Commit 16bccbaa authored by Leon Romanovsky's avatar Leon Romanovsky Committed by Saeed Mahameed
Browse files

net/mlx5e: Remove optimization which prevented update of ESN state



aso->use_cache variable introduced in commit 8c582ddf ("net/mlx5e: Handle
hardware IPsec limits events") was an optimization to skip recurrent calls
to mlx5e_ipsec_aso_query(). Such calls are possible when lifetime event is
generated:
 -> mlx5e_ipsec_handle_event()
  -> mlx5e_ipsec_aso_query() - first call
  -> xfrm_state_check_expire()
   -> mlx5e_xfrm_update_curlft()
    -> mlx5e_ipsec_aso_query() - second call

However, such optimization not really effective as mlx5e_ipsec_aso_query()
is needed to be called for update ESN anyway, which was missed due to misplaced
use_cache assignment.

Fixes: cee137a6 ("net/mlx5e: Handle ESN update events")
Reviewed-by: default avatarJianbo Liu <jianbol@nvidia.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent ffa99b53
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -122,11 +122,6 @@ struct mlx5e_ipsec_aso {
	u8 ctx[MLX5_ST_SZ_BYTES(ipsec_aso)];
	dma_addr_t dma_addr;
	struct mlx5_aso *aso;
	/* IPsec ASO caches data on every query call,
	 * so in nested calls, we can use this boolean to save
	 * recursive calls to mlx5e_ipsec_aso_query()
	 */
	u8 use_cache : 1;
};

struct mlx5e_ipsec {
+0 −5
Original line number Diff line number Diff line
@@ -320,7 +320,6 @@ static void mlx5e_ipsec_handle_event(struct work_struct *_work)
	if (ret)
		goto unlock;

	aso->use_cache = true;
	if (attrs->esn_trigger &&
	    !MLX5_GET(ipsec_aso, aso->ctx, esn_event_arm)) {
		u32 mode_param = MLX5_GET(ipsec_aso, aso->ctx, mode_parameter);
@@ -333,7 +332,6 @@ static void mlx5e_ipsec_handle_event(struct work_struct *_work)
		    !MLX5_GET(ipsec_aso, aso->ctx, hard_lft_arm) ||
		    !MLX5_GET(ipsec_aso, aso->ctx, remove_flow_enable))
			xfrm_state_check_expire(sa_entry->x);
	aso->use_cache = false;

unlock:
	spin_unlock(&sa_entry->x->lock);
@@ -458,9 +456,6 @@ int mlx5e_ipsec_aso_query(struct mlx5e_ipsec_sa_entry *sa_entry,
	u8 ds_cnt;

	lockdep_assert_held(&sa_entry->x->lock);
	if (aso->use_cache)
		return 0;

	res = &mdev->mlx5e_res.hw_objs;

	memset(aso->ctx, 0, sizeof(aso->ctx));