Skip to content

Commit f342db1

Browse files
Subbaraya Sundeepsmb49
authored andcommitted
octeontx2-pf: mcs: Do not reset PN while updating secy
BugLink: https://bugs.launchpad.net/bugs/2028580 [ Upstream commit 3c99bac ] After creating SecYs, SCs and SAs a SecY can be modified to change attributes like validation mode, protect frames mode etc. During this SecY update, packet number is reset to initial user given value by mistake. Hence do not reset PN when updating SecY parameters. Fixes: c54ffc7 ("octeontx2-pf: mcs: Introduce MACSEC hardware offloading") Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com> Signed-off-by: Sunil Goutham <sgoutham@marvell.com> Signed-off-by: Geetha sowjanya <gakula@marvell.com> Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent 97963e0 commit f342db1

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,22 +1134,27 @@ static int cn10k_mdo_upd_secy(struct macsec_context *ctx)
11341134
struct macsec_secy *secy = ctx->secy;
11351135
struct macsec_tx_sa *sw_tx_sa;
11361136
struct cn10k_mcs_txsc *txsc;
1137+
bool active;
11371138
u8 sa_num;
11381139
int err;
11391140

11401141
txsc = cn10k_mcs_get_txsc(cfg, secy);
11411142
if (!txsc)
11421143
return -ENOENT;
11431144

1144-
txsc->encoding_sa = secy->tx_sc.encoding_sa;
1145-
1146-
sa_num = txsc->encoding_sa;
1147-
sw_tx_sa = rcu_dereference_bh(secy->tx_sc.sa[sa_num]);
1145+
/* Encoding SA got changed */
1146+
if (txsc->encoding_sa != secy->tx_sc.encoding_sa) {
1147+
txsc->encoding_sa = secy->tx_sc.encoding_sa;
1148+
sa_num = txsc->encoding_sa;
1149+
sw_tx_sa = rcu_dereference_bh(secy->tx_sc.sa[sa_num]);
1150+
active = sw_tx_sa ? sw_tx_sa->active : false;
1151+
cn10k_mcs_link_tx_sa2sc(pfvf, secy, txsc, sa_num, active);
1152+
}
11481153

11491154
if (netif_running(secy->netdev)) {
11501155
cn10k_mcs_sync_stats(pfvf, secy, txsc);
11511156

1152-
err = cn10k_mcs_secy_tx_cfg(pfvf, secy, txsc, sw_tx_sa, sa_num);
1157+
err = cn10k_mcs_secy_tx_cfg(pfvf, secy, txsc, NULL, 0);
11531158
if (err)
11541159
return err;
11551160
}

0 commit comments

Comments
 (0)