aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMintz, Yuval <Yuval.Mintz@cavium.com>2016-12-04 08:30:17 -0500
committerDavid S. Miller <davem@davemloft.net>2016-12-05 15:08:39 -0500
commit65870fa77fd7f83d7be4ed924d47ed9e3831f434 (patch)
treeb9590fba709353e6a68cc3f31ba07d24737c25cd
parent9a53682b340b97642793271ba095cc9531a7b649 (diff)
bnx2x: Correct ringparam estimate when DOWN
Until interface is up [and assuming ringparams weren't explicitly configured] when queried for the size of its rings bnx2x would claim they're the maximal size by default. That is incorrect as by default the maximal number of buffers would be equally divided between the various rx rings. This prevents the user from actually setting the number of elements on each rx ring to be of maximal size prior to transitioning the interface into up state. To fix this, make a rough estimation about the number of buffers. It wouldn't always be accurate, but it would be much better than current estimation and would allow users to increase number of buffers during early initialization of the interface. Reported-by: Seymour, Shane <shane.seymour@hpe.com> Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
index 85a7800bfc12..5f19427c7b27 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
@@ -1872,8 +1872,16 @@ static void bnx2x_get_ringparam(struct net_device *dev,
1872 1872
1873 ering->rx_max_pending = MAX_RX_AVAIL; 1873 ering->rx_max_pending = MAX_RX_AVAIL;
1874 1874
1875 /* If size isn't already set, we give an estimation of the number
1876 * of buffers we'll have. We're neglecting some possible conditions
1877 * [we couldn't know for certain at this point if number of queues
1878 * might shrink] but the number would be correct for the likely
1879 * scenario.
1880 */
1875 if (bp->rx_ring_size) 1881 if (bp->rx_ring_size)
1876 ering->rx_pending = bp->rx_ring_size; 1882 ering->rx_pending = bp->rx_ring_size;
1883 else if (BNX2X_NUM_RX_QUEUES(bp))
1884 ering->rx_pending = MAX_RX_AVAIL / BNX2X_NUM_RX_QUEUES(bp);
1877 else 1885 else
1878 ering->rx_pending = MAX_RX_AVAIL; 1886 ering->rx_pending = MAX_RX_AVAIL;
1879 1887