Skip to content

Commit f5e1ed0

Browse files
Emeel HakimSaeed Mahameed
authored andcommitted
net/mlx5e: Fix macsec ssci attribute handling in offload path
Currently when macsec offload is set with extended packet number (epn) enabled, the driver wrongly deduce the short secure channel identifier (ssci) from the salt instead of the stand alone ssci attribute as it should, consequently creating a mismatch between the kernel and driver's ssci values. Fix by using the ssci value from the relevant attribute. Fixes: 4411a6c ("net/mlx5e: Support MACsec offload extended packet number (EPN)") Signed-off-by: Emeel Hakim <[email protected]> Reviewed-by: Raed Salem <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent cd4f186 commit f5e1ed0

File tree

1 file changed

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

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ struct mlx5e_macsec_sa {
6262
u32 enc_key_id;
6363
u32 next_pn;
6464
sci_t sci;
65+
ssci_t ssci;
6566
salt_t salt;
6667

6768
struct rhash_head hash;
@@ -499,10 +500,11 @@ mlx5e_macsec_get_macsec_device_context(const struct mlx5e_macsec *macsec,
499500
}
500501

501502
static void update_macsec_epn(struct mlx5e_macsec_sa *sa, const struct macsec_key *key,
502-
const pn_t *next_pn_halves)
503+
const pn_t *next_pn_halves, ssci_t ssci)
503504
{
504505
struct mlx5e_macsec_epn_state *epn_state = &sa->epn_state;
505506

507+
sa->ssci = ssci;
506508
sa->salt = key->salt;
507509
epn_state->epn_enabled = 1;
508510
epn_state->epn_msb = next_pn_halves->upper;
@@ -550,7 +552,8 @@ static int mlx5e_macsec_add_txsa(struct macsec_context *ctx)
550552
tx_sa->assoc_num = assoc_num;
551553

552554
if (secy->xpn)
553-
update_macsec_epn(tx_sa, &ctx_tx_sa->key, &ctx_tx_sa->next_pn_halves);
555+
update_macsec_epn(tx_sa, &ctx_tx_sa->key, &ctx_tx_sa->next_pn_halves,
556+
ctx_tx_sa->ssci);
554557

555558
err = mlx5_create_encryption_key(mdev, ctx->sa.key, secy->key_len,
556559
MLX5_ACCEL_OBJ_MACSEC_KEY,
@@ -945,7 +948,8 @@ static int mlx5e_macsec_add_rxsa(struct macsec_context *ctx)
945948
rx_sa->fs_id = rx_sc->sc_xarray_element->fs_id;
946949

947950
if (ctx->secy->xpn)
948-
update_macsec_epn(rx_sa, &ctx_rx_sa->key, &ctx_rx_sa->next_pn_halves);
951+
update_macsec_epn(rx_sa, &ctx_rx_sa->key, &ctx_rx_sa->next_pn_halves,
952+
ctx_rx_sa->ssci);
949953

950954
err = mlx5_create_encryption_key(mdev, ctx->sa.key, ctx->secy->key_len,
951955
MLX5_ACCEL_OBJ_MACSEC_KEY,

0 commit comments

Comments
 (0)