patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/bnxt: fix a segfault encountered during PMD exit
@ 2016-11-15 23:06 Ajit Khaparde
  2016-11-16  2:19 ` [dpdk-stable] [dpdk-dev] " Yuanhan Liu
  0 siblings, 1 reply; 5+ messages in thread
From: Ajit Khaparde @ 2016-11-15 23:06 UTC (permalink / raw)
  To: dev; +Cc: stable

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: <stable@dpdk.org>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 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 = (struct bnxt *)eth_dev->data->dev_private;
 	int rc;
 
+	bp->dev_stopped = 0;
 	rc = 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 = (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 = (struct bnxt *)eth_dev->data->dev_private;
+
+	if (bp->dev_stopped == 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 = 0;
+
 	return 0;
 
 error_free:
@@ -1040,6 +1046,8 @@ bnxt_dev_uninit(struct rte_eth_dev *eth_dev) {
 		rte_free(bp->grp_info);
 	rc = bnxt_hwrm_func_driver_unregister(bp, 0);
 	bnxt_free_hwrm_resources(bp);
+	if (bp->dev_stopped == 0)
+		bnxt_dev_close_op(eth_dev);
 	return rc;
 }
 
-- 
2.8.4 (Apple Git-73)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH] net/bnxt: fix a segfault encountered during PMD exit
  2016-11-15 23:06 [dpdk-stable] [PATCH] net/bnxt: fix a segfault encountered during PMD exit Ajit Khaparde
@ 2016-11-16  2:19 ` Yuanhan Liu
  2016-11-16  5:26   ` Ajit Khaparde
  0 siblings, 1 reply; 5+ messages in thread
From: Yuanhan Liu @ 2016-11-16  2:19 UTC (permalink / raw)
  To: Ajit Khaparde; +Cc: stable

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 316e412299fde9f8f099ef957aa04dc6c43d02a2 ]

You could either send another veresion, or I will handle it (copy &
paste the original commit log) for you while apply.

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: <stable@dpdk.org>
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
>  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 = (struct bnxt *)eth_dev->data->dev_private;
>  	int rc;
>  
> +	bp->dev_stopped = 0;
>  	rc = 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 = (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 = (struct bnxt *)eth_dev->data->dev_private;
> +
> +	if (bp->dev_stopped == 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 = 0;
> +
>  	return 0;
>  
>  error_free:
> @@ -1040,6 +1046,8 @@ bnxt_dev_uninit(struct rte_eth_dev *eth_dev) {
>  		rte_free(bp->grp_info);
>  	rc = bnxt_hwrm_func_driver_unregister(bp, 0);
>  	bnxt_free_hwrm_resources(bp);
> +	if (bp->dev_stopped == 0)
> +		bnxt_dev_close_op(eth_dev);
>  	return rc;
>  }
>  
> -- 
> 2.8.4 (Apple Git-73)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH] net/bnxt: fix a segfault encountered during PMD exit
  2016-11-16  2:19 ` [dpdk-stable] [dpdk-dev] " Yuanhan Liu
@ 2016-11-16  5:26   ` Ajit Khaparde
  2016-11-16 14:27     ` Yuanhan Liu
  0 siblings, 1 reply; 5+ messages in thread
From: Ajit Khaparde @ 2016-11-16  5:26 UTC (permalink / raw)
  To: Yuanhan Liu; +Cc: dpdk stable

On Tue, Nov 15, 2016 at 8:19 PM, Yuanhan Liu <yuanhan.liu@linux.intel.com>
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 316e412299fde9f8f099ef957aa04dc6c43d02a2
> ]
>
​I had cloned the dpdk-stable for the first time. So it did not have the
usual git hooks.
By the time I got the email about the checkpatch failure, it was late
anyway.
​


>
> You could either send another veresion, or I will handle it (copy &
> ​​
> paste the original commit log) for you while apply.
>
​If it isn't much, could you just use this version and do the copy-paste
this time.
​Otherwise 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: <stable@dpdk.org>
> > Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> > ---
> >  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 = (struct bnxt *)eth_dev->data->dev_private;
> >       int rc;
> >
> > +     bp->dev_stopped = 0;
> >       rc = 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 = (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 = (struct bnxt *)eth_dev->data->dev_private;
> > +
> > +     if (bp->dev_stopped == 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 = 0;
> > +
> >       return 0;
> >
> >  error_free:
> > @@ -1040,6 +1046,8 @@ bnxt_dev_uninit(struct rte_eth_dev *eth_dev) {
> >               rte_free(bp->grp_info);
> >       rc = bnxt_hwrm_func_driver_unregister(bp, 0);
> >       bnxt_free_hwrm_resources(bp);
> > +     if (bp->dev_stopped == 0)
> > +             bnxt_dev_close_op(eth_dev);
> >       return rc;
> >  }
> >
> > --
> > 2.8.4 (Apple Git-73)
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH] net/bnxt: fix a segfault encountered during PMD exit
  2016-11-16  5:26   ` Ajit Khaparde
@ 2016-11-16 14:27     ` Yuanhan Liu
  2016-11-17 12:11       ` Yuanhan Liu
  0 siblings, 1 reply; 5+ messages in thread
From: Yuanhan Liu @ 2016-11-16 14:27 UTC (permalink / raw)
  To: Ajit Khaparde; +Cc: dpdk stable

On Tue, Nov 15, 2016 at 11:26:41PM -0600, Ajit Khaparde wrote:
> 
> 
> On Tue, Nov 15, 2016 at 8:19 PM, Yuanhan Liu <yuanhan.liu@linux.intel.com>
> 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 316e412299fde9f8f099ef957aa04d
>     c6c43d02a2 ]
> 
> ​I had cloned the dpdk-stable for the first time. So it did not have the usual
> git hooks.
> By the time I got the email about the checkpatch failure, it was late anyway.
> ​
>  
> 
> 
>     You could either send another veresion, or I will handle it (copy &
>     ​​
>     paste the original commit log) for you while apply.
> 
> ​If it isn't much, could you just use this version and do the copy-paste this
> time.
> ​Otherwise I will send something out tomorrow. My laptop battery is almost out
> of power.

No worry, I could do it for you.

	--yliu

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH] net/bnxt: fix a segfault encountered during PMD exit
  2016-11-16 14:27     ` Yuanhan Liu
@ 2016-11-17 12:11       ` Yuanhan Liu
  0 siblings, 0 replies; 5+ messages in thread
From: Yuanhan Liu @ 2016-11-17 12:11 UTC (permalink / raw)
  To: Ajit Khaparde; +Cc: dpdk stable

On Wed, Nov 16, 2016 at 10:27:28PM +0800, Yuanhan Liu wrote:
> >     You could either send another veresion, or I will handle it (copy &
> >     ​​
> >     paste the original commit log) for you while apply.
> > 
> > ​If it isn't much, could you just use this version and do the copy-paste this
> > time.
> > ​Otherwise I will send something out tomorrow. My laptop battery is almost out
> > of power.
> 
> No worry, I could do it for you.
> 

Applied to dpdk stable 16.07 branch.

Thanks.

	--yliu

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-11-17 12:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-15 23:06 [dpdk-stable] [PATCH] net/bnxt: fix a segfault encountered during PMD exit Ajit Khaparde
2016-11-16  2:19 ` [dpdk-stable] [dpdk-dev] " Yuanhan Liu
2016-11-16  5:26   ` Ajit Khaparde
2016-11-16 14:27     ` Yuanhan Liu
2016-11-17 12:11       ` Yuanhan Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).