summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-02-26 15:28:08 -0500
committerDavid S. Miller <davem@davemloft.net>2014-02-26 15:28:08 -0500
commitf2ea0cfd6b5fb7daf4cf48bdc364f1cf9ef55d0c (patch)
tree0a543a0f2f3717659320a29201ac14f6ecf25c6b
parent8e165e20348b53583f6c6cb45865b89209f4aa13 (diff)
parent94d9de3cf7b7902253e65d7aef30f2db051c1ac6 (diff)
Merge branch 'bnx2x'
Michal Schmidt says: ==================== bnx2x: minimize RAM usage in kdump kdump kernels usually have only a small amount of memory reserved. bnx2x can be memory-hungry. Let's minimize its memory usage when running in kdump. I detect kdump by looking at the "reset_devices" flag. A couple of storage drivers (cciss, hpsa) use it for the same purpose. I am not sure this is the best way to solve the problem, but it works. Should it be made more generic by, say, looking at the total amount of lowmem instead? Not using TPA by default when lowmem is small and/or defaulting to fewer queues would help 32bit systems where a driver for a multi-function multi-queue NIC can consume a significant amount of available memory. Or do we want no such heuristics? Is this something to consider doing for other network drivers too? ==================== Acked-by: Ariel Elior <ariele@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c12
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c2
2 files changed, 10 insertions, 4 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 89d75c24335c..26bc25bd465d 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -61,10 +61,14 @@ static void bnx2x_add_all_napi(struct bnx2x *bp)
static int bnx2x_calc_num_queues(struct bnx2x *bp)
{
- return bnx2x_num_queues ?
- min_t(int, bnx2x_num_queues, BNX2X_MAX_QUEUES(bp)) :
- min_t(int, netif_get_num_default_rss_queues(),
- BNX2X_MAX_QUEUES(bp));
+ int nq = bnx2x_num_queues ? : netif_get_num_default_rss_queues();
+
+ /* Reduce memory usage in kdump environment by using only one queue */
+ if (reset_devices)
+ nq = 1;
+
+ nq = clamp(nq, 1, BNX2X_MAX_QUEUES(bp));
+ return nq;
}
/**
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 230dea623895..5e74599b05c7 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -11804,6 +11804,8 @@ static int bnx2x_init_bp(struct bnx2x *bp)
bp->disable_tpa = disable_tpa;
bp->disable_tpa |= IS_MF_STORAGE_SD(bp) || IS_MF_FCOE_AFEX(bp);
+ /* Reduce memory usage in kdump environment by disabling TPA */
+ bp->disable_tpa |= reset_devices;
/* Set TPA flags */
if (bp->disable_tpa) {