58 lines
2.1 KiB
Diff
58 lines
2.1 KiB
Diff
From 5a21b2dc63b360eb3cf2a51245c079f2b343085c Mon Sep 17 00:00:00 2001
|
|
From: Kamal Heib <kheib@redhat.com>
|
|
Date: Thu, 16 Apr 2026 18:03:21 -0400
|
|
Subject: [PATCH] net/mlx5e: CT: extract a memcmp from a spinlock section
|
|
|
|
JIRA: https://redhat.atlassian.net/browse/RHEL-169055
|
|
|
|
commit 122d86aa2a0c8950ea958a3d258eccbb5872bd68
|
|
Author: Cosmin Ratiu <cratiu@nvidia.com>
|
|
Date: Wed Jul 9 00:16:24 2025 +0300
|
|
|
|
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>
|
|
|
|
Signed-off-by: Kamal Heib <kheib@redhat.com>
|
|
|
|
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
|
|
index 81332cd4a582..870d12364f99 100644
|
|
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
|
|
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
|
|
@@ -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);
|
|
--
|
|
2.50.1 (Apple Git-155)
|
|
|