Add ACL support
Subsystems (3)
v4 cover Add ACL support
E8xx hardware provides a Ternary Classifier block for implementing functions such as ACL (Access Control List). In this series it's simply referred to as "ACL".
Implement ACL filtering. This expands support of network flow classification rules for the ethtool ntuple command. ACL filtering allows for an ip or port field's optional mask to be specified.
Example filters:
ethtool -N eth0 flow-type tcp4 dst-port 8880 m 0x00ff action 10 ethtool -N eth0 flow-type tcp4 src-ip 192.168.0.55 m 0.0.0.255 action -1
This is a resurrection of an old series from 2020 [1] with several improvements, but the fundamental logic unchanged. v1 was almost pulled in, but ultimately it was decided to drop it [2] because of unresolved issues. One issue was too many defensive NULL checks. Second issue is about inconsistency when using multiple input sets. Both are addressed in this patchset.
More about the second issue:
From [3]:
Quoted 8 lines
I would argue that you need to have some sort of logic that basically checks to see if you are going to hit the input set issue and falls back and applies the ACL rules. Otherwise you are significantly hampering the usefulness of this filter type. It doesn't make sense that dropping a field will cause a rule to fail to be added, but masking a single bit in some field will make it valid. It would make it a nightmare to use from the user point of view as the rules come across as arbitrary.
Flow Director (FD) has a hardware limitation where all filters for the same packet type must use identical input sets. Previously, attempting to add the second filter would fail.
Patch 10 adds automatic fallback to ACL block when FD cannot accommodate a filter due to input set conflicts, which resolves this inconsistency.
v4:
* Fix a bug where filters with different flow types would use the same profile, leading to strange behaviour. See patch 4 for details
* Clean up confusing code using struct ice_fd_hw_prof for ACL. This struct has many members that are not relevant to ACL. Also remove some code that dealt with those extra members (it was redundant). See patches 3, 4, 7, 8
* Resend for sashiko. v3 failed to be applied and therefore was not analyzed
v3:
* Various minor fixes, mostly reported by sashiko [4] - check individual changelogs. Not all comments were addressed (some were irrelevant)
v2:
* Rebase. Notable conflicts were the removal of ice_status and the addition of libie (which affected AdminQ communication)
* Reduce the number of defensive NULL checks
* Use = {} instead of memset for definitions
* Use kzalloc_obj() instead of plain kzalloc()
* Move from devm_ to plain allocation for objects that don't require it
* Move iterator declaration to loop start
* Move some defines out of structs
* Fix kdoc (except untouched ice_ethtool_fdir.c functions)
* Adjust style (err for return variable, spacing, rewrite some comments,
* commit messages)
* Remove overly verbose comments
* Add patches 5, 6, 9 and 10
* More changes listed in patches (if applicable)
[1] https://lore.kernel.org/intel-wired-lan/[email protected]
[2] https://lore.kernel.org/netdev/[email protected]/#t
[3] https://lore.kernel.org/netdev/CAKgT0Ucxd5-gvEwWAdbL04ER2o++RX_oekUV3E0rYquEgFKj1w@mail.gmail.com
[4] https://sashiko.dev/#/patchset/20260409120003.2719-1-marcin.szycik%40linux.intel.com
Lukasz Czapnik (1):
ice: use ACL for ntuple rules that conflict with FDir
Marcin Szycik (3):
Revert "ice: remove unused ice_flow_entry fields"
ice: use plain alloc/dealloc for ice_ntuple_fltr
ice: re-introduce ice_dealloc_flow_entry() helper
Real Valiquette (5):
ice: initialize ACL table
ice: initialize ACL scenario
ice: create flow profile
ice: create ACL entry
ice: program ACL entry
Tony Nguyen (1):
ice: rename shared Flow Director functions and structs
drivers/net/ethernet/intel/ice/Makefile | 5 +-
drivers/net/ethernet/intel/ice/ice.h | 21 +-
drivers/net/ethernet/intel/ice/ice_acl.h | 170 +++
drivers/net/ethernet/intel/ice/ice_acl_main.h | 9 +
.../net/ethernet/intel/ice/ice_adminq_cmd.h | 393 +++++-
drivers/net/ethernet/intel/ice/ice_arfs.h | 2 +-
drivers/net/ethernet/intel/ice/ice_fdir.h | 18 +-
.../net/ethernet/intel/ice/ice_flex_pipe.h | 2 +
drivers/net/ethernet/intel/ice/ice_flow.h | 39 +-
.../net/ethernet/intel/ice/ice_lan_tx_rx.h | 3 +
drivers/net/ethernet/intel/ice/ice_type.h | 10 +
drivers/net/ethernet/intel/ice/ice_acl.c | 486 +++++++
drivers/net/ethernet/intel/ice/ice_acl_ctrl.c | 1127 +++++++++++++++
drivers/net/ethernet/intel/ice/ice_acl_main.c | 295 ++++
drivers/net/ethernet/intel/ice/ice_arfs.c | 8 +-
drivers/net/ethernet/intel/ice/ice_ethtool.c | 8 +-
...ce_ethtool_fdir.c => ice_ethtool_ntuple.c} | 678 ++++++---
drivers/net/ethernet/intel/ice/ice_fdir.c | 32 +-
.../net/ethernet/intel/ice/ice_flex_pipe.c | 11 +-
drivers/net/ethernet/intel/ice/ice_flow.c | 1234 ++++++++++++++++-
drivers/net/ethernet/intel/ice/ice_lib.c | 10 +-
drivers/net/ethernet/intel/ice/ice_main.c | 94 +-
drivers/net/ethernet/intel/ice/virt/fdir.c | 32 +-
23 files changed, 4433 insertions(+), 254 deletions(-)
create mode 100644 drivers/net/ethernet/intel/ice/ice_acl.h
create mode 100644 drivers/net/ethernet/intel/ice/ice_acl_main.h
create mode 100644 drivers/net/ethernet/intel/ice/ice_acl.c
create mode 100644 drivers/net/ethernet/intel/ice/ice_acl_ctrl.c
create mode 100644 drivers/net/ethernet/intel/ice/ice_acl_main.c
rename drivers/net/ethernet/intel/ice/{ice_ethtool_fdir.c => ice_ethtool_ntuple.c} (78%)Signature · 1 line
2.49.0
PATCH v4 1/10 ice: rename shared Flow Director functions and structs
From: Tony Nguyen <[email protected]>
Rename shared Flow Director functions and structs. These entities are currently used to add Flow Director filters, however, they will be expanded to also add ACL filters. Rename the functions and struct, replacing 'fdir' to 'ntuple', to reflect that they are being used for ntuple filters and are not solely used for Flow Director.
Rename the file to also reflect this change.
---
v2:
* Also rename struct ice_fdir_fltr and file
---
drivers/net/ethernet/intel/ice/Makefile | 2 +-
drivers/net/ethernet/intel/ice/ice.h | 6 +-
drivers/net/ethernet/intel/ice/ice_arfs.h | 2 +-
drivers/net/ethernet/intel/ice/ice_fdir.h | 12 ++--
drivers/net/ethernet/intel/ice/ice_arfs.c | 8 +--
drivers/net/ethernet/intel/ice/ice_ethtool.c | 4 +-
...ce_ethtool_fdir.c => ice_ethtool_ntuple.c} | 58 ++++++++++---------
drivers/net/ethernet/intel/ice/ice_fdir.c | 18 +++---
drivers/net/ethernet/intel/ice/virt/fdir.c | 28 ++++-----
9 files changed, 70 insertions(+), 68 deletions(-)
rename drivers/net/ethernet/intel/ice/{ice_ethtool_fdir.c => ice_ethtool_ntuple.c} (97%)drivers/net/ethernet/intel/ice/Makefile +1 -1
@@ -24,7 +24,7 @@ ice-y := ice_main.o \ ice_vsi_vlan_ops.o \ ice_vsi_vlan_lib.o \ ice_fdir.o \ - ice_ethtool_fdir.o \ + ice_ethtool_ntuple.o \ ice_vlan_mode.o \ ice_flex_pipe.o \ ice_flow.o \
drivers/net/ethernet/intel/ice/ice.h +3 -3
@@ -1015,11 +1015,11 @@ void ice_deinit_rdma(struct ice_pf *pf);bool ice_is_wol_supported (struct ice_hw *hw);void ice_fdir_del_all_fltrs (struct ice_vsi *vsi);int -ice_fdir_write_fltr (struct ice_pf *pf,struct ice_fdir_fltr *input,bool add, +ice_fdir_write_fltr (struct ice_pf *pf,struct ice_ntuple_fltr *input,bool add,bool is_tun);void ice_vsi_manage_fdir (struct ice_vsi *vsi,bool ena); -int ice_add_fdir_ethtool (struct ice_vsi *vsi,struct ethtool_rxnfc *cmd); -int ice_del_fdir_ethtool (struct ice_vsi *vsi,struct ethtool_rxnfc *cmd); +int ice_add_ntuple_ethtool (struct ice_vsi *vsi,struct ethtool_rxnfc *cmd); +int ice_del_ntuple_ethtool (struct ice_vsi *vsi,struct ethtool_rxnfc *cmd);int ice_get_ethtool_fdir_entry (struct ice_hw *hw,struct ethtool_rxnfc *cmd); int ice_get_fdir_fltr_ids(struct ice_hw *hw, struct ethtool_rxnfc *cmd,
drivers/net/ethernet/intel/ice/ice_arfs.h +1 -1
@@ -13,7 +13,7 @@ enum ice_arfs_fltr_state { };struct ice_arfs_entry { -struct ice_fdir_fltr fltr_info; +struct ice_ntuple_fltr fltr_info;struct hlist_node list_entry;u64 time_activated;/* only valid for UDP flows */ u32 flow_id;
drivers/net/ethernet/intel/ice/ice_fdir.h +6 -6
@@ -160,7 +160,7 @@ struct ice_fdir_extra {__be16 vlan_tag;/* VLAN tag info */ }; -struct ice_fdir_fltr { +struct ice_ntuple_fltr {struct list_head fltr_node;enum ice_fltr_ptype flow_type;
@@ -216,18 +216,18 @@ int ice_free_fd_res_cntr(struct ice_hw *hw, u16 cntr_id);int ice_alloc_fd_guar_item (struct ice_hw *hw,u16 *cntr_id,u16 num_fltr);int ice_alloc_fd_shrd_item (struct ice_hw *hw,u16 *cntr_id,u16 num_fltr);void -ice_fdir_get_prgm_desc (struct ice_hw *hw,struct ice_fdir_fltr *input, +ice_fdir_get_prgm_desc (struct ice_hw *hw,struct ice_ntuple_fltr *input,struct ice_fltr_desc *fdesc,bool add);int -ice_fdir_get_gen_prgm_pkt (struct ice_hw *hw,struct ice_fdir_fltr *input, +ice_fdir_get_gen_prgm_pkt (struct ice_hw *hw,struct ice_ntuple_fltr *input,u8 *pkt,bool frag,bool tun);int ice_get_fdir_cnt_all (struct ice_hw *hw);int ice_fdir_num_avail_fltr (struct ice_hw *hw,struct ice_vsi *vsi); -bool ice_fdir_is_dup_fltr (struct ice_hw *hw,struct ice_fdir_fltr *input); +bool ice_fdir_is_dup_fltr (struct ice_hw *hw,struct ice_ntuple_fltr *input);bool ice_fdir_has_frag (enum ice_fltr_ptype flow); -struct ice_fdir_fltr * +struct ice_ntuple_fltr *ice_fdir_find_fltr_by_idx (struct ice_hw *hw,u32 fltr_idx);void ice_fdir_update_cntrs (struct ice_hw *hw,enum ice_fltr_ptype flow,bool add); -void ice_fdir_list_add_fltr (struct ice_hw *hw,struct ice_fdir_fltr *input); +void ice_fdir_list_add_fltr (struct ice_hw *hw,struct ice_ntuple_fltr *input);#endif /* _ICE_FDIR_H_ */
drivers/net/ethernet/intel/ice/ice_arfs.c +4 -4
@@ -302,7 +302,7 @@ ice_arfs_build_entry(struct ice_vsi *vsi, const struct flow_keys *fk, u16 rxq_idx, u32 flow_id) {struct ice_arfs_entry *arfs_entry; -struct ice_fdir_fltr *fltr_info; +struct ice_ntuple_fltr *fltr_info;u8 ip_proto; arfs_entry = devm_kzalloc(ice_pf_to_dev(vsi->back),
@@ -392,8 +392,8 @@ ice_arfs_is_perfect_flow_set(struct ice_hw *hw, __be16 l3_proto, u8 l4_proto)* * false - fltr_info and fk refer to different flows. */ static bool -ice_arfs_cmp (const struct ice_fdir_fltr *fltr_info,const struct flow_keys *fk, -__be16 n_proto,u8 ip_proto) +ice_arfs_cmp (const struct ice_ntuple_fltr *fltr_info, +const struct flow_keys *fk,__be16 n_proto,u8 ip_proto) {/* Determine if the filter is for IPv4 or IPv6 based on flow_type, * which is one of ICE_FLTR_PTYPE_NONF_IPV{4,6}_{TCP,UDP}.
@@ -485,7 +485,7 @@ ice_rx_flow_steer(struct net_device *netdev, const struct sk_buff *skb,spin_lock_bh (&vsi->arfs_lock);hlist_for_each_entry (arfs_entry, &vsi->arfs_fltr_list[idx], list_entry) { -struct ice_fdir_fltr *fltr_info; +struct ice_ntuple_fltr *fltr_info;/* keep searching for the already existing arfs_entry flow */ if (arfs_entry->flow_id != flow_id)
drivers/net/ethernet/intel/ice/ice_ethtool.c +2 -2
@@ -3143,9 +3143,9 @@ static int ice_set_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd)switch (cmd->cmd) {case ETHTOOL_SRXCLSRLINS : -return ice_add_fdir_ethtool (vsi, cmd); +return ice_add_ntuple_ethtool (vsi, cmd);case ETHTOOL_SRXCLSRLDEL : -return ice_del_fdir_ethtool (vsi, cmd); +return ice_del_ntuple_ethtool (vsi, cmd);default :break ; }
drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c renamed from drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c +30 -28
161 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_fdir.c +9 -9
@@ -648,7 +648,7 @@ ice_set_fd_desc_val(struct ice_fd_fltr_desc_ctx *ctx,* @add: if add is true, this is an add operation, false implies delete */ void -ice_fdir_get_prgm_desc (struct ice_hw *hw,struct ice_fdir_fltr *input, +ice_fdir_get_prgm_desc (struct ice_hw *hw,struct ice_ntuple_fltr *input,struct ice_fltr_desc *fdesc,bool add) {struct ice_fd_fltr_desc_ctx fdir_fltr_ctx = {0 };
@@ -855,7 +855,7 @@ static void ice_pkt_insert_mac_addr(u8 *pkt, u8 *addr)* @tun: true implies generate a tunnel packet */ int -ice_fdir_get_gen_prgm_pkt (struct ice_hw *hw,struct ice_fdir_fltr *input, +ice_fdir_get_gen_prgm_pkt (struct ice_hw *hw,struct ice_ntuple_fltr *input,u8 *pkt,bool frag,bool tun) {enum ice_fltr_ptype flow;
@@ -1138,10 +1138,10 @@ bool ice_fdir_has_frag(enum ice_fltr_ptype flow)* * Returns pointer to filter if found or null */ -struct ice_fdir_fltr * +struct ice_ntuple_fltr *ice_fdir_find_fltr_by_idx (struct ice_hw *hw,u32 fltr_idx) { -struct ice_fdir_fltr *rule; +struct ice_ntuple_fltr *rule;list_for_each_entry (rule, &hw->fdir_list_head, fltr_node) {/* rule ID found in the list */
@@ -1158,9 +1158,9 @@ ice_fdir_find_fltr_by_idx(struct ice_hw *hw, u32 fltr_idx)* @hw: hardware structure * @fltr: filter node to add to structure */ -void ice_fdir_list_add_fltr (struct ice_hw *hw,struct ice_fdir_fltr *fltr) +void ice_fdir_list_add_fltr (struct ice_hw *hw,struct ice_ntuple_fltr *fltr) { -struct ice_fdir_fltr *rule, *parent =NULL ; +struct ice_ntuple_fltr *rule, *parent =NULL ;list_for_each_entry (rule, &hw->fdir_list_head, fltr_node) {/* rule ID found or pass its spot in the list */
@@ -1215,7 +1215,7 @@ static int ice_cmp_ipv6_addr(__be32 *a, __be32 *b)* Returns true if the filters match */ static bool -ice_fdir_comp_rules (struct ice_fdir_fltr *a,struct ice_fdir_fltr *b) +ice_fdir_comp_rules (struct ice_ntuple_fltr *a,struct ice_ntuple_fltr *b) {enum ice_fltr_ptype flow_type = a->flow_type;
@@ -1275,9 +1275,9 @@ ice_fdir_comp_rules(struct ice_fdir_fltr *a, struct ice_fdir_fltr *b)* * Returns true if the filter is found in the list */ -bool ice_fdir_is_dup_fltr (struct ice_hw *hw,struct ice_fdir_fltr *input) +bool ice_fdir_is_dup_fltr (struct ice_hw *hw,struct ice_ntuple_fltr *input) { -struct ice_fdir_fltr *rule; +struct ice_ntuple_fltr *rule;bool ret = false;list_for_each_entry (rule, &hw->fdir_list_head, fltr_node) {
drivers/net/ethernet/intel/ice/virt/fdir.c +14 -14
@@ -38,7 +38,7 @@ enum ice_fdir_tunnel_type { };struct virtchnl_fdir_fltr_conf { -struct ice_fdir_fltr input; +struct ice_ntuple_fltr input;enum ice_fdir_tunnel_type ttype;u64 inset_flag;u32 flow_id;
@@ -567,12 +567,12 @@ static bool ice_vc_fdir_has_prof_conflict(struct ice_vf *vf, struct virtchnl_fdir_fltr_conf *conf) { - struct ice_fdir_fltr *desc; + struct ice_ntuple_fltr *desc;list_for_each_entry (desc, &vf->fdir.fdir_rule_list, fltr_node) {struct virtchnl_fdir_fltr_conf *existing_conf;enum ice_fltr_ptype flow_type_a, flow_type_b; -struct ice_fdir_fltr *a, *b; +struct ice_ntuple_fltr *a, *b; existing_conf =to_fltr_conf_from_desc (desc); a = &existing_conf->input;
@@ -748,7 +748,7 @@ static int ice_vc_fdir_config_input_set(struct ice_vf *vf, struct virtchnl_fdir_add *fltr, struct virtchnl_fdir_fltr_conf *conf, int tun) { - struct ice_fdir_fltr *input = &conf->input; + struct ice_ntuple_fltr *input = &conf->input;struct device *dev =ice_pf_to_dev (vf->pf);struct ice_flow_seg_info *seg;enum ice_fltr_ptype flow;
@@ -924,8 +924,8 @@ ice_vc_fdir_parse_pattern(struct ice_vf *vf, struct virtchnl_fdir_add *fltr,struct virtchnl_proto_hdrs *proto = &fltr->rule_cfg.proto_hdrs;enum virtchnl_proto_hdr_type l3 =VIRTCHNL_PROTO_HDR_NONE ;enum virtchnl_proto_hdr_type l4 =VIRTCHNL_PROTO_HDR_NONE ; +struct ice_ntuple_fltr *input = &conf->input;struct device *dev =ice_pf_to_dev (vf->pf); -struct ice_fdir_fltr *input = &conf->input;int i;if (proto->count >VIRTCHNL_MAX_NUM_PROTO_HDRS ) {
@@ -1150,8 +1150,8 @@ ice_vc_fdir_parse_action(struct ice_vf *vf, struct virtchnl_fdir_add *fltr, struct virtchnl_fdir_fltr_conf *conf) {struct virtchnl_filter_action_set *as = &fltr->rule_cfg.action_set; +struct ice_ntuple_fltr *input = &conf->input;struct device *dev =ice_pf_to_dev (vf->pf); -struct ice_fdir_fltr *input = &conf->input;u32 dest_num =0 ;u32 mark_num =0 ;int i;
@@ -1249,8 +1249,8 @@ static bool ice_vc_fdir_comp_rules(struct virtchnl_fdir_fltr_conf *conf_a, struct virtchnl_fdir_fltr_conf *conf_b) { - struct ice_fdir_fltr *a = &conf_a->input; -struct ice_fdir_fltr *b = &conf_b->input; + struct ice_ntuple_fltr *a = &conf_a->input; +struct ice_ntuple_fltr *b = &conf_b->input;if (conf_a->ttype != conf_b->ttype)return false;
@@ -1288,7 +1288,7 @@ ice_vc_fdir_comp_rules(struct virtchnl_fdir_fltr_conf *conf_a,static bool ice_vc_fdir_is_dup_fltr (struct ice_vf *vf,struct virtchnl_fdir_fltr_conf *conf) { -struct ice_fdir_fltr *desc; +struct ice_ntuple_fltr *desc;bool ret;list_for_each_entry (desc, &vf->fdir.fdir_rule_list, fltr_node) {
@@ -1317,7 +1317,7 @@ static int ice_vc_fdir_insert_entry(struct ice_vf *vf, struct virtchnl_fdir_fltr_conf *conf, u32 *id) { - struct ice_fdir_fltr *input = &conf->input; + struct ice_ntuple_fltr *input = &conf->input;int i;/* alloc ID corresponding with conf */
@@ -1341,7 +1341,7 @@ static void ice_vc_fdir_remove_entry(struct ice_vf *vf, struct virtchnl_fdir_fltr_conf *conf, u32 id) { - struct ice_fdir_fltr *input = &conf->input; + struct ice_ntuple_fltr *input = &conf->input;idr_remove (&vf->fdir.fdir_rule_idr, id);list_del (&input->fltr_node);
@@ -1367,7 +1367,7 @@ ice_vc_fdir_lookup_entry(struct ice_vf *vf, u32 id)static void ice_vc_fdir_flush_entry (struct ice_vf *vf) {struct virtchnl_fdir_fltr_conf *conf; -struct ice_fdir_fltr *desc, *temp; +struct ice_ntuple_fltr *desc, *temp;list_for_each_entry_safe (desc, temp, &vf->fdir.fdir_rule_list, fltr_node) {
@@ -1390,7 +1390,7 @@ static int ice_vc_fdir_write_fltr(struct ice_vf *vf,struct virtchnl_fdir_fltr_conf *conf, bool add, bool is_tun) { - struct ice_fdir_fltr *input = &conf->input; + struct ice_ntuple_fltr *input = &conf->input;struct ice_vsi *vsi, *ctrl_vsi;struct ice_fltr_desc desc;struct device *dev;
@@ -2315,7 +2315,7 @@ int ice_vc_del_fdir_fltr(struct ice_vf *vf, u8 *msg)struct virtchnl_fdir_fltr_conf *conf;struct ice_vf_fdir *fdir = &vf->fdir;enum virtchnl_status_code v_ret; -struct ice_fdir_fltr *input; +struct ice_ntuple_fltr *input;enum ice_fltr_ptype flow;struct device *dev;struct ice_pf *pf;
Signature · 1 line
2.49.0
RE: [Intel-wired-lan] [PATCH iwl-next v4 01/10] ice: rename shared Flow Director functions and structs
Quoted 24 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Marcin Szycik
Sent: Thursday, May 21, 2026 4:50 AM
To: [email protected]
Cc: [email protected]; Penigalapati, Sandeep <[email protected]>; S, Ananth <[email protected]>; [email protected]; Marcin Szycik <[email protected]>; Nguyen, Anthony L <[email protected]>; Loktionov, Aleksandr <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v4 01/10] ice: rename shared Flow Director functions and structsFrom: Tony Nguyen <[email protected]>
Rename shared Flow Director functions and structs. These entities are currently used to add Flow Director filters, however, they will be expanded to also add ACL filters. Rename the functions and struct, replacing 'fdir' to 'ntuple', to reflect that they are being used for ntuple filters and are not solely used for Flow Director.
Rename the file to also reflect this change.
Co-developed-by Paul M Stillwell Jr <[email protected]>Signed-off-by Paul M Stillwell Jr <[email protected]>Signed-off-by Tony Nguyen <[email protected]>Reviewed-by Aleksandr Loktionov <[email protected]>Co-developed-by Marcin Szycik <[email protected]>Signed-off-by Marcin Szycik <[email protected]>---
v2:
* Also rename structice_fdir_fltrand file
Quoted 10 lines
---
drivers/net/ethernet/intel/ice/Makefile | 2 +-
drivers/net/ethernet/intel/ice/ice.h | 6 +-
drivers/net/ethernet/intel/ice/ice_arfs.h | 2 +-
drivers/net/ethernet/intel/ice/ice_fdir.h | 12 ++--
drivers/net/ethernet/intel/ice/ice_arfs.c | 8 +--
drivers/net/ethernet/intel/ice/ice_ethtool.c | 4 +- ...ce_ethtool_fdir.c => ice_ethtool_ntuple.c} | 58 ++++++++++---------
drivers/net/ethernet/intel/ice/ice_fdir.c | 18 +++---
drivers/net/ethernet/intel/ice/virt/fdir.c | 28 ++++-----
9 files changed, 70 insertions(+), 68 deletions(-) rename drivers/net/ethernet/intel/ice/{ice_ethtool_fdir.c => ice_ethtool_ntuple.c} (97%)PATCH v4 2/10 ice: initialize ACL table
In reply to Marcin SzycikFrom: Real Valiquette <[email protected]>
E8xx hardware provides a Ternary Classifier block for implementing functions such as ACL (Access Control List). In this series it's simply referred to as "ACL".
ACL filtering can be utilized to expand support of ntuple rules by allowing mask values to be specified for redirect to queue or drop.
Implement support for specifying the 'm' value of ethtool ntuple command for currently supported fields (src-ip, dst-ip, src-port, and dst-port).
For example:
ethtool -N eth0 flow-type tcp4 dst-port 8880 m 0x00ff action 10
or
ethtool -N eth0 flow-type tcp4 src-ip 192.168.0.55 m 0.0.0.255 action -1
At this time the following flow-types support mask values: tcp4, udp4, sctp4, and ip4.
Begin implementation of ACL filters by setting up structures, AdminQ commands, and allocation of the ACL table in the hardware.
---
v2:
* Return -ERANGE in one branch in ice_aq_alloc_acl_tbl() to differenciate error codes
* Use GENMASK() for ICE_AQ_VSI_ACL_DEF_RX_*_M
* Use plain alloc/kfree for hw->acl_tbl
* Call ice_deinit_acl() unconditionally because ICE_FLAG_FD_ENA can be disabled during operation
* ice_acl_init_tbl(): remove first/last variables
* Merge ice_aq_acl_entry() into ice_aq_program_acl_entry() and ice_aq_actpair_p_q() into ice_aq_program_actpair() - wrappers with one user make no sense
* Rename ICE_AQC_ALLOC_ID_LESS_THAN_4K to more sensible ICE_AQC_ALLOC_ID_4K
* Reorder members of struct ice_acl_tbl to minimize holes
* Remove ICE_AQ_VSI_ACL_DEF_RX_*_S - will be unused after switching to FIELD_PREP() in "ice: program ACL entry"
* Replace memset() with = {} in ice_init_acl()
--- drivers/net/ethernet/intel/ice/Makefile | 2 + drivers/net/ethernet/intel/ice/ice.h | 3 + drivers/net/ethernet/intel/ice/ice_acl.h | 117 +++++++ .../net/ethernet/intel/ice/ice_adminq_cmd.h | 208 +++++++++++- drivers/net/ethernet/intel/ice/ice_type.h | 3 + drivers/net/ethernet/intel/ice/ice_acl.c | 136 ++++++++ drivers/net/ethernet/intel/ice/ice_acl_ctrl.c | 302 ++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_main.c | 49 +++ 8 files changed, 818 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_acl.h create mode 100644 drivers/net/ethernet/intel/ice/ice_acl.c create mode 100644 drivers/net/ethernet/intel/ice/ice_acl_ctrl.c
drivers/net/ethernet/intel/ice/Makefile +2 -0
@@ -25,6 +25,8 @@ ice-y := ice_main.o \ ice_vsi_vlan_lib.o \ ice_fdir.o \ ice_ethtool_ntuple.o \ + ice_acl.o \ + ice_acl_ctrl.o \ ice_vlan_mode.o \ ice_flex_pipe.o \ ice_flow.o \
drivers/net/ethernet/intel/ice/ice.h +3 -0
@@ -157,6 +157,9 @@#define ICE_SWITCH_FLTR_PRIO_VSI 5#define ICE_SWITCH_FLTR_PRIO_QGRP ICE_SWITCH_FLTR_PRIO_VSI +#define ICE_ACL_ENTIRE_SLICE 1 +#define ICE_ACL_HALF_SLICE 2 +/* Macro for each VSI in a PF */ #define ice_for_each_vsi (pf, i) \ for ((i) = 0; (i) < (pf)->num_alloc_vsi; (i)++)
drivers/net/ethernet/intel/ice/ice_acl.h new file +117 -0
117 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +206 -2
232 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_type.h +3 -0
@@ -54,6 +54,7 @@ static inline u32 ice_round_to_num(u32 N, u32 R)#define ICE_DBG_RDMA BIT_ULL(15)#define ICE_DBG_PKG BIT_ULL(16)#define ICE_DBG_RES BIT_ULL(17) +#define ICE_DBG_ACL BIT_ULL(18)#define ICE_DBG_PTP BIT_ULL(19)#define ICE_DBG_AQ_MSG BIT_ULL(24)#define ICE_DBG_AQ_DESC BIT_ULL(25)
@@ -1024,6 +1025,8 @@ struct ice_hw {struct udp_tunnel_nic_shared udp_tunnel_shared;struct udp_tunnel_nic_info udp_tunnel_nic; +struct ice_acl_tbl *acl_tbl; +/* dvm boost update information */ struct ice_dvm_table dvm_upd;
drivers/net/ethernet/intel/ice/ice_acl.c new file +136 -0
136 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_acl_ctrl.c new file +302 -0
302 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_main.c +49 -0
73 lines not on this page · raw message
Signature · 1 line
2.49.0
RE: [Intel-wired-lan] [PATCH iwl-next v4 02/10] ice: initialize ACL table
Quoted 49 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Marcin Szycik
Sent: Thursday, May 21, 2026 4:50 AM
To: [email protected]
Cc: [email protected]; Penigalapati, Sandeep <[email protected]>; S, Ananth <[email protected]>; [email protected]; Marcin Szycik <[email protected]>; Cao, Chinh T <[email protected]>; Nguyen, Anthony L <[email protected]>; Loktionov, Aleksandr <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v4 02/10] ice: initialize ACL tableFrom: Real Valiquette <[email protected]>
E8xx hardware provides a Ternary Classifier block for implementing functions such as ACL (Access Control List). In this series it's simply referred to as "ACL".
ACL filtering can be utilized to expand support of ntuple rules by allowing mask values to be specified for redirect to queue or drop.
Implement support for specifying the 'm' value of ethtool ntuple command for currently supported fields (src-ip, dst-ip, src-port, and dst-port).
For example:
ethtool -N eth0 flow-type tcp4 dst-port 8880 m0x00ffaction 10 or ethtool -N eth0 flow-type tcp4 src-ip 192.168.0.55 m 0.0.0.255 action -1At this time the following flow-types support mask values: tcp4, udp4, sctp4, and ip4.
Begin implementation of ACL filters by setting up structures, AdminQ commands, and allocation of the ACL table in the hardware.
Co-developed-by Chinh Cao <[email protected]>Signed-off-by Chinh Cao <[email protected]>Signed-off-by Real Valiquette <[email protected]>Co-developed-by Tony Nguyen <[email protected]>Signed-off-by Tony Nguyen <[email protected]>Co-developed-by Marcin Szycik <[email protected]>Signed-off-by Marcin Szycik <[email protected]>Reviewed-by Aleksandr Loktionov <[email protected]>---
v2:
* Return-ERANGEin one branch inice_aq_alloc_acl_tbl()to differenciate error codes
* UseGENMASK()for ICE_AQ_VSI_ACL_DEF_RX_*_M
* Use plain alloc/kfree forhw->acl_tbl
* Callice_deinit_acl()unconditionally becauseICE_FLAG_FD_ENAcan be disabled during operation
*ice_acl_init_tbl(): remove first/last variables
* Mergeice_aq_acl_entry()intoice_aq_program_acl_entry()andice_aq_actpair_p_q()intoice_aq_program_actpair()- wrappers with one user make no sense
* RenameICE_AQC_ALLOC_ID_LESS_THAN_4Kto more sensibleICE_AQC_ALLOC_ID_4K
* Reorder members of structice_acl_tblto minimize holes
* Remove ICE_AQ_VSI_ACL_DEF_RX_*_S - will be unused after switching toFIELD_PREP()in "ice: program ACL entry"
* Replacememset()with = {} inice_init_acl()
Quoted 12 lines
--- drivers/net/ethernet/intel/ice/Makefile | 2 + drivers/net/ethernet/intel/ice/ice.h | 3 + drivers/net/ethernet/intel/ice/ice_acl.h | 117 +++++++ .../net/ethernet/intel/ice/ice_adminq_cmd.h | 208 +++++++++++- drivers/net/ethernet/intel/ice/ice_type.h | 3 + drivers/net/ethernet/intel/ice/ice_acl.c | 136 ++++++++ drivers/net/ethernet/intel/ice/ice_acl_ctrl.c | 302 ++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_main.c | 49 +++ 8 files changed, 818 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_acl.h create mode 100644 drivers/net/ethernet/intel/ice/ice_acl.c create mode 100644 drivers/net/ethernet/intel/ice/ice_acl_ctrl.c
PATCH v4 3/10 ice: initialize ACL scenario
In reply to Marcin SzycikFrom: Real Valiquette <[email protected]>
Complete initialization of the ACL table by programming the table with an initial scenario. The scenario stores the data for the filtering rules. Adjust reporting of ntuple filters to include ACL filters.
---
v4:
* Introduce struct ice_acl_hw_prof in place of using struct ice_fd_hw_prof for ACL. It didn't make very much sense, because most members were actually unsed, in addition to it being very confusing.
* Now, ice_fdir_rem_flow() won't be able to remove ACL profiles (because ice_fdir_get_hw_prof() no longer returns them, as it should logically be). Instead, create a new function: ice_acl_rem_flows(). It's simpler than the previously used ice_fdir_rem_flow(), because it doesn't need to iterate over any arrays. It also doesn't need to call some functions - it should all be handled by ice_acl_rem_flow()
v3:
* ice_acl_create_scen(): add check against max match width (ICE_ACL_MAX_WIDTH_BYTES)
* ice_acl_alloc_partition(): change row type to int, throw errors if subtractions underflows
* ice_acl_destroy_scen(): add a call to ice_acl_commit_partition() to clear availability bits. We don't actually destroy scenarios outside of driver deinit, so this doesn't currently matter, but should be done to futureproof the code
* ice_fdir_update_cntrs(): remove flow and acl_fltr args, pass the whole fltr and read those values from it. This prevents passing literal value as acl_fltr, ensuring the correct counter will be modified (previously there were some hardcoded calls)
v2:
* Add unroll in ice_init_acl() in case of ice_acl_create_scen() failure
--- drivers/net/ethernet/intel/ice/ice.h | 1 + drivers/net/ethernet/intel/ice/ice_acl.h | 8 + .../net/ethernet/intel/ice/ice_adminq_cmd.h | 31 + drivers/net/ethernet/intel/ice/ice_fdir.h | 6 +- drivers/net/ethernet/intel/ice/ice_flow.h | 7 + drivers/net/ethernet/intel/ice/ice_type.h | 7 + drivers/net/ethernet/intel/ice/ice_acl.c | 116 ++++ drivers/net/ethernet/intel/ice/ice_acl_ctrl.c | 573 ++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_ethtool.c | 4 +- .../ethernet/intel/ice/ice_ethtool_ntuple.c | 68 ++- drivers/net/ethernet/intel/ice/ice_fdir.c | 14 +- drivers/net/ethernet/intel/ice/ice_main.c | 17 +- 12 files changed, 835 insertions(+), 17 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +1 -0
@@ -1024,6 +1024,7 @@ void ice_vsi_manage_fdir(struct ice_vsi *vsi, bool ena);int ice_add_ntuple_ethtool (struct ice_vsi *vsi,struct ethtool_rxnfc *cmd);int ice_del_ntuple_ethtool (struct ice_vsi *vsi,struct ethtool_rxnfc *cmd);int ice_get_ethtool_fdir_entry (struct ice_hw *hw,struct ethtool_rxnfc *cmd); +u32 ice_ntuple_get_max_fltr_cnt (struct ice_hw *hw);int ice_get_fdir_fltr_ids (struct ice_hw *hw,struct ethtool_rxnfc *cmd,u32 *rule_locs);
drivers/net/ethernet/intel/ice/ice_acl.h +8 -0
@@ -101,6 +101,8 @@ struct ice_acl_alloc_tbl {int ice_acl_create_tbl (struct ice_hw *hw,struct ice_acl_tbl_params *params);int ice_acl_destroy_tbl (struct ice_hw *hw); +int ice_acl_create_scen (struct ice_hw *hw,u16 match_width,u16 num_entries, +u16 *scen_id);int ice_aq_alloc_acl_tbl (struct ice_hw *hw,struct ice_acl_alloc_tbl *tbl,struct ice_sq_cd *cd); int ice_aq_dealloc_acl_tbl(struct ice_hw *hw, u16 alloc_id,
@@ -113,5 +115,11 @@ int ice_aq_program_actpair(struct ice_hw *hw, u8 act_mem_idx, u16 act_entry_idx, struct ice_aqc_actpair *buf, struct ice_sq_cd *cd);int ice_aq_alloc_acl_scen (struct ice_hw *hw,u16 *scen_id,struct ice_aqc_acl_scen *buf,struct ice_sq_cd *cd); +int ice_aq_dealloc_acl_scen (struct ice_hw *hw,u16 scen_id, +struct ice_sq_cd *cd); +int ice_aq_update_acl_scen (struct ice_hw *hw,u16 scen_id, +struct ice_aqc_acl_scen *buf,struct ice_sq_cd *cd); +int ice_aq_query_acl_scen (struct ice_hw *hw,u16 scen_id, +struct ice_aqc_acl_scen *buf,struct ice_sq_cd *cd);#endif /* _ICE_ACL_H_ */
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +31 -0
@@ -1994,6 +1994,8 @@ struct ice_aqc_neigh_dev_req { ICE_ACL_ENTRY_ALLOC_UNIT)#define ICE_AQC_ACL_ALLOC_UNITS (ICE_AQC_ACL_SLICES * \ ICE_AQC_MAX_TCAM_ALLOC_UNITS) +#define ICE_ACL_MAX_WIDTH_BYTES (ICE_AQC_ACL_SLICES * \ + ICE_AQC_ACL_KEY_WIDTH_BYTES)struct ice_aqc_acl_alloc_table {__le16 table_width;
@@ -2070,6 +2072,33 @@ struct ice_aqc_acl_generic {u8 act_mem[ICE_AQC_MAX_ACTION_MEMORIES ]; }; +/* Allocate ACL scenario (indirect 0x0C14). This command doesn't have separate +* response buffer since original command buffer gets updated with +* 'scen_id' in case of success +*/ +struct ice_aqc_acl_alloc_scen { +union { +struct { +u8 reserved[8 ]; + } cmd; +struct { +__le16 scen_id; +u8 reserved[6 ]; + } resp; + } ops; +__le32 addr_high; +__le32 addr_low; +}; + +/* De-allocate ACL scenario (direct 0x0C15). This command doesn't need +* separate response buffer since nothing to be returned as a response +* except status. +*/ +struct ice_aqc_acl_dealloc_scen { +__le16 scen_id; +u8 reserved[14 ]; +}; +/* Update ACL scenario (direct 0x0C1B) * Query ACL scenario (direct 0x0C23) */
@@ -2850,6 +2879,8 @@ enum ice_adminq_opc {/* ACL commands */ ice_aqc_opc_alloc_acl_tbl =0x0C10 , ice_aqc_opc_dealloc_acl_tbl =0x0C11 , + ice_aqc_opc_alloc_acl_scen =0x0C14 , + ice_aqc_opc_dealloc_acl_scen =0x0C15 , ice_aqc_opc_update_acl_scen =0x0C1B , ice_aqc_opc_program_acl_actpair =0x0C1C , ice_aqc_opc_program_acl_entry = 0x0C20,
drivers/net/ethernet/intel/ice/ice_fdir.h +4 -2
@@ -198,6 +198,8 @@ struct ice_ntuple_fltr {u32 fltr_id;u8 fdid_prio;u8 comp_report; + +bool acl_fltr; };/* Dummy packet filter definition structure */
@@ -227,7 +229,7 @@ bool ice_fdir_is_dup_fltr(struct ice_hw *hw, struct ice_ntuple_fltr *input);bool ice_fdir_has_frag (enum ice_fltr_ptype flow);struct ice_ntuple_fltr *ice_fdir_find_fltr_by_idx (struct ice_hw *hw,u32 fltr_idx); -void -ice_fdir_update_cntrs (struct ice_hw *hw,enum ice_fltr_ptype flow,bool add); +void ice_fdir_update_cntrs (struct ice_hw *hw,struct ice_ntuple_fltr *fltr, +bool add);void ice_fdir_list_add_fltr (struct ice_hw *hw,struct ice_ntuple_fltr *input);#endif /* _ICE_FDIR_H_ */
drivers/net/ethernet/intel/ice/ice_flow.h +7 -0
@@ -482,6 +482,13 @@ struct ice_flow_prof {DECLARE_BITMAP (vsis,ICE_MAX_VSI );bool symm;/* Symmetric Hash for RSS */ + +union { +/* struct sw_recipe */ +struct ice_acl_scen *scen; +/* struct fd */ +u32 data; + } cfg; };struct ice_rss_raw_cfg {
drivers/net/ethernet/intel/ice/ice_type.h +7 -0
@@ -266,6 +266,11 @@ struct ice_fd_hw_prof {u64 prof_id[ICE_FD_HW_SEG_MAX ]; }; +struct ice_acl_hw_prof { +struct ice_flow_seg_info *seg; +u64 prof_id; +}; +/* Common HW capabilities for SW use */ struct ice_hw_common_caps {u32 valid_functions;
@@ -1026,6 +1031,8 @@ struct ice_hw {struct udp_tunnel_nic_info udp_tunnel_nic;struct ice_acl_tbl *acl_tbl; +struct ice_acl_hw_prof **acl_prof; +u16 acl_fltr_cnt[ICE_FLTR_PTYPE_MAX ];/* dvm boost update information */ struct ice_dvm_table dvm_upd;
drivers/net/ethernet/intel/ice/ice_acl.c +116 -0
119 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_acl_ctrl.c +573 -0
597 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_ethtool.c +2 -2
@@ -3188,8 +3188,8 @@ ice_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,switch (cmd->cmd) {case ETHTOOL_GRXCLSRLCNT : cmd->rule_cnt = hw->fdir_active_fltr; -/* report total rule count */ - cmd->data =ice_get_fdir_cnt_all (hw); +/* report max rule count */ + cmd->data =ice_ntuple_get_max_fltr_cnt (hw); ret =0 ;break ;case ETHTOOL_GRXCLSRULE :
drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c +60 -8
122 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_fdir.c +10 -4
@@ -1178,19 +1178,25 @@ void ice_fdir_list_add_fltr(struct ice_hw *hw, struct ice_ntuple_fltr *fltr)/** * ice_fdir_update_cntrs - increment / decrement filter counter * @hw: pointer to hardware structure -* @flow: filter flow type +* @fltr: filter node * @add: true implies filters added */ -void -ice_fdir_update_cntrs (struct ice_hw *hw,enum ice_fltr_ptype flow,bool add) +void ice_fdir_update_cntrs (struct ice_hw *hw,struct ice_ntuple_fltr *fltr, +bool add) { +enum ice_fltr_ptype flow = fltr->flow_type;int incr; incr = add ?1 :-1 ; hw->fdir_active_fltr += incr; -if (flow ==ICE_FLTR_PTYPE_NONF_NONE || flow >=ICE_FLTR_PTYPE_MAX ) +if (flow ==ICE_FLTR_PTYPE_NONF_NONE || flow >=ICE_FLTR_PTYPE_MAX ) {ice_debug (hw,ICE_DBG_SW ,"Unknown filter type %d\n" , flow); +return ; + } + +if (fltr->acl_fltr) + hw->acl_fltr_cnt[flow] += incr;else hw->fdir_fltr_cnt[flow] += incr; }
drivers/net/ethernet/intel/ice/ice_main.c +16 -1
@@ -4346,6 +4346,8 @@ static int ice_init_acl(struct ice_pf *pf)struct ice_acl_tbl_params params = {};struct ice_hw *hw = &pf->hw;int divider; +u16 scen_id; +int err;/* Creates a single ACL table that consist of src_ip(4 byte), * dest_ip(4 byte), src_port(2 byte) and dst_port(2 byte) for a total
@@ -4364,7 +4366,20 @@ static int ice_init_acl(struct ice_pf *pf) params.entry_act_pairs =1 ; params.concurr = false; -return ice_acl_create_tbl (hw, ¶ms); + err =ice_acl_create_tbl (hw, ¶ms); +if (err) +return err; + + err =ice_acl_create_scen (hw, params.width, params.depth, &scen_id); +if (err) + goto destroy_table; + +return 0 ; + +destroy_table: +ice_acl_destroy_tbl (hw); + +return err; }/**
Signature · 1 line
2.49.0
RE: [Intel-wired-lan] [PATCH iwl-next v4 03/10] ice: initialize ACL scenario
Quoted 46 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Marcin Szycik
Sent: Thursday, May 21, 2026 4:50 AM
To: [email protected]
Cc: [email protected]; Penigalapati, Sandeep <[email protected]>; S, Ananth <[email protected]>; [email protected]; Marcin Szycik <[email protected]>; Cao, Chinh T <[email protected]>; Nguyen, Anthony L <[email protected]>; Loktionov, Aleksandr <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v4 03/10] ice: initialize ACL scenarioFrom: Real Valiquette <[email protected]>
Complete initialization of the ACL table by programming the table with an initial scenario. The scenario stores the data for the filtering rules. Adjust reporting of ntuple filters to include ACL filters.
Co-developed-by Chinh Cao <[email protected]>Signed-off-by Chinh Cao <[email protected]>Signed-off-by Real Valiquette <[email protected]>Co-developed-by Tony Nguyen <[email protected]>Signed-off-by Tony Nguyen <[email protected]>Reviewed-by Aleksandr Loktionov <[email protected]>Signed-off-by Marcin Szycik <[email protected]>---
v4:
* Introduce structice_acl_hw_profin place of using structice_fd_hw_proffor ACL. It didn't make very much sense, because most members were actually unsed, in addition to it being very confusing.
* Now,ice_fdir_rem_flow()won't be able to remove ACL profiles (becauseice_fdir_get_hw_prof()no longer returns them, as it should logically be). Instead, create a new function:ice_acl_rem_flows(). It's simpler than the previously usedice_fdir_rem_flow(), because it doesn't need to iterate over any arrays. It also doesn't need to call some functions - it should all be handled byice_acl_rem_flow()
v3:
*ice_acl_create_scen(): add check against max match width (ICE_ACL_MAX_WIDTH_BYTES)
*ice_acl_alloc_partition(): changerowtype to int, throw errors if subtractions underflows
*ice_acl_destroy_scen(): add a call toice_acl_commit_partition()to clear availability bits. We don't actually destroy scenarios outside of driver deinit, so this doesn't currently matter, but should be done to futureproof the code
*ice_fdir_update_cntrs(): removeflowandacl_fltrargs, pass the whole fltr and read those values from it. This prevents passing literal value asacl_fltr, ensuring the correct counter will be modified (previously there were some hardcoded calls)
v2:
* Add unroll inice_init_acl()in case ofice_acl_create_scen()failure
Quoted 14 lines
--- drivers/net/ethernet/intel/ice/ice.h | 1 + drivers/net/ethernet/intel/ice/ice_acl.h | 8 + .../net/ethernet/intel/ice/ice_adminq_cmd.h | 31 + drivers/net/ethernet/intel/ice/ice_fdir.h | 6 +- drivers/net/ethernet/intel/ice/ice_flow.h | 7 + drivers/net/ethernet/intel/ice/ice_type.h | 7 + drivers/net/ethernet/intel/ice/ice_acl.c | 116 ++++ drivers/net/ethernet/intel/ice/ice_acl_ctrl.c | 573 ++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_ethtool.c | 4 +- .../ethernet/intel/ice/ice_ethtool_ntuple.c | 68 ++- drivers/net/ethernet/intel/ice/ice_fdir.c | 14 +- drivers/net/ethernet/intel/ice/ice_main.c | 17 +- 12 files changed, 835 insertions(+), 17 deletions(-)
PATCH v4 4/10 ice: create flow profile
In reply to Marcin SzycikFrom: Real Valiquette <[email protected]>
Implement the initial steps for creating an ACL filter to support ntuple masks. Create a flow profile based on a given mask rule and program it to the hardware. Though the profile is written to hardware, no actions are associated with the profile yet.
---
v4:
* ice_acl_prof_add_ethtool(): add missing line (hw_prof->prof_id = prof->id;). Without it, all flow entries are added to profile 0, which wrongly uses old extraction sequence in case flow type is different. To reproduce, add two filters with different input sets and check if they forward to expected queues, e.g.:
ethtool -N $PF1 flow-type tcp4 src-port 1234 m 0x000f action 23
ethtool -N $PF1 flow-type udp4 src-port 1234 m 0x000f action 24* Adjust to using struct ice_acl_hw_prof instead of struct ice_fd_hw_prof
* ice_acl_prof_add_ethtool(): remove old_seg helper variable - after above change, accessing old segment is straightforward, so it's not needed
v3:
* ice_acl_prof_add_ethtool(): add a writeback to hw profile in error path to prevent leaving a pointer to deallocated object
* ice_deinit_acl(): exit early if hw->acl_prof is already NULL
* ice_flow_acl_def_entry_frmt(): copy seg->match to variable instead of reading it as unsigned long pointer in order to avoid potential type mismatch
v2:
* Add ice_acl_main.h in order to not awkwardly add prototypes to ice.h. This will also help avoid potential dependency issues for future additions to ice_acl_main.c
* Rename ice_acl_check_input_set() to a more fiting ice_acl_prof_add_ethtool() as it adds a profile
* Set hw->acl_prof = 0 in ice_acl_prof_add_ethtool() to avoid use after free
* Add ipv4 and port full mask defines in ice_ethtool_ntuple.c
* Move hw->acl_prof allocation to ice_init_acl(). Previously, it was being deallocated when hw->acl_prof[fltr_type] allocation failed, possibly with already existing other elements. Extend array lifetime to driver's lifetime
* Change hw->acl_prof[fltr_type] alloc from devm_ to plain
* Add hw->acl_prof[fltr_type] and hw->acl_prof deallocation in ice_deinit_acl() - previously were only deallocated on failure
* Tweak alloc/unroll logic in ice_acl_prof_add_ethtool()
--- drivers/net/ethernet/intel/ice/Makefile | 1 + drivers/net/ethernet/intel/ice/ice.h | 6 + drivers/net/ethernet/intel/ice/ice_acl_main.h | 9 + .../net/ethernet/intel/ice/ice_adminq_cmd.h | 39 +++ drivers/net/ethernet/intel/ice/ice_flow.h | 17 + drivers/net/ethernet/intel/ice/ice_acl_main.c | 228 +++++++++++++ .../ethernet/intel/ice/ice_ethtool_ntuple.c | 299 +++++++++++++----- .../net/ethernet/intel/ice/ice_flex_pipe.c | 6 + drivers/net/ethernet/intel/ice/ice_flow.c | 173 ++++++++++ drivers/net/ethernet/intel/ice/ice_main.c | 36 ++- 10 files changed, 733 insertions(+), 81 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_acl_main.h create mode 100644 drivers/net/ethernet/intel/ice/ice_acl_main.c
drivers/net/ethernet/intel/ice/Makefile +1 -0
@@ -25,6 +25,7 @@ ice-y := ice_main.o \ ice_vsi_vlan_lib.o \ ice_fdir.o \ ice_ethtool_ntuple.o \ + ice_acl_main.o \ ice_acl.o \ ice_acl_ctrl.o \ ice_vlan_mode.o \
drivers/net/ethernet/intel/ice/ice.h +6 -0
@@ -1025,6 +1025,11 @@ int ice_add_ntuple_ethtool(struct ice_vsi *vsi, struct ethtool_rxnfc *cmd);int ice_del_ntuple_ethtool (struct ice_vsi *vsi,struct ethtool_rxnfc *cmd);int ice_get_ethtool_fdir_entry (struct ice_hw *hw,struct ethtool_rxnfc *cmd);u32 ice_ntuple_get_max_fltr_cnt (struct ice_hw *hw); +int ice_ntuple_l4_proto_to_port (enum ice_flow_seg_hdr l4_proto, +enum ice_flow_field *src_port, +enum ice_flow_field *dst_port); +int ice_ntuple_check_ip4_seg (struct ethtool_tcpip4_spec *tcp_ip4_spec); +int ice_ntuple_check_ip4_usr_seg (struct ethtool_usrip4_spec *usr_ip4_spec);int ice_get_fdir_fltr_ids (struct ice_hw *hw,struct ethtool_rxnfc *cmd,u32 *rule_locs);
@@ -1033,6 +1038,7 @@ void ice_fdir_release_flows(struct ice_hw *hw);void ice_fdir_replay_flows (struct ice_hw *hw);void ice_fdir_replay_fltrs (struct ice_pf *pf);int ice_fdir_create_dflt_rules (struct ice_pf *pf); +enum ice_fltr_ptype ice_ethtool_flow_to_fltr (int eth);enum ice_aq_task_state {ICE_AQ_TASK_NOT_PREPARED ,
drivers/net/ethernet/intel/ice/ice_acl_main.h new file +9 -0
@@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2026, Intel Corporation. */ + +#ifndef _ICE_ACL_MAIN_H_ +#define _ICE_ACL_MAIN_H_ +#include "ice.h" +#include <linux/ethtool.h> +int ice_acl_add_rule_ethtool (struct ice_vsi *vsi,struct ethtool_rxnfc *cmd); +#endif /* _ICE_ACL_MAIN_H_ */
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +39 -0
@@ -172,6 +172,8 @@ struct ice_aqc_set_port_params {#define ICE_AQC_RES_TYPE_FDIR_COUNTER_BLOCK 0x21#define ICE_AQC_RES_TYPE_FDIR_GUARANTEED_ENTRIES 0x22#define ICE_AQC_RES_TYPE_FDIR_SHARED_ENTRIES 0x23 +#define ICE_AQC_RES_TYPE_ACL_PROF_BLDR_PROFID 0x50 +#define ICE_AQC_RES_TYPE_ACL_PROF_BLDR_TCAM 0x51#define ICE_AQC_RES_TYPE_FD_PROF_BLDR_PROFID 0x58#define ICE_AQC_RES_TYPE_FD_PROF_BLDR_TCAM 0x59#define ICE_AQC_RES_TYPE_HASH_PROF_BLDR_PROFID 0x60
@@ -2177,6 +2179,43 @@ struct ice_aqc_actpair {struct ice_acl_act_entry act[ICE_ACL_NUM_ACT_PER_ACT_PAIR ]; }; +/* The first byte of the byte selection base is reserved to keep the +* first byte of the field vector where the packet direction info is +* available. Thus we should start at index 1 of the field vector to +* map its entries to the byte selection base. +*/ +#define ICE_AQC_ACL_PROF_BYTE_SEL_START_IDX 1 +#define ICE_AQC_ACL_PROF_BYTE_SEL_ELEMS 30 + +/* Input buffer format for program profile extraction admin command and +* response buffer format for query profile admin command is as defined +* in struct ice_aqc_acl_prof_generic_frmt +*/ + +/* Input buffer format for program profile ranges and query profile ranges +* admin commands. Same format is used for response buffer in case of query +* profile ranges command +*/ +struct ice_acl_rng_data { +/* The range checker output shall be sent when the value +* related to this range checker is lower than low boundary +*/ +__be16 low_boundary; +/* The range checker output shall be sent when the value +* related to this range checker is higher than high boundary +*/ +__be16 high_boundary; +/* A value of '0' in bit shall clear the relevant bit input +* to the range checker +*/ +__be16 mask; +}; + +#define ICE_AQC_ACL_PROF_RANGES_NUM_CFG 8 +struct ice_aqc_acl_profile_ranges { +struct ice_acl_rng_data checker_cfg[ICE_AQC_ACL_PROF_RANGES_NUM_CFG ]; +}; +/* Program ACL entry (indirect 0x0C20) */ struct ice_aqc_acl_entry {u8 tcam_index;
drivers/net/ethernet/intel/ice/ice_flow.h +17 -0
@@ -504,6 +504,23 @@ struct ice_rss_cfg {struct ice_rss_hash_cfg hash; }; +enum ice_flow_action_type { +ICE_FLOW_ACT_NOP , +ICE_FLOW_ACT_DROP , +ICE_FLOW_ACT_CNTR_PKT , +ICE_FLOW_ACT_FWD_QUEUE , +ICE_FLOW_ACT_CNTR_BYTES , +ICE_FLOW_ACT_CNTR_PKT_BYTES , +}; + +struct ice_flow_action { +enum ice_flow_action_type type; +union { +struct ice_acl_act_entry acl_act; +u32 dummy; + } data; +}; + int ice_flow_add_prof(struct ice_hw *hw, enum ice_block blk, enum ice_flow_dir dir, struct ice_flow_seg_info *segs, u8 segs_cnt,
drivers/net/ethernet/intel/ice/ice_acl_main.c new file +228 -0
228 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c +222 -77
455 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_flex_pipe.c +6 -0
@@ -1259,6 +1259,9 @@ ice_find_prof_id_with_mask(struct ice_hw *hw, enum ice_block blk,static bool ice_prof_id_rsrc_type (enum ice_block blk,u16 *rsrc_type) {switch (blk) { +case ICE_BLK_ACL : + *rsrc_type =ICE_AQC_RES_TYPE_ACL_PROF_BLDR_PROFID ; +break ;case ICE_BLK_FD : *rsrc_type =ICE_AQC_RES_TYPE_FD_PROF_BLDR_PROFID ;break ;
@@ -1279,6 +1282,9 @@ static bool ice_prof_id_rsrc_type(enum ice_block blk, u16 *rsrc_type)static bool ice_tcam_ent_rsrc_type (enum ice_block blk,u16 *rsrc_type) {switch (blk) { +case ICE_BLK_ACL : + *rsrc_type =ICE_AQC_RES_TYPE_ACL_PROF_BLDR_TCAM ; +break ;case ICE_BLK_FD : *rsrc_type =ICE_AQC_RES_TYPE_FD_PROF_BLDR_TCAM ;break ;
drivers/net/ethernet/intel/ice/ice_flow.c +173 -0
203 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_main.c +32 -4
@@ -4336,19 +4336,25 @@ static int ice_send_version(struct ice_pf *pf) }/** -* ice_init_acl - Initializes the ACL block +* ice_init_acl - initialize the ACL block and allocate necessary structs * @pf: ptr to PF device * * Return: 0 on success, negative on error */ static int ice_init_acl (struct ice_pf *pf) { +struct device *dev =ice_pf_to_dev (pf);struct ice_acl_tbl_params params = {};struct ice_hw *hw = &pf->hw;int divider;u16 scen_id;int err; + hw->acl_prof =devm_kcalloc (dev,ICE_FLTR_PTYPE_MAX , +sizeof (*hw->acl_prof),GFP_KERNEL ); +if (!hw->acl_prof) +return -ENOMEM ; +/* Creates a single ACL table that consist of src_ip(4 byte), * dest_ip(4 byte), src_port(2 byte) and dst_port(2 byte) for a total * of 12 bytes (96 bits), hence 120 bit wide keys, i.e. 3 TCAM slices.
@@ -4368,7 +4374,7 @@ static int ice_init_acl(struct ice_pf *pf) err =ice_acl_create_tbl (hw, ¶ms);if (err) -return err; + goto free_prof; err =ice_acl_create_scen (hw, params.width, params.depth, &scen_id);if (err)
@@ -4378,17 +4384,39 @@ static int ice_init_acl(struct ice_pf *pf) destroy_table:ice_acl_destroy_tbl (hw); +free_prof: +devm_kfree (dev, hw->acl_prof); + hw->acl_prof =NULL ;return err; }/** -* ice_deinit_acl - Unroll the initialization of the ACL block +* ice_deinit_acl - unroll the initialization of the ACL block * @pf: ptr to PF device */ static void ice_deinit_acl (struct ice_pf *pf) { -ice_acl_destroy_tbl (&pf->hw); +struct device *dev =ice_pf_to_dev (pf); +struct ice_hw *hw = &pf->hw; + +ice_acl_destroy_tbl (hw); + +if (!hw->acl_prof) +return ; + +for (int i =0 ; i <ICE_FLTR_PTYPE_MAX ; i++) { +struct ice_acl_hw_prof *hw_prof = hw->acl_prof[i]; + +if (!hw_prof) +continue ; + +kfree (hw_prof->seg); +kfree (hw_prof); + } + +devm_kfree (dev, hw->acl_prof); + hw->acl_prof =NULL ; }/**
Signature · 1 line
2.49.0
RE: [Intel-wired-lan] [PATCH iwl-next v4 04/10] ice: create flow profile
Quoted 59 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Marcin Szycik
Sent: Thursday, May 21, 2026 4:50 AM
To: [email protected]
Cc: [email protected]; Penigalapati, Sandeep <[email protected]>; S, Ananth <[email protected]>; [email protected]; Marcin Szycik <[email protected]>; Cao, Chinh T <[email protected]>; Nguyen, Anthony L <[email protected]>; Loktionov, Aleksandr <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v4 04/10] ice: create flow profileFrom: Real Valiquette <[email protected]>
Implement the initial steps for creating an ACL filter to support ntuple masks. Create a flow profile based on a given mask rule and program it to the hardware. Though the profile is written to hardware, no actions are associated with the profile yet.
Co-developed-by Chinh Cao <[email protected]>Signed-off-by Chinh Cao <[email protected]>Signed-off-by Real Valiquette <[email protected]>Co-developed-by Tony Nguyen <[email protected]>Signed-off-by Tony Nguyen <[email protected]>Co-developed-by Marcin Szycik <[email protected]>Signed-off-by Marcin Szycik <[email protected]>Reviewed-by Aleksandr Loktionov <[email protected]>---
v4:
*ice_acl_prof_add_ethtool(): add missing line (hw_prof->prof_id=prof->id;). Without it, all flow entries are added to profile 0, which wrongly uses old extraction sequence in case flow type is different. To reproduce, add two filters with different input sets and check if they forward to expected queues, e.g.:ethtool -N $PF1 flow-type tcp4 src-port 1234 m 0x000f action 23 ethtool -N $PF1 flow-type udp4 src-port 1234 m 0x000f action 24* Adjust to using struct
ice_acl_hw_profinstead of structice_fd_hw_prof
*ice_acl_prof_add_ethtool(): removeold_seghelper variable - after above change, accessing old segment is straightforward, so it's not needed
v3:
*ice_acl_prof_add_ethtool(): add a writeback to hw profile in error path to prevent leaving a pointer to deallocated object
*ice_deinit_acl(): exit early ifhw->acl_profis already NULL
*ice_flow_acl_def_entry_frmt(): copyseg->matchto variable instead of reading it as unsigned long pointer in order to avoid potential type mismatch
v2:
* Addice_acl_main.hin order to not awkwardly add prototypes toice.h. This will also help avoid potential dependency issues for future additions toice_acl_main.c
* Renameice_acl_check_input_set()to a more fitingice_acl_prof_add_ethtool()as it adds a profile
* Sethw->acl_prof= 0 inice_acl_prof_add_ethtool()to avoid use after free
* Add ipv4 and port full mask defines inice_ethtool_ntuple.c
* Movehw->acl_profallocation toice_init_acl(). Previously, it was being deallocated when hw->acl_prof[fltr_type] allocation failed, possibly with already existing other elements. Extend array lifetime to driver's lifetime
* Change hw->acl_prof[fltr_type] alloc fromdevm_to plain
* Add hw->acl_prof[fltr_type] andhw->acl_profdeallocation inice_deinit_acl()- previously were only deallocated on failure
* Tweak alloc/unroll logic inice_acl_prof_add_ethtool()
Quoted 13 lines
--- drivers/net/ethernet/intel/ice/Makefile | 1 + drivers/net/ethernet/intel/ice/ice.h | 6 + drivers/net/ethernet/intel/ice/ice_acl_main.h | 9 + .../net/ethernet/intel/ice/ice_adminq_cmd.h | 39 +++ drivers/net/ethernet/intel/ice/ice_flow.h | 17 + drivers/net/ethernet/intel/ice/ice_acl_main.c | 228 +++++++++++++ .../ethernet/intel/ice/ice_ethtool_ntuple.c | 299 +++++++++++++----- .../net/ethernet/intel/ice/ice_flex_pipe.c | 6 + drivers/net/ethernet/intel/ice/ice_flow.c | 173 ++++++++++ drivers/net/ethernet/intel/ice/ice_main.c | 36 ++- 10 files changed, 733 insertions(+), 81 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_acl_main.h create mode 100644 drivers/net/ethernet/intel/ice/ice_acl_main.c
PATCH v4 5/10 Revert "ice: remove unused ice_flow_entry fields"
In reply to Marcin SzycikThis reverts commit 4cd7bc7144ec2c0bb27208c3bb1f153dfd44b1c7. These fields will be needed in the following commits.
---
v2:
* Add this patch
--- drivers/net/ethernet/intel/ice/ice_flow.h | 3 +++ drivers/net/ethernet/intel/ice/ice_flow.c | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_flow.h +3 -0
@@ -458,8 +458,11 @@ struct ice_flow_entry {u64 id;struct ice_flow_prof *prof; +/* Flow entry's content */ +void *entry;enum ice_flow_priority priority;u16 vsi_handle; +u16 entry_sz; };#define ICE_FLOW_ENTRY_HNDL (e) ((u64)(uintptr_t)e)
drivers/net/ethernet/intel/ice/ice_flow.c +4 -1
@@ -1604,6 +1604,7 @@ ice_flow_rem_entry_sync(struct ice_hw *hw, enum ice_block __always_unused blk,list_del (&entry->l_entry); +devm_kfree (ice_hw_to_dev (hw), entry->entry);devm_kfree (ice_hw_to_dev (hw), entry);return 0 ;
@@ -2024,8 +2025,10 @@ ice_flow_add_entry(struct ice_hw *hw, enum ice_block blk, u64 prof_id, *entry_h =ICE_FLOW_ENTRY_HNDL (e); out: -if (status) +if (status && e) { +devm_kfree (ice_hw_to_dev (hw), e->entry);devm_kfree (ice_hw_to_dev (hw), e); + }return status; }
Signature · 1 line
2.49.0
RE: [Intel-wired-lan] [PATCH iwl-next v4 05/10] Revert "ice: remove unused ice_flow_entry fields"
Quoted 14 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Marcin Szycik
Sent: Thursday, May 21, 2026 4:50 AM
To: [email protected]
Cc: [email protected]; Penigalapati, Sandeep <[email protected]>; S, Ananth <[email protected]>; [email protected]; Marcin Szycik <[email protected]>; Loktionov, Aleksandr <[email protected]>; Kitszel, Przemyslaw <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v4 05/10] Revert "ice: remove unusedice_flow_entryfields"This reverts commit
4cd7bc7144ec2c0bb27208c3bb1f153dfd44b1c7. These fields will be needed in the following commits.Signed-off-by Marcin Szycik <[email protected]>Reviewed-by Aleksandr Loktionov <[email protected]>Reviewed-by Przemek Kitszel <[email protected]>
Quoted 6 lines
---
v2:
* Add this patch--- drivers/net/ethernet/intel/ice/ice_flow.h | 3 +++ drivers/net/ethernet/intel/ice/ice_flow.c | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-)
PATCH v4 6/10 ice: use plain alloc/dealloc for ice_ntuple_fltr
In reply to Marcin SzycikChange struct ice_ntuple_fltr allocation from devm_ to plain alloc, since its lifetime is not tied to the device. All such objects are being removed on device remove via ice_deinit_features() -> ice_deinit_fdir() -> ice_vsi_manage_fdir() -> ice_fdir_del_all_fltrs()
---
v2:
* Add this patch
--- drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c +4 -4
@@ -1750,7 +1750,7 @@ void ice_fdir_del_all_fltrs(struct ice_vsi *vsi)ice_fdir_write_all_fltr (pf, f_rule, false);ice_fdir_update_cntrs (hw, f_rule, false);list_del (&f_rule->fltr_node); -devm_kfree (ice_pf_to_dev (pf), f_rule); +kfree (f_rule); } }
@@ -1853,7 +1853,7 @@ ice_ntuple_update_list_entry(struct ice_pf *pf, struct ice_ntuple_fltr *input,*/ ice_fdir_do_rem_flow (pf, old_fltr->flow_type);list_del (&old_fltr->fltr_node); -devm_kfree (ice_hw_to_dev (hw), old_fltr); +kfree (old_fltr); }if (!input)return err;
@@ -2204,7 +2204,7 @@ int ice_add_ntuple_ethtool(struct ice_vsi *vsi, struct ethtool_rxnfc *cmd)return -ENOSPC ; } - input =devm_kzalloc (dev,sizeof (*input),GFP_KERNEL ); + input =kzalloc_obj (*input);if (!input)return -ENOMEM ;
@@ -2248,7 +2248,7 @@ int ice_add_ntuple_ethtool(struct ice_vsi *vsi, struct ethtool_rxnfc *cmd)mutex_unlock (&hw->fdir_fltr_lock); free_input:if (ret) -devm_kfree (dev, input); +kfree (input);return ret; }
Signature · 1 line
2.49.0
RE: [Intel-wired-lan] [PATCH iwl-next v4 06/10] ice: use plain alloc/dealloc for ice_ntuple_fltr
Quoted 11 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Marcin Szycik
Sent: Thursday, May 21, 2026 4:50 AM
To: [email protected]
Cc: [email protected]; Penigalapati, Sandeep <[email protected]>; S, Ananth <[email protected]>; [email protected]; Marcin Szycik <[email protected]>; Loktionov, Aleksandr <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v4 06/10] ice: use plain alloc/dealloc forice_ntuple_fltrChange struct
ice_ntuple_fltrallocation fromdevm_to plain alloc, since its lifetime is not tied to the device. All such objects are being removed on device remove viaice_deinit_features()->ice_deinit_fdir()->ice_vsi_manage_fdir()->ice_fdir_del_all_fltrs()
Quoted 8 lines
Signed-off-by Marcin Szycik <[email protected]>Reviewed-by Aleksandr Loktionov <[email protected]>---
v2:
* Add this patch--- drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
PATCH v4 7/10 ice: create ACL entry
In reply to Marcin SzycikFrom: Real Valiquette <[email protected]>
Create an ACL entry for the mask match data and set the desired action. Generate and program the associated extraction sequence.
---
v4:
* Adjust to using struct ice_acl_hw_prof instead of struct ice_fd_hw_prof. This gets rid of some redundant checks and an extra-confusing block of code in ice_acl_add_rule_ethtool(). That block was storing entry handle in a VSI array, but only for first entry added on that VSI (in ACL this would always be PF), so only a single entry per profile. This was also redundant, as entries are kept in prof->entries, so these VSI arrays are never actually accessed again in any ACL path. All this nonsense is a leftover from reusing fdir structures for ACL, which need to track some ADQ-specific stuff.
v3:
* ice_acl_add_rule_ethtool(): add a check against illegal values of hw_prof->cnt
* ice_flow_acl_check_actions(): check counter action type with ice_flow_acl_is_cntr_act(). Previously only ICE_FLOW_ACT_FWD_QUEUE was being accepted in the first loop, leading to an error if other counter types were used
* ice_flow_acl_frmt_entry(): set err variable when alloc failed to return correct status
* ice_flow_acl_frmt_entry(): set range_buf = NULL if !range to avoid double free in error path
* ice_flow_acl_frmt_entry_range(): introduce a temporary variable (offset_val) to copy data from buffer with offset. Reading it with cast would lead to byte swap on big endian
* ice_flow_acl_free_act_cntr(): flip condition in loop to reduce indent v2:
* Fix invalid profile ID passed to ice_flow_add_entry() in ice_acl_add_rule_ethtool()
* Fix uninitialized cntrs.amount field in ice_aq_dealloc_acl_cntrs()
* Make ice_flow_acl_is_prof_in_use() more readable and return bool
* Add ice_flow_acl_is_cntr_act() helper
* Remove prof_id initialization when it's immediately set by ice_flow_get_hw_prof() anyway
* Check if src overflows in ice_flow_acl_set_xtrct_seq_fld()
* Adjust error codes in ice_flow_acl_check_actions() to more reasonable ones
* Add ICE_RX_PKT_DROP_DROP instead of using a magic number
* Reverse condition to decrease indent level in ice_aq_alloc_acl_cntrs()
* Get rid of useless variable in ice_acl_add_rule_ethtool()
* Use plain alloc and kfree instead of devm_ for ice_ntuple_fltr in ice_acl_add_rule_ethtool(), ice_flow_entry::entry and ice_flow_entry::range_buf
* Use plain kmemdup and kfree instead of devm_ for ice_flow_entry::acts
* ice_flow_entry members are being deallocated on device unload via ice_deinit_fdir -> ice_vsi_manage_fdir -> ice_fdir_rem_flow -> ice_fdir_erase_flow_from_hw -> ice_flow_rem_entry -> ice_flow_rem_entry_sync
* Add missing entry->range_buf and entry->acts dealloc in ice_flow_add_entry() unroll
* Remove redundant checks from ice_flow_acl_frmt_entry() unroll
--- drivers/net/ethernet/intel/ice/ice.h | 3 + drivers/net/ethernet/intel/ice/ice_acl.h | 24 + .../net/ethernet/intel/ice/ice_adminq_cmd.h | 123 +++- .../net/ethernet/intel/ice/ice_flex_pipe.h | 2 + drivers/net/ethernet/intel/ice/ice_flow.h | 9 +- .../net/ethernet/intel/ice/ice_lan_tx_rx.h | 3 + drivers/net/ethernet/intel/ice/ice_acl.c | 183 +++++ drivers/net/ethernet/intel/ice/ice_acl_main.c | 57 +- .../ethernet/intel/ice/ice_ethtool_ntuple.c | 37 +- .../net/ethernet/intel/ice/ice_flex_pipe.c | 5 +- drivers/net/ethernet/intel/ice/ice_flow.c | 641 +++++++++++++++++- drivers/net/ethernet/intel/ice/ice_main.c | 2 +- drivers/net/ethernet/intel/ice/virt/fdir.c | 4 +- 13 files changed, 1054 insertions(+), 39 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +3 -0
@@ -1025,6 +1025,9 @@ int ice_add_ntuple_ethtool(struct ice_vsi *vsi, struct ethtool_rxnfc *cmd);int ice_del_ntuple_ethtool (struct ice_vsi *vsi,struct ethtool_rxnfc *cmd);int ice_get_ethtool_fdir_entry (struct ice_hw *hw,struct ethtool_rxnfc *cmd);u32 ice_ntuple_get_max_fltr_cnt (struct ice_hw *hw); +int ice_ntuple_set_input_set (struct ice_vsi *vsi,enum ice_block blk, +struct ethtool_rx_flow_spec *fsp, +struct ice_ntuple_fltr *input);int ice_ntuple_l4_proto_to_port (enum ice_flow_seg_hdr l4_proto,enum ice_flow_field *src_port,enum ice_flow_field *dst_port);
drivers/net/ethernet/intel/ice/ice_acl.h +24 -0
@@ -99,6 +99,20 @@ struct ice_acl_alloc_tbl { } buf; }; +/* Input and output params for [de]allocate_acl_counters */ +struct ice_acl_cntrs { +u8 amount; +u8 type; +u8 bank; + +/* first/last: +* Output in case of alloc_acl_counters +* Input in case of deallocate_acl_counters +*/ +u16 first_cntr; +u16 last_cntr; +}; +int ice_acl_create_tbl (struct ice_hw *hw,struct ice_acl_tbl_params *params);int ice_acl_destroy_tbl (struct ice_hw *hw); int ice_acl_create_scen(struct ice_hw *hw, u16 match_width, u16 num_entries,
@@ -113,6 +127,16 @@ int ice_aq_program_acl_entry(struct ice_hw *hw, u8 tcam_idx, u16 entry_idx, struct ice_sq_cd *cd);int ice_aq_program_actpair (struct ice_hw *hw,u8 act_mem_idx,u16 act_entry_idx,struct ice_aqc_actpair *buf,struct ice_sq_cd *cd); +int ice_prgm_acl_prof_xtrct (struct ice_hw *hw,u8 prof_id, +struct ice_aqc_acl_prof_generic_frmt *buf, +struct ice_sq_cd *cd); +int ice_query_acl_prof (struct ice_hw *hw,u8 prof_id, +struct ice_aqc_acl_prof_generic_frmt *buf, +struct ice_sq_cd *cd); +int ice_aq_alloc_acl_cntrs (struct ice_hw *hw,struct ice_acl_cntrs *cntrs, +struct ice_sq_cd *cd); +int ice_aq_dealloc_acl_cntrs (struct ice_hw *hw,struct ice_acl_cntrs *cntrs, +struct ice_sq_cd *cd);int ice_aq_alloc_acl_scen (struct ice_hw *hw,u16 *scen_id,struct ice_aqc_acl_scen *buf,struct ice_sq_cd *cd); int ice_aq_dealloc_acl_scen(struct ice_hw *hw, u16 scen_id,
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +118 -5
152 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_flex_pipe.h +2 -0
@@ -8,6 +8,8 @@#define ICE_FDIR_REG_SET_SIZE 4 +int ice_set_key (u8 *key,u16 size,u8 *val,u8 *upd,u8 *dc,u8 *nm,u16 off, +u16 len);int ice_acquire_change_lock (struct ice_hw *hw,enum ice_aq_res_access_type access);void ice_release_change_lock (struct ice_hw *hw);
drivers/net/ethernet/intel/ice/ice_flow.h +8 -1
@@ -452,17 +452,23 @@ struct ice_flow_seg_info {struct ice_flow_seg_fld_raw raws[ICE_FLOW_SEG_RAW_FLD_MAX ]; }; +#define ICE_FLOW_ACL_MAX_NUM_ACT 2/* This structure describes a flow entry, and is tracked only in this file */ struct ice_flow_entry {struct list_head l_entry;u64 id;struct ice_flow_prof *prof; +/* Action list */ +struct ice_flow_action *acts;/* Flow entry's content */ void *entry; +/* Range buffer (For ACL only) */ +struct ice_aqc_acl_profile_ranges *range_buf;enum ice_flow_priority priority;u16 vsi_handle;u16 entry_sz; +u8 acts_cnt; };#define ICE_FLOW_ENTRY_HNDL (e) ((u64)(uintptr_t)e)
@@ -535,7 +541,8 @@ ice_flow_set_parser_prof(struct ice_hw *hw, u16 dest_vsi, u16 fdir_vsi,int ice_flow_add_entry (struct ice_hw *hw,enum ice_block blk,u64 prof_id,u64 entry_id,u16 vsi,enum ice_flow_priority prio, -void *data,u64 *entry_h); +void *data,struct ice_flow_action *acts,u8 acts_cnt, +u64 *entry_h);int ice_flow_rem_entry (struct ice_hw *hw,enum ice_block blk,u64 entry_h); void ice_flow_set_fld(struct ice_flow_seg_info *seg, enum ice_flow_field fld,
drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h +3 -0
@@ -312,6 +312,8 @@ enum ice_flex_mdid_pkt_flags {enum ice_flex_rx_mdid {ICE_RX_MDID_FLOW_ID_LOWER =5 ,ICE_RX_MDID_FLOW_ID_HIGH , +ICE_MDID_RX_PKT_DROP =8 , +ICE_MDID_RX_DST_Q =12 ,ICE_RX_MDID_SRC_VSI =19 ,ICE_RX_MDID_HASH_LOW =56 ,ICE_RX_MDID_HASH_HIGH ,
@@ -320,6 +322,7 @@ enum ice_flex_rx_mdid {/* Rx/Tx Flag64 packet flag bits */ enum ice_flg64_bits {ICE_FLG_PKT_DSI =0 , +ICE_FLG_PKT_DIR =4 , ICE_FLG_EVLAN_x8100 =14 , ICE_FLG_EVLAN_x9100, ICE_FLG_VLAN_x8100,
drivers/net/ethernet/intel/ice/ice_acl.c +183 -0
189 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_acl_main.c +56 -1
74 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c +23 -14
@@ -501,7 +501,7 @@ void ice_fdir_replay_flows(struct ice_hw *hw) prof->vsi_h[0 ], prof->vsi_h[j], prio, prof->fdir_seg, - &entry_h); + NULL, 0, &entry_h);if (err) {dev_err (ice_hw_to_dev (hw),"Could not replay Flow Director, flow type %d\n" , flow);
@@ -734,12 +734,12 @@ ice_fdir_set_hw_fltr_rule(struct ice_pf *pf, struct ice_flow_seg_info *seg,return err; err =ice_flow_add_entry (hw,ICE_BLK_FD , prof->id, main_vsi->idx, main_vsi->idx,ICE_FLOW_PRIO_NORMAL , - seg, &entry1_h); + seg,NULL ,0 , &entry1_h);if (err) goto err_prof; err =ice_flow_add_entry (hw,ICE_BLK_FD , prof->id, main_vsi->idx, ctrl_vsi->idx,ICE_FLOW_PRIO_NORMAL , - seg, &entry2_h); + seg,NULL ,0 , &entry2_h);if (err) goto err_entry;
@@ -763,7 +763,7 @@ ice_fdir_set_hw_fltr_rule(struct ice_pf *pf, struct ice_flow_seg_info *seg, vsi_h = main_vsi->tc_map_vsi[idx]->idx; err =ice_flow_add_entry (hw,ICE_BLK_FD , prof->id, main_vsi->idx, vsi_h, -ICE_FLOW_PRIO_NORMAL , seg, +ICE_FLOW_PRIO_NORMAL , seg,NULL ,0 , &entry1_h);if (err) { dev_err(dev, "Could not add Channel VSI %d to flow group\n",
@@ -1986,28 +1986,36 @@ ice_update_ring_dest_vsi(struct ice_vsi *vsi, u16 *dest_vsi, u32 *ring) }/** -* ice_ntuple_set_input_set - Set the input set for Flow Director +* ice_ntuple_set_input_set - Set the input set for specified block * @vsi: pointer to target VSI +* @blk: filter block to configure * @fsp: pointer to ethtool Rx flow specification * @input: filter structure * * Return: 0 on success, negative on failure */ -static int -ice_ntuple_set_input_set (struct ice_vsi *vsi,struct ethtool_rx_flow_spec *fsp, -struct ice_ntuple_fltr *input) +int ice_ntuple_set_input_set (struct ice_vsi *vsi,enum ice_block blk, +struct ethtool_rx_flow_spec *fsp, +struct ice_ntuple_fltr *input) {s16 q_index =ICE_FDIR_NO_QUEUE_IDX ; +int flow_type, flow_mask;u16 orig_q_index =0 ;struct ice_pf *pf;struct ice_hw *hw; -int flow_type;u16 dest_vsi;u8 dest_ctl;if (!vsi || !fsp || !input)return -EINVAL ; +if (blk ==ICE_BLK_FD ) + flow_mask =FLOW_EXT ; +else if (blk ==ICE_BLK_ACL ) + flow_mask =FLOW_MAC_EXT ; +else +return -EINVAL ; + pf = vsi->back; hw = &pf->hw;
@@ -2019,7 +2027,8 @@ ice_ntuple_set_input_set(struct ice_vsi *vsi, struct ethtool_rx_flow_spec *fsp,u8 vf =ethtool_get_flow_spec_ring_vf (fsp->ring_cookie);if (vf) { -dev_err (ice_pf_to_dev (pf),"Failed to add filter. Flow director filters are not supported on VF queues.\n" ); +dev_err (ice_pf_to_dev (pf),"Failed to add filter. %s filters are not supported on VF queues.\n" , + blk ==ICE_BLK_FD ?"Flow Director" :"ACL" );return -EINVAL ; }
@@ -2034,7 +2043,7 @@ ice_ntuple_set_input_set(struct ice_vsi *vsi, struct ethtool_rx_flow_spec *fsp, input->fltr_id = fsp->location; input->q_index = q_index; - flow_type = fsp->flow_type & ~FLOW_EXT ; + flow_type = fsp->flow_type & ~flow_mask;/* Record the original queue index as specified by user. * with channel configuration 'q_index' becomes relative
@@ -2088,9 +2097,9 @@ ice_ntuple_set_input_set(struct ice_vsi *vsi, struct ethtool_rx_flow_spec *fsp,case TCP_V6_FLOW :case UDP_V6_FLOW :case SCTP_V6_FLOW : -memcpy (input->ip.v6.dst_ip, fsp->h_u.usr_ip6_spec.ip6dst, +memcpy (input->ip.v6.dst_ip, fsp->h_u.tcp_ip6_spec.ip6dst,sizeof (struct in6_addr )); -memcpy (input->ip.v6.src_ip, fsp->h_u.usr_ip6_spec.ip6src, +memcpy (input->ip.v6.src_ip, fsp->h_u.tcp_ip6_spec.ip6src,sizeof (struct in6_addr )); input->ip.v6.dst_port = fsp->h_u.tcp_ip6_spec.pdst; input->ip.v6.src_port = fsp->h_u.tcp_ip6_spec.psrc;
@@ -2208,7 +2217,7 @@ int ice_add_ntuple_ethtool(struct ice_vsi *vsi, struct ethtool_rxnfc *cmd)if (!input)return -ENOMEM ; - ret =ice_ntuple_set_input_set (vsi, fsp, input); + ret =ice_ntuple_set_input_set (vsi,ICE_BLK_FD , fsp, input);if (ret) goto free_input;
drivers/net/ethernet/intel/ice/ice_flex_pipe.c +2 -3
@@ -235,9 +235,8 @@ static bool ice_bits_max_set(const u8 *mask, u16 size, u16 max)* dc == NULL --> dc mask is all 0's (no don't care bits) * nm == NULL --> nm mask is all 0's (no never match bits) */ -static int -ice_set_key (u8 *key,u16 size,u8 *val,u8 *upd,u8 *dc,u8 *nm,u16 off, -u16 len) +int ice_set_key (u8 *key,u16 size,u8 *val,u8 *upd,u8 *dc,u8 *nm,u16 off, +u16 len) {u16 half_size;u16 i;
drivers/net/ethernet/intel/ice/ice_flow.c +629 -12
712 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_main.c +1 -1
@@ -8659,7 +8659,7 @@ static int ice_add_vsi_to_fdir(struct ice_pf *pf, struct ice_vsi *vsi) prof->prof_id[tun], prof->vsi_h[0 ], vsi->idx, prio, prof->fdir_seg[tun], - &entry_h); + NULL, 0, &entry_h);if (status) {dev_err (dev,"channel VSI idx %d, not able to add to group %d\n" , vsi->idx, flow);
drivers/net/ethernet/intel/ice/virt/fdir.c +2 -2
@@ -688,7 +688,7 @@ ice_vc_fdir_write_flow_prof(struct ice_vf *vf, enum ice_fltr_ptype flow, ret =ice_flow_add_entry (hw,ICE_BLK_FD , prof->id, vf_vsi->idx, vf_vsi->idx,ICE_FLOW_PRIO_NORMAL , - seg, &entry1_h); + seg,NULL ,0 , &entry1_h);if (ret) {dev_dbg (dev,"Could not add flow 0x%x VSI entry for VF %d\n" , flow, vf->vf_id);
@@ -697,7 +697,7 @@ ice_vc_fdir_write_flow_prof(struct ice_vf *vf, enum ice_fltr_ptype flow, ret =ice_flow_add_entry (hw,ICE_BLK_FD , prof->id, vf_vsi->idx, ctrl_vsi->idx,ICE_FLOW_PRIO_NORMAL , - seg, &entry2_h); + seg,NULL ,0 , &entry2_h);if (ret) { dev_dbg(dev, "Could not add flow 0x%x Ctrl VSI entry for VF %d\n",
Signature · 1 line
2.49.0
RE: [Intel-wired-lan] [PATCH iwl-next v4 07/10] ice: create ACL entry
Quoted 74 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Marcin Szycik
Sent: Thursday, May 21, 2026 4:50 AM
To: [email protected]
Cc: [email protected]; Penigalapati, Sandeep <[email protected]>; S, Ananth <[email protected]>; [email protected]; Marcin Szycik <[email protected]>; Cao, Chinh T <[email protected]>; Nguyen, Anthony L <[email protected]>; Loktionov, Aleksandr <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v4 07/10] ice: create ACL entryFrom: Real Valiquette <[email protected]>
Create an ACL entry for the mask match data and set the desired action. Generate and program the associated extraction sequence.
Co-developed-by Chinh Cao <[email protected]>Signed-off-by Chinh Cao <[email protected]>Signed-off-by Real Valiquette <[email protected]>Co-developed-by Tony Nguyen <[email protected]>Signed-off-by Tony Nguyen <[email protected]>Co-developed-by Jesse Brandeburg <[email protected]>Signed-off-by Jesse Brandeburg <[email protected]>Co-developed-by Marcin Szycik <[email protected]>Signed-off-by Marcin Szycik <[email protected]>Reviewed-by Aleksandr Loktionov <[email protected]>---
v4:
* Adjust to using structice_acl_hw_profinstead of structice_fd_hw_prof. This gets rid of some redundant checks and an extra-confusing block of code inice_acl_add_rule_ethtool(). That block was storing entry handle in a VSI array, but only for first entry added on that VSI (in ACL this would always be PF), so only a single entry per profile. This was also redundant, as entries are kept inprof->entries, so these VSI arrays are never actually accessed again in any ACL path. All this nonsense is a leftover from reusing fdir structures for ACL, which need to track some ADQ-specific stuff.
v3:
*ice_acl_add_rule_ethtool(): add a check against illegal values ofhw_prof->cnt
*ice_flow_acl_check_actions(): check counter action type withice_flow_acl_is_cntr_act(). Previously onlyICE_FLOW_ACT_FWD_QUEUEwas being accepted in the first loop, leading to an error if other counter types were used
*ice_flow_acl_frmt_entry(): set err variable when alloc failed to return correct status
*ice_flow_acl_frmt_entry(): setrange_buf= NULL if !range to avoid double free in error path
*ice_flow_acl_frmt_entry_range(): introduce a temporary variable (offset_val) to copy data from buffer with offset. Reading it with cast would lead to byte swap on big endian
*ice_flow_acl_free_act_cntr(): flip condition in loop to reduce indent v2:
* Fix invalid profile ID passed toice_flow_add_entry()inice_acl_add_rule_ethtool()
* Fix uninitialized cntrs.amount field inice_aq_dealloc_acl_cntrs()
* Makeice_flow_acl_is_prof_in_use()more readable and return bool
* Addice_flow_acl_is_cntr_act()helper
* Removeprof_idinitialization when it's immediately set byice_flow_get_hw_prof()anyway
* Check if src overflows inice_flow_acl_set_xtrct_seq_fld()
* Adjust error codes inice_flow_acl_check_actions()to more reasonable ones
* AddICE_RX_PKT_DROP_DROPinstead of using a magic number
* Reverse condition to decrease indent level inice_aq_alloc_acl_cntrs()
* Get rid of useless variable inice_acl_add_rule_ethtool()
* Use plain alloc and kfree instead ofdevm_forice_ntuple_fltrinice_acl_add_rule_ethtool(),ice_flow_entry::entryandice_flow_entry::range_buf
* Use plain kmemdup and kfree instead ofdevm_forice_flow_entry::acts
*ice_flow_entrymembers are being deallocated on device unload viaice_deinit_fdir->ice_vsi_manage_fdir->ice_fdir_rem_flow->ice_fdir_erase_flow_from_hw->ice_flow_rem_entry->ice_flow_rem_entry_sync
* Add missingentry->range_bufandentry->actsdealloc inice_flow_add_entry()unroll
* Remove redundant checks fromice_flow_acl_frmt_entry()unroll
Quoted 15 lines
--- drivers/net/ethernet/intel/ice/ice.h | 3 + drivers/net/ethernet/intel/ice/ice_acl.h | 24 + .../net/ethernet/intel/ice/ice_adminq_cmd.h | 123 +++- .../net/ethernet/intel/ice/ice_flex_pipe.h | 2 + drivers/net/ethernet/intel/ice/ice_flow.h | 9 +- .../net/ethernet/intel/ice/ice_lan_tx_rx.h | 3 + drivers/net/ethernet/intel/ice/ice_acl.c | 183 +++++ drivers/net/ethernet/intel/ice/ice_acl_main.c | 57 +- .../ethernet/intel/ice/ice_ethtool_ntuple.c | 37 +- .../net/ethernet/intel/ice/ice_flex_pipe.c | 5 +- drivers/net/ethernet/intel/ice/ice_flow.c | 641 +++++++++++++++++- drivers/net/ethernet/intel/ice/ice_main.c | 2 +- drivers/net/ethernet/intel/ice/virt/fdir.c | 4 +- 13 files changed, 1054 insertions(+), 39 deletions(-)
PATCH v4 8/10 ice: program ACL entry
In reply to Marcin SzycikFrom: Real Valiquette <[email protected]>
Complete the filter programming process; set the flow entry and action into the scenario and write it to hardware. Configure the VSI for ACL filters.
---
v4:
* Remove last side effects of using struct ice_fd_hw_prof for ACL v3:
* Cleanup comments in ice_acl_add_entry(), ice_flow_acl_find_scen_entry_cond()
* ice_acl_rem_entry(): clear entry from entry bitmap only if programming succceeded
* ice_acl_rem_entry(): catch ice_acl_scen_free_entry_idx() status
* ice_acl_add_rule_ethtool(): add fdir_fltr_lock around ice_ntuple_update_list_entry() call
* ice_acl_add_rule_ethtool(): catch ice_ntuple_update_list_entry() status, add unroll
* ice_flow_acl_find_scen_entry_cond(): remove inner loop when checking if actions match. Previously it was effectively checking if actions match *and* are all the same. Note: ACL will always use 1 action in current software implementation, but it can be extended in the future.
* ice_flow_acl_add_scen_entry_sync(): set exist->acts_cnt = 0 on alloc fail
v2:
* Use plain alloc instead of devm_ for ice_flow_entry::acts
* Use FIELD_PREP_CONST() for ICE_ACL_RX_*_MISS_CNTR
* Fix wrong struct ice_acl_act_entry alloc count in ice_flow_acl_add_scen_entry_sync() - was e->entry_sz, which is an unrelated value
* Only set acts_cnt after successful allocation in ice_flow_acl_add_scen_entry_sync()
* Return -EINVAL instead of -ENOSPC on wrong index in ice_acl_scen_free_entry_idx()
--- drivers/net/ethernet/intel/ice/ice.h | 2 + drivers/net/ethernet/intel/ice/ice_acl.h | 21 + .../net/ethernet/intel/ice/ice_adminq_cmd.h | 2 + drivers/net/ethernet/intel/ice/ice_flow.h | 3 + drivers/net/ethernet/intel/ice/ice_acl.c | 53 ++- drivers/net/ethernet/intel/ice/ice_acl_ctrl.c | 252 +++++++++++ drivers/net/ethernet/intel/ice/ice_acl_main.c | 12 + .../ethernet/intel/ice/ice_ethtool_ntuple.c | 48 ++- drivers/net/ethernet/intel/ice/ice_flow.c | 390 ++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_lib.c | 10 +- 10 files changed, 786 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +2 -0
@@ -1061,6 +1061,8 @@ void ice_aq_prep_for_event(struct ice_pf *pf, struct ice_aq_task *task, u16 opcode);int ice_aq_wait_for_event (struct ice_pf *pf,struct ice_aq_task *task,unsigned long timeout); +int ice_ntuple_update_list_entry (struct ice_pf *pf, +struct ice_ntuple_fltr *input,int fltr_idx);int ice_open (struct net_device *netdev);int ice_open_internal (struct net_device *netdev);int ice_stop (struct net_device *netdev);
drivers/net/ethernet/intel/ice/ice_acl.h +21 -0
@@ -39,6 +39,7 @@ struct ice_acl_tbl {DECLARE_BITMAP (avail,ICE_AQC_ACL_ALLOC_UNITS ); }; +#define ICE_MAX_ACL_TCAM_ENTRY (ICE_AQC_ACL_TCAM_DEPTH * ICE_AQC_ACL_SLICES)enum ice_acl_entry_prio {ICE_ACL_PRIO_LOW =0 ,ICE_ACL_PRIO_NORMAL ,
@@ -65,6 +66,11 @@ struct ice_acl_scen {* participate in this scenario */ DECLARE_BITMAP (act_mem_bitmap,ICE_AQC_MAX_ACTION_MEMORIES ); + +/* If nth bit of entry_bitmap is set, then nth entry will +* be available in this scenario +*/ +DECLARE_BITMAP (entry_bitmap,ICE_MAX_ACL_TCAM_ENTRY );u16 first_idx[ICE_ACL_MAX_PRIO ];u16 last_idx[ICE_ACL_MAX_PRIO ];
@@ -137,6 +143,12 @@ int ice_aq_alloc_acl_cntrs(struct ice_hw *hw, struct ice_acl_cntrs *cntrs, struct ice_sq_cd *cd);int ice_aq_dealloc_acl_cntrs (struct ice_hw *hw,struct ice_acl_cntrs *cntrs,struct ice_sq_cd *cd); +int ice_prog_acl_prof_ranges (struct ice_hw *hw,u8 prof_id, +struct ice_aqc_acl_profile_ranges *buf, +struct ice_sq_cd *cd); +int ice_query_acl_prof_ranges (struct ice_hw *hw,u8 prof_id, +struct ice_aqc_acl_profile_ranges *buf, +struct ice_sq_cd *cd);int ice_aq_alloc_acl_scen (struct ice_hw *hw,u16 *scen_id,struct ice_aqc_acl_scen *buf,struct ice_sq_cd *cd); int ice_aq_dealloc_acl_scen(struct ice_hw *hw, u16 scen_id,
@@ -145,5 +157,14 @@ int ice_aq_update_acl_scen(struct ice_hw *hw, u16 scen_id, struct ice_aqc_acl_scen *buf, struct ice_sq_cd *cd);int ice_aq_query_acl_scen (struct ice_hw *hw,u16 scen_id,struct ice_aqc_acl_scen *buf,struct ice_sq_cd *cd); +int ice_acl_add_entry (struct ice_hw *hw,struct ice_acl_scen *scen, +enum ice_acl_entry_prio prio,u8 *keys,u8 *inverts, +struct ice_acl_act_entry *acts,u8 acts_cnt, +u16 *entry_idx); +int ice_acl_prog_act (struct ice_hw *hw,struct ice_acl_scen *scen, +struct ice_acl_act_entry *acts,u8 acts_cnt, +u16 entry_idx); +int ice_acl_rem_entry (struct ice_hw *hw,struct ice_acl_scen *scen, +u16 entry_idx);#endif /* _ICE_ACL_H_ */
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +2 -0
@@ -3034,8 +3034,10 @@ enum ice_adminq_opc { ice_aqc_opc_update_acl_scen =0x0C1B , ice_aqc_opc_program_acl_actpair =0x0C1C , ice_aqc_opc_program_acl_prof_extraction =0x0C1D , + ice_aqc_opc_program_acl_prof_ranges =0x0C1E , ice_aqc_opc_program_acl_entry =0x0C20 , ice_aqc_opc_query_acl_prof =0x0C21 , + ice_aqc_opc_query_acl_prof_ranges =0x0C22 , ice_aqc_opc_query_acl_scen =0x0C23 , /* Tx queue handling commands/events */
drivers/net/ethernet/intel/ice/ice_flow.h +3 -0
@@ -468,6 +468,8 @@ struct ice_flow_entry {enum ice_flow_priority priority;u16 vsi_handle;u16 entry_sz; +/* Entry index in the ACL's scenario */ +u16 scen_entry_idx;u8 acts_cnt; };
@@ -535,6 +537,7 @@ ice_flow_add_prof(struct ice_hw *hw, enum ice_block blk, enum ice_flow_dir dir, struct ice_flow_seg_info *segs, u8 segs_cnt, bool symm, struct ice_flow_prof **prof);int ice_flow_rem_prof (struct ice_hw *hw,enum ice_block blk,u64 prof_id); +u64 ice_flow_find_entry (struct ice_hw *hw,enum ice_block blk,u64 entry_id);int ice_flow_set_parser_prof (struct ice_hw *hw,u16 dest_vsi,u16 fdir_vsi,struct ice_parser_profile *prof,enum ice_block blk);
drivers/net/ethernet/intel/ice/ice_acl.c +52 -1
65 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_acl_ctrl.c +252 -0
267 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_acl_main.c +12 -0
@@ -274,8 +274,20 @@ int ice_acl_add_rule_ethtool(struct ice_vsi *vsi, struct ethtool_rxnfc *cmd) goto free_input; } + input->acl_fltr = true; + +mutex_lock (&hw->fdir_fltr_lock); +/* input struct is added to the HW filter list */ + err =ice_ntuple_update_list_entry (pf, input, fsp->location); +mutex_unlock (&hw->fdir_fltr_lock); +if (err) + goto del_entry; +return 0 ; +del_entry: +ice_flow_rem_entry (hw,ICE_BLK_ACL , entry_h); + free_input:kfree (input);
drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c +43 -5
69 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_flow.c +390 -0
424 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_lib.c +9 -1
@@ -1118,7 +1118,7 @@ static void ice_set_fd_vsi_ctx(struct ice_vsi_ctx *ctxt, struct ice_vsi *vsi) vsi->type != ICE_VSI_VF && vsi->type != ICE_VSI_CHNL)return ; - val =ICE_AQ_VSI_PROP_FLOW_DIR_VALID ; + val =ICE_AQ_VSI_PROP_FLOW_DIR_VALID |ICE_AQ_VSI_PROP_ACL_VALID ; ctxt->info.valid_sections |=cpu_to_le16 (val); dflt_q =0 ; dflt_q_group =0 ;
@@ -1144,6 +1144,14 @@ static void ice_set_fd_vsi_ctx(struct ice_vsi_ctx *ctxt, struct ice_vsi *vsi)/* priority of the default qindex action */ val |=FIELD_PREP (ICE_AQ_VSI_FD_DEF_PRIORITY_M , dflt_q_prio); ctxt->info.fd_report_opt =cpu_to_le16 (val); + +#define ICE_ACL_RX_PROF_MISS_CNTR \ + FIELD_PREP_CONST(ICE_AQ_VSI_ACL_DEF_RX_PROF_M, 2) +#define ICE_ACL_RX_TBL_MISS_CNTR \ + FIELD_PREP_CONST(ICE_AQ_VSI_ACL_DEF_RX_TABLE_M, 3) + + val =ICE_ACL_RX_PROF_MISS_CNTR |ICE_ACL_RX_TBL_MISS_CNTR ; + ctxt->info.acl_def_act =cpu_to_le16 (val); }/**
Signature · 1 line
2.49.0
RE: [Intel-wired-lan] [PATCH iwl-next v4 08/10] ice: program ACL entry
Quoted 47 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Marcin Szycik
Sent: Thursday, May 21, 2026 4:50 AM
To: [email protected]
Cc: [email protected]; Penigalapati, Sandeep <[email protected]>; S, Ananth <[email protected]>; [email protected]; Marcin Szycik <[email protected]>; Cao, Chinh T <[email protected]>; Nguyen, Anthony L <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v4 08/10] ice: program ACL entryFrom: Real Valiquette <[email protected]>
Complete the filter programming process; set the flow entry and action into the scenario and write it to hardware. Configure the VSI for ACL filters.
Co-developed-by Chinh Cao <[email protected]>Signed-off-by Chinh Cao <[email protected]>Signed-off-by Real Valiquette <[email protected]>Co-developed-by Tony Nguyen <[email protected]>Signed-off-by Tony Nguyen <[email protected]>Signed-off-by Marcin Szycik <[email protected]>---
v4:
* Remove last side effects of using structice_fd_hw_proffor ACL v3:
* Cleanup comments inice_acl_add_entry(),ice_flow_acl_find_scen_entry_cond()
*ice_acl_rem_entry(): clear entry from entry bitmap only if programming succceeded
*ice_acl_rem_entry(): catchice_acl_scen_free_entry_idx()status
*ice_acl_add_rule_ethtool(): addfdir_fltr_lockaroundice_ntuple_update_list_entry()call
*ice_acl_add_rule_ethtool(): catchice_ntuple_update_list_entry()status, add unroll
*ice_flow_acl_find_scen_entry_cond(): remove inner loop when checking if actions match. Previously it was effectively checking if actions match *and* are all the same. Note: ACL will always use 1 action in current software implementation, but it can be extended in the future.
*ice_flow_acl_add_scen_entry_sync(): setexist->acts_cnt= 0 on alloc fail
v2:
* Use plain alloc instead ofdevm_forice_flow_entry::acts
* UseFIELD_PREP_CONST()for ICE_ACL_RX_*_MISS_CNTR
* Fix wrong structice_acl_act_entryalloc count inice_flow_acl_add_scen_entry_sync()- wase->entry_sz, which is an unrelated value
* Only setacts_cntafter successful allocation inice_flow_acl_add_scen_entry_sync()
* Return-EINVALinstead of-ENOSPCon wrong index inice_acl_scen_free_entry_idx()
Quoted 11 lines
--- drivers/net/ethernet/intel/ice/ice.h | 2 + drivers/net/ethernet/intel/ice/ice_acl.h | 21 + .../net/ethernet/intel/ice/ice_adminq_cmd.h | 2 + drivers/net/ethernet/intel/ice/ice_flow.h | 3 + drivers/net/ethernet/intel/ice/ice_acl.c | 53 ++- drivers/net/ethernet/intel/ice/ice_acl_ctrl.c | 252 +++++++++++ drivers/net/ethernet/intel/ice/ice_acl_main.c | 12 + .../ethernet/intel/ice/ice_ethtool_ntuple.c | 48 ++- drivers/net/ethernet/intel/ice/ice_flow.c | 390 ++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_lib.c | 10 +- 10 files changed, 786 insertions(+), 7 deletions(-)
PATCH v4 9/10 ice: re-introduce ice_dealloc_flow_entry() helper
In reply to Marcin SzycikIt was removed in commit ad667d626825 ("ice: remove null checks before devm_kfree() calls"). Now it's useful again.
---
v3:
* ice_flow_acl_add_scen_entry_sync(), ice_flow_add_entry(): call ice_flow_acl_free_act_cntr() in unroll
v2:
* Add this patch
--- drivers/net/ethernet/intel/ice/ice_flow.c | 61 +++++++++++++++-------- 1 file changed, 39 insertions(+), 22 deletions(-)
drivers/net/ethernet/intel/ice/ice_flow.c +39 -22
@@ -1589,6 +1589,23 @@ ice_flow_find_prof_id(struct ice_hw *hw, enum ice_block blk, u64 prof_id)return NULL ; } +/** +* ice_dealloc_flow_entry - Deallocate flow entry memory +* @hw: pointer to the HW struct +* @entry: flow entry to be removed +*/ +static void +ice_dealloc_flow_entry (struct ice_hw *hw,struct ice_flow_entry *entry) +{ +if (!entry) +return ; + +kfree (entry->entry); +kfree (entry->range_buf); +kfree (entry->acts); +devm_kfree (ice_hw_to_dev (hw), entry); +} +/** * ice_flow_get_hw_prof - return the HW profile for a specific profile ID handle * @hw: pointer to the HW struct
@@ -1759,11 +1776,7 @@ static int ice_flow_rem_entry_sync(struct ice_hw *hw, enum ice_block blk, }list_del (&entry->l_entry); - -kfree (entry->entry); -kfree (entry->range_buf); -kfree (entry->acts); -devm_kfree (ice_hw_to_dev (hw), entry); +ice_dealloc_flow_entry (hw, entry);return 0 ; }
@@ -2877,6 +2890,9 @@ static int ice_flow_acl_add_scen_entry_sync(struct ice_hw *hw,/* For the action memory info, update the SW's copy of * exist entry with e's action memory info */ +if (exist->acts_cnt && exist->acts) +ice_flow_acl_free_act_cntr (hw, exist->acts, + exist->acts_cnt);kfree (exist->acts); exist->acts =kzalloc_objs (*exist->acts, e->acts_cnt);if (!exist->acts) {
@@ -2906,13 +2922,13 @@ static int ice_flow_acl_add_scen_entry_sync(struct ice_hw *hw, goto out; } -/* As we don't add the new entry to our SW DB, deallocate its -* memories, and return the exist entry to the caller +/* As we don't add the new entry to our SW DB, free its HW +* counter resources and deallocate its memory, then return +* the exist entry to the caller */ -kfree (e->entry); -kfree (e->range_buf); -kfree (e->acts); -devm_kfree (ice_hw_to_dev (hw), e); +if (e->acts_cnt && e->acts) +ice_flow_acl_free_act_cntr (hw, e->acts, e->acts_cnt); +ice_dealloc_flow_entry (hw, e); *entry = exist; } out:
@@ -2993,7 +3009,7 @@ int ice_flow_add_entry(struct ice_hw *hw, enum ice_block blk, u64 prof_id,mutex_unlock (&hw->fl_profs_locks[blk]);if (status) - goto out; + goto dealloc_entry; e->id = entry_id; e->vsi_handle = vsi_handle;
@@ -3009,15 +3025,15 @@ int ice_flow_add_entry(struct ice_hw *hw, enum ice_block blk, u64 prof_id, status =ice_flow_acl_frmt_entry (hw, prof, e, (u8 *)data, acts, acts_cnt);if (status) - goto out; + goto dealloc_entry; status =ice_flow_acl_add_scen_entry (hw, prof, &e);if (status) - goto out; + goto free_cntrs;break ;default : status = -EOPNOTSUPP ; - goto out; + goto dealloc_entry; }if (blk !=ICE_BLK_ACL ) {
@@ -3029,13 +3045,14 @@ int ice_flow_add_entry(struct ice_hw *hw, enum ice_block blk, u64 prof_id, *entry_h =ICE_FLOW_ENTRY_HNDL (e); -out: -if (status && e) { -kfree (e->entry); -kfree (e->range_buf); -kfree (e->acts); -devm_kfree (ice_hw_to_dev (hw), e); - } +return 0 ; + +free_cntrs: +if (blk ==ICE_BLK_ACL && e->acts_cnt && e->acts) +ice_flow_acl_free_act_cntr (hw, e->acts, e->acts_cnt); +dealloc_entry: +if (e) +ice_dealloc_flow_entry (hw, e);return status; }
Signature · 1 line
2.49.0
RE: [Intel-wired-lan] [PATCH iwl-next v4 09/10] ice: re-introduce ice_dealloc_flow_entry() helper
Quoted 20 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Marcin Szycik
Sent: Thursday, May 21, 2026 4:50 AM
To: [email protected]
Cc: [email protected]; Penigalapati, Sandeep <[email protected]>; S, Ananth <[email protected]>; [email protected]; Marcin Szycik <[email protected]>; Loktionov, Aleksandr <[email protected]>; Kitszel, Przemyslaw <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v4 09/10] ice: re-introduceice_dealloc_flow_entry()helperIt was removed in commit
ad667d626825("ice: remove null checks beforedevm_kfree()calls"). Now it's useful again.Signed-off-by Marcin Szycik <[email protected]>Reviewed-by Aleksandr Loktionov <[email protected]>Reviewed-by Przemek Kitszel <[email protected]>---
v3:
*ice_flow_acl_add_scen_entry_sync(),ice_flow_add_entry(): callice_flow_acl_free_act_cntr()in unroll
v2:
* Add this patch
Quoted 3 lines
--- drivers/net/ethernet/intel/ice/ice_flow.c | 61 +++++++++++++++-------- 1 file changed, 39 insertions(+), 22 deletions(-)
PATCH v4 10/10 ice: use ACL for ntuple rules that conflict with FDir
In reply to Marcin SzycikFrom: Lukasz Czapnik <[email protected]>
Flow Director can keep only one input set per flow type. After ACL support was added for ethtool ntuple rules, the driver still only selected ACL for rules with partial masks.
That leaves a gap for rules with full masks that still require a different input set than the one already programmed for Flow Director. Such rules go through the FDir path, build a different extraction sequence and then fail because the existing FDir profile cannot be reused.
Detect this case before programming the rule. Build the candidate IP flow segment, compare it with the active non-tunneled FDir profile and, when the input sets differ, offload the rule through ACL if ACL is available.
Refactor the IP flow segment setup into a helper so the same logic can be used both by the extraction-sequence configuration path and by the conflict check.
---
v3:
* Include flex fields in test_seg to avoid false conflict detection
* Skip conflict check early for ETHER_FLOW
v2:
* Add this patch
--- .../ethernet/intel/ice/ice_ethtool_ntuple.c | 168 +++++++++++++----- 1 file changed, 121 insertions(+), 47 deletions(-)
drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c +121 -47
@@ -1428,6 +1428,115 @@ ice_set_fdir_vlan_seg(struct ice_flow_seg_info *seg,return 0 ; } +/** +* ice_set_fdir_ip_flow_seg - set IP flow segment based on ethtool flow type +* @fsp: pointer to ethtool Rx flow specification +* @seg: flow segment for programming +* @perfect_fltr: valid on success; returns true if perfect fltr, false if not +* +* Return: 0 on success and errno in case of error. +*/ +static int ice_set_fdir_ip_flow_seg (struct ethtool_rx_flow_spec *fsp, +struct ice_flow_seg_info *seg, +bool *perfect_fltr) +{ +switch (fsp->flow_type & ~FLOW_EXT ) { +case TCP_V4_FLOW : +return ice_set_fdir_ip4_seg (seg, &fsp->m_u.tcp_ip4_spec, +ICE_FLOW_SEG_HDR_TCP , perfect_fltr); +case UDP_V4_FLOW : +return ice_set_fdir_ip4_seg (seg, &fsp->m_u.tcp_ip4_spec, +ICE_FLOW_SEG_HDR_UDP , perfect_fltr); +case SCTP_V4_FLOW : +return ice_set_fdir_ip4_seg (seg, &fsp->m_u.tcp_ip4_spec, +ICE_FLOW_SEG_HDR_SCTP , + perfect_fltr); +case IPV4_USER_FLOW : +return ice_set_fdir_ip4_usr_seg (seg, &fsp->m_u.usr_ip4_spec, + perfect_fltr); +case TCP_V6_FLOW : +return ice_set_fdir_ip6_seg (seg, &fsp->m_u.tcp_ip6_spec, +ICE_FLOW_SEG_HDR_TCP , perfect_fltr); +case UDP_V6_FLOW : +return ice_set_fdir_ip6_seg (seg, &fsp->m_u.tcp_ip6_spec, +ICE_FLOW_SEG_HDR_UDP , perfect_fltr); +case SCTP_V6_FLOW : +return ice_set_fdir_ip6_seg (seg, &fsp->m_u.tcp_ip6_spec, +ICE_FLOW_SEG_HDR_SCTP , + perfect_fltr); +case IPV6_USER_FLOW : +return ice_set_fdir_ip6_usr_seg (seg, &fsp->m_u.usr_ip6_spec, + perfect_fltr); +default : +return -EINVAL ; + } +} + +/** +* ice_fdir_has_input_set_conflict - Check conflict with existing FD filters +* @pf: PF structure +* @fsp: pointer to ethtool Rx flow specification +* @user: user-defined data parsed from flow specification +* +* Checks if adding this filter to Flow Director would cause an input set +* mismatch with existing filters for the same flow type by building +* the segment and comparing with existing profiles. +* +* Return: true if there's a conflict (use ACL), false otherwise (can use FD) +*/ +static bool +ice_fdir_has_input_set_conflict (struct ice_pf *pf, +struct ethtool_rx_flow_spec *fsp, +const struct ice_rx_flow_userdef *user) +{ +struct ice_flow_seg_info *test_seg, *old_seg; +bool perfect_fltr = false, conflict = false; +struct ice_fd_hw_prof *hw_prof; +struct ice_hw *hw = &pf->hw; +enum ice_fltr_ptype flow; +int err; + +if ((fsp->flow_type & ~FLOW_EXT ) ==ETHER_FLOW ) +return false; + + flow =ice_ethtool_flow_to_fltr (fsp->flow_type & ~FLOW_EXT ); +if (flow >=ICE_FLTR_PTYPE_MAX || !hw->fdir_prof || + !hw->fdir_prof[flow]) { +return false; + } + + hw_prof = hw->fdir_prof[flow]; + old_seg = hw_prof->fdir_seg[ICE_FD_HW_SEG_NON_TUN ]; + +if (!old_seg || hw->fdir_fltr_cnt[flow] ==0 ) +return false; + + test_seg =kzalloc_obj (*test_seg); +if (!test_seg) +return false; + + err =ice_set_fdir_ip_flow_seg (fsp, test_seg, &perfect_fltr); + +if (err) { +kfree (test_seg); +return false; + } + +if (user && user->flex_fltr) +ice_flow_add_fld_raw (test_seg, user->flex_offset, +ICE_FLTR_PRGM_FLEX_WORD_SIZE , +ICE_FLOW_FLD_OFF_INVAL , +ICE_FLOW_FLD_OFF_INVAL ); + +/* Compare the test segment with the existing segment */ +if (memcmp (old_seg, test_seg,sizeof (*test_seg)) !=0 ) + conflict = true; + +kfree (test_seg); + +return conflict; +} +/** * ice_cfg_fdir_xtrct_seq - Configure extraction sequence for the given filter * @pf: PF structure
@@ -1458,57 +1567,16 @@ ice_cfg_fdir_xtrct_seq(struct ice_pf *pf, struct ethtool_rx_flow_spec *fsp,return -ENOMEM ; } -switch (fsp->flow_type & ~FLOW_EXT ) { -case TCP_V4_FLOW : - ret =ice_set_fdir_ip4_seg (seg, &fsp->m_u.tcp_ip4_spec, -ICE_FLOW_SEG_HDR_TCP , - &perfect_filter); -break ; -case UDP_V4_FLOW : - ret =ice_set_fdir_ip4_seg (seg, &fsp->m_u.tcp_ip4_spec, -ICE_FLOW_SEG_HDR_UDP , - &perfect_filter); -break ; -case SCTP_V4_FLOW : - ret =ice_set_fdir_ip4_seg (seg, &fsp->m_u.tcp_ip4_spec, -ICE_FLOW_SEG_HDR_SCTP , - &perfect_filter); -break ; -case IPV4_USER_FLOW : - ret =ice_set_fdir_ip4_usr_seg (seg, &fsp->m_u.usr_ip4_spec, - &perfect_filter); -break ; -case TCP_V6_FLOW : - ret =ice_set_fdir_ip6_seg (seg, &fsp->m_u.tcp_ip6_spec, -ICE_FLOW_SEG_HDR_TCP , - &perfect_filter); -break ; -case UDP_V6_FLOW : - ret =ice_set_fdir_ip6_seg (seg, &fsp->m_u.tcp_ip6_spec, -ICE_FLOW_SEG_HDR_UDP , - &perfect_filter); -break ; -case SCTP_V6_FLOW : - ret =ice_set_fdir_ip6_seg (seg, &fsp->m_u.tcp_ip6_spec, -ICE_FLOW_SEG_HDR_SCTP , - &perfect_filter); -break ; -case IPV6_USER_FLOW : - ret =ice_set_fdir_ip6_usr_seg (seg, &fsp->m_u.usr_ip6_spec, - &perfect_filter); -break ; -case ETHER_FLOW : +if ((fsp->flow_type & ~FLOW_EXT ) ==ETHER_FLOW ) { ret =ice_set_ether_flow_seg (dev, seg, &fsp->m_u.ether_spec);if (!ret && (fsp->m_ext.vlan_etype || fsp->m_ext.vlan_tci)) { -if (!ice_fdir_vlan_valid (dev, fsp)) { +if (!ice_fdir_vlan_valid (dev, fsp)) ret = -EINVAL ; -break ; - } - ret =ice_set_fdir_vlan_seg (seg, &fsp->m_ext); +else + ret =ice_set_fdir_vlan_seg (seg, &fsp->m_ext); } -break ; -default : - ret = -EINVAL ; + }else { + ret =ice_set_fdir_ip_flow_seg (fsp, seg, &perfect_filter); }if (ret) goto err_exit;
@@ -2239,6 +2307,12 @@ int ice_add_ntuple_ethtool(struct ice_vsi *vsi, struct ethtool_rxnfc *cmd)if (pf->hw.acl_tbl &&ice_is_acl_filter (fsp))return ice_acl_add_rule_ethtool (vsi, cmd); +/* Check if this would cause input set conflict with existing FD filters +*/ +if (pf->hw.acl_tbl &&ice_fdir_has_input_set_conflict (pf, fsp, + &userdata)) +return ice_acl_add_rule_ethtool (vsi, cmd); + ret =ice_cfg_fdir_xtrct_seq (pf, fsp, &userdata);if (ret)return ret;
Signature · 1 line
2.49.0
RE: [Intel-wired-lan] [PATCH iwl-next v4 10/10] ice: use ACL for ntuple rules that conflict with FDir
Quoted 25 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Marcin Szycik
Sent: Thursday, May 21, 2026 4:50 AM
To: [email protected]
Cc: [email protected]; Penigalapati, Sandeep <[email protected]>; S, Ananth <[email protected]>; [email protected]; Czapnik, Lukasz <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v4 10/10] ice: use ACL for ntuple rules that conflict with FDirFrom: Lukasz Czapnik <[email protected]>
Flow Director can keep only one input set per flow type. After ACL support was added for ethtool ntuple rules, the driver still only selected ACL for rules with partial masks.
That leaves a gap for rules with full masks that still require a different input set than the one already programmed for Flow Director. Such rules go through the FDir path, build a different extraction sequence and > then fail because the existing FDir profile cannot be reused.
Detect this case before programming the rule. Build the candidate IP flow segment, compare it with the active non-tunneled FDir profile and, when the input sets differ, offload the rule through ACL if ACL is available.
Refactor the IP flow segment setup into a helper so the same logic can be used both by the extraction-sequence configuration path and by the conflict check.
Signed-off-by Lukasz Czapnik <[email protected]>---
v3:
* Include flex fields intest_segto avoid false conflict detection
* Skip conflict check early forETHER_FLOW
v2:
* Add this patch
Quoted 3 lines
--- .../ethernet/intel/ice/ice_ethtool_ntuple.c | 168 +++++++++++++----- 1 file changed, 121 insertions(+), 47 deletions(-)