net/ixgbe: add mac type check for all filters
PATCH 2/2 net/ixgbe: add mac type check for all filters
All kinds of filter need to hardware mac type check to make sure the hardware support that type of fliter. If not, it may cause serious issue.
--- drivers/net/ixgbe/ixgbe_flow.c | 129 +++++++++++++++++++++-------------------- 1 file changed, 65 insertions(+), 64 deletions(-)
drivers/net/ixgbe/ixgbe_flow.c +65 -64
@@ -84,11 +84,12 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,struct rte_eth_ntuple_filter *filter, struct rte_flow_error *error);static int -ixgbe_parse_ntuple_filter (const struct rte_flow_attr *attr, -const struct rte_flow_item pattern[], -const struct rte_flow_action actions[], -struct rte_eth_ntuple_filter *filter, -struct rte_flow_error *error); +ixgbe_parse_ntuple_filter (struct rte_eth_dev *dev, +const struct rte_flow_attr *attr, +const struct rte_flow_item pattern[], +const struct rte_flow_action actions[], +struct rte_eth_ntuple_filter *filter, +struct rte_flow_error *error); static int cons_parse_ethertype_filter(const struct rte_flow_attr *attr, const struct rte_flow_item *pattern,
@@ -96,11 +97,12 @@ cons_parse_ethertype_filter(const struct rte_flow_attr *attr,struct rte_eth_ethertype_filter *filter, struct rte_flow_error *error);static int -ixgbe_parse_ethertype_filter (const struct rte_flow_attr *attr, -const struct rte_flow_item pattern[], -const struct rte_flow_action actions[], -struct rte_eth_ethertype_filter *filter, -struct rte_flow_error *error); +ixgbe_parse_ethertype_filter (struct rte_eth_dev *dev, +const struct rte_flow_attr *attr, +const struct rte_flow_item pattern[], +const struct rte_flow_action actions[], +struct rte_eth_ethertype_filter *filter, +struct rte_flow_error *error); static int cons_parse_syn_filter(const struct rte_flow_attr *attr, const struct rte_flow_item pattern[],
@@ -108,11 +110,12 @@ cons_parse_syn_filter(const struct rte_flow_attr *attr,struct rte_eth_syn_filter *filter, struct rte_flow_error *error);static int -ixgbe_parse_syn_filter (const struct rte_flow_attr *attr, -const struct rte_flow_item pattern[], -const struct rte_flow_action actions[], -struct rte_eth_syn_filter *filter, -struct rte_flow_error *error); +ixgbe_parse_syn_filter (struct rte_eth_dev *dev, +const struct rte_flow_attr *attr, +const struct rte_flow_item pattern[], +const struct rte_flow_action actions[], +struct rte_eth_syn_filter *filter, +struct rte_flow_error *error); static int cons_parse_l2_tn_filter(const struct rte_flow_attr *attr, const struct rte_flow_item pattern[],
@@ -120,20 +123,13 @@ cons_parse_l2_tn_filter(const struct rte_flow_attr *attr,struct rte_eth_l2_tunnel_conf *filter, struct rte_flow_error *error);static int -ixgbe_validate_l2_tn_filter (struct rte_eth_dev *dev, +ixgbe_parse_l2_tn_filter (struct rte_eth_dev *dev,const struct rte_flow_attr *attr,const struct rte_flow_item pattern[],const struct rte_flow_action actions[],struct rte_eth_l2_tunnel_conf *rule,struct rte_flow_error *error); static int -ixgbe_validate_fdir_filter (struct rte_eth_dev *dev, -const struct rte_flow_attr *attr, -const struct rte_flow_item pattern[], -const struct rte_flow_action actions[], -struct ixgbe_fdir_rule *rule, -struct rte_flow_error *error); -static int ixgbe_parse_fdir_filter_normal(const struct rte_flow_attr *attr, const struct rte_flow_item pattern[], const struct rte_flow_action actions[],
@@ -146,11 +142,12 @@ ixgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr,struct ixgbe_fdir_rule *rule, struct rte_flow_error *error);static int -ixgbe_parse_fdir_filter (const struct rte_flow_attr *attr, -const struct rte_flow_item pattern[], -const struct rte_flow_action actions[], -struct ixgbe_fdir_rule *rule, -struct rte_flow_error *error); +ixgbe_parse_fdir_filter (struct rte_eth_dev *dev, +const struct rte_flow_attr *attr, +const struct rte_flow_item pattern[], +const struct rte_flow_action actions[], +struct ixgbe_fdir_rule *rule, +struct rte_flow_error *error); static int ixgbe_flow_validate(__rte_unused struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
@@ -518,13 +515,17 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,/* a specific function for ixgbe because the flags is specific */ static int -ixgbe_parse_ntuple_filter (const struct rte_flow_attr *attr, +ixgbe_parse_ntuple_filter (struct rte_eth_dev *dev, +const struct rte_flow_attr *attr,const struct rte_flow_item pattern[],const struct rte_flow_action actions[],struct rte_eth_ntuple_filter *filter,struct rte_flow_error *error) {int ret; +struct ixgbe_hw *hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); + +MAC_TYPE_FILTER_SUP_EXT (hw->mac.type); ret =cons_parse_ntuple_filter (attr, pattern, actions, filter, error);
@@ -766,13 +767,17 @@ cons_parse_ethertype_filter(const struct rte_flow_attr *attr, }static int -ixgbe_parse_ethertype_filter (const struct rte_flow_attr *attr, +ixgbe_parse_ethertype_filter (struct rte_eth_dev *dev, +const struct rte_flow_attr *attr,const struct rte_flow_item pattern[],const struct rte_flow_action actions[],struct rte_eth_ethertype_filter *filter,struct rte_flow_error *error) {int ret; +struct ixgbe_hw *hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); + +MAC_TYPE_FILTER_SUP (hw->mac.type); ret =cons_parse_ethertype_filter (attr, pattern, actions, filter, error);
@@ -1061,13 +1066,17 @@ cons_parse_syn_filter(const struct rte_flow_attr *attr, }static int -ixgbe_parse_syn_filter (const struct rte_flow_attr *attr, +ixgbe_parse_syn_filter (struct rte_eth_dev *dev, +const struct rte_flow_attr *attr,const struct rte_flow_item pattern[],const struct rte_flow_action actions[],struct rte_eth_syn_filter *filter,struct rte_flow_error *error) {int ret; +struct ixgbe_hw *hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); + +MAC_TYPE_FILTER_SUP (hw->mac.type); ret =cons_parse_syn_filter (attr, pattern, actions, filter, error);
@@ -1250,7 +1259,7 @@ cons_parse_l2_tn_filter(const struct rte_flow_attr *attr, } static int -ixgbe_validate_l2_tn_filter(struct rte_eth_dev *dev, +ixgbe_parse_l2_tn_filter(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, const struct rte_flow_item pattern[], const struct rte_flow_action actions[],
@@ -2403,46 +2412,37 @@ ixgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr, }static int -ixgbe_validate_fdir_filter (struct rte_eth_dev *dev, +ixgbe_parse_fdir_filter (struct rte_eth_dev *dev,const struct rte_flow_attr *attr,const struct rte_flow_item pattern[],const struct rte_flow_action actions[],struct ixgbe_fdir_rule *rule,struct rte_flow_error *error) { -int ret =0 ; - +int ret; +struct ixgbe_hw *hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private);enum rte_fdir_mode fdir_mode = dev->data->dev_conf.fdir_conf.mode; -ixgbe_parse_fdir_filter (attr, pattern, actions, - rule, error); - - -if (fdir_mode ==RTE_FDIR_MODE_NONE || - fdir_mode != rule->mode) +if (hw->mac.type != ixgbe_mac_82599EB && + hw->mac.type != ixgbe_mac_X540 && + hw->mac.type != ixgbe_mac_X550 && + hw->mac.type != ixgbe_mac_X550EM_x && + hw->mac.type != ixgbe_mac_X550EM_a)return -ENOTSUP ; -return ret; -} - -static int -ixgbe_parse_fdir_filter (const struct rte_flow_attr *attr, -const struct rte_flow_item pattern[], -const struct rte_flow_action actions[], -struct ixgbe_fdir_rule *rule, -struct rte_flow_error *error) -{ -int ret; - ret =ixgbe_parse_fdir_filter_normal (attr, pattern, actions, rule, error);if (!ret) -return 0 ; + goto step_next; ret =ixgbe_parse_fdir_filter_tunnel (attr, pattern, actions, rule, error); +step_next: +if (fdir_mode ==RTE_FDIR_MODE_NONE || + fdir_mode != rule->mode) +return -ENOTSUP ;return ret; }
@@ -2546,7 +2546,7 @@ ixgbe_flow_create(struct rte_eth_dev *dev, ixgbe_flow_mem_ptr, entries);memset (&ntuple_filter,0 ,sizeof (struct rte_eth_ntuple_filter )); - ret =ixgbe_parse_ntuple_filter (attr, pattern, + ret =ixgbe_parse_ntuple_filter (dev, attr, pattern, actions, &ntuple_filter, error);if (!ret) { ret =ixgbe_add_del_ntuple_filter (dev, &ntuple_filter, TRUE);
@@ -2566,7 +2566,7 @@ ixgbe_flow_create(struct rte_eth_dev *dev, }memset (ðertype_filter,0 ,sizeof (struct rte_eth_ethertype_filter )); - ret =ixgbe_parse_ethertype_filter (attr, pattern, + ret =ixgbe_parse_ethertype_filter (dev, attr, pattern, actions, ðertype_filter, error);if (!ret) { ret = ixgbe_add_del_ethertype_filter(dev,
@@ -2588,7 +2588,8 @@ ixgbe_flow_create(struct rte_eth_dev *dev, }memset (&syn_filter,0 ,sizeof (struct rte_eth_syn_filter )); - ret =cons_parse_syn_filter (attr, pattern, actions, &syn_filter, error); + ret =ixgbe_parse_syn_filter (dev, attr, pattern, + actions, &syn_filter, error);if (!ret) { ret =ixgbe_syn_filter_set (dev, &syn_filter, TRUE);if (!ret) {
@@ -2608,7 +2609,7 @@ ixgbe_flow_create(struct rte_eth_dev *dev, }memset (&fdir_rule,0 ,sizeof (struct ixgbe_fdir_rule )); - ret =ixgbe_parse_fdir_filter (attr, pattern, + ret =ixgbe_parse_fdir_filter (dev, attr, pattern, actions, &fdir_rule, error);if (!ret) {/* A mask cannot be deleted. */
@@ -2661,7 +2662,7 @@ ixgbe_flow_create(struct rte_eth_dev *dev, }memset (&l2_tn_filter,0 ,sizeof (struct rte_eth_l2_tunnel_conf )); - ret =cons_parse_l2_tn_filter (attr, pattern, + ret =ixgbe_parse_l2_tn_filter (dev, attr, pattern, actions, &l2_tn_filter, error);if (!ret) { ret =ixgbe_dev_l2_tunnel_filter_add (dev, &l2_tn_filter, FALSE);
@@ -2707,31 +2708,31 @@ ixgbe_flow_validate(__rte_unused struct rte_eth_dev *dev,int ret;memset (&ntuple_filter,0 ,sizeof (struct rte_eth_ntuple_filter )); - ret =ixgbe_parse_ntuple_filter (attr, pattern, + ret =ixgbe_parse_ntuple_filter (dev, attr, pattern, actions, &ntuple_filter, error);if (!ret)return 0 ;memset (ðertype_filter,0 ,sizeof (struct rte_eth_ethertype_filter )); - ret =ixgbe_parse_ethertype_filter (attr, pattern, + ret =ixgbe_parse_ethertype_filter (dev, attr, pattern, actions, ðertype_filter, error);if (!ret)return 0 ;memset (&syn_filter,0 ,sizeof (struct rte_eth_syn_filter )); - ret =ixgbe_parse_syn_filter (attr, pattern, + ret =ixgbe_parse_syn_filter (dev, attr, pattern, actions, &syn_filter, error);if (!ret)return 0 ;memset (&fdir_rule,0 ,sizeof (struct ixgbe_fdir_rule )); - ret =ixgbe_validate_fdir_filter (dev, attr, pattern, + ret =ixgbe_parse_fdir_filter (dev, attr, pattern, actions, &fdir_rule, error);if (!ret)return 0 ;memset (&l2_tn_filter,0 ,sizeof (struct rte_eth_l2_tunnel_conf )); - ret =ixgbe_validate_l2_tn_filter (dev, attr, pattern, + ret =ixgbe_parse_l2_tn_filter (dev, attr, pattern, actions, &l2_tn_filter, error);return ret;
Signature · 1 line
2.9.3
Quoted 24 lines · Wei Zhao
All kinds of filter need to hardware mac type check to make sure the hardware support that type of fliter. If not, it may cause serious issue.
Fixes 11777435c727 ("net/ixgbe: parse flow director filter")Fixes 672be56d76a2 ("net/ixgbe: parse n-tuple filter")Fixes eb3539fc8550 ("net/ixgbe: parse ethertype filter")Fixes 429f6ebb42cc ("net/ixgbe: parse TCP SYN filter")Signed-off-by Wei Zhao <[email protected]>Signed-off-by Wenzhuo Lu <[email protected]>--- drivers/net/ixgbe/ixgbe_flow.c | 129 +++++++++++++++++++++-------------------- 1 file changed, 65 insertions(+), 64 deletions(-)drivers/net/ixgbe/ixgbe_flow.c +0
-1@@ -84,11 +84,12 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,struct rte_eth_ntuple_filter *filter, struct rte_flow_error *error); static int -ixgbe_parse_ntuple_filter(const struct rte_flow_attr *attr,
drivers/net/ixgbe/ixgbe_flow.c cons_parse_ntuple_filter(const struct rte_flow_attr *attr, · line 92
Quoted 10 lines
drivers/net/ixgbe/ixgbe_flow.c +6
-4-const struct rte_flow_item pattern[], - const struct rte_flow_action actions[], - struct rte_eth_ntuple_filter *filter, - struct rte_flow_error *error); +ixgbe_parse_ntuple_filter(struct rte_eth_dev *dev, + const struct rte_flow_attr *attr, + const struct rte_flow_item pattern[], + const struct rte_flow_action actions[], + struct rte_eth_ntuple_filter *filter, + struct rte_flow_error *error);
Hi Wei,
You don't need these function declarations at all. What do you think removing these first, in a separate patch, and won't need to update them here?
Also it is possible to remove all function declarations if you move "ixgbe_flow_ops" at the end of the file, that would be something I prefer, but it is your call.
Thanks,
ferruh
Hi, Ferruh
Quoted 52 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Saturday, February 18, 2017 12:01 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 2/2] net/ixgbe: add mac type check for all filtersdrivers/net/ixgbe/ixgbe_flow.c cons_parse_ntuple_filter(const struct rte_flow_attr
Quoted 21 lines · Wei Zhao
All kinds of filter need to hardware mac type check to make sure the hardware support that type of fliter.
If not, it may cause serious issue.Fixes 11777435c727 ("net/ixgbe: parse flow director filter")Fixes 672be56d76a2 ("net/ixgbe: parse n-tuple filter")Fixes eb3539fc8550 ("net/ixgbe: parse ethertype filter")Fixes 429f6ebb42cc ("net/ixgbe: parse TCP SYN filter")Signed-off-by Wei Zhao <[email protected]>Signed-off-by Wenzhuo Lu <[email protected]>--- drivers/net/ixgbe/ixgbe_flow.c | 129 +++++++++++++++++++++-------------------- 1 file changed, 65 insertions(+), 64 deletions(-)(quoted diff) +0
-0
b/drivers/net/ixgbe/ixgbe_flow.cindex 5a634d3..f414fa8 100644drivers/net/ixgbe/ixgbe_flow.c +0
-0@@ -84,11 +84,12 @@ cons_parse_ntuple_filter(const struct rte_flow_attr*attr,
Quoted 4 lines
drivers/net/ixgbe/ixgbe_flow.c +0
-1struct rte_eth_ntuple_filter *filter, struct rte_flow_error *error); static int -ixgbe_parse_ntuple_filter(const struct rte_flow_attr *attr,drivers/net/ixgbe/ixgbe_flow.c cons_parse_ntuple_filter(const struct rte_flow_attr *attr, · line 92
Quoted 10 lines
drivers/net/ixgbe/ixgbe_flow.c +6
-4-const struct rte_flow_item pattern[], - const struct rte_flow_action actions[], - struct rte_eth_ntuple_filter *filter, - struct rte_flow_error *error); +ixgbe_parse_ntuple_filter(struct rte_eth_dev *dev, + const struct rte_flow_attr *attr, + const struct rte_flow_item pattern[], + const struct rte_flow_action actions[], + struct rte_eth_ntuple_filter *filter, + struct rte_flow_error *error);Hi Wei,
You don't need these function declarations at all. What do you think removing these first, in a separate patch, and won't need to update them here?
Quoted 6 lines
Also it is possible to remove all function declarations if you move "
ixgbe_flow_ops" at the end of the file, that would be something I prefer, but it is your call.Thanks,
Ferruh
Sorry for late reply, I have just find your mail just now.
I think your suggestion is very good from code style, but this patch is a fix patch set for a P2 issue.
So, it is not focus on code style. code style can be changed in
a separate patch if we need to and not mix them together?
Hi, Ferruh
Quoted 67 lines
-----Original Message-----
From: Zhao1, Wei
Sent: Monday, March 6, 2017 3:44 PM
To: Yigit, Ferruh <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>
Subject: RE: [dpdk-dev] [PATCH 2/2] net/ixgbe: add mac type check for all filtersHi, Ferruh
Quoted 25 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Saturday, February 18, 2017 12:01 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 2/2] net/ixgbe: add mac type check for all filtersQuoted 16 lines · Wei Zhao
All kinds of filter need to hardware mac type check to make sure the hardware support that type of fliter.
If not, it may cause serious issue.Fixes 11777435c727 ("net/ixgbe: parse flow director filter")Fixes 672be56d76a2 ("net/ixgbe: parse n-tuple filter")Fixes eb3539fc8550 ("net/ixgbe: parse ethertype filter")Fixes 429f6ebb42cc ("net/ixgbe: parse TCP SYN filter")Signed-off-by Wei Zhao <[email protected]>Signed-off-by Wenzhuo Lu <[email protected]>--- drivers/net/ixgbe/ixgbe_flow.c | 129 +++++++++++++++++++++-------------------- 1 file changed, 65 insertions(+), 64 deletions(-)Quoted 9 lines
Quoted 6 lines
(quoted diff) +0
-0
b/drivers/net/ixgbe/ixgbe_flow.cindex 5a634d3..f414fa8 100644drivers/net/ixgbe/ixgbe_flow.c +0
-0@@ -84,11 +84,12 @@ cons_parse_ntuple_filter(const struct
rte_flow_attr*attr,
Quoted 2 lines
drivers/net/ixgbe/ixgbe_flow.c +0
-0struct rte_eth_ntuple_filter *filter, struct rte_flow_error *error); staticint
Quoted 22 lines
drivers/net/ixgbe/ixgbe_flow.c cons_parse_ntuple_filter(const struct rte_flow_attr *attr, · line 92
Quoted 11 lines
drivers/net/ixgbe/ixgbe_flow.c +6
-5-ixgbe_parse_ntuple_filter(const struct rte_flow_attr *attr, - const struct rte_flow_item pattern[], - const struct rte_flow_action actions[], - struct rte_eth_ntuple_filter *filter, - struct rte_flow_error *error); +ixgbe_parse_ntuple_filter(struct rte_eth_dev *dev, + const struct rte_flow_attr *attr, + const struct rte_flow_item pattern[], + const struct rte_flow_action actions[], + struct rte_eth_ntuple_filter *filter, + struct rte_flow_error *error);Hi Wei,
You don't need these function declarations at all. What do you think removing these first, in a separate patch, and won't need to update them here?
Also it is possible to remove all function declarations if you move "
ixgbe_flow_ops" at the end of the file, that would be something I prefer, but it is your call.
Quoted 9 lines
Quoted 2 lines
Thanks,
FerruhSorry for late reply, I have just find your mail just now.
I think your suggestion is very good from code style, but this patch is a fix
patch set for a P2 issue.
So, it is not focus on code style. code style can be changed in a separate patch if we need to and not mix them together?
I have commit 1 remove patch and new v2 fix patch set as your suggestion.
Thank you.