Skip to content

Commit 2799797

Browse files
Chris MiSaeed Mahameed
authored andcommitted
net/mlx5e: CT, Use xarray to manage fte ids
IDR is deprecated. Use xarray instead. Signed-off-by: Chris Mi <[email protected]> Reviewed-by: Oz Shlomo <[email protected]> Reviewed-by: Roi Dayan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent bcd6740 commit 2799797

File tree

1 file changed

+9
-9
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/en

1 file changed

+9
-9
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct mlx5_tc_ct_priv {
4646
struct mlx5_core_dev *dev;
4747
const struct net_device *netdev;
4848
struct mod_hdr_tbl *mod_hdr_tbl;
49-
struct idr fte_ids;
49+
struct xarray fte_ids;
5050
struct xarray tuple_ids;
5151
struct rhashtable zone_ht;
5252
struct rhashtable ct_tuples_ht;
@@ -1773,12 +1773,12 @@ __mlx5_tc_ct_flow_offload(struct mlx5_tc_ct_priv *ct_priv,
17731773
}
17741774
ct_flow->ft = ft;
17751775

1776-
err = idr_alloc_u32(&ct_priv->fte_ids, ct_flow, &fte_id,
1777-
MLX5_FTE_ID_MAX, GFP_KERNEL);
1776+
err = xa_alloc(&ct_priv->fte_ids, &fte_id, ct_flow,
1777+
XA_LIMIT(1, MLX5_FTE_ID_MAX), GFP_KERNEL);
17781778
if (err) {
17791779
netdev_warn(priv->netdev,
17801780
"Failed to allocate fte id, err: %d\n", err);
1781-
goto err_idr;
1781+
goto err_xarray;
17821782
}
17831783
ct_flow->fte_id = fte_id;
17841784

@@ -1914,8 +1914,8 @@ __mlx5_tc_ct_flow_offload(struct mlx5_tc_ct_priv *ct_priv,
19141914
err_alloc_post:
19151915
kfree(ct_flow->pre_ct_attr);
19161916
err_alloc_pre:
1917-
idr_remove(&ct_priv->fte_ids, fte_id);
1918-
err_idr:
1917+
xa_erase(&ct_priv->fte_ids, fte_id);
1918+
err_xarray:
19191919
mlx5_tc_ct_del_ft_cb(ct_priv, ft);
19201920
err_ft:
19211921
kvfree(post_ct_spec);
@@ -2033,7 +2033,7 @@ __mlx5_tc_ct_delete_flow(struct mlx5_tc_ct_priv *ct_priv,
20332033
mlx5_tc_rule_delete(priv, ct_flow->post_ct_rule,
20342034
ct_flow->post_ct_attr);
20352035
mlx5_chains_put_chain_mapping(ct_priv->chains, ct_flow->chain_mapping);
2036-
idr_remove(&ct_priv->fte_ids, ct_flow->fte_id);
2036+
xa_erase(&ct_priv->fte_ids, ct_flow->fte_id);
20372037
mlx5_tc_ct_del_ft_cb(ct_priv, ct_flow->ft);
20382038
}
20392039

@@ -2203,7 +2203,7 @@ mlx5_tc_ct_init(struct mlx5e_priv *priv, struct mlx5_fs_chains *chains,
22032203
goto err_post_ct_tbl;
22042204
}
22052205

2206-
idr_init(&ct_priv->fte_ids);
2206+
xa_init_flags(&ct_priv->fte_ids, XA_FLAGS_ALLOC1);
22072207
mutex_init(&ct_priv->control_lock);
22082208
rhashtable_init(&ct_priv->zone_ht, &zone_params);
22092209
rhashtable_init(&ct_priv->ct_tuples_ht, &tuples_ht_params);
@@ -2247,7 +2247,7 @@ mlx5_tc_ct_clean(struct mlx5_tc_ct_priv *ct_priv)
22472247
rhashtable_destroy(&ct_priv->ct_tuples_nat_ht);
22482248
rhashtable_destroy(&ct_priv->zone_ht);
22492249
mutex_destroy(&ct_priv->control_lock);
2250-
idr_destroy(&ct_priv->fte_ids);
2250+
xa_destroy(&ct_priv->fte_ids);
22512251
kfree(ct_priv);
22522252
}
22532253

0 commit comments

Comments
 (0)