cxgb4: Fix number of queue sets corssing the limit
authorGanesh Goudar <ganeshgr@chelsio.com>
Tue, 18 Oct 2016 08:51:25 +0000 (14:21 +0530)
committerDavid S. Miller <davem@davemloft.net>
Tue, 18 Oct 2016 14:32:39 +0000 (10:32 -0400)
Do not let number of offload queue sets to go more than
MAX_OFLD_QSETS, which would otherwise crash the driver
on machines with cores more than MAX_OFLD_QSETS.

Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c

index f320497368f401deb36a3c1b93d0e288208a7fec..57eb4e1345cb00a49666d1ff147aa4ef971d3d26 100644 (file)
@@ -4057,7 +4057,7 @@ static void cfg_queues(struct adapter *adap)
                 * capped by the number of available cores.
                 */
                if (n10g) {
-                       i = num_online_cpus();
+                       i = min_t(int, MAX_OFLD_QSETS, num_online_cpus());
                        s->ofldqsets = roundup(i, adap->params.nports);
                } else {
                        s->ofldqsets = adap->params.nports;