🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24561

Re: [PATCH net-next v17 3/5] net: dsa: motorcomm: use fixed-width GENMASK_U*() helpers

#24561
From: David Laight
Date: Mon, 30 Nov 2026 10:52
72 lines
14103 bytes
On Tue, 10 Nov 2026 15:26:52 -0800
Jakub Kicinski <kuba@kernel.org> wrote:

> This is an AI-generated review of your patch. The human sending this
> email has considered the AI review valid, or at least plausible.
> ---
> net: dsa: motorcomm: use fixed-width GENMASK_U*() helpers
> 
> This patch replaces two GENMASK() uses in the motorcomm DSA driver with
> GENMASK_U32(). One is in yt921x_chip_setup_dsa() in chip.c and the other
> is in yt921x_mbus_int_init() in mdio_bus.c. It is described as a type
> cleanup with no functional change.
> 
> > Some masks assigned to u16 and u32 fields are defined with
> > GENMASK(),which is an unsigned long constant and wider than
> > the field type on 64-bit builds. Convert the YT921X_MBUS_CTRL_*
> > masks used by mdio_bus.c to fixed-width helpers.
> >
> > This is a type cleanup only, with no functional change. Other
> > GENMASK() uses in the driver are intentionally left untouched.  
> 
> [Severity: Medium]
> Does this description match the diff? The patch doesn't seem to touch
> the YT921X_MBUS_CTRL_* masks at all. After this patch they are still
> plain GENMASK() in drivers/net/dsa/motorcomm/mdio_bus.h:
> 
> #define  YT921X_MBUS_CTRL_PORT_M		GENMASK(25, 21)
> #define  YT921X_MBUS_CTRL_REG_M			GENMASK(20, 16)
> #define  YT921X_MBUS_CTRL_TYPE_M		GENMASK(11, 8)  /* wild guess */
> #define  YT921X_MBUS_CTRL_OP_M			GENMASK(3, 2)  /* wild guess */
> 
> They still feed the u32 mask variables in yt921x_intif_read(),
> yt921x_intif_write(), yt921x_extif_read() and yt921x_extif_write(),
> for example:
> 
> 	mask = YT921X_MBUS_CTRL_PORT_M | YT921X_MBUS_CTRL_REG_M |
> 	       YT921X_MBUS_CTRL_OP_M;
> 
> No later patch in the series converts them either.
> 
> The two lines the patch does change are not MBUS_CTRL masks. In
> yt921x_chip_setup_dsa(), the mask written to YT921X_FILTER_UNK_UCAST
> and YT921X_FILTER_UNK_MCAST is changed:
> 
> 	ctrl = GENMASK_U32(10, 0);
> 
> That seems to contradict "Other GENMASK() uses in the driver are
> intentionally left untouched".
> 
> The other change is the phy_mask calculation in yt921x_mbus_int_init():
> 
> 	mbus->phy_mask = ~GENMASK_U32(max_ports - 1, 0);
> 
> Also, the message refers to "masks assigned to u16 and u32 fields",
> but none of the changed lines involve a u16 field.

The u16 variants are also pretty dubious.
The result is always promoted to 'signed int' when used; which can
have unforeseen consequences, eg ~(GENMASK_U16(15, 15) << 16).

David

> 
> Both changed lines give the same values as before, so runtime behaviour
> does not change. Only the description is off.
> 
> Could the message be reworded to describe the FILTER_UNK and phy_mask
> changes, with the "left untouched" sentence dropped? The other option
> is to convert the YT921X_MBUS_CTRL_* masks in mdio_bus.h as the
> message says.
> 
Technical Details
Message-ID: <20261130105235.1a1b4b4d@pumpkin>
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374113-linux-kernel-netdev=dewy.ru
References: <20261105031442.4164960-4-kyle.switch@motor-comm.com> <20261110232652.2437155-1-kuba@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374113-linux-kernel-netdev=dewy.ru
From: david.laight.linux@gmail.com (David Laight)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v17 3/5] net: dsa: motorcomm: use fixed-width
 GENMASK_U*() helpers
Date: Mon, 30 Nov 2026 10:52:35 +0000
Organization: Usenet Network
Message-ID: <20261130105235.1a1b4b4d@pumpkin>
References: <20261105031442.4164960-4-kyle.switch@motor-comm.com>
	<20261110232652.2437155-1-kuba@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="1406744"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:0k7Mx9OSFZKq0zRCxrpSJxU8xm8= sha256:Sjk1WzKm5C/o+jTdO0VdQT+ojEwgYtmU21t9W7Qw9V0=
	sha1:nAyLtB30E1vCxw1gxnXDKCeSpIU= sha256:sNp2nHlgjnb0lstIXIEHpr7RUFAE2xfOruQ30VVVNGE=
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 5E7CC125FD9; Mon, 30 Nov 2026 13:52:56 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.149
X-Spam-Status: No, score=-3.149 tagged_above=-9999 required=6.31
	tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, 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=gmail.com
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 VDYMwZL09erV;
	Mon, 30 Nov 2026 13:52:51 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-374113-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 5A36D125FD5; Mon, 30 Nov 2026 13:52:43 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id CF64224235; Mon, 30 Nov 2026 10:52:40 +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=1796035960;
	b=XegJfyckQk0aMC10MpGKDLsJhS1hwWzdqv4OalC8Shw//6/HHIbZ/XagxNvj1CaIpUA0
	 7di97yX4n8TZebZVFe3p2m8tjUiaMBeKBCnLiQaCtxvZTzNQI0Iw30Nw6I1TKfD4tQW8D
	 kedcDmiyBNSLrRWcr2eN80jlF+kbJi3xv7+88Yb678ADwjFPm3WBbZyVu/Ip3bnFpA+Pn
	 t/EUnr5OLn7BBoisyQL45SvV565gOBmBlXIa3vxij1b3T6iiodwmZb7i0lRP6YLpIeY2u
	 klOhlw3tulQUCBOe7bSFJfMzILfsmivUlOv3Q3VbVLld34wjrPNxPf+uZaa7p/WbSag==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796035960;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
	 X-Gm-Gg:X-Received:Received:Date:From:To:Cc:Subject:Message-ID:
	 In-Reply-To:References:X-Mailer:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Type:Content-Transfer-Encoding;
	bh=6QQ0DZYuIRw6EZBxd2mk/d5igN6l4XKLz7TJAL7X4f4=;
	b=NZTGZHXJtJVeSjKYwjqGrIqYXTDWOy/CwlbwtXoH+i3E2WBWNzjTP12GjjX6wGZk0iz6
	 w8W6w4+yNdi24O/b+70DWhuIN6r9e4sXNcxyz6TJv5KlDwAfFcQ17V2awYBOzXBQMo6Er
	 62ZwPHcHW6Z0sTK/OrMWdKH7DBX/GW9/OR99IgW/QN0X8znjP+ETbCgmbTMcoJno8MvP4
	 usCreTZjx70/84cIipy4P2yl4fEHKnmeOaOKPwmoIBEDRGTS8sZ6/zSox5rnTJg8XqYjN
	 wOYeuvPumRfb5K68hxJ4fLyYVtdqKHcfLDFsiHvha9tw7q7PIwFlW10UxelaqXl0QAQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=hsMv1Mel;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	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 373CB606A335;
	Mon, 30 Nov 2026 10:52:40 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=hsMv1Mel
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.47
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796035959;
	b=YkrYEjPQaNRo3EXwFXo3VxmuRT6jeeS5tlV6Gb3s27QBuN9YfqL5xUnBpoKSzCtyVqK6
	 fzqbfQOWFgAIA2AWEpsA4J+FrAZCdwdWS7kWjQCPDtFcNiwMqnUJuB8wTIR0d5T7NcnlC
	 aaf7R8QhdP1i15WjOC4HaMm/nTEODJ5mMWC99/BL64ji1T+sDXmNB+oQITPNHGMbaN5am
	 aUvf309x1KcQCYVht64xs4Q32aDcwnA/FGNYIns5aQIW9XTAFpis7v9mlk5tijbakTPwD
	 /iW4BVBWlJqa59T70Qre3QaD5d/hR5gucu28MmcHObBweKQQNd82z+2fWKkZg+nhJdA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796035959;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
	 Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References:X-Mailer:
	 MIME-Version:Content-Type:Content-Transfer-Encoding;
	bh=6QQ0DZYuIRw6EZBxd2mk/d5igN6l4XKLz7TJAL7X4f4=;
	b=HQFGf0lTrzfOwo3oWny61J6Xo+McHcxUGTjMjvTKXD4PEgtSiB5wE0k6te5RY3Aa1Sb3
	 ZFemN5el7wcP36w+Obs/jxpgb4CYLy4lcabMYmanjPeEATaBoCebMDJjKDDMW/1qKS4gb
	 lGuKKGK0hXGJCao2hiGkhdsHvXTjzaGSu7kieCLlv2gQsJVWW/8ufNCpHDD+PwJyoD3mZ
	 PSVrovAd570mUQ4VaXL6KE2XtOFM/O9BIYYRFngVwQeHD/2dFk+ekQ+omqCqoPoorhDA3
	 Zkzy3Emp2ylPV6ltn3xevF7/2TIQKZaC2MCso+YVwS+kRWa0yiea7DXqrQ+FTqa+FSA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=hsMv1Mel;
	arc=none smtp.remote-ip=209.85.128.47
X-Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10AFA606A320
	for <netdev@vger.kernel.org>; Mon, 30 Nov 2026 10:52:38 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 10AFA606A320
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4bba60271d7so44552115e9.2
        for <netdev@vger.kernel.org>; Mon, 30 Nov 2026 02:52:38 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1796035957; x=1796640757; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:mime-version:references
         :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject
         :date:message-id:reply-to:content-type;
        bh=6QQ0DZYuIRw6EZBxd2mk/d5igN6l4XKLz7TJAL7X4f4=;
        b=hsMv1Mel2h25iZAriRhV+y06CVQF77qA84zKuKGTJ20964WJ4gkyR0sEytlDEB70nE
         zxG9FzB79NStwswDTiBviOq+oIBCbP/qzAucA69yGUpIx8TpZjRgt6Gl1Vd4ovL+qHTR
         J805rc6Uy582JZYDRXB8FWEUVNvZ3R8Pl303ZFNNJFvsvo6e28J1yYmqAUZeKMm3LQ62
         EkbGfSPaZ7p/NLb2FT3g8zhthqOdJxxYdYR/99yNPj8Kw5KDWM+cFU3maK1Y32g3VIVJ
         cXcQX8QnK0/vXWmQLSHi3eWMnCfCuNp4Pl8kIX5AFbkwhlhoRPUW54KO4lUOr3RDzJmp
         tS3g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1796035957; x=1796640757;
        h=content-transfer-encoding:content-type:mime-version:references
         :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=6QQ0DZYuIRw6EZBxd2mk/d5igN6l4XKLz7TJAL7X4f4=;
        b=Px0gnxW0wxArugVejjPPUbk4jb6ggkZzQXXUC+uDWRPDrtT00KVWkWcKJmiCOgiazh
         wssrvJllBXHRHzxnwVpBzeasrqDqcuKY+LOWnPWL3/of8bKVxU5Eb2MhstJmqtfIqI36
         p7RSBzCIRMH+RZVWwBONcXnCTUqDxmfZ3+1bs4DYBmE19bqmMiGO/5MsktxIoxV7KHfH
         XryFuNQdMbrRg0SqE83qbSaiHRVxIO3qULpns2WrfvlU82nluD0cUM78X1Moq09XgLxi
         DTJON+wMhvpkbiFDf8b4684JptDps9NQp9fs/mxlUv3m8CYDTqG5aFw7x18UKZ4U5G1C
         f74A==
X-Forwarded-Encrypted: i=1; AL+hErHccTroXfdBUb7SruaewKkq8wDOZlImGDPy+yLLf0WcRTzqoRpe3S2oFd0yDNI+nkEDHufOoOg=@vger.kernel.org
X-Gm-Message-State: APuU4Z+r0swPpX430uCtQgjqZzm453P/K2pmJf764itRdOMYfXkFWmDH
	BnNs8GeCGg3JE9cYMRzeG9Xsa5FNI3VQ0TCUmSIoHL8sKvLkugd3uaAY
X-Gm-Gg: AZFdTZfaDVlY8ABNQzVFm4XEJIVWROTTVEd0rFzqpfH91pDFb4FkX3qw+ZYxXNlg8w8
	uEXP3woXqcD1e8IRde5EPYyAzRaUdtkrstvkrfflbHqWdcwNEqcb1FiPVer5Zyf8F9kV0/TiGkH
	WHYKo8HSHr187o40xg3+Dq8HKjo6AaApxbKOsBMKyVL7VVOKGqcY63dE1ksfxcY7xnsj4pZKJdx
	WLwOr0I4OwvLrtunH5NqHoTEeu8mX9rp1UG05Tw9fbtke5bcGiWUtbdt/zevJMxP2iPQrDETIwH
	yjhq8mxJVFfaZ4F+uT7J3od5jRSUZbQwlIumWXWTd/GDV+4yO+k8BqClDUx0Ndk591YSB8ibQwP
	bQJHDZOGfbx04oAyN6ZIyk54RJA+VnZmCvuM1+Y58qqzJL2qmKt5Nxg10PcJLajvPUWXu8bKmsV
	k0Gs2EDiRssW/eIaxWlluXek1K4ISnh/fPfj5rMAwD5xy4Vm9m3SyQq3R9SQySMPkfRGjTYFlUz
	nJ3D2q9TpAwqjMGO711QF+RxH1JJuluKLF+C3DWn/qV0omAcEJQjqgF7JP5shm/y141nrRdNpr1
	aM6igAV79yz2mIsPT3VJDhZWo7VNVOacok1iSYSlQoBGQ79wwkZzOrVmnbTQFlT5BA==
X-Received: by 2002:a05:600c:3555:b0:4a1:f377:5c68 with SMTP id 5b1f17b1804b1-4bb8881da76mr662871115e9.34.1796035957243;
        Mon, 30 Nov 2026 02:52:37 -0800 (PST)
X-Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36])
        by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbab390cf5sm487627885e9.7.2026.11.30.02.52.36
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Mon, 30 Nov 2026 02:52:36 -0800 (PST)
X-Cc: kyle.switch@motor-comm.com, andrew@lunn.ch, olteanv@gmail.com,
 davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
 mmyangfl@gmail.com, horms@kernel.org, linux@armlinux.org.uk,
 netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
 ming.xu@motor-comm.com, xiaolin.xu@motor-comm.com,
 jianmin.wang@motor-comm.com, wei.zhang@gl-inet.com, sijia.huang@gl-inet.com
X-In-Reply-To: <20261110232652.2437155-1-kuba@kernel.org>
X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf)
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