From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id BF4F8A0487 for ; Mon, 1 Jul 2019 15:39:15 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 73B651B9B5; Mon, 1 Jul 2019 15:39:15 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 9B4701B9B0 for ; Mon, 1 Jul 2019 15:39:13 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Jul 2019 06:38:47 -0700 X-IronPort-AV: E=Sophos;i="5.63,439,1557212400"; d="scan'208";a="246920986" Received: from bricha3-mobl.ger.corp.intel.com ([10.237.221.51]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Jul 2019 06:38:46 -0700 Date: Mon, 1 Jul 2019 14:38:43 +0100 From: Bruce Richardson To: Olivier Matz Cc: Stephen Hemminger , DPDK Dev List Message-ID: <20190701133843.GC380@bricha3-MOBL.ger.corp.intel.com> References: <20190516155457.4006-1-bruce.richardson@intel.com> <20190701131112.kdz3koexxyou466k@platinum> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190701131112.kdz3koexxyou466k@platinum> User-Agent: Mutt/1.11.4 (2019-03-13) 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 Mon, Jul 01, 2019 at 03:11:12PM +0200, Olivier Matz wrote: > Hi Bruce, > > On Thu, May 16, 2019 at 04:54:57PM +0100, 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; > > | ^~~~~ > > > > Since ethernet addresses should always be aligned on a two-byte boundary, > > I'm a bit reserved about this last assumption. The ethernet address > structure may be used in a private structure, whose alignment is 1. Are > we sure that there is no (funny) protocol that carries unaligned > ethernet addresses? > > Shouldn't we change the definition of unaligned_uint16_t instead? > Or change the rte_is_broadcast_ether_addr() function? > We could, but I believe the correct behaviour is to make the addresses always 2-byte aligned, unless someone actually has a real-world case where there is a protocol that doesn't have the data 2-byte aligned. /Bruce