RE: [Intel-wired-lan] [PATCH v12 net-next 7/9] octeontx2-af: npc: Support for custom KPU profile from filesystem

From: Loktionov, Aleksandr

Date: Mon May 11 2026 - 07:58:04 EST




> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@xxxxxxxxxx> On Behalf
> Of Ratheesh Kannoth
> Sent: Friday, May 8, 2026 5:49 AM
> To: intel-wired-lan@xxxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx;
> linux-rdma@xxxxxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx; oss-
> drivers@xxxxxxxxxxxx
> Cc: akiyano@xxxxxxxxxx; andrew+netdev@xxxxxxx; Nguyen, Anthony L
> <anthony.l.nguyen@xxxxxxxxx>; Kubalewski, Arkadiusz
> <arkadiusz.kubalewski@xxxxxxxxx>; brett.creeley@xxxxxxx;
> darinzon@xxxxxxxxxx; davem@xxxxxxxxxxxxx; donald.hunter@xxxxxxxxx;
> edumazet@xxxxxxxxxx; horms@xxxxxxxxxx; idosch@xxxxxxxxxx; Vecera, Ivan
> <ivecera@xxxxxxxxxx>; jiri@xxxxxxxxxxx; kuba@xxxxxxxxxx;
> leon@xxxxxxxxxx; mbloch@xxxxxxxxxx; michael.chan@xxxxxxxxxxxx;
> pabeni@xxxxxxxxxx; pavan.chebbi@xxxxxxxxxxxx; petrm@xxxxxxxxxx;
> Prathosh.Satish@xxxxxxxxxxxxx; Kitszel, Przemyslaw
> <przemyslaw.kitszel@xxxxxxxxx>; saeedm@xxxxxxxxxx;
> sgoutham@xxxxxxxxxxx; tariqt@xxxxxxxxxx; vadim.fedorenko@xxxxxxxxx;
> Ratheesh Kannoth <rkannoth@xxxxxxxxxxx>
> Subject: [Intel-wired-lan] [PATCH v12 net-next 7/9] octeontx2-af: npc:
> Support for custom KPU profile from filesystem
>
> Flashing updated firmware on deployed devices is cumbersome. Provide a
> mechanism to load a custom KPU (Key Parse Unit) profile directly from
> the filesystem at module load time.
>
> When the rvu_af module is loaded with the kpu_profile parameter, the
> specified profile is read from /lib/firmware/kpu and programmed into
> the KPU registers. Add npc_kpu_profile_cam2 for the extended cam
> format used by filesystem-loaded profiles and support ptype/ptype_mask
> in npc_config_kpucam when profile->from_fs is set.
>
> Usage:
> 1. Copy the KPU profile file to /lib/firmware/kpu.
> 2. Build OCTEONTX2_AF as a module.
> 3. Load: insmod rvu_af.ko kpu_profile=<profile_name>
>
> Signed-off-by: Ratheesh Kannoth <rkannoth@xxxxxxxxxxx>
> ---
> .../ethernet/marvell/octeontx2/af/cn20k/npc.c | 57 ++-
> .../net/ethernet/marvell/octeontx2/af/npc.h | 17 +
> .../net/ethernet/marvell/octeontx2/af/rvu.h | 12 +-
> .../ethernet/marvell/octeontx2/af/rvu_npc.c | 456 ++++++++++++++---
> -
> .../ethernet/marvell/octeontx2/af/rvu_npc.h | 17 +
> .../ethernet/marvell/octeontx2/af/rvu_reg.h | 1 +
> 6 files changed, 449 insertions(+), 111 deletions(-)
>
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c
> b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c
> index 6f8f42234b06..67dfbe5ca903 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c
> @@ -521,13 +521,17 @@ npc_program_single_kpm_profile(struct rvu *rvu,
> int blkaddr,
> int kpm, int start_entry,
> const struct npc_kpu_profile *profile) {

...

> +void npc_load_kpu_profile(struct rvu *rvu) {
> + struct npc_kpu_profile_adapter *profile = &rvu->kpu;
> + const char *kpu_profile = rvu->kpu_pfl_name;
> +
> + profile->from_fs = false;
> +
> + npc_prepare_default_kpu(rvu, profile);
> +
> + /* If user not specified profile customization */
> + if (!strncmp(kpu_profile, def_pfl_name, KPU_NAME_LEN))
> + return;
> +
> + /* Order of preceedence for load loading NPC profile (high to
> low)
> + * Firmware binary in filesystem.
> + * Firmware database method.
> + * Default KPU profile.
> + */
> +
> + /* Filesystem-based KPU loading is not supported on cn20k.
> + * npc_prepare_default_kpu() was invoked earlier, but control
> + * reached this point because the default profile was not
> selected.
> + * No need to call it again.
> + */
It looks like comment contradicts with the code below?
Isn't it?

> + if (!is_cn20k(rvu->pdev)) {
> + if (!npc_load_kpu_profile_from_fs(rvu))
> + return;
> + }
> +
> + /* First prepare default KPU, then we'll customize top entries.
> */
> + npc_prepare_default_kpu(rvu, profile);
> + if (!npc_load_kpu_profile_from_fw(rvu))
> + return;
>

...

> #define NPC_AF_KPUX_ENTRYX_CAMX(a, b, c) \
> (0x100000 | (a) << 14 | (b) << 6 | (c) << 3)
> --
> 2.43.0