net/i40e: fix flex payload rule conflict issue
PATCH 1/1 net/i40e: fix flex payload rule conflict issue
From: Beilei Xing <[email protected]>
With the following commands, the second flow can't be created successfully.
1. flow create 0 ingress pattern eth / ipv4 / udp / raw relative is 1 pattern is 0102030405 / end actions drop / end
2. flow destroy 0 rule 0
3. flow create 0 ingress pattern eth / ipv4 / udp / raw relative is 1 pattern is 010203040506 / end actions drop / end
The root cause is that a flag for flex pit isn't reset.
--- drivers/net/i40e/i40e_flow.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/i40e/i40e_flow.c +6 -1
@@ -5284,6 +5284,7 @@ i40e_flow_destroy(struct rte_eth_dev *dev,enum rte_filter_type filter_type = flow->filter_type;struct i40e_fdir_info *fdir_info = &pf->fdir;int ret =0 ; +int i;switch (filter_type) {case RTE_ETH_FILTER_ETHERTYPE :
@@ -5299,9 +5300,10 @@ i40e_flow_destroy(struct rte_eth_dev *dev, &((struct i40e_fdir_filter *)flow->rule)->fdir, 0); -/* If the last flow is destroyed, disable fdir. */ if (!ret &&TAILQ_EMPTY (&pf->fdir.fdir_list)) {i40e_fdir_rx_proc_enable (dev,0 ); +for (i =0 ; i <I40E_MAX_FLXPLD_LAYER ; i++) + pf->fdir.flex_pit_flag[i] =0 ; }break ;case RTE_ETH_FILTER_HASH :
@@ -5515,6 +5517,9 @@ i40e_flow_flush_fdir_filter(struct i40e_pf *pf) pf->fdir.flex_mask_flag[pctype] =0 ; } +for (i =0 ; i <I40E_MAX_FLXPLD_LAYER ; i++) + pf->fdir.flex_pit_flag[i] =0 ; +/* Disable FDIR processing as all FDIR rules are now flushed */ i40e_fdir_rx_proc_enable (dev,0 ); }
Signature · 1 line
2.26.2
PATCH v2 1/1 net/i40e: fix flex payload rule conflict issue
From: Beilei Xing <[email protected]>
With the following commands, the second flow can't be created successfully.
1. flow create 0 ingress pattern eth / ipv4 / udp / raw relative is 1 pattern is 0102030405 / end actions drop / end
2. flow destroy 0 rule 0
3. flow create 0 ingress pattern eth / ipv4 / udp / raw relative is 1 pattern is 010203040506 / end actions drop / end
The root cause is that a flag for flex pit isn't reset.
---
v2 changes:
- Add fix line.
- Refine comments.
drivers/net/i40e/i40e_flow.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/net/i40e/i40e_flow.c +9 -1
@@ -5284,6 +5284,7 @@ i40e_flow_destroy(struct rte_eth_dev *dev,enum rte_filter_type filter_type = flow->filter_type;struct i40e_fdir_info *fdir_info = &pf->fdir;int ret =0 ; +int i;switch (filter_type) {case RTE_ETH_FILTER_ETHERTYPE :
@@ -5299,9 +5300,13 @@ i40e_flow_destroy(struct rte_eth_dev *dev, &((struct i40e_fdir_filter *)flow->rule)->fdir, 0); -/* If the last flow is destroyed, disable fdir. */ +/* When the last flow is destroyed. */ if (!ret &&TAILQ_EMPTY (&pf->fdir.fdir_list)) { +/* Disable FDIR processing. */ i40e_fdir_rx_proc_enable (dev,0 ); +/* Reset the flex_pit_flag. */ +for (i =0 ; i <I40E_MAX_FLXPLD_LAYER ; i++) + pf->fdir.flex_pit_flag[i] =0 ; }break ;case RTE_ETH_FILTER_HASH :
@@ -5515,6 +5520,9 @@ i40e_flow_flush_fdir_filter(struct i40e_pf *pf) pf->fdir.flex_mask_flag[pctype] =0 ; } +for (i =0 ; i <I40E_MAX_FLXPLD_LAYER ; i++) + pf->fdir.flex_pit_flag[i] =0 ; +/* Disable FDIR processing as all FDIR rules are now flushed */ i40e_fdir_rx_proc_enable (dev,0 ); }
Signature · 1 line
2.26.2
Hi, beilei
Quoted 50 lines
-----Original Message-----
From: Xing, Beilei <[email protected]>
Sent: Tuesday, December 29, 2020 2:18 PM
To: Guo, Jia <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>; [email protected]; Sun, Chenmin <[email protected]>
Subject: [PATCH v2] net/i40e: fix flex payload rule conflict issueFrom: Beilei Xing <[email protected]>
With the following commands, the second flow can't be created successfully.
1. flow create 0 ingress pattern eth / ipv4 / udp / raw relative is 1 pattern is 0102030405 / end actions drop / end
2. flow destroy 0 rule 0
3. flow create 0 ingress pattern eth / ipv4 / udp / raw relative is 1 pattern is 010203040506 / end actions drop / endThe root cause is that a flag for flex pit isn't reset.
Fixes 6ced3dd72f5f ("net/i40e: support flexible payload parsing for FDIR")Reported-by Chenmin Sun<[email protected]>Signed-off-by Beilei Xing <[email protected]>---
v2 changes:
- Add fix line.
- Refine comments.drivers/net/i40e/i40e_flow.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)drivers/net/i40e/i40e_flow.c +1
-0@@ -5284,6 +5284,7 @@ i40e_flow_destroy(struct rte_eth_dev *dev,enum rte_filter_type filter_type = flow->filter_type;struct i40e_fdir_info *fdir_info = &pf->fdir;int ret =0 ; +int i;switch (filter_type) {case RTE_ETH_FILTER_ETHERTYPE :@@ -5299,9 +5300,13 @@ i40e_flow_destroy(struct rte_eth_dev *dev, &((struct i40e_fdir_filter *)flow->rule)->fdir,
drivers/net/i40e/i40e_flow.c i40e_flow_destroy(struct rte_eth_dev *dev, · line 5309
Quoted 10 lines
drivers/net/i40e/i40e_flow.c +5
-10); -/* If the last flow is destroyed, disable fdir. */ +/* When the last flow is destroyed. */ if (!ret &&TAILQ_EMPTY (&pf->fdir.fdir_list)) { +/* Disable FDIR processing. */ i40e_fdir_rx_proc_enable (dev,0 ); +/* Reset the flex_pit_flag. */ +for (i =0 ; i <I40E_MAX_FLXPLD_LAYER ; i++) + pf->fdir.flex_pit_flag[i] =0 ;
Why reset all flex_pit_flag when destroy the last flow, if destroy other flow, is it no need to reset corresponding flex_pit_flag which set before when the flow added? And reset flag should be ahead of the FDIR disabling I think.
Quoted 16 lines
drivers/net/i40e/i40e_flow.c +3
-0}break ;case RTE_ETH_FILTER_HASH :@@ -5515,6 +5520,9 @@ i40e_flow_flush_fdir_filter(struct i40e_pf *pf) pf->fdir.flex_mask_flag[pctype] =0 ; } +for (i =0 ; i <I40E_MAX_FLXPLD_LAYER ; i++) + pf->fdir.flex_pit_flag[i] =0 ; +/* Disable FDIR processing as all FDIR rules are now flushed */ i40e_fdir_rx_proc_enable (dev,0 );}
--
2.26.2
PATCH v3 1/1 net/i40e: fix flex payload rule conflict issue
In reply to [email protected]From: Beilei Xing <[email protected]>
With the following commands, the second flow can't be created successfully.
1. flow create 0 ingress pattern eth / ipv4 / udp / raw relative is 1 pattern is 0102030405 / end actions drop / end
2. flow destroy 0 rule 0
3. flow create 0 ingress pattern eth / ipv4 / udp / raw relative is 1 pattern is 010203040506 / end actions drop / end
The root cause is that a flag for flex pit isn't reset.
---
v3 changes:
- Add flow count for flexible payload flow.
v2 changeds:
- Add fix line.
drivers/net/i40e/i40e_ethdev.h | 3 +++ drivers/net/i40e/i40e_fdir.c | 16 ++++++++++++++-- drivers/net/i40e/i40e_flow.c | 4 ++++ 3 files changed, 21 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_ethdev.h +3 -0
@@ -636,6 +636,7 @@ struct i40e_fdir_flow_ext {bool is_udp;/* ipv4|ipv6 udp flow */ enum i40e_flxpld_layer_idx layer_idx;struct i40e_fdir_flex_pit flex_pit[I40E_MAX_FLXPLD_LAYER *I40E_MAX_FLXPLD_FIED ]; +bool is_flex_flow; };/* A structure used to define the input for a flow director filter entry */
@@ -784,6 +785,8 @@ struct i40e_fdir_info {bool flex_mask_flag[I40E_FILTER_PCTYPE_MAX ];bool inset_flag[I40E_FILTER_PCTYPE_MAX ];/* Mark if input set is set */ + +uint32_t flex_flow_count[I40E_MAX_FLXPLD_LAYER ]; };/* Ethertype filter number HW supports */
drivers/net/i40e/i40e_fdir.c +14 -2
@@ -355,6 +355,7 @@ i40e_init_flx_pld(struct i40e_pf *pf) I40E_PRTQF_FLX_PIT(index + 1), 0x0000FC29);/*non-used*/I40E_WRITE_REG (hw,I40E_PRTQF_FLX_PIT (index +2 ),0x0000FC2A );/*non-used*/ + pf->fdir.flex_pit_flag[i] =0 ; }/* initialize the masks */
@@ -1513,8 +1514,6 @@ i40e_flow_set_fdir_flex_pit(struct i40e_pf *pf,I40E_WRITE_REG (hw,I40E_PRTQF_FLX_PIT (field_idx), flx_pit); min_next_off++; } - - pf->fdir.flex_pit_flag[layer_idx] =1 ; } static int
@@ -1738,6 +1737,8 @@ i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev, fdir_info->fdir_guarantee_free_space > 0) wait_status = false; }else { + layer_idx = filter->input.flow_ext.layer_idx; + node =i40e_sw_fdir_filter_lookup (fdir_info, &check_filter.fdir.input);if (!node) {
@@ -1785,6 +1786,17 @@ i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev, goto error_op; } +if (filter->input.flow_ext.is_flex_flow) { +if (add) { + fdir_info->flex_flow_count[layer_idx]++; + pf->fdir.flex_pit_flag[layer_idx] =1 ; + }else { + fdir_info->flex_flow_count[layer_idx]--; +if (!fdir_info->flex_flow_count[layer_idx]) + pf->fdir.flex_pit_flag[layer_idx] =0 ; + } + } +if (add) { fdir_info->fdir_actual_cnt++; if (fdir_info->fdir_invalprio == 1 &&
drivers/net/i40e/i40e_flow.c +4 -0
@@ -3069,6 +3069,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, &flex_pit, sizeof(struct i40e_fdir_flex_pit)); filter->input.flow_ext.layer_idx = layer_idx; filter->input.flow_ext.raw_id = raw_id; + filter->input.flow_ext.is_flex_flow = true;break ;case RTE_FLOW_ITEM_TYPE_VF : vf_spec = item->spec;
@@ -5515,6 +5516,9 @@ i40e_flow_flush_fdir_filter(struct i40e_pf *pf) pf->fdir.flex_mask_flag[pctype] =0 ; } +for (i =0 ; i <I40E_MAX_FLXPLD_LAYER ; i++) + pf->fdir.flex_pit_flag[i] =0 ; +/* Disable FDIR processing as all FDIR rules are now flushed */ i40e_fdir_rx_proc_enable (dev,0 ); }
Signature · 1 line
2.26.2
Quoted 88 lines
-----Original Message-----
From: Xing, Beilei <[email protected]>
Sent: Friday, January 1, 2021 12:04 PM
To: Guo, Jia <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>; [email protected]; Sun, Chenmin <[email protected]>
Subject: [PATCH v3] net/i40e: fix flex payload rule conflict issueFrom: Beilei Xing <[email protected]>
With the following commands, the second flow can't be created successfully.
1. flow create 0 ingress pattern eth / ipv4 / udp / raw relative is 1 pattern is 0102030405 / end actions drop / end
2. flow destroy 0 rule 0
3. flow create 0 ingress pattern eth / ipv4 / udp / raw relative is 1 pattern is 010203040506 / end actions drop / endThe root cause is that a flag for flex pit isn't reset.
Fixes 6ced3dd72f5f ("net/i40e: support flexible payload parsing for FDIR")Reported-by Chenmin Sun<[email protected]>Signed-off-by Beilei Xing <[email protected]>---
v3 changes:
- Add flow count for flexible payload flow.
v2 changeds:
- Add fix line.drivers/net/i40e/i40e_ethdev.h | 3 +++ drivers/net/i40e/i40e_fdir.c | 16 ++++++++++++++-- drivers/net/i40e/i40e_flow.c | 4 ++++ 3 files changed, 21 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_ethdev.hindex696c5aaf7e..aac226999c100644drivers/net/i40e/i40e_ethdev.h +1
-0@@ -636,6 +636,7 @@ struct i40e_fdir_flow_ext {bool is_udp;/* ipv4|ipv6 udp flow */ enum i40e_flxpld_layer_idx layer_idx;struct i40e_fdir_flex_pit flex_pit[I40E_MAX_FLXPLD_LAYER *I40E_MAX_FLXPLD_FIED ]; +bool is_flex_flow; };/* A structure used to define the input for a flow director filter entry */ @@
-784,6 +785,8 @@ structi40e_fdir_info{drivers/net/i40e/i40e_ethdev.h +0
-0bool flex_mask_flag[I40E_FILTER_PCTYPE_MAX ];bool inset_flag[I40E_FILTER_PCTYPE_MAX ];/* Mark if input set is set */
drivers/net/i40e/i40e_ethdev.h +2
-0+ +uint32_t flex_flow_count[I40E_MAX_FLXPLD_LAYER ]; }; /* Ethertype filter number HW supports */ diff --git
a/drivers/net/i40e/i40e_fdir.cb/drivers/net/i40e/i40e_fdir.cindex50c0eee9f2..4400b607c8100644drivers/net/i40e/i40e_fdir.c +0
-0@@ -355,6 +355,7 @@ i40e_init_flx_pld(struct i40e_pf *pf) I40E_PRTQF_FLX_PIT(index + 1), 0x0000FC29);/*non-used*/
drivers/net/i40e/i40e_fdir.c +0
-0I40E_WRITE_REG (hw,I40E_PRTQF_FLX_PIT (index +2 ),0x0000FC2A );/*non- used*/
drivers/net/i40e/i40e_fdir.c +1
-2+ pf->fdir.flex_pit_flag[i] =0 ; }/* initialize the masks */ @@ -1513,8 +1514,6 @@ i40e_flow_set_fdir_flex_pit(struct i40e_pf *pf,I40E_WRITE_REG (hw,I40E_PRTQF_FLX_PIT (field_idx), flx_pit); min_next_off++; } - - pf->fdir.flex_pit_flag[layer_idx] =1 ; }static int
drivers/net/i40e/i40e_fdir.c i40e_flow_add_del_fdir_filter(struct rte_eth_dev · line 1742
Quoted 6 lines
drivers/net/i40e/i40e_fdir.c +2
-0@@ -1738,6 +1737,8 @@ i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev, fdir_info->fdir_guarantee_free_space > 0) wait_status = false; }else { + layer_idx = filter->input.flow_ext.layer_idx; +
Assume that flow_ext.layer_idx should be assign to the layer_idx at the condition of " (!filter->input.flow_ext.customized_pctype) ", right?
Quoted 48 lines
drivers/net/i40e/i40e_fdir.c +0
-0node =i40e_sw_fdir_filter_lookup (fdir_info, &check_filter.fdir.input);drivers/net/i40e/i40e_fdir.c +11
-0if (!node) {@@ -1785,6 +1786,17 @@ i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev, goto error_op; } +if (filter->input.flow_ext.is_flex_flow) { +if (add) { + fdir_info->flex_flow_count[layer_idx]++; + pf->fdir.flex_pit_flag[layer_idx] =1 ; + }else { + fdir_info->flex_flow_count[layer_idx]--; +if (!fdir_info->flex_flow_count[layer_idx]) + pf->fdir.flex_pit_flag[layer_idx] =0 ; + } + } +if (add) { fdir_info->fdir_actual_cnt++;if (
fdir_info->fdir_invalprio== 1 && diff --gita/drivers/net/i40e/i40e_flow.cb/drivers/net/i40e/i40e_flow.cindexb09ff6590d..bbd666b7a0100644drivers/net/i40e/i40e_flow.c +1
-0@@ -3069,6 +3069,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, &flex_pit, sizeof(struct i40e_fdir_flex_pit)); filter->input.flow_ext.layer_idx = layer_idx; filter->input.flow_ext.raw_id = raw_id; + filter->input.flow_ext.is_flex_flow = true;break ;case RTE_FLOW_ITEM_TYPE_VF :drivers/net/i40e/i40e_flow.c +3
-0vf_spec = item->spec;@@ -5515,6 +5516,9 @@ i40e_flow_flush_fdir_filter(struct i40e_pf *pf) pf->fdir.flex_mask_flag[pctype] =0 ; } +for (i =0 ; i <I40E_MAX_FLXPLD_LAYER ; i++) + pf->fdir.flex_pit_flag[i] =0 ; +/* Disable FDIR processing as all FDIR rules are now flushed */ i40e_fdir_rx_proc_enable (dev,0 );}
--
2.26.2
Quoted 92 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Thursday, December 31, 2020 2:07 PM
To: Xing, Beilei <[email protected]>; [email protected]
Cc: [email protected]; Sun, Chenmin <[email protected]>
Subject: RE: [PATCH v3] net/i40e: fix flex payload rule conflict issueQuoted 82 lines
-----Original Message-----
From: Xing, Beilei <[email protected]>
Sent: Friday, January 1, 2021 12:04 PM
To: Guo, Jia <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>; [email protected]; Sun, Chenmin <[email protected]>
Subject: [PATCH v3] net/i40e: fix flex payload rule conflict issueFrom: Beilei Xing <[email protected]>
With the following commands, the second flow can't be created successfully.
1. flow create 0 ingress pattern eth / ipv4 / udp / raw relative is 1 pattern is 0102030405 / end actions drop / end
2. flow destroy 0 rule 0
3. flow create 0 ingress pattern eth / ipv4 / udp / raw relative is 1 pattern is 010203040506 / end actions drop / endThe root cause is that a flag for flex pit isn't reset.
Fixes 6ced3dd72f5f ("net/i40e: support flexible payload parsing forFDIR")
Cc: [email protected]Reported-by Chenmin Sun<[email protected]>Signed-off-by Beilei Xing <[email protected]>---
v3 changes:
- Add flow count for flexible payload flow.
v2 changeds:
- Add fix line.drivers/net/i40e/i40e_ethdev.h | 3 +++ drivers/net/i40e/i40e_fdir.c | 16 ++++++++++++++-- drivers/net/i40e/i40e_flow.c | 4 ++++ 3 files changed, 21 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_ethdev.hindex696c5aaf7e..aac226999c100644drivers/net/i40e/i40e_ethdev.h +0
-0@@ -636,6 +636,7 @@ struct i40e_fdir_flow_ext { bool is_udp; /*ipv4|ipv6 udp flow */ enum
i40e_flxpld_layer_idxlayer_idx; structi40e_fdir_flex_pitflex_pit[I40E_MAX_FLXPLD_LAYER *I40E_MAX_FLXPLD_FIED];
+boolis_flex_flow;
};/* A structure used to define the input for a flow director filter
entry */ @@
-784,6 +785,8 @@ structi40e_fdir_info{ bool flex_mask_flag[I40E_FILTER_PCTYPE_MAX];bool inset_flag[I40E_FILTER_PCTYPE_MAX]; /* Mark if input set is set
*/drivers/net/i40e/i40e_ethdev.h +2
-0+ +uint32_t flex_flow_count[I40E_MAX_FLXPLD_LAYER ]; }; /* Ethertype filter number HW supports */ diff --git
a/drivers/net/i40e/i40e_fdir.cb/drivers/net/i40e/i40e_fdir.cindex50c0eee9f2..4400b607c8100644drivers/net/i40e/i40e_fdir.c +0
-0@@ -355,6 +355,7 @@ i40e_init_flx_pld(struct i40e_pf *pf)
I40E_PRTQF_FLX_PIT(index + 1), 0x0000FC29);/*non- used*/I40E_WRITE_REG(hw, I40E_PRTQF_FLX_PIT(index + 2), 0x0000FC2A);/*non- used*/drivers/net/i40e/i40e_fdir.c +1
-2+pf->fdir.flex_pit_flag[i] =0 ; }/* initialize the masks */ @@ -1513,8 +1514,6 @@ i40e_flow_set_fdir_flex_pit(struct i40e_pf *pf,I40E_WRITE_REG (hw,I40E_PRTQF_FLX_PIT (field_idx), flx_pit); min_next_off++; } - -pf->fdir.flex_pit_flag[layer_idx] =1 ; }
Quoted 9 lines
drivers/net/i40e/i40e_fdir.c i40e_flow_add_del_fdir_filter(struct rte_eth_dev · line 1740
Quoted 6 lines
drivers/net/i40e/i40e_fdir.c +2
-0static int@@ -1738,6 +1737,8 @@ i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev, fdir_info->fdir_guarantee_free_space > 0) wait_status = false; }else { +layer_idx = filter->input.flow_ext.layer_idx; +Assume that flow_ext.layer_idx should be assign to the
layer_idxat the condition of " (!filter->input.flow_ext.customized_pctype) ", right?
Yes, thanks for the comment, will fix in next version.
Quoted 44 lines
Quoted 43 lines
drivers/net/i40e/i40e_fdir.c +10
-0node =i40e_sw_fdir_filter_lookup (fdir_info, &check_filter.fdir.input);if (!node) {@@ -1785,6 +1786,17 @@ i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev, goto error_op; } +if (filter->input.flow_ext.is_flex_flow) {if (add) { +fdir_info->flex_flow_count[layer_idx]++; +pf->fdir.flex_pit_flag[layer_idx] =1 ; +}else { +fdir_info->flex_flow_count[layer_idx]--; +if (!fdir_info->flex_flow_count[layer_idx]) +pf->fdir.flex_pit_flag[layer_idx] =0 ; +} +} +if (add) { fdir_info->fdir_actual_cnt++; if (fdir_info->fdir_invalprio == 1 && diff --git
a/drivers/net/i40e/i40e_flow.cb/drivers/net/i40e/i40e_flow.cindexb09ff6590d..bbd666b7a0100644drivers/net/i40e/i40e_flow.c +1
-0@@ -3069,6 +3069,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, &flex_pit, sizeof(struct i40e_fdir_flex_pit)); filter->input.flow_ext.layer_idx = layer_idx; filter->input.flow_ext.raw_id = raw_id; +filter->input.flow_ext.is_flex_flow = true;break ;case RTE_FLOW_ITEM_TYPE_VF :
vf_spec=item->spec;drivers/net/i40e/i40e_flow.c +3
-1@@ -5515,6 +5516,9 @@ i40e_flow_flush_fdir_filter(struct i40e_pf *pf) pf->fdir.flex_mask_flag[pctype] =0 ; } +for (i =0 ; i <I40E_MAX_FLXPLD_LAYER ; i++) +pf->fdir.flex_pit_flag[i] =0 ; +/* Disable FDIR processing as all FDIR rules are now flushed */ i40e_fdir_rx_proc_enable (dev,0 ); } --2.26.2
PATCH v4 1/1 net/i40e: fix flex payload rule conflict issue
In reply to [email protected]From: Beilei Xing <[email protected]>
With the following commands, the second flow can't be created successfully.
1. flow create 0 ingress pattern eth / ipv4 / udp / raw relative is 1 pattern is 0102030405 / end actions drop / end
2. flow destroy 0 rule 0
3. flow create 0 ingress pattern eth / ipv4 / udp / raw relative is 1 pattern is 010203040506 / end actions drop / end
The root cause is that a flag for flex pit isn't reset.
---
v4 changes:
- Code refine.
v3 changes:
- Add flow count for flexible payload flow.
v2 changeds:
- Add fix line.
drivers/net/i40e/i40e_ethdev.h | 3 +++ drivers/net/i40e/i40e_fdir.c | 19 ++++++++++++++++--- drivers/net/i40e/i40e_flow.c | 4 ++++ 3 files changed, 23 insertions(+), 3 deletions(-)
drivers/net/i40e/i40e_ethdev.h +3 -0
@@ -636,6 +636,7 @@ struct i40e_fdir_flow_ext {bool is_udp;/* ipv4|ipv6 udp flow */ enum i40e_flxpld_layer_idx layer_idx;struct i40e_fdir_flex_pit flex_pit[I40E_MAX_FLXPLD_LAYER *I40E_MAX_FLXPLD_FIED ]; +bool is_flex_flow; };/* A structure used to define the input for a flow director filter entry */
@@ -784,6 +785,8 @@ struct i40e_fdir_info {bool flex_mask_flag[I40E_FILTER_PCTYPE_MAX ];bool inset_flag[I40E_FILTER_PCTYPE_MAX ];/* Mark if input set is set */ + +uint32_t flex_flow_count[I40E_MAX_FLXPLD_LAYER ]; };/* Ethertype filter number HW supports */
drivers/net/i40e/i40e_fdir.c +16 -3
@@ -355,6 +355,7 @@ i40e_init_flx_pld(struct i40e_pf *pf) I40E_PRTQF_FLX_PIT(index + 1), 0x0000FC29);/*non-used*/I40E_WRITE_REG (hw,I40E_PRTQF_FLX_PIT (index +2 ),0x0000FC2A );/*non-used*/ + pf->fdir.flex_pit_flag[i] =0 ; }/* initialize the masks */
@@ -1513,8 +1514,6 @@ i40e_flow_set_fdir_flex_pit(struct i40e_pf *pf,I40E_WRITE_REG (hw,I40E_PRTQF_FLX_PIT (field_idx), flx_pit); min_next_off++; } - - pf->fdir.flex_pit_flag[layer_idx] =1 ; } static int
@@ -1686,7 +1685,7 @@ i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev,i40e_fdir_filter_convert (filter, &check_filter);if (add) { -if (!filter->input.flow_ext.customized_pctype) { +if (filter->input.flow_ext.is_flex_flow) {for (i =0 ; i < filter->input.flow_ext.raw_id; i++) { layer_idx = filter->input.flow_ext.layer_idx; field_idx = layer_idx *I40E_MAX_FLXPLD_FIED + i;
@@ -1738,6 +1737,9 @@ i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev, fdir_info->fdir_guarantee_free_space > 0) wait_status = false; }else { +if (filter->input.flow_ext.is_flex_flow) + layer_idx = filter->input.flow_ext.layer_idx; + node =i40e_sw_fdir_filter_lookup (fdir_info, &check_filter.fdir.input);if (!node) {
@@ -1785,6 +1787,17 @@ i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev, goto error_op; } +if (filter->input.flow_ext.is_flex_flow) { +if (add) { + fdir_info->flex_flow_count[layer_idx]++; + pf->fdir.flex_pit_flag[layer_idx] =1 ; + }else { + fdir_info->flex_flow_count[layer_idx]--; +if (!fdir_info->flex_flow_count[layer_idx]) + pf->fdir.flex_pit_flag[layer_idx] =0 ; + } + } +if (add) { fdir_info->fdir_actual_cnt++; if (fdir_info->fdir_invalprio == 1 &&
drivers/net/i40e/i40e_flow.c +4 -0
@@ -3069,6 +3069,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, &flex_pit, sizeof(struct i40e_fdir_flex_pit)); filter->input.flow_ext.layer_idx = layer_idx; filter->input.flow_ext.raw_id = raw_id; + filter->input.flow_ext.is_flex_flow = true;break ;case RTE_FLOW_ITEM_TYPE_VF : vf_spec = item->spec;
@@ -5515,6 +5516,9 @@ i40e_flow_flush_fdir_filter(struct i40e_pf *pf) pf->fdir.flex_mask_flag[pctype] =0 ; } +for (i =0 ; i <I40E_MAX_FLXPLD_LAYER ; i++) + pf->fdir.flex_pit_flag[i] =0 ; +/* Disable FDIR processing as all FDIR rules are now flushed */ i40e_fdir_rx_proc_enable (dev,0 ); }
Signature · 1 line
2.26.2
PATCH v5 1/1 net/i40e: fix flex payload rule conflict issue
In reply to [email protected]From: Beilei Xing <[email protected]>
With the following commands, the second flow can't be created successfully.
1. flow create 0 ingress pattern eth / ipv4 / udp / raw relative is 1 pattern is 0102030405 / end actions drop / end
2. flow destroy 0 rule 0
3. flow create 0 ingress pattern eth / ipv4 / udp / raw relative is 1 pattern is 010203040506 / end actions drop / end
The root cause is that a flag for flex pit isn't reset.
---
v4 changes:
- Code refine.
v3 changes:
- Add flow count for flexible payload flow.
v2 changeds:
- Add fix line.
drivers/net/i40e/i40e_ethdev.h | 3 +++ drivers/net/i40e/i40e_fdir.c | 19 ++++++++++++++++--- drivers/net/i40e/i40e_flow.c | 4 ++++ 3 files changed, 23 insertions(+), 3 deletions(-)
drivers/net/i40e/i40e_ethdev.h +3 -0
@@ -636,6 +636,7 @@ struct i40e_fdir_flow_ext {bool is_udp;/* ipv4|ipv6 udp flow */ enum i40e_flxpld_layer_idx layer_idx;struct i40e_fdir_flex_pit flex_pit[I40E_MAX_FLXPLD_LAYER *I40E_MAX_FLXPLD_FIED ]; +bool is_flex_flow; };/* A structure used to define the input for a flow director filter entry */
@@ -784,6 +785,8 @@ struct i40e_fdir_info {bool flex_mask_flag[I40E_FILTER_PCTYPE_MAX ];bool inset_flag[I40E_FILTER_PCTYPE_MAX ];/* Mark if input set is set */ + +uint32_t flex_flow_count[I40E_MAX_FLXPLD_LAYER ]; };/* Ethertype filter number HW supports */
drivers/net/i40e/i40e_fdir.c +16 -3
@@ -355,6 +355,7 @@ i40e_init_flx_pld(struct i40e_pf *pf) I40E_PRTQF_FLX_PIT(index + 1), 0x0000FC29);/*non-used*/I40E_WRITE_REG (hw,I40E_PRTQF_FLX_PIT (index +2 ),0x0000FC2A );/*non-used*/ + pf->fdir.flex_pit_flag[i] =0 ; }/* initialize the masks */
@@ -1513,8 +1514,6 @@ i40e_flow_set_fdir_flex_pit(struct i40e_pf *pf,I40E_WRITE_REG (hw,I40E_PRTQF_FLX_PIT (field_idx), flx_pit); min_next_off++; } - - pf->fdir.flex_pit_flag[layer_idx] =1 ; } static int
@@ -1686,7 +1685,7 @@ i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev,i40e_fdir_filter_convert (filter, &check_filter);if (add) { -if (!filter->input.flow_ext.customized_pctype) { +if (filter->input.flow_ext.is_flex_flow) {for (i =0 ; i < filter->input.flow_ext.raw_id; i++) { layer_idx = filter->input.flow_ext.layer_idx; field_idx = layer_idx *I40E_MAX_FLXPLD_FIED + i;
@@ -1738,6 +1737,9 @@ i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev, fdir_info->fdir_guarantee_free_space > 0) wait_status = false; }else { +if (filter->input.flow_ext.is_flex_flow) + layer_idx = filter->input.flow_ext.layer_idx; + node =i40e_sw_fdir_filter_lookup (fdir_info, &check_filter.fdir.input);if (!node) {
@@ -1785,6 +1787,17 @@ i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev, goto error_op; } +if (filter->input.flow_ext.is_flex_flow) { +if (add) { + fdir_info->flex_flow_count[layer_idx]++; + pf->fdir.flex_pit_flag[layer_idx] =1 ; + }else { + fdir_info->flex_flow_count[layer_idx]--; +if (!fdir_info->flex_flow_count[layer_idx]) + pf->fdir.flex_pit_flag[layer_idx] =0 ; + } + } +if (add) { fdir_info->fdir_actual_cnt++; if (fdir_info->fdir_invalprio == 1 &&
drivers/net/i40e/i40e_flow.c +4 -0
@@ -3069,6 +3069,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, &flex_pit, sizeof(struct i40e_fdir_flex_pit)); filter->input.flow_ext.layer_idx = layer_idx; filter->input.flow_ext.raw_id = raw_id; + filter->input.flow_ext.is_flex_flow = true;break ;case RTE_FLOW_ITEM_TYPE_VF : vf_spec = item->spec;
@@ -5515,6 +5516,9 @@ i40e_flow_flush_fdir_filter(struct i40e_pf *pf) pf->fdir.flex_mask_flag[pctype] =0 ; } +for (i =0 ; i <I40E_MAX_FLXPLD_LAYER ; i++) + pf->fdir.flex_pit_flag[i] =0 ; +/* Disable FDIR processing as all FDIR rules are now flushed */ i40e_fdir_rx_proc_enable (dev,0 ); }
Signature · 1 line
2.26.2
Quoted 154 lines
-----Original Message-----
From: Xing, Beilei <[email protected]>
Sent: Tuesday, January 5, 2021 11:13 AM
To: Guo, Jia <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>; [email protected]; Sun, Chenmin <[email protected]>
Subject: [PATCH v5] net/i40e: fix flex payload rule conflict issueFrom: Beilei Xing <[email protected]>
With the following commands, the second flow can't be created successfully.
1. flow create 0 ingress pattern eth / ipv4 / udp / raw relative is 1 pattern is 0102030405 / end actions drop / end
2. flow destroy 0 rule 0
3. flow create 0 ingress pattern eth / ipv4 / udp / raw relative is 1 pattern is 010203040506 / end actions drop / endThe root cause is that a flag for flex pit isn't reset.
Fixes 6ced3dd72f5f ("net/i40e: support flexible payload parsing for FDIR")Reported-by Chenmin Sun<[email protected]>Signed-off-by Beilei Xing <[email protected]>---
v4 changes:
- Code refine.
v3 changes:
- Add flow count for flexible payload flow.
v2 changeds:
- Add fix line.drivers/net/i40e/i40e_ethdev.h | 3 +++ drivers/net/i40e/i40e_fdir.c | 19 ++++++++++++++++--- drivers/net/i40e/i40e_flow.c | 4 ++++ 3 files changed, 23 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_ethdev.hindex696c5aaf7e..aac226999c100644drivers/net/i40e/i40e_ethdev.h +1
-0@@ -636,6 +636,7 @@ struct i40e_fdir_flow_ext {bool is_udp;/* ipv4|ipv6 udp flow */ enum i40e_flxpld_layer_idx layer_idx;struct i40e_fdir_flex_pit flex_pit[I40E_MAX_FLXPLD_LAYER *I40E_MAX_FLXPLD_FIED ]; +bool is_flex_flow; };/* A structure used to define the input for a flow director filter entry */ @@
-784,6 +785,8 @@ structi40e_fdir_info{drivers/net/i40e/i40e_ethdev.h +0
-0bool flex_mask_flag[I40E_FILTER_PCTYPE_MAX ];bool inset_flag[I40E_FILTER_PCTYPE_MAX ];/* Mark if input set is set */
drivers/net/i40e/i40e_ethdev.h +2
-0+ +uint32_t flex_flow_count[I40E_MAX_FLXPLD_LAYER ]; }; /* Ethertype filter number HW supports */ diff --git
a/drivers/net/i40e/i40e_fdir.cb/drivers/net/i40e/i40e_fdir.cindex50c0eee9f2..0343e8b09a100644drivers/net/i40e/i40e_fdir.c +0
-0@@ -355,6 +355,7 @@ i40e_init_flx_pld(struct i40e_pf *pf) I40E_PRTQF_FLX_PIT(index + 1), 0x0000FC29);/*non-used*/
drivers/net/i40e/i40e_fdir.c +0
-0I40E_WRITE_REG (hw,I40E_PRTQF_FLX_PIT (index +2 ),0x0000FC2A );/*non- used*/
drivers/net/i40e/i40e_fdir.c +1
-2+ pf->fdir.flex_pit_flag[i] =0 ; }/* initialize the masks */ @@ -1513,8 +1514,6 @@ i40e_flow_set_fdir_flex_pit(struct i40e_pf *pf,I40E_WRITE_REG (hw,I40E_PRTQF_FLX_PIT (field_idx), flx_pit); min_next_off++; } - - pf->fdir.flex_pit_flag[layer_idx] =1 ; }static int
drivers/net/i40e/i40e_fdir.c +1
-1@@ -1686,7 +1685,7 @@ i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev,i40e_fdir_filter_convert (filter, &check_filter);if (add) { -if (!filter->input.flow_ext.customized_pctype) { +if (filter->input.flow_ext.is_flex_flow) {for (i =0 ; i < filter->input.flow_ext.raw_id; i++) { layer_idx = filter->input.flow_ext.layer_idx;
field_idx=layer_idx*I40E_MAX_FLXPLD_FIED+ i; @@ -1738,6 +1737,9 @@ i40e_flow_add_del_fdir_filter(structrte_eth_dev*dev,drivers/net/i40e/i40e_fdir.c +14
-0fdir_info->fdir_guarantee_free_space > 0) wait_status = false; }else { +if (filter->input.flow_ext.is_flex_flow) + layer_idx = filter->input.flow_ext.layer_idx; + node =i40e_sw_fdir_filter_lookup (fdir_info, &check_filter.fdir.input);if (!node) {@@ -1785,6 +1787,17 @@ i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev, goto error_op; } +if (filter->input.flow_ext.is_flex_flow) { +if (add) { + fdir_info->flex_flow_count[layer_idx]++; + pf->fdir.flex_pit_flag[layer_idx] =1 ; + }else { + fdir_info->flex_flow_count[layer_idx]--; +if (!fdir_info->flex_flow_count[layer_idx]) + pf->fdir.flex_pit_flag[layer_idx] =0 ; + } + } +if (add) { fdir_info->fdir_actual_cnt++;if (
fdir_info->fdir_invalprio== 1 && diff --gita/drivers/net/i40e/i40e_flow.cb/drivers/net/i40e/i40e_flow.cindexb09ff6590d..bbd666b7a0100644drivers/net/i40e/i40e_flow.c +1
-0@@ -3069,6 +3069,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, &flex_pit, sizeof(struct i40e_fdir_flex_pit)); filter->input.flow_ext.layer_idx = layer_idx; filter->input.flow_ext.raw_id = raw_id; + filter->input.flow_ext.is_flex_flow = true;break ;case RTE_FLOW_ITEM_TYPE_VF :drivers/net/i40e/i40e_flow.c +3
-0vf_spec = item->spec;@@ -5515,6 +5516,9 @@ i40e_flow_flush_fdir_filter(struct i40e_pf *pf) pf->fdir.flex_mask_flag[pctype] =0 ; } +for (i =0 ; i <I40E_MAX_FLXPLD_LAYER ; i++) + pf->fdir.flex_pit_flag[i] =0 ; +/* Disable FDIR processing as all FDIR rules are now flushed */ i40e_fdir_rx_proc_enable (dev,0 );}
--
2.26.2
Zhang, Qi Z
AppliedQuoted 39 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Guo, Jia
Sent: Tuesday, January 5, 2021 11:40 AM
To: Xing, Beilei <[email protected]>; [email protected]
Cc: [email protected]; Sun, Chenmin <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5] net/i40e: fix flex payload rule conflict issueAcked-by Jeff Guo <[email protected]>Quoted 28 lines
-----Original Message-----
From: Xing, Beilei <[email protected]>
Sent: Tuesday, January 5, 2021 11:13 AM
To: Guo, Jia <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>; [email protected]; Sun, Chenmin <[email protected]>
Subject: [PATCH v5] net/i40e: fix flex payload rule conflict issueFrom: Beilei Xing <[email protected]>
With the following commands, the second flow can't be created successfully.
1. flow create 0 ingress pattern eth / ipv4 / udp / raw relative is 1 pattern is 0102030405 / end actions drop / end
2. flow destroy 0 rule 0
3. flow create 0 ingress pattern eth / ipv4 / udp / raw relative is 1 pattern is 010203040506 / end actions drop / endThe root cause is that a flag for flex pit isn't reset.
Fixes 6ced3dd72f5f ("net/i40e: support flexible payload parsing forFDIR")
Cc: [email protected]Reported-by Chenmin Sun<[email protected]>Signed-off-by Beilei Xing <[email protected]>
Applied to dpdk-next-net-intel.
Thanks
Qi