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 4A7F8A00E6 for ; Fri, 17 May 2019 01:17:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 79C204CAB; Fri, 17 May 2019 01:17:45 +0200 (CEST) Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by dpdk.org (Postfix) with ESMTP id 41B3E397D for ; Fri, 17 May 2019 01:17:44 +0200 (CEST) Received: by mail-pg1-f193.google.com with SMTP id e6so2297990pgc.4 for ; Thu, 16 May 2019 16:17:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cpkvNhap6VEFzKERn9k2UBLqeN1MfnsRNGyFS/4bGuU=; b=TogTK1PjCPMiKvJF8vceNYB2QGHoxyPZEEbjoRyyadWMg1VJqLQSJbWVhyva50mOG0 90s2j8nJATSn5Jk//z9wSMu1TdWEfYADqHojK4wpCgK5iNtpluqrP7UshYOKip9zSPIV I47gFUBzagkJ9TeOpxEcn0rWRZ1/G9ZXZ/KNTNLkRrxDiDfuKf+conewRc/fI+lUeEwY omDgR99PmXqhiSRZl1zKfZ8QSflkrvPGBDitSZIcw1acGTXS9lMZH7OogAhm7mlnDYcL m1uX90wPOZgkDmPt0bY3hMjxNrePzUMAQMDxPW103+wg+wNRwQnLU4BNGavRXoCRdj5N mFPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cpkvNhap6VEFzKERn9k2UBLqeN1MfnsRNGyFS/4bGuU=; b=LtzDGZdeBL+G+VR5r8VmzUu6f9GgwfFJyBu6GOzg/Do0ijz6jmi7ftHYi4or715Uth wbHVDNnVq1GJfmFS2s38+ZFb7z0KhQxSw7D5CMHBBqyasW8xT1oI104w8z880jXWmFFG dxjsXoLVzCv5jvACRA36EtzR49t1gD8VjHJY0ME7vuG6eMHLSAAkeQ+4elpss1fz9vkk Nl40HyfTp9LwlNQWPidvmzriguTvEFCkBb5wJMs0M11yUAtz5vwZJYGFgWM6E1l6wcFT sHox1Doewxmh44r60vR62Q5O21yEuhMc0u+T9FbC7Q3VtgM2doNeBUt7lmaIATLiyPha uLaQ== X-Gm-Message-State: APjAAAW8PtCt1kZve1CTOw3NMVpTRBH5w8wBm+u/irxi+D+WaUmwkLCn qpQ7Qm0bJHxpg8zn91OHDXixyw== X-Google-Smtp-Source: APXvYqxfrj3VUJmAX9DyJAn04MoAJHPMykVYNmun257ee5YUnuTJkmhcBCmkoH5Z754pvCKsVWYzRg== X-Received: by 2002:a63:2d87:: with SMTP id t129mr53223037pgt.451.1558048663254; Thu, 16 May 2019 16:17:43 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id x16sm7451758pff.30.2019.05.16.16.17.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 16 May 2019 16:17:43 -0700 (PDT) Date: Thu, 16 May 2019 16:17:35 -0700 From: Stephen Hemminger To: Bruce Richardson Cc: dev@dpdk.org Message-ID: <20190516161735.29d95e6e@hermes.lan> In-Reply-To: <20190516204005.GD642@bricha3-MOBL.ger.corp.intel.com> References: <20190516180427.17270-1-stephen@networkplumber.org> <20190516180427.17270-3-stephen@networkplumber.org> <20190516204005.GD642@bricha3-MOBL.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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, 16 May 2019 21:40:05 +0100 Bruce Richardson wrote: > 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? That is a general issue of unaligned IP header problem. Really we should be doing a combination of packed and 2 byte alignment. I will drop the Vxlan and NVGre ones