Skip to content

Commit

Permalink
bnx2x: Correct ringparam estimate when DOWN
Browse files Browse the repository at this point in the history
commit 65870fa upstream.

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>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
  • Loading branch information
Mintz, Yuval authored and Jiri Slaby committed Jan 27, 2017
1 parent b6580bd commit 05dc5c8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -1776,8 +1776,16 @@ static void bnx2x_get_ringparam(struct net_device *dev,

ering->rx_max_pending = MAX_RX_AVAIL;

/* If size isn't already set, we give an estimation of the number
* of buffers we'll have. We're neglecting some possible conditions
* [we couldn't know for certain at this point if number of queues
* might shrink] but the number would be correct for the likely
* scenario.
*/
if (bp->rx_ring_size)
ering->rx_pending = bp->rx_ring_size;
else if (BNX2X_NUM_RX_QUEUES(bp))
ering->rx_pending = MAX_RX_AVAIL / BNX2X_NUM_RX_QUEUES(bp);
else
ering->rx_pending = MAX_RX_AVAIL;

Expand Down

0 comments on commit 05dc5c8

Please sign in to comment.