[PATCH net v7 2/2] octeontx2-af: mcs: Fix SC resource cleanup loop
From: Subrat Pandey
Date: Tue Sep 22 2026 - 06:25:21 EST
From: Baha Mesleh <baha.mesleh@xxxxxxxxx>
The SC resource cleanup and statistics loops were incorrectly
iterating over secy.max instead of sc.max, so the highest SC id
could be left allocated across teardown or FLR. Use sc.max as
the loop bound.
Fixes: cfc14181d497 ("octeontx2-af: cn10k: mcs: Manage the MCS block hardware resources")
Signed-off-by: Baha Mesleh <baha.mesleh@xxxxxxxxx>
Signed-off-by: Subrat Pandey <subratp@xxxxxxxxxxx>
---
v7:
- v6: https://lore.kernel.org/all/20260910062657.3712256-3-subratp@xxxxxxxxxxx/
- Reword commit message.
v4:
- Correct the Fixes: tag commit subject to match the actual upstream
commit title.
v3:
- Extend the sc.max fix to the SC stats loop in mcs_clear_all_stats()
(v2 fixed only mcs_free_all_rsrc()).
- Add Fixes: tag and reword commit message.
drivers/net/ethernet/marvell/octeontx2/af/mcs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mcs.c b/drivers/net/ethernet/marvell/octeontx2/af/mcs.c
index 211c10aa5880..30c672d526a0 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/mcs.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/mcs.c
@@ -314,7 +314,7 @@ int mcs_clear_all_stats(struct mcs *mcs, u16 pcifunc, int dir)
}
/* Clear SC stats */
- for (id = 0; id < map->secy.max; id++) {
+ for (id = 0; id < map->sc.max; id++) {
if (map->sc2pf_map[id] != pcifunc)
continue;
mcs_clear_stats(mcs, MCS_SC_STATS, id, dir);
@@ -738,7 +738,7 @@ int mcs_free_all_rsrc(struct mcs *mcs, int dir, u16 pcifunc)
}
/* free sc entries */
- for (id = 0; id < map->secy.max; id++) {
+ for (id = 0; id < map->sc.max; id++) {
if (map->sc2pf_map[id] != pcifunc)
continue;
mcs_free_rsrc(&map->sc, map->sc2pf_map, id, pcifunc);
--
2.43.0