Article View: linux.kernel.netdev
Article #24023Re: [PATCH net-next v12 10/15] net: ethernet: oa_tc6: APIs to customize CONFIG0 settings
From: netdev-bot+sashiko
Date: Sun, 29 Nov 2026 00:36
Date: Sun, 29 Nov 2026 00:36
146 lines
13633 bytes
13633 bytes
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
Technical Details
Message-ID:
<179591261378.3135.2463710344001656562@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373318-linux-kernel-netdev=dewy.ruReferences:
<20261124-s2500-mac-phy-support-v12-10-3575855d99f9@onsemi.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373318-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev 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 Organization: Usenet Network Message-ID: <179591261378.3135.2463710344001656562@kernel.org> References: <20261124-s2500-mac-phy-support-v12-10-3575855d99f9@onsemi.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1069075"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:4qLknEivw9EeRoH3PmJSi3SZbhw= sha256:y+eW0yPTfocJFRacjJq0erTw18HL/vr+tIfV6fNzLTU= sha1:5yeADesJtFLHGMZ+pmF+zvXXJV0= sha256:l3dBH3vZns8f+RSwUz7mSW7ZyOpup60q372Gn6lDjsY= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 95B58125F8A; Sun, 29 Nov 2026 03:37:13 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id G47X71F3Tiut; Sun, 29 Nov 2026 03:37:10 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-373318-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 96F65125F88; Sun, 29 Nov 2026 03:37:00 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id B0C4F22F9A; Sun, 29 Nov 2026 00:36:58 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795912617; b=hzo6Q6iDbOfltRfCGp3pxLmdwK6knPYvQssTl9koavmYf7emEQzyL52OXdsB5KO1ATAD Ez/5AV5KREgbhNAZIDFpcX5vuzvsjh8KPeh3bHEoHI/Tgwn3uhTVznMZcMk/1Tdsaz+rD fXvHbirPlVTZpmdpleiZ21Bsjyabf/qhWzMRI+1BAsUlWVqyDHYRfk1YR5SZH2Tx66gt8 6WPJBJAn83oIGCHxlgS59Env4YvErEsoiHFcwAPg3BYu5BJts8AN3aDWNuw29Ajs0m0Al ktQUzrugoBG+SbKN44oX4bVxao8DMPRDDYHiO0WxQ/7gVzmgGlUUzXKD5FE0T8SO+6Q== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795912617; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=lQgTv2nZM8NAEhNSc/2MV1dqs6eLI+O80tO7vGGjMhA=; b=MqVfpkUeAhXNRYumP3wIxDTIDrBrQUNUnhdZiV5AbI8z1+2AbdjZzE5frLqnjpb41bas xCMsp++olZ9A4yss4rgc/S6CpHn4qOmwiUdXHcyCC2JWmFCuEBgzNx4wOnYIDIDXxMhLc VlRjtq3EApkWB8G9SukLKnSxVylBWjx8ZLsCuUtCp8tgiPxZjs7UfvN9X+QT1XDifMsCK 5D/utkxUQ+uUgBr1yn9iqmlvJsXVCb9Scp0rE/gn0+MO1xZNwEmXl+B4B3alwqMgPp34F z9MujcG8QUF+0IFlHuHR1zIWLu/QKKFjYBKQvaVELUfPBS+guv7tdNxbDXz2pHhJtfg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=JJl3HHzZ; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8CB49606A33E; Sun, 29 Nov 2026 00:36:57 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=JJl3HHzZ X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795912616; b=etrCMvA7lmUHEW0ghqItNzTiExRE1KYVTIOCO+/S03l2bIAwj6dPo+SbqI93XXr5l547 N1i01kM9DtFW1DT9bOu2EOI66qH0HyHSaNNNUs+i0KKgYAMtUZ4KVBRPH9InY1ZWWqV/Y L/wyatstwf1m62gXpa+Io6r4I0DLOL/0Y7qWiA3+EG0Re1BSgNU0DIif/mP1CSI8yPNyf EwamAhUQCUM/LWKIBScK4mVbrtgLxO7sZZVPLJO8qjIb7UAddksuGrIPIBBKbcKJZzU91 HvwzV8+gnjWnzTeW9+b/6qK8k7roG145WC42JllRMIUn6OuCHJkONsQcwSasVvoeNQw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795912616; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=lQgTv2nZM8NAEhNSc/2MV1dqs6eLI+O80tO7vGGjMhA=; b=r7qDt8udnSFikF5+e77/FqvUj3WpO2ytbOxQhYk2F44CTUZsNXuOywVjlkOKTrZHDmB0 qvceDPtPUqFw/Y2XJsjzxNCTVYAW5ubIdiZF9iPZDyPCdCxieBhkew4DFvopeBfj2D0+7 dfHVem4I2Z77kSlGtCj3CpdID7KuhXD9WXs1hUIRIs6e+00tuHg1MCJUJZHemmA7nGM0J ebPcgHj0l+zQz2/8fM+MajdXVEKDNr2sUTBNfDd8QHCKz1sRo29sNjMZdj/WNEAACXiOl EhDCZ1L1Ms7nUxIOKwBNIQTbQVOJX3qcxcDb9cwrgPz2eeZtEHXaJ5UFKj7C2AKfMZw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=JJl3HHzZ; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AACFB606A329; Sun, 29 Nov 2026 00:36:56 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5FC31F00936; Sun, 29 Nov 2026 00:36:54 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795912616; bh=lQgTv2nZM8NAEhNSc/2MV1dqs6eLI+O80tO7vGGjMhA=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=JJl3HHzZ+piozyLUr4JQNfltDzXQUV/R70ei2D4u63p2s3VDUpOOaRSzMcp8mF+rs hSrHSqzH218/meBKVuOIV+NB7EeySNwbaKIGl5UpmskvO/dSBwfZ/57sydiDDp12SA 6zXkhKTiSbqXz5/ItR27Yk1hN+Je95Ty4dubJ4Dpo8ADZ9oPPQeliOaWusxtybhw8m ER5qsvZSpWeSYhZWF2vdNZYP3IJ/dqvdFEK8kYjdH/z7RsIDR9r8XjFOmnVdgCuRlP cQq1iEOJ7hyqNuex/cPvZhRAkG1X4q7wQ+WQwK7yBFeLOvFkMHa2E88gTVMh1Kl0G8 CHP2B6BaiGStA== X-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 X-In-Reply-To: <20261124-s2500-mac-phy-support-v12-10-3575855d99f9@onsemi.com> X-sashiko-severity: Low X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list