From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk0-f172.google.com (mail-qk0-f172.google.com [209.85.220.172]) by dpdk.org (Postfix) with ESMTP id 3C52D2C8 for ; Wed, 16 Nov 2016 06:27:22 +0100 (CET) Received: by mail-qk0-f172.google.com with SMTP id n204so162645849qke.2 for ; Tue, 15 Nov 2016 21:27:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=se9cGFqLPMgN7gvIX/LriXzNFETW9QK8g0wrecaUUyM=; b=F5+X6d5SdbepzJcvxBVmXZUeJdMYZdqTTrJahcLb4AqpaQV0v1mAjF07SO0h1uh3SU 0Caestw8dbKjYrKZ9JtUObYZ4t5rnYZhD3AtG8PT50ZFM5s3XhLOT0ITj2gYfLbwHI6L VGwolXTw+0GymoLh96diYr5kzzWZNRFy9cfxo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=se9cGFqLPMgN7gvIX/LriXzNFETW9QK8g0wrecaUUyM=; b=BOVb4JiUMUvrakJAkZu2iyRkmzqDE44MzhF6NvLLfS3M7BVRkktwZQCVMjM2UHdskU COtkMmD1y7cVBC/SidFeNweGoLZ2e64S5YKxoegvBId91eZaI5qeaPcgoOSkk1FnMU8O qwYMmZZxIzDgzBGvd1wOgj3kxlxv5DUgnDh+uEYbbuMhpjZ2QvC6LceBQ/lqmwud4FhI 9QYcBTndWRLwsMV7wgXFA3j3ZIulCaZzC/9Art/yt2C96K+DzcAtxs+LTX3zCaAfOhXw BQIyJCxWSfizbdGrmAxPOZbDieWjRudeaVpwbO/fpHX++wm9RwVFpBxbTBb5J20dVhCj Llpg== X-Gm-Message-State: AKaTC00uR3aEjSgWNibQtgNSSeGqb+Qc82ctMtWgCwuIXxbQlwc+IaNGoq7ykcocQxZO33rAdZ422XWTg8PjMMSA X-Received: by 10.233.237.147 with SMTP id c141mr1239955qkg.175.1479274042238; Tue, 15 Nov 2016 21:27:22 -0800 (PST) MIME-Version: 1.0 Received: by 10.237.36.179 with HTTP; Tue, 15 Nov 2016 21:26:41 -0800 (PST) In-Reply-To: <20161116021951.GE5048@yliu-dev.sh.intel.com> References: <20161115230629.GA99122@C02PT1RBG8WP.vpn.broadcom.net> <20161116021951.GE5048@yliu-dev.sh.intel.com> From: Ajit Khaparde Date: Tue, 15 Nov 2016 23:26:41 -0600 Message-ID: To: Yuanhan Liu Cc: dpdk stable Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] net/bnxt: fix a segfault encountered during PMD exit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Nov 2016 05:27:23 -0000 On Tue, Nov 15, 2016 at 8:19 PM, Yuanhan Liu wrote: > Hi Ajit, > > Thanks for the backport. Few minor comments though: > > - the dev mailing list should not be cc'ed (thus I removed it). > > - the commit log should not be changed, except an extra line is needed: > > [ backported from upstream commit 316e412299fde9f8f099ef957aa04dc6c43d0= 2a2 > ] > =E2=80=8BI had cloned the dpdk-stable for the first time. So it did not hav= e the usual git hooks. By the time I got the email about the checkpatch failure, it was late anyway. =E2=80=8B > > You could either send another veresion, or I will handle it (copy & > =E2=80=8B=E2=80=8B > paste the original commit log) for you while apply. > =E2=80=8BIf it isn't much, could you just use this version and do the copy-= paste this time. =E2=80=8BOtherwise I will send something out tomorrow. My laptop battery is= almost out of power. Thanks Ajit > > Thanks. > > --yliu > > On Tue, Nov 15, 2016 at 05:06:29PM -0600, Ajit Khaparde wrote: > > This patch fixes segfault encountered during dev_uninit/close routine. > > KNI sample app can be used to reproduce the issue. > > > > backported from upstream commit 316e412 > > > > Cc: > > Signed-off-by: Ajit Khaparde > > --- > > drivers/net/bnxt/bnxt.h | 1 + > > drivers/net/bnxt/bnxt_ethdev.c | 28 ++++++++++++++++++---------- > > 2 files changed, 19 insertions(+), 10 deletions(-) > > > > diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h > > index df1f771..0e21ace 100644 > > --- a/drivers/net/bnxt/bnxt.h > > +++ b/drivers/net/bnxt/bnxt.h > > @@ -171,6 +171,7 @@ struct bnxt { > > > > struct bnxt_pf_info pf; > > struct bnxt_vf_info vf; > > + uint8_t dev_stopped; > > }; > > > > #endif > > diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ > ethdev.c > > index 3795fac..deeb54c 100644 > > --- a/drivers/net/bnxt/bnxt_ethdev.c > > +++ b/drivers/net/bnxt/bnxt_ethdev.c > > @@ -384,6 +384,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev > *eth_dev) > > struct bnxt *bp =3D (struct bnxt *)eth_dev->data->dev_private; > > int rc; > > > > + bp->dev_stopped =3D 0; > > rc =3D bnxt_hwrm_func_reset(bp); > > if (rc) { > > RTE_LOG(ERR, PMD, "hwrm chip reset failure rc: %x\n", rc)= ; > > @@ -427,16 +428,6 @@ static int bnxt_dev_set_link_down_op(struct > rte_eth_dev *eth_dev) > > return 0; > > } > > > > -static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev) > > -{ > > - struct bnxt *bp =3D (struct bnxt *)eth_dev->data->dev_private; > > - > > - bnxt_free_tx_mbufs(bp); > > - bnxt_free_rx_mbufs(bp); > > - bnxt_free_mem(bp); > > - rte_free(eth_dev->data->mac_addrs); > > -} > > - > > /* Unload the driver, release resources */ > > static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev) > > { > > @@ -449,6 +440,19 @@ static void bnxt_dev_stop_op(struct rte_eth_dev > *eth_dev) > > bnxt_shutdown_nic(bp); > > } > > > > +static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev) > > +{ > > + struct bnxt *bp =3D (struct bnxt *)eth_dev->data->dev_private; > > + > > + if (bp->dev_stopped =3D=3D 0) > > + bnxt_dev_stop_op(eth_dev); > > + > > + bnxt_free_tx_mbufs(bp); > > + bnxt_free_rx_mbufs(bp); > > + bnxt_free_mem(bp); > > + rte_free(eth_dev->data->mac_addrs); > > +} > > + > > static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev, > > uint32_t index) > > { > > @@ -1021,6 +1025,8 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev) > > eth_dev->pci_dev->mem_resource[0].phys_addr, > > eth_dev->pci_dev->mem_resource[0].addr); > > > > + bp->dev_stopped =3D 0; > > + > > return 0; > > > > error_free: > > @@ -1040,6 +1046,8 @@ bnxt_dev_uninit(struct rte_eth_dev *eth_dev) { > > rte_free(bp->grp_info); > > rc =3D bnxt_hwrm_func_driver_unregister(bp, 0); > > bnxt_free_hwrm_resources(bp); > > + if (bp->dev_stopped =3D=3D 0) > > + bnxt_dev_close_op(eth_dev); > > return rc; > > } > > > > -- > > 2.8.4 (Apple Git-73) >