mirror of
https://github.com/torvalds/linux.git
synced 2026-08-01 03:59:40 +02:00
net/mlx5e: CT: extract a memcmp from a spinlock section
This reduces the time the lock is held and reduces contention. Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com> Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/1752009387-13300-3-git-send-email-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
ade89d1f24
commit
122d86aa2a
|
|
@ -1195,6 +1195,7 @@ mlx5_tc_ct_block_flow_offload_add(struct mlx5_ct_ft *ft,
|
|||
struct flow_action_entry *meta_action;
|
||||
unsigned long cookie = flow->cookie;
|
||||
struct mlx5_ct_entry *entry;
|
||||
bool has_nat;
|
||||
int err;
|
||||
|
||||
meta_action = mlx5_tc_ct_get_ct_metadata_action(flow_rule);
|
||||
|
|
@ -1236,6 +1237,8 @@ mlx5_tc_ct_block_flow_offload_add(struct mlx5_ct_ft *ft,
|
|||
err = mlx5_tc_ct_rule_to_tuple_nat(&entry->tuple_nat, flow_rule);
|
||||
if (err)
|
||||
goto err_set;
|
||||
has_nat = memcmp(&entry->tuple, &entry->tuple_nat,
|
||||
sizeof(entry->tuple));
|
||||
|
||||
spin_lock_bh(&ct_priv->ht_lock);
|
||||
|
||||
|
|
@ -1244,7 +1247,7 @@ mlx5_tc_ct_block_flow_offload_add(struct mlx5_ct_ft *ft,
|
|||
if (err)
|
||||
goto err_entries;
|
||||
|
||||
if (memcmp(&entry->tuple, &entry->tuple_nat, sizeof(entry->tuple))) {
|
||||
if (has_nat) {
|
||||
err = rhashtable_lookup_insert_fast(&ct_priv->ct_tuples_nat_ht,
|
||||
&entry->tuple_nat_node,
|
||||
tuples_nat_ht_params);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user