net/i40e: fix eth pattern parsing
PATCH 1/1 net/i40e: fix eth pattern parsing
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
--- drivers/net/i40e/i40e_flow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/i40e/i40e_flow.c +2 -1
@@ -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,
Signature · 1 line
2.11.0
Quoted 18 lines · 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:ffFixes d46e85af6b5c ("net/i40e: parse QinQ pattern")Signed-off-by Bernard Iremonger <[email protected]>--- drivers/net/i40e/i40e_flow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/net/i40e/i40e_flow.c +0
-0
drivers/net/i40e/i40e_flow.c i40e_flow_parse_qinq_pattern(__rte_unused struct rte_eth_dev *dev, · line 1776
Quoted 6 lines
drivers/net/i40e/i40e_flow.c +2
-1@@ -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
Quoted 4 lines
drivers/net/i40e/i40e_flow.c +0
-0rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item,
Hi Ferruh,
Quoted 28 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, April 4, 2017 1:40 PM
To: Iremonger, Bernard <[email protected]>; [email protected]; Xing, Beilei <[email protected]>
Cc: Lu, Wenzhuo <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] net/i40e: fix eth pattern parsingdrivers/net/i40e/i40e_flow.c i40e_flow_parse_qinq_pattern(__rte_unused
Quoted 18 lines · 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:ffFixes d46e85af6b5c ("net/i40e: parse QinQ pattern")Signed-off-by Bernard Iremonger <[email protected]>--- drivers/net/i40e/i40e_flow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_flow.cindex9f541eaff..3fcd31036100644drivers/net/i40e/i40e_flow.c +0
-0@@ -1772,7 +1772,8 @@ i40e_flow_parse_qinq_pattern(__rte_unusedstruct
rte_eth_dev*dev,
Quoted 11 lines
drivers/net/i40e/i40e_flow.c i40e_flow_parse_qinq_pattern(__rte_unused struct rte_eth_dev *dev, · line 1776
Quoted 8 lines
drivers/net/i40e/i40e_flow.c +2
-1case 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.
Quoted 5 lines
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.
Quoted 8 lines
Thanks,
ferruhdrivers/net/i40e/i40e_flow.c i40e_flow_parse_qinq_pattern(__rte_unused struct rte_eth_dev *dev, · line 1777
Quoted 2 lines
drivers/net/i40e/i40e_flow.c +0
-0rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM,Quoted 2 lines
item,
Regards,
Bernard.
Quoted 44 lines
-----Original Message-----
From: Iremonger, Bernard
Sent: Tuesday, April 4, 2017 8:52 PM
To: Yigit, Ferruh <[email protected]>; [email protected]; Xing, Beilei <[email protected]>
Cc: Lu, Wenzhuo <[email protected]>
Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix eth pattern parsingHi Ferruh,
Quoted 22 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, April 4, 2017 1:40 PM
To: Iremonger, Bernard <[email protected]>; [email protected]; Xing, Beilei <[email protected]>
Cc: Lu, Wenzhuo <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] net/i40e: fix eth pattern parsingQuoted 13 lines · 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:ffFixes d46e85af6b5c ("net/i40e: parse QinQ pattern")Signed-off-by Bernard Iremonger <[email protected]>--- drivers/net/i40e/i40e_flow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)Quoted 8 lines
drivers/net/i40e/i40e_flow.c i40e_flow_parse_qinq_pattern(__rte_unused
Quoted 5 lines
(quoted diff) +0
-0
b/drivers/net/i40e/i40e_flow.cindex9f541eaff..3fcd31036100644drivers/net/i40e/i40e_flow.c +0
-0@@ -1772,7 +1772,8 @@ i40e_flow_parse_qinq_pattern(__rte_unusedstruct
rte_eth_dev*dev,Quoted 2 lines
drivers/net/i40e/i40e_flow.c +0
-0case RTE_FLOW_ITEM_TYPE_ETH : eth_spec = (const struct rte_flow_item_eth *)item-spec;
Quoted 1 line
drivers/net/i40e/i40e_flow.c i40e_flow_parse_qinq_pattern(__rte_unused · line 1774
Quoted 1 line
drivers/net/i40e/i40e_flow.c +0
-0eth_mask = (const struct rte_flow_item_eth *)item-mask;
Quoted 8 lines
Quoted 6 lines
drivers/net/i40e/i40e_flow.c i40e_flow_parse_qinq_pattern(__rte_unused struct rte_eth_dev *dev, · line 1776
Quoted 3 lines
drivers/net/i40e/i40e_flow.c +2
-1-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
Quoted 21 lines
Quoted 6 lines
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 againstintention.
Yes , I will describe valid patterns for the flow rule in a separate patch.
Quoted 8 lines
Thanks,
ferruhdrivers/net/i40e/i40e_flow.c i40e_flow_parse_qinq_pattern(__rte_unused · line 1778
Quoted 2 lines
drivers/net/i40e/i40e_flow.c +0
-0rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM,Quoted 2 lines
drivers/net/i40e/i40e_flow.c +0
-0item,Regards,
Bernard.
Hi Beilei,
Quoted 60 lines
-----Original Message-----
From: Xing, Beilei
Sent: Wednesday, April 5, 2017 3:03 AM
To: Iremonger, Bernard <[email protected]>; Yigit, Ferruh <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>
Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix eth pattern parsingQuoted 8 lines
-----Original Message-----
From: Iremonger, Bernard
Sent: Tuesday, April 4, 2017 8:52 PM
To: Yigit, Ferruh <[email protected]>; [email protected]; Xing, Beilei <[email protected]>
Cc: Lu, Wenzhuo <[email protected]>
Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix eth pattern parsingQuoted 6 lines
Hi Ferruh,
Quoted 4 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, April 4, 2017 1:40 PM
To: Iremonger, Bernard <[email protected]>;Quoted 18 lines
Quoted 18 lines
Xing, Beilei <[email protected]>
Cc: Lu, Wenzhuo <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] net/i40e: fix eth pattern parsingQuoted 13 lines · 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:ffFixes d46e85af6b5c ("net/i40e: parse QinQ pattern")Signed-off-by Bernard Iremonger <[email protected]>--- drivers/net/i40e/i40e_flow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)Quoted 5 lines
Quoted 5 lines
drivers/net/i40e/i40e_flow.c
Quoted 5 lines
(quoted diff) +0
-0
b/drivers/net/i40e/i40e_flow.cindex9f541eaff..3fcd31036100644drivers/net/i40e/i40e_flow.c +0
-0@@ -1772,7 +1772,8 @@i40e_flow_parse_qinq_pattern(__rte_unused
Quoted 12 lines
Quoted 3 lines
struct
rte_eth_dev*dev,Quoted 2 lines
drivers/net/i40e/i40e_flow.c +0
-0case RTE_FLOW_ITEM_TYPE_ETH : eth_spec = (const struct rte_flow_item_eth *)item-spec;
Quoted 1 line
drivers/net/i40e/i40e_flow.c line 1774
Quoted 1 line
drivers/net/i40e/i40e_flow.c +0
-0eth_mask = (const struct rte_flow_item_eth *)item-mask;
Quoted 6 lines
drivers/net/i40e/i40e_flow.c i40e_flow_parse_qinq_pattern(__rte_unused struct rte_eth_dev *dev, · line 1776
Quoted 3 lines
drivers/net/i40e/i40e_flow.c +2
-1-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
Quoted 7 lines
it.
Quoted 2 lines
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.
Quoted 15 lines
Quoted 15 lines
Quoted 8 lines
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 againstintention.
Yes , I will describe valid patterns for the flow rule in a separate patch.
Quoted 3 lines
Thanks,
ferruh
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
drivers/net/i40e/i40e_flow.c line 1778
Quoted 2 lines
drivers/net/i40e/i40e_flow.c +0
-0rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM,Quoted 2 lines
drivers/net/i40e/i40e_flow.c +0
-0item,Regards,
Bernard.
Regards,
Bernard.
PATCH v2 1/1 net/i40e: fix QinQ eth pattern parsing
In reply to Bernard IremongerThe eth keyword only should be accepted.
---
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(-)
drivers/net/i40e/i40e_flow.c +9 -6
@@ -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 ;
Signature · 1 line
2.11.0
Re: [PATCH v2] net/i40e: fix QinQ eth pattern parsing
Quoted 9 lines
-----Original Message-----
From: Iremonger, Bernard
Sent: Wednesday, April 5, 2017 10:04 PM
To: [email protected]; Xing, Beilei <[email protected]>
Cc: Lu, Wenzhuo <[email protected]>; Iremonger, Bernard <[email protected]>
Subject: [PATCH v2] net/i40e: fix QinQ eth pattern parsing
Quoted 5 lines
The eth keyword only should be accepted.
Fixes d46e85af6b5c ("net/i40e: parse QinQ pattern")Signed-off-by Bernard Iremonger <[email protected]>
Ferruh Yigit
AppliedRe: [PATCH v2] net/i40e: fix QinQ eth pattern parsing
Quoted 9 lines · Beilei
Quoted 9 lines
-----Original Message-----
From: Iremonger, Bernard
Sent: Wednesday, April 5, 2017 10:04 PM
To: [email protected]; Xing, Beilei <[email protected]>
Cc: Lu, Wenzhuo <[email protected]>; Iremonger, Bernard <[email protected]>
Subject: [PATCH v2] net/i40e: fix QinQ eth pattern parsing
Quoted 7 lines
Quoted 5 lines
The eth keyword only should be accepted.
Fixes d46e85af6b5c ("net/i40e: parse QinQ pattern")Signed-off-by Bernard Iremonger <[email protected]>Acked-by Beilei Xing <[email protected]>
Applied to dpdk-next-net/master, thanks.