Skip to contentSkip to conversation

net/i40e: allow VF to get pctype mapping info

PATCH Superseded Beilei Xing 3 participants 8 messages May 22, 2019 – Jun 18, 2019 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/i40e: allow VF to get pctype mapping info

This patch allows VF to get pctype mapping info.

---
 drivers/net/i40e/rte_pmd_i40e.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/net/i40e/rte_pmd_i40e.c +0 -3
index 7ae78e4..8a4889e 100644
@@ -2425,9 +2425,6 @@ int rte_pmd_i40e_flow_type_mapping_get(
 
 	dev = &rte_eth_devices[port];
 
-	if (!is_i40e_supported(dev))
-		return -ENOTSUP;
-
 	ad = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 
 	for (i = 0; i < I40E_FLOW_TYPE_MAX; i++) {
Signature · 1 line
2.5.5
#1 lore raw

PATCH v2 1/1 net/i40e: allow VF to configure pctype mapping

This patch allows VF to get/update/reset pctype
mapping info.

---
v2 changes:
- Allow VF update/reset pctype mapping.

 drivers/net/i40e/rte_pmd_i40e.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/net/i40e/rte_pmd_i40e.c +0 -8
index 7ae78e4..b3bdc61 100644
@@ -2405,8 +2405,6 @@ int rte_pmd_i40e_flow_type_mapping_reset(uint16_t port)
 
 	dev = &rte_eth_devices[port];
 
-	if (!is_i40e_supported(dev))
-		return -ENOTSUP;
 
 	i40e_set_default_pctype_table(dev);
 
@@ -2425,9 +2423,6 @@ int rte_pmd_i40e_flow_type_mapping_get(
 
 	dev = &rte_eth_devices[port];
 
-	if (!is_i40e_supported(dev))
-		return -ENOTSUP;
-
 	ad = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 
 	for (i = 0; i < I40E_FLOW_TYPE_MAX; i++) {
@@ -2453,9 +2448,6 @@ rte_pmd_i40e_flow_type_mapping_update(
 
 	dev = &rte_eth_devices[port];
 
-	if (!is_i40e_supported(dev))
-		return -ENOTSUP;
-
 	if (count > I40E_FLOW_TYPE_MAX)
 		return -EINVAL;
 
Signature · 1 line
2.5.5
#2 lore raw

Re: [dpdk-dev] [PATCH v2] net/i40e: allow VF to configure pctype mapping

Quoted 16 lines · Beilei Xing

This patch allows VF to get/update/reset pctype
mapping info.

---
v2 changes:
- Allow VF update/reset pctype mapping.

 drivers/net/i40e/rte_pmd_i40e.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/net/i40e/rte_pmd_i40e.c +0 -0
index 7ae78e4..b3bdc61 100644

drivers/net/i40e/rte_pmd_i40e.c int rte_pmd_i40e_flow_type_mapping_reset(uint16_t port) · line 2409

Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e.c +0 -2
@@ -2405,8 +2405,6 @@ int rte_pmd_i40e_flow_type_mapping_reset(uint16_t port)
 
 	dev = &rte_eth_devices[port];
 
-	if (!is_i40e_supported(dev))
-		return -ENOTSUP;

Hi Beilei,

Since these are public APIs, these checks are to prevent possible issues user call these APIs with a port_id that is not 'i40e' at all, in that case the API still will try to work on that device and this may lead a crash or corruption in that device.

Instead of removing these checks, can it be possible to extend it to cover both PF and VF? If there are APIs in this file that requires device explicitly to be PF or VF, perhaps we can create two version of the check and use appropriate one for the API.

Quoted 24 lines
drivers/net/i40e/rte_pmd_i40e.c +0 -6
 	i40e_set_default_pctype_table(dev);
 
@@ -2425,9 +2423,6 @@ int rte_pmd_i40e_flow_type_mapping_get(
 
 	dev = &rte_eth_devices[port];
 
-	if (!is_i40e_supported(dev))
-		return -ENOTSUP;
-
 	ad = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 
 	for (i = 0; i < I40E_FLOW_TYPE_MAX; i++) {
@@ -2453,9 +2448,6 @@ rte_pmd_i40e_flow_type_mapping_update(
 
 	dev = &rte_eth_devices[port];
 
-	if (!is_i40e_supported(dev))
-		return -ENOTSUP;
-
 	if (count > I40E_FLOW_TYPE_MAX)
 		return -EINVAL;
 
#3 lore raw

Re: [dpdk-dev] [PATCH v2] net/i40e: allow VF to configure pctype mapping

Quoted 40 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Friday, May 24, 2019 6:53 AM
To: Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: allow VF to configure pctype mapping

Quoted 15 lines · Beilei Xing

This patch allows VF to get/update/reset pctype mapping info.

---
v2 changes:
- Allow VF update/reset pctype mapping.

 drivers/net/i40e/rte_pmd_i40e.c | 8 --------
 1 file changed, 8 deletions(-)
(quoted diff) +0 -0

b/drivers/net/i40e/rte_pmd_i40e.c index 7ae78e4..b3bdc61 100644

drivers/net/i40e/rte_pmd_i40e.c int · line 2410

Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e.c +0 -2
@@ -2405,8 +2405,6 @@ int
 rte_pmd_i40e_flow_type_mapping_reset(uint16_t port)
 
 	dev = &rte_eth_devices[port];
 
-	if (!is_i40e_supported(dev))
-		return -ENOTSUP;

Hi Beilei,

Since these are public APIs, these checks are to prevent possible issues user call these APIs with a port_id that is not 'i40e' at all, in that case the API still will try to work on that device and this may lead a crash or corruption in that device.

Quoted 4 lines

Instead of removing these checks, can it be possible to extend it to cover both PF and VF? If there are APIs in this file that requires device explicitly to be PF or VF, perhaps we can create two version of the check and use appropriate one for the API.

+1

Quoted 26 lines
Quoted 26 lines
drivers/net/i40e/rte_pmd_i40e.c +0 -3
 	i40e_set_default_pctype_table(dev);
 
@@ -2425,9 +2423,6 @@ int rte_pmd_i40e_flow_type_mapping_get(
 
 	dev = &rte_eth_devices[port];
 
-	if (!is_i40e_supported(dev))
-		return -ENOTSUP;
-
 	ad = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 
 	for (i = 0; i < I40E_FLOW_TYPE_MAX; i++) { @@ -2453,9 +2448,6 @@

rte_pmd_i40e_flow_type_mapping_update(

drivers/net/i40e/rte_pmd_i40e.c +0 -3
 	dev = &rte_eth_devices[port];
 
-	if (!is_i40e_supported(dev))
-		return -ENOTSUP;
-
 	if (count > I40E_FLOW_TYPE_MAX)
 		return -EINVAL;
#4 lore raw

PATCH v3 1/1 net/i40e: allow VF to configure pctype mapping

In reply to Beilei Xing

This patch allows VF to get/update/reset pctype
mapping info.

---
v3 changes:
- add new function is_i40evf_supported.
v2 changes:
- Allow VF update/reset pctype mapping.

 drivers/net/i40e/i40e_ethdev.c    | 2 +-
 drivers/net/i40e/i40e_ethdev.h    | 4 ++++
 drivers/net/i40e/i40e_ethdev_vf.c | 6 ++++++
 drivers/net/i40e/rte_pmd_i40e.c   | 9 ++++++---
 4 files changed, 17 insertions(+), 4 deletions(-)
drivers/net/i40e/i40e_ethdev.c +1 -1
index 815baa1..65cd6cc 100644
@@ -12135,7 +12135,7 @@ i40e_filter_restore(struct i40e_pf *pf)
 	i40e_rss_filter_restore(pf);
 }
 
-static bool
+bool
 is_device_supported(struct rte_eth_dev *dev, struct rte_pci_driver *drv)
 {
 	if (strcmp(dev->device->driver->name, drv->driver.name))
drivers/net/i40e/i40e_ethdev.h +4 -0
index 9855038..95669fa 100644
@@ -11,6 +11,8 @@
 #include <rte_kvargs.h>
 #include <rte_hash.h>
 #include <rte_flow.h>
+#include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_flow_driver.h>
 #include <rte_tm_driver.h>
 #include "rte_pmd_i40e.h"
@@ -1214,7 +1216,9 @@ void i40e_set_vlan_filter(struct i40e_vsi *vsi, uint16_t vlan_id, bool on);
 int i40e_add_macvlan_filters(struct i40e_vsi *vsi,
 			     struct i40e_macvlan_filter *filter,
 			     int total);
+bool is_device_supported(struct rte_eth_dev *dev, struct rte_pci_driver *drv);
 bool is_i40e_supported(struct rte_eth_dev *dev);
+bool is_i40evf_supported(struct rte_eth_dev *dev);
 
 int i40e_validate_input_set(enum i40e_filter_pctype pctype,
 			    enum rte_filter_type filter, uint64_t inset);
drivers/net/i40e/i40e_ethdev_vf.c +6 -0
index a348972..bc9fc01 100644
@@ -2804,3 +2804,9 @@ i40evf_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *mc_addrs,
 
 	return 0;
 }
+
+bool
+is_i40evf_supported(struct rte_eth_dev *dev)
+{
+	return is_device_supported(dev, &rte_i40evf_pmd);
+}
drivers/net/i40e/rte_pmd_i40e.c +6 -3
index 7ae78e4..0fdb552 100644
@@ -2405,7 +2405,8 @@ int rte_pmd_i40e_flow_type_mapping_reset(uint16_t port)
 
 	dev = &rte_eth_devices[port];
 
-	if (!is_i40e_supported(dev))
+	if (!is_i40e_supported(dev) &&
+	    !is_i40evf_supported(dev))
 		return -ENOTSUP;
 
 	i40e_set_default_pctype_table(dev);
@@ -2425,7 +2426,8 @@ int rte_pmd_i40e_flow_type_mapping_get(
 
 	dev = &rte_eth_devices[port];
 
-	if (!is_i40e_supported(dev))
+	if (!is_i40e_supported(dev) &&
+	    !is_i40evf_supported(dev))
 		return -ENOTSUP;
 
 	ad = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
@@ -2453,7 +2455,8 @@ rte_pmd_i40e_flow_type_mapping_update(
 
 	dev = &rte_eth_devices[port];
 
-	if (!is_i40e_supported(dev))
+	if (!is_i40e_supported(dev) &&
+	    !is_i40evf_supported(dev))
 		return -ENOTSUP;
 
 	if (count > I40E_FLOW_TYPE_MAX)
Signature · 1 line
2.5.5
#5 lore raw

PATCH v4 1/1 net/i40e: allow VF to configure pctype mapping

This patch allows VF to get/update/reset pctype
mapping info.

---
v4 changes:
- Fix messon build error.
v3 changes:
- add new function is_i40evf_supported.
v2 changes:
- Allow VF update/reset pctype mapping.

 drivers/net/i40e/i40e_ethdev.c    | 2 +-
 drivers/net/i40e/i40e_ethdev.h    | 3 +++
 drivers/net/i40e/i40e_ethdev_vf.c | 6 ++++++
 drivers/net/i40e/rte_pmd_i40e.c   | 9 ++++++---
 4 files changed, 16 insertions(+), 4 deletions(-)
drivers/net/i40e/i40e_ethdev.c +1 -1
index 815baa1..65cd6cc 100644
@@ -12135,7 +12135,7 @@ i40e_filter_restore(struct i40e_pf *pf)
 	i40e_rss_filter_restore(pf);
 }
 
-static bool
+bool
 is_device_supported(struct rte_eth_dev *dev, struct rte_pci_driver *drv)
 {
 	if (strcmp(dev->device->driver->name, drv->driver.name))
drivers/net/i40e/i40e_ethdev.h +3 -0
index 9855038..7e327ea 100644
@@ -271,6 +271,7 @@ enum i40e_flxpld_layer_idx {
 	(ETHER_HDR_LEN + ETHER_CRC_LEN + I40E_VLAN_TAG_SIZE * 2)
 
 struct i40e_adapter;
+struct rte_pci_driver;
 
 /**
  * MAC filter structure
@@ -1214,7 +1215,9 @@ void i40e_set_vlan_filter(struct i40e_vsi *vsi, uint16_t vlan_id, bool on);
 int i40e_add_macvlan_filters(struct i40e_vsi *vsi,
 			     struct i40e_macvlan_filter *filter,
 			     int total);
+bool is_device_supported(struct rte_eth_dev *dev, struct rte_pci_driver *drv);
 bool is_i40e_supported(struct rte_eth_dev *dev);
+bool is_i40evf_supported(struct rte_eth_dev *dev);
 
 int i40e_validate_input_set(enum i40e_filter_pctype pctype,
 			    enum rte_filter_type filter, uint64_t inset);
drivers/net/i40e/i40e_ethdev_vf.c +6 -0
index a348972..bc9fc01 100644
@@ -2804,3 +2804,9 @@ i40evf_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *mc_addrs,
 
 	return 0;
 }
+
+bool
+is_i40evf_supported(struct rte_eth_dev *dev)
+{
+	return is_device_supported(dev, &rte_i40evf_pmd);
+}
drivers/net/i40e/rte_pmd_i40e.c +6 -3
index 7ae78e4..0fdb552 100644
@@ -2405,7 +2405,8 @@ int rte_pmd_i40e_flow_type_mapping_reset(uint16_t port)
 
 	dev = &rte_eth_devices[port];
 
-	if (!is_i40e_supported(dev))
+	if (!is_i40e_supported(dev) &&
+	    !is_i40evf_supported(dev))
 		return -ENOTSUP;
 
 	i40e_set_default_pctype_table(dev);
@@ -2425,7 +2426,8 @@ int rte_pmd_i40e_flow_type_mapping_get(
 
 	dev = &rte_eth_devices[port];
 
-	if (!is_i40e_supported(dev))
+	if (!is_i40e_supported(dev) &&
+	    !is_i40evf_supported(dev))
 		return -ENOTSUP;
 
 	ad = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
@@ -2453,7 +2455,8 @@ rte_pmd_i40e_flow_type_mapping_update(
 
 	dev = &rte_eth_devices[port];
 
-	if (!is_i40e_supported(dev))
+	if (!is_i40e_supported(dev) &&
+	    !is_i40evf_supported(dev))
 		return -ENOTSUP;
 
 	if (count > I40E_FLOW_TYPE_MAX)
Signature · 1 line
2.5.5
Acked-by on v4 1/1 Applied
#6 lore raw

Re: [dpdk-dev] [PATCH v4] net/i40e: allow VF to configure pctype mapping

Quoted 9 lines

-----Original Message-----
From: Xing, Beilei
Sent: Monday, June 17, 2019 11:18 AM
To: Zhang, Qi Z <[email protected]>
Cc: [email protected]
Subject: [PATCH v4] net/i40e: allow VF to configure pctype mapping

Quoted 3 lines

This patch allows VF to get/update/reset pctype mapping info.

Applied to dpdk-next-net-intel.

Thanks
Qi

#7 lore raw

Re: [dpdk-dev] [PATCH v4] net/i40e: allow VF to configure pctype mapping

In reply to Beilei Xing
Quoted 21 lines

-----Original Message-----
From: Zhang, Qi Z
Sent: Tuesday, June 18, 2019 9:14 PM
To: Xing, Beilei <[email protected]>
Cc: [email protected]
Subject: RE: [PATCH v4] net/i40e: allow VF to configure pctype mapping

Quoted 10 lines

-----Original Message-----
From: Xing, Beilei
Sent: Monday, June 17, 2019 11:18 AM
To: Zhang, Qi Z <[email protected]>
Cc: [email protected]
Subject: [PATCH v4] net/i40e: allow VF to configure pctype mapping

This patch allows VF to get/update/reset pctype mapping info.

Added Cc: [email protected] during apply.

Quoted 7 lines

Applied to dpdk-next-net-intel.

Thanks
Qi