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 872BEA00E6 for ; Thu, 16 May 2019 22:40:11 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5C3D65920; Thu, 16 May 2019 22:40:11 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id C82BA58EC for ; Thu, 16 May 2019 22:40:09 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 May 2019 13:40:08 -0700 X-ExtLoop1: 1 Received: from bricha3-mobl.ger.corp.intel.com ([10.252.2.218]) by orsmga007.jf.intel.com with SMTP; 16 May 2019 13:40:06 -0700 Received: by (sSMTP sendmail emulation); Thu, 16 May 2019 21:40:05 +0100 Date: Thu, 16 May 2019 21:40:05 +0100 From: Bruce Richardson To: Stephen Hemminger Cc: dev@dpdk.org Message-ID: <20190516204005.GD642@bricha3-MOBL.ger.corp.intel.com> References: <20190516180427.17270-1-stephen@networkplumber.org> <20190516180427.17270-3-stephen@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190516180427.17270-3-stephen@networkplumber.org> User-Agent: Mutt/1.11.4 (2019-03-13) Subject: Re: [dpdk-dev] [PATCH v2 2/7] ether: do not mark ethernet address and header as packed 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 Thu, May 16, 2019 at 11:04:22AM -0700, Stephen Hemminger wrote: > Since the Ethernet address and header are naturally aligned > correctly on all architectures, there is no need to mark them > as packed. This results in faster code, and also gets rid of > warnings with gcc-9 about getting address of packed structure. > > Suggested-by: Bruce Richardson > Signed-off-by: Stephen Hemminger > --- > lib/librte_net/rte_ether.h | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h > index ac8897681aca..0954d183cca7 100644 > --- a/lib/librte_net/rte_ether.h > +++ b/lib/librte_net/rte_ether.h > @@ -57,7 +57,7 @@ extern "C" { > struct ether_addr { > /** 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. */ > #define ETHER_GROUP_ADDR 0x01 /**< Multicast or broadcast Eth. address. */ > @@ -273,7 +273,7 @@ struct ether_hdr { > struct ether_addr d_addr; /**< Destination address. */ > struct ether_addr s_addr; /**< Source address. */ > uint16_t ether_type; /**< Frame type. */ > -} __attribute__((__packed__)); > +}; > > /** > * Ethernet VLAN Header. > @@ -283,7 +283,7 @@ struct ether_hdr { > struct vlan_hdr { > uint16_t vlan_tci; /**< Priority (3) + CFI (1) + Identifier Code (12) */ > uint16_t eth_proto;/**< Ethernet type of encapsulated frame. */ > -} __attribute__((__packed__)); > +}; > > /** > * VXLAN protocol header. > @@ -293,7 +293,7 @@ struct vlan_hdr { > struct vxlan_hdr { > uint32_t vx_flags; /**< flag (8) + Reserved (24). */ > uint32_t vx_vni; /**< VNI (24) + Reserved (8). */ > -} __attribute__((__packed__)); > +}; > > /* Ethernet frame types */ > #define ETHER_TYPE_IPv4 0x0800 /**< IPv4 Protocol. */ > @@ -325,7 +325,7 @@ struct vxlan_gpe_hdr { > uint8_t reserved[2]; /**< Reserved (16). */ > uint8_t proto; /**< next-protocol (8). */ > uint32_t vx_vni; /**< VNI (24) + Reserved (8). */ > -} __attribute__((__packed__)); > +}; > Are we sure that these last two structures are always 4-byte aligned in packets? > /* VXLAN-GPE next protocol types */ > #define VXLAN_GPE_TYPE_IPV4 1 /**< IPv4 Protocol. */ > -- > 2.20.1 >