Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp985278pxb; Fri, 15 Apr 2022 17:26:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzd1OqzZpmv8fBz9GmW0H+LBafoJeQA4bz49GSzJi/DxfJ2X39vWt/J160293UJszN2u88h X-Received: by 2002:a17:902:f78d:b0:14d:522e:deb3 with SMTP id q13-20020a170902f78d00b0014d522edeb3mr1206144pln.173.1650068795968; Fri, 15 Apr 2022 17:26:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650068795; cv=none; d=google.com; s=arc-20160816; b=Uas2QIU1WCbbM6slf4cwZIkj4vYgPsW8SwgMRIyHnar3q35FmPbGy1XKqCT2NkG8t9 wNB07WV7f88GOP5RDglozGE+glG0sr8M0+kIE4Bb3H6P4ytCmq7MzwGQ+LEjwfbJMJ3e +IDkpqQspIqY5CTVVpCP8oG9Xq6KZeYGOciFtjqDjS0B6VFvOzPNdmgbfqqBfyICShFf cq2RXccjjNYMRrW2f8gaSW6/qmS8pfXTeYV8gOTJ9Vwm3xocwSIdZSeoX6Iwn0f1tor4 sZrHDrh8+l3MazfZHatXPfII4VBuZjKTp98jD2rOnweXJDxtP+fl1HW4UMRZuJgSFXIv yolA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ePaXFvQpBZHWZnEFe6kdyoM4M5jCBAO3IMy7bDaD+IQ=; b=GOzmULhYPWvA2GAayflLYM0ayR77II0fJ/jA0u9kHfrHMcmSu9Tl3IgeOLegSLh77O yFjtZH4vZ84dRVZAqN01+ZvVjGIoGhqSfWjLLnY0zUT8yI1X7uOqEhGzDCnZkGfd3P3X J9yPIWrHCf7+fNsQCQERKdVQm3TFHCj1o/IWOgYMz1hk621d3K5GXknuhqiD5j3Te8Vi TRlgUUuuVPglt79dahalvmRQ3A819Cjm9OoOU5ulNpaeOjPIqGI31j6cuGELeg/J1Zrl 43ISjqupu44vmTstvKdVyCVSo62b+UvVJYuPPPsOUI5EYI/g2hDZ9TUUv/czwjab96u4 C8Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="T3y7/ezw"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id v7-20020a056a00148700b004fa3a8e00c5si2891407pfu.380.2022.04.15.17.26.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 17:26:35 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="T3y7/ezw"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 58C6FDB6; Fri, 15 Apr 2022 17:24:30 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238209AbiDNPsD (ORCPT + 99 others); Thu, 14 Apr 2022 11:48:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242158AbiDNPeP (ORCPT ); Thu, 14 Apr 2022 11:34:15 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7DA2B715D; Thu, 14 Apr 2022 08:11:50 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id c64so6735634edf.11; Thu, 14 Apr 2022 08:11:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=ePaXFvQpBZHWZnEFe6kdyoM4M5jCBAO3IMy7bDaD+IQ=; b=T3y7/ezwj893tPbd5HahxfqR30GzBGzewCsL3NxKGci1PBv/JhijD1EWqxBqyiPhCq MixICDu2zy/rZSjOartFBhQMPEUInun7+vXgTUAn46k70RS39svn1sDFccf8XnzbCm1w +xfyWVzZshcJqTywem9rulpf+BAJWF4nVne0lKwjkMb+i1yyqlV9tzqxywR8zC0Dqhv7 V6trRKYPrp1Vi4tjauvr2KhKSV0Dy5dYJtUTu2ejESyn2xhHn4ZvWRCLHV86vU3AvVgu ykouEjIMSV1YZldUBE1U5o7iBg44+Dt78fkPvv+0xvqc6a38kGD3EEjcy27DtWFQYj5t NFdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=ePaXFvQpBZHWZnEFe6kdyoM4M5jCBAO3IMy7bDaD+IQ=; b=WDtkxu0XwJF5OU38fIFUTRj2EqdoGw6qLYP8Lhp6jDyZQMk7Jyy7iAxfXX0baMocte +L6LMD1NXXNYwKl4eR2F4wBV+cIdzdbEYiT6LAC1079m8g63sjRy01ffLYt3A+/lmFRL kvvAOAKhq/fkaSJ5SaWkdp711ghwZ5SjeLtDBERLpYq4jAYIWrTlWZZVDHwTHRdzsGpD WZ/CFFORt8RW8NQgaVvI3uKvedxkdInP9CrDKLs3hGeS0dgNp26tSa+ol45VtWntjQFj GvbsphmnmP1e4nWPAinO/nfkJd9Hz1Vq0fcPtOQVxGD9Tyim2nG4jiZiQRxRKFVZIyr3 KzbA== X-Gm-Message-State: AOAM533861uqGFE2hBLRgrw7rUnutfBK/F4RVqPKoYbXZB0yFbwB238Z V8V5LokFZ0rxPx2aIRKHXjaFQSloUDY= X-Received: by 2002:a05:6402:5250:b0:41d:8556:4191 with SMTP id t16-20020a056402525000b0041d85564191mr3586219edd.269.1649949109131; Thu, 14 Apr 2022 08:11:49 -0700 (PDT) Received: from skbuf ([188.26.57.45]) by smtp.gmail.com with ESMTPSA id hx12-20020a170906846c00b006e8ad71c18fsm706995ejc.208.2022.04.14.08.11.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Apr 2022 08:11:48 -0700 (PDT) Date: Thu, 14 Apr 2022 18:11:46 +0300 From: Vladimir Oltean To: =?utf-8?B?Q2zDqW1lbnQgTMOpZ2Vy?= Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S . Miller" , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Geert Uytterhoeven , Magnus Damm , Heiner Kallweit , Russell King , Thomas Petazzoni , Herve Codina , =?utf-8?Q?Miqu=C3=A8l?= Raynal , Milan Stevanovic , Jimmy Lalande , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH net-next 02/12] net: dsa: add Renesas RZ/N1 switch tag driver Message-ID: <20220414151146.a2fncklswo6utiyd@skbuf> References: <20220414122250.158113-1-clement.leger@bootlin.com> <20220414122250.158113-3-clement.leger@bootlin.com> <20220414142242.vsvv3vxexc7i3ukm@skbuf> <20220414163546.3f6c5157@fixe.home> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220414163546.3f6c5157@fixe.home> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 14, 2022 at 04:35:46PM +0200, Cl?ment L?ger wrote: > > Please keep variable declarations sorted in decreasing order of line > > length (applies throughout the patch series, I won't repeat this comment). > > Acked, both PCS and DSA driver are ok with that rule. Missed that one > though. Are you sure? Because a5psw_port_stp_state_set() says otherwise. > > sizeof(tag), to be consistent with the other use of sizeof() above? > > Although, hmm, I think you could get away with editing "ptag" in place. > > I was not sure of the alignment guarantee I would have here. If the > VLAN header is guaranteed to be aligned on 2 bytes, then I guess it's > ok to do that in-place. If I look at Documentation/core-api/unaligned-memory-access.rst | Alignment vs. Networking | ======================== | | On architectures that require aligned loads, networking requires that the IP | header is aligned on a four-byte boundary to optimise the IP stack. For | regular ethernet hardware, the constant NET_IP_ALIGN is used. On most | architectures this constant has the value 2 because the normal ethernet | header is 14 bytes long, so in order to get proper alignment one needs to | DMA to an address which can be expressed as 4*n + 2. One notable exception | here is powerpc which defines NET_IP_ALIGN to 0 because DMA to unaligned | addresses can be very expensive and dwarf the cost of unaligned loads. Your struct a5psw_tag *ptag starts at 10 bytes (8 for tag, 2 for Ethertype) before the IP header, so I'm thinking it is aligned at a 2 byte boundary as well. A VLAN header between the DSA header and the IP header should also not affect that alignment, since its length is 4 bytes. If "ctrl_tag" is aligned at a 4 byte boundary - 10, it means "ctrl_data" is aligned at a 4 byte boundary - 8, so also a 4 byte boundary. But "ctrl_data2" is aligned at a 4 byte boundary + 2, so you might want to break up the u32 access into 2 u16 accesses, just to be on the safe side?