Re: [net-next,PatchV2,1/2] octeontx2-af: Mailbox handlers to fetch DMAC filter drop counter

From: Jakub Kicinski

Date: Mon Jan 19 2026 - 14:46:50 EST


This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.

For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
octeontx2-af: Mailbox handlers to fetch DMAC filter drop counter

This patch adds mailbox handler support to read the DMAC filter drop
counter from CGX and RPM MAC blocks.

> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
> index 3abd750a4bd7..aef0087174b7 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c

[ ... ]

> +int rvu_mbox_handler_cgx_get_dmacflt_dropped_pktcnt(struct rvu *rvu,
> + struct msg_req *req,
> + struct cgx_dmac_filter_drop_cnt *rsp)
> +{
> + int pf = rvu_get_pf(rvu->pdev, req->hdr.pcifunc);
> + struct mac_ops *mac_ops;
> + u8 cgx_id, lmac_id;
> + void *cgxd;
> +
> + rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
> + cgxd = rvu_cgx_pdata(cgx_id, rvu);
> + mac_ops = get_mac_ops(cgxd);
> +
> + if (!mac_ops->get_dmacflt_dropped_pktcnt)
^^^^^^^^^

Can mac_ops be NULL here? When a PF is not CGX-mapped, pf2cgxlmac_map[pf]
returns 0xFF, which extracts cgx_id=0xF. Then rvu_cgx_pdata() returns
NULL if cgx_id >= cgx_cnt_max. Subsequently, get_mac_ops(NULL) returns
NULL, and this line would dereference a NULL pointer.

Other similar handlers in this file check is_pf_cgxmapped() or
is_cgx_config_permitted() before proceeding with the CGX operations.
For example, rvu_mbox_handler_cgx_fec_stats() and
rvu_mbox_handler_cgx_features_get() both validate the PF mapping first.

Should this handler also include a validation check like:

if (!is_pf_cgxmapped(rvu, pf))
return 0;

> + return 0;
> +
> + rsp->count = mac_ops->get_dmacflt_dropped_pktcnt(cgxd, lmac_id);
> + return 0;
> +}
--
pw-bot: cr