All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: wei.fang@oss.nxp.com
Cc: imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH net-next 04/14] net: enetc: decouple FDBT logical config from hardware wire format
Date: Sat, 05 Dec 2026 07:11:15 +0000	[thread overview]
Message-ID: <sashiko-outbox-251200@kernel.org> (raw)
In-Reply-To: <20261204071410.692071-5-wei.fang@oss.nxp.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] net: enetc: ntmp_fdbt_search_port_entry() uses swcbd.size for
  NTMP_REQ_LEN
--

commit 1eaf3a5180328e94fddc03214caeb25cfcd150d7
Author: Wei Fang <wei.fang@nxp.com>

net: enetc: decouple FDBT logical config from hardware wire format

This commit turns struct fdbt_entry_data into a version-agnostic logical
config, moves the wire structures to ntmp_private.h, and introduces
ntmp_get_fdbt_ops() with pack/unpack callbacks. It also updates the FDBT
API and the netc DSA switch driver callers to use the new interface.

> diff --git a/drivers/net/ethernet/freescale/enetc/ntmp.c b/drivers/net/ethernet/freescale/enetc/ntmp.c
> index 6143e8b5c6b1f..801e4e7bb8314 100644
> --- a/drivers/net/ethernet/freescale/enetc/ntmp.c
> +++ b/drivers/net/ethernet/freescale/enetc/ntmp.c

[ ... ]

> @@ -929,20 +989,24 @@ int ntmp_fdbt_search_port_entry(struct ntmp_user *user, int port,
>  	u32 len;
>  	int err;
>  
> -	swcbd.size = sizeof(*req);
> +	ops = ntmp_get_fdbt_ops(version);
> +	if (!ops)
> +		return -EOPNOTSUPP;
> +
> +	swcbd.size = max_t(u32, sizeof(*req), ops->resp_query_len);
>  	err = ntmp_alloc_data_mem(user->dev, &swcbd, (void **)&req);
>  	if (err)
>  		return err;
>  
>  	/* Request data */
> -	ntmp_fill_crd(&req->crd, user->tbl_ver[NTMP_FDBT_ID], 0, 0);
> -	req->ak.search.resume_eid = cpu_to_le32(*resume_entry_id);
> +	ntmp_fill_crd(&req->crd, version, 0, 0);
> +	req->ak.search.resume_eid = cpu_to_le32(entry->status);
>  	req->ak.search.cfge.port_bitmap = cpu_to_le32(BIT(port));
>  	/* Match CFGE_DATA[PORT_BITMAP] field */
>  	req->ak.search.cfge_mc = FDBT_CFGE_MC_PORT_BITMAP;
>  
>  	/* Request header */
> -	len = NTMP_LEN(swcbd.size, sizeof(*resp));
> +	len = NTMP_LEN(swcbd.size, ops->resp_query_len);

[Severity: Low]
Should this pass sizeof(*req) instead of swcbd.size as the request length
to NTMP_LEN()?

Now that swcbd.size is max_t(u32, sizeof(*req), ops->resp_query_len), a
future FDBT version with a larger query response than struct fdbt_req_qd
would encode ops->resp_query_len as the request length, causing hardware
to reject or misparse the search command.  For comparison,
ntmp_fdbt_add_entry() passes ops->req_ua_len rather than swcbd.size.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204071410.692071-1-wei.fang@oss.nxp.com?part=4

  reply	other threads:[~2026-12-05  7:11 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  7:13 [PATCH net-next 00/14] net: enetc: refactor NTMP table handling and add generic helpers wei.fang
2026-12-04  7:13 ` [PATCH net-next 01/14] net: enetc: use an ID-indexed array to track NTMP table versions wei.fang
2026-12-04  7:13 ` [PATCH net-next 02/14] net: enetc: decouple MAFT logical config from hardware wire format wei.fang
2026-12-04  7:13 ` [PATCH net-next 03/14] net: enetc: decouple IPFT " wei.fang
2026-12-04  7:14 ` [PATCH net-next 04/14] net: enetc: decouple FDBT " wei.fang
2026-12-05  7:11   ` sashiko-bot [this message]
2026-12-04  7:14 ` [PATCH net-next 05/14] net: enetc: decouple VFT " wei.fang
2026-12-05  7:11   ` sashiko-bot
2026-12-04  7:14 ` [PATCH net-next 06/14] net: enetc: decouple ETT " wei.fang
2026-12-04  7:14 ` [PATCH net-next 07/14] net: enetc: decouple BPT " wei.fang
2026-12-05  7:11   ` sashiko-bot
2026-12-04  7:14 ` [PATCH net-next 08/14] net: enetc: add generic ntmp_add_entry_by_id() helper wei.fang
2026-12-05  7:11   ` sashiko-bot
2026-12-04  7:14 ` [PATCH net-next 09/14] net: enetc: simplify callers of ntmp_query_entry_by_id() wei.fang
2026-12-04  7:14 ` [PATCH net-next 10/14] net: enetc: add kernel-doc for ntmp_delete_entry_by_id() wei.fang
2026-12-04  7:14 ` [PATCH net-next 11/14] net: enetc: add a generic helper to update an NTMP entry by entry ID wei.fang
2026-12-05  7:11   ` sashiko-bot
2026-12-04  7:14 ` [PATCH net-next 12/14] net: enetc: convert ntmp_ect_update_entry() to the generic update helper wei.fang
2026-12-04  7:14 ` [PATCH net-next 13/14] net: enetc: add a generic helper to add an NTMP entry by key wei.fang
2026-12-05  7:11   ` sashiko-bot
2026-12-04  7:14 ` [PATCH net-next 14/14] net: enetc: convert the RSST to the generic NTMP entry helpers wei.fang

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=sashiko-outbox-251200@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wei.fang@oss.nxp.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.