1 Star 0 Fork 75

chenjiji09/dpdk

forked from src-openEuler/dpdk 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0357-telemetry-make-array-initialization-more-robust.patch 1.53 KB
一键复制 编辑 原始数据 按行查看 历史
From d4dd238ec9a01810d29a069cbbb3a573b5f16d20 Mon Sep 17 00:00:00 2001
From: Bruce Richardson <bruce.richardson@intel.com>
Date: Thu, 12 Jan 2023 17:41:09 +0000
Subject: telemetry: make array initialization more robust
[ upstream commit 5ebf6e0ff8e5164c50d15a2e57f2a4c9cecda2dc ]
Rather than relying on a specific ordering of elements in the array
matching that of elements in the enum definition, we can explicitly mark
each array entry using the equivalent enum value as an index.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Ciara Power <ciara.power@intel.com>
---
lib/telemetry/telemetry_data.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/telemetry/telemetry_data.c b/lib/telemetry/telemetry_data.c
index 15bcf8c..7204c34 100644
--- a/lib/telemetry/telemetry_data.c
+++ b/lib/telemetry/telemetry_data.c
@@ -16,10 +16,10 @@ int
rte_tel_data_start_array(struct rte_tel_data *d, enum rte_tel_value_type type)
{
enum tel_container_types array_types[] = {
- TEL_ARRAY_STRING, /* RTE_TEL_STRING_VAL = 0 */
- TEL_ARRAY_INT, /* RTE_TEL_INT_VAL = 1 */
- TEL_ARRAY_U64, /* RTE_TEL_U64_VAL = 2 */
- TEL_ARRAY_CONTAINER, /* RTE_TEL_CONTAINER = 3 */
+ [RTE_TEL_STRING_VAL] = TEL_ARRAY_STRING,
+ [RTE_TEL_INT_VAL] = TEL_ARRAY_INT,
+ [RTE_TEL_U64_VAL] = TEL_ARRAY_U64,
+ [RTE_TEL_CONTAINER] = TEL_ARRAY_CONTAINER,
};
d->type = array_types[type];
d->data_len = 0;
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/chenjiji09/dpdk.git
git@gitee.com:chenjiji09/dpdk.git
chenjiji09
dpdk
dpdk
master

搜索帮助