[v4] net/iavf: support outer IP hash for GTPU

Message ID 20200910032623.38168-1-alvinx.zhang@intel.com (mailing list archive)
State Changes Requested, archived
Delegated to: Qi Zhang
Headers
Series [v4] net/iavf: support outer IP hash for GTPU |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation fail Compilation issues

Commit Message

Alvin Zhang Sept. 10, 2020, 3:26 a.m. UTC
  From: Alvin Zhang <alvinx.zhang@intel.com>

Add headers for GTPU, now outer IP hash can be configured as input
sets for GTPU packet.

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
---
 
V2: Modify codes according to comments.
V3: Refact all codes.
V4: Fix compatibility issues.

 drivers/net/iavf/iavf_hash.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
  

Comments

Guo, Jia Sept. 10, 2020, 5:24 a.m. UTC | #1
> -----Original Message-----
> From: Zhang, AlvinX <alvinx.zhang@intel.com>
> Sent: Thursday, September 10, 2020 11:26 AM
> To: Guo, Jia <jia.guo@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>
> Subject: [PATCH v4] net/iavf: support outer IP hash for GTPU
> 
> From: Alvin Zhang <alvinx.zhang@intel.com>
> 
> Add headers for GTPU, now outer IP hash can be configured as input sets for
> GTPU packet.
> 

I think this patch will not cover outer IP hash for any GTPU case, only none-inner GTPU case, right? 

> Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
> ---
> 
> V2: Modify codes according to comments.
> V3: Refact all codes.
> V4: Fix compatibility issues.
> 
>  drivers/net/iavf/iavf_hash.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c index
> aab8b14..3ec32d9 100644
> --- a/drivers/net/iavf/iavf_hash.c
> +++ b/drivers/net/iavf/iavf_hash.c
> @@ -132,6 +132,9 @@ struct iavf_hash_flow_cfg {
>  	VIRTCHNL_PROTO_HDR_PFCP, \
>  	FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_PFCP_SEID),
> {BUFF_NOUSED} }
> 
> +#define proto_hdr_gtpu { \
> +	VIRTCHNL_PROTO_HDR_GTPU_IP, 0, {BUFF_NOUSED} }
> +

I still not funs of set field to zero here since it should be general use for other case, it could specific refine to 0 when parsing pattern if need. 

>  #define TUNNEL_LEVEL_OUTER		0
>  #define TUNNEL_LEVEL_INNER		1
> 
> @@ -256,6 +259,14 @@ struct virtchnl_proto_hdrs ipv6_pfcp_tmplt = {
>  	TUNNEL_LEVEL_OUTER, 2, {proto_hdr_ipv6, proto_hdr_pfcp}  };
> 
> +struct virtchnl_proto_hdrs outer_ipv4_udp_gtpu_tmplt = {
> +	TUNNEL_LEVEL_OUTER, 3, {proto_hdr_ipv4, proto_hdr_udp,
> proto_hdr_gtpu}
> +};
> +
> +struct virtchnl_proto_hdrs outer_ipv6_udp_gtpu_tmplt = {
> +	TUNNEL_LEVEL_OUTER, 3, {proto_hdr_ipv6, proto_hdr_udp,
> proto_hdr_gtpu}
> +};
> +
>  /* rss type super set */
> 
>  /* IPv4 outer */
> @@ -348,6 +359,7 @@ struct virtchnl_proto_hdrs ipv6_pfcp_tmplt = {
>  	{iavf_pattern_eth_vlan_ipv4_udp,
> 	IAVF_RSS_TYPE_VLAN_IPV4_UDP,	&outer_ipv4_udp_tmplt},
>  	{iavf_pattern_eth_vlan_ipv4_tcp,
> 	IAVF_RSS_TYPE_VLAN_IPV4_TCP,	&outer_ipv4_tcp_tmplt},
>  	{iavf_pattern_eth_vlan_ipv4_sctp,
> 	IAVF_RSS_TYPE_VLAN_IPV4_SCTP,	&outer_ipv4_sctp_tmplt},
> +	{iavf_pattern_eth_ipv4_gtpu,			ETH_RSS_IPV4,
> 		&outer_ipv4_udp_gtpu_tmplt},

There is also a question the same as the other mail loop of GTPC, should it be supper set here?

>  	{iavf_pattern_eth_ipv4_gtpu_ipv4,
> 	IAVF_RSS_TYPE_GTPU_IPV4,	&inner_ipv4_tmplt},
>  	{iavf_pattern_eth_ipv4_gtpu_ipv4_udp,
> 	IAVF_RSS_TYPE_GTPU_IPV4_UDP,	&inner_ipv4_udp_tmplt},
>  	{iavf_pattern_eth_ipv4_gtpu_ipv4_tcp,
> 	IAVF_RSS_TYPE_GTPU_IPV4_TCP,	&inner_ipv4_tcp_tmplt},
> @@ -374,6 +386,7 @@ struct virtchnl_proto_hdrs ipv6_pfcp_tmplt = {
>  	{iavf_pattern_eth_vlan_ipv6_udp,
> 	IAVF_RSS_TYPE_VLAN_IPV6_UDP,	&outer_ipv6_udp_tmplt},
>  	{iavf_pattern_eth_vlan_ipv6_tcp,
> 	IAVF_RSS_TYPE_VLAN_IPV6_TCP,	&outer_ipv6_tcp_tmplt},
>  	{iavf_pattern_eth_vlan_ipv6_sctp,
> 	IAVF_RSS_TYPE_VLAN_IPV6_SCTP,	&outer_ipv6_sctp_tmplt},
> +	{iavf_pattern_eth_ipv6_gtpu,			ETH_RSS_IPV6,
> 		&outer_ipv6_udp_gtpu_tmplt},
>  	{iavf_pattern_eth_ipv4_gtpu_ipv6,
> 	IAVF_RSS_TYPE_GTPU_IPV6,	&inner_ipv6_tmplt},
>  	{iavf_pattern_eth_ipv4_gtpu_ipv6_udp,
> 	IAVF_RSS_TYPE_GTPU_IPV6_UDP,	&inner_ipv6_udp_tmplt},
>  	{iavf_pattern_eth_ipv4_gtpu_ipv6_tcp,
> 	IAVF_RSS_TYPE_GTPU_IPV6_TCP,	&inner_ipv6_tcp_tmplt},
> --
> 1.8.3.1
  
Alvin Zhang Sept. 10, 2020, 9:24 a.m. UTC | #2
Thanks Guojia,

> -----Original Message-----
> From: Guo, Jia <jia.guo@intel.com>
> Sent: Thursday, September 10, 2020 1:25 PM
> To: Zhang, AlvinX <alvinx.zhang@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org
> Subject: RE: [PATCH v4] net/iavf: support outer IP hash for GTPU
> 
> 
> > -----Original Message-----
> > From: Zhang, AlvinX <alvinx.zhang@intel.com>
> > Sent: Thursday, September 10, 2020 11:26 AM
> > To: Guo, Jia <jia.guo@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> > Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>
> > Subject: [PATCH v4] net/iavf: support outer IP hash for GTPU
> >
> > From: Alvin Zhang <alvinx.zhang@intel.com>
> >
> > Add headers for GTPU, now outer IP hash can be configured as input
> > sets for GTPU packet.
> >
> 
> I think this patch will not cover outer IP hash for any GTPU case, only none-inner
> GTPU case, right?
> 
> > Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
> > ---
> >
> > V2: Modify codes according to comments.
> > V3: Refact all codes.
> > V4: Fix compatibility issues.
> >
> >  drivers/net/iavf/iavf_hash.c | 13 +++++++++++++
> >  1 file changed, 13 insertions(+)
> >
> > diff --git a/drivers/net/iavf/iavf_hash.c
> > b/drivers/net/iavf/iavf_hash.c index
> > aab8b14..3ec32d9 100644
> > --- a/drivers/net/iavf/iavf_hash.c
> > +++ b/drivers/net/iavf/iavf_hash.c
> > @@ -132,6 +132,9 @@ struct iavf_hash_flow_cfg {
> > VIRTCHNL_PROTO_HDR_PFCP, \
> > FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_PFCP_SEID),
> > {BUFF_NOUSED} }
> >
> > +#define proto_hdr_gtpu { \
> > +VIRTCHNL_PROTO_HDR_GTPU_IP, 0, {BUFF_NOUSED} }
> > +
> 
> I still not funs of set field to zero here since it should be general use for other
> case, it could specific refine to 0 when parsing pattern if need.

In V1 patch I have put TEID field as input set, but the kernel driver did not supported this field and returned success.
That's mean the rule has been created succeed, but it did not work.

> 
> >  #define TUNNEL_LEVEL_OUTER0
> >  #define TUNNEL_LEVEL_INNER1
> >
> > @@ -256,6 +259,14 @@ struct virtchnl_proto_hdrs ipv6_pfcp_tmplt = {
> > TUNNEL_LEVEL_OUTER, 2, {proto_hdr_ipv6, proto_hdr_pfcp}  };
> >
> > +struct virtchnl_proto_hdrs outer_ipv4_udp_gtpu_tmplt = {
> > +TUNNEL_LEVEL_OUTER, 3, {proto_hdr_ipv4, proto_hdr_udp,
> > proto_hdr_gtpu}
> > +};
> > +
> > +struct virtchnl_proto_hdrs outer_ipv6_udp_gtpu_tmplt = {
> > +TUNNEL_LEVEL_OUTER, 3, {proto_hdr_ipv6, proto_hdr_udp,
> > proto_hdr_gtpu}
> > +};
> > +
> >  /* rss type super set */
> >
> >  /* IPv4 outer */
> > @@ -348,6 +359,7 @@ struct virtchnl_proto_hdrs ipv6_pfcp_tmplt = {
> > {iavf_pattern_eth_vlan_ipv4_udp,
> > IAVF_RSS_TYPE_VLAN_IPV4_UDP,&outer_ipv4_udp_tmplt},
> >  {iavf_pattern_eth_vlan_ipv4_tcp,
> > IAVF_RSS_TYPE_VLAN_IPV4_TCP,&outer_ipv4_tcp_tmplt},
> >  {iavf_pattern_eth_vlan_ipv4_sctp,
> > IAVF_RSS_TYPE_VLAN_IPV4_SCTP,&outer_ipv4_sctp_tmplt},
> > +{iavf_pattern_eth_ipv4_gtpu,ETH_RSS_IPV4,
> > &outer_ipv4_udp_gtpu_tmplt},
> 
> There is also a question the same as the other mail loop of GTPC, should it be
> supper set here?

As above, if user really set ETH_RSS_GTPU as input set, the rule will be created succeed, but it don't work.

> 
> >  {iavf_pattern_eth_ipv4_gtpu_ipv4,
> > IAVF_RSS_TYPE_GTPU_IPV4,&inner_ipv4_tmplt},
> >  {iavf_pattern_eth_ipv4_gtpu_ipv4_udp,
> > IAVF_RSS_TYPE_GTPU_IPV4_UDP,&inner_ipv4_udp_tmplt},
> >  {iavf_pattern_eth_ipv4_gtpu_ipv4_tcp,
> > IAVF_RSS_TYPE_GTPU_IPV4_TCP,&inner_ipv4_tcp_tmplt},
> > @@ -374,6 +386,7 @@ struct virtchnl_proto_hdrs ipv6_pfcp_tmplt = {
> > {iavf_pattern_eth_vlan_ipv6_udp,
> > IAVF_RSS_TYPE_VLAN_IPV6_UDP,&outer_ipv6_udp_tmplt},
> >  {iavf_pattern_eth_vlan_ipv6_tcp,
> > IAVF_RSS_TYPE_VLAN_IPV6_TCP,&outer_ipv6_tcp_tmplt},
> >  {iavf_pattern_eth_vlan_ipv6_sctp,
> > IAVF_RSS_TYPE_VLAN_IPV6_SCTP,&outer_ipv6_sctp_tmplt},
> > +{iavf_pattern_eth_ipv6_gtpu,ETH_RSS_IPV6,
> > &outer_ipv6_udp_gtpu_tmplt},
> >  {iavf_pattern_eth_ipv4_gtpu_ipv6,
> > IAVF_RSS_TYPE_GTPU_IPV6,&inner_ipv6_tmplt},
> >  {iavf_pattern_eth_ipv4_gtpu_ipv6_udp,
> > IAVF_RSS_TYPE_GTPU_IPV6_UDP,&inner_ipv6_udp_tmplt},
> >  {iavf_pattern_eth_ipv4_gtpu_ipv6_tcp,
> > IAVF_RSS_TYPE_GTPU_IPV6_TCP,&inner_ipv6_tcp_tmplt},
> > --
> > 1.8.3.1
>
  

Patch

diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index aab8b14..3ec32d9 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -132,6 +132,9 @@  struct iavf_hash_flow_cfg {
 	VIRTCHNL_PROTO_HDR_PFCP, \
 	FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_PFCP_SEID), {BUFF_NOUSED} }
 
+#define proto_hdr_gtpu { \
+	VIRTCHNL_PROTO_HDR_GTPU_IP, 0, {BUFF_NOUSED} }
+
 #define TUNNEL_LEVEL_OUTER		0
 #define TUNNEL_LEVEL_INNER		1
 
@@ -256,6 +259,14 @@  struct virtchnl_proto_hdrs ipv6_pfcp_tmplt = {
 	TUNNEL_LEVEL_OUTER, 2, {proto_hdr_ipv6, proto_hdr_pfcp}
 };
 
+struct virtchnl_proto_hdrs outer_ipv4_udp_gtpu_tmplt = {
+	TUNNEL_LEVEL_OUTER, 3, {proto_hdr_ipv4, proto_hdr_udp, proto_hdr_gtpu}
+};
+
+struct virtchnl_proto_hdrs outer_ipv6_udp_gtpu_tmplt = {
+	TUNNEL_LEVEL_OUTER, 3, {proto_hdr_ipv6, proto_hdr_udp, proto_hdr_gtpu}
+};
+
 /* rss type super set */
 
 /* IPv4 outer */
@@ -348,6 +359,7 @@  struct virtchnl_proto_hdrs ipv6_pfcp_tmplt = {
 	{iavf_pattern_eth_vlan_ipv4_udp,		IAVF_RSS_TYPE_VLAN_IPV4_UDP,	&outer_ipv4_udp_tmplt},
 	{iavf_pattern_eth_vlan_ipv4_tcp,		IAVF_RSS_TYPE_VLAN_IPV4_TCP,	&outer_ipv4_tcp_tmplt},
 	{iavf_pattern_eth_vlan_ipv4_sctp,		IAVF_RSS_TYPE_VLAN_IPV4_SCTP,	&outer_ipv4_sctp_tmplt},
+	{iavf_pattern_eth_ipv4_gtpu,			ETH_RSS_IPV4,			&outer_ipv4_udp_gtpu_tmplt},
 	{iavf_pattern_eth_ipv4_gtpu_ipv4,		IAVF_RSS_TYPE_GTPU_IPV4,	&inner_ipv4_tmplt},
 	{iavf_pattern_eth_ipv4_gtpu_ipv4_udp,		IAVF_RSS_TYPE_GTPU_IPV4_UDP,	&inner_ipv4_udp_tmplt},
 	{iavf_pattern_eth_ipv4_gtpu_ipv4_tcp,		IAVF_RSS_TYPE_GTPU_IPV4_TCP,	&inner_ipv4_tcp_tmplt},
@@ -374,6 +386,7 @@  struct virtchnl_proto_hdrs ipv6_pfcp_tmplt = {
 	{iavf_pattern_eth_vlan_ipv6_udp,		IAVF_RSS_TYPE_VLAN_IPV6_UDP,	&outer_ipv6_udp_tmplt},
 	{iavf_pattern_eth_vlan_ipv6_tcp,		IAVF_RSS_TYPE_VLAN_IPV6_TCP,	&outer_ipv6_tcp_tmplt},
 	{iavf_pattern_eth_vlan_ipv6_sctp,		IAVF_RSS_TYPE_VLAN_IPV6_SCTP,	&outer_ipv6_sctp_tmplt},
+	{iavf_pattern_eth_ipv6_gtpu,			ETH_RSS_IPV6,			&outer_ipv6_udp_gtpu_tmplt},
 	{iavf_pattern_eth_ipv4_gtpu_ipv6,		IAVF_RSS_TYPE_GTPU_IPV6,	&inner_ipv6_tmplt},
 	{iavf_pattern_eth_ipv4_gtpu_ipv6_udp,		IAVF_RSS_TYPE_GTPU_IPV6_UDP,	&inner_ipv6_udp_tmplt},
 	{iavf_pattern_eth_ipv4_gtpu_ipv6_tcp,		IAVF_RSS_TYPE_GTPU_IPV6_TCP,	&inner_ipv6_tcp_tmplt},