DPDK patches and discussions
 help / color / mirror / Atom feed
From: Olivier Matz <olivier.matz@6wind.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: dev@dpdk.org, Rami Rosen <ramirose@gmail.com>,
	Andrew Rybchenko <arybchenko@solarflare.com>
Subject: Re: [dpdk-dev] [PATCH v5 1/8] net/rte_ether: deinline non-critical functions
Date: Tue, 2 Jul 2019 09:56:40 +0200	[thread overview]
Message-ID: <20190702075640.2vnyiyy2gjoh5buf@platinum> (raw)
In-Reply-To: <20190624204435.29452-2-stephen@networkplumber.org>

Hi Stephen,

On Mon, Jun 24, 2019 at 01:44:28PM -0700, Stephen Hemminger wrote:
> Formatting Ethernet address and getting a random value are
> not in critical path so they should not be inlined.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> Acked-by: Rami Rosen <ramirose@gmail.com>
> Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
> ---
>  lib/librte_net/Makefile            |  1 +
>  lib/librte_net/meson.build         |  2 +-
>  lib/librte_net/rte_ether.c         | 29 +++++++++++++++++++++++++++++
>  lib/librte_net/rte_ether.h         | 25 ++++---------------------
>  lib/librte_net/rte_net_version.map |  7 +++++++
>  5 files changed, 42 insertions(+), 22 deletions(-)
>  create mode 100644 lib/librte_net/rte_ether.c
> 
> diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile
> index c3082069ab50..1244c9fd54c9 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/meson.build b/lib/librte_net/meson.build
> index 7d66f693cbf3..868a93fd6b6b 100644
> --- a/lib/librte_net/meson.build
> +++ b/lib/librte_net/meson.build
> @@ -16,5 +16,5 @@ headers = files('rte_ip.h',
>  	'rte_net_crc.h',
>  	'rte_mpls.h')
>  
> -sources = files('rte_arp.c', 'rte_net.c', 'rte_net_crc.c')
> +sources = files('rte_arp.c', 'rte_ether.c', 'rte_net.c', 'rte_net_crc.c')
>  deps += ['mbuf']
> diff --git a/lib/librte_net/rte_ether.c b/lib/librte_net/rte_ether.c
> new file mode 100644
> index 000000000000..974fe815b335
> --- /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 <rte_ether.h>
> +
> +void
> +rte_eth_random_addr(uint8_t *addr)
> +{
> +	uint64_t rand = rte_rand();
> +	uint8_t *p = (uint8_t *)&rand;
> +
> +	rte_memcpy(addr, p, RTE_ETHER_ADDR_LEN);
> +	addr[0] &= (uint8_t)~RTE_ETHER_GROUP_ADDR;	/* clear multicast bit */
> +	addr[0] |= RTE_ETHER_LOCAL_ADMIN_ADDR;	/* set local assignment bit */
> +}
> +
> +void
> +rte_ether_format_addr(char *buf, uint16_t size,
> +		      const struct rte_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 7be9b4890af7..3caae0d98f6d 100644
> --- a/lib/librte_net/rte_ether.h
> +++ b/lib/librte_net/rte_ether.h
> @@ -207,15 +207,8 @@ static inline int rte_is_valid_assigned_ether_addr(const struct rte_ether_addr *
>   * @param addr
>   *   A pointer to Ethernet address.
>   */
> -static inline void rte_eth_random_addr(uint8_t *addr)
> -{
> -	uint64_t rand = rte_rand();
> -	uint8_t *p = (uint8_t *)&rand;
> -
> -	rte_memcpy(addr, p, RTE_ETHER_ADDR_LEN);
> -	addr[0] &= (uint8_t)~RTE_ETHER_GROUP_ADDR;  /* clear multicast bit */
> -	addr[0] |= RTE_ETHER_LOCAL_ADMIN_ADDR;  /* set local assignment bit */
> -}
> +void
> +rte_eth_random_addr(uint8_t *addr);
>  
>  /**
>   * Fast copy an Ethernet address.
> @@ -254,19 +247,9 @@ static inline void rte_ether_addr_copy(const struct rte_ether_addr *ea_from,
>   * @param eth_addr
>   *   A pointer to a ether_addr structure.
>   */
> -static inline void
> +void
>  rte_ether_format_addr(char *buf, uint16_t size,
> -		  const struct rte_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 rte_ether_addr *eth_addr);
>  /**
>   * Ethernet header: Contains the destination address, source address
>   * and frame type.
> diff --git a/lib/librte_net/rte_net_version.map b/lib/librte_net/rte_net_version.map
> index 26c06e7c7ae7..f1e1b84ab491 100644
> --- a/lib/librte_net/rte_net_version.map
> +++ b/lib/librte_net/rte_net_version.map
> @@ -13,6 +13,13 @@ DPDK_17.05 {
>  
>  } DPDK_16.11;
>  
> +DPDK_19.08 {
> +	global:
> +
> +	rte_eth_random_addr;
> +	rte_ether_format_addr;
> +} DPDK_17.05;
> +
>  EXPERIMENTAL {
>  	global:
>  
> -- 
> 2.20.1
> 

In drivers/net/memif and drivers/net/axgbe, rte_ether_format_addr() is
used, but -lrte_net is not passed to LDLIBS in the Makefile. This was
probably ok before because it was an inline function, but I wonder if
it shouldn't be added in this patch.

  reply	other threads:[~2019-07-02  7:56 UTC|newest]

Thread overview: 127+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-16 18:04 [dpdk-dev] [PATCH v2 0/7] ether: improvements and optimizations Stephen Hemminger
2019-05-16 18:04 ` [dpdk-dev] [PATCH v2 1/7] ether: mark ethernet addresses as being 2-byte aligned Stephen Hemminger
2019-05-16 18:04 ` [dpdk-dev] [PATCH v2 2/7] ether: do not mark ethernet address and header as packed Stephen Hemminger
2019-05-16 20:40   ` Bruce Richardson
2019-05-16 23:17     ` Stephen Hemminger
2019-05-16 18:04 ` [dpdk-dev] [PATCH v2 3/7] ether: deinline non-critical functions Stephen Hemminger
2019-05-16 18:29   ` Rami Rosen
2019-05-17  7:08   ` David Marchand
2019-05-16 18:04 ` [dpdk-dev] [PATCH v2 4/7] ether: add eth_unformat_addr Stephen Hemminger
2019-05-17  7:08   ` David Marchand
2019-05-16 18:04 ` [dpdk-dev] [PATCH v2 5/7] ethdev: use eth_unformat_addr Stephen Hemminger
2019-05-16 18:04 ` [dpdk-dev] [PATCH v2 6/7] ether: use bitops to speedup comparison Stephen Hemminger
2019-05-16 18:04 ` [dpdk-dev] [PATCH v2 7/7] cmdline: use ether_unformat_addr Stephen Hemminger
2019-06-05  1:08 ` [dpdk-dev] [PATCH v3 0/6] net/ether: improvements and optimizations Stephen Hemminger
2019-06-05  1:08   ` [dpdk-dev] [PATCH v3 1/6] net/rte_ether: deinline non-critical functions Stephen Hemminger
2019-06-05  8:44     ` Andrew Rybchenko
2019-06-05 16:29       ` Stephen Hemminger
2019-06-05  1:08   ` [dpdk-dev] [PATCH v3 2/6] net/ether: add rte_eth_unformat_addr Stephen Hemminger
2019-06-05  8:55     ` Andrew Rybchenko
2019-06-05 16:31       ` Stephen Hemminger
2019-06-05  1:08   ` [dpdk-dev] [PATCH v3 3/6] ethdev: use rte_eth_unformat_addr Stephen Hemminger
2019-06-05  8:59     ` Andrew Rybchenko
2019-06-05 15:02       ` Stephen Hemminger
2019-06-05 16:33       ` Stephen Hemminger
2019-06-05  1:08   ` [dpdk-dev] [PATCH v3 4/6] net/ether: use bitops to speedup comparison Stephen Hemminger
2019-06-05  9:02     ` Andrew Rybchenko
2019-06-05  1:08   ` [dpdk-dev] [PATCH v3 5/6] net/ether: mark ethernet addresses as being 2-byte aligned Stephen Hemminger
2019-06-05  9:04     ` Andrew Rybchenko
2019-06-05  1:08   ` [dpdk-dev] [PATCH v3 6/6] cmdline: use rte_ether_unformat_addr Stephen Hemminger
2019-06-05 18:09 ` [dpdk-dev] [PATCH v4 0/8] net/ether: enhancements and optimizations Stephen Hemminger
2019-06-05 18:09   ` [dpdk-dev] [PATCH v4 1/8] net/rte_ether: deinline non-critical functions Stephen Hemminger
2019-06-06  8:06     ` Maxime Coquelin
2019-06-05 18:09   ` [dpdk-dev] [PATCH v4 2/8] net/ether: add rte_eth_unformat_addr Stephen Hemminger
2019-06-05 18:09   ` [dpdk-dev] [PATCH v4 3/8] ethdev: use rte_eth_unformat_addr Stephen Hemminger
2019-06-05 18:09   ` [dpdk-dev] [PATCH v4 4/8] net/ether: use bitops to speedup comparison Stephen Hemminger
2019-06-05 18:09   ` [dpdk-dev] [PATCH v4 5/8] net/ether: mark ethernet addresses as being 2-byte aligned Stephen Hemminger
2019-06-07 16:59     ` Ananyev, Konstantin
2019-06-07 18:35       ` Stephen Hemminger
2019-06-07 20:40         ` Richardson, Bruce
2019-06-08 11:51         ` Ananyev, Konstantin
2019-06-07 20:39       ` Richardson, Bruce
2019-06-08 12:15         ` Ananyev, Konstantin
2019-06-05 18:09   ` [dpdk-dev] [PATCH v4 6/8] cmdline: use rte_ether_unformat_addr Stephen Hemminger
2019-06-05 18:09   ` [dpdk-dev] [PATCH v4 7/8] net/bonding: use rte_ether_unformat_addr rather than cmdline_parse Stephen Hemminger
2019-06-05 18:09   ` [dpdk-dev] [PATCH v4 8/8] app/testpmd: use rte_ether_unformat_addr Stephen Hemminger
2019-06-20 14:18     ` Iremonger, Bernard
2019-06-20 16:12       ` Stephen Hemminger
2019-06-24 20:44 ` [dpdk-dev] [PATCH v5 0/8] net/ether: enhancements and optimizations Stephen Hemminger
2019-06-24 20:44   ` [dpdk-dev] [PATCH v5 1/8] net/rte_ether: deinline non-critical functions Stephen Hemminger
2019-07-02  7:56     ` Olivier Matz [this message]
2019-06-24 20:44   ` [dpdk-dev] [PATCH v5 2/8] net/ether: add function to convert string to ethernet address Stephen Hemminger
2019-06-24 20:44   ` [dpdk-dev] [PATCH v5 3/8] ethdev: use new ethernet parsing function Stephen Hemminger
2019-06-24 20:44   ` [dpdk-dev] [PATCH v5 4/8] net/ether: use bitops to speedup comparison Stephen Hemminger
2019-07-02  7:53     ` Olivier Matz
2019-07-02  9:26       ` Olivier Matz
2019-07-02 15:28         ` Stephen Hemminger
2019-06-24 20:44   ` [dpdk-dev] [PATCH v5 5/8] net/ether: mark ethernet addresses as being 2-byte aligned Stephen Hemminger
2019-06-24 20:44   ` [dpdk-dev] [PATCH v5 6/8] cmdline: use new ethernet address parser Stephen Hemminger
     [not found]     ` <8688172CD5C0B74590FAE19D9579F94B53742875@SHSMSX103.ccr.corp.intel.com>
2019-07-16 16:17       ` Stephen Hemminger
2019-07-17 14:04         ` Aaron Conole
2019-07-17 14:39           ` Olivier Matz
2019-06-24 20:44   ` [dpdk-dev] [PATCH v5 7/8] net/bonding: " Stephen Hemminger
2019-06-24 20:44   ` [dpdk-dev] [PATCH v5 8/8] app/testpmd: " Stephen Hemminger
2019-07-02 16:50 ` [dpdk-dev] [PATCH v6 0/8] net/ether: enhancements and optimizations Stephen Hemminger
2019-07-02 16:50   ` [dpdk-dev] [PATCH v6 1/8] net/rte_ether: deinline non-critical functions Stephen Hemminger
2019-07-02 16:50   ` [dpdk-dev] [PATCH v6 2/8] net/ether: add function to convert string to ethernet address Stephen Hemminger
2019-07-02 16:50   ` [dpdk-dev] [PATCH v6 3/8] ethdev: use new ethernet parsing function Stephen Hemminger
2019-07-02 16:50   ` [dpdk-dev] [PATCH v6 4/8] net/ether: use bitops to speedup comparison Stephen Hemminger
2019-07-02 16:50   ` [dpdk-dev] [PATCH v6 5/8] net/ether: mark ethernet addresses as being 2-byte aligned Stephen Hemminger
2019-07-02 21:46     ` Ananyev, Konstantin
2019-07-02 16:50   ` [dpdk-dev] [PATCH v6 6/8] cmdline: use new ethernet address parser Stephen Hemminger
2019-07-02 16:50   ` [dpdk-dev] [PATCH v6 7/8] net/bonding: " Stephen Hemminger
2019-07-02 16:50   ` [dpdk-dev] [PATCH v6 8/8] app/testpmd: " Stephen Hemminger
2019-07-02 21:37   ` [dpdk-dev] [PATCH v6 0/8] net/ether: enhancements and optimizations Thomas Monjalon
2019-07-02 22:03     ` Stephen Hemminger
2019-07-02 22:12 ` [dpdk-dev] [PATCH v7 00/12] ether: improvements " Stephen Hemminger
2019-07-02 22:12   ` [dpdk-dev] [PATCH v7 01/12] net/rte_ether: deinline non-critical functions Stephen Hemminger
2019-07-05 14:25     ` Olivier Matz
2019-07-02 22:12   ` [dpdk-dev] [PATCH v7 02/12] net/ether: add function to convert string to ethernet address Stephen Hemminger
2019-07-05 14:25     ` Olivier Matz
2019-07-02 22:12   ` [dpdk-dev] [PATCH v7 03/12] ethdev: use new ethernet parsing function Stephen Hemminger
2019-07-02 22:12   ` [dpdk-dev] [PATCH v7 04/12] net/ether: use bitops to speedup comparison Stephen Hemminger
2019-07-05 14:34     ` Olivier Matz
2019-07-02 22:12   ` [dpdk-dev] [PATCH v7 05/12] net/ether: mark ethernet addresses as being 2-byte aligned Stephen Hemminger
2019-07-05 14:34     ` Olivier Matz
2019-07-05 15:45       ` Richardson, Bruce
2019-07-02 22:12   ` [dpdk-dev] [PATCH v7 06/12] cmdline: use new ethernet address parser Stephen Hemminger
2019-07-05 14:46     ` Olivier Matz
2019-07-02 22:12   ` [dpdk-dev] [PATCH v7 07/12] net/bonding: " Stephen Hemminger
2019-07-02 22:12   ` [dpdk-dev] [PATCH v7 08/12] app/testpmd: " Stephen Hemminger
2019-07-03 13:30     ` Iremonger, Bernard
2019-07-05 17:12       ` Stephen Hemminger
2019-07-02 22:12   ` [dpdk-dev] [PATCH v7 09/12] net/virtio: use new ether addr parsing Stephen Hemminger
2019-07-02 22:12   ` [dpdk-dev] [PATCH v7 10/12] net/failsafe: use common ether address parsing routine Stephen Hemminger
2019-07-03  9:10     ` Gaëtan Rivet
2019-07-02 22:12   ` [dpdk-dev] [PATCH v7 11/12] net/vdev_netvsc: use common ethernet address parsing Stephen Hemminger
2019-07-03  8:12     ` Matan Azrad
2019-07-02 22:12   ` [dpdk-dev] [PATCH v7 12/12] net/memif: use common ethernet address parsing routine Stephen Hemminger
2019-07-05 17:16 ` [dpdk-dev] [PATCH v8 00/11] ether: improvements and optimizations Stephen Hemminger
2019-07-05 17:16   ` [dpdk-dev] [PATCH v8 01/11] net/ether: deinline non-critical functions Stephen Hemminger
2019-07-05 17:16   ` [dpdk-dev] [PATCH v8 02/11] net/ether: add function to convert string to ethernet address Stephen Hemminger
2019-07-05 17:16   ` [dpdk-dev] [PATCH v8 03/11] ethdev: use new ethernet parsing function Stephen Hemminger
2019-07-05 17:16   ` [dpdk-dev] [PATCH v8 04/11] net/ether: use bitops to speedup comparison Stephen Hemminger
2019-07-05 17:16   ` [dpdk-dev] [PATCH v8 05/11] cmdline: use new ethernet address parser Stephen Hemminger
2019-07-05 17:16   ` [dpdk-dev] [PATCH v8 06/11] net/bonding: " Stephen Hemminger
2019-07-05 17:16   ` [dpdk-dev] [PATCH v8 07/11] app/testpmd: " Stephen Hemminger
2019-07-05 17:16   ` [dpdk-dev] [PATCH v8 08/11] net/virtio: use new ether addr parsing Stephen Hemminger
2019-07-05 17:16   ` [dpdk-dev] [PATCH v8 09/11] net/failsafe: use common ether address parsing routine Stephen Hemminger
2019-07-05 17:16   ` [dpdk-dev] [PATCH v8 10/11] net/vdev_netvsc: use common ethernet address parsing Stephen Hemminger
2019-07-05 17:16   ` [dpdk-dev] [PATCH v8 11/11] net/memif: use common ethernet address parsing routine Stephen Hemminger
2019-07-08 18:26 ` [dpdk-dev] [PATCH v9 00/11] ether: improvements and optimizations Stephen Hemminger
2019-07-08 18:26   ` [dpdk-dev] [PATCH v9 01/11] net/ether: deinline non-critical functions Stephen Hemminger
2019-07-08 18:26   ` [dpdk-dev] [PATCH v9 02/11] net/ether: add function to convert string to ethernet address Stephen Hemminger
2019-07-08 18:26   ` [dpdk-dev] [PATCH v9 03/11] ethdev: use new ethernet parsing function Stephen Hemminger
2019-07-08 18:26   ` [dpdk-dev] [PATCH v9 04/11] net/ether: use bitops to speedup comparison Stephen Hemminger
2019-07-08 18:26   ` [dpdk-dev] [PATCH v9 05/11] cmdline: use new ethernet address parser Stephen Hemminger
2019-07-08 18:26   ` [dpdk-dev] [PATCH v9 06/11] net/bonding: " Stephen Hemminger
2019-07-08 18:26   ` [dpdk-dev] [PATCH v9 07/11] app/testpmd: " Stephen Hemminger
2019-07-21 13:42     ` Raslan Darawsheh
2019-07-22 12:09       ` Thomas Monjalon
2019-07-22 16:15       ` Ferruh Yigit
2019-07-08 18:26   ` [dpdk-dev] [PATCH v9 08/11] net/virtio: use new ether addr parsing Stephen Hemminger
2019-07-08 18:26   ` [dpdk-dev] [PATCH v9 09/11] net/failsafe: use common ether address parsing routine Stephen Hemminger
2019-07-08 18:26   ` [dpdk-dev] [PATCH v9 10/11] net/vdev_netvsc: use common ethernet address parsing Stephen Hemminger
2019-07-08 18:26   ` [dpdk-dev] [PATCH v9 11/11] net/memif: use common ethernet address parsing routine Stephen Hemminger
2019-07-08 19:13   ` [dpdk-dev] [PATCH v9 00/11] ether: improvements and optimizations Ferruh Yigit
2019-07-09 15:01     ` Bruce Richardson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190702075640.2vnyiyy2gjoh5buf@platinum \
    --to=olivier.matz@6wind.com \
    --cc=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=ramirose@gmail.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).