Skip to content

Commit 8c62544

Browse files
dtatuleakuba-moo
authored andcommitted
net/mlx5e: macsec: Maintain TX SA from encoding_sa
In MACsec, it is possible to create multiple active TX SAs on a SC, but only one such SA can be used at a time for transmission. This SA is selected through the encoding_sa link parameter. When there are 2 or more active TX SAs configured (encoding_sa=0): ip macsec add macsec0 tx sa 0 pn 1 on key 00 <KEY1> ip macsec add macsec0 tx sa 1 pn 1 on key 00 <KEY2> ... the traffic should be still sent via TX SA 0 as the encoding_sa was not changed. However, the driver ignores the encoding_sa and overrides it to SA 1 by installing the flow steering id of the newly created TX SA into the SCI -> flow steering id hash map. The future packet tx descriptors will point to the incorrect flow steering rule (SA 1). This patch fixes the issue by avoiding the creation of the flow steering rule for an active TX SA that is not the encoding_sa. The driver side tx_sa object and the FW side macsec object are still created. When the encoding_sa link parameter is changed to another active TX SA, only the new flow steering rule will be created in the mlx5e_macsec_upd_txsa() handler. Fixes: 8ff0ac5 ("net/mlx5: Add MACsec offload Tx command support") Signed-off-by: Dragos Tatulea <[email protected]> Reviewed-by: Cosmin Ratiu <[email protected]> Reviewed-by: Lior Nahmanson <[email protected]> Signed-off-by: Tariq Toukan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 050a4c0 commit 8c62544

File tree

1 file changed

+4
-0
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/en_accel

1 file changed

+4
-0
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,13 @@ static int mlx5e_macsec_init_sa_fs(struct macsec_context *ctx,
339339
{
340340
struct mlx5e_priv *priv = macsec_netdev_priv(ctx->netdev);
341341
struct mlx5_macsec_fs *macsec_fs = priv->mdev->macsec_fs;
342+
const struct macsec_tx_sc *tx_sc = &ctx->secy->tx_sc;
342343
struct mlx5_macsec_rule_attrs rule_attrs;
343344
union mlx5_macsec_rule *macsec_rule;
344345

346+
if (is_tx && tx_sc->encoding_sa != sa->assoc_num)
347+
return 0;
348+
345349
rule_attrs.macsec_obj_id = sa->macsec_obj_id;
346350
rule_attrs.sci = sa->sci;
347351
rule_attrs.assoc_num = sa->assoc_num;

0 commit comments

Comments
 (0)