octeontx2-af: Add devlink option to adjust mcam high prio zone entries
authorNaveen Mamindlapalli <naveenm@marvell.com>
Mon, 12 Jun 2023 06:04:19 +0000 (11:34 +0530)
committerDavid S. Miller <davem@davemloft.net>
Tue, 13 Jun 2023 08:54:57 +0000 (09:54 +0100)
commit09de114c770fef0c8c586b4dd59431226d873387
tree224762169c7242731802b9eb6672fa29fdeebdbb
parentc29e012eae29c13f092a95f1ffab40a269fe5bc2
octeontx2-af: Add devlink option to adjust mcam high prio zone entries

The NPC MCAM entries are currently divided into three priority zones
in AF driver: high, mid, and low. The high priority zone and low priority
zone take up 1/8th (each) of the available MCAM entries, and remaining
going to the mid priority zone.

The current allocation scheme may not meet certain requirements, such
as when a requester needs more high priority zone entries than are
reserved. This patch adds a devlink configurable option to increase the
number of high priority zone entries that can be allocated by requester.
The max number of entries that can be reserved for high priority usage
is 100% of available MCAM entries.

Usage:
1) Change high priority zone percentage to 75%:
devlink -p dev param set pci/0002:01:00.0 name npc_mcam_high_zone_percent \
value 75 cmode runtime

2) Read high priority zone percentage:
devlink -p dev param show pci/0002:01:00.0 name npc_mcam_high_zone_percent

The devlink set configuration is only permitted when no MCAM entries
are assigned, i.e., all MCAM entries are free, indicating that no PF/VF
driver is loaded. So user must unload/unbind PF/VF driver/devices before
modifying the high priority zone percentage.

Signed-off-by: Naveen Mamindlapalli <naveenm@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c