From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796319995; b=ookOSJNoQfVMY+VbGmckG8t9BRODitT+/sjsSwUIeO2V5zKwXmqN+m3AreJ2BbkuR8zg q1iR2XBfiWjmG+WhaU7KgiwxrMDBqxv3ure6TglR00DI7I91eppBmJTYaQObQ1aCwFQ1M Oe0Ncp/QHwJK19JN2G/zAlu8wQf6r/LHsjQ5arKgYn5xQT6JDksM9ZtUM8PJrWUQshMT1 YYBmj6wO9IGmgviuJAPZ2GUhhPXHBUKpyGJzuXrv/MwHDEqQfp676Y561nH8EitXEi/UT QMSW64b4wlePipA9ir44XBatSxOBZySt9HJ8HZ4tWQJFEeiATcFrOc/JeAHviFNF2OA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796319995; 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=8I7W01X0AE6ahyx4llSbQHBtu40349GoqZVzAJAEzJw=; b=dtdpOV3sudEuCd00RwcH156PvwwpH6ZD7IMgImEnnfAv+TATvH3B4uP/vscW8XJgstnn N1npwLE/KrJ/e0d3J6HFDLJ0ZjNGuPN2ZrPLQ/jtl8Pnpjetm4C+g3IEdEZXjhJ/V5TYA fuN+N4pjytKhv64IjZDRxPgCrWqNw1euw2xKUQub2p5VpKfu1c6R0BSmrw5EVg/efDr6i 3O3KmD2JMyilY5dyLc6JfbnhVKFz/91jxGb+MAXnlR3DwtC/jv2bIvX56Q+gI+wRSgRcO GuMrmtD//phcz4D/QaPub8E/cSUxEgasRv057YFfH0xJhvY3BQrcsLByuR4O5fKWVkw== 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=W73tAmOz; arc=none smtp.remote-ip=100.103.45.18 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 ABE75606A32F; Thu, 3 Dec 2026 17:46:35 +0000 (UTC) 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=W73tAmOz Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28E1D1F00893; Thu, 3 Dec 2026 17:46:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796319995; bh=8I7W01X0AE6ahyx4llSbQHBtu40349GoqZVzAJAEzJw=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=W73tAmOzfUfhPewMaDb2fzmCyrRS0DjLiiQrhXbfwZfsGqHxh5CkNHkhsOIHDvGtw UfCUvxlitBg8P+2jWvF+30MHGV3ZeiJxbfpFCSOtaY14uDoILKdkMVZRb63icUK0Md Us4BjPsJRoDQmpP2WdSuUmgR7QjCQdlUaBfZdNPb71CrdEOgoTiypbjrGKo5QQLM+r Goj7zIy07neMIgxthlgWOHZonAxIHzV6FxJzhB71WH7ZWokvBmtL3qZRzWOUsMjeaa oERMOEneEdT+ndUySYakz6UPCkhCFoijxasZhdBh9jGiuQ2Cz38IJYwTpQJ6vTsZH8 A0kXD3MYaDFEw== Subject: Re: [PATCH net-next v13 10/15] net: ethernet: oa_tc6: APIs to customize CONFIG0 settings From: netdev-bot+sashiko@kernel.org To: Selvamani.Rajagopal@onsemi.com Cc: andrew+netdev@lunn.ch, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, parthiban.veerasooran@microchip.com, horms@kernel.org, corbet@lwn.net, skhan@linuxfoundation.org, rdunlap@infradead.org, richardcochran@gmail.com, andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, edumazet@kernel.org, piergiorgio.beruto@gmail.com, willemb@google.com, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, jerry.ray@microchip.com, ciprian.regus@analog.com Date: Thu, 03 Dec 2026 17:46:33 +0000 Message-ID: <179631999370.3146.17088902225862685906@kernel.org> In-Reply-To: <20261202-s2500-mac-phy-support-v13-10-a2908fad2693@onsemi.com> References: <20261202-s2500-mac-phy-support-v13-10-a2908fad2693@onsemi.com> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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] oa_tc6_tx_credit_threshold_set() (drivers/net/ethernet/oa_tc6/oa_tc6_main.c) only checks that the… - [Low] include/linux/oa_tc6.h adds OA_TC6_CONFIG0_TXCTHRESH_8 (2) and OA_TC6_CONFIG0_TXCTHRESH_16 (3) to the OA_TC6_CONFIG0_* block. - [Low] oa_tc6_tx_credit_threshold_set() reads, modifies and writes back CONFIG0 using two separate spi_ctrl_lock critical sections… -- net: ethernet: oa_tc6: APIs to customize CONFIG0 settings This 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. When the flag is set and the MAC-PHY reports cut-through capability, oa_tc6_init() sets RXCTE before the SYNC bit. > diff --git a/drivers/net/ethernet/oa_tc6/oa_tc6_main.c b/drivers/net/ethernet/oa_tc6/oa_tc6_main.c > index e9e7b4ad3b2c1..a60bdb857fa4d 100644 > --- a/drivers/net/ethernet/oa_tc6/oa_tc6_main.c > +++ b/drivers/net/ethernet/oa_tc6/oa_tc6_main.c [ ... ] > @@ -1629,6 +1649,39 @@ 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. > + * > + * Calling from probe is recommended to avoid concurrent CONFIG0 updates > + * during the read-modify-write operation. > + * > + * 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; [Severity: Low] This only checks that thresh fits in the 2-bit field. Should it also be checked against the device's transmit credit capacity? The framework already reads the initial credit count in oa_tc6_update_buffer_status_from_register(): tc6->tx_credits = FIELD_GET(OA_TC6_BUFFER_STATUS_TX_CREDITS_AVAILABLE, value); oa_tc6_macphy_threaded_irq() stops once the cached credits reach zero. It then waits for the MAC-PHY interrupt, which TXCTHRESH controls, to start again: while (tc6->int_flag || (tc6->waiting_tx_skb && tc6->tx_credits)) { Suppose a vendor driver picked a threshold larger than its TX buffer depth. Could the interrupt then never fire, so TX stalls on a link with no RX traffic? The only caller in the series is s2500_init(), which passes OA_TC6_CONFIG0_TXCTHRESH_8. Nothing suggests the S2500 has fewer than 8 credits, so this may only matter for future users. Would it be worth mentioning this in the kernel-doc? > + > + 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); [Severity: Low] The read and the write-back each take spi_ctrl_lock on their own, so this read-modify-write of CONFIG0 is not atomic. oa_tc6_set_hwtstamp_settings() also does a read-modify-write of CONFIG0. It runs from the threaded IRQ handler when a SIOCSHWTSTAMP request is pending: ret = oa_tc6_read_registers(tc6, OA_TC6_REG_CONFIG0, regs, ARRAY_SIZE(regs)); ... ret = oa_tc6_write_register(tc6, OA_TC6_REG_CONFIG0, cfg0); What happens if this exported helper is called while the netdev is live? Could the two sequences interleave and lose either the TXCTHRESH update or the FTSE/FTSS timestamp bits? This can't happen in the series today. The only caller, s2500_init(), runs from s2500_probe() before register_netdev(), and the kernel-doc recommends calling from probe. That rule is only a recommendation in a public API, though. Would it make sense to state it as a requirement, or to serialize CONFIG0 updates? > +} > +EXPORT_SYMBOL_GPL(oa_tc6_tx_credit_threshold_set); [ ... ] > 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 these are unshifted field values. Every other OA_TC6_CONFIG0_* macro here is a BIT(n) register mask, and callers OR those straight into CONFIG0. For example, oa_tc6_zero_align_receive_frame_enable() does: regval |= OA_TC6_CONFIG0_ZARFE_ENABLE; If a vendor driver did the same with OA_TC6_CONFIG0_TXCTHRESH_16, it would set CONFIG0[1:0], the block payload size field, instead of TXCTHRESH[11:10]. Would a different name, such as OA_TC6_TXCTHRESH_8_CREDITS, or pre-shifted values built with FIELD_PREP_CONST() avoid this confusion? Encodings 0 (one or more credits) and 1 (four or more credits) also have no named constants. > +#define OA_TC6_CONFIG0_RXCTE BIT(8) > #define OA_TC6_CONFIG0_FTSE_ENABLE BIT(7) -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202-s2500-mac-phy-support-v13-0-a2908fad2693%40onsemi.com