๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #5877

Re: [PATCH net-next v27 2/3] net: phy: Add support for Template Control register for PMA

#5877
From: netdev-bot+sashiko
Date: Wed, 21 Oct 2026 05:21
67 lines
10543 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] include/uapi/linux/mdio.h line 325 defines the new exported uAPI
  macro MDIO_PMA_10GBT_TESTMODE_MASK as GENMASK(15, 13).

--

net: phy: Add support for Template Control register for PMA

This commit adds definitions for the 10GBASE-T PMA Template Test Mode
register (PMA register 132, bits 15:13) to the mdio uAPI header. It also
adds a genphy_c45_template_testmode() helper, which selects one of the
eight test modes (Normal through TestMode7).

> diff --git a/include/uapi/linux/mdio.h b/include/uapi/linux/mdio.h
> index 06f4bc3c20c7..353ca13c64fc 100644
> --- a/include/uapi/linux/mdio.h
> +++ b/include/uapi/linux/mdio.h

[ ... ]

> @@ -320,6 +321,17 @@
>  /* PMA 10GBASE-R Fast Retrain status and control register. */
>  #define MDIO_PMA_10GBR_FSRT_ENABLE	0x0001	/* Fast retrain enable */
>  
> +/* PMA 10GBASE-T Template Test Mode Register*/
> +#define MDIO_PMA_10GBT_TESTMODE_MASK GENMASK(15, 13) /* Template test mode */

[Severity: Low]
Will MDIO_PMA_10GBT_TESTMODE_MASK compile when userspace uses it?

GENMASK() is defined in the kernel-only include/linux/bits.h. The
exported include/uapi/linux/bits.h only provides these:

    #define __GENMASK(h, l) ...
    #define __GENMASK_ULL(h, l) ...
    #define __GENMASK_U128(h, l) ...

Also, include/uapi/linux/mdio.h only includes <linux/types.h> and
<linux/mii.h>.

So a userspace program that includes the installed <linux/mdio.h> and
uses MDIO_PMA_10GBT_TESTMODE_MASK would fail with GENMASK undeclared. The
in-tree build works because phy-c45.c gets GENMASK() from the kernel
headers. CONFIG_UAPI_HEADER_TEST would not catch this either, because
the macro is never expanded there.

Could this use __GENMASK(15, 13) with the uapi <linux/bits.h>, or the
literal 0xe000?

The header already has the same problem in MDIO_AN_C73_0_S_MASK,
MDIO_AN_C73_0_E_MASK and MDIO_AN_C73_1_T_MASK, but this patch adds a new
exported symbol with it. The later patches in the series leave this
definition unchanged.

> +#define MDIO_PMA_10GBT_TESTMODE_NORMAL 0x0 /* Template Normal */
> +#define MDIO_PMA_10GBT_TESTMODE_1 0x1 /* Template TestMode1 */

[ ... ]

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261020021929.3028490-1-kyle.switch%40motor-comm.com
Technical Details
Message-ID: <179256006554.3135.14588045194539327406@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-349819-linux-kernel-netdev=dewy.ru
References: <20261020021929.3028490-3-kyle.switch@motor-comm.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-349819-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v27 2/3] net: phy: Add support for Template
 Control register for PMA
Date: Wed, 21 Oct 2026 05:21:05 +0000
Organization: Usenet Network
Message-ID: <179256006554.3135.14588045194539327406@kernel.org>
References: <20261020021929.3028490-3-kyle.switch@motor-comm.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="4038416"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:6RUJVhP9pSzTp0XDIqiGikvne4c= sha256:y9Lxt4r1/fjjAl2F6JfwjPQdEvRh37MsyRnJOmNqPQM=
	sha1:Dh3gGIoyBr3l+lFqhOT04T04uqk= sha256:6d6BQL84gUm/R+8FwRR2zUSppAxtETkKGgs/GgcBTzQ=
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 994B5110F20; Wed, 21 Oct 2026 08:26:39 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.628
X-Spam-Status: No, score=-2.628 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.329,
	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, URIBL_BLOCKED=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 Gle8M2P627rr;
	Wed, 21 Oct 2026 08:26:35 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-349819-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 75A19110F0C; Wed, 21 Oct 2026 08:26:24 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id F286D3EB52; Wed, 21 Oct 2026 05:21:15 +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=1792560075;
	b=XiMR+341YMOzzquC87HheFXWRaFZfLDxmH16PMusXQS5DA+kKdqhO6wD0Cj8RNjbIDNY
	 RZ6YvcDuw2fDAvsv9VfbjBcDRmcedRMYPYhtNafocVVK8x2KLtAl63A2AokjB9lCrxWj6
	 JycJ/lMdQSTwNIMkIy2SslMYMH+xnHMZdclVjPpfoixCaKI85r7kuKlIxOnqSijcTpQbM
	 h1e5KZj8g+lkSZmokfjsk+OfkKbn81L1NPxCc/elu3aXdua+s1eJ0mWJuLZCjnGBNWeTp
	 BTn2aAGsHi7wM1Z1ctpr05tVywGeVN6X29P9ad4RoUyYHPupel/Ar65gBi0Djfr8chg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792560075;
	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=+zwq9CURf+CmUWAR+V9f51vXK3xezEQGZb6fNB7au+E=;
	b=mv9inc1taCRWUNNy7BVnd0otuGHj7NV/OiLjfQ+zWem+hsWhO3H+g11ceRdFutS9T00I
	 nDnktnmcyX5Wd5COFwmSsVCPXe0kOyN2khYa3kZnnpWxXKpAalJax9i9xCGr5DPT35U65
	 rqkC5/Kmv+JeIvMHpUGZqdzWtkw9ecnXr7XbExhN1q6UvgtLSGnHzJ9/smgcLPP7WCY06
	 yfKV/xnf3nqeLvLt0baGkl2iR60SXza0knWQwTmxL/R7IFxmwzPLmqKpoK852HAAH+zg+
	 tEaLPTINXFALrsY3NALbNX6GeOIgDDfg1WcC7nLw8G27SY9WfmDlsUWwz9PQ3AkltcQ==
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=QOqnDTCn;
	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 CA566606A329;
	Wed, 21 Oct 2026 05:21:15 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=QOqnDTCn
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=1792560067;
	b=OBCqOhxEVu6IAEyaJus3kF+hjhyelD6Pn6PMnYKpUL+CLAfWtKyW0JULu35tghihW6GJ
	 pBK3gjq1urkkAvIfvdio9yU7MNfXsLziNrdaViaPgwdmoH0Zl2PvKDJxM4mWZj8kVIIQD
	 b/HfR9dlp+vFyBaTZoviwrlY4elytMKvtNZmwv7MumA0iQmI4TPp39nN0TKMmrZy0Paic
	 eCB+xSli/Dc5w0qZwtuiiBheUm5GVx800kQjCWYLVTLxnI2I/sUOzOglUm6DsqSNR63AD
	 BWdAp4ufGDYrtjkl9wI9WMca1thpKyFoLbfY89NlyN8K8PdC8XHvIBGatSo8f9QWvxw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792560067;
	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=+zwq9CURf+CmUWAR+V9f51vXK3xezEQGZb6fNB7au+E=;
	b=efR4jfPxwBxlVmPGKyxZtmzhVLoregonQ56Pepu9mGzHzlP/sGCfy/g2lbYKgt/yacr2
	 5n/tQ8PVEGLwewvYde7ULeiPWrAw32Kjna+vO8twEhpiMRs1wIKad17hBZ7g5OOSrsm1P
	 YR2NtP2DVwwq4D7YarHLlhyiqUuby2TT8iTPQS8/FxZy1rEpt4mhQm/Civo7+zA5clYNe
	 zO42ipTukn3T8kcW3kmxiywR974xkUmTx+WqRkvHqUsAsG8bfXLj2dbgPgZdj6ZpLl9Gk
	 taALimyupaHKJ3ZxCjiyutE031TzdHlpwuMBBJCIKUMy3TCwKvchbakqIdjYjhtoIkg==
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=QOqnDTCn;
	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 67A21606A31D;
	Wed, 21 Oct 2026 05:21:07 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id F27661F000CC;
	Wed, 21 Oct 2026 05:21:05 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792560067;
	bh=+zwq9CURf+CmUWAR+V9f51vXK3xezEQGZb6fNB7au+E=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=QOqnDTCneMPwB6usyLEYfCXEBsg6juKbSiDdRyszCM89QVG/4wFpVHXfrC1J1qf9X
	 20hGym9soeGNN+HxvgBAk5nYEsO+JvRcAYcaX/xnaOiFd4h+B6Qyt/RZFtIB9oHSWB
	 Md94UgKBiuG7dinmy8/UqgwSt/mPfMWQEyDqfL7Qv+qAcIANbbzlemPTBeNQ1jyn3e
	 k4L2kAhtefQpjd8UZiZb28ByfDlwnnjG/B8Ost/FrLASE24abPT5CAUX0XHWVMfXKe
	 ShHkUrF/HnHX4QX7PhoMjIesDutDBSl9IKhKKHwP8WYAWPKF5GrQ47hVrPJFWlId+4
	 qp1uTqPI4d3WA==
X-Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
 kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org,
 conor+dt@kernel.org, andrew@lunn.ch, hkallweit1@gmail.com,
 linux@armlinux.org.uk, Frank.Sae@motor-comm.com, netdev@vger.kernel.org,
 devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
 ming.xu@motor-comm.com, xiaolin.xu@motor-comm.com,
 jianmin.wang@motor-comm.com
X-In-Reply-To: <20261020021929.3028490-3-kyle.switch@motor-comm.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