Skip to content

Commit bbfeba2

Browse files
committed
Merge branch 'mlx5-misc-patches-2024-08-08'
Tariq Toukan says: ==================== mlx5 misc patches 2024-08-08 This patchset contains multiple enhancements from the team to the mlx5 core and Eth drivers. Patch #1 by Chris bumps a defined value to permit more devices doing TC offloads. Patch #2 by Jianbo adds an IPsec fast-path optimization to replace the slow async handling. Patches #3 and #4 by Jianbo add TC offload support for complicated rules to overcome firmware limitation. Patch #5 by Gal unifies the access macro to advertised/supported link modes. Patches #6 to #9 by Gal adds extack messages in ethtool ops to replace prints to the kernel log. Patch #10 by Cosmin switches to using 'update' verb instead of 'replace' to better reflect the operation. Patch #11 by Cosmin exposes an update connection tracking operation to replace the assumed delete+add implementaiton. ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 1862923 + 6b5662b commit bbfeba2

File tree

13 files changed

+253
-74
lines changed

13 files changed

+253
-74
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,14 +1172,16 @@ void mlx5e_ethtool_get_ringparam(struct mlx5e_priv *priv,
11721172
struct ethtool_ringparam *param,
11731173
struct kernel_ethtool_ringparam *kernel_param);
11741174
int mlx5e_ethtool_set_ringparam(struct mlx5e_priv *priv,
1175-
struct ethtool_ringparam *param);
1175+
struct ethtool_ringparam *param,
1176+
struct netlink_ext_ack *extack);
11761177
void mlx5e_ethtool_get_channels(struct mlx5e_priv *priv,
11771178
struct ethtool_channels *ch);
11781179
int mlx5e_ethtool_set_channels(struct mlx5e_priv *priv,
11791180
struct ethtool_channels *ch);
11801181
int mlx5e_ethtool_get_coalesce(struct mlx5e_priv *priv,
11811182
struct ethtool_coalesce *coal,
1182-
struct kernel_ethtool_coalesce *kernel_coal);
1183+
struct kernel_ethtool_coalesce *kernel_coal,
1184+
struct netlink_ext_ack *extack);
11831185
int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv,
11841186
struct ethtool_coalesce *coal,
11851187
struct kernel_ethtool_coalesce *kernel_coal,

drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ struct mlx5_ct_fs_ops {
2525
struct mlx5_flow_attr *attr,
2626
struct flow_rule *flow_rule);
2727
void (*ct_rule_del)(struct mlx5_ct_fs *fs, struct mlx5_ct_fs_rule *fs_rule);
28+
int (*ct_rule_update)(struct mlx5_ct_fs *fs, struct mlx5_ct_fs_rule *fs_rule,
29+
struct mlx5_flow_spec *spec, struct mlx5_flow_attr *attr);
2830

2931
size_t priv_size;
3032
};

drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_dmfs.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,30 @@ mlx5_ct_fs_dmfs_ct_rule_del(struct mlx5_ct_fs *fs, struct mlx5_ct_fs_rule *fs_ru
6565
kfree(dmfs_rule);
6666
}
6767

68+
static int mlx5_ct_fs_dmfs_ct_rule_update(struct mlx5_ct_fs *fs, struct mlx5_ct_fs_rule *fs_rule,
69+
struct mlx5_flow_spec *spec, struct mlx5_flow_attr *attr)
70+
{
71+
struct mlx5_ct_fs_dmfs_rule *dmfs_rule = container_of(fs_rule,
72+
struct mlx5_ct_fs_dmfs_rule,
73+
fs_rule);
74+
struct mlx5e_priv *priv = netdev_priv(fs->netdev);
75+
struct mlx5_flow_handle *rule;
76+
77+
rule = mlx5_tc_rule_insert(priv, spec, attr);
78+
if (IS_ERR(rule))
79+
return PTR_ERR(rule);
80+
mlx5_tc_rule_delete(priv, dmfs_rule->rule, dmfs_rule->attr);
81+
82+
dmfs_rule->rule = rule;
83+
dmfs_rule->attr = attr;
84+
85+
return 0;
86+
}
87+
6888
static struct mlx5_ct_fs_ops dmfs_ops = {
6989
.ct_rule_add = mlx5_ct_fs_dmfs_ct_rule_add,
7090
.ct_rule_del = mlx5_ct_fs_dmfs_ct_rule_del,
91+
.ct_rule_update = mlx5_ct_fs_dmfs_ct_rule_update,
7192

7293
.init = mlx5_ct_fs_dmfs_init,
7394
.destroy = mlx5_ct_fs_dmfs_destroy,

drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_smfs.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,35 @@ mlx5_ct_fs_smfs_ct_rule_del(struct mlx5_ct_fs *fs, struct mlx5_ct_fs_rule *fs_ru
368368
kfree(smfs_rule);
369369
}
370370

371+
static int mlx5_ct_fs_smfs_ct_rule_update(struct mlx5_ct_fs *fs, struct mlx5_ct_fs_rule *fs_rule,
372+
struct mlx5_flow_spec *spec, struct mlx5_flow_attr *attr)
373+
{
374+
struct mlx5_ct_fs_smfs_rule *smfs_rule = container_of(fs_rule,
375+
struct mlx5_ct_fs_smfs_rule,
376+
fs_rule);
377+
struct mlx5_ct_fs_smfs *fs_smfs = mlx5_ct_fs_priv(fs);
378+
struct mlx5dr_action *actions[3]; /* We only need to create 3 actions, see below. */
379+
struct mlx5dr_rule *rule;
380+
381+
actions[0] = smfs_rule->count_action;
382+
actions[1] = attr->modify_hdr->action.dr_action;
383+
actions[2] = fs_smfs->fwd_action;
384+
385+
rule = mlx5_smfs_rule_create(smfs_rule->smfs_matcher->dr_matcher, spec,
386+
ARRAY_SIZE(actions), actions, spec->flow_context.flow_source);
387+
if (!rule)
388+
return -EINVAL;
389+
390+
mlx5_smfs_rule_destroy(smfs_rule->rule);
391+
smfs_rule->rule = rule;
392+
393+
return 0;
394+
}
395+
371396
static struct mlx5_ct_fs_ops fs_smfs_ops = {
372397
.ct_rule_add = mlx5_ct_fs_smfs_ct_rule_add,
373398
.ct_rule_del = mlx5_ct_fs_smfs_ct_rule_del,
399+
.ct_rule_update = mlx5_ct_fs_smfs_ct_rule_update,
374400

375401
.init = mlx5_ct_fs_smfs_init,
376402
.destroy = mlx5_ct_fs_smfs_destroy,

drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -876,15 +876,14 @@ mlx5_tc_ct_entry_add_rule(struct mlx5_tc_ct_priv *ct_priv,
876876
}
877877

878878
static int
879-
mlx5_tc_ct_entry_replace_rule(struct mlx5_tc_ct_priv *ct_priv,
880-
struct flow_rule *flow_rule,
881-
struct mlx5_ct_entry *entry,
882-
bool nat, u8 zone_restore_id)
879+
mlx5_tc_ct_entry_update_rule(struct mlx5_tc_ct_priv *ct_priv,
880+
struct flow_rule *flow_rule,
881+
struct mlx5_ct_entry *entry,
882+
bool nat, u8 zone_restore_id)
883883
{
884884
struct mlx5_ct_zone_rule *zone_rule = &entry->zone_rules[nat];
885885
struct mlx5_flow_attr *attr = zone_rule->attr, *old_attr;
886886
struct mlx5e_mod_hdr_handle *mh;
887-
struct mlx5_ct_fs_rule *rule;
888887
struct mlx5_flow_spec *spec;
889888
int err;
890889

@@ -902,29 +901,26 @@ mlx5_tc_ct_entry_replace_rule(struct mlx5_tc_ct_priv *ct_priv,
902901
err = mlx5_tc_ct_entry_create_mod_hdr(ct_priv, attr, flow_rule, &mh, zone_restore_id,
903902
nat, mlx5_tc_ct_entry_in_ct_nat_table(entry));
904903
if (err) {
905-
ct_dbg("Failed to create ct entry mod hdr");
904+
ct_dbg("Failed to create ct entry mod hdr, err: %d", err);
906905
goto err_mod_hdr;
907906
}
908907

909908
mlx5_tc_ct_set_tuple_match(ct_priv, spec, flow_rule);
910909
mlx5e_tc_match_to_reg_match(spec, ZONE_TO_REG, entry->tuple.zone, MLX5_CT_ZONE_MASK);
911910

912-
rule = ct_priv->fs_ops->ct_rule_add(ct_priv->fs, spec, attr, flow_rule);
913-
if (IS_ERR(rule)) {
914-
err = PTR_ERR(rule);
915-
ct_dbg("Failed to add replacement ct entry rule, nat: %d", nat);
911+
err = ct_priv->fs_ops->ct_rule_update(ct_priv->fs, zone_rule->rule, spec, attr);
912+
if (err) {
913+
ct_dbg("Failed to update ct entry rule, nat: %d, err: %d", nat, err);
916914
goto err_rule;
917915
}
918916

919-
ct_priv->fs_ops->ct_rule_del(ct_priv->fs, zone_rule->rule);
920-
zone_rule->rule = rule;
921917
mlx5_tc_ct_entry_destroy_mod_hdr(ct_priv, old_attr, zone_rule->mh);
922918
zone_rule->mh = mh;
923919
mlx5_put_label_mapping(ct_priv, old_attr->ct_attr.ct_labels_id);
924920

925921
kfree(old_attr);
926922
kvfree(spec);
927-
ct_dbg("Replaced ct entry rule in zone %d", entry->tuple.zone);
923+
ct_dbg("Updated ct entry rule in zone %d", entry->tuple.zone);
928924

929925
return 0;
930926

@@ -1141,37 +1137,37 @@ mlx5_tc_ct_entry_add_rules(struct mlx5_tc_ct_priv *ct_priv,
11411137
}
11421138

11431139
static int
1144-
mlx5_tc_ct_entry_replace_rules(struct mlx5_tc_ct_priv *ct_priv,
1145-
struct flow_rule *flow_rule,
1146-
struct mlx5_ct_entry *entry,
1147-
u8 zone_restore_id)
1140+
mlx5_tc_ct_entry_update_rules(struct mlx5_tc_ct_priv *ct_priv,
1141+
struct flow_rule *flow_rule,
1142+
struct mlx5_ct_entry *entry,
1143+
u8 zone_restore_id)
11481144
{
11491145
int err = 0;
11501146

11511147
if (mlx5_tc_ct_entry_in_ct_table(entry)) {
1152-
err = mlx5_tc_ct_entry_replace_rule(ct_priv, flow_rule, entry, false,
1153-
zone_restore_id);
1148+
err = mlx5_tc_ct_entry_update_rule(ct_priv, flow_rule, entry, false,
1149+
zone_restore_id);
11541150
if (err)
11551151
return err;
11561152
}
11571153

11581154
if (mlx5_tc_ct_entry_in_ct_nat_table(entry)) {
1159-
err = mlx5_tc_ct_entry_replace_rule(ct_priv, flow_rule, entry, true,
1160-
zone_restore_id);
1155+
err = mlx5_tc_ct_entry_update_rule(ct_priv, flow_rule, entry, true,
1156+
zone_restore_id);
11611157
if (err && mlx5_tc_ct_entry_in_ct_table(entry))
11621158
mlx5_tc_ct_entry_del_rule(ct_priv, entry, false);
11631159
}
11641160
return err;
11651161
}
11661162

11671163
static int
1168-
mlx5_tc_ct_block_flow_offload_replace(struct mlx5_ct_ft *ft, struct flow_rule *flow_rule,
1169-
struct mlx5_ct_entry *entry, unsigned long cookie)
1164+
mlx5_tc_ct_block_flow_offload_update(struct mlx5_ct_ft *ft, struct flow_rule *flow_rule,
1165+
struct mlx5_ct_entry *entry, unsigned long cookie)
11701166
{
11711167
struct mlx5_tc_ct_priv *ct_priv = ft->ct_priv;
11721168
int err;
11731169

1174-
err = mlx5_tc_ct_entry_replace_rules(ct_priv, flow_rule, entry, ft->zone_restore_id);
1170+
err = mlx5_tc_ct_entry_update_rules(ct_priv, flow_rule, entry, ft->zone_restore_id);
11751171
if (!err)
11761172
return 0;
11771173

@@ -1216,7 +1212,7 @@ mlx5_tc_ct_block_flow_offload_add(struct mlx5_ct_ft *ft,
12161212
entry->restore_cookie = meta_action->ct_metadata.cookie;
12171213
spin_unlock_bh(&ct_priv->ht_lock);
12181214

1219-
err = mlx5_tc_ct_block_flow_offload_replace(ft, flow_rule, entry, cookie);
1215+
err = mlx5_tc_ct_block_flow_offload_update(ft, flow_rule, entry, cookie);
12201216
mlx5_tc_ct_entry_put(entry);
12211217
return err;
12221218
}

drivers/net/ethernet/mellanox/mlx5/core/en/tc_priv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ struct mlx5e_tc_flow {
109109
struct completion init_done;
110110
struct completion del_hw_done;
111111
struct mlx5_flow_attr *attr;
112+
struct mlx5_flow_attr *extra_split_attr;
112113
struct list_head attrs;
113114
u32 chain_mapping;
114115
};

drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ static void mlx5e_ipsec_packet_setup(void *obj, u32 pdn,
127127
MLX5_SET(ipsec_aso, aso_ctx, remove_flow_pkt_cnt,
128128
attrs->lft.hard_packet_limit);
129129
MLX5_SET(ipsec_aso, aso_ctx, hard_lft_arm, 1);
130+
MLX5_SET(ipsec_aso, aso_ctx, remove_flow_enable, 1);
130131
}
131132

132133
if (attrs->lft.soft_packet_limit != XFRM_INF) {

0 commit comments

Comments
 (0)