Skip to content

Commit 96a7e86

Browse files
lategoodbyekuba-moo
authored andcommitted
qca_debug: Fix ethtool -G iface tx behavior
After calling ethtool -g it was not possible to adjust the TX ring size again: # ethtool -g eth1 Ring parameters for eth1: Pre-set maximums: RX: 4 RX Mini: n/a RX Jumbo: n/a TX: 10 Current hardware settings: RX: 4 RX Mini: n/a RX Jumbo: n/a TX: 10 # ethtool -G eth1 tx 8 netlink error: Invalid argument The reason for this is that the readonly setting rx_pending get initialized and after that the range check in qcaspi_set_ringparam() fails regardless of the provided parameter. So fix this by accepting the exposed RX defaults. Instead of adding another magic number better use a new define here. Fixes: 291ab06 ("net: qualcomm: new Ethernet over SPI driver for QCA7000") Suggested-by: Paolo Abeni <[email protected]> Signed-off-by: Stefan Wahren <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent f4e6064 commit 96a7e86

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/net/ethernet/qualcomm/qca_debug.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
#define QCASPI_MAX_REGS 0x20
3232

33+
#define QCASPI_RX_MAX_FRAMES 4
34+
3335
static const u16 qcaspi_spi_regs[] = {
3436
SPI_REG_BFR_SIZE,
3537
SPI_REG_WRBUF_SPC_AVA,
@@ -252,9 +254,9 @@ qcaspi_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ring,
252254
{
253255
struct qcaspi *qca = netdev_priv(dev);
254256

255-
ring->rx_max_pending = 4;
257+
ring->rx_max_pending = QCASPI_RX_MAX_FRAMES;
256258
ring->tx_max_pending = TX_RING_MAX_LEN;
257-
ring->rx_pending = 4;
259+
ring->rx_pending = QCASPI_RX_MAX_FRAMES;
258260
ring->tx_pending = qca->txr.count;
259261
}
260262

@@ -265,7 +267,7 @@ qcaspi_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ring,
265267
{
266268
struct qcaspi *qca = netdev_priv(dev);
267269

268-
if ((ring->rx_pending) ||
270+
if (ring->rx_pending != QCASPI_RX_MAX_FRAMES ||
269271
(ring->rx_mini_pending) ||
270272
(ring->rx_jumbo_pending))
271273
return -EINVAL;

0 commit comments

Comments
 (0)