Covert static log types in libraries to dynamic
v12 cover Covert static log types in libraries to dynamic
This patchset removes the main uses of static LOGTYPE's in DPDK libraries. It starts with the easy one and goes on to the more complex ones.
There are several options on how to treat the old static types:
leave them there, mark as deprecated, or remove them. This version removes them since there is no guarantee in current DPDK policies that says they can't be removed.
Note: there is one patch in this series that will get flagged incorrectly as an ABI change.
v12 - rebase and add table and pipeline libraries
v11 - fix include check on arm cross build
v10 - add necessary rte_compat.h in thash_gfni stub for arm
v9 - fix handling of crc32 alg in lib/hash.
make it an internal global variable.
fix gfni stubs for case where they are not used.
Stephen Hemminger (22):
gso: don't log message on non TCP/UDP
eal: drop no longer used GSO logtype
log: drop unused RTE_LOGTYPE_TIMER
efd: convert RTE_LOGTYPE_EFD to dynamic type
mbuf: convert RTE_LOGTYPE_MBUF to dynamic type
acl: convert RTE_LOGTYPE_ACL to dynamic type examples/power: replace use of RTE_LOGTYPE_POWER examples/l3fwd-power: replace use of RTE_LOGTYPE_POWER
power: convert RTE_LOGTYPE_POWER to dynamic type
ring: convert RTE_LOGTYPE_RING to dynamic type
mempool: convert RTE_LOGTYPE_MEMPOOL to dynamic type
lpm: convert RTE_LOGTYPE_LPM to dynamic types
kni: convert RTE_LOGTYPE_KNI to dynamic type
sched: convert RTE_LOGTYPE_SCHED to dynamic type examples/ipsec-secgw: replace RTE_LOGTYPE_PORT
port: convert RTE_LOGTYPE_PORT to dynamic type
hash: move rte_thash_gfni stubs out of header file
hash: move rte_hash_set_alg out header
hash: convert RTE_LOGTYPE_HASH to dynamic type
table: convert RTE_LOGTYPE_TABLE to dynamic type app/test: remove use of RTE_LOGTYPE_PIPELINE
pipeline: convert RTE_LOGTYPE_PIPELINE to dynamic type
app/test/test_acl.c | 3 +- app/test/test_table_acl.c | 50 +++++++++++------------- app/test/test_table_pipeline.c | 40 +++++++++---------- examples/distributor/main.c | 2 +- examples/ipsec-secgw/sa.c | 6 +-- examples/l3fwd-power/main.c | 17 +++++---- lib/acl/acl_bld.c | 1 + lib/acl/acl_gen.c | 1 + lib/acl/acl_log.h | 4 ++ lib/acl/rte_acl.c | 4 ++ lib/acl/tb_mem.c | 3 +- lib/eal/common/eal_common_log.c | 17 --------- lib/eal/include/rte_log.h | 34 ++++++++--------- lib/efd/rte_efd.c | 4 ++ lib/fib/fib_log.h | 4 ++ lib/fib/rte_fib.c | 3 ++ lib/fib/rte_fib6.c | 2 + lib/gso/rte_gso.c | 4 +- lib/gso/rte_gso.h | 1 + lib/hash/meson.build | 9 ++++- lib/hash/rte_crc_arm64.h | 8 ++-- lib/hash/rte_crc_x86.h | 10 ++--- lib/hash/rte_cuckoo_hash.c | 5 +++ lib/hash/rte_fbk_hash.c | 5 +++ lib/hash/rte_hash_crc.c | 68 +++++++++++++++++++++++++++++++++ lib/hash/rte_hash_crc.h | 48 ++--------------------- lib/hash/rte_thash.c | 3 ++ lib/hash/rte_thash_gfni.c | 50 ++++++++++++++++++++++++ lib/hash/rte_thash_gfni.h | 30 +++++---------- lib/hash/version.map | 11 ++++++ lib/kni/rte_kni.c | 3 ++ lib/lpm/lpm_log.h | 4 ++ lib/lpm/rte_lpm.c | 3 ++ lib/lpm/rte_lpm6.c | 1 + lib/mbuf/mbuf_log.h | 4 ++ lib/mbuf/rte_mbuf.c | 4 ++ lib/mbuf/rte_mbuf_dyn.c | 2 + lib/mbuf/rte_mbuf_pool_ops.c | 2 + lib/mempool/rte_mempool.c | 2 + lib/mempool/rte_mempool.h | 8 ++++ lib/mempool/version.map | 3 ++ lib/pipeline/rte_pipeline.c | 2 + lib/pipeline/rte_pipeline.h | 5 +++ lib/port/rte_port_ethdev.c | 3 ++ lib/port/rte_port_eventdev.c | 4 ++ lib/port/rte_port_fd.c | 3 ++ lib/port/rte_port_frag.c | 3 ++ lib/port/rte_port_kni.c | 3 ++ lib/port/rte_port_ras.c | 3 ++ lib/port/rte_port_ring.c | 3 ++ lib/port/rte_port_sched.c | 3 ++ lib/port/rte_port_source_sink.c | 3 ++ lib/port/rte_port_sym_crypto.c | 3 ++ lib/power/guest_channel.c | 3 +- lib/power/power_common.c | 2 + lib/power/power_common.h | 3 +- lib/power/power_kvm_vm.c | 1 + lib/power/rte_power.c | 1 + lib/rib/rib_log.h | 4 ++ lib/rib/rte_rib.c | 3 ++ lib/rib/rte_rib6.c | 3 ++ lib/ring/rte_ring.c | 3 ++ lib/sched/rte_pie.c | 1 + lib/sched/rte_sched.c | 5 +++ lib/sched/rte_sched_log.h | 4 ++ lib/table/meson.build | 1 + lib/table/rte_table.c | 8 ++++ lib/table/rte_table.h | 4 ++ 68 files changed, 391 insertions(+), 176 deletions(-) create mode 100644 lib/acl/acl_log.h create mode 100644 lib/fib/fib_log.h create mode 100644 lib/hash/rte_hash_crc.c create mode 100644 lib/hash/rte_thash_gfni.c create mode 100644 lib/lpm/lpm_log.h create mode 100644 lib/mbuf/mbuf_log.h create mode 100644 lib/rib/rib_log.h create mode 100644 lib/sched/rte_sched_log.h create mode 100644 lib/table/rte_table.c
Signature · 1 line
2.39.2
PATCH v12 1/22 gso: don't log message on non TCP/UDP
If a large packet is passed into GSO routines of unknown protocol then library would log a message.
Better to tell the application instead of logging.
--- lib/gso/rte_gso.c | 4 +--- lib/gso/rte_gso.h | 1 + 2 files changed, 2 insertions(+), 3 deletions(-)
lib/gso/rte_gso.c +1 -3
@@ -80,9 +80,7 @@ rte_gso_segment(struct rte_mbuf *pkt, ret =gso_udp4_segment (pkt, gso_size, direct_pool, indirect_pool, pkts_out, nb_pkts_out); }else { -/* unsupported packet, skip */ -RTE_LOG (DEBUG ,GSO ,"Unsupported packet type\n" ); - ret =0 ; + ret = -ENOTSUP ;/* only UDP or TCP allowed */ }if (ret <0 ) {
lib/gso/rte_gso.h +1 -0
@@ -114,6 +114,7 @@ struct rte_gso_ctx {* - The number of GSO segments filled in pkts_out on success. * - Return 0 if it does not need to be GSO'd. * - Return -ENOMEM if run out of memory in MBUF pools. +* - Return -ENOTSUP for protocols that can not be segmented * - Return -EINVAL for invalid parameters. */ int rte_gso_segment(struct rte_mbuf *pkt,
Signature · 1 line
2.39.2
PATCH v12 2/22 eal: drop no longer used GSO logtype
In reply to Stephen HemmingerThe message that used this was replaced in previous patch.
--- lib/eal/common/eal_common_log.c | 1 - lib/eal/include/rte_log.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
lib/eal/common/eal_common_log.c +0 -1
@@ -368,7 +368,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_CRYPTODEV, "lib.cryptodev"}, {RTE_LOGTYPE_EFD, "lib.efd"}, {RTE_LOGTYPE_EVENTDEV, "lib.eventdev"}, - {RTE_LOGTYPE_GSO, "lib.gso"}, {RTE_LOGTYPE_USER1, "user1"}, {RTE_LOGTYPE_USER2, "user2"}, {RTE_LOGTYPE_USER3, "user3"},
lib/eal/include/rte_log.h +1 -1
@@ -46,7 +46,7 @@ extern "C" {#define RTE_LOGTYPE_CRYPTODEV 17/**< Log related to cryptodev. */ #define RTE_LOGTYPE_EFD 18/**< Log related to EFD. */ #define RTE_LOGTYPE_EVENTDEV 19/**< Log related to eventdev. */ -#define RTE_LOGTYPE_GSO 20/**< Log related to GSO. */ +/* was RTE_LOGTYPE_GSO */ /* these log types can be used in an application */ #define RTE_LOGTYPE_USER1 24/**< User-defined log type 1. */
Signature · 1 line
2.39.2
PATCH v12 3/22 log: drop unused RTE_LOGTYPE_TIMER
In reply to Stephen HemmingerThe timer code does not use rte_log.
--- lib/eal/common/eal_common_log.c | 1 - lib/eal/include/rte_log.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
lib/eal/common/eal_common_log.c +0 -1
@@ -352,7 +352,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_MALLOC, "lib.malloc"}, {RTE_LOGTYPE_RING, "lib.ring"}, {RTE_LOGTYPE_MEMPOOL, "lib.mempool"}, - {RTE_LOGTYPE_TIMER, "lib.timer"}, {RTE_LOGTYPE_PMD, "pmd"}, {RTE_LOGTYPE_HASH, "lib.hash"}, {RTE_LOGTYPE_LPM, "lib.lpm"},
lib/eal/include/rte_log.h +1 -1
@@ -30,7 +30,7 @@ extern "C" {#define RTE_LOGTYPE_MALLOC 1/**< Log related to malloc. */ #define RTE_LOGTYPE_RING 2/**< Log related to ring. */ #define RTE_LOGTYPE_MEMPOOL 3/**< Log related to mempool. */ -#define RTE_LOGTYPE_TIMER 4/**< Log related to timers. */ +/* was RTE_LOGTYPE_TIMER */ #define RTE_LOGTYPE_PMD 5/**< Log related to poll mode driver. */ #define RTE_LOGTYPE_HASH 6/**< Log related to hash table. */ #define RTE_LOGTYPE_LPM 7/**< Log related to LPM. */
Signature · 1 line
2.39.2
PATCH v12 4/22 efd: convert RTE_LOGTYPE_EFD to dynamic type
In reply to Stephen HemmingerReplace all uses of the global logtype with a dynamic log type.
--- lib/eal/common/eal_common_log.c | 1 - lib/eal/include/rte_log.h | 2 +- lib/efd/rte_efd.c | 4 ++++ 3 files changed, 5 insertions(+), 2 deletions(-)
lib/eal/common/eal_common_log.c +0 -1
@@ -365,7 +365,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_PIPELINE, "lib.pipeline"}, {RTE_LOGTYPE_MBUF, "lib.mbuf"}, {RTE_LOGTYPE_CRYPTODEV, "lib.cryptodev"}, - {RTE_LOGTYPE_EFD, "lib.efd"}, {RTE_LOGTYPE_EVENTDEV, "lib.eventdev"}, {RTE_LOGTYPE_USER1, "user1"}, {RTE_LOGTYPE_USER2, "user2"},
lib/eal/include/rte_log.h +1 -1
@@ -44,7 +44,7 @@ extern "C" {#define RTE_LOGTYPE_PIPELINE 15/**< Log related to pipeline. */ #define RTE_LOGTYPE_MBUF 16/**< Log related to mbuf. */ #define RTE_LOGTYPE_CRYPTODEV 17/**< Log related to cryptodev. */ -#define RTE_LOGTYPE_EFD 18/**< Log related to EFD. */ +/* was RTE_LOGTYPE_EFD */ #define RTE_LOGTYPE_EVENTDEV 19/**< Log related to eventdev. */ /* was RTE_LOGTYPE_GSO */
lib/efd/rte_efd.c +4 -0
@@ -9,6 +9,7 @@#include <errno.h> #include <sys/queue.h> +#include <rte_cpuflags.h> #include <rte_string_fns.h> #include <rte_log.h> #include <rte_eal_memconfig.h>
@@ -28,6 +29,9 @@#include "rte_efd_arm64.h" #endif +RTE_LOG_REGISTER_DEFAULT (efd_logtype,INFO ); +#define RTE_LOGTYPE_EFD efd_logtype +#define EFD_KEY (key_idx, table) (table->keys + ((key_idx) * table->key_len))/** Hash function used to determine chunk_id and bin_id for a group */ #define EFD_HASH (key, table) \
Signature · 1 line
2.39.2
PATCH v12 5/22 mbuf: convert RTE_LOGTYPE_MBUF to dynamic type
In reply to Stephen HemmingerIntroduce a new dynamic logtype for mbuf related messages. Since this is used in multiple files put one macro in mbuf_log.h
--- lib/eal/common/eal_common_log.c | 1 - lib/eal/include/rte_log.h | 2 +- lib/mbuf/mbuf_log.h | 4 ++++ lib/mbuf/rte_mbuf.c | 4 ++++ lib/mbuf/rte_mbuf_dyn.c | 2 ++ lib/mbuf/rte_mbuf_pool_ops.c | 2 ++ 6 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 lib/mbuf/mbuf_log.h
lib/eal/common/eal_common_log.c +0 -1
@@ -363,7 +363,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_PORT, "lib.port"}, {RTE_LOGTYPE_TABLE, "lib.table"}, {RTE_LOGTYPE_PIPELINE, "lib.pipeline"}, - {RTE_LOGTYPE_MBUF, "lib.mbuf"}, {RTE_LOGTYPE_CRYPTODEV, "lib.cryptodev"}, {RTE_LOGTYPE_EVENTDEV, "lib.eventdev"}, {RTE_LOGTYPE_USER1, "user1"},
lib/eal/include/rte_log.h +1 -1
@@ -42,7 +42,7 @@ extern "C" {#define RTE_LOGTYPE_PORT 13/**< Log related to port. */ #define RTE_LOGTYPE_TABLE 14/**< Log related to table. */ #define RTE_LOGTYPE_PIPELINE 15/**< Log related to pipeline. */ -#define RTE_LOGTYPE_MBUF 16/**< Log related to mbuf. */ +/* was RTE_LOGTYPE_MBUF */ #define RTE_LOGTYPE_CRYPTODEV 17/**< Log related to cryptodev. */ /* was RTE_LOGTYPE_EFD */ #define RTE_LOGTYPE_EVENTDEV 19/**< Log related to eventdev. */
lib/mbuf/mbuf_log.h new file +4 -0
@@ -0,0 +1,4 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ + +extern int mbuf_logtype; +#define RTE_LOGTYPE_MBUF mbuf_logtype
lib/mbuf/rte_mbuf.c +4 -0
@@ -20,6 +20,10 @@#include <rte_errno.h> #include <rte_memcpy.h> +#include "mbuf_log.h" + +RTE_LOG_REGISTER_DEFAULT (mbuf_logtype,INFO ); +/* * pktmbuf pool constructor, given as a callback function to * rte_mempool_create(), or called directly if using
lib/mbuf/rte_mbuf_dyn.c +2 -0
@@ -17,6 +17,8 @@#include <rte_mbuf.h> #include <rte_mbuf_dyn.h> +#include "mbuf_log.h" +#define RTE_MBUF_DYN_MZNAME "rte_mbuf_dyn"struct mbuf_dynfield_elt {
lib/mbuf/rte_mbuf_pool_ops.c +2 -0
@@ -8,6 +8,8 @@#include <rte_errno.h> #include <rte_mbuf_pool_ops.h> +#include "mbuf_log.h" +int rte_mbuf_set_platform_mempool_ops (const char *ops_name) {
Signature · 1 line
2.39.2
PATCH v12 6/22 acl: convert RTE_LOGTYPE_ACL to dynamic type
In reply to Stephen HemmingerGet rid of RTE_LOGTYPE_ACL and RTE_LOGTYPE_MALLOC. For ACL library use a dynamic type.
The one message using RTE_LOGTYPE_MALLOC should have been under the ACL logtype anyway.
The test code should not have been using fixed log type so just change that to stderr.
--- app/test/test_acl.c | 3 ++- lib/acl/acl_bld.c | 1 + lib/acl/acl_gen.c | 1 + lib/acl/acl_log.h | 4 ++++ lib/acl/rte_acl.c | 4 ++++ lib/acl/tb_mem.c | 3 ++- lib/eal/common/eal_common_log.c | 2 -- lib/eal/include/rte_log.h | 4 ++-- 8 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 lib/acl/acl_log.h
app/test/test_acl.c +2 -1
@@ -154,7 +154,8 @@ rte_acl_ipv4vlan_add_rules(struct rte_acl_ctx *ctx,for (i =0 ; i != num; i++) { rc =acl_ipv4vlan_check_rule (rules + i);if (rc !=0 ) { -RTE_LOG (ERR ,ACL ,"%s: rule #%u is invalid\n" , +fprintf (stderr, +"%s: rule #%u is invalid\n" , __func__, i +1 );return rc; }
lib/acl/acl_bld.c +1 -0
@@ -5,6 +5,7 @@#include <rte_acl.h> #include "tb_mem.h" #include "acl.h" +#include "acl_log.h" #define ACL_POOL_ALIGN 8#define ACL_POOL_ALLOC_MIN 0x800000
lib/acl/acl_gen.c +1 -0
@@ -4,6 +4,7 @@#include <rte_acl.h> #include "acl.h" +#include "acl_log.h" #define QRANGE_MIN ((uint8_t)INT8_MIN)
lib/acl/acl_log.h new file +4 -0
@@ -0,0 +1,4 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ + +extern int acl_logtype; +#define RTE_LOGTYPE_ACL acl_logtype
lib/acl/rte_acl.c +4 -0
@@ -6,8 +6,12 @@#include <rte_string_fns.h> #include <rte_acl.h> #include <rte_tailq.h> +#include <rte_log.h> #include "acl.h" +#include "acl_log.h" + +RTE_LOG_REGISTER_DEFAULT (acl_logtype,INFO );TAILQ_HEAD (rte_acl_list, rte_tailq_entry);
lib/acl/tb_mem.c +2 -1
@@ -3,6 +3,7 @@*/ #include "tb_mem.h" +#include "acl_log.h" /* * Memory management routines for temporary memory.
@@ -25,7 +26,7 @@ tb_pool(struct tb_mem_pool *pool, size_t sz) size = sz + pool->alignment -1 ; block =calloc (1 , size +sizeof (*pool->block));if (block ==NULL ) { -RTE_LOG (ERR ,MALLOC ,"%s(%zu)\n failed, currently allocated " +RTE_LOG (ERR ,ACL ,"%s(%zu)\n failed, currently allocated " "by pool: %zu bytes\n" , __func__, sz, pool->alloc);siglongjmp (pool->fail, -ENOMEM );return NULL ;
lib/eal/common/eal_common_log.c +0 -2
@@ -349,14 +349,12 @@ struct logtype {static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL ,"lib.eal" }, - {RTE_LOGTYPE_MALLOC ,"lib.malloc" }, {RTE_LOGTYPE_RING ,"lib.ring" }, {RTE_LOGTYPE_MEMPOOL ,"lib.mempool" }, {RTE_LOGTYPE_PMD ,"pmd" }, {RTE_LOGTYPE_HASH ,"lib.hash" }, {RTE_LOGTYPE_LPM ,"lib.lpm" }, {RTE_LOGTYPE_KNI ,"lib.kni" }, - {RTE_LOGTYPE_ACL ,"lib.acl" }, {RTE_LOGTYPE_POWER ,"lib.power" }, {RTE_LOGTYPE_METER ,"lib.meter" }, {RTE_LOGTYPE_SCHED ,"lib.sched" },
lib/eal/include/rte_log.h +2 -2
@@ -27,7 +27,7 @@ extern "C" {/* SDK log type */ #define RTE_LOGTYPE_EAL 0/**< Log related to eal. */ -#define RTE_LOGTYPE_MALLOC 1/**< Log related to malloc. */ +/* was RTE_LOGTYPE_MALLOC */ #define RTE_LOGTYPE_RING 2/**< Log related to ring. */ #define RTE_LOGTYPE_MEMPOOL 3/**< Log related to mempool. */ /* was RTE_LOGTYPE_TIMER */
@@ -35,7 +35,7 @@ extern "C" {#define RTE_LOGTYPE_HASH 6/**< Log related to hash table. */ #define RTE_LOGTYPE_LPM 7/**< Log related to LPM. */ #define RTE_LOGTYPE_KNI 8/**< Log related to KNI. */ -#define RTE_LOGTYPE_ACL 9/**< Log related to ACL. */ +/* was RTE_LOGTYPE_ACL */ #define RTE_LOGTYPE_POWER 10/**< Log related to power. */ #define RTE_LOGTYPE_METER 11/**< Log related to QoS meter. */ #define RTE_LOGTYPE_SCHED 12/**< Log related to QoS port scheduler. */
Signature · 1 line
2.39.2
Re: [PATCH v12 06/22] acl: convert RTE_LOGTYPE_ACL to dynamic type
Get rid of RTE_LOGTYPE_ACL and RTE_LOGTYPE_MALLOC. For ACL library use a dynamic type.
The one message using RTE_LOGTYPE_MALLOC should have been under the ACL logtype anyway.
The test code should not have been using fixed log type so just change that to stderr.
---
app/test/test_acl.c | 3 ++-
lib/acl/acl_bld.c | 1 + lib/acl/acl_gen.c | 1 + lib/acl/acl_log.h | 4 ++++ lib/acl/rte_acl.c | 4 ++++ lib/acl/tb_mem.c | 3 ++- lib/eal/common/eal_common_log.c | 2 -- lib/eal/include/rte_log.h | 4 ++-- 8 files changed, 16 insertions(+), 6 deletions(-)
create mode 100644 lib/acl/acl_log.h
app/test/test_acl.c +0 -0
@@ -154,7 +154,8 @@ rte_acl_ipv4vlan_add_rules(struct rte_acl_ctx *ctx,
for (i = 0; i != num; i++) {
rc = acl_ipv4vlan_check_rule(rules + i); if (rc != 0) {
- RTE_LOG(ERR, ACL, "%s: rule #%u is invalid\n",
+ fprintf(stderr,
+ "%s: rule #%u is invalid\n",
__func__, i + 1); return rc;
}
lib/acl/acl_bld.c +0 -0
@@ -5,6 +5,7 @@
#include <rte_acl.h>
#include "tb_mem.h"
#include "acl.h"
+#include "acl_log.h"
#define ACL_POOL_ALIGN 8
#define ACL_POOL_ALLOC_MIN 0x800000
lib/acl/acl_gen.c +0 -0
@@ -4,6 +4,7 @@
#include <rte_acl.h>
#include "acl.h"
+#include "acl_log.h"
#define QRANGE_MIN ((uint8_t)INT8_MIN)
lib/acl/acl_log.h new file +4 -0
@@ -0,0 +1,4 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ + +extern int acl_logtype; +#define RTE_LOGTYPE_ACL acl_logtype
lib/acl/rte_acl.c +0 -0
@@ -6,8 +6,12 @@
#include <rte_string_fns.h>
#include <rte_acl.h>
#include <rte_tailq.h>
+#include <rte_log.h>
#include "acl.h"
+#include "acl_log.h"
+
+RTE_LOG_REGISTER_DEFAULT(acl_logtype, INFO);
TAILQ_HEAD(rte_acl_list, rte_tailq_entry);
lib/acl/tb_mem.c +0 -0
@@ -3,6 +3,7 @@
*/
#include "tb_mem.h"
+#include "acl_log.h"
/*
* Memory management routines for temporary memory.
@@ -25,7 +26,7 @@ tb_pool(struct tb_mem_pool *pool, size_t sz) size = sz + pool->alignment - 1;
block = calloc(1, size + sizeof(*pool->block));
if (block == NULL) {
- RTE_LOG(ERR, MALLOC, "%s(%zu)\n failed, currently allocated "
+ RTE_LOG(ERR, ACL, "%s(%zu)\n failed, currently allocated "
"by pool: %zu bytes\n", __func__, sz, pool->alloc); siglongjmp(pool->fail, -ENOMEM);
return NULL;
lib/eal/common/eal_common_log.c +0 -0
@@ -349,14 +349,12 @@ struct logtype {
static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL, "lib.eal"},
- {RTE_LOGTYPE_MALLOC, "lib.malloc"}, {RTE_LOGTYPE_RING, "lib.ring"}, {RTE_LOGTYPE_MEMPOOL, "lib.mempool"}, {RTE_LOGTYPE_PMD, "pmd"}, {RTE_LOGTYPE_HASH, "lib.hash"}, {RTE_LOGTYPE_LPM, "lib.lpm"}, {RTE_LOGTYPE_KNI, "lib.kni"},
- {RTE_LOGTYPE_ACL, "lib.acl"}, {RTE_LOGTYPE_POWER, "lib.power"}, {RTE_LOGTYPE_METER, "lib.meter"}, {RTE_LOGTYPE_SCHED, "lib.sched"},
lib/eal/include/rte_log.h +0 -0
@@ -27,7 +27,7 @@ extern "C" {
/* SDK log type */
#define RTE_LOGTYPE_EAL 0 /**< Log related to eal. */ -#define RTE_LOGTYPE_MALLOC 1 /**< Log related to malloc. */
+ /* was RTE_LOGTYPE_MALLOC */
#define RTE_LOGTYPE_RING 2 /**< Log related to ring. */ #define RTE_LOGTYPE_MEMPOOL 3 /**< Log related to mempool. */ /* was RTE_LOGTYPE_TIMER */ @@ -35,7 +35,7 @@ extern "C" {
#define RTE_LOGTYPE_HASH 6 /**< Log related to hash table. */ #define RTE_LOGTYPE_LPM 7 /**< Log related to LPM. */ #define RTE_LOGTYPE_KNI 8 /**< Log related to KNI. */ -#define RTE_LOGTYPE_ACL 9 /**< Log related to ACL. */
+ /* was RTE_LOGTYPE_ACL */
#define RTE_LOGTYPE_POWER 10 /**< Log related to power. */ #define RTE_LOGTYPE_METER 11 /**< Log related to QoS meter. */ #define RTE_LOGTYPE_SCHED 12 /**< Log related to QoS port scheduler. */ --
2.39.2
PATCH v12 7/22 examples/power: replace use of RTE_LOGTYPE_POWER
In reply to Stephen HemmingerDon't use static logtype in sample application.
--- examples/distributor/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
examples/distributor/main.c +1 -1
@@ -679,7 +679,7 @@ init_power_library(void)/* init power management library */ ret =rte_power_init (lcore_id);if (ret) { -RTE_LOG (ERR ,POWER , +fprintf (stderr,"Library initialization failed on core %u\n" , lcore_id);/*
Signature · 1 line
2.39.2
PATCH v12 8/22 examples/l3fwd-power: replace use of RTE_LOGTYPE_POWER
In reply to Stephen HemmingerConvert to using a dynamic logtype for the application.
--- examples/l3fwd-power/main.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
examples/l3fwd-power/main.c +9 -8
@@ -51,7 +51,8 @@#include "perf_core.h" #include "main.h" -#define RTE_LOGTYPE_L3FWD_POWER RTE_LOGTYPE_USER1 +RTE_LOG_REGISTER (l3fwd_power_logtype, l3fwd.power,INFO ); +#define RTE_LOGTYPE_L3FWD_POWER l3fwd_power_logtype#define MAX_PKT_BURST 32
@@ -2236,7 +2237,7 @@ init_power_library(void)/* init power management library */ ret =rte_power_init (lcore_id);if (ret) { -RTE_LOG (ERR ,POWER , +RTE_LOG (ERR ,L3FWD_POWER ,"Library initialization failed on core %u\n" , lcore_id);return ret;
@@ -2246,8 +2247,8 @@ init_power_library(void)if (env !=PM_ENV_ACPI_CPUFREQ && env !=PM_ENV_PSTATE_CPUFREQ && env !=PM_ENV_CPPC_CPUFREQ ) { -RTE_LOG (ERR ,POWER , -"Only ACPI, PSTATE and CPPC mode are supported\n" ); +RTE_LOG (ERR ,L3FWD_POWER , +"Only ACPI and PSTATE mode are supported\n" );return -1 ; } }
@@ -2264,7 +2265,7 @@ deinit_power_library(void)/* deinit power management library */ ret =rte_power_exit (lcore_id);if (ret) { -RTE_LOG (ERR ,POWER , +RTE_LOG (ERR ,L3FWD_POWER ,"Library deinitialization failed on core %u\n" , lcore_id);return ret;
@@ -2333,7 +2334,7 @@ update_telemetry(__rte_unused struct rte_timer *tim, ret =rte_metrics_update_values (RTE_METRICS_GLOBAL , telstats_index, values,RTE_DIM (values));if (ret <0 ) -RTE_LOG (WARNING ,POWER ,"failed to update metrics\n" ); +RTE_LOG (WARNING ,L3FWD_POWER ,"failed to update metrics\n" ); } static int
@@ -2382,7 +2383,7 @@ launch_timer(unsigned int lcore_id) rte_get_main_lcore()); } -RTE_LOG (INFO ,POWER ,"Bring up the Timer\n" ); +RTE_LOG (INFO ,L3FWD_POWER ,"Bring up the Timer\n" );telemetry_setup_timer ();
@@ -2398,7 +2399,7 @@ launch_timer(unsigned int lcore_id) } } -RTE_LOG (INFO ,POWER ,"Timer_subsystem is done\n" ); +RTE_LOG (INFO ,L3FWD_POWER ,"Timer_subsystem is done\n" );return 0 ; }
Signature · 1 line
2.39.2
PATCH v12 9/22 power: convert RTE_LOGTYPE_POWER to dynamic type
In reply to Stephen HemmingerUse dynamic log type for power library.
Also replace use of RTE_LOGTYPE_USER1 with lib.power.guest.
--- lib/eal/common/eal_common_log.c | 1 - lib/eal/include/rte_log.h | 2 +- lib/power/guest_channel.c | 3 ++- lib/power/power_common.c | 2 ++ lib/power/power_common.h | 3 ++- lib/power/power_kvm_vm.c | 1 + lib/power/rte_power.c | 1 + 7 files changed, 9 insertions(+), 4 deletions(-)
lib/eal/common/eal_common_log.c +0 -1
@@ -355,7 +355,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_HASH, "lib.hash"}, {RTE_LOGTYPE_LPM, "lib.lpm"}, {RTE_LOGTYPE_KNI, "lib.kni"}, - {RTE_LOGTYPE_POWER, "lib.power"}, {RTE_LOGTYPE_METER, "lib.meter"}, {RTE_LOGTYPE_SCHED, "lib.sched"}, {RTE_LOGTYPE_PORT, "lib.port"},
lib/eal/include/rte_log.h +1 -1
@@ -36,7 +36,7 @@ extern "C" {#define RTE_LOGTYPE_LPM 7/**< Log related to LPM. */ #define RTE_LOGTYPE_KNI 8/**< Log related to KNI. */ /* was RTE_LOGTYPE_ACL */ -#define RTE_LOGTYPE_POWER 10/**< Log related to power. */ +/* was RTE_LOGTYPE_POWER */ #define RTE_LOGTYPE_METER 11/**< Log related to QoS meter. */ #define RTE_LOGTYPE_SCHED 12/**< Log related to QoS port scheduler. */ #define RTE_LOGTYPE_PORT 13/**< Log related to port. */
lib/power/guest_channel.c +2 -1
@@ -17,7 +17,8 @@#include "guest_channel.h" -#define RTE_LOGTYPE_GUEST_CHANNEL RTE_LOGTYPE_USER1 +RTE_LOG_REGISTER_SUFFIX (guest_channel_logtype, guest,INFO ); +#define RTE_LOGTYPE_GUEST_CHANNEL guest_channel_logtype/* Timeout for incoming message in milliseconds. */ #define TIMEOUT 10
lib/power/power_common.c +2 -0
@@ -12,6 +12,8 @@#include "power_common.h" +RTE_LOG_REGISTER_DEFAULT (power_logtype,INFO ); +#define POWER_SYSFILE_SCALING_DRIVER \ "/sys/devices/system/cpu/cpu%u/cpufreq/scaling_driver"#define POWER_SYSFILE_GOVERNOR \
lib/power/power_common.h +2 -1
@@ -5,11 +5,12 @@#ifndef _POWER_COMMON_H_#define _POWER_COMMON_H_ -#include <rte_common.h> #define RTE_POWER_INVALID_FREQ_INDEX (~0) +extern int power_logtype; +#define RTE_LOGTYPE_POWER power_logtype#ifdef RTE_LIBRTE_POWER_DEBUG #define POWER_DEBUG_TRACE(fmt, args...) \
lib/power/power_kvm_vm.c +1 -0
@@ -8,6 +8,7 @@#include "rte_power_guest_channel.h" #include "guest_channel.h" +#include "power_common.h" #include "power_kvm_vm.h" #define FD_PATH "/dev/virtio-ports/virtio.serial.port.poweragent"
lib/power/rte_power.c +1 -0
@@ -10,6 +10,7 @@#include "rte_power.h" #include "power_acpi_cpufreq.h" #include "power_cppc_cpufreq.h" +#include "power_common.h" #include "power_kvm_vm.h" #include "power_pstate_cpufreq.h"
Signature · 1 line
2.39.2
PATCH v12 10/22 ring: convert RTE_LOGTYPE_RING to dynamic type
In reply to Stephen HemmingerThe logtype for ring only used in library.
--- lib/eal/common/eal_common_log.c | 1 - lib/eal/include/rte_log.h | 2 +- lib/ring/rte_ring.c | 3 +++ 3 files changed, 4 insertions(+), 2 deletions(-)
lib/eal/common/eal_common_log.c +0 -1
@@ -349,7 +349,6 @@ struct logtype {static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL ,"lib.eal" }, - {RTE_LOGTYPE_RING ,"lib.ring" }, {RTE_LOGTYPE_MEMPOOL ,"lib.mempool" }, {RTE_LOGTYPE_PMD ,"pmd" }, {RTE_LOGTYPE_HASH ,"lib.hash" },
lib/eal/include/rte_log.h +1 -1
@@ -28,7 +28,7 @@ extern "C" {/* SDK log type */ #define RTE_LOGTYPE_EAL 0/**< Log related to eal. */ /* was RTE_LOGTYPE_MALLOC */ -#define RTE_LOGTYPE_RING 2/**< Log related to ring. */ +/* was RTE_LOGTYPE_RING */ #define RTE_LOGTYPE_MEMPOOL 3/**< Log related to mempool. */ /* was RTE_LOGTYPE_TIMER */ #define RTE_LOGTYPE_PMD 5/**< Log related to poll mode driver. */
lib/ring/rte_ring.c +3 -0
@@ -26,6 +26,9 @@#include "rte_ring.h" #include "rte_ring_elem.h" +RTE_LOG_REGISTER_DEFAULT (ring_logtype,INFO ); +#define RTE_LOGTYPE_RING ring_logtype +TAILQ_HEAD (rte_ring_list, rte_tailq_entry);static struct rte_tailq_elem rte_ring_tailq = {
Signature · 1 line
2.39.2
Re: [PATCH v12 10/22] ring: convert RTE_LOGTYPE_RING to dynamic type
The logtype for ring only used in library.
---
lib/eal/common/eal_common_log.c | 1 -
lib/eal/include/rte_log.h | 2 +-
lib/ring/rte_ring.c | 3 +++
3 files changed, 4 insertions(+), 2 deletions(-)
lib/eal/common/eal_common_log.c +0 -0
@@ -349,7 +349,6 @@ struct logtype {
static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL, "lib.eal"},
- {RTE_LOGTYPE_RING, "lib.ring"}, {RTE_LOGTYPE_MEMPOOL, "lib.mempool"}, {RTE_LOGTYPE_PMD, "pmd"}, {RTE_LOGTYPE_HASH, "lib.hash"},
lib/eal/include/rte_log.h +0 -0
@@ -28,7 +28,7 @@ extern "C" {
/* SDK log type */
#define RTE_LOGTYPE_EAL 0 /**< Log related to eal. */ /* was RTE_LOGTYPE_MALLOC */ -#define RTE_LOGTYPE_RING 2 /**< Log related to ring. */
+ /* was RTE_LOGTYPE_RING */
#define RTE_LOGTYPE_MEMPOOL 3 /**< Log related to mempool. */ /* was RTE_LOGTYPE_TIMER */ #define RTE_LOGTYPE_PMD 5 /**< Log related to poll mode driver. */
lib/ring/rte_ring.c +0 -0
@@ -26,6 +26,9 @@
#include "rte_ring.h"
#include "rte_ring_elem.h"
+RTE_LOG_REGISTER_DEFAULT(ring_logtype, INFO);
+#define RTE_LOGTYPE_RING ring_logtype
+
TAILQ_HEAD(rte_ring_list, rte_tailq_entry);
static struct rte_tailq_elem rte_ring_tailq = {
--
2.39.2
PATCH v12 11/22 mempool: convert RTE_LOGTYPE_MEMPOOL to dynamic type
In reply to Stephen HemmingerConvert from RTE_LOGTYPE_MEMPOOL to logtype_mempool.
--- lib/eal/common/eal_common_log.c | 1 - lib/eal/include/rte_log.h | 2 +- lib/mempool/rte_mempool.c | 2 ++ lib/mempool/rte_mempool.h | 8 ++++++++ lib/mempool/version.map | 3 +++ 5 files changed, 14 insertions(+), 2 deletions(-)
lib/eal/common/eal_common_log.c +0 -1
@@ -349,7 +349,6 @@ struct logtype {static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL ,"lib.eal" }, - {RTE_LOGTYPE_MEMPOOL ,"lib.mempool" }, {RTE_LOGTYPE_PMD ,"pmd" }, {RTE_LOGTYPE_HASH ,"lib.hash" }, {RTE_LOGTYPE_LPM ,"lib.lpm" },
lib/eal/include/rte_log.h +1 -1
@@ -29,7 +29,7 @@ extern "C" {#define RTE_LOGTYPE_EAL 0/**< Log related to eal. */ /* was RTE_LOGTYPE_MALLOC */ /* was RTE_LOGTYPE_RING */ -#define RTE_LOGTYPE_MEMPOOL 3/**< Log related to mempool. */ +/* was RTE_LOGTYPE_MEMPOOL */ /* was RTE_LOGTYPE_TIMER */ #define RTE_LOGTYPE_PMD 5/**< Log related to poll mode driver. */ #define RTE_LOGTYPE_HASH 6/**< Log related to hash table. */
lib/mempool/rte_mempool.c +2 -0
@@ -31,6 +31,8 @@#include "mempool_trace.h" #include "rte_mempool.h" +RTE_LOG_REGISTER_DEFAULT (rte_mempool_logtype,INFO ); +TAILQ_HEAD (rte_mempool_list, rte_tailq_entry);static struct rte_tailq_elem rte_mempool_tailq = {
lib/mempool/rte_mempool.h +8 -0
@@ -43,6 +43,7 @@#include <rte_spinlock.h> #include <rte_debug.h> #include <rte_lcore.h> +#include <rte_log.h> #include <rte_branch_prediction.h> #include <rte_ring.h> #include <rte_memcpy.h>
@@ -175,6 +176,13 @@ struct rte_mempool_objtlr {#endif + +/** +* @internal Logtype used for mempool related messages. +*/ +extern int rte_mempool_logtype; +#define RTE_LOGTYPE_MEMPOOL rte_mempool_logtype +/** * A list of memory where objects are stored */
lib/mempool/version.map +3 -0
@@ -57,4 +57,7 @@ INTERNAL { # added in 21.11 rte_mempool_event_callback_register; rte_mempool_event_callback_unregister; + + # added in 23.07 + rte_mempool_logtype; };
Signature · 1 line
2.39.2
PATCH v12 12/22 lpm: convert RTE_LOGTYPE_LPM to dynamic types
In reply to Stephen HemmingerSplit lpm and lpm6 into separate log types since they are in different files and user may want to change log levels for IPv4 vs IPv6.
For rib and fib libraries give them own types as well.
--- lib/eal/common/eal_common_log.c | 1 - lib/eal/include/rte_log.h | 2 +- lib/fib/fib_log.h | 4 ++++ lib/fib/rte_fib.c | 3 +++ lib/fib/rte_fib6.c | 2 ++ lib/lpm/lpm_log.h | 4 ++++ lib/lpm/rte_lpm.c | 3 +++ lib/lpm/rte_lpm6.c | 1 + lib/rib/rib_log.h | 4 ++++ lib/rib/rte_rib.c | 3 +++ lib/rib/rte_rib6.c | 3 +++ 11 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 lib/fib/fib_log.h create mode 100644 lib/lpm/lpm_log.h create mode 100644 lib/rib/rib_log.h
lib/eal/common/eal_common_log.c +0 -1
@@ -351,7 +351,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL, "lib.eal"}, {RTE_LOGTYPE_PMD, "pmd"}, {RTE_LOGTYPE_HASH, "lib.hash"}, - {RTE_LOGTYPE_LPM, "lib.lpm"}, {RTE_LOGTYPE_KNI, "lib.kni"}, {RTE_LOGTYPE_METER, "lib.meter"}, {RTE_LOGTYPE_SCHED, "lib.sched"},
lib/eal/include/rte_log.h +1 -1
@@ -33,7 +33,7 @@ extern "C" {/* was RTE_LOGTYPE_TIMER */ #define RTE_LOGTYPE_PMD 5/**< Log related to poll mode driver. */ #define RTE_LOGTYPE_HASH 6/**< Log related to hash table. */ -#define RTE_LOGTYPE_LPM 7/**< Log related to LPM. */ +/* was RTE_LOGTYPE_LPM */ #define RTE_LOGTYPE_KNI 8/**< Log related to KNI. */ /* was RTE_LOGTYPE_ACL */ /* was RTE_LOGTYPE_POWER */
lib/fib/fib_log.h new file +4 -0
@@ -0,0 +1,4 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ + +extern int fib_logtype; +#define RTE_LOGTYPE_LPM fib_logtype
lib/fib/rte_fib.c +3 -0
@@ -17,6 +17,9 @@#include <rte_fib.h> #include "dir24_8.h" +#include "fib_log.h" + +RTE_LOG_REGISTER_DEFAULT (fib_logtype,INFO );TAILQ_HEAD (rte_fib_list, rte_tailq_entry);static struct rte_tailq_elem rte_fib_tailq = {
lib/fib/rte_fib6.c +2 -0
@@ -10,6 +10,7 @@#include <rte_eal_memconfig.h> #include <rte_tailq.h> #include <rte_errno.h> +#include <rte_log.h> #include <rte_malloc.h> #include <rte_string_fns.h>
@@ -17,6 +18,7 @@#include <rte_fib6.h> #include "trie.h" +#include "fib_log.h" TAILQ_HEAD (rte_fib6_list, rte_tailq_entry);static struct rte_tailq_elem rte_fib6_tailq = {
lib/lpm/lpm_log.h new file +4 -0
@@ -0,0 +1,4 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ + +extern int lpm_logtype; +#define RTE_LOGTYPE_LPM lpm_logtype
lib/lpm/rte_lpm.c +3 -0
@@ -18,6 +18,9 @@#include <rte_tailq.h> #include "rte_lpm.h" +#include "lpm_log.h" + +RTE_LOG_REGISTER_DEFAULT (lpm_logtype,INFO );TAILQ_HEAD (rte_lpm_list, rte_tailq_entry);
lib/lpm/rte_lpm6.c +1 -0
@@ -20,6 +20,7 @@#include <rte_tailq.h> #include "rte_lpm6.h" +#include "lpm_log.h" #define RTE_LPM6_TBL24_NUM_ENTRIES (1 << 24)#define RTE_LPM6_TBL8_GROUP_NUM_ENTRIES 256
lib/rib/rib_log.h new file +4 -0
@@ -0,0 +1,4 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ + +extern int rib_logtype; +#define RTE_LOGTYPE_LPM rib_logtype
lib/rib/rte_rib.c +3 -0
@@ -16,6 +16,9 @@#include <rte_rib.h> +RTE_LOG_REGISTER_DEFAULT (rib_logtype,INFO ); +#define RTE_LOGTYPE_LPM rib_logtype +TAILQ_HEAD (rte_rib_list, rte_tailq_entry);static struct rte_tailq_elem rte_rib_tailq = { .name ="RTE_RIB" ,
lib/rib/rte_rib6.c +3 -0
@@ -9,6 +9,7 @@#include <rte_eal_memconfig.h> #include <rte_errno.h> +#include <rte_log.h> #include <rte_malloc.h> #include <rte_mempool.h> #include <rte_string_fns.h>
@@ -16,6 +17,8 @@#include <rte_rib6.h> +#include "rib_log.h" +#define RTE_RIB_VALID_NODE 1#define RIB6_MAXDEPTH 128/* Maximum length of a RIB6 name. */
Signature · 1 line
2.39.2
PATCH v12 13/22 kni: convert RTE_LOGTYPE_KNI to dynamic type
In reply to Stephen HemmingerEven though KNI will eventually disappear, fix the logtype now.
--- lib/eal/common/eal_common_log.c | 1 - lib/eal/include/rte_log.h | 2 +- lib/kni/rte_kni.c | 3 +++ 3 files changed, 4 insertions(+), 2 deletions(-)
lib/eal/common/eal_common_log.c +0 -1
@@ -351,7 +351,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL, "lib.eal"}, {RTE_LOGTYPE_PMD, "pmd"}, {RTE_LOGTYPE_HASH, "lib.hash"}, - {RTE_LOGTYPE_KNI, "lib.kni"}, {RTE_LOGTYPE_METER, "lib.meter"}, {RTE_LOGTYPE_SCHED, "lib.sched"}, {RTE_LOGTYPE_PORT, "lib.port"},
lib/eal/include/rte_log.h +1 -1
@@ -34,7 +34,7 @@ extern "C" {#define RTE_LOGTYPE_PMD 5/**< Log related to poll mode driver. */ #define RTE_LOGTYPE_HASH 6/**< Log related to hash table. */ /* was RTE_LOGTYPE_LPM */ -#define RTE_LOGTYPE_KNI 8/**< Log related to KNI. */ +/* was RTE_LOGTYPE_KNI */ /* was RTE_LOGTYPE_ACL */ /* was RTE_LOGTYPE_POWER */ #define RTE_LOGTYPE_METER 11/**< Log related to QoS meter. */
lib/kni/rte_kni.c +3 -0
@@ -23,6 +23,9 @@#include <rte_kni_common.h> #include "rte_kni_fifo.h" +RTE_LOG_REGISTER_DEFAULT (kni_logtype,INFO ); +#define RTE_LOGTYPE_KNI kni_logtype +#define MAX_MBUF_BURST_NUM 32/* Maximum number of ring entries */
Signature · 1 line
2.39.2
PATCH v12 14/22 sched: convert RTE_LOGTYPE_SCHED to dynamic type
In reply to Stephen HemmingerAlso can remove unused RTE_LOGTYPE_METER
--- lib/eal/common/eal_common_log.c | 2 -- lib/eal/include/rte_log.h | 4 ++-- lib/sched/rte_pie.c | 1 + lib/sched/rte_sched.c | 5 +++++ lib/sched/rte_sched_log.h | 4 ++++ 5 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 lib/sched/rte_sched_log.h
lib/eal/common/eal_common_log.c +0 -2
@@ -351,8 +351,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL, "lib.eal"}, {RTE_LOGTYPE_PMD, "pmd"}, {RTE_LOGTYPE_HASH, "lib.hash"}, - {RTE_LOGTYPE_METER, "lib.meter"}, - {RTE_LOGTYPE_SCHED, "lib.sched"}, {RTE_LOGTYPE_PORT, "lib.port"}, {RTE_LOGTYPE_TABLE, "lib.table"}, {RTE_LOGTYPE_PIPELINE, "lib.pipeline"},
lib/eal/include/rte_log.h +2 -2
@@ -37,8 +37,8 @@ extern "C" {/* was RTE_LOGTYPE_KNI */ /* was RTE_LOGTYPE_ACL */ /* was RTE_LOGTYPE_POWER */ -#define RTE_LOGTYPE_METER 11/**< Log related to QoS meter. */ -#define RTE_LOGTYPE_SCHED 12/**< Log related to QoS port scheduler. */ +/* was RTE_LOGTYPE_METER */ +/* was RTE_LOGTYPE_SCHED */ #define RTE_LOGTYPE_PORT 13/**< Log related to port. */ #define RTE_LOGTYPE_TABLE 14/**< Log related to table. */ #define RTE_LOGTYPE_PIPELINE 15/**< Log related to pipeline. */
lib/sched/rte_pie.c +1 -0
@@ -6,6 +6,7 @@#include <stdlib.h> #include <string.h> +#include "rte_sched_log.h" #include "rte_pie.h" #ifdef __INTEL_COMPILER
lib/sched/rte_sched.c +5 -0
@@ -16,9 +16,12 @@#include <rte_reciprocal.h> #include "rte_sched.h" +#include "rte_sched_log.h" #include "rte_sched_common.h" +#include "rte_approx.h" +#ifdef __INTEL_COMPILER#pragma warning(disable:2259)/* conversion may lose significant bits */ #endif
@@ -3002,3 +3005,5 @@ rte_sched_port_dequeue(struct rte_sched_port *port, struct rte_mbuf **pkts, uintreturn count; } + +RTE_LOG_REGISTER_DEFAULT (sched_logtype,INFO );
lib/sched/rte_sched_log.h new file +4 -0
@@ -0,0 +1,4 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ + +extern int sched_logtype; +#define RTE_LOGTYPE_SCHED sched_logtype
Signature · 1 line
2.39.2
PATCH v12 15/22 examples/ipsec-secgw: replace RTE_LOGTYPE_PORT
In reply to Stephen HemmingerLooks like some code got copy/paste in to the IPSEC gateway example from another place. Shouldn't be using RTE_LOGTYPE_PORT here.
--- examples/ipsec-secgw/sa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
examples/ipsec-secgw/sa.c +3 -3
@@ -1130,7 +1130,7 @@ check_eth_dev_caps(uint16_t portid, uint32_t inbound, uint32_t tso)if (inbound) {if ((dev_info.rx_offload_capa &RTE_ETH_RX_OFFLOAD_SECURITY ) ==0 ) { -RTE_LOG (WARNING ,PORT , +RTE_LOG (WARNING ,IPSEC ,"hardware RX IPSec offload is not supported\n" );return -EINVAL ; }
@@ -1138,13 +1138,13 @@ check_eth_dev_caps(uint16_t portid, uint32_t inbound, uint32_t tso) }else {/* outbound */ if ((dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_SECURITY ) ==0 ) { -RTE_LOG (WARNING ,PORT , +RTE_LOG (WARNING ,IPSEC ,"hardware TX IPSec offload is not supported\n" );return -EINVAL ; }if (tso && (dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_TCP_TSO ) ==0 ) { -RTE_LOG (WARNING ,PORT , +RTE_LOG (WARNING ,IPSEC ,"hardware TCP TSO offload is not supported\n" );return -EINVAL ; }
Signature · 1 line
2.39.2
PATCH v12 16/22 port: convert RTE_LOGTYPE_PORT to dynamic type
In reply to Stephen HemmingerSplit up the single static RTE_LOGTYPE_PORT into separate sub types for each component: port.ethdev, port.evendev, ...
--- lib/eal/common/eal_common_log.c | 1 - lib/eal/include/rte_log.h | 2 +- lib/port/rte_port_ethdev.c | 3 +++ lib/port/rte_port_eventdev.c | 4 ++++ lib/port/rte_port_fd.c | 3 +++ lib/port/rte_port_frag.c | 3 +++ lib/port/rte_port_kni.c | 3 +++ lib/port/rte_port_ras.c | 3 +++ lib/port/rte_port_ring.c | 3 +++ lib/port/rte_port_sched.c | 3 +++ lib/port/rte_port_source_sink.c | 3 +++ lib/port/rte_port_sym_crypto.c | 3 +++ 12 files changed, 32 insertions(+), 2 deletions(-)
lib/eal/common/eal_common_log.c +0 -1
@@ -351,7 +351,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL, "lib.eal"}, {RTE_LOGTYPE_PMD, "pmd"}, {RTE_LOGTYPE_HASH, "lib.hash"}, - {RTE_LOGTYPE_PORT, "lib.port"}, {RTE_LOGTYPE_TABLE, "lib.table"}, {RTE_LOGTYPE_PIPELINE, "lib.pipeline"}, {RTE_LOGTYPE_CRYPTODEV, "lib.cryptodev"},
lib/eal/include/rte_log.h +1 -1
@@ -39,7 +39,7 @@ extern "C" {/* was RTE_LOGTYPE_POWER */ /* was RTE_LOGTYPE_METER */ /* was RTE_LOGTYPE_SCHED */ -#define RTE_LOGTYPE_PORT 13/**< Log related to port. */ +/* was RTE_LOGTYPE_PORT */ #define RTE_LOGTYPE_TABLE 14/**< Log related to table. */ #define RTE_LOGTYPE_PIPELINE 15/**< Log related to pipeline. */ /* was RTE_LOGTYPE_MBUF */
lib/port/rte_port_ethdev.c +3 -0
@@ -10,6 +10,9 @@#include "rte_port_ethdev.h" +RTE_LOG_REGISTER_SUFFIX (port_ethdev_logtype, ethdev,INFO ); +#define RTE_LOGTYPE_PORT port_ethdev_logtype +/* * Port ETHDEV Reader */
lib/port/rte_port_eventdev.c +4 -0
@@ -5,11 +5,15 @@#include <string.h> #include <stdint.h> +#include <rte_log.h> #include <rte_mbuf.h> #include <rte_malloc.h> #include "rte_port_eventdev.h" +RTE_LOG_REGISTER_SUFFIX (port_eventdev_logtype, eventdev,INFO ); +#define RTE_LOGTYPE_PORT port_eventdev_logtype +/* * Port EVENTDEV Reader */
lib/port/rte_port_fd.c +3 -0
@@ -10,6 +10,9 @@#include "rte_port_fd.h" +RTE_LOG_REGISTER_SUFFIX (port_fd_logtype, fd,INFO ); +#define RTE_LOGTYPE_PORT port_fd_logtype +/* * Port FD Reader */
lib/port/rte_port_frag.c +3 -0
@@ -7,6 +7,9 @@#include "rte_port_frag.h" +RTE_LOG_REGISTER_SUFFIX (port_frag_logtype, frag,INFO ); +#define RTE_LOGTYPE_PORT port_frag_logtype +/* Max number of fragments per packet allowed */ #define RTE_PORT_FRAG_MAX_FRAGS_PER_PACKET 0x80
lib/port/rte_port_kni.c +3 -0
@@ -9,6 +9,9 @@#include "rte_port_kni.h" +RTE_LOG_REGISTER_SUFFIX (port_kni_logtype, kni,INFO ); +#define RTE_LOGTYPE_PORT port_kni_logtype +/* * Port KNI Reader */
lib/port/rte_port_ras.c +3 -0
@@ -9,6 +9,9 @@#include "rte_port_ras.h" +RTE_LOG_REGISTER_SUFFIX (port_ras_logtype, ras,INFO ); +#define RTE_LOGTYPE_PORT port_ras_logtype +#ifndef RTE_PORT_RAS_N_BUCKETS #define RTE_PORT_RAS_N_BUCKETS 4094#endif
lib/port/rte_port_ring.c +3 -0
@@ -10,6 +10,9 @@#include "rte_port_ring.h" +RTE_LOG_REGISTER_SUFFIX (port_ring_logtype, ring,INFO ); +#define RTE_LOGTYPE_PORT port_ring_logtype +/* * Port RING Reader */
lib/port/rte_port_sched.c +3 -0
@@ -7,6 +7,9 @@#include "rte_port_sched.h" +RTE_LOG_REGISTER_SUFFIX (port_sched_logtype, sched,INFO ); +#define RTE_LOGTYPE_PORT port_sched_logtype +/* * Reader */
lib/port/rte_port_source_sink.c +3 -0
@@ -15,6 +15,9 @@#include "rte_port_source_sink.h" +RTE_LOG_REGISTER_SUFFIX (port_source_logtype, source,INFO ); +#define RTE_LOGTYPE_PORT port_source_logtype +/* * Port SOURCE */
lib/port/rte_port_sym_crypto.c +3 -0
@@ -8,6 +8,9 @@#include "rte_port_sym_crypto.h" +RTE_LOG_REGISTER_SUFFIX (port_crypto_logtype, crypto,INFO ); +#define RTE_LOGTYPE_PORT port_crypto_logtype +/* * Port Crypto Reader */
Signature · 1 line
2.39.2
PATCH v12 17/22 hash: move rte_thash_gfni stubs out of header file
In reply to Stephen HemmingerHaving stubs in header file makes it harder to update RTE_LOG(). Also modify to only print warning once.
--- lib/hash/meson.build | 8 ++++++- lib/hash/rte_thash_gfni.c | 47 +++++++++++++++++++++++++++++++++++++++ lib/hash/rte_thash_gfni.h | 30 ++++++++----------------- lib/hash/version.map | 4 ++++ 4 files changed, 67 insertions(+), 22 deletions(-) create mode 100644 lib/hash/rte_thash_gfni.c
lib/hash/meson.build +7 -1
@@ -17,7 +17,13 @@ indirect_headers += files( 'rte_thash_x86_gfni.h', ) -sources = files('rte_cuckoo_hash.c', 'rte_fbk_hash.c', 'rte_thash.c') +sources = files( + 'rte_cuckoo_hash.c', + 'rte_fbk_hash.c', + 'rte_thash.c', + 'rte_thash_gfni.c' +) + deps += ['net'] deps += ['ring'] deps += ['rcu']
lib/hash/rte_thash_gfni.c new file +47 -0
47 lines not on this page · raw message
lib/hash/rte_thash_gfni.h +9 -21
@@ -9,13 +9,14 @@extern "C" {#endif +#include <stdint.h> +#include <rte_compat.h> -#include <rte_log.h> +#include <rte_common.h> +#include <rte_config.h> #ifdef RTE_ARCH_X86 -#include <rte_thash_x86_gfni.h> -#endif #ifndef RTE_THASH_GFNI_DEFINED
@@ -38,13 +39,8 @@ extern "C" {* Calculated Toeplitz hash value. */ __rte_experimental -static inline uint32_t -rte_thash_gfni(const uint64_t *mtrx __rte_unused, - const uint8_t *key __rte_unused, int len __rte_unused) -{ -RTE_LOG (ERR ,HASH ,"%s is undefined under given arch\n" , __func__); -return 0 ; -} +uint32_t +rte_thash_gfni (const uint64_t *mtrx,const uint8_t *key,int len);/** * Bulk implementation for Toeplitz hash.
@@ -67,17 +63,9 @@ rte_thash_gfni(const uint64_t *mtrx __rte_unused,* Number of tuples to hash. */ __rte_experimental -static inline void -rte_thash_gfni_bulk(const uint64_t *mtrx __rte_unused, - int len __rte_unused, uint8_t *tuple[] __rte_unused, -uint32_t val[],uint32_t num) -{ -unsigned int i; - -RTE_LOG (ERR ,HASH ,"%s is undefined under given arch\n" , __func__); -for (i =0 ; i < num; i++) - val[i] =0 ; -} +void +rte_thash_gfni_bulk (const uint64_t *mtrx,int len,uint8_t *tuple[], +uint32_t val[],uint32_t num);#endif /* RTE_THASH_GFNI_DEFINED */
lib/hash/version.map +4 -0
@@ -51,4 +51,8 @@ EXPERIMENTAL { rte_thash_complete_matrix; rte_thash_get_gfni_matrices; rte_thash_gfni_supported; + + # added in 22.07 + rte_thash_gfni; + rte_thash_gfni_bulk; };
Signature · 1 line
2.39.2
PATCH v12 18/22 hash: move rte_hash_set_alg out header
In reply to Stephen HemmingerThe code for setting algorithm for hash is not at all perf sensitive, and doing it inline has a couple of problems. First, it means that if multiple files include the header, then the initialization gets done multiple times. But also, it makes it harder to fix usage of RTE_LOG().
Despite what the checking script say. This is not an ABI change, the previous version inlined the same code; therefore both old and new code will work the same.
--- lib/hash/meson.build | 1 + lib/hash/rte_crc_arm64.h | 8 ++--- lib/hash/rte_crc_x86.h | 10 +++--- lib/hash/rte_hash_crc.c | 68 ++++++++++++++++++++++++++++++++++++++++ lib/hash/rte_hash_crc.h | 48 ++-------------------------- lib/hash/version.map | 7 +++++ 6 files changed, 88 insertions(+), 54 deletions(-) create mode 100644 lib/hash/rte_hash_crc.c
lib/hash/meson.build +1 -0
@@ -19,6 +19,7 @@ indirect_headers += files( sources = files( 'rte_cuckoo_hash.c', + 'rte_hash_crc.c', 'rte_fbk_hash.c', 'rte_thash.c', 'rte_thash_gfni.c'
lib/hash/rte_crc_arm64.h +4 -4
@@ -53,7 +53,7 @@ crc32c_arm64_u64(uint64_t data, uint32_t init_val)static inline uint32_t rte_hash_crc_1byte (uint8_t data,uint32_t init_val) { -if (likely (crc32_alg &CRC32_ARM64 )) +if (likely (rte_hash_crc32_alg &CRC32_ARM64 ))return crc32c_arm64_u8 (data, init_val);return crc32c_1byte (data, init_val);
@@ -67,7 +67,7 @@ rte_hash_crc_1byte(uint8_t data, uint32_t init_val)static inline uint32_t rte_hash_crc_2byte (uint16_t data,uint32_t init_val) { -if (likely (crc32_alg &CRC32_ARM64 )) +if (likely (rte_hash_crc32_alg &CRC32_ARM64 ))return crc32c_arm64_u16 (data, init_val);return crc32c_2bytes (data, init_val);
@@ -81,7 +81,7 @@ rte_hash_crc_2byte(uint16_t data, uint32_t init_val)static inline uint32_t rte_hash_crc_4byte (uint32_t data,uint32_t init_val) { -if (likely (crc32_alg &CRC32_ARM64 )) +if (likely (rte_hash_crc32_alg &CRC32_ARM64 ))return crc32c_arm64_u32 (data, init_val);return crc32c_1word (data, init_val);
@@ -95,7 +95,7 @@ rte_hash_crc_4byte(uint32_t data, uint32_t init_val)static inline uint32_t rte_hash_crc_8byte (uint64_t data,uint32_t init_val) { -if (likely (crc32_alg &CRC32_ARM64 )) +if (likely (rte_hash_crc32_alg &CRC32_ARM64 ))return crc32c_arm64_u64 (data, init_val);return crc32c_2words (data, init_val);
lib/hash/rte_crc_x86.h +5 -5
@@ -67,7 +67,7 @@ crc32c_sse42_u64(uint64_t data, uint64_t init_val)static inline uint32_t rte_hash_crc_1byte (uint8_t data,uint32_t init_val) { -if (likely (crc32_alg &CRC32_SSE42 )) +if (likely (rte_hash_crc32_alg &CRC32_SSE42 ))return crc32c_sse42_u8 (data, init_val);return crc32c_1byte (data, init_val);
@@ -81,7 +81,7 @@ rte_hash_crc_1byte(uint8_t data, uint32_t init_val)static inline uint32_t rte_hash_crc_2byte (uint16_t data,uint32_t init_val) { -if (likely (crc32_alg &CRC32_SSE42 )) +if (likely (rte_hash_crc32_alg &CRC32_SSE42 ))return crc32c_sse42_u16 (data, init_val);return crc32c_2bytes (data, init_val);
@@ -95,7 +95,7 @@ rte_hash_crc_2byte(uint16_t data, uint32_t init_val)static inline uint32_t rte_hash_crc_4byte (uint32_t data,uint32_t init_val) { -if (likely (crc32_alg &CRC32_SSE42 )) +if (likely (rte_hash_crc32_alg &CRC32_SSE42 ))return crc32c_sse42_u32 (data, init_val);return crc32c_1word (data, init_val);
@@ -110,11 +110,11 @@ static inline uint32_t rte_hash_crc_8byte(uint64_t data, uint32_t init_val) {#ifdef RTE_ARCH_X86_64 -if (likely (crc32_alg == CRC32_SSE42_x64)) +if (likely (rte_hash_crc32_alg == CRC32_SSE42_x64))return crc32c_sse42_u64 (data, init_val);#endif -if (likely (crc32_alg &CRC32_SSE42 )) +if (likely (rte_hash_crc32_alg &CRC32_SSE42 ))return crc32c_sse42_u64_mimic (data, init_val);return crc32c_2words (data, init_val);
lib/hash/rte_hash_crc.c new file +68 -0
68 lines not on this page · raw message
lib/hash/rte_hash_crc.h +3 -45
66 lines not on this page · raw message
lib/hash/version.map +7 -0
@@ -9,6 +9,7 @@ DPDK_23 { rte_hash_add_key_with_hash; rte_hash_add_key_with_hash_data; rte_hash_count; + rte_hash_crc_set_alg; rte_hash_create; rte_hash_del_key; rte_hash_del_key_with_hash;
@@ -56,3 +57,9 @@ EXPERIMENTAL { rte_thash_gfni; rte_thash_gfni_bulk; }; + +INTERNAL { + global: + + rte_hash_crc32_alg; +};
Signature · 1 line
2.39.2
PATCH v12 19/22 hash: convert RTE_LOGTYPE_HASH to dynamic type
In reply to Stephen HemmingerUse dynamic type for hash and add subtypes for crc and gfni.
--- lib/eal/common/eal_common_log.c | 1 - lib/eal/include/rte_log.h | 2 +- lib/hash/rte_cuckoo_hash.c | 5 +++++ lib/hash/rte_fbk_hash.c | 5 +++++ lib/hash/rte_thash.c | 3 +++ lib/hash/rte_thash_gfni.c | 3 +++ 6 files changed, 17 insertions(+), 2 deletions(-)
lib/eal/common/eal_common_log.c +0 -1
@@ -350,7 +350,6 @@ struct logtype {static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL ,"lib.eal" }, {RTE_LOGTYPE_PMD ,"pmd" }, - {RTE_LOGTYPE_HASH ,"lib.hash" }, {RTE_LOGTYPE_TABLE ,"lib.table" }, {RTE_LOGTYPE_PIPELINE ,"lib.pipeline" }, {RTE_LOGTYPE_CRYPTODEV ,"lib.cryptodev" },
lib/eal/include/rte_log.h +1 -1
@@ -32,7 +32,7 @@ extern "C" {/* was RTE_LOGTYPE_MEMPOOL */ /* was RTE_LOGTYPE_TIMER */ #define RTE_LOGTYPE_PMD 5/**< Log related to poll mode driver. */ -#define RTE_LOGTYPE_HASH 6/**< Log related to hash table. */ +/* was RTE_LOGTYPE_HASH */ /* was RTE_LOGTYPE_LPM */ /* was RTE_LOGTYPE_KNI */ /* was RTE_LOGTYPE_ACL */
lib/hash/rte_cuckoo_hash.c +5 -0
@@ -24,6 +24,11 @@#include <rte_tailq.h> #include "rte_hash.h" + +/* needs to be before rte_cuckoo_hash.h */ +RTE_LOG_REGISTER_DEFAULT (hash_logtype,INFO ); +#define RTE_LOGTYPE_HASH hash_logtype +#include "rte_cuckoo_hash.h" /* Mask of all flags supported by this version */
lib/hash/rte_fbk_hash.c +5 -0
@@ -8,6 +8,8 @@#include <errno.h> #include <sys/queue.h> + +#include <rte_cpuflags.h> #include <rte_eal_memconfig.h> #include <rte_malloc.h> #include <rte_common.h>
@@ -18,6 +20,9 @@#include "rte_fbk_hash.h" +RTE_LOG_REGISTER_SUFFIX (fbk_hash_logtype, fbk,INFO ); +#define RTE_LOGTYPE_HASH fbk_hash_logtype +TAILQ_HEAD (rte_fbk_hash_list, rte_tailq_entry);static struct rte_tailq_elem rte_fbk_hash_tailq = {
lib/hash/rte_thash.c +3 -0
@@ -13,6 +13,9 @@#include <rte_log.h> #include <rte_malloc.h> +RTE_LOG_REGISTER_SUFFIX (thash_logtype, thash,INFO ); +#define RTE_LOGTYPE_HASH thash_logtype +#define THASH_NAME_LEN 64#define TOEPLITZ_HASH_LEN 32
lib/hash/rte_thash_gfni.c +3 -0
@@ -10,6 +10,9 @@#ifndef RTE_THASH_GFNI_DEFINED +RTE_LOG_REGISTER_SUFFIX (hash_gfni_logtype, gfni,INFO ); +#define RTE_LOGTYPE_HASH hash_gfni_logtype +uint32_t rte_thash_gfni(const uint64_t *mtrx __rte_unused, const uint8_t *key __rte_unused, int len __rte_unused)
Signature · 1 line
2.39.2
PATCH v12 20/22 table: convert RTE_LOGTYPE_TABLE to dynamic type
In reply to Stephen HemmingerMake an alias for RTE_LOGTYPE_TABLE in rte_table.h and use it.
--- lib/eal/common/eal_common_log.c | 1 - lib/eal/include/rte_log.h | 2 +- lib/table/meson.build | 1 + lib/table/rte_table.c | 8 ++++++++ lib/table/rte_table.h | 4 ++++ 5 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 lib/table/rte_table.c
lib/eal/common/eal_common_log.c +0 -1
@@ -350,7 +350,6 @@ struct logtype {static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL ,"lib.eal" }, {RTE_LOGTYPE_PMD ,"pmd" }, - {RTE_LOGTYPE_TABLE ,"lib.table" }, {RTE_LOGTYPE_PIPELINE ,"lib.pipeline" }, {RTE_LOGTYPE_CRYPTODEV ,"lib.cryptodev" }, {RTE_LOGTYPE_EVENTDEV ,"lib.eventdev" },
lib/eal/include/rte_log.h +1 -1
@@ -40,7 +40,7 @@ extern "C" {/* was RTE_LOGTYPE_METER */ /* was RTE_LOGTYPE_SCHED */ /* was RTE_LOGTYPE_PORT */ -#define RTE_LOGTYPE_TABLE 14/**< Log related to table. */ +/* was RTE_LOGTYPE_TABLE */ #define RTE_LOGTYPE_PIPELINE 15/**< Log related to pipeline. */ /* was RTE_LOGTYPE_MBUF */ #define RTE_LOGTYPE_CRYPTODEV 17/**< Log related to cryptodev. */
lib/table/meson.build +1 -0
@@ -7,6 +7,7 @@ sources = files( 'rte_swx_table_learner.c', 'rte_swx_table_selector.c', 'rte_swx_table_wm.c', + 'rte_table.c', 'rte_table_acl.c', 'rte_table_array.c', 'rte_table_hash_cuckoo.c',
lib/table/rte_table.c new file +8 -0
@@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2010-2014 Intel Corporation +*/ + +#include <rte_log.h> +#include <rte_table.h> + +RTE_LOG_REGISTER_DEFAULT (table_logtype,INFO );
lib/table/rte_table.h +4 -0
@@ -265,6 +265,10 @@ struct rte_table_ops {rte_table_op_stats_read f_stats;/**< Stats */ }; +/** Internal Logtype used */ +extern int table_logtype; +#define RTE_LOGTYPE_TABLE table_logtype + #ifdef __cplusplus }#endif
Signature · 1 line
2.39.2
PATCH v12 21/22 app/test: remove use of RTE_LOGTYPE_PIPELINE
In reply to Stephen HemmingerInstead of using static type PIPELINE for logging in test application use stderr instead. If not testing RTE_LOG() better to not use it since log also goes to syslog.
--- app/test/test_table_acl.c | 50 ++++++++++++++++------------------ app/test/test_table_pipeline.c | 40 +++++++++++++-------------- 2 files changed, 43 insertions(+), 47 deletions(-)
app/test/test_table_acl.c +23 -27
@@ -165,7 +165,7 @@ parse_cb_ipv4_rule(char *str, struct rte_table_acl_rule_add_params *v) &v->field_value[SRC_FIELD_IPV4 ].value.u32, &v->field_value[SRC_FIELD_IPV4].mask_range.u32);if (rc !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"failed to read src address/mask: %s\n" , +fprintf (stderr,"failed to read src address/mask: %s\n" , in[CB_FLD_SRC_ADDR ]);return rc; }
@@ -178,7 +178,7 @@ parse_cb_ipv4_rule(char *str, struct rte_table_acl_rule_add_params *v) &v->field_value[DST_FIELD_IPV4 ].value.u32, &v->field_value[DST_FIELD_IPV4].mask_range.u32);if (rc !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"failed to read dest address/mask: %s\n" , +fprintf (stderr,"failed to read dest address/mask: %s\n" , in[CB_FLD_DST_ADDR ]);return rc; }
@@ -190,7 +190,7 @@ parse_cb_ipv4_rule(char *str, struct rte_table_acl_rule_add_params *v) &v->field_value[SRCP_FIELD_IPV4 ].value.u16, &v->field_value[SRCP_FIELD_IPV4].mask_range.u16);if (rc !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"failed to read source port range: %s\n" , +fprintf (stderr,"failed to read source port range: %s\n" , in[CB_FLD_SRC_PORT_RANGE ]);return rc; }
@@ -202,7 +202,7 @@ parse_cb_ipv4_rule(char *str, struct rte_table_acl_rule_add_params *v) &v->field_value[DSTP_FIELD_IPV4 ].value.u16, &v->field_value[DSTP_FIELD_IPV4].mask_range.u16);if (rc !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"failed to read dest port range: %s\n" , +fprintf (stderr,"failed to read dest port range: %s\n" , in[CB_FLD_DST_PORT_RANGE ]);return rc; }
@@ -254,7 +254,7 @@ parse_cb_ipv4_rule_del(char *str, struct rte_table_acl_rule_delete_params *v) &v->field_value[SRC_FIELD_IPV4 ].value.u32, &v->field_value[SRC_FIELD_IPV4].mask_range.u32);if (rc !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"failed to read src address/mask: %s\n" , +fprintf (stderr,"failed to read src address/mask: %s\n" , in[CB_FLD_SRC_ADDR ]);return rc; }
@@ -267,7 +267,7 @@ parse_cb_ipv4_rule_del(char *str, struct rte_table_acl_rule_delete_params *v) &v->field_value[DST_FIELD_IPV4 ].value.u32, &v->field_value[DST_FIELD_IPV4].mask_range.u32);if (rc !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"failed to read dest address/mask: %s\n" , +fprintf (stderr,"failed to read dest address/mask: %s\n" , in[CB_FLD_DST_ADDR ]);return rc; }
@@ -279,7 +279,7 @@ parse_cb_ipv4_rule_del(char *str, struct rte_table_acl_rule_delete_params *v) &v->field_value[SRCP_FIELD_IPV4 ].value.u16, &v->field_value[SRCP_FIELD_IPV4].mask_range.u16);if (rc !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"failed to read source port range: %s\n" , +fprintf (stderr,"failed to read source port range: %s\n" , in[CB_FLD_SRC_PORT_RANGE ]);return rc; }
@@ -291,7 +291,7 @@ parse_cb_ipv4_rule_del(char *str, struct rte_table_acl_rule_delete_params *v) &v->field_value[DSTP_FIELD_IPV4 ].value.u16, &v->field_value[DSTP_FIELD_IPV4].mask_range.u16);if (rc !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"failed to read dest port range: %s\n" , +fprintf (stderr,"failed to read dest port range: %s\n" , in[CB_FLD_DST_PORT_RANGE ]);return rc; }
@@ -346,7 +346,7 @@ setup_acl_pipeline(void)/* Pipeline configuration */ p =rte_pipeline_create (&pipeline_params);if (p ==NULL ) { -RTE_LOG (INFO ,PIPELINE ,"%s: Failed to configure pipeline\n" , +fprintf (stderr,"%s: Failed to configure pipeline\n" , __func__); goto fail; }
@@ -410,7 +410,7 @@ setup_acl_pipeline(void) table_params.f_action_miss =NULL ; table_params.action_data_size =0 ; -RTE_LOG (INFO ,PIPELINE ,"miss_action=%x\n" , +printf ("miss_action=%x\n" , table_entry_miss_action); printf("RTE_ACL_RULE_SZ(%zu) = %zu\n", DIM(ipv4_defs),
@@ -471,9 +471,8 @@ setup_acl_pipeline(void) ret =parser (line, &keys[n]);if (ret !=0 ) { -RTE_LOG (ERR ,PIPELINE , -"line %u: parse_cb_ipv4vlan_rule" -" failed, error code: %d (%s)\n" , +fprintf (stderr, +"line %u: parse_cb_ipv4vlan_rule failed, error code: %d (%s)\n" , n, ret,strerror (-ret));return ret; }
@@ -513,9 +512,8 @@ setup_acl_pipeline(void) ret =parse_cb_ipv4_rule_del (line, &keys[n]);if (ret !=0 ) { -RTE_LOG (ERR ,PIPELINE , -"line %u: parse_cb_ipv4vlan_rule" -" failed, error code: %d (%s)\n" , +fprintf (stderr, +"line %u: parse_cb_ipv4vlan_rule failed, error code: %d (%s)\n" , n, ret,strerror (-ret));return ret; }
@@ -549,9 +547,8 @@ setup_acl_pipeline(void) ret =parser (line, &rule_params);if (ret !=0 ) { -RTE_LOG (ERR ,PIPELINE , -"line %u: parse_cb_ipv4vlan_rule" -" failed, error code: %d (%s)\n" , +fprintf (stderr, +"line %u: parse_cb_ipv4vlan_rule failed, error code: %d (%s)\n" , n, ret,strerror (-ret));return ret; }
@@ -575,8 +572,8 @@ setup_acl_pipeline(void) ret =parser (line, &rule_params);if (ret !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"line %u: parse rule " -" failed, error code: %d (%s)\n" , +fprintf (stderr, +"line %u: parse rule failed, error code: %d (%s)\n" , n, ret,strerror (-ret));return ret; }
@@ -602,8 +599,8 @@ setup_acl_pipeline(void) ret =parser (line, &rule_params);if (ret !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"line %u: parse rule" -" failed, error code: %d (%s)\n" , +fprintf (stderr, +"line %u: parse rule failed, error code: %d (%s)\n" , n, ret,strerror (-ret));return ret; }
@@ -667,7 +664,7 @@ test_pipeline_single_filter(int expected_count) memcpy(rte_pktmbuf_mtod(mbuf, char *), &five_tuple, sizeof(struct ipv4_5tuple)); -RTE_LOG (INFO ,PIPELINE ,"%s: Enqueue onto ring %d\n" , +printf ("%s: Enqueue onto ring %d\n" , __func__, i);rte_ring_enqueue (rings_rx[i], mbuf); }
@@ -702,9 +699,8 @@ test_pipeline_single_filter(int expected_count) }if (tx_count != expected_count) { -RTE_LOG (INFO ,PIPELINE , -"%s: Unexpected packets for ACL test, " -"expected %d, got %d\n" , +fprintf (stderr, +"%s: Unexpected packets for ACL test, expected %d, got %d\n" , __func__, expected_count, tx_count); goto fail; }
app/test/test_table_pipeline.c +20 -20
@@ -6,7 +6,6 @@#include <string.h> #include <rte_pipeline.h> -#include <rte_log.h> #include <inttypes.h> #include <rte_hexdump.h> #include "test_table.h"
@@ -173,30 +172,31 @@ check_pipeline_invalid_params(void) p =rte_pipeline_create (NULL );if (p !=NULL ) { -RTE_LOG (INFO ,PIPELINE , +fprintf (stderr,"%s: configured pipeline with null params\n" , __func__); goto fail; } p =rte_pipeline_create (&pipeline_params_1);if (p !=NULL ) { -RTE_LOG (INFO ,PIPELINE ,"%s: Configure pipeline with NULL " -"name\n" , __func__); +fprintf (stderr, +"%s: Configure pipeline with NULL name\n" , __func__); goto fail; } p =rte_pipeline_create (&pipeline_params_2);if (p !=NULL ) { -RTE_LOG (INFO ,PIPELINE ,"%s: Configure pipeline with invalid " -"socket\n" , __func__); +fprintf (stderr, +"%s: Configure pipeline with invalid socket\n" , __func__); goto fail; }if (rte_eal_has_hugepages ()) { p =rte_pipeline_create (&pipeline_params_3);if (p !=NULL ) { -RTE_LOG (INFO ,PIPELINE ,"%s: Configure pipeline with " -"invalid socket\n" , __func__); +fprintf (stderr, +"%s: Configure pipeline with invalid socket\n" , + __func__); goto fail; } }
@@ -224,20 +224,20 @@ setup_pipeline(int test_type) .socket_id = 0, }; -RTE_LOG (INFO ,PIPELINE ,"%s: **** Setting up %s test\n" , +fprintf (stderr,"%s: **** Setting up %s test\n" , __func__, pipeline_test_names[test_type]);/* Pipeline configuration */ p =rte_pipeline_create (&pipeline_params);if (p ==NULL ) { -RTE_LOG (INFO ,PIPELINE ,"%s: Failed to configure pipeline\n" , +fprintf (stderr,"%s: Failed to configure pipeline\n" , __func__); goto fail; } ret =rte_pipeline_free (p);if (ret !=0 ) { -RTE_LOG (INFO ,PIPELINE ,"%s: Failed to free pipeline\n" , +fprintf (stderr,"%s: Failed to free pipeline\n" , __func__); goto fail; }
@@ -245,7 +245,7 @@ setup_pipeline(int test_type)/* Pipeline configuration */ p =rte_pipeline_create (&pipeline_params);if (p ==NULL ) { -RTE_LOG (INFO ,PIPELINE ,"%s: Failed to configure pipeline\n" , +fprintf (stderr,"%s: Failed to configure pipeline\n" , __func__); goto fail; }
@@ -411,7 +411,7 @@ test_pipeline_single_filter(int test_type, int expected_count)int ret;int tx_count; -RTE_LOG (INFO ,PIPELINE ,"%s: **** Running %s test\n" , +fprintf (stderr,"%s: **** Running %s test\n" , __func__, pipeline_test_names[test_type]);/* Run pipeline once */ for (i =0 ; i <N_PORTS ; i++)
@@ -420,7 +420,7 @@ test_pipeline_single_filter(int test_type, int expected_count) ret =rte_pipeline_flush (NULL );if (ret != -EINVAL ) { -RTE_LOG (INFO ,PIPELINE , +fprintf (stderr,"%s: No pipeline flush error NULL pipeline (%d)\n" , __func__, ret); goto fail;
@@ -445,7 +445,7 @@ test_pipeline_single_filter(int test_type, int expected_count) k32 = (uint32_t *) key; k32[0 ] =0xadadadad >> (j %2 ); -RTE_LOG (INFO ,PIPELINE ,"%s: Enqueue onto ring %d\n" , +fprintf (stderr,"%s: Enqueue onto ring %d\n" , __func__, i);rte_ring_enqueue (rings_rx[i], m); }
@@ -487,9 +487,9 @@ test_pipeline_single_filter(int test_type, int expected_count) }if (tx_count != expected_count) { -RTE_LOG (INFO ,PIPELINE , -"%s: Unexpected packets out for %s test, expected %d, " -"got %d\n" , __func__, pipeline_test_names[test_type], +fprintf (stderr, +"%s: Unexpected packets out for %s test, expected %d, got %d\n" , + __func__, pipeline_test_names[test_type], expected_count, tx_count); goto fail; }
@@ -564,8 +564,8 @@ test_table_pipeline(void) connect_miss_action_to_table =0 ;if (check_pipeline_invalid_params ()) { -RTE_LOG (INFO ,PIPELINE ,"%s: Check pipeline invalid params " -"failed.\n" , __func__); +fprintf (stderr,"%s: Check pipeline invalid params failed.\n" , + __func__);return -1 ; }
Signature · 1 line
2.39.2
PATCH v12 22/22 pipeline: convert RTE_LOGTYPE_PIPELINE to dynamic type
In reply to Stephen HemmingerConvert RTE_LOGTYPE_PIPELINE to a dynamic value.
--- lib/eal/common/eal_common_log.c | 1 - lib/eal/include/rte_log.h | 2 +- lib/pipeline/rte_pipeline.c | 2 ++ lib/pipeline/rte_pipeline.h | 5 +++++ 4 files changed, 8 insertions(+), 2 deletions(-)
lib/eal/common/eal_common_log.c +0 -1
@@ -350,7 +350,6 @@ struct logtype {static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL ,"lib.eal" }, {RTE_LOGTYPE_PMD ,"pmd" }, - {RTE_LOGTYPE_PIPELINE ,"lib.pipeline" }, {RTE_LOGTYPE_CRYPTODEV ,"lib.cryptodev" }, {RTE_LOGTYPE_EVENTDEV ,"lib.eventdev" }, {RTE_LOGTYPE_USER1 ,"user1" },
lib/eal/include/rte_log.h +1 -1
@@ -41,7 +41,7 @@ extern "C" {/* was RTE_LOGTYPE_SCHED */ /* was RTE_LOGTYPE_PORT */ /* was RTE_LOGTYPE_TABLE */ -#define RTE_LOGTYPE_PIPELINE 15/**< Log related to pipeline. */ +/* was RTE_LOGTYPE_PIPELINE */ /* was RTE_LOGTYPE_MBUF */ #define RTE_LOGTYPE_CRYPTODEV 17/**< Log related to cryptodev. */ /* was RTE_LOGTYPE_EFD */
lib/pipeline/rte_pipeline.c +2 -0
@@ -1612,3 +1612,5 @@ int rte_pipeline_table_stats_read(struct rte_pipeline *p, uint32_t table_id,return 0 ; } + +RTE_LOG_REGISTER_DEFAULT (pipeline_logtype,INFO );
lib/pipeline/rte_pipeline.h +5 -0
@@ -841,6 +841,11 @@ int rte_pipeline_ah_packet_hijack(struct rte_pipeline *p,int rte_pipeline_ah_packet_drop (struct rte_pipeline *p,uint64_t pkts_mask); + +/** Internal Logtype used */ +extern int pipeline_logtype; +#define RTE_LOGTYPE_PIPELINE pipeline_logtype + #ifdef __cplusplus }#endif
Signature · 1 line
2.39.2
v13 cover Convert static log types in libraries to dynamic types
In reply to Stephen HemmingerThis patchset removes most of the uses of static LOGTYPE's in DPDK libraries. It starts with the easy one and goes on to the more complex ones.
There are several options on how to treat the old static types:
leave them there, mark as deprecated, or remove them. This version removes them since there is no guarantee in current DPDK policies that says they can't be removed.
Note: there is one patch in this series that will get flagged incorrectly as an ABI change.
v13 - rebase because log now moved.
v12 - rebase and add table and pipeline libraries
v11 - fix include check on arm cross build
v10 - add necessary rte_compat.h in thash_gfni stub for arm
v9 - fix handling of crc32 alg in lib/hash.
make it an internal global variable.
fix gfni stubs for case where they are not used.
Stephen Hemminger (21):
gso: don't log message on non TCP/UDP
eal: drop no longer used GSO logtype
log: drop unused RTE_LOGTYPE_TIMER
efd: convert RTE_LOGTYPE_EFD to dynamic type
mbuf: convert RTE_LOGTYPE_MBUF to dynamic type
acl: convert RTE_LOGTYPE_ACL to dynamic type examples/power: replace use of RTE_LOGTYPE_POWER examples/l3fwd-power: replace use of RTE_LOGTYPE_POWER
power: convert RTE_LOGTYPE_POWER to dynamic type
ring: convert RTE_LOGTYPE_RING to dynamic type
mempool: convert RTE_LOGTYPE_MEMPOOL to dynamic type
lpm: convert RTE_LOGTYPE_LPM to dynamic types
sched: convert RTE_LOGTYPE_SCHED to dynamic type examples/ipsec-secgw: replace RTE_LOGTYPE_PORT
port: convert RTE_LOGTYPE_PORT to dynamic type
hash: move rte_thash_gfni stubs out of header file
hash: move rte_hash_set_alg out header
hash: convert RTE_LOGTYPE_HASH to dynamic type
table: convert RTE_LOGTYPE_TABLE to dynamic type app/test: remove use of RTE_LOGTYPE_PIPELINE
pipeline: convert RTE_LOGTYPE_PIPELINE to dynamic type
app/test/test_acl.c | 2 +- app/test/test_table_acl.c | 50 +++++++++++------------- app/test/test_table_pipeline.c | 40 +++++++++---------- examples/distributor/main.c | 2 +- examples/ipsec-secgw/sa.c | 6 +-- examples/l3fwd-power/main.c | 17 +++++---- lib/acl/acl.h | 1 + lib/acl/acl_bld.c | 3 ++ lib/acl/acl_gen.c | 1 + lib/acl/acl_log.h | 6 +++ lib/acl/rte_acl.c | 3 ++ lib/acl/tb_mem.c | 3 +- lib/efd/rte_efd.c | 4 ++ lib/fib/fib_log.h | 4 ++ lib/fib/rte_fib.c | 3 ++ lib/fib/rte_fib6.c | 2 + lib/gso/rte_gso.c | 4 +- lib/gso/rte_gso.h | 1 + lib/hash/meson.build | 9 ++++- lib/hash/rte_crc_arm64.h | 8 ++-- lib/hash/rte_crc_x86.h | 10 ++--- lib/hash/rte_cuckoo_hash.c | 5 +++ lib/hash/rte_fbk_hash.c | 5 +++ lib/hash/rte_hash_crc.c | 68 +++++++++++++++++++++++++++++++++ lib/hash/rte_hash_crc.h | 48 ++--------------------- lib/hash/rte_thash.c | 3 ++ lib/hash/rte_thash_gfni.c | 50 ++++++++++++++++++++++++ lib/hash/rte_thash_gfni.h | 30 +++++---------- lib/hash/version.map | 11 ++++++ lib/log/log.c | 16 -------- lib/log/rte_log.h | 32 ++++++++-------- lib/lpm/lpm_log.h | 4 ++ lib/lpm/rte_lpm.c | 3 ++ lib/lpm/rte_lpm6.c | 1 + lib/mbuf/mbuf_log.h | 4 ++ lib/mbuf/rte_mbuf.c | 4 ++ lib/mbuf/rte_mbuf_dyn.c | 2 + lib/mbuf/rte_mbuf_pool_ops.c | 2 + lib/mempool/rte_mempool.c | 2 + lib/mempool/rte_mempool.h | 8 ++++ lib/mempool/version.map | 3 ++ lib/pipeline/rte_pipeline.c | 2 + lib/pipeline/rte_pipeline.h | 5 +++ lib/port/rte_port_ethdev.c | 3 ++ lib/port/rte_port_eventdev.c | 4 ++ lib/port/rte_port_fd.c | 3 ++ lib/port/rte_port_frag.c | 3 ++ lib/port/rte_port_ras.c | 3 ++ lib/port/rte_port_ring.c | 3 ++ lib/port/rte_port_sched.c | 3 ++ lib/port/rte_port_source_sink.c | 3 ++ lib/port/rte_port_sym_crypto.c | 3 ++ lib/power/guest_channel.c | 3 +- lib/power/power_common.c | 2 + lib/power/power_common.h | 2 + lib/power/power_kvm_vm.c | 1 + lib/power/rte_power.c | 1 + lib/rib/rib_log.h | 4 ++ lib/rib/rte_rib.c | 3 ++ lib/rib/rte_rib6.c | 3 ++ lib/ring/rte_ring.c | 3 ++ lib/sched/rte_pie.c | 1 + lib/sched/rte_sched.c | 5 +++ lib/sched/rte_sched_log.h | 4 ++ lib/table/meson.build | 1 + lib/table/rte_table.c | 8 ++++ lib/table/rte_table.h | 4 ++ 67 files changed, 387 insertions(+), 173 deletions(-) create mode 100644 lib/acl/acl_log.h create mode 100644 lib/fib/fib_log.h create mode 100644 lib/hash/rte_hash_crc.c create mode 100644 lib/hash/rte_thash_gfni.c create mode 100644 lib/lpm/lpm_log.h create mode 100644 lib/mbuf/mbuf_log.h create mode 100644 lib/rib/rib_log.h create mode 100644 lib/sched/rte_sched_log.h create mode 100644 lib/table/rte_table.c
Signature · 1 line
2.39.2
PATCH v13 1/21 gso: don't log message on non TCP/UDP
If a large packet is passed into GSO routines of unknown protocol then library would log a message.
Better to tell the application instead of logging.
--- lib/gso/rte_gso.c | 4 +--- lib/gso/rte_gso.h | 1 + 2 files changed, 2 insertions(+), 3 deletions(-)
lib/gso/rte_gso.c +1 -3
@@ -80,9 +80,7 @@ rte_gso_segment(struct rte_mbuf *pkt, ret =gso_udp4_segment (pkt, gso_size, direct_pool, indirect_pool, pkts_out, nb_pkts_out); }else { -/* unsupported packet, skip */ -RTE_LOG (DEBUG ,GSO ,"Unsupported packet type\n" ); - ret =0 ; + ret = -ENOTSUP ;/* only UDP or TCP allowed */ }if (ret <0 ) {
lib/gso/rte_gso.h +1 -0
@@ -114,6 +114,7 @@ struct rte_gso_ctx {* - The number of GSO segments filled in pkts_out on success. * - Return 0 if it does not need to be GSO'd. * - Return -ENOMEM if run out of memory in MBUF pools. +* - Return -ENOTSUP for protocols that can not be segmented * - Return -EINVAL for invalid parameters. */ int rte_gso_segment(struct rte_mbuf *pkt,
Signature · 1 line
2.39.2
PATCH v13 2/21 eal: drop no longer used GSO logtype
In reply to Stephen HemmingerThe message that used this was replaced in previous patch.
--- lib/log/log.c | 1 - lib/log/rte_log.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
lib/log/log.c +0 -1
@@ -370,7 +370,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_CRYPTODEV, "lib.cryptodev"}, {RTE_LOGTYPE_EFD, "lib.efd"}, {RTE_LOGTYPE_EVENTDEV, "lib.eventdev"}, - {RTE_LOGTYPE_GSO, "lib.gso"}, {RTE_LOGTYPE_USER1, "user1"}, {RTE_LOGTYPE_USER2, "user2"}, {RTE_LOGTYPE_USER3, "user3"},
lib/log/rte_log.h +1 -1
@@ -46,7 +46,7 @@ extern "C" {#define RTE_LOGTYPE_CRYPTODEV 17/**< Log related to cryptodev. */ #define RTE_LOGTYPE_EFD 18/**< Log related to EFD. */ #define RTE_LOGTYPE_EVENTDEV 19/**< Log related to eventdev. */ -#define RTE_LOGTYPE_GSO 20/**< Log related to GSO. */ +/* was RTE_LOGTYPE_GSO */ /* these log types can be used in an application */ #define RTE_LOGTYPE_USER1 24/**< User-defined log type 1. */
Signature · 1 line
2.39.2
PATCH v13 3/21 log: drop unused RTE_LOGTYPE_TIMER
In reply to Stephen HemmingerThe timer code does not use rte_log.
--- lib/log/log.c | 1 - lib/log/rte_log.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
lib/log/log.c +0 -1
@@ -355,7 +355,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_MALLOC, "lib.malloc"}, {RTE_LOGTYPE_RING, "lib.ring"}, {RTE_LOGTYPE_MEMPOOL, "lib.mempool"}, - {RTE_LOGTYPE_TIMER, "lib.timer"}, {RTE_LOGTYPE_PMD, "pmd"}, {RTE_LOGTYPE_HASH, "lib.hash"}, {RTE_LOGTYPE_LPM, "lib.lpm"},
lib/log/rte_log.h +1 -1
@@ -30,7 +30,7 @@ extern "C" {#define RTE_LOGTYPE_MALLOC 1/**< Log related to malloc. */ #define RTE_LOGTYPE_RING 2/**< Log related to ring. */ #define RTE_LOGTYPE_MEMPOOL 3/**< Log related to mempool. */ -#define RTE_LOGTYPE_TIMER 4/**< Log related to timers. */ +/* was RTE_LOGTYPE_TIMER */ #define RTE_LOGTYPE_PMD 5/**< Log related to poll mode driver. */ #define RTE_LOGTYPE_HASH 6/**< Log related to hash table. */ #define RTE_LOGTYPE_LPM 7/**< Log related to LPM. */
Signature · 1 line
2.39.2
PATCH v13 4/21 efd: convert RTE_LOGTYPE_EFD to dynamic type
In reply to Stephen HemmingerReplace all uses of the global logtype with a dynamic log type.
--- lib/efd/rte_efd.c | 4 ++++ lib/log/log.c | 1 - lib/log/rte_log.h | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-)
lib/efd/rte_efd.c +4 -0
@@ -9,6 +9,7 @@#include <errno.h> #include <sys/queue.h> +#include <rte_cpuflags.h> #include <rte_string_fns.h> #include <rte_log.h> #include <rte_eal_memconfig.h>
@@ -28,6 +29,9 @@#include "rte_efd_arm64.h" #endif +RTE_LOG_REGISTER_DEFAULT (efd_logtype,INFO ); +#define RTE_LOGTYPE_EFD efd_logtype +#define EFD_KEY (key_idx, table) (table->keys + ((key_idx) * table->key_len))/** Hash function used to determine chunk_id and bin_id for a group */ #define EFD_HASH (key, table) \
lib/log/log.c +0 -1
@@ -367,7 +367,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_PIPELINE, "lib.pipeline"}, {RTE_LOGTYPE_MBUF, "lib.mbuf"}, {RTE_LOGTYPE_CRYPTODEV, "lib.cryptodev"}, - {RTE_LOGTYPE_EFD, "lib.efd"}, {RTE_LOGTYPE_EVENTDEV, "lib.eventdev"}, {RTE_LOGTYPE_USER1, "user1"}, {RTE_LOGTYPE_USER2, "user2"},
lib/log/rte_log.h +1 -1
@@ -44,7 +44,7 @@ extern "C" {#define RTE_LOGTYPE_PIPELINE 15/**< Log related to pipeline. */ #define RTE_LOGTYPE_MBUF 16/**< Log related to mbuf. */ #define RTE_LOGTYPE_CRYPTODEV 17/**< Log related to cryptodev. */ -#define RTE_LOGTYPE_EFD 18/**< Log related to EFD. */ +/* was RTE_LOGTYPE_EFD */ #define RTE_LOGTYPE_EVENTDEV 19/**< Log related to eventdev. */ /* was RTE_LOGTYPE_GSO */
Signature · 1 line
2.39.2
PATCH v13 5/21 mbuf: convert RTE_LOGTYPE_MBUF to dynamic type
In reply to Stephen HemmingerIntroduce a new dynamic logtype for mbuf related messages. Since this is used in multiple files put one macro in mbuf_log.h
--- lib/log/log.c | 1 - lib/log/rte_log.h | 2 +- lib/mbuf/mbuf_log.h | 4 ++++ lib/mbuf/rte_mbuf.c | 4 ++++ lib/mbuf/rte_mbuf_dyn.c | 2 ++ lib/mbuf/rte_mbuf_pool_ops.c | 2 ++ 6 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 lib/mbuf/mbuf_log.h
lib/log/log.c +0 -1
@@ -365,7 +365,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_PORT, "lib.port"}, {RTE_LOGTYPE_TABLE, "lib.table"}, {RTE_LOGTYPE_PIPELINE, "lib.pipeline"}, - {RTE_LOGTYPE_MBUF, "lib.mbuf"}, {RTE_LOGTYPE_CRYPTODEV, "lib.cryptodev"}, {RTE_LOGTYPE_EVENTDEV, "lib.eventdev"}, {RTE_LOGTYPE_USER1, "user1"},
lib/log/rte_log.h +1 -1
@@ -42,7 +42,7 @@ extern "C" {#define RTE_LOGTYPE_PORT 13/**< Log related to port. */ #define RTE_LOGTYPE_TABLE 14/**< Log related to table. */ #define RTE_LOGTYPE_PIPELINE 15/**< Log related to pipeline. */ -#define RTE_LOGTYPE_MBUF 16/**< Log related to mbuf. */ +/* was RTE_LOGTYPE_MBUF */ #define RTE_LOGTYPE_CRYPTODEV 17/**< Log related to cryptodev. */ /* was RTE_LOGTYPE_EFD */ #define RTE_LOGTYPE_EVENTDEV 19/**< Log related to eventdev. */
lib/mbuf/mbuf_log.h new file +4 -0
@@ -0,0 +1,4 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ + +extern int mbuf_logtype; +#define RTE_LOGTYPE_MBUF mbuf_logtype
lib/mbuf/rte_mbuf.c +4 -0
@@ -20,6 +20,10 @@#include <rte_errno.h> #include <rte_memcpy.h> +#include "mbuf_log.h" + +RTE_LOG_REGISTER_DEFAULT (mbuf_logtype,INFO ); +/* * pktmbuf pool constructor, given as a callback function to * rte_mempool_create(), or called directly if using
lib/mbuf/rte_mbuf_dyn.c +2 -0
@@ -17,6 +17,8 @@#include <rte_mbuf.h> #include <rte_mbuf_dyn.h> +#include "mbuf_log.h" +#define RTE_MBUF_DYN_MZNAME "rte_mbuf_dyn"struct mbuf_dynfield_elt {
lib/mbuf/rte_mbuf_pool_ops.c +2 -0
@@ -8,6 +8,8 @@#include <rte_errno.h> #include <rte_mbuf_pool_ops.h> +#include "mbuf_log.h" +int rte_mbuf_set_platform_mempool_ops (const char *ops_name) {
Signature · 1 line
2.39.2
PATCH v13 6/21 acl: convert RTE_LOGTYPE_ACL to dynamic type
In reply to Stephen HemmingerGet rid of RTE_LOGTYPE_ACL and RTE_LOGTYPE_MALLOC. For ACL library use a dynamic type.
The one message using RTE_LOGTYPE_MALLOC should have been under the ACL logtype anyway.
The test code should not have been using fixed log type so just change that to stderr.
--- app/test/test_acl.c | 2 +- lib/acl/acl.h | 1 + lib/acl/acl_bld.c | 3 +++ lib/acl/acl_gen.c | 1 + lib/acl/acl_log.h | 6 ++++++ lib/acl/rte_acl.c | 3 +++ lib/acl/tb_mem.c | 3 ++- lib/log/log.c | 2 -- lib/log/rte_log.h | 4 ++-- 9 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 lib/acl/acl_log.h
app/test/test_acl.c +1 -1
@@ -154,7 +154,7 @@ rte_acl_ipv4vlan_add_rules(struct rte_acl_ctx *ctx,for (i =0 ; i != num; i++) { rc =acl_ipv4vlan_check_rule (rules + i);if (rc !=0 ) { -RTE_LOG (ERR ,ACL ,"%s: rule #%u is invalid\n" , +fprintf (stderr,"%s: rule #%u is invalid\n" , __func__, i +1 );return rc; }
lib/acl/acl.h +1 -0
@@ -225,6 +225,7 @@ int rte_acl_classify_altivec(const struct rte_acl_ctx *ctx, const uint8_t **data, uint32_t *results, uint32_t num, uint32_t categories); + #ifdef __cplusplus }#endif /* __cplusplus */
lib/acl/acl_bld.c +3 -0
@@ -3,8 +3,11 @@*/ #include <rte_acl.h> +#include <rte_log.h> +#include "tb_mem.h" #include "acl.h" +#include "acl_log.h" #define ACL_POOL_ALIGN 8#define ACL_POOL_ALLOC_MIN 0x800000
lib/acl/acl_gen.c +1 -0
@@ -4,6 +4,7 @@#include <rte_acl.h> #include "acl.h" +#include "acl_log.h" #define QRANGE_MIN ((uint8_t)INT8_MIN)
lib/acl/acl_log.h new file +6 -0
@@ -0,0 +1,6 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ + +#include <rte_log.h> + +extern int acl_logtype; +#define RTE_LOGTYPE_ACL acl_logtype
lib/acl/rte_acl.c +3 -0
@@ -8,6 +8,9 @@#include <rte_tailq.h> #include "acl.h" +#include "acl_log.h" + +RTE_LOG_REGISTER_DEFAULT (acl_logtype,INFO );TAILQ_HEAD (rte_acl_list, rte_tailq_entry);
lib/acl/tb_mem.c +2 -1
@@ -3,6 +3,7 @@*/ #include "tb_mem.h" +#include "acl_log.h" /* * Memory management routines for temporary memory.
@@ -25,7 +26,7 @@ tb_pool(struct tb_mem_pool *pool, size_t sz) size = sz + pool->alignment -1 ; block =calloc (1 , size +sizeof (*pool->block));if (block ==NULL ) { -RTE_LOG (ERR ,MALLOC ,"%s(%zu)\n failed, currently allocated " +RTE_LOG (ERR ,ACL ,"%s(%zu)\n failed, currently allocated " "by pool: %zu bytes\n" , __func__, sz, pool->alloc);siglongjmp (pool->fail, -ENOMEM );return NULL ;
lib/log/log.c +0 -2
@@ -352,13 +352,11 @@ struct logtype {static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL ,"lib.eal" }, - {RTE_LOGTYPE_MALLOC ,"lib.malloc" }, {RTE_LOGTYPE_RING ,"lib.ring" }, {RTE_LOGTYPE_MEMPOOL ,"lib.mempool" }, {RTE_LOGTYPE_PMD ,"pmd" }, {RTE_LOGTYPE_HASH ,"lib.hash" }, {RTE_LOGTYPE_LPM ,"lib.lpm" }, - {RTE_LOGTYPE_ACL ,"lib.acl" }, {RTE_LOGTYPE_POWER ,"lib.power" }, {RTE_LOGTYPE_METER ,"lib.meter" }, {RTE_LOGTYPE_SCHED ,"lib.sched" },
lib/log/rte_log.h +2 -2
@@ -27,7 +27,7 @@ extern "C" {/* SDK log type */ #define RTE_LOGTYPE_EAL 0/**< Log related to eal. */ -#define RTE_LOGTYPE_MALLOC 1/**< Log related to malloc. */ +/* was RTE_LOGTYPE_MALLOC */ #define RTE_LOGTYPE_RING 2/**< Log related to ring. */ #define RTE_LOGTYPE_MEMPOOL 3/**< Log related to mempool. */ /* was RTE_LOGTYPE_TIMER */
@@ -35,7 +35,7 @@ extern "C" {#define RTE_LOGTYPE_HASH 6/**< Log related to hash table. */ #define RTE_LOGTYPE_LPM 7/**< Log related to LPM. */ /* was RTE_LOGTYPE_KNI */ -#define RTE_LOGTYPE_ACL 9/**< Log related to ACL. */ +/* was RTE_LOGTYPE_ACL */ #define RTE_LOGTYPE_POWER 10/**< Log related to power. */ #define RTE_LOGTYPE_METER 11/**< Log related to QoS meter. */ #define RTE_LOGTYPE_SCHED 12/**< Log related to QoS port scheduler. */
Signature · 1 line
2.39.2
PATCH v13 7/21 examples/power: replace use of RTE_LOGTYPE_POWER
In reply to Stephen HemmingerDon't use static logtype in sample application.
--- examples/distributor/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
examples/distributor/main.c +1 -1
@@ -679,7 +679,7 @@ init_power_library(void)/* init power management library */ ret =rte_power_init (lcore_id);if (ret) { -RTE_LOG (ERR ,POWER , +fprintf (stderr,"Library initialization failed on core %u\n" , lcore_id);/*
Signature · 1 line
2.39.2
PATCH v13 8/21 examples/l3fwd-power: replace use of RTE_LOGTYPE_POWER
In reply to Stephen HemmingerConvert to using a dynamic logtype for the application.
--- examples/l3fwd-power/main.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
examples/l3fwd-power/main.c +9 -8
@@ -51,7 +51,8 @@#include "perf_core.h" #include "main.h" -#define RTE_LOGTYPE_L3FWD_POWER RTE_LOGTYPE_USER1 +RTE_LOG_REGISTER (l3fwd_power_logtype, l3fwd.power,INFO ); +#define RTE_LOGTYPE_L3FWD_POWER l3fwd_power_logtype#define MAX_PKT_BURST 32
@@ -2236,7 +2237,7 @@ init_power_library(void)/* init power management library */ ret =rte_power_init (lcore_id);if (ret) { -RTE_LOG (ERR ,POWER , +RTE_LOG (ERR ,L3FWD_POWER ,"Library initialization failed on core %u\n" , lcore_id);return ret;
@@ -2246,8 +2247,8 @@ init_power_library(void)if (env !=PM_ENV_ACPI_CPUFREQ && env !=PM_ENV_PSTATE_CPUFREQ && env !=PM_ENV_CPPC_CPUFREQ ) { -RTE_LOG (ERR ,POWER , -"Only ACPI, PSTATE and CPPC mode are supported\n" ); +RTE_LOG (ERR ,L3FWD_POWER , +"Only ACPI and PSTATE mode are supported\n" );return -1 ; } }
@@ -2264,7 +2265,7 @@ deinit_power_library(void)/* deinit power management library */ ret =rte_power_exit (lcore_id);if (ret) { -RTE_LOG (ERR ,POWER , +RTE_LOG (ERR ,L3FWD_POWER ,"Library deinitialization failed on core %u\n" , lcore_id);return ret;
@@ -2333,7 +2334,7 @@ update_telemetry(__rte_unused struct rte_timer *tim, ret =rte_metrics_update_values (RTE_METRICS_GLOBAL , telstats_index, values,RTE_DIM (values));if (ret <0 ) -RTE_LOG (WARNING ,POWER ,"failed to update metrics\n" ); +RTE_LOG (WARNING ,L3FWD_POWER ,"failed to update metrics\n" ); } static int
@@ -2382,7 +2383,7 @@ launch_timer(unsigned int lcore_id) rte_get_main_lcore()); } -RTE_LOG (INFO ,POWER ,"Bring up the Timer\n" ); +RTE_LOG (INFO ,L3FWD_POWER ,"Bring up the Timer\n" );telemetry_setup_timer ();
@@ -2398,7 +2399,7 @@ launch_timer(unsigned int lcore_id) } } -RTE_LOG (INFO ,POWER ,"Timer_subsystem is done\n" ); +RTE_LOG (INFO ,L3FWD_POWER ,"Timer_subsystem is done\n" );return 0 ; }
Signature · 1 line
2.39.2
PATCH v13 9/21 power: convert RTE_LOGTYPE_POWER to dynamic type
In reply to Stephen HemmingerUse dynamic log type for power library.
Also replace use of RTE_LOGTYPE_USER1 with lib.power.guest.
--- lib/log/log.c | 1 - lib/log/rte_log.h | 2 +- lib/power/guest_channel.c | 3 ++- lib/power/power_common.c | 2 ++ lib/power/power_common.h | 2 ++ lib/power/power_kvm_vm.c | 1 + lib/power/rte_power.c | 1 + 7 files changed, 9 insertions(+), 3 deletions(-)
lib/log/log.c +0 -1
@@ -357,7 +357,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_PMD, "pmd"}, {RTE_LOGTYPE_HASH, "lib.hash"}, {RTE_LOGTYPE_LPM, "lib.lpm"}, - {RTE_LOGTYPE_POWER, "lib.power"}, {RTE_LOGTYPE_METER, "lib.meter"}, {RTE_LOGTYPE_SCHED, "lib.sched"}, {RTE_LOGTYPE_PORT, "lib.port"},
lib/log/rte_log.h +1 -1
@@ -36,7 +36,7 @@ extern "C" {#define RTE_LOGTYPE_LPM 7/**< Log related to LPM. */ /* was RTE_LOGTYPE_KNI */ /* was RTE_LOGTYPE_ACL */ -#define RTE_LOGTYPE_POWER 10/**< Log related to power. */ +/* was RTE_LOGTYPE_POWER */ #define RTE_LOGTYPE_METER 11/**< Log related to QoS meter. */ #define RTE_LOGTYPE_SCHED 12/**< Log related to QoS port scheduler. */ #define RTE_LOGTYPE_PORT 13/**< Log related to port. */
lib/power/guest_channel.c +2 -1
@@ -17,7 +17,8 @@#include "guest_channel.h" -#define RTE_LOGTYPE_GUEST_CHANNEL RTE_LOGTYPE_USER1 +RTE_LOG_REGISTER_SUFFIX (guest_channel_logtype, guest,INFO ); +#define RTE_LOGTYPE_GUEST_CHANNEL guest_channel_logtype/* Timeout for incoming message in milliseconds. */ #define TIMEOUT 10
lib/power/power_common.c +2 -0
@@ -12,6 +12,8 @@#include "power_common.h" +RTE_LOG_REGISTER_DEFAULT (power_logtype,INFO ); +#define POWER_SYSFILE_SCALING_DRIVER \ "/sys/devices/system/cpu/cpu%u/cpufreq/scaling_driver"#define POWER_SYSFILE_GOVERNOR \
lib/power/power_common.h +2 -0
@@ -10,6 +10,8 @@#define RTE_POWER_INVALID_FREQ_INDEX (~0) +extern int power_logtype; +#define RTE_LOGTYPE_POWER power_logtype#ifdef RTE_LIBRTE_POWER_DEBUG #define POWER_DEBUG_TRACE(fmt, args...) \
lib/power/power_kvm_vm.c +1 -0
@@ -8,6 +8,7 @@#include "rte_power_guest_channel.h" #include "guest_channel.h" +#include "power_common.h" #include "power_kvm_vm.h" #define FD_PATH "/dev/virtio-ports/virtio.serial.port.poweragent"
lib/power/rte_power.c +1 -0
@@ -10,6 +10,7 @@#include "rte_power.h" #include "power_acpi_cpufreq.h" #include "power_cppc_cpufreq.h" +#include "power_common.h" #include "power_kvm_vm.h" #include "power_pstate_cpufreq.h"
Signature · 1 line
2.39.2
PATCH v13 10/21 ring: convert RTE_LOGTYPE_RING to dynamic type
In reply to Stephen HemmingerThe logtype for ring only used in library.
--- lib/log/log.c | 1 - lib/log/rte_log.h | 2 +- lib/ring/rte_ring.c | 3 +++ 3 files changed, 4 insertions(+), 2 deletions(-)
lib/log/log.c +0 -1
@@ -352,7 +352,6 @@ struct logtype {static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL ,"lib.eal" }, - {RTE_LOGTYPE_RING ,"lib.ring" }, {RTE_LOGTYPE_MEMPOOL ,"lib.mempool" }, {RTE_LOGTYPE_PMD ,"pmd" }, {RTE_LOGTYPE_HASH ,"lib.hash" },
lib/log/rte_log.h +1 -1
@@ -28,7 +28,7 @@ extern "C" {/* SDK log type */ #define RTE_LOGTYPE_EAL 0/**< Log related to eal. */ /* was RTE_LOGTYPE_MALLOC */ -#define RTE_LOGTYPE_RING 2/**< Log related to ring. */ +/* was RTE_LOGTYPE_RING */ #define RTE_LOGTYPE_MEMPOOL 3/**< Log related to mempool. */ /* was RTE_LOGTYPE_TIMER */ #define RTE_LOGTYPE_PMD 5/**< Log related to poll mode driver. */
lib/ring/rte_ring.c +3 -0
@@ -26,6 +26,9 @@#include "rte_ring.h" #include "rte_ring_elem.h" +RTE_LOG_REGISTER_DEFAULT (ring_logtype,INFO ); +#define RTE_LOGTYPE_RING ring_logtype +TAILQ_HEAD (rte_ring_list, rte_tailq_entry);static struct rte_tailq_elem rte_ring_tailq = {
Signature · 1 line
2.39.2
PATCH v13 11/21 mempool: convert RTE_LOGTYPE_MEMPOOL to dynamic type
In reply to Stephen HemmingerConvert from RTE_LOGTYPE_MEMPOOL to logtype_mempool.
--- lib/log/log.c | 1 - lib/log/rte_log.h | 2 +- lib/mempool/rte_mempool.c | 2 ++ lib/mempool/rte_mempool.h | 8 ++++++++ lib/mempool/version.map | 3 +++ 5 files changed, 14 insertions(+), 2 deletions(-)
lib/log/log.c +0 -1
@@ -352,7 +352,6 @@ struct logtype {static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL ,"lib.eal" }, - {RTE_LOGTYPE_MEMPOOL ,"lib.mempool" }, {RTE_LOGTYPE_PMD ,"pmd" }, {RTE_LOGTYPE_HASH ,"lib.hash" }, {RTE_LOGTYPE_LPM ,"lib.lpm" },
lib/log/rte_log.h +1 -1
@@ -29,7 +29,7 @@ extern "C" {#define RTE_LOGTYPE_EAL 0/**< Log related to eal. */ /* was RTE_LOGTYPE_MALLOC */ /* was RTE_LOGTYPE_RING */ -#define RTE_LOGTYPE_MEMPOOL 3/**< Log related to mempool. */ +/* was RTE_LOGTYPE_MEMPOOL */ /* was RTE_LOGTYPE_TIMER */ #define RTE_LOGTYPE_PMD 5/**< Log related to poll mode driver. */ #define RTE_LOGTYPE_HASH 6/**< Log related to hash table. */
lib/mempool/rte_mempool.c +2 -0
@@ -31,6 +31,8 @@#include "mempool_trace.h" #include "rte_mempool.h" +RTE_LOG_REGISTER_DEFAULT (rte_mempool_logtype,INFO ); +TAILQ_HEAD (rte_mempool_list, rte_tailq_entry);static struct rte_tailq_elem rte_mempool_tailq = {
lib/mempool/rte_mempool.h +8 -0
@@ -43,6 +43,7 @@#include <rte_spinlock.h> #include <rte_debug.h> #include <rte_lcore.h> +#include <rte_log.h> #include <rte_branch_prediction.h> #include <rte_ring.h> #include <rte_memcpy.h>
@@ -175,6 +176,13 @@ struct rte_mempool_objtlr {#endif + +/** +* @internal Logtype used for mempool related messages. +*/ +extern int rte_mempool_logtype; +#define RTE_LOGTYPE_MEMPOOL rte_mempool_logtype +/** * A list of memory where objects are stored */
lib/mempool/version.map +3 -0
@@ -57,4 +57,7 @@ INTERNAL { # added in 21.11 rte_mempool_event_callback_register; rte_mempool_event_callback_unregister; + + # added in 23.07 + rte_mempool_logtype; };
Signature · 1 line
2.39.2
PATCH v13 12/21 lpm: convert RTE_LOGTYPE_LPM to dynamic types
In reply to Stephen HemmingerSplit lpm and lpm6 into separate log types since they are in different files and user may want to change log levels for IPv4 vs IPv6.
For rib and fib libraries give them own types as well.
--- lib/fib/fib_log.h | 4 ++++ lib/fib/rte_fib.c | 3 +++ lib/fib/rte_fib6.c | 2 ++ lib/log/log.c | 1 - lib/log/rte_log.h | 2 +- lib/lpm/lpm_log.h | 4 ++++ lib/lpm/rte_lpm.c | 3 +++ lib/lpm/rte_lpm6.c | 1 + lib/rib/rib_log.h | 4 ++++ lib/rib/rte_rib.c | 3 +++ lib/rib/rte_rib6.c | 3 +++ 11 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 lib/fib/fib_log.h create mode 100644 lib/lpm/lpm_log.h create mode 100644 lib/rib/rib_log.h
lib/fib/fib_log.h new file +4 -0
@@ -0,0 +1,4 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ + +extern int fib_logtype; +#define RTE_LOGTYPE_LPM fib_logtype
lib/fib/rte_fib.c +3 -0
@@ -17,6 +17,9 @@#include <rte_fib.h> #include "dir24_8.h" +#include "fib_log.h" + +RTE_LOG_REGISTER_DEFAULT (fib_logtype,INFO );TAILQ_HEAD (rte_fib_list, rte_tailq_entry);static struct rte_tailq_elem rte_fib_tailq = {
lib/fib/rte_fib6.c +2 -0
@@ -10,6 +10,7 @@#include <rte_eal_memconfig.h> #include <rte_tailq.h> #include <rte_errno.h> +#include <rte_log.h> #include <rte_malloc.h> #include <rte_string_fns.h>
@@ -17,6 +18,7 @@#include <rte_fib6.h> #include "trie.h" +#include "fib_log.h" TAILQ_HEAD (rte_fib6_list, rte_tailq_entry);static struct rte_tailq_elem rte_fib6_tailq = {
lib/log/log.c +0 -1
@@ -354,7 +354,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL, "lib.eal"}, {RTE_LOGTYPE_PMD, "pmd"}, {RTE_LOGTYPE_HASH, "lib.hash"}, - {RTE_LOGTYPE_LPM, "lib.lpm"}, {RTE_LOGTYPE_METER, "lib.meter"}, {RTE_LOGTYPE_SCHED, "lib.sched"}, {RTE_LOGTYPE_PORT, "lib.port"},
lib/log/rte_log.h +1 -1
@@ -33,7 +33,7 @@ extern "C" {/* was RTE_LOGTYPE_TIMER */ #define RTE_LOGTYPE_PMD 5/**< Log related to poll mode driver. */ #define RTE_LOGTYPE_HASH 6/**< Log related to hash table. */ -#define RTE_LOGTYPE_LPM 7/**< Log related to LPM. */ +/* was RTE_LOGTYPE_LPM */ /* was RTE_LOGTYPE_KNI */ /* was RTE_LOGTYPE_ACL */ /* was RTE_LOGTYPE_POWER */
lib/lpm/lpm_log.h new file +4 -0
@@ -0,0 +1,4 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ + +extern int lpm_logtype; +#define RTE_LOGTYPE_LPM lpm_logtype
lib/lpm/rte_lpm.c +3 -0
@@ -18,6 +18,9 @@#include <rte_tailq.h> #include "rte_lpm.h" +#include "lpm_log.h" + +RTE_LOG_REGISTER_DEFAULT (lpm_logtype,INFO );TAILQ_HEAD (rte_lpm_list, rte_tailq_entry);
lib/lpm/rte_lpm6.c +1 -0
@@ -20,6 +20,7 @@#include <rte_tailq.h> #include "rte_lpm6.h" +#include "lpm_log.h" #define RTE_LPM6_TBL24_NUM_ENTRIES (1 << 24)#define RTE_LPM6_TBL8_GROUP_NUM_ENTRIES 256
lib/rib/rib_log.h new file +4 -0
@@ -0,0 +1,4 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ + +extern int rib_logtype; +#define RTE_LOGTYPE_LPM rib_logtype
lib/rib/rte_rib.c +3 -0
@@ -16,6 +16,9 @@#include <rte_rib.h> +RTE_LOG_REGISTER_DEFAULT (rib_logtype,INFO ); +#define RTE_LOGTYPE_LPM rib_logtype +TAILQ_HEAD (rte_rib_list, rte_tailq_entry);static struct rte_tailq_elem rte_rib_tailq = { .name ="RTE_RIB" ,
lib/rib/rte_rib6.c +3 -0
@@ -9,6 +9,7 @@#include <rte_eal_memconfig.h> #include <rte_errno.h> +#include <rte_log.h> #include <rte_malloc.h> #include <rte_mempool.h> #include <rte_string_fns.h>
@@ -16,6 +17,8 @@#include <rte_rib6.h> +#include "rib_log.h" +#define RTE_RIB_VALID_NODE 1#define RIB6_MAXDEPTH 128/* Maximum length of a RIB6 name. */
Signature · 1 line
2.39.2
PATCH v13 13/21 sched: convert RTE_LOGTYPE_SCHED to dynamic type
In reply to Stephen HemmingerAlso can remove unused RTE_LOGTYPE_METER
--- lib/log/log.c | 2 -- lib/log/rte_log.h | 4 ++-- lib/sched/rte_pie.c | 1 + lib/sched/rte_sched.c | 5 +++++ lib/sched/rte_sched_log.h | 4 ++++ 5 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 lib/sched/rte_sched_log.h
lib/log/log.c +0 -2
@@ -354,8 +354,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL, "lib.eal"}, {RTE_LOGTYPE_PMD, "pmd"}, {RTE_LOGTYPE_HASH, "lib.hash"}, - {RTE_LOGTYPE_METER, "lib.meter"}, - {RTE_LOGTYPE_SCHED, "lib.sched"}, {RTE_LOGTYPE_PORT, "lib.port"}, {RTE_LOGTYPE_TABLE, "lib.table"}, {RTE_LOGTYPE_PIPELINE, "lib.pipeline"},
lib/log/rte_log.h +2 -2
@@ -37,8 +37,8 @@ extern "C" {/* was RTE_LOGTYPE_KNI */ /* was RTE_LOGTYPE_ACL */ /* was RTE_LOGTYPE_POWER */ -#define RTE_LOGTYPE_METER 11/**< Log related to QoS meter. */ -#define RTE_LOGTYPE_SCHED 12/**< Log related to QoS port scheduler. */ +/* was RTE_LOGTYPE_METER */ +/* was RTE_LOGTYPE_SCHED */ #define RTE_LOGTYPE_PORT 13/**< Log related to port. */ #define RTE_LOGTYPE_TABLE 14/**< Log related to table. */ #define RTE_LOGTYPE_PIPELINE 15/**< Log related to pipeline. */
lib/sched/rte_pie.c +1 -0
@@ -6,6 +6,7 @@#include <stdlib.h> #include <string.h> +#include "rte_sched_log.h" #include "rte_pie.h" #ifdef __INTEL_COMPILER
lib/sched/rte_sched.c +5 -0
@@ -16,9 +16,12 @@#include <rte_reciprocal.h> #include "rte_sched.h" +#include "rte_sched_log.h" #include "rte_sched_common.h" +#include "rte_approx.h" +#ifdef __INTEL_COMPILER#pragma warning(disable:2259)/* conversion may lose significant bits */ #endif
@@ -2999,3 +3002,5 @@ rte_sched_port_dequeue(struct rte_sched_port *port, struct rte_mbuf **pkts, uintreturn count; } + +RTE_LOG_REGISTER_DEFAULT (sched_logtype,INFO );
lib/sched/rte_sched_log.h new file +4 -0
@@ -0,0 +1,4 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ + +extern int sched_logtype; +#define RTE_LOGTYPE_SCHED sched_logtype
Signature · 1 line
2.39.2
PATCH v13 14/21 examples/ipsec-secgw: replace RTE_LOGTYPE_PORT
In reply to Stephen HemmingerLooks like some code got copy/paste in to the IPSEC gateway example from another place. Shouldn't be using RTE_LOGTYPE_PORT here.
--- examples/ipsec-secgw/sa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
examples/ipsec-secgw/sa.c +3 -3
@@ -1128,7 +1128,7 @@ check_eth_dev_caps(uint16_t portid, uint32_t inbound, uint32_t tso)if (inbound) {if ((dev_info.rx_offload_capa &RTE_ETH_RX_OFFLOAD_SECURITY ) ==0 ) { -RTE_LOG (WARNING ,PORT , +RTE_LOG (WARNING ,IPSEC ,"hardware RX IPSec offload is not supported\n" );return -EINVAL ; }
@@ -1136,13 +1136,13 @@ check_eth_dev_caps(uint16_t portid, uint32_t inbound, uint32_t tso) }else {/* outbound */ if ((dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_SECURITY ) ==0 ) { -RTE_LOG (WARNING ,PORT , +RTE_LOG (WARNING ,IPSEC ,"hardware TX IPSec offload is not supported\n" );return -EINVAL ; }if (tso && (dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_TCP_TSO ) ==0 ) { -RTE_LOG (WARNING ,PORT , +RTE_LOG (WARNING ,IPSEC ,"hardware TCP TSO offload is not supported\n" );return -EINVAL ; }
Signature · 1 line
2.39.2
PATCH v13 15/21 port: convert RTE_LOGTYPE_PORT to dynamic type
In reply to Stephen HemmingerSplit up the single static RTE_LOGTYPE_PORT into separate sub types for each component: port.ethdev, port.evendev, ...
--- lib/log/log.c | 1 - lib/log/rte_log.h | 2 +- lib/port/rte_port_ethdev.c | 3 +++ lib/port/rte_port_eventdev.c | 4 ++++ lib/port/rte_port_fd.c | 3 +++ lib/port/rte_port_frag.c | 3 +++ lib/port/rte_port_ras.c | 3 +++ lib/port/rte_port_ring.c | 3 +++ lib/port/rte_port_sched.c | 3 +++ lib/port/rte_port_source_sink.c | 3 +++ lib/port/rte_port_sym_crypto.c | 3 +++ 11 files changed, 29 insertions(+), 2 deletions(-)
lib/log/log.c +0 -1
@@ -354,7 +354,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL, "lib.eal"}, {RTE_LOGTYPE_PMD, "pmd"}, {RTE_LOGTYPE_HASH, "lib.hash"}, - {RTE_LOGTYPE_PORT, "lib.port"}, {RTE_LOGTYPE_TABLE, "lib.table"}, {RTE_LOGTYPE_PIPELINE, "lib.pipeline"}, {RTE_LOGTYPE_CRYPTODEV, "lib.cryptodev"},
lib/log/rte_log.h +1 -1
@@ -39,7 +39,7 @@ extern "C" {/* was RTE_LOGTYPE_POWER */ /* was RTE_LOGTYPE_METER */ /* was RTE_LOGTYPE_SCHED */ -#define RTE_LOGTYPE_PORT 13/**< Log related to port. */ +/* was RTE_LOGTYPE_PORT */ #define RTE_LOGTYPE_TABLE 14/**< Log related to table. */ #define RTE_LOGTYPE_PIPELINE 15/**< Log related to pipeline. */ /* was RTE_LOGTYPE_MBUF */
lib/port/rte_port_ethdev.c +3 -0
@@ -10,6 +10,9 @@#include "rte_port_ethdev.h" +RTE_LOG_REGISTER_SUFFIX (port_ethdev_logtype, ethdev,INFO ); +#define RTE_LOGTYPE_PORT port_ethdev_logtype +/* * Port ETHDEV Reader */
lib/port/rte_port_eventdev.c +4 -0
@@ -5,11 +5,15 @@#include <string.h> #include <stdint.h> +#include <rte_log.h> #include <rte_mbuf.h> #include <rte_malloc.h> #include "rte_port_eventdev.h" +RTE_LOG_REGISTER_SUFFIX (port_eventdev_logtype, eventdev,INFO ); +#define RTE_LOGTYPE_PORT port_eventdev_logtype +/* * Port EVENTDEV Reader */
lib/port/rte_port_fd.c +3 -0
@@ -10,6 +10,9 @@#include "rte_port_fd.h" +RTE_LOG_REGISTER_SUFFIX (port_fd_logtype, fd,INFO ); +#define RTE_LOGTYPE_PORT port_fd_logtype +/* * Port FD Reader */
lib/port/rte_port_frag.c +3 -0
@@ -7,6 +7,9 @@#include "rte_port_frag.h" +RTE_LOG_REGISTER_SUFFIX (port_frag_logtype, frag,INFO ); +#define RTE_LOGTYPE_PORT port_frag_logtype +/* Max number of fragments per packet allowed */ #define RTE_PORT_FRAG_MAX_FRAGS_PER_PACKET 0x80
lib/port/rte_port_ras.c +3 -0
@@ -9,6 +9,9 @@#include "rte_port_ras.h" +RTE_LOG_REGISTER_SUFFIX (port_ras_logtype, ras,INFO ); +#define RTE_LOGTYPE_PORT port_ras_logtype +#ifndef RTE_PORT_RAS_N_BUCKETS #define RTE_PORT_RAS_N_BUCKETS 4094#endif
lib/port/rte_port_ring.c +3 -0
@@ -10,6 +10,9 @@#include "rte_port_ring.h" +RTE_LOG_REGISTER_SUFFIX (port_ring_logtype, ring,INFO ); +#define RTE_LOGTYPE_PORT port_ring_logtype +/* * Port RING Reader */
lib/port/rte_port_sched.c +3 -0
@@ -7,6 +7,9 @@#include "rte_port_sched.h" +RTE_LOG_REGISTER_SUFFIX (port_sched_logtype, sched,INFO ); +#define RTE_LOGTYPE_PORT port_sched_logtype +/* * Reader */
lib/port/rte_port_source_sink.c +3 -0
@@ -15,6 +15,9 @@#include "rte_port_source_sink.h" +RTE_LOG_REGISTER_SUFFIX (port_source_logtype, source,INFO ); +#define RTE_LOGTYPE_PORT port_source_logtype +/* * Port SOURCE */
lib/port/rte_port_sym_crypto.c +3 -0
@@ -8,6 +8,9 @@#include "rte_port_sym_crypto.h" +RTE_LOG_REGISTER_SUFFIX (port_crypto_logtype, crypto,INFO ); +#define RTE_LOGTYPE_PORT port_crypto_logtype +/* * Port Crypto Reader */
Signature · 1 line
2.39.2
PATCH v13 16/21 hash: move rte_thash_gfni stubs out of header file
In reply to Stephen HemmingerHaving stubs in header file makes it harder to update RTE_LOG(). Also modify to only print warning once.
--- lib/hash/meson.build | 8 ++++++- lib/hash/rte_thash_gfni.c | 47 +++++++++++++++++++++++++++++++++++++++ lib/hash/rte_thash_gfni.h | 30 ++++++++----------------- lib/hash/version.map | 4 ++++ 4 files changed, 67 insertions(+), 22 deletions(-) create mode 100644 lib/hash/rte_thash_gfni.c
lib/hash/meson.build +7 -1
@@ -17,7 +17,13 @@ indirect_headers += files( 'rte_thash_x86_gfni.h', ) -sources = files('rte_cuckoo_hash.c', 'rte_fbk_hash.c', 'rte_thash.c') +sources = files( + 'rte_cuckoo_hash.c', + 'rte_fbk_hash.c', + 'rte_thash.c', + 'rte_thash_gfni.c' +) + deps += ['net'] deps += ['ring'] deps += ['rcu']
lib/hash/rte_thash_gfni.c new file +47 -0
47 lines not on this page · raw message
lib/hash/rte_thash_gfni.h +9 -21
@@ -9,13 +9,14 @@extern "C" {#endif +#include <stdint.h> +#include <rte_compat.h> -#include <rte_log.h> +#include <rte_common.h> +#include <rte_config.h> #ifdef RTE_ARCH_X86 -#include <rte_thash_x86_gfni.h> -#endif #ifndef RTE_THASH_GFNI_DEFINED
@@ -38,13 +39,8 @@ extern "C" {* Calculated Toeplitz hash value. */ __rte_experimental -static inline uint32_t -rte_thash_gfni(const uint64_t *mtrx __rte_unused, - const uint8_t *key __rte_unused, int len __rte_unused) -{ -RTE_LOG (ERR ,HASH ,"%s is undefined under given arch\n" , __func__); -return 0 ; -} +uint32_t +rte_thash_gfni (const uint64_t *mtrx,const uint8_t *key,int len);/** * Bulk implementation for Toeplitz hash.
@@ -67,17 +63,9 @@ rte_thash_gfni(const uint64_t *mtrx __rte_unused,* Number of tuples to hash. */ __rte_experimental -static inline void -rte_thash_gfni_bulk(const uint64_t *mtrx __rte_unused, - int len __rte_unused, uint8_t *tuple[] __rte_unused, -uint32_t val[],uint32_t num) -{ -unsigned int i; - -RTE_LOG (ERR ,HASH ,"%s is undefined under given arch\n" , __func__); -for (i =0 ; i < num; i++) - val[i] =0 ; -} +void +rte_thash_gfni_bulk (const uint64_t *mtrx,int len,uint8_t *tuple[], +uint32_t val[],uint32_t num);#endif /* RTE_THASH_GFNI_DEFINED */
lib/hash/version.map +4 -0
@@ -51,4 +51,8 @@ EXPERIMENTAL { rte_thash_complete_matrix; rte_thash_get_gfni_matrices; rte_thash_gfni_supported; + + # added in 22.07 + rte_thash_gfni; + rte_thash_gfni_bulk; };
Signature · 1 line
2.39.2
PATCH v13 17/21 hash: move rte_hash_set_alg out header
In reply to Stephen HemmingerThe code for setting algorithm for hash is not at all perf sensitive, and doing it inline has a couple of problems. First, it means that if multiple files include the header, then the initialization gets done multiple times. But also, it makes it harder to fix usage of RTE_LOG().
Despite what the checking script say. This is not an ABI change, the previous version inlined the same code; therefore both old and new code will work the same.
--- lib/hash/meson.build | 1 + lib/hash/rte_crc_arm64.h | 8 ++--- lib/hash/rte_crc_x86.h | 10 +++--- lib/hash/rte_hash_crc.c | 68 ++++++++++++++++++++++++++++++++++++++++ lib/hash/rte_hash_crc.h | 48 ++-------------------------- lib/hash/version.map | 7 +++++ 6 files changed, 88 insertions(+), 54 deletions(-) create mode 100644 lib/hash/rte_hash_crc.c
lib/hash/meson.build +1 -0
@@ -19,6 +19,7 @@ indirect_headers += files( sources = files( 'rte_cuckoo_hash.c', + 'rte_hash_crc.c', 'rte_fbk_hash.c', 'rte_thash.c', 'rte_thash_gfni.c'
lib/hash/rte_crc_arm64.h +4 -4
@@ -53,7 +53,7 @@ crc32c_arm64_u64(uint64_t data, uint32_t init_val)static inline uint32_t rte_hash_crc_1byte (uint8_t data,uint32_t init_val) { -if (likely (crc32_alg &CRC32_ARM64 )) +if (likely (rte_hash_crc32_alg &CRC32_ARM64 ))return crc32c_arm64_u8 (data, init_val);return crc32c_1byte (data, init_val);
@@ -67,7 +67,7 @@ rte_hash_crc_1byte(uint8_t data, uint32_t init_val)static inline uint32_t rte_hash_crc_2byte (uint16_t data,uint32_t init_val) { -if (likely (crc32_alg &CRC32_ARM64 )) +if (likely (rte_hash_crc32_alg &CRC32_ARM64 ))return crc32c_arm64_u16 (data, init_val);return crc32c_2bytes (data, init_val);
@@ -81,7 +81,7 @@ rte_hash_crc_2byte(uint16_t data, uint32_t init_val)static inline uint32_t rte_hash_crc_4byte (uint32_t data,uint32_t init_val) { -if (likely (crc32_alg &CRC32_ARM64 )) +if (likely (rte_hash_crc32_alg &CRC32_ARM64 ))return crc32c_arm64_u32 (data, init_val);return crc32c_1word (data, init_val);
@@ -95,7 +95,7 @@ rte_hash_crc_4byte(uint32_t data, uint32_t init_val)static inline uint32_t rte_hash_crc_8byte (uint64_t data,uint32_t init_val) { -if (likely (crc32_alg &CRC32_ARM64 )) +if (likely (rte_hash_crc32_alg &CRC32_ARM64 ))return crc32c_arm64_u64 (data, init_val);return crc32c_2words (data, init_val);
lib/hash/rte_crc_x86.h +5 -5
@@ -67,7 +67,7 @@ crc32c_sse42_u64(uint64_t data, uint64_t init_val)static inline uint32_t rte_hash_crc_1byte (uint8_t data,uint32_t init_val) { -if (likely (crc32_alg &CRC32_SSE42 )) +if (likely (rte_hash_crc32_alg &CRC32_SSE42 ))return crc32c_sse42_u8 (data, init_val);return crc32c_1byte (data, init_val);
@@ -81,7 +81,7 @@ rte_hash_crc_1byte(uint8_t data, uint32_t init_val)static inline uint32_t rte_hash_crc_2byte (uint16_t data,uint32_t init_val) { -if (likely (crc32_alg &CRC32_SSE42 )) +if (likely (rte_hash_crc32_alg &CRC32_SSE42 ))return crc32c_sse42_u16 (data, init_val);return crc32c_2bytes (data, init_val);
@@ -95,7 +95,7 @@ rte_hash_crc_2byte(uint16_t data, uint32_t init_val)static inline uint32_t rte_hash_crc_4byte (uint32_t data,uint32_t init_val) { -if (likely (crc32_alg &CRC32_SSE42 )) +if (likely (rte_hash_crc32_alg &CRC32_SSE42 ))return crc32c_sse42_u32 (data, init_val);return crc32c_1word (data, init_val);
@@ -110,11 +110,11 @@ static inline uint32_t rte_hash_crc_8byte(uint64_t data, uint32_t init_val) {#ifdef RTE_ARCH_X86_64 -if (likely (crc32_alg == CRC32_SSE42_x64)) +if (likely (rte_hash_crc32_alg == CRC32_SSE42_x64))return crc32c_sse42_u64 (data, init_val);#endif -if (likely (crc32_alg &CRC32_SSE42 )) +if (likely (rte_hash_crc32_alg &CRC32_SSE42 ))return crc32c_sse42_u64_mimic (data, init_val);return crc32c_2words (data, init_val);
lib/hash/rte_hash_crc.c new file +68 -0
68 lines not on this page · raw message
lib/hash/rte_hash_crc.h +3 -45
66 lines not on this page · raw message
lib/hash/version.map +7 -0
@@ -9,6 +9,7 @@ DPDK_24 { rte_hash_add_key_with_hash; rte_hash_add_key_with_hash_data; rte_hash_count; + rte_hash_crc_set_alg; rte_hash_create; rte_hash_del_key; rte_hash_del_key_with_hash;
@@ -56,3 +57,9 @@ EXPERIMENTAL { rte_thash_gfni; rte_thash_gfni_bulk; }; + +INTERNAL { + global: + + rte_hash_crc32_alg; +};
Signature · 1 line
2.39.2
PATCH v13 18/21 hash: convert RTE_LOGTYPE_HASH to dynamic type
In reply to Stephen HemmingerUse dynamic type for hash and add subtypes for crc and gfni.
--- lib/hash/rte_cuckoo_hash.c | 5 +++++ lib/hash/rte_fbk_hash.c | 5 +++++ lib/hash/rte_thash.c | 3 +++ lib/hash/rte_thash_gfni.c | 3 +++ lib/log/log.c | 1 - lib/log/rte_log.h | 2 +- 6 files changed, 17 insertions(+), 2 deletions(-)
lib/hash/rte_cuckoo_hash.c +5 -0
@@ -24,6 +24,11 @@#include <rte_tailq.h> #include "rte_hash.h" + +/* needs to be before rte_cuckoo_hash.h */ +RTE_LOG_REGISTER_DEFAULT (hash_logtype,INFO ); +#define RTE_LOGTYPE_HASH hash_logtype +#include "rte_cuckoo_hash.h" /* Mask of all flags supported by this version */
lib/hash/rte_fbk_hash.c +5 -0
@@ -8,6 +8,8 @@#include <errno.h> #include <sys/queue.h> + +#include <rte_cpuflags.h> #include <rte_eal_memconfig.h> #include <rte_malloc.h> #include <rte_common.h>
@@ -18,6 +20,9 @@#include "rte_fbk_hash.h" +RTE_LOG_REGISTER_SUFFIX (fbk_hash_logtype, fbk,INFO ); +#define RTE_LOGTYPE_HASH fbk_hash_logtype +TAILQ_HEAD (rte_fbk_hash_list, rte_tailq_entry);static struct rte_tailq_elem rte_fbk_hash_tailq = {
lib/hash/rte_thash.c +3 -0
@@ -13,6 +13,9 @@#include <rte_log.h> #include <rte_malloc.h> +RTE_LOG_REGISTER_SUFFIX (thash_logtype, thash,INFO ); +#define RTE_LOGTYPE_HASH thash_logtype +#define THASH_NAME_LEN 64#define TOEPLITZ_HASH_LEN 32
lib/hash/rte_thash_gfni.c +3 -0
@@ -10,6 +10,9 @@#ifndef RTE_THASH_GFNI_DEFINED +RTE_LOG_REGISTER_SUFFIX (hash_gfni_logtype, gfni,INFO ); +#define RTE_LOGTYPE_HASH hash_gfni_logtype +uint32_t rte_thash_gfni(const uint64_t *mtrx __rte_unused, const uint8_t *key __rte_unused, int len __rte_unused)
lib/log/log.c +0 -1
@@ -353,7 +353,6 @@ struct logtype {static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL ,"lib.eal" }, {RTE_LOGTYPE_PMD ,"pmd" }, - {RTE_LOGTYPE_HASH ,"lib.hash" }, {RTE_LOGTYPE_TABLE ,"lib.table" }, {RTE_LOGTYPE_PIPELINE ,"lib.pipeline" }, {RTE_LOGTYPE_CRYPTODEV ,"lib.cryptodev" },
lib/log/rte_log.h +1 -1
@@ -32,7 +32,7 @@ extern "C" {/* was RTE_LOGTYPE_MEMPOOL */ /* was RTE_LOGTYPE_TIMER */ #define RTE_LOGTYPE_PMD 5/**< Log related to poll mode driver. */ -#define RTE_LOGTYPE_HASH 6/**< Log related to hash table. */ +/* was RTE_LOGTYPE_HASH */ /* was RTE_LOGTYPE_LPM */ /* was RTE_LOGTYPE_KNI */ /* was RTE_LOGTYPE_ACL */
Signature · 1 line
2.39.2
PATCH v13 19/21 table: convert RTE_LOGTYPE_TABLE to dynamic type
In reply to Stephen HemmingerMake an alias for RTE_LOGTYPE_TABLE in rte_table.h and use it.
--- lib/log/log.c | 1 - lib/log/rte_log.h | 2 +- lib/table/meson.build | 1 + lib/table/rte_table.c | 8 ++++++++ lib/table/rte_table.h | 4 ++++ 5 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 lib/table/rte_table.c
lib/log/log.c +0 -1
@@ -353,7 +353,6 @@ struct logtype {static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL ,"lib.eal" }, {RTE_LOGTYPE_PMD ,"pmd" }, - {RTE_LOGTYPE_TABLE ,"lib.table" }, {RTE_LOGTYPE_PIPELINE ,"lib.pipeline" }, {RTE_LOGTYPE_CRYPTODEV ,"lib.cryptodev" }, {RTE_LOGTYPE_EVENTDEV ,"lib.eventdev" },
lib/log/rte_log.h +1 -1
@@ -40,7 +40,7 @@ extern "C" {/* was RTE_LOGTYPE_METER */ /* was RTE_LOGTYPE_SCHED */ /* was RTE_LOGTYPE_PORT */ -#define RTE_LOGTYPE_TABLE 14/**< Log related to table. */ +/* was RTE_LOGTYPE_TABLE */ #define RTE_LOGTYPE_PIPELINE 15/**< Log related to pipeline. */ /* was RTE_LOGTYPE_MBUF */ #define RTE_LOGTYPE_CRYPTODEV 17/**< Log related to cryptodev. */
lib/table/meson.build +1 -0
@@ -7,6 +7,7 @@ sources = files( 'rte_swx_table_learner.c', 'rte_swx_table_selector.c', 'rte_swx_table_wm.c', + 'rte_table.c', 'rte_table_acl.c', 'rte_table_array.c', 'rte_table_hash_cuckoo.c',
lib/table/rte_table.c new file +8 -0
@@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2010-2014 Intel Corporation +*/ + +#include <rte_log.h> +#include <rte_table.h> + +RTE_LOG_REGISTER_DEFAULT (table_logtype,INFO );
lib/table/rte_table.h +4 -0
@@ -264,6 +264,10 @@ struct rte_table_ops {rte_table_op_stats_read f_stats;/**< Stats */ }; +/** Internal Logtype used */ +extern int table_logtype; +#define RTE_LOGTYPE_TABLE table_logtype + #ifdef __cplusplus }#endif
Signature · 1 line
2.39.2
PATCH v13 20/21 app/test: remove use of RTE_LOGTYPE_PIPELINE
In reply to Stephen HemmingerInstead of using static type PIPELINE for logging in test application use stderr instead. If not testing RTE_LOG() better to not use it since log also goes to syslog.
--- app/test/test_table_acl.c | 50 ++++++++++++++++------------------ app/test/test_table_pipeline.c | 40 +++++++++++++-------------- 2 files changed, 43 insertions(+), 47 deletions(-)
app/test/test_table_acl.c +23 -27
@@ -165,7 +165,7 @@ parse_cb_ipv4_rule(char *str, struct rte_table_acl_rule_add_params *v) &v->field_value[SRC_FIELD_IPV4 ].value.u32, &v->field_value[SRC_FIELD_IPV4].mask_range.u32);if (rc !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"failed to read src address/mask: %s\n" , +fprintf (stderr,"failed to read src address/mask: %s\n" , in[CB_FLD_SRC_ADDR ]);return rc; }
@@ -178,7 +178,7 @@ parse_cb_ipv4_rule(char *str, struct rte_table_acl_rule_add_params *v) &v->field_value[DST_FIELD_IPV4 ].value.u32, &v->field_value[DST_FIELD_IPV4].mask_range.u32);if (rc !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"failed to read dest address/mask: %s\n" , +fprintf (stderr,"failed to read dest address/mask: %s\n" , in[CB_FLD_DST_ADDR ]);return rc; }
@@ -190,7 +190,7 @@ parse_cb_ipv4_rule(char *str, struct rte_table_acl_rule_add_params *v) &v->field_value[SRCP_FIELD_IPV4 ].value.u16, &v->field_value[SRCP_FIELD_IPV4].mask_range.u16);if (rc !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"failed to read source port range: %s\n" , +fprintf (stderr,"failed to read source port range: %s\n" , in[CB_FLD_SRC_PORT_RANGE ]);return rc; }
@@ -202,7 +202,7 @@ parse_cb_ipv4_rule(char *str, struct rte_table_acl_rule_add_params *v) &v->field_value[DSTP_FIELD_IPV4 ].value.u16, &v->field_value[DSTP_FIELD_IPV4].mask_range.u16);if (rc !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"failed to read dest port range: %s\n" , +fprintf (stderr,"failed to read dest port range: %s\n" , in[CB_FLD_DST_PORT_RANGE ]);return rc; }
@@ -254,7 +254,7 @@ parse_cb_ipv4_rule_del(char *str, struct rte_table_acl_rule_delete_params *v) &v->field_value[SRC_FIELD_IPV4 ].value.u32, &v->field_value[SRC_FIELD_IPV4].mask_range.u32);if (rc !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"failed to read src address/mask: %s\n" , +fprintf (stderr,"failed to read src address/mask: %s\n" , in[CB_FLD_SRC_ADDR ]);return rc; }
@@ -267,7 +267,7 @@ parse_cb_ipv4_rule_del(char *str, struct rte_table_acl_rule_delete_params *v) &v->field_value[DST_FIELD_IPV4 ].value.u32, &v->field_value[DST_FIELD_IPV4].mask_range.u32);if (rc !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"failed to read dest address/mask: %s\n" , +fprintf (stderr,"failed to read dest address/mask: %s\n" , in[CB_FLD_DST_ADDR ]);return rc; }
@@ -279,7 +279,7 @@ parse_cb_ipv4_rule_del(char *str, struct rte_table_acl_rule_delete_params *v) &v->field_value[SRCP_FIELD_IPV4 ].value.u16, &v->field_value[SRCP_FIELD_IPV4].mask_range.u16);if (rc !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"failed to read source port range: %s\n" , +fprintf (stderr,"failed to read source port range: %s\n" , in[CB_FLD_SRC_PORT_RANGE ]);return rc; }
@@ -291,7 +291,7 @@ parse_cb_ipv4_rule_del(char *str, struct rte_table_acl_rule_delete_params *v) &v->field_value[DSTP_FIELD_IPV4 ].value.u16, &v->field_value[DSTP_FIELD_IPV4].mask_range.u16);if (rc !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"failed to read dest port range: %s\n" , +fprintf (stderr,"failed to read dest port range: %s\n" , in[CB_FLD_DST_PORT_RANGE ]);return rc; }
@@ -346,7 +346,7 @@ setup_acl_pipeline(void)/* Pipeline configuration */ p =rte_pipeline_create (&pipeline_params);if (p ==NULL ) { -RTE_LOG (INFO ,PIPELINE ,"%s: Failed to configure pipeline\n" , +fprintf (stderr,"%s: Failed to configure pipeline\n" , __func__); goto fail; }
@@ -410,7 +410,7 @@ setup_acl_pipeline(void) table_params.f_action_miss =NULL ; table_params.action_data_size =0 ; -RTE_LOG (INFO ,PIPELINE ,"miss_action=%x\n" , +printf ("miss_action=%x\n" , table_entry_miss_action); printf("RTE_ACL_RULE_SZ(%zu) = %zu\n", DIM(ipv4_defs),
@@ -471,9 +471,8 @@ setup_acl_pipeline(void) ret =parser (line, &keys[n]);if (ret !=0 ) { -RTE_LOG (ERR ,PIPELINE , -"line %u: parse_cb_ipv4vlan_rule" -" failed, error code: %d (%s)\n" , +fprintf (stderr, +"line %u: parse_cb_ipv4vlan_rule failed, error code: %d (%s)\n" , n, ret,strerror (-ret));return ret; }
@@ -513,9 +512,8 @@ setup_acl_pipeline(void) ret =parse_cb_ipv4_rule_del (line, &keys[n]);if (ret !=0 ) { -RTE_LOG (ERR ,PIPELINE , -"line %u: parse_cb_ipv4vlan_rule" -" failed, error code: %d (%s)\n" , +fprintf (stderr, +"line %u: parse_cb_ipv4vlan_rule failed, error code: %d (%s)\n" , n, ret,strerror (-ret));return ret; }
@@ -549,9 +547,8 @@ setup_acl_pipeline(void) ret =parser (line, &rule_params);if (ret !=0 ) { -RTE_LOG (ERR ,PIPELINE , -"line %u: parse_cb_ipv4vlan_rule" -" failed, error code: %d (%s)\n" , +fprintf (stderr, +"line %u: parse_cb_ipv4vlan_rule failed, error code: %d (%s)\n" , n, ret,strerror (-ret));return ret; }
@@ -575,8 +572,8 @@ setup_acl_pipeline(void) ret =parser (line, &rule_params);if (ret !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"line %u: parse rule " -" failed, error code: %d (%s)\n" , +fprintf (stderr, +"line %u: parse rule failed, error code: %d (%s)\n" , n, ret,strerror (-ret));return ret; }
@@ -602,8 +599,8 @@ setup_acl_pipeline(void) ret =parser (line, &rule_params);if (ret !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"line %u: parse rule" -" failed, error code: %d (%s)\n" , +fprintf (stderr, +"line %u: parse rule failed, error code: %d (%s)\n" , n, ret,strerror (-ret));return ret; }
@@ -667,7 +664,7 @@ test_pipeline_single_filter(int expected_count) memcpy(rte_pktmbuf_mtod(mbuf, char *), &five_tuple, sizeof(struct ipv4_5tuple)); -RTE_LOG (INFO ,PIPELINE ,"%s: Enqueue onto ring %d\n" , +printf ("%s: Enqueue onto ring %d\n" , __func__, i);rte_ring_enqueue (rings_rx[i], mbuf); }
@@ -702,9 +699,8 @@ test_pipeline_single_filter(int expected_count) }if (tx_count != expected_count) { -RTE_LOG (INFO ,PIPELINE , -"%s: Unexpected packets for ACL test, " -"expected %d, got %d\n" , +fprintf (stderr, +"%s: Unexpected packets for ACL test, expected %d, got %d\n" , __func__, expected_count, tx_count); goto fail; }
app/test/test_table_pipeline.c +20 -20
@@ -6,7 +6,6 @@#include <string.h> #include <rte_pipeline.h> -#include <rte_log.h> #include <inttypes.h> #include <rte_hexdump.h> #include "test_table.h"
@@ -173,30 +172,31 @@ check_pipeline_invalid_params(void) p =rte_pipeline_create (NULL );if (p !=NULL ) { -RTE_LOG (INFO ,PIPELINE , +fprintf (stderr,"%s: configured pipeline with null params\n" , __func__); goto fail; } p =rte_pipeline_create (&pipeline_params_1);if (p !=NULL ) { -RTE_LOG (INFO ,PIPELINE ,"%s: Configure pipeline with NULL " -"name\n" , __func__); +fprintf (stderr, +"%s: Configure pipeline with NULL name\n" , __func__); goto fail; } p =rte_pipeline_create (&pipeline_params_2);if (p !=NULL ) { -RTE_LOG (INFO ,PIPELINE ,"%s: Configure pipeline with invalid " -"socket\n" , __func__); +fprintf (stderr, +"%s: Configure pipeline with invalid socket\n" , __func__); goto fail; }if (rte_eal_has_hugepages ()) { p =rte_pipeline_create (&pipeline_params_3);if (p !=NULL ) { -RTE_LOG (INFO ,PIPELINE ,"%s: Configure pipeline with " -"invalid socket\n" , __func__); +fprintf (stderr, +"%s: Configure pipeline with invalid socket\n" , + __func__); goto fail; } }
@@ -224,20 +224,20 @@ setup_pipeline(int test_type) .socket_id = 0, }; -RTE_LOG (INFO ,PIPELINE ,"%s: **** Setting up %s test\n" , +fprintf (stderr,"%s: **** Setting up %s test\n" , __func__, pipeline_test_names[test_type]);/* Pipeline configuration */ p =rte_pipeline_create (&pipeline_params);if (p ==NULL ) { -RTE_LOG (INFO ,PIPELINE ,"%s: Failed to configure pipeline\n" , +fprintf (stderr,"%s: Failed to configure pipeline\n" , __func__); goto fail; } ret =rte_pipeline_free (p);if (ret !=0 ) { -RTE_LOG (INFO ,PIPELINE ,"%s: Failed to free pipeline\n" , +fprintf (stderr,"%s: Failed to free pipeline\n" , __func__); goto fail; }
@@ -245,7 +245,7 @@ setup_pipeline(int test_type)/* Pipeline configuration */ p =rte_pipeline_create (&pipeline_params);if (p ==NULL ) { -RTE_LOG (INFO ,PIPELINE ,"%s: Failed to configure pipeline\n" , +fprintf (stderr,"%s: Failed to configure pipeline\n" , __func__); goto fail; }
@@ -411,7 +411,7 @@ test_pipeline_single_filter(int test_type, int expected_count)int ret;int tx_count; -RTE_LOG (INFO ,PIPELINE ,"%s: **** Running %s test\n" , +fprintf (stderr,"%s: **** Running %s test\n" , __func__, pipeline_test_names[test_type]);/* Run pipeline once */ for (i =0 ; i <N_PORTS ; i++)
@@ -420,7 +420,7 @@ test_pipeline_single_filter(int test_type, int expected_count) ret =rte_pipeline_flush (NULL );if (ret != -EINVAL ) { -RTE_LOG (INFO ,PIPELINE , +fprintf (stderr,"%s: No pipeline flush error NULL pipeline (%d)\n" , __func__, ret); goto fail;
@@ -445,7 +445,7 @@ test_pipeline_single_filter(int test_type, int expected_count) k32 = (uint32_t *) key; k32[0 ] =0xadadadad >> (j %2 ); -RTE_LOG (INFO ,PIPELINE ,"%s: Enqueue onto ring %d\n" , +fprintf (stderr,"%s: Enqueue onto ring %d\n" , __func__, i);rte_ring_enqueue (rings_rx[i], m); }
@@ -487,9 +487,9 @@ test_pipeline_single_filter(int test_type, int expected_count) }if (tx_count != expected_count) { -RTE_LOG (INFO ,PIPELINE , -"%s: Unexpected packets out for %s test, expected %d, " -"got %d\n" , __func__, pipeline_test_names[test_type], +fprintf (stderr, +"%s: Unexpected packets out for %s test, expected %d, got %d\n" , + __func__, pipeline_test_names[test_type], expected_count, tx_count); goto fail; }
@@ -564,8 +564,8 @@ test_table_pipeline(void) connect_miss_action_to_table =0 ;if (check_pipeline_invalid_params ()) { -RTE_LOG (INFO ,PIPELINE ,"%s: Check pipeline invalid params " -"failed.\n" , __func__); +fprintf (stderr,"%s: Check pipeline invalid params failed.\n" , + __func__);return -1 ; }
Signature · 1 line
2.39.2
PATCH v13 21/21 pipeline: convert RTE_LOGTYPE_PIPELINE to dynamic type
In reply to Stephen HemmingerConvert RTE_LOGTYPE_PIPELINE to a dynamic value.
--- lib/log/log.c | 1 - lib/log/rte_log.h | 2 +- lib/pipeline/rte_pipeline.c | 2 ++ lib/pipeline/rte_pipeline.h | 5 +++++ 4 files changed, 8 insertions(+), 2 deletions(-)
lib/log/log.c +0 -1
@@ -353,7 +353,6 @@ struct logtype {static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL ,"lib.eal" }, {RTE_LOGTYPE_PMD ,"pmd" }, - {RTE_LOGTYPE_PIPELINE ,"lib.pipeline" }, {RTE_LOGTYPE_CRYPTODEV ,"lib.cryptodev" }, {RTE_LOGTYPE_EVENTDEV ,"lib.eventdev" }, {RTE_LOGTYPE_USER1 ,"user1" },
lib/log/rte_log.h +1 -1
@@ -41,7 +41,7 @@ extern "C" {/* was RTE_LOGTYPE_SCHED */ /* was RTE_LOGTYPE_PORT */ /* was RTE_LOGTYPE_TABLE */ -#define RTE_LOGTYPE_PIPELINE 15/**< Log related to pipeline. */ +/* was RTE_LOGTYPE_PIPELINE */ /* was RTE_LOGTYPE_MBUF */ #define RTE_LOGTYPE_CRYPTODEV 17/**< Log related to cryptodev. */ /* was RTE_LOGTYPE_EFD */
lib/pipeline/rte_pipeline.c +2 -0
@@ -1608,3 +1608,5 @@ int rte_pipeline_table_stats_read(struct rte_pipeline *p, uint32_t table_id,return 0 ; } + +RTE_LOG_REGISTER_DEFAULT (pipeline_logtype,INFO );
lib/pipeline/rte_pipeline.h +5 -0
@@ -833,6 +833,11 @@ int rte_pipeline_ah_packet_hijack(struct rte_pipeline *p,int rte_pipeline_ah_packet_drop (struct rte_pipeline *p,uint64_t pkts_mask); + +/** Internal Logtype used */ +extern int pipeline_logtype; +#define RTE_LOGTYPE_PIPELINE pipeline_logtype + #ifdef __cplusplus }#endif
Signature · 1 line
2.39.2
Re: [PATCH v13 00/21] Convert static log types in libraries to dynamic types
In reply to Stephen HemmingerQuoted 38 lines · Stephen Hemminger
This patchset removes most of the uses of static LOGTYPE's in DPDK libraries. It starts with the easy one and goes on to the more complex ones.
There are several options on how to treat the old static types:
leave them there, mark as deprecated, or remove them. This version removes them since there is no guarantee in current DPDK policies that says they can't be removed.Note: there is one patch in this series that will get flagged incorrectly as an ABI change.
v13 - rebase because log now moved.
v12 - rebase and add table and pipeline libraries
v11 - fix include check on arm cross build
v10 - add necessary
rte_compat.hinthash_gfnistub for armv9 - fix handling of crc32 alg in lib/hash.
make it an internal global variable.
fix gfni stubs for case where they are not used.Stephen Hemminger (21):
gso: don't log message on non TCP/UDP
eal: drop no longer used GSO logtype
log: drop unusedRTE_LOGTYPE_TIMER
efd: convertRTE_LOGTYPE_EFDto dynamic type
mbuf: convertRTE_LOGTYPE_MBUFto dynamic type
acl: convertRTE_LOGTYPE_ACLto dynamic type examples/power: replace use ofRTE_LOGTYPE_POWERexamples/l3fwd-power: replace use ofRTE_LOGTYPE_POWER
power: convertRTE_LOGTYPE_POWERto dynamic type
ring: convertRTE_LOGTYPE_RINGto dynamic type
mempool: convertRTE_LOGTYPE_MEMPOOLto dynamic type
lpm: convertRTE_LOGTYPE_LPMto dynamic types
sched: convertRTE_LOGTYPE_SCHEDto dynamic type
Quoted 9 lines
examples/ipsec-secgw: replace
RTE_LOGTYPE_PORT
port: convertRTE_LOGTYPE_PORTto dynamic type
hash: moverte_thash_gfnistubs out of header file
hash: moverte_hash_set_algout header
hash: convertRTE_LOGTYPE_HASHto dynamic type
table: convertRTE_LOGTYPE_TABLEto dynamic type app/test: remove use ofRTE_LOGTYPE_PIPELINE
pipeline: convertRTE_LOGTYPE_PIPELINEto dynamic type
This series needs some rebase.
Thanks.
Signature · 1 line
David Marchand
cover Convert static log types in libraries to dynamic
In reply to Stephen HemmingerThis patchset removes most of the uses of static LOGTYPE's in DPDK libraries. It starts with the easy one and goes on to the more complex ones.
There are several options on how to treat the old static types:
leave them there, mark as deprecated, or remove them. This version removes them since there is no guarantee in current DPDK policies that says they can't be removed.
Note: there is one patch in this series that will get flagged incorrectly as an ABI change.
v14 - rebase on 24.03-rc0
skip port, table and pipeline libraries since lots of to be deprecated code.
v13 - rebase because log now moved.
v12 - rebase and add table and pipeline libraries
v11 - fix include check on arm cross build
v10 - add necessary rte_compat.h in thash_gfni stub for arm
v9 - fix handling of crc32 alg in lib/hash.
make it an internal global variable.
fix gfni stubs for case where they are not used.
Stephen Hemminger (18):
gso: don't log message on non TCP/UDP
eal: drop no longer used GSO logtype
log: drop unused RTE_LOGTYPE_TIMER
efd: convert RTE_LOGTYPE_EFD to dynamic type
mbuf: convert RTE_LOGTYPE_MBUF to dynamic type
acl: convert RTE_LOGTYPE_ACL to dynamic type examples/power: replace use of RTE_LOGTYPE_POWER examples/l3fwd-power: replace use of RTE_LOGTYPE_POWER
power: convert RTE_LOGTYPE_POWER to dynamic type
ring: convert RTE_LOGTYPE_RING to dynamic type
mempool: convert RTE_LOGTYPE_MEMPOOL to dynamic type
lpm: convert RTE_LOGTYPE_LPM to dynamic types
sched: convert RTE_LOGTYPE_SCHED to dynamic type examples/ipsec-secgw: replace RTE_LOGTYPE_PORT app/test: remove use of RTE_LOGTYPE_PIPELINE
hash: mover rte_thash_gfni stubs out of header file
hash: move rte_hash_set_alg out of header file
hash: convert RTE_LOGTYPE_HASH to dynamic type
app/test/test_acl.c | 2 +- app/test/test_table_acl.c | 50 ++++++++++++------------- app/test/test_table_pipeline.c | 40 ++++++++++---------- examples/distributor/main.c | 2 +- examples/ipsec-secgw/sa.c | 6 +-- examples/l3fwd-power/main.c | 17 +++++---- lib/acl/acl.h | 1 + lib/acl/acl_bld.c | 3 ++ lib/acl/acl_gen.c | 1 + lib/acl/acl_log.h | 6 +++ lib/acl/rte_acl.c | 3 ++ lib/acl/tb_mem.c | 3 +- lib/efd/rte_efd.c | 4 ++ lib/fib/fib_log.h | 4 ++ lib/fib/rte_fib.c | 3 ++ lib/fib/rte_fib6.c | 2 + lib/gso/rte_gso.c | 4 +- lib/gso/rte_gso.h | 1 + lib/hash/meson.build | 9 ++++- lib/hash/rte_crc_arm64.h | 8 ++-- lib/hash/rte_crc_x86.h | 10 ++--- lib/hash/rte_cuckoo_hash.c | 5 +++ lib/hash/rte_fbk_hash.c | 5 +++ lib/hash/rte_hash_crc.c | 68 ++++++++++++++++++++++++++++++++++ lib/hash/rte_hash_crc.h | 48 ++---------------------- lib/hash/rte_thash.c | 3 ++ lib/hash/rte_thash_gfni.c | 50 +++++++++++++++++++++++++ lib/hash/rte_thash_gfni.h | 23 +++--------- lib/hash/version.map | 9 +++++ lib/log/log.c | 13 ------- lib/log/rte_log.h | 26 ++++++------- lib/lpm/lpm_log.h | 4 ++ lib/lpm/rte_lpm.c | 3 ++ lib/lpm/rte_lpm6.c | 1 + lib/mbuf/mbuf_log.h | 4 ++ lib/mbuf/rte_mbuf.c | 4 ++ lib/mbuf/rte_mbuf_dyn.c | 2 + lib/mbuf/rte_mbuf_pool_ops.c | 2 + lib/mempool/rte_mempool.c | 2 + lib/mempool/rte_mempool.h | 8 ++++ lib/mempool/version.map | 3 ++ lib/power/power_common.c | 2 + lib/power/power_common.h | 2 + lib/power/power_kvm_vm.c | 1 + lib/power/rte_power.c | 1 + lib/power/rte_power_uncore.c | 1 + lib/rib/rib_log.h | 4 ++ lib/rib/rte_rib.c | 3 ++ lib/rib/rte_rib6.c | 3 ++ lib/ring/rte_ring.c | 3 ++ lib/sched/rte_pie.c | 1 + lib/sched/rte_sched.c | 5 +++ lib/sched/rte_sched_log.h | 4 ++ 53 files changed, 329 insertions(+), 163 deletions(-) create mode 100644 lib/acl/acl_log.h create mode 100644 lib/fib/fib_log.h create mode 100644 lib/hash/rte_hash_crc.c create mode 100644 lib/hash/rte_thash_gfni.c create mode 100644 lib/lpm/lpm_log.h create mode 100644 lib/mbuf/mbuf_log.h create mode 100644 lib/rib/rib_log.h create mode 100644 lib/sched/rte_sched_log.h
Signature · 1 line
2.42.0
PATCH 1/18 gso: don't log message on non TCP/UDP
If a large packet is passed into GSO routines of unknown protocol then library would log a message.
Better to tell the application instead of logging.
--- lib/gso/rte_gso.c | 4 +--- lib/gso/rte_gso.h | 1 + 2 files changed, 2 insertions(+), 3 deletions(-)
lib/gso/rte_gso.c +1 -3
@@ -80,9 +80,7 @@ rte_gso_segment(struct rte_mbuf *pkt, ret =gso_udp4_segment (pkt, gso_size, direct_pool, indirect_pool, pkts_out, nb_pkts_out); }else { -/* unsupported packet, skip */ -RTE_LOG (DEBUG ,GSO ,"Unsupported packet type\n" ); - ret =0 ; + ret = -ENOTSUP ;/* only UDP or TCP allowed */ }if (ret <0 ) {
lib/gso/rte_gso.h +1 -0
@@ -114,6 +114,7 @@ struct rte_gso_ctx {* - The number of GSO segments filled in pkts_out on success. * - Return 0 if it does not need to be GSO'd. * - Return -ENOMEM if run out of memory in MBUF pools. +* - Return -ENOTSUP for protocols that can not be segmented * - Return -EINVAL for invalid parameters. */ int rte_gso_segment(struct rte_mbuf *pkt,
Signature · 1 line
2.42.0
PATCH 2/18 eal: drop no longer used GSO logtype
In reply to Stephen HemmingerThe message that used this was replaced in previous patch.
--- lib/log/log.c | 1 - lib/log/rte_log.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
lib/log/log.c +0 -1
@@ -370,7 +370,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_CRYPTODEV, "lib.cryptodev"}, {RTE_LOGTYPE_EFD, "lib.efd"}, {RTE_LOGTYPE_EVENTDEV, "lib.eventdev"}, - {RTE_LOGTYPE_GSO, "lib.gso"}, {RTE_LOGTYPE_USER1, "user1"}, {RTE_LOGTYPE_USER2, "user2"}, {RTE_LOGTYPE_USER3, "user3"},
lib/log/rte_log.h +1 -1
@@ -46,7 +46,7 @@ extern "C" {#define RTE_LOGTYPE_CRYPTODEV 17/**< Log related to cryptodev. */ #define RTE_LOGTYPE_EFD 18/**< Log related to EFD. */ #define RTE_LOGTYPE_EVENTDEV 19/**< Log related to eventdev. */ -#define RTE_LOGTYPE_GSO 20/**< Log related to GSO. */ +/* was RTE_LOGTYPE_GSO */ /* these log types can be used in an application */ #define RTE_LOGTYPE_USER1 24/**< User-defined log type 1. */
Signature · 1 line
2.42.0
PATCH 3/18 log: drop unused RTE_LOGTYPE_TIMER
In reply to Stephen HemmingerThe timer code does not use rte_log.
--- lib/log/log.c | 1 - lib/log/rte_log.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
lib/log/log.c +0 -1
@@ -355,7 +355,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_MALLOC, "lib.malloc"}, {RTE_LOGTYPE_RING, "lib.ring"}, {RTE_LOGTYPE_MEMPOOL, "lib.mempool"}, - {RTE_LOGTYPE_TIMER, "lib.timer"}, {RTE_LOGTYPE_PMD, "pmd"}, {RTE_LOGTYPE_HASH, "lib.hash"}, {RTE_LOGTYPE_LPM, "lib.lpm"},
lib/log/rte_log.h +1 -1
@@ -30,7 +30,7 @@ extern "C" {#define RTE_LOGTYPE_MALLOC 1/**< Log related to malloc. */ #define RTE_LOGTYPE_RING 2/**< Log related to ring. */ #define RTE_LOGTYPE_MEMPOOL 3/**< Log related to mempool. */ -#define RTE_LOGTYPE_TIMER 4/**< Log related to timers. */ +/* was RTE_LOGTYPE_TIMER */ #define RTE_LOGTYPE_PMD 5/**< Log related to poll mode driver. */ #define RTE_LOGTYPE_HASH 6/**< Log related to hash table. */ #define RTE_LOGTYPE_LPM 7/**< Log related to LPM. */
Signature · 1 line
2.42.0
PATCH 4/18 efd: convert RTE_LOGTYPE_EFD to dynamic type
In reply to Stephen HemmingerReplace all uses of the global logtype with a dynamic log type.
--- lib/efd/rte_efd.c | 4 ++++ lib/log/log.c | 1 - lib/log/rte_log.h | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-)
lib/efd/rte_efd.c +4 -0
@@ -9,6 +9,7 @@#include <errno.h> #include <sys/queue.h> +#include <rte_cpuflags.h> #include <rte_string_fns.h> #include <rte_log.h> #include <rte_eal_memconfig.h>
@@ -28,6 +29,9 @@#include "rte_efd_arm64.h" #endif +RTE_LOG_REGISTER_DEFAULT (efd_logtype,INFO ); +#define RTE_LOGTYPE_EFD efd_logtype +#define EFD_KEY (key_idx, table) (table->keys + ((key_idx) * table->key_len))/** Hash function used to determine chunk_id and bin_id for a group */ #define EFD_HASH (key, table) \
lib/log/log.c +0 -1
@@ -367,7 +367,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_PIPELINE, "lib.pipeline"}, {RTE_LOGTYPE_MBUF, "lib.mbuf"}, {RTE_LOGTYPE_CRYPTODEV, "lib.cryptodev"}, - {RTE_LOGTYPE_EFD, "lib.efd"}, {RTE_LOGTYPE_EVENTDEV, "lib.eventdev"}, {RTE_LOGTYPE_USER1, "user1"}, {RTE_LOGTYPE_USER2, "user2"},
lib/log/rte_log.h +1 -1
@@ -44,7 +44,7 @@ extern "C" {#define RTE_LOGTYPE_PIPELINE 15/**< Log related to pipeline. */ #define RTE_LOGTYPE_MBUF 16/**< Log related to mbuf. */ #define RTE_LOGTYPE_CRYPTODEV 17/**< Log related to cryptodev. */ -#define RTE_LOGTYPE_EFD 18/**< Log related to EFD. */ +/* was RTE_LOGTYPE_EFD */ #define RTE_LOGTYPE_EVENTDEV 19/**< Log related to eventdev. */ /* was RTE_LOGTYPE_GSO */
Signature · 1 line
2.42.0
PATCH 5/18 mbuf: convert RTE_LOGTYPE_MBUF to dynamic type
In reply to Stephen HemmingerIntroduce a new dynamic logtype for mbuf related messages. Since this is used in multiple files put one macro in mbuf_log.h
--- lib/log/log.c | 1 - lib/log/rte_log.h | 2 +- lib/mbuf/mbuf_log.h | 4 ++++ lib/mbuf/rte_mbuf.c | 4 ++++ lib/mbuf/rte_mbuf_dyn.c | 2 ++ lib/mbuf/rte_mbuf_pool_ops.c | 2 ++ 6 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 lib/mbuf/mbuf_log.h
lib/log/log.c +0 -1
@@ -365,7 +365,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_PORT, "lib.port"}, {RTE_LOGTYPE_TABLE, "lib.table"}, {RTE_LOGTYPE_PIPELINE, "lib.pipeline"}, - {RTE_LOGTYPE_MBUF, "lib.mbuf"}, {RTE_LOGTYPE_CRYPTODEV, "lib.cryptodev"}, {RTE_LOGTYPE_EVENTDEV, "lib.eventdev"}, {RTE_LOGTYPE_USER1, "user1"},
lib/log/rte_log.h +1 -1
@@ -42,7 +42,7 @@ extern "C" {#define RTE_LOGTYPE_PORT 13/**< Log related to port. */ #define RTE_LOGTYPE_TABLE 14/**< Log related to table. */ #define RTE_LOGTYPE_PIPELINE 15/**< Log related to pipeline. */ -#define RTE_LOGTYPE_MBUF 16/**< Log related to mbuf. */ +/* was RTE_LOGTYPE_MBUF */ #define RTE_LOGTYPE_CRYPTODEV 17/**< Log related to cryptodev. */ /* was RTE_LOGTYPE_EFD */ #define RTE_LOGTYPE_EVENTDEV 19/**< Log related to eventdev. */
lib/mbuf/mbuf_log.h new file +4 -0
@@ -0,0 +1,4 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ + +extern int mbuf_logtype; +#define RTE_LOGTYPE_MBUF mbuf_logtype
lib/mbuf/rte_mbuf.c +4 -0
@@ -20,6 +20,10 @@#include <rte_errno.h> #include <rte_memcpy.h> +#include "mbuf_log.h" + +RTE_LOG_REGISTER_DEFAULT (mbuf_logtype,INFO ); +/* * pktmbuf pool constructor, given as a callback function to * rte_mempool_create(), or called directly if using
lib/mbuf/rte_mbuf_dyn.c +2 -0
@@ -17,6 +17,8 @@#include <rte_mbuf.h> #include <rte_mbuf_dyn.h> +#include "mbuf_log.h" +#define RTE_MBUF_DYN_MZNAME "rte_mbuf_dyn"struct mbuf_dynfield_elt {
lib/mbuf/rte_mbuf_pool_ops.c +2 -0
@@ -8,6 +8,8 @@#include <rte_errno.h> #include <rte_mbuf_pool_ops.h> +#include "mbuf_log.h" +int rte_mbuf_set_platform_mempool_ops (const char *ops_name) {
Signature · 1 line
2.42.0
PATCH 6/18 acl: convert RTE_LOGTYPE_ACL to dynamic type
In reply to Stephen HemmingerGet rid of RTE_LOGTYPE_ACL and RTE_LOGTYPE_MALLOC. For ACL library use a dynamic type.
The one message using RTE_LOGTYPE_MALLOC should have been under the ACL logtype anyway.
The test code should not have been using fixed log type so just change that to stderr.
--- app/test/test_acl.c | 2 +- lib/acl/acl.h | 1 + lib/acl/acl_bld.c | 3 +++ lib/acl/acl_gen.c | 1 + lib/acl/acl_log.h | 6 ++++++ lib/acl/rte_acl.c | 3 +++ lib/acl/tb_mem.c | 3 ++- lib/log/log.c | 2 -- lib/log/rte_log.h | 4 ++-- 9 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 lib/acl/acl_log.h
app/test/test_acl.c +1 -1
@@ -154,7 +154,7 @@ rte_acl_ipv4vlan_add_rules(struct rte_acl_ctx *ctx,for (i =0 ; i != num; i++) { rc =acl_ipv4vlan_check_rule (rules + i);if (rc !=0 ) { -RTE_LOG (ERR ,ACL ,"%s: rule #%u is invalid\n" , +fprintf (stderr,"%s: rule #%u is invalid\n" , __func__, i +1 );return rc; }
lib/acl/acl.h +1 -0
@@ -225,6 +225,7 @@ int rte_acl_classify_altivec(const struct rte_acl_ctx *ctx, const uint8_t **data, uint32_t *results, uint32_t num, uint32_t categories); + #ifdef __cplusplus }#endif /* __cplusplus */
lib/acl/acl_bld.c +3 -0
@@ -3,8 +3,11 @@*/ #include <rte_acl.h> +#include <rte_log.h> +#include "tb_mem.h" #include "acl.h" +#include "acl_log.h" #define ACL_POOL_ALIGN 8#define ACL_POOL_ALLOC_MIN 0x800000
lib/acl/acl_gen.c +1 -0
@@ -4,6 +4,7 @@#include <rte_acl.h> #include "acl.h" +#include "acl_log.h" #define QRANGE_MIN ((uint8_t)INT8_MIN)
lib/acl/acl_log.h new file +6 -0
@@ -0,0 +1,6 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ + +#include <rte_log.h> + +extern int acl_logtype; +#define RTE_LOGTYPE_ACL acl_logtype
lib/acl/rte_acl.c +3 -0
@@ -8,6 +8,9 @@#include <rte_tailq.h> #include "acl.h" +#include "acl_log.h" + +RTE_LOG_REGISTER_DEFAULT (acl_logtype,INFO );TAILQ_HEAD (rte_acl_list, rte_tailq_entry);
lib/acl/tb_mem.c +2 -1
@@ -3,6 +3,7 @@*/ #include "tb_mem.h" +#include "acl_log.h" /* * Memory management routines for temporary memory.
@@ -25,7 +26,7 @@ tb_pool(struct tb_mem_pool *pool, size_t sz) size = sz + pool->alignment -1 ; block =calloc (1 , size +sizeof (*pool->block));if (block ==NULL ) { -RTE_LOG (ERR ,MALLOC ,"%s(%zu)\n failed, currently allocated " +RTE_LOG (ERR ,ACL ,"%s(%zu)\n failed, currently allocated " "by pool: %zu bytes\n" , __func__, sz, pool->alloc);siglongjmp (pool->fail, -ENOMEM );return NULL ;
lib/log/log.c +0 -2
@@ -352,13 +352,11 @@ struct logtype {static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL ,"lib.eal" }, - {RTE_LOGTYPE_MALLOC ,"lib.malloc" }, {RTE_LOGTYPE_RING ,"lib.ring" }, {RTE_LOGTYPE_MEMPOOL ,"lib.mempool" }, {RTE_LOGTYPE_PMD ,"pmd" }, {RTE_LOGTYPE_HASH ,"lib.hash" }, {RTE_LOGTYPE_LPM ,"lib.lpm" }, - {RTE_LOGTYPE_ACL ,"lib.acl" }, {RTE_LOGTYPE_POWER ,"lib.power" }, {RTE_LOGTYPE_METER ,"lib.meter" }, {RTE_LOGTYPE_SCHED ,"lib.sched" },
lib/log/rte_log.h +2 -2
@@ -27,7 +27,7 @@ extern "C" {/* SDK log type */ #define RTE_LOGTYPE_EAL 0/**< Log related to eal. */ -#define RTE_LOGTYPE_MALLOC 1/**< Log related to malloc. */ +/* was RTE_LOGTYPE_MALLOC */ #define RTE_LOGTYPE_RING 2/**< Log related to ring. */ #define RTE_LOGTYPE_MEMPOOL 3/**< Log related to mempool. */ /* was RTE_LOGTYPE_TIMER */
@@ -35,7 +35,7 @@ extern "C" {#define RTE_LOGTYPE_HASH 6/**< Log related to hash table. */ #define RTE_LOGTYPE_LPM 7/**< Log related to LPM. */ /* was RTE_LOGTYPE_KNI */ -#define RTE_LOGTYPE_ACL 9/**< Log related to ACL. */ +/* was RTE_LOGTYPE_ACL */ #define RTE_LOGTYPE_POWER 10/**< Log related to power. */ #define RTE_LOGTYPE_METER 11/**< Log related to QoS meter. */ #define RTE_LOGTYPE_SCHED 12/**< Log related to QoS port scheduler. */
Signature · 1 line
2.42.0
PATCH 7/18 examples/power: replace use of RTE_LOGTYPE_POWER
In reply to Stephen HemmingerDon't use static logtype in sample application.
--- examples/distributor/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
examples/distributor/main.c +1 -1
@@ -679,7 +679,7 @@ init_power_library(void)/* init power management library */ ret =rte_power_init (lcore_id);if (ret) { -RTE_LOG (ERR ,POWER , +fprintf (stderr,"Library initialization failed on core %u\n" , lcore_id);/*
Signature · 1 line
2.42.0
PATCH 8/18 examples/l3fwd-power: replace use of RTE_LOGTYPE_POWER
In reply to Stephen HemmingerConvert to using a dynamic logtype for the application.
--- examples/l3fwd-power/main.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
examples/l3fwd-power/main.c +9 -8
@@ -51,7 +51,8 @@#include "perf_core.h" #include "main.h" -#define RTE_LOGTYPE_L3FWD_POWER RTE_LOGTYPE_USER1 +RTE_LOG_REGISTER (l3fwd_power_logtype, l3fwd.power,INFO ); +#define RTE_LOGTYPE_L3FWD_POWER l3fwd_power_logtype#define MAX_PKT_BURST 32
@@ -2242,7 +2243,7 @@ init_power_library(void)/* init power management library */ ret =rte_power_init (lcore_id);if (ret) { -RTE_LOG (ERR ,POWER , +RTE_LOG (ERR ,L3FWD_POWER ,"Library initialization failed on core %u\n" , lcore_id);return ret;
@@ -2253,8 +2254,8 @@ init_power_library(void) env != PM_ENV_PSTATE_CPUFREQ && env != PM_ENV_AMD_PSTATE_CPUFREQ && env != PM_ENV_CPPC_CPUFREQ) { -RTE_LOG (ERR ,POWER , -"Only ACPI, PSTATE and CPPC mode are supported\n" ); +RTE_LOG (ERR ,L3FWD_POWER , +"Only ACPI and PSTATE mode are supported\n" );return -1 ; } }
@@ -2271,7 +2272,7 @@ deinit_power_library(void)/* deinit power management library */ ret =rte_power_exit (lcore_id);if (ret) { -RTE_LOG (ERR ,POWER , +RTE_LOG (ERR ,L3FWD_POWER ,"Library deinitialization failed on core %u\n" , lcore_id);return ret;
@@ -2340,7 +2341,7 @@ update_telemetry(__rte_unused struct rte_timer *tim, ret =rte_metrics_update_values (RTE_METRICS_GLOBAL , telstats_index, values,RTE_DIM (values));if (ret <0 ) -RTE_LOG (WARNING ,POWER ,"failed to update metrics\n" ); +RTE_LOG (WARNING ,L3FWD_POWER ,"failed to update metrics\n" ); } static int
@@ -2389,7 +2390,7 @@ launch_timer(unsigned int lcore_id) rte_get_main_lcore()); } -RTE_LOG (INFO ,POWER ,"Bring up the Timer\n" ); +RTE_LOG (INFO ,L3FWD_POWER ,"Bring up the Timer\n" );telemetry_setup_timer ();
@@ -2405,7 +2406,7 @@ launch_timer(unsigned int lcore_id) } } -RTE_LOG (INFO ,POWER ,"Timer_subsystem is done\n" ); +RTE_LOG (INFO ,L3FWD_POWER ,"Timer_subsystem is done\n" );return 0 ; }
Signature · 1 line
2.42.0
PATCH 9/18 power: convert RTE_LOGTYPE_POWER to dynamic type
In reply to Stephen HemmingerUse dynamic log type for power library.
--- lib/log/log.c | 1 - lib/log/rte_log.h | 2 +- lib/power/power_common.c | 2 ++ lib/power/power_common.h | 2 ++ lib/power/power_kvm_vm.c | 1 + lib/power/rte_power.c | 1 + lib/power/rte_power_uncore.c | 1 + 7 files changed, 8 insertions(+), 2 deletions(-)
lib/log/log.c +0 -1
@@ -357,7 +357,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_PMD, "pmd"}, {RTE_LOGTYPE_HASH, "lib.hash"}, {RTE_LOGTYPE_LPM, "lib.lpm"}, - {RTE_LOGTYPE_POWER, "lib.power"}, {RTE_LOGTYPE_METER, "lib.meter"}, {RTE_LOGTYPE_SCHED, "lib.sched"}, {RTE_LOGTYPE_PORT, "lib.port"},
lib/log/rte_log.h +1 -1
@@ -36,7 +36,7 @@ extern "C" {#define RTE_LOGTYPE_LPM 7/**< Log related to LPM. */ /* was RTE_LOGTYPE_KNI */ /* was RTE_LOGTYPE_ACL */ -#define RTE_LOGTYPE_POWER 10/**< Log related to power. */ +/* was RTE_LOGTYPE_POWER */ #define RTE_LOGTYPE_METER 11/**< Log related to QoS meter. */ #define RTE_LOGTYPE_SCHED 12/**< Log related to QoS port scheduler. */ #define RTE_LOGTYPE_PORT 13/**< Log related to port. */
lib/power/power_common.c +2 -0
@@ -12,6 +12,8 @@#include "power_common.h" +RTE_LOG_REGISTER_DEFAULT (power_logtype,INFO ); +#define POWER_SYSFILE_SCALING_DRIVER \ "/sys/devices/system/cpu/cpu%u/cpufreq/scaling_driver"#define POWER_SYSFILE_GOVERNOR \
lib/power/power_common.h +2 -0
@@ -10,6 +10,8 @@#define RTE_POWER_INVALID_FREQ_INDEX (~0) +extern int power_logtype; +#define RTE_LOGTYPE_POWER power_logtype#ifdef RTE_LIBRTE_POWER_DEBUG #define POWER_DEBUG_TRACE(fmt, args...) \
lib/power/power_kvm_vm.c +1 -0
@@ -8,6 +8,7 @@#include "rte_power_guest_channel.h" #include "guest_channel.h" +#include "power_common.h" #include "power_kvm_vm.h" #define FD_PATH "/dev/virtio-ports/virtio.serial.port.poweragent"
lib/power/rte_power.c +1 -0
@@ -10,6 +10,7 @@#include "rte_power.h" #include "power_acpi_cpufreq.h" #include "power_cppc_cpufreq.h" +#include "power_common.h" #include "power_kvm_vm.h" #include "power_pstate_cpufreq.h" #include "power_amd_pstate_cpufreq.h"
lib/power/rte_power_uncore.c +1 -0
@@ -8,6 +8,7 @@#include <rte_errno.h> #include <rte_spinlock.h> +#include "power_common.h" #include "rte_power_uncore.h" #include "power_intel_uncore.h"
Signature · 1 line
2.42.0
PATCH 10/18 ring: convert RTE_LOGTYPE_RING to dynamic type
In reply to Stephen HemmingerThe logtype for ring only used in library.
--- lib/log/log.c | 1 - lib/log/rte_log.h | 2 +- lib/ring/rte_ring.c | 3 +++ 3 files changed, 4 insertions(+), 2 deletions(-)
lib/log/log.c +0 -1
@@ -352,7 +352,6 @@ struct logtype {static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL ,"lib.eal" }, - {RTE_LOGTYPE_RING ,"lib.ring" }, {RTE_LOGTYPE_MEMPOOL ,"lib.mempool" }, {RTE_LOGTYPE_PMD ,"pmd" }, {RTE_LOGTYPE_HASH ,"lib.hash" },
lib/log/rte_log.h +1 -1
@@ -28,7 +28,7 @@ extern "C" {/* SDK log type */ #define RTE_LOGTYPE_EAL 0/**< Log related to eal. */ /* was RTE_LOGTYPE_MALLOC */ -#define RTE_LOGTYPE_RING 2/**< Log related to ring. */ +/* was RTE_LOGTYPE_RING */ #define RTE_LOGTYPE_MEMPOOL 3/**< Log related to mempool. */ /* was RTE_LOGTYPE_TIMER */ #define RTE_LOGTYPE_PMD 5/**< Log related to poll mode driver. */
lib/ring/rte_ring.c +3 -0
@@ -26,6 +26,9 @@#include "rte_ring.h" #include "rte_ring_elem.h" +RTE_LOG_REGISTER_DEFAULT (ring_logtype,INFO ); +#define RTE_LOGTYPE_RING ring_logtype +TAILQ_HEAD (rte_ring_list, rte_tailq_entry);static struct rte_tailq_elem rte_ring_tailq = {
Signature · 1 line
2.42.0
PATCH 11/18 mempool: convert RTE_LOGTYPE_MEMPOOL to dynamic type
In reply to Stephen HemmingerConvert from RTE_LOGTYPE_MEMPOOL to logtype_mempool.
--- lib/log/log.c | 1 - lib/log/rte_log.h | 2 +- lib/mempool/rte_mempool.c | 2 ++ lib/mempool/rte_mempool.h | 8 ++++++++ lib/mempool/version.map | 3 +++ 5 files changed, 14 insertions(+), 2 deletions(-)
lib/log/log.c +0 -1
@@ -352,7 +352,6 @@ struct logtype {static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL ,"lib.eal" }, - {RTE_LOGTYPE_MEMPOOL ,"lib.mempool" }, {RTE_LOGTYPE_PMD ,"pmd" }, {RTE_LOGTYPE_HASH ,"lib.hash" }, {RTE_LOGTYPE_LPM ,"lib.lpm" },
lib/log/rte_log.h +1 -1
@@ -29,7 +29,7 @@ extern "C" {#define RTE_LOGTYPE_EAL 0/**< Log related to eal. */ /* was RTE_LOGTYPE_MALLOC */ /* was RTE_LOGTYPE_RING */ -#define RTE_LOGTYPE_MEMPOOL 3/**< Log related to mempool. */ +/* was RTE_LOGTYPE_MEMPOOL */ /* was RTE_LOGTYPE_TIMER */ #define RTE_LOGTYPE_PMD 5/**< Log related to poll mode driver. */ #define RTE_LOGTYPE_HASH 6/**< Log related to hash table. */
lib/mempool/rte_mempool.c +2 -0
@@ -31,6 +31,8 @@#include "mempool_trace.h" #include "rte_mempool.h" +RTE_LOG_REGISTER_DEFAULT (rte_mempool_logtype,INFO ); +TAILQ_HEAD (rte_mempool_list, rte_tailq_entry);static struct rte_tailq_elem rte_mempool_tailq = {
lib/mempool/rte_mempool.h +8 -0
@@ -43,6 +43,7 @@#include <rte_spinlock.h> #include <rte_debug.h> #include <rte_lcore.h> +#include <rte_log.h> #include <rte_branch_prediction.h> #include <rte_ring.h> #include <rte_memcpy.h>
@@ -176,6 +177,13 @@ struct rte_mempool_objtlr {#endif + +/** +* @internal Logtype used for mempool related messages. +*/ +extern int rte_mempool_logtype; +#define RTE_LOGTYPE_MEMPOOL rte_mempool_logtype +/** * A list of memory where objects are stored */
lib/mempool/version.map +3 -0
@@ -57,4 +57,7 @@ INTERNAL { # added in 21.11 rte_mempool_event_callback_register; rte_mempool_event_callback_unregister; + + # added in 23.07 + rte_mempool_logtype; };
Signature · 1 line
2.42.0
PATCH 12/18 lpm: convert RTE_LOGTYPE_LPM to dynamic types
In reply to Stephen HemmingerSplit lpm and lpm6 into separate log types since they are in different files and user may want to change log levels for IPv4 vs IPv6.
For rib and fib libraries give them own types as well.
--- lib/fib/fib_log.h | 4 ++++ lib/fib/rte_fib.c | 3 +++ lib/fib/rte_fib6.c | 2 ++ lib/log/log.c | 1 - lib/log/rte_log.h | 2 +- lib/lpm/lpm_log.h | 4 ++++ lib/lpm/rte_lpm.c | 3 +++ lib/lpm/rte_lpm6.c | 1 + lib/rib/rib_log.h | 4 ++++ lib/rib/rte_rib.c | 3 +++ lib/rib/rte_rib6.c | 3 +++ 11 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 lib/fib/fib_log.h create mode 100644 lib/lpm/lpm_log.h create mode 100644 lib/rib/rib_log.h
lib/fib/fib_log.h new file +4 -0
@@ -0,0 +1,4 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ + +extern int fib_logtype; +#define RTE_LOGTYPE_LPM fib_logtype
lib/fib/rte_fib.c +3 -0
@@ -17,6 +17,9 @@#include <rte_fib.h> #include "dir24_8.h" +#include "fib_log.h" + +RTE_LOG_REGISTER_DEFAULT (fib_logtype,INFO );TAILQ_HEAD (rte_fib_list, rte_tailq_entry);static struct rte_tailq_elem rte_fib_tailq = {
lib/fib/rte_fib6.c +2 -0
@@ -10,6 +10,7 @@#include <rte_eal_memconfig.h> #include <rte_tailq.h> #include <rte_errno.h> +#include <rte_log.h> #include <rte_malloc.h> #include <rte_string_fns.h>
@@ -17,6 +18,7 @@#include <rte_fib6.h> #include "trie.h" +#include "fib_log.h" TAILQ_HEAD (rte_fib6_list, rte_tailq_entry);static struct rte_tailq_elem rte_fib6_tailq = {
lib/log/log.c +0 -1
@@ -354,7 +354,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL, "lib.eal"}, {RTE_LOGTYPE_PMD, "pmd"}, {RTE_LOGTYPE_HASH, "lib.hash"}, - {RTE_LOGTYPE_LPM, "lib.lpm"}, {RTE_LOGTYPE_METER, "lib.meter"}, {RTE_LOGTYPE_SCHED, "lib.sched"}, {RTE_LOGTYPE_PORT, "lib.port"},
lib/log/rte_log.h +1 -1
@@ -33,7 +33,7 @@ extern "C" {/* was RTE_LOGTYPE_TIMER */ #define RTE_LOGTYPE_PMD 5/**< Log related to poll mode driver. */ #define RTE_LOGTYPE_HASH 6/**< Log related to hash table. */ -#define RTE_LOGTYPE_LPM 7/**< Log related to LPM. */ +/* was RTE_LOGTYPE_LPM */ /* was RTE_LOGTYPE_KNI */ /* was RTE_LOGTYPE_ACL */ /* was RTE_LOGTYPE_POWER */
lib/lpm/lpm_log.h new file +4 -0
@@ -0,0 +1,4 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ + +extern int lpm_logtype; +#define RTE_LOGTYPE_LPM lpm_logtype
lib/lpm/rte_lpm.c +3 -0
@@ -18,6 +18,9 @@#include <rte_tailq.h> #include "rte_lpm.h" +#include "lpm_log.h" + +RTE_LOG_REGISTER_DEFAULT (lpm_logtype,INFO );TAILQ_HEAD (rte_lpm_list, rte_tailq_entry);
lib/lpm/rte_lpm6.c +1 -0
@@ -20,6 +20,7 @@#include <rte_tailq.h> #include "rte_lpm6.h" +#include "lpm_log.h" #define RTE_LPM6_TBL24_NUM_ENTRIES (1 << 24)#define RTE_LPM6_TBL8_GROUP_NUM_ENTRIES 256
lib/rib/rib_log.h new file +4 -0
@@ -0,0 +1,4 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ + +extern int rib_logtype; +#define RTE_LOGTYPE_LPM rib_logtype
lib/rib/rte_rib.c +3 -0
@@ -16,6 +16,9 @@#include <rte_rib.h> +RTE_LOG_REGISTER_DEFAULT (rib_logtype,INFO ); +#define RTE_LOGTYPE_LPM rib_logtype +TAILQ_HEAD (rte_rib_list, rte_tailq_entry);static struct rte_tailq_elem rte_rib_tailq = { .name ="RTE_RIB" ,
lib/rib/rte_rib6.c +3 -0
@@ -9,6 +9,7 @@#include <rte_eal_memconfig.h> #include <rte_errno.h> +#include <rte_log.h> #include <rte_malloc.h> #include <rte_mempool.h> #include <rte_string_fns.h>
@@ -16,6 +17,8 @@#include <rte_rib6.h> +#include "rib_log.h" +#define RTE_RIB_VALID_NODE 1#define RIB6_MAXDEPTH 128/* Maximum length of a RIB6 name. */
Signature · 1 line
2.42.0
PATCH 13/18 sched: convert RTE_LOGTYPE_SCHED to dynamic type
In reply to Stephen HemmingerAlso can remove unused RTE_LOGTYPE_METER
--- lib/log/log.c | 2 -- lib/log/rte_log.h | 4 ++-- lib/sched/rte_pie.c | 1 + lib/sched/rte_sched.c | 5 +++++ lib/sched/rte_sched_log.h | 4 ++++ 5 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 lib/sched/rte_sched_log.h
lib/log/log.c +0 -2
@@ -354,8 +354,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL, "lib.eal"}, {RTE_LOGTYPE_PMD, "pmd"}, {RTE_LOGTYPE_HASH, "lib.hash"}, - {RTE_LOGTYPE_METER, "lib.meter"}, - {RTE_LOGTYPE_SCHED, "lib.sched"}, {RTE_LOGTYPE_PORT, "lib.port"}, {RTE_LOGTYPE_TABLE, "lib.table"}, {RTE_LOGTYPE_PIPELINE, "lib.pipeline"},
lib/log/rte_log.h +2 -2
@@ -37,8 +37,8 @@ extern "C" {/* was RTE_LOGTYPE_KNI */ /* was RTE_LOGTYPE_ACL */ /* was RTE_LOGTYPE_POWER */ -#define RTE_LOGTYPE_METER 11/**< Log related to QoS meter. */ -#define RTE_LOGTYPE_SCHED 12/**< Log related to QoS port scheduler. */ +/* was RTE_LOGTYPE_METER */ +/* was RTE_LOGTYPE_SCHED */ #define RTE_LOGTYPE_PORT 13/**< Log related to port. */ #define RTE_LOGTYPE_TABLE 14/**< Log related to table. */ #define RTE_LOGTYPE_PIPELINE 15/**< Log related to pipeline. */
lib/sched/rte_pie.c +1 -0
@@ -6,6 +6,7 @@#include <stdlib.h> #include <string.h> +#include "rte_sched_log.h" #include "rte_pie.h" #ifdef __INTEL_COMPILER
lib/sched/rte_sched.c +5 -0
@@ -16,9 +16,12 @@#include <rte_reciprocal.h> #include "rte_sched.h" +#include "rte_sched_log.h" #include "rte_sched_common.h" +#include "rte_approx.h" +#ifdef __INTEL_COMPILER#pragma warning(disable:2259)/* conversion may lose significant bits */ #endif
@@ -2999,3 +3002,5 @@ rte_sched_port_dequeue(struct rte_sched_port *port, struct rte_mbuf **pkts, uintreturn count; } + +RTE_LOG_REGISTER_DEFAULT (sched_logtype,INFO );
lib/sched/rte_sched_log.h new file +4 -0
@@ -0,0 +1,4 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ + +extern int sched_logtype; +#define RTE_LOGTYPE_SCHED sched_logtype
Signature · 1 line
2.42.0
PATCH 14/18 examples/ipsec-secgw: replace RTE_LOGTYPE_PORT
In reply to Stephen HemmingerLooks like some code got copy/paste in to the IPSEC gateway example from another place. Shouldn't be using RTE_LOGTYPE_PORT here.
--- examples/ipsec-secgw/sa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
examples/ipsec-secgw/sa.c +3 -3
@@ -1128,7 +1128,7 @@ check_eth_dev_caps(uint16_t portid, uint32_t inbound, uint32_t tso)if (inbound) {if ((dev_info.rx_offload_capa &RTE_ETH_RX_OFFLOAD_SECURITY ) ==0 ) { -RTE_LOG (WARNING ,PORT , +RTE_LOG (WARNING ,IPSEC ,"hardware RX IPSec offload is not supported\n" );return -EINVAL ; }
@@ -1136,13 +1136,13 @@ check_eth_dev_caps(uint16_t portid, uint32_t inbound, uint32_t tso) }else {/* outbound */ if ((dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_SECURITY ) ==0 ) { -RTE_LOG (WARNING ,PORT , +RTE_LOG (WARNING ,IPSEC ,"hardware TX IPSec offload is not supported\n" );return -EINVAL ; }if (tso && (dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_TCP_TSO ) ==0 ) { -RTE_LOG (WARNING ,PORT , +RTE_LOG (WARNING ,IPSEC ,"hardware TCP TSO offload is not supported\n" );return -EINVAL ; }
Signature · 1 line
2.42.0
PATCH 15/18 app/test: remove use of RTE_LOGTYPE_PIPELINE
In reply to Stephen HemmingerInstead of using static type PIPELINE for logging in test application use stderr instead. If not testing RTE_LOG() better to not use it since log also goes to syslog.
--- app/test/test_table_acl.c | 50 ++++++++++++++++------------------ app/test/test_table_pipeline.c | 40 +++++++++++++-------------- 2 files changed, 43 insertions(+), 47 deletions(-)
app/test/test_table_acl.c +23 -27
@@ -165,7 +165,7 @@ parse_cb_ipv4_rule(char *str, struct rte_table_acl_rule_add_params *v) &v->field_value[SRC_FIELD_IPV4 ].value.u32, &v->field_value[SRC_FIELD_IPV4].mask_range.u32);if (rc !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"failed to read src address/mask: %s\n" , +fprintf (stderr,"failed to read src address/mask: %s\n" , in[CB_FLD_SRC_ADDR ]);return rc; }
@@ -178,7 +178,7 @@ parse_cb_ipv4_rule(char *str, struct rte_table_acl_rule_add_params *v) &v->field_value[DST_FIELD_IPV4 ].value.u32, &v->field_value[DST_FIELD_IPV4].mask_range.u32);if (rc !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"failed to read dest address/mask: %s\n" , +fprintf (stderr,"failed to read dest address/mask: %s\n" , in[CB_FLD_DST_ADDR ]);return rc; }
@@ -190,7 +190,7 @@ parse_cb_ipv4_rule(char *str, struct rte_table_acl_rule_add_params *v) &v->field_value[SRCP_FIELD_IPV4 ].value.u16, &v->field_value[SRCP_FIELD_IPV4].mask_range.u16);if (rc !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"failed to read source port range: %s\n" , +fprintf (stderr,"failed to read source port range: %s\n" , in[CB_FLD_SRC_PORT_RANGE ]);return rc; }
@@ -202,7 +202,7 @@ parse_cb_ipv4_rule(char *str, struct rte_table_acl_rule_add_params *v) &v->field_value[DSTP_FIELD_IPV4 ].value.u16, &v->field_value[DSTP_FIELD_IPV4].mask_range.u16);if (rc !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"failed to read dest port range: %s\n" , +fprintf (stderr,"failed to read dest port range: %s\n" , in[CB_FLD_DST_PORT_RANGE ]);return rc; }
@@ -254,7 +254,7 @@ parse_cb_ipv4_rule_del(char *str, struct rte_table_acl_rule_delete_params *v) &v->field_value[SRC_FIELD_IPV4 ].value.u32, &v->field_value[SRC_FIELD_IPV4].mask_range.u32);if (rc !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"failed to read src address/mask: %s\n" , +fprintf (stderr,"failed to read src address/mask: %s\n" , in[CB_FLD_SRC_ADDR ]);return rc; }
@@ -267,7 +267,7 @@ parse_cb_ipv4_rule_del(char *str, struct rte_table_acl_rule_delete_params *v) &v->field_value[DST_FIELD_IPV4 ].value.u32, &v->field_value[DST_FIELD_IPV4].mask_range.u32);if (rc !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"failed to read dest address/mask: %s\n" , +fprintf (stderr,"failed to read dest address/mask: %s\n" , in[CB_FLD_DST_ADDR ]);return rc; }
@@ -279,7 +279,7 @@ parse_cb_ipv4_rule_del(char *str, struct rte_table_acl_rule_delete_params *v) &v->field_value[SRCP_FIELD_IPV4 ].value.u16, &v->field_value[SRCP_FIELD_IPV4].mask_range.u16);if (rc !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"failed to read source port range: %s\n" , +fprintf (stderr,"failed to read source port range: %s\n" , in[CB_FLD_SRC_PORT_RANGE ]);return rc; }
@@ -291,7 +291,7 @@ parse_cb_ipv4_rule_del(char *str, struct rte_table_acl_rule_delete_params *v) &v->field_value[DSTP_FIELD_IPV4 ].value.u16, &v->field_value[DSTP_FIELD_IPV4].mask_range.u16);if (rc !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"failed to read dest port range: %s\n" , +fprintf (stderr,"failed to read dest port range: %s\n" , in[CB_FLD_DST_PORT_RANGE ]);return rc; }
@@ -346,7 +346,7 @@ setup_acl_pipeline(void)/* Pipeline configuration */ p =rte_pipeline_create (&pipeline_params);if (p ==NULL ) { -RTE_LOG (INFO ,PIPELINE ,"%s: Failed to configure pipeline\n" , +fprintf (stderr,"%s: Failed to configure pipeline\n" , __func__); goto fail; }
@@ -410,7 +410,7 @@ setup_acl_pipeline(void) table_params.f_action_miss =NULL ; table_params.action_data_size =0 ; -RTE_LOG (INFO ,PIPELINE ,"miss_action=%x\n" , +printf ("miss_action=%x\n" , table_entry_miss_action); printf("RTE_ACL_RULE_SZ(%zu) = %zu\n", DIM(ipv4_defs),
@@ -471,9 +471,8 @@ setup_acl_pipeline(void) ret =parser (line, &keys[n]);if (ret !=0 ) { -RTE_LOG (ERR ,PIPELINE , -"line %u: parse_cb_ipv4vlan_rule" -" failed, error code: %d (%s)\n" , +fprintf (stderr, +"line %u: parse_cb_ipv4vlan_rule failed, error code: %d (%s)\n" , n, ret,strerror (-ret));return ret; }
@@ -513,9 +512,8 @@ setup_acl_pipeline(void) ret =parse_cb_ipv4_rule_del (line, &keys[n]);if (ret !=0 ) { -RTE_LOG (ERR ,PIPELINE , -"line %u: parse_cb_ipv4vlan_rule" -" failed, error code: %d (%s)\n" , +fprintf (stderr, +"line %u: parse_cb_ipv4vlan_rule failed, error code: %d (%s)\n" , n, ret,strerror (-ret));return ret; }
@@ -549,9 +547,8 @@ setup_acl_pipeline(void) ret =parser (line, &rule_params);if (ret !=0 ) { -RTE_LOG (ERR ,PIPELINE , -"line %u: parse_cb_ipv4vlan_rule" -" failed, error code: %d (%s)\n" , +fprintf (stderr, +"line %u: parse_cb_ipv4vlan_rule failed, error code: %d (%s)\n" , n, ret,strerror (-ret));return ret; }
@@ -575,8 +572,8 @@ setup_acl_pipeline(void) ret =parser (line, &rule_params);if (ret !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"line %u: parse rule " -" failed, error code: %d (%s)\n" , +fprintf (stderr, +"line %u: parse rule failed, error code: %d (%s)\n" , n, ret,strerror (-ret));return ret; }
@@ -602,8 +599,8 @@ setup_acl_pipeline(void) ret =parser (line, &rule_params);if (ret !=0 ) { -RTE_LOG (ERR ,PIPELINE ,"line %u: parse rule" -" failed, error code: %d (%s)\n" , +fprintf (stderr, +"line %u: parse rule failed, error code: %d (%s)\n" , n, ret,strerror (-ret));return ret; }
@@ -667,7 +664,7 @@ test_pipeline_single_filter(int expected_count) memcpy(rte_pktmbuf_mtod(mbuf, char *), &five_tuple, sizeof(struct ipv4_5tuple)); -RTE_LOG (INFO ,PIPELINE ,"%s: Enqueue onto ring %d\n" , +printf ("%s: Enqueue onto ring %d\n" , __func__, i);rte_ring_enqueue (rings_rx[i], mbuf); }
@@ -702,9 +699,8 @@ test_pipeline_single_filter(int expected_count) }if (tx_count != expected_count) { -RTE_LOG (INFO ,PIPELINE , -"%s: Unexpected packets for ACL test, " -"expected %d, got %d\n" , +fprintf (stderr, +"%s: Unexpected packets for ACL test, expected %d, got %d\n" , __func__, expected_count, tx_count); goto fail; }
app/test/test_table_pipeline.c +20 -20
@@ -6,7 +6,6 @@#include <string.h> #include <rte_pipeline.h> -#include <rte_log.h> #include <inttypes.h> #include <rte_hexdump.h> #include "test_table.h"
@@ -173,30 +172,31 @@ check_pipeline_invalid_params(void) p =rte_pipeline_create (NULL );if (p !=NULL ) { -RTE_LOG (INFO ,PIPELINE , +fprintf (stderr,"%s: configured pipeline with null params\n" , __func__); goto fail; } p =rte_pipeline_create (&pipeline_params_1);if (p !=NULL ) { -RTE_LOG (INFO ,PIPELINE ,"%s: Configure pipeline with NULL " -"name\n" , __func__); +fprintf (stderr, +"%s: Configure pipeline with NULL name\n" , __func__); goto fail; } p =rte_pipeline_create (&pipeline_params_2);if (p !=NULL ) { -RTE_LOG (INFO ,PIPELINE ,"%s: Configure pipeline with invalid " -"socket\n" , __func__); +fprintf (stderr, +"%s: Configure pipeline with invalid socket\n" , __func__); goto fail; }if (rte_eal_has_hugepages ()) { p =rte_pipeline_create (&pipeline_params_3);if (p !=NULL ) { -RTE_LOG (INFO ,PIPELINE ,"%s: Configure pipeline with " -"invalid socket\n" , __func__); +fprintf (stderr, +"%s: Configure pipeline with invalid socket\n" , + __func__); goto fail; } }
@@ -224,20 +224,20 @@ setup_pipeline(int test_type) .socket_id = 0, }; -RTE_LOG (INFO ,PIPELINE ,"%s: **** Setting up %s test\n" , +fprintf (stderr,"%s: **** Setting up %s test\n" , __func__, pipeline_test_names[test_type]);/* Pipeline configuration */ p =rte_pipeline_create (&pipeline_params);if (p ==NULL ) { -RTE_LOG (INFO ,PIPELINE ,"%s: Failed to configure pipeline\n" , +fprintf (stderr,"%s: Failed to configure pipeline\n" , __func__); goto fail; } ret =rte_pipeline_free (p);if (ret !=0 ) { -RTE_LOG (INFO ,PIPELINE ,"%s: Failed to free pipeline\n" , +fprintf (stderr,"%s: Failed to free pipeline\n" , __func__); goto fail; }
@@ -245,7 +245,7 @@ setup_pipeline(int test_type)/* Pipeline configuration */ p =rte_pipeline_create (&pipeline_params);if (p ==NULL ) { -RTE_LOG (INFO ,PIPELINE ,"%s: Failed to configure pipeline\n" , +fprintf (stderr,"%s: Failed to configure pipeline\n" , __func__); goto fail; }
@@ -411,7 +411,7 @@ test_pipeline_single_filter(int test_type, int expected_count)int ret;int tx_count; -RTE_LOG (INFO ,PIPELINE ,"%s: **** Running %s test\n" , +fprintf (stderr,"%s: **** Running %s test\n" , __func__, pipeline_test_names[test_type]);/* Run pipeline once */ for (i =0 ; i <N_PORTS ; i++)
@@ -420,7 +420,7 @@ test_pipeline_single_filter(int test_type, int expected_count) ret =rte_pipeline_flush (NULL );if (ret != -EINVAL ) { -RTE_LOG (INFO ,PIPELINE , +fprintf (stderr,"%s: No pipeline flush error NULL pipeline (%d)\n" , __func__, ret); goto fail;
@@ -445,7 +445,7 @@ test_pipeline_single_filter(int test_type, int expected_count) k32 = (uint32_t *) key; k32[0 ] =0xadadadad >> (j %2 ); -RTE_LOG (INFO ,PIPELINE ,"%s: Enqueue onto ring %d\n" , +fprintf (stderr,"%s: Enqueue onto ring %d\n" , __func__, i);rte_ring_enqueue (rings_rx[i], m); }
@@ -487,9 +487,9 @@ test_pipeline_single_filter(int test_type, int expected_count) }if (tx_count != expected_count) { -RTE_LOG (INFO ,PIPELINE , -"%s: Unexpected packets out for %s test, expected %d, " -"got %d\n" , __func__, pipeline_test_names[test_type], +fprintf (stderr, +"%s: Unexpected packets out for %s test, expected %d, got %d\n" , + __func__, pipeline_test_names[test_type], expected_count, tx_count); goto fail; }
@@ -564,8 +564,8 @@ test_table_pipeline(void) connect_miss_action_to_table =0 ;if (check_pipeline_invalid_params ()) { -RTE_LOG (INFO ,PIPELINE ,"%s: Check pipeline invalid params " -"failed.\n" , __func__); +fprintf (stderr,"%s: Check pipeline invalid params failed.\n" , + __func__);return -1 ; }
Signature · 1 line
2.42.0
PATCH 16/18 hash: mover rte_thash_gfni stubs out of header file
In reply to Stephen HemmingerHaving stubs in header file makes it harder to update RTE_LOG(). Also modify to only print warning once.
--- lib/hash/meson.build | 8 ++++++- lib/hash/rte_thash_gfni.c | 47 +++++++++++++++++++++++++++++++++++++++ lib/hash/rte_thash_gfni.h | 23 +++++-------------- lib/hash/version.map | 2 ++ 4 files changed, 61 insertions(+), 19 deletions(-) create mode 100644 lib/hash/rte_thash_gfni.c
lib/hash/meson.build +7 -1
@@ -17,7 +17,13 @@ indirect_headers += files( 'rte_thash_x86_gfni.h', ) -sources = files('rte_cuckoo_hash.c', 'rte_fbk_hash.c', 'rte_thash.c') +sources = files( + 'rte_cuckoo_hash.c', + 'rte_fbk_hash.c', + 'rte_thash.c', + 'rte_thash_gfni.c' +) + deps += ['net'] deps += ['ring'] deps += ['rcu']
lib/hash/rte_thash_gfni.c new file +47 -0
47 lines not on this page · raw message
lib/hash/rte_thash_gfni.h +5 -18
@@ -33,13 +33,8 @@ extern "C" {* @return * Calculated Toeplitz hash value. */ -static inline uint32_t -rte_thash_gfni(const uint64_t *mtrx __rte_unused, - const uint8_t *key __rte_unused, int len __rte_unused) -{ -RTE_LOG (ERR ,HASH ,"%s is undefined under given arch\n" , __func__); -return 0 ; -} +uint32_t +rte_thash_gfni (const uint64_t *mtrx,const uint8_t *key,int len);/** * Bulk implementation for Toeplitz hash.
@@ -58,17 +53,9 @@ rte_thash_gfni(const uint64_t *mtrx __rte_unused,* @param num * Number of tuples to hash. */ -static inline void -rte_thash_gfni_bulk(const uint64_t *mtrx __rte_unused, - int len __rte_unused, uint8_t *tuple[] __rte_unused, -uint32_t val[],uint32_t num) -{ -unsigned int i; - -RTE_LOG (ERR ,HASH ,"%s is undefined under given arch\n" , __func__); -for (i =0 ; i < num; i++) - val[i] =0 ; -} +void +rte_thash_gfni_bulk (const uint64_t *mtrx,int len,uint8_t *tuple[], +uint32_t val[],uint32_t num);#endif /* RTE_THASH_GFNI_DEFINED */
lib/hash/version.map +2 -0
@@ -39,6 +39,8 @@ DPDK_24 { rte_thash_get_gfni_matrices; rte_thash_get_helper; rte_thash_get_key; + rte_thash_gfni; + rte_thash_gfni_bulk; rte_thash_gfni_supported; rte_thash_init_ctx;
Signature · 1 line
2.42.0
PATCH 17/18 hash: move rte_hash_set_alg out of header file
In reply to Stephen HemmingerThe code for setting algorithm for hash is not at all perf sensitive, and doing it inline has a couple of problems. First, it means that if multiple files include the header, then the initialization gets done multiple times. But also, it makes it harder to fix usage of RTE_LOG().
Despite what the checking script say. This is not an ABI change, the previous version inlined the same code; therefore both old and new code will work the same.
--- lib/hash/meson.build | 1 + lib/hash/rte_crc_arm64.h | 8 ++--- lib/hash/rte_crc_x86.h | 10 +++--- lib/hash/rte_hash_crc.c | 68 ++++++++++++++++++++++++++++++++++++++++ lib/hash/rte_hash_crc.h | 48 ++-------------------------- lib/hash/version.map | 7 +++++ 6 files changed, 88 insertions(+), 54 deletions(-) create mode 100644 lib/hash/rte_hash_crc.c
lib/hash/meson.build +1 -0
@@ -19,6 +19,7 @@ indirect_headers += files( sources = files( 'rte_cuckoo_hash.c', + 'rte_hash_crc.c', 'rte_fbk_hash.c', 'rte_thash.c', 'rte_thash_gfni.c'
lib/hash/rte_crc_arm64.h +4 -4
@@ -53,7 +53,7 @@ crc32c_arm64_u64(uint64_t data, uint32_t init_val)static inline uint32_t rte_hash_crc_1byte (uint8_t data,uint32_t init_val) { -if (likely (crc32_alg &CRC32_ARM64 )) +if (likely (rte_hash_crc32_alg &CRC32_ARM64 ))return crc32c_arm64_u8 (data, init_val);return crc32c_1byte (data, init_val);
@@ -67,7 +67,7 @@ rte_hash_crc_1byte(uint8_t data, uint32_t init_val)static inline uint32_t rte_hash_crc_2byte (uint16_t data,uint32_t init_val) { -if (likely (crc32_alg &CRC32_ARM64 )) +if (likely (rte_hash_crc32_alg &CRC32_ARM64 ))return crc32c_arm64_u16 (data, init_val);return crc32c_2bytes (data, init_val);
@@ -81,7 +81,7 @@ rte_hash_crc_2byte(uint16_t data, uint32_t init_val)static inline uint32_t rte_hash_crc_4byte (uint32_t data,uint32_t init_val) { -if (likely (crc32_alg &CRC32_ARM64 )) +if (likely (rte_hash_crc32_alg &CRC32_ARM64 ))return crc32c_arm64_u32 (data, init_val);return crc32c_1word (data, init_val);
@@ -95,7 +95,7 @@ rte_hash_crc_4byte(uint32_t data, uint32_t init_val)static inline uint32_t rte_hash_crc_8byte (uint64_t data,uint32_t init_val) { -if (likely (crc32_alg &CRC32_ARM64 )) +if (likely (rte_hash_crc32_alg &CRC32_ARM64 ))return crc32c_arm64_u64 (data, init_val);return crc32c_2words (data, init_val);
lib/hash/rte_crc_x86.h +5 -5
@@ -67,7 +67,7 @@ crc32c_sse42_u64(uint64_t data, uint64_t init_val)static inline uint32_t rte_hash_crc_1byte (uint8_t data,uint32_t init_val) { -if (likely (crc32_alg &CRC32_SSE42 )) +if (likely (rte_hash_crc32_alg &CRC32_SSE42 ))return crc32c_sse42_u8 (data, init_val);return crc32c_1byte (data, init_val);
@@ -81,7 +81,7 @@ rte_hash_crc_1byte(uint8_t data, uint32_t init_val)static inline uint32_t rte_hash_crc_2byte (uint16_t data,uint32_t init_val) { -if (likely (crc32_alg &CRC32_SSE42 )) +if (likely (rte_hash_crc32_alg &CRC32_SSE42 ))return crc32c_sse42_u16 (data, init_val);return crc32c_2bytes (data, init_val);
@@ -95,7 +95,7 @@ rte_hash_crc_2byte(uint16_t data, uint32_t init_val)static inline uint32_t rte_hash_crc_4byte (uint32_t data,uint32_t init_val) { -if (likely (crc32_alg &CRC32_SSE42 )) +if (likely (rte_hash_crc32_alg &CRC32_SSE42 ))return crc32c_sse42_u32 (data, init_val);return crc32c_1word (data, init_val);
@@ -110,11 +110,11 @@ static inline uint32_t rte_hash_crc_8byte(uint64_t data, uint32_t init_val) {#ifdef RTE_ARCH_X86_64 -if (likely (crc32_alg == CRC32_SSE42_x64)) +if (likely (rte_hash_crc32_alg == CRC32_SSE42_x64))return crc32c_sse42_u64 (data, init_val);#endif -if (likely (crc32_alg &CRC32_SSE42 )) +if (likely (rte_hash_crc32_alg &CRC32_SSE42 ))return crc32c_sse42_u64_mimic (data, init_val);return crc32c_2words (data, init_val);
lib/hash/rte_hash_crc.c new file +68 -0
68 lines not on this page · raw message
lib/hash/rte_hash_crc.h +3 -45
66 lines not on this page · raw message
lib/hash/version.map +7 -0
@@ -9,6 +9,7 @@ DPDK_24 { rte_hash_add_key_with_hash; rte_hash_add_key_with_hash_data; rte_hash_count; + rte_hash_crc_set_alg; rte_hash_create; rte_hash_del_key; rte_hash_del_key_with_hash;
@@ -46,3 +47,9 @@ DPDK_24 { local: *; }; + +INTERNAL { + global: + + rte_hash_crc32_alg; +};
Signature · 1 line
2.42.0
PATCH 18/18 hash: convert RTE_LOGTYPE_HASH to dynamic type
In reply to Stephen HemmingerUse dynamic type for hash and add subtypes for crc and gfni.
--- lib/hash/rte_cuckoo_hash.c | 5 +++++ lib/hash/rte_fbk_hash.c | 5 +++++ lib/hash/rte_thash.c | 3 +++ lib/hash/rte_thash_gfni.c | 3 +++ lib/log/log.c | 1 - lib/log/rte_log.h | 2 +- 6 files changed, 17 insertions(+), 2 deletions(-)
lib/hash/rte_cuckoo_hash.c +5 -0
@@ -24,6 +24,11 @@#include <rte_tailq.h> #include "rte_hash.h" + +/* needs to be before rte_cuckoo_hash.h */ +RTE_LOG_REGISTER_DEFAULT (hash_logtype,INFO ); +#define RTE_LOGTYPE_HASH hash_logtype +#include "rte_cuckoo_hash.h" /* Mask of all flags supported by this version */
lib/hash/rte_fbk_hash.c +5 -0
@@ -8,6 +8,8 @@#include <errno.h> #include <sys/queue.h> + +#include <rte_cpuflags.h> #include <rte_eal_memconfig.h> #include <rte_malloc.h> #include <rte_common.h>
@@ -18,6 +20,9 @@#include "rte_fbk_hash.h" +RTE_LOG_REGISTER_SUFFIX (fbk_hash_logtype, fbk,INFO ); +#define RTE_LOGTYPE_HASH fbk_hash_logtype +TAILQ_HEAD (rte_fbk_hash_list, rte_tailq_entry);static struct rte_tailq_elem rte_fbk_hash_tailq = {
lib/hash/rte_thash.c +3 -0
@@ -13,6 +13,9 @@#include <rte_log.h> #include <rte_malloc.h> +RTE_LOG_REGISTER_SUFFIX (thash_logtype, thash,INFO ); +#define RTE_LOGTYPE_HASH thash_logtype +#define THASH_NAME_LEN 64#define TOEPLITZ_HASH_LEN 32
lib/hash/rte_thash_gfni.c +3 -0
@@ -10,6 +10,9 @@#ifndef RTE_THASH_GFNI_DEFINED +RTE_LOG_REGISTER_SUFFIX (hash_gfni_logtype, gfni,INFO ); +#define RTE_LOGTYPE_HASH hash_gfni_logtype +uint32_t rte_thash_gfni(const uint64_t *mtrx __rte_unused, const uint8_t *key __rte_unused, int len __rte_unused)
lib/log/log.c +0 -1
@@ -353,7 +353,6 @@ struct logtype {static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL ,"lib.eal" }, {RTE_LOGTYPE_PMD ,"pmd" }, - {RTE_LOGTYPE_HASH ,"lib.hash" }, {RTE_LOGTYPE_PORT ,"lib.port" }, {RTE_LOGTYPE_TABLE ,"lib.table" }, {RTE_LOGTYPE_PIPELINE ,"lib.pipeline" },
lib/log/rte_log.h +1 -1
@@ -32,7 +32,7 @@ extern "C" {/* was RTE_LOGTYPE_MEMPOOL */ /* was RTE_LOGTYPE_TIMER */ #define RTE_LOGTYPE_PMD 5/**< Log related to poll mode driver. */ -#define RTE_LOGTYPE_HASH 6/**< Log related to hash table. */ +/* was RTE_LOGTYPE_HASH */ /* was RTE_LOGTYPE_LPM */ /* was RTE_LOGTYPE_KNI */ /* was RTE_LOGTYPE_ACL */
Signature · 1 line
2.42.0
Re: [PATCH 00/18] Convert static log types in libraries to dynamic
In reply to Stephen HemmingerQuoted 8 lines · Stephen Hemminger
This patchset removes most of the uses of static LOGTYPE's in DPDK libraries. It starts with the easy one and goes on to the more complex ones.
There are several options on how to treat the old static types:
leave them there, mark as deprecated, or remove them. This version removes them since there is no guarantee in current DPDK policies that says they can't be removed.
Those logtypes were internal things that should not have been public in the first place.
And switching to a dynamic logtype for external users (if any) is trivial.
Quoted 3 lines
Note: there is one patch in this series that will get flagged incorrectly as an ABI change.
Adding such stable symbols is not a problem.
We can ignore this warning (which is there to force maintainers to inspect such additions).
Quoted 91 lines
v14 - rebase on 24.03-rc0
skip port, table and pipeline libraries since lots of to be deprecated code.v13 - rebase because log now moved.
v12 - rebase and add table and pipeline libraries
v11 - fix include check on arm cross build
v10 - add necessary
rte_compat.hinthash_gfnistub for armv9 - fix handling of crc32 alg in lib/hash.
make it an internal global variable.
fix gfni stubs for case where they are not used.Stephen Hemminger (18):
gso: don't log message on non TCP/UDP
eal: drop no longer used GSO logtype
log: drop unusedRTE_LOGTYPE_TIMER
efd: convertRTE_LOGTYPE_EFDto dynamic type
mbuf: convertRTE_LOGTYPE_MBUFto dynamic type
acl: convertRTE_LOGTYPE_ACLto dynamic type examples/power: replace use ofRTE_LOGTYPE_POWERexamples/l3fwd-power: replace use ofRTE_LOGTYPE_POWER
power: convertRTE_LOGTYPE_POWERto dynamic type
ring: convertRTE_LOGTYPE_RINGto dynamic type
mempool: convertRTE_LOGTYPE_MEMPOOLto dynamic type
lpm: convertRTE_LOGTYPE_LPMto dynamic types
sched: convertRTE_LOGTYPE_SCHEDto dynamic type examples/ipsec-secgw: replaceRTE_LOGTYPE_PORTapp/test: remove use ofRTE_LOGTYPE_PIPELINE
hash: moverrte_thash_gfnistubs out of header file
hash: moverte_hash_set_algout of header file
hash: convertRTE_LOGTYPE_HASHto dynamic typeapp/test/test_acl.c | 2 +- app/test/test_table_acl.c | 50 ++++++++++++------------- app/test/test_table_pipeline.c | 40 ++++++++++---------- examples/distributor/main.c | 2 +- examples/ipsec-secgw/sa.c | 6 +-- examples/l3fwd-power/main.c | 17 +++++---- lib/acl/acl.h | 1 + lib/acl/acl_bld.c | 3 ++ lib/acl/acl_gen.c | 1 + lib/acl/acl_log.h | 6 +++ lib/acl/rte_acl.c | 3 ++ lib/acl/tb_mem.c | 3 +- lib/efd/rte_efd.c | 4 ++ lib/fib/fib_log.h | 4 ++ lib/fib/rte_fib.c | 3 ++ lib/fib/rte_fib6.c | 2 + lib/gso/rte_gso.c | 4 +- lib/gso/rte_gso.h | 1 + lib/hash/meson.build | 9 ++++- lib/hash/rte_crc_arm64.h | 8 ++-- lib/hash/rte_crc_x86.h | 10 ++--- lib/hash/rte_cuckoo_hash.c | 5 +++ lib/hash/rte_fbk_hash.c | 5 +++ lib/hash/rte_hash_crc.c | 68 ++++++++++++++++++++++++++++++++++ lib/hash/rte_hash_crc.h | 48 ++---------------------- lib/hash/rte_thash.c | 3 ++ lib/hash/rte_thash_gfni.c | 50 +++++++++++++++++++++++++ lib/hash/rte_thash_gfni.h | 23 +++--------- lib/hash/version.map | 9 +++++ lib/log/log.c | 13 ------- lib/log/rte_log.h | 26 ++++++------- lib/lpm/lpm_log.h | 4 ++ lib/lpm/rte_lpm.c | 3 ++ lib/lpm/rte_lpm6.c | 1 + lib/mbuf/mbuf_log.h | 4 ++ lib/mbuf/rte_mbuf.c | 4 ++ lib/mbuf/rte_mbuf_dyn.c | 2 + lib/mbuf/rte_mbuf_pool_ops.c | 2 + lib/mempool/rte_mempool.c | 2 + lib/mempool/rte_mempool.h | 8 ++++ lib/mempool/version.map | 3 ++ lib/power/power_common.c | 2 + lib/power/power_common.h | 2 + lib/power/power_kvm_vm.c | 1 + lib/power/rte_power.c | 1 + lib/power/rte_power_uncore.c | 1 + lib/rib/rib_log.h | 4 ++ lib/rib/rte_rib.c | 3 ++ lib/rib/rte_rib6.c | 3 ++ lib/ring/rte_ring.c | 3 ++ lib/sched/rte_pie.c | 1 + lib/sched/rte_sched.c | 5 +++ lib/sched/rte_sched_log.h | 4 ++ 53 files changed, 329 insertions(+), 163 deletions(-)
Quoted 8 lines
create mode 100644 lib/acl/acl_log.h create mode 100644 lib/fib/fib_log.h create mode 100644 lib/hash/rte_hash_crc.c create mode 100644 lib/hash/rte_thash_gfni.c create mode 100644 lib/lpm/lpm_log.h create mode 100644 lib/mbuf/mbuf_log.h create mode 100644 lib/rib/rib_log.h create mode 100644 lib/sched/rte_sched_log.h
I fixed a few issues:
- added a release note update for the gso patch,
- fixed some styling issues in meson updates,
- reordered some hunks and patches,
- dropped some whitespace damage and typos,
- dropped unneeded include of rte_compat.h,
- fixed indent,
- marked exported variables as stable (such variable is part of the application ABI),
Series applied.
Signature · 1 line
David Marchand