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 CF67CA00E6 for ; Thu, 16 May 2019 20:05:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CD86EE3EE; Thu, 16 May 2019 20:04:44 +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 6717B5F1B for ; Thu, 16 May 2019 20:04:40 +0200 (CEST) Received: by mail-pl1-f195.google.com with SMTP id g5so2011031plt.2 for ; Thu, 16 May 2019 11:04:40 -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=bfKwk9SuRceosz3HZshOVoHB2uA66ZXDogeYFXaBmdw=; b=TL1rSHStFitGmY4eGTq+3c3Od0MKgm9dHErUlN0ywd3wWjG4GZLn9zJjk1LuL25ry+ X3tsaO6bQUS7O2TllpAkGRNB5i71hm+jXerU2U8b41GsMm9N6vnXZf0J/85eCSCfnLVr GruQ5HGl5wwbegExQ1gTJJal1cqGhi+bOK/dFfpyjO91I9A/FQ7Hl2ary2iRS84oriPZ r/2FE3YwU9IfL3cimhY/es6W3l2CauJ3PVQIkjVjx50cVU76gbUUZ2clVLeSGl5q3zX1 okjDk6VU4s3ozhq0q3sP1PhcsEe32o7yD1M0rPXUS3VRPaJdjUkY1VVfEyIKZELTYy4s DqYg== 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=bfKwk9SuRceosz3HZshOVoHB2uA66ZXDogeYFXaBmdw=; b=W8N986OTBuQeNt4o0xMqKGPqWoYBSI8yAKPTFRUdrvtieCePRtnd80+klxdvgmTi6P mNE/HZEqaSUDnhX7scxK/HEnjVPDKlu9tYLdXIOdKXeE6H3+BAXWjvm9/8ZCbhzqUMqm I8tpOuv9iicKSQ/vTlOAfiOk6SEOlDVzoVeA2pUrD3mReC5jyjJB7cj4s08mnz/ThUu8 rmcbpD5iPTG2u4t4Y5gkQ/2rBDb+WkWA/6jgzT6lCAPaS8nfoQSafIYWH2IExBmKyTGo uQ+1OLX4WYFlCEzzg+52oSRB3WdKV7ALkca3HDjf7oDEGUnvHW7BONcpHpRx96TH/eCq kNzg== X-Gm-Message-State: APjAAAWCjYch0ldR93AUFGcU3I3hQx2TTxRunamm8tdnzqxuMb0EfVro kqpAO9EPyjhIRYfDKm73wP70GPh5dqs= X-Google-Smtp-Source: APXvYqz1nZn8URdIpKu6pm/hVGQnn3OeRR+yfuIjKY3bou6saISp5vg1aOLK+ew2oKlruxBxkwNyzw== X-Received: by 2002:a17:902:163:: with SMTP id 90mr52677575plb.212.1558029879359; Thu, 16 May 2019 11:04:39 -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.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 May 2019 11:04:38 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Thu, 16 May 2019 11:04:23 -0700 Message-Id: <20190516180427.17270-4-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 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 3/7] ether: deinline non-critical functions 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" Formatting ethernet address and getting a random value are not in critical path so they should not be inlined. Signed-off-by: Stephen Hemminger --- lib/librte_net/Makefile | 1 + lib/librte_net/rte_ether.c | 29 +++++++++++++++++++++++++++++ lib/librte_net/rte_ether.h | 24 ++++-------------------- lib/librte_net/rte_net_version.map | 8 ++++++++ 4 files changed, 42 insertions(+), 20 deletions(-) create mode 100644 lib/librte_net/rte_ether.c diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile index c3082069ab50..b4900b44f4d0 100644 --- a/lib/librte_net/Makefile +++ b/lib/librte_net/Makefile @@ -15,6 +15,7 @@ LIBABIVER := 1 SRCS-$(CONFIG_RTE_LIBRTE_NET) := rte_net.c SRCS-$(CONFIG_RTE_LIBRTE_NET) += rte_net_crc.c SRCS-$(CONFIG_RTE_LIBRTE_NET) += rte_arp.c +SRCS-$(CONFIG_RTE_LIBRTE_NET) += rte_ether.c # install includes SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h rte_esp.h diff --git a/lib/librte_net/rte_ether.c b/lib/librte_net/rte_ether.c new file mode 100644 index 000000000000..d4b41f122a16 --- /dev/null +++ b/lib/librte_net/rte_ether.c @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation + */ + +#include + +void +eth_random_addr(uint8_t *addr) +{ + uint64_t rand = rte_rand(); + uint8_t *p = (uint8_t *)&rand; + + rte_memcpy(addr, p, ETHER_ADDR_LEN); + addr[0] &= (uint8_t)~ETHER_GROUP_ADDR; /* clear multicast bit */ + addr[0] |= ETHER_LOCAL_ADMIN_ADDR; /* set local assignment bit */ +} + +void +ether_format_addr(char *buf, uint16_t size, + const struct ether_addr *eth_addr) +{ + snprintf(buf, size, "%02X:%02X:%02X:%02X:%02X:%02X", + eth_addr->addr_bytes[0], + eth_addr->addr_bytes[1], + eth_addr->addr_bytes[2], + eth_addr->addr_bytes[3], + eth_addr->addr_bytes[4], + eth_addr->addr_bytes[5]); +} diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h index 0954d183cca7..ed178a1f1736 100644 --- a/lib/librte_net/rte_ether.h +++ b/lib/librte_net/rte_ether.h @@ -205,15 +205,8 @@ static inline int is_valid_assigned_ether_addr(const struct ether_addr *ea) * @param addr * A pointer to Ethernet address. */ -static inline void eth_random_addr(uint8_t *addr) -{ - uint64_t rand = rte_rand(); - uint8_t *p = (uint8_t *)&rand; - - rte_memcpy(addr, p, ETHER_ADDR_LEN); - addr[0] &= (uint8_t)~ETHER_GROUP_ADDR; /* clear multicast bit */ - addr[0] |= ETHER_LOCAL_ADMIN_ADDR; /* set local assignment bit */ -} +void +eth_random_addr(uint8_t *addr); /** * Fast copy an Ethernet address. @@ -252,18 +245,9 @@ static inline void ether_addr_copy(const struct ether_addr *ea_from, * @param eth_addr * A pointer to a ether_addr structure. */ -static inline void +void ether_format_addr(char *buf, uint16_t size, - const struct ether_addr *eth_addr) -{ - snprintf(buf, size, "%02X:%02X:%02X:%02X:%02X:%02X", - eth_addr->addr_bytes[0], - eth_addr->addr_bytes[1], - eth_addr->addr_bytes[2], - eth_addr->addr_bytes[3], - eth_addr->addr_bytes[4], - eth_addr->addr_bytes[5]); -} + const struct ether_addr *eth_addr); /** * Ethernet header: Contains the destination address, source address diff --git a/lib/librte_net/rte_net_version.map b/lib/librte_net/rte_net_version.map index 26c06e7c7ae7..49d34093781c 100644 --- a/lib/librte_net/rte_net_version.map +++ b/lib/librte_net/rte_net_version.map @@ -13,6 +13,14 @@ DPDK_17.05 { } DPDK_16.11; +DPDK_19.08 { + global: + + eth_random_addr; + eth_format_addr; +} DPDK_17.05; + + EXPERIMENTAL { global: -- 2.20.1