Skip to content

Commit e8e9e13

Browse files
mstarovodavem330
authored andcommitted
net: atlantic: add XPN handling
This patch adds XPN handling. Our driver doesn't support XPN, but we should still update a couple of places in the code, because the size of 'next_pn' field has changed. Signed-off-by: Mark Starovoytov <[email protected]> Signed-off-by: Igor Russkikh <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent aec0f1a commit e8e9e13

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/net/ethernet/aquantia/atlantic/aq_macsec.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,9 @@ static int aq_mdo_add_secy(struct macsec_context *ctx)
452452
u32 txsc_idx;
453453
int ret = 0;
454454

455+
if (secy->xpn)
456+
return -EOPNOTSUPP;
457+
455458
sc_sa = sc_sa_from_num_an(MACSEC_NUM_AN);
456459
if (sc_sa == aq_macsec_sa_sc_not_used)
457460
return -EINVAL;
@@ -556,6 +559,7 @@ static int aq_update_txsa(struct aq_nic_s *nic, const unsigned int sc_idx,
556559
const struct macsec_tx_sa *tx_sa,
557560
const unsigned char *key, const unsigned char an)
558561
{
562+
const u32 next_pn = tx_sa->next_pn_halves.lower;
559563
struct aq_mss_egress_sakey_record key_rec;
560564
const unsigned int sa_idx = sc_idx | an;
561565
struct aq_mss_egress_sa_record sa_rec;
@@ -565,7 +569,7 @@ static int aq_update_txsa(struct aq_nic_s *nic, const unsigned int sc_idx,
565569
memset(&sa_rec, 0, sizeof(sa_rec));
566570
sa_rec.valid = tx_sa->active;
567571
sa_rec.fresh = 1;
568-
sa_rec.next_pn = tx_sa->next_pn;
572+
sa_rec.next_pn = next_pn;
569573

570574
ret = aq_mss_set_egress_sa_record(hw, &sa_rec, sa_idx);
571575
if (ret)
@@ -889,6 +893,7 @@ static int aq_update_rxsa(struct aq_nic_s *nic, const unsigned int sc_idx,
889893
const unsigned char *key, const unsigned char an)
890894
{
891895
struct aq_mss_ingress_sakey_record sa_key_record;
896+
const u32 next_pn = rx_sa->next_pn_halves.lower;
892897
struct aq_mss_ingress_sa_record sa_record;
893898
struct aq_hw_s *hw = nic->aq_hw;
894899
const int sa_idx = sc_idx | an;
@@ -897,7 +902,7 @@ static int aq_update_rxsa(struct aq_nic_s *nic, const unsigned int sc_idx,
897902
memset(&sa_record, 0, sizeof(sa_record));
898903
sa_record.valid = rx_sa->active;
899904
sa_record.fresh = 1;
900-
sa_record.next_pn = rx_sa->next_pn;
905+
sa_record.next_pn = next_pn;
901906

902907
ret = aq_mss_set_ingress_sa_record(hw, &sa_record, sa_idx);
903908
if (ret)

0 commit comments

Comments
 (0)