Skip to contentSkip to conversation

driver: i40evf device initialization

PATCH In review Ben Magistro 4 participants 14 messages Aug 25, 2021 – Nov 27, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 driver: i40evf device initialization

The i40evf driver is not initializing the eth_dev attribute which can result in a nullptr dereference. Changes were modeled after the iavf_dev_init() per suggestion from the mailing list[1].

[1] https://mails.dpdk.org/archives/dev/2021-August/217251.html

---
 drivers/net/i40e/i40e_ethdev_vf.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_ethdev_vf.c +6 -2
index 0cfe13b7b2..ccdce9a16a 100644
@@ -1564,8 +1564,9 @@ i40evf_dev_alarm_handler(void *param)
 static int
 i40evf_dev_init(struct rte_eth_dev *eth_dev)
 {
-	struct i40e_hw *hw
-		= I40E_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	struct i40e_adapter *adapter =
+		I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private);
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(adapter);
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
 
 	PMD_INIT_FUNC_TRACE();
@@ -1596,11 +1597,14 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
 	hw->device_id = pci_dev->id.device_id;
 	hw->subsystem_vendor_id = pci_dev->id.subsystem_vendor_id;
 	hw->subsystem_device_id = pci_dev->id.subsystem_device_id;
+	hw->bus.bus_id = pci_dev->addr.bus;
 	hw->bus.device = pci_dev->addr.devid;
 	hw->bus.func = pci_dev->addr.function;
 	hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
 	hw->adapter_stopped = 1;
 	hw->adapter_closed = 0;
+	hw->back = I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private);
+	adapter->eth_dev = eth_dev;
 
 	if(i40evf_init_vf(eth_dev) != 0) {
 		PMD_INIT_LOG(ERR, "Init vf failed");
Signature · 1 line
2.27.0
#1 lore raw
Quoted 7 lines · Ben Magistro

The i40evf driver is not initializing the eth_dev attribute which can result in a nullptr dereference. Changes were modeled after the iavf_dev_init() per suggestion from the mailing list[1].

[1] https://mails.dpdk.org/archives/dev/2021-August/217251.html

i40evf will be removed in this release. But I guess it helps for stable releases to first merge the fixes and later removed it, not sure.

@Luca, @Kevin, do you prefer this patch directly to stable repos, or through the main repo?
i40evf won't be tested in the main anyway, since it would be removed before -rc1 testing, so it looks like there won't be any difference from testing point of view.

Quoted 36 lines
---
 drivers/net/i40e/i40e_ethdev_vf.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_ethdev_vf.c +6 -2
index 0cfe13b7b2..ccdce9a16a 100644
@@ -1564,8 +1564,9 @@ i40evf_dev_alarm_handler(void *param)
 static int
 i40evf_dev_init(struct rte_eth_dev *eth_dev)
 {
-	struct i40e_hw *hw
-		= I40E_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	struct i40e_adapter *adapter =
+		I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private);
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(adapter);
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
 
 	PMD_INIT_FUNC_TRACE();
@@ -1596,11 +1597,14 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
 	hw->device_id = pci_dev->id.device_id;
 	hw->subsystem_vendor_id = pci_dev->id.subsystem_vendor_id;
 	hw->subsystem_device_id = pci_dev->id.subsystem_device_id;
+	hw->bus.bus_id = pci_dev->addr.bus;
 	hw->bus.device = pci_dev->addr.devid;
 	hw->bus.func = pci_dev->addr.function;
 	hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
 	hw->adapter_stopped = 1;
 	hw->adapter_closed = 0;
+	hw->back = I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private);
+	adapter->eth_dev = eth_dev;
 
 	if(i40evf_init_vf(eth_dev) != 0) {
 		PMD_INIT_LOG(ERR, "Init vf failed");
#2 lore raw

+ Christian and Xueming

Quoted 7 lines · Ferruh Yigit
Quoted 6 lines · Ben Magistro

The i40evf driver is not initializing the eth_dev attribute which can result in a nullptr dereference. Changes were modeled after the iavf_dev_init() per suggestion from the mailing list[1].

[1] https://mails.dpdk.org/archives/dev/2021-August/217251.html

Quoted 7 lines
Quoted 1 line

i40evf will be removed in this release. But I guess it helps for stable releases to first merge the fixes and later removed it, not sure.

@Luca, @Kevin, do you prefer this patch directly to stable repos, or through the main repo?

I'll leave to Luca/Xueming and Christian to say if they have a preference, but I'd guess either way is fine from stable view once it has fixes/stable tags or LTS patch prefix (it doesn't have any of these at present).

Quoted 41 lines

i40evf won't be tested in the main anyway, since it would be removed before -rc1 testing, so it looks like there won't be any difference from testing point of view.

Quoted 36 lines
---
 drivers/net/i40e/i40e_ethdev_vf.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_ethdev_vf.c +6 -2
index 0cfe13b7b2..ccdce9a16a 100644
@@ -1564,8 +1564,9 @@ i40evf_dev_alarm_handler(void *param)
 static int
 i40evf_dev_init(struct rte_eth_dev *eth_dev)
 {
-	struct i40e_hw *hw
-		= I40E_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	struct i40e_adapter *adapter =
+		I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private);
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(adapter);
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
 
 	PMD_INIT_FUNC_TRACE();
@@ -1596,11 +1597,14 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
 	hw->device_id = pci_dev->id.device_id;
 	hw->subsystem_vendor_id = pci_dev->id.subsystem_vendor_id;
 	hw->subsystem_device_id = pci_dev->id.subsystem_device_id;
+	hw->bus.bus_id = pci_dev->addr.bus;
 	hw->bus.device = pci_dev->addr.devid;
 	hw->bus.func = pci_dev->addr.function;
 	hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
 	hw->adapter_stopped = 1;
 	hw->adapter_closed = 0;
+	hw->back = I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private);
+	adapter->eth_dev = eth_dev;
 
 	if(i40evf_init_vf(eth_dev) != 0) {
 		PMD_INIT_LOG(ERR, "Init vf failed");
#3 lore raw
Quoted 23 lines

-----Original Message-----
From: Kevin Traynor <[email protected]>
Sent: Thursday, August 26, 2021 6:46 PM
To: Ferruh Yigit <[email protected]>; Ben Magistro <[email protected]>; [email protected]; Beilei Xing <[email protected]>; Luca Boccassi <[email protected]>; Christian Ehrhardt <[email protected]>; Xueming(Steven) Li <[email protected]>
Cc: [email protected]; [email protected]; Qi Zhang <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] driver: i40evf device initialization

+ Christian and Xueming

Quoted 9 lines · Ferruh Yigit
Quoted 7 lines · Ben Magistro

The i40evf driver is not initializing the eth_dev attribute which can result in a nullptr dereference. Changes were modeled after the iavf_dev_init() per suggestion from the mailing list[1].

[1] https://mails.dpdk.org/archives/dev/2021-August/217251.html

Quoted 8 lines
Quoted 5 lines

i40evf will be removed in this release. But I guess it helps for stable releases to first merge the fixes and later removed it, not sure.

@Luca, @Kevin, do you prefer this patch directly to stable repos, or through the main repo?

I'll leave to Luca/Xueming and Christian to say if they have a preference, but I'd guess either way is fine from stable view once it has fixes/stable tags or LTS patch prefix (it doesn't have any of these at present).

Yes, any option will make it being noticed by LTS maintainer:
1. patches accepted by main with "fix" in subject
2. patches accepted by main with "cc: [email protected]" in commit message
3. patches backported to LTS, sent to stable maillist with LTS prefix, for example "[20.11]"

Quoted 41 lines
Quoted 41 lines

i40evf won't be tested in the main anyway, since it would be removed
before -rc1 testing, so it looks like there won't be any difference from testing point of view.

Quoted 35 lines
---
 drivers/net/i40e/i40e_ethdev_vf.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_ethdev_vf.c +6 -2
index 0cfe13b7b2..ccdce9a16a 100644
@@ -1564,8 +1564,9 @@ i40evf_dev_alarm_handler(void *param)  static
 int  i40evf_dev_init(struct rte_eth_dev *eth_dev)  {
-	struct i40e_hw *hw
-		= I40E_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	struct i40e_adapter *adapter =
+		I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private);
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(adapter);
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
 
 	PMD_INIT_FUNC_TRACE();
@@ -1596,11 +1597,14 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
 	hw->device_id = pci_dev->id.device_id;
 	hw->subsystem_vendor_id = pci_dev->id.subsystem_vendor_id;
 	hw->subsystem_device_id = pci_dev->id.subsystem_device_id;
+	hw->bus.bus_id = pci_dev->addr.bus;
 	hw->bus.device = pci_dev->addr.devid;
 	hw->bus.func = pci_dev->addr.function;
 	hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
 	hw->adapter_stopped = 1;
 	hw->adapter_closed = 0;
+	hw->back = I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private);
+	adapter->eth_dev = eth_dev;
 
 	if(i40evf_init_vf(eth_dev) != 0) {
 		PMD_INIT_LOG(ERR, "Init vf failed");
#4 lore raw
Quoted 29 lines · Xueming(Steven) Li
Quoted 29 lines

-----Original Message-----
From: Kevin Traynor <[email protected]>
Sent: Thursday, August 26, 2021 6:46 PM
To: Ferruh Yigit <[email protected]>; Ben Magistro <[email protected]>; [email protected]; Beilei Xing <[email protected]>; Luca Boccassi <[email protected]>; Christian Ehrhardt <[email protected]>; Xueming(Steven) Li <[email protected]>
Cc: [email protected]; [email protected]; Qi Zhang <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] driver: i40evf device initialization

+ Christian and Xueming

Quoted 14 lines · Ferruh Yigit
Quoted 7 lines · Ben Magistro

The i40evf driver is not initializing the eth_dev attribute which can result in a nullptr dereference. Changes were modeled after the iavf_dev_init() per suggestion from the mailing list[1].

[1] https://mails.dpdk.org/archives/dev/2021-August/217251.html

i40evf will be removed in this release. But I guess it helps for stable releases to first merge the fixes and later removed it, not sure.

@Luca, @Kevin, do you prefer this patch directly to stable repos, or through the main repo?

Quoted 8 lines
Quoted 2 lines

I'll leave to Luca/Xueming and Christian to say if they have a preference, but I'd guess either way is fine from stable view once it has fixes/stable tags or LTS patch prefix (it doesn't have any of these at present).

Yes, any option will make it being noticed by LTS maintainer:
1. patches accepted by main with "fix" in subject
2. patches accepted by main with "cc: [email protected]" in commit message
3. patches backported to LTS, sent to stable maillist with LTS prefix, for example "[20.11]"

Thanks Xueming,

But is there a preferences for this case?

The i40evf will be removed from main repo, is it better
1- first apply the fix and remove the component from main (I assume fix still will be bacported to LTS in this case)
or
2- remove the i40evf from main (without fix), apply the fix directly to the LTS.

Thanks,
ferruh

Quoted 42 lines
Quoted 41 lines
Quoted 41 lines

i40evf won't be tested in the main anyway, since it would be removed
before -rc1 testing, so it looks like there won't be any difference from testing point of view.

Quoted 35 lines
---
 drivers/net/i40e/i40e_ethdev_vf.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_ethdev_vf.c +6 -2
index 0cfe13b7b2..ccdce9a16a 100644
@@ -1564,8 +1564,9 @@ i40evf_dev_alarm_handler(void *param)  static
 int  i40evf_dev_init(struct rte_eth_dev *eth_dev)  {
-	struct i40e_hw *hw
-		= I40E_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	struct i40e_adapter *adapter =
+		I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private);
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(adapter);
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
 
 	PMD_INIT_FUNC_TRACE();
@@ -1596,11 +1597,14 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
 	hw->device_id = pci_dev->id.device_id;
 	hw->subsystem_vendor_id = pci_dev->id.subsystem_vendor_id;
 	hw->subsystem_device_id = pci_dev->id.subsystem_device_id;
+	hw->bus.bus_id = pci_dev->addr.bus;
 	hw->bus.device = pci_dev->addr.devid;
 	hw->bus.func = pci_dev->addr.function;
 	hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
 	hw->adapter_stopped = 1;
 	hw->adapter_closed = 0;
+	hw->back = I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private);
+	adapter->eth_dev = eth_dev;
 
 	if(i40evf_init_vf(eth_dev) != 0) {
 		PMD_INIT_LOG(ERR, "Init vf failed");
#5 lore raw
Quoted 54 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Monday, August 30, 2021 5:43 PM
To: Xueming(Steven) Li <[email protected]>; Kevin Traynor <[email protected]>; Ben Magistro <[email protected]>; [email protected]; Beilei Xing <[email protected]>; Luca Boccassi <[email protected]>; Christian Ehrhardt <[email protected]>
Cc: [email protected]; [email protected]; Qi Zhang <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] driver: i40evf device initialization

Quoted 26 lines · Xueming(Steven) Li
Quoted 26 lines

-----Original Message-----
From: Kevin Traynor <[email protected]>
Sent: Thursday, August 26, 2021 6:46 PM
To: Ferruh Yigit <[email protected]>; Ben Magistro <[email protected]>; [email protected]; Beilei Xing <[email protected]>; Luca Boccassi <[email protected]>; Christian Ehrhardt <[email protected]>; Xueming(Steven) Li <[email protected]>
Cc: [email protected]; [email protected]; Qi Zhang <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] driver: i40evf device initialization

+ Christian and Xueming

Quoted 9 lines · Ferruh Yigit
Quoted 7 lines · Ben Magistro

The i40evf driver is not initializing the eth_dev attribute which can result in a nullptr dereference. Changes were modeled after the iavf_dev_init() per suggestion from the mailing list[1].

[1] https://mails.dpdk.org/archives/dev/2021-August/217251.html

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

i40evf will be removed in this release. But I guess it helps for stable releases to first merge the fixes and later removed it, not sure.

@Luca, @Kevin, do you prefer this patch directly to stable repos, or through the main repo?

I'll leave to Luca/Xueming and Christian to say if they have a
preference, but I'd guess either way is fine from stable view once it has fixes/stable tags or LTS patch prefix (it doesn't have any of

these at present).

Quoted 6 lines

Yes, any option will make it being noticed by LTS maintainer:
1. patches accepted by main with "fix" in subject 2. patches accepted by main with "cc: [email protected]" in commit message 3. patches backported to LTS, sent to stable maillist with LTS prefix, for example "[20.11]"

Quoted 7 lines

Thanks Xueming,

But is there a preferences for this case?

The i40evf will be removed from main repo, is it better
1- first apply the fix and remove the component from main (I assume fix still will be bacported to LTS in this case) or 2- remove the i40evf from main (without fix), apply the fix directly to the LTS.

Both options will work, the first is more easy and common I guess, both 19.11 LTS and 20.11 LTS maintainer can find it.

Quoted 46 lines

Thanks,
ferruh

Quoted 42 lines
Quoted 41 lines
Quoted 41 lines

i40evf won't be tested in the main anyway, since it would be removed
before -rc1 testing, so it looks like there won't be any difference from testing point of view.

Quoted 35 lines
---
 drivers/net/i40e/i40e_ethdev_vf.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_ethdev_vf.c +6 -2
index 0cfe13b7b2..ccdce9a16a 100644
@@ -1564,8 +1564,9 @@ i40evf_dev_alarm_handler(void *param)  static
 int  i40evf_dev_init(struct rte_eth_dev *eth_dev)  {
-	struct i40e_hw *hw
-		= I40E_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	struct i40e_adapter *adapter =
+		I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private);
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(adapter);
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
 
 	PMD_INIT_FUNC_TRACE();
@@ -1596,11 +1597,14 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
 	hw->device_id = pci_dev->id.device_id;
 	hw->subsystem_vendor_id = pci_dev->id.subsystem_vendor_id;
 	hw->subsystem_device_id = pci_dev->id.subsystem_device_id;
+	hw->bus.bus_id = pci_dev->addr.bus;
 	hw->bus.device = pci_dev->addr.devid;
 	hw->bus.func = pci_dev->addr.function;
 	hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
 	hw->adapter_stopped = 1;
 	hw->adapter_closed = 0;
+	hw->back = I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private);
+	adapter->eth_dev = eth_dev;
 
 	if(i40evf_init_vf(eth_dev) != 0) {
 		PMD_INIT_LOG(ERR, "Init vf failed");
#6 lore raw

+cc: [email protected]

Per discussions here, cc'ing stable for fix to be applied to LTS as i40evf is being removed from next.

Quoted 112 lines · Xueming(Steven) Li
Quoted 55 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Monday, August 30, 2021 5:43 PM
To: Xueming(Steven) Li <[email protected]>; Kevin Traynor <[email protected]>; Ben Magistro <[email protected]>; [email protected]; Beilei Xing <[email protected]>; Luca Boccassi <[email protected]>; Christian Ehrhardt <[email protected]>
Cc: [email protected]; [email protected]; Qi Zhang <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] driver: i40evf device initialization

Quoted 26 lines · Xueming(Steven) Li
Quoted 26 lines

-----Original Message-----
From: Kevin Traynor <[email protected]>
Sent: Thursday, August 26, 2021 6:46 PM
To: Ferruh Yigit <[email protected]>; Ben Magistro <[email protected]>; [email protected]; Beilei Xing <[email protected]>; Luca Boccassi <[email protected]>; Christian Ehrhardt <[email protected]>; Xueming(Steven) Li <[email protected]>
Cc: [email protected]; [email protected]; Qi Zhang <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] driver: i40evf device initialization

+ Christian and Xueming

Quoted 9 lines · Ferruh Yigit
Quoted 7 lines · Ben Magistro

The i40evf driver is not initializing the eth_dev attribute which can result in a nullptr dereference. Changes were modeled after the iavf_dev_init() per suggestion from the mailing list[1].

[1] https://mails.dpdk.org/archives/dev/2021-August/217251.html

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

i40evf will be removed in this release. But I guess it helps for stable releases to first merge the fixes and later removed it, not sure.

@Luca, @Kevin, do you prefer this patch directly to stable repos, or through the main repo?

I'll leave to Luca/Xueming and Christian to say if they have a
preference, but I'd guess either way is fine from stable view once it has fixes/stable tags or LTS patch prefix (it doesn't have any of

these at present).

Quoted 6 lines

Yes, any option will make it being noticed by LTS maintainer:
1. patches accepted by main with "fix" in subject 2. patches accepted by main with "cc: [email protected]" in commit message 3. patches backported to LTS, sent to stable maillist with LTS prefix, for example "[20.11]"

Quoted 7 lines

Thanks Xueming,

But is there a preferences for this case?

The i40evf will be removed from main repo, is it better
1- first apply the fix and remove the component from main (I assume fix still will be bacported to LTS in this case) or 2- remove the i40evf from main (without fix), apply the fix directly to the LTS.

Both options will work, the first is more easy and common I guess, both 19.11 LTS and 20.11 LTS maintainer can find it.

Quoted 46 lines

Thanks,
ferruh

Quoted 42 lines
Quoted 41 lines
Quoted 41 lines

i40evf won't be tested in the main anyway, since it would be removed
before -rc1 testing, so it looks like there won't be any difference from testing point of view.

Quoted 35 lines
---
 drivers/net/i40e/i40e_ethdev_vf.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_ethdev_vf.c +6 -2
index 0cfe13b7b2..ccdce9a16a 100644
@@ -1564,8 +1564,9 @@ i40evf_dev_alarm_handler(void *param)  static
 int  i40evf_dev_init(struct rte_eth_dev *eth_dev)  {
-        struct i40e_hw *hw
-                = I40E_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+        struct i40e_adapter *adapter =
+                I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private);
+        struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(adapter);
         struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
 
         PMD_INIT_FUNC_TRACE();
@@ -1596,11 +1597,14 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
         hw->device_id = pci_dev->id.device_id;
         hw->subsystem_vendor_id = pci_dev->id.subsystem_vendor_id;
         hw->subsystem_device_id = pci_dev->id.subsystem_device_id;
+        hw->bus.bus_id = pci_dev->addr.bus;
         hw->bus.device = pci_dev->addr.devid;
         hw->bus.func = pci_dev->addr.function;
         hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
         hw->adapter_stopped = 1;
         hw->adapter_closed = 0;
+        hw->back = I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private);
+        adapter->eth_dev = eth_dev;
 
         if(i40evf_init_vf(eth_dev) != 0) {
                 PMD_INIT_LOG(ERR, "Init vf failed");
#7 lore raw

Hello,

Replying here as I'm a little stuck and hoping someone has some advice for what the next steps should be.

Going from the list above of how to get this noticed by the LTS maintainer(s), the patch, well commit message + subject were revised and resent to the list (
https://patches.dpdk.org/project/dpdk/patch/[email protected]/)
but the i40evf has since been removed from main already so options 1 & 2 seem to no longer apply. This seems to put us into option 3 of a backported patch? Is it just a subject line change then or can this be pulled out of the "not applicable" pile still?

Thanks and appreciate the advice,

Ben Magistro

Quoted 143 lines · Ben Magistro

+cc: [email protected]

Per discussions here, cc'ing stable for fix to be applied to LTS as i40evf is being removed from next.

Quoted 7 lines · Xueming(Steven) Li
Quoted 7 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Monday, August 30, 2021 5:43 PM
To: Xueming(Steven) Li <[email protected]>; Kevin Traynor <

[email protected]>; Ben Magistro <[email protected]>;

Quoted 1 line
Quoted 1 line

[email protected]; Beilei Xing <[email protected]>; Luca Boccassi <

[email protected]>; Christian Ehrhardt

Quoted 2 lines
Quoted 2 lines

<[email protected]>
Cc: [email protected]; [email protected];

Qi Zhang <[email protected]>

Quoted 11 lines
Quoted 11 lines

Subject: Re: [dpdk-dev] [PATCH] driver: i40evf device initialization

Quoted 8 lines · Xueming(Steven) Li
Quoted 8 lines

-----Original Message-----
From: Kevin Traynor <[email protected]>
Sent: Thursday, August 26, 2021 6:46 PM
To: Ferruh Yigit <[email protected]>; Ben Magistro <[email protected]>; [email protected]; Beilei Xing <[email protected]>; Luca Boccassi <[email protected]>;

Christian

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Ehrhardt <[email protected]>; Xueming(Steven) Li <[email protected]>
Cc: [email protected]; [email protected]

;

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

Qi Zhang <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] driver: i40evf device initialization

+ Christian and Xueming

Quoted 3 lines · Ferruh Yigit
Quoted 2 lines · Ben Magistro

The i40evf driver is not initializing the eth_dev attribute which can result in a nullptr dereference. Changes were modeled after

the

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

iavf_dev_init() per suggestion from the mailing list[1].

[1] https://mails.dpdk.org/archives/dev/2021-August/217251.html

i40evf will be removed in this release. But I guess it helps for stable releases to first merge the fixes and later removed it, not

sure.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

@Luca, @Kevin, do you prefer this patch directly to stable repos,

or

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

through the main repo?

I'll leave to Luca/Xueming and Christian to say if they have a preference, but I'd guess either way is fine from stable view once

it has fixes/stable tags or LTS patch prefix (it doesn't have any of

Quoted 6 lines
Quoted 6 lines

these at present).

Quoted 5 lines

Yes, any option will make it being noticed by LTS maintainer:
1. patches accepted by main with "fix" in subject 2. patches accepted by main with "cc: [email protected]" in commit message 3. patches backported to LTS, sent to stable maillist with LTS prefix, for

example "[20.11]"

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

Thanks Xueming,

But is there a preferences for this case?

The i40evf will be removed from main repo, is it better 1- first apply the fix and remove the component from main (I assume

fix still will be bacported to LTS in this case) or

Quoted 1 line
Quoted 1 line

2- remove the i40evf from main (without fix), apply the fix directly

to the LTS.

Quoted 2 lines

Both options will work, the first is more easy and common I guess, both

19.11 LTS and 20.11 LTS maintainer can find it.

Quoted 7 lines
Quoted 7 lines

Thanks,
ferruh

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

i40evf won't be tested in the main anyway, since it would be

removed

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

before -rc1 testing, so it looks like there won't be any

difference from testing point of view.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

---
 drivers/net/i40e/i40e_ethdev_vf.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/net/i40e/i40e_ethdev_vf.c i40evf_dev_alarm_handler(void *param)

Quoted 6 lines
drivers/net/i40e/i40e_ethdev_vf.c +0 -0
index 0cfe13b7b2..ccdce9a16a 100644
@@ -1564,8 +1564,9 @@ i40evf_dev_alarm_handler(void *param)

static

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

drivers/net/i40e/i40e_ethdev_vf.c i40evf_dev_alarm_handler(void *param) · line 1566

Quoted 3 lines
drivers/net/i40e/i40e_ethdev_vf.c +0 -2
 int  i40evf_dev_init(struct rte_eth_dev *eth_dev)  {
-        struct i40e_hw *hw
-                =

I40E_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

drivers/net/i40e/i40e_ethdev_vf.c i40evf_dev_alarm_handler(void *param) · line 1566

Quoted 2 lines
drivers/net/i40e/i40e_ethdev_vf.c +2 -0
+        struct i40e_adapter *adapter =
+

I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private);

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

drivers/net/i40e/i40e_ethdev_vf.c i40evf_dev_alarm_handler(void *param) · line 1568

Quoted 2 lines
drivers/net/i40e/i40e_ethdev_vf.c +1 -0
+        struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(adapter);
         struct rte_pci_device *pci_dev =

RTE_ETH_DEV_TO_PCI(eth_dev);

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

drivers/net/i40e/i40e_ethdev_vf.c i40evf_dev_init(struct rte_eth_dev

Quoted 3 lines
drivers/net/i40e/i40e_ethdev_vf.c +0 -0
         PMD_INIT_FUNC_TRACE();
@@ -1596,11 +1597,14 @@ i40evf_dev_init(struct rte_eth_dev

*eth_dev)

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

drivers/net/i40e/i40e_ethdev_vf.c i40evf_dev_init(struct rte_eth_dev · line 1598

Quoted 2 lines
drivers/net/i40e/i40e_ethdev_vf.c +0 -0
         hw->device_id = pci_dev->id.device_id;
         hw->subsystem_vendor_id =

pci_dev->id.subsystem_vendor_id;

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

drivers/net/i40e/i40e_ethdev_vf.c i40evf_dev_init(struct rte_eth_dev · line 1599

Quoted 1 line
drivers/net/i40e/i40e_ethdev_vf.c +0 -0
         hw->subsystem_device_id =

pci_dev->id.subsystem_device_id;

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

drivers/net/i40e/i40e_ethdev_vf.c i40evf_dev_init(struct rte_eth_dev · line 1606

Quoted 7 lines
drivers/net/i40e/i40e_ethdev_vf.c +2 -0
+        hw->bus.bus_id = pci_dev->addr.bus;
         hw->bus.device = pci_dev->addr.devid;
         hw->bus.func = pci_dev->addr.function;
         hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
         hw->adapter_stopped = 1;
         hw->adapter_closed = 0;
+        hw->back =

I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private);

Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
drivers/net/i40e/i40e_ethdev_vf.c +1 -0
+        adapter->eth_dev = eth_dev;
 
         if(i40evf_init_vf(eth_dev) != 0) {
                 PMD_INIT_LOG(ERR, "Init vf failed");
#8 lore raw
Quoted 5 lines · Ben Magistro

Hello,

Replying here as I'm a little stuck and hoping someone has some advice for what the next steps should be.

Quoted 9 lines

Going from the list above of how to get this noticed by the LTS maintainer(s), the patch, well commit message + subject were revised and resent to the list
(https://patches.dpdk.org/project/dpdk/patch/20211012141752.6376-1-
[email protected]/) but the i40evf has since been removed from main already so options 1 & 2 seem to no longer apply.  This seems to put us into option 3 of a backported patch?  Is it just a subject line change then or can this be pulled out of the "not applicable" pile still?

Hi Ben,

Since it doesn't apply to upstream, option 3 should be good enough, just add [20.11] or [19.11] as prefix and send to [email protected].

Regards,
Xueming Li

Quoted 164 lines

Thanks and appreciate the advice,

Ben Magistro

Quoted 157 lines · Ben Magistro

+cc: [email protected]

Per discussions here, cc'ing stable for fix to be applied to LTS as i40evf is being removed from next.

Quoted 150 lines · Xueming(Steven) Li
Quoted 79 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Monday, August 30, 2021 5:43 PM
To: Xueming(Steven) Li <[email protected]>; Kevin Traynor <[email protected]>; Ben Magistro <[email protected]>; [email protected]; Beilei Xing <[email protected]>; Luca Boccassi <[email protected]>; Christian Ehrhardt <[email protected]>
Cc: [email protected]; [email protected]; Qi Zhang <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] driver: i40evf device initialization

Quoted 43 lines · Xueming(Steven) Li
Quoted 43 lines

-----Original Message-----
From: Kevin Traynor <[email protected]>
Sent: Thursday, August 26, 2021 6:46 PM
To: Ferruh Yigit <[email protected]>; Ben Magistro <[email protected]>; [email protected]; Beilei Xing <[email protected]>; Luca Boccassi <[email protected]>; Christian
Ehrhardt <[email protected]>; Xueming(Steven) Li
<[email protected]>
Cc: [email protected]; [email protected];
Qi Zhang <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] driver: i40evf device initialization

+ Christian and Xueming

Quoted 21 lines · Ferruh Yigit
Quoted 11 lines · Ben Magistro

The i40evf driver is not initializing the eth_dev
attribute which
can result in a nullptr dereference. Changes were
modeled after the
iavf_dev_init() per suggestion from the mailing
list[1].

[1] https://mails.dpdk.org/archives/dev/2021-
August/217251.html

i40evf will be removed in this release. But I guess it helps for
stable releases to first merge the fixes and later removed it, not sure.

@Luca, @Kevin, do you prefer this patch directly to stable repos, or
through the main repo?

Quoted 5 lines
Quoted 5 lines

I'll leave to Luca/Xueming and Christian to say if they have a
preference, but I'd guess either way is fine from stable view once it has fixes/stable tags or LTS patch prefix (it doesn't have any of

these at present).

Quoted 9 lines

Yes, any option will make it being noticed by LTS maintainer:
1. patches accepted by main with "fix" in subject 2. patches accepted
by main with "cc: [email protected]" in commit message 3. patches
backported to LTS, sent to stable maillist with LTS prefix, for example "[20.11]"

Thanks Xueming,

Quoted 7 lines

But is there a preferences for this case?

The i40evf will be removed from main repo, is it better 1- first apply the fix and remove the component from main (I assume fix still will be bacported to LTS in this case) or 2- remove the i40evf from main (without fix), apply the fix directly to the LTS.

Both options will work, the first is more easy and common I guess, both 19.11 LTS and 20.11 LTS maintainer can find it.

Quoted 59 lines

Thanks,
ferruh

Quoted 55 lines
Quoted 54 lines
Quoted 54 lines

i40evf won't be tested in the main anyway, since it would be removed
before -rc1 testing, so it looks like there won't be any difference from testing point of view.

Quoted 46 lines

---
  drivers/net/i40e/i40e_ethdev_vf.c | 8 ++++++--

  1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_ethdev_vf.c +3 -2
index 0cfe13b7b2..ccdce9a16a 100644
@@ -1564,8 +1564,9 @@ i40evf_dev_alarm_handler(void
 *param)  static
 int  i40evf_dev_init(struct rte_eth_dev *eth_dev)  {
-        struct i40e_hw *hw
-                = I40E_DEV_PRIVATE_TO_HW(eth_dev-
 >data->dev_private);
+        struct i40e_adapter *adapter =
+                I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev-
 >data->dev_private);
+        struct i40e_hw *hw =
 I40E_DEV_PRIVATE_TO_HW(adapter);

          struct rte_pci_device *pci_dev =
RTE_ETH_DEV_TO_PCI(eth_dev);

          PMD_INIT_FUNC_TRACE();

drivers/net/i40e/i40e_ethdev_vf.c +0 -0
@@ -1596,11 +1597,14 @@ i40evf_dev_init(struct
 rte_eth_dev *eth_dev)
           hw->device_id = pci_dev->id.device_id;

          hw->subsystem_vendor_id = pci_dev-

Quoted 1 line

id.subsystem_vendor_id;

          hw->subsystem_device_id = pci_dev-

Quoted 1 line

id.subsystem_device_id;

+        hw->bus.bus_id = pci_dev->addr.bus;
          hw->bus.device = pci_dev->addr.devid;
          hw->bus.func = pci_dev->addr.function;
          hw->hw_addr = (void *)pci_dev-

Quoted 1 line

mem_resource[0].addr;

          hw->adapter_stopped = 1;
          hw->adapter_closed = 0;
+        hw->back =
I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data-

Quoted 1 line

dev_private);

+        adapter->eth_dev = eth_dev;

          if(i40evf_init_vf(eth_dev) != 0) { PMD_INIT_LOG(ERR, "Init vf failed");

#9 lore raw

PATCH v2 1/1 net/i40e: fix i40evf device initialization

In reply to Ben Magistro

The i40evf driver is not initializing the eth_dev attribute which can result in a nullptr dereference. Changes were modeled after the iavf_dev_init() per suggestion from the mailing list[1].

[1] https://mails.dpdk.org/archives/dev/2021-August/217251.html

---
 drivers/net/i40e/i40e_ethdev_vf.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_ethdev_vf.c +6 -2
index 625981048a..1d08064b58 100644
@@ -1562,8 +1562,9 @@ i40evf_dev_alarm_handler(void *param)
 static int
 i40evf_dev_init(struct rte_eth_dev *eth_dev)
 {
-	struct i40e_hw *hw
-		= I40E_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	struct i40e_adapter *adapter =
+		I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private);
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(adapter);
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
 
 	PMD_INIT_FUNC_TRACE();
@@ -1594,11 +1595,14 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
 	hw->device_id = pci_dev->id.device_id;
 	hw->subsystem_vendor_id = pci_dev->id.subsystem_vendor_id;
 	hw->subsystem_device_id = pci_dev->id.subsystem_device_id;
+	hw->bus.bus_id = pci_dev->addr.bus;
 	hw->bus.device = pci_dev->addr.devid;
 	hw->bus.func = pci_dev->addr.function;
 	hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
 	hw->adapter_stopped = 1;
 	hw->adapter_closed = 0;
+	hw->back = I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private);
+	adapter->eth_dev = eth_dev;
 
 	if(i40evf_init_vf(eth_dev) != 0) {
 		PMD_INIT_LOG(ERR, "Init vf failed");
Signature · 1 line
2.27.0
#10 lore raw

PATCH v3 1/1 net/i40e: fix i40evf device initialization

In reply to Ben Magistro

The i40evf driver is not initializing the eth_dev attribute which can result in a nullptr dereference. Changes were modeled after the iavf_dev_init() per suggestion from the mailing list[1].

[1] https://mails.dpdk.org/archives/dev/2021-August/217251.html

Fixes 4861cde46116 ("i40e: new poll mode driver")
---
 drivers/net/i40e/i40e_ethdev_vf.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_ethdev_vf.c +6 -2
index 0cfe13b7b2..ccdce9a16a 100644
@@ -1564,8 +1564,9 @@ i40evf_dev_alarm_handler(void *param)
 static int
 i40evf_dev_init(struct rte_eth_dev *eth_dev)
 {
-	struct i40e_hw *hw
-		= I40E_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	struct i40e_adapter *adapter =
+		I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private);
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(adapter);
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
 
 	PMD_INIT_FUNC_TRACE();
@@ -1596,11 +1597,14 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
 	hw->device_id = pci_dev->id.device_id;
 	hw->subsystem_vendor_id = pci_dev->id.subsystem_vendor_id;
 	hw->subsystem_device_id = pci_dev->id.subsystem_device_id;
+	hw->bus.bus_id = pci_dev->addr.bus;
 	hw->bus.device = pci_dev->addr.devid;
 	hw->bus.func = pci_dev->addr.function;
 	hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
 	hw->adapter_stopped = 1;
 	hw->adapter_closed = 0;
+	hw->back = I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private);
+	adapter->eth_dev = eth_dev;
 
 	if(i40evf_init_vf(eth_dev) != 0) {
 		PMD_INIT_LOG(ERR, "Init vf failed");
Signature · 1 line
2.27.0
#11 lore raw

Re: [dpdk-dev] [PATCH v3] net/i40e: fix i40evf device initialization

Quoted 35 lines · Ben Magistro

The i40evf driver is not initializing the eth_dev attribute which can result in a nullptr dereference. Changes were modeled after the iavf_dev_init() per suggestion from the mailing list[1].

[1] https://mails.dpdk.org/archives/dev/2021-August/217251.html

Fixes 4861cde46116 ("i40e: new poll mode driver")
---
 drivers/net/i40e/i40e_ethdev_vf.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_ethdev_vf.c +4 -2
index 0cfe13b7b2..ccdce9a16a 100644
@@ -1564,8 +1564,9 @@ i40evf_dev_alarm_handler(void *param)
 static int
 i40evf_dev_init(struct rte_eth_dev *eth_dev)
 {
-	struct i40e_hw *hw
-		= I40E_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	struct i40e_adapter *adapter =
+		I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private);
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(adapter);
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
 
 	PMD_INIT_FUNC_TRACE();
@@ -1596,11 +1597,14 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
 	hw->device_id = pci_dev->id.device_id;
 	hw->subsystem_vendor_id = pci_dev->id.subsystem_vendor_id;
 	hw->subsystem_device_id = pci_dev->id.subsystem_device_id;
+	hw->bus.bus_id = pci_dev->addr.bus;

drivers/net/i40e/i40e_ethdev_vf.c i40evf_dev_init(struct rte_eth_dev *eth_dev) · line 1610

Quoted 10 lines
drivers/net/i40e/i40e_ethdev_vf.c +2 -0
 	hw->bus.device = pci_dev->addr.devid;
 	hw->bus.func = pci_dev->addr.function;
 	hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
 	hw->adapter_stopped = 1;
 	hw->adapter_closed = 0;
+	hw->back = I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private);
+	adapter->eth_dev = eth_dev;
 
 	if(i40evf_init_vf(eth_dev) != 0) {
 		PMD_INIT_LOG(ERR, "Init vf failed");

Hi Ben,

There is compilation error, could you rebase with tag v20.11.3?

#12 lore raw

PATCH v4 1/1 net/i40e: fix i40evf device initialization

In reply to Ben Magistro

The i40evf driver is not initializing the eth_dev attribute which can result in a nullptr dereference. Changes were modeled after the iavf_dev_init() per suggestion from the mailing list[1] and i40evf_init_vf().

[1] https://mails.dpdk.org/archives/dev/2021-August/217251.html

Rebased on v20.11.3.

Fixes 4861cde46116 ("i40e: new poll mode driver")
---
 drivers/net/i40e/i40e_ethdev_vf.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/i40e/i40e_ethdev_vf.c +6 -0
index 625981048a..adfe4f12f7 100644
@@ -1564,6 +1564,7 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
 {
 	struct i40e_hw *hw
 		= I40E_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(eth_dev->data->dev_private);
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
 
 	PMD_INIT_FUNC_TRACE();
@@ -1594,12 +1595,17 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
 	hw->device_id = pci_dev->id.device_id;
 	hw->subsystem_vendor_id = pci_dev->id.subsystem_vendor_id;
 	hw->subsystem_device_id = pci_dev->id.subsystem_device_id;
+	hw->bus.bus_id = pci_dev->addr.bus;
 	hw->bus.device = pci_dev->addr.devid;
 	hw->bus.func = pci_dev->addr.function;
 	hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
 	hw->adapter_stopped = 1;
 	hw->adapter_closed = 0;
 
+	vf->adapter = I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private);
+	vf->dev_data = eth_dev->data;
+	hw->back = I40E_DEV_PRIVATE_TO_ADAPTER(vf);
+
 	if(i40evf_init_vf(eth_dev) != 0) {
 		PMD_INIT_LOG(ERR, "Init vf failed");
 		return -1;
Signature · 1 line
2.27.0
#13 lore raw

Re: [dpdk-stable][20.11] [PATCH v4] net/i40e: fix i40evf device initialization

Quoted 7 lines · Ben Magistro

The i40evf driver is not initializing the eth_dev attribute which can result in a nullptr dereference. Changes were modeled after the iavf_dev_init() per suggestion from the mailing list[1] and i40evf_init_vf().

[1] https://mails.dpdk.org/archives/dev/2021-August/217251.html

Quoted 7 lines

Rebased on v20.11.3.

Fixes 4861cde46116 ("i40e: new poll mode driver")

---

Hi Ben,

Applied to 20.11.4 list, thanks!

Best Regards,
Xueming Li