Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3210839pxb; Fri, 5 Nov 2021 11:36:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0FREzeYcA9+gxKxjLYJ0pl9/zixnv8q/DgOP+oSRWUOgZ8ZGH+C/HEhqo2hUaN+SsKJIF X-Received: by 2002:a92:c051:: with SMTP id o17mr42106833ilf.276.1636137391790; Fri, 05 Nov 2021 11:36:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636137391; cv=none; d=google.com; s=arc-20160816; b=WdM/b/evcp8oSNUjESrTzicV8oSn3O/u4v8ZMe9SfAXwhNETx6xfNVKwRPIPSVvSEb H8kypQ71SN6155ynttesFLeHppyTcXopxTQVfK+F0MrE7BR1867v13hxWny5pj60Tvfn ZrQZGblxNVm8M2iO98ruT8ZA9W5lxVPZq+OhqlLj1RZuu3USabuA550+sjPC/UJ1obI+ M9r6+Tty06GWs+vNX8dhHJxxciRN2YBP4KYTfO9QwWyz1aZfS+7bwbXbBsSE0NSejwJw quntS1EdecDTB5Qsw3xq03wmIXHGb8MqH8zy+Qk1Ualtb2pl+aKTP0ynLMRa4zqyJLg/ hscw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=gIDtt6XBpfnPE3TLrNFhrgxvibCLDMzaf3e/LV3rvU0=; b=n6rJz419SyeDl5a/qNlRPeYI3wRjhUU2BL5yo/+nGOVXXuj1i85kcj5TDcji+4LYC+ e+FvOWKKhACHjVBDsbi0Je0dX1VHcVTXAWRfsZTyPJSI/QAetftCNzwrJa/q033xdSXr ISb2mkje71DTw7YVsC3trluS0nCcf7oRSoXmjJVdDJdKZosZDIQXO98HD9VrLuQk4CTK ZsnnU8ubEIKRMGbc05yryjtZw1YDEzvBjAYvuxgcJzHBzwF0Vu2Nx0AyHHOvL1nvpjaG dO/9d3U/ERvYe1gLY7efWU7FYRLgy2v2GPidntKDobOdFev6CwJ9T4qIRZHaw88klBGE vO7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y9si9297108ilv.58.2021.11.05.11.36.18; Fri, 05 Nov 2021 11:36:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234122AbhKEQ7B (ORCPT + 99 others); Fri, 5 Nov 2021 12:59:01 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:49055 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233696AbhKEQ7A (ORCPT ); Fri, 5 Nov 2021 12:59:00 -0400 Received: from mail-wm1-f47.google.com ([209.85.128.47]) by mrelayeu.kundenserver.de (mreue106 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MLyzP-1n0IPi2EGv-00HzgQ; Fri, 05 Nov 2021 17:56:19 +0100 Received: by mail-wm1-f47.google.com with SMTP id c71-20020a1c9a4a000000b0032cdcc8cbafso6864625wme.3; Fri, 05 Nov 2021 09:56:19 -0700 (PDT) X-Gm-Message-State: AOAM5319JCfb4P8VkkKMswy7LLSqENZ5/ldZ/YtndskEazxlPcOrxWGb YKXi7B1eBMEojmLQ3YStQAEvMpSHhVfsskPhrA8= X-Received: by 2002:a1c:1c1:: with SMTP id 184mr31696130wmb.1.1636131379131; Fri, 05 Nov 2021 09:56:19 -0700 (PDT) MIME-Version: 1.0 References: <1636031398-19867-1-git-send-email-volodymyr.mytnyk@plvision.eu> In-Reply-To: From: Arnd Bergmann Date: Fri, 5 Nov 2021 17:56:03 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH net v3] net: marvell: prestera: fix hw structure laid out To: "Volodymyr Mytnyk [C]" Cc: Arnd Bergmann , Networking , Taras Chornyi , Mickey Rachamim , Serhiy Pshyk , Andrew Lunn , Geert Uytterhoeven , Denis Kirjanov , "Taras Chornyi [C]" , "David S. Miller" , Jakub Kicinski , "Vadym Kochan [C]" , Yevhen Orlov , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:BMDUplX6zSp/RXl9H0Byv+lBATiOD+qjYj5165qj18rJrLYvHFC c3NiRKl43rTH8+baG2LUzJKzoafCxcN7QdShVto9m7MYHsB/kOyNCFen9N2qI2tw7yfCXO+ ni2/EjYW7rTdZI5E9H8JWOcK/6GUY7bQCb2vX/uPg6cgbvib1LzYgFHx1S5nLXEZSnwxK07 k+ryvd5mUCwmsxb9iKG5Q== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:I43aGbWE+m0=:GuxhiSs19Z0+QfB9k9dfpL UOJ9bVlRIkafqa2tgxeioqOozCUzO2mehf7RhqlEygx5FfkR8Cnc963Iz19BpK28R9RvUhhnb 5lI6m0x+8bM8bfGnlvSuwABEQGAbpuCdYgRhxfwpqNje707QbwWJrcpVtM1TOcL6HZ3pe3Y3m L04+/8RsRpONmSOgCs7liZMK6EWx/yqJhwcNadQQq46NXyOl5E9rBes7YQu611dNkISx147oO RhJYqrVKfQ82fpLyf46xdBpUEXkwQ+kSRD2+MzRC8cEEHJhSOZwxzs6xvtyg4rRc0mq2R23ol VXCS8x+A3jEow6SPYfauVpMEE1hOhFg3JqXy1utLyVvljQ+89Pqk9hgr/FtoxNMRqfQJG2K8w JWSgJy+9gRADgFtHJ8h++S9B/QQiPXTOnFB13Mj/su/voyWHnAVQMasncFm47qtrgUReUt3gp FEOHOImHC8leoP0VWeWpRc/V+WZqf1wAPLXmTohnsAFv7FYGm177nimT72f8l4bpXjiTSwHv6 loBRXqCaCkd8vP5lt4Ekr3jM7BtSS11aLgkuei769MxguRQWDAafDTSLayansCd2n6nSn6iGm ZOYrHc98ynqvk3h1Zfdln70OfRljVy34knrdheB7s4VjXW+qE1BmTXGT2WbvSdvOZOCLmXSTn qrA3i8vM/gu64IoSbSiYA5Cy9IP2Axwg7LTEnsvaLnIAnUtYmZlYMgB3BgvLgGWzoUJDktGHC 8x3mgOqQHFEdD8LtEOE+cf1ZxpysczKx9AfiJdk0/S+rw80vR1sPP+YFPg9+72JPI9Pdp3g0u mGm2BKEuVNNNA9Vwhz50l8qHRpiD8WIuyWXIFyVO4WZhKtD8l4= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 5, 2021 at 5:33 PM Volodymyr Mytnyk [C] wrote: > > > > However, there is still this structure that lacks explicit padding: > > > > struct prestera_msg_acl_match { > > __le32 type; > > /* there is a four-byte hole on most architectures, but not on > > x86-32 or m68k */ > > Checked holes on x86_64 with pahole, and there is no holes. Maybe on some > other there will be. Will add 4byte member here to make sure. Thx. That is very strange, as the union has an __le64 member that should be 64-bit aligned on x86_64. > > > > struct prestera_msg_event_port_param { > > union { > > struct { > > __le32 mode; > > __le32 speed; > > u8 oper; > > u8 duplex; > > u8 fc; > > u8 fec; > > } mac; > > struct { > > __le64 lmode_bmap; > > u8 mdix; > > u8 fc; > > u8 __pad[2]; > > } __packed phy; > > } __packed; > > } __packed; > > > > There is no need to make the outer aggregates __packed, I would > > mark only the innermost ones here: mode, speed and lmode_bmap. > > Same for prestera_msg_port_cap_param and prestera_msg_port_param. > > > > Will add __packed only to innermost ones. Looks like only phy is required to have __packed. I think you need it on both lmode_bmap and mode/speed to get a completely unaligned structure. If you mark phy as __packed, that will implicitly mark lmode_bmap as packed but leave the four-byte alignment on mode and speed, so the entire structure is still four-byte aligned. Arnd