From: Jianbo Liu 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 Reviewed-by: Leon Romanovsky Signed-off-by: Tariq Toukan --- .../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