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 37A4EA0A0E; Thu, 29 Apr 2021 00:03:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 75599412A6; Thu, 29 Apr 2021 00:03:56 +0200 (CEST) Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by mails.dpdk.org (Postfix) with ESMTP id E70FD40147 for ; Thu, 29 Apr 2021 00:03:55 +0200 (CEST) Received: by mail-pg1-f172.google.com with SMTP id j189so1996955pgd.13 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=NPAZRgypi1GYndgUyGytSyhJVAIwhWaEp6GQ0c3Dbro=; b=a45PIQQUMjlkRjQ74OhYvL8TrX/rRTvduwRgznPGZ1PWALaw/m+9/3/aOCKXAsX3pa CThz/unYyevYufXwrom3khYa3z52y0K+fsOQFGBLeyI4Mel9oB3cK9mPYXxrHb6P6MLH EB5714XO+wXTmsm/G116UlFRaOUITQWIX4otY= 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=NPAZRgypi1GYndgUyGytSyhJVAIwhWaEp6GQ0c3Dbro=; b=FII9If/AY0Swr3d3++imz0tVpoftodcFfO4q0lioxXDYr98niUSfrBLodmhYPMUmAe l6HDwoImVicy+cR1PIKp4cP6JIeGF9Q9gHCqWDRTgH44taIyJaIVbkr/xwCJk+vXQAdH ZDiouBDi4otW9U+Z8MbXU7qIaVUsLb8LPgYowqhwogkWlyuA9+fF3alWMj4NYZj3ZYnR ocNppbc5t4+2/4ptChry+m6QGqQcMz7gw3HBrZPr/2VvgXrU5z6/g63yKffN8buTF9vw Fxp+/G2kI+CgSkXmmw7oaaydhINnJvN38GoMNGGo6NOyi9+F+ixILO7h6LovPv/ctQSu mK8w== X-Gm-Message-State: AOAM532IGjyaS1fLPeiIHVVmNBezcR7BEC7iy6dKDE9syulrnwe2uFaw GIW1UUm9dMPZyabZEUgiahQN1g== 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="0000000000000acebc05c10f8eff" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [dpdk-dev] [PATCH] net/bnxt: fix dynamic VNIC count X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" --0000000000000acebc05c10f8eff 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 --0000000000000acebc05c10f8eff--