[v2,3/4] net/ice: add check for NVGRE protocol

Message ID 20200617061429.6447-4-wei.zhao1@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers
Series enable more PPPoE packet type for switch |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Zhao1, Wei June 17, 2020, 6:14 a.m. UTC
  This patch add check for protocol type of IPv4 packet,
it need to update tunnel type when NVGRE is in payload.

Fixes: 6bc7628c5e0b ("net/ice: change default tunnel type")
Cc: stable@dpdk.org

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 drivers/net/ice/ice_switch_filter.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
  

Comments

Qi Zhang June 22, 2020, 3:49 p.m. UTC | #1
> -----Original Message-----
> From: Zhao1, Wei <wei.zhao1@intel.com>
> Sent: Wednesday, June 17, 2020 2:14 PM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Zhao1, Wei
> <wei.zhao1@intel.com>
> Subject: [PATCH v2 3/4] net/ice: add check for NVGRE protocol

fix tunnel type for switch rule

> 
> This patch add check for protocol type of IPv4 packet, it need to update tunnel
> type when NVGRE is in payload.

The patch change default tunnel type to ICE_NON_TUN and only change to 
ICE_SW_TUN_AND_NON_TUN to hint switch engine if GRE proto is matched in a IPv4 header.

> 
> Fixes: 6bc7628c5e0b ("net/ice: change default tunnel type")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> ---
>  drivers/net/ice/ice_switch_filter.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ice/ice_switch_filter.c
> b/drivers/net/ice/ice_switch_filter.c
> index 3c0c36bce..3b38195d6 100644
> --- a/drivers/net/ice/ice_switch_filter.c
> +++ b/drivers/net/ice/ice_switch_filter.c
> @@ -28,6 +28,7 @@
>  #define MAX_QGRP_NUM_TYPE 7
>  #define ICE_PPP_IPV4_PROTO	0x0021
>  #define ICE_PPP_IPV6_PROTO	0x0057
> +#define ICE_IPV4_PROTO_NVGRE	0x2F
To keep consistent 
#define ICE_IPV4_NVGRE_PROTO 0x002F 

> 
>  #define ICE_SW_INSET_ETHER ( \
>  	ICE_INSET_DMAC | ICE_INSET_SMAC | ICE_INSET_ETHERTYPE) @@ -632,6
> +633,10 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
>  					list[t].m_u.ipv4_hdr.protocol =
>  						ipv4_mask->hdr.next_proto_id;
>  				}
> +				if ((ipv4_spec->hdr.next_proto_id &
> +					ipv4_mask->hdr.next_proto_id) ==
> +					ICE_IPV4_PROTO_NVGRE)
> +					*tun_type = ICE_SW_TUN_AND_NON_TUN;
>  				if (ipv4_mask->hdr.type_of_service) {
>  					list[t].h_u.ipv4_hdr.tos =
>  						ipv4_spec->hdr.type_of_service;
> @@ -1526,7 +1531,7 @@ ice_switch_parse_pattern_action(struct ice_adapter
> *ad,
>  	const struct rte_flow_item *item = pattern;
>  	uint16_t item_num = 0;
>  	enum ice_sw_tunnel_type tun_type =
> -		ICE_SW_TUN_AND_NON_TUN;
> +			ICE_NON_TUN;
>  	struct ice_pattern_match_item *pattern_match_item = NULL;
> 
>  	for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
> --
> 2.19.1
  
Zhao1, Wei June 23, 2020, 1:11 a.m. UTC | #2
> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Monday, June 22, 2020 11:50 PM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: stable@dpdk.org
> Subject: RE: [PATCH v2 3/4] net/ice: add check for NVGRE protocol
> 
> 
> 
> > -----Original Message-----
> > From: Zhao1, Wei <wei.zhao1@intel.com>
> > Sent: Wednesday, June 17, 2020 2:14 PM
> > To: dev@dpdk.org
> > Cc: stable@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Zhao1, Wei
> > <wei.zhao1@intel.com>
> > Subject: [PATCH v2 3/4] net/ice: add check for NVGRE protocol
> 
> fix tunnel type for switch rule
> 
> >
> > This patch add check for protocol type of IPv4 packet, it need to
> > update tunnel type when NVGRE is in payload.
> 
> The patch change default tunnel type to ICE_NON_TUN and only change to
> ICE_SW_TUN_AND_NON_TUN to hint switch engine if GRE proto is matched in
> a IPv4 header.
> 

Ok, Update in v3 
> >
> > Fixes: 6bc7628c5e0b ("net/ice: change default tunnel type")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> > ---
> >  drivers/net/ice/ice_switch_filter.c | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ice/ice_switch_filter.c
> > b/drivers/net/ice/ice_switch_filter.c
> > index 3c0c36bce..3b38195d6 100644
> > --- a/drivers/net/ice/ice_switch_filter.c
> > +++ b/drivers/net/ice/ice_switch_filter.c
> > @@ -28,6 +28,7 @@
> >  #define MAX_QGRP_NUM_TYPE 7
> >  #define ICE_PPP_IPV4_PROTO	0x0021
> >  #define ICE_PPP_IPV6_PROTO	0x0057
> > +#define ICE_IPV4_PROTO_NVGRE	0x2F
> To keep consistent
> #define ICE_IPV4_NVGRE_PROTO 0x002F
> 

Ok, Update in v3

> >
> >  #define ICE_SW_INSET_ETHER ( \
> >  	ICE_INSET_DMAC | ICE_INSET_SMAC | ICE_INSET_ETHERTYPE) @@
> -632,6
> > +633,10 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
> >  					list[t].m_u.ipv4_hdr.protocol =
> >  						ipv4_mask->hdr.next_proto_id;
> >  				}
> > +				if ((ipv4_spec->hdr.next_proto_id &
> > +					ipv4_mask->hdr.next_proto_id) ==
> > +					ICE_IPV4_PROTO_NVGRE)
> > +					*tun_type = ICE_SW_TUN_AND_NON_TUN;
> >  				if (ipv4_mask->hdr.type_of_service) {
> >  					list[t].h_u.ipv4_hdr.tos =
> >  						ipv4_spec->hdr.type_of_service; @@ -1526,7
> +1531,7 @@
> > ice_switch_parse_pattern_action(struct ice_adapter *ad,
> >  	const struct rte_flow_item *item = pattern;
> >  	uint16_t item_num = 0;
> >  	enum ice_sw_tunnel_type tun_type =
> > -		ICE_SW_TUN_AND_NON_TUN;
> > +			ICE_NON_TUN;
> >  	struct ice_pattern_match_item *pattern_match_item = NULL;
> >
> >  	for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
> > --
> > 2.19.1
>
  

Patch

diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index 3c0c36bce..3b38195d6 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -28,6 +28,7 @@ 
 #define MAX_QGRP_NUM_TYPE 7
 #define ICE_PPP_IPV4_PROTO	0x0021
 #define ICE_PPP_IPV6_PROTO	0x0057
+#define ICE_IPV4_PROTO_NVGRE	0x2F
 
 #define ICE_SW_INSET_ETHER ( \
 	ICE_INSET_DMAC | ICE_INSET_SMAC | ICE_INSET_ETHERTYPE)
@@ -632,6 +633,10 @@  ice_switch_inset_get(const struct rte_flow_item pattern[],
 					list[t].m_u.ipv4_hdr.protocol =
 						ipv4_mask->hdr.next_proto_id;
 				}
+				if ((ipv4_spec->hdr.next_proto_id &
+					ipv4_mask->hdr.next_proto_id) ==
+					ICE_IPV4_PROTO_NVGRE)
+					*tun_type = ICE_SW_TUN_AND_NON_TUN;
 				if (ipv4_mask->hdr.type_of_service) {
 					list[t].h_u.ipv4_hdr.tos =
 						ipv4_spec->hdr.type_of_service;
@@ -1526,7 +1531,7 @@  ice_switch_parse_pattern_action(struct ice_adapter *ad,
 	const struct rte_flow_item *item = pattern;
 	uint16_t item_num = 0;
 	enum ice_sw_tunnel_type tun_type =
-		ICE_SW_TUN_AND_NON_TUN;
+			ICE_NON_TUN;
 	struct ice_pattern_match_item *pattern_match_item = NULL;
 
 	for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {