From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by dpdk.org (Postfix) with ESMTP id 1A49A5B1E for ; Thu, 16 May 2019 00:20:01 +0200 (CEST) Received: by mail-pl1-f195.google.com with SMTP id g5so543578plt.2 for ; Wed, 15 May 2019 15:20:01 -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=ZWNZHay0xN3T3JMmVhQZ41r8L5iCV64FZ7UGs4mBQdk=; b=YrUmEgWaVra5y/1M+QyDIjF2pWc2uUh9la2jmJk181zm57j4HjDUWjZm3IDLY42QT+ w+9qSsvhDKIlG7baXEeLzGeqAPXHe/RumXPLJDC7wgqusTV7HrmKmda3uJJp5dOkbD9U 7g2g6uAuZ2mQblwpB74UJFrg3CwalWGpQ/T7qvIhbIF5nHbf503LzmfWW3IZnHyOutya uBx0COOWNUDXo3SzsqwtPJ4KW28y70xoZzpb6RSpCu6z+b7hAFua5L7inD6iCmk9GVEg q49sgNAhvwASF32vWrIYkh+xu7es2rito61jOM592y3WD0PY0+a09Pls2eoQ2a7IOhm6 KBkA== 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=ZWNZHay0xN3T3JMmVhQZ41r8L5iCV64FZ7UGs4mBQdk=; b=VCt0opPfLdfwcqT7ynMB5KdeRJSxqjDsASrG+I6pIouCEMT8zS76f6Atm06VtYmc+a iuWEvw188ba/k7gc4aLphtpj0zSeKrT98Yin9CGfAVDfv/GsPwmZs0oHB5BWw3K8x+u6 UXXr94K4F2w9x/YSdhJV9Epw7JYOac3aRfis1YC2/ilg0Pixcx2ZKUxpFLXR3Ys4Jo5N bPtOBK4C1aqLo/V9fEPUkxyPDgQa5ZTZbHBbjenBrpWGfYhnipz+SqHYN0P2PfeIxnI8 nTqewRqA9MZTuHndIreU/yfCRvzvtVjemh0gFeK4K2A01ZXfDBfJO0m4FkRW5hN7DKRe 5Ktg== X-Gm-Message-State: APjAAAWQbswO7PND54n6i3NaZtYu1muMUFIe1lXKYrT0OBmpuxcNjjY3 IzcOptTrMLv4BUpCaczcm/TYpU6KAbc= X-Google-Smtp-Source: APXvYqx5AHmyGc8FDiUVXRiQXpUy40FLgR7dno1rU7dLv5bVSn/PPSuyuDVpL0EXkoJ1p2kmsqzx5g== X-Received: by 2002:a17:902:ca:: with SMTP id a68mr21023752pla.7.1557958800345; Wed, 15 May 2019 15:20:00 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id d5sm3549964pgb.33.2019.05.15.15.19.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 May 2019 15:19:59 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Wed, 15 May 2019 15:19:49 -0700 Message-Id: <20190515221952.21959-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190515221952.21959-1-stephen@networkplumber.org> References: <20190515221952.21959-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [RFC 1/4] net/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: , X-List-Received-Date: Wed, 15 May 2019 22:20:02 -0000 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..f68b42cd0e8f 100644 --- a/lib/librte_net/Makefile +++ b/lib/librte_net/Makefile @@ -14,6 +14,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_ether.c SRCS-$(CONFIG_RTE_LIBRTE_NET) += rte_arp.c # install includes 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 3a87ff184900..46d40412763c 100644 --- a/lib/librte_net/rte_ether.h +++ b/lib/librte_net/rte_ether.h @@ -204,15 +204,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. @@ -251,18 +244,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 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 2CFFCA00E6 for ; Thu, 16 May 2019 00:20:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6F7475F1B; Thu, 16 May 2019 00:20:05 +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 1A49A5B1E for ; Thu, 16 May 2019 00:20:01 +0200 (CEST) Received: by mail-pl1-f195.google.com with SMTP id g5so543578plt.2 for ; Wed, 15 May 2019 15:20:01 -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=ZWNZHay0xN3T3JMmVhQZ41r8L5iCV64FZ7UGs4mBQdk=; b=YrUmEgWaVra5y/1M+QyDIjF2pWc2uUh9la2jmJk181zm57j4HjDUWjZm3IDLY42QT+ w+9qSsvhDKIlG7baXEeLzGeqAPXHe/RumXPLJDC7wgqusTV7HrmKmda3uJJp5dOkbD9U 7g2g6uAuZ2mQblwpB74UJFrg3CwalWGpQ/T7qvIhbIF5nHbf503LzmfWW3IZnHyOutya uBx0COOWNUDXo3SzsqwtPJ4KW28y70xoZzpb6RSpCu6z+b7hAFua5L7inD6iCmk9GVEg q49sgNAhvwASF32vWrIYkh+xu7es2rito61jOM592y3WD0PY0+a09Pls2eoQ2a7IOhm6 KBkA== 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=ZWNZHay0xN3T3JMmVhQZ41r8L5iCV64FZ7UGs4mBQdk=; b=VCt0opPfLdfwcqT7ynMB5KdeRJSxqjDsASrG+I6pIouCEMT8zS76f6Atm06VtYmc+a iuWEvw188ba/k7gc4aLphtpj0zSeKrT98Yin9CGfAVDfv/GsPwmZs0oHB5BWw3K8x+u6 UXXr94K4F2w9x/YSdhJV9Epw7JYOac3aRfis1YC2/ilg0Pixcx2ZKUxpFLXR3Ys4Jo5N bPtOBK4C1aqLo/V9fEPUkxyPDgQa5ZTZbHBbjenBrpWGfYhnipz+SqHYN0P2PfeIxnI8 nTqewRqA9MZTuHndIreU/yfCRvzvtVjemh0gFeK4K2A01ZXfDBfJO0m4FkRW5hN7DKRe 5Ktg== X-Gm-Message-State: APjAAAWQbswO7PND54n6i3NaZtYu1muMUFIe1lXKYrT0OBmpuxcNjjY3 IzcOptTrMLv4BUpCaczcm/TYpU6KAbc= X-Google-Smtp-Source: APXvYqx5AHmyGc8FDiUVXRiQXpUy40FLgR7dno1rU7dLv5bVSn/PPSuyuDVpL0EXkoJ1p2kmsqzx5g== X-Received: by 2002:a17:902:ca:: with SMTP id a68mr21023752pla.7.1557958800345; Wed, 15 May 2019 15:20:00 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id d5sm3549964pgb.33.2019.05.15.15.19.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 May 2019 15:19:59 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Wed, 15 May 2019 15:19:49 -0700 Message-Id: <20190515221952.21959-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190515221952.21959-1-stephen@networkplumber.org> References: <20190515221952.21959-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [RFC 1/4] net/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" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190515221949.GT3nQpdJ_CS1bs-VpRSYGyo6k6qClxxCRLDDi19tbcc@z> 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..f68b42cd0e8f 100644 --- a/lib/librte_net/Makefile +++ b/lib/librte_net/Makefile @@ -14,6 +14,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_ether.c SRCS-$(CONFIG_RTE_LIBRTE_NET) += rte_arp.c # install includes 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 3a87ff184900..46d40412763c 100644 --- a/lib/librte_net/rte_ether.h +++ b/lib/librte_net/rte_ether.h @@ -204,15 +204,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. @@ -251,18 +244,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