DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/i40e: fix data path corrupt on secondary process
@ 2021-06-09  7:05 dapengx.yu
  2021-06-21  3:07 ` Zhang, Qi Z
  2021-06-21  7:23 ` [dpdk-dev] [PATCH v2] " dapengx.yu
  0 siblings, 2 replies; 4+ messages in thread
From: dapengx.yu @ 2021-06-09  7:05 UTC (permalink / raw)
  To: Beilei Xing; +Cc: dev, qi.z.zhang, Dapeng Yu, stable

From: Dapeng Yu <dapengx.yu@intel.com>

The rte_eth_devices array is not in share memory, it should not be
referenced by i40e_adapter which is shared by primary and secondary.
Any process set i40e_adapter->eth_dev will corrupt another process'
context.

The patch removed the field "eth_dev" from i40e_adapter.
Now, when the data paths try to access the rte_eth_dev_data instance,
they should replace adapter->eth_dev->data with adapter->pf.dev_data.

Fixes: 2bedd7277a10 ("net/i40e: print real global changes")
Fixes: 4861cde46116 ("i40e: new poll mode driver")
Fixes: be6c228d4da3 ("i40e: support Rx interrupt")
Fixes: 8e109464c022 ("i40e: allow vector Rx and Tx usage")
Fixes: 1d169e9dafb8 ("net/i40e: support cloud filter with L4 port")
Fixes: a778a1fa2e4e ("i40e: set up and initialize flow director")
Fixes: 460d1679586e ("drivers/net: delete HW rings while freeing queues")
Fixes: b0ea2716e05b ("net/i40e: add flow flush function")
Fixes: ef4c16fd9148 ("net/i40e: refactor RSS flow")
Fixes: 819a5c14d1dd ("net/i40e: fix null checks")
Fixes: e0cb96204b71 ("net/i40e: add support for representor ports")
Cc: stable@dpdk.org

Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c         | 44 +++++++++++++-------------
 drivers/net/i40e/i40e_ethdev.h         |  7 ++--
 drivers/net/i40e/i40e_fdir.c           |  4 +--
 drivers/net/i40e/i40e_flow.c           |  2 +-
 drivers/net/i40e/i40e_hash.c           |  7 ++--
 drivers/net/i40e/i40e_rxtx.c           |  4 +--
 drivers/net/i40e/i40e_vf_representor.c | 37 ++++++++++++----------
 7 files changed, 55 insertions(+), 50 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index dd61258739..ebaf20486f 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -732,10 +732,11 @@ i40e_write_global_rx_ctl(struct i40e_hw *hw, uint32_t reg_addr,
 			 uint32_t reg_val)
 {
 	uint32_t ori_reg_val;
-	struct rte_eth_dev *dev;
+	struct rte_eth_dev_data *dev_data =
+		((struct i40e_adapter *)hw->back)->pf.dev_data;
+	struct rte_eth_dev *dev = &rte_eth_devices[dev_data->port_id];
 
 	ori_reg_val = i40e_read_rx_ctl(hw, reg_addr);
-	dev = ((struct i40e_adapter *)hw->back)->eth_dev;
 	i40e_write_rx_ctl(hw, reg_addr, reg_val);
 	if (ori_reg_val != reg_val)
 		PMD_DRV_LOG(WARNING,
@@ -1321,7 +1322,9 @@ i40e_aq_debug_write_global_register(struct i40e_hw *hw,
 				    struct i40e_asq_cmd_details *cmd_details)
 {
 	uint64_t ori_reg_val;
-	struct rte_eth_dev *dev;
+	struct rte_eth_dev_data *dev_data =
+		((struct i40e_adapter *)hw->back)->pf.dev_data;
+	struct rte_eth_dev *dev = &rte_eth_devices[dev_data->port_id];
 	int ret;
 
 	ret = i40e_aq_debug_read_register(hw, reg_addr, &ori_reg_val, NULL);
@@ -1331,7 +1334,6 @@ i40e_aq_debug_write_global_register(struct i40e_hw *hw,
 			    reg_addr);
 		return -EIO;
 	}
-	dev = ((struct i40e_adapter *)hw->back)->eth_dev;
 
 	if (ori_reg_val != reg_val)
 		PMD_DRV_LOG(WARNING,
@@ -1450,7 +1452,6 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)
 	dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
 
 	pf->adapter = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
-	pf->adapter->eth_dev = dev;
 	pf->dev_data = dev->data;
 
 	hw->back = I40E_PF_TO_ADAPTER(pf);
@@ -1977,7 +1978,7 @@ i40e_dev_configure(struct rte_eth_dev *dev)
 void
 i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi)
 {
-	struct rte_eth_dev *dev = vsi->adapter->eth_dev;
+	struct rte_eth_dev *dev = I40E_VSI_TO_ETH_DEV(vsi);
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 	struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
@@ -2093,7 +2094,7 @@ __vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t msix_vect,
 int
 i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx)
 {
-	struct rte_eth_dev *dev = vsi->adapter->eth_dev;
+	struct rte_eth_dev *dev = I40E_VSI_TO_ETH_DEV(vsi);
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 	struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
@@ -2169,7 +2170,7 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx)
 void
 i40e_vsi_enable_queues_intr(struct i40e_vsi *vsi)
 {
-	struct rte_eth_dev *dev = vsi->adapter->eth_dev;
+	struct rte_eth_dev *dev = I40E_VSI_TO_ETH_DEV(vsi);
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 	struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
@@ -2196,7 +2197,7 @@ i40e_vsi_enable_queues_intr(struct i40e_vsi *vsi)
 void
 i40e_vsi_disable_queues_intr(struct i40e_vsi *vsi)
 {
-	struct rte_eth_dev *dev = vsi->adapter->eth_dev;
+	struct rte_eth_dev *dev = I40E_VSI_TO_ETH_DEV(vsi);
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 	struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
@@ -6411,8 +6412,7 @@ i40e_dev_tx_init(struct i40e_pf *pf)
 			break;
 	}
 	if (ret == I40E_SUCCESS)
-		i40e_set_tx_function(container_of(pf, struct i40e_adapter, pf)
-				     ->eth_dev);
+		i40e_set_tx_function(&rte_eth_devices[pf->dev_data->port_id]);
 
 	return ret;
 }
@@ -6440,8 +6440,7 @@ i40e_dev_rx_init(struct i40e_pf *pf)
 		}
 	}
 	if (ret == I40E_SUCCESS)
-		i40e_set_rx_function(container_of(pf, struct i40e_adapter, pf)
-				     ->eth_dev);
+		i40e_set_rx_function(&rte_eth_devices[pf->dev_data->port_id]);
 
 	return ret;
 }
@@ -7880,7 +7879,7 @@ i40e_status_code i40e_replace_mpls_l1_filter(struct i40e_pf *pf)
 	struct i40e_aqc_replace_cloud_filters_cmd  filter_replace;
 	struct i40e_aqc_replace_cloud_filters_cmd_buf  filter_replace_buf;
 	struct i40e_hw *hw = I40E_PF_TO_HW(pf);
-	struct rte_eth_dev *dev = ((struct i40e_adapter *)hw->back)->eth_dev;
+	struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id];
 	enum i40e_status_code status = I40E_SUCCESS;
 
 	if (pf->support_multi_driver) {
@@ -7941,7 +7940,7 @@ i40e_status_code i40e_replace_mpls_cloud_filter(struct i40e_pf *pf)
 	struct i40e_aqc_replace_cloud_filters_cmd  filter_replace;
 	struct i40e_aqc_replace_cloud_filters_cmd_buf  filter_replace_buf;
 	struct i40e_hw *hw = I40E_PF_TO_HW(pf);
-	struct rte_eth_dev *dev = ((struct i40e_adapter *)hw->back)->eth_dev;
+	struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id];
 	enum i40e_status_code status = I40E_SUCCESS;
 
 	if (pf->support_multi_driver) {
@@ -8016,7 +8015,7 @@ i40e_replace_gtp_l1_filter(struct i40e_pf *pf)
 	struct i40e_aqc_replace_cloud_filters_cmd  filter_replace;
 	struct i40e_aqc_replace_cloud_filters_cmd_buf  filter_replace_buf;
 	struct i40e_hw *hw = I40E_PF_TO_HW(pf);
-	struct rte_eth_dev *dev = ((struct i40e_adapter *)hw->back)->eth_dev;
+	struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id];
 	enum i40e_status_code status = I40E_SUCCESS;
 
 	if (pf->support_multi_driver) {
@@ -8104,7 +8103,7 @@ i40e_status_code i40e_replace_gtp_cloud_filter(struct i40e_pf *pf)
 	struct i40e_aqc_replace_cloud_filters_cmd  filter_replace;
 	struct i40e_aqc_replace_cloud_filters_cmd_buf  filter_replace_buf;
 	struct i40e_hw *hw = I40E_PF_TO_HW(pf);
-	struct rte_eth_dev *dev = ((struct i40e_adapter *)hw->back)->eth_dev;
+	struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id];
 	enum i40e_status_code status = I40E_SUCCESS;
 
 	if (pf->support_multi_driver) {
@@ -8179,7 +8178,7 @@ i40e_replace_port_l1_filter(struct i40e_pf *pf,
 	struct i40e_aqc_replace_cloud_filters_cmd  filter_replace;
 	enum i40e_status_code status = I40E_SUCCESS;
 	struct i40e_hw *hw = I40E_PF_TO_HW(pf);
-	struct rte_eth_dev *dev = ((struct i40e_adapter *)hw->back)->eth_dev;
+	struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id];
 
 	if (pf->support_multi_driver) {
 		PMD_DRV_LOG(ERR, "Replace l1 filter is not supported.");
@@ -8251,7 +8250,7 @@ i40e_replace_port_cloud_filter(struct i40e_pf *pf,
 	struct i40e_aqc_replace_cloud_filters_cmd  filter_replace;
 	enum i40e_status_code status = I40E_SUCCESS;
 	struct i40e_hw *hw = I40E_PF_TO_HW(pf);
-	struct rte_eth_dev *dev = ((struct i40e_adapter *)hw->back)->eth_dev;
+	struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id];
 
 	if (pf->support_multi_driver) {
 		PMD_DRV_LOG(ERR, "Replace cloud filter is not supported.");
@@ -9578,9 +9577,10 @@ void
 i40e_check_write_global_reg(struct i40e_hw *hw, uint32_t addr, uint32_t val)
 {
 	uint32_t reg = i40e_read_rx_ctl(hw, addr);
-	struct rte_eth_dev *dev;
+	struct rte_eth_dev_data *dev_data =
+		((struct i40e_adapter *)hw->back)->pf.dev_data;
+	struct rte_eth_dev *dev = &rte_eth_devices[dev_data->port_id];
 
-	dev = ((struct i40e_adapter *)hw->back)->eth_dev;
 	if (reg != val) {
 		i40e_write_rx_ctl(hw, addr, val);
 		PMD_DRV_LOG(WARNING,
@@ -12372,7 +12372,7 @@ i40e_cloud_filter_qinq_create(struct i40e_pf *pf)
 	struct i40e_aqc_replace_cloud_filters_cmd  filter_replace;
 	struct i40e_aqc_replace_cloud_filters_cmd_buf  filter_replace_buf;
 	struct i40e_hw *hw = I40E_PF_TO_HW(pf);
-	struct rte_eth_dev *dev = ((struct i40e_adapter *)hw->back)->eth_dev;
+	struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id];
 
 	if (pf->support_multi_driver) {
 		PMD_DRV_LOG(ERR, "Replace cloud filter is not supported.");
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index ba6acd1878..cbbb35780a 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -90,8 +90,10 @@
 	do {								\
 		uint32_t ori_val;					\
 		struct rte_eth_dev *dev;				\
+		struct rte_eth_dev_data *dev_data;			\
 		ori_val = I40E_READ_REG((hw), (reg));			\
-		dev = ((struct i40e_adapter *)hw->back)->eth_dev;	\
+		dev_data = ((struct i40e_adapter *)hw->back)->pf.dev_data; \
+		dev = &rte_eth_devices[dev_data->port_id];		\
 		I40E_PCI_REG_WRITE(I40E_PCI_REG_ADDR((hw),		\
 						     (reg)), (value));	\
 		if (ori_val != value)					\
@@ -1285,7 +1287,6 @@ struct i40e_vf {
 struct i40e_adapter {
 	/* Common for both PF and VF */
 	struct i40e_hw hw;
-	struct rte_eth_dev *eth_dev;
 
 	/* Specific for PF or VF */
 	union {
@@ -1540,7 +1541,7 @@ i40e_get_vsi_from_adapter(struct i40e_adapter *adapter)
 #define I40E_VSI_TO_DEV_DATA(vsi) \
 	(((struct i40e_vsi *)vsi)->adapter->pf.dev_data)
 #define I40E_VSI_TO_ETH_DEV(vsi) \
-	(((struct i40e_vsi *)vsi)->adapter->eth_dev)
+	(&rte_eth_devices[((struct i40e_vsi *)vsi)->adapter->pf.dev_data->port_id])
 
 /* I40E_PF_TO */
 #define I40E_PF_TO_HW(pf) \
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index ac0e09bfdd..6381d6ffea 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -160,7 +160,7 @@ i40e_fdir_setup(struct i40e_pf *pf)
 	int err = I40E_SUCCESS;
 	char z_name[RTE_MEMZONE_NAMESIZE];
 	const struct rte_memzone *mz = NULL;
-	struct rte_eth_dev *eth_dev = pf->adapter->eth_dev;
+	struct rte_eth_dev *eth_dev = &rte_eth_devices[pf->dev_data->port_id];
 	uint16_t i;
 
 	if ((pf->flags & I40E_FLAG_FDIR) == 0) {
@@ -284,7 +284,7 @@ i40e_fdir_teardown(struct i40e_pf *pf)
 {
 	struct i40e_hw *hw = I40E_PF_TO_HW(pf);
 	struct i40e_vsi *vsi;
-	struct rte_eth_dev *dev = pf->adapter->eth_dev;
+	struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id];
 
 	vsi = pf->fdir.fdir_vsi;
 	if (!vsi)
diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c
index 2cc9ad9ef7..4d214303c0 100644
--- a/drivers/net/i40e/i40e_flow.c
+++ b/drivers/net/i40e/i40e_flow.c
@@ -4897,7 +4897,7 @@ i40e_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *error)
 static int
 i40e_flow_flush_fdir_filter(struct i40e_pf *pf)
 {
-	struct rte_eth_dev *dev = pf->adapter->eth_dev;
+	struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id];
 	struct i40e_fdir_info *fdir_info = &pf->fdir;
 	struct i40e_fdir_filter *fdir_filter;
 	enum i40e_filter_pctype pctype;
diff --git a/drivers/net/i40e/i40e_hash.c b/drivers/net/i40e/i40e_hash.c
index b1cb24f437..b4590f9117 100644
--- a/drivers/net/i40e/i40e_hash.c
+++ b/drivers/net/i40e/i40e_hash.c
@@ -732,7 +732,7 @@ i40e_hash_config_region(struct i40e_pf *pf,
 			const struct i40e_rte_flow_rss_conf *rss_conf)
 {
 	struct i40e_hw *hw = &pf->adapter->hw;
-	struct rte_eth_dev *dev = pf->adapter->eth_dev;
+	struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id];
 	struct i40e_queue_region_info *regions = pf->queue_region.region;
 	uint32_t num = pf->queue_region.queue_region_number;
 	uint32_t i, region_id_mask = 0;
@@ -1262,6 +1262,7 @@ i40e_hash_reset_conf(struct i40e_pf *pf,
 		     struct i40e_rte_flow_rss_conf *rss_conf)
 {
 	struct i40e_hw *hw = &pf->adapter->hw;
+	struct rte_eth_dev *dev;
 	uint64_t inset;
 	uint32_t idx;
 	int ret;
@@ -1275,8 +1276,8 @@ i40e_hash_reset_conf(struct i40e_pf *pf,
 	}
 
 	if (rss_conf->misc_reset_flags & I40E_HASH_FLOW_RESET_FLAG_REGION) {
-		ret = i40e_flush_queue_region_all_conf(pf->adapter->eth_dev,
-						       hw, pf, 0);
+		dev = &rte_eth_devices[pf->dev_data->port_id];
+		ret = i40e_flush_queue_region_all_conf(dev, hw, pf, 0);
 		if (ret)
 			return ret;
 
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 808ed95864..ec6b444b94 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -3046,7 +3046,7 @@ i40e_fdir_setup_tx_resources(struct i40e_pf *pf)
 		return I40E_ERR_BAD_PTR;
 	}
 
-	dev = pf->adapter->eth_dev;
+	dev = &rte_eth_devices[pf->dev_data->port_id];
 
 	/* Allocate the TX queue data structure. */
 	txq = rte_zmalloc_socket("i40e fdir tx queue",
@@ -3104,7 +3104,7 @@ i40e_fdir_setup_rx_resources(struct i40e_pf *pf)
 		return I40E_ERR_BAD_PTR;
 	}
 
-	dev = pf->adapter->eth_dev;
+	dev = &rte_eth_devices[pf->dev_data->port_id];
 
 	/* Allocate the RX queue data structure. */
 	rxq = rte_zmalloc_socket("i40e fdir rx queue",
diff --git a/drivers/net/i40e/i40e_vf_representor.c b/drivers/net/i40e/i40e_vf_representor.c
index 7ed47c1a2c..0481b55381 100644
--- a/drivers/net/i40e/i40e_vf_representor.c
+++ b/drivers/net/i40e/i40e_vf_representor.c
@@ -19,15 +19,18 @@ i40e_vf_representor_link_update(struct rte_eth_dev *ethdev,
 	int wait_to_complete)
 {
 	struct i40e_vf_representor *representor = ethdev->data->dev_private;
+	struct rte_eth_dev *dev =
+		&rte_eth_devices[representor->adapter->pf.dev_data->port_id];
 
-	return i40e_dev_link_update(representor->adapter->eth_dev,
-		wait_to_complete);
+	return i40e_dev_link_update(dev, wait_to_complete);
 }
 static int
 i40e_vf_representor_dev_infos_get(struct rte_eth_dev *ethdev,
 	struct rte_eth_dev_info *dev_info)
 {
 	struct i40e_vf_representor *representor = ethdev->data->dev_private;
+	struct rte_eth_dev_data *pf_dev_data =
+		representor->adapter->pf.dev_data;
 
 	/* get dev info for the vdev */
 	dev_info->device = ethdev->device;
@@ -99,7 +102,7 @@ i40e_vf_representor_dev_infos_get(struct rte_eth_dev *ethdev,
 	};
 
 	dev_info->switch_info.name =
-		representor->adapter->eth_dev->device->name;
+		rte_eth_devices[pf_dev_data->port_id].device->name;
 	dev_info->switch_info.domain_id = representor->switch_domain_id;
 	dev_info->switch_info.port_id = representor->vf_id;
 
@@ -213,7 +216,7 @@ i40e_vf_representor_stats_get(struct rte_eth_dev *ethdev,
 	int ret;
 
 	ret = rte_pmd_i40e_get_vf_native_stats(
-		representor->adapter->eth_dev->data->port_id,
+		representor->adapter->pf.dev_data->port_id,
 		representor->vf_id, &native_stats);
 	if (ret == 0) {
 		i40evf_stat_update_48(
@@ -273,7 +276,7 @@ i40e_vf_representor_stats_reset(struct rte_eth_dev *ethdev)
 	struct i40e_vf_representor *representor = ethdev->data->dev_private;
 
 	return rte_pmd_i40e_get_vf_native_stats(
-		representor->adapter->eth_dev->data->port_id,
+		representor->adapter->pf.dev_data->port_id,
 		representor->vf_id, &representor->stats_offset);
 }
 
@@ -283,7 +286,7 @@ i40e_vf_representor_promiscuous_enable(struct rte_eth_dev *ethdev)
 	struct i40e_vf_representor *representor = ethdev->data->dev_private;
 
 	return rte_pmd_i40e_set_vf_unicast_promisc(
-		representor->adapter->eth_dev->data->port_id,
+		representor->adapter->pf.dev_data->port_id,
 		representor->vf_id, 1);
 }
 
@@ -293,7 +296,7 @@ i40e_vf_representor_promiscuous_disable(struct rte_eth_dev *ethdev)
 	struct i40e_vf_representor *representor = ethdev->data->dev_private;
 
 	return rte_pmd_i40e_set_vf_unicast_promisc(
-		representor->adapter->eth_dev->data->port_id,
+		representor->adapter->pf.dev_data->port_id,
 		representor->vf_id, 0);
 }
 
@@ -303,7 +306,7 @@ i40e_vf_representor_allmulticast_enable(struct rte_eth_dev *ethdev)
 	struct i40e_vf_representor *representor = ethdev->data->dev_private;
 
 	return rte_pmd_i40e_set_vf_multicast_promisc(
-		representor->adapter->eth_dev->data->port_id,
+		representor->adapter->pf.dev_data->port_id,
 		representor->vf_id,  1);
 }
 
@@ -313,7 +316,7 @@ i40e_vf_representor_allmulticast_disable(struct rte_eth_dev *ethdev)
 	struct i40e_vf_representor *representor = ethdev->data->dev_private;
 
 	return rte_pmd_i40e_set_vf_multicast_promisc(
-		representor->adapter->eth_dev->data->port_id,
+		representor->adapter->pf.dev_data->port_id,
 		representor->vf_id,  0);
 }
 
@@ -323,7 +326,7 @@ i40e_vf_representor_mac_addr_remove(struct rte_eth_dev *ethdev, uint32_t index)
 	struct i40e_vf_representor *representor = ethdev->data->dev_private;
 
 	rte_pmd_i40e_remove_vf_mac_addr(
-		representor->adapter->eth_dev->data->port_id,
+		representor->adapter->pf.dev_data->port_id,
 		representor->vf_id, &ethdev->data->mac_addrs[index]);
 }
 
@@ -334,7 +337,7 @@ i40e_vf_representor_mac_addr_set(struct rte_eth_dev *ethdev,
 	struct i40e_vf_representor *representor = ethdev->data->dev_private;
 
 	return rte_pmd_i40e_set_vf_mac_addr(
-		representor->adapter->eth_dev->data->port_id,
+		representor->adapter->pf.dev_data->port_id,
 		representor->vf_id, mac_addr);
 }
 
@@ -346,7 +349,7 @@ i40e_vf_representor_vlan_filter_set(struct rte_eth_dev *ethdev,
 	uint64_t vf_mask = 1ULL << representor->vf_id;
 
 	return rte_pmd_i40e_set_vf_vlan_filter(
-		representor->adapter->eth_dev->data->port_id,
+		representor->adapter->pf.dev_data->port_id,
 		vlan_id, vf_mask, on);
 }
 
@@ -360,7 +363,7 @@ i40e_vf_representor_vlan_offload_set(struct rte_eth_dev *ethdev, int mask)
 	struct i40e_pf *pf;
 	uint32_t vfid;
 
-	pdev = representor->adapter->eth_dev;
+	pdev = &rte_eth_devices[representor->adapter->pf.dev_data->port_id];
 	vfid = representor->vf_id;
 
 	if (!is_i40e_supported(pdev)) {
@@ -410,7 +413,7 @@ i40e_vf_representor_vlan_strip_queue_set(struct rte_eth_dev *ethdev,
 	struct i40e_vf_representor *representor = ethdev->data->dev_private;
 
 	rte_pmd_i40e_set_vf_vlan_stripq(
-		representor->adapter->eth_dev->data->port_id,
+		representor->adapter->pf.dev_data->port_id,
 		representor->vf_id, on);
 }
 
@@ -421,7 +424,7 @@ i40e_vf_representor_vlan_pvid_set(struct rte_eth_dev *ethdev, uint16_t vlan_id,
 	struct i40e_vf_representor *representor = ethdev->data->dev_private;
 
 	return rte_pmd_i40e_set_vf_vlan_insert(
-		representor->adapter->eth_dev->data->port_id,
+		representor->adapter->pf.dev_data->port_id,
 		representor->vf_id, vlan_id);
 }
 
@@ -487,7 +490,7 @@ i40e_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params)
 		((struct i40e_vf_representor *)init_params)->adapter;
 
 	pf = I40E_DEV_PRIVATE_TO_PF(
-		representor->adapter->eth_dev->data->dev_private);
+		representor->adapter->pf.dev_data->dev_private);
 
 	if (representor->vf_id >= pf->vf_num)
 		return -ENODEV;
@@ -519,7 +522,7 @@ i40e_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params)
 	ethdev->data->mac_addrs = &vf->mac_addr;
 
 	/* Link state. Inherited from PF */
-	link = &representor->adapter->eth_dev->data->dev_link;
+	link = &representor->adapter->pf.dev_data->dev_link;
 
 	ethdev->data->dev_link.link_speed = link->link_speed;
 	ethdev->data->dev_link.link_duplex = link->link_duplex;
-- 
2.27.0


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

end of thread, other threads:[~2021-07-01 12:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09  7:05 [dpdk-dev] [PATCH] net/i40e: fix data path corrupt on secondary process dapengx.yu
2021-06-21  3:07 ` Zhang, Qi Z
2021-06-21  7:23 ` [dpdk-dev] [PATCH v2] " dapengx.yu
2021-07-01 12:37   ` 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).