Skip to content

Commit 8b0f741

Browse files
Subbaraya Sundeepdavem330
authored andcommitted
octeontx2-af: Always allocate PF entries from low prioriy zone
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 <sbhatta@marvell.com> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent a535d59 commit 8b0f741

1 file changed

Lines changed: 22 additions & 11 deletions

File tree

  • drivers/net/ethernet/marvell/octeontx2/af

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

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2519,7 +2519,17 @@ static int npc_mcam_alloc_entries(struct npc_mcam *mcam, u16 pcifunc,
25192519
* - when available free entries are less.
25202520
* Lower priority ones out of avaialble free entries are always
25212521
* chosen when 'high vs low' question arises.
2522+
*
2523+
* For a VF base MCAM match rule is set by its PF. And all the
2524+
* further MCAM rules installed by VF on its own are
2525+
* concatenated with the base rule set by its PF. Hence PF entries
2526+
* should be at lower priority compared to VF entries. Otherwise
2527+
* base rule is hit always and rules installed by VF will be of
2528+
* no use. Hence if the request is from PF then allocate low
2529+
* priority entries.
25222530
*/
2531+
if (!(pcifunc & RVU_PFVF_FUNC_MASK))
2532+
goto lprio_alloc;
25232533

25242534
/* Get the search range for priority allocation request */
25252535
if (req->priority) {
@@ -2528,17 +2538,6 @@ static int npc_mcam_alloc_entries(struct npc_mcam *mcam, u16 pcifunc,
25282538
goto alloc;
25292539
}
25302540

2531-
/* For a VF base MCAM match rule is set by its PF. And all the
2532-
* further MCAM rules installed by VF on its own are
2533-
* concatenated with the base rule set by its PF. Hence PF entries
2534-
* should be at lower priority compared to VF entries. Otherwise
2535-
* base rule is hit always and rules installed by VF will be of
2536-
* no use. Hence if the request is from PF and NOT a priority
2537-
* allocation request then allocate low priority entries.
2538-
*/
2539-
if (!(pcifunc & RVU_PFVF_FUNC_MASK))
2540-
goto lprio_alloc;
2541-
25422541
/* Find out the search range for non-priority allocation request
25432542
*
25442543
* Get MCAM free entry count in middle zone.
@@ -2568,6 +2567,18 @@ static int npc_mcam_alloc_entries(struct npc_mcam *mcam, u16 pcifunc,
25682567
reverse = true;
25692568
start = 0;
25702569
end = mcam->bmap_entries;
2570+
/* Ensure PF requests are always at bottom and if PF requests
2571+
* for higher/lower priority entry wrt reference entry then
2572+
* honour that criteria and start search for entries from bottom
2573+
* and not in mid zone.
2574+
*/
2575+
if (!(pcifunc & RVU_PFVF_FUNC_MASK) &&
2576+
req->priority == NPC_MCAM_HIGHER_PRIO)
2577+
end = req->ref_entry;
2578+
2579+
if (!(pcifunc & RVU_PFVF_FUNC_MASK) &&
2580+
req->priority == NPC_MCAM_LOWER_PRIO)
2581+
start = req->ref_entry;
25712582
}
25722583

25732584
alloc:

0 commit comments

Comments
 (0)