DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ke Zhang <ke1x.zhang@intel.com>
To: thomas@monjalon.net, yuying.zhang@intel.com,
	beilei.xing@intel.com, ferruh.yigit@xilinx.com,
	yidingx.zhou@intel.com, dev@dpdk.org
Cc: Ke Zhang <ke1x.zhang@intel.com>, stable@dpdk.org
Subject: [PATCH v4] net/i40e: fix the issue caused by PF and VF release order
Date: Fri, 15 Jul 2022 17:03:59 +0800	[thread overview]
Message-ID: <20220715090359.76538-1-ke1x.zhang@intel.com> (raw)
In-Reply-To: <20220713071112.6182-1-ke1x.zhang@intel.com>

A segmentation fault occurs when testpmd exit.

This is due to fetching the device name from PF, PF
is freed firstly and then VF representor is called
later.

This commit fixes the bug by fetching the device
name from VF representor not PF.

Fixes: e391a7b7f815 ("net/i40e: fix multi-process shared data")
Cc: stable@dpdk.org

Signed-off-by: Ke Zhang <ke1x.zhang@intel.com>

---
v4: Update the commit log
v3: Change the design and fix code in driver
v2: Change the testpmd code to fix this issue
---
---
 drivers/net/i40e/i40e_vf_representor.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/i40e/i40e_vf_representor.c b/drivers/net/i40e/i40e_vf_representor.c
index 7f8e81858e..bcd445bcdd 100644
--- a/drivers/net/i40e/i40e_vf_representor.c
+++ b/drivers/net/i40e/i40e_vf_representor.c
@@ -29,8 +29,6 @@ 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;
@@ -104,7 +102,7 @@ i40e_vf_representor_dev_infos_get(struct rte_eth_dev *ethdev,
 	};
 
 	dev_info->switch_info.name =
-		rte_eth_devices[pf_dev_data->port_id].device->name;
+		rte_eth_devices[ethdev->data->port_id].device->name;
 	dev_info->switch_info.domain_id = representor->switch_domain_id;
 	dev_info->switch_info.port_id = representor->vf_id;
 
-- 
2.25.1


  parent reply	other threads:[~2022-07-15  9:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-22  7:18 [PATCH] app/testpmd: fix quit testpmd with vfs and pf Ke Zhang
2022-03-28 10:06 ` Singh, Aman Deep
2022-03-31  8:28   ` Singh, Aman Deep
2022-06-17 18:53   ` Ferruh Yigit
2022-06-21  9:03 ` [PATCH v2] " Ke Zhang
2022-06-21  9:20   ` Ferruh Yigit
2022-06-21  9:24 ` Ke Zhang
2022-06-21 10:43   ` Ferruh Yigit
2022-06-22 21:31     ` Thomas Monjalon
2022-06-23  6:41       ` Thomas Monjalon
2022-07-13  7:11   ` [PATCH v3] " Ke Zhang
2022-07-13  9:15     ` Thomas Monjalon
2022-07-15  9:03     ` Ke Zhang [this message]
2022-08-02  2:16       ` [PATCH v4] net/i40e: fix the issue caused by PF and VF release order Zhang, Yuying
2022-08-08  0:06         ` Zhang, Qi Z
2022-08-08  0:30           ` Zhang, Qi Z
2022-08-04  9:50       ` [PATCH v5] " Ke Zhang
2022-08-08  0:30         ` 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=20220715090359.76538-1-ke1x.zhang@intel.com \
    --to=ke1x.zhang@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@xilinx.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    --cc=yidingx.zhou@intel.com \
    --cc=yuying.zhang@intel.com \
    /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).