qca_debug: Fix ethtool -G iface tx behavior
[ Upstream commit 96a7e861d9e04d07febd3011c30cd84cd141d81f ] 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: 291ab06ecf67 ("net: qualcomm: new Ethernet over SPI driver for QCA7000") Suggested-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Link: https://lore.kernel.org/r/20231206141222.52029-3-wahrenst@gmx.net Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
cbaa34ab8d
commit
7c1588950e
1 changed files with 5 additions and 3 deletions
|
@ -30,6 +30,8 @@
|
||||||
|
|
||||||
#define QCASPI_MAX_REGS 0x20
|
#define QCASPI_MAX_REGS 0x20
|
||||||
|
|
||||||
|
#define QCASPI_RX_MAX_FRAMES 4
|
||||||
|
|
||||||
static const u16 qcaspi_spi_regs[] = {
|
static const u16 qcaspi_spi_regs[] = {
|
||||||
SPI_REG_BFR_SIZE,
|
SPI_REG_BFR_SIZE,
|
||||||
SPI_REG_WRBUF_SPC_AVA,
|
SPI_REG_WRBUF_SPC_AVA,
|
||||||
|
@ -249,9 +251,9 @@ qcaspi_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ring)
|
||||||
{
|
{
|
||||||
struct qcaspi *qca = netdev_priv(dev);
|
struct qcaspi *qca = netdev_priv(dev);
|
||||||
|
|
||||||
ring->rx_max_pending = 4;
|
ring->rx_max_pending = QCASPI_RX_MAX_FRAMES;
|
||||||
ring->tx_max_pending = TX_RING_MAX_LEN;
|
ring->tx_max_pending = TX_RING_MAX_LEN;
|
||||||
ring->rx_pending = 4;
|
ring->rx_pending = QCASPI_RX_MAX_FRAMES;
|
||||||
ring->tx_pending = qca->txr.count;
|
ring->tx_pending = qca->txr.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +262,7 @@ qcaspi_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ring)
|
||||||
{
|
{
|
||||||
struct qcaspi *qca = netdev_priv(dev);
|
struct qcaspi *qca = netdev_priv(dev);
|
||||||
|
|
||||||
if ((ring->rx_pending) ||
|
if (ring->rx_pending != QCASPI_RX_MAX_FRAMES ||
|
||||||
(ring->rx_mini_pending) ||
|
(ring->rx_mini_pending) ||
|
||||||
(ring->rx_jumbo_pending))
|
(ring->rx_jumbo_pending))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
Loading…
Add table
Reference in a new issue