@@ -579,6 +579,7 @@ static inline void __refill_fl(struct adapter *adap, struct sge_fl *fl)
579
579
* @phys: the physical address of the allocated ring
580
580
* @metadata: address of the array holding the SW state for the ring
581
581
* @stat_size: extra space in HW ring for status information
582
+ * @node: preferred node for memory allocations
582
583
*
583
584
* Allocates resources for an SGE descriptor ring, such as Tx queues,
584
585
* 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)
590
591
*/
591
592
static void * alloc_ring (struct device * dev , size_t nelem , size_t elem_size ,
592
593
size_t sw_size , dma_addr_t * phys , void * metadata ,
593
- size_t stat_size )
594
+ size_t stat_size , int node )
594
595
{
595
596
size_t len = nelem * elem_size + stat_size ;
596
597
void * s = NULL ;
@@ -599,7 +600,7 @@ static void *alloc_ring(struct device *dev, size_t nelem, size_t elem_size,
599
600
if (!p )
600
601
return NULL ;
601
602
if (sw_size ) {
602
- s = kcalloc (nelem , sw_size , GFP_KERNEL );
603
+ s = kzalloc_node (nelem * sw_size , GFP_KERNEL , node );
603
604
604
605
if (!s ) {
605
606
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,
1982
1983
iq -> size = roundup (iq -> size , 16 );
1983
1984
1984
1985
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 );
1986
1987
if (!iq -> desc )
1987
1988
return - ENOMEM ;
1988
1989
@@ -2008,7 +2009,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
2008
2009
fl -> size = roundup (fl -> size , 8 );
2009
2010
fl -> desc = alloc_ring (adap -> pdev_dev , fl -> size , sizeof (__be64 ),
2010
2011
sizeof (struct rx_sw_desc ), & fl -> addr ,
2011
- & fl -> sdesc , STAT_LEN );
2012
+ & fl -> sdesc , STAT_LEN , NUMA_NO_NODE );
2012
2013
if (!fl -> desc )
2013
2014
goto fl_nomem ;
2014
2015
@@ -2095,7 +2096,8 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq,
2095
2096
2096
2097
txq -> q .desc = alloc_ring (adap -> pdev_dev , txq -> q .size ,
2097
2098
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 ));
2099
2101
if (!txq -> q .desc )
2100
2102
return - ENOMEM ;
2101
2103
@@ -2147,7 +2149,7 @@ int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq,
2147
2149
2148
2150
txq -> q .desc = alloc_ring (adap -> pdev_dev , nentries ,
2149
2151
sizeof (struct tx_desc ), 0 , & txq -> q .phys_addr ,
2150
- NULL , 0 );
2152
+ NULL , 0 , NUMA_NO_NODE );
2151
2153
if (!txq -> q .desc )
2152
2154
return - ENOMEM ;
2153
2155
@@ -2198,7 +2200,8 @@ int t4_sge_alloc_ofld_txq(struct adapter *adap, struct sge_ofld_txq *txq,
2198
2200
2199
2201
txq -> q .desc = alloc_ring (adap -> pdev_dev , txq -> q .size ,
2200
2202
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 );
2202
2205
if (!txq -> q .desc )
2203
2206
return - ENOMEM ;
2204
2207
0 commit comments