* [dpdk-stable] [PATCH v2] net/ena: fix assigning NUMA node to IO queue [not found] <1559644299-28575-1-git-send-email-mk@semihalf.com> @ 2019-06-04 10:42 ` Michal Krawczyk 2019-06-04 10:47 ` David Marchand 0 siblings, 1 reply; 4+ messages in thread From: Michal Krawczyk @ 2019-06-04 10:42 UTC (permalink / raw) To: dev Cc: mw, gtzalik, evgenys, matua, igorch, anatoly.burakov, Michal Krawczyk, stable Previous solution was using memzones in invalid way in hope to assign IO queue to the appropriate NUMA zone. The right way is to use socket_id from the rx/tx queue setup function and then pass it to the IO queue. Fixes: 3d3edc265fc8 ("net/ena: make coherent memory allocation NUMA-aware") Cc: stable@dpdk.org Signed-off-by: Michal Krawczyk <mk@semihalf.com> --- v2: * Remove gerrit change id * Add dpdk-stable to cc drivers/net/ena/ena_ethdev.c | 24 +++++------------------- drivers/net/ena/ena_ethdev.h | 2 ++ 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index b6651fc..e9ccb04 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -272,22 +272,6 @@ static const struct eth_dev_ops ena_dev_ops = { .reta_query = ena_rss_reta_query, }; -#define NUMA_NO_NODE SOCKET_ID_ANY - -static inline int ena_cpu_to_node(int cpu) -{ - struct rte_config *config = rte_eal_get_configuration(); - struct rte_fbarray *arr = &config->mem_config->memzones; - const struct rte_memzone *mz; - - if (unlikely(cpu >= RTE_MAX_MEMZONE)) - return NUMA_NO_NODE; - - mz = rte_fbarray_get(arr, cpu); - - return mz->socket_id; -} - static inline void ena_rx_mbuf_prepare(struct rte_mbuf *mbuf, struct ena_com_rx_ctx *ena_rx_ctx) { @@ -1126,7 +1110,7 @@ static int ena_create_io_queue(struct ena_ring *ring) } ctx.qid = ena_qid; ctx.msix_vector = -1; /* interrupts not used */ - ctx.numa_node = ena_cpu_to_node(ring->id); + ctx.numa_node = ring->numa_socket_id; rc = ena_com_create_io_queue(ena_dev, &ctx); if (rc) { @@ -1224,7 +1208,7 @@ static int ena_queue_start(struct ena_ring *ring) static int ena_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, uint16_t nb_desc, - __rte_unused unsigned int socket_id, + unsigned int socket_id, const struct rte_eth_txconf *tx_conf) { struct ena_ring *txq = NULL; @@ -1262,6 +1246,7 @@ static int ena_tx_queue_setup(struct rte_eth_dev *dev, txq->next_to_clean = 0; txq->next_to_use = 0; txq->ring_size = nb_desc; + txq->numa_socket_id = socket_id; txq->tx_buffer_info = rte_zmalloc("txq->tx_buffer_info", sizeof(struct ena_tx_buffer) * @@ -1309,7 +1294,7 @@ static int ena_tx_queue_setup(struct rte_eth_dev *dev, static int ena_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, uint16_t nb_desc, - __rte_unused unsigned int socket_id, + unsigned int socket_id, __rte_unused const struct rte_eth_rxconf *rx_conf, struct rte_mempool *mp) { @@ -1347,6 +1332,7 @@ static int ena_rx_queue_setup(struct rte_eth_dev *dev, rxq->next_to_clean = 0; rxq->next_to_use = 0; rxq->ring_size = nb_desc; + rxq->numa_socket_id = socket_id; rxq->mb_pool = mp; rxq->rx_buffer_info = rte_zmalloc("rxq->buffer_info", diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h index dcc8690..9067e90 100644 --- a/drivers/net/ena/ena_ethdev.h +++ b/drivers/net/ena/ena_ethdev.h @@ -143,6 +143,8 @@ struct ena_ring { struct ena_stats_rx rx_stats; struct ena_stats_tx tx_stats; }; + + unsigned int numa_socket_id; } __rte_cache_aligned; enum ena_adapter_state { -- 2.7.4 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-stable] [PATCH v2] net/ena: fix assigning NUMA node to IO queue 2019-06-04 10:42 ` [dpdk-stable] [PATCH v2] net/ena: fix assigning NUMA node to IO queue Michal Krawczyk @ 2019-06-04 10:47 ` David Marchand 2019-06-04 10:59 ` [dpdk-stable] [PATCH v3] " Michal Krawczyk 0 siblings, 1 reply; 4+ messages in thread From: David Marchand @ 2019-06-04 10:47 UTC (permalink / raw) To: Michal Krawczyk Cc: dev, Marcin Wojtas, gtzalik, evgenys, matua, igorch, Burakov, Anatoly, dpdk stable On Tue, Jun 4, 2019 at 12:43 PM Michal Krawczyk <mk@semihalf.com> wrote: > Previous solution was using memzones in invalid way in hope to assign > IO queue to the appropriate NUMA zone. > > The right way is to use socket_id from the rx/tx queue setup function > and then pass it to the IO queue. > > Fixes: 3d3edc265fc8 ("net/ena: make coherent memory allocation NUMA-aware") > Cc: stable@dpdk.org > > Signed-off-by: Michal Krawczyk <mk@semihalf.com> > --- > v2: > * Remove gerrit change id > * Add dpdk-stable to cc > > drivers/net/ena/ena_ethdev.c | 24 +++++------------------- > drivers/net/ena/ena_ethdev.h | 2 ++ > 2 files changed, 7 insertions(+), 19 deletions(-) > > diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c > index b6651fc..e9ccb04 100644 > --- a/drivers/net/ena/ena_ethdev.c > +++ b/drivers/net/ena/ena_ethdev.c > @@ -272,22 +272,6 @@ static const struct eth_dev_ops ena_dev_ops = { > .reta_query = ena_rss_reta_query, > }; > > -#define NUMA_NO_NODE SOCKET_ID_ANY > - > -static inline int ena_cpu_to_node(int cpu) > -{ > - struct rte_config *config = rte_eal_get_configuration(); > - struct rte_fbarray *arr = &config->mem_config->memzones; > - const struct rte_memzone *mz; > - > - if (unlikely(cpu >= RTE_MAX_MEMZONE)) > - return NUMA_NO_NODE; > - > - mz = rte_fbarray_get(arr, cpu); > - > - return mz->socket_id; > -} > - > I suppose you can remove the rte_eal_memconfig.h header inclusion now. static inline void ena_rx_mbuf_prepare(struct rte_mbuf *mbuf, > struct ena_com_rx_ctx *ena_rx_ctx) > { > @@ -1126,7 +1110,7 @@ static int ena_create_io_queue(struct ena_ring *ring) > } > ctx.qid = ena_qid; > ctx.msix_vector = -1; /* interrupts not used */ > - ctx.numa_node = ena_cpu_to_node(ring->id); > + ctx.numa_node = ring->numa_socket_id; > > rc = ena_com_create_io_queue(ena_dev, &ctx); > if (rc) { > @@ -1224,7 +1208,7 @@ static int ena_queue_start(struct ena_ring *ring) > static int ena_tx_queue_setup(struct rte_eth_dev *dev, > uint16_t queue_idx, > uint16_t nb_desc, > - __rte_unused unsigned int socket_id, > + unsigned int socket_id, > const struct rte_eth_txconf *tx_conf) > { > struct ena_ring *txq = NULL; > @@ -1262,6 +1246,7 @@ static int ena_tx_queue_setup(struct rte_eth_dev > *dev, > txq->next_to_clean = 0; > txq->next_to_use = 0; > txq->ring_size = nb_desc; > + txq->numa_socket_id = socket_id; > > txq->tx_buffer_info = rte_zmalloc("txq->tx_buffer_info", > sizeof(struct ena_tx_buffer) * > @@ -1309,7 +1294,7 @@ static int ena_tx_queue_setup(struct rte_eth_dev > *dev, > static int ena_rx_queue_setup(struct rte_eth_dev *dev, > uint16_t queue_idx, > uint16_t nb_desc, > - __rte_unused unsigned int socket_id, > + unsigned int socket_id, > __rte_unused const struct rte_eth_rxconf > *rx_conf, > struct rte_mempool *mp) > { > @@ -1347,6 +1332,7 @@ static int ena_rx_queue_setup(struct rte_eth_dev > *dev, > rxq->next_to_clean = 0; > rxq->next_to_use = 0; > rxq->ring_size = nb_desc; > + rxq->numa_socket_id = socket_id; > rxq->mb_pool = mp; > > rxq->rx_buffer_info = rte_zmalloc("rxq->buffer_info", > diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h > index dcc8690..9067e90 100644 > --- a/drivers/net/ena/ena_ethdev.h > +++ b/drivers/net/ena/ena_ethdev.h > @@ -143,6 +143,8 @@ struct ena_ring { > struct ena_stats_rx rx_stats; > struct ena_stats_tx tx_stats; > }; > + > + unsigned int numa_socket_id; > } __rte_cache_aligned; > > enum ena_adapter_state { > -- > 2.7.4 > > Reviewed-by: David Marchand <david.marchand@redhat.com> -- David Marchand ^ permalink raw reply [flat|nested] 4+ messages in thread
* [dpdk-stable] [PATCH v3] net/ena: fix assigning NUMA node to IO queue 2019-06-04 10:47 ` David Marchand @ 2019-06-04 10:59 ` Michal Krawczyk 2019-06-10 17:47 ` Ferruh Yigit 0 siblings, 1 reply; 4+ messages in thread From: Michal Krawczyk @ 2019-06-04 10:59 UTC (permalink / raw) To: dev, david.marchand Cc: mw, gtzalik, evgenys, matua, igorch, anatoly.burakov, Michal Krawczyk, stable Previous solution was using memzones in invalid way in hope to assign IO queue to the appropriate NUMA zone. The right way is to use socket_id from the rx/tx queue setup function and then pass it to the IO queue. Fixes: 3d3edc265fc8 ("net/ena: make coherent memory allocation NUMA-aware") Cc: stable@dpdk.org Signed-off-by: Michal Krawczyk <mk@semihalf.com> Reviewed-by: David Marchand <david.marchand@redhat.com> --- v3: * Remove rte_eal_memconfig.h header inclusion v2: * Remove gerrit change id * Add dpdk-stable to cc drivers/net/ena/ena_ethdev.c | 25 +++++-------------------- drivers/net/ena/ena_ethdev.h | 2 ++ 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index b6651fc..6f4734e 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -40,7 +40,6 @@ #include <rte_dev.h> #include <rte_errno.h> #include <rte_version.h> -#include <rte_eal_memconfig.h> #include <rte_net.h> #include "ena_ethdev.h" @@ -272,22 +271,6 @@ static const struct eth_dev_ops ena_dev_ops = { .reta_query = ena_rss_reta_query, }; -#define NUMA_NO_NODE SOCKET_ID_ANY - -static inline int ena_cpu_to_node(int cpu) -{ - struct rte_config *config = rte_eal_get_configuration(); - struct rte_fbarray *arr = &config->mem_config->memzones; - const struct rte_memzone *mz; - - if (unlikely(cpu >= RTE_MAX_MEMZONE)) - return NUMA_NO_NODE; - - mz = rte_fbarray_get(arr, cpu); - - return mz->socket_id; -} - static inline void ena_rx_mbuf_prepare(struct rte_mbuf *mbuf, struct ena_com_rx_ctx *ena_rx_ctx) { @@ -1126,7 +1109,7 @@ static int ena_create_io_queue(struct ena_ring *ring) } ctx.qid = ena_qid; ctx.msix_vector = -1; /* interrupts not used */ - ctx.numa_node = ena_cpu_to_node(ring->id); + ctx.numa_node = ring->numa_socket_id; rc = ena_com_create_io_queue(ena_dev, &ctx); if (rc) { @@ -1224,7 +1207,7 @@ static int ena_queue_start(struct ena_ring *ring) static int ena_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, uint16_t nb_desc, - __rte_unused unsigned int socket_id, + unsigned int socket_id, const struct rte_eth_txconf *tx_conf) { struct ena_ring *txq = NULL; @@ -1262,6 +1245,7 @@ static int ena_tx_queue_setup(struct rte_eth_dev *dev, txq->next_to_clean = 0; txq->next_to_use = 0; txq->ring_size = nb_desc; + txq->numa_socket_id = socket_id; txq->tx_buffer_info = rte_zmalloc("txq->tx_buffer_info", sizeof(struct ena_tx_buffer) * @@ -1309,7 +1293,7 @@ static int ena_tx_queue_setup(struct rte_eth_dev *dev, static int ena_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, uint16_t nb_desc, - __rte_unused unsigned int socket_id, + unsigned int socket_id, __rte_unused const struct rte_eth_rxconf *rx_conf, struct rte_mempool *mp) { @@ -1347,6 +1331,7 @@ static int ena_rx_queue_setup(struct rte_eth_dev *dev, rxq->next_to_clean = 0; rxq->next_to_use = 0; rxq->ring_size = nb_desc; + rxq->numa_socket_id = socket_id; rxq->mb_pool = mp; rxq->rx_buffer_info = rte_zmalloc("rxq->buffer_info", diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h index dcc8690..9067e90 100644 --- a/drivers/net/ena/ena_ethdev.h +++ b/drivers/net/ena/ena_ethdev.h @@ -143,6 +143,8 @@ struct ena_ring { struct ena_stats_rx rx_stats; struct ena_stats_tx tx_stats; }; + + unsigned int numa_socket_id; } __rte_cache_aligned; enum ena_adapter_state { -- 2.7.4 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-stable] [PATCH v3] net/ena: fix assigning NUMA node to IO queue 2019-06-04 10:59 ` [dpdk-stable] [PATCH v3] " Michal Krawczyk @ 2019-06-10 17:47 ` Ferruh Yigit 0 siblings, 0 replies; 4+ messages in thread From: Ferruh Yigit @ 2019-06-10 17:47 UTC (permalink / raw) To: Michal Krawczyk, dev, david.marchand Cc: mw, gtzalik, evgenys, matua, igorch, anatoly.burakov, stable On 6/4/2019 11:59 AM, Michal Krawczyk wrote: > Previous solution was using memzones in invalid way in hope to assign > IO queue to the appropriate NUMA zone. > > The right way is to use socket_id from the rx/tx queue setup function > and then pass it to the IO queue. > > Fixes: 3d3edc265fc8 ("net/ena: make coherent memory allocation NUMA-aware") > Cc: stable@dpdk.org > > Signed-off-by: Michal Krawczyk <mk@semihalf.com> > Reviewed-by: David Marchand <david.marchand@redhat.com> Applied to dpdk-next-net/master, thanks. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-06-10 17:48 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <1559644299-28575-1-git-send-email-mk@semihalf.com> 2019-06-04 10:42 ` [dpdk-stable] [PATCH v2] net/ena: fix assigning NUMA node to IO queue Michal Krawczyk 2019-06-04 10:47 ` David Marchand 2019-06-04 10:59 ` [dpdk-stable] [PATCH v3] " Michal Krawczyk 2019-06-10 17:47 ` Ferruh Yigit
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).