[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200323131348.340-18-irusskikh@marvell.com>
Date: Mon, 23 Mar 2020 16:13:48 +0300
From: Igor Russkikh <irusskikh@...vell.com>
To: <netdev@...r.kernel.org>
CC: Mark Starovoytov <mstarovoitov@...vell.com>,
Sabrina Dubroca <sd@...asysnail.net>,
Antoine Tenart <antoine.tenart@...tlin.com>,
"Igor Russkikh" <irusskikh@...vell.com>
Subject: [PATCH net-next 17/17] net: atlantic: add XPN handling
From: Mark Starovoytov <mstarovoitov@...vell.com>
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 <mstarovoitov@...vell.com>
Signed-off-by: Igor Russkikh <irusskikh@...vell.com>
---
drivers/net/ethernet/aquantia/atlantic/aq_macsec.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c b/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c
index dc1da79b8b26..bc23b8bf4a72 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c
@@ -461,6 +461,9 @@ static int aq_mdo_add_secy(struct macsec_context *ctx)
u32 txsc_idx;
int ret = 0;
+ if (secy->xpn)
+ return -EOPNOTSUPP;
+
sc_sa = sc_sa_from_num_an(MACSEC_NUM_AN);
if (sc_sa == aq_macsec_sa_sc_not_used)
return -EINVAL;
@@ -567,6 +570,7 @@ static int aq_update_txsa(struct aq_nic_s *nic, const unsigned int sc_idx,
const struct macsec_tx_sa *tx_sa,
const unsigned char *key, const unsigned char an)
{
+ const u32 next_pn = tx_sa->next_pn_halves.lower;
struct aq_mss_egress_sakey_record key_rec;
const unsigned int sa_idx = sc_idx | an;
struct aq_mss_egress_sa_record sa_rec;
@@ -574,12 +578,12 @@ static int aq_update_txsa(struct aq_nic_s *nic, const unsigned int sc_idx,
int ret = 0;
netdev_dbg(nic->ndev, "set tx_sa %d: active=%d, next_pn=%d\n", an,
- tx_sa->active, tx_sa->next_pn);
+ tx_sa->active, next_pn);
memset(&sa_rec, 0, sizeof(sa_rec));
sa_rec.valid = tx_sa->active;
sa_rec.fresh = 1;
- sa_rec.next_pn = tx_sa->next_pn;
+ sa_rec.next_pn = next_pn;
ret = aq_mss_set_egress_sa_record(hw, &sa_rec, sa_idx);
if (ret) {
@@ -941,18 +945,19 @@ static int aq_update_rxsa(struct aq_nic_s *nic, const unsigned int sc_idx,
const unsigned char *key, const unsigned char an)
{
struct aq_mss_ingress_sakey_record sa_key_record;
+ const u32 next_pn = rx_sa->next_pn_halves.lower;
struct aq_mss_ingress_sa_record sa_record;
struct aq_hw_s *hw = nic->aq_hw;
const int sa_idx = sc_idx | an;
int ret = 0;
netdev_dbg(nic->ndev, "set rx_sa %d: active=%d, next_pn=%d\n", an,
- rx_sa->active, rx_sa->next_pn);
+ rx_sa->active, next_pn);
memset(&sa_record, 0, sizeof(sa_record));
sa_record.valid = rx_sa->active;
sa_record.fresh = 1;
- sa_record.next_pn = rx_sa->next_pn;
+ sa_record.next_pn = next_pn;
ret = aq_mss_set_ingress_sa_record(hw, &sa_record, sa_idx);
if (ret) {
--
2.17.1
Powered by blists - more mailing lists