🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #5812

Re: [PATCH net] net: sundance: fix sign extension of the octet counters

#5812
From: Jakub Kicinski
Date: Wed, 21 Oct 2026 01:11
21 lines
8655 bytes
On Wed, 21 Oct 2026 02:44:34 +0300 Rand Deeb wrote:
> get_stats() adds the upper halves of the 32-bit TxOctets and RxOctets
> hardware counters to the byte statistics with
> 
> 	dev->stats.tx_bytes += ioread16(ioaddr + TxOctetsHigh) << 16;
> 
> On architectures that use the ioread16() from asm-generic/io.h, which
> returns u16, the value is promoted to int before the shift. When the
> high word is 0x8000 or more, the result does not fit in a positive int
> and ends up negative, and adding it to the unsigned long counter
> sign-extends it. On 64-bit kernels tx_bytes and rx_bytes then end up
> 2^32 lower than they should be. x86 and m68k are not affected, because
> their ioread16() comes from asm-generic/iomap.h and returns unsigned int.
> 
> Cast the high word to u32 before shifting, so the result is the same on
> all architectures.

We don't take LLM slop fixes for ancient hw
-- 
pw-bot: reject
Technical Details
Message-ID: <20261020181122.53fd0c79@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-349682-linux-kernel-netdev=dewy.ru
References: <20261020234434.318-1-rand.sec96@gmail.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-349682-linux-kernel-netdev=dewy.ru
From: kuba@kernel.org (Jakub Kicinski)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] net: sundance: fix sign extension of the octet
 counters
Date: Tue, 20 Oct 2026 18:11:22 -0700
Organization: Usenet Network
Message-ID: <20261020181122.53fd0c79@kernel.org>
References: <20261020234434.318-1-rand.sec96@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="4008690"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:YZdolNd0jfz0R1V/RoZGLezvmdM= sha256:2efkA6x+/xMkVzM1C4y4sYF5tc2w8I1lURmSdaEaRGA=
	sha1:7AKe21/GYQzEbmzXA7ek4IKUIVg= sha256:1AB32CfSmW8U9UuA6CwV8a/2G+0Ji06KtP77/SVSvxI=
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 0AB79110EC7; Wed, 21 Oct 2026 04:12:01 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.729
X-Spam-Status: No, score=-3.729 tagged_above=-9999 required=6.31
	tests=[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] 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 opqhuv0CX2T1;
	Wed, 21 Oct 2026 04:11:58 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-349682-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 5E789110E87; Wed, 21 Oct 2026 04:11:50 +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 C63EF35AB8; Wed, 21 Oct 2026 01:11:29 +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=1792545089;
	b=DluypBB2QmK6lETNd39bxd2+yBOM73I0WzldzaB57HM/D/rtqcNtUGEZAmWwvzPD9+MP
	 jJ7M4s7l2XuPx57OwmT1Bk+FbZdLXMoZEJHUmmlFmNxLAPxhlxNEFVi0kcEThMDLy6U+7
	 /KqxYGs4eGtefvRoQszHope+kJ78hYWBwSXJcOyWv+dhZCSZBjXngAeUimZdyhO21o13t
	 aRA70M+rbtZCdX5L/VCQFxe6GPIvlGXioDQwo8JF0prU87xnfhkaWK8XnhHZepNCeWu+L
	 UhkVC1PzOr31sBm9Z8n7SgGwOqbpj7a0s8ntwIUEqDnKNlrSEvrRos8/ULp97K6CnUQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792545089;
	h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc:
	 Subject:Message-ID:In-Reply-To:References:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Type:Content-Transfer-Encoding;
	bh=En/FtpZXlY/dvjdQX+68Ke8pNZRCV4qTfxUJ+5HJUPc=;
	b=CwWmcaDxZtEY2Y+7EjY79XK25SlPoXqIWtRpt5v72GOdqon+/uXKkPk0ihb76zfkrOV2
	 hTkGVTvu9XVNsQ5FRMHQrDUNRcvkO42sRYFBVMMyFHoxtT4VugAnKCRXnObyzvWbTdSpU
	 UElLLOA/cwy+Xj8cuuS7Kqbwj2SmwaZsR+LAZKpMqjp6dmvxgLbGRWfNihWPUZLVmjGnd
	 1FIpQkmUNG9zxtq5egD8T3G7EkaUHhOst8fC/wbDb/b9Tz+RCJ4JA4BCQwBlXUV/Kd6Xg
	 VgTj+71JDF3lV9j7/vI7/Awfo7Lu6DvvYoPVxaoB/k8QqxqzZF5k3Ew6NqNrknlx3mQ==
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=hpHJg7gG;
	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 78B7D606A322;
	Wed, 21 Oct 2026 01:11:29 +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=hpHJg7gG
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=1792545083;
	b=ZAv7QUVn5NUyINH9wCKj4dYCqJDND6veOqnu2h7VH30U56ha+scQSF5tF5VMMzDqBWg2
	 NjA8BqL7MB6GR7T43fHY09EQCMaqNQn8T3+B1B+JsEg0jp4zcHiUNbdGIXo/Rocb0yo8m
	 IQDxKpTCn4aj2wiVvbW+aX/tRAeTPgIVpJqVq5LbrKsowWiJFM7zQ7ibSbJrbKbYiYFoz
	 fWZ94NxAgt6jMB5Z/F6elqxdGq6SwBEqhj8hLmvSlGUUnmj6Qa3m86VvOcvX82MVdwHVc
	 3uG4uBOvEjReo7y2qhOrTgKNBVgJK0BF66Y/v6GPxdVh/3rGZ2LX50G2CISAv/VllPQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792545083;
	h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID:
	 In-Reply-To:References:MIME-Version:Content-Type:
	 Content-Transfer-Encoding;
	bh=En/FtpZXlY/dvjdQX+68Ke8pNZRCV4qTfxUJ+5HJUPc=;
	b=RCwx+PFPM44AAVIIiuSAkml/QsfXosMFBvFsqrsc/t1V+pvQ1qT6hLbrND2WIXBD32+q
	 Vkuy+PVz2LZy4bIdPZ3JqiX1TyVOgXHXcqsvhd9/7lQVc7aAvXoUlz9E875I4T+TMoelV
	 n7xqPm8EExZ9yEl2aqYwjaizNX19RlkqMNWKJvE5P/fvHvz7hsyR5wg05FSGTaqTyDy1O
	 MiGCUYT089nGNJHkVXmUgOwN6dDeu49r45PG9QMJ9FBriTg5I6PoYAl1FzDSwEQJZjON8
	 j+rMKag9T0/1qFJvYfiQ//Hi28dorp04dy/XtfbFJihiAs3BjkqKZcO8pDsDAQVIdQw==
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=hpHJg7gG;
	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 5BC01606A319;
	Wed, 21 Oct 2026 01:11:23 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF8371F000C9;
	Wed, 21 Oct 2026 01:11:22 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792545083;
	bh=En/FtpZXlY/dvjdQX+68Ke8pNZRCV4qTfxUJ+5HJUPc=;
	h=Date:From:To:Cc:Subject:In-Reply-To:References;
	b=hpHJg7gGT6ATRYixOYuqIzn5AFfKE/hFFf95McBshMsONyU4MM+AjV0+PWsNPf9hL
	 KG3bLo8lbn1yNRPGs8awBoaHHTt9GOkmznHIdHDOurmucTWq4NzZzEkcwwVJUpwKd0
	 2oZ2/lCfVnwDXYR6UACnA7hW1zfRSSfP6k7XnC+FBaaEEObj+GzKWSSrBsCUOAHVRA
	 NBFWhgDW1lla1jNGICydbHeE/Ye/nMs7/vbT8isoqKWnIdFMyqUOu+28/qkb8fanls
	 L1EkRbeW9DR2iYAQfvVdf1rxeZ/KQPFNblcYqAVzRCcT4n4+A7OqEnaucl1QLG2Puh
	 1hY1GdJOd0QzQ==
X-Cc: Denis Kirjanov <kirjanov@gmail.com>, Paolo Abeni <pabeni@redhat.com>,
 Eric Dumazet <edumazet@kernel.org>, "David S . Miller"
 <davem@davemloft.net>, Andrew Lunn <andrew+netdev@lunn.ch>,
 netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
 deeb.rand@confident.ru, lvc-project@linuxtesting.org, shda@confident.ru
X-In-Reply-To: <20261020234434.318-1-rand.sec96@gmail.com>
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