DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] common/idpf: remove unnecessary field in vport
@ 2023-04-20 16:20 Qi Zhang
  2023-04-26  6:45 ` Xing, Beilei
  2023-04-26  7:38 ` Xing, Beilei
  0 siblings, 2 replies; 5+ messages in thread
From: Qi Zhang @ 2023-04-20 16:20 UTC (permalink / raw)
  To: beilei.xing; +Cc: dev, Qi Zhang

Remove the pointer to rte_eth_dev instance, as
1. there is already a pointer to  rte_eth_dev_data.
2. a pointer to rte_eth_dev will break multi-process usage.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/common/idpf/idpf_common_device.h | 1 -
 drivers/net/cpfl/cpfl_ethdev.c           | 4 ++--
 drivers/net/idpf/idpf_ethdev.c           | 4 ++--
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/common/idpf/idpf_common_device.h b/drivers/common/idpf/idpf_common_device.h
index 7a54f7c937..d29bcc71ab 100644
--- a/drivers/common/idpf/idpf_common_device.h
+++ b/drivers/common/idpf/idpf_common_device.h
@@ -117,7 +117,6 @@ struct idpf_vport {
 
 	struct virtchnl2_vport_stats eth_stats_offset;
 
-	void *dev;
 	/* Event from ipf */
 	bool link_up;
 	uint32_t link_speed;
diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c
index f1d4425ce2..680c2326ec 100644
--- a/drivers/net/cpfl/cpfl_ethdev.c
+++ b/drivers/net/cpfl/cpfl_ethdev.c
@@ -1061,7 +1061,8 @@ static void
 cpfl_handle_event_msg(struct idpf_vport *vport, uint8_t *msg, uint16_t msglen)
 {
 	struct virtchnl2_event *vc_event = (struct virtchnl2_event *)msg;
-	struct rte_eth_dev *dev = (struct rte_eth_dev *)vport->dev;
+	struct rte_eth_dev_data *data = vport->dev_data;
+	struct rte_eth_dev *dev = &rte_eth_devices[data->port_id];
 
 	if (msglen < sizeof(struct virtchnl2_event)) {
 		PMD_DRV_LOG(ERR, "Error event");
@@ -1245,7 +1246,6 @@ cpfl_dev_vport_init(struct rte_eth_dev *dev, void *init_params)
 	vport->adapter = &adapter->base;
 	vport->sw_idx = param->idx;
 	vport->devarg_id = param->devarg_id;
-	vport->dev = dev;
 
 	memset(&create_vport_info, 0, sizeof(create_vport_info));
 	ret = idpf_vport_info_init(vport, &create_vport_info);
diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c
index e01eb3a2ec..38ad4e7ac0 100644
--- a/drivers/net/idpf/idpf_ethdev.c
+++ b/drivers/net/idpf/idpf_ethdev.c
@@ -1024,7 +1024,8 @@ static void
 idpf_handle_event_msg(struct idpf_vport *vport, uint8_t *msg, uint16_t msglen)
 {
 	struct virtchnl2_event *vc_event = (struct virtchnl2_event *)msg;
-	struct rte_eth_dev *dev = (struct rte_eth_dev *)vport->dev;
+	struct rte_eth_dev_data *data = vport->dev_data;
+	struct rte_eth_dev *dev = &rte_eth_devices[data->port_id];
 
 	if (msglen < sizeof(struct virtchnl2_event)) {
 		PMD_DRV_LOG(ERR, "Error event");
@@ -1235,7 +1236,6 @@ idpf_dev_vport_init(struct rte_eth_dev *dev, void *init_params)
 	vport->adapter = &adapter->base;
 	vport->sw_idx = param->idx;
 	vport->devarg_id = param->devarg_id;
-	vport->dev = dev;
 
 	memset(&create_vport_info, 0, sizeof(create_vport_info));
 	ret = idpf_vport_info_init(vport, &create_vport_info);
-- 
2.31.1


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

* RE: [PATCH] common/idpf: remove unnecessary field in vport
  2023-04-20 16:20 [PATCH] common/idpf: remove unnecessary field in vport Qi Zhang
@ 2023-04-26  6:45 ` Xing, Beilei
  2023-04-26  6:53   ` Zhang, Qi Z
  2023-04-26  7:38 ` Xing, Beilei
  1 sibling, 1 reply; 5+ messages in thread
From: Xing, Beilei @ 2023-04-26  6:45 UTC (permalink / raw)
  To: Zhang, Qi Z; +Cc: dev



> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Friday, April 21, 2023 12:21 AM
> To: Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>
> Subject: [PATCH] common/idpf: remove unnecessary field in vport
> 
> Remove the pointer to rte_eth_dev instance, as 1. there is already a pointer to
> rte_eth_dev_data.
> 2. a pointer to rte_eth_dev will break multi-process usage.

Basically it's OK for me, do we need to add fix line?

> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> ---
>  drivers/common/idpf/idpf_common_device.h | 1 -
>  drivers/net/cpfl/cpfl_ethdev.c           | 4 ++--
>  drivers/net/idpf/idpf_ethdev.c           | 4 ++--
>  3 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/common/idpf/idpf_common_device.h
> b/drivers/common/idpf/idpf_common_device.h
> index 7a54f7c937..d29bcc71ab 100644
> --- a/drivers/common/idpf/idpf_common_device.h
> +++ b/drivers/common/idpf/idpf_common_device.h
> @@ -117,7 +117,6 @@ struct idpf_vport {
> 
>  	struct virtchnl2_vport_stats eth_stats_offset;
> 
> -	void *dev;
>  	/* Event from ipf */
>  	bool link_up;
>  	uint32_t link_speed;
> diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c
> index f1d4425ce2..680c2326ec 100644
> --- a/drivers/net/cpfl/cpfl_ethdev.c
> +++ b/drivers/net/cpfl/cpfl_ethdev.c
> @@ -1061,7 +1061,8 @@ static void
>  cpfl_handle_event_msg(struct idpf_vport *vport, uint8_t *msg, uint16_t
> msglen)  {
>  	struct virtchnl2_event *vc_event = (struct virtchnl2_event *)msg;
> -	struct rte_eth_dev *dev = (struct rte_eth_dev *)vport->dev;
> +	struct rte_eth_dev_data *data = vport->dev_data;
> +	struct rte_eth_dev *dev = &rte_eth_devices[data->port_id];
> 
>  	if (msglen < sizeof(struct virtchnl2_event)) {
>  		PMD_DRV_LOG(ERR, "Error event");
> @@ -1245,7 +1246,6 @@ cpfl_dev_vport_init(struct rte_eth_dev *dev, void
> *init_params)
>  	vport->adapter = &adapter->base;
>  	vport->sw_idx = param->idx;
>  	vport->devarg_id = param->devarg_id;
> -	vport->dev = dev;
> 
>  	memset(&create_vport_info, 0, sizeof(create_vport_info));
>  	ret = idpf_vport_info_init(vport, &create_vport_info); diff --git
> a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c index
> e01eb3a2ec..38ad4e7ac0 100644
> --- a/drivers/net/idpf/idpf_ethdev.c
> +++ b/drivers/net/idpf/idpf_ethdev.c
> @@ -1024,7 +1024,8 @@ static void
>  idpf_handle_event_msg(struct idpf_vport *vport, uint8_t *msg, uint16_t
> msglen)  {
>  	struct virtchnl2_event *vc_event = (struct virtchnl2_event *)msg;
> -	struct rte_eth_dev *dev = (struct rte_eth_dev *)vport->dev;
> +	struct rte_eth_dev_data *data = vport->dev_data;
> +	struct rte_eth_dev *dev = &rte_eth_devices[data->port_id];
> 
>  	if (msglen < sizeof(struct virtchnl2_event)) {
>  		PMD_DRV_LOG(ERR, "Error event");
> @@ -1235,7 +1236,6 @@ idpf_dev_vport_init(struct rte_eth_dev *dev, void
> *init_params)
>  	vport->adapter = &adapter->base;
>  	vport->sw_idx = param->idx;
>  	vport->devarg_id = param->devarg_id;
> -	vport->dev = dev;
> 
>  	memset(&create_vport_info, 0, sizeof(create_vport_info));
>  	ret = idpf_vport_info_init(vport, &create_vport_info);
> --
> 2.31.1


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

* RE: [PATCH] common/idpf: remove unnecessary field in vport
  2023-04-26  6:45 ` Xing, Beilei
@ 2023-04-26  6:53   ` Zhang, Qi Z
  0 siblings, 0 replies; 5+ messages in thread
From: Zhang, Qi Z @ 2023-04-26  6:53 UTC (permalink / raw)
  To: Xing, Beilei; +Cc: dev



> -----Original Message-----
> From: Xing, Beilei <beilei.xing@intel.com>
> Sent: Wednesday, April 26, 2023 2:46 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org
> Subject: RE: [PATCH] common/idpf: remove unnecessary field in vport
> 
> 
> 
> > -----Original Message-----
> > From: Zhang, Qi Z <qi.z.zhang@intel.com>
> > Sent: Friday, April 21, 2023 12:21 AM
> > To: Xing, Beilei <beilei.xing@intel.com>
> > Cc: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>
> > Subject: [PATCH] common/idpf: remove unnecessary field in vport
> >
> > Remove the pointer to rte_eth_dev instance, as 1. there is already a
> > pointer to rte_eth_dev_data.
> > 2. a pointer to rte_eth_dev will break multi-process usage.
> 
> Basically it's OK for me, do we need to add fix line?

the multi-process support has not been enabled  yet, so technically this is not a fix but code refactor.

> 
> >
> > Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> > ---
> >  drivers/common/idpf/idpf_common_device.h | 1 -
> >  drivers/net/cpfl/cpfl_ethdev.c           | 4 ++--
> >  drivers/net/idpf/idpf_ethdev.c           | 4 ++--
> >  3 files changed, 4 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/common/idpf/idpf_common_device.h
> > b/drivers/common/idpf/idpf_common_device.h
> > index 7a54f7c937..d29bcc71ab 100644
> > --- a/drivers/common/idpf/idpf_common_device.h
> > +++ b/drivers/common/idpf/idpf_common_device.h
> > @@ -117,7 +117,6 @@ struct idpf_vport {
> >
> >  	struct virtchnl2_vport_stats eth_stats_offset;
> >
> > -	void *dev;
> >  	/* Event from ipf */
> >  	bool link_up;
> >  	uint32_t link_speed;
> > diff --git a/drivers/net/cpfl/cpfl_ethdev.c
> > b/drivers/net/cpfl/cpfl_ethdev.c index f1d4425ce2..680c2326ec 100644
> > --- a/drivers/net/cpfl/cpfl_ethdev.c
> > +++ b/drivers/net/cpfl/cpfl_ethdev.c
> > @@ -1061,7 +1061,8 @@ static void
> >  cpfl_handle_event_msg(struct idpf_vport *vport, uint8_t *msg,
> > uint16_t
> > msglen)  {
> >  	struct virtchnl2_event *vc_event = (struct virtchnl2_event *)msg;
> > -	struct rte_eth_dev *dev = (struct rte_eth_dev *)vport->dev;
> > +	struct rte_eth_dev_data *data = vport->dev_data;
> > +	struct rte_eth_dev *dev = &rte_eth_devices[data->port_id];
> >
> >  	if (msglen < sizeof(struct virtchnl2_event)) {
> >  		PMD_DRV_LOG(ERR, "Error event");
> > @@ -1245,7 +1246,6 @@ cpfl_dev_vport_init(struct rte_eth_dev *dev,
> > void
> > *init_params)
> >  	vport->adapter = &adapter->base;
> >  	vport->sw_idx = param->idx;
> >  	vport->devarg_id = param->devarg_id;
> > -	vport->dev = dev;
> >
> >  	memset(&create_vport_info, 0, sizeof(create_vport_info));
> >  	ret = idpf_vport_info_init(vport, &create_vport_info); diff --git
> > a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c
> > index
> > e01eb3a2ec..38ad4e7ac0 100644
> > --- a/drivers/net/idpf/idpf_ethdev.c
> > +++ b/drivers/net/idpf/idpf_ethdev.c
> > @@ -1024,7 +1024,8 @@ static void
> >  idpf_handle_event_msg(struct idpf_vport *vport, uint8_t *msg,
> > uint16_t
> > msglen)  {
> >  	struct virtchnl2_event *vc_event = (struct virtchnl2_event *)msg;
> > -	struct rte_eth_dev *dev = (struct rte_eth_dev *)vport->dev;
> > +	struct rte_eth_dev_data *data = vport->dev_data;
> > +	struct rte_eth_dev *dev = &rte_eth_devices[data->port_id];
> >
> >  	if (msglen < sizeof(struct virtchnl2_event)) {
> >  		PMD_DRV_LOG(ERR, "Error event");
> > @@ -1235,7 +1236,6 @@ idpf_dev_vport_init(struct rte_eth_dev *dev,
> > void
> > *init_params)
> >  	vport->adapter = &adapter->base;
> >  	vport->sw_idx = param->idx;
> >  	vport->devarg_id = param->devarg_id;
> > -	vport->dev = dev;
> >
> >  	memset(&create_vport_info, 0, sizeof(create_vport_info));
> >  	ret = idpf_vport_info_init(vport, &create_vport_info);
> > --
> > 2.31.1


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

* RE: [PATCH] common/idpf: remove unnecessary field in vport
  2023-04-20 16:20 [PATCH] common/idpf: remove unnecessary field in vport Qi Zhang
  2023-04-26  6:45 ` Xing, Beilei
@ 2023-04-26  7:38 ` Xing, Beilei
  2023-04-26  8:04   ` Zhang, Qi Z
  1 sibling, 1 reply; 5+ messages in thread
From: Xing, Beilei @ 2023-04-26  7:38 UTC (permalink / raw)
  To: Zhang, Qi Z; +Cc: dev



> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Friday, April 21, 2023 12:21 AM
> To: Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>
> Subject: [PATCH] common/idpf: remove unnecessary field in vport
> 
> Remove the pointer to rte_eth_dev instance, as 1. there is already a pointer to
> rte_eth_dev_data.
> 2. a pointer to rte_eth_dev will break multi-process usage.
> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>

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

* RE: [PATCH] common/idpf: remove unnecessary field in vport
  2023-04-26  7:38 ` Xing, Beilei
@ 2023-04-26  8:04   ` Zhang, Qi Z
  0 siblings, 0 replies; 5+ messages in thread
From: Zhang, Qi Z @ 2023-04-26  8:04 UTC (permalink / raw)
  To: Xing, Beilei; +Cc: dev



> -----Original Message-----
> From: Xing, Beilei <beilei.xing@intel.com>
> Sent: Wednesday, April 26, 2023 3:38 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org
> Subject: RE: [PATCH] common/idpf: remove unnecessary field in vport
> 
> 
> 
> > -----Original Message-----
> > From: Zhang, Qi Z <qi.z.zhang@intel.com>
> > Sent: Friday, April 21, 2023 12:21 AM
> > To: Xing, Beilei <beilei.xing@intel.com>
> > Cc: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>
> > Subject: [PATCH] common/idpf: remove unnecessary field in vport
> >
> > Remove the pointer to rte_eth_dev instance, as 1. there is already a
> > pointer to rte_eth_dev_data.
> > 2. a pointer to rte_eth_dev will break multi-process usage.
> >
> > Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> Acked-by: Beilei Xing <beilei.xing@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi

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

end of thread, other threads:[~2023-04-26  8:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-20 16:20 [PATCH] common/idpf: remove unnecessary field in vport Qi Zhang
2023-04-26  6:45 ` Xing, Beilei
2023-04-26  6:53   ` Zhang, Qi Z
2023-04-26  7:38 ` Xing, Beilei
2023-04-26  8:04   ` 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).