Skip to content

Commit ad6bad3

Browse files
Dimitris Michailidisdavem330
authored andcommitted
cxgb4: NUMA-aware Tx queue allocations
Allocate Tx queue memory on the node indicated by the new netdev_queue_numa_node_read. Signed-off-by: Dimitris Michailidis <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 23d88e1 commit ad6bad3

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

drivers/net/cxgb4/sge.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,7 @@ static inline void __refill_fl(struct adapter *adap, struct sge_fl *fl)
579579
* @phys: the physical address of the allocated ring
580580
* @metadata: address of the array holding the SW state for the ring
581581
* @stat_size: extra space in HW ring for status information
582+
* @node: preferred node for memory allocations
582583
*
583584
* Allocates resources for an SGE descriptor ring, such as Tx queues,
584585
* free buffer lists, or response queues. Each SGE ring requires
@@ -590,7 +591,7 @@ static inline void __refill_fl(struct adapter *adap, struct sge_fl *fl)
590591
*/
591592
static void *alloc_ring(struct device *dev, size_t nelem, size_t elem_size,
592593
size_t sw_size, dma_addr_t *phys, void *metadata,
593-
size_t stat_size)
594+
size_t stat_size, int node)
594595
{
595596
size_t len = nelem * elem_size + stat_size;
596597
void *s = NULL;
@@ -599,7 +600,7 @@ static void *alloc_ring(struct device *dev, size_t nelem, size_t elem_size,
599600
if (!p)
600601
return NULL;
601602
if (sw_size) {
602-
s = kcalloc(nelem, sw_size, GFP_KERNEL);
603+
s = kzalloc_node(nelem * sw_size, GFP_KERNEL, node);
603604

604605
if (!s) {
605606
dma_free_coherent(dev, len, p, *phys);
@@ -1982,7 +1983,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
19821983
iq->size = roundup(iq->size, 16);
19831984

19841985
iq->desc = alloc_ring(adap->pdev_dev, iq->size, iq->iqe_len, 0,
1985-
&iq->phys_addr, NULL, 0);
1986+
&iq->phys_addr, NULL, 0, NUMA_NO_NODE);
19861987
if (!iq->desc)
19871988
return -ENOMEM;
19881989

@@ -2008,7 +2009,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
20082009
fl->size = roundup(fl->size, 8);
20092010
fl->desc = alloc_ring(adap->pdev_dev, fl->size, sizeof(__be64),
20102011
sizeof(struct rx_sw_desc), &fl->addr,
2011-
&fl->sdesc, STAT_LEN);
2012+
&fl->sdesc, STAT_LEN, NUMA_NO_NODE);
20122013
if (!fl->desc)
20132014
goto fl_nomem;
20142015

@@ -2095,7 +2096,8 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq,
20952096

20962097
txq->q.desc = alloc_ring(adap->pdev_dev, txq->q.size,
20972098
sizeof(struct tx_desc), sizeof(struct tx_sw_desc),
2098-
&txq->q.phys_addr, &txq->q.sdesc, STAT_LEN);
2099+
&txq->q.phys_addr, &txq->q.sdesc, STAT_LEN,
2100+
netdev_queue_numa_node_read(netdevq));
20992101
if (!txq->q.desc)
21002102
return -ENOMEM;
21012103

@@ -2147,7 +2149,7 @@ int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq,
21472149

21482150
txq->q.desc = alloc_ring(adap->pdev_dev, nentries,
21492151
sizeof(struct tx_desc), 0, &txq->q.phys_addr,
2150-
NULL, 0);
2152+
NULL, 0, NUMA_NO_NODE);
21512153
if (!txq->q.desc)
21522154
return -ENOMEM;
21532155

@@ -2198,7 +2200,8 @@ int t4_sge_alloc_ofld_txq(struct adapter *adap, struct sge_ofld_txq *txq,
21982200

21992201
txq->q.desc = alloc_ring(adap->pdev_dev, txq->q.size,
22002202
sizeof(struct tx_desc), sizeof(struct tx_sw_desc),
2201-
&txq->q.phys_addr, &txq->q.sdesc, STAT_LEN);
2203+
&txq->q.phys_addr, &txq->q.sdesc, STAT_LEN,
2204+
NUMA_NO_NODE);
22022205
if (!txq->q.desc)
22032206
return -ENOMEM;
22042207

0 commit comments

Comments
 (0)