Skip to content

Commit 97963e0

Browse files
Subbaraya Sundeepsmb49
authored andcommitted
octeontx2-pf: mcs: Fix shared counters logic
BugLink: https://bugs.launchpad.net/bugs/2028580 [ Upstream commit 9bdfe61 ] Macsec stats like InPktsLate and InPktsDelayed share same counter in hardware. If SecY replay_protect is true then counter represents InPktsLate otherwise InPktsDelayed. This mode change was tracked based on protect_frames instead of replay_protect mistakenly. Similarly InPktsUnchecked and InPktsOk share same counter and mode change was tracked based on validate_check instead of validate_disabled. This patch fixes those problems. 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 76377a0 commit 97963e0

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ static void cn10k_mcs_sync_stats(struct otx2_nic *pfvf, struct macsec_secy *secy
10141014

10151015
/* Check if sync is really needed */
10161016
if (secy->validate_frames == txsc->last_validate_frames &&
1017-
secy->protect_frames == txsc->last_protect_frames)
1017+
secy->replay_protect == txsc->last_replay_protect)
10181018
return;
10191019

10201020
cn10k_mcs_secy_stats(pfvf, txsc->hw_secy_id_rx, &rx_rsp, MCS_RX, true);
@@ -1036,19 +1036,19 @@ static void cn10k_mcs_sync_stats(struct otx2_nic *pfvf, struct macsec_secy *secy
10361036
rxsc->stats.InPktsInvalid += sc_rsp.pkt_invalid_cnt;
10371037
rxsc->stats.InPktsNotValid += sc_rsp.pkt_notvalid_cnt;
10381038

1039-
if (txsc->last_protect_frames)
1039+
if (txsc->last_replay_protect)
10401040
rxsc->stats.InPktsLate += sc_rsp.pkt_late_cnt;
10411041
else
10421042
rxsc->stats.InPktsDelayed += sc_rsp.pkt_late_cnt;
10431043

1044-
if (txsc->last_validate_frames == MACSEC_VALIDATE_CHECK)
1044+
if (txsc->last_validate_frames == MACSEC_VALIDATE_DISABLED)
10451045
rxsc->stats.InPktsUnchecked += sc_rsp.pkt_unchecked_cnt;
10461046
else
10471047
rxsc->stats.InPktsOK += sc_rsp.pkt_unchecked_cnt;
10481048
}
10491049

10501050
txsc->last_validate_frames = secy->validate_frames;
1051-
txsc->last_protect_frames = secy->protect_frames;
1051+
txsc->last_replay_protect = secy->replay_protect;
10521052
}
10531053

10541054
static int cn10k_mdo_open(struct macsec_context *ctx)
@@ -1117,7 +1117,7 @@ static int cn10k_mdo_add_secy(struct macsec_context *ctx)
11171117
txsc->sw_secy = secy;
11181118
txsc->encoding_sa = secy->tx_sc.encoding_sa;
11191119
txsc->last_validate_frames = secy->validate_frames;
1120-
txsc->last_protect_frames = secy->protect_frames;
1120+
txsc->last_replay_protect = secy->replay_protect;
11211121

11221122
list_add(&txsc->entry, &cfg->txsc_list);
11231123

@@ -1538,12 +1538,12 @@ static int cn10k_mdo_get_rx_sc_stats(struct macsec_context *ctx)
15381538
rxsc->stats.InPktsInvalid += rsp.pkt_invalid_cnt;
15391539
rxsc->stats.InPktsNotValid += rsp.pkt_notvalid_cnt;
15401540

1541-
if (secy->protect_frames)
1541+
if (secy->replay_protect)
15421542
rxsc->stats.InPktsLate += rsp.pkt_late_cnt;
15431543
else
15441544
rxsc->stats.InPktsDelayed += rsp.pkt_late_cnt;
15451545

1546-
if (secy->validate_frames == MACSEC_VALIDATE_CHECK)
1546+
if (secy->validate_frames == MACSEC_VALIDATE_DISABLED)
15471547
rxsc->stats.InPktsUnchecked += rsp.pkt_unchecked_cnt;
15481548
else
15491549
rxsc->stats.InPktsOK += rsp.pkt_unchecked_cnt;

drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ struct cn10k_mcs_txsc {
389389
struct cn10k_txsc_stats stats;
390390
struct list_head entry;
391391
enum macsec_validation_type last_validate_frames;
392-
bool last_protect_frames;
392+
bool last_replay_protect;
393393
u16 hw_secy_id_tx;
394394
u16 hw_secy_id_rx;
395395
u16 hw_flow_id;

0 commit comments

Comments
 (0)