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

From: Simon Horman

Date: Mon Jan 19 2026 - 09:53:35 EST


On Wed, Jan 14, 2026 at 12:27:42PM +0530, Hariprasad Kelam wrote:
> Both CGX/RPM mac blocks support DMAC filters. This patch
> adds mbox support to read the counter.
>
> Signed-off-by: Hariprasad Kelam <hkelam@xxxxxxxxxxx>

...

> 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
> @@ -1352,3 +1352,23 @@ void rvu_mac_reset(struct rvu *rvu, u16 pcifunc)
> if (mac_ops->mac_reset(cgxd, lmac, !is_vf(pcifunc)))
> dev_err(rvu->dev, "Failed to reset MAC\n");
> }
> +
> +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);

Hi Hariprasad,

Claude Code with Review Prompts [1] flags that get_mac_ops may not
always return a valid ops structure. And that other handlers that
mac_ops guard against this using is_cgx_config_permitted().

I am wondering if that is appropriate here too.

[1] https://github.com/masoncl/review-prompts/

> +
> + if (!mac_ops->get_dmacflt_dropped_pktcnt)
> + return 0;
> +
> + rsp->count = mac_ops->get_dmacflt_dropped_pktcnt(cgxd, lmac_id);
> + return 0;
> +}
> --
> 2.34.1
>
>