Skip to content

Commit bfbdd77

Browse files
ayalevinSaeed Mahameed
authored andcommitted
net/mlx5e: E-Switch, Add support for tx_port_ts in switchdev mode
When turning on tx_port_ts (private flag) a PTP-SQ is created. Consider this queue when adding rules matching SQs to VPORTs. Otherwise the traffic on this queue won't reach the wire. Signed-off-by: Aya Levin <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Reviewed-by: Maor Dickman <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 7c5f940 commit bfbdd77

File tree

1 file changed

+15
-3
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+15
-3
lines changed

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
#include "diag/en_rep_tracepoint.h"
5656
#include "en_accel/ipsec.h"
5757
#include "en/tc/int_port.h"
58+
#include "en/ptp.h"
5859

5960
#define MLX5E_REP_PARAMS_DEF_LOG_SQ_SIZE \
6061
max(0x7, MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE)
@@ -401,13 +402,18 @@ int mlx5e_add_sqs_fwd_rules(struct mlx5e_priv *priv)
401402
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
402403
struct mlx5e_rep_priv *rpriv = priv->ppriv;
403404
struct mlx5_eswitch_rep *rep = rpriv->rep;
405+
int n, tc, nch, num_sqs = 0;
404406
struct mlx5e_channel *c;
405-
int n, tc, num_sqs = 0;
406407
int err = -ENOMEM;
408+
bool ptp_sq;
407409
u32 *sqs;
408410

409-
sqs = kcalloc(priv->channels.num * mlx5e_get_dcb_num_tc(&priv->channels.params),
410-
sizeof(*sqs), GFP_KERNEL);
411+
ptp_sq = !!(priv->channels.ptp &&
412+
MLX5E_GET_PFLAG(&priv->channels.params, MLX5E_PFLAG_TX_PORT_TS));
413+
nch = priv->channels.num + ptp_sq;
414+
415+
sqs = kcalloc(nch * mlx5e_get_dcb_num_tc(&priv->channels.params), sizeof(*sqs),
416+
GFP_KERNEL);
411417
if (!sqs)
412418
goto out;
413419

@@ -416,6 +422,12 @@ int mlx5e_add_sqs_fwd_rules(struct mlx5e_priv *priv)
416422
for (tc = 0; tc < c->num_tc; tc++)
417423
sqs[num_sqs++] = c->sq[tc].sqn;
418424
}
425+
if (ptp_sq) {
426+
struct mlx5e_ptp *ptp_ch = priv->channels.ptp;
427+
428+
for (tc = 0; tc < ptp_ch->num_tc; tc++)
429+
sqs[num_sqs++] = ptp_ch->ptpsq[tc].txqsq.sqn;
430+
}
419431

420432
err = mlx5e_sqs2vport_start(esw, rep, sqs, num_sqs);
421433
kfree(sqs);

0 commit comments

Comments
 (0)