From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 22BA0C3DA49 for ; Tue, 23 Jul 2024 15:51:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=qW4zkwGdwDYDktpri7pWekVPN6py5ctB8Xz2qiAJLKI=; b=2dJSuQmIJmwSgiyqwIUoTLfKPZ aORzMsjunHZ2g8Tztr6/HGWHfWNtDC56wxjbmNAwpv74sCEd64xE6MQ1GS9zqgcVd6AG0DQbdMQ7M koRSdC7Amz+/tUws4dxURg5Nno4DdN/w5W6nnOm9HJP/aS0lQ0R0ajnRPtvxKryl6Gwa8Em0MKcWc CEgE1Su9wOEVUmHpATM7bhwE45qFeIbnZYtL4czWh+4X0S3kylfTC093EVMge2BnmbTXiOh9pNjc1 +IdpQA35Ny+qyGTt5qd+Mvd24BCH6uGtMnQ5AeUWJCvMB1Z+XJshuagzwYUff4g2dA2ZV7KB9qxP0 59AF/vvw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWHmz-0000000Cx3u-0bjs; Tue, 23 Jul 2024 15:50:57 +0000 Received: from relay8-d.mail.gandi.net ([217.70.183.201]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWHma-0000000Cwzb-3n1G for linux-arm-kernel@lists.infradead.org; Tue, 23 Jul 2024 15:50:35 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id C2FDC1BF204; Tue, 23 Jul 2024 15:50:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1721749829; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qW4zkwGdwDYDktpri7pWekVPN6py5ctB8Xz2qiAJLKI=; b=diGmkaDDhbbwGnVqM5n+brku5HpTbCKSvZABMWHjNUcdhSnnk6qDKbKoZ7f64Rw5NAi9r2 RHJ7mvjwVFc5RENCp/g29cR4Q1fauVps0WvzuWblz96EymuolIR5gT5ROgyPjdYrGysSTd 93xtVkLz5XQyRpv+YD8hQJ3l7TmaawX15Y9Lb7w38Q/JeGJTxICvX702Yp71MAFDMYnH99 Qmfdo9D+iFlpiBH0PlfwLDXWQEZSJ4xRqKk3JHpBCec6T8ibL7ZglixTlZ7xLoxzMZ6akJ L6demDM9v/YZMZYgKHrMfKAOyz9nyCdhZpMY7Secu/DUnQCyGO7t/OgMGuzi3Q== Date: Tue, 23 Jul 2024 17:50:27 +0200 From: Maxime Chevallier To: Simon Horman Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexandre Torgue , Jose Abreu , Maxime Coquelin , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH net] net: stmmac: Correct byte order of perfect_match Message-ID: <20240723175027.081423a1@fedora.home> In-Reply-To: <20240723-stmmac-perfect-match-v1-1-678a800343b2@kernel.org> References: <20240723-stmmac-perfect-match-v1-1-678a800343b2@kernel.org> Organization: Bootlin X-Mailer: Claws Mail 4.3.0 (GTK 3.24.43; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-GND-Sasl: maxime.chevallier@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240723_085033_466161_332B41B8 X-CRM114-Status: GOOD ( 16.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hello Simon, On Tue, 23 Jul 2024 14:29:27 +0100 Simon Horman wrote: > The perfect_match parameter of the update_vlan_hash operation is __le16, > and is correctly converted from host byte-order in the lone caller, > stmmac_vlan_update(). > > However, the implementations of this caller, dwxgmac2_update_vlan_hash() > and dwxgmac2_update_vlan_hash(), both treat this parameter as host byte > order, using the following pattern: > > u32 value = ... > ... > writel(value | perfect_match, ...); > > This is not correct because both: > 1) value is host byte order; and > 2) writel expects a host byte order value as it's first argument > > I believe that this will break on big endian systems. And I expect it > has gone unnoticed by only being exercised on little endian systems. > > The approach taken by this patch is to update the callback, and it's > caller to simply use a host byte order value. > > Flagged by Sparse. > Compile tested only. > > Fixes: c7ab0b8088d7 ("net: stmmac: Fallback to VLAN Perfect filtering if HASH is not available") > Signed-off-by: Simon Horman Reviewed-by: Maxime Chevallier Thanks, Maxime