From: Qi Zhang <qi.z.zhang@intel.com>
To: beilei.xing@intel.com
Cc: dev@dpdk.org, Qi Zhang <qi.z.zhang@intel.com>
Subject: [PATCH] common/idpf: remove unnecessary field in vport
Date: Thu, 20 Apr 2023 12:20:38 -0400 [thread overview]
Message-ID: <20230420162038.637079-1-qi.z.zhang@intel.com> (raw)
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
next reply other threads:[~2023-04-20 8:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-20 16:20 Qi Zhang [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230420162038.637079-1-qi.z.zhang@intel.com \
--to=qi.z.zhang@intel.com \
--cc=beilei.xing@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).