public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: hkelam@marvell.com
Cc: Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [net-next,PatchV2,1/2] octeontx2-af: Mailbox handlers to fetch DMAC filter drop counter
Date: Mon, 19 Jan 2026 11:46:46 -0800	[thread overview]
Message-ID: <20260119194646.1265255-1-kuba@kernel.org> (raw)
In-Reply-To: <20260117165520.2215073-2-hkelam@marvell.com>

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

  reply	other threads:[~2026-01-19 19:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-17 16:55 [net-next PatchV2 0/2] Octeontx2-pf: Add support for DMAC_FILTER trap Hariprasad Kelam
2026-01-17 16:55 ` [net-next PatchV2 1/2] octeontx2-af: Mailbox handlers to fetch DMAC filter drop counter Hariprasad Kelam
2026-01-19 19:46   ` Jakub Kicinski [this message]
2026-01-17 16:55 ` [net-next PatchV2 2/2] Octeontx2-pf: Add support for DMAC_FILTER trap Hariprasad Kelam
2026-01-19 19:46   ` [net-next,PatchV2,2/2] " Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260119194646.1265255-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=hkelam@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox