From: netdev-bot+sashiko@kernel.org
To: Selvamani.Rajagopal@onsemi.com
Cc: andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk,
davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
andrew+netdev@lunn.ch, parthiban.veerasooran@microchip.com,
richardcochran@gmail.com, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, horms@kernel.org, corbet@lwn.net,
skhan@linuxfoundation.org, rdunlap@infradead.org,
edumazet@kernel.org, piergiorgio.beruto@gmail.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, linux-doc@vger.kernel.org,
jerry.ray@microchip.com, ciprian.regus@analog.com
Subject: Re: [PATCH net-next v12 10/15] net: ethernet: oa_tc6: APIs to customize CONFIG0 settings
Date: Sun, 29 Nov 2026 00:36:53 +0000 [thread overview]
Message-ID: <179591261378.3135.2463710344001656562@kernel.org> (raw)
In-Reply-To: <20261124-s2500-mac-phy-support-v12-10-3575855d99f9@onsemi.com>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] In include/linux/oa_tc6.h, OA_TC6_CONFIG0_TXCTHRESH_8 (2) and
OA_TC6_CONFIG0_TXCTHRESH_16 (3) are raw, unshifted values for the…
- [Low] oa_tc6_tx_credit_threshold_set() reads CONFIG0 with
oa_tc6_read_register(), changes TXCTHRESH and writes CONFIG0 back with…
--
net: ethernet: oa_tc6: APIs to customize CONFIG0 settings
This patch adds oa_tc6_tx_credit_threshold_set(), which lets a vendor
driver program the TXCTHRESH field of CONFIG0. It also adds the
OA_TC6_CONFIG_RX_CUT_THROUGH quirk flag. With that flag set, and if the
MAC-PHY reports cut-through capability, oa_tc6_init() sets the RXCTE bit
before the SYNC bit is set.
> diff --git a/drivers/net/ethernet/oa_tc6/oa_tc6_main.c b/drivers/net/ethernet/oa_tc6/oa_tc6_main.c
> index 228cc2a3dc2d2..c078f22c32d6f 100644
> --- a/drivers/net/ethernet/oa_tc6/oa_tc6_main.c
> +++ b/drivers/net/ethernet/oa_tc6/oa_tc6_main.c
[ ... ]
> @@ -1618,6 +1638,36 @@ int oa_tc6_zero_align_receive_frame_enable(struct oa_tc6 *tc6)
> }
> EXPORT_SYMBOL_GPL(oa_tc6_zero_align_receive_frame_enable);
>
> +/**
> + * oa_tc6_tx_credit_threshold_set - function to set the minimum number of free
> + * transmit credits needed before the MAC-PHY asserts the interrupt.
> + * @tc6: oa_tc6 struct.
> + * @thresh: transmit credit threshold field value, e.g.
> + * OA_TC6_CONFIG0_TXCTHRESH_8.
> + *
> + * Return: 0 on success, -EINVAL if @thresh does not fit the TXCTHRESH
> + * field, otherwise a negative error code from the register access.
> + */
> +int oa_tc6_tx_credit_threshold_set(struct oa_tc6 *tc6, u8 thresh)
> +{
> + u32 regval;
> + int ret;
> +
> + if (thresh > OA_TC6_CONFIG0_TXCTHRESH_16)
> + return -EINVAL;
> +
> + ret = oa_tc6_read_register(tc6, OA_TC6_REG_CONFIG0, ®val);
> + if (ret)
> + return ret;
> +
> + /* Set Transmit Credit Threshold */
> + regval &= ~OA_TC6_CONFIG0_TXCTHRESH_MASK;
> + regval |= FIELD_PREP(OA_TC6_CONFIG0_TXCTHRESH_MASK, thresh);
> +
> + return oa_tc6_write_register(tc6, OA_TC6_REG_CONFIG0, regval);
> +}
> +EXPORT_SYMBOL_GPL(oa_tc6_tx_credit_threshold_set);
[Severity: Low]
Should the calling context for this helper be documented?
The read and the write each take spi_ctrl_lock separately, so nothing
serializes the whole read-modify-write of CONFIG0. The IRQ thread also
does a read-modify-write of CONFIG0:
oa_tc6_macphy_threaded_irq()
oa_tc6_hwtstamp_req_process()
oa_tc6_set_hwtstamp_settings()
oa_tc6_read_registers(tc6, OA_TC6_REG_CONFIG0, regs, ...)
...
oa_tc6_write_register(tc6, OA_TC6_REG_CONFIG0, cfg0)
If both ran at the same time, one update could be lost. Either the
TXCTHRESH setting would be dropped, or hardware timestamping would be
silently turned off while tc6->ts_cfg still says it is on.
No caller in this series can trigger this today. The s2500 driver calls
the helper from s2500_init() in s2500_probe(), before register_netdev().
The IRQ thread only writes CONFIG0 after oa_tc6_hwtstamp_post() sets
ts_cfg_req, and that needs ndo_hwtstamp_set on a registered netdev.
Neither the kernel-doc above nor oa-tc6-framework.rst says the helper
must be called at probe time, before register_netdev(). Could a note be
added there for future vendor drivers? The existing
oa_tc6_zero_align_receive_frame_enable() uses the same pattern.
[ ... ]
> diff --git a/include/linux/oa_tc6.h b/include/linux/oa_tc6.h
> index f34ed8218a7c4..35b536741d016 100644
> --- a/include/linux/oa_tc6.h
> +++ b/include/linux/oa_tc6.h
[ ... ]
> @@ -30,6 +31,10 @@
> #define OA_TC6_REG_CONFIG0 0x0004
> #define OA_TC6_CONFIG0_SYNC BIT(15)
> #define OA_TC6_CONFIG0_ZARFE_ENABLE BIT(12)
> +#define OA_TC6_CONFIG0_TXCTHRESH_MASK GENMASK(11, 10)
> +#define OA_TC6_CONFIG0_TXCTHRESH_8 2 /* 0b10: >=8 credits */
> +#define OA_TC6_CONFIG0_TXCTHRESH_16 3 /* 0b11: >=16 credits */
[Severity: Low]
This isn't a bug, but are these names easy to misread next to the other
OA_TC6_CONFIG0_* defines?
SYNC, ZARFE_ENABLE, the new RXCTE, FTSE_ENABLE and PROTE are all masks
that are already in register position. OA_TC6_CONFIG0_TXCTHRESH_8 and
OA_TC6_CONFIG0_TXCTHRESH_16 are unshifted field values. They only come
out right when passed through FIELD_PREP(), as
oa_tc6_tx_credit_threshold_set() does.
Suppose a vendor driver follows the neighbouring defines and does this
before calling oa_tc6_write_register():
regval |= OA_TC6_CONFIG0_TXCTHRESH_8;
That would set bits 1:0 instead of bits 11:10.
The header and the documentation also disagree. oa-tc6-framework.rst
names a macro only for value 2:
- 2: eight or more credits (OA_TC6_CONFIG0_TXCTHRESH_8)
- 3: sixteen or more credits
It does not mention OA_TC6_CONFIG0_TXCTHRESH_16, and values 0 and 1 have
no macro at all.
Would a field-value name such as OA_TC6_TXCTHRESH_8 be clearer, with all
four values documented the same way?
> +#define OA_TC6_CONFIG0_RXCTE BIT(8)
> #define OA_TC6_CONFIG0_FTSE_ENABLE BIT(7)
> #define OA_TC6_CONFIG0_FTSS_64BIT_TSTAMP BIT(6)
> #define OA_TC6_CONFIG0_PROTE BIT(5)
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124-s2500-mac-phy-support-v12-0-3575855d99f9%40onsemi.com
next prev parent reply other threads:[~2026-11-29 0:36 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 22:09 [PATCH net-next v12 00/15] Support for onsemi's S2500 10BASE-T1S MAC-PHY Selvamani Rajagopal via B4 Relay
2026-11-24 22:09 ` [PATCH net-next v12 01/15] dt-bindings: net: add onsemi's S2500 Selvamani Rajagopal via B4 Relay
2026-11-24 22:09 ` [PATCH net-next v12 02/15] Documentation: networking: Add timestamp related APIs to OA TC6 framework Selvamani Rajagopal via B4 Relay
2026-11-24 22:09 ` [PATCH net-next v12 03/15] net: ethernet: oa_tc6: Move oa_tc6.c to its own directory Selvamani Rajagopal via B4 Relay
2026-11-24 22:09 ` [PATCH net-next v12 04/15] net: ethernet: oa_tc6: Move constant definitions to header file Selvamani Rajagopal via B4 Relay
2026-11-24 22:09 ` [PATCH net-next v12 05/15] net: ethernet: microchip: lan865x: Depends on PTP_1588_CLOCK_OPTIONAL Selvamani Rajagopal via B4 Relay
2026-11-25 18:04 ` Selvamani Rajagopal
2026-11-24 22:09 ` [PATCH net-next v12 06/15] net: ethernet: adi: adin1140: " Selvamani Rajagopal via B4 Relay
2026-11-25 18:04 ` Selvamani Rajagopal
2026-11-24 22:09 ` [PATCH net-next v12 07/15] net: ethernet: oa_tc6: Support for hardware timestamp Selvamani Rajagopal via B4 Relay
2026-11-25 18:16 ` Selvamani Rajagopal
2026-11-25 22:10 ` sashiko-bot
2026-11-29 0:36 ` netdev-bot+sashiko
2026-11-24 22:09 ` [PATCH net-next v12 08/15] net: ethernet: oa_tc6: Drop frames if footer has FD bit set Selvamani Rajagopal via B4 Relay
2026-11-24 22:09 ` [PATCH net-next v12 09/15] net: ethernet: oa_tc6: Support for vendor specific MMS Selvamani Rajagopal via B4 Relay
2026-11-24 22:37 ` Selvamani Rajagopal
2026-11-24 22:09 ` [PATCH net-next v12 10/15] net: ethernet: oa_tc6: APIs to customize CONFIG0 settings Selvamani Rajagopal via B4 Relay
2026-11-29 0:36 ` netdev-bot+sashiko [this message]
2026-11-24 22:09 ` [PATCH net-next v12 11/15] net: phy: ncn26000: Enable enhanced noise immunity Selvamani Rajagopal via B4 Relay
2026-11-24 22:10 ` [PATCH net-next v12 12/15] net: phy: Add helper to modify only the PHY loopback bit Selvamani Rajagopal via B4 Relay
2026-11-24 22:10 ` [PATCH net-next v12 13/15] net: phy: ncn26000: Support for onsemi's S2500 internal phy Selvamani Rajagopal via B4 Relay
2026-11-24 22:10 ` [PATCH net-next v12 14/15] net: phy: dp83867: Use genphy_loopback_no_speed() Selvamani Rajagopal via B4 Relay
2026-11-24 22:10 ` [PATCH net-next v12 15/15] net: ethernet: onsemi: s2500: Add driver support for S2500 Selvamani Rajagopal via B4 Relay
2026-11-25 22:10 ` sashiko-bot
2026-11-29 0:36 ` netdev-bot+sashiko
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=179591261378.3135.2463710344001656562@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=Selvamani.Rajagopal@onsemi.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=ciprian.regus@analog.com \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@kernel.org \
--cc=hkallweit1@gmail.com \
--cc=horms@kernel.org \
--cc=jerry.ray@microchip.com \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=parthiban.veerasooran@microchip.com \
--cc=piergiorgio.beruto@gmail.com \
--cc=rdunlap@infradead.org \
--cc=richardcochran@gmail.com \
--cc=robh@kernel.org \
--cc=skhan@linuxfoundation.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