From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1C296423B5; Thu, 12 Jan 2023 12:25:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0D9AB40E25; Thu, 12 Jan 2023 12:25:00 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 2C2C842D2D for ; Thu, 12 Jan 2023 12:24:58 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30C9dqx8021107; Thu, 12 Jan 2023 03:22:41 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=pS5WEZTyfsEIy5mGNXtItslR0RFVGQpow6Zc3P6sG7I=; b=cu51pynIaWNSJKf+KXQovbO3dlv8nzeUoPDwsQ40YX4+dvtK7FxRtNJsYXn01Pfk/kgA XhCBhYUuzCywOmyt4MUwI03sJJZbahK5Ma9ebOnZJQP07cenB3hiUyOVheyBhWnjXwaz 2TOn9ZxyTsJ3l5LT5tGe0owpJhyIZgEiMeB6OH9f4Z32C9GlcSXiGVY266opxRiNn1u2 XaD++SB5i6onvFV79mw3A/aIWFDE4Gskl87LSaOcrTHBgYxeByfOGGN6RCao9jbgZCB5 zH9SK64WsI368yoZmJIOHK3ou015K6Js9DE2olzgV1QFKkHcmQKt8S4H18GH7AQFPG0P xA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3n1k56ysn4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 12 Jan 2023 03:22:41 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 12 Jan 2023 03:22:39 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.42 via Frontend Transport; Thu, 12 Jan 2023 03:22:39 -0800 Received: from localhost.localdomain (unknown [10.28.36.185]) by maili.marvell.com (Postfix) with ESMTP id EAEA93F7083; Thu, 12 Jan 2023 03:22:17 -0800 (PST) From: Ankur Dwivedi To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Ankur Dwivedi Subject: [PATCH v5 1/6] eal: trace: add trace point emit for blob Date: Thu, 12 Jan 2023 16:51:35 +0530 Message-ID: <20230112112140.807233-2-adwivedi@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230112112140.807233-1-adwivedi@marvell.com> References: <20221222063306.3383695-1-adwivedi@marvell.com> <20230112112140.807233-1-adwivedi@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: 8k1Zc14POlcWItFFYh3QfDuPl7cwOzIP X-Proofpoint-GUID: 8k1Zc14POlcWItFFYh3QfDuPl7cwOzIP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-12_07,2023-01-12_01,2022-06-22_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Adds a trace point emit function for emitting a blob. The maximum blob bytes which can be captured is maximum value contained in uint16_t, which is 65535. Also adds test case for emit array tracepoint function. Signed-off-by: Ankur Dwivedi --- app/test/test_trace.c | 5 +++++ lib/eal/common/eal_common_trace_points.c | 2 ++ lib/eal/include/rte_eal_trace.h | 6 ++++++ lib/eal/include/rte_trace_point.h | 17 +++++++++++++++++ lib/eal/include/rte_trace_point_register.h | 7 +++++++ lib/eal/version.map | 3 +++ 6 files changed, 40 insertions(+) diff --git a/app/test/test_trace.c b/app/test/test_trace.c index 6bedf14024..cf781dc25b 100644 --- a/app/test/test_trace.c +++ b/app/test/test_trace.c @@ -4,6 +4,7 @@ #include #include +#include #include #include "test.h" @@ -177,6 +178,7 @@ test_fp_trace_points(void) static int test_generic_trace_points(void) { + uint8_t arr[32] = {0}; int tmp; rte_eal_trace_generic_void(); @@ -195,6 +197,9 @@ test_generic_trace_points(void) rte_eal_trace_generic_ptr(&tmp); rte_eal_trace_generic_str("my string"); rte_eal_trace_generic_size_t(sizeof(void *)); + rte_eal_trace_generic_blob(arr, 17); + rte_eal_trace_generic_blob(arr, 32); + rte_eal_trace_generic_blob(arr, rte_rand() % 32); RTE_EAL_TRACE_GENERIC_FUNC; return TEST_SUCCESS; diff --git a/lib/eal/common/eal_common_trace_points.c b/lib/eal/common/eal_common_trace_points.c index 0b0b254615..051f89809c 100644 --- a/lib/eal/common/eal_common_trace_points.c +++ b/lib/eal/common/eal_common_trace_points.c @@ -40,6 +40,8 @@ RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_size_t, lib.eal.generic.size_t) RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_func, lib.eal.generic.func) +RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_blob, + lib.eal.generic.blob) RTE_TRACE_POINT_REGISTER(rte_eal_trace_alarm_set, lib.eal.alarm.set) diff --git a/lib/eal/include/rte_eal_trace.h b/lib/eal/include/rte_eal_trace.h index 5ef4398230..02e3a564a1 100644 --- a/lib/eal/include/rte_eal_trace.h +++ b/lib/eal/include/rte_eal_trace.h @@ -143,6 +143,12 @@ RTE_TRACE_POINT( rte_trace_point_emit_string(func); ) +RTE_TRACE_POINT( + rte_eal_trace_generic_blob, + RTE_TRACE_POINT_ARGS(void *in, uint16_t len), + rte_trace_point_emit_blob(in, len); +) + #define RTE_EAL_TRACE_GENERIC_FUNC rte_eal_trace_generic_func(__func__) /* Interrupt */ diff --git a/lib/eal/include/rte_trace_point.h b/lib/eal/include/rte_trace_point.h index 0f8700974f..21b6bf7bf6 100644 --- a/lib/eal/include/rte_trace_point.h +++ b/lib/eal/include/rte_trace_point.h @@ -144,6 +144,8 @@ _tp _args \ #define rte_trace_point_emit_ptr(val) /** Tracepoint function payload for string datatype */ #define rte_trace_point_emit_string(val) +/** Tracepoint function payload for char array */ +#define rte_trace_point_emit_blob(val, len) #endif /* __DOXYGEN__ */ @@ -374,12 +376,27 @@ do { \ mem = RTE_PTR_ADD(mem, __RTE_TRACE_EMIT_STRING_LEN_MAX); \ } while (0) +#define rte_trace_point_emit_blob(in, len) \ +do { \ + if (unlikely(in == NULL)) \ + return; \ + __rte_trace_point_emit(len, uint16_t); \ + memcpy(mem, in, len); \ + mem = RTE_PTR_ADD(mem, len); \ +} while (0) + #else #define __rte_trace_point_emit_header_generic(t) RTE_SET_USED(t) #define __rte_trace_point_emit_header_fp(t) RTE_SET_USED(t) #define __rte_trace_point_emit(in, type) RTE_SET_USED(in) #define rte_trace_point_emit_string(in) RTE_SET_USED(in) +#define rte_trace_point_emit_blob(in, len) \ +do { \ + RTE_SET_USED(in); \ + RTE_SET_USED(len); \ +} while (0) + #endif /* ALLOW_EXPERIMENTAL_API */ #endif /* _RTE_TRACE_POINT_REGISTER_H_ */ diff --git a/lib/eal/include/rte_trace_point_register.h b/lib/eal/include/rte_trace_point_register.h index a32f4d731b..a54f9769da 100644 --- a/lib/eal/include/rte_trace_point_register.h +++ b/lib/eal/include/rte_trace_point_register.h @@ -47,6 +47,13 @@ do { \ RTE_STR(in)"[32]", "string_bounded_t"); \ } while (0) +#define rte_trace_point_emit_blob(in, len) \ +do { \ + RTE_SET_USED(in); \ + __rte_trace_point_emit(len, uint16_t); \ + __rte_trace_point_emit_field(len, RTE_STR(in)"["#len"]", RTE_STR(uint8_t)); \ +} while (0) + #ifdef __cplusplus } #endif diff --git a/lib/eal/version.map b/lib/eal/version.map index 7ad12a7dc9..67be24686a 100644 --- a/lib/eal/version.map +++ b/lib/eal/version.map @@ -440,6 +440,9 @@ EXPERIMENTAL { rte_thread_detach; rte_thread_equal; rte_thread_join; + + # added in 23.03 + __rte_eal_trace_generic_blob; }; INTERNAL { -- 2.25.1