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 954FFA0032 for ; Fri, 18 Feb 2022 13:42:21 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8C13340395; Fri, 18 Feb 2022 13:42:21 +0100 (CET) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by mails.dpdk.org (Postfix) with ESMTP id 27C5740141 for ; Fri, 18 Feb 2022 13:42:20 +0100 (CET) Received: by mail-wr1-f45.google.com with SMTP id k1so14377394wrd.8 for ; Fri, 18 Feb 2022 04:42:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EcHfrSYc5NUoirsewarYHujJPGWzhe3W2HDLXF5XGes=; b=BhhM5j21QTFLtWNlcTXyo8OMvM+hW2Utt9o125L/tJOWKFAU9uy1TcnwO9uTanHaIa nhsGyoG0NVE4i5hDlY+0NRGl9f9/vvaGLvQuX98Nlt61TenE/te5iCmtkyz/f/99Lixk 1LYKSECC4fXqLAnHkiGeAOn838FHMzJ5SXf6OQ6NdWOg5ZPQy1oxr18LBkv6zrCwFU29 43VUV29elyrHhXJJMMEFSWfQzOf7iHVDbNWxdw9bxEfEfmTpvrwtqjniLdrFpEx2szio TWhsn5XJEH9TgPuIIqps3KF4wl/AvJNvHTj3ETSMHBwUUS8pgTGJSpcsywEMwsd+CSlS vGlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EcHfrSYc5NUoirsewarYHujJPGWzhe3W2HDLXF5XGes=; b=JO80lZupvMlJGZ2QpLUROZlfxNM8Vc/3qqkQZQZvEgN99pXE/6F2WU/2HB6whH3RG9 NWgM+iSbmCFMsLDGlH8jJ+0JA58hrVGSpbThR3iYWT1BlbSmfj2CJSl+VWNNUCMZ5lXo ln7ZFH71baxUu4mC6MmUYLWMuJp+CI/kl4uyNrxxGexroYTcRAy9K38xWjuirtUdWFUV YAIjWBpi3xIzgXXguFl66f88NsglGYypYBL2fCfGIJ2ofTt1DdSyM+dhmE1vPh8NbQWu B8L2BUvzfOEQN3gUU3VzjL7aQoztydhLYQrIWu2o2OncRDrky/2MmatIuUv8CGHMv8fZ kzhA== X-Gm-Message-State: AOAM530dN/pvRPtK9PDjQWPRZdFIhrrlxgwxOAoy96w7t/evt2q6VNzC F/M2UucM7tAe+TgoTZifmIA= X-Google-Smtp-Source: ABdhPJy6pYNYMcwYvFiTmIzEwVWQhuFBepucIFpWy4h1skQZTbydPYXWmh6399rsznakEjFk3p9rLg== X-Received: by 2002:a5d:5889:0:b0:1e3:3ef9:213 with SMTP id n9-20020a5d5889000000b001e33ef90213mr5869888wrf.324.1645188139837; Fri, 18 Feb 2022 04:42:19 -0800 (PST) Received: from localhost ([2a01:4b00:f41a:3600:360b:9754:2e3a:c344]) by smtp.gmail.com with ESMTPSA id l12sm4072863wmd.44.2022.02.18.04.42.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Feb 2022 04:42:19 -0800 (PST) From: luca.boccassi@gmail.com To: Kalesh AP Cc: Somnath Kotur , Ajit Khaparde , dpdk stable Subject: patch 'net/bnxt: fix memzone allocation per VNIC' has been queued to stable release 20.11.5 Date: Fri, 18 Feb 2022 12:38:23 +0000 Message-Id: <20220218123931.1749595-54-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220218123931.1749595-1-luca.boccassi@gmail.com> References: <20220218123931.1749595-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Hi, FYI, your patch has been queued to stable release 20.11.5 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/20/22. 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/3e0a066400aa784eb77a79294d8f371129dac21d Thanks. Luca Boccassi --- >From 3e0a066400aa784eb77a79294d8f371129dac21d Mon Sep 17 00:00:00 2001 From: Kalesh AP Date: Thu, 20 Jan 2022 14:42:27 +0530 Subject: [PATCH] net/bnxt: fix memzone allocation per VNIC [ upstream commit 5b8b248c9679b9571f73a75e1905d7cef39e6c6e ] In case of Thor RSS table size is too big. This could result in memory allocation failure when the supported vnic count is high. Instead of allocating the memzone for all VNICs in one shot, allocate for each VNIC individually. Also, fixed to free the memzone in the uninit path. Fixes: 9738793f28ec ("net/bnxt: add VNIC functions and structs") Signed-off-by: Kalesh AP Reviewed-by: Somnath Kotur Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_vnic.c | 68 +++++++++++++++--------------------- drivers/net/bnxt/bnxt_vnic.h | 1 + 2 files changed, 30 insertions(+), 39 deletions(-) diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c index f18e672dca..fd425e5d83 100644 --- a/drivers/net/bnxt/bnxt_vnic.c +++ b/drivers/net/bnxt/bnxt_vnic.c @@ -98,18 +98,11 @@ void bnxt_free_vnic_attributes(struct bnxt *bp) for (i = 0; i < bp->max_vnics; i++) { vnic = &bp->vnic_info[i]; - if (vnic->rss_table) { - /* 'Unreserve' the rss_table */ - /* N/A */ - - vnic->rss_table = NULL; - } - - if (vnic->rss_hash_key) { - /* 'Unreserve' the rss_hash_key */ - /* N/A */ - + if (vnic->rss_mz != NULL) { + rte_memzone_free(vnic->rss_mz); + vnic->rss_mz = NULL; vnic->rss_hash_key = NULL; + vnic->rss_table = NULL; } } } @@ -122,7 +115,6 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp, bool reconfig) char mz_name[RTE_MEMZONE_NAMESIZE]; uint32_t entry_length; size_t rss_table_size; - uint16_t max_vnics; int i; rte_iova_t mz_phys_addr; @@ -136,38 +128,36 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp, bool reconfig) entry_length = RTE_CACHE_LINE_ROUNDUP(entry_length + rss_table_size); - max_vnics = bp->max_vnics; - snprintf(mz_name, RTE_MEMZONE_NAMESIZE, - "bnxt_" PCI_PRI_FMT "_vnicattr", pdev->addr.domain, - pdev->addr.bus, pdev->addr.devid, pdev->addr.function); - mz_name[RTE_MEMZONE_NAMESIZE - 1] = 0; - mz = rte_memzone_lookup(mz_name); - if (!mz) { - mz = rte_memzone_reserve(mz_name, - entry_length * max_vnics, - bp->eth_dev->device->numa_node, - RTE_MEMZONE_2MB | - RTE_MEMZONE_SIZE_HINT_ONLY | - RTE_MEMZONE_IOVA_CONTIG); - if (!mz) - return -ENOMEM; - } - mz_phys_addr = mz->iova; - - for (i = 0; i < max_vnics; i++) { + for (i = 0; i < bp->max_vnics; i++) { vnic = &bp->vnic_info[i]; + snprintf(mz_name, RTE_MEMZONE_NAMESIZE, + "bnxt_" PCI_PRI_FMT "_vnicattr_%d", pdev->addr.domain, + pdev->addr.bus, pdev->addr.devid, pdev->addr.function, i); + mz_name[RTE_MEMZONE_NAMESIZE - 1] = 0; + mz = rte_memzone_lookup(mz_name); + if (mz == NULL) { + mz = rte_memzone_reserve(mz_name, + entry_length, + bp->eth_dev->device->numa_node, + RTE_MEMZONE_2MB | + RTE_MEMZONE_SIZE_HINT_ONLY | + RTE_MEMZONE_IOVA_CONTIG); + if (mz == NULL) { + PMD_DRV_LOG(ERR, "Cannot allocate bnxt vnic_attributes memory\n"); + return -ENOMEM; + } + } + vnic->rss_mz = mz; + mz_phys_addr = mz->iova; + /* Allocate rss table and hash key */ - vnic->rss_table = - (void *)((char *)mz->addr + (entry_length * i)); + vnic->rss_table = (void *)((char *)mz->addr); + vnic->rss_table_dma_addr = mz_phys_addr; memset(vnic->rss_table, -1, entry_length); - vnic->rss_table_dma_addr = mz_phys_addr + (entry_length * i); - vnic->rss_hash_key = (void *)((char *)vnic->rss_table + - rss_table_size); - - vnic->rss_hash_key_dma_addr = vnic->rss_table_dma_addr + - rss_table_size; + vnic->rss_hash_key = (void *)((char *)vnic->rss_table + rss_table_size); + vnic->rss_hash_key_dma_addr = vnic->rss_table_dma_addr + rss_table_size; if (!reconfig) { bnxt_prandom_bytes(vnic->rss_hash_key, HW_HASH_KEY_SIZE); memcpy(bp->rss_conf.rss_key, vnic->rss_hash_key, HW_HASH_KEY_SIZE); diff --git a/drivers/net/bnxt/bnxt_vnic.h b/drivers/net/bnxt/bnxt_vnic.h index 785db8f0cd..c07fd52b21 100644 --- a/drivers/net/bnxt/bnxt_vnic.h +++ b/drivers/net/bnxt/bnxt_vnic.h @@ -28,6 +28,7 @@ struct bnxt_vnic_info { uint16_t mru; uint16_t hash_type; uint8_t hash_mode; + const struct rte_memzone *rss_mz; rte_iova_t rss_table_dma_addr; uint16_t *rss_table; rte_iova_t rss_hash_key_dma_addr; -- 2.30.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-02-18 12:37:40.110503191 +0000 +++ 0054-net-bnxt-fix-memzone-allocation-per-VNIC.patch 2022-02-18 12:37:37.678791652 +0000 @@ -1 +1 @@ -From 5b8b248c9679b9571f73a75e1905d7cef39e6c6e Mon Sep 17 00:00:00 2001 +From 3e0a066400aa784eb77a79294d8f371129dac21d Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 5b8b248c9679b9571f73a75e1905d7cef39e6c6e ] + @@ -14 +15,0 @@ -Cc: stable@dpdk.org @@ -25 +26 @@ -index 09d67ef885..b3c03a2af5 100644 +index f18e672dca..fd425e5d83 100644 @@ -124 +125 @@ -index 25481fcbdd..9055b93c4b 100644 +index 785db8f0cd..c07fd52b21 100644