[V4,9/9] ethdev: display capability values in hexadecimal format

Message ID 20221213101512.39919-10-lihuisong@huawei.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series telemetry: fix data truncation and conversion error and add hex integer API |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/github-robot: build success github build: passed
ci/intel-Testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

lihuisong (C) Dec. 13, 2022, 10:15 a.m. UTC
  The 'dev_flags', 'rx_offloads', 'tx_offloads' and 'rss_hf' are better
displayed in hexadecimal format.

Like:
 -->old display by input /ethdev/info,0
      "dev_flags": 3,
      "rx_offloads": 524288,
      "tx_offloads": 65536,
      "ethdev_rss_hf": 9100

 --> now display
     "dev_flags": "0x3",
     "rx_offloads": "0x80000",
     "tx_offloads": "0x10000",
     "ethdev_rss_hf": "0x238c"

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/ethdev/rte_ethdev.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
  

Patch

diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index a40d396677..3e3b7febaa 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -6068,13 +6068,14 @@  eth_dev_handle_port_info(const char *cmd __rte_unused,
 	rte_tel_data_add_dict_container(d, "rxq_state", rxq_state, 0);
 	rte_tel_data_add_dict_container(d, "txq_state", txq_state, 0);
 	rte_tel_data_add_dict_int(d, "numa_node", eth_dev->data->numa_node);
-	rte_tel_data_add_dict_u64(d, "dev_flags", eth_dev->data->dev_flags);
-	rte_tel_data_add_dict_u64(d, "rx_offloads",
-			eth_dev->data->dev_conf.rxmode.offloads);
-	rte_tel_data_add_dict_u64(d, "tx_offloads",
-			eth_dev->data->dev_conf.txmode.offloads);
-	rte_tel_data_add_dict_u64(d, "ethdev_rss_hf",
-			eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf);
+	rte_tel_data_add_dict_uint_hex(d, "dev_flags",
+			eth_dev->data->dev_flags, 0);
+	rte_tel_data_add_dict_uint_hex(d, "rx_offloads",
+			eth_dev->data->dev_conf.rxmode.offloads, 0);
+	rte_tel_data_add_dict_uint_hex(d, "tx_offloads",
+			eth_dev->data->dev_conf.txmode.offloads, 0);
+	rte_tel_data_add_dict_uint_hex(d, "ethdev_rss_hf",
+			eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf, 0);
 
 	return 0;
 }