Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

cxgb4: flower: add support for fragmentation

This patch adds support for matching fragmented packets in tc flower
filters.

Previously, commit 93a8540aac72 ("cxgb4: flower: validate control flags")
added a check using flow_rule_match_has_control_flags() to reject
any rules with control flags, as the driver did not support
fragmentation at that time.

Now, with this patch, support for FLOW_DIS_IS_FRAGMENT is added:
- The driver checks for control flags using
flow_rule_is_supp_control_flags(), as recommended in
commit d11e63119432 ("flow_offload: add control flag checking helpers").
- If the fragmentation flag is present, the driver sets `fs->val.frag` and
`fs->mask.frag` accordingly in the filter specification.

Since fragmentation is now supported, the earlier check that rejected all
control flags (flow_rule_match_has_control_flags()) has been removed.

Signed-off-by: Harshita V Rajput <harshitha.vr@chelsio.com>
Signed-off-by: Potnuri Bharat Teja <bharat@chelsio.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20251028075255.1391596-1-harshitha.vr@chelsio.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Harshita V Rajput and committed by
Jakub Kicinski
0d0eb186 12a7c6a9

+24 -16
+24 -16
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c
··· 161 161 162 162 static void cxgb4_process_flow_match(struct net_device *dev, 163 163 struct flow_rule *rule, 164 + u16 addr_type, 164 165 struct ch_filter_specification *fs) 165 166 { 166 - u16 addr_type = 0; 167 - 168 - if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_CONTROL)) { 169 - struct flow_match_control match; 170 - 171 - flow_rule_match_control(rule, &match); 172 - addr_type = match.key->addr_type; 173 - } else if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_IPV4_ADDRS)) { 174 - addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS; 175 - } else if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_IPV6_ADDRS)) { 176 - addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS; 177 - } 178 167 179 168 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_BASIC)) { 180 169 struct flow_match_basic match; ··· 315 326 dissector->used_keys); 316 327 return -EOPNOTSUPP; 317 328 } 318 - 319 - if (flow_rule_match_has_control_flags(rule, extack)) 320 - return -EOPNOTSUPP; 321 329 322 330 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_BASIC)) { 323 331 struct flow_match_basic match; ··· 844 858 { 845 859 struct adapter *adap = netdev2adap(dev); 846 860 struct filter_ctx ctx; 861 + u16 addr_type = 0; 847 862 u8 inet_family; 848 863 int fidx, ret; 849 864 ··· 854 867 if (cxgb4_validate_flow_match(extack, rule)) 855 868 return -EOPNOTSUPP; 856 869 857 - cxgb4_process_flow_match(dev, rule, fs); 870 + if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_CONTROL)) { 871 + struct flow_match_control match; 872 + 873 + flow_rule_match_control(rule, &match); 874 + addr_type = match.key->addr_type; 875 + 876 + if (match.mask->flags & FLOW_DIS_IS_FRAGMENT) { 877 + fs->val.frag = match.key->flags & FLOW_DIS_IS_FRAGMENT; 878 + fs->mask.frag = true; 879 + } 880 + 881 + if (!flow_rule_is_supp_control_flags(FLOW_DIS_IS_FRAGMENT, 882 + match.mask->flags, extack)) 883 + return -EOPNOTSUPP; 884 + 885 + } else if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_IPV4_ADDRS)) { 886 + addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS; 887 + } else if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_IPV6_ADDRS)) { 888 + addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS; 889 + } 890 + 891 + cxgb4_process_flow_match(dev, rule, addr_type, fs); 858 892 cxgb4_process_flow_actions(dev, &rule->action, fs); 859 893 860 894 fs->hash = is_filter_exact_match(adap, fs);