From 07fbeb466db1a6b5951e47d024743df090493661 Mon Sep 17 00:00:00 2001 From: chenjiji09 Date: Thu, 20 Jul 2023 10:45:56 +0800 Subject: [PATCH] Telemetry: use uint in place of u64 and support timer adapter Sync some patchs from upstreaming for telemetry and modifications are as follow: 1. Use uint in place of u64 for telemetry and functions. 2. Adds telemetry support to get timer adapter info and timer adapter statistics. 3. Add a new telemetry command /ethdev/module_eeprom to dump the module EEPROM of each port. --- ...-telemetry-command-for-module-EEPROM.patch | 205 +++ ...-common-code-for-different-SFF-specs.patch | 601 +++++++ ...ev-support-SFF-8079-module-telemetry.patch | 471 ++++++ ...ev-support-SFF-8472-module-telemetry.patch | 351 ++++ ...ev-support-SFF-8636-module-telemetry.patch | 1433 +++++++++++++++++ ...emove-RTE-prefix-from-internal-enums.patch | 285 ++++ ...ake-array-initialization-more-robust.patch | 41 + ...e-unsigned-64-bit-enum-value-to-uint.patch | 219 +++ ...metry-add-uint-type-as-alias-for-u64.patch | 267 +++ 0360-eventdev-timer-add-telemetry.patch | 125 ++ ...metry-u64-functions-to-uint-versions.patch | 676 ++++++++ ...try-mark-u64-functions-as-deprecated.patch | 114 ++ ...te-JSON-functions-for-int-uint-types.patch | 155 ++ ...e-internal-int-representation-64-bit.patch | 35 + ...etry-use-64-bit-signed-values-in-API.patch | 71 + dpdk.spec | 26 +- 16 files changed, 5074 insertions(+), 1 deletion(-) create mode 100644 0351-ethdev-add-telemetry-command-for-module-EEPROM.patch create mode 100644 0352-ethdev-add-common-code-for-different-SFF-specs.patch create mode 100644 0353-ethdev-support-SFF-8079-module-telemetry.patch create mode 100644 0354-ethdev-support-SFF-8472-module-telemetry.patch create mode 100644 0355-ethdev-support-SFF-8636-module-telemetry.patch create mode 100644 0356-telemetry-remove-RTE-prefix-from-internal-enums.patch create mode 100644 0357-telemetry-make-array-initialization-more-robust.patch create mode 100644 0358-telemetry-rename-unsigned-64-bit-enum-value-to-uint.patch create mode 100644 0359-telemetry-add-uint-type-as-alias-for-u64.patch create mode 100644 0360-eventdev-timer-add-telemetry.patch create mode 100644 0361-rename-telemetry-u64-functions-to-uint-versions.patch create mode 100644 0362-telemetry-mark-u64-functions-as-deprecated.patch create mode 100644 0363-telemetry-update-JSON-functions-for-int-uint-types.patch create mode 100644 0364-telemetry-make-internal-int-representation-64-bit.patch create mode 100644 0365-telemetry-use-64-bit-signed-values-in-API.patch diff --git a/0351-ethdev-add-telemetry-command-for-module-EEPROM.patch b/0351-ethdev-add-telemetry-command-for-module-EEPROM.patch new file mode 100644 index 0000000..42d6c1e --- /dev/null +++ b/0351-ethdev-add-telemetry-command-for-module-EEPROM.patch @@ -0,0 +1,205 @@ +From 30dc6e572abdbe453e4b66229627ad7e598f1213 Mon Sep 17 00:00:00 2001 +From: Robin Zhang +Date: Thu, 26 May 2022 07:32:11 +0000 +Subject: ethdev: add telemetry command for module EEPROM + +[ upstream commit 7546a2cd2b2cd8915a171afcc4193f7885deb2b2 ] + +Add a new telemetry command /ethdev/module_eeprom to dump the module +EEPROM of each port. The format of module EEPROM information follows +the SFF(Small Form Factor) Committee specifications. + +Signed-off-by: Robin Zhang +Signed-off-by: Kevin Liu +Acked-by: Andrew Rybchenko +--- + devtools/words-case.txt | 1 + + lib/ethdev/meson.build | 1 + + lib/ethdev/rte_ethdev.c | 3 + + lib/ethdev/sff_telemetry.c | 109 +++++++++++++++++++++++++++++++++++++ + lib/ethdev/sff_telemetry.h | 14 +++++ + 5 files changed, 128 insertions(+) + create mode 100644 lib/ethdev/sff_telemetry.c + create mode 100644 lib/ethdev/sff_telemetry.h + +diff --git a/devtools/words-case.txt b/devtools/words-case.txt +index bc33470..2f1753b 100644 +--- a/devtools/words-case.txt ++++ b/devtools/words-case.txt +@@ -76,6 +76,7 @@ RSS + RVU + Rx + SCTP ++SFF + SMP + SoC + SQ +diff --git a/lib/ethdev/meson.build b/lib/ethdev/meson.build +index a094585..6a14d0b 100644 +--- a/lib/ethdev/meson.build ++++ b/lib/ethdev/meson.build +@@ -11,6 +11,7 @@ sources = files( + 'rte_flow.c', + 'rte_mtr.c', + 'rte_tm.c', ++ 'sff_telemetry.c', + ) + + headers = files( +diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c +index 1a25515..c65dc8b 100644 +--- a/lib/ethdev/rte_ethdev.c ++++ b/lib/ethdev/rte_ethdev.c +@@ -41,6 +41,7 @@ + #include "ethdev_driver.h" + #include "ethdev_profile.h" + #include "ethdev_private.h" ++#include "sff_telemetry.h" + + static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data"; + struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS]; +@@ -6655,4 +6656,6 @@ RTE_INIT(ethdev_init_telemetry) + "Returns the link status for a port. Parameters: int port_id"); + rte_telemetry_register_cmd("/ethdev/info", eth_dev_handle_port_info, + "Returns the device info for a port. Parameters: int port_id"); ++ rte_telemetry_register_cmd("/ethdev/module_eeprom", eth_dev_handle_port_module_eeprom, ++ "Returns module EEPROM info with SFF specs. Parameters: int port_id"); + } +diff --git a/lib/ethdev/sff_telemetry.c b/lib/ethdev/sff_telemetry.c +new file mode 100644 +index 0000000..d415abd +--- /dev/null ++++ b/lib/ethdev/sff_telemetry.c +@@ -0,0 +1,109 @@ ++/* SPDX-License-Identifier: BSD-3-Clause ++ * Copyright(c) 2022 Intel Corporation ++ */ ++ ++#include ++ ++#include "rte_ethdev.h" ++#include ++#include "sff_telemetry.h" ++#include ++ ++static void ++sff_port_module_eeprom_parse(uint16_t port_id, struct rte_tel_data *d) ++{ ++ struct rte_eth_dev_module_info minfo; ++ struct rte_dev_eeprom_info einfo; ++ int ret; ++ ++ if (d == NULL) { ++ RTE_ETHDEV_LOG(ERR, "Dict invalid\n"); ++ return; ++ } ++ ++ ret = rte_eth_dev_get_module_info(port_id, &minfo); ++ if (ret != 0) { ++ switch (ret) { ++ case -ENODEV: ++ RTE_ETHDEV_LOG(ERR, "Port index %d invalid\n", port_id); ++ break; ++ case -ENOTSUP: ++ RTE_ETHDEV_LOG(ERR, "Operation not supported by device\n"); ++ break; ++ case -EIO: ++ RTE_ETHDEV_LOG(ERR, "Device is removed\n"); ++ break; ++ default: ++ RTE_ETHDEV_LOG(ERR, "Unable to get port module info, %d\n", ret); ++ break; ++ } ++ return; ++ } ++ ++ einfo.offset = 0; ++ einfo.length = minfo.eeprom_len; ++ einfo.data = calloc(1, minfo.eeprom_len); ++ if (einfo.data == NULL) { ++ RTE_ETHDEV_LOG(ERR, "Allocation of port %u EEPROM data failed\n", port_id); ++ return; ++ } ++ ++ ret = rte_eth_dev_get_module_eeprom(port_id, &einfo); ++ if (ret != 0) { ++ switch (ret) { ++ case -ENODEV: ++ RTE_ETHDEV_LOG(ERR, "Port index %d invalid\n", port_id); ++ break; ++ case -ENOTSUP: ++ RTE_ETHDEV_LOG(ERR, "Operation not supported by device\n"); ++ break; ++ case -EIO: ++ RTE_ETHDEV_LOG(ERR, "Device is removed\n"); ++ break; ++ default: ++ RTE_ETHDEV_LOG(ERR, "Unable to get port module EEPROM, %d\n", ret); ++ break; ++ } ++ free(einfo.data); ++ return; ++ } ++ ++ switch (minfo.type) { ++ /* parsing module EEPROM data base on different module type */ ++ default: ++ RTE_ETHDEV_LOG(NOTICE, "Unsupported module type: %u\n", minfo.type); ++ break; ++ } ++ ++ free(einfo.data); ++} ++ ++int ++eth_dev_handle_port_module_eeprom(const char *cmd __rte_unused, const char *params, ++ struct rte_tel_data *d) ++{ ++ char *end_param; ++ int port_id; ++ ++ if (params == NULL || strlen(params) == 0 || !isdigit(*params)) ++ return -1; ++ ++ errno = 0; ++ port_id = strtoul(params, &end_param, 0); ++ ++ if (errno != 0) { ++ RTE_ETHDEV_LOG(ERR, "Invalid argument, %d\n", errno); ++ return -1; ++ } ++ ++ if (*end_param != '\0') ++ RTE_ETHDEV_LOG(NOTICE, ++ "Extra parameters [%s] passed to ethdev telemetry command, ignoring\n", ++ end_param); ++ ++ rte_tel_data_start_dict(d); ++ ++ sff_port_module_eeprom_parse(port_id, d); ++ ++ return 0; ++} +diff --git a/lib/ethdev/sff_telemetry.h b/lib/ethdev/sff_telemetry.h +new file mode 100644 +index 0000000..8c10a88 +--- /dev/null ++++ b/lib/ethdev/sff_telemetry.h +@@ -0,0 +1,14 @@ ++/* SPDX-License-Identifier: BSD-3-Clause ++ * Copyright(c) 2022 Intel Corporation ++ */ ++ ++#ifndef _ETHDEV_SFF_TELEMETRY_H_ ++#define _ETHDEV_SFF_TELEMETRY_H_ ++ ++#include ++ ++int eth_dev_handle_port_module_eeprom(const char *cmd __rte_unused, ++ const char *params, ++ struct rte_tel_data *d); ++ ++#endif /* _ETHDEV_SFF_TELEMETRY_H_ */ +-- +2.23.0 + diff --git a/0352-ethdev-add-common-code-for-different-SFF-specs.patch b/0352-ethdev-add-common-code-for-different-SFF-specs.patch new file mode 100644 index 0000000..e8f2bee --- /dev/null +++ b/0352-ethdev-add-common-code-for-different-SFF-specs.patch @@ -0,0 +1,601 @@ +From e82d88982f75025b6f1e812f778d33def13d5f33 Mon Sep 17 00:00:00 2001 +From: Robin Zhang +Date: Thu, 26 May 2022 07:32:12 +0000 +Subject: ethdev: add common code for different SFF specs + +[ upstream commit 266c2beb474903bd0d156f3b33656847541a96ea ] + +Add support for SFF-8024 Rev 4.0 of pluggable I/O configuration +and some common utilities for SFF-8436/8636 and SFF-8472/8079. + +Signed-off-by: Robin Zhang +Signed-off-by: Kevin Liu +Acked-by: Andrew Rybchenko +--- + lib/ethdev/meson.build | 1 + + lib/ethdev/sff_common.c | 319 +++++++++++++++++++++++++++++++++++++ + lib/ethdev/sff_common.h | 173 ++++++++++++++++++++ + lib/ethdev/sff_telemetry.c | 30 ++++ + lib/ethdev/sff_telemetry.h | 5 + + 5 files changed, 528 insertions(+) + create mode 100644 lib/ethdev/sff_common.c + create mode 100644 lib/ethdev/sff_common.h + +diff --git a/lib/ethdev/meson.build b/lib/ethdev/meson.build +index 6a14d0b..4ec2178 100644 +--- a/lib/ethdev/meson.build ++++ b/lib/ethdev/meson.build +@@ -12,6 +12,7 @@ sources = files( + 'rte_mtr.c', + 'rte_tm.c', + 'sff_telemetry.c', ++ 'sff_common.c', + ) + + headers = files( +diff --git a/lib/ethdev/sff_common.c b/lib/ethdev/sff_common.c +new file mode 100644 +index 0000000..bd42527 +--- /dev/null ++++ b/lib/ethdev/sff_common.c +@@ -0,0 +1,319 @@ ++/* SPDX-License-Identifier: BSD-3-Clause ++ * Copyright(c) 2022 Intel Corporation ++ * Implements SFF-8024 Rev 4.0 of pluggable I/O configuration and some ++ * common utilities for SFF-8436/8636 and SFF-8472/8079 ++ */ ++ ++#include ++ ++#include "sff_common.h" ++ ++double sff_convert_mw_to_dbm(double mw) ++{ ++ return (10. * log10(mw / 1000.)) + 30.; ++} ++ ++void sff_show_value_with_unit(const uint8_t *data, unsigned int reg, ++ const char *name, unsigned int mult, ++ const char *unit, struct rte_tel_data *d) ++{ ++ unsigned int val = data[reg]; ++ char val_string[SFF_ITEM_VAL_COMPOSE_SIZE]; ++ ++ snprintf(val_string, sizeof(val_string), "%u%s", val * mult, unit); ++ ssf_add_dict_string(d, name, val_string); ++} ++ ++void sff_show_ascii(const uint8_t *data, unsigned int first_reg, ++ unsigned int last_reg, const char *name, struct rte_tel_data *d) ++{ ++ unsigned int reg, val; ++ char tmp[3]; ++ char val_string[SFF_ITEM_VAL_COMPOSE_SIZE]; ++ ++ memset(val_string, 0, sizeof(val_string)); ++ ++ while (first_reg <= last_reg && data[last_reg] == ' ') ++ last_reg--; ++ for (reg = first_reg; reg <= last_reg; reg++) { ++ val = data[reg]; ++ if ((val >= 32) && (val <= 126)) { ++ snprintf(tmp, sizeof(tmp), "%c", val); ++ strlcat(val_string, tmp, sizeof(val_string)); ++ } else { ++ strlcat(val_string, "_", sizeof(val_string)); ++ } ++ } ++ ssf_add_dict_string(d, name, val_string); ++} ++ ++void sff_8024_show_oui(const uint8_t *data, int id_offset, struct rte_tel_data *d) ++{ ++ char val_string[SFF_ITEM_VAL_COMPOSE_SIZE]; ++ ++ snprintf(val_string, sizeof(val_string), "%02x:%02x:%02x", ++ data[id_offset], data[(id_offset) + 1], data[(id_offset) + 2]); ++ ssf_add_dict_string(d, "Vendor OUI", val_string); ++} ++ ++void sff_8024_show_identifier(const uint8_t *data, int id_offset, struct rte_tel_data *d) ++{ ++ char val_string[SFF_ITEM_VAL_COMPOSE_SIZE]; ++ ++ snprintf(val_string, sizeof(val_string), "0x%02x", data[id_offset]); ++ ++ switch (data[id_offset]) { ++ case SFF_8024_ID_UNKNOWN: ++ strlcat(val_string, " (no module present, unknown, or unspecified)", ++ sizeof(val_string)); ++ break; ++ case SFF_8024_ID_GBIC: ++ strlcat(val_string, " (GBIC)", sizeof(val_string)); ++ break; ++ case SFF_8024_ID_SOLDERED_MODULE: ++ strlcat(val_string, " (module soldered to motherboard)", sizeof(val_string)); ++ break; ++ case SFF_8024_ID_SFP: ++ strlcat(val_string, " (SFP)", sizeof(val_string)); ++ break; ++ case SFF_8024_ID_300_PIN_XBI: ++ strlcat(val_string, " (300 pin XBI)", sizeof(val_string)); ++ break; ++ case SFF_8024_ID_XENPAK: ++ strlcat(val_string, " (XENPAK)", sizeof(val_string)); ++ break; ++ case SFF_8024_ID_XFP: ++ strlcat(val_string, " (XFP)", sizeof(val_string)); ++ break; ++ case SFF_8024_ID_XFF: ++ strlcat(val_string, " (XFF)", sizeof(val_string)); ++ break; ++ case SFF_8024_ID_XFP_E: ++ strlcat(val_string, " (XFP-E)", sizeof(val_string)); ++ break; ++ case SFF_8024_ID_XPAK: ++ strlcat(val_string, " (XPAK)", sizeof(val_string)); ++ break; ++ case SFF_8024_ID_X2: ++ strlcat(val_string, " (X2)", sizeof(val_string)); ++ break; ++ case SFF_8024_ID_DWDM_SFP: ++ strlcat(val_string, " (DWDM-SFP)", sizeof(val_string)); ++ break; ++ case SFF_8024_ID_QSFP: ++ strlcat(val_string, " (QSFP)", sizeof(val_string)); ++ break; ++ case SFF_8024_ID_QSFP_PLUS: ++ strlcat(val_string, " (QSFP+)", sizeof(val_string)); ++ break; ++ case SFF_8024_ID_CXP: ++ strlcat(val_string, " (CXP)", sizeof(val_string)); ++ break; ++ case SFF_8024_ID_HD4X: ++ strlcat(val_string, " (Shielded Mini Multilane HD 4X)", sizeof(val_string)); ++ break; ++ case SFF_8024_ID_HD8X: ++ strlcat(val_string, " (Shielded Mini Multilane HD 8X)", sizeof(val_string)); ++ break; ++ case SFF_8024_ID_QSFP28: ++ strlcat(val_string, " (QSFP28)", sizeof(val_string)); ++ break; ++ case SFF_8024_ID_CXP2: ++ strlcat(val_string, " (CXP2/CXP28)", sizeof(val_string)); ++ break; ++ case SFF_8024_ID_CDFP: ++ strlcat(val_string, " (CDFP Style 1/Style 2)", sizeof(val_string)); ++ break; ++ case SFF_8024_ID_HD4X_FANOUT: ++ strlcat(val_string, " (Shielded Mini Multilane HD 4X Fanout Cable)", ++ sizeof(val_string)); ++ break; ++ case SFF_8024_ID_HD8X_FANOUT: ++ strlcat(val_string, " (Shielded Mini Multilane HD 8X Fanout Cable)", ++ sizeof(val_string)); ++ break; ++ case SFF_8024_ID_CDFP_S3: ++ strlcat(val_string, " (CDFP Style 3)", sizeof(val_string)); ++ break; ++ case SFF_8024_ID_MICRO_QSFP: ++ strlcat(val_string, " (microQSFP)", sizeof(val_string)); ++ break; ++ default: ++ strlcat(val_string, " (reserved or unknown)", sizeof(val_string)); ++ break; ++ } ++ ssf_add_dict_string(d, "Identifier", val_string); ++} ++ ++void sff_8024_show_connector(const uint8_t *data, int ctor_offset, struct rte_tel_data *d) ++{ ++ char val_string[SFF_ITEM_VAL_COMPOSE_SIZE]; ++ ++ snprintf(val_string, sizeof(val_string), "0x%02x", data[ctor_offset]); ++ ++ switch (data[ctor_offset]) { ++ case SFF_8024_CTOR_UNKNOWN: ++ strlcat(val_string, " (unknown or unspecified)", sizeof(val_string)); ++ break; ++ case SFF_8024_CTOR_SC: ++ strlcat(val_string, " (SC)", sizeof(val_string)); ++ break; ++ case SFF_8024_CTOR_FC_STYLE_1: ++ strlcat(val_string, " (Fibre Channel Style 1 copper)", sizeof(val_string)); ++ break; ++ case SFF_8024_CTOR_FC_STYLE_2: ++ strlcat(val_string, " (Fibre Channel Style 2 copper)", sizeof(val_string)); ++ break; ++ case SFF_8024_CTOR_BNC_TNC: ++ strlcat(val_string, " (BNC/TNC)", sizeof(val_string)); ++ break; ++ case SFF_8024_CTOR_FC_COAX: ++ strlcat(val_string, " (Fibre Channel coaxial headers)", sizeof(val_string)); ++ break; ++ case SFF_8024_CTOR_FIBER_JACK: ++ strlcat(val_string, " (FibreJack)", sizeof(val_string)); ++ break; ++ case SFF_8024_CTOR_LC: ++ strlcat(val_string, " (LC)", sizeof(val_string)); ++ break; ++ case SFF_8024_CTOR_MT_RJ: ++ strlcat(val_string, " (MT-RJ)", sizeof(val_string)); ++ break; ++ case SFF_8024_CTOR_MU: ++ strlcat(val_string, " (MU)", sizeof(val_string)); ++ break; ++ case SFF_8024_CTOR_SG: ++ strlcat(val_string, " (SG)", sizeof(val_string)); ++ break; ++ case SFF_8024_CTOR_OPT_PT: ++ strlcat(val_string, " (Optical pigtail)", sizeof(val_string)); ++ break; ++ case SFF_8024_CTOR_MPO: ++ strlcat(val_string, " (MPO Parallel Optic)", sizeof(val_string)); ++ break; ++ case SFF_8024_CTOR_MPO_2: ++ strlcat(val_string, " (MPO Parallel Optic - 2x16)", sizeof(val_string)); ++ break; ++ case SFF_8024_CTOR_HSDC_II: ++ strlcat(val_string, " (HSSDC II)", sizeof(val_string)); ++ break; ++ case SFF_8024_CTOR_COPPER_PT: ++ strlcat(val_string, " (Copper pigtail)", sizeof(val_string)); ++ break; ++ case SFF_8024_CTOR_RJ45: ++ strlcat(val_string, " (RJ45)", sizeof(val_string)); ++ break; ++ case SFF_8024_CTOR_NO_SEPARABLE: ++ strlcat(val_string, " (No separable connector)", sizeof(val_string)); ++ break; ++ case SFF_8024_CTOR_MXC_2x16: ++ strlcat(val_string, " (MXC 2x16)", sizeof(val_string)); ++ break; ++ default: ++ strlcat(val_string, " (reserved or unknown)", sizeof(val_string)); ++ break; ++ } ++ ssf_add_dict_string(d, "Connector", val_string); ++} ++ ++void sff_8024_show_encoding(const uint8_t *data, int encoding_offset, ++ int sff_type, struct rte_tel_data *d) ++{ ++ char val_string[SFF_ITEM_VAL_COMPOSE_SIZE]; ++ ++ snprintf(val_string, sizeof(val_string), "0x%02x", data[encoding_offset]); ++ ++ switch (data[encoding_offset]) { ++ case SFF_8024_ENCODING_UNSPEC: ++ strlcat(val_string, " (unspecified)", sizeof(val_string)); ++ break; ++ case SFF_8024_ENCODING_8B10B: ++ strlcat(val_string, " (8B/10B)", sizeof(val_string)); ++ break; ++ case SFF_8024_ENCODING_4B5B: ++ strlcat(val_string, " (4B/5B)", sizeof(val_string)); ++ break; ++ case SFF_8024_ENCODING_NRZ: ++ strlcat(val_string, " (NRZ)", sizeof(val_string)); ++ break; ++ case SFF_8024_ENCODING_4h: ++ if (sff_type == RTE_ETH_MODULE_SFF_8472) ++ strlcat(val_string, " (Manchester)", sizeof(val_string)); ++ else if (sff_type == RTE_ETH_MODULE_SFF_8636) ++ strlcat(val_string, " (SONET Scrambled)", sizeof(val_string)); ++ break; ++ case SFF_8024_ENCODING_5h: ++ if (sff_type == RTE_ETH_MODULE_SFF_8472) ++ strlcat(val_string, " (SONET Scrambled)", sizeof(val_string)); ++ else if (sff_type == RTE_ETH_MODULE_SFF_8636) ++ strlcat(val_string, " (64B/66B)", sizeof(val_string)); ++ break; ++ case SFF_8024_ENCODING_6h: ++ if (sff_type == RTE_ETH_MODULE_SFF_8472) ++ strlcat(val_string, " (64B/66B)", sizeof(val_string)); ++ else if (sff_type == RTE_ETH_MODULE_SFF_8636) ++ strlcat(val_string, " (Manchester)", sizeof(val_string)); ++ break; ++ case SFF_8024_ENCODING_256B: ++ strlcat(val_string, ++ " ((256B/257B (transcoded FEC-enabled data))", sizeof(val_string)); ++ break; ++ case SFF_8024_ENCODING_PAM4: ++ strlcat(val_string, " (PAM4)", sizeof(val_string)); ++ break; ++ default: ++ strlcat(val_string, " (reserved or unknown)", sizeof(val_string)); ++ break; ++ } ++ ssf_add_dict_string(d, "Encoding", val_string); ++} ++ ++void sff_show_thresholds(struct sff_diags sd, struct rte_tel_data *d) ++{ ++ char val_string[SFF_ITEM_VAL_COMPOSE_SIZE]; ++ ++ SFF_SPRINT_BIAS(val_string, sd.bias_cur[SFF_HALRM]); ++ ssf_add_dict_string(d, "Laser bias current high alarm threshold", val_string); ++ SFF_SPRINT_BIAS(val_string, sd.bias_cur[SFF_LALRM]); ++ ssf_add_dict_string(d, "Laser bias current low alarm threshold", val_string); ++ SFF_SPRINT_BIAS(val_string, sd.bias_cur[SFF_HWARN]); ++ ssf_add_dict_string(d, "Laser bias current high warning threshold", val_string); ++ SFF_SPRINT_BIAS(val_string, sd.bias_cur[SFF_LWARN]); ++ ssf_add_dict_string(d, "Laser bias current low warning threshold", val_string); ++ ++ SFF_SPRINT_xX_PWR(val_string, sd.tx_power[SFF_HALRM]); ++ ssf_add_dict_string(d, "Laser output power high alarm threshold", val_string); ++ SFF_SPRINT_xX_PWR(val_string, sd.tx_power[SFF_LALRM]); ++ ssf_add_dict_string(d, "Laser output power low alarm threshold", val_string); ++ SFF_SPRINT_xX_PWR(val_string, sd.tx_power[SFF_HWARN]); ++ ssf_add_dict_string(d, "Laser output power high warning threshold", val_string); ++ SFF_SPRINT_xX_PWR(val_string, sd.tx_power[SFF_LWARN]); ++ ssf_add_dict_string(d, "Laser output power low warning threshold", val_string); ++ ++ SFF_SPRINT_TEMP(val_string, sd.sfp_temp[SFF_HALRM]); ++ ssf_add_dict_string(d, "Module temperature high alarm threshold", val_string); ++ SFF_SPRINT_TEMP(val_string, sd.sfp_temp[SFF_LALRM]); ++ ssf_add_dict_string(d, "Module temperature low alarm threshold", val_string); ++ SFF_SPRINT_TEMP(val_string, sd.sfp_temp[SFF_HWARN]); ++ ssf_add_dict_string(d, "Module temperature high warning threshold", val_string); ++ SFF_SPRINT_TEMP(val_string, sd.sfp_temp[SFF_LWARN]); ++ ssf_add_dict_string(d, "Module temperature low warning threshold", val_string); ++ ++ SFF_SPRINT_VCC(val_string, sd.sfp_voltage[SFF_HALRM]); ++ ssf_add_dict_string(d, "Module voltage high alarm threshold", val_string); ++ SFF_SPRINT_VCC(val_string, sd.sfp_voltage[SFF_LALRM]); ++ ssf_add_dict_string(d, "Module voltage low alarm threshold", val_string); ++ SFF_SPRINT_VCC(val_string, sd.sfp_voltage[SFF_HWARN]); ++ ssf_add_dict_string(d, "Module voltage high warning threshold", val_string); ++ SFF_SPRINT_VCC(val_string, sd.sfp_voltage[SFF_LWARN]); ++ ssf_add_dict_string(d, "Module voltage low alarm threshold", val_string); ++ ++ SFF_SPRINT_xX_PWR(val_string, sd.rx_power[SFF_HALRM]); ++ ssf_add_dict_string(d, "Laser rx power high alarm threshold", val_string); ++ SFF_SPRINT_xX_PWR(val_string, sd.rx_power[SFF_LALRM]); ++ ssf_add_dict_string(d, "Laser rx power low alarm threshold", val_string); ++ SFF_SPRINT_xX_PWR(val_string, sd.rx_power[SFF_HWARN]); ++ ssf_add_dict_string(d, "Laser rx power high warning threshold", val_string); ++ SFF_SPRINT_xX_PWR(val_string, sd.rx_power[SFF_LWARN]); ++ ssf_add_dict_string(d, "Laser rx power low warning threshold", val_string); ++} +diff --git a/lib/ethdev/sff_common.h b/lib/ethdev/sff_common.h +new file mode 100644 +index 0000000..e44f3c7 +--- /dev/null ++++ b/lib/ethdev/sff_common.h +@@ -0,0 +1,173 @@ ++/* SPDX-License-Identifier: BSD-3-Clause ++ * Copyright(c) 2022 Intel Corporation ++ * ++ * Implements SFF-8024 Rev 4.0 of pluggable I/O configuration and some ++ * common utilities for SFF-8436/8636 and SFF-8472/8079 ++ * ++ */ ++ ++#ifndef _SFF_COMMON_H_ ++#define _SFF_COMMON_H_ ++ ++#include ++ ++#include "rte_ethdev.h" ++#include "sff_telemetry.h" ++ ++#define SFF_8024_ID_OFFSET 0x00 ++#define SFF_8024_ID_UNKNOWN 0x00 ++#define SFF_8024_ID_GBIC 0x01 ++#define SFF_8024_ID_SOLDERED_MODULE 0x02 ++#define SFF_8024_ID_SFP 0x03 ++#define SFF_8024_ID_300_PIN_XBI 0x04 ++#define SFF_8024_ID_XENPAK 0x05 ++#define SFF_8024_ID_XFP 0x06 ++#define SFF_8024_ID_XFF 0x07 ++#define SFF_8024_ID_XFP_E 0x08 ++#define SFF_8024_ID_XPAK 0x09 ++#define SFF_8024_ID_X2 0x0A ++#define SFF_8024_ID_DWDM_SFP 0x0B ++#define SFF_8024_ID_QSFP 0x0C ++#define SFF_8024_ID_QSFP_PLUS 0x0D ++#define SFF_8024_ID_CXP 0x0E ++#define SFF_8024_ID_HD4X 0x0F ++#define SFF_8024_ID_HD8X 0x10 ++#define SFF_8024_ID_QSFP28 0x11 ++#define SFF_8024_ID_CXP2 0x12 ++#define SFF_8024_ID_CDFP 0x13 ++#define SFF_8024_ID_HD4X_FANOUT 0x14 ++#define SFF_8024_ID_HD8X_FANOUT 0x15 ++#define SFF_8024_ID_CDFP_S3 0x16 ++#define SFF_8024_ID_MICRO_QSFP 0x17 ++#define SFF_8024_ID_LAST SFF_8024_ID_MICRO_QSFP ++#define SFF_8024_ID_UNALLOCATED_LAST 0x7F ++#define SFF_8024_ID_VENDOR_START 0x80 ++#define SFF_8024_ID_VENDOR_LAST 0xFF ++ ++#define SFF_8024_CTOR_UNKNOWN 0x00 ++#define SFF_8024_CTOR_SC 0x01 ++#define SFF_8024_CTOR_FC_STYLE_1 0x02 ++#define SFF_8024_CTOR_FC_STYLE_2 0x03 ++#define SFF_8024_CTOR_BNC_TNC 0x04 ++#define SFF_8024_CTOR_FC_COAX 0x05 ++#define SFF_8024_CTOR_FIBER_JACK 0x06 ++#define SFF_8024_CTOR_LC 0x07 ++#define SFF_8024_CTOR_MT_RJ 0x08 ++#define SFF_8024_CTOR_MU 0x09 ++#define SFF_8024_CTOR_SG 0x0A ++#define SFF_8024_CTOR_OPT_PT 0x0B ++#define SFF_8024_CTOR_MPO 0x0C ++#define SFF_8024_CTOR_MPO_2 0x0D ++/* 0E-1Fh --- Reserved */ ++#define SFF_8024_CTOR_HSDC_II 0x20 ++#define SFF_8024_CTOR_COPPER_PT 0x21 ++#define SFF_8024_CTOR_RJ45 0x22 ++#define SFF_8024_CTOR_NO_SEPARABLE 0x23 ++#define SFF_8024_CTOR_MXC_2x16 0x24 ++#define SFF_8024_CTOR_LAST SFF_8024_CTOR_MXC_2x16 ++#define SFF_8024_CTOR_UNALLOCATED_LAST 0x7F ++#define SFF_8024_CTOR_VENDOR_START 0x80 ++#define SFF_8024_CTOR_VENDOR_LAST 0xFF ++ ++/* ENCODING Values */ ++#define SFF_8024_ENCODING_UNSPEC 0x00 ++#define SFF_8024_ENCODING_8B10B 0x01 ++#define SFF_8024_ENCODING_4B5B 0x02 ++#define SFF_8024_ENCODING_NRZ 0x03 ++/* ++ * Value: 04h ++ * SFF-8472 - Manchester ++ * SFF-8436/8636 - SONET Scrambled ++ */ ++#define SFF_8024_ENCODING_4h 0x04 ++/* ++ * Value: 05h ++ * SFF-8472 - SONET Scrambled ++ * SFF-8436/8636 - 64B/66B ++ */ ++#define SFF_8024_ENCODING_5h 0x05 ++/* ++ * Value: 06h ++ * SFF-8472 - 64B/66B ++ * SFF-8436/8636 - Manchester ++ */ ++#define SFF_8024_ENCODING_6h 0x06 ++#define SFF_8024_ENCODING_256B 0x07 ++#define SFF_8024_ENCODING_PAM4 0x08 ++ ++/* Most common case: 16-bit unsigned integer in a certain unit */ ++#define SFF_OFFSET_TO_U16(offset) \ ++ (data[offset] << 8 | data[(offset) + 1]) ++ ++#define SFF_SPRINT_xX_PWR(str, var) \ ++ snprintf(str, sizeof(str), "%.4f mW / %.2f dBm", \ ++ (double)((var) / 10000.), \ ++ sff_convert_mw_to_dbm((double)((var) / 10000.))) ++ ++#define SFF_SPRINT_BIAS(str, bias_cur) \ ++ snprintf(str, sizeof(str), "%.3f mA", (double)(bias_cur / 500.)) ++ ++#define SFF_SPRINT_TEMP(str, temp) \ ++ snprintf(str, sizeof(str), "%.2f degrees C / %.2f degrees F", \ ++ (double)(temp / 256.), \ ++ (double)(temp / 256. * 1.8 + 32.)) ++ ++#define SFF_SPRINT_VCC(str, sfp_voltage) \ ++ snprintf(str, sizeof(str), "%.4f V", (double)(sfp_voltage / 10000.)) ++ ++/* Channel Monitoring Fields */ ++struct sff_channel_diags { ++ uint16_t bias_cur; /* Measured bias current in 2uA units */ ++ uint16_t rx_power; /* Measured RX Power */ ++ uint16_t tx_power; /* Measured TX Power */ ++}; ++ ++/* Module Monitoring Fields */ ++struct sff_diags { ++ ++#define SFF_MAX_CHANNEL_NUM 4 ++#define SFF_LWARN 0 ++#define SFF_HWARN 1 ++#define SFF_LALRM 2 ++#define SFF_HALRM 3 ++#define SFF_MCURR 4 ++ ++ /* Supports DOM */ ++ uint8_t supports_dom; ++ /* Supports alarm/warning thold */ ++ uint8_t supports_alarms; ++ /* RX Power: 0 = OMA, 1 = Average power */ ++ uint8_t rx_power_type; ++ /* TX Power: 0 = Not supported, 1 = Average power */ ++ uint8_t tx_power_type; ++ ++ uint8_t calibrated_ext; /* Is externally calibrated */ ++ /* [5] tables are low/high warn, low/high alarm, current */ ++ /* SFP voltage in 0.1mV units */ ++ uint16_t sfp_voltage[5]; ++ /* SFP Temp in 16-bit signed 1/256 Celsius */ ++ int16_t sfp_temp[5]; ++ /* Measured bias current in 2uA units */ ++ uint16_t bias_cur[5]; ++ /* Measured TX Power */ ++ uint16_t tx_power[5]; ++ /* Measured RX Power */ ++ uint16_t rx_power[5]; ++ struct sff_channel_diags scd[SFF_MAX_CHANNEL_NUM]; ++}; ++ ++double sff_convert_mw_to_dbm(double mw); ++void sff_show_value_with_unit(const uint8_t *data, unsigned int reg, ++ const char *name, unsigned int mult, ++ const char *unit, struct rte_tel_data *d); ++void sff_show_ascii(const uint8_t *data, unsigned int first_reg, ++ unsigned int last_reg, const char *name, struct rte_tel_data *d); ++void sff_show_thresholds(struct sff_diags sd, struct rte_tel_data *d); ++ ++void sff_8024_show_oui(const uint8_t *data, int id_offset, struct rte_tel_data *d); ++void sff_8024_show_identifier(const uint8_t *data, int id_offset, struct rte_tel_data *d); ++void sff_8024_show_connector(const uint8_t *data, int ctor_offset, struct rte_tel_data *d); ++void sff_8024_show_encoding(const uint8_t *data, int encoding_offset, ++ int sff_type, struct rte_tel_data *d); ++ ++#endif /* _SFF_COMMON_H_ */ +diff --git a/lib/ethdev/sff_telemetry.c b/lib/ethdev/sff_telemetry.c +index d415abd..7da4385 100644 +--- a/lib/ethdev/sff_telemetry.c ++++ b/lib/ethdev/sff_telemetry.c +@@ -78,6 +78,36 @@ sff_port_module_eeprom_parse(uint16_t port_id, struct rte_tel_data *d) + free(einfo.data); + } + ++void ++ssf_add_dict_string(struct rte_tel_data *d, const char *name_str, const char *value_str) ++{ ++ struct tel_dict_entry *e = &d->data.dict[d->data_len]; ++ ++ if (d->type != RTE_TEL_DICT) ++ return; ++ if (d->data_len >= RTE_TEL_MAX_DICT_ENTRIES) { ++ RTE_ETHDEV_LOG(ERR, "data_len has exceeded the maximum number of inserts\n"); ++ return; ++ } ++ ++ e->type = RTE_TEL_STRING_VAL; ++ /* append different values for same keys */ ++ if (d->data_len > 0) { ++ struct tel_dict_entry *previous = &d->data.dict[d->data_len - 1]; ++ if (strcmp(previous->name, name_str) == 0) { ++ strlcat(previous->value.sval, "; ", RTE_TEL_MAX_STRING_LEN); ++ strlcat(previous->value.sval, value_str, RTE_TEL_MAX_STRING_LEN); ++ goto end; ++ } ++ } ++ strlcpy(e->value.sval, value_str, RTE_TEL_MAX_STRING_LEN); ++ strlcpy(e->name, name_str, RTE_TEL_MAX_STRING_LEN); ++ d->data_len++; ++ ++end: ++ return; ++} ++ + int + eth_dev_handle_port_module_eeprom(const char *cmd __rte_unused, const char *params, + struct rte_tel_data *d) +diff --git a/lib/ethdev/sff_telemetry.h b/lib/ethdev/sff_telemetry.h +index 8c10a88..39c0f5a 100644 +--- a/lib/ethdev/sff_telemetry.h ++++ b/lib/ethdev/sff_telemetry.h +@@ -7,8 +7,13 @@ + + #include + ++#define SFF_ITEM_VAL_COMPOSE_SIZE 64 ++ + int eth_dev_handle_port_module_eeprom(const char *cmd __rte_unused, + const char *params, + struct rte_tel_data *d); + ++void ssf_add_dict_string(struct rte_tel_data *d, const char *name_str, ++ const char *value_str); ++ + #endif /* _ETHDEV_SFF_TELEMETRY_H_ */ +-- +2.23.0 + diff --git a/0353-ethdev-support-SFF-8079-module-telemetry.patch b/0353-ethdev-support-SFF-8079-module-telemetry.patch new file mode 100644 index 0000000..aecc381 --- /dev/null +++ b/0353-ethdev-support-SFF-8079-module-telemetry.patch @@ -0,0 +1,471 @@ +From 59d6646469a84142cea747793af88059d88a90de Mon Sep 17 00:00:00 2001 +From: Robin Zhang +Date: Thu, 26 May 2022 07:32:13 +0000 +Subject: ethdev: support SFF-8079 module telemetry + +[ upstream commit 084b4880ff0d4a984e3787d45adf072804e2d765 ] + +Add support for module EEPROM information format defined in +SFF-8079 Rev 1.7. + +Signed-off-by: Robin Zhang +Signed-off-by: Kevin Liu +Acked-by: Andrew Rybchenko +--- + lib/ethdev/meson.build | 1 + + lib/ethdev/sff_8079.c | 401 +++++++++++++++++++++++++++++++++++++ + lib/ethdev/sff_telemetry.c | 3 + + lib/ethdev/sff_telemetry.h | 3 + + 4 files changed, 408 insertions(+) + create mode 100644 lib/ethdev/sff_8079.c + +diff --git a/lib/ethdev/meson.build b/lib/ethdev/meson.build +index 4ec2178..5823fa0 100644 +--- a/lib/ethdev/meson.build ++++ b/lib/ethdev/meson.build +@@ -13,6 +13,7 @@ sources = files( + 'rte_tm.c', + 'sff_telemetry.c', + 'sff_common.c', ++ 'sff_8079.c', + ) + + headers = files( +diff --git a/lib/ethdev/sff_8079.c b/lib/ethdev/sff_8079.c +new file mode 100644 +index 0000000..91ad25f +--- /dev/null ++++ b/lib/ethdev/sff_8079.c +@@ -0,0 +1,401 @@ ++/* SPDX-License-Identifier: BSD-3-Clause ++ * Copyright(c) 2022 Intel Corporation ++ * Implements SFF-8079 optics diagnostics. ++ */ ++ ++#include ++ ++#include "sff_common.h" ++ ++static void sff_8079_show_identifier(const uint8_t *data, struct rte_tel_data *d) ++{ ++ sff_8024_show_identifier(data, 0, d); ++} ++ ++static void sff_8079_show_ext_identifier(const uint8_t *data, struct rte_tel_data *d) ++{ ++ char val_string[SFF_ITEM_VAL_COMPOSE_SIZE]; ++ ++ snprintf(val_string, sizeof(val_string), "0x%02x", data[1]); ++ if (data[1] == 0x00) ++ strlcat(val_string, " (GBIC not specified / not MOD_DEF compliant)", ++ sizeof(val_string)); ++ else if (data[1] == 0x04) ++ strlcat(val_string, " (GBIC/SFP defined by 2-wire interface ID)", ++ sizeof(val_string)); ++ else if (data[1] <= 0x07) { ++ char tmp[SFF_ITEM_VAL_COMPOSE_SIZE]; ++ snprintf(tmp, sizeof(tmp), " (GBIC compliant with MOD_DEF %u)", data[1]); ++ strlcat(val_string, tmp, sizeof(val_string)); ++ } else ++ strlcat(val_string, " (unknown)", sizeof(val_string)); ++ ssf_add_dict_string(d, "Extended identifier", val_string); ++} ++ ++static void sff_8079_show_connector(const uint8_t *data, struct rte_tel_data *d) ++{ ++ sff_8024_show_connector(data, 2, d); ++} ++ ++static void sff_8079_show_transceiver(const uint8_t *data, struct rte_tel_data *d) ++{ ++ static const char *name = "Transceiver type"; ++ char val_string[SFF_ITEM_VAL_COMPOSE_SIZE]; ++ ++ snprintf(val_string, sizeof(val_string), ++ "0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x", ++ data[3], data[4], data[5], data[6], data[7], data[8], data[9], data[10], data[36]); ++ ssf_add_dict_string(d, "Transceiver codes", val_string); ++ ++ /* 10G Ethernet Compliance Codes */ ++ if (data[3] & (1 << 7)) ++ ssf_add_dict_string(d, "10G Ethernet transceiver type", ++ "10G Ethernet: 10G Base-ER [SFF-8472 rev10.4 onwards]"); ++ if (data[3] & (1 << 6)) ++ ssf_add_dict_string(d, name, "10G Ethernet: 10G Base-LRM"); ++ if (data[3] & (1 << 5)) ++ ssf_add_dict_string(d, name, "10G Ethernet: 10G Base-LR"); ++ if (data[3] & (1 << 4)) ++ ssf_add_dict_string(d, name, "10G Ethernet: 10G Base-SR"); ++ ++ /* Infiniband Compliance Codes */ ++ if (data[3] & (1 << 3)) ++ ssf_add_dict_string(d, name, "Infiniband: 1X SX"); ++ if (data[3] & (1 << 2)) ++ ssf_add_dict_string(d, name, "Infiniband: 1X LX"); ++ if (data[3] & (1 << 1)) ++ ssf_add_dict_string(d, name, "Infiniband: 1X Copper Active"); ++ if (data[3] & (1 << 0)) ++ ssf_add_dict_string(d, name, "Infiniband: 1X Copper Passive"); ++ ++ /* ESCON Compliance Codes */ ++ if (data[4] & (1 << 7)) ++ ssf_add_dict_string(d, name, "ESCON: ESCON MMF, 1310nm LED"); ++ if (data[4] & (1 << 6)) ++ ssf_add_dict_string(d, name, "ESCON: ESCON SMF, 1310nm Laser"); ++ ++ /* SONET Compliance Codes */ ++ if (data[4] & (1 << 5)) ++ ssf_add_dict_string(d, name, "SONET: OC-192, short reach"); ++ if (data[4] & (1 << 4)) ++ ssf_add_dict_string(d, name, "SONET: SONET reach specifier bit 1"); ++ if (data[4] & (1 << 3)) ++ ssf_add_dict_string(d, name, "SONET: SONET reach specifier bit 2"); ++ if (data[4] & (1 << 2)) ++ ssf_add_dict_string(d, name, "SONET: OC-48, long reach"); ++ if (data[4] & (1 << 1)) ++ ssf_add_dict_string(d, name, "SONET: OC-48, intermediate reach"); ++ if (data[4] & (1 << 0)) ++ ssf_add_dict_string(d, name, "SONET: OC-48, short reach"); ++ if (data[5] & (1 << 6)) ++ ssf_add_dict_string(d, name, "SONET: OC-12, single mode, long reach"); ++ if (data[5] & (1 << 5)) ++ ssf_add_dict_string(d, name, "SONET: OC-12, single mode, inter. reach"); ++ if (data[5] & (1 << 4)) ++ ssf_add_dict_string(d, name, "SONET: OC-12, short reach"); ++ if (data[5] & (1 << 2)) ++ ssf_add_dict_string(d, name, "SONET: OC-3, single mode, long reach"); ++ if (data[5] & (1 << 1)) ++ ssf_add_dict_string(d, name, "SONET: OC-3, single mode, inter. reach"); ++ if (data[5] & (1 << 0)) ++ ssf_add_dict_string(d, name, "SONET: OC-3, short reach"); ++ ++ /* Ethernet Compliance Codes */ ++ if (data[6] & (1 << 7)) ++ ssf_add_dict_string(d, name, "Ethernet: BASE-PX"); ++ if (data[6] & (1 << 6)) ++ ssf_add_dict_string(d, name, "Ethernet: BASE-BX10"); ++ if (data[6] & (1 << 5)) ++ ssf_add_dict_string(d, name, "Ethernet: 100BASE-FX"); ++ if (data[6] & (1 << 4)) ++ ssf_add_dict_string(d, name, "Ethernet: 100BASE-LX/LX10"); ++ if (data[6] & (1 << 3)) ++ ssf_add_dict_string(d, name, "Ethernet: 1000BASE-T"); ++ if (data[6] & (1 << 2)) ++ ssf_add_dict_string(d, name, "Ethernet: 1000BASE-CX"); ++ if (data[6] & (1 << 1)) ++ ssf_add_dict_string(d, name, "Ethernet: 1000BASE-LX"); ++ if (data[6] & (1 << 0)) ++ ssf_add_dict_string(d, name, "Ethernet: 1000BASE-SX"); ++ ++ /* Fibre Channel link length */ ++ if (data[7] & (1 << 7)) ++ ssf_add_dict_string(d, name, "FC: very long distance (V)"); ++ if (data[7] & (1 << 6)) ++ ssf_add_dict_string(d, name, "FC: short distance (S)"); ++ if (data[7] & (1 << 5)) ++ ssf_add_dict_string(d, name, "FC: intermediate distance (I)"); ++ if (data[7] & (1 << 4)) ++ ssf_add_dict_string(d, name, "FC: long distance (L)"); ++ if (data[7] & (1 << 3)) ++ ssf_add_dict_string(d, name, "FC: medium distance (M)"); ++ ++ /* Fibre Channel transmitter technology */ ++ if (data[7] & (1 << 2)) ++ ssf_add_dict_string(d, name, "FC: Shortwave laser, linear Rx (SA)"); ++ if (data[7] & (1 << 1)) ++ ssf_add_dict_string(d, name, "FC: Longwave laser (LC)"); ++ if (data[7] & (1 << 0)) ++ ssf_add_dict_string(d, name, "FC: Electrical inter-enclosure (EL)"); ++ if (data[8] & (1 << 7)) ++ ssf_add_dict_string(d, name, "FC: Electrical intra-enclosure (EL)"); ++ if (data[8] & (1 << 6)) ++ ssf_add_dict_string(d, name, "FC: Shortwave laser w/o OFC (SN)"); ++ if (data[8] & (1 << 5)) ++ ssf_add_dict_string(d, name, "FC: Shortwave laser with OFC (SL)"); ++ if (data[8] & (1 << 4)) ++ ssf_add_dict_string(d, name, "FC: Longwave laser (LL)"); ++ if (data[8] & (1 << 3)) ++ ssf_add_dict_string(d, name, "Active Cable"); ++ if (data[8] & (1 << 2)) ++ ssf_add_dict_string(d, name, "Passive Cable"); ++ if (data[8] & (1 << 1)) ++ ssf_add_dict_string(d, name, "FC: Copper FC-BaseT"); ++ ++ /* Fibre Channel transmission media */ ++ if (data[9] & (1 << 7)) ++ ssf_add_dict_string(d, name, "FC: Twin Axial Pair (TW)"); ++ if (data[9] & (1 << 6)) ++ ssf_add_dict_string(d, name, "FC: Twisted Pair (TP)"); ++ if (data[9] & (1 << 5)) ++ ssf_add_dict_string(d, name, "FC: Miniature Coax (MI)"); ++ if (data[9] & (1 << 4)) ++ ssf_add_dict_string(d, name, "FC: Video Coax (TV)"); ++ if (data[9] & (1 << 3)) ++ ssf_add_dict_string(d, name, "FC: Multimode, 62.5um (M6)"); ++ if (data[9] & (1 << 2)) ++ ssf_add_dict_string(d, name, "FC: Multimode, 50um (M5)"); ++ if (data[9] & (1 << 0)) ++ ssf_add_dict_string(d, name, "FC: Single Mode (SM)"); ++ ++ /* Fibre Channel speed */ ++ if (data[10] & (1 << 7)) ++ ssf_add_dict_string(d, name, "FC: 1200 MBytes/sec"); ++ if (data[10] & (1 << 6)) ++ ssf_add_dict_string(d, name, "FC: 800 MBytes/sec"); ++ if (data[10] & (1 << 4)) ++ ssf_add_dict_string(d, name, "FC: 400 MBytes/sec"); ++ if (data[10] & (1 << 2)) ++ ssf_add_dict_string(d, name, "FC: 200 MBytes/sec"); ++ if (data[10] & (1 << 0)) ++ ssf_add_dict_string(d, name, "FC: 100 MBytes/sec"); ++ ++ /* Extended Specification Compliance Codes from SFF-8024 */ ++ switch (data[36]) { ++ case 0x1: ++ ssf_add_dict_string(d, name, ++ "Extended: 100G AOC or 25GAUI C2M AOC with worst BER of 5x10^(-5)"); ++ break; ++ case 0x2: ++ ssf_add_dict_string(d, name, "Extended: 100G Base-SR4 or 25GBase-SR"); ++ break; ++ case 0x3: ++ ssf_add_dict_string(d, name, "Extended: 100G Base-LR4 or 25GBase-LR"); ++ break; ++ case 0x4: ++ ssf_add_dict_string(d, name, "Extended: 100G Base-ER4 or 25GBase-ER"); ++ break; ++ case 0x8: ++ ssf_add_dict_string(d, name, ++ "Extended: 100G ACC or 25GAUI C2M ACC with worst BER of 5x10^(-5)"); ++ break; ++ case 0xb: ++ ssf_add_dict_string(d, name, "Extended: 100G Base-CR4 or 25G Base-CR CA-L"); ++ break; ++ case 0xc: ++ ssf_add_dict_string(d, name, "Extended: 25G Base-CR CA-S"); ++ break; ++ case 0xd: ++ ssf_add_dict_string(d, name, "Extended: 25G Base-CR CA-N"); ++ break; ++ case 0x16: ++ ssf_add_dict_string(d, name, "Extended: 10Gbase-T with SFI electrical interface"); ++ break; ++ case 0x18: ++ ssf_add_dict_string(d, name, ++ "Extended: 100G AOC or 25GAUI C2M AOC with worst BER of 10^(-12)"); ++ break; ++ case 0x19: ++ ssf_add_dict_string(d, name, ++ "Extended: 100G ACC or 25GAUI C2M ACC with worst BER of 10^(-12)"); ++ break; ++ case 0x1c: ++ ssf_add_dict_string(d, name, "Extended: 10Gbase-T Short Reach"); ++ break; ++ default: ++ break; ++ } ++} ++ ++static void sff_8079_show_encoding(const uint8_t *data, struct rte_tel_data *d) ++{ ++ sff_8024_show_encoding(data, 11, RTE_ETH_MODULE_SFF_8472, d); ++} ++ ++static void sff_8079_show_rate_identifier(const uint8_t *data, struct rte_tel_data *d) ++{ ++ char val_string[SFF_ITEM_VAL_COMPOSE_SIZE]; ++ ++ snprintf(val_string, sizeof(val_string), "0x%02x", data[13]); ++ ++ switch (data[13]) { ++ case 0x00: ++ strlcat(val_string, " (unspecified)", sizeof(val_string)); ++ break; ++ case 0x01: ++ strlcat(val_string, " (4/2/1G Rate_Select & AS0/AS1)", sizeof(val_string)); ++ break; ++ case 0x02: ++ strlcat(val_string, " (8/4/2G Rx Rate_Select only)", sizeof(val_string)); ++ break; ++ case 0x03: ++ strlcat(val_string, " (8/4/2G Independent Rx & Tx Rate_Select)", ++ sizeof(val_string)); ++ break; ++ case 0x04: ++ strlcat(val_string, " (8/4/2G Tx Rate_Select only)", sizeof(val_string)); ++ break; ++ default: ++ strlcat(val_string, " (reserved or unknown)", sizeof(val_string)); ++ break; ++ } ++ ssf_add_dict_string(d, "Rate identifier", val_string); ++} ++ ++static void sff_8079_show_oui(const uint8_t *data, struct rte_tel_data *d) ++{ ++ sff_8024_show_oui(data, 37, d); ++} ++ ++static void ++sff_8079_show_wavelength_or_copper_compliance(const uint8_t *data, ++ struct rte_tel_data *d) ++{ ++ char val_string[SFF_ITEM_VAL_COMPOSE_SIZE]; ++ ++ if (data[8] & (1 << 2)) { ++ snprintf(val_string, sizeof(val_string), "0x%02x", data[60]); ++ switch (data[60]) { ++ case 0x00: ++ strlcat(val_string, " (unspecified)", sizeof(val_string)); ++ break; ++ case 0x01: ++ strlcat(val_string, " (SFF-8431 appendix E)", sizeof(val_string)); ++ break; ++ default: ++ strlcat(val_string, " (unknown)", sizeof(val_string)); ++ break; ++ } ++ strlcat(val_string, " [SFF-8472 rev10.4 only]", sizeof(val_string)); ++ ssf_add_dict_string(d, "Passive Cu cmplnce.", val_string); ++ } else if (data[8] & (1 << 3)) { ++ snprintf(val_string, sizeof(val_string), "0x%02x", data[60]); ++ switch (data[60]) { ++ case 0x00: ++ strlcat(val_string, " (unspecified)", sizeof(val_string)); ++ break; ++ case 0x01: ++ strlcat(val_string, " (SFF-8431 appendix E)", sizeof(val_string)); ++ break; ++ case 0x04: ++ strlcat(val_string, " (SFF-8431 limiting)", sizeof(val_string)); ++ break; ++ default: ++ strlcat(val_string, " (unknown)", sizeof(val_string)); ++ break; ++ } ++ strlcat(val_string, " [SFF-8472 rev10.4 only]", sizeof(val_string)); ++ ssf_add_dict_string(d, "Active Cu cmplnce.", val_string); ++ } else { ++ snprintf(val_string, sizeof(val_string), "%unm", (data[60] << 8) | data[61]); ++ ssf_add_dict_string(d, "Laser wavelength", val_string); ++ } ++} ++ ++static void sff_8079_show_options(const uint8_t *data, struct rte_tel_data *d) ++{ ++ static const char *name = "Option"; ++ char val_string[SFF_ITEM_VAL_COMPOSE_SIZE]; ++ ++ snprintf(val_string, sizeof(val_string), "0x%02x 0x%02x", data[64], data[65]); ++ ssf_add_dict_string(d, "Option values", val_string); ++ ++ if (data[65] & (1 << 1)) ++ ssf_add_dict_string(d, name, "RX_LOS implemented"); ++ if (data[65] & (1 << 2)) ++ ssf_add_dict_string(d, name, "RX_LOS implemented, inverted"); ++ if (data[65] & (1 << 3)) ++ ssf_add_dict_string(d, name, "TX_FAULT implemented"); ++ if (data[65] & (1 << 4)) ++ ssf_add_dict_string(d, name, "TX_DISABLE implemented"); ++ if (data[65] & (1 << 5)) ++ ssf_add_dict_string(d, name, "RATE_SELECT implemented"); ++ if (data[65] & (1 << 6)) ++ ssf_add_dict_string(d, name, "Tunable transmitter technology"); ++ if (data[65] & (1 << 7)) ++ ssf_add_dict_string(d, name, "Receiver decision threshold implemented"); ++ if (data[64] & (1 << 0)) ++ ssf_add_dict_string(d, name, "Linear receiver output implemented"); ++ if (data[64] & (1 << 1)) ++ ssf_add_dict_string(d, name, "Power level 2 requirement"); ++ if (data[64] & (1 << 2)) ++ ssf_add_dict_string(d, name, "Cooled transceiver implemented"); ++ if (data[64] & (1 << 3)) ++ ssf_add_dict_string(d, name, "Retimer or CDR implemented"); ++ if (data[64] & (1 << 4)) ++ ssf_add_dict_string(d, name, "Paging implemented"); ++ if (data[64] & (1 << 5)) ++ ssf_add_dict_string(d, name, "Power level 3 requirement"); ++} ++ ++void sff_8079_show_all(const uint8_t *data, struct rte_tel_data *d) ++{ ++ sff_8079_show_identifier(data, d); ++ if (((data[0] == 0x02) || (data[0] == 0x03)) && (data[1] == 0x04)) { ++ unsigned int br_nom, br_min, br_max; ++ char val_string[SFF_ITEM_VAL_COMPOSE_SIZE]; ++ ++ if (data[12] == 0) { ++ br_nom = br_min = br_max = 0; ++ } else if (data[12] == 255) { ++ br_nom = data[66] * 250; ++ br_max = data[67]; ++ br_min = data[67]; ++ } else { ++ br_nom = data[12] * 100; ++ br_max = data[66]; ++ br_min = data[67]; ++ } ++ sff_8079_show_ext_identifier(data, d); ++ sff_8079_show_connector(data, d); ++ sff_8079_show_transceiver(data, d); ++ sff_8079_show_encoding(data, d); ++ ++ snprintf(val_string, sizeof(val_string), "%uMBd", br_nom); ++ ssf_add_dict_string(d, "BR, Nominal", val_string); ++ ++ sff_8079_show_rate_identifier(data, d); ++ sff_show_value_with_unit(data, 14, ++ "Length (SMF,km)", 1, "km", d); ++ sff_show_value_with_unit(data, 15, "Length (SMF)", 100, "m", d); ++ sff_show_value_with_unit(data, 16, "Length (50um)", 10, "m", d); ++ sff_show_value_with_unit(data, 17, ++ "Length (62.5um)", 10, "m", d); ++ sff_show_value_with_unit(data, 18, "Length (Copper)", 1, "m", d); ++ sff_show_value_with_unit(data, 19, "Length (OM3)", 10, "m", d); ++ sff_8079_show_wavelength_or_copper_compliance(data, d); ++ sff_show_ascii(data, 20, 35, "Vendor name", d); ++ sff_8079_show_oui(data, d); ++ sff_show_ascii(data, 40, 55, "Vendor PN", d); ++ sff_show_ascii(data, 56, 59, "Vendor rev", d); ++ sff_8079_show_options(data, d); ++ ++ snprintf(val_string, sizeof(val_string), "%u%%", br_max); ++ ssf_add_dict_string(d, "BR margin, max", val_string); ++ snprintf(val_string, sizeof(val_string), "%u%%", br_min); ++ ssf_add_dict_string(d, "BR margin, min", val_string); ++ ++ sff_show_ascii(data, 68, 83, "Vendor SN", d); ++ sff_show_ascii(data, 84, 91, "Date code", d); ++ } ++} +diff --git a/lib/ethdev/sff_telemetry.c b/lib/ethdev/sff_telemetry.c +index 7da4385..bc458af 100644 +--- a/lib/ethdev/sff_telemetry.c ++++ b/lib/ethdev/sff_telemetry.c +@@ -70,6 +70,9 @@ sff_port_module_eeprom_parse(uint16_t port_id, struct rte_tel_data *d) + + switch (minfo.type) { + /* parsing module EEPROM data base on different module type */ ++ case RTE_ETH_MODULE_SFF_8079: ++ sff_8079_show_all(einfo.data, d); ++ break; + default: + RTE_ETHDEV_LOG(NOTICE, "Unsupported module type: %u\n", minfo.type); + break; +diff --git a/lib/ethdev/sff_telemetry.h b/lib/ethdev/sff_telemetry.h +index 39c0f5a..81fb45e 100644 +--- a/lib/ethdev/sff_telemetry.h ++++ b/lib/ethdev/sff_telemetry.h +@@ -9,6 +9,9 @@ + + #define SFF_ITEM_VAL_COMPOSE_SIZE 64 + ++/* SFF-8079 Optics diagnostics */ ++void sff_8079_show_all(const uint8_t *data, struct rte_tel_data *d); ++ + int eth_dev_handle_port_module_eeprom(const char *cmd __rte_unused, + const char *params, + struct rte_tel_data *d); +-- +2.23.0 + diff --git a/0354-ethdev-support-SFF-8472-module-telemetry.patch b/0354-ethdev-support-SFF-8472-module-telemetry.patch new file mode 100644 index 0000000..5a49899 --- /dev/null +++ b/0354-ethdev-support-SFF-8472-module-telemetry.patch @@ -0,0 +1,351 @@ +From b9a55306238ad50311fa2df68df6d494b4799e38 Mon Sep 17 00:00:00 2001 +From: Robin Zhang +Date: Thu, 26 May 2022 07:32:14 +0000 +Subject: ethdev: support SFF-8472 module telemetry + +[ upstream commit 0caf7f376b088fcfc1980ac6d79dd3b3df96d324 ] + +Add support for module EEPROM information format defined in +SFF-8472 Rev 12.0 + +Signed-off-by: Robin Zhang +Signed-off-by: Kevin Liu +Acked-by: Andrew Rybchenko +--- + lib/ethdev/meson.build | 1 + + lib/ethdev/sff_8472.c | 280 +++++++++++++++++++++++++++++++++++++ + lib/ethdev/sff_telemetry.c | 4 + + lib/ethdev/sff_telemetry.h | 3 + + 4 files changed, 288 insertions(+) + create mode 100644 lib/ethdev/sff_8472.c + +diff --git a/lib/ethdev/meson.build b/lib/ethdev/meson.build +index 5823fa0..6c24c0b 100644 +--- a/lib/ethdev/meson.build ++++ b/lib/ethdev/meson.build +@@ -14,6 +14,7 @@ sources = files( + 'sff_telemetry.c', + 'sff_common.c', + 'sff_8079.c', ++ 'sff_8472.c', + ) + + headers = files( +diff --git a/lib/ethdev/sff_8472.c b/lib/ethdev/sff_8472.c +new file mode 100644 +index 0000000..97f2318 +--- /dev/null ++++ b/lib/ethdev/sff_8472.c +@@ -0,0 +1,280 @@ ++/* SPDX-License-Identifier: BSD-3-Clause ++ * Copyright(c) 2022 Intel Corporation ++ * Implements SFF-8472 optics diagnostics. ++ */ ++ ++#include ++ ++#include "sff_common.h" ++ ++/* Offsets in decimal, for direct comparison with the SFF specs */ ++ ++/* A0-based EEPROM offsets for DOM support checks */ ++#define SFF_A0_DOM 92 ++#define SFF_A0_OPTIONS 93 ++#define SFF_A0_COMP 94 ++ ++/* EEPROM bit values for various registers */ ++#define SFF_A0_DOM_EXTCAL RTE_BIT32(4) ++#define SFF_A0_DOM_INTCAL RTE_BIT32(5) ++#define SFF_A0_DOM_IMPL RTE_BIT32(6) ++#define SFF_A0_DOM_PWRT RTE_BIT32(3) ++ ++#define SFF_A0_OPTIONS_AW RTE_BIT32(7) ++ ++/* ++ * This is the offset at which the A2 page is in the EEPROM ++ * blob returned by the kernel. ++ */ ++#define SFF_A2_BASE 0x100 ++ ++/* A2-based offsets for DOM */ ++#define SFF_A2_TEMP 96 ++#define SFF_A2_TEMP_HALRM 0 ++#define SFF_A2_TEMP_LALRM 2 ++#define SFF_A2_TEMP_HWARN 4 ++#define SFF_A2_TEMP_LWARN 6 ++ ++#define SFF_A2_VCC 98 ++#define SFF_A2_VCC_HALRM 8 ++#define SFF_A2_VCC_LALRM 10 ++#define SFF_A2_VCC_HWARN 12 ++#define SFF_A2_VCC_LWARN 14 ++ ++#define SFF_A2_BIAS 100 ++#define SFF_A2_BIAS_HALRM 16 ++#define SFF_A2_BIAS_LALRM 18 ++#define SFF_A2_BIAS_HWARN 20 ++#define SFF_A2_BIAS_LWARN 22 ++ ++#define SFF_A2_TX_PWR 102 ++#define SFF_A2_TX_PWR_HALRM 24 ++#define SFF_A2_TX_PWR_LALRM 26 ++#define SFF_A2_TX_PWR_HWARN 28 ++#define SFF_A2_TX_PWR_LWARN 30 ++ ++#define SFF_A2_RX_PWR 104 ++#define SFF_A2_RX_PWR_HALRM 32 ++#define SFF_A2_RX_PWR_LALRM 34 ++#define SFF_A2_RX_PWR_HWARN 36 ++#define SFF_A2_RX_PWR_LWARN 38 ++ ++#define SFF_A2_ALRM_FLG 112 ++#define SFF_A2_WARN_FLG 116 ++ ++/* 32-bit little-endian calibration constants */ ++#define SFF_A2_CAL_RXPWR4 56 ++#define SFF_A2_CAL_RXPWR3 60 ++#define SFF_A2_CAL_RXPWR2 64 ++#define SFF_A2_CAL_RXPWR1 68 ++#define SFF_A2_CAL_RXPWR0 72 ++ ++/* 16-bit little endian calibration constants */ ++#define SFF_A2_CAL_TXI_SLP 76 ++#define SFF_A2_CAL_TXI_OFF 78 ++#define SFF_A2_CAL_TXPWR_SLP 80 ++#define SFF_A2_CAL_TXPWR_OFF 82 ++#define SFF_A2_CAL_T_SLP 84 ++#define SFF_A2_CAL_T_OFF 86 ++#define SFF_A2_CAL_V_SLP 88 ++#define SFF_A2_CAL_V_OFF 90 ++ ++static struct sff_8472_aw_flags { ++ const char *str; /* Human-readable string, null at the end */ ++ int offset; /* A2-relative address offset */ ++ uint8_t value; /* Alarm is on if (offset & value) != 0. */ ++} sff_8472_aw_flags[] = { ++ { "Laser bias current high alarm", SFF_A2_ALRM_FLG, RTE_BIT32(3) }, ++ { "Laser bias current low alarm", SFF_A2_ALRM_FLG, RTE_BIT32(2) }, ++ { "Laser bias current high warning", SFF_A2_WARN_FLG, RTE_BIT32(3) }, ++ { "Laser bias current low warning", SFF_A2_WARN_FLG, RTE_BIT32(2) }, ++ ++ { "Laser output power high alarm", SFF_A2_ALRM_FLG, RTE_BIT32(1) }, ++ { "Laser output power low alarm", SFF_A2_ALRM_FLG, RTE_BIT32(0) }, ++ { "Laser output power high warning", SFF_A2_WARN_FLG, RTE_BIT32(1) }, ++ { "Laser output power low warning", SFF_A2_WARN_FLG, RTE_BIT32(0) }, ++ ++ { "Module temperature high alarm", SFF_A2_ALRM_FLG, RTE_BIT32(7) }, ++ { "Module temperature low alarm", SFF_A2_ALRM_FLG, RTE_BIT32(6) }, ++ { "Module temperature high warning", SFF_A2_WARN_FLG, RTE_BIT32(7) }, ++ { "Module temperature low warning", SFF_A2_WARN_FLG, RTE_BIT32(6) }, ++ ++ { "Module voltage high alarm", SFF_A2_ALRM_FLG, RTE_BIT32(5) }, ++ { "Module voltage low alarm", SFF_A2_ALRM_FLG, RTE_BIT32(4) }, ++ { "Module voltage high warning", SFF_A2_WARN_FLG, RTE_BIT32(5) }, ++ { "Module voltage low warning", SFF_A2_WARN_FLG, RTE_BIT32(4) }, ++ ++ { "Laser rx power high alarm", SFF_A2_ALRM_FLG + 1, RTE_BIT32(7) }, ++ { "Laser rx power low alarm", SFF_A2_ALRM_FLG + 1, RTE_BIT32(6) }, ++ { "Laser rx power high warning", SFF_A2_WARN_FLG + 1, RTE_BIT32(7) }, ++ { "Laser rx power low warning", SFF_A2_WARN_FLG + 1, RTE_BIT32(6) }, ++ ++ { NULL, 0, 0 }, ++}; ++ ++/* Most common case: 16-bit unsigned integer in a certain unit */ ++#define A2_OFFSET_TO_U16(offset) \ ++ (data[SFF_A2_BASE + (offset)] << 8 | data[SFF_A2_BASE + (offset) + 1]) ++ ++/* Calibration slope is a number between 0.0 included and 256.0 excluded. */ ++#define A2_OFFSET_TO_SLP(offset) \ ++ (data[SFF_A2_BASE + (offset)] + data[SFF_A2_BASE + (offset) + 1] / 256.) ++ ++/* Calibration offset is an integer from -32768 to 32767 */ ++#define A2_OFFSET_TO_OFF(offset) \ ++ ((int16_t)A2_OFFSET_TO_U16(offset)) ++ ++/* RXPWR(x) are IEEE-754 floating point numbers in big-endian format */ ++#define A2_OFFSET_TO_RXPWRx(offset) \ ++ (befloattoh((const uint32_t *)(data + SFF_A2_BASE + (offset)))) ++ ++/* ++ * 2-byte internal temperature conversions: ++ * First byte is a signed 8-bit integer, which is the temp decimal part ++ * Second byte are 1/256th of degree, which are added to the dec part. ++ */ ++#define A2_OFFSET_TO_TEMP(offset) ((int16_t)A2_OFFSET_TO_U16(offset)) ++ ++static void sff_8472_dom_parse(const uint8_t *data, struct sff_diags *sd) ++{ ++ sd->bias_cur[SFF_MCURR] = A2_OFFSET_TO_U16(SFF_A2_BIAS); ++ sd->bias_cur[SFF_HALRM] = A2_OFFSET_TO_U16(SFF_A2_BIAS_HALRM); ++ sd->bias_cur[SFF_LALRM] = A2_OFFSET_TO_U16(SFF_A2_BIAS_LALRM); ++ sd->bias_cur[SFF_HWARN] = A2_OFFSET_TO_U16(SFF_A2_BIAS_HWARN); ++ sd->bias_cur[SFF_LWARN] = A2_OFFSET_TO_U16(SFF_A2_BIAS_LWARN); ++ ++ sd->sfp_voltage[SFF_MCURR] = A2_OFFSET_TO_U16(SFF_A2_VCC); ++ sd->sfp_voltage[SFF_HALRM] = A2_OFFSET_TO_U16(SFF_A2_VCC_HALRM); ++ sd->sfp_voltage[SFF_LALRM] = A2_OFFSET_TO_U16(SFF_A2_VCC_LALRM); ++ sd->sfp_voltage[SFF_HWARN] = A2_OFFSET_TO_U16(SFF_A2_VCC_HWARN); ++ sd->sfp_voltage[SFF_LWARN] = A2_OFFSET_TO_U16(SFF_A2_VCC_LWARN); ++ ++ sd->tx_power[SFF_MCURR] = A2_OFFSET_TO_U16(SFF_A2_TX_PWR); ++ sd->tx_power[SFF_HALRM] = A2_OFFSET_TO_U16(SFF_A2_TX_PWR_HALRM); ++ sd->tx_power[SFF_LALRM] = A2_OFFSET_TO_U16(SFF_A2_TX_PWR_LALRM); ++ sd->tx_power[SFF_HWARN] = A2_OFFSET_TO_U16(SFF_A2_TX_PWR_HWARN); ++ sd->tx_power[SFF_LWARN] = A2_OFFSET_TO_U16(SFF_A2_TX_PWR_LWARN); ++ ++ sd->rx_power[SFF_MCURR] = A2_OFFSET_TO_U16(SFF_A2_RX_PWR); ++ sd->rx_power[SFF_HALRM] = A2_OFFSET_TO_U16(SFF_A2_RX_PWR_HALRM); ++ sd->rx_power[SFF_LALRM] = A2_OFFSET_TO_U16(SFF_A2_RX_PWR_LALRM); ++ sd->rx_power[SFF_HWARN] = A2_OFFSET_TO_U16(SFF_A2_RX_PWR_HWARN); ++ sd->rx_power[SFF_LWARN] = A2_OFFSET_TO_U16(SFF_A2_RX_PWR_LWARN); ++ ++ sd->sfp_temp[SFF_MCURR] = A2_OFFSET_TO_TEMP(SFF_A2_TEMP); ++ sd->sfp_temp[SFF_HALRM] = A2_OFFSET_TO_TEMP(SFF_A2_TEMP_HALRM); ++ sd->sfp_temp[SFF_LALRM] = A2_OFFSET_TO_TEMP(SFF_A2_TEMP_LALRM); ++ sd->sfp_temp[SFF_HWARN] = A2_OFFSET_TO_TEMP(SFF_A2_TEMP_HWARN); ++ sd->sfp_temp[SFF_LWARN] = A2_OFFSET_TO_TEMP(SFF_A2_TEMP_LWARN); ++} ++ ++/* Converts to a float from a big-endian 4-byte source buffer. */ ++static float befloattoh(const uint32_t *source) ++{ ++ union { ++ uint32_t src; ++ float dst; ++ } converter; ++ ++ converter.src = ntohl(*source); ++ return converter.dst; ++} ++ ++static void sff_8472_calibration(const uint8_t *data, struct sff_diags *sd) ++{ ++ unsigned long i; ++ uint16_t rx_reading; ++ ++ /* Calibration should occur for all values (threshold and current) */ ++ for (i = 0; i < RTE_DIM(sd->bias_cur); ++i) { ++ /* ++ * Apply calibration formula 1 (Temp., Voltage, Bias, Tx Power) ++ */ ++ sd->bias_cur[i] *= A2_OFFSET_TO_SLP(SFF_A2_CAL_TXI_SLP); ++ sd->tx_power[i] *= A2_OFFSET_TO_SLP(SFF_A2_CAL_TXPWR_SLP); ++ sd->sfp_voltage[i] *= A2_OFFSET_TO_SLP(SFF_A2_CAL_V_SLP); ++ sd->sfp_temp[i] *= A2_OFFSET_TO_SLP(SFF_A2_CAL_T_SLP); ++ ++ sd->bias_cur[i] += A2_OFFSET_TO_OFF(SFF_A2_CAL_TXI_OFF); ++ sd->tx_power[i] += A2_OFFSET_TO_OFF(SFF_A2_CAL_TXPWR_OFF); ++ sd->sfp_voltage[i] += A2_OFFSET_TO_OFF(SFF_A2_CAL_V_OFF); ++ sd->sfp_temp[i] += A2_OFFSET_TO_OFF(SFF_A2_CAL_T_OFF); ++ ++ /* ++ * Apply calibration formula 2 (Rx Power only) ++ */ ++ rx_reading = sd->rx_power[i]; ++ sd->rx_power[i] = A2_OFFSET_TO_RXPWRx(SFF_A2_CAL_RXPWR0); ++ sd->rx_power[i] += rx_reading * ++ A2_OFFSET_TO_RXPWRx(SFF_A2_CAL_RXPWR1); ++ sd->rx_power[i] += rx_reading * ++ A2_OFFSET_TO_RXPWRx(SFF_A2_CAL_RXPWR2); ++ sd->rx_power[i] += rx_reading * ++ A2_OFFSET_TO_RXPWRx(SFF_A2_CAL_RXPWR3); ++ } ++} ++ ++static void sff_8472_parse_eeprom(const uint8_t *data, struct sff_diags *sd) ++{ ++ sd->supports_dom = data[SFF_A0_DOM] & SFF_A0_DOM_IMPL; ++ sd->supports_alarms = data[SFF_A0_OPTIONS] & SFF_A0_OPTIONS_AW; ++ sd->calibrated_ext = data[SFF_A0_DOM] & SFF_A0_DOM_EXTCAL; ++ sd->rx_power_type = data[SFF_A0_DOM] & SFF_A0_DOM_PWRT; ++ ++ sff_8472_dom_parse(data, sd); ++ ++ /* ++ * If the SFP is externally calibrated, we need to read calibration data ++ * and compensate the already stored readings. ++ */ ++ if (sd->calibrated_ext) ++ sff_8472_calibration(data, sd); ++} ++ ++void sff_8472_show_all(const uint8_t *data, struct rte_tel_data *d) ++{ ++ struct sff_diags sd = {0}; ++ const char *rx_power_string = NULL; ++ char val_string[SFF_ITEM_VAL_COMPOSE_SIZE]; ++ int i; ++ ++ sff_8472_parse_eeprom(data, &sd); ++ ++ if (!sd.supports_dom) { ++ ssf_add_dict_string(d, "Optical diagnostics support", "No"); ++ return; ++ } ++ ssf_add_dict_string(d, "Optical diagnostics support", "Yes"); ++ ++ SFF_SPRINT_BIAS(val_string, sd.bias_cur[SFF_MCURR]); ++ ssf_add_dict_string(d, "Laser bias current", val_string); ++ ++ SFF_SPRINT_xX_PWR(val_string, sd.tx_power[SFF_MCURR]); ++ ssf_add_dict_string(d, "Laser output power", val_string); ++ ++ if (!sd.rx_power_type) ++ rx_power_string = "Receiver signal OMA"; ++ else ++ rx_power_string = "Receiver signal average optical power"; ++ ++ SFF_SPRINT_xX_PWR(val_string, sd.rx_power[SFF_MCURR]); ++ ssf_add_dict_string(d, rx_power_string, val_string); ++ ++ SFF_SPRINT_TEMP(val_string, sd.sfp_temp[SFF_MCURR]); ++ ssf_add_dict_string(d, "Module temperature", val_string); ++ ++ SFF_SPRINT_VCC(val_string, sd.sfp_voltage[SFF_MCURR]); ++ ssf_add_dict_string(d, "Module voltage", val_string); ++ ++ ssf_add_dict_string(d, "Alarm/warning flags implemented", ++ (sd.supports_alarms ? "Yes" : "No")); ++ ++ if (sd.supports_alarms) { ++ for (i = 0; sff_8472_aw_flags[i].str; ++i) { ++ ssf_add_dict_string(d, sff_8472_aw_flags[i].str, ++ data[SFF_A2_BASE + sff_8472_aw_flags[i].offset] ++ & sff_8472_aw_flags[i].value ? "On" : "Off"); ++ } ++ sff_show_thresholds(sd, d); ++ } ++} +diff --git a/lib/ethdev/sff_telemetry.c b/lib/ethdev/sff_telemetry.c +index bc458af..babb941 100644 +--- a/lib/ethdev/sff_telemetry.c ++++ b/lib/ethdev/sff_telemetry.c +@@ -73,6 +73,10 @@ sff_port_module_eeprom_parse(uint16_t port_id, struct rte_tel_data *d) + case RTE_ETH_MODULE_SFF_8079: + sff_8079_show_all(einfo.data, d); + break; ++ case RTE_ETH_MODULE_SFF_8472: ++ sff_8079_show_all(einfo.data, d); ++ sff_8472_show_all(einfo.data, d); ++ break; + default: + RTE_ETHDEV_LOG(NOTICE, "Unsupported module type: %u\n", minfo.type); + break; +diff --git a/lib/ethdev/sff_telemetry.h b/lib/ethdev/sff_telemetry.h +index 81fb45e..3a8131d 100644 +--- a/lib/ethdev/sff_telemetry.h ++++ b/lib/ethdev/sff_telemetry.h +@@ -12,6 +12,9 @@ + /* SFF-8079 Optics diagnostics */ + void sff_8079_show_all(const uint8_t *data, struct rte_tel_data *d); + ++/* SFF-8472 Optics diagnostics */ ++void sff_8472_show_all(const uint8_t *data, struct rte_tel_data *d); ++ + int eth_dev_handle_port_module_eeprom(const char *cmd __rte_unused, + const char *params, + struct rte_tel_data *d); +-- +2.23.0 + diff --git a/0355-ethdev-support-SFF-8636-module-telemetry.patch b/0355-ethdev-support-SFF-8636-module-telemetry.patch new file mode 100644 index 0000000..e1af955 --- /dev/null +++ b/0355-ethdev-support-SFF-8636-module-telemetry.patch @@ -0,0 +1,1433 @@ +From 37492ce91408582f2d69c2f4df246ae6b1d70151 Mon Sep 17 00:00:00 2001 +From: Robin Zhang +Date: Thu, 26 May 2022 07:32:15 +0000 +Subject: ethdev: support SFF-8636 module telemetry + +[ upstream commit c42754fd581a4298b9db54aa063285a4ead5e23a ] + +Add support for module EEPROM information format defined in +SFF-8636 Rev 2.7. + +Signed-off-by: Robin Zhang +Signed-off-by: Kevin Liu +Acked-by: Andrew Rybchenko +--- + lib/ethdev/meson.build | 1 + + lib/ethdev/sff_8636.c | 764 +++++++++++++++++++++++++++++++++++++ + lib/ethdev/sff_8636.h | 590 ++++++++++++++++++++++++++++ + lib/ethdev/sff_telemetry.c | 4 + + lib/ethdev/sff_telemetry.h | 3 + + 5 files changed, 1362 insertions(+) + create mode 100644 lib/ethdev/sff_8636.c + create mode 100644 lib/ethdev/sff_8636.h + +diff --git a/lib/ethdev/meson.build b/lib/ethdev/meson.build +index 6c24c0b..47bb262 100644 +--- a/lib/ethdev/meson.build ++++ b/lib/ethdev/meson.build +@@ -15,6 +15,7 @@ sources = files( + 'sff_common.c', + 'sff_8079.c', + 'sff_8472.c', ++ 'sff_8636.c', + ) + + headers = files( +diff --git a/lib/ethdev/sff_8636.c b/lib/ethdev/sff_8636.c +new file mode 100644 +index 0000000..6b65f47 +--- /dev/null ++++ b/lib/ethdev/sff_8636.c +@@ -0,0 +1,764 @@ ++/* SPDX-License-Identifier: BSD-3-Clause ++ * Copyright(c) 2022 Intel Corporation ++ * Implements SFF-8636 based QSFP+/QSFP28 Diagnostics Memory map. ++ */ ++ ++#include ++#include ++ ++#include "sff_common.h" ++#include "sff_8636.h" ++ ++#define SFF_MAX_DESC_SIZE 42 ++ ++static const uint8_t sff_8636_rx_power_offset[SFF_MAX_CHANNEL_NUM] = { ++ SFF_8636_RX_PWR_1_OFFSET, ++ SFF_8636_RX_PWR_2_OFFSET, ++ SFF_8636_RX_PWR_3_OFFSET, ++ SFF_8636_RX_PWR_4_OFFSET, ++}; ++static const uint8_t sff_8636_tx_power_offset[SFF_MAX_CHANNEL_NUM] = { ++ SFF_8636_TX_PWR_1_OFFSET, ++ SFF_8636_TX_PWR_2_OFFSET, ++ SFF_8636_TX_PWR_3_OFFSET, ++ SFF_8636_TX_PWR_4_OFFSET, ++}; ++static const uint8_t sff_8636_tx_bias_offset[SFF_MAX_CHANNEL_NUM] = { ++ SFF_8636_TX_BIAS_1_OFFSET, ++ SFF_8636_TX_BIAS_2_OFFSET, ++ SFF_8636_TX_BIAS_3_OFFSET, ++ SFF_8636_TX_BIAS_4_OFFSET, ++}; ++ ++static struct sff_8636_aw_flags { ++ const char *str; /* Human-readable string, null at the end */ ++ int offset; /* A2-relative address offset */ ++ uint8_t value; /* Alarm is on if (offset & value) != 0. */ ++} sff_8636_aw_flags[] = { ++ { "Laser bias current high alarm (Chan 1)", ++ SFF_8636_TX_BIAS_12_AW_OFFSET, (SFF_8636_TX_BIAS_1_HALARM) }, ++ { "Laser bias current low alarm (Chan 1)", ++ SFF_8636_TX_BIAS_12_AW_OFFSET, (SFF_8636_TX_BIAS_1_LALARM) }, ++ { "Laser bias current high warning (Chan 1)", ++ SFF_8636_TX_BIAS_12_AW_OFFSET, (SFF_8636_TX_BIAS_1_HWARN) }, ++ { "Laser bias current low warning (Chan 1)", ++ SFF_8636_TX_BIAS_12_AW_OFFSET, (SFF_8636_TX_BIAS_1_LWARN) }, ++ ++ { "Laser bias current high alarm (Chan 2)", ++ SFF_8636_TX_BIAS_12_AW_OFFSET, (SFF_8636_TX_BIAS_2_HALARM) }, ++ { "Laser bias current low alarm (Chan 2)", ++ SFF_8636_TX_BIAS_12_AW_OFFSET, (SFF_8636_TX_BIAS_2_LALARM) }, ++ { "Laser bias current high warning (Chan 2)", ++ SFF_8636_TX_BIAS_12_AW_OFFSET, (SFF_8636_TX_BIAS_2_HWARN) }, ++ { "Laser bias current low warning (Chan 2)", ++ SFF_8636_TX_BIAS_12_AW_OFFSET, (SFF_8636_TX_BIAS_2_LWARN) }, ++ ++ { "Laser bias current high alarm (Chan 3)", ++ SFF_8636_TX_BIAS_34_AW_OFFSET, (SFF_8636_TX_BIAS_3_HALARM) }, ++ { "Laser bias current low alarm (Chan 3)", ++ SFF_8636_TX_BIAS_34_AW_OFFSET, (SFF_8636_TX_BIAS_3_LALARM) }, ++ { "Laser bias current high warning (Chan 3)", ++ SFF_8636_TX_BIAS_34_AW_OFFSET, (SFF_8636_TX_BIAS_3_HWARN) }, ++ { "Laser bias current low warning (Chan 3)", ++ SFF_8636_TX_BIAS_34_AW_OFFSET, (SFF_8636_TX_BIAS_3_LWARN) }, ++ ++ { "Laser bias current high alarm (Chan 4)", ++ SFF_8636_TX_BIAS_34_AW_OFFSET, (SFF_8636_TX_BIAS_4_HALARM) }, ++ { "Laser bias current low alarm (Chan 4)", ++ SFF_8636_TX_BIAS_34_AW_OFFSET, (SFF_8636_TX_BIAS_4_LALARM) }, ++ { "Laser bias current high warning (Chan 4)", ++ SFF_8636_TX_BIAS_34_AW_OFFSET, (SFF_8636_TX_BIAS_4_HWARN) }, ++ { "Laser bias current low warning (Chan 4)", ++ SFF_8636_TX_BIAS_34_AW_OFFSET, (SFF_8636_TX_BIAS_4_LWARN) }, ++ ++ { "Module temperature high alarm", ++ SFF_8636_TEMP_AW_OFFSET, (SFF_8636_TEMP_HALARM_STATUS) }, ++ { "Module temperature low alarm", ++ SFF_8636_TEMP_AW_OFFSET, (SFF_8636_TEMP_LALARM_STATUS) }, ++ { "Module temperature high warning", ++ SFF_8636_TEMP_AW_OFFSET, (SFF_8636_TEMP_HWARN_STATUS) }, ++ { "Module temperature low warning", ++ SFF_8636_TEMP_AW_OFFSET, (SFF_8636_TEMP_LWARN_STATUS) }, ++ ++ { "Module voltage high alarm", ++ SFF_8636_VCC_AW_OFFSET, (SFF_8636_VCC_HALARM_STATUS) }, ++ { "Module voltage low alarm", ++ SFF_8636_VCC_AW_OFFSET, (SFF_8636_VCC_LALARM_STATUS) }, ++ { "Module voltage high warning", ++ SFF_8636_VCC_AW_OFFSET, (SFF_8636_VCC_HWARN_STATUS) }, ++ { "Module voltage low warning", ++ SFF_8636_VCC_AW_OFFSET, (SFF_8636_VCC_LWARN_STATUS) }, ++ ++ { "Laser tx power high alarm (Channel 1)", ++ SFF_8636_TX_PWR_12_AW_OFFSET, (SFF_8636_TX_PWR_1_HALARM) }, ++ { "Laser tx power low alarm (Channel 1)", ++ SFF_8636_TX_PWR_12_AW_OFFSET, (SFF_8636_TX_PWR_1_LALARM) }, ++ { "Laser tx power high warning (Channel 1)", ++ SFF_8636_TX_PWR_12_AW_OFFSET, (SFF_8636_TX_PWR_1_HWARN) }, ++ { "Laser tx power low warning (Channel 1)", ++ SFF_8636_TX_PWR_12_AW_OFFSET, (SFF_8636_TX_PWR_1_LWARN) }, ++ ++ { "Laser tx power high alarm (Channel 2)", ++ SFF_8636_TX_PWR_12_AW_OFFSET, (SFF_8636_TX_PWR_2_HALARM) }, ++ { "Laser tx power low alarm (Channel 2)", ++ SFF_8636_TX_PWR_12_AW_OFFSET, (SFF_8636_TX_PWR_2_LALARM) }, ++ { "Laser tx power high warning (Channel 2)", ++ SFF_8636_TX_PWR_12_AW_OFFSET, (SFF_8636_TX_PWR_2_HWARN) }, ++ { "Laser tx power low warning (Channel 2)", ++ SFF_8636_TX_PWR_12_AW_OFFSET, (SFF_8636_TX_PWR_2_LWARN) }, ++ ++ { "Laser tx power high alarm (Channel 3)", ++ SFF_8636_TX_PWR_34_AW_OFFSET, (SFF_8636_TX_PWR_3_HALARM) }, ++ { "Laser tx power low alarm (Channel 3)", ++ SFF_8636_TX_PWR_34_AW_OFFSET, (SFF_8636_TX_PWR_3_LALARM) }, ++ { "Laser tx power high warning (Channel 3)", ++ SFF_8636_TX_PWR_34_AW_OFFSET, (SFF_8636_TX_PWR_3_HWARN) }, ++ { "Laser tx power low warning (Channel 3)", ++ SFF_8636_TX_PWR_34_AW_OFFSET, (SFF_8636_TX_PWR_3_LWARN) }, ++ ++ { "Laser tx power high alarm (Channel 4)", ++ SFF_8636_TX_PWR_34_AW_OFFSET, (SFF_8636_TX_PWR_4_HALARM) }, ++ { "Laser tx power low alarm (Channel 4)", ++ SFF_8636_TX_PWR_34_AW_OFFSET, (SFF_8636_TX_PWR_4_LALARM) }, ++ { "Laser tx power high warning (Channel 4)", ++ SFF_8636_TX_PWR_34_AW_OFFSET, (SFF_8636_TX_PWR_4_HWARN) }, ++ { "Laser tx power low warning (Channel 4)", ++ SFF_8636_TX_PWR_34_AW_OFFSET, (SFF_8636_TX_PWR_4_LWARN) }, ++ ++ { "Laser rx power high alarm (Channel 1)", ++ SFF_8636_RX_PWR_12_AW_OFFSET, (SFF_8636_RX_PWR_1_HALARM) }, ++ { "Laser rx power low alarm (Channel 1)", ++ SFF_8636_RX_PWR_12_AW_OFFSET, (SFF_8636_RX_PWR_1_LALARM) }, ++ { "Laser rx power high warning (Channel 1)", ++ SFF_8636_RX_PWR_12_AW_OFFSET, (SFF_8636_RX_PWR_1_HWARN) }, ++ { "Laser rx power low warning (Channel 1)", ++ SFF_8636_RX_PWR_12_AW_OFFSET, (SFF_8636_RX_PWR_1_LWARN) }, ++ ++ { "Laser rx power high alarm (Channel 2)", ++ SFF_8636_RX_PWR_12_AW_OFFSET, (SFF_8636_RX_PWR_2_HALARM) }, ++ { "Laser rx power low alarm (Channel 2)", ++ SFF_8636_RX_PWR_12_AW_OFFSET, (SFF_8636_RX_PWR_2_LALARM) }, ++ { "Laser rx power high warning (Channel 2)", ++ SFF_8636_RX_PWR_12_AW_OFFSET, (SFF_8636_RX_PWR_2_HWARN) }, ++ { "Laser rx power low warning (Channel 2)", ++ SFF_8636_RX_PWR_12_AW_OFFSET, (SFF_8636_RX_PWR_2_LWARN) }, ++ ++ { "Laser rx power high alarm (Channel 3)", ++ SFF_8636_RX_PWR_34_AW_OFFSET, (SFF_8636_RX_PWR_3_HALARM) }, ++ { "Laser rx power low alarm (Channel 3)", ++ SFF_8636_RX_PWR_34_AW_OFFSET, (SFF_8636_RX_PWR_3_LALARM) }, ++ { "Laser rx power high warning (Channel 3)", ++ SFF_8636_RX_PWR_34_AW_OFFSET, (SFF_8636_RX_PWR_3_HWARN) }, ++ { "Laser rx power low warning (Channel 3)", ++ SFF_8636_RX_PWR_34_AW_OFFSET, (SFF_8636_RX_PWR_3_LWARN) }, ++ ++ { "Laser rx power high alarm (Channel 4)", ++ SFF_8636_RX_PWR_34_AW_OFFSET, (SFF_8636_RX_PWR_4_HALARM) }, ++ { "Laser rx power low alarm (Channel 4)", ++ SFF_8636_RX_PWR_34_AW_OFFSET, (SFF_8636_RX_PWR_4_LALARM) }, ++ { "Laser rx power high warning (Channel 4)", ++ SFF_8636_RX_PWR_34_AW_OFFSET, (SFF_8636_RX_PWR_4_HWARN) }, ++ { "Laser rx power low warning (Channel 4)", ++ SFF_8636_RX_PWR_34_AW_OFFSET, (SFF_8636_RX_PWR_4_LWARN) }, ++ ++ { NULL, 0, 0 }, ++}; ++ ++static void sff_8636_show_identifier(const uint8_t *data, struct rte_tel_data *d) ++{ ++ sff_8024_show_identifier(data, SFF_8636_ID_OFFSET, d); ++} ++ ++static void sff_8636_show_ext_identifier(const uint8_t *data, struct rte_tel_data *d) ++{ ++ static const char *name = "Extended identifier description"; ++ char val_string[SFF_ITEM_VAL_COMPOSE_SIZE]; ++ snprintf(val_string, sizeof(val_string), "0x%02x", data[SFF_8636_EXT_ID_OFFSET]); ++ ssf_add_dict_string(d, "Extended identifier", val_string); ++ ++ switch (data[SFF_8636_EXT_ID_OFFSET] & SFF_8636_EXT_ID_PWR_CLASS_MASK) { ++ case SFF_8636_EXT_ID_PWR_CLASS_1: ++ ssf_add_dict_string(d, name, "1.5W max. Power consumption"); ++ break; ++ case SFF_8636_EXT_ID_PWR_CLASS_2: ++ ssf_add_dict_string(d, name, "2.0W max. Power consumption"); ++ break; ++ case SFF_8636_EXT_ID_PWR_CLASS_3: ++ ssf_add_dict_string(d, name, "2.5W max. Power consumption"); ++ break; ++ case SFF_8636_EXT_ID_PWR_CLASS_4: ++ ssf_add_dict_string(d, name, "3.5W max. Power consumption"); ++ break; ++ } ++ ++ if (data[SFF_8636_EXT_ID_OFFSET] & SFF_8636_EXT_ID_CDR_TX_MASK) ++ ssf_add_dict_string(d, name, "CDR present in TX"); ++ else ++ ssf_add_dict_string(d, name, "No CDR in TX"); ++ ++ if (data[SFF_8636_EXT_ID_OFFSET] & SFF_8636_EXT_ID_CDR_RX_MASK) ++ ssf_add_dict_string(d, name, "CDR present in RX"); ++ else ++ ssf_add_dict_string(d, name, "No CDR in RX"); ++ ++ switch (data[SFF_8636_EXT_ID_OFFSET] & SFF_8636_EXT_ID_EPWR_CLASS_MASK) { ++ case SFF_8636_EXT_ID_PWR_CLASS_LEGACY: ++ snprintf(val_string, sizeof(val_string), "%s", ""); ++ break; ++ case SFF_8636_EXT_ID_PWR_CLASS_5: ++ snprintf(val_string, sizeof(val_string), "%s", "4.0W max. Power consumption, "); ++ break; ++ case SFF_8636_EXT_ID_PWR_CLASS_6: ++ snprintf(val_string, sizeof(val_string), "%s", "4.5W max. Power consumption, "); ++ break; ++ case SFF_8636_EXT_ID_PWR_CLASS_7: ++ snprintf(val_string, sizeof(val_string), "%s", "5.0W max. Power consumption, "); ++ break; ++ } ++ ++ if (data[SFF_8636_PWR_MODE_OFFSET] & SFF_8636_HIGH_PWR_ENABLE) ++ strlcat(val_string, "High Power Class (> 3.5 W) enabled", sizeof(val_string)); ++ else ++ strlcat(val_string, "High Power Class (> 3.5 W) not enabled", sizeof(val_string)); ++ ++ ssf_add_dict_string(d, name, val_string); ++} ++ ++static void sff_8636_show_connector(const uint8_t *data, struct rte_tel_data *d) ++{ ++ sff_8024_show_connector(data, SFF_8636_CTOR_OFFSET, d); ++} ++ ++static void sff_8636_show_transceiver(const uint8_t *data, struct rte_tel_data *d) ++{ ++ static const char *name = "Transceiver type"; ++ char val_string[SFF_ITEM_VAL_COMPOSE_SIZE]; ++ ++ snprintf(val_string, sizeof(val_string), "0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x", ++ data[SFF_8636_ETHERNET_COMP_OFFSET], ++ data[SFF_8636_SONET_COMP_OFFSET], ++ data[SFF_8636_SAS_COMP_OFFSET], ++ data[SFF_8636_GIGE_COMP_OFFSET], ++ data[SFF_8636_FC_LEN_OFFSET], ++ data[SFF_8636_FC_TECH_OFFSET], ++ data[SFF_8636_FC_TRANS_MEDIA_OFFSET], ++ data[SFF_8636_FC_SPEED_OFFSET]); ++ ssf_add_dict_string(d, "Transceiver codes", val_string); ++ ++ /* 10G/40G Ethernet Compliance Codes */ ++ if (data[SFF_8636_ETHERNET_COMP_OFFSET] & SFF_8636_ETHERNET_10G_LRM) ++ ssf_add_dict_string(d, name, "10G Ethernet: 10G Base-LRM"); ++ if (data[SFF_8636_ETHERNET_COMP_OFFSET] & SFF_8636_ETHERNET_10G_LR) ++ ssf_add_dict_string(d, name, "10G Ethernet: 10G Base-LR"); ++ if (data[SFF_8636_ETHERNET_COMP_OFFSET] & SFF_8636_ETHERNET_10G_SR) ++ ssf_add_dict_string(d, name, "10G Ethernet: 10G Base-SR"); ++ if (data[SFF_8636_ETHERNET_COMP_OFFSET] & SFF_8636_ETHERNET_40G_CR4) ++ ssf_add_dict_string(d, name, "40G Ethernet: 40G Base-CR4"); ++ if (data[SFF_8636_ETHERNET_COMP_OFFSET] & SFF_8636_ETHERNET_40G_SR4) ++ ssf_add_dict_string(d, name, "40G Ethernet: 40G Base-SR4"); ++ if (data[SFF_8636_ETHERNET_COMP_OFFSET] & SFF_8636_ETHERNET_40G_LR4) ++ ssf_add_dict_string(d, name, "40G Ethernet: 40G Base-LR4"); ++ if (data[SFF_8636_ETHERNET_COMP_OFFSET] & SFF_8636_ETHERNET_40G_ACTIVE) ++ ssf_add_dict_string(d, name, "40G Ethernet: 40G Active Cable (XLPPI)"); ++ ++ /* Extended Specification Compliance Codes from SFF-8024 */ ++ if (data[SFF_8636_ETHERNET_COMP_OFFSET] & SFF_8636_ETHERNET_RSRVD) { ++ switch (data[SFF_8636_OPTION_1_OFFSET]) { ++ case SFF_8636_ETHERNET_UNSPECIFIED: ++ ssf_add_dict_string(d, name, "(reserved or unknown)"); ++ break; ++ case SFF_8636_ETHERNET_100G_AOC: ++ ssf_add_dict_string(d, name, ++ "100G Ethernet: 100G AOC or 25GAUI C2M AOC with worst BER of 5x10^(-5)"); ++ break; ++ case SFF_8636_ETHERNET_100G_SR4: ++ ssf_add_dict_string(d, name, ++ "100G Ethernet: 100G Base-SR4 or 25GBase-SR"); ++ break; ++ case SFF_8636_ETHERNET_100G_LR4: ++ ssf_add_dict_string(d, name, "100G Ethernet: 100G Base-LR4"); ++ break; ++ case SFF_8636_ETHERNET_100G_ER4: ++ ssf_add_dict_string(d, name, "100G Ethernet: 100G Base-ER4"); ++ break; ++ case SFF_8636_ETHERNET_100G_SR10: ++ ssf_add_dict_string(d, name, "100G Ethernet: 100G Base-SR10"); ++ break; ++ case SFF_8636_ETHERNET_100G_CWDM4_FEC: ++ ssf_add_dict_string(d, name, "100G Ethernet: 100G CWDM4 MSA with FEC"); ++ break; ++ case SFF_8636_ETHERNET_100G_PSM4: ++ ssf_add_dict_string(d, name, "100G Ethernet: 100G PSM4 Parallel SMF"); ++ break; ++ case SFF_8636_ETHERNET_100G_ACC: ++ ssf_add_dict_string(d, name, ++ "100G Ethernet: 100G ACC or 25GAUI C2M ACC with worst BER of 5x10^(-5)"); ++ break; ++ case SFF_8636_ETHERNET_100G_CWDM4_NO_FEC: ++ ssf_add_dict_string(d, name, ++ "100G Ethernet: 100G CWDM4 MSA without FEC"); ++ break; ++ case SFF_8636_ETHERNET_100G_RSVD1: ++ ssf_add_dict_string(d, name, "(reserved or unknown)"); ++ break; ++ case SFF_8636_ETHERNET_100G_CR4: ++ ssf_add_dict_string(d, name, ++ "100G Ethernet: 100G Base-CR4 or 25G Base-CR CA-L"); ++ break; ++ case SFF_8636_ETHERNET_25G_CR_CA_S: ++ ssf_add_dict_string(d, name, "25G Ethernet: 25G Base-CR CA-S"); ++ break; ++ case SFF_8636_ETHERNET_25G_CR_CA_N: ++ ssf_add_dict_string(d, name, "25G Ethernet: 25G Base-CR CA-N"); ++ break; ++ case SFF_8636_ETHERNET_40G_ER4: ++ ssf_add_dict_string(d, name, "40G Ethernet: 40G Base-ER4"); ++ break; ++ case SFF_8636_ETHERNET_4X10_SR: ++ ssf_add_dict_string(d, name, "4x10G Ethernet: 10G Base-SR"); ++ break; ++ case SFF_8636_ETHERNET_40G_PSM4: ++ ssf_add_dict_string(d, name, "40G Ethernet: 40G PSM4 Parallel SMF"); ++ break; ++ case SFF_8636_ETHERNET_G959_P1I1_2D1: ++ ssf_add_dict_string(d, name, ++ "Ethernet: G959.1 profile P1I1-2D1 (10709 MBd, 2km, 1310nm SM)"); ++ break; ++ case SFF_8636_ETHERNET_G959_P1S1_2D2: ++ ssf_add_dict_string(d, name, ++ "Ethernet: G959.1 profile P1S1-2D2 (10709 MBd, 40km, 1550nm SM)"); ++ break; ++ case SFF_8636_ETHERNET_G959_P1L1_2D2: ++ ssf_add_dict_string(d, name, ++ "Ethernet: G959.1 profile P1L1-2D2 (10709 MBd, 80km, 1550nm SM)"); ++ break; ++ case SFF_8636_ETHERNET_10GT_SFI: ++ ssf_add_dict_string(d, name, ++ "10G Ethernet: 10G Base-T with SFI electrical interface"); ++ break; ++ case SFF_8636_ETHERNET_100G_CLR4: ++ ssf_add_dict_string(d, name, "100G Ethernet: 100G CLR4"); ++ break; ++ case SFF_8636_ETHERNET_100G_AOC2: ++ ssf_add_dict_string(d, name, ++ "100G Ethernet: 100G AOC or 25GAUI C2M AOC with worst BER of 10^(-12)"); ++ break; ++ case SFF_8636_ETHERNET_100G_ACC2: ++ ssf_add_dict_string(d, name, ++ "100G Ethernet: 100G ACC or 25GAUI C2M ACC with worst BER of 10^(-12)"); ++ break; ++ default: ++ ssf_add_dict_string(d, name, "(reserved or unknown)"); ++ break; ++ } ++ } ++ ++ /* SONET Compliance Codes */ ++ if (data[SFF_8636_SONET_COMP_OFFSET] & SFF_8636_SONET_40G_OTN) ++ ssf_add_dict_string(d, name, "40G OTN (OTU3B/OTU3C)"); ++ if (data[SFF_8636_SONET_COMP_OFFSET] & SFF_8636_SONET_OC48_LR) ++ ssf_add_dict_string(d, name, "SONET: OC-48, long reach"); ++ if (data[SFF_8636_SONET_COMP_OFFSET] & SFF_8636_SONET_OC48_IR) ++ ssf_add_dict_string(d, name, "SONET: OC-48, intermediate reach"); ++ if (data[SFF_8636_SONET_COMP_OFFSET] & SFF_8636_SONET_OC48_SR) ++ ssf_add_dict_string(d, name, "SONET: OC-48, short reach"); ++ ++ /* SAS/SATA Compliance Codes */ ++ if (data[SFF_8636_SAS_COMP_OFFSET] & SFF_8636_SAS_6G) ++ ssf_add_dict_string(d, name, "SAS 6.0G"); ++ if (data[SFF_8636_SAS_COMP_OFFSET] & SFF_8636_SAS_3G) ++ ssf_add_dict_string(d, name, "SAS 3.0G"); ++ ++ /* Ethernet Compliance Codes */ ++ if (data[SFF_8636_GIGE_COMP_OFFSET] & SFF_8636_GIGE_1000_BASE_T) ++ ssf_add_dict_string(d, name, "Ethernet: 1000BASE-T"); ++ if (data[SFF_8636_GIGE_COMP_OFFSET] & SFF_8636_GIGE_1000_BASE_CX) ++ ssf_add_dict_string(d, name, "Ethernet: 1000BASE-CX"); ++ if (data[SFF_8636_GIGE_COMP_OFFSET] & SFF_8636_GIGE_1000_BASE_LX) ++ ssf_add_dict_string(d, name, "Ethernet: 1000BASE-LX"); ++ if (data[SFF_8636_GIGE_COMP_OFFSET] & SFF_8636_GIGE_1000_BASE_SX) ++ ssf_add_dict_string(d, name, "Ethernet: 1000BASE-SX"); ++ ++ /* Fibre Channel link length */ ++ if (data[SFF_8636_FC_LEN_OFFSET] & SFF_8636_FC_LEN_VERY_LONG) ++ ssf_add_dict_string(d, name, "FC: very long distance (V)"); ++ if (data[SFF_8636_FC_LEN_OFFSET] & SFF_8636_FC_LEN_SHORT) ++ ssf_add_dict_string(d, name, "FC: short distance (S)"); ++ if (data[SFF_8636_FC_LEN_OFFSET] & SFF_8636_FC_LEN_INT) ++ ssf_add_dict_string(d, name, "FC: intermediate distance (I)"); ++ if (data[SFF_8636_FC_LEN_OFFSET] & SFF_8636_FC_LEN_LONG) ++ ssf_add_dict_string(d, name, "FC: long distance (L)"); ++ if (data[SFF_8636_FC_LEN_OFFSET] & SFF_8636_FC_LEN_MED) ++ ssf_add_dict_string(d, name, "FC: medium distance (M)"); ++ ++ /* Fibre Channel transmitter technology */ ++ if (data[SFF_8636_FC_LEN_OFFSET] & SFF_8636_FC_TECH_LONG_LC) ++ ssf_add_dict_string(d, name, "FC: Longwave laser (LC)"); ++ if (data[SFF_8636_FC_LEN_OFFSET] & SFF_8636_FC_TECH_ELEC_INTER) ++ ssf_add_dict_string(d, name, "FC: Electrical inter-enclosure (EL)"); ++ if (data[SFF_8636_FC_TECH_OFFSET] & SFF_8636_FC_TECH_ELEC_INTRA) ++ ssf_add_dict_string(d, name, "FC: Electrical intra-enclosure (EL)"); ++ if (data[SFF_8636_FC_TECH_OFFSET] & SFF_8636_FC_TECH_SHORT_WO_OFC) ++ ssf_add_dict_string(d, name, "FC: Shortwave laser w/o OFC (SN)"); ++ if (data[SFF_8636_FC_TECH_OFFSET] & SFF_8636_FC_TECH_SHORT_W_OFC) ++ ssf_add_dict_string(d, name, "FC: Shortwave laser with OFC (SL)"); ++ if (data[SFF_8636_FC_TECH_OFFSET] & SFF_8636_FC_TECH_LONG_LL) ++ ssf_add_dict_string(d, name, "FC: Longwave laser (LL)"); ++ ++ /* Fibre Channel transmission media */ ++ if (data[SFF_8636_FC_TRANS_MEDIA_OFFSET] & SFF_8636_FC_TRANS_MEDIA_TW) ++ ssf_add_dict_string(d, name, "FC: Twin Axial Pair (TW)"); ++ if (data[SFF_8636_FC_TRANS_MEDIA_OFFSET] & SFF_8636_FC_TRANS_MEDIA_TP) ++ ssf_add_dict_string(d, name, "FC: Twisted Pair (TP)"); ++ if (data[SFF_8636_FC_TRANS_MEDIA_OFFSET] & SFF_8636_FC_TRANS_MEDIA_MI) ++ ssf_add_dict_string(d, name, "FC: Miniature Coax (MI)"); ++ if (data[SFF_8636_FC_TRANS_MEDIA_OFFSET] & SFF_8636_FC_TRANS_MEDIA_TV) ++ ssf_add_dict_string(d, name, "FC: Video Coax (TV)"); ++ if (data[SFF_8636_FC_TRANS_MEDIA_OFFSET] & SFF_8636_FC_TRANS_MEDIA_M6) ++ ssf_add_dict_string(d, name, "FC: Multimode, 62.5m (M6)"); ++ if (data[SFF_8636_FC_TRANS_MEDIA_OFFSET] & SFF_8636_FC_TRANS_MEDIA_M5) ++ ssf_add_dict_string(d, name, "FC: Multimode, 50m (M5)"); ++ if (data[SFF_8636_FC_TRANS_MEDIA_OFFSET] & SFF_8636_FC_TRANS_MEDIA_OM3) ++ ssf_add_dict_string(d, name, "FC: Multimode, 50um (OM3)"); ++ if (data[SFF_8636_FC_TRANS_MEDIA_OFFSET] & SFF_8636_FC_TRANS_MEDIA_SM) ++ ssf_add_dict_string(d, name, "FC: Single Mode (SM)"); ++ ++ /* Fibre Channel speed */ ++ if (data[SFF_8636_FC_SPEED_OFFSET] & SFF_8636_FC_SPEED_1200_MBPS) ++ ssf_add_dict_string(d, name, "FC: 1200 MBytes/sec"); ++ if (data[SFF_8636_FC_SPEED_OFFSET] & SFF_8636_FC_SPEED_800_MBPS) ++ ssf_add_dict_string(d, name, "FC: 800 MBytes/sec"); ++ if (data[SFF_8636_FC_SPEED_OFFSET] & SFF_8636_FC_SPEED_1600_MBPS) ++ ssf_add_dict_string(d, name, "FC: 1600 MBytes/sec"); ++ if (data[SFF_8636_FC_SPEED_OFFSET] & SFF_8636_FC_SPEED_400_MBPS) ++ ssf_add_dict_string(d, name, "FC: 400 MBytes/sec"); ++ if (data[SFF_8636_FC_SPEED_OFFSET] & SFF_8636_FC_SPEED_200_MBPS) ++ ssf_add_dict_string(d, name, "FC: 200 MBytes/sec"); ++ if (data[SFF_8636_FC_SPEED_OFFSET] & SFF_8636_FC_SPEED_100_MBPS) ++ ssf_add_dict_string(d, name, "FC: 100 MBytes/sec"); ++} ++ ++static void sff_8636_show_encoding(const uint8_t *data, struct rte_tel_data *d) ++{ ++ sff_8024_show_encoding(data, SFF_8636_ENCODING_OFFSET, ++ RTE_ETH_MODULE_SFF_8636, d); ++} ++ ++static void sff_8636_show_rate_identifier(const uint8_t *data, struct rte_tel_data *d) ++{ ++ char val_string[20]; ++ ++ snprintf(val_string, sizeof(val_string), "0x%02x", data[SFF_8636_EXT_RS_OFFSET]); ++ ssf_add_dict_string(d, "Rate identifier", val_string); ++} ++ ++static void sff_8636_show_oui(const uint8_t *data, struct rte_tel_data *d) ++{ ++ sff_8024_show_oui(data, SFF_8636_VENDOR_OUI_OFFSET, d); ++} ++ ++static void sff_8636_show_wavelength_or_copper_compliance(const uint8_t *data, ++ struct rte_tel_data *d) ++{ ++ char val_string[SFF_ITEM_VAL_COMPOSE_SIZE]; ++ snprintf(val_string, sizeof(val_string), "0x%02x", ++ (data[SFF_8636_DEVICE_TECH_OFFSET] & SFF_8636_TRANS_TECH_MASK)); ++ ++ switch (data[SFF_8636_DEVICE_TECH_OFFSET] & SFF_8636_TRANS_TECH_MASK) { ++ case SFF_8636_TRANS_850_VCSEL: ++ strlcat(val_string, " (850 nm VCSEL)", sizeof(val_string)); ++ break; ++ case SFF_8636_TRANS_1310_VCSEL: ++ strlcat(val_string, " (1310 nm VCSEL)", sizeof(val_string)); ++ break; ++ case SFF_8636_TRANS_1550_VCSEL: ++ strlcat(val_string, " (1550 nm VCSEL)", sizeof(val_string)); ++ break; ++ case SFF_8636_TRANS_1310_FP: ++ strlcat(val_string, " (1310 nm FP)", sizeof(val_string)); ++ break; ++ case SFF_8636_TRANS_1310_DFB: ++ strlcat(val_string, " (1310 nm DFB)", sizeof(val_string)); ++ break; ++ case SFF_8636_TRANS_1550_DFB: ++ strlcat(val_string, " (1550 nm DFB)", sizeof(val_string)); ++ break; ++ case SFF_8636_TRANS_1310_EML: ++ strlcat(val_string, " (1310 nm EML)", sizeof(val_string)); ++ break; ++ case SFF_8636_TRANS_1550_EML: ++ strlcat(val_string, " (1550 nm EML)", sizeof(val_string)); ++ break; ++ case SFF_8636_TRANS_OTHERS: ++ strlcat(val_string, " (Others/Undefined)", sizeof(val_string)); ++ break; ++ case SFF_8636_TRANS_1490_DFB: ++ strlcat(val_string, " (1490 nm DFB)", sizeof(val_string)); ++ break; ++ case SFF_8636_TRANS_COPPER_PAS_UNEQUAL: ++ strlcat(val_string, " (Copper cable unequalized)", sizeof(val_string)); ++ break; ++ case SFF_8636_TRANS_COPPER_PAS_EQUAL: ++ strlcat(val_string, " (Copper cable passive equalized)", sizeof(val_string)); ++ break; ++ case SFF_8636_TRANS_COPPER_LNR_FAR_EQUAL: ++ strlcat(val_string, ++ " (Copper cable, near and far end limiting active equalizers)", ++ sizeof(val_string)); ++ break; ++ case SFF_8636_TRANS_COPPER_FAR_EQUAL: ++ strlcat(val_string, ++ " (Copper cable, far end limiting active equalizers)", ++ sizeof(val_string)); ++ break; ++ case SFF_8636_TRANS_COPPER_NEAR_EQUAL: ++ strlcat(val_string, ++ " (Copper cable, near end limiting active equalizers)", ++ sizeof(val_string)); ++ break; ++ case SFF_8636_TRANS_COPPER_LNR_EQUAL: ++ strlcat(val_string, ++ " (Copper cable, linear active equalizers)", ++ sizeof(val_string)); ++ break; ++ } ++ ssf_add_dict_string(d, "Transmitter technology", val_string); ++ ++ if ((data[SFF_8636_DEVICE_TECH_OFFSET] & SFF_8636_TRANS_TECH_MASK) ++ >= SFF_8636_TRANS_COPPER_PAS_UNEQUAL) { ++ snprintf(val_string, sizeof(val_string), "%udb", ++ data[SFF_8636_WAVELEN_HIGH_BYTE_OFFSET]); ++ ssf_add_dict_string(d, "Attenuation at 2.5GHz", val_string); ++ ++ snprintf(val_string, sizeof(val_string), "%udb", ++ data[SFF_8636_WAVELEN_HIGH_BYTE_OFFSET]); ++ ssf_add_dict_string(d, "Attenuation at 5.0GHz", val_string); ++ ++ snprintf(val_string, sizeof(val_string), "%udb", ++ data[SFF_8636_WAVELEN_HIGH_BYTE_OFFSET]); ++ ssf_add_dict_string(d, "Attenuation at 7.0GHz", val_string); ++ ++ snprintf(val_string, sizeof(val_string), "%udb", ++ data[SFF_8636_WAVELEN_HIGH_BYTE_OFFSET]); ++ ssf_add_dict_string(d, "Attenuation at 12.9GHz", val_string); ++ } else { ++ snprintf(val_string, sizeof(val_string), "%.3lfnm", ++ (((data[SFF_8636_WAVELEN_HIGH_BYTE_OFFSET] << 8) | ++ data[SFF_8636_WAVELEN_LOW_BYTE_OFFSET])*0.05)); ++ ssf_add_dict_string(d, "Laser wavelength", val_string); ++ ++ snprintf(val_string, sizeof(val_string), "%.3lfnm", ++ (((data[SFF_8636_WAVE_TOL_HIGH_BYTE_OFFSET] << 8) | ++ data[SFF_8636_WAVE_TOL_LOW_BYTE_OFFSET])*0.005)); ++ ssf_add_dict_string(d, "Laser wavelength tolerance", val_string); ++ } ++} ++ ++static void sff_8636_show_revision_compliance(const uint8_t *data, struct rte_tel_data *d) ++{ ++ static const char *name = "Revision Compliance"; ++ ++ switch (data[SFF_8636_REV_COMPLIANCE_OFFSET]) { ++ case SFF_8636_REV_UNSPECIFIED: ++ ssf_add_dict_string(d, name, "Revision not specified"); ++ break; ++ case SFF_8636_REV_8436_48: ++ ssf_add_dict_string(d, name, "SFF-8436 Rev 4.8 or earlier"); ++ break; ++ case SFF_8636_REV_8436_8636: ++ ssf_add_dict_string(d, name, "SFF-8436 Rev 4.8 or earlier"); ++ break; ++ case SFF_8636_REV_8636_13: ++ ssf_add_dict_string(d, name, "SFF-8636 Rev 1.3 or earlier"); ++ break; ++ case SFF_8636_REV_8636_14: ++ ssf_add_dict_string(d, name, "SFF-8636 Rev 1.4"); ++ break; ++ case SFF_8636_REV_8636_15: ++ ssf_add_dict_string(d, name, "SFF-8636 Rev 1.5"); ++ break; ++ case SFF_8636_REV_8636_20: ++ ssf_add_dict_string(d, name, "SFF-8636 Rev 2.0"); ++ break; ++ case SFF_8636_REV_8636_27: ++ ssf_add_dict_string(d, name, "SFF-8636 Rev 2.5/2.6/2.7"); ++ break; ++ default: ++ ssf_add_dict_string(d, name, "Unallocated"); ++ break; ++ } ++} ++ ++/* ++ * 2-byte internal temperature conversions: ++ * First byte is a signed 8-bit integer, which is the temp decimal part ++ * Second byte are 1/256th of degree, which are added to the dec part. ++ */ ++#define SFF_8636_OFFSET_TO_TEMP(offset) ((int16_t)SFF_OFFSET_TO_U16(offset)) ++ ++static void sff_8636_dom_parse(const uint8_t *data, struct sff_diags *sd) ++{ ++ int i = 0; ++ ++ /* Monitoring Thresholds for Alarms and Warnings */ ++ sd->sfp_voltage[SFF_MCURR] = SFF_OFFSET_TO_U16(SFF_8636_VCC_CURR); ++ sd->sfp_voltage[SFF_HALRM] = SFF_OFFSET_TO_U16(SFF_8636_VCC_HALRM); ++ sd->sfp_voltage[SFF_LALRM] = SFF_OFFSET_TO_U16(SFF_8636_VCC_LALRM); ++ sd->sfp_voltage[SFF_HWARN] = SFF_OFFSET_TO_U16(SFF_8636_VCC_HWARN); ++ sd->sfp_voltage[SFF_LWARN] = SFF_OFFSET_TO_U16(SFF_8636_VCC_LWARN); ++ ++ sd->sfp_temp[SFF_MCURR] = SFF_8636_OFFSET_TO_TEMP(SFF_8636_TEMP_CURR); ++ sd->sfp_temp[SFF_HALRM] = SFF_8636_OFFSET_TO_TEMP(SFF_8636_TEMP_HALRM); ++ sd->sfp_temp[SFF_LALRM] = SFF_8636_OFFSET_TO_TEMP(SFF_8636_TEMP_LALRM); ++ sd->sfp_temp[SFF_HWARN] = SFF_8636_OFFSET_TO_TEMP(SFF_8636_TEMP_HWARN); ++ sd->sfp_temp[SFF_LWARN] = SFF_8636_OFFSET_TO_TEMP(SFF_8636_TEMP_LWARN); ++ ++ sd->bias_cur[SFF_HALRM] = SFF_OFFSET_TO_U16(SFF_8636_TX_BIAS_HALRM); ++ sd->bias_cur[SFF_LALRM] = SFF_OFFSET_TO_U16(SFF_8636_TX_BIAS_LALRM); ++ sd->bias_cur[SFF_HWARN] = SFF_OFFSET_TO_U16(SFF_8636_TX_BIAS_HWARN); ++ sd->bias_cur[SFF_LWARN] = SFF_OFFSET_TO_U16(SFF_8636_TX_BIAS_LWARN); ++ ++ sd->tx_power[SFF_HALRM] = SFF_OFFSET_TO_U16(SFF_8636_TX_PWR_HALRM); ++ sd->tx_power[SFF_LALRM] = SFF_OFFSET_TO_U16(SFF_8636_TX_PWR_LALRM); ++ sd->tx_power[SFF_HWARN] = SFF_OFFSET_TO_U16(SFF_8636_TX_PWR_HWARN); ++ sd->tx_power[SFF_LWARN] = SFF_OFFSET_TO_U16(SFF_8636_TX_PWR_LWARN); ++ ++ sd->rx_power[SFF_HALRM] = SFF_OFFSET_TO_U16(SFF_8636_RX_PWR_HALRM); ++ sd->rx_power[SFF_LALRM] = SFF_OFFSET_TO_U16(SFF_8636_RX_PWR_LALRM); ++ sd->rx_power[SFF_HWARN] = SFF_OFFSET_TO_U16(SFF_8636_RX_PWR_HWARN); ++ sd->rx_power[SFF_LWARN] = SFF_OFFSET_TO_U16(SFF_8636_RX_PWR_LWARN); ++ ++ ++ /* Channel Specific Data */ ++ for (i = 0; i < SFF_MAX_CHANNEL_NUM; i++) { ++ sd->scd[i].bias_cur = SFF_OFFSET_TO_U16(sff_8636_tx_bias_offset[i]); ++ sd->scd[i].rx_power = SFF_OFFSET_TO_U16(sff_8636_rx_power_offset[i]); ++ sd->scd[i].tx_power = SFF_OFFSET_TO_U16(sff_8636_tx_power_offset[i]); ++ } ++ ++} ++ ++static void sff_8636_show_dom(const uint8_t *data, uint32_t eeprom_len, struct rte_tel_data *d) ++{ ++ struct sff_diags sd = {0}; ++ const char *rx_power_string = NULL; ++ char power_string[SFF_MAX_DESC_SIZE]; ++ char val_string[SFF_ITEM_VAL_COMPOSE_SIZE]; ++ int i; ++ ++ /* ++ * There is no clear identifier to signify the existence of ++ * optical diagnostics similar to SFF-8472. So checking existence ++ * of page 3, will provide the guarantee for existence of alarms ++ * and thresholds ++ * If pagging support exists, then supports_alarms is marked as 1 ++ */ ++ ++ if (eeprom_len == RTE_ETH_MODULE_SFF_8636_MAX_LEN) { ++ if (!(data[SFF_8636_STATUS_2_OFFSET] & ++ SFF_8636_STATUS_PAGE_3_PRESENT)) { ++ sd.supports_alarms = 1; ++ } ++ } ++ ++ sd.rx_power_type = data[SFF_8636_DIAG_TYPE_OFFSET] & ++ SFF_8636_RX_PWR_TYPE_MASK; ++ sd.tx_power_type = data[SFF_8636_DIAG_TYPE_OFFSET] & ++ SFF_8636_RX_PWR_TYPE_MASK; ++ ++ sff_8636_dom_parse(data, &sd); ++ ++ SFF_SPRINT_TEMP(val_string, sd.sfp_temp[SFF_MCURR]); ++ ssf_add_dict_string(d, "Module temperature", val_string); ++ ++ SFF_SPRINT_VCC(val_string, sd.sfp_voltage[SFF_MCURR]); ++ ssf_add_dict_string(d, "Module voltage", val_string); ++ ++ /* ++ * SFF-8636/8436 spec is not clear whether RX power/ TX bias ++ * current fields are supported or not. A valid temperature ++ * reading is used as existence for TX/RX power. ++ */ ++ if ((sd.sfp_temp[SFF_MCURR] == 0x0) || ++ (sd.sfp_temp[SFF_MCURR] == (int16_t)0xFFFF)) ++ return; ++ ++ ssf_add_dict_string(d, "Alarm/warning flags implemented", ++ (sd.supports_alarms ? "Yes" : "No")); ++ ++ for (i = 0; i < SFF_MAX_CHANNEL_NUM; i++) { ++ snprintf(power_string, SFF_MAX_DESC_SIZE, "%s (Channel %d)", ++ "Laser tx bias current", i+1); ++ SFF_SPRINT_BIAS(val_string, sd.scd[i].bias_cur); ++ ssf_add_dict_string(d, power_string, val_string); ++ } ++ ++ for (i = 0; i < SFF_MAX_CHANNEL_NUM; i++) { ++ snprintf(power_string, SFF_MAX_DESC_SIZE, "%s (Channel %d)", ++ "Transmit avg optical power", i+1); ++ SFF_SPRINT_xX_PWR(val_string, sd.scd[i].tx_power); ++ ssf_add_dict_string(d, power_string, val_string); ++ } ++ ++ if (!sd.rx_power_type) ++ rx_power_string = "Receiver signal OMA"; ++ else ++ rx_power_string = "Rcvr signal avg optical power"; ++ ++ for (i = 0; i < SFF_MAX_CHANNEL_NUM; i++) { ++ snprintf(power_string, SFF_MAX_DESC_SIZE, "%s(Channel %d)", ++ rx_power_string, i+1); ++ SFF_SPRINT_xX_PWR(val_string, sd.scd[i].rx_power); ++ ssf_add_dict_string(d, power_string, val_string); ++ } ++ ++ if (sd.supports_alarms) { ++ for (i = 0; sff_8636_aw_flags[i].str; ++i) { ++ ssf_add_dict_string(d, sff_8636_aw_flags[i].str, ++ data[sff_8636_aw_flags[i].offset] ++ & sff_8636_aw_flags[i].value ? "On" : "Off"); ++ } ++ ++ sff_show_thresholds(sd, d); ++ } ++ ++} ++void sff_8636_show_all(const uint8_t *data, uint32_t eeprom_len, struct rte_tel_data *d) ++{ ++ sff_8636_show_identifier(data, d); ++ if ((data[SFF_8636_ID_OFFSET] == SFF_8024_ID_QSFP) || ++ (data[SFF_8636_ID_OFFSET] == SFF_8024_ID_QSFP_PLUS) || ++ (data[SFF_8636_ID_OFFSET] == SFF_8024_ID_QSFP28)) { ++ sff_8636_show_ext_identifier(data, d); ++ sff_8636_show_connector(data, d); ++ sff_8636_show_transceiver(data, d); ++ sff_8636_show_encoding(data, d); ++ sff_show_value_with_unit(data, SFF_8636_BR_NOMINAL_OFFSET, ++ "BR, Nominal", 100, "Mbps", d); ++ sff_8636_show_rate_identifier(data, d); ++ sff_show_value_with_unit(data, SFF_8636_SM_LEN_OFFSET, ++ "Length (SMF,km)", 1, "km", d); ++ sff_show_value_with_unit(data, SFF_8636_OM3_LEN_OFFSET, ++ "Length (OM3 50um)", 2, "m", d); ++ sff_show_value_with_unit(data, SFF_8636_OM2_LEN_OFFSET, ++ "Length (OM2 50um)", 1, "m", d); ++ sff_show_value_with_unit(data, SFF_8636_OM1_LEN_OFFSET, ++ "Length (OM1 62.5um)", 1, "m", d); ++ sff_show_value_with_unit(data, SFF_8636_CBL_LEN_OFFSET, ++ "Length (Copper or Active cable)", 1, "m", d); ++ sff_8636_show_wavelength_or_copper_compliance(data, d); ++ sff_show_ascii(data, SFF_8636_VENDOR_NAME_START_OFFSET, ++ SFF_8636_VENDOR_NAME_END_OFFSET, "Vendor name", d); ++ sff_8636_show_oui(data, d); ++ sff_show_ascii(data, SFF_8636_VENDOR_PN_START_OFFSET, ++ SFF_8636_VENDOR_PN_END_OFFSET, "Vendor PN", d); ++ sff_show_ascii(data, SFF_8636_VENDOR_REV_START_OFFSET, ++ SFF_8636_VENDOR_REV_END_OFFSET, "Vendor rev", d); ++ sff_show_ascii(data, SFF_8636_VENDOR_SN_START_OFFSET, ++ SFF_8636_VENDOR_SN_END_OFFSET, "Vendor SN", d); ++ sff_show_ascii(data, SFF_8636_DATE_YEAR_OFFSET, ++ SFF_8636_DATE_VENDOR_LOT_OFFSET + 1, "Date code", d); ++ sff_8636_show_revision_compliance(data, d); ++ sff_8636_show_dom(data, eeprom_len, d); ++ } ++} +diff --git a/lib/ethdev/sff_8636.h b/lib/ethdev/sff_8636.h +new file mode 100644 +index 0000000..70f7035 +--- /dev/null ++++ b/lib/ethdev/sff_8636.h +@@ -0,0 +1,590 @@ ++/* SPDX-License-Identifier: BSD-3-Clause ++ * Copyright(c) 2022 Intel Corporation ++ * SFF-8636 standards based QSFP EEPROM Field Definitions ++ */ ++ ++#ifndef _SFF_8636_H_ ++#define _SFF_8636_H_ ++ ++/*------------------------------------------------------------------------------ ++ * ++ * QSFP EEPROM data structures ++ * ++ * register info from SFF-8636 Rev 2.7 ++ */ ++ ++/*------------------------------------------------------------------------------ ++ * ++ * Lower Memory Page 00h ++ * Measurement, Diagnostic and Control Functions ++ * ++ */ ++/* Identifier - 0 */ ++/* Values are defined under SFF_8024_ID_OFFSET */ ++#define SFF_8636_ID_OFFSET 0x00 ++ ++#define SFF_8636_REV_COMPLIANCE_OFFSET 0x01 ++#define SFF_8636_REV_UNSPECIFIED 0x00 ++#define SFF_8636_REV_8436_48 0x01 ++#define SFF_8636_REV_8436_8636 0x02 ++#define SFF_8636_REV_8636_13 0x03 ++#define SFF_8636_REV_8636_14 0x04 ++#define SFF_8636_REV_8636_15 0x05 ++#define SFF_8636_REV_8636_20 0x06 ++#define SFF_8636_REV_8636_27 0x07 ++ ++#define SFF_8636_STATUS_2_OFFSET 0x02 ++/* Flat Memory:0- Paging, 1- Page 0 only */ ++#define SFF_8636_STATUS_PAGE_3_PRESENT RTE_BIT32(2) ++#define SFF_8636_STATUS_INTL_OUTPUT RTE_BIT32(1) ++#define SFF_8636_STATUS_DATA_NOT_READY RTE_BIT32(0) ++ ++/* Channel Status Interrupt Flags - 3-5 */ ++#define SFF_8636_LOS_AW_OFFSET 0x03 ++#define SFF_8636_TX4_LOS_AW RTE_BIT32(7) ++#define SFF_8636_TX3_LOS_AW RTE_BIT32(6) ++#define SFF_8636_TX2_LOS_AW RTE_BIT32(5) ++#define SFF_8636_TX1_LOS_AW RTE_BIT32(4) ++#define SFF_8636_RX4_LOS_AW RTE_BIT32(3) ++#define SFF_8636_RX3_LOS_AW RTE_BIT32(2) ++#define SFF_8636_RX2_LOS_AW RTE_BIT32(1) ++#define SFF_8636_RX1_LOS_AW RTE_BIT32(0) ++ ++#define SFF_8636_FAULT_AW_OFFSET 0x04 ++#define SFF_8636_TX4_FAULT_AW RTE_BIT32(3) ++#define SFF_8636_TX3_FAULT_AW RTE_BIT32(2) ++#define SFF_8636_TX2_FAULT_AW RTE_BIT32(1) ++#define SFF_8636_TX1_FAULT_AW RTE_BIT32(0) ++ ++/* Module Monitor Interrupt Flags - 6-8 */ ++#define SFF_8636_TEMP_AW_OFFSET 0x06 ++#define SFF_8636_TEMP_HALARM_STATUS RTE_BIT32(7) ++#define SFF_8636_TEMP_LALARM_STATUS RTE_BIT32(6) ++#define SFF_8636_TEMP_HWARN_STATUS RTE_BIT32(5) ++#define SFF_8636_TEMP_LWARN_STATUS RTE_BIT32(4) ++ ++#define SFF_8636_VCC_AW_OFFSET 0x07 ++#define SFF_8636_VCC_HALARM_STATUS RTE_BIT32(7) ++#define SFF_8636_VCC_LALARM_STATUS RTE_BIT32(6) ++#define SFF_8636_VCC_HWARN_STATUS RTE_BIT32(5) ++#define SFF_8636_VCC_LWARN_STATUS RTE_BIT32(4) ++ ++/* Channel Monitor Interrupt Flags - 9-21 */ ++#define SFF_8636_RX_PWR_12_AW_OFFSET 0x09 ++#define SFF_8636_RX_PWR_1_HALARM RTE_BIT32(7) ++#define SFF_8636_RX_PWR_1_LALARM RTE_BIT32(6) ++#define SFF_8636_RX_PWR_1_HWARN RTE_BIT32(5) ++#define SFF_8636_RX_PWR_1_LWARN RTE_BIT32(4) ++#define SFF_8636_RX_PWR_2_HALARM RTE_BIT32(3) ++#define SFF_8636_RX_PWR_2_LALARM RTE_BIT32(2) ++#define SFF_8636_RX_PWR_2_HWARN RTE_BIT32(1) ++#define SFF_8636_RX_PWR_2_LWARN RTE_BIT32(0) ++ ++#define SFF_8636_RX_PWR_34_AW_OFFSET 0x0A ++#define SFF_8636_RX_PWR_3_HALARM RTE_BIT32(7) ++#define SFF_8636_RX_PWR_3_LALARM RTE_BIT32(6) ++#define SFF_8636_RX_PWR_3_HWARN RTE_BIT32(5) ++#define SFF_8636_RX_PWR_3_LWARN RTE_BIT32(4) ++#define SFF_8636_RX_PWR_4_HALARM RTE_BIT32(3) ++#define SFF_8636_RX_PWR_4_LALARM RTE_BIT32(2) ++#define SFF_8636_RX_PWR_4_HWARN RTE_BIT32(1) ++#define SFF_8636_RX_PWR_4_LWARN RTE_BIT32(0) ++ ++#define SFF_8636_TX_BIAS_12_AW_OFFSET 0x0B ++#define SFF_8636_TX_BIAS_1_HALARM RTE_BIT32(7) ++#define SFF_8636_TX_BIAS_1_LALARM RTE_BIT32(6) ++#define SFF_8636_TX_BIAS_1_HWARN RTE_BIT32(5) ++#define SFF_8636_TX_BIAS_1_LWARN RTE_BIT32(4) ++#define SFF_8636_TX_BIAS_2_HALARM RTE_BIT32(3) ++#define SFF_8636_TX_BIAS_2_LALARM RTE_BIT32(2) ++#define SFF_8636_TX_BIAS_2_HWARN RTE_BIT32(1) ++#define SFF_8636_TX_BIAS_2_LWARN RTE_BIT32(0) ++ ++#define SFF_8636_TX_BIAS_34_AW_OFFSET 0xC ++#define SFF_8636_TX_BIAS_3_HALARM RTE_BIT32(7) ++#define SFF_8636_TX_BIAS_3_LALARM RTE_BIT32(6) ++#define SFF_8636_TX_BIAS_3_HWARN RTE_BIT32(5) ++#define SFF_8636_TX_BIAS_3_LWARN RTE_BIT32(4) ++#define SFF_8636_TX_BIAS_4_HALARM RTE_BIT32(3) ++#define SFF_8636_TX_BIAS_4_LALARM RTE_BIT32(2) ++#define SFF_8636_TX_BIAS_4_HWARN RTE_BIT32(1) ++#define SFF_8636_TX_BIAS_4_LWARN RTE_BIT32(0) ++ ++#define SFF_8636_TX_PWR_12_AW_OFFSET 0x0D ++#define SFF_8636_TX_PWR_1_HALARM RTE_BIT32(7) ++#define SFF_8636_TX_PWR_1_LALARM RTE_BIT32(6) ++#define SFF_8636_TX_PWR_1_HWARN RTE_BIT32(5) ++#define SFF_8636_TX_PWR_1_LWARN RTE_BIT32(4) ++#define SFF_8636_TX_PWR_2_HALARM RTE_BIT32(3) ++#define SFF_8636_TX_PWR_2_LALARM RTE_BIT32(2) ++#define SFF_8636_TX_PWR_2_HWARN RTE_BIT32(1) ++#define SFF_8636_TX_PWR_2_LWARN RTE_BIT32(0) ++ ++#define SFF_8636_TX_PWR_34_AW_OFFSET 0x0E ++#define SFF_8636_TX_PWR_3_HALARM RTE_BIT32(7) ++#define SFF_8636_TX_PWR_3_LALARM RTE_BIT32(6) ++#define SFF_8636_TX_PWR_3_HWARN RTE_BIT32(5) ++#define SFF_8636_TX_PWR_3_LWARN RTE_BIT32(4) ++#define SFF_8636_TX_PWR_4_HALARM RTE_BIT32(3) ++#define SFF_8636_TX_PWR_4_LALARM RTE_BIT32(2) ++#define SFF_8636_TX_PWR_4_HWARN RTE_BIT32(1) ++#define SFF_8636_TX_PWR_4_LWARN RTE_BIT32(0) ++ ++/* Module Monitoring Values - 22-33 */ ++#define SFF_8636_TEMP_CURR 0x16 ++#define SFF_8636_TEMP_MSB_OFFSET 0x16 ++#define SFF_8636_TEMP_LSB_OFFSET 0x17 ++ ++#define SFF_8636_VCC_CURR 0x1A ++#define SFF_8636_VCC_MSB_OFFSET 0x1A ++#define SFF_8636_VCC_LSB_OFFSET 0x1B ++ ++/* Channel Monitoring Values - 34-81 */ ++#define SFF_8636_RX_PWR_1_OFFSET 0x22 ++#define SFF_8636_RX_PWR_2_OFFSET 0x24 ++#define SFF_8636_RX_PWR_3_OFFSET 0x26 ++#define SFF_8636_RX_PWR_4_OFFSET 0x28 ++ ++#define SFF_8636_TX_BIAS_1_OFFSET 0x2A ++#define SFF_8636_TX_BIAS_2_OFFSET 0x2C ++#define SFF_8636_TX_BIAS_3_OFFSET 0x2E ++#define SFF_8636_TX_BIAS_4_OFFSET 0x30 ++ ++#define SFF_8636_TX_PWR_1_OFFSET 0x32 ++#define SFF_8636_TX_PWR_2_OFFSET 0x34 ++#define SFF_8636_TX_PWR_3_OFFSET 0x36 ++#define SFF_8636_TX_PWR_4_OFFSET 0x38 ++ ++/* Control Bytes - 86 - 99 */ ++#define SFF_8636_TX_DISABLE_OFFSET 0x56 ++#define SFF_8636_TX_DISABLE_4 RTE_BIT32(3) ++#define SFF_8636_TX_DISABLE_3 RTE_BIT32(2) ++#define SFF_8636_TX_DISABLE_2 RTE_BIT32(1) ++#define SFF_8636_TX_DISABLE_1 RTE_BIT32(0) ++ ++#define SFF_8636_RX_RATE_SELECT_OFFSET 0x57 ++#define SFF_8636_RX_RATE_SELECT_4_MASK (3 << 6) ++#define SFF_8636_RX_RATE_SELECT_3_MASK (3 << 4) ++#define SFF_8636_RX_RATE_SELECT_2_MASK (3 << 2) ++#define SFF_8636_RX_RATE_SELECT_1_MASK (3 << 0) ++ ++#define SFF_8636_TX_RATE_SELECT_OFFSET 0x58 ++#define SFF_8636_TX_RATE_SELECT_4_MASK (3 << 6) ++#define SFF_8636_TX_RATE_SELECT_3_MASK (3 << 4) ++#define SFF_8636_TX_RATE_SELECT_2_MASK (3 << 2) ++#define SFF_8636_TX_RATE_SELECT_1_MASK (3 << 0) ++ ++#define SFF_8636_RX_APP_SELECT_4_OFFSET 0x58 ++#define SFF_8636_RX_APP_SELECT_3_OFFSET 0x59 ++#define SFF_8636_RX_APP_SELECT_2_OFFSET 0x5A ++#define SFF_8636_RX_APP_SELECT_1_OFFSET 0x5B ++ ++#define SFF_8636_PWR_MODE_OFFSET 0x5D ++#define SFF_8636_HIGH_PWR_ENABLE RTE_BIT32(2) ++#define SFF_8636_LOW_PWR_MODE RTE_BIT32(1) ++#define SFF_8636_PWR_OVERRIDE RTE_BIT32(0) ++ ++#define SFF_8636_TX_APP_SELECT_4_OFFSET 0x5E ++#define SFF_8636_TX_APP_SELECT_3_OFFSET 0x5F ++#define SFF_8636_TX_APP_SELECT_2_OFFSET 0x60 ++#define SFF_8636_TX_APP_SELECT_1_OFFSET 0x61 ++ ++#define SFF_8636_LOS_MASK_OFFSET 0x64 ++#define SFF_8636_TX_LOS_4_MASK RTE_BIT32(7) ++#define SFF_8636_TX_LOS_3_MASK RTE_BIT32(6) ++#define SFF_8636_TX_LOS_2_MASK RTE_BIT32(5) ++#define SFF_8636_TX_LOS_1_MASK RTE_BIT32(4) ++#define SFF_8636_RX_LOS_4_MASK RTE_BIT32(3) ++#define SFF_8636_RX_LOS_3_MASK RTE_BIT32(2) ++#define SFF_8636_RX_LOS_2_MASK RTE_BIT32(1) ++#define SFF_8636_RX_LOS_1_MASK RTE_BIT32(0) ++ ++#define SFF_8636_FAULT_MASK_OFFSET 0x65 ++#define SFF_8636_TX_FAULT_1_MASK RTE_BIT32(3) ++#define SFF_8636_TX_FAULT_2_MASK RTE_BIT32(2) ++#define SFF_8636_TX_FAULT_3_MASK RTE_BIT32(1) ++#define SFF_8636_TX_FAULT_4_MASK RTE_BIT32(0) ++ ++#define SFF_8636_TEMP_MASK_OFFSET 0x67 ++#define SFF_8636_TEMP_HALARM_MASK RTE_BIT32(7) ++#define SFF_8636_TEMP_LALARM_MASK RTE_BIT32(6) ++#define SFF_8636_TEMP_HWARN_MASK RTE_BIT32(5) ++#define SFF_8636_TEMP_LWARN_MASK RTE_BIT32(4) ++ ++#define SFF_8636_VCC_MASK_OFFSET 0x68 ++#define SFF_8636_VCC_HALARM_MASK RTE_BIT32(7) ++#define SFF_8636_VCC_LALARM_MASK RTE_BIT32(6) ++#define SFF_8636_VCC_HWARN_MASK RTE_BIT32(5) ++#define SFF_8636_VCC_LWARN_MASK RTE_BIT32(4) ++ ++/*------------------------------------------------------------------------------ ++ * ++ * Upper Memory Page 00h ++ * Serial ID - Base ID, Extended ID and Vendor Specific ID fields ++ * ++ */ ++/* Identifier - 128 */ ++/* Identifier values same as Lower Memory Page 00h */ ++#define SFF_8636_UPPER_PAGE_0_ID_OFFSET 0x80 ++ ++/* Extended Identifier - 128 */ ++#define SFF_8636_EXT_ID_OFFSET 0x81 ++#define SFF_8636_EXT_ID_PWR_CLASS_MASK 0xC0 ++#define SFF_8636_EXT_ID_PWR_CLASS_1 (0 << 6) ++#define SFF_8636_EXT_ID_PWR_CLASS_2 (1 << 6) ++#define SFF_8636_EXT_ID_PWR_CLASS_3 (2 << 6) ++#define SFF_8636_EXT_ID_PWR_CLASS_4 (3 << 6) ++#define SFF_8636_EXT_ID_CLIE_MASK 0x10 ++#define SFF_8636_EXT_ID_CLIEI_CODE_PRESENT (1 << 4) ++#define SFF_8636_EXT_ID_CDR_TX_MASK 0x08 ++#define SFF_8636_EXT_ID_CDR_TX_PRESENT (1 << 3) ++#define SFF_8636_EXT_ID_CDR_RX_MASK 0x04 ++#define SFF_8636_EXT_ID_CDR_RX_PRESENT (1 << 2) ++#define SFF_8636_EXT_ID_EPWR_CLASS_MASK 0x03 ++#define SFF_8636_EXT_ID_PWR_CLASS_LEGACY 0 ++#define SFF_8636_EXT_ID_PWR_CLASS_5 1 ++#define SFF_8636_EXT_ID_PWR_CLASS_6 2 ++#define SFF_8636_EXT_ID_PWR_CLASS_7 3 ++ ++/* Connector Values offset - 130 */ ++/* Values are defined under SFF_8024_CTOR */ ++#define SFF_8636_CTOR_OFFSET 0x82 ++#define SFF_8636_CTOR_UNKNOWN 0x00 ++#define SFF_8636_CTOR_SC 0x01 ++#define SFF_8636_CTOR_FC_STYLE_1 0x02 ++#define SFF_8636_CTOR_FC_STYLE_2 0x03 ++#define SFF_8636_CTOR_BNC_TNC 0x04 ++#define SFF_8636_CTOR_FC_COAX 0x05 ++#define SFF_8636_CTOR_FIBER_JACK 0x06 ++#define SFF_8636_CTOR_LC 0x07 ++#define SFF_8636_CTOR_MT_RJ 0x08 ++#define SFF_8636_CTOR_MU 0x09 ++#define SFF_8636_CTOR_SG 0x0A ++#define SFF_8636_CTOR_OPT_PT 0x0B ++#define SFF_8636_CTOR_MPO 0x0C ++/* 0D-1Fh --- Reserved */ ++#define SFF_8636_CTOR_HSDC_II 0x20 ++#define SFF_8636_CTOR_COPPER_PT 0x21 ++#define SFF_8636_CTOR_RJ45 0x22 ++#define SFF_8636_CTOR_NO_SEPARABLE 0x23 ++#define SFF_8636_CTOR_MXC_2X16 0x24 ++ ++/* Specification Compliance - 131-138 */ ++/* Ethernet Compliance Codes - 131 */ ++#define SFF_8636_ETHERNET_COMP_OFFSET 0x83 ++#define SFF_8636_ETHERNET_RSRVD RTE_BIT32(7) ++#define SFF_8636_ETHERNET_10G_LRM RTE_BIT32(6) ++#define SFF_8636_ETHERNET_10G_LR RTE_BIT32(5) ++#define SFF_8636_ETHERNET_10G_SR RTE_BIT32(4) ++#define SFF_8636_ETHERNET_40G_CR4 RTE_BIT32(3) ++#define SFF_8636_ETHERNET_40G_SR4 RTE_BIT32(2) ++#define SFF_8636_ETHERNET_40G_LR4 RTE_BIT32(1) ++#define SFF_8636_ETHERNET_40G_ACTIVE RTE_BIT32(0) ++ ++/* SONET Compliance Codes - 132 */ ++#define SFF_8636_SONET_COMP_OFFSET 0x84 ++#define SFF_8636_SONET_40G_OTN RTE_BIT32(3) ++#define SFF_8636_SONET_OC48_LR RTE_BIT32(2) ++#define SFF_8636_SONET_OC48_IR RTE_BIT32(1) ++#define SFF_8636_SONET_OC48_SR RTE_BIT32(0) ++ ++/* SAS/SATA Complaince Codes - 133 */ ++#define SFF_8636_SAS_COMP_OFFSET 0x85 ++#define SFF_8636_SAS_12G RTE_BIT32(6) ++#define SFF_8636_SAS_6G RTE_BIT32(5) ++#define SFF_8636_SAS_3G RTE_BIT32(4) ++ ++/* Gigabit Ethernet Compliance Codes - 134 */ ++#define SFF_8636_GIGE_COMP_OFFSET 0x86 ++#define SFF_8636_GIGE_1000_BASE_T RTE_BIT32(3) ++#define SFF_8636_GIGE_1000_BASE_CX RTE_BIT32(2) ++#define SFF_8636_GIGE_1000_BASE_LX RTE_BIT32(1) ++#define SFF_8636_GIGE_1000_BASE_SX RTE_BIT32(0) ++ ++/* Fibre Channel Link length/Transmitter Tech. - 135,136 */ ++#define SFF_8636_FC_LEN_OFFSET 0x87 ++#define SFF_8636_FC_LEN_VERY_LONG RTE_BIT32(7) ++#define SFF_8636_FC_LEN_SHORT RTE_BIT32(6) ++#define SFF_8636_FC_LEN_INT RTE_BIT32(5) ++#define SFF_8636_FC_LEN_LONG RTE_BIT32(4) ++#define SFF_8636_FC_LEN_MED RTE_BIT32(3) ++#define SFF_8636_FC_TECH_LONG_LC RTE_BIT32(1) ++#define SFF_8636_FC_TECH_ELEC_INTER RTE_BIT32(0) ++ ++#define SFF_8636_FC_TECH_OFFSET 0x88 ++#define SFF_8636_FC_TECH_ELEC_INTRA RTE_BIT32(7) ++#define SFF_8636_FC_TECH_SHORT_WO_OFC RTE_BIT32(6) ++#define SFF_8636_FC_TECH_SHORT_W_OFC RTE_BIT32(5) ++#define SFF_8636_FC_TECH_LONG_LL RTE_BIT32(4) ++ ++/* Fibre Channel Transmitter Media - 137 */ ++#define SFF_8636_FC_TRANS_MEDIA_OFFSET 0x89 ++/* Twin Axial Pair */ ++#define SFF_8636_FC_TRANS_MEDIA_TW RTE_BIT32(7) ++/* Shielded Twisted Pair */ ++#define SFF_8636_FC_TRANS_MEDIA_TP RTE_BIT32(6) ++/* Miniature Coax */ ++#define SFF_8636_FC_TRANS_MEDIA_MI RTE_BIT32(5) ++/* Video Coax */ ++#define SFF_8636_FC_TRANS_MEDIA_TV RTE_BIT32(4) ++/* Multi-mode 62.5m */ ++#define SFF_8636_FC_TRANS_MEDIA_M6 RTE_BIT32(3) ++/* Multi-mode 50m */ ++#define SFF_8636_FC_TRANS_MEDIA_M5 RTE_BIT32(2) ++/* Multi-mode 50um */ ++#define SFF_8636_FC_TRANS_MEDIA_OM3 RTE_BIT32(1) ++/* Single Mode */ ++#define SFF_8636_FC_TRANS_MEDIA_SM RTE_BIT32(0) ++ ++/* Fibre Channel Speed - 138 */ ++#define SFF_8636_FC_SPEED_OFFSET 0x8A ++#define SFF_8636_FC_SPEED_1200_MBPS RTE_BIT32(7) ++#define SFF_8636_FC_SPEED_800_MBPS RTE_BIT32(6) ++#define SFF_8636_FC_SPEED_1600_MBPS RTE_BIT32(5) ++#define SFF_8636_FC_SPEED_400_MBPS RTE_BIT32(4) ++#define SFF_8636_FC_SPEED_200_MBPS RTE_BIT32(2) ++#define SFF_8636_FC_SPEED_100_MBPS RTE_BIT32(0) ++ ++/* Encoding - 139 */ ++/* Values are defined under SFF_8024_ENCODING */ ++#define SFF_8636_ENCODING_OFFSET 0x8B ++#define SFF_8636_ENCODING_MANCHESTER 0x06 ++#define SFF_8636_ENCODING_64B66B 0x05 ++#define SFF_8636_ENCODING_SONET 0x04 ++#define SFF_8636_ENCODING_NRZ 0x03 ++#define SFF_8636_ENCODING_4B5B 0x02 ++#define SFF_8636_ENCODING_8B10B 0x01 ++#define SFF_8636_ENCODING_UNSPEC 0x00 ++ ++/* BR, Nominal - 140 */ ++#define SFF_8636_BR_NOMINAL_OFFSET 0x8C ++ ++/* Extended RateSelect - 141 */ ++#define SFF_8636_EXT_RS_OFFSET 0x8D ++#define SFF_8636_EXT_RS_V1 RTE_BIT32(0) ++ ++/* Length (Standard SM Fiber)-km - 142 */ ++#define SFF_8636_SM_LEN_OFFSET 0x8E ++ ++/* Length (OM3)-Unit 2m - 143 */ ++#define SFF_8636_OM3_LEN_OFFSET 0x8F ++ ++/* Length (OM2)-Unit 1m - 144 */ ++#define SFF_8636_OM2_LEN_OFFSET 0x90 ++ ++/* Length (OM1)-Unit 1m - 145 */ ++#define SFF_8636_OM1_LEN_OFFSET 0x91 ++ ++/* Cable Assembly Length -Unit 1m - 146 */ ++#define SFF_8636_CBL_LEN_OFFSET 0x92 ++ ++/* Device Technology - 147 */ ++#define SFF_8636_DEVICE_TECH_OFFSET 0x93 ++/* Transmitter Technology */ ++#define SFF_8636_TRANS_TECH_MASK 0xF0 ++/* Copper cable, linear active equalizers */ ++#define SFF_8636_TRANS_COPPER_LNR_EQUAL (15 << 4) ++/* Copper cable, near end limiting active equalizers */ ++#define SFF_8636_TRANS_COPPER_NEAR_EQUAL (14 << 4) ++/* Copper cable, far end limiting active equalizers */ ++#define SFF_8636_TRANS_COPPER_FAR_EQUAL (13 << 4) ++/* Copper cable, near & far end limiting active equalizers */ ++#define SFF_8636_TRANS_COPPER_LNR_FAR_EQUAL (12 << 4) ++/* Copper cable, passive equalized */ ++#define SFF_8636_TRANS_COPPER_PAS_EQUAL (11 << 4) ++/* Copper cable, unequalized */ ++#define SFF_8636_TRANS_COPPER_PAS_UNEQUAL (10 << 4) ++/* 1490 nm DFB */ ++#define SFF_8636_TRANS_1490_DFB (9 << 4) ++/* Others */ ++#define SFF_8636_TRANS_OTHERS (8 << 4) ++/* 1550 nm EML */ ++#define SFF_8636_TRANS_1550_EML (7 << 4) ++/* 1310 nm EML */ ++#define SFF_8636_TRANS_1310_EML (6 << 4) ++/* 1550 nm DFB */ ++#define SFF_8636_TRANS_1550_DFB (5 << 4) ++/* 1310 nm DFB */ ++#define SFF_8636_TRANS_1310_DFB (4 << 4) ++/* 1310 nm FP */ ++#define SFF_8636_TRANS_1310_FP (3 << 4) ++/* 1550 nm VCSEL */ ++#define SFF_8636_TRANS_1550_VCSEL (2 << 4) ++/* 1310 nm VCSEL */ ++#define SFF_8636_TRANS_1310_VCSEL (1 << 4) ++/* 850 nm VCSEL */ ++#define SFF_8636_TRANS_850_VCSEL (0 << 4) ++ ++ /* Active/No wavelength control */ ++#define SFF_8636_DEV_TECH_ACTIVE_WAVE_LEN RTE_BIT32(3) ++/* Cooled transmitter */ ++#define SFF_8636_DEV_TECH_COOL_TRANS RTE_BIT32(2) ++/* APD/Pin Detector */ ++#define SFF_8636_DEV_TECH_APD_DETECTOR RTE_BIT32(1) ++/* Transmitter tunable */ ++#define SFF_8636_DEV_TECH_TUNABLE RTE_BIT32(0) ++ ++/* Vendor Name - 148-163 */ ++#define SFF_8636_VENDOR_NAME_START_OFFSET 0x94 ++#define SFF_8636_VENDOR_NAME_END_OFFSET 0xA3 ++ ++/* Extended Module Codes - 164 */ ++#define SFF_8636_EXT_MOD_CODE_OFFSET 0xA4 ++#define SFF_8636_EXT_MOD_INFINIBAND_EDR RTE_BIT32(4) ++#define SFF_8636_EXT_MOD_INFINIBAND_FDR RTE_BIT32(3) ++#define SFF_8636_EXT_MOD_INFINIBAND_QDR RTE_BIT32(2) ++#define SFF_8636_EXT_MOD_INFINIBAND_DDR RTE_BIT32(1) ++#define SFF_8636_EXT_MOD_INFINIBAND_SDR RTE_BIT32(0) ++ ++/* Vendor OUI - 165-167 */ ++#define SFF_8636_VENDOR_OUI_OFFSET 0xA5 ++#define SFF_8636_VENDOR_OUI_LEN 3 ++ ++/* Vendor OUI - 165-167 */ ++#define SFF_8636_VENDOR_PN_START_OFFSET 0xA8 ++#define SFF_8636_VENDOR_PN_END_OFFSET 0xB7 ++ ++/* Vendor Revision - 184-185 */ ++#define SFF_8636_VENDOR_REV_START_OFFSET 0xB8 ++#define SFF_8636_VENDOR_REV_END_OFFSET 0xB9 ++ ++/* Wavelength - 186-187 */ ++#define SFF_8636_WAVELEN_HIGH_BYTE_OFFSET 0xBA ++#define SFF_8636_WAVELEN_LOW_BYTE_OFFSET 0xBB ++ ++/* Wavelength Tolerance- 188-189 */ ++#define SFF_8636_WAVE_TOL_HIGH_BYTE_OFFSET 0xBC ++#define SFF_8636_WAVE_TOL_LOW_BYTE_OFFSET 0xBD ++ ++/* Max case temp - Other than 70 C - 190 */ ++#define SFF_8636_MAXCASE_TEMP_OFFSET 0xBE ++ ++/* CC_BASE - 191 */ ++#define SFF_8636_CC_BASE_OFFSET 0xBF ++ ++/* Option Values - 192-195 */ ++#define SFF_8636_OPTION_1_OFFSET 0xC0 ++#define SFF_8636_ETHERNET_UNSPECIFIED 0x00 ++#define SFF_8636_ETHERNET_100G_AOC 0x01 ++#define SFF_8636_ETHERNET_100G_SR4 0x02 ++#define SFF_8636_ETHERNET_100G_LR4 0x03 ++#define SFF_8636_ETHERNET_100G_ER4 0x04 ++#define SFF_8636_ETHERNET_100G_SR10 0x05 ++#define SFF_8636_ETHERNET_100G_CWDM4_FEC 0x06 ++#define SFF_8636_ETHERNET_100G_PSM4 0x07 ++#define SFF_8636_ETHERNET_100G_ACC 0x08 ++#define SFF_8636_ETHERNET_100G_CWDM4_NO_FEC 0x09 ++#define SFF_8636_ETHERNET_100G_RSVD1 0x0A ++#define SFF_8636_ETHERNET_100G_CR4 0x0B ++#define SFF_8636_ETHERNET_25G_CR_CA_S 0x0C ++#define SFF_8636_ETHERNET_25G_CR_CA_N 0x0D ++#define SFF_8636_ETHERNET_40G_ER4 0x10 ++#define SFF_8636_ETHERNET_4X10_SR 0x11 ++#define SFF_8636_ETHERNET_40G_PSM4 0x12 ++#define SFF_8636_ETHERNET_G959_P1I1_2D1 0x13 ++#define SFF_8636_ETHERNET_G959_P1S1_2D2 0x14 ++#define SFF_8636_ETHERNET_G959_P1L1_2D2 0x15 ++#define SFF_8636_ETHERNET_10GT_SFI 0x16 ++#define SFF_8636_ETHERNET_100G_CLR4 0x17 ++#define SFF_8636_ETHERNET_100G_AOC2 0x18 ++#define SFF_8636_ETHERNET_100G_ACC2 0x19 ++ ++#define SFF_8636_OPTION_2_OFFSET 0xC1 ++/* Rx output amplitude */ ++#define SFF_8636_O2_RX_OUTPUT_AMP RTE_BIT32(0) ++#define SFF_8636_OPTION_3_OFFSET 0xC2 ++/* Rx Squelch Disable */ ++#define SFF_8636_O3_RX_SQL_DSBL RTE_BIT32(3) ++/* Rx Output Disable capable */ ++#define SFF_8636_O3_RX_OUTPUT_DSBL RTE_BIT32(2) ++/* Tx Squelch Disable */ ++#define SFF_8636_O3_TX_SQL_DSBL RTE_BIT32(1) ++/* Tx Squelch Impl */ ++#define SFF_8636_O3_TX_SQL_IMPL RTE_BIT32(0) ++#define SFF_8636_OPTION_4_OFFSET 0xC3 ++/* Memory Page 02 present */ ++#define SFF_8636_O4_PAGE_02_PRESENT RTE_BIT32(7) ++/* Memory Page 01 present */ ++#define SFF_8636_O4_PAGE_01_PRESENT RTE_BIT32(6) ++/* Rate Select implemented */ ++#define SFF_8636_O4_RATE_SELECT RTE_BIT32(5) ++/* Tx_DISABLE implemented */ ++#define SFF_8636_O4_TX_DISABLE RTE_BIT32(4) ++/* Tx_FAULT implemented */ ++#define SFF_8636_O4_TX_FAULT RTE_BIT32(3) ++/* Tx Squelch implemented */ ++#define SFF_8636_O4_TX_SQUELCH RTE_BIT32(2) ++/* Tx Loss of Signal */ ++#define SFF_8636_O4_TX_LOS RTE_BIT32(1) ++ ++/* Vendor SN - 196-211 */ ++#define SFF_8636_VENDOR_SN_START_OFFSET 0xC4 ++#define SFF_8636_VENDOR_SN_END_OFFSET 0xD3 ++ ++/* Vendor Date - 212-219 */ ++#define SFF_8636_DATE_YEAR_OFFSET 0xD4 ++#define SFF_8636_DATE_YEAR_LEN 2 ++#define SFF_8636_DATE_MONTH_OFFSET 0xD6 ++#define SFF_8636_DATE_MONTH_LEN 2 ++#define SFF_8636_DATE_DAY_OFFSET 0xD8 ++#define SFF_8636_DATE_DAY_LEN 2 ++#define SFF_8636_DATE_VENDOR_LOT_OFFSET 0xDA ++#define SFF_8636_DATE_VENDOR_LOT_LEN 2 ++ ++/* Diagnostic Monitoring Type - 220 */ ++#define SFF_8636_DIAG_TYPE_OFFSET 0xDC ++#define SFF_8636_RX_PWR_TYPE_MASK 0x8 ++#define SFF_8636_RX_PWR_TYPE_AVG_PWR RTE_BIT32(3) ++#define SFF_8636_RX_PWR_TYPE_OMA (0 << 3) ++#define SFF_8636_TX_PWR_TYPE_MASK 0x4 ++#define SFF_8636_TX_PWR_TYPE_AVG_PWR RTE_BIT32(2) ++ ++/* Enhanced Options - 221 */ ++#define SFF_8636_ENH_OPTIONS_OFFSET 0xDD ++#define SFF_8636_RATE_SELECT_EXT_SUPPORT RTE_BIT32(3) ++#define SFF_8636_RATE_SELECT_APP_TABLE_SUPPORT RTE_BIT32(2) ++ ++/* Check code - 223 */ ++#define SFF_8636_CC_EXT_OFFSET 0xDF ++#define SFF_8636_CC_EXT_LEN 1 ++ ++/*------------------------------------------------------------------------------ ++ * ++ * Upper Memory Page 03h ++ * Contains module thresholds, channel thresholds and masks, ++ * and optional channel controls ++ * ++ * Offset - Page Num(3) * PageSize(0x80) + Page offset ++ */ ++ ++/* Module Thresholds (48 Bytes) 128-175 */ ++/* MSB at low address, LSB at high address */ ++#define SFF_8636_TEMP_HALRM 0x200 ++#define SFF_8636_TEMP_LALRM 0x202 ++#define SFF_8636_TEMP_HWARN 0x204 ++#define SFF_8636_TEMP_LWARN 0x206 ++ ++#define SFF_8636_VCC_HALRM 0x210 ++#define SFF_8636_VCC_LALRM 0x212 ++#define SFF_8636_VCC_HWARN 0x214 ++#define SFF_8636_VCC_LWARN 0x216 ++ ++#define SFF_8636_RX_PWR_HALRM 0x230 ++#define SFF_8636_RX_PWR_LALRM 0x232 ++#define SFF_8636_RX_PWR_HWARN 0x234 ++#define SFF_8636_RX_PWR_LWARN 0x236 ++ ++#define SFF_8636_TX_BIAS_HALRM 0x238 ++#define SFF_8636_TX_BIAS_LALRM 0x23A ++#define SFF_8636_TX_BIAS_HWARN 0x23C ++#define SFF_8636_TX_BIAS_LWARN 0x23E ++ ++#define SFF_8636_TX_PWR_HALRM 0x240 ++#define SFF_8636_TX_PWR_LALRM 0x242 ++#define SFF_8636_TX_PWR_HWARN 0x244 ++#define SFF_8636_TX_PWR_LWARN 0x246 ++ ++#define ETH_MODULE_SFF_8636_MAX_LEN 640 ++#define ETH_MODULE_SFF_8436_MAX_LEN 640 ++ ++#endif /* _SFF_8636_H_ */ +diff --git a/lib/ethdev/sff_telemetry.c b/lib/ethdev/sff_telemetry.c +index babb941..887f07c 100644 +--- a/lib/ethdev/sff_telemetry.c ++++ b/lib/ethdev/sff_telemetry.c +@@ -77,6 +77,10 @@ sff_port_module_eeprom_parse(uint16_t port_id, struct rte_tel_data *d) + sff_8079_show_all(einfo.data, d); + sff_8472_show_all(einfo.data, d); + break; ++ case RTE_ETH_MODULE_SFF_8436: ++ case RTE_ETH_MODULE_SFF_8636: ++ sff_8636_show_all(einfo.data, einfo.length, d); ++ break; + default: + RTE_ETHDEV_LOG(NOTICE, "Unsupported module type: %u\n", minfo.type); + break; +diff --git a/lib/ethdev/sff_telemetry.h b/lib/ethdev/sff_telemetry.h +index 3a8131d..81c1fb0 100644 +--- a/lib/ethdev/sff_telemetry.h ++++ b/lib/ethdev/sff_telemetry.h +@@ -15,6 +15,9 @@ void sff_8079_show_all(const uint8_t *data, struct rte_tel_data *d); + /* SFF-8472 Optics diagnostics */ + void sff_8472_show_all(const uint8_t *data, struct rte_tel_data *d); + ++/* SFF-8636 Optics diagnostics */ ++void sff_8636_show_all(const uint8_t *data, uint32_t eeprom_len, struct rte_tel_data *d); ++ + int eth_dev_handle_port_module_eeprom(const char *cmd __rte_unused, + const char *params, + struct rte_tel_data *d); +-- +2.23.0 + diff --git a/0356-telemetry-remove-RTE-prefix-from-internal-enums.patch b/0356-telemetry-remove-RTE-prefix-from-internal-enums.patch new file mode 100644 index 0000000..cf7ca98 --- /dev/null +++ b/0356-telemetry-remove-RTE-prefix-from-internal-enums.patch @@ -0,0 +1,285 @@ +From 7d1c58f6d3ab3d695553ea6018b8866ed43ca99a Mon Sep 17 00:00:00 2001 +From: Bruce Richardson +Date: Thu, 12 Jan 2023 17:41:08 +0000 +Subject: telemetry: remove RTE prefix from internal enums + +[ upstream commit 5a36d5311fafc0775922317928bb8892f5b13dc8 ] + +To better distinguish which values are public and which are internal +remove the "RTE_" prefix off the internal enum defining the container +types. + +Signed-off-by: Bruce Richardson +Acked-by: Morten Brørup +Acked-by: Tyler Retzlaff +Acked-by: Ciara Power +--- + lib/ethdev/sff_telemetry.c | 2 +- + lib/telemetry/telemetry.c | 36 +++++++++++++++--------------- + lib/telemetry/telemetry_data.c | 40 +++++++++++++++++----------------- + lib/telemetry/telemetry_data.h | 14 ++++++------ + 4 files changed, 46 insertions(+), 46 deletions(-) + +diff --git a/lib/ethdev/sff_telemetry.c b/lib/ethdev/sff_telemetry.c +index 887f07c..922841b 100644 +--- a/lib/ethdev/sff_telemetry.c ++++ b/lib/ethdev/sff_telemetry.c +@@ -94,7 +94,7 @@ ssf_add_dict_string(struct rte_tel_data *d, const char *name_str, const char *va + { + struct tel_dict_entry *e = &d->data.dict[d->data_len]; + +- if (d->type != RTE_TEL_DICT) ++ if (d->type != TEL_DICT) + return; + if (d->data_len >= RTE_TEL_MAX_DICT_ENTRIES) { + RTE_ETHDEV_LOG(ERR, "data_len has exceeded the maximum number of inserts\n"); +diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c +index 52048de..8f2aef4 100644 +--- a/lib/telemetry/telemetry.c ++++ b/lib/telemetry/telemetry.c +@@ -166,27 +166,27 @@ container_to_json(const struct rte_tel_data *d, char *out_buf, size_t buf_len) + size_t used = 0; + unsigned int i; + +- if (d->type != RTE_TEL_DICT && d->type != RTE_TEL_ARRAY_U64 && +- d->type != RTE_TEL_ARRAY_INT && d->type != RTE_TEL_ARRAY_STRING) ++ if (d->type != TEL_DICT && d->type != TEL_ARRAY_U64 && ++ d->type != TEL_ARRAY_INT && d->type != TEL_ARRAY_STRING) + return snprintf(out_buf, buf_len, "null"); + + used = rte_tel_json_empty_array(out_buf, buf_len, 0); +- if (d->type == RTE_TEL_ARRAY_U64) ++ if (d->type == TEL_ARRAY_U64) + for (i = 0; i < d->data_len; i++) + used = rte_tel_json_add_array_u64(out_buf, + buf_len, used, + d->data.array[i].u64val); +- if (d->type == RTE_TEL_ARRAY_INT) ++ if (d->type == TEL_ARRAY_INT) + for (i = 0; i < d->data_len; i++) + used = rte_tel_json_add_array_int(out_buf, + buf_len, used, + d->data.array[i].ival); +- if (d->type == RTE_TEL_ARRAY_STRING) ++ if (d->type == TEL_ARRAY_STRING) + for (i = 0; i < d->data_len; i++) + used = rte_tel_json_add_array_string(out_buf, + buf_len, used, + d->data.array[i].sval); +- if (d->type == RTE_TEL_DICT) ++ if (d->type == TEL_DICT) + for (i = 0; i < d->data_len; i++) { + const struct tel_dict_entry *v = &d->data.dict[i]; + switch (v->type) { +@@ -244,15 +244,15 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s) + buf_len = sizeof(out_buf) - prefix_used - 1; /* space for '}' */ + + switch (d->type) { +- case RTE_TEL_NULL: ++ case TEL_NULL: + used = strlcpy(cb_data_buf, "null", buf_len); + break; + +- case RTE_TEL_STRING: ++ case TEL_STRING: + used = rte_tel_json_str(cb_data_buf, buf_len, 0, d->data.str); + break; + +- case RTE_TEL_DICT: ++ case TEL_DICT: + used = rte_tel_json_empty_obj(cb_data_buf, buf_len, 0); + for (i = 0; i < d->data_len; i++) { + const struct tel_dict_entry *v = &d->data.dict[i]; +@@ -290,26 +290,26 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s) + } + break; + +- case RTE_TEL_ARRAY_STRING: +- case RTE_TEL_ARRAY_INT: +- case RTE_TEL_ARRAY_U64: +- case RTE_TEL_ARRAY_CONTAINER: ++ case TEL_ARRAY_STRING: ++ case TEL_ARRAY_INT: ++ case TEL_ARRAY_U64: ++ case TEL_ARRAY_CONTAINER: + used = rte_tel_json_empty_array(cb_data_buf, buf_len, 0); + for (i = 0; i < d->data_len; i++) +- if (d->type == RTE_TEL_ARRAY_STRING) ++ if (d->type == TEL_ARRAY_STRING) + used = rte_tel_json_add_array_string( + cb_data_buf, + buf_len, used, + d->data.array[i].sval); +- else if (d->type == RTE_TEL_ARRAY_INT) ++ else if (d->type == TEL_ARRAY_INT) + used = rte_tel_json_add_array_int(cb_data_buf, + buf_len, used, + d->data.array[i].ival); +- else if (d->type == RTE_TEL_ARRAY_U64) ++ else if (d->type == TEL_ARRAY_U64) + used = rte_tel_json_add_array_u64(cb_data_buf, + buf_len, used, + d->data.array[i].u64val); +- else if (d->type == RTE_TEL_ARRAY_CONTAINER) { ++ else if (d->type == TEL_ARRAY_CONTAINER) { + char temp[buf_len]; + const struct container *rec_data = + &d->data.array[i].container; +@@ -350,7 +350,7 @@ static int + unknown_command(const char *cmd __rte_unused, const char *params __rte_unused, + struct rte_tel_data *d) + { +- return d->type = RTE_TEL_NULL; ++ return d->type = TEL_NULL; + } + + static void * +diff --git a/lib/telemetry/telemetry_data.c b/lib/telemetry/telemetry_data.c +index 61d9eea..15bcf8c 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[] = { +- RTE_TEL_ARRAY_STRING, /* RTE_TEL_STRING_VAL = 0 */ +- RTE_TEL_ARRAY_INT, /* RTE_TEL_INT_VAL = 1 */ +- RTE_TEL_ARRAY_U64, /* RTE_TEL_u64_VAL = 2 */ +- RTE_TEL_ARRAY_CONTAINER, /* RTE_TEL_CONTAINER = 3 */ ++ 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 */ + }; + d->type = array_types[type]; + d->data_len = 0; +@@ -29,7 +29,7 @@ rte_tel_data_start_array(struct rte_tel_data *d, enum rte_tel_value_type type) + int + rte_tel_data_start_dict(struct rte_tel_data *d) + { +- d->type = RTE_TEL_DICT; ++ d->type = TEL_DICT; + d->data_len = 0; + return 0; + } +@@ -37,7 +37,7 @@ rte_tel_data_start_dict(struct rte_tel_data *d) + int + rte_tel_data_string(struct rte_tel_data *d, const char *str) + { +- d->type = RTE_TEL_STRING; ++ d->type = TEL_STRING; + d->data_len = strlcpy(d->data.str, str, sizeof(d->data.str)); + if (d->data_len >= RTE_TEL_MAX_SINGLE_STRING_LEN) { + d->data_len = RTE_TEL_MAX_SINGLE_STRING_LEN - 1; +@@ -49,7 +49,7 @@ rte_tel_data_string(struct rte_tel_data *d, const char *str) + int + rte_tel_data_add_array_string(struct rte_tel_data *d, const char *str) + { +- if (d->type != RTE_TEL_ARRAY_STRING) ++ if (d->type != TEL_ARRAY_STRING) + return -EINVAL; + if (d->data_len >= RTE_TEL_MAX_ARRAY_ENTRIES) + return -ENOSPC; +@@ -61,7 +61,7 @@ rte_tel_data_add_array_string(struct rte_tel_data *d, const char *str) + int + rte_tel_data_add_array_int(struct rte_tel_data *d, int x) + { +- if (d->type != RTE_TEL_ARRAY_INT) ++ if (d->type != TEL_ARRAY_INT) + return -EINVAL; + if (d->data_len >= RTE_TEL_MAX_ARRAY_ENTRIES) + return -ENOSPC; +@@ -72,7 +72,7 @@ rte_tel_data_add_array_int(struct rte_tel_data *d, int x) + int + rte_tel_data_add_array_u64(struct rte_tel_data *d, uint64_t x) + { +- if (d->type != RTE_TEL_ARRAY_U64) ++ if (d->type != TEL_ARRAY_U64) + return -EINVAL; + if (d->data_len >= RTE_TEL_MAX_ARRAY_ENTRIES) + return -ENOSPC; +@@ -84,10 +84,10 @@ int + rte_tel_data_add_array_container(struct rte_tel_data *d, + struct rte_tel_data *val, int keep) + { +- if (d->type != RTE_TEL_ARRAY_CONTAINER || +- (val->type != RTE_TEL_ARRAY_U64 +- && val->type != RTE_TEL_ARRAY_INT +- && val->type != RTE_TEL_ARRAY_STRING)) ++ if (d->type != TEL_ARRAY_CONTAINER || ++ (val->type != TEL_ARRAY_U64 ++ && val->type != TEL_ARRAY_INT ++ && val->type != TEL_ARRAY_STRING)) + return -EINVAL; + if (d->data_len >= RTE_TEL_MAX_ARRAY_ENTRIES) + return -ENOSPC; +@@ -176,7 +176,7 @@ rte_tel_data_add_dict_string(struct rte_tel_data *d, const char *name, + struct tel_dict_entry *e = &d->data.dict[d->data_len]; + size_t nbytes, vbytes; + +- if (d->type != RTE_TEL_DICT) ++ if (d->type != TEL_DICT) + return -EINVAL; + if (d->data_len >= RTE_TEL_MAX_DICT_ENTRIES) + return -ENOSPC; +@@ -198,7 +198,7 @@ int + rte_tel_data_add_dict_int(struct rte_tel_data *d, const char *name, int val) + { + struct tel_dict_entry *e = &d->data.dict[d->data_len]; +- if (d->type != RTE_TEL_DICT) ++ if (d->type != TEL_DICT) + return -EINVAL; + if (d->data_len >= RTE_TEL_MAX_DICT_ENTRIES) + return -ENOSPC; +@@ -218,7 +218,7 @@ rte_tel_data_add_dict_u64(struct rte_tel_data *d, + const char *name, uint64_t val) + { + struct tel_dict_entry *e = &d->data.dict[d->data_len]; +- if (d->type != RTE_TEL_DICT) ++ if (d->type != TEL_DICT) + return -EINVAL; + if (d->data_len >= RTE_TEL_MAX_DICT_ENTRIES) + return -ENOSPC; +@@ -239,10 +239,10 @@ rte_tel_data_add_dict_container(struct rte_tel_data *d, const char *name, + { + struct tel_dict_entry *e = &d->data.dict[d->data_len]; + +- if (d->type != RTE_TEL_DICT || (val->type != RTE_TEL_ARRAY_U64 +- && val->type != RTE_TEL_ARRAY_INT +- && val->type != RTE_TEL_ARRAY_STRING +- && val->type != RTE_TEL_DICT)) ++ if (d->type != TEL_DICT || (val->type != TEL_ARRAY_U64 ++ && val->type != TEL_ARRAY_INT ++ && val->type != TEL_ARRAY_STRING ++ && val->type != TEL_DICT)) + return -EINVAL; + if (d->data_len >= RTE_TEL_MAX_DICT_ENTRIES) + return -ENOSPC; +diff --git a/lib/telemetry/telemetry_data.h b/lib/telemetry/telemetry_data.h +index adb84a0..2e5504a 100644 +--- a/lib/telemetry/telemetry_data.h ++++ b/lib/telemetry/telemetry_data.h +@@ -9,13 +9,13 @@ + #include "rte_telemetry.h" + + enum tel_container_types { +- RTE_TEL_NULL, /** null, used as error value */ +- RTE_TEL_STRING, /** basic string type, no included data */ +- RTE_TEL_DICT, /** name-value pairs, of individual value type */ +- RTE_TEL_ARRAY_STRING, /** array of string values only */ +- RTE_TEL_ARRAY_INT, /** array of signed, 32-bit int values */ +- RTE_TEL_ARRAY_U64, /** array of unsigned 64-bit int values */ +- RTE_TEL_ARRAY_CONTAINER, /** array of container structs */ ++ TEL_NULL, /** null, used as error value */ ++ TEL_STRING, /** basic string type, no included data */ ++ TEL_DICT, /** name-value pairs, of individual value type */ ++ TEL_ARRAY_STRING, /** array of string values only */ ++ TEL_ARRAY_INT, /** array of signed, 32-bit int values */ ++ TEL_ARRAY_U64, /** array of unsigned 64-bit int values */ ++ TEL_ARRAY_CONTAINER, /** array of container structs */ + }; + + struct container { +-- +2.23.0 + diff --git a/0357-telemetry-make-array-initialization-more-robust.patch b/0357-telemetry-make-array-initialization-more-robust.patch new file mode 100644 index 0000000..df38e24 --- /dev/null +++ b/0357-telemetry-make-array-initialization-more-robust.patch @@ -0,0 +1,41 @@ +From d4dd238ec9a01810d29a069cbbb3a573b5f16d20 Mon Sep 17 00:00:00 2001 +From: Bruce Richardson +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 +Acked-by: Morten Brørup +Acked-by: Tyler Retzlaff +Acked-by: Ciara Power +--- + 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 + diff --git a/0358-telemetry-rename-unsigned-64-bit-enum-value-to-uint.patch b/0358-telemetry-rename-unsigned-64-bit-enum-value-to-uint.patch new file mode 100644 index 0000000..64528ce --- /dev/null +++ b/0358-telemetry-rename-unsigned-64-bit-enum-value-to-uint.patch @@ -0,0 +1,219 @@ +From 2dcb9886c4939afcbd0ef4983a52541c3cdc92fb Mon Sep 17 00:00:00 2001 +From: Bruce Richardson +Date: Thu, 12 Jan 2023 17:41:10 +0000 +Subject: telemetry: rename unsigned 64-bit enum value to uint + +[ upstream commit 2d2c55e4ae5ad9ddd24567d2c4695c5bc4ea017c ] + +For telemetry data, rather than having unsigned 64-bit values and signed +32-bit values, we want to just have unsigned and signed values, each +stored with the max bit-width i.e. 64-bits. To that end, we rename the +U64 enum entry to "UINT" to have a more generic name + +For backward API-level compatibility, we can use a macro to alias the +old name to the new. + +Suggested-by: Morten Brørup +Signed-off-by: Bruce Richardson +Acked-by: Morten Brørup +Acked-by: Tyler Retzlaff +Acked-by: Ciara Power +--- + app/test/test_telemetry_data.c | 10 +++++----- + drivers/net/cnxk/cnxk_ethdev_telemetry.c | 2 +- + lib/cryptodev/rte_cryptodev.c | 2 +- + lib/ethdev/rte_ethdev.c | 2 +- + lib/ipsec/ipsec_telemetry.c | 2 +- + lib/security/rte_security.c | 4 ++-- + lib/telemetry/rte_telemetry.h | 6 ++++-- + lib/telemetry/telemetry.c | 4 ++-- + lib/telemetry/telemetry_data.c | 4 ++-- + 9 files changed, 19 insertions(+), 17 deletions(-) + +diff --git a/app/test/test_telemetry_data.c b/app/test/test_telemetry_data.c +index 7d9be37..8bce86b 100644 +--- a/app/test/test_telemetry_data.c ++++ b/app/test/test_telemetry_data.c +@@ -393,7 +393,7 @@ test_case_array_u64(void) + { + int i; + +- rte_tel_data_start_array(&response_data, RTE_TEL_U64_VAL); ++ rte_tel_data_start_array(&response_data, RTE_TEL_UINT_VAL); + for (i = 0; i < 5; i++) + rte_tel_data_add_array_u64(&response_data, i); + return CHECK_OUTPUT("[0,1,2,3,4]"); +@@ -444,10 +444,10 @@ test_dict_with_array_u64_values(void) + int i; + + struct rte_tel_data *child_data = rte_tel_data_alloc(); +- rte_tel_data_start_array(child_data, RTE_TEL_U64_VAL); ++ rte_tel_data_start_array(child_data, RTE_TEL_UINT_VAL); + + struct rte_tel_data *child_data2 = rte_tel_data_alloc(); +- rte_tel_data_start_array(child_data2, RTE_TEL_U64_VAL); ++ rte_tel_data_start_array(child_data2, RTE_TEL_UINT_VAL); + + rte_tel_data_start_dict(&response_data); + +@@ -470,10 +470,10 @@ test_array_with_array_u64_values(void) + int i; + + struct rte_tel_data *child_data = rte_tel_data_alloc(); +- rte_tel_data_start_array(child_data, RTE_TEL_U64_VAL); ++ rte_tel_data_start_array(child_data, RTE_TEL_UINT_VAL); + + struct rte_tel_data *child_data2 = rte_tel_data_alloc(); +- rte_tel_data_start_array(child_data2, RTE_TEL_U64_VAL); ++ rte_tel_data_start_array(child_data2, RTE_TEL_UINT_VAL); + + rte_tel_data_start_array(&response_data, RTE_TEL_CONTAINER); + +diff --git a/drivers/net/cnxk/cnxk_ethdev_telemetry.c b/drivers/net/cnxk/cnxk_ethdev_telemetry.c +index 4fd9048..d73d715 100644 +--- a/drivers/net/cnxk/cnxk_ethdev_telemetry.c ++++ b/drivers/net/cnxk/cnxk_ethdev_telemetry.c +@@ -51,7 +51,7 @@ ethdev_tel_handle_info(const char *cmd __rte_unused, + i_data = rte_tel_data_alloc(); + if (i_data == NULL) + return -ENOMEM; +- rte_tel_data_start_array(i_data, RTE_TEL_U64_VAL); ++ rte_tel_data_start_array(i_data, RTE_TEL_UINT_VAL); + + for (i = 0; i < RTE_MAX_ETHPORTS; i++) { + /* Skip if port is unused */ +diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c +index 23e079d..ae20d19 100644 +--- a/lib/cryptodev/rte_cryptodev.c ++++ b/lib/cryptodev/rte_cryptodev.c +@@ -2524,7 +2524,7 @@ crypto_caps_array(struct rte_tel_data *d, + uint64_t caps_val[CRYPTO_CAPS_SZ]; + unsigned int i = 0, j; + +- rte_tel_data_start_array(d, RTE_TEL_U64_VAL); ++ rte_tel_data_start_array(d, RTE_TEL_UINT_VAL); + + while ((dev_caps = &capabilities[i++])->op != + RTE_CRYPTO_OP_TYPE_UNDEFINED) { +diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c +index c65dc8b..8a35521 100644 +--- a/lib/ethdev/rte_ethdev.c ++++ b/lib/ethdev/rte_ethdev.c +@@ -6211,7 +6211,7 @@ eth_dev_add_port_queue_stats(struct rte_tel_data *d, uint64_t *q_stats, + struct rte_tel_data *q_data = rte_tel_data_alloc(); + if (q_data == NULL) + return; +- rte_tel_data_start_array(q_data, RTE_TEL_U64_VAL); ++ rte_tel_data_start_array(q_data, RTE_TEL_UINT_VAL); + for (q = 0; q < RTE_ETHDEV_QUEUE_STAT_CNTRS; q++) + rte_tel_data_add_array_u64(q_data, q_stats[q]); + rte_tel_data_add_dict_container(d, stat_name, q_data, 0); +diff --git a/lib/ipsec/ipsec_telemetry.c b/lib/ipsec/ipsec_telemetry.c +index 9a91e47..1147de6 100644 +--- a/lib/ipsec/ipsec_telemetry.c ++++ b/lib/ipsec/ipsec_telemetry.c +@@ -21,7 +21,7 @@ handle_telemetry_cmd_ipsec_sa_list(const char *cmd __rte_unused, + struct rte_tel_data *data) + { + struct ipsec_telemetry_entry *entry; +- rte_tel_data_start_array(data, RTE_TEL_U64_VAL); ++ rte_tel_data_start_array(data, RTE_TEL_UINT_VAL); + + LIST_FOREACH(entry, &ipsec_telemetry_list, next) { + const struct rte_ipsec_sa *sa = entry->sa; +diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c +index 6e45a03..fda8c47 100644 +--- a/lib/security/rte_security.c ++++ b/lib/security/rte_security.c +@@ -237,7 +237,7 @@ crypto_caps_array(struct rte_tel_data *d, + uint64_t caps_val[CRYPTO_CAPS_SZ]; + unsigned int i = 0, j; + +- rte_tel_data_start_array(d, RTE_TEL_U64_VAL); ++ rte_tel_data_start_array(d, RTE_TEL_UINT_VAL); + + while ((dev_caps = &capabilities[i++])->op != + RTE_CRYPTO_OP_TYPE_UNDEFINED) { +@@ -262,7 +262,7 @@ sec_caps_array(struct rte_tel_data *d, + uint64_t caps_val[SEC_CAPS_SZ]; + unsigned int i = 0, j; + +- rte_tel_data_start_array(d, RTE_TEL_U64_VAL); ++ rte_tel_data_start_array(d, RTE_TEL_UINT_VAL); + + while ((dev_caps = &capabilities[i++])->action != + RTE_SECURITY_ACTION_TYPE_NONE) { +diff --git a/lib/telemetry/rte_telemetry.h b/lib/telemetry/rte_telemetry.h +index 5d5b75b..05e64d4 100644 +--- a/lib/telemetry/rte_telemetry.h ++++ b/lib/telemetry/rte_telemetry.h +@@ -43,10 +43,12 @@ struct rte_tel_data; + enum rte_tel_value_type { + RTE_TEL_STRING_VAL, /** a string value */ + RTE_TEL_INT_VAL, /** a signed 32-bit int value */ +- RTE_TEL_U64_VAL, /** an unsigned 64-bit int value */ ++ RTE_TEL_UINT_VAL, /** an unsigned 64-bit int value */ + RTE_TEL_CONTAINER, /** a container struct */ + }; + ++#define RTE_TEL_U64_VAL RTE_TEL_UINT_VAL ++ + /** + * Start an array of the specified type for returning from a callback + * +@@ -121,7 +123,7 @@ rte_tel_data_add_array_int(struct rte_tel_data *d, int x); + /** + * Add a uint64_t to an array. + * The array must have been started by rte_tel_data_start_array() with +- * RTE_TEL_U64_VAL as the type parameter. ++ * RTE_TEL_UINT_VAL as the type parameter. + * + * @param d + * The data structure passed to the callback +diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c +index 8f2aef4..f4c886d 100644 +--- a/lib/telemetry/telemetry.c ++++ b/lib/telemetry/telemetry.c +@@ -200,7 +200,7 @@ container_to_json(const struct rte_tel_data *d, char *out_buf, size_t buf_len) + buf_len, used, + v->name, v->value.ival); + break; +- case RTE_TEL_U64_VAL: ++ case RTE_TEL_UINT_VAL: + used = rte_tel_json_add_obj_u64(out_buf, + buf_len, used, + v->name, v->value.u64val); +@@ -267,7 +267,7 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s) + buf_len, used, + v->name, v->value.ival); + break; +- case RTE_TEL_U64_VAL: ++ case RTE_TEL_UINT_VAL: + used = rte_tel_json_add_obj_u64(cb_data_buf, + buf_len, used, + v->name, v->value.u64val); +diff --git a/lib/telemetry/telemetry_data.c b/lib/telemetry/telemetry_data.c +index 7204c34..4c661db 100644 +--- a/lib/telemetry/telemetry_data.c ++++ b/lib/telemetry/telemetry_data.c +@@ -18,7 +18,7 @@ rte_tel_data_start_array(struct rte_tel_data *d, enum rte_tel_value_type type) + enum tel_container_types array_types[] = { + [RTE_TEL_STRING_VAL] = TEL_ARRAY_STRING, + [RTE_TEL_INT_VAL] = TEL_ARRAY_INT, +- [RTE_TEL_U64_VAL] = TEL_ARRAY_U64, ++ [RTE_TEL_UINT_VAL] = TEL_ARRAY_U64, + [RTE_TEL_CONTAINER] = TEL_ARRAY_CONTAINER, + }; + d->type = array_types[type]; +@@ -227,7 +227,7 @@ rte_tel_data_add_dict_u64(struct rte_tel_data *d, + return -EINVAL; + + d->data_len++; +- e->type = RTE_TEL_U64_VAL; ++ e->type = RTE_TEL_UINT_VAL; + e->value.u64val = val; + const size_t bytes = strlcpy(e->name, name, RTE_TEL_MAX_STRING_LEN); + return bytes < RTE_TEL_MAX_STRING_LEN ? 0 : E2BIG; +-- +2.23.0 + diff --git a/0359-telemetry-add-uint-type-as-alias-for-u64.patch b/0359-telemetry-add-uint-type-as-alias-for-u64.patch new file mode 100644 index 0000000..b9ab0c5 --- /dev/null +++ b/0359-telemetry-add-uint-type-as-alias-for-u64.patch @@ -0,0 +1,267 @@ +From 6c57ca3ecc620e75494ed69a94793feeb6ce4118 Mon Sep 17 00:00:00 2001 +From: Bruce Richardson +Date: Thu, 12 Jan 2023 17:41:11 +0000 +Subject: telemetry: add uint type as alias for u64 + +[ upstream commit cc4f33d98c997ceff56942e24cba33f1c58baa19 ] + +To match the "_int" suffix for telemetry data functions taking signed +values, we can add new functions with the "_uint" suffix for unsigned +ones. While later patches will deprecate the old public functions, for +now we can just add the new functions as aliases or duplicates of the +older ones with the "u64" suffix. + +Internal functions can be directly renamed, without any need for +aliasing or deprecation. + +Suggested-by: Morten Brørup +Signed-off-by: Bruce Richardson +Acked-by: Morten Brørup +Acked-by: Tyler Retzlaff +Acked-by: Ciara Power +--- + lib/telemetry/rte_telemetry.h | 35 ++++++++++++++++++++++++++++++++++ + lib/telemetry/telemetry.c | 16 ++++++++-------- + lib/telemetry/telemetry_data.c | 28 +++++++++++++++++++-------- + lib/telemetry/telemetry_data.h | 4 ++-- + lib/telemetry/version.map | 2 ++ + 5 files changed, 67 insertions(+), 18 deletions(-) + +diff --git a/lib/telemetry/rte_telemetry.h b/lib/telemetry/rte_telemetry.h +index 05e64d4..73886fe 100644 +--- a/lib/telemetry/rte_telemetry.h ++++ b/lib/telemetry/rte_telemetry.h +@@ -121,6 +121,22 @@ int + rte_tel_data_add_array_int(struct rte_tel_data *d, int x); + + /** ++ * Add an unsigned value to an array. ++ * The array must have been started by rte_tel_data_start_array() with ++ * RTE_TEL_UINT_VAL as the type parameter. ++ * ++ * @param d ++ * The data structure passed to the callback ++ * @param x ++ * The number to be returned in the array ++ * @return ++ * 0 on success, negative errno on error ++ */ ++__rte_experimental ++int ++rte_tel_data_add_array_uint(struct rte_tel_data *d, uint64_t x); ++ ++ /** + * Add a uint64_t to an array. + * The array must have been started by rte_tel_data_start_array() with + * RTE_TEL_UINT_VAL as the type parameter. +@@ -215,6 +231,25 @@ int + rte_tel_data_add_dict_int(struct rte_tel_data *d, const char *name, int val); + + /** ++ * Add an unsigned value to a dictionary. ++ * The dict must have been started by rte_tel_data_start_dict(). ++ * ++ * @param d ++ * The data structure passed to the callback ++ * @param name ++ * The name the value is to be stored under in the dict ++ * Must contain only alphanumeric characters or the symbols: '_' or '/' ++ * @param val ++ * The number to be stored in the dict ++ * @return ++ * 0 on success, negative errno on error, E2BIG on string truncation of name. ++ */ ++__rte_experimental ++int ++rte_tel_data_add_dict_uint(struct rte_tel_data *d, ++ const char *name, uint64_t val); ++ ++ /** + * Add a uint64_t value to a dictionary. + * The dict must have been started by rte_tel_data_start_dict(). + * +diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c +index f4c886d..7c0213c 100644 +--- a/lib/telemetry/telemetry.c ++++ b/lib/telemetry/telemetry.c +@@ -166,16 +166,16 @@ container_to_json(const struct rte_tel_data *d, char *out_buf, size_t buf_len) + size_t used = 0; + unsigned int i; + +- if (d->type != TEL_DICT && d->type != TEL_ARRAY_U64 && ++ if (d->type != TEL_DICT && d->type != TEL_ARRAY_UINT && + d->type != TEL_ARRAY_INT && d->type != TEL_ARRAY_STRING) + return snprintf(out_buf, buf_len, "null"); + + used = rte_tel_json_empty_array(out_buf, buf_len, 0); +- if (d->type == TEL_ARRAY_U64) ++ if (d->type == TEL_ARRAY_UINT) + for (i = 0; i < d->data_len; i++) + used = rte_tel_json_add_array_u64(out_buf, + buf_len, used, +- d->data.array[i].u64val); ++ d->data.array[i].uval); + if (d->type == TEL_ARRAY_INT) + for (i = 0; i < d->data_len; i++) + used = rte_tel_json_add_array_int(out_buf, +@@ -203,7 +203,7 @@ container_to_json(const struct rte_tel_data *d, char *out_buf, size_t buf_len) + case RTE_TEL_UINT_VAL: + used = rte_tel_json_add_obj_u64(out_buf, + buf_len, used, +- v->name, v->value.u64val); ++ v->name, v->value.uval); + break; + case RTE_TEL_CONTAINER: + { +@@ -270,7 +270,7 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s) + case RTE_TEL_UINT_VAL: + used = rte_tel_json_add_obj_u64(cb_data_buf, + buf_len, used, +- v->name, v->value.u64val); ++ v->name, v->value.uval); + break; + case RTE_TEL_CONTAINER: + { +@@ -292,7 +292,7 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s) + + case TEL_ARRAY_STRING: + case TEL_ARRAY_INT: +- case TEL_ARRAY_U64: ++ case TEL_ARRAY_UINT: + case TEL_ARRAY_CONTAINER: + used = rte_tel_json_empty_array(cb_data_buf, buf_len, 0); + for (i = 0; i < d->data_len; i++) +@@ -305,10 +305,10 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s) + used = rte_tel_json_add_array_int(cb_data_buf, + buf_len, used, + d->data.array[i].ival); +- else if (d->type == TEL_ARRAY_U64) ++ else if (d->type == TEL_ARRAY_UINT) + used = rte_tel_json_add_array_u64(cb_data_buf, + buf_len, used, +- d->data.array[i].u64val); ++ d->data.array[i].uval); + else if (d->type == TEL_ARRAY_CONTAINER) { + char temp[buf_len]; + const struct container *rec_data = +diff --git a/lib/telemetry/telemetry_data.c b/lib/telemetry/telemetry_data.c +index 4c661db..b53c165 100644 +--- a/lib/telemetry/telemetry_data.c ++++ b/lib/telemetry/telemetry_data.c +@@ -18,7 +18,7 @@ rte_tel_data_start_array(struct rte_tel_data *d, enum rte_tel_value_type type) + enum tel_container_types array_types[] = { + [RTE_TEL_STRING_VAL] = TEL_ARRAY_STRING, + [RTE_TEL_INT_VAL] = TEL_ARRAY_INT, +- [RTE_TEL_UINT_VAL] = TEL_ARRAY_U64, ++ [RTE_TEL_UINT_VAL] = TEL_ARRAY_UINT, + [RTE_TEL_CONTAINER] = TEL_ARRAY_CONTAINER, + }; + d->type = array_types[type]; +@@ -70,22 +70,28 @@ rte_tel_data_add_array_int(struct rte_tel_data *d, int x) + } + + int +-rte_tel_data_add_array_u64(struct rte_tel_data *d, uint64_t x) ++rte_tel_data_add_array_uint(struct rte_tel_data *d, uint64_t x) + { +- if (d->type != TEL_ARRAY_U64) ++ if (d->type != TEL_ARRAY_UINT) + return -EINVAL; + if (d->data_len >= RTE_TEL_MAX_ARRAY_ENTRIES) + return -ENOSPC; +- d->data.array[d->data_len++].u64val = x; ++ d->data.array[d->data_len++].uval = x; + return 0; + } + ++int ++rte_tel_data_add_array_u64(struct rte_tel_data *d, uint64_t x) ++{ ++ return rte_tel_data_add_array_uint(d, x); ++} ++ + int + rte_tel_data_add_array_container(struct rte_tel_data *d, + struct rte_tel_data *val, int keep) + { + if (d->type != TEL_ARRAY_CONTAINER || +- (val->type != TEL_ARRAY_U64 ++ (val->type != TEL_ARRAY_UINT + && val->type != TEL_ARRAY_INT + && val->type != TEL_ARRAY_STRING)) + return -EINVAL; +@@ -214,7 +220,7 @@ rte_tel_data_add_dict_int(struct rte_tel_data *d, const char *name, int val) + } + + int +-rte_tel_data_add_dict_u64(struct rte_tel_data *d, ++rte_tel_data_add_dict_uint(struct rte_tel_data *d, + const char *name, uint64_t val) + { + struct tel_dict_entry *e = &d->data.dict[d->data_len]; +@@ -228,18 +234,24 @@ rte_tel_data_add_dict_u64(struct rte_tel_data *d, + + d->data_len++; + e->type = RTE_TEL_UINT_VAL; +- e->value.u64val = val; ++ e->value.uval = val; + const size_t bytes = strlcpy(e->name, name, RTE_TEL_MAX_STRING_LEN); + return bytes < RTE_TEL_MAX_STRING_LEN ? 0 : E2BIG; + } + ++int ++rte_tel_data_add_dict_u64(struct rte_tel_data *d, const char *name, uint64_t val) ++{ ++ return rte_tel_data_add_dict_uint(d, name, val); ++} ++ + int + rte_tel_data_add_dict_container(struct rte_tel_data *d, const char *name, + struct rte_tel_data *val, int keep) + { + struct tel_dict_entry *e = &d->data.dict[d->data_len]; + +- if (d->type != TEL_DICT || (val->type != TEL_ARRAY_U64 ++ if (d->type != TEL_DICT || (val->type != TEL_ARRAY_UINT + && val->type != TEL_ARRAY_INT + && val->type != TEL_ARRAY_STRING + && val->type != TEL_DICT)) +diff --git a/lib/telemetry/telemetry_data.h b/lib/telemetry/telemetry_data.h +index 2e5504a..d5f4125 100644 +--- a/lib/telemetry/telemetry_data.h ++++ b/lib/telemetry/telemetry_data.h +@@ -14,7 +14,7 @@ enum tel_container_types { + TEL_DICT, /** name-value pairs, of individual value type */ + TEL_ARRAY_STRING, /** array of string values only */ + TEL_ARRAY_INT, /** array of signed, 32-bit int values */ +- TEL_ARRAY_U64, /** array of unsigned 64-bit int values */ ++ TEL_ARRAY_UINT, /** array of unsigned 64-bit int values */ + TEL_ARRAY_CONTAINER, /** array of container structs */ + }; + +@@ -30,7 +30,7 @@ struct container { + union tel_value { + char sval[RTE_TEL_MAX_STRING_LEN]; + int ival; +- uint64_t u64val; ++ uint64_t uval; + struct container container; + }; + +diff --git a/lib/telemetry/version.map b/lib/telemetry/version.map +index 576ac55..3c228d9 100644 +--- a/lib/telemetry/version.map ++++ b/lib/telemetry/version.map +@@ -23,7 +23,9 @@ EXPERIMENTAL { + global: + + # added in 23.03 ++ rte_tel_data_add_array_uint; + rte_tel_data_add_array_uint_hex; ++ rte_tel_data_add_dict_uint; + rte_tel_data_add_dict_uint_hex; + + local: *; +-- +2.23.0 + diff --git a/0360-eventdev-timer-add-telemetry.patch b/0360-eventdev-timer-add-telemetry.patch new file mode 100644 index 0000000..19f370a --- /dev/null +++ b/0360-eventdev-timer-add-telemetry.patch @@ -0,0 +1,125 @@ +From 63c25440db217d92d1fcfde458c29782f908a00e Mon Sep 17 00:00:00 2001 +From: Ankur Dwivedi +Date: Tue, 26 Apr 2022 09:29:45 +0530 +Subject: eventdev/timer: add telemetry + +[ upstream commit 791dfec24d007df483b6179604938175198e6104 ] + +Adds telemetry support to get timer adapter info and timer adapter +statistics. + +Signed-off-by: Ankur Dwivedi +Reviewed-by: Jerin Jacob +--- + lib/eventdev/rte_event_timer_adapter.c | 91 ++++++++++++++++++++++++++ + 1 file changed, 91 insertions(+) + +diff --git a/lib/eventdev/rte_event_timer_adapter.c b/lib/eventdev/rte_event_timer_adapter.c +index 9dad170..771f7bb 100644 +--- a/lib/eventdev/rte_event_timer_adapter.c ++++ b/lib/eventdev/rte_event_timer_adapter.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + + #include "event_timer_adapter_pmd.h" + #include "eventdev_pmd.h" +@@ -1254,3 +1255,93 @@ static const struct event_timer_adapter_ops swtim_ops = { + .arm_tmo_tick_burst = swtim_arm_tmo_tick_burst, + .cancel_burst = swtim_cancel_burst, + }; ++ ++static int ++handle_ta_info(const char *cmd __rte_unused, const char *params, ++ struct rte_tel_data *d) ++{ ++ struct rte_event_timer_adapter_info adapter_info; ++ struct rte_event_timer_adapter *adapter; ++ uint16_t adapter_id; ++ int ret; ++ ++ if (params == NULL || strlen(params) == 0 || !isdigit(*params)) ++ return -1; ++ ++ adapter_id = atoi(params); ++ ++ if (adapter_id >= RTE_EVENT_TIMER_ADAPTER_NUM_MAX) { ++ EVTIM_LOG_ERR("Invalid timer adapter id %u", adapter_id); ++ return -EINVAL; ++ } ++ ++ adapter = &adapters[adapter_id]; ++ ++ ret = rte_event_timer_adapter_get_info(adapter, &adapter_info); ++ if (ret < 0) { ++ EVTIM_LOG_ERR("Failed to get info for timer adapter id %u", adapter_id); ++ return ret; ++ } ++ ++ rte_tel_data_start_dict(d); ++ rte_tel_data_add_dict_u64(d, "timer_adapter_id", adapter_id); ++ rte_tel_data_add_dict_u64(d, "min_resolution_ns", adapter_info.min_resolution_ns); ++ rte_tel_data_add_dict_u64(d, "max_tmo_ns", adapter_info.max_tmo_ns); ++ rte_tel_data_add_dict_u64(d, "event_dev_id", adapter_info.conf.event_dev_id); ++ rte_tel_data_add_dict_u64(d, "socket_id", adapter_info.conf.socket_id); ++ rte_tel_data_add_dict_u64(d, "clk_src", adapter_info.conf.clk_src); ++ rte_tel_data_add_dict_u64(d, "timer_tick_ns", adapter_info.conf.timer_tick_ns); ++ rte_tel_data_add_dict_u64(d, "nb_timers", adapter_info.conf.nb_timers); ++ rte_tel_data_add_dict_u64(d, "flags", adapter_info.conf.flags); ++ ++ return 0; ++} ++ ++static int ++handle_ta_stats(const char *cmd __rte_unused, const char *params, ++ struct rte_tel_data *d) ++{ ++ struct rte_event_timer_adapter_stats stats; ++ struct rte_event_timer_adapter *adapter; ++ uint16_t adapter_id; ++ int ret; ++ ++ if (params == NULL || strlen(params) == 0 || !isdigit(*params)) ++ return -1; ++ ++ adapter_id = atoi(params); ++ ++ if (adapter_id >= RTE_EVENT_TIMER_ADAPTER_NUM_MAX) { ++ EVTIM_LOG_ERR("Invalid timer adapter id %u", adapter_id); ++ return -EINVAL; ++ } ++ ++ adapter = &adapters[adapter_id]; ++ ++ ret = rte_event_timer_adapter_stats_get(adapter, &stats); ++ if (ret < 0) { ++ EVTIM_LOG_ERR("Failed to get stats for timer adapter id %u", adapter_id); ++ return ret; ++ } ++ ++ rte_tel_data_start_dict(d); ++ rte_tel_data_add_dict_u64(d, "timer_adapter_id", adapter_id); ++ rte_tel_data_add_dict_u64(d, "evtim_exp_count", stats.evtim_exp_count); ++ rte_tel_data_add_dict_u64(d, "ev_enq_count", stats.ev_enq_count); ++ rte_tel_data_add_dict_u64(d, "ev_inv_count", stats.ev_inv_count); ++ rte_tel_data_add_dict_u64(d, "evtim_retry_count", stats.evtim_retry_count); ++ rte_tel_data_add_dict_u64(d, "adapter_tick_count", stats.adapter_tick_count); ++ ++ return 0; ++} ++ ++RTE_INIT(ta_init_telemetry) ++{ ++ rte_telemetry_register_cmd("/eventdev/ta_info", ++ handle_ta_info, ++ "Returns Timer adapter info. Parameter: Timer adapter id"); ++ ++ rte_telemetry_register_cmd("/eventdev/ta_stats", ++ handle_ta_stats, ++ "Returns Timer adapter stats. Parameter: Timer adapter id"); ++} +-- +2.23.0 + diff --git a/0361-rename-telemetry-u64-functions-to-uint-versions.patch b/0361-rename-telemetry-u64-functions-to-uint-versions.patch new file mode 100644 index 0000000..1b0e9a8 --- /dev/null +++ b/0361-rename-telemetry-u64-functions-to-uint-versions.patch @@ -0,0 +1,676 @@ +From c7ab12b7b114ed360557c0330134048c934ad74a Mon Sep 17 00:00:00 2001 +From: Bruce Richardson +Date: Thu, 12 Jan 2023 17:41:12 +0000 +Subject: rename telemetry u64 functions to uint versions + +[ upstream commit af0785a2447b307965377b62f46a5f39457a85a3 ] + +Within the DPDK code-base, replace all occurrences of +"rte_tel_data_add_array_u64" with "rte_tel_data_add_array_uint", and +similarly replace all occurrences of "rte_tel_data_add_dict_u64" with +"rte_tel_data_add_dict_uint". This allows us to later mark the older +functions as deprecated without hitting warnings. + +Signed-off-by: Bruce Richardson +Acked-by: Ciara Power +--- + app/test/test_telemetry_data.c | 12 ++-- + drivers/common/cnxk/roc_platform.h | 4 +- + drivers/net/cnxk/cnxk_ethdev_telemetry.c | 4 +- + examples/ipsec-secgw/ipsec-secgw.c | 72 +++++++++++------------- + examples/l3fwd-power/main.c | 4 +- + lib/cryptodev/rte_cryptodev.c | 6 +- + lib/dmadev/rte_dmadev.c | 2 +- + lib/eal/common/eal_common_memory.c | 29 +++++----- + lib/ethdev/rte_ethdev.c | 14 ++--- + lib/eventdev/rte_event_eth_rx_adapter.c | 16 +++--- + lib/eventdev/rte_event_timer_adapter.c | 38 ++++++++----- + lib/eventdev/rte_eventdev.c | 5 +- + lib/ipsec/ipsec_telemetry.c | 31 +++++----- + lib/mempool/rte_mempool.c | 24 ++++---- + lib/rawdev/rte_rawdev.c | 4 +- + lib/security/rte_security.c | 4 +- + 16 files changed, 137 insertions(+), 132 deletions(-) + +diff --git a/app/test/test_telemetry_data.c b/app/test/test_telemetry_data.c +index 8bce86b..0b3af69 100644 +--- a/app/test/test_telemetry_data.c ++++ b/app/test/test_telemetry_data.c +@@ -395,7 +395,7 @@ test_case_array_u64(void) + + rte_tel_data_start_array(&response_data, RTE_TEL_UINT_VAL); + for (i = 0; i < 5; i++) +- rte_tel_data_add_array_u64(&response_data, i); ++ rte_tel_data_add_array_uint(&response_data, i); + return CHECK_OUTPUT("[0,1,2,3,4]"); + } + +@@ -433,7 +433,7 @@ test_case_add_dict_u64(void) + + for (i = 0; i < 5; i++) { + sprintf(name_of_value, "dict_%d", i); +- rte_tel_data_add_dict_u64(&response_data, name_of_value, i); ++ rte_tel_data_add_dict_uint(&response_data, name_of_value, i); + } + return CHECK_OUTPUT("{\"dict_0\":0,\"dict_1\":1,\"dict_2\":2,\"dict_3\":3,\"dict_4\":4}"); + } +@@ -452,8 +452,8 @@ test_dict_with_array_u64_values(void) + rte_tel_data_start_dict(&response_data); + + for (i = 0; i < 10; i++) { +- rte_tel_data_add_array_u64(child_data, i); +- rte_tel_data_add_array_u64(child_data2, i); ++ rte_tel_data_add_array_uint(child_data, i); ++ rte_tel_data_add_array_uint(child_data2, i); + } + + rte_tel_data_add_dict_container(&response_data, "dict_0", +@@ -478,8 +478,8 @@ test_array_with_array_u64_values(void) + rte_tel_data_start_array(&response_data, RTE_TEL_CONTAINER); + + for (i = 0; i < 5; i++) { +- rte_tel_data_add_array_u64(child_data, i); +- rte_tel_data_add_array_u64(child_data2, i); ++ rte_tel_data_add_array_uint(child_data, i); ++ rte_tel_data_add_array_uint(child_data2, i); + } + rte_tel_data_add_array_container(&response_data, child_data, 0); + rte_tel_data_add_array_container(&response_data, child_data2, 0); +diff --git a/drivers/common/cnxk/roc_platform.h b/drivers/common/cnxk/roc_platform.h +index 61d4781..f1fa54f 100644 +--- a/drivers/common/cnxk/roc_platform.h ++++ b/drivers/common/cnxk/roc_platform.h +@@ -182,9 +182,9 @@ + #define plt_tel_data_start_dict rte_tel_data_start_dict + #define plt_tel_data_add_dict_int rte_tel_data_add_dict_int + #define plt_tel_data_add_dict_ptr(d, n, v) \ +- rte_tel_data_add_dict_u64(d, n, (uint64_t)v) ++ rte_tel_data_add_dict_uint(d, n, (uint64_t)v) + #define plt_tel_data_add_dict_string rte_tel_data_add_dict_string +-#define plt_tel_data_add_dict_u64 rte_tel_data_add_dict_u64 ++#define plt_tel_data_add_dict_u64 rte_tel_data_add_dict_uint + #define plt_telemetry_register_cmd rte_telemetry_register_cmd + + /* Log */ +diff --git a/drivers/net/cnxk/cnxk_ethdev_telemetry.c b/drivers/net/cnxk/cnxk_ethdev_telemetry.c +index d73d715..5f472f1 100644 +--- a/drivers/net/cnxk/cnxk_ethdev_telemetry.c ++++ b/drivers/net/cnxk/cnxk_ethdev_telemetry.c +@@ -77,8 +77,8 @@ ethdev_tel_handle_info(const char *cmd __rte_unused, + } + + for (j = 0; j < ETH_INFO_SZ; j++) +- rte_tel_data_add_array_u64(i_data, +- eth_info.val[j]); ++ rte_tel_data_add_array_uint(i_data, ++ eth_info.val[j]); + + j++; + } +diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c +index 96916cd..70c6f31 100644 +--- a/examples/ipsec-secgw/ipsec-secgw.c ++++ b/examples/ipsec-secgw/ipsec-secgw.c +@@ -2947,14 +2947,12 @@ handle_telemetry_cmd_ipsec_secgw_stats(const char *cmd __rte_unused, + } + + /* add telemetry key/values pairs */ +- rte_tel_data_add_dict_u64(data, "packets received", +- total_pkts_rx); ++ rte_tel_data_add_dict_uint(data, "packets received", total_pkts_rx); + +- rte_tel_data_add_dict_u64(data, "packets transmitted", +- total_pkts_tx); ++ rte_tel_data_add_dict_uint(data, "packets transmitted", total_pkts_tx); + +- rte_tel_data_add_dict_u64(data, "packets dropped", +- total_pkts_dropped); ++ rte_tel_data_add_dict_uint(data, "packets dropped", ++ total_pkts_dropped); + + + return 0; +@@ -3053,30 +3051,30 @@ handle_telemetry_cmd_ipsec_secgw_stats_outbound(const char *cmd __rte_unused, + + /* add spd 4 telemetry key/values pairs */ + +- rte_tel_data_add_dict_u64(spd4_data, "protect", +- total_stats.outbound.spd4.protect); +- rte_tel_data_add_dict_u64(spd4_data, "bypass", +- total_stats.outbound.spd4.bypass); +- rte_tel_data_add_dict_u64(spd4_data, "discard", +- total_stats.outbound.spd4.discard); ++ rte_tel_data_add_dict_uint(spd4_data, "protect", ++ total_stats.outbound.spd4.protect); ++ rte_tel_data_add_dict_uint(spd4_data, "bypass", ++ total_stats.outbound.spd4.bypass); ++ rte_tel_data_add_dict_uint(spd4_data, "discard", ++ total_stats.outbound.spd4.discard); + + rte_tel_data_add_dict_container(data, "spd4", spd4_data, 0); + + /* add spd 6 telemetry key/values pairs */ + +- rte_tel_data_add_dict_u64(spd6_data, "protect", +- total_stats.outbound.spd6.protect); +- rte_tel_data_add_dict_u64(spd6_data, "bypass", +- total_stats.outbound.spd6.bypass); +- rte_tel_data_add_dict_u64(spd6_data, "discard", +- total_stats.outbound.spd6.discard); ++ rte_tel_data_add_dict_uint(spd6_data, "protect", ++ total_stats.outbound.spd6.protect); ++ rte_tel_data_add_dict_uint(spd6_data, "bypass", ++ total_stats.outbound.spd6.bypass); ++ rte_tel_data_add_dict_uint(spd6_data, "discard", ++ total_stats.outbound.spd6.discard); + + rte_tel_data_add_dict_container(data, "spd6", spd6_data, 0); + + /* add sad telemetry key/values pairs */ + +- rte_tel_data_add_dict_u64(sad_data, "miss", +- total_stats.outbound.sad.miss); ++ rte_tel_data_add_dict_uint(sad_data, "miss", ++ total_stats.outbound.sad.miss); + + rte_tel_data_add_dict_container(data, "sad", sad_data, 0); + +@@ -3127,30 +3125,30 @@ handle_telemetry_cmd_ipsec_secgw_stats_inbound(const char *cmd __rte_unused, + + /* add sad telemetry key/values pairs */ + +- rte_tel_data_add_dict_u64(sad_data, "miss", +- total_stats.inbound.sad.miss); ++ rte_tel_data_add_dict_uint(sad_data, "miss", ++ total_stats.inbound.sad.miss); + + rte_tel_data_add_dict_container(data, "sad", sad_data, 0); + + /* add spd 4 telemetry key/values pairs */ + +- rte_tel_data_add_dict_u64(spd4_data, "protect", +- total_stats.inbound.spd4.protect); +- rte_tel_data_add_dict_u64(spd4_data, "bypass", +- total_stats.inbound.spd4.bypass); +- rte_tel_data_add_dict_u64(spd4_data, "discard", +- total_stats.inbound.spd4.discard); ++ rte_tel_data_add_dict_uint(spd4_data, "protect", ++ total_stats.inbound.spd4.protect); ++ rte_tel_data_add_dict_uint(spd4_data, "bypass", ++ total_stats.inbound.spd4.bypass); ++ rte_tel_data_add_dict_uint(spd4_data, "discard", ++ total_stats.inbound.spd4.discard); + + rte_tel_data_add_dict_container(data, "spd4", spd4_data, 0); + + /* add spd 6 telemetry key/values pairs */ + +- rte_tel_data_add_dict_u64(spd6_data, "protect", +- total_stats.inbound.spd6.protect); +- rte_tel_data_add_dict_u64(spd6_data, "bypass", +- total_stats.inbound.spd6.bypass); +- rte_tel_data_add_dict_u64(spd6_data, "discard", +- total_stats.inbound.spd6.discard); ++ rte_tel_data_add_dict_uint(spd6_data, "protect", ++ total_stats.inbound.spd6.protect); ++ rte_tel_data_add_dict_uint(spd6_data, "bypass", ++ total_stats.inbound.spd6.bypass); ++ rte_tel_data_add_dict_uint(spd6_data, "discard", ++ total_stats.inbound.spd6.discard); + + rte_tel_data_add_dict_container(data, "spd6", spd6_data, 0); + +@@ -3197,14 +3195,12 @@ handle_telemetry_cmd_ipsec_secgw_stats_routing(const char *cmd __rte_unused, + update_statistics(&total_stats, coreid); + + /* add lpm 4 telemetry key/values pairs */ +- rte_tel_data_add_dict_u64(lpm4_data, "miss", +- total_stats.lpm4.miss); ++ rte_tel_data_add_dict_uint(lpm4_data, "miss", total_stats.lpm4.miss); + + rte_tel_data_add_dict_container(data, "IPv4 LPM", lpm4_data, 0); + + /* add lpm 6 telemetry key/values pairs */ +- rte_tel_data_add_dict_u64(lpm6_data, "miss", +- total_stats.lpm6.miss); ++ rte_tel_data_add_dict_uint(lpm6_data, "miss", total_stats.lpm6.miss); + + rte_tel_data_add_dict_container(data, "IPv6 LPM", lpm6_data, 0); + +diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c +index a2eb35d..15b6b4b 100644 +--- a/examples/l3fwd-power/main.c ++++ b/examples/l3fwd-power/main.c +@@ -2373,8 +2373,8 @@ handle_app_stats(const char *cmd __rte_unused, + rte_tel_data_start_dict(d); + get_current_stat_values(values); + for (i = 0; i < NUM_TELSTATS; i++) +- rte_tel_data_add_dict_u64(d, telstats_strings[i].name, +- values[i]); ++ rte_tel_data_add_dict_uint(d, telstats_strings[i].name, ++ values[i]); + return 0; + } + +diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c +index ae20d19..ef55747 100644 +--- a/lib/cryptodev/rte_cryptodev.c ++++ b/lib/cryptodev/rte_cryptodev.c +@@ -2472,13 +2472,13 @@ cryptodev_handle_dev_info(const char *cmd __rte_unused, + rte_tel_data_start_dict(d); + rte_tel_data_add_dict_string(d, "device_name", + cryptodev_info.device->name); +- rte_tel_data_add_dict_u64(d, "max_nb_queue_pairs", ++ rte_tel_data_add_dict_uint(d, "max_nb_queue_pairs", + cryptodev_info.max_nb_queue_pairs); + + return 0; + } + +-#define ADD_DICT_STAT(s) rte_tel_data_add_dict_u64(d, #s, cryptodev_stats.s) ++#define ADD_DICT_STAT(s) rte_tel_data_add_dict_uint(d, #s, cryptodev_stats.s) + + static int + cryptodev_handle_dev_stats(const char *cmd __rte_unused, +@@ -2531,7 +2531,7 @@ crypto_caps_array(struct rte_tel_data *d, + memset(&caps_val, 0, CRYPTO_CAPS_SZ * sizeof(caps_val[0])); + rte_memcpy(caps_val, dev_caps, sizeof(capabilities[0])); + for (j = 0; j < CRYPTO_CAPS_SZ; j++) +- rte_tel_data_add_array_u64(d, caps_val[j]); ++ rte_tel_data_add_array_uint(d, caps_val[j]); + } + + return i; +diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c +index ea1cb81..aa7ca48 100644 +--- a/lib/dmadev/rte_dmadev.c ++++ b/lib/dmadev/rte_dmadev.c +@@ -935,7 +935,7 @@ dmadev_handle_dev_info(const char *cmd __rte_unused, + return 0; + } + +-#define ADD_DICT_STAT(s) rte_tel_data_add_dict_u64(d, #s, dma_stats.s) ++#define ADD_DICT_STAT(s) rte_tel_data_add_dict_uint(d, #s, dma_stats.s) + + static int + dmadev_handle_dev_stats(const char *cmd __rte_unused, +diff --git a/lib/eal/common/eal_common_memory.c b/lib/eal/common/eal_common_memory.c +index f2f8858..6292808 100644 +--- a/lib/eal/common/eal_common_memory.c ++++ b/lib/eal/common/eal_common_memory.c +@@ -1191,17 +1191,18 @@ handle_eal_heap_info_request(const char *cmd __rte_unused, const char *params, + malloc_heap_get_stats(heap, &sock_stats); + + rte_tel_data_start_dict(d); +- rte_tel_data_add_dict_u64(d, "Head id", heap_id); ++ rte_tel_data_add_dict_uint(d, "Head id", heap_id); + rte_tel_data_add_dict_string(d, "Name", heap->name); +- rte_tel_data_add_dict_u64(d, "Heap_size", +- sock_stats.heap_totalsz_bytes); +- rte_tel_data_add_dict_u64(d, "Free_size", sock_stats.heap_freesz_bytes); +- rte_tel_data_add_dict_u64(d, "Alloc_size", +- sock_stats.heap_allocsz_bytes); +- rte_tel_data_add_dict_u64(d, "Greatest_free_size", +- sock_stats.greatest_free_size); +- rte_tel_data_add_dict_u64(d, "Alloc_count", sock_stats.alloc_count); +- rte_tel_data_add_dict_u64(d, "Free_count", sock_stats.free_count); ++ rte_tel_data_add_dict_uint(d, "Heap_size", ++ sock_stats.heap_totalsz_bytes); ++ rte_tel_data_add_dict_uint(d, "Free_size", ++ sock_stats.heap_freesz_bytes); ++ rte_tel_data_add_dict_uint(d, "Alloc_size", ++ sock_stats.heap_allocsz_bytes); ++ rte_tel_data_add_dict_uint(d, "Greatest_free_size", ++ sock_stats.greatest_free_size); ++ rte_tel_data_add_dict_uint(d, "Alloc_count", sock_stats.alloc_count); ++ rte_tel_data_add_dict_uint(d, "Free_count", sock_stats.free_count); + + return 0; + } +@@ -1253,13 +1254,13 @@ handle_eal_memzone_info_request(const char *cmd __rte_unused, + mz = rte_fbarray_get(&mcfg->memzones, mz_idx); + + rte_tel_data_start_dict(d); +- rte_tel_data_add_dict_u64(d, "Zone", mz_idx); ++ rte_tel_data_add_dict_uint(d, "Zone", mz_idx); + rte_tel_data_add_dict_string(d, "Name", mz->name); +- rte_tel_data_add_dict_u64(d, "Length", mz->len); ++ rte_tel_data_add_dict_uint(d, "Length", mz->len); + snprintf(addr, ADDR_STR, "%p", mz->addr); + rte_tel_data_add_dict_string(d, "Address", addr); + rte_tel_data_add_dict_int(d, "Socket", mz->socket_id); +- rte_tel_data_add_dict_u64(d, "Flags", mz->flags); ++ rte_tel_data_add_dict_uint(d, "Flags", mz->flags); + + /* go through each page occupied by this memzone */ + msl = rte_mem_virt2memseg_list(mz->addr); +@@ -1274,7 +1275,7 @@ handle_eal_memzone_info_request(const char *cmd __rte_unused, + ms_idx = RTE_PTR_DIFF(mz->addr, msl->base_va) / page_sz; + ms = rte_fbarray_get(&msl->memseg_arr, ms_idx); + +- rte_tel_data_add_dict_u64(d, "Hugepage_size", page_sz); ++ rte_tel_data_add_dict_uint(d, "Hugepage_size", page_sz); + snprintf(addr, ADDR_STR, "%p", ms->addr); + rte_tel_data_add_dict_string(d, "Hugepage_base", addr); + +diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c +index 8a35521..c0f2232 100644 +--- a/lib/ethdev/rte_ethdev.c ++++ b/lib/ethdev/rte_ethdev.c +@@ -6213,11 +6213,11 @@ eth_dev_add_port_queue_stats(struct rte_tel_data *d, uint64_t *q_stats, + return; + rte_tel_data_start_array(q_data, RTE_TEL_UINT_VAL); + for (q = 0; q < RTE_ETHDEV_QUEUE_STAT_CNTRS; q++) +- rte_tel_data_add_array_u64(q_data, q_stats[q]); ++ rte_tel_data_add_array_uint(q_data, q_stats[q]); + rte_tel_data_add_dict_container(d, stat_name, q_data, 0); + } + +-#define ADD_DICT_STAT(stats, s) rte_tel_data_add_dict_u64(d, #s, stats.s) ++#define ADD_DICT_STAT(stats, s) rte_tel_data_add_dict_uint(d, #s, stats.s) + + static int + eth_dev_handle_port_stats(const char *cmd __rte_unused, +@@ -6302,8 +6302,8 @@ eth_dev_handle_port_xstats(const char *cmd __rte_unused, + + rte_tel_data_start_dict(d); + for (i = 0; i < num_xstats; i++) +- rte_tel_data_add_dict_u64(d, xstat_names[i].name, +- eth_xstats[i].value); ++ rte_tel_data_add_dict_uint(d, xstat_names[i].name, ++ eth_xstats[i].value); + free(eth_xstats); + return 0; + } +@@ -6380,7 +6380,7 @@ eth_dev_handle_port_link_status(const char *cmd __rte_unused, + return 0; + } + rte_tel_data_add_dict_string(d, status_str, "UP"); +- rte_tel_data_add_dict_u64(d, "speed", link.link_speed); ++ rte_tel_data_add_dict_uint(d, "speed", link.link_speed); + rte_tel_data_add_dict_string(d, "duplex", + (link.link_duplex == RTE_ETH_LINK_FULL_DUPLEX) ? + "full-duplex" : "half-duplex"); +@@ -6432,9 +6432,9 @@ eth_dev_handle_port_info(const char *cmd __rte_unused, + eth_dev->data->nb_tx_queues); + rte_tel_data_add_dict_int(d, "port_id", eth_dev->data->port_id); + rte_tel_data_add_dict_int(d, "mtu", eth_dev->data->mtu); +- rte_tel_data_add_dict_u64(d, "rx_mbuf_size_min", ++ rte_tel_data_add_dict_uint(d, "rx_mbuf_size_min", + eth_dev->data->min_rx_buf_size); +- rte_tel_data_add_dict_u64(d, "rx_mbuf_alloc_fail", ++ rte_tel_data_add_dict_uint(d, "rx_mbuf_alloc_fail", + eth_dev->data->rx_mbuf_alloc_failed); + rte_ether_format_addr(mac_addr, sizeof(mac_addr), + eth_dev->data->mac_addrs); +diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c +index 6f160b0..5ee5703 100644 +--- a/lib/eventdev/rte_event_eth_rx_adapter.c ++++ b/lib/eventdev/rte_event_eth_rx_adapter.c +@@ -3228,7 +3228,7 @@ rte_event_eth_rx_adapter_queue_conf_get(uint8_t id, + return 0; + } + +-#define RXA_ADD_DICT(stats, s) rte_tel_data_add_dict_u64(d, #s, stats.s) ++#define RXA_ADD_DICT(stats, s) rte_tel_data_add_dict_uint(d, #s, stats.s) + + static int + handle_rxa_stats(const char *cmd __rte_unused, +@@ -3253,7 +3253,7 @@ handle_rxa_stats(const char *cmd __rte_unused, + } + + rte_tel_data_start_dict(d); +- rte_tel_data_add_dict_u64(d, "rx_adapter_id", rx_adapter_id); ++ rte_tel_data_add_dict_uint(d, "rx_adapter_id", rx_adapter_id); + RXA_ADD_DICT(rx_adptr_stats, rx_packets); + RXA_ADD_DICT(rx_adptr_stats, rx_poll_count); + RXA_ADD_DICT(rx_adptr_stats, rx_dropped); +@@ -3343,9 +3343,9 @@ handle_rxa_get_queue_conf(const char *cmd __rte_unused, + } + + rte_tel_data_start_dict(d); +- rte_tel_data_add_dict_u64(d, "rx_adapter_id", rx_adapter_id); +- rte_tel_data_add_dict_u64(d, "eth_dev_id", eth_dev_id); +- rte_tel_data_add_dict_u64(d, "rx_queue_id", rx_queue_id); ++ rte_tel_data_add_dict_uint(d, "rx_adapter_id", rx_adapter_id); ++ rte_tel_data_add_dict_uint(d, "eth_dev_id", eth_dev_id); ++ rte_tel_data_add_dict_uint(d, "rx_queue_id", rx_queue_id); + RXA_ADD_DICT(queue_conf, rx_queue_flags); + RXA_ADD_DICT(queue_conf, servicing_weight); + RXA_ADD_DICT(queue_conf.ev, queue_id); +@@ -3407,9 +3407,9 @@ handle_rxa_get_queue_stats(const char *cmd __rte_unused, + } + + rte_tel_data_start_dict(d); +- rte_tel_data_add_dict_u64(d, "rx_adapter_id", rx_adapter_id); +- rte_tel_data_add_dict_u64(d, "eth_dev_id", eth_dev_id); +- rte_tel_data_add_dict_u64(d, "rx_queue_id", rx_queue_id); ++ rte_tel_data_add_dict_uint(d, "rx_adapter_id", rx_adapter_id); ++ rte_tel_data_add_dict_uint(d, "eth_dev_id", eth_dev_id); ++ rte_tel_data_add_dict_uint(d, "rx_queue_id", rx_queue_id); + RXA_ADD_DICT(q_stats, rx_event_buf_count); + RXA_ADD_DICT(q_stats, rx_event_buf_size); + RXA_ADD_DICT(q_stats, rx_poll_count); +diff --git a/lib/eventdev/rte_event_timer_adapter.c b/lib/eventdev/rte_event_timer_adapter.c +index 771f7bb..51dafc8 100644 +--- a/lib/eventdev/rte_event_timer_adapter.c ++++ b/lib/eventdev/rte_event_timer_adapter.c +@@ -1284,15 +1284,20 @@ handle_ta_info(const char *cmd __rte_unused, const char *params, + } + + rte_tel_data_start_dict(d); +- rte_tel_data_add_dict_u64(d, "timer_adapter_id", adapter_id); +- rte_tel_data_add_dict_u64(d, "min_resolution_ns", adapter_info.min_resolution_ns); +- rte_tel_data_add_dict_u64(d, "max_tmo_ns", adapter_info.max_tmo_ns); +- rte_tel_data_add_dict_u64(d, "event_dev_id", adapter_info.conf.event_dev_id); +- rte_tel_data_add_dict_u64(d, "socket_id", adapter_info.conf.socket_id); +- rte_tel_data_add_dict_u64(d, "clk_src", adapter_info.conf.clk_src); +- rte_tel_data_add_dict_u64(d, "timer_tick_ns", adapter_info.conf.timer_tick_ns); +- rte_tel_data_add_dict_u64(d, "nb_timers", adapter_info.conf.nb_timers); +- rte_tel_data_add_dict_u64(d, "flags", adapter_info.conf.flags); ++ rte_tel_data_add_dict_uint(d, "timer_adapter_id", adapter_id); ++ rte_tel_data_add_dict_uint(d, "min_resolution_ns", ++ adapter_info.min_resolution_ns); ++ rte_tel_data_add_dict_uint(d, "max_tmo_ns", adapter_info.max_tmo_ns); ++ rte_tel_data_add_dict_uint(d, "event_dev_id", ++ adapter_info.conf.event_dev_id); ++ rte_tel_data_add_dict_uint(d, "socket_id", ++ adapter_info.conf.socket_id); ++ rte_tel_data_add_dict_uint(d, "clk_src", adapter_info.conf.clk_src); ++ rte_tel_data_add_dict_uint(d, "timer_tick_ns", ++ adapter_info.conf.timer_tick_ns); ++ rte_tel_data_add_dict_uint(d, "nb_timers", ++ adapter_info.conf.nb_timers); ++ rte_tel_data_add_dict_uint(d, "flags", adapter_info.conf.flags); + + return 0; + } +@@ -1325,12 +1330,15 @@ handle_ta_stats(const char *cmd __rte_unused, const char *params, + } + + rte_tel_data_start_dict(d); +- rte_tel_data_add_dict_u64(d, "timer_adapter_id", adapter_id); +- rte_tel_data_add_dict_u64(d, "evtim_exp_count", stats.evtim_exp_count); +- rte_tel_data_add_dict_u64(d, "ev_enq_count", stats.ev_enq_count); +- rte_tel_data_add_dict_u64(d, "ev_inv_count", stats.ev_inv_count); +- rte_tel_data_add_dict_u64(d, "evtim_retry_count", stats.evtim_retry_count); +- rte_tel_data_add_dict_u64(d, "adapter_tick_count", stats.adapter_tick_count); ++ rte_tel_data_add_dict_uint(d, "timer_adapter_id", adapter_id); ++ rte_tel_data_add_dict_uint(d, "evtim_exp_count", ++ stats.evtim_exp_count); ++ rte_tel_data_add_dict_uint(d, "ev_enq_count", stats.ev_enq_count); ++ rte_tel_data_add_dict_uint(d, "ev_inv_count", stats.ev_inv_count); ++ rte_tel_data_add_dict_uint(d, "evtim_retry_count", ++ stats.evtim_retry_count); ++ rte_tel_data_add_dict_uint(d, "adapter_tick_count", ++ stats.adapter_tick_count); + + return 0; + } +diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c +index 79b9ea3..b019346 100644 +--- a/lib/eventdev/rte_eventdev.c ++++ b/lib/eventdev/rte_eventdev.c +@@ -1574,7 +1574,7 @@ handle_queue_links(const char *cmd __rte_unused, + char qid_name[32]; + + snprintf(qid_name, 31, "qid_%u", queues[i]); +- rte_tel_data_add_dict_u64(d, qid_name, priorities[i]); ++ rte_tel_data_add_dict_uint(d, qid_name, priorities[i]); + } + + return 0; +@@ -1640,8 +1640,7 @@ eventdev_build_telemetry_data(int dev_id, + + rte_tel_data_start_dict(d); + for (i = 0; i < num_xstats; i++) +- rte_tel_data_add_dict_u64(d, xstat_names[i].name, +- values[i]); ++ rte_tel_data_add_dict_uint(d, xstat_names[i].name, values[i]); + + free(xstat_names); + free(ids); +diff --git a/lib/ipsec/ipsec_telemetry.c b/lib/ipsec/ipsec_telemetry.c +index 1147de6..ee7f64d 100644 +--- a/lib/ipsec/ipsec_telemetry.c ++++ b/lib/ipsec/ipsec_telemetry.c +@@ -25,7 +25,7 @@ handle_telemetry_cmd_ipsec_sa_list(const char *cmd __rte_unused, + + LIST_FOREACH(entry, &ipsec_telemetry_list, next) { + const struct rte_ipsec_sa *sa = entry->sa; +- rte_tel_data_add_array_u64(data, rte_be_to_cpu_32(sa->spi)); ++ rte_tel_data_add_array_uint(data, rte_be_to_cpu_32(sa->spi)); + } + + return 0; +@@ -79,15 +79,15 @@ handle_telemetry_cmd_ipsec_sa_stats(const char *cmd __rte_unused, + rte_tel_data_start_dict(sa_data); + + /* add telemetry key/values pairs */ +- rte_tel_data_add_dict_u64(sa_data, name_pkt_cnt, +- sa->statistics.count); ++ rte_tel_data_add_dict_uint(sa_data, name_pkt_cnt, ++ sa->statistics.count); + +- rte_tel_data_add_dict_u64(sa_data, name_byte_cnt, +- sa->statistics.bytes - +- (sa->statistics.count * sa->hdr_len)); ++ rte_tel_data_add_dict_uint(sa_data, name_byte_cnt, ++ sa->statistics.bytes - ++ (sa->statistics.count * sa->hdr_len)); + +- rte_tel_data_add_dict_u64(sa_data, name_error_cnt, +- sa->statistics.errors.count); ++ rte_tel_data_add_dict_uint(sa_data, name_error_cnt, ++ sa->statistics.errors.count); + + /* generate telemetry label */ + snprintf(sa_name, sizeof(sa_name), "SA_SPI_%i", +@@ -176,15 +176,16 @@ handle_telemetry_cmd_ipsec_sa_details(const char *cmd __rte_unused, + RTE_IPSEC_SATP_DIR_IB) + + if (sa->sqn.inb.rsn[sa->sqn.inb.rdidx]) +- rte_tel_data_add_dict_u64(data, +- "sequence-number", +- sa->sqn.inb.rsn[sa->sqn.inb.rdidx]->sqn); ++ rte_tel_data_add_dict_uint(data, ++ "sequence-number", ++ sa->sqn.inb.rsn[sa->sqn.inb.rdidx]->sqn); + else +- rte_tel_data_add_dict_u64(data, +- "sequence-number", 0); ++ rte_tel_data_add_dict_uint(data, ++ "sequence-number", ++ 0); + else +- rte_tel_data_add_dict_u64(data, "sequence-number", +- sa->sqn.outb); ++ rte_tel_data_add_dict_uint(data, "sequence-number", ++ sa->sqn.outb); + + rte_tel_data_add_dict_string(data, + "explicit-congestion-notification", +diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c +index 871f4d1..d137854 100644 +--- a/lib/mempool/rte_mempool.c ++++ b/lib/mempool/rte_mempool.c +@@ -1517,27 +1517,27 @@ mempool_info_cb(struct rte_mempool *mp, void *arg) + return; + + rte_tel_data_add_dict_string(info->d, "name", mp->name); +- rte_tel_data_add_dict_u64(info->d, "pool_id", mp->pool_id); +- rte_tel_data_add_dict_u64(info->d, "flags", mp->flags); ++ rte_tel_data_add_dict_uint(info->d, "pool_id", mp->pool_id); ++ rte_tel_data_add_dict_uint(info->d, "flags", mp->flags); + rte_tel_data_add_dict_int(info->d, "socket_id", mp->socket_id); +- rte_tel_data_add_dict_u64(info->d, "size", mp->size); +- rte_tel_data_add_dict_u64(info->d, "cache_size", mp->cache_size); +- rte_tel_data_add_dict_u64(info->d, "elt_size", mp->elt_size); +- rte_tel_data_add_dict_u64(info->d, "header_size", mp->header_size); +- rte_tel_data_add_dict_u64(info->d, "trailer_size", mp->trailer_size); +- rte_tel_data_add_dict_u64(info->d, "private_data_size", ++ rte_tel_data_add_dict_uint(info->d, "size", mp->size); ++ rte_tel_data_add_dict_uint(info->d, "cache_size", mp->cache_size); ++ rte_tel_data_add_dict_uint(info->d, "elt_size", mp->elt_size); ++ rte_tel_data_add_dict_uint(info->d, "header_size", mp->header_size); ++ rte_tel_data_add_dict_uint(info->d, "trailer_size", mp->trailer_size); ++ rte_tel_data_add_dict_uint(info->d, "private_data_size", + mp->private_data_size); + rte_tel_data_add_dict_int(info->d, "ops_index", mp->ops_index); +- rte_tel_data_add_dict_u64(info->d, "populated_size", ++ rte_tel_data_add_dict_uint(info->d, "populated_size", + mp->populated_size); + + mz = mp->mz; + rte_tel_data_add_dict_string(info->d, "mz_name", mz->name); +- rte_tel_data_add_dict_u64(info->d, "mz_len", mz->len); +- rte_tel_data_add_dict_u64(info->d, "mz_hugepage_sz", ++ rte_tel_data_add_dict_uint(info->d, "mz_len", mz->len); ++ rte_tel_data_add_dict_uint(info->d, "mz_hugepage_sz", + mz->hugepage_sz); + rte_tel_data_add_dict_int(info->d, "mz_socket_id", mz->socket_id); +- rte_tel_data_add_dict_u64(info->d, "mz_flags", mz->flags); ++ rte_tel_data_add_dict_uint(info->d, "mz_flags", mz->flags); + } + + static int +diff --git a/lib/rawdev/rte_rawdev.c b/lib/rawdev/rte_rawdev.c +index a6134e7..443b132 100644 +--- a/lib/rawdev/rte_rawdev.c ++++ b/lib/rawdev/rte_rawdev.c +@@ -620,8 +620,8 @@ handle_dev_xstats(const char *cmd __rte_unused, + + rte_tel_data_start_dict(d); + for (i = 0; i < num_xstats; i++) +- rte_tel_data_add_dict_u64(d, xstat_names[i].name, +- rawdev_xstats[i]); ++ rte_tel_data_add_dict_uint(d, xstat_names[i].name, ++ rawdev_xstats[i]); + + free(rawdev_xstats); + return 0; +diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c +index fda8c47..bc5a52e 100644 +--- a/lib/security/rte_security.c ++++ b/lib/security/rte_security.c +@@ -244,7 +244,7 @@ crypto_caps_array(struct rte_tel_data *d, + memset(&caps_val, 0, CRYPTO_CAPS_SZ * sizeof(caps_val[0])); + rte_memcpy(caps_val, dev_caps, sizeof(capabilities[0])); + for (j = 0; j < CRYPTO_CAPS_SZ; j++) +- rte_tel_data_add_array_u64(d, caps_val[j]); ++ rte_tel_data_add_array_uint(d, caps_val[j]); + } + + return (i - 1); +@@ -269,7 +269,7 @@ sec_caps_array(struct rte_tel_data *d, + memset(&caps_val, 0, SEC_CAPS_SZ * sizeof(caps_val[0])); + rte_memcpy(caps_val, dev_caps, sizeof(capabilities[0])); + for (j = 0; j < SEC_CAPS_SZ; j++) +- rte_tel_data_add_array_u64(d, caps_val[j]); ++ rte_tel_data_add_array_uint(d, caps_val[j]); + } + + return i - 1; +-- +2.23.0 + diff --git a/0362-telemetry-mark-u64-functions-as-deprecated.patch b/0362-telemetry-mark-u64-functions-as-deprecated.patch new file mode 100644 index 0000000..98e7426 --- /dev/null +++ b/0362-telemetry-mark-u64-functions-as-deprecated.patch @@ -0,0 +1,114 @@ +From e2015dc88edc684c588b23c6b263aab7879b3d28 Mon Sep 17 00:00:00 2001 +From: Bruce Richardson +Date: Thu, 12 Jan 2023 17:41:13 +0000 +Subject: telemetry: mark u64 functions as deprecated + +[ upstream commit b2fafe2d3f4229abd05eb9e517565c0cc5da443e ] + +Add a deprecation notice for the renaming of the telemetry data u64/uint +functions, and point users to the newer versions of them when building. +To do this, we also need to mark the renamed versions as stable, rather +than experimental. + +Signed-off-by: Bruce Richardson +Acked-by: Ciara Power +--- + doc/guides/rel_notes/deprecation.rst | 5 +++++ + lib/telemetry/rte_telemetry.h | 9 +++++---- + lib/telemetry/version.map | 4 ++-- + 3 files changed, 12 insertions(+), 6 deletions(-) + +diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst +index 5581822..67dadda 100644 +--- a/doc/guides/rel_notes/deprecation.rst ++++ b/doc/guides/rel_notes/deprecation.rst +@@ -14,6 +14,11 @@ Deprecation Notices + * kvargs: The function ``rte_kvargs_process`` will get a new parameter + for returning key match count. It will ease handling of no-match case. + ++* telemetry: The functions ``rte_tel_data_add_array_u64`` and ``rte_tel_data_add_dict_u64``, ++ used by telemetry callbacks for adding unsigned integer values to be returned to the user, ++ are renamed to ``rte_tel_data_add_array_uint`` and ``rte_tel_data_add_dict_uint`` respectively. ++ As such, the old function names are deprecated and will be removed in a future release. ++ + * eal: The function ``rte_eal_remote_launch`` will return new error codes + after read or write error on the pipe, instead of calling ``rte_panic``. + +diff --git a/lib/telemetry/rte_telemetry.h b/lib/telemetry/rte_telemetry.h +index 73886fe..f364ac7 100644 +--- a/lib/telemetry/rte_telemetry.h ++++ b/lib/telemetry/rte_telemetry.h +@@ -11,6 +11,7 @@ extern "C" { + + #include + #include ++#include + + /** Maximum length for string used in object. */ + #define RTE_TEL_MAX_STRING_LEN 128 +@@ -132,7 +133,6 @@ rte_tel_data_add_array_int(struct rte_tel_data *d, int x); + * @return + * 0 on success, negative errno on error + */ +-__rte_experimental + int + rte_tel_data_add_array_uint(struct rte_tel_data *d, uint64_t x); + +@@ -149,7 +149,8 @@ rte_tel_data_add_array_uint(struct rte_tel_data *d, uint64_t x); + * 0 on success, negative errno on error + */ + int +-rte_tel_data_add_array_u64(struct rte_tel_data *d, uint64_t x); ++rte_tel_data_add_array_u64(struct rte_tel_data *d, uint64_t x) ++ __rte_deprecated_msg("use 'rte_tel_data_add_array_uint' instead"); + + /** + * Add a container to an array. A container is an existing telemetry data +@@ -244,7 +245,6 @@ rte_tel_data_add_dict_int(struct rte_tel_data *d, const char *name, int val); + * @return + * 0 on success, negative errno on error, E2BIG on string truncation of name. + */ +-__rte_experimental + int + rte_tel_data_add_dict_uint(struct rte_tel_data *d, + const char *name, uint64_t val); +@@ -265,7 +265,8 @@ rte_tel_data_add_dict_uint(struct rte_tel_data *d, + */ + int + rte_tel_data_add_dict_u64(struct rte_tel_data *d, +- const char *name, uint64_t val); ++ const char *name, uint64_t val) ++ __rte_deprecated_msg("use 'rte_tel_data_add_dict_uint' instead"); + + /** + * Add a container to a dictionary. A container is an existing telemetry data +diff --git a/lib/telemetry/version.map b/lib/telemetry/version.map +index 3c228d9..86ba714 100644 +--- a/lib/telemetry/version.map ++++ b/lib/telemetry/version.map +@@ -5,10 +5,12 @@ DPDK_22 { + rte_tel_data_add_array_int; + rte_tel_data_add_array_string; + rte_tel_data_add_array_u64; ++ rte_tel_data_add_array_uint; + rte_tel_data_add_dict_container; + rte_tel_data_add_dict_int; + rte_tel_data_add_dict_string; + rte_tel_data_add_dict_u64; ++ rte_tel_data_add_dict_uint; + rte_tel_data_alloc; + rte_tel_data_free; + rte_tel_data_start_array; +@@ -23,9 +25,7 @@ EXPERIMENTAL { + global: + + # added in 23.03 +- rte_tel_data_add_array_uint; + rte_tel_data_add_array_uint_hex; +- rte_tel_data_add_dict_uint; + rte_tel_data_add_dict_uint_hex; + + local: *; +-- +2.23.0 + diff --git a/0363-telemetry-update-JSON-functions-for-int-uint-types.patch b/0363-telemetry-update-JSON-functions-for-int-uint-types.patch new file mode 100644 index 0000000..d5875fd --- /dev/null +++ b/0363-telemetry-update-JSON-functions-for-int-uint-types.patch @@ -0,0 +1,155 @@ +From 2bc12391f90112b2c2f923f6b47c04a5f688cf24 Mon Sep 17 00:00:00 2001 +From: Bruce Richardson +Date: Thu, 12 Jan 2023 17:41:14 +0000 +Subject: telemetry: update JSON functions for int/uint types + +[ upstream commit 2f4520cda1a53e65401b2170877621a2c519062f ] + +Since we are standardizing on using uint in place of u64, and expanding +the int values to 64-bit, we can update the internal json functions to +use the new names and expanded signed type. + +Suggested-by: Morten Brørup +Signed-off-by: Bruce Richardson +Acked-by: Morten Brørup +Acked-by: Tyler Retzlaff +Acked-by: Ciara Power +--- + app/test/test_telemetry_json.c | 9 ++++----- + lib/telemetry/telemetry.c | 8 ++++---- + lib/telemetry/telemetry_json.h | 16 ++++++++-------- + 3 files changed, 16 insertions(+), 17 deletions(-) + +diff --git a/app/test/test_telemetry_json.c b/app/test/test_telemetry_json.c +index 790181d..cd4048e 100644 +--- a/app/test/test_telemetry_json.c ++++ b/app/test/test_telemetry_json.c +@@ -37,9 +37,9 @@ test_basic_obj(void) + char buf[1024]; + int used = 0; + +- used = rte_tel_json_add_obj_u64(buf, sizeof(buf), used, ++ used = rte_tel_json_add_obj_uint(buf, sizeof(buf), used, + "weddings", 4); +- used = rte_tel_json_add_obj_u64(buf, sizeof(buf), used, ++ used = rte_tel_json_add_obj_uint(buf, sizeof(buf), used, + "funerals", 1); + + printf("%s: buf = '%s', expected = '%s'\n", __func__, buf, expected); +@@ -80,8 +80,7 @@ test_overflow_obj(void) + int i, used = 0; + + for (i = 0; i < (int)RTE_DIM(names); i++) +- used = rte_tel_json_add_obj_u64(buf, sizeof(buf), used, +- names[i], vals[i]); ++ used = rte_tel_json_add_obj_uint(buf, sizeof(buf), used, names[i], vals[i]); + + printf("%s: buf = '%s', expected = '%s'\n", __func__, buf, expected); + if (buf[used - 1] != '}') +@@ -115,7 +114,7 @@ test_large_obj_element(void) + char buf[sizeof(str) - 5] = "XYZ"; + int used = 0; + +- used = rte_tel_json_add_obj_u64(buf, sizeof(buf), used, str, 0); ++ used = rte_tel_json_add_obj_uint(buf, sizeof(buf), used, str, 0); + printf("%s: buf = '%s', expected = '%s'\n", __func__, buf, expected); + + return strlen(buf) != 0; +diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c +index 7c0213c..11927ef 100644 +--- a/lib/telemetry/telemetry.c ++++ b/lib/telemetry/telemetry.c +@@ -173,7 +173,7 @@ container_to_json(const struct rte_tel_data *d, char *out_buf, size_t buf_len) + used = rte_tel_json_empty_array(out_buf, buf_len, 0); + if (d->type == TEL_ARRAY_UINT) + for (i = 0; i < d->data_len; i++) +- used = rte_tel_json_add_array_u64(out_buf, ++ used = rte_tel_json_add_array_uint(out_buf, + buf_len, used, + d->data.array[i].uval); + if (d->type == TEL_ARRAY_INT) +@@ -201,7 +201,7 @@ container_to_json(const struct rte_tel_data *d, char *out_buf, size_t buf_len) + v->name, v->value.ival); + break; + case RTE_TEL_UINT_VAL: +- used = rte_tel_json_add_obj_u64(out_buf, ++ used = rte_tel_json_add_obj_uint(out_buf, + buf_len, used, + v->name, v->value.uval); + break; +@@ -268,7 +268,7 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s) + v->name, v->value.ival); + break; + case RTE_TEL_UINT_VAL: +- used = rte_tel_json_add_obj_u64(cb_data_buf, ++ used = rte_tel_json_add_obj_uint(cb_data_buf, + buf_len, used, + v->name, v->value.uval); + break; +@@ -306,7 +306,7 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s) + buf_len, used, + d->data.array[i].ival); + else if (d->type == TEL_ARRAY_UINT) +- used = rte_tel_json_add_array_u64(cb_data_buf, ++ used = rte_tel_json_add_array_uint(cb_data_buf, + buf_len, used, + d->data.array[i].uval); + else if (d->type == TEL_ARRAY_CONTAINER) { +diff --git a/lib/telemetry/telemetry_json.h b/lib/telemetry/telemetry_json.h +index e3fae7c..744bbfe 100644 +--- a/lib/telemetry/telemetry_json.h ++++ b/lib/telemetry/telemetry_json.h +@@ -136,19 +136,19 @@ rte_tel_json_add_array_string(char *buf, const int len, const int used, + + /* Appends an integer into the JSON array in the provided buffer. */ + static inline int +-rte_tel_json_add_array_int(char *buf, const int len, const int used, int val) ++rte_tel_json_add_array_int(char *buf, const int len, const int used, int64_t val) + { + int ret, end = used - 1; /* strip off final delimiter */ + if (used <= 2) /* assume empty, since minimum is '[]' */ +- return __json_snprintf(buf, len, "[%d]", val); ++ return __json_snprintf(buf, len, "[%"PRId64"]", val); + +- ret = __json_snprintf(buf + end, len - end, ",%d]", val); ++ ret = __json_snprintf(buf + end, len - end, ",%"PRId64"]", val); + return ret == 0 ? used : end + ret; + } + + /* Appends a uint64_t into the JSON array in the provided buffer. */ + static inline int +-rte_tel_json_add_array_u64(char *buf, const int len, const int used, ++rte_tel_json_add_array_uint(char *buf, const int len, const int used, + uint64_t val) + { + int ret, end = used - 1; /* strip off final delimiter */ +@@ -180,7 +180,7 @@ rte_tel_json_add_array_json(char *buf, const int len, const int used, + * provided buffer. + */ + static inline int +-rte_tel_json_add_obj_u64(char *buf, const int len, const int used, ++rte_tel_json_add_obj_uint(char *buf, const int len, const int used, + const char *name, uint64_t val) + { + int ret, end = used - 1; +@@ -199,14 +199,14 @@ rte_tel_json_add_obj_u64(char *buf, const int len, const int used, + */ + static inline int + rte_tel_json_add_obj_int(char *buf, const int len, const int used, +- const char *name, int val) ++ const char *name, int64_t val) + { + int ret, end = used - 1; + if (used <= 2) /* assume empty, since minimum is '{}' */ +- return __json_snprintf(buf, len, "{\"%s\":%d}", name, ++ return __json_snprintf(buf, len, "{\"%s\":%"PRId64"}", name, + val); + +- ret = __json_snprintf(buf + end, len - end, ",\"%s\":%d}", ++ ret = __json_snprintf(buf + end, len - end, ",\"%s\":%"PRId64"}", + name, val); + return ret == 0 ? used : end + ret; + } +-- +2.23.0 + diff --git a/0364-telemetry-make-internal-int-representation-64-bit.patch b/0364-telemetry-make-internal-int-representation-64-bit.patch new file mode 100644 index 0000000..4c7b669 --- /dev/null +++ b/0364-telemetry-make-internal-int-representation-64-bit.patch @@ -0,0 +1,35 @@ +From 1ad824f7c9efc55442d76b37b361eab9c01f7743 Mon Sep 17 00:00:00 2001 +From: Bruce Richardson +Date: Thu, 12 Jan 2023 17:41:15 +0000 +Subject: telemetry: make internal int representation 64-bit + +[ upstream commit 032a2904414d21489d4d089ff6a4b3b91cbe9b18 ] + +The internal storage for int values can be expanded from 32-bit to +64-bit without affecting the external ABI. + +Suggested-by: Morten Brørup +Signed-off-by: Bruce Richardson +Acked-by: Morten Brørup +Acked-by: Tyler Retzlaff +Acked-by: Ciara Power +--- + lib/telemetry/telemetry_data.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/telemetry/telemetry_data.h b/lib/telemetry/telemetry_data.h +index d5f4125..f6e5ab9 100644 +--- a/lib/telemetry/telemetry_data.h ++++ b/lib/telemetry/telemetry_data.h +@@ -29,7 +29,7 @@ struct container { + */ + union tel_value { + char sval[RTE_TEL_MAX_STRING_LEN]; +- int ival; ++ int64_t ival; + uint64_t uval; + struct container container; + }; +-- +2.23.0 + diff --git a/0365-telemetry-use-64-bit-signed-values-in-API.patch b/0365-telemetry-use-64-bit-signed-values-in-API.patch new file mode 100644 index 0000000..c202481 --- /dev/null +++ b/0365-telemetry-use-64-bit-signed-values-in-API.patch @@ -0,0 +1,71 @@ +From 1f67a8df15a65d80125027a20a91062731399f3a Mon Sep 17 00:00:00 2001 +From: Bruce Richardson +Date: Thu, 12 Jan 2023 17:41:16 +0000 +Subject: telemetry: use 64-bit signed values in API + +[ upstream commit 8e639c7c50cca6c5ca630c2895d0a4f827bd20e2 ] + +While the unsigned values added to telemetry dicts/arrays were up to +64-bits in size, the signed values were only up to 32-bits. We can +standardize the API by having both int and uint functions take 64-bit +values. For ABI compatibility, we use function versioning to ensure +older binaries can still use the older functions taking a 32-bit +parameter. + +Suggested-by: Morten Brørup +Signed-off-by: Bruce Richardson +Acked-by: Morten Brørup +Acked-by: Tyler Retzlaff +Acked-by: Ciara Power +--- + lib/telemetry/rte_telemetry.h | 4 ++-- + lib/telemetry/telemetry_data.c | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/lib/telemetry/rte_telemetry.h b/lib/telemetry/rte_telemetry.h +index f364ac7..11da35f 100644 +--- a/lib/telemetry/rte_telemetry.h ++++ b/lib/telemetry/rte_telemetry.h +@@ -119,7 +119,7 @@ rte_tel_data_add_array_string(struct rte_tel_data *d, const char *str); + * 0 on success, negative errno on error + */ + int +-rte_tel_data_add_array_int(struct rte_tel_data *d, int x); ++rte_tel_data_add_array_int(struct rte_tel_data *d, int64_t x); + + /** + * Add an unsigned value to an array. +@@ -229,7 +229,7 @@ rte_tel_data_add_dict_string(struct rte_tel_data *d, const char *name, + * 0 on success, negative errno on error, E2BIG on string truncation of name. + */ + int +-rte_tel_data_add_dict_int(struct rte_tel_data *d, const char *name, int val); ++rte_tel_data_add_dict_int(struct rte_tel_data *d, const char *name, int64_t val); + + /** + * Add an unsigned value to a dictionary. +diff --git a/lib/telemetry/telemetry_data.c b/lib/telemetry/telemetry_data.c +index b53c165..f8b95a2 100644 +--- a/lib/telemetry/telemetry_data.c ++++ b/lib/telemetry/telemetry_data.c +@@ -59,7 +59,7 @@ rte_tel_data_add_array_string(struct rte_tel_data *d, const char *str) + } + + int +-rte_tel_data_add_array_int(struct rte_tel_data *d, int x) ++rte_tel_data_add_array_int(struct rte_tel_data *d, int64_t x) + { + if (d->type != TEL_ARRAY_INT) + return -EINVAL; +@@ -201,7 +201,7 @@ rte_tel_data_add_dict_string(struct rte_tel_data *d, const char *name, + } + + int +-rte_tel_data_add_dict_int(struct rte_tel_data *d, const char *name, int val) ++rte_tel_data_add_dict_int(struct rte_tel_data *d, const char *name, int64_t val) + { + struct tel_dict_entry *e = &d->data.dict[d->data_len]; + if (d->type != TEL_DICT) +-- +2.23.0 + diff --git a/dpdk.spec b/dpdk.spec index 7ce920b..5837428 100644 --- a/dpdk.spec +++ b/dpdk.spec @@ -1,6 +1,6 @@ Name: dpdk Version: 21.11 -Release: 55 +Release: 56 Packager: packaging@6wind.com URL: http://dpdk.org %global source_version 21.11 @@ -377,6 +377,21 @@ Patch6347: 0347-net-hns3-add-FDIR-VLAN-match-mode-runtime-config.patch Patch6348: 0348-doc-fix-kernel-patch-link-in-hns3-guide.patch Patch6349: 0349-doc-fix-syntax-in-hns3-guide.patch Patch6350: 0350-doc-fix-number-of-leading-spaces-in-hns3-guide.patch +Patch6351: 0351-ethdev-add-telemetry-command-for-module-EEPROM.patch +Patch6352: 0352-ethdev-add-common-code-for-different-SFF-specs.patch +Patch6353: 0353-ethdev-support-SFF-8079-module-telemetry.patch +Patch6354: 0354-ethdev-support-SFF-8472-module-telemetry.patch +Patch6355: 0355-ethdev-support-SFF-8636-module-telemetry.patch +Patch6356: 0356-telemetry-remove-RTE-prefix-from-internal-enums.patch +Patch6357: 0357-telemetry-make-array-initialization-more-robust.patch +Patch6358: 0358-telemetry-rename-unsigned-64-bit-enum-value-to-uint.patch +Patch6359: 0359-telemetry-add-uint-type-as-alias-for-u64.patch +Patch6360: 0360-eventdev-timer-add-telemetry.patch +Patch6361: 0361-rename-telemetry-u64-functions-to-uint-versions.patch +Patch6362: 0362-telemetry-mark-u64-functions-as-deprecated.patch +Patch6363: 0363-telemetry-update-JSON-functions-for-int-uint-types.patch +Patch6364: 0364-telemetry-make-internal-int-representation-64-bit.patch +Patch6365: 0365-telemetry-use-64-bit-signed-values-in-API.patch Summary: Data Plane Development Kit core Group: System Environment/Libraries @@ -522,6 +537,15 @@ strip -g $RPM_BUILD_ROOT/lib/modules/%{kern_devel_ver}/extra/dpdk/igb_uio.ko /usr/sbin/depmod %changelog +* Tue Jul 18 2023 chenjiji - 21.11-56 + Sync some patchs from upstreaming for telemetry and modifications + are as follow: + 1. Use uint in place of u64 for telemetry and functions. + 2. Adds telemetry support to get timer adapter info and timer + adapter statistics. + 3. Add a new telemetry command /ethdev/module_eeprom to dump the + module EEPROM of each port. + * Mon Jul 17 2023 chenjiji - 21.11-55 Sync some patchs from upstreaming about add FDIR VLAN match mode runtime config and fix doc format for hns3 pmd. Patchs -- Gitee