Commit 135435f9 authored by Antoine Tenart's avatar Antoine Tenart Committed by Jakub Kicinski

net: atlantic: macsec: make the prepare phase a noop

In preparation for removing the MACsec h/w offloading preparation phase,
make it a no-op in the Atlantic driver.
Signed-off-by: default avatarAntoine Tenart <atenart@kernel.org>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 920d998e
......@@ -452,6 +452,9 @@ static int aq_mdo_add_secy(struct macsec_context *ctx)
u32 txsc_idx;
int ret = 0;
if (ctx->prepare)
return 0;
if (secy->xpn)
return -EOPNOTSUPP;
......@@ -466,9 +469,6 @@ static int aq_mdo_add_secy(struct macsec_context *ctx)
if (txsc_idx == AQ_MACSEC_MAX_SC)
return -ENOSPC;
if (ctx->prepare)
return 0;
cfg->sc_sa = sc_sa;
cfg->aq_txsc[txsc_idx].hw_sc_idx = aq_to_hw_sc_idx(txsc_idx, sc_sa);
cfg->aq_txsc[txsc_idx].sw_secy = secy;
......@@ -488,13 +488,13 @@ static int aq_mdo_upd_secy(struct macsec_context *ctx)
int txsc_idx;
int ret = 0;
if (ctx->prepare)
return 0;
txsc_idx = aq_get_txsc_idx_from_secy(nic->macsec_cfg, secy);
if (txsc_idx < 0)
return -ENOENT;
if (ctx->prepare)
return 0;
if (netif_carrier_ok(nic->ndev) && netif_running(secy->netdev))
ret = aq_set_txsc(nic, txsc_idx);
......@@ -597,13 +597,13 @@ static int aq_mdo_add_txsa(struct macsec_context *ctx)
int txsc_idx;
int ret = 0;
if (ctx->prepare)
return 0;
txsc_idx = aq_get_txsc_idx_from_secy(cfg, secy);
if (txsc_idx < 0)
return -EINVAL;
if (ctx->prepare)
return 0;
aq_txsc = &cfg->aq_txsc[txsc_idx];
set_bit(ctx->sa.assoc_num, &aq_txsc->tx_sa_idx_busy);
......@@ -627,13 +627,13 @@ static int aq_mdo_upd_txsa(struct macsec_context *ctx)
int txsc_idx;
int ret = 0;
if (ctx->prepare)
return 0;
txsc_idx = aq_get_txsc_idx_from_secy(cfg, secy);
if (txsc_idx < 0)
return -EINVAL;
if (ctx->prepare)
return 0;
aq_txsc = &cfg->aq_txsc[txsc_idx];
if (netif_carrier_ok(nic->ndev) && netif_running(secy->netdev))
ret = aq_update_txsa(nic, aq_txsc->hw_sc_idx, secy,
......@@ -677,13 +677,13 @@ static int aq_mdo_del_txsa(struct macsec_context *ctx)
int txsc_idx;
int ret = 0;
if (ctx->prepare)
return 0;
txsc_idx = aq_get_txsc_idx_from_secy(cfg, ctx->secy);
if (txsc_idx < 0)
return -EINVAL;
if (ctx->prepare)
return 0;
ret = aq_clear_txsa(nic, &cfg->aq_txsc[txsc_idx], ctx->sa.assoc_num,
AQ_CLEAR_ALL);
......@@ -773,6 +773,9 @@ static int aq_mdo_add_rxsc(struct macsec_context *ctx)
u32 rxsc_idx;
int ret = 0;
if (ctx->prepare)
return 0;
if (hweight32(cfg->rxsc_idx_busy) >= rxsc_idx_max)
return -ENOSPC;
......@@ -780,9 +783,6 @@ static int aq_mdo_add_rxsc(struct macsec_context *ctx)
if (rxsc_idx >= rxsc_idx_max)
return -ENOSPC;
if (ctx->prepare)
return 0;
cfg->aq_rxsc[rxsc_idx].hw_sc_idx = aq_to_hw_sc_idx(rxsc_idx,
cfg->sc_sa);
cfg->aq_rxsc[rxsc_idx].sw_secy = ctx->secy;
......@@ -805,13 +805,13 @@ static int aq_mdo_upd_rxsc(struct macsec_context *ctx)
int rxsc_idx;
int ret = 0;
if (ctx->prepare)
return 0;
rxsc_idx = aq_get_rxsc_idx_from_rxsc(nic->macsec_cfg, ctx->rx_sc);
if (rxsc_idx < 0)
return -ENOENT;
if (ctx->prepare)
return 0;
if (netif_carrier_ok(nic->ndev) && netif_running(ctx->secy->netdev))
ret = aq_set_rxsc(nic, rxsc_idx);
......@@ -872,13 +872,13 @@ static int aq_mdo_del_rxsc(struct macsec_context *ctx)
int rxsc_idx;
int ret = 0;
if (ctx->prepare)
return 0;
rxsc_idx = aq_get_rxsc_idx_from_rxsc(nic->macsec_cfg, ctx->rx_sc);
if (rxsc_idx < 0)
return -ENOENT;
if (ctx->prepare)
return 0;
if (netif_carrier_ok(nic->ndev))
clear_type = AQ_CLEAR_ALL;
......@@ -944,13 +944,13 @@ static int aq_mdo_add_rxsa(struct macsec_context *ctx)
int rxsc_idx;
int ret = 0;
if (ctx->prepare)
return 0;
rxsc_idx = aq_get_rxsc_idx_from_rxsc(nic->macsec_cfg, rx_sc);
if (rxsc_idx < 0)
return -EINVAL;
if (ctx->prepare)
return 0;
aq_rxsc = &nic->macsec_cfg->aq_rxsc[rxsc_idx];
set_bit(ctx->sa.assoc_num, &aq_rxsc->rx_sa_idx_busy);
......@@ -974,13 +974,13 @@ static int aq_mdo_upd_rxsa(struct macsec_context *ctx)
int rxsc_idx;
int ret = 0;
if (ctx->prepare)
return 0;
rxsc_idx = aq_get_rxsc_idx_from_rxsc(cfg, rx_sc);
if (rxsc_idx < 0)
return -EINVAL;
if (ctx->prepare)
return 0;
if (netif_carrier_ok(nic->ndev) && netif_running(secy->netdev))
ret = aq_update_rxsa(nic, cfg->aq_rxsc[rxsc_idx].hw_sc_idx,
secy, ctx->sa.rx_sa, NULL,
......@@ -1025,13 +1025,13 @@ static int aq_mdo_del_rxsa(struct macsec_context *ctx)
int rxsc_idx;
int ret = 0;
if (ctx->prepare)
return 0;
rxsc_idx = aq_get_rxsc_idx_from_rxsc(cfg, rx_sc);
if (rxsc_idx < 0)
return -EINVAL;
if (ctx->prepare)
return 0;
ret = aq_clear_rxsa(nic, &cfg->aq_rxsc[rxsc_idx], ctx->sa.assoc_num,
AQ_CLEAR_ALL);
......@@ -1069,13 +1069,13 @@ static int aq_mdo_get_tx_sc_stats(struct macsec_context *ctx)
struct aq_macsec_txsc *aq_txsc;
int txsc_idx;
if (ctx->prepare)
return 0;
txsc_idx = aq_get_txsc_idx_from_secy(nic->macsec_cfg, ctx->secy);
if (txsc_idx < 0)
return -ENOENT;
if (ctx->prepare)
return 0;
aq_txsc = &nic->macsec_cfg->aq_txsc[txsc_idx];
stats = &aq_txsc->stats;
aq_get_txsc_stats(hw, aq_txsc->hw_sc_idx, stats);
......@@ -1102,13 +1102,13 @@ static int aq_mdo_get_tx_sa_stats(struct macsec_context *ctx)
u32 next_pn;
int ret;
if (ctx->prepare)
return 0;
txsc_idx = aq_get_txsc_idx_from_secy(cfg, ctx->secy);
if (txsc_idx < 0)
return -EINVAL;
if (ctx->prepare)
return 0;
aq_txsc = &cfg->aq_txsc[txsc_idx];
sa_idx = aq_txsc->hw_sc_idx | ctx->sa.assoc_num;
stats = &aq_txsc->tx_sa_stats[ctx->sa.assoc_num];
......@@ -1143,13 +1143,13 @@ static int aq_mdo_get_rx_sc_stats(struct macsec_context *ctx)
int ret = 0;
int i;
if (ctx->prepare)
return 0;
rxsc_idx = aq_get_rxsc_idx_from_rxsc(cfg, ctx->rx_sc);
if (rxsc_idx < 0)
return -ENOENT;
if (ctx->prepare)
return 0;
aq_rxsc = &cfg->aq_rxsc[rxsc_idx];
for (i = 0; i < MACSEC_NUM_AN; i++) {
if (!test_bit(i, &aq_rxsc->rx_sa_idx_busy))
......@@ -1192,13 +1192,13 @@ static int aq_mdo_get_rx_sa_stats(struct macsec_context *ctx)
u32 next_pn;
int ret;
if (ctx->prepare)
return 0;
rxsc_idx = aq_get_rxsc_idx_from_rxsc(cfg, ctx->rx_sc);
if (rxsc_idx < 0)
return -EINVAL;
if (ctx->prepare)
return 0;
aq_rxsc = &cfg->aq_rxsc[rxsc_idx];
stats = &aq_rxsc->rx_sa_stats[ctx->sa.assoc_num];
sa_idx = aq_rxsc->hw_sc_idx | ctx->sa.assoc_num;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment