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 75A47A0350 for ; Mon, 21 Feb 2022 16:39:42 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6BFFE4013F; Mon, 21 Feb 2022 16:39:42 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 098E94013F for ; Mon, 21 Feb 2022 16:39:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645457980; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kAw0J7FLKdAIeFZta7OuWT6pl2kyGbcygEQmMfjvLaA=; b=i5gWSFDgJjwKxXb9ex0d46VUpsf8dx3rIn2k+tNelDIFHMWbCaDBPVubpD2m808vkdm+V4 YRFeoVMiSkZPz74XlvlnmsdLga2khkOYlFoZm5IDzHDIPRSSZ9mqbV4kh004e041XL2UNg b/ss3x+wypOc6RZB6eRkxSWfRKbABTY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-572-UR4R01OxPZe1Wrg5ZHl4SA-1; Mon, 21 Feb 2022 10:39:38 -0500 X-MC-Unique: UR4R01OxPZe1Wrg5ZHl4SA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 370BD8143E5; Mon, 21 Feb 2022 15:39:37 +0000 (UTC) Received: from rh.Home (unknown [10.39.195.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 077B07B9D9; Mon, 21 Feb 2022 15:39:35 +0000 (UTC) From: Kevin Traynor 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 21.11.1 Date: Mon, 21 Feb 2022 15:34:46 +0000 Message-Id: <20220221153625.152324-97-ktraynor@redhat.com> In-Reply-To: <20220221153625.152324-1-ktraynor@redhat.com> References: <20220221153625.152324-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" 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 21.11.1 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/26/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/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/f70203b5c016243eed2724191f75a0175a6bf3e9 Thanks. Kevin --- >From f70203b5c016243eed2724191f75a0175a6bf3e9 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 09d67ef885..b3c03a2af5 100644 --- a/drivers/net/bnxt/bnxt_vnic.c +++ b/drivers/net/bnxt/bnxt_vnic.c @@ -99,16 +99,9 @@ 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; } } @@ -123,5 +116,4 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp, bool reconfig) uint32_t entry_length; size_t rss_table_size; - uint16_t max_vnics; int i; rte_iova_t mz_phys_addr; @@ -137,36 +129,34 @@ 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); diff --git a/drivers/net/bnxt/bnxt_vnic.h b/drivers/net/bnxt/bnxt_vnic.h index 25481fcbdd..9055b93c4b 100644 --- a/drivers/net/bnxt/bnxt_vnic.h +++ b/drivers/net/bnxt/bnxt_vnic.h @@ -29,4 +29,5 @@ struct bnxt_vnic_info { 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; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-02-21 15:22:46.721090127 +0000 +++ 0097-net-bnxt-fix-memzone-allocation-per-VNIC.patch 2022-02-21 15:22:44.196704362 +0000 @@ -1 +1 @@ -From 5b8b248c9679b9571f73a75e1905d7cef39e6c6e Mon Sep 17 00:00:00 2001 +From f70203b5c016243eed2724191f75a0175a6bf3e9 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 5b8b248c9679b9571f73a75e1905d7cef39e6c6e ] + @@ -14 +15,0 @@ -Cc: stable@dpdk.org