[dpdk-dev] net/ixgbe: add support for VLAN in IP mode FDIR

Message ID 1528189935-34943-3-git-send-email-wei.zhao1@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers

Checks

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

Commit Message

Zhao1, Wei June 5, 2018, 9:12 a.m. UTC
  In IP mode FDIR, X550 can support not only 4 tuple parameters
but also vlan tci in protocol, so add this feature to flow parser.

Fixes: 11777435c727 ("net/ixgbe: parse flow director filter")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 drivers/net/ixgbe/ixgbe_flow.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

Wenzhuo Lu June 12, 2018, 2:25 a.m. UTC | #1
Hi Wei,


> -----Original Message-----
> From: Zhao1, Wei
> Sent: Tuesday, June 5, 2018 5:12 PM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; stable@dpdk.org; Zhao1, Wei
> <wei.zhao1@intel.com>
> Subject: [PATCH] net/ixgbe: add support for VLAN in IP mode FDIR
> 
> In IP mode FDIR, X550 can support not only 4 tuple parameters but also vlan
> tci in protocol, so add this feature to flow parser.
> 
> Fixes: 11777435c727 ("net/ixgbe: parse flow director filter")
> 
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> ---
>  drivers/net/ixgbe/ixgbe_flow.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
> index 0427e6f..f5e7805 100644
> --- a/drivers/net/ixgbe/ixgbe_flow.c
> +++ b/drivers/net/ixgbe/ixgbe_flow.c
> @@ -322,7 +322,8 @@ cons_parse_ntuple_filter(const struct rte_flow_attr
> *attr,
>  		}
>  		/* check if the next not void item is IPv4 */
The comment should be updated too, if we need below change.

>  		item = next_no_void_pattern(pattern, item);
> -		if (item->type != RTE_FLOW_ITEM_TYPE_IPV4) {
> +		if (item->type != RTE_FLOW_ITEM_TYPE_IPV4 &&
> +				item->type != RTE_FLOW_ITEM_TYPE_VLAN) {
>  			rte_flow_error_set(error,
>  			  EINVAL, RTE_FLOW_ERROR_TYPE_ITEM,
>  			  item, "Not supported by ntuple filter"); 
Really confused. I see the above code is already wrapped by " if (item->type == RTE_FLOW_ITEM_TYPE_VLAN) {". You want to support double vlan?
  
Zhao1, Wei June 12, 2018, 2:30 a.m. UTC | #2
Hi, wenzhuo

> -----Original Message-----
> From: Lu, Wenzhuo
> Sent: Tuesday, June 12, 2018 10:26 AM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: stable@dpdk.org
> Subject: RE: [PATCH] net/ixgbe: add support for VLAN in IP mode FDIR
> 
> Hi Wei,
> 
> 
> > -----Original Message-----
> > From: Zhao1, Wei
> > Sent: Tuesday, June 5, 2018 5:12 PM
> > To: dev@dpdk.org
> > Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; stable@dpdk.org; Zhao1, Wei
> > <wei.zhao1@intel.com>
> > Subject: [PATCH] net/ixgbe: add support for VLAN in IP mode FDIR
> >
> > In IP mode FDIR, X550 can support not only 4 tuple parameters but also
> > vlan tci in protocol, so add this feature to flow parser.
> >
> > Fixes: 11777435c727 ("net/ixgbe: parse flow director filter")
> >
> > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> > ---
> >  drivers/net/ixgbe/ixgbe_flow.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ixgbe/ixgbe_flow.c
> > b/drivers/net/ixgbe/ixgbe_flow.c index 0427e6f..f5e7805 100644
> > --- a/drivers/net/ixgbe/ixgbe_flow.c
> > +++ b/drivers/net/ixgbe/ixgbe_flow.c
> > @@ -322,7 +322,8 @@ cons_parse_ntuple_filter(const struct
> > rte_flow_attr *attr,
> >  		}
> >  		/* check if the next not void item is IPv4 */
> The comment should be updated too, if we need below change.

Ok, I will update it.
> 
> >  		item = next_no_void_pattern(pattern, item);
> > -		if (item->type != RTE_FLOW_ITEM_TYPE_IPV4) {
> > +		if (item->type != RTE_FLOW_ITEM_TYPE_IPV4 &&
> > +				item->type != RTE_FLOW_ITEM_TYPE_VLAN)
> {
> >  			rte_flow_error_set(error,
> >  			  EINVAL, RTE_FLOW_ERROR_TYPE_ITEM,
> >  			  item, "Not supported by ntuple filter");
> Really confused. I see the above code is already wrapped by " if (item->type
> == RTE_FLOW_ITEM_TYPE_VLAN) {". You want to support double vlan?

No, I have get a report that some use the following mode 
sendp([Ether(dst="A0:36:9F:BD:5D:B0")/Dot1Q(vlan=1)/IP(src="192.168.0.1",dst="192.168.0.2",tos=2,ttl=40)/UDP(dport=23, sport=22)/Raw('x'*100)],iface="enp3s0f0",count=10)
to test fdir IP mode.
In order to support this, we need this patch.
  
Wenzhuo Lu June 12, 2018, 2:41 a.m. UTC | #3
> -----Original Message-----
> From: Zhao1, Wei
> Sent: Tuesday, June 12, 2018 10:31 AM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; dev@dpdk.org
> Cc: stable@dpdk.org
> Subject: RE: [PATCH] net/ixgbe: add support for VLAN in IP mode FDIR
> 
> Hi, wenzhuo
> 
> > -----Original Message-----
> > From: Lu, Wenzhuo
> > Sent: Tuesday, June 12, 2018 10:26 AM
> > To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> > Cc: stable@dpdk.org
> > Subject: RE: [PATCH] net/ixgbe: add support for VLAN in IP mode FDIR
> >
> > Hi Wei,
> >
> >
> > > -----Original Message-----
> > > From: Zhao1, Wei
> > > Sent: Tuesday, June 5, 2018 5:12 PM
> > > To: dev@dpdk.org
> > > Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; stable@dpdk.org; Zhao1, Wei
> > > <wei.zhao1@intel.com>
> > > Subject: [PATCH] net/ixgbe: add support for VLAN in IP mode FDIR
> > >
> > > In IP mode FDIR, X550 can support not only 4 tuple parameters but
> > > also vlan tci in protocol, so add this feature to flow parser.
> > >
> > > Fixes: 11777435c727 ("net/ixgbe: parse flow director filter")
> > >
> > > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> > > ---

> >
> > >  		item = next_no_void_pattern(pattern, item);
> > > -		if (item->type != RTE_FLOW_ITEM_TYPE_IPV4) {
> > > +		if (item->type != RTE_FLOW_ITEM_TYPE_IPV4 &&
> > > +				item->type != RTE_FLOW_ITEM_TYPE_VLAN)
> > {
> > >  			rte_flow_error_set(error,
> > >  			  EINVAL, RTE_FLOW_ERROR_TYPE_ITEM,
> > >  			  item, "Not supported by ntuple filter");
> > Really confused. I see the above code is already wrapped by " if
> > (item->type == RTE_FLOW_ITEM_TYPE_VLAN) {". You want to support
> double vlan?
> 
> No, I have get a report that some use the following mode
> sendp([Ether(dst="A0:36:9F:BD:5D:B0")/Dot1Q(vlan=1)/IP(src="192.168.0.1",d
> st="192.168.0.2",tos=2,ttl=40)/UDP(dport=23,
> sport=22)/Raw('x'*100)],iface="enp3s0f0",count=10)
> to test fdir IP mode.
> In order to support this, we need this patch.
I can understand the change in ' ixgbe_parse_fdir_filter_normal' is to support this case.
What I cannot understand is the above change. The original code is already for the case vlan + IPv4.
  
Zhao1, Wei June 12, 2018, 2:49 a.m. UTC | #4
> -----Original Message-----
> From: Lu, Wenzhuo
> Sent: Tuesday, June 12, 2018 10:42 AM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: stable@dpdk.org
> Subject: RE: [PATCH] net/ixgbe: add support for VLAN in IP mode FDIR
> 
> > -----Original Message-----
> > From: Zhao1, Wei
> > Sent: Tuesday, June 12, 2018 10:31 AM
> > To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; dev@dpdk.org
> > Cc: stable@dpdk.org
> > Subject: RE: [PATCH] net/ixgbe: add support for VLAN in IP mode FDIR
> >
> > Hi, wenzhuo
> >
> > > -----Original Message-----
> > > From: Lu, Wenzhuo
> > > Sent: Tuesday, June 12, 2018 10:26 AM
> > > To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> > > Cc: stable@dpdk.org
> > > Subject: RE: [PATCH] net/ixgbe: add support for VLAN in IP mode FDIR
> > >
> > > Hi Wei,
> > >
> > >
> > > > -----Original Message-----
> > > > From: Zhao1, Wei
> > > > Sent: Tuesday, June 5, 2018 5:12 PM
> > > > To: dev@dpdk.org
> > > > Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; stable@dpdk.org; Zhao1,
> > > > Wei <wei.zhao1@intel.com>
> > > > Subject: [PATCH] net/ixgbe: add support for VLAN in IP mode FDIR
> > > >
> > > > In IP mode FDIR, X550 can support not only 4 tuple parameters but
> > > > also vlan tci in protocol, so add this feature to flow parser.
> > > >
> > > > Fixes: 11777435c727 ("net/ixgbe: parse flow director filter")
> > > >
> > > > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> > > > ---
> 
> > >
> > > >  		item = next_no_void_pattern(pattern, item);
> > > > -		if (item->type != RTE_FLOW_ITEM_TYPE_IPV4) {
> > > > +		if (item->type != RTE_FLOW_ITEM_TYPE_IPV4 &&
> > > > +				item->type != RTE_FLOW_ITEM_TYPE_VLAN)
> > > {
> > > >  			rte_flow_error_set(error,
> > > >  			  EINVAL, RTE_FLOW_ERROR_TYPE_ITEM,
> > > >  			  item, "Not supported by ntuple filter");
> > > Really confused. I see the above code is already wrapped by " if
> > > (item->type == RTE_FLOW_ITEM_TYPE_VLAN) {". You want to support
> > double vlan?
> >
> > No, I have get a report that some use the following mode
> > sendp([Ether(dst="A0:36:9F:BD:5D:B0")/Dot1Q(vlan=1)/IP(src="192.168.0.
> > 1",d st="192.168.0.2",tos=2,ttl=40)/UDP(dport=23,
> > sport=22)/Raw('x'*100)],iface="enp3s0f0",count=10)
> > to test fdir IP mode.
> > In order to support this, we need this patch.
> I can understand the change in ' ixgbe_parse_fdir_filter_normal' is to support
> this case.
> What I cannot understand is the above change. The original code is already
> for the case vlan + IPv4.
> 

If we do not change code as this way, as we do not add " item->type != RTE_FLOW_ITEM_TYPE_VLAN ".
Even there is code which support VLAN in the following code,  but it will " return -rte_errno; " first when user using 
Ether/ Dot1Q(vlan=1)/IP()/UDP mode packet, this error is caused by missing " item->type != RTE_FLOW_ITEM_TYPE_VLAN".
  
Zhao1, Wei June 12, 2018, 3:18 a.m. UTC | #5
Hi, wenzhuo

> -----Original Message-----
> From: Lu, Wenzhuo
> Sent: Tuesday, June 12, 2018 10:42 AM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: stable@dpdk.org
> Subject: RE: [PATCH] net/ixgbe: add support for VLAN in IP mode FDIR
> 
> > -----Original Message-----
> > From: Zhao1, Wei
> > Sent: Tuesday, June 12, 2018 10:31 AM
> > To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; dev@dpdk.org
> > Cc: stable@dpdk.org
> > Subject: RE: [PATCH] net/ixgbe: add support for VLAN in IP mode FDIR
> >
> > Hi, wenzhuo
> >
> > > -----Original Message-----
> > > From: Lu, Wenzhuo
> > > Sent: Tuesday, June 12, 2018 10:26 AM
> > > To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> > > Cc: stable@dpdk.org
> > > Subject: RE: [PATCH] net/ixgbe: add support for VLAN in IP mode FDIR
> > >
> > > Hi Wei,
> > >
> > >
> > > > -----Original Message-----
> > > > From: Zhao1, Wei
> > > > Sent: Tuesday, June 5, 2018 5:12 PM
> > > > To: dev@dpdk.org
> > > > Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; stable@dpdk.org; Zhao1,
> > > > Wei <wei.zhao1@intel.com>
> > > > Subject: [PATCH] net/ixgbe: add support for VLAN in IP mode FDIR
> > > >
> > > > In IP mode FDIR, X550 can support not only 4 tuple parameters but
> > > > also vlan tci in protocol, so add this feature to flow parser.
> > > >
> > > > Fixes: 11777435c727 ("net/ixgbe: parse flow director filter")
> > > >
> > > > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> > > > ---
> 
> > >
> > > >  		item = next_no_void_pattern(pattern, item);
> > > > -		if (item->type != RTE_FLOW_ITEM_TYPE_IPV4) {
> > > > +		if (item->type != RTE_FLOW_ITEM_TYPE_IPV4 &&
> > > > +				item->type != RTE_FLOW_ITEM_TYPE_VLAN)
> > > {
> > > >  			rte_flow_error_set(error,
> > > >  			  EINVAL, RTE_FLOW_ERROR_TYPE_ITEM,
> > > >  			  item, "Not supported by ntuple filter");
> > > Really confused. I see the above code is already wrapped by " if
> > > (item->type == RTE_FLOW_ITEM_TYPE_VLAN) {". You want to support
> > double vlan?
> >
> > No, I have get a report that some use the following mode
> > sendp([Ether(dst="A0:36:9F:BD:5D:B0")/Dot1Q(vlan=1)/IP(src="192.168.0.
> > 1",d st="192.168.0.2",tos=2,ttl=40)/UDP(dport=23,
> > sport=22)/Raw('x'*100)],iface="enp3s0f0",count=10)
> > to test fdir IP mode.
> > In order to support this, we need this patch.
> I can understand the change in ' ixgbe_parse_fdir_filter_normal' is to support
> this case.
> What I cannot understand is the above change. The original code is already
> for the case vlan + IPv4.
> 

I will commit new v2 for your comment.
  

Patch

diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index 0427e6f..f5e7805 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -322,7 +322,8 @@  cons_parse_ntuple_filter(const struct rte_flow_attr *attr,
 		}
 		/* check if the next not void item is IPv4 */
 		item = next_no_void_pattern(pattern, item);
-		if (item->type != RTE_FLOW_ITEM_TYPE_IPV4) {
+		if (item->type != RTE_FLOW_ITEM_TYPE_IPV4 &&
+				item->type != RTE_FLOW_ITEM_TYPE_VLAN) {
 			rte_flow_error_set(error,
 			  EINVAL, RTE_FLOW_ERROR_TYPE_ITEM,
 			  item, "Not supported by ntuple filter");
@@ -1739,7 +1740,8 @@  ixgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev,
 				return -rte_errno;
 			}
 		} else {
-			if (item->type != RTE_FLOW_ITEM_TYPE_IPV4) {
+			if (item->type != RTE_FLOW_ITEM_TYPE_IPV4 &&
+					item->type != RTE_FLOW_ITEM_TYPE_VLAN) {
 				memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
 				rte_flow_error_set(error, EINVAL,
 					RTE_FLOW_ERROR_TYPE_ITEM,