refactor rte_flow
cover refactor rte_flow
1. apply group to hardware pipeline stage static mapping
2. remove pipeline mode
Qi Zhang (2):
net/ice: remove pipeline mode
net/ice: map group to pipeline stage
doc/guides/nics/ice.rst | 19 --- drivers/net/ice/ice_acl_filter.c | 13 +- drivers/net/ice/ice_ethdev.c | 8 - drivers/net/ice/ice_ethdev.h | 4 - drivers/net/ice/ice_fdir_filter.c | 21 +-- drivers/net/ice/ice_generic_flow.c | 251 ++++++---------------------- drivers/net/ice/ice_generic_flow.h | 15 +- drivers/net/ice/ice_hash.c | 19 +-- drivers/net/ice/ice_switch_filter.c | 127 +------------- 9 files changed, 71 insertions(+), 406 deletions(-)
Signature · 1 line
2.31.1
PATCH 1/2 net/ice: remove pipeline mode
This marks the initial phase of refactoring the ice rte_flow implementation.
The combination of switch and fdir rules within the same syntax has led to inconvenient user experiences. Naturally, the switch filter and fdir filter represent distinct pipeline stages with differing hardware capabilities.
To address this, we have made the decision to assign each stage to a separate rte_flow group. This will allow users to clearly specify their intentions when creating a rule. Consequently, the need for a pipeline mode can be removed.
--- doc/guides/nics/ice.rst | 19 ----- drivers/net/ice/ice_ethdev.c | 8 -- drivers/net/ice/ice_ethdev.h | 2 - drivers/net/ice/ice_fdir_filter.c | 2 +- drivers/net/ice/ice_generic_flow.c | 120 ++++++++-------------------- drivers/net/ice/ice_generic_flow.h | 6 +- drivers/net/ice/ice_switch_filter.c | 118 +-------------------------- 7 files changed, 40 insertions(+), 235 deletions(-)
doc/guides/nics/ice.rst +0 -19
@@ -90,25 +90,6 @@ Runtime Configuration NOTE: In Safe mode, only very limited features are available, features like RSS, checksum, fdir, tunneling ... are all disabled. -- ``Generic Flow Pipeline Mode Support`` (default ``0``) - - In pipeline mode, a flow can be set at one specific stage by setting parameter - ``priority``. Currently, we support two stages: priority = 0 or !0. Flows with - priority 0 located at the first pipeline stage which typically be used as a firewall - to drop the packet on a blocklist(we called it permission stage). At this stage, - flow rules are created for the device's exact match engine: switch. Flows with priority - !0 located at the second stage, typically packets are classified here and be steered to - specific queue or queue group (we called it distribution stage), At this stage, flow - rules are created for device's flow director engine. - For none-pipeline mode, ``priority`` is ignored, a flow rule can be created as a flow director - rule or a switch rule depends on its pattern/action and the resource allocation situation, - all flows are virtually at the same pipeline stage. - By default, generic flow API is enabled in none-pipeline mode, user can choose to - use pipeline mode by setting ``devargs`` parameter ``pipeline-mode-support``, - for example:: - - -a 80:00.0,pipeline-mode-support=1 - - ``Default MAC Disable`` (default ``0``) Disable the default MAC make the device drop all packets by default,
drivers/net/ice/ice_ethdev.c +0 -8
@@ -27,7 +27,6 @@/* devargs */ #define ICE_SAFE_MODE_SUPPORT_ARG "safe-mode-support" -#define ICE_PIPELINE_MODE_SUPPORT_ARG "pipeline-mode-support"#define ICE_DEFAULT_MAC_DISABLE "default-mac-disable"#define ICE_PROTO_XTR_ARG "proto_xtr"#define ICE_FIELD_OFFS_ARG "field_offs"
@@ -43,7 +42,6 @@ int ice_timestamp_dynfield_offset = -1;static const char *const ice_valid_args[] = {ICE_SAFE_MODE_SUPPORT_ARG , -ICE_PIPELINE_MODE_SUPPORT_ARG ,ICE_PROTO_XTR_ARG ,ICE_FIELD_OFFS_ARG ,ICE_FIELD_NAME_ARG ,
@@ -2103,11 +2101,6 @@ static int ice_parse_devargs(struct rte_eth_dev *dev)if (ret) goto bail; - ret =rte_kvargs_process (kvlist,ICE_PIPELINE_MODE_SUPPORT_ARG , - &parse_bool, &ad->devargs.pipe_mode_support); -if (ret) - goto bail; - ret =rte_kvargs_process (kvlist,ICE_DEFAULT_MAC_DISABLE , &parse_bool, &ad->devargs.default_mac_disable);if (ret)
@@ -6549,7 +6542,6 @@ RTE_PMD_REGISTER_PARAM_STRING(net_ice,ICE_HW_DEBUG_MASK_ARG "=0xXXX" ICE_PROTO_XTR_ARG "=[queue:]<vlan|ipv4|ipv6|ipv6_flow|tcp|ip_offset>" ICE_SAFE_MODE_SUPPORT_ARG "=<0|1>" -ICE_PIPELINE_MODE_SUPPORT_ARG "=<0|1>" ICE_DEFAULT_MAC_DISABLE "=<0|1>" ICE_RX_LOW_LATENCY_ARG "=<0|1>");
drivers/net/ice/ice_ethdev.h +0 -2
@@ -542,7 +542,6 @@ struct ice_pf {struct ice_flow_list flow_list;rte_spinlock_t flow_ops_lock;struct ice_parser_list rss_parser_list; -struct ice_parser_list perm_parser_list;struct ice_parser_list dist_parser_list;bool init_link_up;uint64_t old_rx_bytes;
@@ -563,7 +562,6 @@ struct ice_devargs {int rx_low_latency;int safe_mode_support;uint8_t proto_xtr_dflt; -int pipe_mode_support;uint8_t default_mac_disable;uint8_t proto_xtr[ICE_MAX_QUEUE_NUM ];uint8_t pin_idx;
drivers/net/ice/ice_fdir_filter.c +1 -1
@@ -2467,7 +2467,7 @@ ice_fdir_parse(struct ice_adapter *ad, item =ice_search_pattern_match_item (ad, pattern, array, array_len, error); -if (!ad->devargs.pipe_mode_support && priority >=1 ) +if (priority >=1 )return -rte_errno;if (!item)
drivers/net/ice/ice_generic_flow.c +35 -85
183 lines not on this page · raw message
drivers/net/ice/ice_generic_flow.h +2 -4
@@ -418,15 +418,13 @@ enum ice_flow_engine_type { };/** -* classification stages. -* for non-pipeline mode, we have two classification stages: Distributor/RSS -* for pipeline-mode we have three classification stages: +* Classification stages. +* We have two classification stages: Distributor/RSS * Permission/Distributor/RSS */ enum ice_flow_classification_stage {ICE_FLOW_STAGE_NONE =0 ,ICE_FLOW_STAGE_RSS , -ICE_FLOW_STAGE_PERMISSION ,ICE_FLOW_STAGE_DISTRIBUTOR ,ICE_FLOW_STAGE_MAX , };
drivers/net/ice/ice_switch_filter.c +2 -116
147 lines not on this page · raw message
Signature · 1 line
2.31.1
PATCH 2/2 net/ice: map group to pipeline stage
In reply to Qi ZhangMapping rte_flow_attr->group to a specific hardware stage.
Group 0 -> switch filter
Group 1 -> acl filter
Group 2 -> fdir filter
For RSS, it will only be selected if there is a RTE_FLOW_ACTION_RSS action target no queue group and the group ID is ignored.
Since each flow parser will be selected based on the group, there is no need to maintain a separate 'parser list' or related APIs for registering/unregistering parsers.
--- drivers/net/ice/ice_acl_filter.c | 13 +- drivers/net/ice/ice_ethdev.h | 2 - drivers/net/ice/ice_fdir_filter.c | 19 +-- drivers/net/ice/ice_generic_flow.c | 187 +++++++--------------------- drivers/net/ice/ice_generic_flow.h | 9 +- drivers/net/ice/ice_hash.c | 19 +-- drivers/net/ice/ice_switch_filter.c | 13 +- 7 files changed, 61 insertions(+), 201 deletions(-)
drivers/net/ice/ice_acl_filter.c +2 -11
@@ -41,8 +41,6 @@ ICE_ACL_INSET_ETH_IPV4 | \ ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT) -static struct ice_flow_parser ice_acl_parser; - struct acl_rule { enum ice_fltr_ptype flow_type; uint64_t entry_id[4];
@@ -993,7 +991,6 @@ ice_acl_init(struct ice_adapter *ad)int ret =0 ;struct ice_pf *pf = &ad->pf;struct ice_hw *hw =ICE_PF_TO_HW (pf); -struct ice_flow_parser *parser = &ice_acl_parser;if (!ad->hw.dcf_enabled)return 0 ;
@@ -1013,11 +1010,7 @@ ice_acl_init(struct ice_adapter *ad)if (ret)return ret; - ret =ice_acl_prof_init (pf); -if (ret) -return ret; - -return ice_register_parser (parser, ad); +return ice_acl_prof_init (pf); } static void
@@ -1040,10 +1033,8 @@ ice_acl_uninit(struct ice_adapter *ad) {struct ice_pf *pf = &ad->pf;struct ice_hw *hw =ICE_PF_TO_HW (pf); -struct ice_flow_parser *parser = &ice_acl_parser;if (ad->hw.dcf_enabled) { -ice_unregister_parser (parser, ad);ice_deinit_acl (pf);ice_acl_prof_free (hw); }
@@ -1059,7 +1050,7 @@ ice_flow_engine ice_acl_engine = { .type = ICE_FLOW_ENGINE_ACL, }; -static struct +struct ice_flow_parser ice_acl_parser = { .engine = &ice_acl_engine, .array = ice_acl_pattern,
drivers/net/ice/ice_ethdev.h +0 -2
@@ -541,8 +541,6 @@ struct ice_pf {bool adapter_stopped;struct ice_flow_list flow_list;rte_spinlock_t flow_ops_lock; -struct ice_parser_list rss_parser_list; -struct ice_parser_list dist_parser_list;bool init_link_up;uint64_t old_rx_bytes;uint64_t old_tx_bytes;
drivers/net/ice/ice_fdir_filter.c +2 -17
@@ -137,8 +137,6 @@ static struct ice_pattern_match_item ice_fdir_pattern_list[] = { {pattern_eth_ipv6_gtpu_eh, ICE_FDIR_INSET_IPV6_GTPU_EH, ICE_FDIR_INSET_IPV6_GTPU_EH, ICE_INSET_NONE}, }; -static struct ice_flow_parser ice_fdir_parser; -static int ice_fdir_is_tunnel_profile (enum ice_fdir_tunnel_type tunnel_type);
@@ -1147,34 +1145,21 @@ static int ice_fdir_init(struct ice_adapter *ad) {struct ice_pf *pf = &ad->pf; -struct ice_flow_parser *parser; -int ret;if (ad->hw.dcf_enabled)return 0 ; - ret =ice_fdir_setup (pf); -if (ret) -return ret; - - parser = &ice_fdir_parser; - -return ice_register_parser (parser, ad); +return ice_fdir_setup (pf); }static void ice_fdir_uninit (struct ice_adapter *ad) { -struct ice_flow_parser *parser;struct ice_pf *pf = &ad->pf;if (ad->hw.dcf_enabled)return ; - parser = &ice_fdir_parser; - -ice_unregister_parser (parser, ad); -ice_fdir_teardown (pf); }
@@ -2510,7 +2495,7 @@ ice_fdir_parse(struct ice_adapter *ad,return ret; } -static struct ice_flow_parser ice_fdir_parser = { +struct ice_flow_parser ice_fdir_parser = { .engine = &ice_fdir_engine, .array = ice_fdir_pattern_list, .array_len =RTE_DIM (ice_fdir_pattern_list),
drivers/net/ice/ice_generic_flow.c +43 -144
262 lines not on this page · raw message
drivers/net/ice/ice_generic_flow.h +5 -4
@@ -515,10 +515,6 @@ struct ice_flow_parser_node {void ice_register_flow_engine (struct ice_flow_engine *engine);int ice_flow_init (struct ice_adapter *ad);void ice_flow_uninit (struct ice_adapter *ad); -int ice_register_parser (struct ice_flow_parser *parser, -struct ice_adapter *ad); -void ice_unregister_parser (struct ice_flow_parser *parser, -struct ice_adapter *ad);struct ice_pattern_match_item * ice_search_pattern_match_item(struct ice_adapter *ad, const struct rte_flow_item pattern[],
@@ -528,4 +524,9 @@ ice_search_pattern_match_item(struct ice_adapter *ad,int ice_flow_redirect (struct ice_adapter *ad,struct ice_flow_redirect *rd); + +extern struct ice_flow_parser ice_switch_parser; +extern struct ice_flow_parser ice_acl_parser; +extern struct ice_flow_parser ice_fdir_parser; +extern struct ice_flow_parser ice_hash_parser;#endif
drivers/net/ice/ice_hash.c +4 -15
@@ -572,7 +572,7 @@ static struct ice_flow_engine ice_hash_engine = { };/* Register parser for os package. */ -static struct ice_flow_parser ice_hash_parser = { +struct ice_flow_parser ice_hash_parser = { .engine = &ice_hash_engine, .array = ice_hash_pattern_list, .array_len =RTE_DIM (ice_hash_pattern_list),
@@ -587,16 +587,9 @@ RTE_INIT(ice_hash_engine_init) }static int -ice_hash_init (struct ice_adapter *ad) +ice_hash_init(struct ice_adapter *ad __rte_unused) { -struct ice_flow_parser *parser =NULL ; - -if (ad->hw.dcf_enabled) -return 0 ; - - parser = &ice_hash_parser; - -return ice_register_parser (parser, ad); +return 0 ; } static int
@@ -1442,12 +1435,8 @@ ice_hash_destroy(struct ice_adapter *ad, }static void -ice_hash_uninit (struct ice_adapter *ad) +ice_hash_uninit(struct ice_adapter *ad __rte_unused) { -if (ad->hw.dcf_enabled) -return ; - -ice_unregister_parser (&ice_hash_parser, ad); } static void
drivers/net/ice/ice_switch_filter.c +5 -8
@@ -201,8 +201,6 @@ struct ice_switch_filter_conf {struct ice_adv_rule_info rule_info; }; -static struct ice_flow_parser ice_switch_dist_parser; -static struct ice_pattern_match_item ice_switch_pattern_dist_list[] = { {pattern_any,ICE_INSET_NONE ,ICE_INSET_NONE ,ICE_INSET_NONE },
@@ -2052,15 +2050,14 @@ ice_switch_redirect(struct ice_adapter *ad, }static int -ice_switch_init (struct ice_adapter *ad) +ice_switch_init(struct ice_adapter *ad __rte_unused) { -return ice_register_parser (&ice_switch_dist_parser, ad); +return 0 ; }static void -ice_switch_uninit (struct ice_adapter *ad) +ice_switch_uninit(struct ice_adapter *ad __rte_unused) { -ice_unregister_parser (&ice_switch_dist_parser, ad); } static struct
@@ -2075,8 +2072,8 @@ ice_flow_engine ice_switch_engine = { .type = ICE_FLOW_ENGINE_SWITCH, }; -static struct -ice_flow_parser ice_switch_dist_parser = { +struct +ice_flow_parser ice_switch_parser = { .engine = &ice_switch_engine, .array = ice_switch_pattern_dist_list, .array_len =RTE_DIM (ice_switch_pattern_dist_list),
Signature · 1 line
2.31.1
v2 cover refactor rte_flow
In reply to Qi Zhang1. remove pipeline mode
2. apply group to hardware pipeline stage static mapping
v2:
- fix segment fault when an unintialized engine has been selected.
Qi Zhang (2):
net/ice: remove pipeline mode
net/ice: map group to pipeline stage
doc/guides/nics/ice.rst | 19 --- drivers/net/ice/ice_acl_filter.c | 13 +- drivers/net/ice/ice_ethdev.c | 8 - drivers/net/ice/ice_ethdev.h | 4 - drivers/net/ice/ice_fdir_filter.c | 21 +-- drivers/net/ice/ice_generic_flow.c | 252 ++++++---------------------- drivers/net/ice/ice_generic_flow.h | 15 +- drivers/net/ice/ice_hash.c | 19 +-- drivers/net/ice/ice_switch_filter.c | 127 +------------- 9 files changed, 72 insertions(+), 406 deletions(-)
Signature · 1 line
2.31.1
PATCH v2 1/2 net/ice: remove pipeline mode
This marks the initial phase of refactoring the ice rte_flow implementation.
The combination of switch and fdir rules within the same syntax has led to inconvenient user experiences. Naturally, the switch filter and fdir filter represent distinct pipeline stages with differing hardware capabilities.
To address this, we have made the decision to assign each stage to a separate rte_flow group. This will allow users to clearly specify their intentions when creating a rule. Consequently, the need for a pipeline mode can be removed.
--- doc/guides/nics/ice.rst | 19 ----- drivers/net/ice/ice_ethdev.c | 8 -- drivers/net/ice/ice_ethdev.h | 2 - drivers/net/ice/ice_fdir_filter.c | 2 +- drivers/net/ice/ice_generic_flow.c | 120 ++++++++-------------------- drivers/net/ice/ice_generic_flow.h | 6 +- drivers/net/ice/ice_switch_filter.c | 118 +-------------------------- 7 files changed, 40 insertions(+), 235 deletions(-)
doc/guides/nics/ice.rst +0 -19
@@ -90,25 +90,6 @@ Runtime Configuration NOTE: In Safe mode, only very limited features are available, features like RSS, checksum, fdir, tunneling ... are all disabled. -- ``Generic Flow Pipeline Mode Support`` (default ``0``) - - In pipeline mode, a flow can be set at one specific stage by setting parameter - ``priority``. Currently, we support two stages: priority = 0 or !0. Flows with - priority 0 located at the first pipeline stage which typically be used as a firewall - to drop the packet on a blocklist(we called it permission stage). At this stage, - flow rules are created for the device's exact match engine: switch. Flows with priority - !0 located at the second stage, typically packets are classified here and be steered to - specific queue or queue group (we called it distribution stage), At this stage, flow - rules are created for device's flow director engine. - For none-pipeline mode, ``priority`` is ignored, a flow rule can be created as a flow director - rule or a switch rule depends on its pattern/action and the resource allocation situation, - all flows are virtually at the same pipeline stage. - By default, generic flow API is enabled in none-pipeline mode, user can choose to - use pipeline mode by setting ``devargs`` parameter ``pipeline-mode-support``, - for example:: - - -a 80:00.0,pipeline-mode-support=1 - - ``Default MAC Disable`` (default ``0``) Disable the default MAC make the device drop all packets by default,
drivers/net/ice/ice_ethdev.c +0 -8
@@ -27,7 +27,6 @@/* devargs */ #define ICE_SAFE_MODE_SUPPORT_ARG "safe-mode-support" -#define ICE_PIPELINE_MODE_SUPPORT_ARG "pipeline-mode-support"#define ICE_DEFAULT_MAC_DISABLE "default-mac-disable"#define ICE_PROTO_XTR_ARG "proto_xtr"#define ICE_FIELD_OFFS_ARG "field_offs"
@@ -43,7 +42,6 @@ int ice_timestamp_dynfield_offset = -1;static const char *const ice_valid_args[] = {ICE_SAFE_MODE_SUPPORT_ARG , -ICE_PIPELINE_MODE_SUPPORT_ARG ,ICE_PROTO_XTR_ARG ,ICE_FIELD_OFFS_ARG ,ICE_FIELD_NAME_ARG ,
@@ -2103,11 +2101,6 @@ static int ice_parse_devargs(struct rte_eth_dev *dev)if (ret) goto bail; - ret =rte_kvargs_process (kvlist,ICE_PIPELINE_MODE_SUPPORT_ARG , - &parse_bool, &ad->devargs.pipe_mode_support); -if (ret) - goto bail; - ret =rte_kvargs_process (kvlist,ICE_DEFAULT_MAC_DISABLE , &parse_bool, &ad->devargs.default_mac_disable);if (ret)
@@ -6549,7 +6542,6 @@ RTE_PMD_REGISTER_PARAM_STRING(net_ice,ICE_HW_DEBUG_MASK_ARG "=0xXXX" ICE_PROTO_XTR_ARG "=[queue:]<vlan|ipv4|ipv6|ipv6_flow|tcp|ip_offset>" ICE_SAFE_MODE_SUPPORT_ARG "=<0|1>" -ICE_PIPELINE_MODE_SUPPORT_ARG "=<0|1>" ICE_DEFAULT_MAC_DISABLE "=<0|1>" ICE_RX_LOW_LATENCY_ARG "=<0|1>");
drivers/net/ice/ice_ethdev.h +0 -2
@@ -542,7 +542,6 @@ struct ice_pf {struct ice_flow_list flow_list;rte_spinlock_t flow_ops_lock;struct ice_parser_list rss_parser_list; -struct ice_parser_list perm_parser_list;struct ice_parser_list dist_parser_list;bool init_link_up;uint64_t old_rx_bytes;
@@ -563,7 +562,6 @@ struct ice_devargs {int rx_low_latency;int safe_mode_support;uint8_t proto_xtr_dflt; -int pipe_mode_support;uint8_t default_mac_disable;uint8_t proto_xtr[ICE_MAX_QUEUE_NUM ];uint8_t pin_idx;
drivers/net/ice/ice_fdir_filter.c +1 -1
@@ -2467,7 +2467,7 @@ ice_fdir_parse(struct ice_adapter *ad, item =ice_search_pattern_match_item (ad, pattern, array, array_len, error); -if (!ad->devargs.pipe_mode_support && priority >=1 ) +if (priority >=1 )return -rte_errno;if (!item)
drivers/net/ice/ice_generic_flow.c +35 -85
183 lines not on this page · raw message
drivers/net/ice/ice_generic_flow.h +2 -4
@@ -418,15 +418,13 @@ enum ice_flow_engine_type { };/** -* classification stages. -* for non-pipeline mode, we have two classification stages: Distributor/RSS -* for pipeline-mode we have three classification stages: +* Classification stages. +* We have two classification stages: Distributor/RSS * Permission/Distributor/RSS */ enum ice_flow_classification_stage {ICE_FLOW_STAGE_NONE =0 ,ICE_FLOW_STAGE_RSS , -ICE_FLOW_STAGE_PERMISSION ,ICE_FLOW_STAGE_DISTRIBUTOR ,ICE_FLOW_STAGE_MAX , };
drivers/net/ice/ice_switch_filter.c +2 -116
147 lines not on this page · raw message
Signature · 1 line
2.31.1
PATCH v2 2/2 net/ice: map group to pipeline stage
In reply to Qi ZhangMapping rte_flow_attr->group to a specific hardware stage.
Group 0 -> switch filter
Group 1 -> acl filter
Group 2 -> fdir filter
For RSS, it will only be selected if there is a RTE_FLOW_ACTION_RSS action target no queue group and the group ID is ignored.
Since each flow parser will be selected based on the group, there is no need to maintain a separate 'parser list' or related APIs for registering/unregistering parsers.
--- drivers/net/ice/ice_acl_filter.c | 13 +- drivers/net/ice/ice_ethdev.h | 2 - drivers/net/ice/ice_fdir_filter.c | 19 +-- drivers/net/ice/ice_generic_flow.c | 188 +++++++--------------------- drivers/net/ice/ice_generic_flow.h | 9 +- drivers/net/ice/ice_hash.c | 19 +-- drivers/net/ice/ice_switch_filter.c | 13 +- 7 files changed, 62 insertions(+), 201 deletions(-)
drivers/net/ice/ice_acl_filter.c +2 -11
@@ -41,8 +41,6 @@ ICE_ACL_INSET_ETH_IPV4 | \ ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT) -static struct ice_flow_parser ice_acl_parser; - struct acl_rule { enum ice_fltr_ptype flow_type; uint64_t entry_id[4];
@@ -993,7 +991,6 @@ ice_acl_init(struct ice_adapter *ad)int ret =0 ;struct ice_pf *pf = &ad->pf;struct ice_hw *hw =ICE_PF_TO_HW (pf); -struct ice_flow_parser *parser = &ice_acl_parser;if (!ad->hw.dcf_enabled)return 0 ;
@@ -1013,11 +1010,7 @@ ice_acl_init(struct ice_adapter *ad)if (ret)return ret; - ret =ice_acl_prof_init (pf); -if (ret) -return ret; - -return ice_register_parser (parser, ad); +return ice_acl_prof_init (pf); } static void
@@ -1040,10 +1033,8 @@ ice_acl_uninit(struct ice_adapter *ad) {struct ice_pf *pf = &ad->pf;struct ice_hw *hw =ICE_PF_TO_HW (pf); -struct ice_flow_parser *parser = &ice_acl_parser;if (ad->hw.dcf_enabled) { -ice_unregister_parser (parser, ad);ice_deinit_acl (pf);ice_acl_prof_free (hw); }
@@ -1059,7 +1050,7 @@ ice_flow_engine ice_acl_engine = { .type = ICE_FLOW_ENGINE_ACL, }; -static struct +struct ice_flow_parser ice_acl_parser = { .engine = &ice_acl_engine, .array = ice_acl_pattern,
drivers/net/ice/ice_ethdev.h +0 -2
@@ -541,8 +541,6 @@ struct ice_pf {bool adapter_stopped;struct ice_flow_list flow_list;rte_spinlock_t flow_ops_lock; -struct ice_parser_list rss_parser_list; -struct ice_parser_list dist_parser_list;bool init_link_up;uint64_t old_rx_bytes;uint64_t old_tx_bytes;
drivers/net/ice/ice_fdir_filter.c +2 -17
@@ -137,8 +137,6 @@ static struct ice_pattern_match_item ice_fdir_pattern_list[] = { {pattern_eth_ipv6_gtpu_eh, ICE_FDIR_INSET_IPV6_GTPU_EH, ICE_FDIR_INSET_IPV6_GTPU_EH, ICE_INSET_NONE}, }; -static struct ice_flow_parser ice_fdir_parser; -static int ice_fdir_is_tunnel_profile (enum ice_fdir_tunnel_type tunnel_type);
@@ -1147,34 +1145,21 @@ static int ice_fdir_init(struct ice_adapter *ad) {struct ice_pf *pf = &ad->pf; -struct ice_flow_parser *parser; -int ret;if (ad->hw.dcf_enabled)return 0 ; - ret =ice_fdir_setup (pf); -if (ret) -return ret; - - parser = &ice_fdir_parser; - -return ice_register_parser (parser, ad); +return ice_fdir_setup (pf); }static void ice_fdir_uninit (struct ice_adapter *ad) { -struct ice_flow_parser *parser;struct ice_pf *pf = &ad->pf;if (ad->hw.dcf_enabled)return ; - parser = &ice_fdir_parser; - -ice_unregister_parser (parser, ad); -ice_fdir_teardown (pf); }
@@ -2510,7 +2495,7 @@ ice_fdir_parse(struct ice_adapter *ad,return ret; } -static struct ice_flow_parser ice_fdir_parser = { +struct ice_flow_parser ice_fdir_parser = { .engine = &ice_fdir_engine, .array = ice_fdir_pattern_list, .array_len =RTE_DIM (ice_fdir_pattern_list),
drivers/net/ice/ice_generic_flow.c +44 -144
263 lines not on this page · raw message
drivers/net/ice/ice_generic_flow.h +5 -4
@@ -515,10 +515,6 @@ struct ice_flow_parser_node {void ice_register_flow_engine (struct ice_flow_engine *engine);int ice_flow_init (struct ice_adapter *ad);void ice_flow_uninit (struct ice_adapter *ad); -int ice_register_parser (struct ice_flow_parser *parser, -struct ice_adapter *ad); -void ice_unregister_parser (struct ice_flow_parser *parser, -struct ice_adapter *ad);struct ice_pattern_match_item * ice_search_pattern_match_item(struct ice_adapter *ad, const struct rte_flow_item pattern[],
@@ -528,4 +524,9 @@ ice_search_pattern_match_item(struct ice_adapter *ad,int ice_flow_redirect (struct ice_adapter *ad,struct ice_flow_redirect *rd); + +extern struct ice_flow_parser ice_switch_parser; +extern struct ice_flow_parser ice_acl_parser; +extern struct ice_flow_parser ice_fdir_parser; +extern struct ice_flow_parser ice_hash_parser;#endif
drivers/net/ice/ice_hash.c +4 -15
@@ -572,7 +572,7 @@ static struct ice_flow_engine ice_hash_engine = { };/* Register parser for os package. */ -static struct ice_flow_parser ice_hash_parser = { +struct ice_flow_parser ice_hash_parser = { .engine = &ice_hash_engine, .array = ice_hash_pattern_list, .array_len =RTE_DIM (ice_hash_pattern_list),
@@ -587,16 +587,9 @@ RTE_INIT(ice_hash_engine_init) }static int -ice_hash_init (struct ice_adapter *ad) +ice_hash_init(struct ice_adapter *ad __rte_unused) { -struct ice_flow_parser *parser =NULL ; - -if (ad->hw.dcf_enabled) -return 0 ; - - parser = &ice_hash_parser; - -return ice_register_parser (parser, ad); +return 0 ; } static int
@@ -1442,12 +1435,8 @@ ice_hash_destroy(struct ice_adapter *ad, }static void -ice_hash_uninit (struct ice_adapter *ad) +ice_hash_uninit(struct ice_adapter *ad __rte_unused) { -if (ad->hw.dcf_enabled) -return ; - -ice_unregister_parser (&ice_hash_parser, ad); } static void
drivers/net/ice/ice_switch_filter.c +5 -8
@@ -201,8 +201,6 @@ struct ice_switch_filter_conf {struct ice_adv_rule_info rule_info; }; -static struct ice_flow_parser ice_switch_dist_parser; -static struct ice_pattern_match_item ice_switch_pattern_dist_list[] = { {pattern_any,ICE_INSET_NONE ,ICE_INSET_NONE ,ICE_INSET_NONE },
@@ -2052,15 +2050,14 @@ ice_switch_redirect(struct ice_adapter *ad, }static int -ice_switch_init (struct ice_adapter *ad) +ice_switch_init(struct ice_adapter *ad __rte_unused) { -return ice_register_parser (&ice_switch_dist_parser, ad); +return 0 ; }static void -ice_switch_uninit (struct ice_adapter *ad) +ice_switch_uninit(struct ice_adapter *ad __rte_unused) { -ice_unregister_parser (&ice_switch_dist_parser, ad); } static struct
@@ -2075,8 +2072,8 @@ ice_flow_engine ice_switch_engine = { .type = ICE_FLOW_ENGINE_SWITCH, }; -static struct -ice_flow_parser ice_switch_dist_parser = { +struct +ice_flow_parser ice_switch_parser = { .engine = &ice_switch_engine, .array = ice_switch_pattern_dist_list, .array_len =RTE_DIM (ice_switch_pattern_dist_list),
Signature · 1 line
2.31.1
v3 cover refactor rte_flow
In reply to Qi Zhang1. remove pipeline mode
2. apply group to hardware pipeline stage static mapping
3. add genenic flow document
v3:
- fix the issue when acl=off on dcf mode
- refine the disabled engine handling
- unified the supported pattern variable name
- add document
v2:
- fix segment fault when an unintialized engine has been selected.
Qi Zhang (5):
net/ice: remove pipeline mode
net/ice: refine flow engine disabling
net/ice: map group to pipeline stage
net/ice: refine supported flow pattern name
doc: add generic flow doc for ice PMD
doc/guides/nics/ice.rst | 64 +++++-- drivers/net/ice/ice_acl_filter.c | 22 +-- drivers/net/ice/ice_dcf_parent.c | 3 + drivers/net/ice/ice_ethdev.c | 9 +- drivers/net/ice/ice_ethdev.h | 4 - drivers/net/ice/ice_fdir_filter.c | 30 +-- drivers/net/ice/ice_generic_flow.c | 284 +++++++--------------------- drivers/net/ice/ice_generic_flow.h | 15 +- drivers/net/ice/ice_hash.c | 19 +- drivers/net/ice/ice_switch_filter.c | 133 +------------ 10 files changed, 146 insertions(+), 437 deletions(-)
Signature · 1 line
2.31.1
PATCH v3 1/5 net/ice: remove pipeline mode
This marks the initial phase of refactoring the ice rte_flow implementation.
The combination of switch and fdir rules within the same syntax has led to inconvenient user experiences. Naturally, the switch filter and fdir filter represent distinct pipeline stages with differing hardware capabilities.
To address this, we have made the decision to assign each stage to a separate rte_flow group. This will allow users to clearly specify their intentions when creating a rule. Consequently, the need for a pipeline mode can be removed.
--- doc/guides/nics/ice.rst | 19 ----- drivers/net/ice/ice_ethdev.c | 8 -- drivers/net/ice/ice_ethdev.h | 2 - drivers/net/ice/ice_fdir_filter.c | 2 +- drivers/net/ice/ice_generic_flow.c | 120 ++++++++-------------------- drivers/net/ice/ice_generic_flow.h | 6 +- drivers/net/ice/ice_switch_filter.c | 118 +-------------------------- 7 files changed, 40 insertions(+), 235 deletions(-)
doc/guides/nics/ice.rst +0 -19
@@ -90,25 +90,6 @@ Runtime Configuration NOTE: In Safe mode, only very limited features are available, features like RSS, checksum, fdir, tunneling ... are all disabled. -- ``Generic Flow Pipeline Mode Support`` (default ``0``) - - In pipeline mode, a flow can be set at one specific stage by setting parameter - ``priority``. Currently, we support two stages: priority = 0 or !0. Flows with - priority 0 located at the first pipeline stage which typically be used as a firewall - to drop the packet on a blocklist(we called it permission stage). At this stage, - flow rules are created for the device's exact match engine: switch. Flows with priority - !0 located at the second stage, typically packets are classified here and be steered to - specific queue or queue group (we called it distribution stage), At this stage, flow - rules are created for device's flow director engine. - For none-pipeline mode, ``priority`` is ignored, a flow rule can be created as a flow director - rule or a switch rule depends on its pattern/action and the resource allocation situation, - all flows are virtually at the same pipeline stage. - By default, generic flow API is enabled in none-pipeline mode, user can choose to - use pipeline mode by setting ``devargs`` parameter ``pipeline-mode-support``, - for example:: - - -a 80:00.0,pipeline-mode-support=1 - - ``Default MAC Disable`` (default ``0``) Disable the default MAC make the device drop all packets by default,
drivers/net/ice/ice_ethdev.c +0 -8
@@ -27,7 +27,6 @@/* devargs */ #define ICE_SAFE_MODE_SUPPORT_ARG "safe-mode-support" -#define ICE_PIPELINE_MODE_SUPPORT_ARG "pipeline-mode-support"#define ICE_DEFAULT_MAC_DISABLE "default-mac-disable"#define ICE_PROTO_XTR_ARG "proto_xtr"#define ICE_FIELD_OFFS_ARG "field_offs"
@@ -43,7 +42,6 @@ int ice_timestamp_dynfield_offset = -1;static const char *const ice_valid_args[] = {ICE_SAFE_MODE_SUPPORT_ARG , -ICE_PIPELINE_MODE_SUPPORT_ARG ,ICE_PROTO_XTR_ARG ,ICE_FIELD_OFFS_ARG ,ICE_FIELD_NAME_ARG ,
@@ -2103,11 +2101,6 @@ static int ice_parse_devargs(struct rte_eth_dev *dev)if (ret) goto bail; - ret =rte_kvargs_process (kvlist,ICE_PIPELINE_MODE_SUPPORT_ARG , - &parse_bool, &ad->devargs.pipe_mode_support); -if (ret) - goto bail; - ret =rte_kvargs_process (kvlist,ICE_DEFAULT_MAC_DISABLE , &parse_bool, &ad->devargs.default_mac_disable);if (ret)
@@ -6549,7 +6542,6 @@ RTE_PMD_REGISTER_PARAM_STRING(net_ice,ICE_HW_DEBUG_MASK_ARG "=0xXXX" ICE_PROTO_XTR_ARG "=[queue:]<vlan|ipv4|ipv6|ipv6_flow|tcp|ip_offset>" ICE_SAFE_MODE_SUPPORT_ARG "=<0|1>" -ICE_PIPELINE_MODE_SUPPORT_ARG "=<0|1>" ICE_DEFAULT_MAC_DISABLE "=<0|1>" ICE_RX_LOW_LATENCY_ARG "=<0|1>");
drivers/net/ice/ice_ethdev.h +0 -2
@@ -542,7 +542,6 @@ struct ice_pf {struct ice_flow_list flow_list;rte_spinlock_t flow_ops_lock;struct ice_parser_list rss_parser_list; -struct ice_parser_list perm_parser_list;struct ice_parser_list dist_parser_list;bool init_link_up;uint64_t old_rx_bytes;
@@ -563,7 +562,6 @@ struct ice_devargs {int rx_low_latency;int safe_mode_support;uint8_t proto_xtr_dflt; -int pipe_mode_support;uint8_t default_mac_disable;uint8_t proto_xtr[ICE_MAX_QUEUE_NUM ];uint8_t pin_idx;
drivers/net/ice/ice_fdir_filter.c +1 -1
@@ -2467,7 +2467,7 @@ ice_fdir_parse(struct ice_adapter *ad, item =ice_search_pattern_match_item (ad, pattern, array, array_len, error); -if (!ad->devargs.pipe_mode_support && priority >=1 ) +if (priority >=1 )return -rte_errno;if (!item)
drivers/net/ice/ice_generic_flow.c +35 -85
183 lines not on this page · raw message
drivers/net/ice/ice_generic_flow.h +2 -4
@@ -418,15 +418,13 @@ enum ice_flow_engine_type { };/** -* classification stages. -* for non-pipeline mode, we have two classification stages: Distributor/RSS -* for pipeline-mode we have three classification stages: +* Classification stages. +* We have two classification stages: Distributor/RSS * Permission/Distributor/RSS */ enum ice_flow_classification_stage {ICE_FLOW_STAGE_NONE =0 ,ICE_FLOW_STAGE_RSS , -ICE_FLOW_STAGE_PERMISSION ,ICE_FLOW_STAGE_DISTRIBUTOR ,ICE_FLOW_STAGE_MAX , };
drivers/net/ice/ice_switch_filter.c +2 -116
147 lines not on this page · raw message
Signature · 1 line
2.31.1
PATCH v3 2/5 net/ice: refine flow engine disabling
In reply to Qi ZhangOnly use "disable_engine_mask" for flow engine disabling
In PF mode, only ACL engine will be disabled. In DCF mode, FDIR and HASH engine will be disabled. In DCF mode with "acl=off", ACL engine will also be disabled.
--- drivers/net/ice/ice_acl_filter.c | 3 --- drivers/net/ice/ice_dcf_parent.c | 3 +++ drivers/net/ice/ice_ethdev.c | 1 + drivers/net/ice/ice_fdir_filter.c | 3 --- drivers/net/ice/ice_hash.c | 3 --- 5 files changed, 4 insertions(+), 9 deletions(-)
drivers/net/ice/ice_acl_filter.c +0 -3
@@ -995,9 +995,6 @@ ice_acl_init(struct ice_adapter *ad)struct ice_hw *hw =ICE_PF_TO_HW (pf);struct ice_flow_parser *parser = &ice_acl_parser; -if (!ad->hw.dcf_enabled) -return 0 ; - ret =ice_acl_prof_alloc (hw);if (ret) { PMD_DRV_LOG(ERR, "Cannot allocate memory for "
drivers/net/ice/ice_dcf_parent.c +3 -0
@@ -475,6 +475,9 @@ ice_dcf_init_parent_adapter(struct rte_eth_dev *eth_dev)if (ice_devargs_check (eth_dev->device->devargs,ICE_DCF_DEVARG_ACL )) parent_adapter->disabled_engine_mask |=BIT (ICE_FLOW_ENGINE_ACL ); + parent_adapter->disabled_engine_mask |=BIT (ICE_FLOW_ENGINE_FDIR ); + parent_adapter->disabled_engine_mask |=BIT (ICE_FLOW_ENGINE_HASH ); + err =ice_flow_init (parent_adapter);if (err) {PMD_INIT_LOG (ERR ,"Failed to initialize flow" );
drivers/net/ice/ice_ethdev.c +1 -0
@@ -2442,6 +2442,7 @@ ice_dev_init(struct rte_eth_dev *dev) }if (!ad->is_safe_mode) { + ad->disabled_engine_mask |=BIT (ICE_FLOW_ENGINE_ACL ); ret =ice_flow_init (ad);if (ret) {PMD_INIT_LOG (ERR ,"Failed to initialize flow" );
drivers/net/ice/ice_fdir_filter.c +0 -3
@@ -1150,9 +1150,6 @@ ice_fdir_init(struct ice_adapter *ad)struct ice_flow_parser *parser;int ret; -if (ad->hw.dcf_enabled) -return 0 ; - ret =ice_fdir_setup (pf);if (ret)return ret;
drivers/net/ice/ice_hash.c +0 -3
@@ -591,9 +591,6 @@ ice_hash_init(struct ice_adapter *ad) {struct ice_flow_parser *parser =NULL ; -if (ad->hw.dcf_enabled) -return 0 ; - parser = &ice_hash_parser;return ice_register_parser (parser, ad);
Signature · 1 line
2.31.1
PATCH v3 3/5 net/ice: map group to pipeline stage
In reply to Qi ZhangMapping rte_flow_attr->group to a specific hardware stage.
Group 0 -> switch filter
Group 1 -> acl filter (dcf mode only)
Group 2 -> fdir filter (pf mode only)
For RSS, it will only be selected if there is a RTE_FLOW_ACTION_RSS action target no queue group and the group ID is ignored.
Since each flow parser will be selected based on the group, there is no need to maintain a separate 'parser list' or related APIs for registering/unregistering parsers.
--- drivers/net/ice/ice_acl_filter.c | 13 +- drivers/net/ice/ice_ethdev.h | 2 - drivers/net/ice/ice_fdir_filter.c | 19 +-- drivers/net/ice/ice_generic_flow.c | 220 ++++++++-------------------- drivers/net/ice/ice_generic_flow.h | 9 +- drivers/net/ice/ice_hash.c | 16 +- drivers/net/ice/ice_switch_filter.c | 13 +- 7 files changed, 78 insertions(+), 214 deletions(-)
drivers/net/ice/ice_acl_filter.c +2 -11
@@ -41,8 +41,6 @@ ICE_ACL_INSET_ETH_IPV4 | \ ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT) -static struct ice_flow_parser ice_acl_parser; - struct acl_rule { enum ice_fltr_ptype flow_type; uint64_t entry_id[4];
@@ -993,7 +991,6 @@ ice_acl_init(struct ice_adapter *ad)int ret =0 ;struct ice_pf *pf = &ad->pf;struct ice_hw *hw =ICE_PF_TO_HW (pf); -struct ice_flow_parser *parser = &ice_acl_parser; ret =ice_acl_prof_alloc (hw);if (ret) {
@@ -1010,11 +1007,7 @@ ice_acl_init(struct ice_adapter *ad)if (ret)return ret; - ret =ice_acl_prof_init (pf); -if (ret) -return ret; - -return ice_register_parser (parser, ad); +return ice_acl_prof_init (pf); } static void
@@ -1037,10 +1030,8 @@ ice_acl_uninit(struct ice_adapter *ad) {struct ice_pf *pf = &ad->pf;struct ice_hw *hw =ICE_PF_TO_HW (pf); -struct ice_flow_parser *parser = &ice_acl_parser;if (ad->hw.dcf_enabled) { -ice_unregister_parser (parser, ad);ice_deinit_acl (pf);ice_acl_prof_free (hw); }
@@ -1056,7 +1047,7 @@ ice_flow_engine ice_acl_engine = { .type = ICE_FLOW_ENGINE_ACL, }; -static struct +struct ice_flow_parser ice_acl_parser = { .engine = &ice_acl_engine, .array = ice_acl_pattern,
drivers/net/ice/ice_ethdev.h +0 -2
@@ -541,8 +541,6 @@ struct ice_pf {bool adapter_stopped;struct ice_flow_list flow_list;rte_spinlock_t flow_ops_lock; -struct ice_parser_list rss_parser_list; -struct ice_parser_list dist_parser_list;bool init_link_up;uint64_t old_rx_bytes;uint64_t old_tx_bytes;
drivers/net/ice/ice_fdir_filter.c +2 -17
@@ -137,8 +137,6 @@ static struct ice_pattern_match_item ice_fdir_pattern_list[] = { {pattern_eth_ipv6_gtpu_eh, ICE_FDIR_INSET_IPV6_GTPU_EH, ICE_FDIR_INSET_IPV6_GTPU_EH, ICE_INSET_NONE}, }; -static struct ice_flow_parser ice_fdir_parser; -static int ice_fdir_is_tunnel_profile (enum ice_fdir_tunnel_type tunnel_type);
@@ -1147,31 +1145,18 @@ static int ice_fdir_init(struct ice_adapter *ad) {struct ice_pf *pf = &ad->pf; -struct ice_flow_parser *parser; -int ret; - - ret =ice_fdir_setup (pf); -if (ret) -return ret; - - parser = &ice_fdir_parser; -return ice_register_parser (parser, ad); +return ice_fdir_setup (pf); }static void ice_fdir_uninit (struct ice_adapter *ad) { -struct ice_flow_parser *parser;struct ice_pf *pf = &ad->pf;if (ad->hw.dcf_enabled)return ; - parser = &ice_fdir_parser; - -ice_unregister_parser (parser, ad); -ice_fdir_teardown (pf); }
@@ -2507,7 +2492,7 @@ ice_fdir_parse(struct ice_adapter *ad,return ret; } -static struct ice_flow_parser ice_fdir_parser = { +struct ice_flow_parser ice_fdir_parser = { .engine = &ice_fdir_engine, .array = ice_fdir_pattern_list, .array_len =RTE_DIM (ice_fdir_pattern_list),
drivers/net/ice/ice_generic_flow.c +60 -160
295 lines not on this page · raw message
drivers/net/ice/ice_generic_flow.h +5 -4
@@ -515,10 +515,6 @@ struct ice_flow_parser_node {void ice_register_flow_engine (struct ice_flow_engine *engine);int ice_flow_init (struct ice_adapter *ad);void ice_flow_uninit (struct ice_adapter *ad); -int ice_register_parser (struct ice_flow_parser *parser, -struct ice_adapter *ad); -void ice_unregister_parser (struct ice_flow_parser *parser, -struct ice_adapter *ad);struct ice_pattern_match_item * ice_search_pattern_match_item(struct ice_adapter *ad, const struct rte_flow_item pattern[],
@@ -528,4 +524,9 @@ ice_search_pattern_match_item(struct ice_adapter *ad,int ice_flow_redirect (struct ice_adapter *ad,struct ice_flow_redirect *rd); + +extern struct ice_flow_parser ice_switch_parser; +extern struct ice_flow_parser ice_acl_parser; +extern struct ice_flow_parser ice_fdir_parser; +extern struct ice_flow_parser ice_hash_parser;#endif
drivers/net/ice/ice_hash.c +4 -12
@@ -572,7 +572,7 @@ static struct ice_flow_engine ice_hash_engine = { };/* Register parser for os package. */ -static struct ice_flow_parser ice_hash_parser = { +struct ice_flow_parser ice_hash_parser = { .engine = &ice_hash_engine, .array = ice_hash_pattern_list, .array_len =RTE_DIM (ice_hash_pattern_list),
@@ -587,13 +587,9 @@ RTE_INIT(ice_hash_engine_init) }static int -ice_hash_init (struct ice_adapter *ad) +ice_hash_init(struct ice_adapter *ad __rte_unused) { -struct ice_flow_parser *parser =NULL ; - - parser = &ice_hash_parser; - -return ice_register_parser (parser, ad); +return 0 ; } static int
@@ -1439,12 +1435,8 @@ ice_hash_destroy(struct ice_adapter *ad, }static void -ice_hash_uninit (struct ice_adapter *ad) +ice_hash_uninit(struct ice_adapter *ad __rte_unused) { -if (ad->hw.dcf_enabled) -return ; - -ice_unregister_parser (&ice_hash_parser, ad); } static void
drivers/net/ice/ice_switch_filter.c +5 -8
@@ -201,8 +201,6 @@ struct ice_switch_filter_conf {struct ice_adv_rule_info rule_info; }; -static struct ice_flow_parser ice_switch_dist_parser; -static struct ice_pattern_match_item ice_switch_pattern_dist_list[] = { {pattern_any,ICE_INSET_NONE ,ICE_INSET_NONE ,ICE_INSET_NONE },
@@ -2052,15 +2050,14 @@ ice_switch_redirect(struct ice_adapter *ad, }static int -ice_switch_init (struct ice_adapter *ad) +ice_switch_init(struct ice_adapter *ad __rte_unused) { -return ice_register_parser (&ice_switch_dist_parser, ad); +return 0 ; }static void -ice_switch_uninit (struct ice_adapter *ad) +ice_switch_uninit(struct ice_adapter *ad __rte_unused) { -ice_unregister_parser (&ice_switch_dist_parser, ad); } static struct
@@ -2075,8 +2072,8 @@ ice_flow_engine ice_switch_engine = { .type = ICE_FLOW_ENGINE_SWITCH, }; -static struct -ice_flow_parser ice_switch_dist_parser = { +struct +ice_flow_parser ice_switch_parser = { .engine = &ice_switch_engine, .array = ice_switch_pattern_dist_list, .array_len =RTE_DIM (ice_switch_pattern_dist_list),
Signature · 1 line
2.31.1
PATCH v3 4/5 net/ice: refine supported flow pattern name
In reply to Qi ZhangUnified the supported patten array name to flow
ice_<engine>_supported_pattern.
--- drivers/net/ice/ice_acl_filter.c | 6 +++--- drivers/net/ice/ice_fdir_filter.c | 6 +++--- drivers/net/ice/ice_switch_filter.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-)
drivers/net/ice/ice_acl_filter.c +3 -3
@@ -47,7 +47,7 @@ struct acl_rule { };static struct -ice_pattern_match_item ice_acl_pattern[] = { +ice_pattern_match_item ice_acl_supported_pattern[] = { {pattern_eth_ipv4,ICE_ACL_INSET_ETH_IPV4 ,ICE_INSET_NONE ,ICE_INSET_NONE }, {pattern_eth_ipv4_udp,ICE_ACL_INSET_ETH_IPV4_UDP ,ICE_INSET_NONE ,ICE_INSET_NONE }, {pattern_eth_ipv4_tcp,ICE_ACL_INSET_ETH_IPV4_TCP ,ICE_INSET_NONE ,ICE_INSET_NONE },
@@ -1050,8 +1050,8 @@ ice_flow_engine ice_acl_engine = {struct ice_flow_parser ice_acl_parser = { .engine = &ice_acl_engine, - .array = ice_acl_pattern, - .array_len =RTE_DIM (ice_acl_pattern), + .array = ice_acl_supported_pattern, + .array_len =RTE_DIM (ice_acl_supported_pattern), .parse_pattern_action = ice_acl_parse, .stage =ICE_FLOW_STAGE_DISTRIBUTOR , };
drivers/net/ice/ice_fdir_filter.c +3 -3
@@ -106,7 +106,7 @@ ICE_INSET_IPV6_SRC | ICE_INSET_IPV6_DST | \ ICE_INSET_NAT_T_ESP_SPI) -static struct ice_pattern_match_item ice_fdir_pattern_list[] = { +static struct ice_pattern_match_item ice_fdir_supported_pattern[] = { {pattern_raw,ICE_INSET_NONE ,ICE_INSET_NONE ,ICE_INSET_NONE }, {pattern_ethertype,ICE_FDIR_INSET_ETH ,ICE_INSET_NONE ,ICE_INSET_NONE }, {pattern_eth_ipv4,ICE_FDIR_INSET_ETH_IPV4 ,ICE_INSET_NONE ,ICE_INSET_NONE },
@@ -2494,8 +2494,8 @@ ice_fdir_parse(struct ice_adapter *ad,struct ice_flow_parser ice_fdir_parser = { .engine = &ice_fdir_engine, - .array = ice_fdir_pattern_list, - .array_len =RTE_DIM (ice_fdir_pattern_list), + .array = ice_fdir_supported_pattern, + .array_len =RTE_DIM (ice_fdir_supported_pattern), .parse_pattern_action = ice_fdir_parse, .stage =ICE_FLOW_STAGE_DISTRIBUTOR , };
drivers/net/ice/ice_switch_filter.c +3 -3
@@ -202,7 +202,7 @@ struct ice_switch_filter_conf { };static struct -ice_pattern_match_item ice_switch_pattern_dist_list[] = { +ice_pattern_match_item ice_switch_supported_pattern[] = { {pattern_any,ICE_INSET_NONE ,ICE_INSET_NONE ,ICE_INSET_NONE }, {pattern_ethertype,ICE_SW_INSET_ETHER ,ICE_INSET_NONE ,ICE_INSET_NONE }, {pattern_ethertype_vlan,ICE_SW_INSET_MAC_VLAN ,ICE_INSET_NONE ,ICE_INSET_NONE },
@@ -2075,8 +2075,8 @@ ice_flow_engine ice_switch_engine = {struct ice_flow_parser ice_switch_parser = { .engine = &ice_switch_engine, - .array = ice_switch_pattern_dist_list, - .array_len =RTE_DIM (ice_switch_pattern_dist_list), + .array = ice_switch_supported_pattern, + .array_len =RTE_DIM (ice_switch_supported_pattern), .parse_pattern_action = ice_switch_parse_pattern_action, .stage =ICE_FLOW_STAGE_DISTRIBUTOR , };
Signature · 1 line
2.31.1
PATCH v3 5/5 doc: add generic flow doc for ice PMD
In reply to Qi ZhangAdd some about document about the how to userte_flow on ice PMD.
--- doc/guides/nics/ice.rst | 45 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
doc/guides/nics/ice.rst +45 -0
@@ -301,6 +301,51 @@ The DCF PMD needs to advertise and acquire DCF capability which allows DCF to send AdminQ commands that it would like to execute over to the PF and receive responses for the same from PF. +Generic Flow Support +~~~~~~~~~~~~~~~~~~~~ + +The ice PMD provides support for the Generic Flow API (RTE_FLOW), enabling +users to offload various flow classification tasks to the E810 NIC. +The E810 NIC's packet processing pipeline consists of the following stages: + +Switch: Supports exact match and limited wildcard matching with a large flow +capacity. + +ACL: Supports wildcard matching with a smaller flow capacity (DCF mode only). + +FDIR: Supports exact match with a large flow capacity (PF mode only). + +Hash: Supports RSS (PF mode only) + +The ice PMD utilizes the ice_flow_engine structure to represent each of these +stages and leverages the rte_flow rule's ``group`` attribute for selecting the +appropriate engine for Switch, ACL, and FDIR operations: + +Group 0 maps to Switch +Group 1 maps to ACL +Group 2 maps to FDIR + +In the case of RSS, it will only be selected if a ``RTE_FLOW_ACTION_RSS`` action +is targeted to no queue group, and the group attribute is ignored. + +For each engine, a list of supported patterns is maintained in a global array +named ``ice_<engine>_supported_pattern``. The Ice PMD will reject any rule with +a pattern that is not included in the supported list. + +One notable feature is the ice PMD's ability to leverage the Raw pattern, +enabling protocol-agnostic flow offloading. Here is an example of creating +a rule that matches an IPv4 destination address of 1.2.3.4 and redirects it to +queue 3 using a raw pattern: + +flow create 0 ingress group 2 pattern raw \ +pattern spec \ +00000000000000000000000008004500001400004000401000000000000001020304 \ +pattern mask \ +000000000000000000000000000000000000000000000000000000000000ffffffff \ +end actions queue index 3 / mark id 3 / end + +Currently, raw pattern support is limited to the FDIR and Hash engines. + Additional Options ++++++++++++++++++
Signature · 1 line
2.31.1
v4 cover net/ice: refactor rte_flow
In reply to Qi Zhang1. remove pipeline mode
2. apply group to hardware pipeline stage static mapping
3. add genenic flow document
v4:
- fix error handling when target engine was disabled.
v3:
- fix the issue when acl=off on dcf mode
- refine the disabled engine handling
- unified the supported pattern variable name
- add document
v2:
- fix segment fault when an unintialized engine has been selected.
Qi Zhang (5):
net/ice: remove pipeline mode
net/ice: refine flow engine disabling
net/ice: map group to pipeline stage
net/ice: refine supported flow pattern name
doc: add generic flow doc for ice PMD
doc/guides/nics/ice.rst | 64 ++++-- drivers/net/ice/ice_acl_filter.c | 22 +- drivers/net/ice/ice_dcf_parent.c | 3 + drivers/net/ice/ice_ethdev.c | 9 +- drivers/net/ice/ice_ethdev.h | 4 - drivers/net/ice/ice_fdir_filter.c | 30 +-- drivers/net/ice/ice_generic_flow.c | 298 ++++++++-------------------- drivers/net/ice/ice_generic_flow.h | 15 +- drivers/net/ice/ice_hash.c | 19 +- drivers/net/ice/ice_switch_filter.c | 133 +------------ 10 files changed, 159 insertions(+), 438 deletions(-)
Signature · 1 line
2.31.1
PATCH v4 1/5 net/ice: remove pipeline mode
This marks the initial phase of refactoring the ice rte_flow implementation.
The combination of switch and fdir rules within the same syntax has led to inconvenient user experiences. Naturally, the switch filter and fdir filter represent distinct pipeline stages with differing hardware capabilities.
To address this, we have made the decision to assign each stage to a separate rte_flow group. This will allow users to clearly specify their intentions when creating a rule. Consequently, the need for a pipeline mode can be removed.
--- doc/guides/nics/ice.rst | 19 ----- drivers/net/ice/ice_ethdev.c | 8 -- drivers/net/ice/ice_ethdev.h | 2 - drivers/net/ice/ice_fdir_filter.c | 2 +- drivers/net/ice/ice_generic_flow.c | 120 ++++++++-------------------- drivers/net/ice/ice_generic_flow.h | 6 +- drivers/net/ice/ice_switch_filter.c | 118 +-------------------------- 7 files changed, 40 insertions(+), 235 deletions(-)
doc/guides/nics/ice.rst +0 -19
@@ -90,25 +90,6 @@ Runtime Configuration NOTE: In Safe mode, only very limited features are available, features like RSS, checksum, fdir, tunneling ... are all disabled. -- ``Generic Flow Pipeline Mode Support`` (default ``0``) - - In pipeline mode, a flow can be set at one specific stage by setting parameter - ``priority``. Currently, we support two stages: priority = 0 or !0. Flows with - priority 0 located at the first pipeline stage which typically be used as a firewall - to drop the packet on a blocklist(we called it permission stage). At this stage, - flow rules are created for the device's exact match engine: switch. Flows with priority - !0 located at the second stage, typically packets are classified here and be steered to - specific queue or queue group (we called it distribution stage), At this stage, flow - rules are created for device's flow director engine. - For none-pipeline mode, ``priority`` is ignored, a flow rule can be created as a flow director - rule or a switch rule depends on its pattern/action and the resource allocation situation, - all flows are virtually at the same pipeline stage. - By default, generic flow API is enabled in none-pipeline mode, user can choose to - use pipeline mode by setting ``devargs`` parameter ``pipeline-mode-support``, - for example:: - - -a 80:00.0,pipeline-mode-support=1 - - ``Default MAC Disable`` (default ``0``) Disable the default MAC make the device drop all packets by default,
drivers/net/ice/ice_ethdev.c +0 -8
@@ -27,7 +27,6 @@/* devargs */ #define ICE_SAFE_MODE_SUPPORT_ARG "safe-mode-support" -#define ICE_PIPELINE_MODE_SUPPORT_ARG "pipeline-mode-support"#define ICE_DEFAULT_MAC_DISABLE "default-mac-disable"#define ICE_PROTO_XTR_ARG "proto_xtr"#define ICE_FIELD_OFFS_ARG "field_offs"
@@ -43,7 +42,6 @@ int ice_timestamp_dynfield_offset = -1;static const char *const ice_valid_args[] = {ICE_SAFE_MODE_SUPPORT_ARG , -ICE_PIPELINE_MODE_SUPPORT_ARG ,ICE_PROTO_XTR_ARG ,ICE_FIELD_OFFS_ARG ,ICE_FIELD_NAME_ARG ,
@@ -2103,11 +2101,6 @@ static int ice_parse_devargs(struct rte_eth_dev *dev)if (ret) goto bail; - ret =rte_kvargs_process (kvlist,ICE_PIPELINE_MODE_SUPPORT_ARG , - &parse_bool, &ad->devargs.pipe_mode_support); -if (ret) - goto bail; - ret =rte_kvargs_process (kvlist,ICE_DEFAULT_MAC_DISABLE , &parse_bool, &ad->devargs.default_mac_disable);if (ret)
@@ -6549,7 +6542,6 @@ RTE_PMD_REGISTER_PARAM_STRING(net_ice,ICE_HW_DEBUG_MASK_ARG "=0xXXX" ICE_PROTO_XTR_ARG "=[queue:]<vlan|ipv4|ipv6|ipv6_flow|tcp|ip_offset>" ICE_SAFE_MODE_SUPPORT_ARG "=<0|1>" -ICE_PIPELINE_MODE_SUPPORT_ARG "=<0|1>" ICE_DEFAULT_MAC_DISABLE "=<0|1>" ICE_RX_LOW_LATENCY_ARG "=<0|1>");
drivers/net/ice/ice_ethdev.h +0 -2
@@ -542,7 +542,6 @@ struct ice_pf {struct ice_flow_list flow_list;rte_spinlock_t flow_ops_lock;struct ice_parser_list rss_parser_list; -struct ice_parser_list perm_parser_list;struct ice_parser_list dist_parser_list;bool init_link_up;uint64_t old_rx_bytes;
@@ -563,7 +562,6 @@ struct ice_devargs {int rx_low_latency;int safe_mode_support;uint8_t proto_xtr_dflt; -int pipe_mode_support;uint8_t default_mac_disable;uint8_t proto_xtr[ICE_MAX_QUEUE_NUM ];uint8_t pin_idx;
drivers/net/ice/ice_fdir_filter.c +1 -1
@@ -2467,7 +2467,7 @@ ice_fdir_parse(struct ice_adapter *ad, item =ice_search_pattern_match_item (ad, pattern, array, array_len, error); -if (!ad->devargs.pipe_mode_support && priority >=1 ) +if (priority >=1 )return -rte_errno;if (!item)
drivers/net/ice/ice_generic_flow.c +35 -85
183 lines not on this page · raw message
drivers/net/ice/ice_generic_flow.h +2 -4
@@ -418,15 +418,13 @@ enum ice_flow_engine_type { };/** -* classification stages. -* for non-pipeline mode, we have two classification stages: Distributor/RSS -* for pipeline-mode we have three classification stages: +* Classification stages. +* We have two classification stages: Distributor/RSS * Permission/Distributor/RSS */ enum ice_flow_classification_stage {ICE_FLOW_STAGE_NONE =0 ,ICE_FLOW_STAGE_RSS , -ICE_FLOW_STAGE_PERMISSION ,ICE_FLOW_STAGE_DISTRIBUTOR ,ICE_FLOW_STAGE_MAX , };
drivers/net/ice/ice_switch_filter.c +2 -116
147 lines not on this page · raw message
Signature · 1 line
2.31.1
PATCH v4 2/5 net/ice: refine flow engine disabling
In reply to Qi ZhangOnly "disable_engine_mask" for flow engine disabling
In PF mode, only ACL engine will be disabled. In DCF mode, FDIR and HASH engine will be disabled. In DCF mode with "acl=off", ACL engine will also be disabled.
--- drivers/net/ice/ice_acl_filter.c | 3 --- drivers/net/ice/ice_dcf_parent.c | 3 +++ drivers/net/ice/ice_ethdev.c | 1 + drivers/net/ice/ice_fdir_filter.c | 3 --- drivers/net/ice/ice_hash.c | 3 --- 5 files changed, 4 insertions(+), 9 deletions(-)
drivers/net/ice/ice_acl_filter.c +0 -3
@@ -995,9 +995,6 @@ ice_acl_init(struct ice_adapter *ad)struct ice_hw *hw =ICE_PF_TO_HW (pf);struct ice_flow_parser *parser = &ice_acl_parser; -if (!ad->hw.dcf_enabled) -return 0 ; - ret =ice_acl_prof_alloc (hw);if (ret) { PMD_DRV_LOG(ERR, "Cannot allocate memory for "
drivers/net/ice/ice_dcf_parent.c +3 -0
@@ -474,6 +474,9 @@ ice_dcf_init_parent_adapter(struct rte_eth_dev *eth_dev)if (ice_devargs_check (eth_dev->device->devargs,ICE_DCF_DEVARG_ACL )) parent_adapter->disabled_engine_mask |=BIT (ICE_FLOW_ENGINE_ACL ); + parent_adapter->disabled_engine_mask |=BIT (ICE_FLOW_ENGINE_FDIR ); + parent_adapter->disabled_engine_mask |=BIT (ICE_FLOW_ENGINE_HASH ); + err =ice_flow_init (parent_adapter);if (err) {PMD_INIT_LOG (ERR ,"Failed to initialize flow" );
drivers/net/ice/ice_ethdev.c +1 -0
@@ -2442,6 +2442,7 @@ ice_dev_init(struct rte_eth_dev *dev) }if (!ad->is_safe_mode) { + ad->disabled_engine_mask |=BIT (ICE_FLOW_ENGINE_ACL ); ret =ice_flow_init (ad);if (ret) {PMD_INIT_LOG (ERR ,"Failed to initialize flow" );
drivers/net/ice/ice_fdir_filter.c +0 -3
@@ -1150,9 +1150,6 @@ ice_fdir_init(struct ice_adapter *ad)struct ice_flow_parser *parser;int ret; -if (ad->hw.dcf_enabled) -return 0 ; - ret =ice_fdir_setup (pf);if (ret)return ret;
drivers/net/ice/ice_hash.c +0 -3
@@ -591,9 +591,6 @@ ice_hash_init(struct ice_adapter *ad) {struct ice_flow_parser *parser =NULL ; -if (ad->hw.dcf_enabled) -return 0 ; - parser = &ice_hash_parser;return ice_register_parser (parser, ad);
Signature · 1 line
2.31.1
PATCH v4 3/5 net/ice: map group to pipeline stage
In reply to Qi ZhangMapping rte_flow_attr->group to a specific hardware stage.
Group 0 -> switch filter
Group 1 -> acl filter (dcf mode only)
Group 2 -> fdir filter (pf mode only)
For RSS, it will only be selected if there is a RTE_FLOW_ACTION_RSS action target no queue group and the group ID is ignored.
Since each flow parser will be selected based on the group, there is no need to maintain a separate 'parser list' or related APIs for registering/unregistering parsers.
--- drivers/net/ice/ice_acl_filter.c | 13 +- drivers/net/ice/ice_ethdev.h | 2 - drivers/net/ice/ice_fdir_filter.c | 19 +-- drivers/net/ice/ice_generic_flow.c | 234 +++++++++------------------- drivers/net/ice/ice_generic_flow.h | 9 +- drivers/net/ice/ice_hash.c | 16 +- drivers/net/ice/ice_switch_filter.c | 13 +- 7 files changed, 91 insertions(+), 215 deletions(-)
drivers/net/ice/ice_acl_filter.c +2 -11
@@ -41,8 +41,6 @@ ICE_ACL_INSET_ETH_IPV4 | \ ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT) -static struct ice_flow_parser ice_acl_parser; - struct acl_rule { enum ice_fltr_ptype flow_type; uint64_t entry_id[4];
@@ -993,7 +991,6 @@ ice_acl_init(struct ice_adapter *ad)int ret =0 ;struct ice_pf *pf = &ad->pf;struct ice_hw *hw =ICE_PF_TO_HW (pf); -struct ice_flow_parser *parser = &ice_acl_parser; ret =ice_acl_prof_alloc (hw);if (ret) {
@@ -1010,11 +1007,7 @@ ice_acl_init(struct ice_adapter *ad)if (ret)return ret; - ret =ice_acl_prof_init (pf); -if (ret) -return ret; - -return ice_register_parser (parser, ad); +return ice_acl_prof_init (pf); } static void
@@ -1037,10 +1030,8 @@ ice_acl_uninit(struct ice_adapter *ad) {struct ice_pf *pf = &ad->pf;struct ice_hw *hw =ICE_PF_TO_HW (pf); -struct ice_flow_parser *parser = &ice_acl_parser;if (ad->hw.dcf_enabled) { -ice_unregister_parser (parser, ad);ice_deinit_acl (pf);ice_acl_prof_free (hw); }
@@ -1056,7 +1047,7 @@ ice_flow_engine ice_acl_engine = { .type = ICE_FLOW_ENGINE_ACL, }; -static struct +struct ice_flow_parser ice_acl_parser = { .engine = &ice_acl_engine, .array = ice_acl_pattern,
drivers/net/ice/ice_ethdev.h +0 -2
@@ -541,8 +541,6 @@ struct ice_pf {bool adapter_stopped;struct ice_flow_list flow_list;rte_spinlock_t flow_ops_lock; -struct ice_parser_list rss_parser_list; -struct ice_parser_list dist_parser_list;bool init_link_up;uint64_t old_rx_bytes;uint64_t old_tx_bytes;
drivers/net/ice/ice_fdir_filter.c +2 -17
@@ -137,8 +137,6 @@ static struct ice_pattern_match_item ice_fdir_pattern_list[] = { {pattern_eth_ipv6_gtpu_eh, ICE_FDIR_INSET_IPV6_GTPU_EH, ICE_FDIR_INSET_IPV6_GTPU_EH, ICE_INSET_NONE}, }; -static struct ice_flow_parser ice_fdir_parser; -static int ice_fdir_is_tunnel_profile (enum ice_fdir_tunnel_type tunnel_type);
@@ -1147,31 +1145,18 @@ static int ice_fdir_init(struct ice_adapter *ad) {struct ice_pf *pf = &ad->pf; -struct ice_flow_parser *parser; -int ret; - - ret =ice_fdir_setup (pf); -if (ret) -return ret; - - parser = &ice_fdir_parser; -return ice_register_parser (parser, ad); +return ice_fdir_setup (pf); }static void ice_fdir_uninit (struct ice_adapter *ad) { -struct ice_flow_parser *parser;struct ice_pf *pf = &ad->pf;if (ad->hw.dcf_enabled)return ; - parser = &ice_fdir_parser; - -ice_unregister_parser (parser, ad); -ice_fdir_teardown (pf); }
@@ -2507,7 +2492,7 @@ ice_fdir_parse(struct ice_adapter *ad,return ret; } -static struct ice_flow_parser ice_fdir_parser = { +struct ice_flow_parser ice_fdir_parser = { .engine = &ice_fdir_engine, .array = ice_fdir_pattern_list, .array_len =RTE_DIM (ice_fdir_pattern_list),
drivers/net/ice/ice_generic_flow.c +73 -161
308 lines not on this page · raw message
drivers/net/ice/ice_generic_flow.h +5 -4
@@ -515,10 +515,6 @@ struct ice_flow_parser_node {void ice_register_flow_engine (struct ice_flow_engine *engine);int ice_flow_init (struct ice_adapter *ad);void ice_flow_uninit (struct ice_adapter *ad); -int ice_register_parser (struct ice_flow_parser *parser, -struct ice_adapter *ad); -void ice_unregister_parser (struct ice_flow_parser *parser, -struct ice_adapter *ad);struct ice_pattern_match_item * ice_search_pattern_match_item(struct ice_adapter *ad, const struct rte_flow_item pattern[],
@@ -528,4 +524,9 @@ ice_search_pattern_match_item(struct ice_adapter *ad,int ice_flow_redirect (struct ice_adapter *ad,struct ice_flow_redirect *rd); + +extern struct ice_flow_parser ice_switch_parser; +extern struct ice_flow_parser ice_acl_parser; +extern struct ice_flow_parser ice_fdir_parser; +extern struct ice_flow_parser ice_hash_parser;#endif
drivers/net/ice/ice_hash.c +4 -12
@@ -572,7 +572,7 @@ static struct ice_flow_engine ice_hash_engine = { };/* Register parser for os package. */ -static struct ice_flow_parser ice_hash_parser = { +struct ice_flow_parser ice_hash_parser = { .engine = &ice_hash_engine, .array = ice_hash_pattern_list, .array_len =RTE_DIM (ice_hash_pattern_list),
@@ -587,13 +587,9 @@ RTE_INIT(ice_hash_engine_init) }static int -ice_hash_init (struct ice_adapter *ad) +ice_hash_init(struct ice_adapter *ad __rte_unused) { -struct ice_flow_parser *parser =NULL ; - - parser = &ice_hash_parser; - -return ice_register_parser (parser, ad); +return 0 ; } static int
@@ -1439,12 +1435,8 @@ ice_hash_destroy(struct ice_adapter *ad, }static void -ice_hash_uninit (struct ice_adapter *ad) +ice_hash_uninit(struct ice_adapter *ad __rte_unused) { -if (ad->hw.dcf_enabled) -return ; - -ice_unregister_parser (&ice_hash_parser, ad); } static void
drivers/net/ice/ice_switch_filter.c +5 -8
@@ -201,8 +201,6 @@ struct ice_switch_filter_conf {struct ice_adv_rule_info rule_info; }; -static struct ice_flow_parser ice_switch_dist_parser; -static struct ice_pattern_match_item ice_switch_pattern_dist_list[] = { {pattern_any,ICE_INSET_NONE ,ICE_INSET_NONE ,ICE_INSET_NONE },
@@ -2052,15 +2050,14 @@ ice_switch_redirect(struct ice_adapter *ad, }static int -ice_switch_init (struct ice_adapter *ad) +ice_switch_init(struct ice_adapter *ad __rte_unused) { -return ice_register_parser (&ice_switch_dist_parser, ad); +return 0 ; }static void -ice_switch_uninit (struct ice_adapter *ad) +ice_switch_uninit(struct ice_adapter *ad __rte_unused) { -ice_unregister_parser (&ice_switch_dist_parser, ad); } static struct
@@ -2075,8 +2072,8 @@ ice_flow_engine ice_switch_engine = { .type = ICE_FLOW_ENGINE_SWITCH, }; -static struct -ice_flow_parser ice_switch_dist_parser = { +struct +ice_flow_parser ice_switch_parser = { .engine = &ice_switch_engine, .array = ice_switch_pattern_dist_list, .array_len =RTE_DIM (ice_switch_pattern_dist_list),
Signature · 1 line
2.31.1
PATCH v4 4/5 net/ice: refine supported flow pattern name
In reply to Qi ZhangUnified the supported pattern array name as
ice_<engine>_supported_pattern.
--- drivers/net/ice/ice_acl_filter.c | 6 +++--- drivers/net/ice/ice_fdir_filter.c | 6 +++--- drivers/net/ice/ice_switch_filter.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-)
drivers/net/ice/ice_acl_filter.c +3 -3
@@ -47,7 +47,7 @@ struct acl_rule { };static struct -ice_pattern_match_item ice_acl_pattern[] = { +ice_pattern_match_item ice_acl_supported_pattern[] = { {pattern_eth_ipv4,ICE_ACL_INSET_ETH_IPV4 ,ICE_INSET_NONE ,ICE_INSET_NONE }, {pattern_eth_ipv4_udp,ICE_ACL_INSET_ETH_IPV4_UDP ,ICE_INSET_NONE ,ICE_INSET_NONE }, {pattern_eth_ipv4_tcp,ICE_ACL_INSET_ETH_IPV4_TCP ,ICE_INSET_NONE ,ICE_INSET_NONE },
@@ -1050,8 +1050,8 @@ ice_flow_engine ice_acl_engine = {struct ice_flow_parser ice_acl_parser = { .engine = &ice_acl_engine, - .array = ice_acl_pattern, - .array_len =RTE_DIM (ice_acl_pattern), + .array = ice_acl_supported_pattern, + .array_len =RTE_DIM (ice_acl_supported_pattern), .parse_pattern_action = ice_acl_parse, .stage =ICE_FLOW_STAGE_DISTRIBUTOR , };
drivers/net/ice/ice_fdir_filter.c +3 -3
@@ -106,7 +106,7 @@ ICE_INSET_IPV6_SRC | ICE_INSET_IPV6_DST | \ ICE_INSET_NAT_T_ESP_SPI) -static struct ice_pattern_match_item ice_fdir_pattern_list[] = { +static struct ice_pattern_match_item ice_fdir_supported_pattern[] = { {pattern_raw,ICE_INSET_NONE ,ICE_INSET_NONE ,ICE_INSET_NONE }, {pattern_ethertype,ICE_FDIR_INSET_ETH ,ICE_INSET_NONE ,ICE_INSET_NONE }, {pattern_eth_ipv4,ICE_FDIR_INSET_ETH_IPV4 ,ICE_INSET_NONE ,ICE_INSET_NONE },
@@ -2494,8 +2494,8 @@ ice_fdir_parse(struct ice_adapter *ad,struct ice_flow_parser ice_fdir_parser = { .engine = &ice_fdir_engine, - .array = ice_fdir_pattern_list, - .array_len =RTE_DIM (ice_fdir_pattern_list), + .array = ice_fdir_supported_pattern, + .array_len =RTE_DIM (ice_fdir_supported_pattern), .parse_pattern_action = ice_fdir_parse, .stage =ICE_FLOW_STAGE_DISTRIBUTOR , };
drivers/net/ice/ice_switch_filter.c +3 -3
@@ -202,7 +202,7 @@ struct ice_switch_filter_conf { };static struct -ice_pattern_match_item ice_switch_pattern_dist_list[] = { +ice_pattern_match_item ice_switch_supported_pattern[] = { {pattern_any,ICE_INSET_NONE ,ICE_INSET_NONE ,ICE_INSET_NONE }, {pattern_ethertype,ICE_SW_INSET_ETHER ,ICE_INSET_NONE ,ICE_INSET_NONE }, {pattern_ethertype_vlan,ICE_SW_INSET_MAC_VLAN ,ICE_INSET_NONE ,ICE_INSET_NONE },
@@ -2075,8 +2075,8 @@ ice_flow_engine ice_switch_engine = {struct ice_flow_parser ice_switch_parser = { .engine = &ice_switch_engine, - .array = ice_switch_pattern_dist_list, - .array_len =RTE_DIM (ice_switch_pattern_dist_list), + .array = ice_switch_supported_pattern, + .array_len =RTE_DIM (ice_switch_supported_pattern), .parse_pattern_action = ice_switch_parse_pattern_action, .stage =ICE_FLOW_STAGE_DISTRIBUTOR , };
Signature · 1 line
2.31.1
PATCH v4 5/5 doc: add generic flow doc for ice PMD
In reply to Qi ZhangAdd some document about how to use rte_flow on ice PMD.
--- doc/guides/nics/ice.rst | 45 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
doc/guides/nics/ice.rst +45 -0
@@ -301,6 +301,51 @@ The DCF PMD needs to advertise and acquire DCF capability which allows DCF to send AdminQ commands that it would like to execute over to the PF and receive responses for the same from PF. +Generic Flow Support +~~~~~~~~~~~~~~~~~~~~ + +The ice PMD provides support for the Generic Flow API (RTE_FLOW), enabling +users to offload various flow classification tasks to the E810 NIC. +The E810 NIC's packet processing pipeline consists of the following stages: + +Switch: Supports exact match and limited wildcard matching with a large flow +capacity. + +ACL: Supports wildcard matching with a smaller flow capacity (DCF mode only). + +FDIR: Supports exact match with a large flow capacity (PF mode only). + +Hash: Supports RSS (PF mode only) + +The ice PMD utilizes the ice_flow_engine structure to represent each of these +stages and leverages the rte_flow rule's ``group`` attribute for selecting the +appropriate engine for Switch, ACL, and FDIR operations: + +Group 0 maps to Switch +Group 1 maps to ACL +Group 2 maps to FDIR + +In the case of RSS, it will only be selected if a ``RTE_FLOW_ACTION_RSS`` action +is targeted to no queue group, and the group attribute is ignored. + +For each engine, a list of supported patterns is maintained in a global array +named ``ice_<engine>_supported_pattern``. The Ice PMD will reject any rule with +a pattern that is not included in the supported list. + +One notable feature is the ice PMD's ability to leverage the Raw pattern, +enabling protocol-agnostic flow offloading. Here is an example of creating +a rule that matches an IPv4 destination address of 1.2.3.4 and redirects it to +queue 3 using a raw pattern: + +flow create 0 ingress group 2 pattern raw \ +pattern spec \ +00000000000000000000000008004500001400004000401000000000000001020304 \ +pattern mask \ +000000000000000000000000000000000000000000000000000000000000ffffffff \ +end actions queue index 3 / mark id 3 / end + +Currently, raw pattern support is limited to the FDIR and Hash engines. + Additional Options ++++++++++++++++++
Signature · 1 line
2.31.1
v5 cover net/ice: refactor rte_flow
In reply to Qi Zhang1. remove pipeline mode
2. apply group to hardware pipeline stage static mapping
3. add genenic flow document
v5:
- remove incorrect group attr check in ice_flow_valid_attr
v4:
- fix error handling when target engine was disabled.
v3:
- fix the issue when acl=off on dcf mode
- refine the disabled engine handling
- unified the supported pattern variable name
- add document
v2:
- fix segment fault when an uninitialized engine has been selected.
Qi Zhang (5):
net/ice: remove pipeline mode
net/ice: refine flow engine disabling
net/ice: map group to pipeline stage
net/ice: refine supported flow pattern name
doc: add generic flow doc for ice PMD
doc/guides/nics/ice.rst | 64 ++++-- drivers/net/ice/ice_acl_filter.c | 22 +- drivers/net/ice/ice_dcf_parent.c | 3 + drivers/net/ice/ice_ethdev.c | 9 +- drivers/net/ice/ice_ethdev.h | 4 - drivers/net/ice/ice_fdir_filter.c | 30 +-- drivers/net/ice/ice_generic_flow.c | 302 +++++++--------------------- drivers/net/ice/ice_generic_flow.h | 15 +- drivers/net/ice/ice_hash.c | 19 +- drivers/net/ice/ice_switch_filter.c | 133 +----------- 10 files changed, 157 insertions(+), 444 deletions(-)
Signature · 1 line
2.31.1
PATCH v5 1/5 net/ice: remove pipeline mode
This marks the initial phase of refactoring the ice rte_flow implementation.
The combination of switch and fdir rules within the same syntax has led to inconvenient user experiences. Naturally, the switch filter and fdir filter represent distinct pipeline stages with differing hardware capabilities.
To address this, we have made the decision to assign each stage to a separate rte_flow group. This will allow users to clearly specify their intentions when creating a rule. Consequently, the need for a pipeline mode can be removed.
--- doc/guides/nics/ice.rst | 19 ----- drivers/net/ice/ice_ethdev.c | 8 -- drivers/net/ice/ice_ethdev.h | 2 - drivers/net/ice/ice_fdir_filter.c | 2 +- drivers/net/ice/ice_generic_flow.c | 120 ++++++++-------------------- drivers/net/ice/ice_generic_flow.h | 6 +- drivers/net/ice/ice_switch_filter.c | 118 +-------------------------- 7 files changed, 40 insertions(+), 235 deletions(-)
doc/guides/nics/ice.rst +0 -19
@@ -90,25 +90,6 @@ Runtime Configuration NOTE: In Safe mode, only very limited features are available, features like RSS, checksum, fdir, tunneling ... are all disabled. -- ``Generic Flow Pipeline Mode Support`` (default ``0``) - - In pipeline mode, a flow can be set at one specific stage by setting parameter - ``priority``. Currently, we support two stages: priority = 0 or !0. Flows with - priority 0 located at the first pipeline stage which typically be used as a firewall - to drop the packet on a blocklist(we called it permission stage). At this stage, - flow rules are created for the device's exact match engine: switch. Flows with priority - !0 located at the second stage, typically packets are classified here and be steered to - specific queue or queue group (we called it distribution stage), At this stage, flow - rules are created for device's flow director engine. - For none-pipeline mode, ``priority`` is ignored, a flow rule can be created as a flow director - rule or a switch rule depends on its pattern/action and the resource allocation situation, - all flows are virtually at the same pipeline stage. - By default, generic flow API is enabled in none-pipeline mode, user can choose to - use pipeline mode by setting ``devargs`` parameter ``pipeline-mode-support``, - for example:: - - -a 80:00.0,pipeline-mode-support=1 - - ``Default MAC Disable`` (default ``0``) Disable the default MAC make the device drop all packets by default,
drivers/net/ice/ice_ethdev.c +0 -8
@@ -27,7 +27,6 @@/* devargs */ #define ICE_SAFE_MODE_SUPPORT_ARG "safe-mode-support" -#define ICE_PIPELINE_MODE_SUPPORT_ARG "pipeline-mode-support"#define ICE_DEFAULT_MAC_DISABLE "default-mac-disable"#define ICE_PROTO_XTR_ARG "proto_xtr"#define ICE_FIELD_OFFS_ARG "field_offs"
@@ -43,7 +42,6 @@ int ice_timestamp_dynfield_offset = -1;static const char *const ice_valid_args[] = {ICE_SAFE_MODE_SUPPORT_ARG , -ICE_PIPELINE_MODE_SUPPORT_ARG ,ICE_PROTO_XTR_ARG ,ICE_FIELD_OFFS_ARG ,ICE_FIELD_NAME_ARG ,
@@ -2103,11 +2101,6 @@ static int ice_parse_devargs(struct rte_eth_dev *dev)if (ret) goto bail; - ret =rte_kvargs_process (kvlist,ICE_PIPELINE_MODE_SUPPORT_ARG , - &parse_bool, &ad->devargs.pipe_mode_support); -if (ret) - goto bail; - ret =rte_kvargs_process (kvlist,ICE_DEFAULT_MAC_DISABLE , &parse_bool, &ad->devargs.default_mac_disable);if (ret)
@@ -6549,7 +6542,6 @@ RTE_PMD_REGISTER_PARAM_STRING(net_ice,ICE_HW_DEBUG_MASK_ARG "=0xXXX" ICE_PROTO_XTR_ARG "=[queue:]<vlan|ipv4|ipv6|ipv6_flow|tcp|ip_offset>" ICE_SAFE_MODE_SUPPORT_ARG "=<0|1>" -ICE_PIPELINE_MODE_SUPPORT_ARG "=<0|1>" ICE_DEFAULT_MAC_DISABLE "=<0|1>" ICE_RX_LOW_LATENCY_ARG "=<0|1>");
drivers/net/ice/ice_ethdev.h +0 -2
@@ -542,7 +542,6 @@ struct ice_pf {struct ice_flow_list flow_list;rte_spinlock_t flow_ops_lock;struct ice_parser_list rss_parser_list; -struct ice_parser_list perm_parser_list;struct ice_parser_list dist_parser_list;bool init_link_up;uint64_t old_rx_bytes;
@@ -563,7 +562,6 @@ struct ice_devargs {int rx_low_latency;int safe_mode_support;uint8_t proto_xtr_dflt; -int pipe_mode_support;uint8_t default_mac_disable;uint8_t proto_xtr[ICE_MAX_QUEUE_NUM ];uint8_t pin_idx;
drivers/net/ice/ice_fdir_filter.c +1 -1
@@ -2467,7 +2467,7 @@ ice_fdir_parse(struct ice_adapter *ad, item =ice_search_pattern_match_item (ad, pattern, array, array_len, error); -if (!ad->devargs.pipe_mode_support && priority >=1 ) +if (priority >=1 )return -rte_errno;if (!item)
drivers/net/ice/ice_generic_flow.c +35 -85
183 lines not on this page · raw message
drivers/net/ice/ice_generic_flow.h +2 -4
@@ -418,15 +418,13 @@ enum ice_flow_engine_type { };/** -* classification stages. -* for non-pipeline mode, we have two classification stages: Distributor/RSS -* for pipeline-mode we have three classification stages: +* Classification stages. +* We have two classification stages: Distributor/RSS * Permission/Distributor/RSS */ enum ice_flow_classification_stage {ICE_FLOW_STAGE_NONE =0 ,ICE_FLOW_STAGE_RSS , -ICE_FLOW_STAGE_PERMISSION ,ICE_FLOW_STAGE_DISTRIBUTOR ,ICE_FLOW_STAGE_MAX , };
drivers/net/ice/ice_switch_filter.c +2 -116
147 lines not on this page · raw message
Signature · 1 line
2.31.1
PATCH v5 2/5 net/ice: refine flow engine disabling
In reply to Qi ZhangOnly "disable_engine_mask" for flow engine disabling
In PF mode, only ACL engine will be disabled. In DCF mode, FDIR and HASH engine will be disabled. In DCF mode with "acl=off", ACL engine will also be disabled.
--- drivers/net/ice/ice_acl_filter.c | 3 --- drivers/net/ice/ice_dcf_parent.c | 3 +++ drivers/net/ice/ice_ethdev.c | 1 + drivers/net/ice/ice_fdir_filter.c | 3 --- drivers/net/ice/ice_hash.c | 3 --- 5 files changed, 4 insertions(+), 9 deletions(-)
drivers/net/ice/ice_acl_filter.c +0 -3
@@ -995,9 +995,6 @@ ice_acl_init(struct ice_adapter *ad)struct ice_hw *hw =ICE_PF_TO_HW (pf);struct ice_flow_parser *parser = &ice_acl_parser; -if (!ad->hw.dcf_enabled) -return 0 ; - ret =ice_acl_prof_alloc (hw);if (ret) { PMD_DRV_LOG(ERR, "Cannot allocate memory for "
drivers/net/ice/ice_dcf_parent.c +3 -0
@@ -474,6 +474,9 @@ ice_dcf_init_parent_adapter(struct rte_eth_dev *eth_dev)if (ice_devargs_check (eth_dev->device->devargs,ICE_DCF_DEVARG_ACL )) parent_adapter->disabled_engine_mask |=BIT (ICE_FLOW_ENGINE_ACL ); + parent_adapter->disabled_engine_mask |=BIT (ICE_FLOW_ENGINE_FDIR ); + parent_adapter->disabled_engine_mask |=BIT (ICE_FLOW_ENGINE_HASH ); + err =ice_flow_init (parent_adapter);if (err) {PMD_INIT_LOG (ERR ,"Failed to initialize flow" );
drivers/net/ice/ice_ethdev.c +1 -0
@@ -2442,6 +2442,7 @@ ice_dev_init(struct rte_eth_dev *dev) }if (!ad->is_safe_mode) { + ad->disabled_engine_mask |=BIT (ICE_FLOW_ENGINE_ACL ); ret =ice_flow_init (ad);if (ret) {PMD_INIT_LOG (ERR ,"Failed to initialize flow" );
drivers/net/ice/ice_fdir_filter.c +0 -3
@@ -1150,9 +1150,6 @@ ice_fdir_init(struct ice_adapter *ad)struct ice_flow_parser *parser;int ret; -if (ad->hw.dcf_enabled) -return 0 ; - ret =ice_fdir_setup (pf);if (ret)return ret;
drivers/net/ice/ice_hash.c +0 -3
@@ -591,9 +591,6 @@ ice_hash_init(struct ice_adapter *ad) {struct ice_flow_parser *parser =NULL ; -if (ad->hw.dcf_enabled) -return 0 ; - parser = &ice_hash_parser;return ice_register_parser (parser, ad);
Signature · 1 line
2.31.1
PATCH v5 3/5 net/ice: map group to pipeline stage
In reply to Qi ZhangMapping rte_flow_attr->group to a specific hardware stage.
Group 0 -> switch filter
Group 1 -> acl filter (dcf mode only)
Group 2 -> fdir filter (pf mode only)
For RSS, it will only be selected if there is a RTE_FLOW_ACTION_RSS action target no queue group and the group ID is ignored.
Since each flow parser will be selected based on the group, there is no need to maintain a separate 'parser list' or related APIs for registering/unregistering parsers.
--- drivers/net/ice/ice_acl_filter.c | 13 +- drivers/net/ice/ice_ethdev.h | 2 - drivers/net/ice/ice_fdir_filter.c | 19 +-- drivers/net/ice/ice_generic_flow.c | 242 +++++++++------------------- drivers/net/ice/ice_generic_flow.h | 9 +- drivers/net/ice/ice_hash.c | 16 +- drivers/net/ice/ice_switch_filter.c | 13 +- 7 files changed, 91 insertions(+), 223 deletions(-)
drivers/net/ice/ice_acl_filter.c +2 -11
@@ -41,8 +41,6 @@ ICE_ACL_INSET_ETH_IPV4 | \ ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT) -static struct ice_flow_parser ice_acl_parser; - struct acl_rule { enum ice_fltr_ptype flow_type; uint64_t entry_id[4];
@@ -993,7 +991,6 @@ ice_acl_init(struct ice_adapter *ad)int ret =0 ;struct ice_pf *pf = &ad->pf;struct ice_hw *hw =ICE_PF_TO_HW (pf); -struct ice_flow_parser *parser = &ice_acl_parser; ret =ice_acl_prof_alloc (hw);if (ret) {
@@ -1010,11 +1007,7 @@ ice_acl_init(struct ice_adapter *ad)if (ret)return ret; - ret =ice_acl_prof_init (pf); -if (ret) -return ret; - -return ice_register_parser (parser, ad); +return ice_acl_prof_init (pf); } static void
@@ -1037,10 +1030,8 @@ ice_acl_uninit(struct ice_adapter *ad) {struct ice_pf *pf = &ad->pf;struct ice_hw *hw =ICE_PF_TO_HW (pf); -struct ice_flow_parser *parser = &ice_acl_parser;if (ad->hw.dcf_enabled) { -ice_unregister_parser (parser, ad);ice_deinit_acl (pf);ice_acl_prof_free (hw); }
@@ -1056,7 +1047,7 @@ ice_flow_engine ice_acl_engine = { .type = ICE_FLOW_ENGINE_ACL, }; -static struct +struct ice_flow_parser ice_acl_parser = { .engine = &ice_acl_engine, .array = ice_acl_pattern,
drivers/net/ice/ice_ethdev.h +0 -2
@@ -541,8 +541,6 @@ struct ice_pf {bool adapter_stopped;struct ice_flow_list flow_list;rte_spinlock_t flow_ops_lock; -struct ice_parser_list rss_parser_list; -struct ice_parser_list dist_parser_list;bool init_link_up;uint64_t old_rx_bytes;uint64_t old_tx_bytes;
drivers/net/ice/ice_fdir_filter.c +2 -17
@@ -137,8 +137,6 @@ static struct ice_pattern_match_item ice_fdir_pattern_list[] = { {pattern_eth_ipv6_gtpu_eh, ICE_FDIR_INSET_IPV6_GTPU_EH, ICE_FDIR_INSET_IPV6_GTPU_EH, ICE_INSET_NONE}, }; -static struct ice_flow_parser ice_fdir_parser; -static int ice_fdir_is_tunnel_profile (enum ice_fdir_tunnel_type tunnel_type);
@@ -1147,31 +1145,18 @@ static int ice_fdir_init(struct ice_adapter *ad) {struct ice_pf *pf = &ad->pf; -struct ice_flow_parser *parser; -int ret; - - ret =ice_fdir_setup (pf); -if (ret) -return ret; - - parser = &ice_fdir_parser; -return ice_register_parser (parser, ad); +return ice_fdir_setup (pf); }static void ice_fdir_uninit (struct ice_adapter *ad) { -struct ice_flow_parser *parser;struct ice_pf *pf = &ad->pf;if (ad->hw.dcf_enabled)return ; - parser = &ice_fdir_parser; - -ice_unregister_parser (parser, ad); -ice_fdir_teardown (pf); }
@@ -2507,7 +2492,7 @@ ice_fdir_parse(struct ice_adapter *ad,return ret; } -static struct ice_flow_parser ice_fdir_parser = { +struct ice_flow_parser ice_fdir_parser = { .engine = &ice_fdir_engine, .array = ice_fdir_pattern_list, .array_len =RTE_DIM (ice_fdir_pattern_list),
drivers/net/ice/ice_generic_flow.c +73 -169
322 lines not on this page · raw message
drivers/net/ice/ice_generic_flow.h +5 -4
@@ -515,10 +515,6 @@ struct ice_flow_parser_node {void ice_register_flow_engine (struct ice_flow_engine *engine);int ice_flow_init (struct ice_adapter *ad);void ice_flow_uninit (struct ice_adapter *ad); -int ice_register_parser (struct ice_flow_parser *parser, -struct ice_adapter *ad); -void ice_unregister_parser (struct ice_flow_parser *parser, -struct ice_adapter *ad);struct ice_pattern_match_item * ice_search_pattern_match_item(struct ice_adapter *ad, const struct rte_flow_item pattern[],
@@ -528,4 +524,9 @@ ice_search_pattern_match_item(struct ice_adapter *ad,int ice_flow_redirect (struct ice_adapter *ad,struct ice_flow_redirect *rd); + +extern struct ice_flow_parser ice_switch_parser; +extern struct ice_flow_parser ice_acl_parser; +extern struct ice_flow_parser ice_fdir_parser; +extern struct ice_flow_parser ice_hash_parser;#endif
drivers/net/ice/ice_hash.c +4 -12
@@ -572,7 +572,7 @@ static struct ice_flow_engine ice_hash_engine = { };/* Register parser for os package. */ -static struct ice_flow_parser ice_hash_parser = { +struct ice_flow_parser ice_hash_parser = { .engine = &ice_hash_engine, .array = ice_hash_pattern_list, .array_len =RTE_DIM (ice_hash_pattern_list),
@@ -587,13 +587,9 @@ RTE_INIT(ice_hash_engine_init) }static int -ice_hash_init (struct ice_adapter *ad) +ice_hash_init(struct ice_adapter *ad __rte_unused) { -struct ice_flow_parser *parser =NULL ; - - parser = &ice_hash_parser; - -return ice_register_parser (parser, ad); +return 0 ; } static int
@@ -1439,12 +1435,8 @@ ice_hash_destroy(struct ice_adapter *ad, }static void -ice_hash_uninit (struct ice_adapter *ad) +ice_hash_uninit(struct ice_adapter *ad __rte_unused) { -if (ad->hw.dcf_enabled) -return ; - -ice_unregister_parser (&ice_hash_parser, ad); } static void
drivers/net/ice/ice_switch_filter.c +5 -8
@@ -201,8 +201,6 @@ struct ice_switch_filter_conf {struct ice_adv_rule_info rule_info; }; -static struct ice_flow_parser ice_switch_dist_parser; -static struct ice_pattern_match_item ice_switch_pattern_dist_list[] = { {pattern_any,ICE_INSET_NONE ,ICE_INSET_NONE ,ICE_INSET_NONE },
@@ -2052,15 +2050,14 @@ ice_switch_redirect(struct ice_adapter *ad, }static int -ice_switch_init (struct ice_adapter *ad) +ice_switch_init(struct ice_adapter *ad __rte_unused) { -return ice_register_parser (&ice_switch_dist_parser, ad); +return 0 ; }static void -ice_switch_uninit (struct ice_adapter *ad) +ice_switch_uninit(struct ice_adapter *ad __rte_unused) { -ice_unregister_parser (&ice_switch_dist_parser, ad); } static struct
@@ -2075,8 +2072,8 @@ ice_flow_engine ice_switch_engine = { .type = ICE_FLOW_ENGINE_SWITCH, }; -static struct -ice_flow_parser ice_switch_dist_parser = { +struct +ice_flow_parser ice_switch_parser = { .engine = &ice_switch_engine, .array = ice_switch_pattern_dist_list, .array_len =RTE_DIM (ice_switch_pattern_dist_list),
Signature · 1 line
2.31.1
PATCH v5 4/5 net/ice: refine supported flow pattern name
In reply to Qi ZhangUnified the supported pattern array name as
ice_<engine>_supported_pattern.
--- drivers/net/ice/ice_acl_filter.c | 6 +++--- drivers/net/ice/ice_fdir_filter.c | 6 +++--- drivers/net/ice/ice_switch_filter.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-)
drivers/net/ice/ice_acl_filter.c +3 -3
@@ -47,7 +47,7 @@ struct acl_rule { };static struct -ice_pattern_match_item ice_acl_pattern[] = { +ice_pattern_match_item ice_acl_supported_pattern[] = { {pattern_eth_ipv4,ICE_ACL_INSET_ETH_IPV4 ,ICE_INSET_NONE ,ICE_INSET_NONE }, {pattern_eth_ipv4_udp,ICE_ACL_INSET_ETH_IPV4_UDP ,ICE_INSET_NONE ,ICE_INSET_NONE }, {pattern_eth_ipv4_tcp,ICE_ACL_INSET_ETH_IPV4_TCP ,ICE_INSET_NONE ,ICE_INSET_NONE },
@@ -1050,8 +1050,8 @@ ice_flow_engine ice_acl_engine = {struct ice_flow_parser ice_acl_parser = { .engine = &ice_acl_engine, - .array = ice_acl_pattern, - .array_len =RTE_DIM (ice_acl_pattern), + .array = ice_acl_supported_pattern, + .array_len =RTE_DIM (ice_acl_supported_pattern), .parse_pattern_action = ice_acl_parse, .stage =ICE_FLOW_STAGE_DISTRIBUTOR , };
drivers/net/ice/ice_fdir_filter.c +3 -3
@@ -106,7 +106,7 @@ ICE_INSET_IPV6_SRC | ICE_INSET_IPV6_DST | \ ICE_INSET_NAT_T_ESP_SPI) -static struct ice_pattern_match_item ice_fdir_pattern_list[] = { +static struct ice_pattern_match_item ice_fdir_supported_pattern[] = { {pattern_raw,ICE_INSET_NONE ,ICE_INSET_NONE ,ICE_INSET_NONE }, {pattern_ethertype,ICE_FDIR_INSET_ETH ,ICE_INSET_NONE ,ICE_INSET_NONE }, {pattern_eth_ipv4,ICE_FDIR_INSET_ETH_IPV4 ,ICE_INSET_NONE ,ICE_INSET_NONE },
@@ -2494,8 +2494,8 @@ ice_fdir_parse(struct ice_adapter *ad,struct ice_flow_parser ice_fdir_parser = { .engine = &ice_fdir_engine, - .array = ice_fdir_pattern_list, - .array_len =RTE_DIM (ice_fdir_pattern_list), + .array = ice_fdir_supported_pattern, + .array_len =RTE_DIM (ice_fdir_supported_pattern), .parse_pattern_action = ice_fdir_parse, .stage =ICE_FLOW_STAGE_DISTRIBUTOR , };
drivers/net/ice/ice_switch_filter.c +3 -3
@@ -202,7 +202,7 @@ struct ice_switch_filter_conf { };static struct -ice_pattern_match_item ice_switch_pattern_dist_list[] = { +ice_pattern_match_item ice_switch_supported_pattern[] = { {pattern_any,ICE_INSET_NONE ,ICE_INSET_NONE ,ICE_INSET_NONE }, {pattern_ethertype,ICE_SW_INSET_ETHER ,ICE_INSET_NONE ,ICE_INSET_NONE }, {pattern_ethertype_vlan,ICE_SW_INSET_MAC_VLAN ,ICE_INSET_NONE ,ICE_INSET_NONE },
@@ -2075,8 +2075,8 @@ ice_flow_engine ice_switch_engine = {struct ice_flow_parser ice_switch_parser = { .engine = &ice_switch_engine, - .array = ice_switch_pattern_dist_list, - .array_len =RTE_DIM (ice_switch_pattern_dist_list), + .array = ice_switch_supported_pattern, + .array_len =RTE_DIM (ice_switch_supported_pattern), .parse_pattern_action = ice_switch_parse_pattern_action, .stage =ICE_FLOW_STAGE_DISTRIBUTOR , };
Signature · 1 line
2.31.1
PATCH v5 5/5 doc: add generic flow doc for ice PMD
In reply to Qi ZhangAdd some document about how to use rte_flow on ice PMD.
--- doc/guides/nics/ice.rst | 45 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
doc/guides/nics/ice.rst +45 -0
@@ -301,6 +301,51 @@ The DCF PMD needs to advertise and acquire DCF capability which allows DCF to send AdminQ commands that it would like to execute over to the PF and receive responses for the same from PF. +Generic Flow Support +~~~~~~~~~~~~~~~~~~~~ + +The ice PMD provides support for the Generic Flow API (RTE_FLOW), enabling +users to offload various flow classification tasks to the E810 NIC. +The E810 NIC's packet processing pipeline consists of the following stages: + +Switch: Supports exact match and limited wildcard matching with a large flow +capacity. + +ACL: Supports wildcard matching with a smaller flow capacity (DCF mode only). + +FDIR: Supports exact match with a large flow capacity (PF mode only). + +Hash: Supports RSS (PF mode only) + +The ice PMD utilizes the ice_flow_engine structure to represent each of these +stages and leverages the rte_flow rule's ``group`` attribute for selecting the +appropriate engine for Switch, ACL, and FDIR operations: + +Group 0 maps to Switch +Group 1 maps to ACL +Group 2 maps to FDIR + +In the case of RSS, it will only be selected if a ``RTE_FLOW_ACTION_RSS`` action +is targeted to no queue group, and the group attribute is ignored. + +For each engine, a list of supported patterns is maintained in a global array +named ``ice_<engine>_supported_pattern``. The Ice PMD will reject any rule with +a pattern that is not included in the supported list. + +One notable feature is the ice PMD's ability to leverage the Raw pattern, +enabling protocol-agnostic flow offloading. Here is an example of creating +a rule that matches an IPv4 destination address of 1.2.3.4 and redirects it to +queue 3 using a raw pattern: + +flow create 0 ingress group 2 pattern raw \ +pattern spec \ +00000000000000000000000008004500001400004000401000000000000001020304 \ +pattern mask \ +000000000000000000000000000000000000000000000000000000000000ffffffff \ +end actions queue index 3 / mark id 3 / end + +Currently, raw pattern support is limited to the FDIR and Hash engines. + Additional Options ++++++++++++++++++
Signature · 1 line
2.31.1
RE: [PATCH v5 5/5] doc: add generic flow doc for ice PMD
Quoted 8 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Tuesday, September 26, 2023 7:30 PM
To: Yang, Qiming <[email protected]>
Cc: Zeng, ZhichaoX <[email protected]>; [email protected]; Zhang, Qi Z <[email protected]>
Subject: [PATCH v5 5/5] doc: add generic flow doc for ice PMD
Quoted 8 lines
Add some document about how to use
rte_flowon ice PMD.Signed-off-by Qi Zhang <[email protected]>--- doc/guides/nics/ice.rst | 45 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
Zhang, Qi Z
AppliedRE: [PATCH v5 5/5] doc: add generic flow doc for ice PMD
Quoted 20 lines
-----Original Message-----
From: Zeng, ZhichaoX <[email protected]>
Sent: Wednesday, September 27, 2023 10:42 AM
To: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>
Cc: [email protected]
Subject: RE: [PATCH v5 5/5] doc: add generic flow doc for ice PMDQuoted 10 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Tuesday, September 26, 2023 7:30 PM
To: Yang, Qiming <[email protected]>
Cc: Zeng, ZhichaoX <[email protected]>; [email protected]; Zhang, Qi Z <[email protected]>
Subject: [PATCH v5 5/5] doc: add generic flow doc for ice PMDAdd some document about how to use
rte_flowon ice PMD.
Quoted 7 lines
Quoted 6 lines
Signed-off-by Qi Zhang <[email protected]>--- doc/guides/nics/ice.rst | 45 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)Series-Reviewed-by Zhichao Zeng <[email protected]>
Applied to dpdk-next-net-intel.
Thanks
Qi
Re: [PATCH v5 5/5] doc: add generic flow doc for ice PMD
In reply to Qi Zhang26/09/2023 13:29, Qi Zhang:
Quoted 20 lines
doc/guides/nics/ice.rst +20
-0+Generic Flow Support +~~~~~~~~~~~~~~~~~~~~ + +The ice PMD provides support for the Generic Flow API (RTE_FLOW), enabling +users to offload various flow classification tasks to the E810 NIC. +The E810 NIC's packet processing pipeline consists of the following stages: + +Switch: Supports exact match and limited wildcard matching with a large flow +capacity. + +ACL: Supports wildcard matching with a smaller flow capacity (DCF mode only). + +FDIR: Supports exact match with a large flow capacity (PF mode only). + +Hash: Supports RSS (PF mode only) + +The ice PMD utilizes the ice_flow_engine structure to represent each of these +stages and leverages the rte_flow rule's ``group`` attribute for selecting the +appropriate engine for Switch, ACL, and FDIR operations: +
doc/guides/nics/ice.rst The DCF PMD needs to advertise and acquire DCF capability which allows DCF to · line 333
Quoted 10 lines
doc/guides/nics/ice.rst +10
-0+Group 0 maps to Switch +Group 1 maps to ACL +Group 2 maps to FDIR + +In the case of RSS, it will only be selected if a ``RTE_FLOW_ACTION_RSS`` action +is targeted to no queue group, and the group attribute is ignored. + +For each engine, a list of supported patterns is maintained in a global array +named ``ice_<engine>_supported_pattern``. The Ice PMD will reject any rule with +a pattern that is not included in the supported list.
Why not choosing the right engine automatically?
You are defining an API (group number specialization) which is specific to this driver.
Don't you care about portability of DPDK applications?
RE: [PATCH v5 5/5] doc: add generic flow doc for ice PMD
Sorry for late response... comment inline
Quoted 46 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Friday, October 13, 2023 9:17 PM
To: Zhang, Qi Z <[email protected]>
Cc: Yang, Qiming <[email protected]>; Zeng, ZhichaoX <[email protected]>; [email protected]; [email protected]; [email protected]; Mcnamara, John <[email protected]>
Subject: Re: [PATCH v5 5/5] doc: add generic flow doc for ice PMD26/09/2023 13:29, Qi Zhang:
doc/guides/nics/ice.rst The DCF PMD needs to advertise and acquire DCF capability which allows DCF to
Quoted 11 lines
doc/guides/nics/ice.rst +11
-0+Generic Flow Support +~~~~~~~~~~~~~~~~~~~~ + +The ice PMD provides support for the Generic Flow API (RTE_FLOW), +enabling users to offload various flow classification tasks to the E810 NIC. +The E810 NIC's packet processing pipeline consists of the following stages: + +Switch: Supports exact match and limited wildcard matching with a +large flow capacity. + +ACL: Supports wildcard matching with a smaller flow capacity (DCF modeonly).
Quoted 5 lines
doc/guides/nics/ice.rst +5
-0+ +FDIR: Supports exact match with a large flow capacity (PF mode only). + +Hash: Supports RSS (PF mode only) +doc/guides/nics/ice.rst The DCF PMD needs to advertise and acquire DCF capability which allows DCF to
Quoted 10 lines
doc/guides/nics/ice.rst +10
-0+The ice PMD utilizes the ice_flow_engine structure to represent each +of these stages and leverages the rte_flow rule's ``group`` attribute +for selecting the appropriate engine for Switch, ACL, and FDIR operations: + +Group 0 maps to Switch +Group 1 maps to ACL +Group 2 maps to FDIR + +In the case of RSS, it will only be selected if a +``RTE_FLOW_ACTION_RSS`` action is targeted to no queue group, and thegroup attribute is ignored.
Review
Quoted 4 lines
(quoted diff) +4
-0+ +For each engine, a list of supported patterns is maintained in a +global array named ``ice_<engine>_supported_pattern``. The Ice PMD +will reject any rule with a pattern that is not included in the supported list.Why not choosing the right engine automatically?
Quoted 2 lines
You are defining an API (group number specialization) which is specific to this driver.
OK, let me know if my understanding is correct or not.
I think the implementation somehow broken below description in rte_flow document.
"Groups are not linked by default, so the logical hierarchy of groups must be explicitly defined by flow rules themselves in each group using the JUMP action to define the next group to redirect to. "
Could a fix like below works ? Or any better suggestion?
1. Initially, map the switch to group 0, as it represents the first stage in the hardware pipeline.
2. For ACL usage, users should create a rule in group 0 with a JUMP action that includes an arbitrarily group ID. then, the driver will associate this group with ACL engine.
3. For FDIR usage, users should create a rule within group <ACL> with a JUMP action, utilizing a distinct group ID. then, the driver will link this group with FDIR engine.
Thanks
Qi
Quoted 3 lines
Don't you care about portability of DPDK applications?