Skip to content

Commit df42c7c

Browse files
Subbaraya SundeepSasha Levin
authored andcommitted
octeontx2-af: Always allocate PF entries from low prioriy zone
[ Upstream commit 8b0f741 ] PF mcam entries has to be at low priority always so that VF can install longest prefix match rules at higher priority. This was taken care currently but when priority allocation wrt reference entry is requested then entries are allocated from mid-zone instead of low priority zone. Fix this and always allocate entries from low priority zone for PFs. Fixes: 7df5b4b ("octeontx2-af: Allocate low priority entries for PF") Signed-off-by: Subbaraya Sundeep <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent f3e9f59 commit df42c7c

File tree

1 file changed

+22
-11
lines changed
  • drivers/net/ethernet/marvell/octeontx2/af

1 file changed

+22
-11
lines changed

drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2506,7 +2506,17 @@ static int npc_mcam_alloc_entries(struct npc_mcam *mcam, u16 pcifunc,
25062506
* - when available free entries are less.
25072507
* Lower priority ones out of avaialble free entries are always
25082508
* chosen when 'high vs low' question arises.
2509+
*
2510+
* For a VF base MCAM match rule is set by its PF. And all the
2511+
* further MCAM rules installed by VF on its own are
2512+
* concatenated with the base rule set by its PF. Hence PF entries
2513+
* should be at lower priority compared to VF entries. Otherwise
2514+
* base rule is hit always and rules installed by VF will be of
2515+
* no use. Hence if the request is from PF then allocate low
2516+
* priority entries.
25092517
*/
2518+
if (!(pcifunc & RVU_PFVF_FUNC_MASK))
2519+
goto lprio_alloc;
25102520

25112521
/* Get the search range for priority allocation request */
25122522
if (req->priority) {
@@ -2515,17 +2525,6 @@ static int npc_mcam_alloc_entries(struct npc_mcam *mcam, u16 pcifunc,
25152525
goto alloc;
25162526
}
25172527

2518-
/* For a VF base MCAM match rule is set by its PF. And all the
2519-
* further MCAM rules installed by VF on its own are
2520-
* concatenated with the base rule set by its PF. Hence PF entries
2521-
* should be at lower priority compared to VF entries. Otherwise
2522-
* base rule is hit always and rules installed by VF will be of
2523-
* no use. Hence if the request is from PF and NOT a priority
2524-
* allocation request then allocate low priority entries.
2525-
*/
2526-
if (!(pcifunc & RVU_PFVF_FUNC_MASK))
2527-
goto lprio_alloc;
2528-
25292528
/* Find out the search range for non-priority allocation request
25302529
*
25312530
* Get MCAM free entry count in middle zone.
@@ -2555,6 +2554,18 @@ static int npc_mcam_alloc_entries(struct npc_mcam *mcam, u16 pcifunc,
25552554
reverse = true;
25562555
start = 0;
25572556
end = mcam->bmap_entries;
2557+
/* Ensure PF requests are always at bottom and if PF requests
2558+
* for higher/lower priority entry wrt reference entry then
2559+
* honour that criteria and start search for entries from bottom
2560+
* and not in mid zone.
2561+
*/
2562+
if (!(pcifunc & RVU_PFVF_FUNC_MASK) &&
2563+
req->priority == NPC_MCAM_HIGHER_PRIO)
2564+
end = req->ref_entry;
2565+
2566+
if (!(pcifunc & RVU_PFVF_FUNC_MASK) &&
2567+
req->priority == NPC_MCAM_LOWER_PRIO)
2568+
start = req->ref_entry;
25582569
}
25592570

25602571
alloc:

0 commit comments

Comments
 (0)