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 8A0EDA0A0E for ; Thu, 29 Apr 2021 00:03:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 53C2240147; Thu, 29 Apr 2021 00:03:56 +0200 (CEST) Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by mails.dpdk.org (Postfix) with ESMTP id E82EB40697 for ; Thu, 29 Apr 2021 00:03:55 +0200 (CEST) Received: by mail-pf1-f176.google.com with SMTP id 10so2157789pfl.1 for ; Wed, 28 Apr 2021 15:03:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:mime-version; bh=oMM/acuLeKoSzKzm+QT+55k8UEyKOnCWiIHXkidZ81s=; b=FNc1Tp2ns1CIavL7mMxgojgxZZFBqrnfKW+dY9nZvjR8RyA4UYsQ9b+lNjsrAexF7n IgZKkU43pJxRhWCgaDiOmZYTWrcZRMXRMeO+/wlF7SV4CI725x6A9Xz+tyuh/FgP1UlB liIKJ5lpvFsfniqDlvVtBnHD5QB9/QQ27XxmQ= 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:mime-version; bh=oMM/acuLeKoSzKzm+QT+55k8UEyKOnCWiIHXkidZ81s=; b=Pab9/MFxUQJdoU/lWMDYEZFA5MarWcN3jekgyHx3bSZmVOzkAtUe9D3A6NDC5FJ6ef v/Q28nH9/9D3ZE5gt1Gv0qYgWefkT3yeoJXqr0atEPNykKTFLrnA52bDOcquGw0rUH8q 9EmuZh/e0jNn1Pgt4AbGj5q3+Sru1THhlEMrtE+bG1SxzevcG/fqTp1Yxw+8bdUt20kF w4naS5rwoTBc8bVFvutAeW8MOify590K1zCYQGXR4b/Ey+ugoh0fNrfEB+NqEfkFqw39 mZRL9JgVUY4VSPMD7dpodRMk1vWZ97rh8wDOJJ1rwQo5yn/MqNbew/9t66HNQVwQsEzo rHkQ== X-Gm-Message-State: AOAM532PUrfGV+yOp4E2z1jWSdjGdGa2b2r7HUIDMaZP60YJ4LrfvPKV Mh2l9Ej6u4zIxFiP3l3RQeXGsQ== X-Google-Smtp-Source: ABdhPJy807gPc3MJMe05pi/5uMJ0wgzadi01wzm4SJp6kDuw4cROLk9J8ThQXIs4Mkd37USR9iZM0w== X-Received: by 2002:a63:d915:: with SMTP id r21mr29131144pgg.69.1619647434869; Wed, 28 Apr 2021 15:03:54 -0700 (PDT) Received: from localhost.localdomain ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id p126sm561135pga.86.2021.04.28.15.03.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 15:03:53 -0700 (PDT) From: Lance Richardson To: Ajit Khaparde , Somnath Kotur , Venkat Duvvuru , Kalesh AP , Rahul Gupta Cc: dev@dpdk.org, stable@dpdk.org Date: Wed, 28 Apr 2021 18:03:44 -0400 Message-Id: <20210428220344.10028-1-lance.richardson@broadcom.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="0000000000000adaed05c10f8e2c" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [dpdk-stable] [PATCH] net/bnxt: fix dynamic VNIC count 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" --0000000000000adaed05c10f8e2c Content-Transfer-Encoding: 8bit Ensure that the current count of in-use VNICs is decremented when a VNIC is freed. Don't attempt VNIC allocation when the maximum supported number of VNICs is currently allocated. Fixes: 49d0709b257f ("net/bnxt: delete and flush L2 filters cleanly") Fixes: d24610f7bfda ("net/bnxt: allow flow creation when RSS is enabled") Cc: stable@dpdk.org Signed-off-by: Lance Richardson Reviewed-by: Ajit Kumar Khaparde --- drivers/net/bnxt/bnxt.h | 2 +- drivers/net/bnxt/bnxt_flow.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index bd2dec4d63..a385710846 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -719,7 +719,7 @@ struct bnxt { uint32_t max_ring_grps; struct bnxt_ring_grp_info *grp_info; - unsigned int nr_vnics; + uint16_t nr_vnics; #define BNXT_GET_DEFAULT_VNIC(bp) (&(bp)->vnic_info[0]) struct bnxt_vnic_info *vnic_info; diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c index 844bf1520f..73fd24cd9a 100644 --- a/drivers/net/bnxt/bnxt_flow.c +++ b/drivers/net/bnxt/bnxt_flow.c @@ -925,6 +925,9 @@ static int bnxt_vnic_prep(struct bnxt *bp, struct bnxt_vnic_info *vnic) uint64_t rx_offloads = dev_conf->rxmode.offloads; int rc; + if (bp->nr_vnics > bp->max_vnics - 1) + return -ENOMEM; + rc = bnxt_vnic_grp_alloc(bp, vnic); if (rc) goto ret; @@ -1550,6 +1553,7 @@ bnxt_flow_validate(struct rte_eth_dev *dev, bnxt_hwrm_vnic_ctx_free(bp, vnic); bnxt_hwrm_vnic_free(bp, vnic); vnic->rx_queue_cnt = 0; + bp->nr_vnics--; PMD_DRV_LOG(DEBUG, "Free VNIC\n"); } } @@ -2011,6 +2015,7 @@ _bnxt_flow_destroy(struct bnxt *bp, bnxt_hwrm_vnic_free(bp, vnic); vnic->rx_queue_cnt = 0; + bp->nr_vnics--; } } else { rte_flow_error_set(error, -ret, -- 2.25.1 --0000000000000adaed05c10f8e2c--