Skip to content

Commit

Permalink
Merge branch 'bnx2x'
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David S. Miller committed Feb 26, 2014
2 parents 8e165e2 + 94d9de3 commit f2ea0cf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 8 additions & 4 deletions drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f2ea0cf

Please sign in to comment.