From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 8BA71A00E6 for ; Thu, 16 May 2019 20:04:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AFF965F0F; Thu, 16 May 2019 20:04:13 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id F265C5B38 for ; Thu, 16 May 2019 20:04:12 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 56FFFC074F04; Thu, 16 May 2019 18:04:07 +0000 (UTC) Received: from [10.36.116.124] (ovpn-116-124.ams2.redhat.com [10.36.116.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF46718ADF; Thu, 16 May 2019 18:04:04 +0000 (UTC) To: Bruce Richardson , Olivier Matz , Stephen Hemminger Cc: DPDK Dev List References: <20190516155457.4006-1-bruce.richardson@intel.com> From: Kevin Traynor Message-ID: <0435f920-2ba1-e827-6bf1-96ac81ee9dbc@redhat.com> Date: Thu, 16 May 2019 19:04:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190516155457.4006-1-bruce.richardson@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 16 May 2019 18:04:12 +0000 (UTC) Subject: Re: [dpdk-dev] [PATCH] ether: mark ethernet addresses as being 2-byte aligned X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 16/05/2019 16:54, Bruce Richardson wrote: > When including the rte_ether.h header in applications with warnings > enabled, a warning was given because of the assumption of 2-byte alignment > of ethernet addresses when processing them. > > .../include/rte_ether.h:149:2: warning: converting a packed ‘const > struct ether_addr’ pointer (alignment 1) to a ‘unaligned_uint16_t’ > {aka ‘const short unsigned int’} pointer (alignment 2) may result in > an unaligned pointer value [-Waddress-of-packed-member] > 149 | const unaligned_uint16_t *ea_words = (const unaligned_uint16_t *)ea; > | ^~~~~ > Hi - There was a couple of these warnings in telemetry that were not squashed with the patch to disable the warning in 19.05. I was just about send a patch to address that when I saw this one. As your patch is aiming for a better solution, I won't send my patch for master but I'll still send to stable. > Since ethernet addresses should always be aligned on a two-byte boundary, > we can just inform the compiler of this assumption to remove the warnings > and allow us to always access the addresses using 16-bit operations. > > Signed-off-by: Bruce Richardson > > --- > > Although this is an ABI break, the network structures are all being renamed > in this release, and a deprecation notice was previously posted for it. > --- > lib/librte_net/rte_ether.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h > index 3a87ff184..8090b7c01 100644 > --- a/lib/librte_net/rte_ether.h > +++ b/lib/librte_net/rte_ether.h > @@ -55,7 +55,8 @@ extern "C" { > * See http://standards.ieee.org/regauth/groupmac/tutorial.html > */ > struct ether_addr { > - uint8_t addr_bytes[ETHER_ADDR_LEN]; /**< Addr bytes in tx order */ > + /** Addr bytes in tx order */ > + uint8_t addr_bytes[ETHER_ADDR_LEN] __rte_aligned(2); > } __attribute__((__packed__)); > > #define ETHER_LOCAL_ADMIN_ADDR 0x02 /**< Locally assigned Eth. address. */ >