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 02632A034C; Thu, 22 Dec 2022 07:36:34 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E46854282D; Thu, 22 Dec 2022 07:36:33 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id A7A32427EB for ; Thu, 22 Dec 2022 07:36:32 +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 2BM6TcnT015570; Wed, 21 Dec 2022 22:34:15 -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=grft8uqZYvR8f9hvlTSBT2f7bNJEY0SL8cS/GMtoMVg=; b=CVF6K+mhrt7Nm99rTGKmyrUg1aQns0hQcNx6wQ4GZclbRCBnDhTbfkavYCbr+LAcdqTi cfVtbFDInYwatiJkSNZYyipAcsJ8P3NrAMu3OOEuGA0e2osExPW9jXSf75Gjsz6T4cQI RmP2FiM1e/L+KSlL/fyQXElNZ9m3eE29o73sTz9k8KLKsQBTydxDztCoMgcR6VQzmQXt 181kuk9W3os8cHDyL5zNkbj/6UxHCbLXbibcLWVwJ7RepU/haDZ1y6eP8VifyfILKvFt q4+UY+kuy4WyupAl3RfubTzBqx0d41CNyFcr2JBBvgV+tfnxzqwCa4erL4+QgBNTGKl0 5w== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3mhe5rskau-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 21 Dec 2022 22:34:15 -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; Wed, 21 Dec 2022 22:34:11 -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; Wed, 21 Dec 2022 22:34:11 -0800 Received: from localhost.localdomain (unknown [10.28.36.185]) by maili.marvell.com (Postfix) with ESMTP id 415305B6948; Wed, 21 Dec 2022 22:33:51 -0800 (PST) From: Ankur Dwivedi To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Ankur Dwivedi Subject: [PATCH v4 1/6] eal: trace: add trace point emit for array Date: Thu, 22 Dec 2022 12:03:00 +0530 Message-ID: <20221222063306.3383695-2-adwivedi@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221222063306.3383695-1-adwivedi@marvell.com> References: <20221006151844.23483-1-adwivedi@marvell.com> <20221222063306.3383695-1-adwivedi@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: PLVQQNDDxXWE-hDdzg-ujsCfp1qAJmz2 X-Proofpoint-ORIG-GUID: PLVQQNDDxXWE-hDdzg-ujsCfp1qAJmz2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-22_01,2022-12-21_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 array. The maximum array bytes which can be captured is set to 32. Also adds test case for emit array tracepoint function. Signed-off-by: Ankur Dwivedi --- app/test/test_trace.c | 3 +++ lib/eal/common/eal_common_trace_points.c | 2 ++ lib/eal/include/rte_eal_trace.h | 6 ++++++ lib/eal/include/rte_trace_point.h | 20 ++++++++++++++++++++ lib/eal/include/rte_trace_point_register.h | 8 ++++++++ 5 files changed, 39 insertions(+) diff --git a/app/test/test_trace.c b/app/test/test_trace.c index 6bedf14024..99cd0762d1 100644 --- a/app/test/test_trace.c +++ b/app/test/test_trace.c @@ -177,6 +177,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 +196,8 @@ 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_char_array(arr, 32); + rte_eal_trace_generic_char_array(arr, 64); 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..93fdaa634e 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_char_array, + lib.eal.generic.char.array) 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..34fdd5331f 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_char_array, + RTE_TRACE_POINT_ARGS(void *in, uint8_t len), + rte_trace_point_emit_char_array(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..9d9a9e0aaa 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_char_array(val, len) #endif /* __DOXYGEN__ */ @@ -151,6 +153,8 @@ _tp _args \ #define __RTE_TRACE_EMIT_STRING_LEN_MAX 32 /** @internal Macro to define event header size. */ #define __RTE_TRACE_EVENT_HEADER_SZ sizeof(uint64_t) +/** @internal Macro to define maximum emit length of array. */ +#define __RTE_TRACE_EMIT_ARRAY_LEN_MAX 32 /** * Enable recording events of the given tracepoint in the trace buffer. @@ -374,12 +378,28 @@ do { \ mem = RTE_PTR_ADD(mem, __RTE_TRACE_EMIT_STRING_LEN_MAX); \ } while (0) +#define rte_trace_point_emit_char_array(in, len) \ +do { \ + if (unlikely(in == NULL)) \ + return; \ + if (len > __RTE_TRACE_EMIT_ARRAY_LEN_MAX) \ + return; \ + 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_char_array(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..c76fe4dd48 100644 --- a/lib/eal/include/rte_trace_point_register.h +++ b/lib/eal/include/rte_trace_point_register.h @@ -47,6 +47,14 @@ do { \ RTE_STR(in)"[32]", "string_bounded_t"); \ } while (0) +#define rte_trace_point_emit_char_array(in, len) \ +do { \ + RTE_SET_USED(in); \ + if (len > __RTE_TRACE_EMIT_ARRAY_LEN_MAX) \ + return; \ + __rte_trace_point_emit_field(len, RTE_STR(in)"[32]", "uint8_t"); \ +} while (0) + #ifdef __cplusplus } #endif -- 2.25.1