Commit 486aeb2d authored by Cosmin Ratiu's avatar Cosmin Ratiu Committed by Jakub Kicinski
Browse files

net/mlx5e: CT: 'update' rules instead of 'replace'



Offloaded rules can be updated with a new modify header action
containing a changed restore cookie. This was done using the verb
'replace', while in some configurations 'update' is a better fit.

This commit renames the functions used to reflect that.

Signed-off-by: default avatarCosmin Ratiu <cratiu@nvidia.com>
Signed-off-by: default avatarTariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20240808055927.2059700-11-tariqt@nvidia.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent b5100b72
Loading
Loading
Loading
Loading
+17 −17
Original line number Diff line number Diff line
@@ -876,7 +876,7 @@ mlx5_tc_ct_entry_add_rule(struct mlx5_tc_ct_priv *ct_priv,
}

static int
mlx5_tc_ct_entry_replace_rule(struct mlx5_tc_ct_priv *ct_priv,
mlx5_tc_ct_entry_update_rule(struct mlx5_tc_ct_priv *ct_priv,
			     struct flow_rule *flow_rule,
			     struct mlx5_ct_entry *entry,
			     bool nat, u8 zone_restore_id)
@@ -924,7 +924,7 @@ mlx5_tc_ct_entry_replace_rule(struct mlx5_tc_ct_priv *ct_priv,

	kfree(old_attr);
	kvfree(spec);
	ct_dbg("Replaced ct entry rule in zone %d", entry->tuple.zone);
	ct_dbg("Updated ct entry rule in zone %d", entry->tuple.zone);

	return 0;

@@ -1141,7 +1141,7 @@ mlx5_tc_ct_entry_add_rules(struct mlx5_tc_ct_priv *ct_priv,
}

static int
mlx5_tc_ct_entry_replace_rules(struct mlx5_tc_ct_priv *ct_priv,
mlx5_tc_ct_entry_update_rules(struct mlx5_tc_ct_priv *ct_priv,
			      struct flow_rule *flow_rule,
			      struct mlx5_ct_entry *entry,
			      u8 zone_restore_id)
@@ -1149,14 +1149,14 @@ mlx5_tc_ct_entry_replace_rules(struct mlx5_tc_ct_priv *ct_priv,
	int err = 0;

	if (mlx5_tc_ct_entry_in_ct_table(entry)) {
		err = mlx5_tc_ct_entry_replace_rule(ct_priv, flow_rule, entry, false,
		err = mlx5_tc_ct_entry_update_rule(ct_priv, flow_rule, entry, false,
						   zone_restore_id);
		if (err)
			return err;
	}

	if (mlx5_tc_ct_entry_in_ct_nat_table(entry)) {
		err = mlx5_tc_ct_entry_replace_rule(ct_priv, flow_rule, entry, true,
		err = mlx5_tc_ct_entry_update_rule(ct_priv, flow_rule, entry, true,
						   zone_restore_id);
		if (err && mlx5_tc_ct_entry_in_ct_table(entry))
			mlx5_tc_ct_entry_del_rule(ct_priv, entry, false);
@@ -1165,13 +1165,13 @@ mlx5_tc_ct_entry_replace_rules(struct mlx5_tc_ct_priv *ct_priv,
}

static int
mlx5_tc_ct_block_flow_offload_replace(struct mlx5_ct_ft *ft, struct flow_rule *flow_rule,
mlx5_tc_ct_block_flow_offload_update(struct mlx5_ct_ft *ft, struct flow_rule *flow_rule,
				     struct mlx5_ct_entry *entry, unsigned long cookie)
{
	struct mlx5_tc_ct_priv *ct_priv = ft->ct_priv;
	int err;

	err = mlx5_tc_ct_entry_replace_rules(ct_priv, flow_rule, entry, ft->zone_restore_id);
	err = mlx5_tc_ct_entry_update_rules(ct_priv, flow_rule, entry, ft->zone_restore_id);
	if (!err)
		return 0;

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

		err = mlx5_tc_ct_block_flow_offload_replace(ft, flow_rule, entry, cookie);
		err = mlx5_tc_ct_block_flow_offload_update(ft, flow_rule, entry, cookie);
		mlx5_tc_ct_entry_put(entry);
		return err;
	}