From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 55328A04C1; Fri, 22 Nov 2019 00:35:05 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BD3D22BF1; Fri, 22 Nov 2019 00:34:50 +0100 (CET) Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id 2B2D0A3 for ; Fri, 22 Nov 2019 00:34:45 +0100 (CET) Received: from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net [10.75.242.48]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 92B1230C06F; Thu, 21 Nov 2019 15:31:04 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 92B1230C06F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1574379064; bh=guMgvinaTRJbrHBvBVKkBnv4d/UCoibWZyToOEDTjBo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uzUEfglBsoEsyI0IsFO+gYd6XqHaMbQzhDrz0/WEu7BmU11kHLNhgUMVLE4l+XyoL T4D5XI+piUEWwyOnwU/J7X/SQAS/YJySaOoeNLX6vpY4hKGth1zwIHrVvsBCYpG/Tv 58wyz5wpadLJi661uciG9oW3TL/5oUH+q+K03N5U= Received: from C02VPB22HTD6.wifi.broadcom.net (c02vpb22htd6.wifi.broadcom.net [10.69.74.102]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id 7385F140090; Thu, 21 Nov 2019 15:34:39 -0800 (PST) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Somnath Kotur Date: Thu, 21 Nov 2019 15:34:34 -0800 Message-Id: <20191121233435.4263-3-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122.2) In-Reply-To: <20191121233435.4263-1-ajit.khaparde@broadcom.com> References: <20191121233435.4263-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 3/3] net/bnxt: fix to free all the vnics during port stop X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" From: Somnath Kotur Now that vnics are created only as part of the flow creation cmds and not during init, we cannot rely on iterating only through 'nr_vnics'. We need to sweep all the vnics by using 'max_vnics' otherwise a vnic with a stale 'rx_queue_cnt' might be left lingering post a port stop/start operation. This could lead to a segfault. This change is required because of the recent fix made by commit to "fix flow creation with non-consecutive group ids". Fixes: bab0a1f2ed4b ("net/bnxt: fix flow creation with non-consecutive group ids") Signed-off-by: Somnath Kotur Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_vnic.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c index 52a4badfc..104342e13 100644 --- a/drivers/net/bnxt/bnxt_vnic.c +++ b/drivers/net/bnxt/bnxt_vnic.c @@ -75,12 +75,13 @@ struct bnxt_vnic_info *bnxt_alloc_vnic(struct bnxt *bp) void bnxt_free_all_vnics(struct bnxt *bp) { - struct bnxt_vnic_info *temp; + struct bnxt_vnic_info *vnic; unsigned int i; - for (i = 0; i < bp->nr_vnics; i++) { - temp = &bp->vnic_info[i]; - STAILQ_INSERT_TAIL(&bp->free_vnic_list, temp, next); + for (i = 0; i < bp->max_vnics; i++) { + vnic = &bp->vnic_info[i]; + STAILQ_INSERT_TAIL(&bp->free_vnic_list, vnic, next); + vnic->rx_queue_cnt = 0; } } -- 2.21.0 (Apple Git-122.2)