DPDK patches and discussions
 help / color / mirror / Atom feed
From: Michal Krawczyk <mk@semihalf.com>
To: ferruh.yigit@intel.com
Cc: dev@dpdk.org, upstream@semihalf.com, shaibran@amazon.com,
	ndagan@amazon.com, igorch@amazon.com,
	Michal Krawczyk <mk@semihalf.com>
Subject: [dpdk-dev] [PATCH v3 5/7] net/ena: add NUMA aware allocations
Date: Tue, 19 Oct 2021 12:56:27 +0200	[thread overview]
Message-ID: <20211019105629.11731-6-mk@semihalf.com> (raw)
In-Reply-To: <20211019105629.11731-1-mk@semihalf.com>

Only the IO rings memory was allocated with taking the socket ID into
the respect, while the other structures was allocated using the regular
rte_zmalloc() API.

Ring specific structures are now being allocated using the ring's
socket ID.

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Shai Brandes <shaibran@amazon.com>
---
 doc/guides/rel_notes/release_21_11.rst |  1 +
 drivers/net/ena/ena_ethdev.c           | 42 ++++++++++++++------------
 2 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst
index 8341d979aa..6ac867321b 100644
--- a/doc/guides/rel_notes/release_21_11.rst
+++ b/doc/guides/rel_notes/release_21_11.rst
@@ -108,6 +108,7 @@ New Features
   bug fixes and improvements, including:
 
   * Support for the tx_free_thresh and rx_free_thresh configuration parameters.
+  * NUMA aware allocations for the queue helper structures.
 
 * **Updated Broadcom bnxt PMD.**
 
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 94dbb3164e..4e9925b6be 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1165,19 +1165,20 @@ static int ena_tx_queue_setup(struct rte_eth_dev *dev,
 	txq->numa_socket_id = socket_id;
 	txq->pkts_without_db = false;
 
-	txq->tx_buffer_info = rte_zmalloc("txq->tx_buffer_info",
-					  sizeof(struct ena_tx_buffer) *
-					  txq->ring_size,
-					  RTE_CACHE_LINE_SIZE);
+	txq->tx_buffer_info = rte_zmalloc_socket("txq->tx_buffer_info",
+		sizeof(struct ena_tx_buffer) * txq->ring_size,
+		RTE_CACHE_LINE_SIZE,
+		socket_id);
 	if (!txq->tx_buffer_info) {
 		PMD_DRV_LOG(ERR,
 			"Failed to allocate memory for Tx buffer info\n");
 		return -ENOMEM;
 	}
 
-	txq->empty_tx_reqs = rte_zmalloc("txq->empty_tx_reqs",
-					 sizeof(u16) * txq->ring_size,
-					 RTE_CACHE_LINE_SIZE);
+	txq->empty_tx_reqs = rte_zmalloc_socket("txq->empty_tx_reqs",
+		sizeof(uint16_t) * txq->ring_size,
+		RTE_CACHE_LINE_SIZE,
+		socket_id);
 	if (!txq->empty_tx_reqs) {
 		PMD_DRV_LOG(ERR,
 			"Failed to allocate memory for empty Tx requests\n");
@@ -1186,9 +1187,10 @@ static int ena_tx_queue_setup(struct rte_eth_dev *dev,
 	}
 
 	txq->push_buf_intermediate_buf =
-		rte_zmalloc("txq->push_buf_intermediate_buf",
-			    txq->tx_max_header_size,
-			    RTE_CACHE_LINE_SIZE);
+		rte_zmalloc_socket("txq->push_buf_intermediate_buf",
+			txq->tx_max_header_size,
+			RTE_CACHE_LINE_SIZE,
+			socket_id);
 	if (!txq->push_buf_intermediate_buf) {
 		PMD_DRV_LOG(ERR, "Failed to alloc push buffer for LLQ\n");
 		rte_free(txq->tx_buffer_info);
@@ -1270,19 +1272,20 @@ static int ena_rx_queue_setup(struct rte_eth_dev *dev,
 	rxq->numa_socket_id = socket_id;
 	rxq->mb_pool = mp;
 
-	rxq->rx_buffer_info = rte_zmalloc("rxq->buffer_info",
+	rxq->rx_buffer_info = rte_zmalloc_socket("rxq->buffer_info",
 		sizeof(struct ena_rx_buffer) * nb_desc,
-		RTE_CACHE_LINE_SIZE);
+		RTE_CACHE_LINE_SIZE,
+		socket_id);
 	if (!rxq->rx_buffer_info) {
 		PMD_DRV_LOG(ERR,
 			"Failed to allocate memory for Rx buffer info\n");
 		return -ENOMEM;
 	}
 
-	rxq->rx_refill_buffer = rte_zmalloc("rxq->rx_refill_buffer",
-					    sizeof(struct rte_mbuf *) * nb_desc,
-					    RTE_CACHE_LINE_SIZE);
-
+	rxq->rx_refill_buffer = rte_zmalloc_socket("rxq->rx_refill_buffer",
+		sizeof(struct rte_mbuf *) * nb_desc,
+		RTE_CACHE_LINE_SIZE,
+		socket_id);
 	if (!rxq->rx_refill_buffer) {
 		PMD_DRV_LOG(ERR,
 			"Failed to allocate memory for Rx refill buffer\n");
@@ -1291,9 +1294,10 @@ static int ena_rx_queue_setup(struct rte_eth_dev *dev,
 		return -ENOMEM;
 	}
 
-	rxq->empty_rx_reqs = rte_zmalloc("rxq->empty_rx_reqs",
-					 sizeof(uint16_t) * nb_desc,
-					 RTE_CACHE_LINE_SIZE);
+	rxq->empty_rx_reqs = rte_zmalloc_socket("rxq->empty_rx_reqs",
+		sizeof(uint16_t) * nb_desc,
+		RTE_CACHE_LINE_SIZE,
+		socket_id);
 	if (!rxq->empty_rx_reqs) {
 		PMD_DRV_LOG(ERR,
 			"Failed to allocate memory for empty Rx requests\n");
-- 
2.25.1


  parent reply	other threads:[~2021-10-19 10:57 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-14 20:18 [dpdk-dev] [PATCH 0/7] net/ena: update ENA PMD to v2.5.0 Michal Krawczyk
2021-10-14 20:18 ` [dpdk-dev] [PATCH 1/7] net/ena: fix verification of the offload capabilities Michal Krawczyk
2021-10-14 20:18 ` [dpdk-dev] [PATCH 2/7] net/ena: support Tx/Rx free thresholds Michal Krawczyk
2021-10-14 20:18 ` [dpdk-dev] [PATCH 3/7] net/ena: fix per-queue offload capabilities Michal Krawczyk
2021-10-14 20:18 ` [dpdk-dev] [PATCH 4/7] net/ena: indicate missing scattered Rx capability Michal Krawczyk
2021-10-14 20:18 ` [dpdk-dev] [PATCH 5/7] net/ena: add NUMA aware allocations Michal Krawczyk
2021-10-14 20:18 ` [dpdk-dev] [PATCH 6/7] net/ena: add check for missing Tx completions Michal Krawczyk
2021-10-14 20:18 ` [dpdk-dev] [PATCH 7/7] net/ena: update version to 2.5.0 Michal Krawczyk
2021-10-15 16:26 ` [dpdk-dev] [PATCH 0/7] net/ena: update ENA PMD to v2.5.0 Michal Krawczyk
2021-10-15 16:26   ` [dpdk-dev] [PATCH v2 1/7] net/ena: fix verification of the offload capabilities Michal Krawczyk
2021-10-15 16:26   ` [dpdk-dev] [PATCH v2 2/7] net/ena: support Tx/Rx free thresholds Michal Krawczyk
2021-10-15 16:26   ` [dpdk-dev] [PATCH v2 3/7] net/ena: fix per-queue offload capabilities Michal Krawczyk
2021-10-15 16:26   ` [dpdk-dev] [PATCH v2 4/7] net/ena: indicate missing scattered Rx capability Michal Krawczyk
2021-10-15 16:26   ` [dpdk-dev] [PATCH v2 5/7] net/ena: add NUMA aware allocations Michal Krawczyk
2021-10-15 16:27   ` [dpdk-dev] [PATCH v2 6/7] net/ena: add check for missing Tx completions Michal Krawczyk
2021-10-15 16:27   ` [dpdk-dev] [PATCH v2 7/7] net/ena: update version to 2.5.0 Michal Krawczyk
2021-10-18 20:51   ` [dpdk-dev] [PATCH 0/7] net/ena: update ENA PMD to v2.5.0 Ferruh Yigit
2021-10-19  9:05     ` Michał Krawczyk
2021-10-19 10:56   ` [dpdk-dev] [PATCH v3 " Michal Krawczyk
2021-10-19 10:56     ` [dpdk-dev] [PATCH v3 1/7] net/ena: fix verification of the offload capabilities Michal Krawczyk
2021-10-19 10:56     ` [dpdk-dev] [PATCH v3 2/7] net/ena: support Tx/Rx free thresholds Michal Krawczyk
2021-10-19 10:56     ` [dpdk-dev] [PATCH v3 3/7] net/ena: fix per-queue offload capabilities Michal Krawczyk
2021-10-19 12:25       ` Ferruh Yigit
2021-10-19 10:56     ` [dpdk-dev] [PATCH v3 4/7] net/ena: indicate missing scattered Rx capability Michal Krawczyk
2021-10-19 10:56     ` Michal Krawczyk [this message]
2021-10-19 10:56     ` [dpdk-dev] [PATCH v3 6/7] net/ena: add check for missing Tx completions Michal Krawczyk
2021-10-19 12:40       ` Ferruh Yigit
2021-10-19 10:56     ` [dpdk-dev] [PATCH v3 7/7] net/ena: update version to 2.5.0 Michal Krawczyk
2021-10-19 13:05     ` [dpdk-dev] [PATCH v3 0/7] net/ena: update ENA PMD to v2.5.0 Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211019105629.11731-6-mk@semihalf.com \
    --to=mk@semihalf.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=igorch@amazon.com \
    --cc=ndagan@amazon.com \
    --cc=shaibran@amazon.com \
    --cc=upstream@semihalf.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).