Skip to content

Commit 1fc2273

Browse files
Achiad Shochatdavem330
authored andcommitted
net/mlx5e: Introduce create/destroy RSS indir table access functions
Introduce access functions to create/destroy RSS indrection table and use it in the Ethernet driver. Signed-off-by: Achiad Shochat <[email protected]> Signed-off-by: Amir Vadai <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1f2a300 commit 1fc2273

File tree

3 files changed

+35
-17
lines changed

3 files changed

+35
-17
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_main.c

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,6 @@ static int mlx5e_open_rqt(struct mlx5e_priv *priv)
11881188
{
11891189
struct mlx5_core_dev *mdev = priv->mdev;
11901190
u32 *in;
1191-
u32 out[MLX5_ST_SZ_DW(create_rqt_out)];
11921191
void *rqtc;
11931192
int inlen;
11941193
int err;
@@ -1216,12 +1215,7 @@ static int mlx5e_open_rqt(struct mlx5e_priv *priv)
12161215
MLX5_SET(rqtc, rqtc, rq_num[i], priv->channel[ix]->rq.rqn);
12171216
}
12181217

1219-
MLX5_SET(create_rqt_in, in, opcode, MLX5_CMD_OP_CREATE_RQT);
1220-
1221-
memset(out, 0, sizeof(out));
1222-
err = mlx5_cmd_exec_check_status(mdev, in, inlen, out, sizeof(out));
1223-
if (!err)
1224-
priv->rqtn = MLX5_GET(create_rqt_out, out, rqtn);
1218+
err = mlx5_core_create_rqt(mdev, in, inlen, &priv->rqtn);
12251219

12261220
kvfree(in);
12271221

@@ -1230,16 +1224,7 @@ static int mlx5e_open_rqt(struct mlx5e_priv *priv)
12301224

12311225
static void mlx5e_close_rqt(struct mlx5e_priv *priv)
12321226
{
1233-
u32 in[MLX5_ST_SZ_DW(destroy_rqt_in)];
1234-
u32 out[MLX5_ST_SZ_DW(destroy_rqt_out)];
1235-
1236-
memset(in, 0, sizeof(in));
1237-
1238-
MLX5_SET(destroy_rqt_in, in, opcode, MLX5_CMD_OP_DESTROY_RQT);
1239-
MLX5_SET(destroy_rqt_in, in, rqtn, priv->rqtn);
1240-
1241-
mlx5_cmd_exec_check_status(priv->mdev, in, sizeof(in), out,
1242-
sizeof(out));
1227+
mlx5_core_destroy_rqt(priv->mdev, priv->rqtn);
12431228
}
12441229

12451230
static void mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 *tirc, int tt)

drivers/net/ethernet/mellanox/mlx5/core/transobj.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,3 +358,32 @@ int mlx5_core_arm_xsrq(struct mlx5_core_dev *dev, u32 xsrqn, u16 lwm)
358358
return mlx5_cmd_exec_check_status(dev, in, sizeof(in), out,
359359
sizeof(out));
360360
}
361+
362+
int mlx5_core_create_rqt(struct mlx5_core_dev *dev, u32 *in, int inlen,
363+
u32 *rqtn)
364+
{
365+
u32 out[MLX5_ST_SZ_DW(create_rqt_out)];
366+
int err;
367+
368+
MLX5_SET(create_rqt_in, in, opcode, MLX5_CMD_OP_CREATE_RQT);
369+
370+
memset(out, 0, sizeof(out));
371+
err = mlx5_cmd_exec_check_status(dev, in, inlen, out, sizeof(out));
372+
if (!err)
373+
*rqtn = MLX5_GET(create_rqt_out, out, rqtn);
374+
375+
return err;
376+
}
377+
378+
void mlx5_core_destroy_rqt(struct mlx5_core_dev *dev, u32 rqtn)
379+
{
380+
u32 in[MLX5_ST_SZ_DW(destroy_rqt_in)];
381+
u32 out[MLX5_ST_SZ_DW(destroy_rqt_out)];
382+
383+
memset(in, 0, sizeof(in));
384+
385+
MLX5_SET(destroy_rqt_in, in, opcode, MLX5_CMD_OP_DESTROY_RQT);
386+
MLX5_SET(destroy_rqt_in, in, rqtn, rqtn);
387+
388+
mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, sizeof(out));
389+
}

drivers/net/ethernet/mellanox/mlx5/core/transobj.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,8 @@ int mlx5_core_destroy_xsrq(struct mlx5_core_dev *dev, u32 rmpn);
6161
int mlx5_core_query_xsrq(struct mlx5_core_dev *dev, u32 rmpn, u32 *out);
6262
int mlx5_core_arm_xsrq(struct mlx5_core_dev *dev, u32 rmpn, u16 lwm);
6363

64+
int mlx5_core_create_rqt(struct mlx5_core_dev *dev, u32 *in, int inlen,
65+
u32 *rqtn);
66+
void mlx5_core_destroy_rqt(struct mlx5_core_dev *dev, u32 rqtn);
67+
6468
#endif /* __TRANSOBJ_H__ */

0 commit comments

Comments
 (0)