Skip to content

Commit a49a9b9

Browse files
w1ldptrgregkh
authored andcommitted
net/mlx5e: Wait for concurrent flow deletion during neigh/fib events
[ Upstream commit 362980e ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent ebeda7a commit a49a9b9

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
@@ -221,8 +221,14 @@ static void mlx5e_take_tmp_flow(struct mlx5e_tc_flow *flow,
221221
struct list_head *flow_list,
222222
int index)
223223
{
224-
if (IS_ERR(mlx5e_flow_get(flow)))
224+
if (IS_ERR(mlx5e_flow_get(flow))) {
225+
/* Flow is being deleted concurrently. Wait for it to be
226+
* unoffloaded from hardware, otherwise deleting encap will
227+
* fail.
228+
*/
229+
wait_for_completion(&flow->del_hw_done);
225230
return;
231+
}
226232
wait_for_completion(&flow->init_done);
227233

228234
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
@@ -1544,6 +1544,7 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv,
15441544
else
15451545
mlx5e_tc_unoffload_fdb_rules(esw, flow, attr);
15461546
}
1547+
complete_all(&flow->del_hw_done);
15471548

15481549
if (mlx5_flow_has_geneve_opt(flow))
15491550
mlx5_geneve_tlv_option_del(priv->mdev->geneve);
@@ -4222,6 +4223,7 @@ mlx5e_alloc_flow(struct mlx5e_priv *priv, int attr_size,
42224223
INIT_LIST_HEAD(&flow->l3_to_l2_reformat);
42234224
refcount_set(&flow->refcnt, 1);
42244225
init_completion(&flow->init_done);
4226+
init_completion(&flow->del_hw_done);
42254227

42264228
*__flow = flow;
42274229
*__parse_attr = parse_attr;

0 commit comments

Comments
 (0)