From: Tariq Toukan <tariqt@nvidia.com>
To: Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>
Cc: Boris Pismenny <borisp@nvidia.com>,
Saeed Mahameed <saeedm@nvidia.com>,
Leon Romanovsky <leon@kernel.org>,
Tariq Toukan <tariqt@nvidia.com>,
"Mark Bloch" <mbloch@nvidia.com>, Jianbo Liu <jianbol@nvidia.com>,
Carolina Jubran <cjubran@nvidia.com>,
Simon Horman <horms@kernel.org>,
Alexandre Cassen <acassen@corp.free.fr>,
Kees Cook <kees@kernel.org>,
"Jason A. Donenfeld" <Jason@zx2c4.com>,
Michal Swiatkowski <michal.swiatkowski@linux.intel.com>,
Fernando Fernandez Mancera <fmancera@suse.de>,
Antonio Quartulli <antonio@openvpn.net>,
Cosmin Ratiu <cratiu@nvidia.com>,
Edward Cree <ecree.xilinx@gmail.com>,
Sridhar Samudrala <sridhar.samudrala@intel.com>,
<netdev@vger.kernel.org>, <linux-rdma@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, Gal Pressman <gal@nvidia.com>,
"Leon Romanovsky" <leonro@nvidia.com>
Subject: [PATCH net] net/mlx5e: Skip IPsec flow modify when MAC address is unchanged
Date: Wed, 13 May 2026 22:02:26 +0300 [thread overview]
Message-ID: <20260513190226.335562-1-tariqt@nvidia.com> (raw)
From: Jianbo Liu <jianbol@nvidia.com>
When a netdev event fires for an IPsec SA, skip calling
mlx5e_accel_ipsec_fs_modify() if the MAC address has not changed and
the rule is not in drop mode. This avoids a redundant hardware update
when nothing has changed, while still allowing the rule to be restored
when the neighbor becomes reachable again after a drop.
Fixes: 4c24272b4e2b ("net/mlx5e: Listen to ARP events to update IPsec L2 headers in tunnel mode")
Signed-off-by: Jianbo Liu <jianbol@nvidia.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
.../net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
index a52e12c3c95a..f567cd801adb 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
@@ -674,19 +674,26 @@ static void mlx5e_ipsec_handle_netdev_event(struct work_struct *_work)
struct mlx5e_ipsec_sa_entry *sa_entry = work->sa_entry;
struct mlx5e_ipsec_netevent_data *data = work->data;
struct mlx5_accel_esp_xfrm_attrs *attrs;
+ u8 *mac;
attrs = &sa_entry->attrs;
switch (attrs->dir) {
case XFRM_DEV_OFFLOAD_IN:
- ether_addr_copy(attrs->smac, data->addr);
+ mac = attrs->smac;
break;
case XFRM_DEV_OFFLOAD_OUT:
- ether_addr_copy(attrs->dmac, data->addr);
+ mac = attrs->dmac;
break;
default:
WARN_ON_ONCE(true);
+ return;
}
+
+ if (ether_addr_equal(mac, data->addr) && !attrs->drop)
+ return;
+
+ ether_addr_copy(mac, data->addr);
attrs->drop = false;
mlx5e_accel_ipsec_fs_modify(sa_entry);
}
base-commit: f5b2772d14884f4be9e718644f1203d4d0e6f0d6
--
2.44.0
reply other threads:[~2026-05-13 19:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260513190226.335562-1-tariqt@nvidia.com \
--to=tariqt@nvidia.com \
--cc=Jason@zx2c4.com \
--cc=acassen@corp.free.fr \
--cc=andrew+netdev@lunn.ch \
--cc=antonio@openvpn.net \
--cc=borisp@nvidia.com \
--cc=cjubran@nvidia.com \
--cc=cratiu@nvidia.com \
--cc=davem@davemloft.net \
--cc=ecree.xilinx@gmail.com \
--cc=edumazet@google.com \
--cc=fmancera@suse.de \
--cc=gal@nvidia.com \
--cc=horms@kernel.org \
--cc=jianbol@nvidia.com \
--cc=kees@kernel.org \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=leonro@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mbloch@nvidia.com \
--cc=michal.swiatkowski@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=sridhar.samudrala@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox