From patchwork Tue Jun 4 10:59:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Krawczyk X-Patchwork-Id: 54353 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 963DC1BC1E; Tue, 4 Jun 2019 12:59:51 +0200 (CEST) Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com [209.85.167.68]) by dpdk.org (Postfix) with ESMTP id E4E0E1BC15 for ; Tue, 4 Jun 2019 12:59:49 +0200 (CEST) Received: by mail-lf1-f68.google.com with SMTP id r15so16083193lfm.11 for ; Tue, 04 Jun 2019 03:59:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8xHVbLyDSuK55awOozCJ3Y6gWFcaldUX8Ozh2Z/iK8M=; b=HYL2XDfo6F9hNQfGiH6nQPUyZBQyjOfX1PKM+YTQmXOGc2NBI2TaTXlY6uUjVsg+CU I3X4jiJQKB0ZafmK8sYy/+GMDSRYrgX8J653/d4JRJuSFfhh6EdEfNiJgRqEnmMYui2X aE9acU8e0lDZLNCAyYqA+tqB1C+XfV4NFNOo3e790lbRtX+DIW8/xVWFQ5Gx0R6NJgZb fkLpL8bWL74rbt/1OiVun0Batrdbt0tHYHrRek0GtQN5tAraWGYokTwYowL3ezeUudka 6Sysj/gHWgL/+OXZgJFLMsc3dg7nItpqb3zBhtXz6I8xSurYoFh1qofinbTMrZVxBlFy 5XAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8xHVbLyDSuK55awOozCJ3Y6gWFcaldUX8Ozh2Z/iK8M=; b=dHMIiu+DFKMxau+IGyrhGtFwZNHc/kRlVWMsfoq2zJyt5j9ExNfldQzHcFX8e9ySBd UiBmcWDhCYCoe/1BCQ+LyJBWsB7PEBcSqrdyJPQwUKODUMb0KeXtweU8CKChvDJtT8ej 9sNa1ntuOug2wy7jeSMMkFokP9zF24b6kbo5wA8nP2VoUluZMVIv3OA9GmXTGR8ppgDu EiIuRfJ/fFb7b1yWI5EAqWEYC/3etXF4d9EQI4fCqcskqt2Z/v5PpLQmcNIYj9+QTJdK Ws0dW1rpxc4HfZRnH7Woyq+wPe5upBcc65JOK67xCbr8AkTlOS5kHqzkSpCDTpUnvslV s7Hw== X-Gm-Message-State: APjAAAVbfjnpNLcrfLo/1/f/Mcq3WnupAAyCa7tLu9rCLxNZkN3pYpfV FzUX7QJ4wlUqT5N5W+BVfNCfu6rpJRE= X-Google-Smtp-Source: APXvYqx6m/23PnnCR78LrsEB8WbTk5pi5ISbwEOmyrJ1NycHjkf2GaDfTbN57/mtnTDHNVSt2NJBBw== X-Received: by 2002:a19:4017:: with SMTP id n23mr17702005lfa.112.1559645989208; Tue, 04 Jun 2019 03:59:49 -0700 (PDT) Received: from localhost.localdomain ([185.157.12.197]) by smtp.gmail.com with ESMTPSA id d2sm3669794lfh.1.2019.06.04.03.59.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Jun 2019 03:59:48 -0700 (PDT) From: Michal Krawczyk To: dev@dpdk.org, david.marchand@redhat.com Cc: mw@semihalf.com, gtzalik@amazon.com, evgenys@amazon.com, matua@amazon.com, igorch@amazon.com, anatoly.burakov@intel.com, Michal Krawczyk , stable@dpdk.org Date: Tue, 4 Jun 2019 12:59:36 +0200 Message-Id: <1559645976-26659-1-git-send-email-mk@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v3] net/ena: fix assigning NUMA node to IO queue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Reviewed-by: David Marchand --- 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 #include #include -#include #include #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 {