summaryrefslogtreecommitdiff
path: root/include/linux/misc
diff options
context:
space:
mode:
authorRatheesh Kannoth <rkannoth@marvell.com>2026-04-29 05:27:15 +0300
committerJakub Kicinski <kuba@kernel.org>2026-05-01 04:50:16 +0300
commitadb5ff41efbc0a9d86fabf880076973379db6e49 (patch)
tree39f057a9ade630011fb8f1224dbff5157cce1253 /include/linux/misc
parent1100af13fd14b523f1b0634c14be497b41c78958 (diff)
downloadlinux-adb5ff41efbc0a9d86fabf880076973379db6e49.tar.xz
octeontx2-af: npc: cn20k: Propagate errors in defrag MCAM alloc rollback
npc_defrag_alloc_free_slots() allocates MCAM indexes in up to two passes on bank0 then bank1. On failure it rolls back by freeing entries already placed in save[]. __npc_subbank_alloc() can return a negative errno while only part of the indexes are valid. The rollback loop used rc for npc_mcam_idx_2_subbank_idx() as well, so a successful lookup stored zero in rc and a later __npc_subbank_free() failure could still end with return 0 when the allocation path had also left rc at zero (for example shortfall after zero return values from the alloc helpers). Jump to the rollback path immediately when either __npc_subbank_alloc() call fails, preserving its errno. If both calls succeed but the total allocated count is still less than cnt, set rc to -ENOSPC before rollback. Use a separate err variable for npc_mcam_idx_2_subbank_idx() so a successful lookup no longer clears a non-zero rc from the allocation phase. Cc: Dan Carpenter <error27@gmail.com> Fixes: 645c6e3c1999 ("octeontx2-af: npc: cn20k: virtual index support") Link: https://lore.kernel.org/netdev/adjNJEpILRZATB2N@stanley.mountain/ Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com> Link: https://patch.msgid.link/20260429022722.1110289-4-rkannoth@marvell.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/linux/misc')
0 files changed, 0 insertions, 0 deletions