[dpdk-dev,v2,2/3] i40e: extern two functions and relevant macros
diff mbox

Message ID 1411089280-23595-3-git-send-email-helin.zhang@intel.com
State Superseded, archived
Headers show

Commit Message

Helin Zhang Sept. 19, 2014, 1:14 a.m. UTC
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.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Reviewed-by: Cunming Liang <cunming.liang@intel.com>
Reviewed-by: Jijiang Liu <jijiang.liu@intel.com>
---
 lib/librte_pmd_i40e/i40e_ethdev.c |  4 ++--
 lib/librte_pmd_i40e/i40e_ethdev.h | 34 +++++++++++++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 3 deletions(-)

Comments

Thomas Monjalon Oct. 17, 2014, 8:59 p.m. UTC | #1
2014-09-19 09:14, Helin Zhang:
> 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.
> 
> Signed-off-by: Helin Zhang <helin.zhang@intel.com>
> Reviewed-by: Cunming Liang <cunming.liang@intel.com>
> Reviewed-by: Jijiang Liu <jijiang.liu@intel.com>
[...]
> +#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))

You've added the constants in the .h file but you forgot to remove them from
the .c file.
Helin Zhang Oct. 20, 2014, 1:11 a.m. UTC | #2
Hi Thomas

> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Saturday, October 18, 2014 4:59 AM
> To: Zhang, Helin
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2 2/3] i40e: extern two functions and relevant
> macros
> 
> 2014-09-19 09:14, Helin Zhang:
> > 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.
> >
> > Signed-off-by: Helin Zhang <helin.zhang@intel.com>
> > Reviewed-by: Cunming Liang <cunming.liang@intel.com>
> > Reviewed-by: Jijiang Liu <jijiang.liu@intel.com>
> [...]
> > +#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))
> 
> 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!


> 
> --
> Thomas

Regards,
Helin

Patch
diff mbox

diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c
index 4e65ca4..f7a40a9 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -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;
diff --git a/lib/librte_pmd_i40e/i40e_ethdev.h b/lib/librte_pmd_i40e/i40e_ethdev.h
index 64deef2..c801345 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.h
+++ b/lib/librte_pmd_i40e/i40e_ethdev.h
@@ -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) \