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 8C1D4A04C1; Fri, 22 Nov 2019 00:44:40 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C88A42BA3; Fri, 22 Nov 2019 00:44:39 +0100 (CET) Received: from mail-io1-f68.google.com (mail-io1-f68.google.com [209.85.166.68]) by dpdk.org (Postfix) with ESMTP id 50FBC1F5 for ; Fri, 22 Nov 2019 00:44:38 +0100 (CET) Received: by mail-io1-f68.google.com with SMTP id z193so5753305iof.1 for ; Thu, 21 Nov 2019 15:44:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=os34zzhRaDRtREeO7a4eXiGfbBg2bMSPdgaVoxjUIlg=; b=Pubx2TBcAXa6yb2k4cnYXsokixB06h9Ip49uSGquQow3odXiaTC3gwSKg06neKzpVt wzxQB+iCCAH7FTn7rDohruct1I9e80frkGqo8v+Vn/+bWC9562ddmwPtql/qcNvVTT8n Y3PuNiCQ9vMhhw0BlOgIsH6bxyGQj0UyRDRAk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=os34zzhRaDRtREeO7a4eXiGfbBg2bMSPdgaVoxjUIlg=; b=HsF/2N/+VMGIO/pXNxQIziA4Fu6vLR6YwThX11w9AN1/rTxPBHCIlu8MHZtuPDeUmd AAWytX6P6IuvrNURV6q6zUCHU/oDgQmzA0PZX6esVUzUvFZKrmvoc0CTtj2HLMrVnDEV 2yDa2gUZhE3DpXg9+WMV6OoiP9jy9i+iOHfwD5tRCKB/3+749hayzHepD8OBXWxAW9UY J0FrrD2pITB3U0wFw//ykDb66Vuwe+q23PEn9BlvgeKlAvRNzrHOJSdkoY8HGRrQMcBd IWeAKmgzrpKkmYJ/BZ6i1aEF3Qn/bWYLclrQF+M1UwTFawSjEU+Z3xjhCXdYd6EV7UK7 eH0w== X-Gm-Message-State: APjAAAX0Xyd9HeoHemp+2BBFNF8aL31uJbF1NFx/fEy7gFnzxbmho1a9 FqD9lPhJcLy7Ihyj2NTa70kHP2fnZU73OXron6QCjZP3obg= X-Google-Smtp-Source: APXvYqzzeW11O0bEPZuCcBuNTQ8qoqxiMqc4LeSDrQN2cuFvAurE5Ax1qTuj3PE/a7b9Pm+s/QI3kJb4ntHsWLN+dDo= X-Received: by 2002:a6b:5b0e:: with SMTP id v14mr6721796ioh.201.1574379877291; Thu, 21 Nov 2019 15:44:37 -0800 (PST) MIME-Version: 1.0 References: <20191121233435.4263-1-ajit.khaparde@broadcom.com> <20191121233435.4263-3-ajit.khaparde@broadcom.com> In-Reply-To: <20191121233435.4263-3-ajit.khaparde@broadcom.com> From: Ajit Khaparde Date: Thu, 21 Nov 2019 15:44:17 -0800 Message-ID: To: dpdk-dev Cc: Ferruh Yigit , Somnath Kotur Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [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" On Thu, Nov 21, 2019 at 3:35 PM Ajit Khaparde wrote: > 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 > Applied to dpdk-next-net-brcm. > --- > 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) > >