EAL and PCI ABI changes for 19.11
Subsystems (3)
cover EAL and PCI ABI changes for 19.11
Let's prepare for the ABI freeze.
The first patches are about changes that had been announced before (with a patch from Stephen that I took as it is ready as is from my pov).
The malloc_heap structure from the memory subsystem can be hidden. The PCI library had some forgotten deprecated APIs that are removed with this series.
Finally, rte_logs could be hidden, but I am not that confortable about doing it right away: I added an accessor to rte_logs.file, but I am fine with dropping the last patch and wait for actually hiding this in the next ABI break.
Comments?
Signature · 44 lines
David Marchand David Marchand (7): eal: remove deprecated CPU flags check function eal: remove deprecated malloc virt2phys function mem: hide internal heap header net/bonding: use non deprecated PCI API pci: remove deprecated functions log: add log stream accessor log: hide internal log structure Stephen Hemminger (1): eal: make lcore config private app/test-pmd/testpmd.c | 1 - doc/guides/rel_notes/deprecation.rst | 17 ------- doc/guides/rel_notes/release_19_11.rst | 14 +++++ drivers/common/qat/qat_logs.c | 3 +- drivers/common/qat/qat_logs.h | 3 +- drivers/net/bonding/rte_eth_bond_args.c | 5 +- lib/librte_eal/common/Makefile | 2 +- lib/librte_eal/common/eal_common_cpuflags.c | 11 ---- lib/librte_eal/common/eal_common_launch.c | 2 + lib/librte_eal/common/eal_common_log.c | 59 ++++++++++++++-------- lib/librte_eal/common/eal_memcfg.h | 3 +- lib/librte_eal/common/eal_private.h | 25 +++++++++ .../common/include/generic/rte_cpuflags.h | 9 ---- lib/librte_eal/common/include/rte_lcore.h | 24 --------- lib/librte_eal/common/include/rte_log.h | 33 ++++++------ lib/librte_eal/common/include/rte_malloc.h | 7 --- lib/librte_eal/common/include/rte_malloc_heap.h | 35 ------------- lib/librte_eal/common/malloc_heap.h | 25 ++++++++- lib/librte_eal/common/meson.build | 1 - lib/librte_eal/common/rte_service.c | 2 + lib/librte_eal/rte_eal_version.map | 6 +-- lib/librte_eal/windows/eal/eal_thread.c | 1 + lib/librte_pci/rte_pci.c | 19 ------- lib/librte_pci/rte_pci.h | 47 ----------------- lib/librte_pci/rte_pci_version.map | 3 -- 25 files changed, 132 insertions(+), 225 deletions(-) delete mode 100644 lib/librte_eal/common/include/rte_malloc_heap.h -- 1.8.3.1
PATCH 1/8 eal: make lcore config private
From: Stephen Hemminger <[email protected]>
The internal structure of lcore_config does not need to be part of visible API/ABI. Make it private to EAL.
Rearrange the structure so it takes less memory (and cache footprint).
---
Based on Stephen v8: http://patchwork.dpdk.org/patch/60443/
Changes since Stephen v8:
- do not change core_id, socket_id and core_index types,
--- doc/guides/rel_notes/deprecation.rst | 4 ---- doc/guides/rel_notes/release_19_11.rst | 2 ++ lib/librte_eal/common/eal_common_launch.c | 2 ++ lib/librte_eal/common/eal_private.h | 25 +++++++++++++++++++++++++ lib/librte_eal/common/include/rte_lcore.h | 24 ------------------------ lib/librte_eal/common/rte_service.c | 2 ++ lib/librte_eal/rte_eal_version.map | 1 - lib/librte_eal/windows/eal/eal_thread.c | 1 + 8 files changed, 32 insertions(+), 29 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -4
@@ -23,10 +23,6 @@ Deprecation Notices * eal: The function ``rte_eal_remote_launch`` will return new error codes after read or write error on the pipe, instead of calling ``rte_panic``. -* eal: The ``lcore_config`` struct and global symbol will be made private to - remove it from the externally visible ABI and allow it to be updated in the - future. - * eal: both declaring and identifying devices will be streamlined in v18.11. New functions will appear to query a specific port from buses, classes of device and device drivers. Device declaration will be made coherent with the
doc/guides/rel_notes/release_19_11.rst +2 -0
@@ -202,6 +202,8 @@ ABI Changes Also, make sure to start the actual text at the margin. ========================================================= +* eal: made the ``lcore_config`` struct and global symbol private. + Shared Library Versions -----------------------
lib/librte_eal/common/eal_common_launch.c +2 -0
@@ -15,6 +15,8 @@#include <rte_per_lcore.h> #include <rte_lcore.h> +#include "eal_private.h" +/* * Wait until a lcore finished its job. */
lib/librte_eal/common/eal_private.h +25 -0
@@ -10,6 +10,31 @@#include <stdio.h> #include <rte_dev.h> +#include <rte_lcore.h> + +/** +* Structure storing internal configuration (per-lcore) +*/ +struct lcore_config { +pthread_t thread_id;/**< pthread identifier */ +int pipe_master2slave[2 ];/**< communication pipe with master */ +int pipe_slave2master[2 ];/**< communication pipe with master */ + +lcore_function_t *volatile f;/**< function to call */ +void *volatile arg;/**< argument of function */ +volatile int ret;/**< return value of function */ + +volatile enum rte_lcore_state_t state;/**< lcore state */ +unsigned int socket_id;/**< physical socket id for this lcore */ +unsigned int core_id;/**< core number on socket for this lcore */ +int core_index;/**< relative index, starting from 0 */ +uint8_t core_role;/**< role of core eg: OFF, RTE, SERVICE */ +uint8_t detected;/**< true if lcore was detected */ + +rte_cpuset_t cpuset;/**< cpu set which the lcore affinity to */ +}; + +extern struct lcore_config lcore_config[RTE_MAX_LCORE ];/** * Initialize the memzone subsystem (private to eal).
lib/librte_eal/common/include/rte_lcore.h +0 -24
@@ -66,30 +66,6 @@ typedef cpuset_t rte_cpuset_t; } while (0)#endif -/** -* Structure storing internal configuration (per-lcore) -*/ -struct lcore_config { -unsigned detected;/**< true if lcore was detected */ -pthread_t thread_id;/**< pthread identifier */ -int pipe_master2slave[2 ];/**< communication pipe with master */ -int pipe_slave2master[2 ];/**< communication pipe with master */ -lcore_function_t *volatile f;/**< function to call */ -void *volatile arg;/**< argument of function */ -volatile int ret;/**< return value of function */ -volatile enum rte_lcore_state_t state;/**< lcore state */ -unsigned socket_id;/**< physical socket id for this lcore */ -unsigned core_id;/**< core number on socket for this lcore */ -int core_index;/**< relative index, starting from 0 */ -rte_cpuset_t cpuset;/**< cpu set which the lcore affinity to */ -uint8_t core_role;/**< role of core eg: OFF, RTE, SERVICE */ -}; - -/** -* Internal configuration (per-lcore) -*/ -extern struct lcore_config lcore_config[RTE_MAX_LCORE ]; -RTE_DECLARE_PER_LCORE (unsigned, _lcore_id);/**< Per thread "lcore id". */ RTE_DECLARE_PER_LCORE (rte_cpuset_t, _cpuset);/**< Per thread "cpuset". */
lib/librte_eal/common/rte_service.c +2 -0
@@ -21,6 +21,8 @@#include <rte_memory.h> #include <rte_malloc.h> +#include "eal_private.h" +#define RTE_SERVICE_NUM_MAX 64#define SERVICE_F_REGISTERED (1 << 0)
lib/librte_eal/rte_eal_version.map +0 -1
@@ -4,7 +4,6 @@ DPDK_2.0 { __rte_panic; eal_parse_sysfs_value; eal_timer_source; - lcore_config; per_lcore__lcore_id; per_lcore__rte_errno; rte_calloc;
lib/librte_eal/windows/eal/eal_thread.c +1 -0
@@ -12,6 +12,7 @@#include <rte_common.h> #include <eal_thread.h> +#include "eal_private.h" RTE_DEFINE_PER_LCORE(unsigned int, _lcore_id) = LCORE_ID_ANY;
Signature · 1 line
1.8.3.1
PATCH 2/8 eal: remove deprecated CPU flags check function
In reply to David MarchandRemove rte_cpu_check_supported as announced previously.
--- doc/guides/rel_notes/deprecation.rst | 3 --- doc/guides/rel_notes/release_19_11.rst | 3 +++ lib/librte_eal/common/eal_common_cpuflags.c | 11 ----------- lib/librte_eal/common/include/generic/rte_cpuflags.h | 9 --------- lib/librte_eal/rte_eal_version.map | 1 - 5 files changed, 3 insertions(+), 24 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -3
@@ -34,9 +34,6 @@ Deprecation Notices + ``rte_eal_devargs_type_count`` -* eal: The ``rte_cpu_check_supported`` function has been deprecated since - v17.08 and will be removed. - * eal: The ``rte_malloc_virt2phy`` function has been deprecated and replaced by ``rte_malloc_virt2iova`` since v17.11 and will be removed.
doc/guides/rel_notes/release_19_11.rst +3 -0
@@ -204,6 +204,9 @@ ABI Changes * eal: made the ``lcore_config`` struct and global symbol private. +* eal: removed the ``rte_cpu_check_supported`` function, replaced by + ``rte_cpu_is_supported`` since dpdk v17.08. + Shared Library Versions -----------------------
lib/librte_eal/common/eal_common_cpuflags.c +0 -11
@@ -7,17 +7,6 @@#include <rte_common.h> #include <rte_cpuflags.h> -/** -* Checks if the machine is adequate for running the binary. If it is not, the -* program exits with status 1. -*/ -void -rte_cpu_check_supported (void ) -{ -if (!rte_cpu_is_supported ()) -exit (1 ); -} -int rte_cpu_is_supported (void ) {
lib/librte_eal/common/include/generic/rte_cpuflags.h +0 -9
@@ -49,15 +49,6 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature);/** * This function checks that the currently used CPU supports the CPU features * that were specified at compile time. It is called automatically within the -* EAL, so does not need to be used by applications. -*/ -__rte_deprecated -void -rte_cpu_check_supported (void ); - -/** -* This function checks that the currently used CPU supports the CPU features -* that were specified at compile time. It is called automatically within the * EAL, so does not need to be used by applications. This version returns a * result so that decisions may be made (for instance, graceful shutdowns). */
lib/librte_eal/rte_eal_version.map +0 -1
@@ -8,7 +8,6 @@ DPDK_2.0 { per_lcore__rte_errno; rte_calloc; rte_calloc_socket; - rte_cpu_check_supported; rte_cpu_get_flag_enabled; rte_cycles_vmware_tsc_map; rte_delay_us;
Signature · 1 line
1.8.3.1
PATCH 3/8 eal: remove deprecated malloc virt2phys function
In reply to David MarchandRemove rte_malloc_virt2phy as announced previously.
--- doc/guides/rel_notes/deprecation.rst | 3 --- doc/guides/rel_notes/release_19_11.rst | 3 +++ lib/librte_eal/common/include/rte_malloc.h | 7 ------- 3 files changed, 3 insertions(+), 10 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -3
@@ -34,9 +34,6 @@ Deprecation Notices + ``rte_eal_devargs_type_count`` -* eal: The ``rte_malloc_virt2phy`` function has been deprecated and replaced - by ``rte_malloc_virt2iova`` since v17.11 and will be removed. - * vfio: removal of ``rte_vfio_dma_map`` and ``rte_vfio_dma_unmap`` APIs which have been replaced with ``rte_dev_dma_map`` and ``rte_dev_dma_unmap`` functions. The due date for the removal targets DPDK 20.02.
doc/guides/rel_notes/release_19_11.rst +3 -0
@@ -207,6 +207,9 @@ ABI Changes * eal: removed the ``rte_cpu_check_supported`` function, replaced by ``rte_cpu_is_supported`` since dpdk v17.08. +* eal: removed the ``rte_malloc_virt2phy`` function, replaced by + ``rte_malloc_virt2iova`` since v17.11. + Shared Library Versions -----------------------
lib/librte_eal/common/include/rte_malloc.h +0 -7
@@ -553,13 +553,6 @@ rte_malloc_set_limit(const char *type, size_t max);rte_iova_t rte_malloc_virt2iova (const void *addr); -__rte_deprecated -static inline phys_addr_t -rte_malloc_virt2phy (const void *addr) -{ -return rte_malloc_virt2iova (addr); -} - #ifdef __cplusplus }#endif
Signature · 1 line
1.8.3.1
PATCH 4/8 mem: hide internal heap header
In reply to David MarchandLet's avoid exporting structures without an identified usecase.
--- app/test-pmd/testpmd.c | 1 - lib/librte_eal/common/Makefile | 2 +- lib/librte_eal/common/eal_memcfg.h | 3 ++- lib/librte_eal/common/include/rte_malloc_heap.h | 35 ------------------------- lib/librte_eal/common/malloc_heap.h | 25 +++++++++++++++++- lib/librte_eal/common/meson.build | 1 - 6 files changed, 27 insertions(+), 40 deletions(-) delete mode 100644 lib/librte_eal/common/include/rte_malloc_heap.h
app/test-pmd/testpmd.c +0 -1
@@ -27,7 +27,6 @@#include <rte_log.h> #include <rte_debug.h> #include <rte_cycles.h> -#include <rte_malloc_heap.h> #include <rte_memory.h> #include <rte_memcpy.h> #include <rte_launch.h>
lib/librte_eal/common/Makefile +1 -1
@@ -10,7 +10,7 @@ INC += rte_log.h rte_memory.h rte_memzone.h INC += rte_per_lcore.h rte_random.h INC += rte_tailq.h rte_interrupts.h rte_alarm.h INC += rte_string_fns.h rte_version.h -INC += rte_eal_memconfig.h rte_malloc_heap.h +INC += rte_eal_memconfig.h INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h rte_class.h INC += rte_option.h INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h
lib/librte_eal/common/eal_memcfg.h +2 -1
@@ -6,7 +6,6 @@#define EAL_MEMCFG_H #include <rte_config.h> -#include <rte_malloc_heap.h> #include <rte_memory.h> #include <rte_memzone.h> #include <rte_pause.h>
@@ -14,6 +13,8 @@#include <rte_rwlock.h> #include <rte_tailq.h> +#include "malloc_heap.h" +/** * Memory configuration shared across multiple processes. */
lib/librte_eal/common/include/rte_malloc_heap.h deleted +0 -35
@@ -1,35 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause -* Copyright(c) 2010-2014 Intel Corporation -*/ - -#ifndef _RTE_MALLOC_HEAP_H_ -#define _RTE_MALLOC_HEAP_H_ - -#include <stddef.h> -#include <sys/queue.h> -#include <rte_spinlock.h> -#include <rte_memory.h> - -/* Number of free lists per heap, grouped by size. */ -#define RTE_HEAP_NUM_FREELISTS 13 -#define RTE_HEAP_NAME_MAX_LEN 32 - -/* dummy definition, for pointers */ -struct malloc_elem ; - -/** -* Structure to hold malloc heap -*/ -struct malloc_heap { -rte_spinlock_t lock; - LIST_HEAD(, malloc_elem) free_head[RTE_HEAP_NUM_FREELISTS]; -struct malloc_elem *volatile first; -struct malloc_elem *volatile last; - -unsigned alloc_count; -unsigned int socket_id; -size_t total_size; -char name[RTE_HEAP_NAME_MAX_LEN ]; -} __rte_cache_aligned; - -#endif /* _RTE_MALLOC_HEAP_H_ */
lib/librte_eal/common/malloc_heap.h +24 -1
@@ -6,9 +6,32 @@#define MALLOC_HEAP_H_ #include <stdbool.h> +#include <sys/queue.h> #include <rte_malloc.h> -#include <rte_malloc_heap.h> +#include <rte_spinlock.h> + +/* Number of free lists per heap, grouped by size. */ +#define RTE_HEAP_NUM_FREELISTS 13 +#define RTE_HEAP_NAME_MAX_LEN 32 + +/* dummy definition, for pointers */ +struct malloc_elem ; + +/** +* Structure to hold malloc heap +*/ +struct malloc_heap { +rte_spinlock_t lock; + LIST_HEAD(, malloc_elem) free_head[RTE_HEAP_NUM_FREELISTS]; +struct malloc_elem *volatile first; +struct malloc_elem *volatile last; + +unsigned int alloc_count; +unsigned int socket_id; +size_t total_size; +char name[RTE_HEAP_NAME_MAX_LEN ]; +} __rte_cache_aligned;#ifdef __cplusplusextern "C" {
lib/librte_eal/common/meson.build +0 -1
@@ -72,7 +72,6 @@ common_headers = files( 'include/rte_lcore.h', 'include/rte_log.h', 'include/rte_malloc.h', - 'include/rte_malloc_heap.h', 'include/rte_memory.h', 'include/rte_memzone.h', 'include/rte_option.h',
Signature · 1 line
1.8.3.1
PATCH 5/8 net/bonding: use non deprecated PCI API
In reply to David Marchandrte_eal_compare_pci_addr has been deprecated since v17.11. Convert to rte_pci_addr_cmp.
--- drivers/net/bonding/rte_eth_bond_args.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/bonding/rte_eth_bond_args.c +2 -3
@@ -60,11 +60,10 @@ find_port_id_by_dev_name(const char *name)static inline int bond_pci_addr_cmp (const struct rte_device *dev,const void *_pci_addr) { -struct rte_pci_device *pdev; +const struct rte_pci_device *pdev =RTE_DEV_TO_PCI_CONST (dev);const struct rte_pci_addr *paddr = _pci_addr; - pdev =RTE_DEV_TO_PCI (*(struct rte_device **)(void *)&dev); -return rte_eal_compare_pci_addr (&pdev->addr, paddr); +return rte_pci_addr_cmp (&pdev->addr, paddr); }/**
Signature · 1 line
1.8.3.1
PATCH 6/8 pci: remove deprecated functions
In reply to David MarchandThose functions have been deprecated since 17.11 and have 1:1 replacement.
--- doc/guides/rel_notes/deprecation.rst | 7 ----- doc/guides/rel_notes/release_19_11.rst | 6 +++++ lib/librte_pci/rte_pci.c | 19 -------------- lib/librte_pci/rte_pci.h | 47 ---------------------------------- lib/librte_pci/rte_pci_version.map | 3 --- 5 files changed, 6 insertions(+), 76 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -7
@@ -38,13 +38,6 @@ Deprecation Notices have been replaced with ``rte_dev_dma_map`` and ``rte_dev_dma_unmap`` functions. The due date for the removal targets DPDK 20.02. -* pci: Several exposed functions are misnamed. - The following functions are deprecated starting from v17.11 and are replaced: - - - ``eal_parse_pci_BDF`` replaced by ``rte_pci_addr_parse`` - - ``eal_parse_pci_DomBDF`` replaced by ``rte_pci_addr_parse`` - - ``rte_eal_compare_pci_addr`` replaced by ``rte_pci_addr_cmp`` - * dpaa2: removal of ``rte_dpaa2_memsegs`` structure which has been replaced by a pa-va search library. This structure was earlier being used for holding memory segments used by dpaa2 driver for faster pa->va translation. This
doc/guides/rel_notes/release_19_11.rst +6 -0
@@ -210,6 +210,12 @@ ABI Changes * eal: removed the ``rte_malloc_virt2phy`` function, replaced by ``rte_malloc_virt2iova`` since v17.11. +* pci: removed the following deprecated functions since dpdk: + + - ``eal_parse_pci_BDF`` replaced by ``rte_pci_addr_parse`` + - ``eal_parse_pci_DomBDF`` replaced by ``rte_pci_addr_parse`` + - ``rte_eal_compare_pci_addr`` replaced by ``rte_pci_addr_cmp`` + Shared Library Versions -----------------------
lib/librte_pci/rte_pci.c +0 -19
@@ -87,18 +87,6 @@ pci_dbdf_parse(const char *input, struct rte_pci_addr *dev_addr)return 0 ; } -int -eal_parse_pci_BDF (const char *input,struct rte_pci_addr *dev_addr) -{ -return pci_bdf_parse (input, dev_addr); -} - -int -eal_parse_pci_DomBDF (const char *input,struct rte_pci_addr *dev_addr) -{ -return pci_dbdf_parse (input, dev_addr); -} -void rte_pci_device_name (const struct rte_pci_addr *addr,char *output,size_t size)
@@ -110,13 +98,6 @@ rte_pci_device_name(const struct rte_pci_addr *addr, }int -rte_eal_compare_pci_addr (const struct rte_pci_addr *addr, -const struct rte_pci_addr *addr2) -{ -return rte_pci_addr_cmp (addr, addr2); -} - -int rte_pci_addr_cmp (const struct rte_pci_addr *addr,const struct rte_pci_addr *addr2) {
lib/librte_pci/rte_pci.h +0 -47
59 lines not on this page · raw message
lib/librte_pci/rte_pci_version.map +0 -3
@@ -1,11 +1,8 @@ DPDK_17.11 { global: - eal_parse_pci_BDF; - eal_parse_pci_DomBDF; pci_map_resource; pci_unmap_resource; - rte_eal_compare_pci_addr; rte_pci_addr_cmp; rte_pci_addr_parse; rte_pci_device_name;
Signature · 1 line
1.8.3.1
PATCH 7/8 log: add log stream accessor
In reply to David MarchandDefine an accessor so that users can write their debug message to the same stream than the rte_log infrastructure.
Use it in the qat infrastructure.
--- drivers/common/qat/qat_logs.c | 3 +-- drivers/common/qat/qat_logs.h | 3 +-- lib/librte_eal/common/eal_common_log.c | 36 ++++++++++++++++++++------------- lib/librte_eal/common/include/rte_log.h | 13 ++++++++++++ lib/librte_eal/rte_eal_version.map | 3 +++ 5 files changed, 40 insertions(+), 18 deletions(-)
drivers/common/qat/qat_logs.c +1 -2
@@ -19,8 +19,7 @@ qat_hexdump_log(uint32_t level, uint32_t logtype, const char *title,if (level > (uint32_t )(rte_log_get_level (logtype)))return 0 ; -rte_hexdump (rte_logs.file ==NULL ? stderr : rte_logs.file, - title, buf, len); +rte_hexdump (rte_log_get_stream (), title, buf, len);return 0 ; }
drivers/common/qat/qat_logs.h +1 -2
@@ -24,8 +24,7 @@ extern int qat_dp_logtype;* * Dump out the message buffer in a special hex dump output format with * characters printed for each line of 16 hex values. The message will be sent -* to the stream defined by rte_logs.file or to stderr in case of rte_logs.file -* is undefined. +* to the stream used by the rte_log infrastructure. */ int qat_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
lib/librte_eal/common/eal_common_log.c +22 -14
@@ -71,6 +71,27 @@ rte_openlog_stream(FILE *f)return 0 ; } +FILE * +rte_log_get_stream (void ) +{ +FILE *f = rte_logs.file; + +if (f ==NULL ) { + f = default_log_stream; +if (f ==NULL ) { +/* +* Grab the current value of stderr here, rather than +* just initializing default_log_stream to stderr. This +* ensures that we will always use the current value +* of stderr, even if the application closes and +* reopens it. +*/ + f = stderr; + } + } +return f; +} +/* Set global log level */ void rte_log_set_global_level (uint32_t level)
@@ -396,21 +417,8 @@ rte_log_dump(FILE *f)int rte_vlog (uint32_t level,uint32_t logtype,const char *format,va_list ap) { +FILE *f =rte_log_get_stream ();int ret; -FILE *f = rte_logs.file; -if (f ==NULL ) { - f = default_log_stream; -if (f ==NULL ) { -/* -* Grab the current value of stderr here, rather than -* just initializing default_log_stream to stderr. This -* ensures that we will always use the current value -* of stderr, even if the application closes and -* reopens it. -*/ - f = stderr; - } - }if (level > rte_logs.level)return 0 ;
lib/librte_eal/common/include/rte_log.h +13 -0
@@ -102,6 +102,19 @@ extern struct rte_logs rte_logs;int rte_openlog_stream (FILE *f);/** +* @warning +* @b EXPERIMENTAL: this API may change without prior notice +* +* Retrieve the stream used by the logging system (see rte_openlog_stream() +* to change it). +* +* @return +* Pointer to the stream. +*/ +__rte_experimental +FILE *rte_log_get_stream(void); + +/** * Set the global log level. * * After this call, logs with a level lower or equal than the level
lib/librte_eal/rte_eal_version.map +3 -0
@@ -417,4 +417,7 @@ EXPERIMENTAL { rte_mcfg_timer_lock; rte_mcfg_timer_unlock; rte_rand_max; + + # added in 19.11 + rte_log_get_stream; };
Signature · 1 line
1.8.3.1
Re: [dpdk-dev] [PATCH 7/8] log: add log stream accessor
Quoted 4 lines · On Tue, 22 Oct 2019 11:32:40 +0200 David Marchand <[email protected]>…
lib/librte_eal/common/eal_common_log.c +4
-0+if (f ==NULL ) { + f = default_log_stream; +if (f ==NULL ) { +/*
lib/librte_eal/common/eal_common_log.c rte_openlog_stream(FILE *f) · line 92
Quoted 10 lines
lib/librte_eal/common/eal_common_log.c +10
-0+* Grab the current value of stderr here, rather than +* just initializing default_log_stream to stderr. This +* ensures that we will always use the current value +* of stderr, even if the application closes and +* reopens it. +*/ + f = stderr; + } + } +return f;
Why not just the short form?
return default_log_stream ? : stderr;
Re: [dpdk-dev] [PATCH 7/8] log: add log stream accessor
Quoted 19 lines · Stephen Hemminger
Quoted 4 lines · On Tue, 22 Oct 2019 11:32:40 +0200 David Marchand <[email protected]>…
lib/librte_eal/common/eal_common_log.c +4
-0+if (f ==NULL ) { + f = default_log_stream; +if (f ==NULL ) { +/* lib/librte_eal/common/eal_common_log.c rte_openlog_stream(FILE *f) · line 92
Quoted 10 lines
lib/librte_eal/common/eal_common_log.c +10
-0+* Grab the current value of stderr here, rather than +* just initializing default_log_stream to stderr. This +* ensures that we will always use the current value +* of stderr, even if the application closes and +* reopens it. +*/ + f = stderr; + } + } +return f;
Quoted 3 lines
Why not just the short form?
return default_log_stream ? : stderr;
Moved the existing code around, I can use this short form.
Signature · 1 line
David Marchand
PATCH 8/8 log: hide internal log structure
In reply to David MarchandNo need to expose rte_logs, hide it and remove it from the current ABI.
--- lib/librte_eal/common/eal_common_log.c | 23 ++++++++++++++++------- lib/librte_eal/common/include/rte_log.h | 20 +++----------------- lib/librte_eal/rte_eal_version.map | 1 - 3 files changed, 19 insertions(+), 25 deletions(-)
lib/librte_eal/common/eal_common_log.c +16 -7
@@ -17,13 +17,6 @@#include "eal_private.h" -/* global log structure */ -struct rte_logs rte_logs = { - .type = ~0 , - .level =RTE_LOG_DEBUG , - .file =NULL , -}; -struct rte_eal_opt_loglevel {/** Next list entry */ TAILQ_ENTRY (rte_eal_opt_loglevel) next;
@@ -58,6 +51,22 @@ struct rte_log_dynamic_type {uint32_t loglevel; }; +/** The rte_log structure. */ +struct rte_logs { +uint32_t type;/**< Bitfield with enabled logs. */ +uint32_t level;/**< Log level. */ +FILE *file;/**< Output file set by rte_openlog_stream, or NULL. */ +size_t dynamic_types_len; +struct rte_log_dynamic_type *dynamic_types; +}; + +/* global log structure */ +static struct rte_logs rte_logs = { + .type = ~0 , + .level =RTE_LOG_DEBUG , + .file =NULL , +}; +/* per core log */ static RTE_DEFINE_PER_LCORE(struct log_cur_msg, log_cur_msg);
lib/librte_eal/common/include/rte_log.h +3 -17
@@ -26,20 +26,6 @@ extern "C" {#include <rte_config.h> #include <rte_compat.h> -struct rte_log_dynamic_type ; - -/** The rte_log structure. */ -struct rte_logs { -uint32_t type;/**< Bitfield with enabled logs. */ -uint32_t level;/**< Log level. */ -FILE *file;/**< Output file set by rte_openlog_stream, or NULL. */ -size_t dynamic_types_len; -struct rte_log_dynamic_type *dynamic_types; -}; - -/** Global log information */ -extern struct rte_logs rte_logs; -/* SDK log type */ #define RTE_LOGTYPE_EAL 0/**< Log related to eal. */ #define RTE_LOGTYPE_MALLOC 1/**< Log related to malloc. */
@@ -260,7 +246,7 @@ void rte_log_dump(FILE *f);* to rte_openlog_stream(). * * The level argument determines if the log should be displayed or -* not, depending on the global rte_logs variable. +* not, depending on the global log level and the per logtype level. * * The preferred alternative is the RTE_LOG() because it adds the * level and type in the logged string.
@@ -291,8 +277,8 @@ int rte_log(uint32_t level, uint32_t logtype, const char *format, ...)* to rte_openlog_stream(). * * The level argument determines if the log should be displayed or -* not, depending on the global rte_logs variable. A trailing -* newline may be added if needed. +* not, depending on the global log level and the per logtype level. +* A trailing newline may be added if needed. * * The preferred alternative is the RTE_LOG() because it adds the * level and type in the logged string.
lib/librte_eal/rte_eal_version.map +0 -1
@@ -45,7 +45,6 @@ DPDK_2.0 { rte_log; rte_log_cur_msg_loglevel; rte_log_cur_msg_logtype; - rte_logs; rte_malloc; rte_malloc_dump_stats; rte_malloc_get_socket_stats;
Signature · 1 line
1.8.3.1
Re: [dpdk-dev] [PATCH 8/8] log: hide internal log structure
Quoted 100 lines · On Tue, 22 Oct 2019 11:32:41 +0200 David Marchand <[email protected]>…
No need to expose
rte_logs, hide it and remove it from the current ABI.Signed-off-by David Marchand <[email protected]>--- lib/librte_eal/common/eal_common_log.c | 23 ++++++++++++++++------- lib/librte_eal/common/include/rte_log.h | 20 +++----------------- lib/librte_eal/rte_eal_version.map | 1 - 3 files changed, 19 insertions(+), 25 deletions(-)lib/librte_eal/common/eal_common_log.c +16
-7@@ -17,13 +17,6 @@#include "eal_private.h" -/* global log structure */ -struct rte_logs rte_logs = { - .type = ~0 , - .level =RTE_LOG_DEBUG , - .file =NULL , -}; -struct rte_eal_opt_loglevel {/** Next list entry */ TAILQ_ENTRY (rte_eal_opt_loglevel) next;@@ -58,6 +51,22 @@ struct rte_log_dynamic_type {uint32_t loglevel; }; +/** The rte_log structure. */ +struct rte_logs { +uint32_t type;/**< Bitfield with enabled logs. */ +uint32_t level;/**< Log level. */ +FILE *file;/**< Output file set by rte_openlog_stream, or NULL. */ +size_t dynamic_types_len; +struct rte_log_dynamic_type *dynamic_types; +}; + +/* global log structure */ +static struct rte_logs rte_logs = { + .type = ~0 , + .level =RTE_LOG_DEBUG , + .file =NULL , +}; +/* per core log */ static RTE_DEFINE_PER_LCORE(struct log_cur_msg, log_cur_msg);lib/librte_eal/common/include/rte_log.h +3
-17@@ -26,20 +26,6 @@ extern "C" {#include <rte_config.h> #include <rte_compat.h> -struct rte_log_dynamic_type ; - -/** The rte_log structure. */ -struct rte_logs { -uint32_t type;/**< Bitfield with enabled logs. */ -uint32_t level;/**< Log level. */ -FILE *file;/**< Output file set by rte_openlog_stream, or NULL. */ -size_t dynamic_types_len; -struct rte_log_dynamic_type *dynamic_types; -}; - -/** Global log information */ -extern struct rte_logs rte_logs; -/* SDK log type */ #define RTE_LOGTYPE_EAL 0/**< Log related to eal. */ #define RTE_LOGTYPE_MALLOC 1/**< Log related to malloc. */ @@ -260,7 +246,7 @@ void rte_log_dump(FILE *f);* to rte_openlog_stream(). * * The level argument determines if the log should be displayed or -* not, depending on the global rte_logs variable. +* not, depending on the global log level and the per logtype level. * * The preferred alternative is the RTE_LOG() because it adds the * level and type in the logged string. @@ -291,8 +277,8 @@ int rte_log(uint32_t level, uint32_t logtype, const char *format, ...)* to rte_openlog_stream(). * * The level argument determines if the log should be displayed or -* not, depending on the global rte_logs variable. A trailing -* newline may be added if needed. +* not, depending on the global log level and the per logtype level. +* A trailing newline may be added if needed. * * The preferred alternative is the RTE_LOG() because it adds the * level and type in the logged string. lib/librte_eal/rte_eal_version.map +0
-0
lib/librte_eal/rte_eal_version.map DPDK_2.0 { · line 50
Quoted 7 lines
lib/librte_eal/rte_eal_version.map +0
-1@@ -45,7 +45,6 @@ DPDK_2.0 { rte_log; rte_log_cur_msg_loglevel; rte_log_cur_msg_logtype; - rte_logs; rte_malloc; rte_malloc_dump_stats; rte_malloc_get_socket_stats;
Re: [dpdk-dev] [PATCH 8/8] log: hide internal log structure
In reply to David MarchandQuoted 9 lines · David Marchand
No need to expose
rte_logs, hide it and remove it from the current ABI.Signed-off-by David Marchand <[email protected]>--- lib/librte_eal/common/eal_common_log.c | 23 ++++++++++++++++------- lib/librte_eal/common/include/rte_log.h | 20 +++----------------- lib/librte_eal/rte_eal_version.map | 1 - 3 files changed, 19 insertions(+), 25 deletions(-)
Note to self.
If we go with this patch, an update of the release notes is missing.
Signature · 1 line
David Marchand
v2 cover EAL and PCI ABI changes for 19.11
In reply to David MarchandLet's prepare for the ABI freeze.
The first patches are about changes that had been announced before (with a patch from Stephen that I took as it is ready as is from my pov).
The malloc_heap structure from the memory subsystem can be hidden. The PCI library had some forgotten deprecated APIs that are removed with this series.
rte_logs could be hidden, but I am not that confortable about doing it right away: I added an accessor to rte_logs.file, but I am fine with dropping the last patch and wait for actually hiding this in the next ABI break.
Changelog since v1:
- I went a step further, hiding rte_config after de-inlining non critical functions
Comments?
Signature · 56 lines
David Marchand David Marchand (11): eal: remove deprecated CPU flags check function eal: remove deprecated malloc virt2phys function mem: hide internal heap header net/bonding: use non deprecated PCI API pci: remove deprecated functions log: add log stream accessor log: hide internal log structure test/mem: remove dependency on EAL internals eal: deinline lcore APIs eal: factorize lcore role code in common code eal: make the global configuration private Stephen Hemminger (1): eal: make lcore config private app/test-pmd/testpmd.c | 1 - app/test/test_memzone.c | 50 +++++++++------ doc/guides/rel_notes/deprecation.rst | 17 ----- doc/guides/rel_notes/release_19_11.rst | 19 ++++++ drivers/common/qat/qat_logs.c | 3 +- drivers/common/qat/qat_logs.h | 3 +- drivers/net/bonding/rte_eth_bond_args.c | 5 +- lib/librte_eal/common/Makefile | 2 +- lib/librte_eal/common/eal_common_cpuflags.c | 11 ---- lib/librte_eal/common/eal_common_launch.c | 2 + lib/librte_eal/common/eal_common_lcore.c | 48 ++++++++++++++ lib/librte_eal/common/eal_common_log.c | 56 ++++++++++------- lib/librte_eal/common/eal_common_mcfg.c | 1 + lib/librte_eal/common/eal_memcfg.h | 3 +- lib/librte_eal/common/eal_private.h | 57 +++++++++++++++++ .../common/include/generic/rte_cpuflags.h | 9 --- lib/librte_eal/common/include/rte_eal.h | 43 ------------- lib/librte_eal/common/include/rte_lcore.h | 73 ++++------------------ lib/librte_eal/common/include/rte_log.h | 33 +++++----- lib/librte_eal/common/include/rte_malloc.h | 7 --- lib/librte_eal/common/include/rte_malloc_heap.h | 35 ----------- lib/librte_eal/common/malloc_heap.c | 1 + lib/librte_eal/common/malloc_heap.h | 25 +++++++- lib/librte_eal/common/meson.build | 1 - lib/librte_eal/common/rte_malloc.c | 1 + lib/librte_eal/common/rte_service.c | 2 + lib/librte_eal/freebsd/eal/eal.c | 7 --- lib/librte_eal/linux/eal/eal.c | 7 --- lib/librte_eal/rte_eal_version.map | 17 +++-- lib/librte_eal/windows/eal/eal_thread.c | 1 + lib/librte_pci/rte_pci.c | 19 ------ lib/librte_pci/rte_pci.h | 47 -------------- lib/librte_pci/rte_pci_version.map | 3 - 33 files changed, 271 insertions(+), 338 deletions(-) delete mode 100644 lib/librte_eal/common/include/rte_malloc_heap.h -- 1.8.3.1
PATCH v2 1/12 eal: make lcore config private
From: Stephen Hemminger <[email protected]>
The internal structure of lcore_config does not need to be part of visible API/ABI. Make it private to EAL.
Rearrange the structure so it takes less memory (and cache footprint).
---
Based on Stephen v8: http://patchwork.dpdk.org/patch/60443/
Changes since Stephen v8:
- do not change core_id, socket_id and core_index types,
--- doc/guides/rel_notes/deprecation.rst | 4 ---- doc/guides/rel_notes/release_19_11.rst | 2 ++ lib/librte_eal/common/eal_common_launch.c | 2 ++ lib/librte_eal/common/eal_private.h | 25 +++++++++++++++++++++++++ lib/librte_eal/common/include/rte_lcore.h | 24 ------------------------ lib/librte_eal/common/rte_service.c | 2 ++ lib/librte_eal/rte_eal_version.map | 1 - lib/librte_eal/windows/eal/eal_thread.c | 1 + 8 files changed, 32 insertions(+), 29 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -4
@@ -23,10 +23,6 @@ Deprecation Notices * eal: The function ``rte_eal_remote_launch`` will return new error codes after read or write error on the pipe, instead of calling ``rte_panic``. -* eal: The ``lcore_config`` struct and global symbol will be made private to - remove it from the externally visible ABI and allow it to be updated in the - future. - * eal: both declaring and identifying devices will be streamlined in v18.11. New functions will appear to query a specific port from buses, classes of device and device drivers. Device declaration will be made coherent with the
doc/guides/rel_notes/release_19_11.rst +2 -0
@@ -202,6 +202,8 @@ ABI Changes Also, make sure to start the actual text at the margin. ========================================================= +* eal: made the ``lcore_config`` struct and global symbol private. + Shared Library Versions -----------------------
lib/librte_eal/common/eal_common_launch.c +2 -0
@@ -15,6 +15,8 @@#include <rte_per_lcore.h> #include <rte_lcore.h> +#include "eal_private.h" +/* * Wait until a lcore finished its job. */
lib/librte_eal/common/eal_private.h +25 -0
@@ -10,6 +10,31 @@#include <stdio.h> #include <rte_dev.h> +#include <rte_lcore.h> + +/** +* Structure storing internal configuration (per-lcore) +*/ +struct lcore_config { +pthread_t thread_id;/**< pthread identifier */ +int pipe_master2slave[2 ];/**< communication pipe with master */ +int pipe_slave2master[2 ];/**< communication pipe with master */ + +lcore_function_t *volatile f;/**< function to call */ +void *volatile arg;/**< argument of function */ +volatile int ret;/**< return value of function */ + +volatile enum rte_lcore_state_t state;/**< lcore state */ +unsigned int socket_id;/**< physical socket id for this lcore */ +unsigned int core_id;/**< core number on socket for this lcore */ +int core_index;/**< relative index, starting from 0 */ +uint8_t core_role;/**< role of core eg: OFF, RTE, SERVICE */ +uint8_t detected;/**< true if lcore was detected */ + +rte_cpuset_t cpuset;/**< cpu set which the lcore affinity to */ +}; + +extern struct lcore_config lcore_config[RTE_MAX_LCORE ];/** * Initialize the memzone subsystem (private to eal).
lib/librte_eal/common/include/rte_lcore.h +0 -24
@@ -66,30 +66,6 @@ typedef cpuset_t rte_cpuset_t; } while (0)#endif -/** -* Structure storing internal configuration (per-lcore) -*/ -struct lcore_config { -unsigned detected;/**< true if lcore was detected */ -pthread_t thread_id;/**< pthread identifier */ -int pipe_master2slave[2 ];/**< communication pipe with master */ -int pipe_slave2master[2 ];/**< communication pipe with master */ -lcore_function_t *volatile f;/**< function to call */ -void *volatile arg;/**< argument of function */ -volatile int ret;/**< return value of function */ -volatile enum rte_lcore_state_t state;/**< lcore state */ -unsigned socket_id;/**< physical socket id for this lcore */ -unsigned core_id;/**< core number on socket for this lcore */ -int core_index;/**< relative index, starting from 0 */ -rte_cpuset_t cpuset;/**< cpu set which the lcore affinity to */ -uint8_t core_role;/**< role of core eg: OFF, RTE, SERVICE */ -}; - -/** -* Internal configuration (per-lcore) -*/ -extern struct lcore_config lcore_config[RTE_MAX_LCORE ]; -RTE_DECLARE_PER_LCORE (unsigned, _lcore_id);/**< Per thread "lcore id". */ RTE_DECLARE_PER_LCORE (rte_cpuset_t, _cpuset);/**< Per thread "cpuset". */
lib/librte_eal/common/rte_service.c +2 -0
@@ -21,6 +21,8 @@#include <rte_memory.h> #include <rte_malloc.h> +#include "eal_private.h" +#define RTE_SERVICE_NUM_MAX 64#define SERVICE_F_REGISTERED (1 << 0)
lib/librte_eal/rte_eal_version.map +0 -1
@@ -4,7 +4,6 @@ DPDK_2.0 { __rte_panic; eal_parse_sysfs_value; eal_timer_source; - lcore_config; per_lcore__lcore_id; per_lcore__rte_errno; rte_calloc;
lib/librte_eal/windows/eal/eal_thread.c +1 -0
@@ -12,6 +12,7 @@#include <rte_common.h> #include <eal_thread.h> +#include "eal_private.h" RTE_DEFINE_PER_LCORE(unsigned int, _lcore_id) = LCORE_ID_ANY;
Signature · 1 line
1.8.3.1
PATCH v2 2/12 eal: remove deprecated CPU flags check function
In reply to David MarchandRemove rte_cpu_check_supported as announced previously.
--- doc/guides/rel_notes/deprecation.rst | 3 --- doc/guides/rel_notes/release_19_11.rst | 3 +++ lib/librte_eal/common/eal_common_cpuflags.c | 11 ----------- lib/librte_eal/common/include/generic/rte_cpuflags.h | 9 --------- lib/librte_eal/rte_eal_version.map | 1 - 5 files changed, 3 insertions(+), 24 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -3
@@ -34,9 +34,6 @@ Deprecation Notices + ``rte_eal_devargs_type_count`` -* eal: The ``rte_cpu_check_supported`` function has been deprecated since - v17.08 and will be removed. - * eal: The ``rte_malloc_virt2phy`` function has been deprecated and replaced by ``rte_malloc_virt2iova`` since v17.11 and will be removed.
doc/guides/rel_notes/release_19_11.rst +3 -0
@@ -204,6 +204,9 @@ ABI Changes * eal: made the ``lcore_config`` struct and global symbol private. +* eal: removed the ``rte_cpu_check_supported`` function, replaced by + ``rte_cpu_is_supported`` since dpdk v17.08. + Shared Library Versions -----------------------
lib/librte_eal/common/eal_common_cpuflags.c +0 -11
@@ -7,17 +7,6 @@#include <rte_common.h> #include <rte_cpuflags.h> -/** -* Checks if the machine is adequate for running the binary. If it is not, the -* program exits with status 1. -*/ -void -rte_cpu_check_supported (void ) -{ -if (!rte_cpu_is_supported ()) -exit (1 ); -} -int rte_cpu_is_supported (void ) {
lib/librte_eal/common/include/generic/rte_cpuflags.h +0 -9
@@ -49,15 +49,6 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature);/** * This function checks that the currently used CPU supports the CPU features * that were specified at compile time. It is called automatically within the -* EAL, so does not need to be used by applications. -*/ -__rte_deprecated -void -rte_cpu_check_supported (void ); - -/** -* This function checks that the currently used CPU supports the CPU features -* that were specified at compile time. It is called automatically within the * EAL, so does not need to be used by applications. This version returns a * result so that decisions may be made (for instance, graceful shutdowns). */
lib/librte_eal/rte_eal_version.map +0 -1
@@ -8,7 +8,6 @@ DPDK_2.0 { per_lcore__rte_errno; rte_calloc; rte_calloc_socket; - rte_cpu_check_supported; rte_cpu_get_flag_enabled; rte_cycles_vmware_tsc_map; rte_delay_us;
Signature · 1 line
1.8.3.1
PATCH v2 3/12 eal: remove deprecated malloc virt2phys function
In reply to David MarchandRemove rte_malloc_virt2phy as announced previously.
--- doc/guides/rel_notes/deprecation.rst | 3 --- doc/guides/rel_notes/release_19_11.rst | 3 +++ lib/librte_eal/common/include/rte_malloc.h | 7 ------- 3 files changed, 3 insertions(+), 10 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -3
@@ -34,9 +34,6 @@ Deprecation Notices + ``rte_eal_devargs_type_count`` -* eal: The ``rte_malloc_virt2phy`` function has been deprecated and replaced - by ``rte_malloc_virt2iova`` since v17.11 and will be removed. - * vfio: removal of ``rte_vfio_dma_map`` and ``rte_vfio_dma_unmap`` APIs which have been replaced with ``rte_dev_dma_map`` and ``rte_dev_dma_unmap`` functions. The due date for the removal targets DPDK 20.02.
doc/guides/rel_notes/release_19_11.rst +3 -0
@@ -207,6 +207,9 @@ ABI Changes * eal: removed the ``rte_cpu_check_supported`` function, replaced by ``rte_cpu_is_supported`` since dpdk v17.08. +* eal: removed the ``rte_malloc_virt2phy`` function, replaced by + ``rte_malloc_virt2iova`` since v17.11. + Shared Library Versions -----------------------
lib/librte_eal/common/include/rte_malloc.h +0 -7
@@ -553,13 +553,6 @@ rte_malloc_set_limit(const char *type, size_t max);rte_iova_t rte_malloc_virt2iova (const void *addr); -__rte_deprecated -static inline phys_addr_t -rte_malloc_virt2phy (const void *addr) -{ -return rte_malloc_virt2iova (addr); -} - #ifdef __cplusplus }#endif
Signature · 1 line
1.8.3.1
PATCH v2 4/12 mem: hide internal heap header
In reply to David MarchandLet's avoid exporting structures without an identified usecase.
--- app/test-pmd/testpmd.c | 1 - lib/librte_eal/common/Makefile | 2 +- lib/librte_eal/common/eal_memcfg.h | 3 ++- lib/librte_eal/common/include/rte_malloc_heap.h | 35 ------------------------- lib/librte_eal/common/malloc_heap.h | 25 +++++++++++++++++- lib/librte_eal/common/meson.build | 1 - 6 files changed, 27 insertions(+), 40 deletions(-) delete mode 100644 lib/librte_eal/common/include/rte_malloc_heap.h
app/test-pmd/testpmd.c +0 -1
@@ -27,7 +27,6 @@#include <rte_log.h> #include <rte_debug.h> #include <rte_cycles.h> -#include <rte_malloc_heap.h> #include <rte_memory.h> #include <rte_memcpy.h> #include <rte_launch.h>
lib/librte_eal/common/Makefile +1 -1
@@ -10,7 +10,7 @@ INC += rte_log.h rte_memory.h rte_memzone.h INC += rte_per_lcore.h rte_random.h INC += rte_tailq.h rte_interrupts.h rte_alarm.h INC += rte_string_fns.h rte_version.h -INC += rte_eal_memconfig.h rte_malloc_heap.h +INC += rte_eal_memconfig.h INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h rte_class.h INC += rte_option.h INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h
lib/librte_eal/common/eal_memcfg.h +2 -1
@@ -6,7 +6,6 @@#define EAL_MEMCFG_H #include <rte_config.h> -#include <rte_malloc_heap.h> #include <rte_memory.h> #include <rte_memzone.h> #include <rte_pause.h>
@@ -14,6 +13,8 @@#include <rte_rwlock.h> #include <rte_tailq.h> +#include "malloc_heap.h" +/** * Memory configuration shared across multiple processes. */
lib/librte_eal/common/include/rte_malloc_heap.h deleted +0 -35
@@ -1,35 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause -* Copyright(c) 2010-2014 Intel Corporation -*/ - -#ifndef _RTE_MALLOC_HEAP_H_ -#define _RTE_MALLOC_HEAP_H_ - -#include <stddef.h> -#include <sys/queue.h> -#include <rte_spinlock.h> -#include <rte_memory.h> - -/* Number of free lists per heap, grouped by size. */ -#define RTE_HEAP_NUM_FREELISTS 13 -#define RTE_HEAP_NAME_MAX_LEN 32 - -/* dummy definition, for pointers */ -struct malloc_elem ; - -/** -* Structure to hold malloc heap -*/ -struct malloc_heap { -rte_spinlock_t lock; - LIST_HEAD(, malloc_elem) free_head[RTE_HEAP_NUM_FREELISTS]; -struct malloc_elem *volatile first; -struct malloc_elem *volatile last; - -unsigned alloc_count; -unsigned int socket_id; -size_t total_size; -char name[RTE_HEAP_NAME_MAX_LEN ]; -} __rte_cache_aligned; - -#endif /* _RTE_MALLOC_HEAP_H_ */
lib/librte_eal/common/malloc_heap.h +24 -1
@@ -6,9 +6,32 @@#define MALLOC_HEAP_H_ #include <stdbool.h> +#include <sys/queue.h> #include <rte_malloc.h> -#include <rte_malloc_heap.h> +#include <rte_spinlock.h> + +/* Number of free lists per heap, grouped by size. */ +#define RTE_HEAP_NUM_FREELISTS 13 +#define RTE_HEAP_NAME_MAX_LEN 32 + +/* dummy definition, for pointers */ +struct malloc_elem ; + +/** +* Structure to hold malloc heap +*/ +struct malloc_heap { +rte_spinlock_t lock; + LIST_HEAD(, malloc_elem) free_head[RTE_HEAP_NUM_FREELISTS]; +struct malloc_elem *volatile first; +struct malloc_elem *volatile last; + +unsigned int alloc_count; +unsigned int socket_id; +size_t total_size; +char name[RTE_HEAP_NAME_MAX_LEN ]; +} __rte_cache_aligned;#ifdef __cplusplusextern "C" {
lib/librte_eal/common/meson.build +0 -1
@@ -72,7 +72,6 @@ common_headers = files( 'include/rte_lcore.h', 'include/rte_log.h', 'include/rte_malloc.h', - 'include/rte_malloc_heap.h', 'include/rte_memory.h', 'include/rte_memzone.h', 'include/rte_option.h',
Signature · 1 line
1.8.3.1
PATCH v2 5/12 net/bonding: use non deprecated PCI API
In reply to David Marchandrte_eal_compare_pci_addr has been deprecated since v17.11. Convert to rte_pci_addr_cmp.
--- drivers/net/bonding/rte_eth_bond_args.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/bonding/rte_eth_bond_args.c +2 -3
@@ -60,11 +60,10 @@ find_port_id_by_dev_name(const char *name)static inline int bond_pci_addr_cmp (const struct rte_device *dev,const void *_pci_addr) { -struct rte_pci_device *pdev; +const struct rte_pci_device *pdev =RTE_DEV_TO_PCI_CONST (dev);const struct rte_pci_addr *paddr = _pci_addr; - pdev =RTE_DEV_TO_PCI (*(struct rte_device **)(void *)&dev); -return rte_eal_compare_pci_addr (&pdev->addr, paddr); +return rte_pci_addr_cmp (&pdev->addr, paddr); }/**
Signature · 1 line
1.8.3.1
PATCH v2 6/12 pci: remove deprecated functions
In reply to David MarchandThose functions have been deprecated since 17.11 and have 1:1 replacement.
--- doc/guides/rel_notes/deprecation.rst | 7 ----- doc/guides/rel_notes/release_19_11.rst | 6 +++++ lib/librte_pci/rte_pci.c | 19 -------------- lib/librte_pci/rte_pci.h | 47 ---------------------------------- lib/librte_pci/rte_pci_version.map | 3 --- 5 files changed, 6 insertions(+), 76 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -7
@@ -38,13 +38,6 @@ Deprecation Notices have been replaced with ``rte_dev_dma_map`` and ``rte_dev_dma_unmap`` functions. The due date for the removal targets DPDK 20.02. -* pci: Several exposed functions are misnamed. - The following functions are deprecated starting from v17.11 and are replaced: - - - ``eal_parse_pci_BDF`` replaced by ``rte_pci_addr_parse`` - - ``eal_parse_pci_DomBDF`` replaced by ``rte_pci_addr_parse`` - - ``rte_eal_compare_pci_addr`` replaced by ``rte_pci_addr_cmp`` - * dpaa2: removal of ``rte_dpaa2_memsegs`` structure which has been replaced by a pa-va search library. This structure was earlier being used for holding memory segments used by dpaa2 driver for faster pa->va translation. This
doc/guides/rel_notes/release_19_11.rst +6 -0
@@ -210,6 +210,12 @@ ABI Changes * eal: removed the ``rte_malloc_virt2phy`` function, replaced by ``rte_malloc_virt2iova`` since v17.11. +* pci: removed the following deprecated functions since dpdk: + + - ``eal_parse_pci_BDF`` replaced by ``rte_pci_addr_parse`` + - ``eal_parse_pci_DomBDF`` replaced by ``rte_pci_addr_parse`` + - ``rte_eal_compare_pci_addr`` replaced by ``rte_pci_addr_cmp`` + Shared Library Versions -----------------------
lib/librte_pci/rte_pci.c +0 -19
@@ -87,18 +87,6 @@ pci_dbdf_parse(const char *input, struct rte_pci_addr *dev_addr)return 0 ; } -int -eal_parse_pci_BDF (const char *input,struct rte_pci_addr *dev_addr) -{ -return pci_bdf_parse (input, dev_addr); -} - -int -eal_parse_pci_DomBDF (const char *input,struct rte_pci_addr *dev_addr) -{ -return pci_dbdf_parse (input, dev_addr); -} -void rte_pci_device_name (const struct rte_pci_addr *addr,char *output,size_t size)
@@ -110,13 +98,6 @@ rte_pci_device_name(const struct rte_pci_addr *addr, }int -rte_eal_compare_pci_addr (const struct rte_pci_addr *addr, -const struct rte_pci_addr *addr2) -{ -return rte_pci_addr_cmp (addr, addr2); -} - -int rte_pci_addr_cmp (const struct rte_pci_addr *addr,const struct rte_pci_addr *addr2) {
lib/librte_pci/rte_pci.h +0 -47
59 lines not on this page · raw message
lib/librte_pci/rte_pci_version.map +0 -3
@@ -1,11 +1,8 @@ DPDK_17.11 { global: - eal_parse_pci_BDF; - eal_parse_pci_DomBDF; pci_map_resource; pci_unmap_resource; - rte_eal_compare_pci_addr; rte_pci_addr_cmp; rte_pci_addr_parse; rte_pci_device_name;
Signature · 1 line
1.8.3.1
PATCH v2 7/12 log: add log stream accessor
In reply to David MarchandDefine an accessor so that users can write their debug message to the same stream than the rte_log infrastructure.
Use it in the qat infrastructure.
---
Changelog since v1:
- use ternary operator,
--- drivers/common/qat/qat_logs.c | 3 +-- drivers/common/qat/qat_logs.h | 3 +-- lib/librte_eal/common/eal_common_log.c | 33 +++++++++++++++++++-------------- lib/librte_eal/common/include/rte_log.h | 13 +++++++++++++ lib/librte_eal/rte_eal_version.map | 3 +++ 5 files changed, 37 insertions(+), 18 deletions(-)
drivers/common/qat/qat_logs.c +1 -2
@@ -19,8 +19,7 @@ qat_hexdump_log(uint32_t level, uint32_t logtype, const char *title,if (level > (uint32_t )(rte_log_get_level (logtype)))return 0 ; -rte_hexdump (rte_logs.file ==NULL ? stderr : rte_logs.file, - title, buf, len); +rte_hexdump (rte_log_get_stream (), title, buf, len);return 0 ; }
drivers/common/qat/qat_logs.h +1 -2
@@ -24,8 +24,7 @@ extern int qat_dp_logtype;* * Dump out the message buffer in a special hex dump output format with * characters printed for each line of 16 hex values. The message will be sent -* to the stream defined by rte_logs.file or to stderr in case of rte_logs.file -* is undefined. +* to the stream used by the rte_log infrastructure. */ int qat_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
lib/librte_eal/common/eal_common_log.c +19 -14
@@ -71,6 +71,24 @@ rte_openlog_stream(FILE *f)return 0 ; } +FILE * +rte_log_get_stream (void ) +{ +FILE *f = rte_logs.file; + +if (f ==NULL ) { +/* +* Grab the current value of stderr here, rather than +* just initializing default_log_stream to stderr. This +* ensures that we will always use the current value +* of stderr, even if the application closes and +* reopens it. +*/ +return default_log_stream ? : stderr; + } +return f; +} +/* Set global log level */ void rte_log_set_global_level (uint32_t level)
@@ -396,21 +414,8 @@ rte_log_dump(FILE *f)int rte_vlog (uint32_t level,uint32_t logtype,const char *format,va_list ap) { +FILE *f =rte_log_get_stream ();int ret; -FILE *f = rte_logs.file; -if (f ==NULL ) { - f = default_log_stream; -if (f ==NULL ) { -/* -* Grab the current value of stderr here, rather than -* just initializing default_log_stream to stderr. This -* ensures that we will always use the current value -* of stderr, even if the application closes and -* reopens it. -*/ - f = stderr; - } - }if (level > rte_logs.level)return 0 ;
lib/librte_eal/common/include/rte_log.h +13 -0
@@ -102,6 +102,19 @@ extern struct rte_logs rte_logs;int rte_openlog_stream (FILE *f);/** +* @warning +* @b EXPERIMENTAL: this API may change without prior notice +* +* Retrieve the stream used by the logging system (see rte_openlog_stream() +* to change it). +* +* @return +* Pointer to the stream. +*/ +__rte_experimental +FILE *rte_log_get_stream(void); + +/** * Set the global log level. * * After this call, logs with a level lower or equal than the level
lib/librte_eal/rte_eal_version.map +3 -0
@@ -417,4 +417,7 @@ EXPERIMENTAL { rte_mcfg_timer_lock; rte_mcfg_timer_unlock; rte_rand_max; + + # added in 19.11 + rte_log_get_stream; };
Signature · 1 line
1.8.3.1
PATCH v2 8/12 log: hide internal log structure
In reply to David MarchandNo need to expose rte_logs, hide it and remove it from the current ABI.
---
Changelog since v1:
- updated release notes,
--- doc/guides/rel_notes/release_19_11.rst | 2 ++ lib/librte_eal/common/eal_common_log.c | 23 ++++++++++++++++------- lib/librte_eal/common/include/rte_log.h | 20 +++----------------- lib/librte_eal/rte_eal_version.map | 1 - 4 files changed, 21 insertions(+), 25 deletions(-)
doc/guides/rel_notes/release_19_11.rst +2 -0
@@ -210,6 +210,8 @@ ABI Changes * eal: removed the ``rte_malloc_virt2phy`` function, replaced by ``rte_malloc_virt2iova`` since v17.11. +* eal: made the ``rte_logs`` struct and global symbol private. + * pci: removed the following deprecated functions since dpdk: - ``eal_parse_pci_BDF`` replaced by ``rte_pci_addr_parse``
lib/librte_eal/common/eal_common_log.c +16 -7
@@ -17,13 +17,6 @@#include "eal_private.h" -/* global log structure */ -struct rte_logs rte_logs = { - .type = ~0 , - .level =RTE_LOG_DEBUG , - .file =NULL , -}; -struct rte_eal_opt_loglevel {/** Next list entry */ TAILQ_ENTRY (rte_eal_opt_loglevel) next;
@@ -58,6 +51,22 @@ struct rte_log_dynamic_type {uint32_t loglevel; }; +/** The rte_log structure. */ +struct rte_logs { +uint32_t type;/**< Bitfield with enabled logs. */ +uint32_t level;/**< Log level. */ +FILE *file;/**< Output file set by rte_openlog_stream, or NULL. */ +size_t dynamic_types_len; +struct rte_log_dynamic_type *dynamic_types; +}; + +/* global log structure */ +static struct rte_logs rte_logs = { + .type = ~0 , + .level =RTE_LOG_DEBUG , + .file =NULL , +}; +/* per core log */ static RTE_DEFINE_PER_LCORE(struct log_cur_msg, log_cur_msg);
lib/librte_eal/common/include/rte_log.h +3 -17
@@ -26,20 +26,6 @@ extern "C" {#include <rte_config.h> #include <rte_compat.h> -struct rte_log_dynamic_type ; - -/** The rte_log structure. */ -struct rte_logs { -uint32_t type;/**< Bitfield with enabled logs. */ -uint32_t level;/**< Log level. */ -FILE *file;/**< Output file set by rte_openlog_stream, or NULL. */ -size_t dynamic_types_len; -struct rte_log_dynamic_type *dynamic_types; -}; - -/** Global log information */ -extern struct rte_logs rte_logs; -/* SDK log type */ #define RTE_LOGTYPE_EAL 0/**< Log related to eal. */ #define RTE_LOGTYPE_MALLOC 1/**< Log related to malloc. */
@@ -260,7 +246,7 @@ void rte_log_dump(FILE *f);* to rte_openlog_stream(). * * The level argument determines if the log should be displayed or -* not, depending on the global rte_logs variable. +* not, depending on the global log level and the per logtype level. * * The preferred alternative is the RTE_LOG() because it adds the * level and type in the logged string.
@@ -291,8 +277,8 @@ int rte_log(uint32_t level, uint32_t logtype, const char *format, ...)* to rte_openlog_stream(). * * The level argument determines if the log should be displayed or -* not, depending on the global rte_logs variable. A trailing -* newline may be added if needed. +* not, depending on the global log level and the per logtype level. +* A trailing newline may be added if needed. * * The preferred alternative is the RTE_LOG() because it adds the * level and type in the logged string.
lib/librte_eal/rte_eal_version.map +0 -1
@@ -45,7 +45,6 @@ DPDK_2.0 { rte_log; rte_log_cur_msg_loglevel; rte_log_cur_msg_logtype; - rte_logs; rte_malloc; rte_malloc_dump_stats; rte_malloc_get_socket_stats;
Signature · 1 line
1.8.3.1
Re: [dpdk-dev] [PATCH v2 08/12] log: hide internal log structure
23/10/2019 20:54, David Marchand:
Quoted 4 lines
No need to expose
rte_logs, hide it and remove it from the current ABI.Signed-off-by David Marchand <[email protected]>
[...]
lib/librte_eal/common/include/rte_log.h extern "C" { · line 38
Quoted 12 lines
lib/librte_eal/common/include/rte_log.h +0
-10-struct rte_log_dynamic_type ; - -/** The rte_log structure. */ -struct rte_logs { -uint32_t type;/**< Bitfield with enabled logs. */ -uint32_t level;/**< Log level. */ -FILE *file;/**< Output file set by rte_openlog_stream, or NULL. */ -size_t dynamic_types_len; -struct rte_log_dynamic_type *dynamic_types; -};
I like this kind of change, but the FILE stream is available only through the new experimental function. It is against the famous Mr Traynor rule:
we cannot deprecate or remove an old stable symbol if the replacement is experimental.
Kevin Traynor
Acked-byRe: [dpdk-dev] [PATCH v2 08/12] log: hide internal log structure
Quoted 6 lines · Thomas Monjalon
23/10/2019 20:54, David Marchand:
Quoted 4 lines
No need to expose
rte_logs, hide it and remove it from the current ABI.Signed-off-by David Marchand <[email protected]>[...]
Quoted 18 lines
lib/librte_eal/common/include/rte_log.h extern "C" { · line 38
Quoted 12 lines
lib/librte_eal/common/include/rte_log.h +0
-10-struct rte_log_dynamic_type ; - -/** The rte_log structure. */ -struct rte_logs { -uint32_t type;/**< Bitfield with enabled logs. */ -uint32_t level;/**< Log level. */ -FILE *file;/**< Output file set by rte_openlog_stream, or NULL. */ -size_t dynamic_types_len; -struct rte_log_dynamic_type *dynamic_types; -};I like this kind of change, but the FILE stream is available only through the new experimental function. It is against the famous Mr Traynor rule:
we cannot deprecate or remove an old stable symbol if the replacement is experimental.
For the change
++ for the rule (although s/we cannot/Thou shall not/ sounds more biblical)
As for accessor function being experimental, it is so simple I don't see any issue with promoting it now. OTOH, if no one is planning to change the struct anytime soon, it's probably fine to keep it public and promote the fn. later.
PATCH v2 9/12 test/mem: remove dependency on EAL internals
In reply to David MarchandRather than dereference the mem_config internal structure, we can rely on the rte_memzone_walk API and count memzones.
--- app/test/test_memzone.c | 50 ++++++++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 19 deletions(-)
app/test/test_memzone.c +31 -19
@@ -13,12 +13,12 @@#include <rte_memory.h> #include <rte_memzone.h> #include <rte_eal.h> +#include <rte_lcore.h> #include <rte_common.h> #include <rte_string_fns.h> #include <rte_errno.h> #include <rte_malloc.h> #include "../../lib/librte_eal/common/malloc_elem.h" -#include "../../lib/librte_eal/common/eal_memcfg.h" #include "test.h"
@@ -927,6 +927,16 @@ test_memzone_free(void)return 0 ; } +static int test_memzones_left; +static int memzone_walk_cnt; +static void memzone_walk_clb (const struct rte_memzone *mz, + void *arg __rte_unused) +{ + memzone_walk_cnt++; +if (!strncmp (TEST_MEMZONE_NAME ("" ), mz->name,RTE_MEMZONE_NAMESIZE )) + test_memzones_left++; +} +static int test_memzone_basic (void ) {
@@ -936,8 +946,12 @@ test_memzone_basic(void)const struct rte_memzone *memzone4;const struct rte_memzone *mz;int memzone_cnt_after, memzone_cnt_expected; -int memzone_cnt_before = -rte_eal_get_configuration ()->mem_config->memzones.count; +int memzone_cnt_before; + + memzone_walk_cnt =0 ; + test_memzones_left =0 ; +rte_memzone_walk (memzone_walk_clb,NULL ); + memzone_cnt_before = memzone_walk_cnt; memzone1 =rte_memzone_reserve (TEST_MEMZONE_NAME ("testzone1" ),100 ,SOCKET_ID_ANY ,0 );
@@ -960,8 +974,10 @@ test_memzone_basic(void) (memzone1 !=NULL ) + (memzone2 !=NULL ) + (memzone3 !=NULL ) + (memzone4 !=NULL ); - memzone_cnt_after = -rte_eal_get_configuration ()->mem_config->memzones.count; + memzone_walk_cnt =0 ; + test_memzones_left =0 ; +rte_memzone_walk (memzone_walk_clb,NULL ); + memzone_cnt_after = memzone_walk_cnt;if (memzone_cnt_after != memzone_cnt_expected)return -1 ;
@@ -1039,30 +1055,26 @@ test_memzone_basic(void)return -1 ; } - memzone_cnt_after = -rte_eal_get_configuration ()->mem_config->memzones.count; + memzone_walk_cnt =0 ; + test_memzones_left =0 ; +rte_memzone_walk (memzone_walk_clb,NULL ); + memzone_cnt_after = memzone_walk_cnt;if (memzone_cnt_after != memzone_cnt_before)return -1 ;return 0 ; } -static int test_memzones_left; -static int memzone_walk_cnt; -static void memzone_walk_clb (const struct rte_memzone *mz, - void *arg __rte_unused) -{ - memzone_walk_cnt++; -if (!strncmp (TEST_MEMZONE_NAME ("" ), mz->name,RTE_MEMZONE_NAMESIZE )) - test_memzones_left++; -} -static int test_memzone (void ) {/* take note of how many memzones were allocated before running */ -int memzone_cnt = -rte_eal_get_configuration ()->mem_config->memzones.count; +int memzone_cnt; + + memzone_walk_cnt =0 ; + test_memzones_left =0 ; +rte_memzone_walk (memzone_walk_clb,NULL ); + memzone_cnt = memzone_walk_cnt;printf ("test basic memzone API\n" );if (test_memzone_basic () <0 )
Signature · 1 line
1.8.3.1
PATCH v2 10/12 eal: deinline lcore APIs
In reply to David MarchandThose functions are used to setup or take control decisions. Move them into the EAL common code and put them directly in the stable ABI.
--- lib/librte_eal/common/eal_common_lcore.c | 38 ++++++++++++++++++++++++++++ lib/librte_eal/common/include/rte_lcore.h | 41 +++---------------------------- lib/librte_eal/rte_eal_version.map | 10 ++++++++ 3 files changed, 52 insertions(+), 37 deletions(-)
lib/librte_eal/common/eal_common_lcore.c +38 -0
@@ -16,6 +16,16 @@#include "eal_private.h" #include "eal_thread.h" +unsigned int rte_get_master_lcore (void ) +{ +return rte_eal_get_configuration ()->master_lcore; +} + +unsigned int rte_lcore_count (void ) +{ +return rte_eal_get_configuration ()->lcore_count; +} +int rte_lcore_index (int lcore_id) {if (unlikely (lcore_id >=RTE_MAX_LCORE ))
@@ -43,6 +53,34 @@ rte_cpuset_t rte_lcore_cpuset(unsigned int lcore_id)return lcore_config[lcore_id].cpuset; } +int rte_lcore_is_enabled (unsigned int lcore_id) +{ +struct rte_config *cfg =rte_eal_get_configuration (); + +if (lcore_id >=RTE_MAX_LCORE ) +return 0 ; +return cfg->lcore_role[lcore_id] ==ROLE_RTE ; +} + +unsigned int rte_get_next_lcore (unsigned int i,int skip_master,int wrap) +{ + i++; +if (wrap) + i %=RTE_MAX_LCORE ; + +while (i <RTE_MAX_LCORE ) { +if (!rte_lcore_is_enabled (i) || + (skip_master && (i ==rte_get_master_lcore ()))) { + i++; +if (wrap) + i %=RTE_MAX_LCORE ; +continue ; + } +break ; + } +return i; +} +unsigned int rte_lcore_to_socket_id (unsigned int lcore_id) {
lib/librte_eal/common/include/rte_lcore.h +4 -37
66 lines not on this page · raw message
lib/librte_eal/rte_eal_version.map +10 -0
@@ -309,6 +309,16 @@ DPDK_19.08 { } DPDK_19.05; +DPDK_19.11 { + global: + + rte_get_master_lcore; + rte_get_next_lcore; + rte_lcore_count; + rte_lcore_is_enabled; + +} DPDK_19.08; + EXPERIMENTAL { global:
Signature · 1 line
1.8.3.1
PATCH v2 11/12 eal: factorize lcore role code in common code
In reply to David MarchandThis code belongs to the lcore API, move the prototype to the right header, then factorize the code into the common code.
--- lib/librte_eal/common/eal_common_lcore.c | 10 ++++++++++ lib/librte_eal/common/include/rte_eal.h | 11 ----------- lib/librte_eal/common/include/rte_lcore.h | 10 ++++++++++ lib/librte_eal/freebsd/eal/eal.c | 7 ------- lib/librte_eal/linux/eal/eal.c | 7 ------- 5 files changed, 20 insertions(+), 25 deletions(-)
lib/librte_eal/common/eal_common_lcore.c +10 -0
@@ -53,6 +53,16 @@ rte_cpuset_t rte_lcore_cpuset(unsigned int lcore_id)return lcore_config[lcore_id].cpuset; } +enum rte_lcore_role_t +rte_eal_lcore_role (unsigned int lcore_id) +{ +struct rte_config *cfg =rte_eal_get_configuration (); + +if (lcore_id >=RTE_MAX_LCORE ) +return ROLE_OFF ; +return cfg->lcore_role[lcore_id]; +} +int rte_lcore_is_enabled (unsigned int lcore_id) {struct rte_config *cfg =rte_eal_get_configuration ();
lib/librte_eal/common/include/rte_eal.h +0 -11
@@ -84,17 +84,6 @@ struct rte_config {struct rte_config *rte_eal_get_configuration (void );/** -* Get a lcore's role. -* -* @param lcore_id -* The identifier of the lcore. -* @return -* The role of the lcore. -*/ -enum rte_lcore_role_t rte_eal_lcore_role (unsigned lcore_id); - - -/** * Get the process type in a multi-process setup * * @return
lib/librte_eal/common/include/rte_lcore.h +10 -0
@@ -70,6 +70,16 @@ RTE_DECLARE_PER_LCORE(unsigned, _lcore_id); /**< Per thread "lcore id". */RTE_DECLARE_PER_LCORE (rte_cpuset_t, _cpuset);/**< Per thread "cpuset". */ /** +* Get a lcore's role. +* +* @param lcore_id +* The identifier of the lcore, which MUST be between 0 and RTE_MAX_LCORE-1. +* @return +* The role of the lcore. +*/ +enum rte_lcore_role_t rte_eal_lcore_role (unsigned int lcore_id); + +/** * Return the Application thread ID of the execution unit. * * Note: in most cases the lcore id returned here will also correspond
lib/librte_eal/freebsd/eal/eal.c +0 -7
@@ -943,13 +943,6 @@ rte_eal_cleanup(void)return 0 ; } -/* get core role */ -enum rte_lcore_role_t -rte_eal_lcore_role (unsigned lcore_id) -{ -return rte_config.lcore_role[lcore_id]; -} -enum rte_proc_type_t rte_eal_process_type (void ) {
lib/librte_eal/linux/eal/eal.c +0 -7
@@ -1348,13 +1348,6 @@ rte_eal_cleanup(void)return 0 ; } -/* get core role */ -enum rte_lcore_role_t -rte_eal_lcore_role (unsigned lcore_id) -{ -return rte_config.lcore_role[lcore_id]; -} -enum rte_proc_type_t rte_eal_process_type (void ) {
Signature · 1 line
1.8.3.1
PATCH v2 12/12 eal: make the global configuration private
In reply to David MarchandNow that all elements of the rte_config structure have (deinlined) accessors, we can hide it.
--- doc/guides/rel_notes/release_19_11.rst | 3 +++ lib/librte_eal/common/eal_common_mcfg.c | 1 + lib/librte_eal/common/eal_private.h | 32 ++++++++++++++++++++++++++++++++ lib/librte_eal/common/include/rte_eal.h | 32 -------------------------------- lib/librte_eal/common/malloc_heap.c | 1 + lib/librte_eal/common/rte_malloc.c | 1 + lib/librte_eal/rte_eal_version.map | 1 - 7 files changed, 38 insertions(+), 33 deletions(-)
doc/guides/rel_notes/release_19_11.rst +3 -0
@@ -212,6 +212,9 @@ ABI Changes * eal: made the ``rte_logs`` struct and global symbol private. +* eal: made the ``rte_config`` struct and ``rte_eal_get_configuration`` + function private. + * pci: removed the following deprecated functions since dpdk: - ``eal_parse_pci_BDF`` replaced by ``rte_pci_addr_parse``
lib/librte_eal/common/eal_common_mcfg.c +1 -0
@@ -8,6 +8,7 @@#include "eal_internal_cfg.h" #include "eal_memcfg.h" +#include "eal_private.h" void eal_mcfg_complete (void )
lib/librte_eal/common/eal_private.h +32 -0
@@ -37,6 +37,38 @@ struct lcore_config {extern struct lcore_config lcore_config[RTE_MAX_LCORE ];/** +* The global RTE configuration structure. +*/ +struct rte_config { +uint32_t master_lcore;/**< Id of the master lcore */ +uint32_t lcore_count;/**< Number of available logical cores. */ +uint32_t numa_node_count;/**< Number of detected NUMA nodes. */ +uint32_t numa_nodes[RTE_MAX_NUMA_NODES ];/**< List of detected NUMA nodes. */ +uint32_t service_lcore_count;/**< Number of available service cores. */ +enum rte_lcore_role_t lcore_role[RTE_MAX_LCORE ];/**< State of cores. */ + +/** Primary or secondary configuration */ +enum rte_proc_type_t process_type; + +/** PA or VA mapping mode */ +enum rte_iova_mode iova_mode; + +/** +* Pointer to memory configuration, which may be shared across multiple +* DPDK instances +*/ +struct rte_mem_config *mem_config; +} __attribute__((__packed__ )); + +/** +* Get the global configuration structure. +* +* @return +* A pointer to the global configuration structure. +*/ +struct rte_config *rte_eal_get_configuration (void ); + +/** * Initialize the memzone subsystem (private to eal). * * @return
lib/librte_eal/common/include/rte_eal.h +0 -32
@@ -52,38 +52,6 @@ enum rte_proc_type_t { };/** -* The global RTE configuration structure. -*/ -struct rte_config { -uint32_t master_lcore;/**< Id of the master lcore */ -uint32_t lcore_count;/**< Number of available logical cores. */ -uint32_t numa_node_count;/**< Number of detected NUMA nodes. */ -uint32_t numa_nodes[RTE_MAX_NUMA_NODES ];/**< List of detected NUMA nodes. */ -uint32_t service_lcore_count;/**< Number of available service cores. */ -enum rte_lcore_role_t lcore_role[RTE_MAX_LCORE ];/**< State of cores. */ - -/** Primary or secondary configuration */ -enum rte_proc_type_t process_type; - -/** PA or VA mapping mode */ -enum rte_iova_mode iova_mode; - -/** -* Pointer to memory configuration, which may be shared across multiple -* DPDK instances -*/ -struct rte_mem_config *mem_config; -} __attribute__((__packed__ )); - -/** -* Get the global configuration structure. -* -* @return -* A pointer to the global configuration structure. -*/ -struct rte_config *rte_eal_get_configuration (void ); - -/** * Get the process type in a multi-process setup * * @return
lib/librte_eal/common/malloc_heap.c +1 -0
@@ -27,6 +27,7 @@#include "eal_internal_cfg.h" #include "eal_memalloc.h" #include "eal_memcfg.h" +#include "eal_private.h" #include "malloc_elem.h" #include "malloc_heap.h" #include "malloc_mp.h"
lib/librte_eal/common/rte_malloc.c +1 -0
@@ -26,6 +26,7 @@#include "malloc_heap.h" #include "eal_memalloc.h" #include "eal_memcfg.h" +#include "eal_private.h" /* Free the memory space back to heap */
lib/librte_eal/rte_eal_version.map +0 -1
@@ -17,7 +17,6 @@ DPDK_2.0 { rte_dump_tailq; rte_eal_alarm_cancel; rte_eal_alarm_set; - rte_eal_get_configuration; rte_eal_get_lcore_state; rte_eal_get_physmem_size; rte_eal_has_hugepages;
Signature · 1 line
1.8.3.1
Quoted 5 lines · On Wed, 23 Oct 2019 20:54:12 +0200 David Marchand <[email protected]>…
Let's prepare for the ABI freeze.
The first patches are about changes that had been announced before (with a patch from Stephen that I took as it is ready as is from my pov).
Quoted 8 lines
The
malloc_heapstructure from the memory subsystem can be hidden. The PCI library had some forgotten deprecated APIs that are removed with this series.
rte_logscould be hidden, but I am not that confortable about doing it right away: I added an accessor to rte_logs.file, but I am fine with dropping the last patch and wait for actually hiding this in the next ABI break.
19.11 is an api/abi break so maybe do it now.
Quoted 13 lines · Stephen Hemminger
Quoted 9 lines · On Wed, 23 Oct 2019 20:54:12 +0200 David Marchand <[email protected]>…
Let's prepare for the ABI freeze.
The first patches are about changes that had been announced before (with a patch from Stephen that I took as it is ready as is from my pov).
The
malloc_heapstructure from the memory subsystem can be hidden. The PCI library had some forgotten deprecated APIs that are removed with this series.
Quoted 6 lines
Quoted 4 lines
rte_logscould be hidden, but I am not that confortable about doing it right away: I added an accessor to rte_logs.file, but I am fine with dropping the last patch and wait for actually hiding this in the next ABI break.19.11 is an api/abi break so maybe do it now.
Did you look at the 4 new patches too?
Same concern + this was not announced before either.
I went and hid more internals, I did not see an impact on really basic bench.
I would appreciate other opinions.
Signature · 1 line
David Marchand
Quoted 20 lines · On Thu, 24 Oct 2019 09:32:10 +0200 David Marchand <[email protected]>…
Quoted 18 lines · Stephen Hemminger
Quoted 13 lines · On Wed, 23 Oct 2019 20:54:12 +0200 David Marchand <[email protected]>…
Let's prepare for the ABI freeze.
The first patches are about changes that had been announced before (with a patch from Stephen that I took as it is ready as is from my pov).
The
malloc_heapstructure from the memory subsystem can be hidden. The PCI library had some forgotten deprecated APIs that are removed with this series.
rte_logscould be hidden, but I am not that confortable about doing it right away: I added an accessor to rte_logs.file, but I am fine with dropping the last patch and wait for actually hiding this in the next ABI break.
Quoted 10 lines
Quoted 1 line
19.11 is an api/abi break so maybe do it now.
Did you look at the 4 new patches too?
Same concern + this was not announced before either.
I went and hid more internals, I did not see an impact on really basic bench.I would appreciate other opinions.
These all look good. There is probably a lot more that could be done, adding more accessors in 20.02 could help but more hiding won't happen again until 20.11
Quoted 7 lines · Stephen Hemminger
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
rte_logscould be hidden, but I am not that confortable about doing it right away: I added an accessor to rte_logs.file, but I am fine with dropping the last patch and wait for actually hiding this in the next ABI break.19.11 is an api/abi break so maybe do it now.
Quoted 7 lines
Quoted 3 lines
I went and hid more internals, I did not see an impact on really basic bench.
I would appreciate other opinions.
These all look good. There is probably a lot more that could be done, adding more accessors in 20.02 could help but more hiding won't happen again until 20.11
Yes, I went with the low hanging fruits.
It is a long term effort in any case, when reviewing too.
Signature · 1 line
David Marchand
23/10/2019 20:54, David Marchand:
Quoted 14 lines
Let's prepare for the ABI freeze.
The first patches are about changes that had been announced before (with a patch from Stephen that I took as it is ready as is from my pov).
The
malloc_heapstructure from the memory subsystem can be hidden. The PCI library had some forgotten deprecated APIs that are removed with this series.
rte_logscould be hidden, but I am not that confortable about doing it right away: I added an accessor to rte_logs.file, but I am fine with dropping the last patch and wait for actually hiding this in the next ABI break.
Quoted 5 lines
Changelog since v1:
- I went a step further, hidingrte_configafter de-inlining non critical functionsComments?
Except patch 8 (hiding rte_logs),
v3 cover EAL and PCI ABI changes for 19.11
In reply to David MarchandLet's prepare for the ABI freeze.
The first patches are about changes that had been announced before.
The malloc_heap structure from the memory subsystem can be hidden. The PCI library had some forgotten deprecated APIs that are removed with this series.
rte_logs could be hidden, but I left it exposed for now. I added an accessor to rte_logs.file, and added a deprecation notice announcing its removal from the public ABI.
Changelog since v2:
- dropped patch 8 and added a deprecation notice on rte_logs instead,
Changelog since v1:
- I went a step further, hiding rte_config after de-inlining non critical functions
Signature · 56 lines
David Marchand David Marchand (11): eal: remove deprecated CPU flags check function eal: remove deprecated malloc virt2phys function mem: hide internal heap header net/bonding: use non deprecated PCI API pci: remove deprecated functions log: add log stream accessor test/mem: remove dependency on EAL internals eal: deinline lcore APIs eal: factorize lcore role code eal: make the global configuration private doc: announce global logs struct removal from ABI Stephen Hemminger (1): eal: make lcore config private app/test-pmd/testpmd.c | 1 - app/test/test_memzone.c | 50 +++++++++------ doc/guides/rel_notes/deprecation.rst | 19 +----- doc/guides/rel_notes/release_19_11.rst | 17 +++++ drivers/common/qat/qat_logs.c | 3 +- drivers/common/qat/qat_logs.h | 3 +- drivers/net/bonding/rte_eth_bond_args.c | 5 +- lib/librte_eal/common/Makefile | 2 +- lib/librte_eal/common/eal_common_cpuflags.c | 11 ---- lib/librte_eal/common/eal_common_launch.c | 2 + lib/librte_eal/common/eal_common_lcore.c | 48 ++++++++++++++ lib/librte_eal/common/eal_common_log.c | 33 +++++----- lib/librte_eal/common/eal_common_mcfg.c | 1 + lib/librte_eal/common/eal_memcfg.h | 3 +- lib/librte_eal/common/eal_private.h | 57 +++++++++++++++++ .../common/include/generic/rte_cpuflags.h | 9 --- lib/librte_eal/common/include/rte_eal.h | 43 ------------- lib/librte_eal/common/include/rte_lcore.h | 73 ++++------------------ lib/librte_eal/common/include/rte_log.h | 13 ++++ lib/librte_eal/common/include/rte_malloc.h | 7 --- lib/librte_eal/common/include/rte_malloc_heap.h | 35 ----------- lib/librte_eal/common/malloc_heap.c | 1 + lib/librte_eal/common/malloc_heap.h | 25 +++++++- lib/librte_eal/common/meson.build | 1 - lib/librte_eal/common/rte_malloc.c | 1 + lib/librte_eal/common/rte_service.c | 2 + lib/librte_eal/freebsd/eal/eal.c | 7 --- lib/librte_eal/linux/eal/eal.c | 7 --- lib/librte_eal/rte_eal_version.map | 16 ++++- lib/librte_eal/windows/eal/eal_thread.c | 1 + lib/librte_pci/rte_pci.c | 19 ------ lib/librte_pci/rte_pci.h | 47 -------------- lib/librte_pci/rte_pci_version.map | 3 - 33 files changed, 253 insertions(+), 312 deletions(-) delete mode 100644 lib/librte_eal/common/include/rte_malloc_heap.h -- 1.8.3.1
PATCH v3 1/12 eal: make lcore config private
From: Stephen Hemminger <[email protected]>
The internal structure of lcore_config does not need to be part of visible API/ABI. Make it private to EAL.
Rearrange the structure so it takes less memory (and cache footprint).
---
Based on Stephen v8: http://patchwork.dpdk.org/patch/60443/
Changes since Stephen v8:
- do not change core_id, socket_id and core_index types,
--- doc/guides/rel_notes/deprecation.rst | 4 ---- doc/guides/rel_notes/release_19_11.rst | 2 ++ lib/librte_eal/common/eal_common_launch.c | 2 ++ lib/librte_eal/common/eal_private.h | 25 +++++++++++++++++++++++++ lib/librte_eal/common/include/rte_lcore.h | 24 ------------------------ lib/librte_eal/common/rte_service.c | 2 ++ lib/librte_eal/rte_eal_version.map | 1 - lib/librte_eal/windows/eal/eal_thread.c | 1 + 8 files changed, 32 insertions(+), 29 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -4
@@ -23,10 +23,6 @@ Deprecation Notices * eal: The function ``rte_eal_remote_launch`` will return new error codes after read or write error on the pipe, instead of calling ``rte_panic``. -* eal: The ``lcore_config`` struct and global symbol will be made private to - remove it from the externally visible ABI and allow it to be updated in the - future. - * eal: both declaring and identifying devices will be streamlined in v18.11. New functions will appear to query a specific port from buses, classes of device and device drivers. Device declaration will be made coherent with the
doc/guides/rel_notes/release_19_11.rst +2 -0
@@ -312,6 +312,8 @@ ABI Changes Also, make sure to start the actual text at the margin. ========================================================= +* eal: made the ``lcore_config`` struct and global symbol private. + Shared Library Versions -----------------------
lib/librte_eal/common/eal_common_launch.c +2 -0
@@ -15,6 +15,8 @@#include <rte_per_lcore.h> #include <rte_lcore.h> +#include "eal_private.h" +/* * Wait until a lcore finished its job. */
lib/librte_eal/common/eal_private.h +25 -0
@@ -10,6 +10,31 @@#include <stdio.h> #include <rte_dev.h> +#include <rte_lcore.h> + +/** +* Structure storing internal configuration (per-lcore) +*/ +struct lcore_config { +pthread_t thread_id;/**< pthread identifier */ +int pipe_master2slave[2 ];/**< communication pipe with master */ +int pipe_slave2master[2 ];/**< communication pipe with master */ + +lcore_function_t *volatile f;/**< function to call */ +void *volatile arg;/**< argument of function */ +volatile int ret;/**< return value of function */ + +volatile enum rte_lcore_state_t state;/**< lcore state */ +unsigned int socket_id;/**< physical socket id for this lcore */ +unsigned int core_id;/**< core number on socket for this lcore */ +int core_index;/**< relative index, starting from 0 */ +uint8_t core_role;/**< role of core eg: OFF, RTE, SERVICE */ +uint8_t detected;/**< true if lcore was detected */ + +rte_cpuset_t cpuset;/**< cpu set which the lcore affinity to */ +}; + +extern struct lcore_config lcore_config[RTE_MAX_LCORE ];/** * Initialize the memzone subsystem (private to eal).
lib/librte_eal/common/include/rte_lcore.h +0 -24
@@ -66,30 +66,6 @@ typedef cpuset_t rte_cpuset_t; } while (0)#endif -/** -* Structure storing internal configuration (per-lcore) -*/ -struct lcore_config { -unsigned detected;/**< true if lcore was detected */ -pthread_t thread_id;/**< pthread identifier */ -int pipe_master2slave[2 ];/**< communication pipe with master */ -int pipe_slave2master[2 ];/**< communication pipe with master */ -lcore_function_t *volatile f;/**< function to call */ -void *volatile arg;/**< argument of function */ -volatile int ret;/**< return value of function */ -volatile enum rte_lcore_state_t state;/**< lcore state */ -unsigned socket_id;/**< physical socket id for this lcore */ -unsigned core_id;/**< core number on socket for this lcore */ -int core_index;/**< relative index, starting from 0 */ -rte_cpuset_t cpuset;/**< cpu set which the lcore affinity to */ -uint8_t core_role;/**< role of core eg: OFF, RTE, SERVICE */ -}; - -/** -* Internal configuration (per-lcore) -*/ -extern struct lcore_config lcore_config[RTE_MAX_LCORE ]; -RTE_DECLARE_PER_LCORE (unsigned, _lcore_id);/**< Per thread "lcore id". */ RTE_DECLARE_PER_LCORE (rte_cpuset_t, _cpuset);/**< Per thread "cpuset". */
lib/librte_eal/common/rte_service.c +2 -0
@@ -21,6 +21,8 @@#include <rte_memory.h> #include <rte_malloc.h> +#include "eal_private.h" +#define RTE_SERVICE_NUM_MAX 64#define SERVICE_F_REGISTERED (1 << 0)
lib/librte_eal/rte_eal_version.map +0 -1
@@ -4,7 +4,6 @@ DPDK_2.0 { __rte_panic; eal_parse_sysfs_value; eal_timer_source; - lcore_config; per_lcore__lcore_id; per_lcore__rte_errno; rte_calloc;
lib/librte_eal/windows/eal/eal_thread.c +1 -0
@@ -12,6 +12,7 @@#include <rte_common.h> #include <eal_thread.h> +#include "eal_private.h" RTE_DEFINE_PER_LCORE(unsigned int, _lcore_id) = LCORE_ID_ANY;
Signature · 1 line
1.8.3.1
Re: [dpdk-dev] [PATCH v3 01/12] eal: make lcore config private
Quoted 11 lines · David Marchand
From: Stephen Hemminger <[email protected]>
The internal structure of
lcore_configdoes not need to be part of visible API/ABI. Make it private to EAL.Rearrange the structure so it takes less memory (and cache footprint).
Signed-off-by Stephen Hemminger <[email protected]>Signed-off-by David Marchand <[email protected]>Acked-by Thomas Monjalon <[email protected]>---
Signature · 2 lines
Thanks, Anatoly
PATCH v3 2/12 eal: remove deprecated CPU flags check function
In reply to David MarchandRemove rte_cpu_check_supported as announced previously.
--- doc/guides/rel_notes/deprecation.rst | 3 --- doc/guides/rel_notes/release_19_11.rst | 3 +++ lib/librte_eal/common/eal_common_cpuflags.c | 11 ----------- lib/librte_eal/common/include/generic/rte_cpuflags.h | 9 --------- lib/librte_eal/rte_eal_version.map | 1 - 5 files changed, 3 insertions(+), 24 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -3
@@ -34,9 +34,6 @@ Deprecation Notices + ``rte_eal_devargs_type_count`` -* eal: The ``rte_cpu_check_supported`` function has been deprecated since - v17.08 and will be removed. - * eal: The ``rte_malloc_virt2phy`` function has been deprecated and replaced by ``rte_malloc_virt2iova`` since v17.11 and will be removed.
doc/guides/rel_notes/release_19_11.rst +3 -0
@@ -314,6 +314,9 @@ ABI Changes * eal: made the ``lcore_config`` struct and global symbol private. +* eal: removed the ``rte_cpu_check_supported`` function, replaced by + ``rte_cpu_is_supported`` since dpdk v17.08. + Shared Library Versions -----------------------
lib/librte_eal/common/eal_common_cpuflags.c +0 -11
@@ -7,17 +7,6 @@#include <rte_common.h> #include <rte_cpuflags.h> -/** -* Checks if the machine is adequate for running the binary. If it is not, the -* program exits with status 1. -*/ -void -rte_cpu_check_supported (void ) -{ -if (!rte_cpu_is_supported ()) -exit (1 ); -} -int rte_cpu_is_supported (void ) {
lib/librte_eal/common/include/generic/rte_cpuflags.h +0 -9
@@ -49,15 +49,6 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature);/** * This function checks that the currently used CPU supports the CPU features * that were specified at compile time. It is called automatically within the -* EAL, so does not need to be used by applications. -*/ -__rte_deprecated -void -rte_cpu_check_supported (void ); - -/** -* This function checks that the currently used CPU supports the CPU features -* that were specified at compile time. It is called automatically within the * EAL, so does not need to be used by applications. This version returns a * result so that decisions may be made (for instance, graceful shutdowns). */
lib/librte_eal/rte_eal_version.map +0 -1
@@ -8,7 +8,6 @@ DPDK_2.0 { per_lcore__rte_errno; rte_calloc; rte_calloc_socket; - rte_cpu_check_supported; rte_cpu_get_flag_enabled; rte_cycles_vmware_tsc_map; rte_delay_us;
Signature · 1 line
1.8.3.1
Re: [dpdk-dev] [PATCH v3 02/12] eal: remove deprecated CPU flags check function
Quoted 5 lines · David Marchand
Remove
rte_cpu_check_supportedas announced previously.Signed-off-by David Marchand <[email protected]>Acked-by Thomas Monjalon <[email protected]>---
Signature · 2 lines
Thanks, Anatoly
PATCH v3 3/12 eal: remove deprecated malloc virt2phys function
In reply to David MarchandRemove rte_malloc_virt2phy as announced previously.
--- doc/guides/rel_notes/deprecation.rst | 3 --- doc/guides/rel_notes/release_19_11.rst | 3 +++ lib/librte_eal/common/include/rte_malloc.h | 7 ------- 3 files changed, 3 insertions(+), 10 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -3
@@ -34,9 +34,6 @@ Deprecation Notices + ``rte_eal_devargs_type_count`` -* eal: The ``rte_malloc_virt2phy`` function has been deprecated and replaced - by ``rte_malloc_virt2iova`` since v17.11 and will be removed. - * vfio: removal of ``rte_vfio_dma_map`` and ``rte_vfio_dma_unmap`` APIs which have been replaced with ``rte_dev_dma_map`` and ``rte_dev_dma_unmap`` functions. The due date for the removal targets DPDK 20.02.
doc/guides/rel_notes/release_19_11.rst +3 -0
@@ -317,6 +317,9 @@ ABI Changes * eal: removed the ``rte_cpu_check_supported`` function, replaced by ``rte_cpu_is_supported`` since dpdk v17.08. +* eal: removed the ``rte_malloc_virt2phy`` function, replaced by + ``rte_malloc_virt2iova`` since v17.11. + Shared Library Versions -----------------------
lib/librte_eal/common/include/rte_malloc.h +0 -7
@@ -553,13 +553,6 @@ rte_malloc_set_limit(const char *type, size_t max);rte_iova_t rte_malloc_virt2iova (const void *addr); -__rte_deprecated -static inline phys_addr_t -rte_malloc_virt2phy (const void *addr) -{ -return rte_malloc_virt2iova (addr); -} - #ifdef __cplusplus }#endif
Signature · 1 line
1.8.3.1
Re: [dpdk-dev] [PATCH v3 03/12] eal: remove deprecated malloc virt2phys function
Quoted 5 lines · David Marchand
Remove
rte_malloc_virt2phyas announced previously.Signed-off-by David Marchand <[email protected]>Acked-by Thomas Monjalon <[email protected]>---
Signature · 2 lines
Thanks, Anatoly
PATCH v3 4/12 mem: hide internal heap header
In reply to David MarchandLet's avoid exporting structures without an identified usecase.
--- app/test-pmd/testpmd.c | 1 - lib/librte_eal/common/Makefile | 2 +- lib/librte_eal/common/eal_memcfg.h | 3 ++- lib/librte_eal/common/include/rte_malloc_heap.h | 35 ------------------------- lib/librte_eal/common/malloc_heap.h | 25 +++++++++++++++++- lib/librte_eal/common/meson.build | 1 - 6 files changed, 27 insertions(+), 40 deletions(-) delete mode 100644 lib/librte_eal/common/include/rte_malloc_heap.h
app/test-pmd/testpmd.c +0 -1
@@ -27,7 +27,6 @@#include <rte_log.h> #include <rte_debug.h> #include <rte_cycles.h> -#include <rte_malloc_heap.h> #include <rte_memory.h> #include <rte_memcpy.h> #include <rte_launch.h>
lib/librte_eal/common/Makefile +1 -1
@@ -10,7 +10,7 @@ INC += rte_log.h rte_memory.h rte_memzone.h INC += rte_per_lcore.h rte_random.h INC += rte_tailq.h rte_interrupts.h rte_alarm.h INC += rte_string_fns.h rte_version.h -INC += rte_eal_memconfig.h rte_malloc_heap.h +INC += rte_eal_memconfig.h INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h rte_class.h INC += rte_option.h INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h
lib/librte_eal/common/eal_memcfg.h +2 -1
@@ -6,7 +6,6 @@#define EAL_MEMCFG_H #include <rte_config.h> -#include <rte_malloc_heap.h> #include <rte_memory.h> #include <rte_memzone.h> #include <rte_pause.h>
@@ -14,6 +13,8 @@#include <rte_rwlock.h> #include <rte_tailq.h> +#include "malloc_heap.h" +/** * Memory configuration shared across multiple processes. */
lib/librte_eal/common/include/rte_malloc_heap.h deleted +0 -35
@@ -1,35 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause -* Copyright(c) 2010-2014 Intel Corporation -*/ - -#ifndef _RTE_MALLOC_HEAP_H_ -#define _RTE_MALLOC_HEAP_H_ - -#include <stddef.h> -#include <sys/queue.h> -#include <rte_spinlock.h> -#include <rte_memory.h> - -/* Number of free lists per heap, grouped by size. */ -#define RTE_HEAP_NUM_FREELISTS 13 -#define RTE_HEAP_NAME_MAX_LEN 32 - -/* dummy definition, for pointers */ -struct malloc_elem ; - -/** -* Structure to hold malloc heap -*/ -struct malloc_heap { -rte_spinlock_t lock; - LIST_HEAD(, malloc_elem) free_head[RTE_HEAP_NUM_FREELISTS]; -struct malloc_elem *volatile first; -struct malloc_elem *volatile last; - -unsigned alloc_count; -unsigned int socket_id; -size_t total_size; -char name[RTE_HEAP_NAME_MAX_LEN ]; -} __rte_cache_aligned; - -#endif /* _RTE_MALLOC_HEAP_H_ */
lib/librte_eal/common/malloc_heap.h +24 -1
@@ -6,9 +6,32 @@#define MALLOC_HEAP_H_ #include <stdbool.h> +#include <sys/queue.h> #include <rte_malloc.h> -#include <rte_malloc_heap.h> +#include <rte_spinlock.h> + +/* Number of free lists per heap, grouped by size. */ +#define RTE_HEAP_NUM_FREELISTS 13 +#define RTE_HEAP_NAME_MAX_LEN 32 + +/* dummy definition, for pointers */ +struct malloc_elem ; + +/** +* Structure to hold malloc heap +*/ +struct malloc_heap { +rte_spinlock_t lock; + LIST_HEAD(, malloc_elem) free_head[RTE_HEAP_NUM_FREELISTS]; +struct malloc_elem *volatile first; +struct malloc_elem *volatile last; + +unsigned int alloc_count; +unsigned int socket_id; +size_t total_size; +char name[RTE_HEAP_NAME_MAX_LEN ]; +} __rte_cache_aligned;#ifdef __cplusplusextern "C" {
lib/librte_eal/common/meson.build +0 -1
@@ -72,7 +72,6 @@ common_headers = files( 'include/rte_lcore.h', 'include/rte_log.h', 'include/rte_malloc.h', - 'include/rte_malloc_heap.h', 'include/rte_memory.h', 'include/rte_memzone.h', 'include/rte_option.h',
Signature · 1 line
1.8.3.1
Re: [dpdk-dev] [PATCH v3 04/12] mem: hide internal heap header
Quoted 5 lines · David Marchand
Let's avoid exporting structures without an identified usecase.
Signed-off-by David Marchand <[email protected]>Acked-by Thomas Monjalon <[email protected]>---
Signature · 2 lines
Thanks, Anatoly
PATCH v3 5/12 net/bonding: use non deprecated PCI API
In reply to David Marchandrte_eal_compare_pci_addr has been deprecated since v17.11. Convert to rte_pci_addr_cmp.
--- drivers/net/bonding/rte_eth_bond_args.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/bonding/rte_eth_bond_args.c +2 -3
@@ -60,11 +60,10 @@ find_port_id_by_dev_name(const char *name)static inline int bond_pci_addr_cmp (const struct rte_device *dev,const void *_pci_addr) { -struct rte_pci_device *pdev; +const struct rte_pci_device *pdev =RTE_DEV_TO_PCI_CONST (dev);const struct rte_pci_addr *paddr = _pci_addr; - pdev =RTE_DEV_TO_PCI (*(struct rte_device **)(void *)&dev); -return rte_eal_compare_pci_addr (&pdev->addr, paddr); +return rte_pci_addr_cmp (&pdev->addr, paddr); }/**
Signature · 1 line
1.8.3.1
PATCH v3 6/12 pci: remove deprecated functions
In reply to David MarchandThose functions have been deprecated since 17.11 and have 1:1 replacement.
--- doc/guides/rel_notes/deprecation.rst | 7 ----- doc/guides/rel_notes/release_19_11.rst | 6 +++++ lib/librte_pci/rte_pci.c | 19 -------------- lib/librte_pci/rte_pci.h | 47 ---------------------------------- lib/librte_pci/rte_pci_version.map | 3 --- 5 files changed, 6 insertions(+), 76 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -7
@@ -38,13 +38,6 @@ Deprecation Notices have been replaced with ``rte_dev_dma_map`` and ``rte_dev_dma_unmap`` functions. The due date for the removal targets DPDK 20.02. -* pci: Several exposed functions are misnamed. - The following functions are deprecated starting from v17.11 and are replaced: - - - ``eal_parse_pci_BDF`` replaced by ``rte_pci_addr_parse`` - - ``eal_parse_pci_DomBDF`` replaced by ``rte_pci_addr_parse`` - - ``rte_eal_compare_pci_addr`` replaced by ``rte_pci_addr_cmp`` - * dpaa2: removal of ``rte_dpaa2_memsegs`` structure which has been replaced by a pa-va search library. This structure was earlier being used for holding memory segments used by dpaa2 driver for faster pa->va translation. This
doc/guides/rel_notes/release_19_11.rst +6 -0
@@ -320,6 +320,12 @@ ABI Changes * eal: removed the ``rte_malloc_virt2phy`` function, replaced by ``rte_malloc_virt2iova`` since v17.11. +* pci: removed the following deprecated functions since dpdk: + + - ``eal_parse_pci_BDF`` replaced by ``rte_pci_addr_parse`` + - ``eal_parse_pci_DomBDF`` replaced by ``rte_pci_addr_parse`` + - ``rte_eal_compare_pci_addr`` replaced by ``rte_pci_addr_cmp`` + Shared Library Versions -----------------------
lib/librte_pci/rte_pci.c +0 -19
@@ -87,18 +87,6 @@ pci_dbdf_parse(const char *input, struct rte_pci_addr *dev_addr)return 0 ; } -int -eal_parse_pci_BDF (const char *input,struct rte_pci_addr *dev_addr) -{ -return pci_bdf_parse (input, dev_addr); -} - -int -eal_parse_pci_DomBDF (const char *input,struct rte_pci_addr *dev_addr) -{ -return pci_dbdf_parse (input, dev_addr); -} -void rte_pci_device_name (const struct rte_pci_addr *addr,char *output,size_t size)
@@ -110,13 +98,6 @@ rte_pci_device_name(const struct rte_pci_addr *addr, }int -rte_eal_compare_pci_addr (const struct rte_pci_addr *addr, -const struct rte_pci_addr *addr2) -{ -return rte_pci_addr_cmp (addr, addr2); -} - -int rte_pci_addr_cmp (const struct rte_pci_addr *addr,const struct rte_pci_addr *addr2) {
lib/librte_pci/rte_pci.h +0 -47
59 lines not on this page · raw message
lib/librte_pci/rte_pci_version.map +0 -3
@@ -1,11 +1,8 @@ DPDK_17.11 { global: - eal_parse_pci_BDF; - eal_parse_pci_DomBDF; pci_map_resource; pci_unmap_resource; - rte_eal_compare_pci_addr; rte_pci_addr_cmp; rte_pci_addr_parse; rte_pci_device_name;
Signature · 1 line
1.8.3.1
PATCH v3 7/12 log: add log stream accessor
In reply to David MarchandDefine an accessor so that users can write their debug message to the same stream than the rte_log infrastructure.
Use it in the qat infrastructure.
---
Changelog since v1:
- use ternary operator,
--- drivers/common/qat/qat_logs.c | 3 +-- drivers/common/qat/qat_logs.h | 3 +-- lib/librte_eal/common/eal_common_log.c | 33 +++++++++++++++++++-------------- lib/librte_eal/common/include/rte_log.h | 13 +++++++++++++ lib/librte_eal/rte_eal_version.map | 3 +++ 5 files changed, 37 insertions(+), 18 deletions(-)
drivers/common/qat/qat_logs.c +1 -2
@@ -19,8 +19,7 @@ qat_hexdump_log(uint32_t level, uint32_t logtype, const char *title,if (level > (uint32_t )(rte_log_get_level (logtype)))return 0 ; -rte_hexdump (rte_logs.file ==NULL ? stderr : rte_logs.file, - title, buf, len); +rte_hexdump (rte_log_get_stream (), title, buf, len);return 0 ; }
drivers/common/qat/qat_logs.h +1 -2
@@ -24,8 +24,7 @@ extern int qat_dp_logtype;* * Dump out the message buffer in a special hex dump output format with * characters printed for each line of 16 hex values. The message will be sent -* to the stream defined by rte_logs.file or to stderr in case of rte_logs.file -* is undefined. +* to the stream used by the rte_log infrastructure. */ int qat_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
lib/librte_eal/common/eal_common_log.c +19 -14
@@ -71,6 +71,24 @@ rte_openlog_stream(FILE *f)return 0 ; } +FILE * +rte_log_get_stream (void ) +{ +FILE *f = rte_logs.file; + +if (f ==NULL ) { +/* +* Grab the current value of stderr here, rather than +* just initializing default_log_stream to stderr. This +* ensures that we will always use the current value +* of stderr, even if the application closes and +* reopens it. +*/ +return default_log_stream ? : stderr; + } +return f; +} +/* Set global log level */ void rte_log_set_global_level (uint32_t level)
@@ -396,21 +414,8 @@ rte_log_dump(FILE *f)int rte_vlog (uint32_t level,uint32_t logtype,const char *format,va_list ap) { +FILE *f =rte_log_get_stream ();int ret; -FILE *f = rte_logs.file; -if (f ==NULL ) { - f = default_log_stream; -if (f ==NULL ) { -/* -* Grab the current value of stderr here, rather than -* just initializing default_log_stream to stderr. This -* ensures that we will always use the current value -* of stderr, even if the application closes and -* reopens it. -*/ - f = stderr; - } - }if (level > rte_logs.level)return 0 ;
lib/librte_eal/common/include/rte_log.h +13 -0
@@ -102,6 +102,19 @@ extern struct rte_logs rte_logs;int rte_openlog_stream (FILE *f);/** +* @warning +* @b EXPERIMENTAL: this API may change without prior notice +* +* Retrieve the stream used by the logging system (see rte_openlog_stream() +* to change it). +* +* @return +* Pointer to the stream. +*/ +__rte_experimental +FILE *rte_log_get_stream(void); + +/** * Set the global log level. * * After this call, logs with a level lower or equal than the level
lib/librte_eal/rte_eal_version.map +3 -0
@@ -417,4 +417,7 @@ EXPERIMENTAL { rte_mcfg_timer_lock; rte_mcfg_timer_unlock; rte_rand_max; + + # added in 19.11 + rte_log_get_stream; };
Signature · 1 line
1.8.3.1
Re: [dpdk-dev] [PATCH v3 07/12] log: add log stream accessor
Quoted 128 lines · David Marchand
Define an accessor so that users can write their debug message to the same stream than the
rte_loginfrastructure.
Use it in the qat infrastructure.Signed-off-by David Marchand <[email protected]>Acked-by Thomas Monjalon <[email protected]>---
Changelog since v1:
- use ternary operator,--- drivers/common/qat/qat_logs.c | 3 +-- drivers/common/qat/qat_logs.h | 3 +-- lib/librte_eal/common/eal_common_log.c | 33 +++++++++++++++++++-------------- lib/librte_eal/common/include/rte_log.h | 13 +++++++++++++ lib/librte_eal/rte_eal_version.map | 3 +++ 5 files changed, 37 insertions(+), 18 deletions(-)drivers/common/qat/qat_logs.c +1
-2@@ -19,8 +19,7 @@ qat_hexdump_log(uint32_t level, uint32_t logtype, const char *title,if (level > (uint32_t )(rte_log_get_level (logtype)))return 0 ; -rte_hexdump (rte_logs.file ==NULL ? stderr : rte_logs.file, - title, buf, len); +rte_hexdump (rte_log_get_stream (), title, buf, len);return 0 ; }drivers/common/qat/qat_logs.h +1
-2@@ -24,8 +24,7 @@ extern int qat_dp_logtype;* * Dump out the message buffer in a special hex dump output format with * characters printed for each line of 16 hex values. The message will be sent -* to the stream defined by rte_logs.file or to stderr in case of rte_logs.file -* is undefined. +* to the stream used by the rte_log infrastructure. */ int qat_hexdump_log(uint32_t level, uint32_t logtype, const char *title,lib/librte_eal/common/eal_common_log.c +19
-14@@ -71,6 +71,24 @@ rte_openlog_stream(FILE *f)return 0 ; } +FILE * +rte_log_get_stream (void ) +{ +FILE *f = rte_logs.file; + +if (f ==NULL ) { +/* +* Grab the current value of stderr here, rather than +* just initializing default_log_stream to stderr. This +* ensures that we will always use the current value +* of stderr, even if the application closes and +* reopens it. +*/ +return default_log_stream ? : stderr; + } +return f; +} +/* Set global log level */ void rte_log_set_global_level (uint32_t level)@@ -396,21 +414,8 @@ rte_log_dump(FILE *f)int rte_vlog (uint32_t level,uint32_t logtype,const char *format,va_list ap) { +FILE *f =rte_log_get_stream ();int ret; -FILE *f = rte_logs.file; -if (f ==NULL ) { - f = default_log_stream; -if (f ==NULL ) { -/* -* Grab the current value of stderr here, rather than -* just initializing default_log_stream to stderr. This -* ensures that we will always use the current value -* of stderr, even if the application closes and -* reopens it. -*/ - f = stderr; - } - }if (level > rte_logs.level)return 0 ;lib/librte_eal/common/include/rte_log.h +13
-0@@ -102,6 +102,19 @@ extern struct rte_logs rte_logs;int rte_openlog_stream (FILE *f);/** +* @warning +* @b EXPERIMENTAL: this API may change without prior notice +* +* Retrieve the stream used by the logging system (see rte_openlog_stream() +* to change it). +* +* @return +* Pointer to the stream. +*/ +__rte_experimental +FILE *rte_log_get_stream(void); + +/** * Set the global log level. * * After this call, logs with a level lower or equal than the level lib/librte_eal/rte_eal_version.map +0
-0
lib/librte_eal/rte_eal_version.map EXPERIMENTAL { · line 423
Quoted 7 lines
lib/librte_eal/rte_eal_version.map +3
-0@@ -417,4 +417,7 @@ EXPERIMENTAL { rte_mcfg_timer_lock; rte_mcfg_timer_unlock; rte_rand_max; + + # added in 19.11 + rte_log_get_stream; };
PATCH v3 8/12 test/mem: remove dependency on EAL internals
In reply to David MarchandRather than dereference the mem_config internal structure, we can rely on the rte_memzone_walk API and count memzones.
--- app/test/test_memzone.c | 50 ++++++++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 19 deletions(-)
app/test/test_memzone.c +31 -19
@@ -13,12 +13,12 @@#include <rte_memory.h> #include <rte_memzone.h> #include <rte_eal.h> +#include <rte_lcore.h> #include <rte_common.h> #include <rte_string_fns.h> #include <rte_errno.h> #include <rte_malloc.h> #include "../../lib/librte_eal/common/malloc_elem.h" -#include "../../lib/librte_eal/common/eal_memcfg.h" #include "test.h"
@@ -927,6 +927,16 @@ test_memzone_free(void)return 0 ; } +static int test_memzones_left; +static int memzone_walk_cnt; +static void memzone_walk_clb (const struct rte_memzone *mz, + void *arg __rte_unused) +{ + memzone_walk_cnt++; +if (!strncmp (TEST_MEMZONE_NAME ("" ), mz->name,RTE_MEMZONE_NAMESIZE )) + test_memzones_left++; +} +static int test_memzone_basic (void ) {
@@ -936,8 +946,12 @@ test_memzone_basic(void)const struct rte_memzone *memzone4;const struct rte_memzone *mz;int memzone_cnt_after, memzone_cnt_expected; -int memzone_cnt_before = -rte_eal_get_configuration ()->mem_config->memzones.count; +int memzone_cnt_before; + + memzone_walk_cnt =0 ; + test_memzones_left =0 ; +rte_memzone_walk (memzone_walk_clb,NULL ); + memzone_cnt_before = memzone_walk_cnt; memzone1 =rte_memzone_reserve (TEST_MEMZONE_NAME ("testzone1" ),100 ,SOCKET_ID_ANY ,0 );
@@ -960,8 +974,10 @@ test_memzone_basic(void) (memzone1 !=NULL ) + (memzone2 !=NULL ) + (memzone3 !=NULL ) + (memzone4 !=NULL ); - memzone_cnt_after = -rte_eal_get_configuration ()->mem_config->memzones.count; + memzone_walk_cnt =0 ; + test_memzones_left =0 ; +rte_memzone_walk (memzone_walk_clb,NULL ); + memzone_cnt_after = memzone_walk_cnt;if (memzone_cnt_after != memzone_cnt_expected)return -1 ;
@@ -1039,30 +1055,26 @@ test_memzone_basic(void)return -1 ; } - memzone_cnt_after = -rte_eal_get_configuration ()->mem_config->memzones.count; + memzone_walk_cnt =0 ; + test_memzones_left =0 ; +rte_memzone_walk (memzone_walk_clb,NULL ); + memzone_cnt_after = memzone_walk_cnt;if (memzone_cnt_after != memzone_cnt_before)return -1 ;return 0 ; } -static int test_memzones_left; -static int memzone_walk_cnt; -static void memzone_walk_clb (const struct rte_memzone *mz, - void *arg __rte_unused) -{ - memzone_walk_cnt++; -if (!strncmp (TEST_MEMZONE_NAME ("" ), mz->name,RTE_MEMZONE_NAMESIZE )) - test_memzones_left++; -} -static int test_memzone (void ) {/* take note of how many memzones were allocated before running */ -int memzone_cnt = -rte_eal_get_configuration ()->mem_config->memzones.count; +int memzone_cnt; + + memzone_walk_cnt =0 ; + test_memzones_left =0 ; +rte_memzone_walk (memzone_walk_clb,NULL ); + memzone_cnt = memzone_walk_cnt;printf ("test basic memzone API\n" );if (test_memzone_basic () <0 )
Signature · 1 line
1.8.3.1
Re: [dpdk-dev] [PATCH v3 08/12] test/mem: remove dependency on EAL internals
Quoted 6 lines · David Marchand
Rather than dereference the
mem_configinternal structure, we can rely on therte_memzone_walkAPI and count memzones.Signed-off-by David Marchand <[email protected]>Acked-by Thomas Monjalon <[email protected]>---
Signature · 2 lines
Thanks, Anatoly
PATCH v3 9/12 eal: deinline lcore APIs
In reply to David MarchandThose functions are used to setup or take control decisions. Move them into the EAL common code and put them directly in the stable ABI.
--- lib/librte_eal/common/eal_common_lcore.c | 38 ++++++++++++++++++++++++++++ lib/librte_eal/common/include/rte_lcore.h | 41 +++---------------------------- lib/librte_eal/rte_eal_version.map | 10 ++++++++ 3 files changed, 52 insertions(+), 37 deletions(-)
lib/librte_eal/common/eal_common_lcore.c +38 -0
@@ -16,6 +16,16 @@#include "eal_private.h" #include "eal_thread.h" +unsigned int rte_get_master_lcore (void ) +{ +return rte_eal_get_configuration ()->master_lcore; +} + +unsigned int rte_lcore_count (void ) +{ +return rte_eal_get_configuration ()->lcore_count; +} +int rte_lcore_index (int lcore_id) {if (unlikely (lcore_id >=RTE_MAX_LCORE ))
@@ -43,6 +53,34 @@ rte_cpuset_t rte_lcore_cpuset(unsigned int lcore_id)return lcore_config[lcore_id].cpuset; } +int rte_lcore_is_enabled (unsigned int lcore_id) +{ +struct rte_config *cfg =rte_eal_get_configuration (); + +if (lcore_id >=RTE_MAX_LCORE ) +return 0 ; +return cfg->lcore_role[lcore_id] ==ROLE_RTE ; +} + +unsigned int rte_get_next_lcore (unsigned int i,int skip_master,int wrap) +{ + i++; +if (wrap) + i %=RTE_MAX_LCORE ; + +while (i <RTE_MAX_LCORE ) { +if (!rte_lcore_is_enabled (i) || + (skip_master && (i ==rte_get_master_lcore ()))) { + i++; +if (wrap) + i %=RTE_MAX_LCORE ; +continue ; + } +break ; + } +return i; +} +unsigned int rte_lcore_to_socket_id (unsigned int lcore_id) {
lib/librte_eal/common/include/rte_lcore.h +4 -37
66 lines not on this page · raw message
lib/librte_eal/rte_eal_version.map +10 -0
@@ -310,6 +310,16 @@ DPDK_19.08 { } DPDK_19.05; +DPDK_19.11 { + global: + + rte_get_master_lcore; + rte_get_next_lcore; + rte_lcore_count; + rte_lcore_is_enabled; + +} DPDK_19.08; + EXPERIMENTAL { global:
Signature · 1 line
1.8.3.1
PATCH v3 10/12 eal: factorize lcore role code
In reply to David MarchandThis code belongs to the lcore API, move the prototype to the right header, then factorize the code into the common code.
--- lib/librte_eal/common/eal_common_lcore.c | 10 ++++++++++ lib/librte_eal/common/include/rte_eal.h | 11 ----------- lib/librte_eal/common/include/rte_lcore.h | 10 ++++++++++ lib/librte_eal/freebsd/eal/eal.c | 7 ------- lib/librte_eal/linux/eal/eal.c | 7 ------- 5 files changed, 20 insertions(+), 25 deletions(-)
lib/librte_eal/common/eal_common_lcore.c +10 -0
@@ -53,6 +53,16 @@ rte_cpuset_t rte_lcore_cpuset(unsigned int lcore_id)return lcore_config[lcore_id].cpuset; } +enum rte_lcore_role_t +rte_eal_lcore_role (unsigned int lcore_id) +{ +struct rte_config *cfg =rte_eal_get_configuration (); + +if (lcore_id >=RTE_MAX_LCORE ) +return ROLE_OFF ; +return cfg->lcore_role[lcore_id]; +} +int rte_lcore_is_enabled (unsigned int lcore_id) {struct rte_config *cfg =rte_eal_get_configuration ();
lib/librte_eal/common/include/rte_eal.h +0 -11
@@ -84,17 +84,6 @@ struct rte_config {struct rte_config *rte_eal_get_configuration (void );/** -* Get a lcore's role. -* -* @param lcore_id -* The identifier of the lcore. -* @return -* The role of the lcore. -*/ -enum rte_lcore_role_t rte_eal_lcore_role (unsigned lcore_id); - - -/** * Get the process type in a multi-process setup * * @return
lib/librte_eal/common/include/rte_lcore.h +10 -0
@@ -70,6 +70,16 @@ RTE_DECLARE_PER_LCORE(unsigned, _lcore_id); /**< Per thread "lcore id". */RTE_DECLARE_PER_LCORE (rte_cpuset_t, _cpuset);/**< Per thread "cpuset". */ /** +* Get a lcore's role. +* +* @param lcore_id +* The identifier of the lcore, which MUST be between 0 and RTE_MAX_LCORE-1. +* @return +* The role of the lcore. +*/ +enum rte_lcore_role_t rte_eal_lcore_role (unsigned int lcore_id); + +/** * Return the Application thread ID of the execution unit. * * Note: in most cases the lcore id returned here will also correspond
lib/librte_eal/freebsd/eal/eal.c +0 -7
@@ -955,13 +955,6 @@ rte_eal_cleanup(void)return 0 ; } -/* get core role */ -enum rte_lcore_role_t -rte_eal_lcore_role (unsigned lcore_id) -{ -return rte_config.lcore_role[lcore_id]; -} -enum rte_proc_type_t rte_eal_process_type (void ) {
lib/librte_eal/linux/eal/eal.c +0 -7
@@ -1308,13 +1308,6 @@ rte_eal_cleanup(void)return 0 ; } -/* get core role */ -enum rte_lcore_role_t -rte_eal_lcore_role (unsigned lcore_id) -{ -return rte_config.lcore_role[lcore_id]; -} -enum rte_proc_type_t rte_eal_process_type (void ) {
Signature · 1 line
1.8.3.1
PATCH v3 11/12 eal: make the global configuration private
In reply to David MarchandNow that all elements of the rte_config structure have (deinlined) accessors, we can hide it.
--- doc/guides/rel_notes/release_19_11.rst | 3 +++ lib/librte_eal/common/eal_common_mcfg.c | 1 + lib/librte_eal/common/eal_private.h | 32 ++++++++++++++++++++++++++++++++ lib/librte_eal/common/include/rte_eal.h | 32 -------------------------------- lib/librte_eal/common/malloc_heap.c | 1 + lib/librte_eal/common/rte_malloc.c | 1 + lib/librte_eal/rte_eal_version.map | 1 - 7 files changed, 38 insertions(+), 33 deletions(-)
doc/guides/rel_notes/release_19_11.rst +3 -0
@@ -320,6 +320,9 @@ ABI Changes * eal: removed the ``rte_malloc_virt2phy`` function, replaced by ``rte_malloc_virt2iova`` since v17.11. +* eal: made the ``rte_config`` struct and ``rte_eal_get_configuration`` + function private. + * pci: removed the following deprecated functions since dpdk: - ``eal_parse_pci_BDF`` replaced by ``rte_pci_addr_parse``
lib/librte_eal/common/eal_common_mcfg.c +1 -0
@@ -8,6 +8,7 @@#include "eal_internal_cfg.h" #include "eal_memcfg.h" +#include "eal_private.h" void eal_mcfg_complete (void )
lib/librte_eal/common/eal_private.h +32 -0
@@ -37,6 +37,38 @@ struct lcore_config {extern struct lcore_config lcore_config[RTE_MAX_LCORE ];/** +* The global RTE configuration structure. +*/ +struct rte_config { +uint32_t master_lcore;/**< Id of the master lcore */ +uint32_t lcore_count;/**< Number of available logical cores. */ +uint32_t numa_node_count;/**< Number of detected NUMA nodes. */ +uint32_t numa_nodes[RTE_MAX_NUMA_NODES ];/**< List of detected NUMA nodes. */ +uint32_t service_lcore_count;/**< Number of available service cores. */ +enum rte_lcore_role_t lcore_role[RTE_MAX_LCORE ];/**< State of cores. */ + +/** Primary or secondary configuration */ +enum rte_proc_type_t process_type; + +/** PA or VA mapping mode */ +enum rte_iova_mode iova_mode; + +/** +* Pointer to memory configuration, which may be shared across multiple +* DPDK instances +*/ +struct rte_mem_config *mem_config; +} __attribute__((__packed__ )); + +/** +* Get the global configuration structure. +* +* @return +* A pointer to the global configuration structure. +*/ +struct rte_config *rte_eal_get_configuration (void ); + +/** * Initialize the memzone subsystem (private to eal). * * @return
lib/librte_eal/common/include/rte_eal.h +0 -32
@@ -52,38 +52,6 @@ enum rte_proc_type_t { };/** -* The global RTE configuration structure. -*/ -struct rte_config { -uint32_t master_lcore;/**< Id of the master lcore */ -uint32_t lcore_count;/**< Number of available logical cores. */ -uint32_t numa_node_count;/**< Number of detected NUMA nodes. */ -uint32_t numa_nodes[RTE_MAX_NUMA_NODES ];/**< List of detected NUMA nodes. */ -uint32_t service_lcore_count;/**< Number of available service cores. */ -enum rte_lcore_role_t lcore_role[RTE_MAX_LCORE ];/**< State of cores. */ - -/** Primary or secondary configuration */ -enum rte_proc_type_t process_type; - -/** PA or VA mapping mode */ -enum rte_iova_mode iova_mode; - -/** -* Pointer to memory configuration, which may be shared across multiple -* DPDK instances -*/ -struct rte_mem_config *mem_config; -} __attribute__((__packed__ )); - -/** -* Get the global configuration structure. -* -* @return -* A pointer to the global configuration structure. -*/ -struct rte_config *rte_eal_get_configuration (void ); - -/** * Get the process type in a multi-process setup * * @return
lib/librte_eal/common/malloc_heap.c +1 -0
@@ -27,6 +27,7 @@#include "eal_internal_cfg.h" #include "eal_memalloc.h" #include "eal_memcfg.h" +#include "eal_private.h" #include "malloc_elem.h" #include "malloc_heap.h" #include "malloc_mp.h"
lib/librte_eal/common/rte_malloc.c +1 -0
@@ -26,6 +26,7 @@#include "malloc_heap.h" #include "eal_memalloc.h" #include "eal_memcfg.h" +#include "eal_private.h" /* Free the memory space back to heap */
lib/librte_eal/rte_eal_version.map +0 -1
@@ -17,7 +17,6 @@ DPDK_2.0 { rte_dump_tailq; rte_eal_alarm_cancel; rte_eal_alarm_set; - rte_eal_get_configuration; rte_eal_get_lcore_state; rte_eal_get_physmem_size; rte_eal_has_hugepages;
Signature · 1 line
1.8.3.1
Re: [dpdk-dev] [PATCH v3 11/12] eal: make the global configuration private
Quoted 6 lines · David Marchand
Now that all elements of the
rte_configstructure have (deinlined) accessors, we can hide it.Signed-off-by David Marchand <[email protected]>Acked-by Thomas Monjalon <[email protected]>---
Can't think of any uses covered by this struct that aren't already covered by our API's, so...
Signature · 2 lines
Thanks, Anatoly
PATCH v3 12/12 doc: announce global logs struct removal from ABI
In reply to David MarchandNew accessor has been introduced to provide the hidden information. This symbol can now be kept internal.
--- doc/guides/rel_notes/deprecation.rst | 4 ++++ 1 file changed, 4 insertions(+)
doc/guides/rel_notes/deprecation.rst +4 -0
@@ -34,6 +34,10 @@ Deprecation Notices + ``rte_eal_devargs_type_count`` +* eal: The ``rte_logs`` struct and global symbol will be made private to + remove it from the externally visible ABI and allow it to be updated in the + future. + * vfio: removal of ``rte_vfio_dma_map`` and ``rte_vfio_dma_unmap`` APIs which have been replaced with ``rte_dev_dma_map`` and ``rte_dev_dma_unmap`` functions. The due date for the removal targets DPDK 20.02.
Signature · 1 line
1.8.3.1
Re: [dpdk-dev] [PATCH v3 12/12] doc: announce global logs struct removal from ABI
Quoted 14 lines · David Marchand
New accessor has been introduced to provide the hidden information. This symbol can now be kept internal.
Signed-off-by David Marchand <[email protected]>--- doc/guides/rel_notes/deprecation.rst | 4 ++++ 1 file changed, 4 insertions(+)doc/guides/rel_notes/deprecation.rst +0
-0
doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 43
Quoted 10 lines
doc/guides/rel_notes/deprecation.rst +4
-0@@ -34,6 +34,10 @@ Deprecation Notices + ``rte_eal_devargs_type_count`` +* eal: The ``rte_logs`` struct and global symbol will be made private to + remove it from the externally visible ABI and allow it to be updated in the + future. + * vfio: removal of ``rte_vfio_dma_map`` and ``rte_vfio_dma_unmap`` APIs which have been replaced with ``rte_dev_dma_map`` and ``rte_dev_dma_unmap`` functions. The due date for the removal targets DPDK 20.02.
Signature · 2 lines
Thanks, Anatoly
Re: [dpdk-dev] [PATCH v3 12/12] doc: announce global logs struct removal from ABI
In reply to David Marchand25/10/2019 15:56, David Marchand:
Quoted 2 lines
New accessor has been introduced to provide the hidden information. This symbol can now be kept internal.
[..]
doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 39
Quoted 3 lines
doc/guides/rel_notes/deprecation.rst +3
-0+* eal: The ``rte_logs`` struct and global symbol will be made private to + remove it from the externally visible ABI and allow it to be updated in the + future.
Re: [dpdk-dev] [PATCH v3 12/12] doc: announce global logs struct removal from ABI
In reply to David MarchandQuoted 13 lines · David Marchand
New accessor has been introduced to provide the hidden information. This symbol can now be kept internal.
Quoted 1 line
Signed-off-by David Marchand <[email protected]>--- doc/guides/rel_notes/deprecation.rst | 4 ++++ 1 file changed, 4 insertions(+)doc/guides/rel_notes/deprecation.rst +0
-0
doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 43
Quoted 10 lines
doc/guides/rel_notes/deprecation.rst +4
-0@@ -34,6 +34,10 @@ Deprecation Notices + ``rte_eal_devargs_type_count`` +* eal: The ``rte_logs`` struct and global symbol will be made private to + remove it from the externally visible ABI and allow it to be updated in the + future. + * vfio: removal of ``rte_vfio_dma_map`` and ``rte_vfio_dma_unmap`` APIs which have been replaced with ``rte_dev_dma_map`` and ``rte_dev_dma_unmap`` functions. The due date for the removal targets DPDK 20.02.
Re: [dpdk-dev] [PATCH v3 12/12] doc: announce global logs struct removal from ABI
Quoted 17 lines · Kevin Traynor
Quoted 15 lines · David Marchand
New accessor has been introduced to provide the hidden information. This symbol can now be kept internal.
Quoted 1 line
Signed-off-by David Marchand <[email protected]>--- doc/guides/rel_notes/deprecation.rst | 4 ++++ 1 file changed, 4 insertions(+)doc/guides/rel_notes/deprecation.rst +0
-0@@ -34,6 +34,10 @@ Deprecation Notices + ``rte_eal_devargs_type_count``
Quoted 10 lines
doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 43
Quoted 8 lines
doc/guides/rel_notes/deprecation.rst +4
-0+* eal: The ``rte_logs`` struct and global symbol will be made private to + remove it from the externally visible ABI and allow it to be updated in the + future. + * vfio: removal of ``rte_vfio_dma_map`` and ``rte_vfio_dma_unmap`` APIs which have been replaced with ``rte_dev_dma_map`` and ``rte_dev_dma_unmap`` functions. The due date for the removal targets DPDK 20.02.Acked-by Kevin Traynor <[email protected]>
Thanks Kevin for catching that contrail vrouter relies on rte_logs. Something to study by 20.11.
Signature · 1 line
David Marchand
Quoted 37 lines · David Marchand
Let's prepare for the ABI freeze.
The first patches are about changes that had been announced before.
The
malloc_heapstructure from the memory subsystem can be hidden. The PCI library had some forgotten deprecated APIs that are removed with this series.
rte_logscould be hidden, but I left it exposed for now. I added an accessor to rte_logs.file, and added a deprecation notice announcing its removal from the public ABI.Changelog since v2:
- dropped patch 8 and added a deprecation notice onrte_logsinstead,Changelog since v1:
- I went a step further, hidingrte_configafter de-inlining non critical functions--
David MarchandDavid Marchand (11):
eal: remove deprecated CPU flags check function
eal: remove deprecated malloc virt2phys function
mem: hide internal heap header net/bonding: use non deprecated PCI API
pci: remove deprecated functions
log: add log stream accessor
test/mem: remove dependency on EAL internals
eal: deinline lcore APIs
eal: factorize lcore role code
eal: make the global configuration private
doc: announce global logs struct removal from ABI
Quoted 2 lines
Stephen Hemminger (1):
eal: make lcore config private
Thanks for the reviews/acks.
Series applied.
--
David Marchand
Quoted 40 lines · David Marchand
Quoted 37 lines · David Marchand
Let's prepare for the ABI freeze.
The first patches are about changes that had been announced before.
The
malloc_heapstructure from the memory subsystem can be hidden. The PCI library had some forgotten deprecated APIs that are removed with this series.
rte_logscould be hidden, but I left it exposed for now. I added an accessor to rte_logs.file, and added a deprecation notice announcing its removal from the public ABI.Changelog since v2:
- dropped patch 8 and added a deprecation notice onrte_logsinstead,Changelog since v1:
- I went a step further, hidingrte_configafter de-inlining non critical functions--
David MarchandDavid Marchand (11):
eal: remove deprecated CPU flags check function
eal: remove deprecated malloc virt2phys function
mem: hide internal heap header net/bonding: use non deprecated PCI API
pci: remove deprecated functions
log: add log stream accessor
test/mem: remove dependency on EAL internals
eal: deinline lcore APIs
eal: factorize lcore role code
eal: make the global configuration private
doc: announce global logs struct removal from ABI
Quoted 5 lines
Quoted 2 lines
Stephen Hemminger (1):
eal: make lcore config privateThanks for the reviews/acks.
Series applied.
I held back before pushing as I caught an issue on ethdev abiver. Since the ABI changes are not in place, we should still bump it and the same would apply on eal and pci libraries in this series.
Waiting a bit if anyone is looking at this, else I will go with this for rc1. Thanks.
--
David Marchand
Quoted 46 lines · David Marchand
Quoted 43 lines · David Marchand
Quoted 39 lines · David Marchand
Let's prepare for the ABI freeze.
The first patches are about changes that had been announced before.
The
malloc_heapstructure from the memory subsystem can be hidden. The PCI library had some forgotten deprecated APIs that are removed with this series.
rte_logscould be hidden, but I left it exposed for now. I added an accessor to rte_logs.file, and added a deprecation notice announcing its removal from the public ABI.Changelog since v2:
- dropped patch 8 and added a deprecation notice onrte_logsinstead,Changelog since v1:
- I went a step further, hidingrte_configafter de-inlining non critical functions--
David MarchandDavid Marchand (11):
eal: remove deprecated CPU flags check function
eal: remove deprecated malloc virt2phys function
mem: hide internal heap header net/bonding: use non deprecated PCI API
pci: remove deprecated functions
log: add log stream accessor
test/mem: remove dependency on EAL internals
eal: deinline lcore APIs
eal: factorize lcore role code
eal: make the global configuration private
doc: announce global logs struct removal from ABIStephen Hemminger (1):
eal: make lcore config private
Quoted 6 lines
Quoted 2 lines
Thanks for the reviews/acks.
Series applied.I held back before pushing as I caught an issue on ethdev abiver. Since the ABI changes are not in place, we should still bump it and the same would apply on eal and pci libraries in this series.
Discussed with Thomas, updated the release notes and bumped the eal and pci libraries.
And pushed to master.
Signature · 1 line
David Marchand