From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 66449A0C4C for ; Mon, 12 Jul 2021 15:14:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 607CB40685; Mon, 12 Jul 2021 15:14:44 +0200 (CEST) Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by mails.dpdk.org (Postfix) with ESMTP id 2E1E94069E for ; Mon, 12 Jul 2021 15:14:43 +0200 (CEST) Received: by mail-wm1-f51.google.com with SMTP id l18-20020a1ced120000b029014c1adff1edso14425027wmh.4 for ; Mon, 12 Jul 2021 06:14:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1PWhe4CUDue2oMDd6FwQTOcU5/p0egfpd0oE1dlCS2Q=; b=vFxCMUn2WnnFVTk3pWpGoJn4E9oUDuczBj31ynhEOMFKDpmnbCapqvP6sioudK/kRx A3oA+gmcI8OV9L0UkIPVeBOvGK8GzQwM+ynC82X1Ud2euAvh/0cUptikB+K1dbw/TqXY Sq7zomQMYAl9YJYHOkZPkIYS9KOFl3kqNSepv/7Em9/o9k/WhadhlESJCGVR3sRFHaIc SSxS4TmhHrM0Oi7vCLcvDKNNFv916cxZ60kKjxSX6hwheQNkrnkffGUrQaWVhLmR88q6 13MCEdiFeDZgPe1Dta960lYNlVYOf5pT2sZQkj6v0Vc7VXxUW2JiRrt8C+N7Fht4yRWk 05PQ== 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:mime-version:content-transfer-encoding; bh=1PWhe4CUDue2oMDd6FwQTOcU5/p0egfpd0oE1dlCS2Q=; b=JoQQjmDQ+bqtxqRB6MHToM5uYgbTCVuCA53cHPi0Gu773UYUzrDkcAYAe11InhGhQz h4IPZ/69o8cNHk1M1gc7RD87VPuTHOiC13+UOmTNy5cPNhFr4evjkeeza5a+o5E5E92C 7OPh2xRJ8AQlhZpWiqdqrVcGpTIc+4Kx8k/d2WpDEGsYuqTmxdbhZdikKATL02nlc1fG Gq5RQV+9X4l8IGevrS0HNSqFzct/GpWBkUk/wXi4AA7Hd+lmWgTnLDcBueUCBSwoJBOB E4QjQikx6uveR7hC3b7awaIvtv/g5YGKC3x6idtoRo/oaL5vzYUq/NWfk2i6acSCo87f Q+Ow== X-Gm-Message-State: AOAM5307+BnkgRoFo6ue4vrpv0DeGbI0YCdOZIgvDNF6iKt7zYIGcaYM ltV77Cda9+J6DNxxUXJGc+k= X-Google-Smtp-Source: ABdhPJx/bsq1kE8NGcMVQJLkgml2bK4z54m+KTBIyXERz2RxdU39FAtCCPz7iHgZNK8PfbIhLbbOHA== X-Received: by 2002:a7b:cb98:: with SMTP id m24mr5421943wmi.21.1626095682956; Mon, 12 Jul 2021 06:14:42 -0700 (PDT) Received: from localhost ([137.220.125.106]) by smtp.gmail.com with ESMTPSA id k5sm13520192wmk.11.2021.07.12.06.14.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 06:14:42 -0700 (PDT) From: luca.boccassi@gmail.com To: Lance Richardson Cc: Somnath Kotur , Ajit Khaparde , dpdk stable Date: Mon, 12 Jul 2021 14:05:23 +0100 Message-Id: <20210712130551.2462159-88-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210712130551.2462159-1-luca.boccassi@gmail.com> References: <20210712130551.2462159-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/bnxt: fix ring and context memory allocation' has been queued to stable release 20.11.3 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/14/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/233e6138a9136a1cdfd59e5bc796c1f62e697ebb Thanks. Luca Boccassi --- >From 233e6138a9136a1cdfd59e5bc796c1f62e697ebb Mon Sep 17 00:00:00 2001 From: Lance Richardson Date: Wed, 16 Jun 2021 13:55:20 -0400 Subject: [PATCH] net/bnxt: fix ring and context memory allocation [ upstream commit c6c90a33de906eb40a8eb01e16736cbaa2845b97 ] Use requested socket ID when allocating memory for transmit rings, receive rings, and completion queues. Use device NUMA ID when allocating context memory, notification queue rings, async completion queue rings, and VNIC attributes. Fixes: 6eb3cc2294fd ("net/bnxt: add initial Tx code") Fixes: 9738793f28ec ("net/bnxt: add VNIC functions and structs") Fixes: f8168ca0e690 ("net/bnxt: support thor controller") Fixes: bd0a14c99f65 ("net/bnxt: use dedicated CPR for async events") Fixes: 683e5cf79249 ("net/bnxt: use common NQ ring") Signed-off-by: Lance Richardson Reviewed-by: Somnath Kotur Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_ethdev.c | 17 +++++++++-------- drivers/net/bnxt/bnxt_ring.c | 30 ++++++++++++++---------------- drivers/net/bnxt/bnxt_ring.h | 2 +- drivers/net/bnxt/bnxt_rxq.c | 4 ++-- drivers/net/bnxt/bnxt_txq.c | 4 ++-- drivers/net/bnxt/bnxt_vnic.c | 3 ++- 6 files changed, 30 insertions(+), 30 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 466b39d2a8..f34e90e8df 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -583,13 +583,14 @@ static int bnxt_register_fc_ctx_mem(struct bnxt *bp) return rc; } -static int bnxt_alloc_ctx_mem_buf(char *type, size_t size, +static int bnxt_alloc_ctx_mem_buf(struct bnxt *bp, char *type, size_t size, struct bnxt_ctx_mem_buf_info *ctx) { if (!ctx) return -EINVAL; - ctx->va = rte_zmalloc(type, size, 0); + ctx->va = rte_zmalloc_socket(type, size, 0, + bp->eth_dev->device->numa_node); if (ctx->va == NULL) return -ENOMEM; rte_mem_lock_page(ctx->va); @@ -613,7 +614,7 @@ static int bnxt_init_fc_ctx_mem(struct bnxt *bp) sprintf(type, "bnxt_rx_fc_in_" PCI_PRI_FMT, pdev->addr.domain, pdev->addr.bus, pdev->addr.devid, pdev->addr.function); /* 4 bytes for each counter-id */ - rc = bnxt_alloc_ctx_mem_buf(type, + rc = bnxt_alloc_ctx_mem_buf(bp, type, max_fc * 4, &bp->flow_stat->rx_fc_in_tbl); if (rc) @@ -622,7 +623,7 @@ static int bnxt_init_fc_ctx_mem(struct bnxt *bp) sprintf(type, "bnxt_rx_fc_out_" PCI_PRI_FMT, pdev->addr.domain, pdev->addr.bus, pdev->addr.devid, pdev->addr.function); /* 16 bytes for each counter - 8 bytes pkt_count, 8 bytes byte_count */ - rc = bnxt_alloc_ctx_mem_buf(type, + rc = bnxt_alloc_ctx_mem_buf(bp, type, max_fc * 16, &bp->flow_stat->rx_fc_out_tbl); if (rc) @@ -631,7 +632,7 @@ static int bnxt_init_fc_ctx_mem(struct bnxt *bp) sprintf(type, "bnxt_tx_fc_in_" PCI_PRI_FMT, pdev->addr.domain, pdev->addr.bus, pdev->addr.devid, pdev->addr.function); /* 4 bytes for each counter-id */ - rc = bnxt_alloc_ctx_mem_buf(type, + rc = bnxt_alloc_ctx_mem_buf(bp, type, max_fc * 4, &bp->flow_stat->tx_fc_in_tbl); if (rc) @@ -640,7 +641,7 @@ static int bnxt_init_fc_ctx_mem(struct bnxt *bp) sprintf(type, "bnxt_tx_fc_out_" PCI_PRI_FMT, pdev->addr.domain, pdev->addr.bus, pdev->addr.devid, pdev->addr.function); /* 16 bytes for each counter - 8 bytes pkt_count, 8 bytes byte_count */ - rc = bnxt_alloc_ctx_mem_buf(type, + rc = bnxt_alloc_ctx_mem_buf(bp, type, max_fc * 16, &bp->flow_stat->tx_fc_out_tbl); if (rc) @@ -4443,7 +4444,7 @@ static int bnxt_alloc_ctx_mem_blk(struct bnxt *bp, if (!mz) { mz = rte_memzone_reserve_aligned(mz_name, rmem->nr_pages * 8, - SOCKET_ID_ANY, + bp->eth_dev->device->numa_node, RTE_MEMZONE_2MB | RTE_MEMZONE_SIZE_HINT_ONLY | RTE_MEMZONE_IOVA_CONTIG, @@ -4466,7 +4467,7 @@ static int bnxt_alloc_ctx_mem_blk(struct bnxt *bp, if (!mz) { mz = rte_memzone_reserve_aligned(mz_name, mem_size, - SOCKET_ID_ANY, + bp->eth_dev->device->numa_node, RTE_MEMZONE_1GB | RTE_MEMZONE_SIZE_HINT_ONLY | RTE_MEMZONE_IOVA_CONTIG, diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c index 94cf7d3de2..6834244e4c 100644 --- a/drivers/net/bnxt/bnxt_ring.c +++ b/drivers/net/bnxt/bnxt_ring.c @@ -94,7 +94,7 @@ int bnxt_alloc_ring_grps(struct bnxt *bp) * tx bd ring - Only non-zero length if tx_ring_info is not NULL * rx bd ring - Only non-zero length if rx_ring_info is not NULL */ -int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx, +int bnxt_alloc_rings(struct bnxt *bp, unsigned int socket_id, uint16_t qidx, struct bnxt_tx_queue *txq, struct bnxt_rx_queue *rxq, struct bnxt_cp_ring_info *cp_ring_info, @@ -203,7 +203,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx, mz = rte_memzone_lookup(mz_name); if (!mz) { mz = rte_memzone_reserve_aligned(mz_name, total_alloc_len, - SOCKET_ID_ANY, + socket_id, RTE_MEMZONE_2MB | RTE_MEMZONE_SIZE_HINT_ONLY | RTE_MEMZONE_IOVA_CONTIG, @@ -422,24 +422,23 @@ int bnxt_alloc_rxtx_nq_ring(struct bnxt *bp) struct bnxt_cp_ring_info *nqr; struct bnxt_ring *ring; int ring_index = BNXT_NUM_ASYNC_CPR(bp); - unsigned int socket_id; uint8_t ring_type; int rc = 0; if (!BNXT_HAS_NQ(bp) || bp->rxtx_nq_ring) return 0; - socket_id = rte_lcore_to_socket_id(rte_get_main_lcore()); - nqr = rte_zmalloc_socket("nqr", sizeof(struct bnxt_cp_ring_info), - RTE_CACHE_LINE_SIZE, socket_id); + RTE_CACHE_LINE_SIZE, + bp->eth_dev->device->numa_node); if (nqr == NULL) return -ENOMEM; ring = rte_zmalloc_socket("bnxt_cp_ring_struct", sizeof(struct bnxt_ring), - RTE_CACHE_LINE_SIZE, socket_id); + RTE_CACHE_LINE_SIZE, + bp->eth_dev->device->numa_node); if (ring == NULL) { rte_free(nqr); return -ENOMEM; @@ -454,7 +453,8 @@ int bnxt_alloc_rxtx_nq_ring(struct bnxt *bp) ring->fw_ring_id = INVALID_HW_RING_ID; nqr->cp_ring_struct = ring; - rc = bnxt_alloc_rings(bp, 0, NULL, NULL, nqr, NULL, "l2_nqr"); + rc = bnxt_alloc_rings(bp, bp->eth_dev->device->numa_node, 0, NULL, + NULL, nqr, NULL, "l2_nqr"); if (rc) { rte_free(ring); rte_free(nqr); @@ -837,22 +837,21 @@ int bnxt_alloc_async_ring_struct(struct bnxt *bp) { struct bnxt_cp_ring_info *cpr = NULL; struct bnxt_ring *ring = NULL; - unsigned int socket_id; if (BNXT_NUM_ASYNC_CPR(bp) == 0) return 0; - socket_id = rte_lcore_to_socket_id(rte_get_main_lcore()); - cpr = rte_zmalloc_socket("cpr", sizeof(struct bnxt_cp_ring_info), - RTE_CACHE_LINE_SIZE, socket_id); + RTE_CACHE_LINE_SIZE, + bp->eth_dev->device->numa_node); if (cpr == NULL) return -ENOMEM; ring = rte_zmalloc_socket("bnxt_cp_ring_struct", sizeof(struct bnxt_ring), - RTE_CACHE_LINE_SIZE, socket_id); + RTE_CACHE_LINE_SIZE, + bp->eth_dev->device->numa_node); if (ring == NULL) { rte_free(cpr); return -ENOMEM; @@ -868,7 +867,6 @@ int bnxt_alloc_async_ring_struct(struct bnxt *bp) bp->async_cp_ring = cpr; cpr->cp_ring_struct = ring; - return bnxt_alloc_rings(bp, 0, NULL, NULL, - bp->async_cp_ring, NULL, - "def_cp"); + return bnxt_alloc_rings(bp, bp->eth_dev->device->numa_node, 0, NULL, + NULL, bp->async_cp_ring, NULL, "def_cp"); } diff --git a/drivers/net/bnxt/bnxt_ring.h b/drivers/net/bnxt/bnxt_ring.h index 0a4685d167..201b3919ed 100644 --- a/drivers/net/bnxt/bnxt_ring.h +++ b/drivers/net/bnxt/bnxt_ring.h @@ -66,7 +66,7 @@ struct bnxt_rx_ring_info; struct bnxt_cp_ring_info; void bnxt_free_ring(struct bnxt_ring *ring); int bnxt_alloc_ring_grps(struct bnxt *bp); -int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx, +int bnxt_alloc_rings(struct bnxt *bp, unsigned int socket_id, uint16_t qidx, struct bnxt_tx_queue *txq, struct bnxt_rx_queue *rxq, struct bnxt_cp_ring_info *cp_ring_info, diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c index ffb7193cfc..a2feb525c4 100644 --- a/drivers/net/bnxt/bnxt_rxq.c +++ b/drivers/net/bnxt/bnxt_rxq.c @@ -335,8 +335,8 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev, eth_dev->data->rx_queues[queue_idx] = rxq; /* Allocate RX ring hardware descriptors */ - rc = bnxt_alloc_rings(bp, queue_idx, NULL, rxq, rxq->cp_ring, NULL, - "rxr"); + rc = bnxt_alloc_rings(bp, socket_id, queue_idx, NULL, rxq, rxq->cp_ring, + NULL, "rxr"); if (rc) { PMD_DRV_LOG(ERR, "ring_dma_zone_reserve for rx_ring failed!\n"); diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c index 99a31cef28..795056e457 100644 --- a/drivers/net/bnxt/bnxt_txq.c +++ b/drivers/net/bnxt/bnxt_txq.c @@ -149,8 +149,8 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev, txq->port_id = eth_dev->data->port_id; /* Allocate TX ring hardware descriptors */ - if (bnxt_alloc_rings(bp, queue_idx, txq, NULL, txq->cp_ring, NULL, - "txr")) { + if (bnxt_alloc_rings(bp, socket_id, queue_idx, txq, NULL, txq->cp_ring, + NULL, "txr")) { PMD_DRV_LOG(ERR, "ring_dma_zone_reserve for tx_ring failed!"); rc = -ENOMEM; goto err; diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c index 007f7e93c9..40cad0fd67 100644 --- a/drivers/net/bnxt/bnxt_vnic.c +++ b/drivers/net/bnxt/bnxt_vnic.c @@ -145,7 +145,8 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp) mz = rte_memzone_lookup(mz_name); if (!mz) { mz = rte_memzone_reserve(mz_name, - entry_length * max_vnics, SOCKET_ID_ANY, + entry_length * max_vnics, + bp->eth_dev->device->numa_node, RTE_MEMZONE_2MB | RTE_MEMZONE_SIZE_HINT_ONLY | RTE_MEMZONE_IOVA_CONTIG); -- 2.30.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-07-12 13:41:41.154842488 +0100 +++ 0088-net-bnxt-fix-ring-and-context-memory-allocation.patch 2021-07-12 13:41:36.750128027 +0100 @@ -1 +1 @@ -From c6c90a33de906eb40a8eb01e16736cbaa2845b97 Mon Sep 17 00:00:00 2001 +From 233e6138a9136a1cdfd59e5bc796c1f62e697ebb Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit c6c90a33de906eb40a8eb01e16736cbaa2845b97 ] + @@ -16 +17,0 @@ -Cc: stable@dpdk.org @@ -31 +32 @@ -index ba3d0e7f31..74ade93b71 100644 +index 466b39d2a8..f34e90e8df 100644 @@ -34 +35 @@ -@@ -580,13 +580,14 @@ static int bnxt_register_fc_ctx_mem(struct bnxt *bp) +@@ -583,13 +583,14 @@ static int bnxt_register_fc_ctx_mem(struct bnxt *bp) @@ -51 +52 @@ -@@ -610,7 +611,7 @@ static int bnxt_init_fc_ctx_mem(struct bnxt *bp) +@@ -613,7 +614,7 @@ static int bnxt_init_fc_ctx_mem(struct bnxt *bp) @@ -60 +61 @@ -@@ -619,7 +620,7 @@ static int bnxt_init_fc_ctx_mem(struct bnxt *bp) +@@ -622,7 +623,7 @@ static int bnxt_init_fc_ctx_mem(struct bnxt *bp) @@ -69 +70 @@ -@@ -628,7 +629,7 @@ static int bnxt_init_fc_ctx_mem(struct bnxt *bp) +@@ -631,7 +632,7 @@ static int bnxt_init_fc_ctx_mem(struct bnxt *bp) @@ -78 +79 @@ -@@ -637,7 +638,7 @@ static int bnxt_init_fc_ctx_mem(struct bnxt *bp) +@@ -640,7 +641,7 @@ static int bnxt_init_fc_ctx_mem(struct bnxt *bp) @@ -87 +88 @@ -@@ -4667,7 +4668,7 @@ static int bnxt_alloc_ctx_mem_blk(struct bnxt *bp, +@@ -4443,7 +4444,7 @@ static int bnxt_alloc_ctx_mem_blk(struct bnxt *bp, @@ -96 +97 @@ -@@ -4690,7 +4691,7 @@ static int bnxt_alloc_ctx_mem_blk(struct bnxt *bp, +@@ -4466,7 +4467,7 @@ static int bnxt_alloc_ctx_mem_blk(struct bnxt *bp, @@ -106 +107 @@ -index e4055fa49b..4a90ac2648 100644 +index 94cf7d3de2..6834244e4c 100644 @@ -127 +128 @@ -@@ -435,24 +435,23 @@ int bnxt_alloc_rxtx_nq_ring(struct bnxt *bp) +@@ -422,24 +422,23 @@ int bnxt_alloc_rxtx_nq_ring(struct bnxt *bp) @@ -156 +157 @@ -@@ -467,7 +466,8 @@ int bnxt_alloc_rxtx_nq_ring(struct bnxt *bp) +@@ -454,7 +453,8 @@ int bnxt_alloc_rxtx_nq_ring(struct bnxt *bp) @@ -166 +167 @@ -@@ -805,22 +805,21 @@ int bnxt_alloc_async_ring_struct(struct bnxt *bp) +@@ -837,22 +837,21 @@ int bnxt_alloc_async_ring_struct(struct bnxt *bp) @@ -193 +194 @@ -@@ -836,7 +835,6 @@ int bnxt_alloc_async_ring_struct(struct bnxt *bp) +@@ -868,7 +867,6 @@ int bnxt_alloc_async_ring_struct(struct bnxt *bp) @@ -204 +205 @@ -index b8b666bb9c..ef9586e64e 100644 +index 0a4685d167..201b3919ed 100644 @@ -207 +208 @@ -@@ -67,7 +67,7 @@ struct bnxt_rx_ring_info; +@@ -66,7 +66,7 @@ struct bnxt_rx_ring_info; @@ -217 +218 @@ -index 45e0c3d01c..44b09e9c61 100644 +index ffb7193cfc..a2feb525c4 100644 @@ -220 +221 @@ -@@ -345,8 +345,8 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev, +@@ -335,8 +335,8 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev, @@ -232 +233 @@ -index d95e1f7526..bc789224d2 100644 +index 99a31cef28..795056e457 100644 @@ -247 +248 @@ -index de5c14566d..26253a7e17 100644 +index 007f7e93c9..40cad0fd67 100644