aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb4/sge.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/cxgb4/sge.c')
-rw-r--r--drivers/net/cxgb4/sge.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/net/cxgb4/sge.c b/drivers/net/cxgb4/sge.c
index 17022258ed68..311471b439a8 100644
--- a/drivers/net/cxgb4/sge.c
+++ b/drivers/net/cxgb4/sge.c
@@ -579,6 +579,7 @@ static inline void __refill_fl(struct adapter *adap, struct sge_fl *fl)
579 * @phys: the physical address of the allocated ring 579 * @phys: the physical address of the allocated ring
580 * @metadata: address of the array holding the SW state for the ring 580 * @metadata: address of the array holding the SW state for the ring
581 * @stat_size: extra space in HW ring for status information 581 * @stat_size: extra space in HW ring for status information
582 * @node: preferred node for memory allocations
582 * 583 *
583 * Allocates resources for an SGE descriptor ring, such as Tx queues, 584 * Allocates resources for an SGE descriptor ring, such as Tx queues,
584 * free buffer lists, or response queues. Each SGE ring requires 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 */
591static void *alloc_ring(struct device *dev, size_t nelem, size_t elem_size, 592static void *alloc_ring(struct device *dev, size_t nelem, size_t elem_size,
592 size_t sw_size, dma_addr_t *phys, void *metadata, 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 size_t len = nelem * elem_size + stat_size; 596 size_t len = nelem * elem_size + stat_size;
596 void *s = NULL; 597 void *s = NULL;
@@ -599,7 +600,7 @@ static void *alloc_ring(struct device *dev, size_t nelem, size_t elem_size,
599 if (!p) 600 if (!p)
600 return NULL; 601 return NULL;
601 if (sw_size) { 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 if (!s) { 605 if (!s) {
605 dma_free_coherent(dev, len, p, *phys); 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 iq->size = roundup(iq->size, 16); 1983 iq->size = roundup(iq->size, 16);
1983 1984
1984 iq->desc = alloc_ring(adap->pdev_dev, iq->size, iq->iqe_len, 0, 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 if (!iq->desc) 1987 if (!iq->desc)
1987 return -ENOMEM; 1988 return -ENOMEM;
1988 1989
@@ -2008,12 +2009,14 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
2008 fl->size = roundup(fl->size, 8); 2009 fl->size = roundup(fl->size, 8);
2009 fl->desc = alloc_ring(adap->pdev_dev, fl->size, sizeof(__be64), 2010 fl->desc = alloc_ring(adap->pdev_dev, fl->size, sizeof(__be64),
2010 sizeof(struct rx_sw_desc), &fl->addr, 2011 sizeof(struct rx_sw_desc), &fl->addr,
2011 &fl->sdesc, STAT_LEN); 2012 &fl->sdesc, STAT_LEN, NUMA_NO_NODE);
2012 if (!fl->desc) 2013 if (!fl->desc)
2013 goto fl_nomem; 2014 goto fl_nomem;
2014 2015
2015 flsz = fl->size / 8 + STAT_LEN / sizeof(struct tx_desc); 2016 flsz = fl->size / 8 + STAT_LEN / sizeof(struct tx_desc);
2016 c.iqns_to_fl0congen = htonl(FW_IQ_CMD_FL0PACKEN | 2017 c.iqns_to_fl0congen = htonl(FW_IQ_CMD_FL0PACKEN |
2018 FW_IQ_CMD_FL0FETCHRO(1) |
2019 FW_IQ_CMD_FL0DATARO(1) |
2017 FW_IQ_CMD_FL0PADEN); 2020 FW_IQ_CMD_FL0PADEN);
2018 c.fl0dcaen_to_fl0cidxfthresh = htons(FW_IQ_CMD_FL0FBMIN(2) | 2021 c.fl0dcaen_to_fl0cidxfthresh = htons(FW_IQ_CMD_FL0FBMIN(2) |
2019 FW_IQ_CMD_FL0FBMAX(3)); 2022 FW_IQ_CMD_FL0FBMAX(3));
@@ -2093,7 +2096,8 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq,
2093 2096
2094 txq->q.desc = alloc_ring(adap->pdev_dev, txq->q.size, 2097 txq->q.desc = alloc_ring(adap->pdev_dev, txq->q.size,
2095 sizeof(struct tx_desc), sizeof(struct tx_sw_desc), 2098 sizeof(struct tx_desc), sizeof(struct tx_sw_desc),
2096 &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));
2097 if (!txq->q.desc) 2101 if (!txq->q.desc)
2098 return -ENOMEM; 2102 return -ENOMEM;
2099 2103
@@ -2106,6 +2110,7 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq,
2106 c.viid_pkd = htonl(FW_EQ_ETH_CMD_VIID(pi->viid)); 2110 c.viid_pkd = htonl(FW_EQ_ETH_CMD_VIID(pi->viid));
2107 c.fetchszm_to_iqid = htonl(FW_EQ_ETH_CMD_HOSTFCMODE(2) | 2111 c.fetchszm_to_iqid = htonl(FW_EQ_ETH_CMD_HOSTFCMODE(2) |
2108 FW_EQ_ETH_CMD_PCIECHN(pi->tx_chan) | 2112 FW_EQ_ETH_CMD_PCIECHN(pi->tx_chan) |
2113 FW_EQ_ETH_CMD_FETCHRO(1) |
2109 FW_EQ_ETH_CMD_IQID(iqid)); 2114 FW_EQ_ETH_CMD_IQID(iqid));
2110 c.dcaen_to_eqsize = htonl(FW_EQ_ETH_CMD_FBMIN(2) | 2115 c.dcaen_to_eqsize = htonl(FW_EQ_ETH_CMD_FBMIN(2) |
2111 FW_EQ_ETH_CMD_FBMAX(3) | 2116 FW_EQ_ETH_CMD_FBMAX(3) |
@@ -2144,7 +2149,7 @@ int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq,
2144 2149
2145 txq->q.desc = alloc_ring(adap->pdev_dev, nentries, 2150 txq->q.desc = alloc_ring(adap->pdev_dev, nentries,
2146 sizeof(struct tx_desc), 0, &txq->q.phys_addr, 2151 sizeof(struct tx_desc), 0, &txq->q.phys_addr,
2147 NULL, 0); 2152 NULL, 0, NUMA_NO_NODE);
2148 if (!txq->q.desc) 2153 if (!txq->q.desc)
2149 return -ENOMEM; 2154 return -ENOMEM;
2150 2155
@@ -2158,6 +2163,7 @@ int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq,
2158 c.physeqid_pkd = htonl(0); 2163 c.physeqid_pkd = htonl(0);
2159 c.fetchszm_to_iqid = htonl(FW_EQ_CTRL_CMD_HOSTFCMODE(2) | 2164 c.fetchszm_to_iqid = htonl(FW_EQ_CTRL_CMD_HOSTFCMODE(2) |
2160 FW_EQ_CTRL_CMD_PCIECHN(pi->tx_chan) | 2165 FW_EQ_CTRL_CMD_PCIECHN(pi->tx_chan) |
2166 FW_EQ_CTRL_CMD_FETCHRO |
2161 FW_EQ_CTRL_CMD_IQID(iqid)); 2167 FW_EQ_CTRL_CMD_IQID(iqid));
2162 c.dcaen_to_eqsize = htonl(FW_EQ_CTRL_CMD_FBMIN(2) | 2168 c.dcaen_to_eqsize = htonl(FW_EQ_CTRL_CMD_FBMIN(2) |
2163 FW_EQ_CTRL_CMD_FBMAX(3) | 2169 FW_EQ_CTRL_CMD_FBMAX(3) |
@@ -2194,7 +2200,8 @@ int t4_sge_alloc_ofld_txq(struct adapter *adap, struct sge_ofld_txq *txq,
2194 2200
2195 txq->q.desc = alloc_ring(adap->pdev_dev, txq->q.size, 2201 txq->q.desc = alloc_ring(adap->pdev_dev, txq->q.size,
2196 sizeof(struct tx_desc), sizeof(struct tx_sw_desc), 2202 sizeof(struct tx_desc), sizeof(struct tx_sw_desc),
2197 &txq->q.phys_addr, &txq->q.sdesc, STAT_LEN); 2203 &txq->q.phys_addr, &txq->q.sdesc, STAT_LEN,
2204 NUMA_NO_NODE);
2198 if (!txq->q.desc) 2205 if (!txq->q.desc)
2199 return -ENOMEM; 2206 return -ENOMEM;
2200 2207
@@ -2207,6 +2214,7 @@ int t4_sge_alloc_ofld_txq(struct adapter *adap, struct sge_ofld_txq *txq,
2207 FW_EQ_OFLD_CMD_EQSTART | FW_LEN16(c)); 2214 FW_EQ_OFLD_CMD_EQSTART | FW_LEN16(c));
2208 c.fetchszm_to_iqid = htonl(FW_EQ_OFLD_CMD_HOSTFCMODE(2) | 2215 c.fetchszm_to_iqid = htonl(FW_EQ_OFLD_CMD_HOSTFCMODE(2) |
2209 FW_EQ_OFLD_CMD_PCIECHN(pi->tx_chan) | 2216 FW_EQ_OFLD_CMD_PCIECHN(pi->tx_chan) |
2217 FW_EQ_OFLD_CMD_FETCHRO(1) |
2210 FW_EQ_OFLD_CMD_IQID(iqid)); 2218 FW_EQ_OFLD_CMD_IQID(iqid));
2211 c.dcaen_to_eqsize = htonl(FW_EQ_OFLD_CMD_FBMIN(2) | 2219 c.dcaen_to_eqsize = htonl(FW_EQ_OFLD_CMD_FBMIN(2) |
2212 FW_EQ_OFLD_CMD_FBMAX(3) | 2220 FW_EQ_OFLD_CMD_FBMAX(3) |