@@ -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 ;
@@ -358,7 +359,6 @@ static int mlx5e_macsec_init_sa(struct macsec_context *ctx,
358359 struct mlx5_core_dev * mdev = priv -> mdev ;
359360 struct mlx5_macsec_obj_attrs obj_attrs ;
360361 union mlx5e_macsec_rule * macsec_rule ;
361- struct macsec_key * key ;
362362 int err ;
363363
364364 obj_attrs .next_pn = sa -> next_pn ;
@@ -368,13 +368,9 @@ static int mlx5e_macsec_init_sa(struct macsec_context *ctx,
368368 obj_attrs .aso_pdn = macsec -> aso .pdn ;
369369 obj_attrs .epn_state = sa -> epn_state ;
370370
371- key = (is_tx ) ? & ctx -> sa .tx_sa -> key : & ctx -> sa .rx_sa -> key ;
372-
373371 if (sa -> epn_state .epn_enabled ) {
374- obj_attrs .ssci = (is_tx ) ? cpu_to_be32 ((__force u32 )ctx -> sa .tx_sa -> ssci ) :
375- cpu_to_be32 ((__force u32 )ctx -> sa .rx_sa -> ssci );
376-
377- memcpy (& obj_attrs .salt , & key -> salt , sizeof (key -> salt ));
372+ obj_attrs .ssci = cpu_to_be32 ((__force u32 )sa -> ssci );
373+ memcpy (& obj_attrs .salt , & sa -> salt , sizeof (sa -> salt ));
378374 }
379375
380376 obj_attrs .replay_window = ctx -> secy -> replay_window ;
@@ -499,10 +495,11 @@ mlx5e_macsec_get_macsec_device_context(const struct mlx5e_macsec *macsec,
499495}
500496
501497static void update_macsec_epn (struct mlx5e_macsec_sa * sa , const struct macsec_key * key ,
502- const pn_t * next_pn_halves )
498+ const pn_t * next_pn_halves , ssci_t ssci )
503499{
504500 struct mlx5e_macsec_epn_state * epn_state = & sa -> epn_state ;
505501
502+ sa -> ssci = ssci ;
506503 sa -> salt = key -> salt ;
507504 epn_state -> epn_enabled = 1 ;
508505 epn_state -> epn_msb = next_pn_halves -> upper ;
@@ -550,7 +547,8 @@ static int mlx5e_macsec_add_txsa(struct macsec_context *ctx)
550547 tx_sa -> assoc_num = assoc_num ;
551548
552549 if (secy -> xpn )
553- update_macsec_epn (tx_sa , & ctx_tx_sa -> key , & ctx_tx_sa -> next_pn_halves );
550+ update_macsec_epn (tx_sa , & ctx_tx_sa -> key , & ctx_tx_sa -> next_pn_halves ,
551+ ctx_tx_sa -> ssci );
554552
555553 err = mlx5_create_encryption_key (mdev , ctx -> sa .key , secy -> key_len ,
556554 MLX5_ACCEL_OBJ_MACSEC_KEY ,
@@ -945,7 +943,8 @@ static int mlx5e_macsec_add_rxsa(struct macsec_context *ctx)
945943 rx_sa -> fs_id = rx_sc -> sc_xarray_element -> fs_id ;
946944
947945 if (ctx -> secy -> xpn )
948- update_macsec_epn (rx_sa , & ctx_rx_sa -> key , & ctx_rx_sa -> next_pn_halves );
946+ update_macsec_epn (rx_sa , & ctx_rx_sa -> key , & ctx_rx_sa -> next_pn_halves ,
947+ ctx_rx_sa -> ssci );
949948
950949 err = mlx5_create_encryption_key (mdev , ctx -> sa .key , ctx -> secy -> key_len ,
951950 MLX5_ACCEL_OBJ_MACSEC_KEY ,
0 commit comments