All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/i40e: fix eth pattern parsing
@ 2017-04-03 16:14 Bernard Iremonger
  2017-04-04 12:39 ` Ferruh Yigit
  2017-04-05 14:03 ` [PATCH v2] net/i40e: fix QinQ " Bernard Iremonger
  0 siblings, 2 replies; 8+ messages in thread
From: Bernard Iremonger @ 2017-04-03 16:14 UTC (permalink / raw)
  To: dev, beilei.xing; +Cc: wenzhuo.lu, Bernard Iremonger

Handle the following eth patterns:
eth dst spec aa:bb:cc:dd:ee:ff
eth dst mask ff:ff:ff:ff:ff:ff
eth src spec aa:bb:cc:dd:ee:ff
eth src mask ff:ff:ff:ff:ff:ff

Fixes: d46e85af6b5c ("net/i40e: parse QinQ pattern")

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 drivers/net/i40e/i40e_flow.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c
index 9f541eaff..3fcd31036 100644
--- a/drivers/net/i40e/i40e_flow.c
+++ b/drivers/net/i40e/i40e_flow.c
@@ -1772,7 +1772,8 @@ i40e_flow_parse_qinq_pattern(__rte_unused struct rte_eth_dev *dev,
 		case RTE_FLOW_ITEM_TYPE_ETH:
 			eth_spec = (const struct rte_flow_item_eth *)item->spec;
 			eth_mask = (const struct rte_flow_item_eth *)item->mask;
-			if (eth_spec && eth_mask) {
+			if ((eth_spec && eth_mask) ||
+			    (eth_spec || eth_mask)) {
 				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
 						   item,
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] net/i40e: fix eth pattern parsing
  2017-04-03 16:14 [PATCH] net/i40e: fix eth pattern parsing Bernard Iremonger
@ 2017-04-04 12:39 ` Ferruh Yigit
  2017-04-04 12:52   ` Iremonger, Bernard
  2017-04-05 14:03 ` [PATCH v2] net/i40e: fix QinQ " Bernard Iremonger
  1 sibling, 1 reply; 8+ messages in thread
From: Ferruh Yigit @ 2017-04-04 12:39 UTC (permalink / raw)
  To: Bernard Iremonger, dev, beilei.xing; +Cc: wenzhuo.lu

On 4/3/2017 5:14 PM, Bernard Iremonger wrote:
> Handle the following eth patterns:
> eth dst spec aa:bb:cc:dd:ee:ff
> eth dst mask ff:ff:ff:ff:ff:ff
> eth src spec aa:bb:cc:dd:ee:ff
> eth src mask ff:ff:ff:ff:ff:ff
> 
> Fixes: d46e85af6b5c ("net/i40e: parse QinQ pattern")
> 
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> ---
>  drivers/net/i40e/i40e_flow.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c
> index 9f541eaff..3fcd31036 100644
> --- a/drivers/net/i40e/i40e_flow.c
> +++ b/drivers/net/i40e/i40e_flow.c
> @@ -1772,7 +1772,8 @@ i40e_flow_parse_qinq_pattern(__rte_unused struct rte_eth_dev *dev,
>  		case RTE_FLOW_ITEM_TYPE_ETH:
>  			eth_spec = (const struct rte_flow_item_eth *)item->spec;
>  			eth_mask = (const struct rte_flow_item_eth *)item->mask;
> -			if (eth_spec && eth_mask) {
> +			if ((eth_spec && eth_mask) ||
> +			    (eth_spec || eth_mask)) {

Is this check requires both spec and mask to be all zeros? If this is
the real intention, can you please add a comment above check to clarify it.

Also other i40e_flow_parse_xxx_pattern() functions has function comment
to describe expected/valid pattern for the flow rule.
i40e_flow_parse_qinq_pattern() is missing that function comment. Would
you mind adding it, which helps to validate implementation against
intention.

Thanks,
ferruh

>  				rte_flow_error_set(error, EINVAL,
>  						   RTE_FLOW_ERROR_TYPE_ITEM,
>  						   item,
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] net/i40e: fix eth pattern parsing
  2017-04-04 12:39 ` Ferruh Yigit
@ 2017-04-04 12:52   ` Iremonger, Bernard
  2017-04-05  2:03     ` Xing, Beilei
  0 siblings, 1 reply; 8+ messages in thread
From: Iremonger, Bernard @ 2017-04-04 12:52 UTC (permalink / raw)
  To: Yigit, Ferruh, dev, Xing, Beilei; +Cc: Lu, Wenzhuo

Hi Ferruh,

> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Tuesday, April 4, 2017 1:40 PM
> To: Iremonger, Bernard <bernard.iremonger@intel.com>; dev@dpdk.org;
> Xing, Beilei <beilei.xing@intel.com>
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Subject: Re: [dpdk-dev] [PATCH] net/i40e: fix eth pattern parsing
> 
> On 4/3/2017 5:14 PM, Bernard Iremonger wrote:
> > Handle the following eth patterns:
> > eth dst spec aa:bb:cc:dd:ee:ff
> > eth dst mask ff:ff:ff:ff:ff:ff
> > eth src spec aa:bb:cc:dd:ee:ff
> > eth src mask ff:ff:ff:ff:ff:ff
> >
> > Fixes: d46e85af6b5c ("net/i40e: parse QinQ pattern")
> >
> > Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> > ---
> >  drivers/net/i40e/i40e_flow.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/i40e/i40e_flow.c
> > b/drivers/net/i40e/i40e_flow.c index 9f541eaff..3fcd31036 100644
> > --- a/drivers/net/i40e/i40e_flow.c
> > +++ b/drivers/net/i40e/i40e_flow.c
> > @@ -1772,7 +1772,8 @@ i40e_flow_parse_qinq_pattern(__rte_unused
> struct rte_eth_dev *dev,
> >  		case RTE_FLOW_ITEM_TYPE_ETH:
> >  			eth_spec = (const struct rte_flow_item_eth *)item-
> >spec;
> >  			eth_mask = (const struct rte_flow_item_eth *)item-
> >mask;
> > -			if (eth_spec && eth_mask) {
> > +			if ((eth_spec && eth_mask) ||
> > +			    (eth_spec || eth_mask)) {
> 
> Is this check requires both spec and mask to be all zeros? If this is the real
> intention, can you please add a comment above check to clarify it.

Yes , the intention is to only except the "eth" key word, I will send a v2.

> 
> Also other i40e_flow_parse_xxx_pattern() functions has function comment
> to describe expected/valid pattern for the flow rule.
> i40e_flow_parse_qinq_pattern() is missing that function comment. Would
> you mind adding it, which helps to validate implementation against intention.

Yes , I will describe valid patterns for the flow rule in a separate patch. 
 
> Thanks,
> ferruh
> 
> >  				rte_flow_error_set(error, EINVAL,
> >
> RTE_FLOW_ERROR_TYPE_ITEM,
> >  						   item,
> >
Regards,

Bernard.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] net/i40e: fix eth pattern parsing
  2017-04-04 12:52   ` Iremonger, Bernard
@ 2017-04-05  2:03     ` Xing, Beilei
  2017-04-05  8:00       ` Iremonger, Bernard
  0 siblings, 1 reply; 8+ messages in thread
From: Xing, Beilei @ 2017-04-05  2:03 UTC (permalink / raw)
  To: Iremonger, Bernard, Yigit, Ferruh, dev; +Cc: Lu, Wenzhuo


> -----Original Message-----
> From: Iremonger, Bernard
> Sent: Tuesday, April 4, 2017 8:52 PM
> To: Yigit, Ferruh <ferruh.yigit@intel.com>; dev@dpdk.org; Xing, Beilei
> <beilei.xing@intel.com>
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix eth pattern parsing
> 
> Hi Ferruh,
> 
> > -----Original Message-----
> > From: Yigit, Ferruh
> > Sent: Tuesday, April 4, 2017 1:40 PM
> > To: Iremonger, Bernard <bernard.iremonger@intel.com>; dev@dpdk.org;
> > Xing, Beilei <beilei.xing@intel.com>
> > Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> > Subject: Re: [dpdk-dev] [PATCH] net/i40e: fix eth pattern parsing
> >
> > On 4/3/2017 5:14 PM, Bernard Iremonger wrote:
> > > Handle the following eth patterns:
> > > eth dst spec aa:bb:cc:dd:ee:ff
> > > eth dst mask ff:ff:ff:ff:ff:ff
> > > eth src spec aa:bb:cc:dd:ee:ff
> > > eth src mask ff:ff:ff:ff:ff:ff
> > >
> > > Fixes: d46e85af6b5c ("net/i40e: parse QinQ pattern")
> > >
> > > Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> > > ---
> > >  drivers/net/i40e/i40e_flow.c | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/net/i40e/i40e_flow.c
> > > b/drivers/net/i40e/i40e_flow.c index 9f541eaff..3fcd31036 100644
> > > --- a/drivers/net/i40e/i40e_flow.c
> > > +++ b/drivers/net/i40e/i40e_flow.c
> > > @@ -1772,7 +1772,8 @@ i40e_flow_parse_qinq_pattern(__rte_unused
> > struct rte_eth_dev *dev,
> > >  		case RTE_FLOW_ITEM_TYPE_ETH:
> > >  			eth_spec = (const struct rte_flow_item_eth *)item-
> spec;
> > >  			eth_mask = (const struct rte_flow_item_eth *)item-
> mask;
> > > -			if (eth_spec && eth_mask) {
> > > +			if ((eth_spec && eth_mask) ||
> > > +			    (eth_spec || eth_mask)) {
> >
> > Is this check requires both spec and mask to be all zeros? If this is
> > the real intention, can you please add a comment above check to clarify it.
> 
> Yes , the intention is to only except the "eth" key word, I will send a v2.

Seem " if (eth_spec || eth_mask) " is enough, what do you think?

Beilei

> 
> >
> > Also other i40e_flow_parse_xxx_pattern() functions has function
> > comment to describe expected/valid pattern for the flow rule.
> > i40e_flow_parse_qinq_pattern() is missing that function comment. Would
> > you mind adding it, which helps to validate implementation against
> intention.
> 
> Yes , I will describe valid patterns for the flow rule in a separate patch.
> 
> > Thanks,
> > ferruh
> >
> > >  				rte_flow_error_set(error, EINVAL,
> > >
> > RTE_FLOW_ERROR_TYPE_ITEM,
> > >  						   item,
> > >
> Regards,
> 
> Bernard.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] net/i40e: fix eth pattern parsing
  2017-04-05  2:03     ` Xing, Beilei
@ 2017-04-05  8:00       ` Iremonger, Bernard
  0 siblings, 0 replies; 8+ messages in thread
From: Iremonger, Bernard @ 2017-04-05  8:00 UTC (permalink / raw)
  To: Xing, Beilei, Yigit, Ferruh, dev; +Cc: Lu, Wenzhuo

Hi Beilei,

> -----Original Message-----
> From: Xing, Beilei
> Sent: Wednesday, April 5, 2017 3:03 AM
> To: Iremonger, Bernard <bernard.iremonger@intel.com>; Yigit, Ferruh
> <ferruh.yigit@intel.com>; dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix eth pattern parsing
> 
> 
> > -----Original Message-----
> > From: Iremonger, Bernard
> > Sent: Tuesday, April 4, 2017 8:52 PM
> > To: Yigit, Ferruh <ferruh.yigit@intel.com>; dev@dpdk.org; Xing, Beilei
> > <beilei.xing@intel.com>
> > Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> > Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix eth pattern parsing
> >
> > Hi Ferruh,
> >
> > > -----Original Message-----
> > > From: Yigit, Ferruh
> > > Sent: Tuesday, April 4, 2017 1:40 PM
> > > To: Iremonger, Bernard <bernard.iremonger@intel.com>;
> dev@dpdk.org;
> > > Xing, Beilei <beilei.xing@intel.com>
> > > Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> > > Subject: Re: [dpdk-dev] [PATCH] net/i40e: fix eth pattern parsing
> > >
> > > On 4/3/2017 5:14 PM, Bernard Iremonger wrote:
> > > > Handle the following eth patterns:
> > > > eth dst spec aa:bb:cc:dd:ee:ff
> > > > eth dst mask ff:ff:ff:ff:ff:ff
> > > > eth src spec aa:bb:cc:dd:ee:ff
> > > > eth src mask ff:ff:ff:ff:ff:ff
> > > >
> > > > Fixes: d46e85af6b5c ("net/i40e: parse QinQ pattern")
> > > >
> > > > Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> > > > ---
> > > >  drivers/net/i40e/i40e_flow.c | 3 ++-
> > > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/net/i40e/i40e_flow.c
> > > > b/drivers/net/i40e/i40e_flow.c index 9f541eaff..3fcd31036 100644
> > > > --- a/drivers/net/i40e/i40e_flow.c
> > > > +++ b/drivers/net/i40e/i40e_flow.c
> > > > @@ -1772,7 +1772,8 @@
> i40e_flow_parse_qinq_pattern(__rte_unused
> > > struct rte_eth_dev *dev,
> > > >  		case RTE_FLOW_ITEM_TYPE_ETH:
> > > >  			eth_spec = (const struct rte_flow_item_eth *)item-
> > spec;
> > > >  			eth_mask = (const struct rte_flow_item_eth *)item-
> > mask;
> > > > -			if (eth_spec && eth_mask) {
> > > > +			if ((eth_spec && eth_mask) ||
> > > > +			    (eth_spec || eth_mask)) {
> > >
> > > Is this check requires both spec and mask to be all zeros? If this
> > > is the real intention, can you please add a comment above check to clarify
> it.
> >
> > Yes , the intention is to only except the "eth" key word, I will send a v2.
> 
> Seem " if (eth_spec || eth_mask) " is enough, what do you think?
> 
> Beilei

Yes, I think you are right.
I will change to how it is done for MPLS and send a v2.
> 
> >
> > >
> > > Also other i40e_flow_parse_xxx_pattern() functions has function
> > > comment to describe expected/valid pattern for the flow rule.
> > > i40e_flow_parse_qinq_pattern() is missing that function comment.
> > > Would you mind adding it, which helps to validate implementation
> > > against
> > intention.
> >
> > Yes , I will describe valid patterns for the flow rule in a separate patch.
> >
> > > Thanks,
> > > ferruh
> > >
> > > >  				rte_flow_error_set(error, EINVAL,
> > > >
> > > RTE_FLOW_ERROR_TYPE_ITEM,
> > > >  						   item,
> > > >
> > Regards,
> >
> > Bernard.

Regards,

Bernard.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] net/i40e: fix QinQ eth pattern parsing
  2017-04-03 16:14 [PATCH] net/i40e: fix eth pattern parsing Bernard Iremonger
  2017-04-04 12:39 ` Ferruh Yigit
@ 2017-04-05 14:03 ` Bernard Iremonger
  2017-04-06  4:54   ` Xing, Beilei
  1 sibling, 1 reply; 8+ messages in thread
From: Bernard Iremonger @ 2017-04-05 14:03 UTC (permalink / raw)
  To: dev, beilei.xing; +Cc: wenzhuo.lu, Bernard Iremonger

The eth keyword only should be accepted.

Fixes: d46e85af6b5c ("net/i40e: parse QinQ pattern")

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
Changes in v2:
rebased to latest dpdk-next-net
Document the i40e_flow_parse_qinq_pattern function.
Parse the eth keyword in similar way to mpls parsing function.

 drivers/net/i40e/i40e_flow.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c
index 9f541eaff..3cf0e5a70 100644
--- a/drivers/net/i40e/i40e_flow.c
+++ b/drivers/net/i40e/i40e_flow.c
@@ -1740,6 +1740,13 @@ i40e_flow_parse_mpls_filter(struct rte_eth_dev *dev,
 	return ret;
 }
 
+/* 1. Last in item should be NULL as range is not supported.
+ * 2. Supported filter types: QINQ.
+ * 3. Mask of fields which need to be matched should be
+ *    filled with 1.
+ * 4. Mask of fields which needn't to be matched should be
+ *    filled with 0.
+ */
 static int
 i40e_flow_parse_qinq_pattern(__rte_unused struct rte_eth_dev *dev,
 			      const struct rte_flow_item *pattern,
@@ -1747,8 +1754,6 @@ i40e_flow_parse_qinq_pattern(__rte_unused struct rte_eth_dev *dev,
 			      struct i40e_tunnel_filter_conf *filter)
 {
 	const struct rte_flow_item *item = pattern;
-	const struct rte_flow_item_eth *eth_spec;
-	const struct rte_flow_item_eth *eth_mask;
 	const struct rte_flow_item_vlan *vlan_spec = NULL;
 	const struct rte_flow_item_vlan *vlan_mask = NULL;
 	const struct rte_flow_item_vlan *i_vlan_spec = NULL;
@@ -1770,13 +1775,11 @@ i40e_flow_parse_qinq_pattern(__rte_unused struct rte_eth_dev *dev,
 		item_type = item->type;
 		switch (item_type) {
 		case RTE_FLOW_ITEM_TYPE_ETH:
-			eth_spec = (const struct rte_flow_item_eth *)item->spec;
-			eth_mask = (const struct rte_flow_item_eth *)item->mask;
-			if (eth_spec && eth_mask) {
+			if (item->spec || item->mask) {
 				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
 						   item,
-						   "Invalid ether spec/mask");
+						   "Invalid ETH item");
 				return -rte_errno;
 			}
 			break;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] net/i40e: fix QinQ eth pattern parsing
  2017-04-05 14:03 ` [PATCH v2] net/i40e: fix QinQ " Bernard Iremonger
@ 2017-04-06  4:54   ` Xing, Beilei
  2017-04-07 16:21     ` Ferruh Yigit
  0 siblings, 1 reply; 8+ messages in thread
From: Xing, Beilei @ 2017-04-06  4:54 UTC (permalink / raw)
  To: Iremonger, Bernard, dev; +Cc: Lu, Wenzhuo


> -----Original Message-----
> From: Iremonger, Bernard
> Sent: Wednesday, April 5, 2017 10:04 PM
> To: dev@dpdk.org; Xing, Beilei <beilei.xing@intel.com>
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Iremonger, Bernard
> <bernard.iremonger@intel.com>
> Subject: [PATCH v2] net/i40e: fix QinQ eth pattern parsing
> 
> The eth keyword only should be accepted.
> 
> Fixes: d46e85af6b5c ("net/i40e: parse QinQ pattern")
> 
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>

Acked-by: Beilei Xing <beilei.xing@intel.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] net/i40e: fix QinQ eth pattern parsing
  2017-04-06  4:54   ` Xing, Beilei
@ 2017-04-07 16:21     ` Ferruh Yigit
  0 siblings, 0 replies; 8+ messages in thread
From: Ferruh Yigit @ 2017-04-07 16:21 UTC (permalink / raw)
  To: Xing, Beilei, Iremonger, Bernard, dev; +Cc: Lu, Wenzhuo

On 4/6/2017 5:54 AM, Xing, Beilei wrote:
> 
>> -----Original Message-----
>> From: Iremonger, Bernard
>> Sent: Wednesday, April 5, 2017 10:04 PM
>> To: dev@dpdk.org; Xing, Beilei <beilei.xing@intel.com>
>> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Iremonger, Bernard
>> <bernard.iremonger@intel.com>
>> Subject: [PATCH v2] net/i40e: fix QinQ eth pattern parsing
>>
>> The eth keyword only should be accepted.
>>
>> Fixes: d46e85af6b5c ("net/i40e: parse QinQ pattern")
>>
>> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> 
> Acked-by: Beilei Xing <beilei.xing@intel.com>

Applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-04-07 16:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-03 16:14 [PATCH] net/i40e: fix eth pattern parsing Bernard Iremonger
2017-04-04 12:39 ` Ferruh Yigit
2017-04-04 12:52   ` Iremonger, Bernard
2017-04-05  2:03     ` Xing, Beilei
2017-04-05  8:00       ` Iremonger, Bernard
2017-04-05 14:03 ` [PATCH v2] net/i40e: fix QinQ " Bernard Iremonger
2017-04-06  4:54   ` Xing, Beilei
2017-04-07 16:21     ` Ferruh Yigit

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.