Skip to content

Commit 362980e

Browse files
w1ldptrSaeed Mahameed
authored andcommitted
net/mlx5e: Wait for concurrent flow deletion during neigh/fib events
Function mlx5e_take_tmp_flow() skips flows with zero reference count. This can cause syndrome 0x179e84 when the called from neigh or route update code and the skipped flow is not removed from the hardware by the time underlying encap/decap resource is deleted. Add new completion 'del_hw_done' that is completed when flow is unoffloaded. This is safe to do because flow with reference count zero needs to be detached from encap/decap entry before its memory is deallocated, which requires taking the encap_tbl_lock mutex that is held by the event handlers code. Fixes: 8914add ("net/mlx5e: Handle FIB events to update tunnel endpoint device") Signed-off-by: Vlad Buslov <vladbu@nvidia.com> Reviewed-by: Roi Dayan <roid@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
1 parent cc4a9cc commit 362980e

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

‎drivers/net/ethernet/mellanox/mlx5/core/en/tc_priv.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ struct mlx5e_tc_flow {
102102
refcount_t refcnt;
103103
struct rcu_head rcu_head;
104104
struct completion init_done;
105+
struct completion del_hw_done;
105106
int tunnel_id; /* the mapped tunnel id of this flow */
106107
struct mlx5_flow_attr *attr;
107108
};

‎drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,14 @@ static void mlx5e_take_tmp_flow(struct mlx5e_tc_flow *flow,
245245
struct list_head *flow_list,
246246
int index)
247247
{
248-
if (IS_ERR(mlx5e_flow_get(flow)))
248+
if (IS_ERR(mlx5e_flow_get(flow))) {
249+
/* Flow is being deleted concurrently. Wait for it to be
250+
* unoffloaded from hardware, otherwise deleting encap will
251+
* fail.
252+
*/
253+
wait_for_completion(&flow->del_hw_done);
249254
return;
255+
}
250256
wait_for_completion(&flow->init_done);
251257

252258
flow->tmp_entry_index = index;

‎drivers/net/ethernet/mellanox/mlx5/core/en_tc.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,6 +1600,7 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv,
16001600
else
16011601
mlx5e_tc_unoffload_fdb_rules(esw, flow, attr);
16021602
}
1603+
complete_all(&flow->del_hw_done);
16031604

16041605
if (mlx5_flow_has_geneve_opt(flow))
16051606
mlx5_geneve_tlv_option_del(priv->mdev->geneve);
@@ -4465,6 +4466,7 @@ mlx5e_alloc_flow(struct mlx5e_priv *priv, int attr_size,
44654466
INIT_LIST_HEAD(&flow->l3_to_l2_reformat);
44664467
refcount_set(&flow->refcnt, 1);
44674468
init_completion(&flow->init_done);
4469+
init_completion(&flow->del_hw_done);
44684470

44694471
*__flow = flow;
44704472
*__parse_attr = parse_attr;

0 commit comments

Comments
 (0)