Skip to contentSkip to conversation

add i40e RSS support in VF

PATCH Superseded Helin Zhang 5 participants 16 messages Sep 19, 2014 – Oct 20, 2014 4 messages not in the archive

lore
Share & tools
lore
#0 lore raw

v2 cover add i40e RSS support in VF

As hardware supports RSS in VF, the patches add that support in driver. In addition, minor improvements are added for defining macro with constant.

v2 changes:
* Remove support of updating/querying redirection table, as it will be implemented in another patches later.
* Remove changes in testpmd, as it is not needed at all for supporting RSS in VF.

Helin Zhang (3):
ethdev: improvement for constant usage
i40e: extern two functions and relevant macros
i40evf: support of RSS in VF

 lib/librte_ether/rte_ethdev.h        |  47 ++++++------
 lib/librte_pmd_i40e/i40e_ethdev.c    |   4 +-
 lib/librte_pmd_i40e/i40e_ethdev.h    |  40 +++++++++-
 lib/librte_pmd_i40e/i40e_ethdev_vf.c | 142 +++++++++++++++++++++++++++++++++++
 4 files changed, 207 insertions(+), 26 deletions(-)
Signature · 1 line
1.8.1.4

A message that is not in the archive (sent off-list or not yet received): 1411089280-23595-1-git-send-email-helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#2 lore raw

PATCH v2 1/3 ethdev: improvement for constant usage

Forced type conversion is not needed to define a macro with constant. The alternate is to let compiler use the default width, or specify the width with suffix of 'U', 'UL', 'ULL', etc.

---
 lib/librte_ether/rte_ethdev.h | 47 ++++++++++++++++++++++---------------------
 1 file changed, 24 insertions(+), 23 deletions(-)
lib/librte_ether/rte_ethdev.h +24 -23
index 50df654..3a0b33b 100644
@@ -362,30 +362,31 @@ struct rte_eth_rss_conf {
 #define ETH_RSS_L2_PAYLOAD_SHIFT              63
 
 /* for 1G & 10G */
-#define ETH_RSS_IPV4                    ((uint16_t)1 << ETH_RSS_IPV4_SHIFT)
-#define ETH_RSS_IPV4_TCP                ((uint16_t)1 << ETH_RSS_IPV4_TCP_SHIFT)
-#define ETH_RSS_IPV6                    ((uint16_t)1 << ETH_RSS_IPV6_SHIFT)
-#define ETH_RSS_IPV6_EX                 ((uint16_t)1 << ETH_RSS_IPV6_EX_SHIFT)
-#define ETH_RSS_IPV6_TCP                ((uint16_t)1 << ETH_RSS_IPV6_TCP_SHIFT)
-#define ETH_RSS_IPV6_TCP_EX             ((uint16_t)1 << ETH_RSS_IPV6_TCP_EX_SHIFT)
-#define ETH_RSS_IPV4_UDP                ((uint16_t)1 << ETH_RSS_IPV4_UDP_SHIFT)
-#define ETH_RSS_IPV6_UDP                ((uint16_t)1 << ETH_RSS_IPV6_UDP_SHIFT)
-#define ETH_RSS_IPV6_UDP_EX             ((uint16_t)1 << ETH_RSS_IPV6_UDP_EX_SHIFT)
+#define ETH_RSS_IPV4                    (1 << ETH_RSS_IPV4_SHIFT)
+#define ETH_RSS_IPV4_TCP                (1 << ETH_RSS_IPV4_TCP_SHIFT)
+#define ETH_RSS_IPV6                    (1 << ETH_RSS_IPV6_SHIFT)
+#define ETH_RSS_IPV6_EX                 (1 << ETH_RSS_IPV6_EX_SHIFT)
+#define ETH_RSS_IPV6_TCP                (1 << ETH_RSS_IPV6_TCP_SHIFT)
+#define ETH_RSS_IPV6_TCP_EX             (1 << ETH_RSS_IPV6_TCP_EX_SHIFT)
+#define ETH_RSS_IPV4_UDP                (1 << ETH_RSS_IPV4_UDP_SHIFT)
+#define ETH_RSS_IPV6_UDP                (1 << ETH_RSS_IPV6_UDP_SHIFT)
+#define ETH_RSS_IPV6_UDP_EX             (1 << ETH_RSS_IPV6_UDP_EX_SHIFT)
 /* for 40G only */
-#define ETH_RSS_NONF_IPV4_UDP           ((uint64_t)1 << ETH_RSS_NONF_IPV4_UDP_SHIFT)
-#define ETH_RSS_NONF_IPV4_TCP           ((uint64_t)1 << ETH_RSS_NONF_IPV4_TCP_SHIFT)
-#define ETH_RSS_NONF_IPV4_SCTP          ((uint64_t)1 << ETH_RSS_NONF_IPV4_SCTP_SHIFT)
-#define ETH_RSS_NONF_IPV4_OTHER         ((uint64_t)1 << ETH_RSS_NONF_IPV4_OTHER_SHIFT)
-#define ETH_RSS_FRAG_IPV4               ((uint64_t)1 << ETH_RSS_FRAG_IPV4_SHIFT)
-#define ETH_RSS_NONF_IPV6_UDP           ((uint64_t)1 << ETH_RSS_NONF_IPV6_UDP_SHIFT)
-#define ETH_RSS_NONF_IPV6_TCP           ((uint64_t)1 << ETH_RSS_NONF_IPV6_TCP_SHIFT)
-#define ETH_RSS_NONF_IPV6_SCTP          ((uint64_t)1 << ETH_RSS_NONF_IPV6_SCTP_SHIFT)
-#define ETH_RSS_NONF_IPV6_OTHER         ((uint64_t)1 << ETH_RSS_NONF_IPV6_OTHER_SHIFT)
-#define ETH_RSS_FRAG_IPV6               ((uint64_t)1 << ETH_RSS_FRAG_IPV6_SHIFT)
-#define ETH_RSS_FCOE_OX                 ((uint64_t)1 << ETH_RSS_FCOE_OX_SHIFT) /* not used */
-#define ETH_RSS_FCOE_RX                 ((uint64_t)1 << ETH_RSS_FCOE_RX_SHIFT) /* not used */
-#define ETH_RSS_FCOE_OTHER              ((uint64_t)1 << ETH_RSS_FCOE_OTHER_SHIFT) /* not used */
-#define ETH_RSS_L2_PAYLOAD              ((uint64_t)1 << ETH_RSS_L2_PAYLOAD_SHIFT)
+#define ETH_RSS_NONF_IPV4_UDP           (1ULL << ETH_RSS_NONF_IPV4_UDP_SHIFT)
+#define ETH_RSS_NONF_IPV4_TCP           (1ULL << ETH_RSS_NONF_IPV4_TCP_SHIFT)
+#define ETH_RSS_NONF_IPV4_SCTP          (1ULL << ETH_RSS_NONF_IPV4_SCTP_SHIFT)
+#define ETH_RSS_NONF_IPV4_OTHER         (1ULL << ETH_RSS_NONF_IPV4_OTHER_SHIFT)
+#define ETH_RSS_FRAG_IPV4               (1ULL << ETH_RSS_FRAG_IPV4_SHIFT)
+#define ETH_RSS_NONF_IPV6_UDP           (1ULL << ETH_RSS_NONF_IPV6_UDP_SHIFT)
+#define ETH_RSS_NONF_IPV6_TCP           (1ULL << ETH_RSS_NONF_IPV6_TCP_SHIFT)
+#define ETH_RSS_NONF_IPV6_SCTP          (1ULL << ETH_RSS_NONF_IPV6_SCTP_SHIFT)
+#define ETH_RSS_NONF_IPV6_OTHER         (1ULL << ETH_RSS_NONF_IPV6_OTHER_SHIFT)
+#define ETH_RSS_FRAG_IPV6               (1ULL << ETH_RSS_FRAG_IPV6_SHIFT)
+/* FCOE relevant should not be used */
+#define ETH_RSS_FCOE_OX                 (1ULL << ETH_RSS_FCOE_OX_SHIFT)
+#define ETH_RSS_FCOE_RX                 (1ULL << ETH_RSS_FCOE_RX_SHIFT)
+#define ETH_RSS_FCOE_OTHER              (1ULL << ETH_RSS_FCOE_OTHER_SHIFT)
+#define ETH_RSS_L2_PAYLOAD              (1ULL << ETH_RSS_L2_PAYLOAD_SHIFT)
 
 #define ETH_RSS_IP ( \
 		ETH_RSS_IPV4 | \
Signature · 1 line
1.8.1.4
#3 lore raw

PATCH v2 2/3 i40e: extern two functions and relevant macros

In reply to a message not in the archive

To reuse code, 'i40e_config_hena()' and 'i40e_parse_hena()' and their relevant macros need to be extern, and then can be used for both PF and VF parts.

---
 lib/librte_pmd_i40e/i40e_ethdev.c |  4 ++--
 lib/librte_pmd_i40e/i40e_ethdev.h | 34 +++++++++++++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 3 deletions(-)
lib/librte_pmd_i40e/i40e_ethdev.c +2 -2
index 4e65ca4..f7a40a9 100644
@@ -3919,7 +3919,7 @@ DONE:
 }
 
 /* Configure hash enable flags for RSS */
-static uint64_t
+uint64_t
 i40e_config_hena(uint64_t flags)
 {
 	uint64_t hena = 0;
@@ -3954,7 +3954,7 @@ i40e_config_hena(uint64_t flags)
 }
 
 /* Parse the hash enable flags */
-static uint64_t
+uint64_t
 i40e_parse_hena(uint64_t flags)
 {
 	uint64_t rss_hf = 0;
lib/librte_pmd_i40e/i40e_ethdev.h +33 -1
index 64deef2..c801345 100644
@@ -68,6 +68,36 @@
 		       I40E_FLAG_HEADER_SPLIT_ENABLED | \
 		       I40E_FLAG_FDIR)
 
+#define I40E_RSS_OFFLOAD_ALL ( \
+	ETH_RSS_NONF_IPV4_UDP | \
+	ETH_RSS_NONF_IPV4_TCP | \
+	ETH_RSS_NONF_IPV4_SCTP | \
+	ETH_RSS_NONF_IPV4_OTHER | \
+	ETH_RSS_FRAG_IPV4 | \
+	ETH_RSS_NONF_IPV6_UDP | \
+	ETH_RSS_NONF_IPV6_TCP | \
+	ETH_RSS_NONF_IPV6_SCTP | \
+	ETH_RSS_NONF_IPV6_OTHER | \
+	ETH_RSS_FRAG_IPV6 | \
+	ETH_RSS_L2_PAYLOAD)
+
+/* All bits of RSS hash enable */
+#define I40E_RSS_HENA_ALL ( \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_UDP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_SCTP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_OTHER) | \
+	(1ULL << I40E_FILTER_PCTYPE_FRAG_IPV4) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_UDP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_SCTP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER) | \
+	(1ULL << I40E_FILTER_PCTYPE_FRAG_IPV6) | \
+	(1ULL << I40E_FILTER_PCTYPE_FCOE_OX) | \
+	(1ULL << I40E_FILTER_PCTYPE_FCOE_RX) | \
+	(1ULL << I40E_FILTER_PCTYPE_FCOE_OTHER) | \
+	(1ULL << I40E_FILTER_PCTYPE_L2_PAYLOAD))
+
 struct i40e_adapter;
 
 TAILQ_HEAD(i40e_mac_filter_list, i40e_mac_filter);
@@ -310,8 +340,10 @@ int i40e_dev_link_update(struct rte_eth_dev *dev,
 void i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi);
 void i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi);
 int i40e_vsi_vlan_pvid_set(struct i40e_vsi *vsi,
-				struct i40e_vsi_vlan_pvid_info *info);
+			   struct i40e_vsi_vlan_pvid_info *info);
 int i40e_vsi_config_vlan_stripping(struct i40e_vsi *vsi, bool on);
+uint64_t i40e_config_hena(uint64_t flags);
+uint64_t i40e_parse_hena(uint64_t flags);
 
 /* I40E_DEV_PRIVATE_TO */
 #define I40E_DEV_PRIVATE_TO_PF(adapter) \
Signature · 1 line
1.8.1.4

A message that is not in the archive (sent off-list or not yet received): 1411089280-23595-3-git-send-email-helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#5 lore raw

Re: [PATCH v2 2/3] i40e: extern two functions and relevant macros

2014-09-19 09:14, Helin Zhang:

Quoted 7 lines

To reuse code, 'i40e_config_hena()' and 'i40e_parse_hena()' and their relevant macros need to be extern, and then can be used for both PF and VF parts.

[...]

Quoted 19 lines
lib/librte_pmd_i40e/i40e_ethdev.h +19 -0
+#define I40E_RSS_OFFLOAD_ALL ( \
+	ETH_RSS_NONF_IPV4_UDP | \
+	ETH_RSS_NONF_IPV4_TCP | \
+	ETH_RSS_NONF_IPV4_SCTP | \
+	ETH_RSS_NONF_IPV4_OTHER | \
+	ETH_RSS_FRAG_IPV4 | \
+	ETH_RSS_NONF_IPV6_UDP | \
+	ETH_RSS_NONF_IPV6_TCP | \
+	ETH_RSS_NONF_IPV6_SCTP | \
+	ETH_RSS_NONF_IPV6_OTHER | \
+	ETH_RSS_FRAG_IPV6 | \
+	ETH_RSS_L2_PAYLOAD)
+
+/* All bits of RSS hash enable */
+#define I40E_RSS_HENA_ALL ( \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_UDP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_SCTP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_OTHER) | \

lib/librte_pmd_i40e/i40e_ethdev.h line 99

Quoted 10 lines
lib/librte_pmd_i40e/i40e_ethdev.h +10 -0
+	(1ULL << I40E_FILTER_PCTYPE_FRAG_IPV4) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_UDP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_SCTP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER) | \
+	(1ULL << I40E_FILTER_PCTYPE_FRAG_IPV6) | \
+	(1ULL << I40E_FILTER_PCTYPE_FCOE_OX) | \
+	(1ULL << I40E_FILTER_PCTYPE_FCOE_RX) | \
+	(1ULL << I40E_FILTER_PCTYPE_FCOE_OTHER) | \
+	(1ULL << I40E_FILTER_PCTYPE_L2_PAYLOAD))

You've added the constants in the .h file but you forgot to remove them from the .c file.

Signature · 1 line
Thomas
#6 lore raw

Re: [PATCH v2 2/3] i40e: extern two functions and relevant macros

Hi Thomas

Quoted 41 lines

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Saturday, October 18, 2014 4:59 AM
To: Zhang, Helin
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 2/3] i40e: extern two functions and relevant macros

2014-09-19 09:14, Helin Zhang:

Quoted 7 lines

To reuse code, 'i40e_config_hena()' and 'i40e_parse_hena()' and their relevant macros need to be extern, and then can be used for both PF and VF parts.

[...]

Quoted 24 lines
lib/librte_pmd_i40e/i40e_ethdev.h +24 -0
+#define I40E_RSS_OFFLOAD_ALL ( \
+	ETH_RSS_NONF_IPV4_UDP | \
+	ETH_RSS_NONF_IPV4_TCP | \
+	ETH_RSS_NONF_IPV4_SCTP | \
+	ETH_RSS_NONF_IPV4_OTHER | \
+	ETH_RSS_FRAG_IPV4 | \
+	ETH_RSS_NONF_IPV6_UDP | \
+	ETH_RSS_NONF_IPV6_TCP | \
+	ETH_RSS_NONF_IPV6_SCTP | \
+	ETH_RSS_NONF_IPV6_OTHER | \
+	ETH_RSS_FRAG_IPV6 | \
+	ETH_RSS_L2_PAYLOAD)
+
+/* All bits of RSS hash enable */
+#define I40E_RSS_HENA_ALL ( \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_UDP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_SCTP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_OTHER) | \
+	(1ULL << I40E_FILTER_PCTYPE_FRAG_IPV4) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_UDP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_SCTP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER) | \
Quoted 8 lines

lib/librte_pmd_i40e/i40e_ethdev.h line 99

Quoted 5 lines
lib/librte_pmd_i40e/i40e_ethdev.h +5 -0
+	(1ULL << I40E_FILTER_PCTYPE_FRAG_IPV6) | \
+	(1ULL << I40E_FILTER_PCTYPE_FCOE_OX) | \
+	(1ULL << I40E_FILTER_PCTYPE_FCOE_RX) | \
+	(1ULL << I40E_FILTER_PCTYPE_FCOE_OTHER) | \
+	(1ULL << I40E_FILTER_PCTYPE_L2_PAYLOAD))

You've added the constants in the .h file but you forgot to remove them from the .c file.

Ohh, yes, you are right! Thank you for the good catch! And sorry for the inconvenience!

Quoted 3 lines

--
Thomas

Regards,
Helin

#7 lore raw

PATCH v2 3/3 i40evf: support of RSS in VF

In reply to a message not in the archive

i40e hardware supports RSS in VF, the code changes are to add this support.

v2 changes:
Updating/querying redirection table has been removed, as it will be in another patches of supporting different redirection table sizes soon later.

---
 lib/librte_pmd_i40e/i40e_ethdev.h    |   6 ++
 lib/librte_pmd_i40e/i40e_ethdev_vf.c | 142 +++++++++++++++++++++++++++++++++++
 2 files changed, 148 insertions(+)
lib/librte_pmd_i40e/i40e_ethdev.h +6 -0
index c801345..1d42cd2 100644
@@ -283,6 +283,8 @@ struct i40e_vf_tx_queues {
  * Structure to store private data specific for VF instance.
  */
 struct i40e_vf {
+	struct i40e_adapter *adapter; /* The adapter this VF associate to */
+	struct rte_eth_dev_data *dev_data; /* Pointer to the device data */
 	uint16_t num_queue_pairs;
 	uint16_t max_pkt_len; /* Maximum packet length */
 	bool promisc_unicast_enabled;
@@ -393,6 +395,10 @@ i40e_get_vsi_from_adapter(struct i40e_adapter *adapter)
 #define I40E_PF_TO_ADAPTER(pf) \
 	((struct i40e_adapter *)pf->adapter)
 
+/* I40E_VF_TO */
+#define I40E_VF_TO_HW(vf) \
+	(&(((struct i40e_vf *)vf)->adapter->hw))
+
 static inline void
 i40e_init_adminq_parameter(struct i40e_hw *hw)
 {
lib/librte_pmd_i40e/i40e_ethdev_vf.c +142 -0

178 lines not on this page · raw message

Signature · 1 line
1.8.1.4
Tested-by
#8 lore raw
In reply to a message not in the archive

This patch has been verified on KVM virtual environment with 4*10G, 2*40G and 1*40G NICs. The VF is generated by SRIOV. And testpmd should be run on HOST to support testpmd works on VM. The RSS function works well in the testpmd app in VM environment of KVM.

Please see environment information as the following:
HOST environment:
CPU: Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz
OS: Linux 3.11.10-301.fc20.x86_64
GCC: 4.8.3
NIC: 4*10G(1572), 2*40G(1583), 1*40G(1584)

VM environment generated by KVM:
CPU: Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz
OS: Linux 3.11.10-301.fc20.x86_64
GCC: 4.8.2
NIC: VF generated through SRIOV

Quoted 30 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Helin Zhang
Sent: Friday, September 19, 2014 9:15 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH v2 0/3] add i40e RSS support in VF

As hardware supports RSS in VF, the patches add that support in driver. In addition, minor improvements are added for defining macro with constant.

v2 changes:
* Remove support of updating/querying redirection table, as it will be implemented in another patches later.
* Remove changes in testpmd, as it is not needed at all for supporting RSS in VF.

Helin Zhang (3):
ethdev: improvement for constant usage
i40e: extern two functions and relevant macros
i40evf: support of RSS in VF

 lib/librte_ether/rte_ethdev.h        |  47 ++++++------
 lib/librte_pmd_i40e/i40e_ethdev.c    |   4 +-
 lib/librte_pmd_i40e/i40e_ethdev.h    |  40 +++++++++-
 lib/librte_pmd_i40e/i40e_ethdev_vf.c | 142
+++++++++++++++++++++++++++++++++++
 4 files changed, 207 insertions(+), 26 deletions(-)

--
1.8.1.4

#9 lore raw
In reply to a message not in the archive
Quoted 31 lines

-----Original Message-----
From: Zhang, Helin
Sent: Friday, September 19, 2014 9:15 AM
To: [email protected]
Cc: Zhang, Helin
Subject: [PATCH v2 0/3] add i40e RSS support in VF

As hardware supports RSS in VF, the patches add that support in driver. In addition, minor improvements are added for defining macro with constant.

v2 changes:
* Remove support of updating/querying redirection table, as it will be implemented in another patches later.
* Remove changes in testpmd, as it is not needed at all for supporting RSS in VF.

Helin Zhang (3):
ethdev: improvement for constant usage
i40e: extern two functions and relevant macros
i40evf: support of RSS in VF

 lib/librte_ether/rte_ethdev.h        |  47 ++++++------
 lib/librte_pmd_i40e/i40e_ethdev.c    |   4 +-
 lib/librte_pmd_i40e/i40e_ethdev.h    |  40 +++++++++-
 lib/librte_pmd_i40e/i40e_ethdev_vf.c | 142
+++++++++++++++++++++++++++++++++++
 4 files changed, 207 insertions(+), 26 deletions(-)

--
1.8.1.4

#10 lore raw
In reply to a message not in the archive

Hi guys

Any update or comments on merging this patch? Thanks!

Regards,
Helin

Quoted 30 lines

-----Original Message-----
From: Zhang, Helin
Sent: Friday, September 19, 2014 9:15 AM
To: [email protected]
Cc: Zhang, Helin
Subject: [PATCH v2 0/3] add i40e RSS support in VF

As hardware supports RSS in VF, the patches add that support in driver. In addition, minor improvements are added for defining macro with constant.

v2 changes:
* Remove support of updating/querying redirection table, as it will be implemented in another patches later.
* Remove changes in testpmd, as it is not needed at all for supporting RSS in VF.

Helin Zhang (3):
ethdev: improvement for constant usage
i40e: extern two functions and relevant macros
i40evf: support of RSS in VF

 lib/librte_ether/rte_ethdev.h        |  47 ++++++------
 lib/librte_pmd_i40e/i40e_ethdev.c    |   4 +-
 lib/librte_pmd_i40e/i40e_ethdev.h    |  40 +++++++++-
 lib/librte_pmd_i40e/i40e_ethdev_vf.c | 142
+++++++++++++++++++++++++++++++++++
 4 files changed, 207 insertions(+), 26 deletions(-)

--
1.8.1.4

#11 lore raw

v3 cover add i40e RSS support in VF

In reply to a message not in the archive

As hardware supports RSS in VF, the patches add that support in driver. In addition, minor improvements are added for defining macro with constant.

v2 changes:
* Removed support of updating/querying redirection table, as it will be implemented in another patches later.
* Removed changes in testpmd, as it is not needed at all for supporting RSS in VF.

v3 changes:
* Removed macros in i40e_ethdev.c, as they have already been moved to i40e_ethdev.h.

Helin Zhang (3):
ethdev: improvement for constant usage
i40e: extern two functions and relevant macros
i40evf: support of RSS in VF

 lib/librte_ether/rte_ethdev.h        |  47 ++++++------
 lib/librte_pmd_i40e/i40e_ethdev.c    |  34 +--------
 lib/librte_pmd_i40e/i40e_ethdev.h    |  40 +++++++++-
 lib/librte_pmd_i40e/i40e_ethdev_vf.c | 142 +++++++++++++++++++++++++++++++++++
 4 files changed, 207 insertions(+), 56 deletions(-)
Signature · 1 line
1.8.1.4

A message that is not in the archive (sent off-list or not yet received): 1413773898-24137-1-git-send-email-helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#13 lore raw

PATCH v3 1/3 ethdev: improvement for constant usage

Forced type conversion is not needed to define a macro with constant. The alternate is to let compiler use the default width, or specify the width with suffix of 'U', 'UL', 'ULL', etc.

---
 lib/librte_ether/rte_ethdev.h | 47 ++++++++++++++++++++++---------------------
 1 file changed, 24 insertions(+), 23 deletions(-)
lib/librte_ether/rte_ethdev.h +24 -23
index 13be711..cf0d48c 100644
@@ -362,30 +362,31 @@ struct rte_eth_rss_conf {
 #define ETH_RSS_L2_PAYLOAD_SHIFT              63
 
 /* for 1G & 10G */
-#define ETH_RSS_IPV4                    ((uint16_t)1 << ETH_RSS_IPV4_SHIFT)
-#define ETH_RSS_IPV4_TCP                ((uint16_t)1 << ETH_RSS_IPV4_TCP_SHIFT)
-#define ETH_RSS_IPV6                    ((uint16_t)1 << ETH_RSS_IPV6_SHIFT)
-#define ETH_RSS_IPV6_EX                 ((uint16_t)1 << ETH_RSS_IPV6_EX_SHIFT)
-#define ETH_RSS_IPV6_TCP                ((uint16_t)1 << ETH_RSS_IPV6_TCP_SHIFT)
-#define ETH_RSS_IPV6_TCP_EX             ((uint16_t)1 << ETH_RSS_IPV6_TCP_EX_SHIFT)
-#define ETH_RSS_IPV4_UDP                ((uint16_t)1 << ETH_RSS_IPV4_UDP_SHIFT)
-#define ETH_RSS_IPV6_UDP                ((uint16_t)1 << ETH_RSS_IPV6_UDP_SHIFT)
-#define ETH_RSS_IPV6_UDP_EX             ((uint16_t)1 << ETH_RSS_IPV6_UDP_EX_SHIFT)
+#define ETH_RSS_IPV4                    (1 << ETH_RSS_IPV4_SHIFT)
+#define ETH_RSS_IPV4_TCP                (1 << ETH_RSS_IPV4_TCP_SHIFT)
+#define ETH_RSS_IPV6                    (1 << ETH_RSS_IPV6_SHIFT)
+#define ETH_RSS_IPV6_EX                 (1 << ETH_RSS_IPV6_EX_SHIFT)
+#define ETH_RSS_IPV6_TCP                (1 << ETH_RSS_IPV6_TCP_SHIFT)
+#define ETH_RSS_IPV6_TCP_EX             (1 << ETH_RSS_IPV6_TCP_EX_SHIFT)
+#define ETH_RSS_IPV4_UDP                (1 << ETH_RSS_IPV4_UDP_SHIFT)
+#define ETH_RSS_IPV6_UDP                (1 << ETH_RSS_IPV6_UDP_SHIFT)
+#define ETH_RSS_IPV6_UDP_EX             (1 << ETH_RSS_IPV6_UDP_EX_SHIFT)
 /* for 40G only */
-#define ETH_RSS_NONF_IPV4_UDP           ((uint64_t)1 << ETH_RSS_NONF_IPV4_UDP_SHIFT)
-#define ETH_RSS_NONF_IPV4_TCP           ((uint64_t)1 << ETH_RSS_NONF_IPV4_TCP_SHIFT)
-#define ETH_RSS_NONF_IPV4_SCTP          ((uint64_t)1 << ETH_RSS_NONF_IPV4_SCTP_SHIFT)
-#define ETH_RSS_NONF_IPV4_OTHER         ((uint64_t)1 << ETH_RSS_NONF_IPV4_OTHER_SHIFT)
-#define ETH_RSS_FRAG_IPV4               ((uint64_t)1 << ETH_RSS_FRAG_IPV4_SHIFT)
-#define ETH_RSS_NONF_IPV6_UDP           ((uint64_t)1 << ETH_RSS_NONF_IPV6_UDP_SHIFT)
-#define ETH_RSS_NONF_IPV6_TCP           ((uint64_t)1 << ETH_RSS_NONF_IPV6_TCP_SHIFT)
-#define ETH_RSS_NONF_IPV6_SCTP          ((uint64_t)1 << ETH_RSS_NONF_IPV6_SCTP_SHIFT)
-#define ETH_RSS_NONF_IPV6_OTHER         ((uint64_t)1 << ETH_RSS_NONF_IPV6_OTHER_SHIFT)
-#define ETH_RSS_FRAG_IPV6               ((uint64_t)1 << ETH_RSS_FRAG_IPV6_SHIFT)
-#define ETH_RSS_FCOE_OX                 ((uint64_t)1 << ETH_RSS_FCOE_OX_SHIFT) /* not used */
-#define ETH_RSS_FCOE_RX                 ((uint64_t)1 << ETH_RSS_FCOE_RX_SHIFT) /* not used */
-#define ETH_RSS_FCOE_OTHER              ((uint64_t)1 << ETH_RSS_FCOE_OTHER_SHIFT) /* not used */
-#define ETH_RSS_L2_PAYLOAD              ((uint64_t)1 << ETH_RSS_L2_PAYLOAD_SHIFT)
+#define ETH_RSS_NONF_IPV4_UDP           (1ULL << ETH_RSS_NONF_IPV4_UDP_SHIFT)
+#define ETH_RSS_NONF_IPV4_TCP           (1ULL << ETH_RSS_NONF_IPV4_TCP_SHIFT)
+#define ETH_RSS_NONF_IPV4_SCTP          (1ULL << ETH_RSS_NONF_IPV4_SCTP_SHIFT)
+#define ETH_RSS_NONF_IPV4_OTHER         (1ULL << ETH_RSS_NONF_IPV4_OTHER_SHIFT)
+#define ETH_RSS_FRAG_IPV4               (1ULL << ETH_RSS_FRAG_IPV4_SHIFT)
+#define ETH_RSS_NONF_IPV6_UDP           (1ULL << ETH_RSS_NONF_IPV6_UDP_SHIFT)
+#define ETH_RSS_NONF_IPV6_TCP           (1ULL << ETH_RSS_NONF_IPV6_TCP_SHIFT)
+#define ETH_RSS_NONF_IPV6_SCTP          (1ULL << ETH_RSS_NONF_IPV6_SCTP_SHIFT)
+#define ETH_RSS_NONF_IPV6_OTHER         (1ULL << ETH_RSS_NONF_IPV6_OTHER_SHIFT)
+#define ETH_RSS_FRAG_IPV6               (1ULL << ETH_RSS_FRAG_IPV6_SHIFT)
+/* FCOE relevant should not be used */
+#define ETH_RSS_FCOE_OX                 (1ULL << ETH_RSS_FCOE_OX_SHIFT)
+#define ETH_RSS_FCOE_RX                 (1ULL << ETH_RSS_FCOE_RX_SHIFT)
+#define ETH_RSS_FCOE_OTHER              (1ULL << ETH_RSS_FCOE_OTHER_SHIFT)
+#define ETH_RSS_L2_PAYLOAD              (1ULL << ETH_RSS_L2_PAYLOAD_SHIFT)
 
 #define ETH_RSS_IP ( \
 		ETH_RSS_IPV4 | \
Signature · 1 line
1.8.1.4
#14 lore raw

PATCH v3 2/3 i40e: extern two functions and relevant macros

In reply to a message not in the archive

To reuse code, 'i40e_config_hena()' and 'i40e_parse_hena()' and their relevant macros need to be extern, and then can be used for both PF and VF parts.

---
 lib/librte_pmd_i40e/i40e_ethdev.c | 34 ++--------------------------------
 lib/librte_pmd_i40e/i40e_ethdev.h | 34 +++++++++++++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 33 deletions(-)

v3 changes:
* Removed macros in i40e_ehtdev.c, as they have been moved to i40e_ethdev.h.

lib/librte_pmd_i40e/i40e_ethdev.c +2 -32
index dbf231f..28bde90 100644
@@ -98,36 +98,6 @@
 
 #define I40E_PRE_TX_Q_CFG_WAIT_US       10 /* 10 us */
 
-#define I40E_RSS_OFFLOAD_ALL ( \
-	ETH_RSS_NONF_IPV4_UDP | \
-	ETH_RSS_NONF_IPV4_TCP | \
-	ETH_RSS_NONF_IPV4_SCTP | \
-	ETH_RSS_NONF_IPV4_OTHER | \
-	ETH_RSS_FRAG_IPV4 | \
-	ETH_RSS_NONF_IPV6_UDP | \
-	ETH_RSS_NONF_IPV6_TCP | \
-	ETH_RSS_NONF_IPV6_SCTP | \
-	ETH_RSS_NONF_IPV6_OTHER | \
-	ETH_RSS_FRAG_IPV6 | \
-	ETH_RSS_L2_PAYLOAD)
-
-/* All bits of RSS hash enable */
-#define I40E_RSS_HENA_ALL ( \
-	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_UDP) | \
-	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP) | \
-	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_SCTP) | \
-	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_OTHER) | \
-	(1ULL << I40E_FILTER_PCTYPE_FRAG_IPV4) | \
-	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_UDP) | \
-	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP) | \
-	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_SCTP) | \
-	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER) | \
-	(1ULL << I40E_FILTER_PCTYPE_FRAG_IPV6) | \
-	(1ULL << I40E_FILTER_PCTYPE_FCOE_OX) | \
-	(1ULL << I40E_FILTER_PCTYPE_FCOE_RX) | \
-	(1ULL << I40E_FILTER_PCTYPE_FCOE_OTHER) | \
-	(1ULL << I40E_FILTER_PCTYPE_L2_PAYLOAD))
-
 static int eth_i40e_dev_init(\
 			__attribute__((unused)) struct eth_driver *eth_drv,
 			struct rte_eth_dev *eth_dev);
@@ -3960,7 +3930,7 @@ DONE:
 }
 
 /* Configure hash enable flags for RSS */
-static uint64_t
+uint64_t
 i40e_config_hena(uint64_t flags)
 {
 	uint64_t hena = 0;
@@ -3995,7 +3965,7 @@ i40e_config_hena(uint64_t flags)
 }
 
 /* Parse the hash enable flags */
-static uint64_t
+uint64_t
 i40e_parse_hena(uint64_t flags)
 {
 	uint64_t rss_hf = 0;
lib/librte_pmd_i40e/i40e_ethdev.h +33 -1
index 64deef2..c801345 100644
@@ -68,6 +68,36 @@
 		       I40E_FLAG_HEADER_SPLIT_ENABLED | \
 		       I40E_FLAG_FDIR)
 
+#define I40E_RSS_OFFLOAD_ALL ( \
+	ETH_RSS_NONF_IPV4_UDP | \
+	ETH_RSS_NONF_IPV4_TCP | \
+	ETH_RSS_NONF_IPV4_SCTP | \
+	ETH_RSS_NONF_IPV4_OTHER | \
+	ETH_RSS_FRAG_IPV4 | \
+	ETH_RSS_NONF_IPV6_UDP | \
+	ETH_RSS_NONF_IPV6_TCP | \
+	ETH_RSS_NONF_IPV6_SCTP | \
+	ETH_RSS_NONF_IPV6_OTHER | \
+	ETH_RSS_FRAG_IPV6 | \
+	ETH_RSS_L2_PAYLOAD)
+
+/* All bits of RSS hash enable */
+#define I40E_RSS_HENA_ALL ( \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_UDP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_SCTP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_OTHER) | \
+	(1ULL << I40E_FILTER_PCTYPE_FRAG_IPV4) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_UDP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_SCTP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER) | \
+	(1ULL << I40E_FILTER_PCTYPE_FRAG_IPV6) | \
+	(1ULL << I40E_FILTER_PCTYPE_FCOE_OX) | \
+	(1ULL << I40E_FILTER_PCTYPE_FCOE_RX) | \
+	(1ULL << I40E_FILTER_PCTYPE_FCOE_OTHER) | \
+	(1ULL << I40E_FILTER_PCTYPE_L2_PAYLOAD))
+
 struct i40e_adapter;
 
 TAILQ_HEAD(i40e_mac_filter_list, i40e_mac_filter);
@@ -310,8 +340,10 @@ int i40e_dev_link_update(struct rte_eth_dev *dev,
 void i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi);
 void i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi);
 int i40e_vsi_vlan_pvid_set(struct i40e_vsi *vsi,
-				struct i40e_vsi_vlan_pvid_info *info);
+			   struct i40e_vsi_vlan_pvid_info *info);
 int i40e_vsi_config_vlan_stripping(struct i40e_vsi *vsi, bool on);
+uint64_t i40e_config_hena(uint64_t flags);
+uint64_t i40e_parse_hena(uint64_t flags);
 
 /* I40E_DEV_PRIVATE_TO */
 #define I40E_DEV_PRIVATE_TO_PF(adapter) \
Signature · 1 line
1.8.1.4
#15 lore raw

PATCH v3 3/3 i40evf: support of RSS in VF

In reply to a message not in the archive

i40e hardware supports RSS in VF, the code changes are to add this support.

---
 lib/librte_pmd_i40e/i40e_ethdev.h    |   6 ++
 lib/librte_pmd_i40e/i40e_ethdev_vf.c | 142 +++++++++++++++++++++++++++++++++++
 2 files changed, 148 insertions(+)

v2 changes:
* Updating/querying redirection table has been removed, as it will be in another patches of supporting different redirection table sizes soon later.

lib/librte_pmd_i40e/i40e_ethdev.h +6 -0
index c801345..1d42cd2 100644
@@ -283,6 +283,8 @@ struct i40e_vf_tx_queues {
  * Structure to store private data specific for VF instance.
  */
 struct i40e_vf {
+	struct i40e_adapter *adapter; /* The adapter this VF associate to */
+	struct rte_eth_dev_data *dev_data; /* Pointer to the device data */
 	uint16_t num_queue_pairs;
 	uint16_t max_pkt_len; /* Maximum packet length */
 	bool promisc_unicast_enabled;
@@ -393,6 +395,10 @@ i40e_get_vsi_from_adapter(struct i40e_adapter *adapter)
 #define I40E_PF_TO_ADAPTER(pf) \
 	((struct i40e_adapter *)pf->adapter)
 
+/* I40E_VF_TO */
+#define I40E_VF_TO_HW(vf) \
+	(&(((struct i40e_vf *)vf)->adapter->hw))
+
 static inline void
 i40e_init_adminq_parameter(struct i40e_hw *hw)
 {
lib/librte_pmd_i40e/i40e_ethdev_vf.c +142 -0

178 lines not on this page · raw message

Signature · 1 line
1.8.1.4
Acked-by
#16 lore raw
In reply to a message not in the archive
Quoted 35 lines

-----Original Message-----
From: Zhang, Helin
Sent: Monday, October 20, 2014 10:58 AM
To: [email protected]
Cc: Cao, Waterman; Zhang, Helin
Subject: [PATCH v3 0/3] add i40e RSS support in VF

As hardware supports RSS in VF, the patches add that support in driver. In addition, minor improvements are added for defining macro with constant.

v2 changes:
* Removed support of updating/querying redirection table, as it will be implemented in another patches later.
* Removed changes in testpmd, as it is not needed at all for supporting RSS in VF.

v3 changes:
* Removed macros in i40e_ethdev.c, as they have already been moved to i40e_ethdev.h.

Helin Zhang (3):
ethdev: improvement for constant usage
i40e: extern two functions and relevant macros
i40evf: support of RSS in VF

 lib/librte_ether/rte_ethdev.h        |  47 ++++++------
 lib/librte_pmd_i40e/i40e_ethdev.c    |  34 +--------
 lib/librte_pmd_i40e/i40e_ethdev.h    |  40 +++++++++-
 lib/librte_pmd_i40e/i40e_ethdev_vf.c | 142
+++++++++++++++++++++++++++++++++++
 4 files changed, 207 insertions(+), 56 deletions(-)

--
1.8.1.4

A message that is not in the archive (sent off-list or not yet received): 1ED644BD7E0A5F4091CF203DAFB8E4CC01D7FFB7-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org

#18 lore raw
Quoted 14 lines
Quoted 14 lines

As hardware supports RSS in VF, the patches add that support in driver. In addition, minor improvements are added for defining macro with constant.

v2 changes:
* Removed support of updating/querying redirection table, as it will be implemented in another patches later.
* Removed changes in testpmd, as it is not needed at all for supporting RSS in VF.

v3 changes:
* Removed macros in i40e_ethdev.c, as they have already been moved to i40e_ethdev.h.

Quoted 7 lines
Quoted 4 lines

Helin Zhang (3):
ethdev: improvement for constant usage
i40e: extern two functions and relevant macros
i40evf: support of RSS in VF

Applied

Thanks

Signature · 1 line
Thomas
#19 lore raw
In reply to a message not in the archive
Quoted 35 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Helin Zhang
Sent: Monday, October 20, 2014 10:58 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH v3 0/3] add i40e RSS support in VF

As hardware supports RSS in VF, the patches add that support in driver. In addition, minor improvements are added for defining macro with constant.

v2 changes:
* Removed support of updating/querying redirection table, as it will be implemented in another patches later.
* Removed changes in testpmd, as it is not needed at all for supporting RSS in VF.

v3 changes:
* Removed macros in i40e_ethdev.c, as they have already been moved to i40e_ethdev.h.

Helin Zhang (3):
ethdev: improvement for constant usage
i40e: extern two functions and relevant macros
i40evf: support of RSS in VF

 lib/librte_ether/rte_ethdev.h        |  47 ++++++------
 lib/librte_pmd_i40e/i40e_ethdev.c    |  34 +--------
 lib/librte_pmd_i40e/i40e_ethdev.h    |  40 +++++++++-
 lib/librte_pmd_i40e/i40e_ethdev_vf.c | 142
+++++++++++++++++++++++++++++++++++
 4 files changed, 207 insertions(+), 56 deletions(-)

--
1.8.1.4