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 11/14] net: enetc: add a generic helper to update an NTMP entry by entry ID
Date: Sat, 05 Dec 2026 07:11:18 +0000 [thread overview]
Message-ID: <sashiko-outbox-251207@kernel.org> (raw)
In-Reply-To: <20261204071410.692071-12-wei.fang@oss.nxp.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] net: enetc: non-const entry in ntmp_update_entry_by_id() casts
away const
- [Low] net: enetc: ntmp_update_entry_by_id() duplicates
ntmp_add_entry_by_id()
--
commit c5efa87d2b61e70c01da22c7e8bb3461799cdac9
Author: Wei Fang <wei.fang@nxp.com>
net: enetc: add a generic helper to update an NTMP entry by entry ID
This commit adds a generic ntmp_update_entry_by_id() helper to update
NTMP table entries by entry ID and converts ntmp_fdbt_update_entry(),
ntmp_ett_update_entry(), and ntmp_bpt_update_entry() to use it.
> diff --git a/drivers/net/ethernet/freescale/enetc/ntmp.c b/drivers/net/ethernet/freescale/enetc/ntmp.c
> index 837bb37a349fe..a0605f0d0b106 100644
> --- a/drivers/net/ethernet/freescale/enetc/ntmp.c
> +++ b/drivers/net/ethernet/freescale/enetc/ntmp.c
> @@ -710,6 +710,61 @@ static int ntmp_add_entry_by_id(struct ntmp_user *user, int tbl_id,
> return err;
> }
[ ... ]
> +static int ntmp_update_entry_by_id(struct ntmp_user *user, int tbl_id,
> + u32 entry_id, void *entry, u16 ua,
> + u32 resp_len)
[Severity: Low]
Can entry be const void * instead of void *? It is only passed to
ops->pack(), which already takes const void *.
Leaving it non-const forces ntmp_fdbt_update_entry() and
ntmp_ett_update_entry() to cast away const with (void *)entry, and adds an
unnecessary (void *) cast in ntmp_bpt_update_entry().
> +{
> + u8 version = user->tbl_ver[tbl_id];
> + const struct ntmp_tbl_ops *ops;
> + struct netc_swcbd swcbd;
> + struct netc_cbdr *cbdr;
> + union netc_cbd cbd;
> + void *buf;
> + u32 len;
> + int err;
> +
> + ops = ntmp_table_ops(tbl_id, version);
> + if (!ops)
> + return -EOPNOTSUPP;
> +
> + swcbd.size = max(ops->req_ua_len, resp_len);
> + err = ntmp_alloc_data_mem(user->dev, &swcbd, &buf);
> + if (err)
> + return err;
> +
> + ntmp_fill_crd_eid(buf, version, 0, ua, entry_id);
> + ops->pack(entry, buf, NTMP_AM_ENTRY_ID);
> +
> + len = NTMP_LEN(ops->req_ua_len, resp_len);
> + ntmp_fill_request_hdr(&cbd, swcbd.dma, len, tbl_id,
> + NTMP_CMD_UPDATE, NTMP_AM_ENTRY_ID);
> +
> + ntmp_select_and_lock_cbdr(user, &cbdr);
> + err = netc_xmit_ntmp_cmd(cbdr, &cbd, &swcbd);
> + if (err)
> + dev_err(user->dev,
> + "Failed to update %s entry 0x%x, err: %pe\n",
> + ntmp_table_name(tbl_id), entry_id, ERR_PTR(err));
> + ntmp_unlock_cbdr(cbdr);
> +
> + return err;
> +}
[Severity: Low]
Could ntmp_update_entry_by_id() and ntmp_add_entry_by_id() share a single
internal helper? Both run the same allocation, packing, and submission
sequence, differing only in the opcode (NTMP_CMD_ADD vs NTMP_CMD_UPDATE),
resp_len (0 vs resp_len), and the verb in dev_err().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204071410.692071-1-wei.fang@oss.nxp.com?part=11
next prev parent 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
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 [this message]
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-251207@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.