From patchwork Thu May 16 18:04:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 53492 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6538CD19B; Thu, 16 May 2019 20:04:42 +0200 (CEST) Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by dpdk.org (Postfix) with ESMTP id 353F1D179 for ; Thu, 16 May 2019 20:04:39 +0200 (CEST) Received: by mail-pl1-f195.google.com with SMTP id n8so1986362plp.10 for ; Thu, 16 May 2019 11:04:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xtG/KhRwgWU2q8q7xbdYkEYheQnNyyATaCzY3kytBOc=; b=HJ4BP8DbGCxNOUoK1Flu8RK4k0NSOfYk48qBrqe6yUT/OVCKQPk4fec/rQOYB28Tpn I88lfFILNEoqvcpKWVK/diRBlVZTk+5ixXA+TRHRGEaaFttWOdT/LfxmhHZPgZtwfIJw laNJvffgFOSaShxwCA3QRkhoQ9YB1tJPdcwSUbcbf+0zhcTGUc0JYAVj4awNLOcTtCEP tfHl3xjdystpJYfvWM6MXQ0x1UTtHf8tbk875NGuptj9x9vEqSqEzTG91P/SIXOH7+iI +UBLhfvCdHn6cbp8BWatnfYspZEjB+ilDRdVNApouz0ZhQnurFIe4O+mX0BkPSmrQq1W f2Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xtG/KhRwgWU2q8q7xbdYkEYheQnNyyATaCzY3kytBOc=; b=Z6/nt6HloGzqEqN9dKbmZk/fBzNb0b0okn2XtPzcfQU4pGN/GhbQBBRs1YOWG/3A+I 4HA1lujnJbWG5U0wXRL0hsiCKbeO457OFrbpF1/xiYuPFW7cWmHTgfCl+BR3HoL7Jsbr mhh3RSsylYadeddt4A+76US0+Ysf1IfKmJPZoGe58V86nc5MMX0DS1CpRxIHGqut193e twJVpDiBpxZ6NdXrOjKVR5z2H3HV5fM2BTW4dm3fNTiADuNWO+iLuUay5VdOLB6LC6yQ Wo0KIF5CZErV/cMnTIMQkNsjG8VTq6rdDzE9qFdK00bEzDMPUnMviBYFK114URrOvS9k Vvuw== X-Gm-Message-State: APjAAAVd2JM4TU4Mx5C7mXYSMYPztNQgmUKUPwzPYdpmMr4twb3xrYYh btj6ZKujF/w97yNwON+YwgQ/OsCZM7w= X-Google-Smtp-Source: APXvYqwOrPoB5RQHdwwG5Z6ZSsq5KcMmkD/oWJsGQ26rGlrE6/Qam0Cn3ugBhynXc96gn2fB6EaGDg== X-Received: by 2002:a17:902:8f98:: with SMTP id z24mr40140278plo.101.1558029878153; Thu, 16 May 2019 11:04:38 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id d67sm9376657pfa.35.2019.05.16.11.04.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 May 2019 11:04:37 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Bruce Richardson Date: Thu, 16 May 2019 11:04:22 -0700 Message-Id: <20190516180427.17270-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190516180427.17270-1-stephen@networkplumber.org> References: <20190516180427.17270-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [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" 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__)); +}; /* VXLAN-GPE next protocol types */ #define VXLAN_GPE_TYPE_IPV4 1 /**< IPv4 Protocol. */