DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/idpf: refine idpf_dev_vport_init() function
@ 2023-06-26 14:06 Mingxia Liu
  2023-06-30  8:13 ` Zhang, Qi Z
  2023-06-30 18:54 ` [PATCH v2] net/idpf: fix error path processing Mingxia Liu
  0 siblings, 2 replies; 6+ messages in thread
From: Mingxia Liu @ 2023-06-26 14:06 UTC (permalink / raw)
  To: dev; +Cc: jingjing.wu, beilei.xing, Mingxia Liu

This patch adds 'cur_vports' and 'cur_vport_nb' updation in error path.

Signed-off-by: Mingxia Liu <mingxia.liu@intel.com>
---
 drivers/net/idpf/idpf_ethdev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c
index 801da57472..3e66898aaf 100644
--- a/drivers/net/idpf/idpf_ethdev.c
+++ b/drivers/net/idpf/idpf_ethdev.c
@@ -1300,6 +1300,8 @@ idpf_dev_vport_init(struct rte_eth_dev *dev, void *init_params)
 err_mac_addrs:
 	adapter->vports[param->idx] = NULL;  /* reset */
 	idpf_vport_deinit(vport);
+	adapter->cur_vports &= ~RTE_BIT32(param->devarg_id);
+	adapter->cur_vport_nb--;
 err:
 	return ret;
 }
-- 
2.34.1


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

* RE: [PATCH] net/idpf: refine idpf_dev_vport_init() function
  2023-06-26 14:06 [PATCH] net/idpf: refine idpf_dev_vport_init() function Mingxia Liu
@ 2023-06-30  8:13 ` Zhang, Qi Z
  2023-06-30  8:14   ` Zhang, Qi Z
  2023-06-30 18:54 ` [PATCH v2] net/idpf: fix error path processing Mingxia Liu
  1 sibling, 1 reply; 6+ messages in thread
From: Zhang, Qi Z @ 2023-06-30  8:13 UTC (permalink / raw)
  To: Liu, Mingxia, dev; +Cc: Wu, Jingjing, Xing, Beilei, Liu, Mingxia



> -----Original Message-----
> From: Mingxia Liu <mingxia.liu@intel.com>
> Sent: Monday, June 26, 2023 10:06 PM
> To: dev@dpdk.org
> Cc: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>;
> Liu, Mingxia <mingxia.liu@intel.com>
> Subject: [PATCH] net/idpf: refine idpf_dev_vport_init() function
> 
> This patch adds 'cur_vports' and 'cur_vport_nb' updation in error path.
> 
> Signed-off-by: Mingxia Liu <mingxia.liu@intel.com>
> ---
>  drivers/net/idpf/idpf_ethdev.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c
> index 801da57472..3e66898aaf 100644
> --- a/drivers/net/idpf/idpf_ethdev.c
> +++ b/drivers/net/idpf/idpf_ethdev.c
> @@ -1300,6 +1300,8 @@ idpf_dev_vport_init(struct rte_eth_dev *dev, void
> *init_params)
>  err_mac_addrs:
>  	adapter->vports[param->idx] = NULL;  /* reset */
>  	idpf_vport_deinit(vport);
> +	adapter->cur_vports &= ~RTE_BIT32(param->devarg_id);
> +	adapter->cur_vport_nb--;

Can we move below two lines to the last?

adapter->cur_vports |= RTE_BIT32(param->devarg_id);
adapter->cur_vport_nb++;

so we don't need to revert them in error handle

>  err:
>  	return ret;
>  }
> --
> 2.34.1


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

* RE: [PATCH] net/idpf: refine idpf_dev_vport_init() function
  2023-06-30  8:13 ` Zhang, Qi Z
@ 2023-06-30  8:14   ` Zhang, Qi Z
  2023-06-30 10:46     ` Liu, Mingxia
  0 siblings, 1 reply; 6+ messages in thread
From: Zhang, Qi Z @ 2023-06-30  8:14 UTC (permalink / raw)
  To: Liu, Mingxia, dev; +Cc: Wu, Jingjing, Xing, Beilei, Liu, Mingxia



> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Friday, June 30, 2023 4:13 PM
> To: Mingxia Liu <mingxia.liu@intel.com>; dev@dpdk.org
> Cc: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>;
> Liu, Mingxia <mingxia.liu@intel.com>
> Subject: RE: [PATCH] net/idpf: refine idpf_dev_vport_init() function
> 
> 
> 
> > -----Original Message-----
> > From: Mingxia Liu <mingxia.liu@intel.com>
> > Sent: Monday, June 26, 2023 10:06 PM
> > To: dev@dpdk.org
> > Cc: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei
> > <beilei.xing@intel.com>; Liu, Mingxia <mingxia.liu@intel.com>
> > Subject: [PATCH] net/idpf: refine idpf_dev_vport_init() function
> >
> > This patch adds 'cur_vports' and 'cur_vport_nb' updation in error path.
> >
> > Signed-off-by: Mingxia Liu <mingxia.liu@intel.com>
> > ---
> >  drivers/net/idpf/idpf_ethdev.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/net/idpf/idpf_ethdev.c
> > b/drivers/net/idpf/idpf_ethdev.c index 801da57472..3e66898aaf 100644
> > --- a/drivers/net/idpf/idpf_ethdev.c
> > +++ b/drivers/net/idpf/idpf_ethdev.c
> > @@ -1300,6 +1300,8 @@ idpf_dev_vport_init(struct rte_eth_dev *dev,
> > void
> > *init_params)
> >  err_mac_addrs:
> >  	adapter->vports[param->idx] = NULL;  /* reset */
> >  	idpf_vport_deinit(vport);
> > +	adapter->cur_vports &= ~RTE_BIT32(param->devarg_id);
> > +	adapter->cur_vport_nb--;
> 
> Can we move below two lines to the last?
> 
> adapter->cur_vports |= RTE_BIT32(param->devarg_id); cur_vport_nb++;
> 
> so we don't need to revert them in error handle

Btw this is a fix, please also add the fixline.
> 
> >  err:
> >  	return ret;
> >  }
> > --
> > 2.34.1


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

* RE: [PATCH] net/idpf: refine idpf_dev_vport_init() function
  2023-06-30  8:14   ` Zhang, Qi Z
@ 2023-06-30 10:46     ` Liu, Mingxia
  0 siblings, 0 replies; 6+ messages in thread
From: Liu, Mingxia @ 2023-06-30 10:46 UTC (permalink / raw)
  To: Zhang, Qi Z, dev; +Cc: Wu, Jingjing, Xing, Beilei



> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Friday, June 30, 2023 4:14 PM
> To: Liu, Mingxia <mingxia.liu@intel.com>; dev@dpdk.org
> Cc: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>;
> Liu, Mingxia <mingxia.liu@intel.com>
> Subject: RE: [PATCH] net/idpf: refine idpf_dev_vport_init() function
> 
> 
> 
> > -----Original Message-----
> > From: Zhang, Qi Z
> > Sent: Friday, June 30, 2023 4:13 PM
> > To: Mingxia Liu <mingxia.liu@intel.com>; dev@dpdk.org
> > Cc: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei
> > <beilei.xing@intel.com>; Liu, Mingxia <mingxia.liu@intel.com>
> > Subject: RE: [PATCH] net/idpf: refine idpf_dev_vport_init() function
> >
> >
> >
> > > -----Original Message-----
> > > From: Mingxia Liu <mingxia.liu@intel.com>
> > > Sent: Monday, June 26, 2023 10:06 PM
> > > To: dev@dpdk.org
> > > Cc: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei
> > > <beilei.xing@intel.com>; Liu, Mingxia <mingxia.liu@intel.com>
> > > Subject: [PATCH] net/idpf: refine idpf_dev_vport_init() function
> > >
> > > This patch adds 'cur_vports' and 'cur_vport_nb' updation in error path.
> > >
> > > Signed-off-by: Mingxia Liu <mingxia.liu@intel.com>
> > > ---
> > >  drivers/net/idpf/idpf_ethdev.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > >
> > > diff --git a/drivers/net/idpf/idpf_ethdev.c
> > > b/drivers/net/idpf/idpf_ethdev.c index 801da57472..3e66898aaf 100644
> > > --- a/drivers/net/idpf/idpf_ethdev.c
> > > +++ b/drivers/net/idpf/idpf_ethdev.c
> > > @@ -1300,6 +1300,8 @@ idpf_dev_vport_init(struct rte_eth_dev *dev,
> > > void
> > > *init_params)
> > >  err_mac_addrs:
> > >  	adapter->vports[param->idx] = NULL;  /* reset */
> > >  	idpf_vport_deinit(vport);
> > > +	adapter->cur_vports &= ~RTE_BIT32(param->devarg_id);
> > > +	adapter->cur_vport_nb--;
> >
> > Can we move below two lines to the last?
> >
> > adapter->cur_vports |= RTE_BIT32(param->devarg_id); cur_vport_nb++;
> >
> > so we don't need to revert them in error handle
> 
> Btw this is a fix, please also add the fixline.
> >
[Liu, Mingxia] Thanks, new patch has been sent.

> > >  err:
> > >  	return ret;
> > >  }
> > > --
> > > 2.34.1


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

* [PATCH v2] net/idpf: fix error path processing
  2023-06-26 14:06 [PATCH] net/idpf: refine idpf_dev_vport_init() function Mingxia Liu
  2023-06-30  8:13 ` Zhang, Qi Z
@ 2023-06-30 18:54 ` Mingxia Liu
  2023-07-03  2:19   ` Zhang, Qi Z
  1 sibling, 1 reply; 6+ messages in thread
From: Mingxia Liu @ 2023-06-30 18:54 UTC (permalink / raw)
  To: dev; +Cc: jingjing.wu, beilei.xing, Mingxia Liu

This patch moves vport info updating lines to the last,
in order to fix reverting missing in the error handle.

Fixes: 5e0f60527e5b ("net/idpf: remove vport req and recv info from adapter")

Signed-off-by: Mingxia Liu <mingxia.liu@intel.com>
---
 drivers/net/idpf/idpf_ethdev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c
index 4b7cc81550..6d9a53c94c 100644
--- a/drivers/net/idpf/idpf_ethdev.c
+++ b/drivers/net/idpf/idpf_ethdev.c
@@ -1277,10 +1277,6 @@ idpf_dev_vport_init(struct rte_eth_dev *dev, void *init_params)
 		goto err;
 	}
 
-	adapter->vports[param->idx] = vport;
-	adapter->cur_vports |= RTE_BIT32(param->devarg_id);
-	adapter->cur_vport_nb++;
-
 	dev->data->mac_addrs = rte_zmalloc(NULL, RTE_ETHER_ADDR_LEN, 0);
 	if (dev->data->mac_addrs == NULL) {
 		PMD_INIT_LOG(ERR, "Cannot allocate mac_addr memory.");
@@ -1291,6 +1287,10 @@ idpf_dev_vport_init(struct rte_eth_dev *dev, void *init_params)
 	rte_ether_addr_copy((struct rte_ether_addr *)vport->default_mac_addr,
 			    &dev->data->mac_addrs[0]);
 
+	adapter->vports[param->idx] = vport;
+	adapter->cur_vports |= RTE_BIT32(param->devarg_id);
+	adapter->cur_vport_nb++;
+
 	return 0;
 
 err_mac_addrs:
-- 
2.34.1


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

* RE: [PATCH v2] net/idpf: fix error path processing
  2023-06-30 18:54 ` [PATCH v2] net/idpf: fix error path processing Mingxia Liu
@ 2023-07-03  2:19   ` Zhang, Qi Z
  0 siblings, 0 replies; 6+ messages in thread
From: Zhang, Qi Z @ 2023-07-03  2:19 UTC (permalink / raw)
  To: Liu, Mingxia, dev; +Cc: Wu, Jingjing, Xing, Beilei, Liu, Mingxia



> -----Original Message-----
> From: Mingxia Liu <mingxia.liu@intel.com>
> Sent: Saturday, July 1, 2023 2:54 AM
> To: dev@dpdk.org
> Cc: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>;
> Liu, Mingxia <mingxia.liu@intel.com>
> Subject: [PATCH v2] net/idpf: fix error path processing
> 
> This patch moves vport info updating lines to the last, in order to fix reverting
> missing in the error handle.
> 
> Fixes: 5e0f60527e5b ("net/idpf: remove vport req and recv info from adapter")
> 
Added Cc: stable@dpdk.org

> Signed-off-by: Mingxia Liu <mingxia.liu@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi



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

end of thread, other threads:[~2023-07-03  2:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-26 14:06 [PATCH] net/idpf: refine idpf_dev_vport_init() function Mingxia Liu
2023-06-30  8:13 ` Zhang, Qi Z
2023-06-30  8:14   ` Zhang, Qi Z
2023-06-30 10:46     ` Liu, Mingxia
2023-06-30 18:54 ` [PATCH v2] net/idpf: fix error path processing Mingxia Liu
2023-07-03  2:19   ` Zhang, Qi Z

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).