Skip to content

Commit 398f335

Browse files
hadarhenziondavem330
authored andcommitted
net/mlx5e: Mark enabled RQTs instances explicitly
In the current driver implementation two types of receive queue tables (RQTs) are in use - direct and indirect. Change the driver to mark each new created RQT (direct or indirect) as "enabled". This behaviour is needed for introducing new mlx5e instances which serve to represent SRIOV VFs. The VF representors will have only one type of RQTs (direct). An "enabled" flag is added to each RQT to allow better handling and code sharing between the representors and the nic netdevices. This patch doesn't add any new functionality. Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com> Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 724b2aa commit 398f335

File tree

3 files changed

+37
-23
lines changed

3 files changed

+37
-23
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,10 +552,15 @@ struct mlx5e_flow_steering {
552552
struct mlx5e_arfs_tables arfs;
553553
};
554554

555-
struct mlx5e_tir {
556-
u32 tirn;
555+
struct mlx5e_rqt {
557556
u32 rqtn;
558-
struct list_head list;
557+
bool enabled;
558+
};
559+
560+
struct mlx5e_tir {
561+
u32 tirn;
562+
struct mlx5e_rqt rqt;
563+
struct list_head list;
559564
};
560565

561566
enum {
@@ -576,7 +581,7 @@ struct mlx5e_priv {
576581

577582
struct mlx5e_channel **channel;
578583
u32 tisn[MLX5E_MAX_NUM_TC];
579-
u32 indir_rqtn;
584+
struct mlx5e_rqt indir_rqt;
580585
struct mlx5e_tir indir_tir[MLX5E_NUM_INDIR_TIRS];
581586
struct mlx5e_tir direct_tir[MLX5E_MAX_NUM_CHANNELS];
582587
u32 tx_rates[MLX5E_MAX_NUM_SQS];

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ static int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir,
898898
mutex_lock(&priv->state_lock);
899899

900900
if (indir) {
901-
u32 rqtn = priv->indir_rqtn;
901+
u32 rqtn = priv->indir_rqt.rqtn;
902902

903903
memcpy(priv->params.indirection_rqt, indir,
904904
sizeof(priv->params.indirection_rqt));

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

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,7 +1486,8 @@ static void mlx5e_fill_direct_rqt_rqn(struct mlx5e_priv *priv, void *rqtc,
14861486
MLX5_SET(rqtc, rqtc, rq_num[0], rqn);
14871487
}
14881488

1489-
static int mlx5e_create_rqt(struct mlx5e_priv *priv, int sz, int ix, u32 *rqtn)
1489+
static int mlx5e_create_rqt(struct mlx5e_priv *priv, int sz,
1490+
int ix, struct mlx5e_rqt *rqt)
14901491
{
14911492
struct mlx5_core_dev *mdev = priv->mdev;
14921493
void *rqtc;
@@ -1509,34 +1510,37 @@ static int mlx5e_create_rqt(struct mlx5e_priv *priv, int sz, int ix, u32 *rqtn)
15091510
else
15101511
mlx5e_fill_direct_rqt_rqn(priv, rqtc, ix);
15111512

1512-
err = mlx5_core_create_rqt(mdev, in, inlen, rqtn);
1513+
err = mlx5_core_create_rqt(mdev, in, inlen, &rqt->rqtn);
1514+
if (!err)
1515+
rqt->enabled = true;
15131516

15141517
kvfree(in);
15151518
return err;
15161519
}
15171520

1518-
static void mlx5e_destroy_rqt(struct mlx5e_priv *priv, u32 rqtn)
1521+
static void mlx5e_destroy_rqt(struct mlx5e_priv *priv, struct mlx5e_rqt *rqt)
15191522
{
1520-
mlx5_core_destroy_rqt(priv->mdev, rqtn);
1523+
rqt->enabled = false;
1524+
mlx5_core_destroy_rqt(priv->mdev, rqt->rqtn);
15211525
}
15221526

15231527
static int mlx5e_create_rqts(struct mlx5e_priv *priv)
15241528
{
15251529
int nch = mlx5e_get_max_num_channels(priv->mdev);
1526-
u32 *rqtn;
1530+
struct mlx5e_rqt *rqt;
15271531
int err;
15281532
int ix;
15291533

15301534
/* Indirect RQT */
1531-
rqtn = &priv->indir_rqtn;
1532-
err = mlx5e_create_rqt(priv, MLX5E_INDIR_RQT_SIZE, 0, rqtn);
1535+
rqt = &priv->indir_rqt;
1536+
err = mlx5e_create_rqt(priv, MLX5E_INDIR_RQT_SIZE, 0, rqt);
15331537
if (err)
15341538
return err;
15351539

15361540
/* Direct RQTs */
15371541
for (ix = 0; ix < nch; ix++) {
1538-
rqtn = &priv->direct_tir[ix].rqtn;
1539-
err = mlx5e_create_rqt(priv, 1 /*size */, ix, rqtn);
1542+
rqt = &priv->direct_tir[ix].rqt;
1543+
err = mlx5e_create_rqt(priv, 1 /*size */, ix, rqt);
15401544
if (err)
15411545
goto err_destroy_rqts;
15421546
}
@@ -1545,9 +1549,9 @@ static int mlx5e_create_rqts(struct mlx5e_priv *priv)
15451549

15461550
err_destroy_rqts:
15471551
for (ix--; ix >= 0; ix--)
1548-
mlx5e_destroy_rqt(priv, priv->direct_tir[ix].rqtn);
1552+
mlx5e_destroy_rqt(priv, &priv->direct_tir[ix].rqt);
15491553

1550-
mlx5e_destroy_rqt(priv, priv->indir_rqtn);
1554+
mlx5e_destroy_rqt(priv, &priv->indir_rqt);
15511555

15521556
return err;
15531557
}
@@ -1558,9 +1562,9 @@ static void mlx5e_destroy_rqts(struct mlx5e_priv *priv)
15581562
int i;
15591563

15601564
for (i = 0; i < nch; i++)
1561-
mlx5e_destroy_rqt(priv, priv->direct_tir[i].rqtn);
1565+
mlx5e_destroy_rqt(priv, &priv->direct_tir[i].rqt);
15621566

1563-
mlx5e_destroy_rqt(priv, priv->indir_rqtn);
1567+
mlx5e_destroy_rqt(priv, &priv->indir_rqt);
15641568
}
15651569

15661570
int mlx5e_redirect_rqt(struct mlx5e_priv *priv, u32 rqtn, int sz, int ix)
@@ -1598,10 +1602,15 @@ static void mlx5e_redirect_rqts(struct mlx5e_priv *priv)
15981602
u32 rqtn;
15991603
int ix;
16001604

1601-
rqtn = priv->indir_rqtn;
1602-
mlx5e_redirect_rqt(priv, rqtn, MLX5E_INDIR_RQT_SIZE, 0);
1605+
if (priv->indir_rqt.enabled) {
1606+
rqtn = priv->indir_rqt.rqtn;
1607+
mlx5e_redirect_rqt(priv, rqtn, MLX5E_INDIR_RQT_SIZE, 0);
1608+
}
1609+
16031610
for (ix = 0; ix < priv->params.num_channels; ix++) {
1604-
rqtn = priv->direct_tir[ix].rqtn;
1611+
if (!priv->direct_tir[ix].rqt.enabled)
1612+
continue;
1613+
rqtn = priv->direct_tir[ix].rqt.rqtn;
16051614
mlx5e_redirect_rqt(priv, rqtn, 1, ix);
16061615
}
16071616
}
@@ -2012,7 +2021,7 @@ static void mlx5e_build_indir_tir_ctx(struct mlx5e_priv *priv, u32 *tirc,
20122021
mlx5e_build_tir_ctx_lro(tirc, priv);
20132022

20142023
MLX5_SET(tirc, tirc, disp_type, MLX5_TIRC_DISP_TYPE_INDIRECT);
2015-
MLX5_SET(tirc, tirc, indirect_table, priv->indir_rqtn);
2024+
MLX5_SET(tirc, tirc, indirect_table, priv->indir_rqt.rqtn);
20162025
mlx5e_build_tir_ctx_hash(tirc, priv);
20172026

20182027
switch (tt) {
@@ -2144,7 +2153,7 @@ static int mlx5e_create_tirs(struct mlx5e_priv *priv)
21442153
tir = &priv->direct_tir[ix];
21452154
tirc = MLX5_ADDR_OF(create_tir_in, in, ctx);
21462155
mlx5e_build_direct_tir_ctx(priv, tirc,
2147-
priv->direct_tir[ix].rqtn);
2156+
priv->direct_tir[ix].rqt.rqtn);
21482157
err = mlx5e_create_tir(priv->mdev, tir, in, inlen);
21492158
if (err)
21502159
goto err_destroy_ch_tirs;

0 commit comments

Comments
 (0)