bnx2x: Correct ringparam estimate when DOWN
authorMintz, Yuval <Yuval.Mintz@cavium.com>
Sun, 4 Dec 2016 13:30:17 +0000 (15:30 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 20 Jun 2017 12:04:15 +0000 (14:04 +0200)
commitbaaee1b72396821153c6ffaedf04c3422420e0bb
treeef84c9ee8423a2daaffac35191b1a16cae393b9a
parent1d662dc0cc20dc54fd2b43291be66e51675dae8d
bnx2x: Correct ringparam estimate when DOWN

commit 65870fa77fd7f83d7be4ed924d47ed9e3831f434 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: Willy Tarreau <w@1wt.eu>
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c