Skip to contentSkip to conversation

octeontx2-af: mcs: Fix unsupported secy stats read

PATCH Applied Subbaraya Sundeep 2 participants 6 messages Jun 16 – Jun 21

Subsystems (4)
lore
Share & tools
lore

Subbaraya Sundeep

author maintainer
#0 lore raw

PATCH v2 1/1 octeontx2-af: mcs: Fix unsupported secy stats read

From: Geetha sowjanya <[email protected]>

Secy control stats counter doesn't exist for CNF10KB platform. Skip reading this respective register for CNF10KB silicon while fetching secy stats.

Fixes 9312150af8da ("octeontx2-af: cn10k: mcs: Support for stats collection")

---
v2 changes:
Fixed AI review by modifying debugfs also NOT to access Secy control stats counter

 drivers/net/ethernet/marvell/octeontx2/af/mcs.c         | 6 +++---
 drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c | 3 ++-
 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/mcs.c +3 -3
index c1775bd01c2b..a07e0b3d8d00 100644
@@ -120,13 +120,13 @@ void mcs_get_rx_secy_stats(struct mcs *mcs, struct mcs_secy_stats *stats, int id
 	reg = MCSX_CSE_RX_MEM_SLAVE_INPKTSSECYUNTAGGEDX(id);
 	stats->pkt_untaged_cnt = mcs_reg_read(mcs, reg);
 
-	reg = MCSX_CSE_RX_MEM_SLAVE_INPKTSSECYCTLX(id);
-	stats->pkt_ctl_cnt = mcs_reg_read(mcs, reg);
-
 	if (mcs->hw->mcs_blks > 1) {
 		reg = MCSX_CSE_RX_MEM_SLAVE_INPKTSSECYNOTAGX(id);
 		stats->pkt_notag_cnt = mcs_reg_read(mcs, reg);
+		return;
 	}
+	reg = MCSX_CSE_RX_MEM_SLAVE_INPKTSSECYCTLX(id);
+	stats->pkt_ctl_cnt = mcs_reg_read(mcs, reg);
 }
 
 void mcs_get_flowid_stats(struct mcs *mcs, struct mcs_flowid_stats *stats,
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c +2 -1
index fa461489acdd..ca2704b188a5 100644
@@ -482,10 +482,11 @@ static int rvu_dbg_mcs_rx_secy_stats_display(struct seq_file *filp, void *unused
 		seq_printf(filp, "secy%d: Tagged ctrl pkts: %lld\n", secy_id,
 			   stats.pkt_tagged_ctl_cnt);
 		seq_printf(filp, "secy%d: Untaged pkts: %lld\n", secy_id, stats.pkt_untaged_cnt);
-		seq_printf(filp, "secy%d: Ctrl pkts: %lld\n", secy_id, stats.pkt_ctl_cnt);
 		if (mcs->hw->mcs_blks > 1)
 			seq_printf(filp, "secy%d: pkts notag: %lld\n", secy_id,
 				   stats.pkt_notag_cnt);
+		else
+			seq_printf(filp, "secy%d: Ctrl pkts: %lld\n", secy_id, stats.pkt_ctl_cnt);
 	}
 	mutex_unlock(&mcs->stats_lock);
 	return 0;
Signature · 1 line
2.48.1
author maintainer
#1 lore raw

PATCH v2 1/1 octeontx2-pf: mcs: Fix mcs resources free on PF shutdown

From: Geetha sowjanya <[email protected]>

On PF shutdown, the current driver free mcs hardware resources though mcs resources are not allocated to it. This patch checks the mcs resources status and if resources are allocated then only sends mailbox message to free them.

Fixes c54ffc73601c ("octeontx2-pf: mcs: Introduce MACSEC hardware offloading")

---
v2 changes:
Fixed AI review so that pfvf->macsec_cfg is freed correctly

 .../net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c    | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c +7 -2
index 2cc1bdfd9b2e..4d3a7f4be962 100644
@@ -1776,11 +1776,16 @@ int cn10k_mcs_init(struct otx2_nic *pfvf)
 
 void cn10k_mcs_free(struct otx2_nic *pfvf)
 {
+	struct cn10k_mcs_cfg *cfg = pfvf->macsec_cfg;
+
 	if (!test_bit(CN10K_HW_MACSEC, &pfvf->hw.cap_flag))
 		return;
 
-	cn10k_mcs_free_rsrc(pfvf, MCS_TX, MCS_RSRC_TYPE_SECY, 0, true);
-	cn10k_mcs_free_rsrc(pfvf, MCS_RX, MCS_RSRC_TYPE_SECY, 0, true);
+	if (!list_empty(&cfg->txsc_list)) {
+		cn10k_mcs_free_rsrc(pfvf, MCS_TX, MCS_RSRC_TYPE_SECY, 0, true);
+		cn10k_mcs_free_rsrc(pfvf, MCS_RX, MCS_RSRC_TYPE_SECY, 0, true);
+	}
+
 	kfree(pfvf->macsec_cfg);
 	pfvf->macsec_cfg = NULL;
 }
Signature · 1 line
2.48.1
#2 lore raw

Re: [net PATCH v2] octeontx2-pf: mcs: Fix mcs resources free on PF shutdown

This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Wed, 17 Jun 2026 00:30:20 +0530 you wrote:

From: Geetha sowjanya <[email protected]>

On PF shutdown, the current driver free mcs hardware resources though mcs resources are not allocated to it. This patch checks the mcs resources status and if resources are allocated then only sends mailbox message to free them.

[...]

Here is the summary with links:
- [net,v2] octeontx2-pf: mcs: Fix mcs resources free on PF shutdown

    https://git.kernel.org/netdev/net/c/450d0e90b103

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
author maintainer
#3 lore raw

PATCH 1/1 octeontx2-pf: Clear stats of all resources when freeing resources

In reply to Subbaraya Sundeep

When all MCS resources mapped to a PF are being freed then clear stats of all those resources too.

Fixes 815debbbf7b5 ("octeontx2-pf: mcs: Clear stats before freeing resource")
---
 drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c +1 -0
index 4d3a7f4be962..9524d38f1582 100644
@@ -182,6 +182,7 @@ static void cn10k_mcs_free_rsrc(struct otx2_nic *pfvf, enum mcs_direction dir,
 	clear_req->id = hw_rsrc_id;
 	clear_req->type = type;
 	clear_req->dir = dir;
+	clear_req->all = all;
 
 	req = otx2_mbox_alloc_msg_mcs_free_resources(mbox);
 	if (!req)
Signature · 1 line
2.48.1
#4 lore raw

Re: [PATCH] octeontx2-pf: Clear stats of all resources when freeing resources

This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Wed, 17 Jun 2026 00:30:19 +0530 you wrote:

When all MCS resources mapped to a PF are being freed then clear stats of all those resources too.

Fixes 815debbbf7b5 ("octeontx2-pf: mcs: Clear stats before freeing resource")
---
 drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c | 1 +
 1 file changed, 1 insertion(+)

Here is the summary with links:
- octeontx2-pf: Clear stats of all resources when freeing resources

    https://git.kernel.org/netdev/net/c/fd4460721fb4

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#5 lore raw
In reply to Subbaraya Sundeep
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 11 lines · On Wed, 17 Jun 2026 00:30:18 +0530 you wrote:

From: Geetha sowjanya <[email protected]>

Secy control stats counter doesn't exist for CNF10KB platform. Skip reading this respective register for CNF10KB silicon while fetching secy stats.

Fixes 9312150af8da ("octeontx2-af: cn10k: mcs: Support for stats collection")

[...]

Here is the summary with links:
- [net,v2] octeontx2-af: mcs: Fix unsupported secy stats read

    https://git.kernel.org/netdev/net/c/d4b7440f7316

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html