diff options
author | Dmitry Kravkov <dmitry@broadcom.com> | 2010-09-12 01:48:28 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-09-13 23:02:53 -0400 |
commit | 251415808306a19be93ec93268e2985f10d3db8b (patch) | |
tree | 176b64ef9f742ae0ebcfa4eceae44859e01e4a1e /drivers/net/bnx2x/bnx2x_cmn.c | |
parent | 441993da47777d961300c070fe1210600af48ad8 (diff) |
bnx2x: Spread rx buffers between allocated queues
Default number of rx buffers will be divided equally
between allocated queues. This will decrease amount of
pre-allocated buffers on systems with multiple CPUs.
User can override this behavior with ethtool -G.
Minimum amount of rx buffers per queue set to 128.
Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2x/bnx2x_cmn.c')
-rw-r--r-- | drivers/net/bnx2x/bnx2x_cmn.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c index 7f1d291eaaa5..efc7be4aefb5 100644 --- a/drivers/net/bnx2x/bnx2x_cmn.c +++ b/drivers/net/bnx2x/bnx2x_cmn.c | |||
@@ -781,6 +781,10 @@ void bnx2x_init_rx_rings(struct bnx2x *bp) | |||
781 | ETH_MAX_AGGREGATION_QUEUES_E1H; | 781 | ETH_MAX_AGGREGATION_QUEUES_E1H; |
782 | u16 ring_prod, cqe_ring_prod; | 782 | u16 ring_prod, cqe_ring_prod; |
783 | int i, j; | 783 | int i, j; |
784 | int rx_ring_size = bp->rx_ring_size ? bp->rx_ring_size : | ||
785 | MAX_RX_AVAIL/bp->num_queues; | ||
786 | |||
787 | rx_ring_size = max_t(int, MIN_RX_AVAIL, rx_ring_size); | ||
784 | 788 | ||
785 | bp->rx_buf_size = bp->dev->mtu + ETH_OVREHEAD + BNX2X_RX_ALIGN; | 789 | bp->rx_buf_size = bp->dev->mtu + ETH_OVREHEAD + BNX2X_RX_ALIGN; |
786 | DP(NETIF_MSG_IFUP, | 790 | DP(NETIF_MSG_IFUP, |
@@ -883,7 +887,7 @@ void bnx2x_init_rx_rings(struct bnx2x *bp) | |||
883 | /* Allocate BDs and initialize BD ring */ | 887 | /* Allocate BDs and initialize BD ring */ |
884 | fp->rx_comp_cons = 0; | 888 | fp->rx_comp_cons = 0; |
885 | cqe_ring_prod = ring_prod = 0; | 889 | cqe_ring_prod = ring_prod = 0; |
886 | for (i = 0; i < bp->rx_ring_size; i++) { | 890 | for (i = 0; i < rx_ring_size; i++) { |
887 | if (bnx2x_alloc_rx_skb(bp, fp, ring_prod) < 0) { | 891 | if (bnx2x_alloc_rx_skb(bp, fp, ring_prod) < 0) { |
888 | BNX2X_ERR("was only able to allocate " | 892 | BNX2X_ERR("was only able to allocate " |
889 | "%d rx skbs on queue[%d]\n", i, j); | 893 | "%d rx skbs on queue[%d]\n", i, j); |