dpdk-testpmd: call get/set link settings interface
PATCH 1/1 dpdk-testpmd: call get/set link settings interface
Add cmdline options for utilizing get/set link settings API added before in patch this patch depends on. Purpose of this change is to provide mechanism for testing link settings interface API.
---
Depends-on: patch-139082 ("lib: add get/set link settings interface")
--- app/test-pmd/cmdline.c | 9 + app/test-pmd/cmdline_settings.c | 516 ++++++++++++++++++++++++++++++++ app/test-pmd/cmdline_settings.h | 14 + app/test-pmd/meson.build | 1 + app/test-pmd/testpmd.h | 1 + app/test-pmd/util.c | 10 + 6 files changed, 551 insertions(+) create mode 100644 app/test-pmd/cmdline_settings.c create mode 100644 app/test-pmd/cmdline_settings.h
app/test-pmd/cmdline.c +9 -0
@@ -65,6 +65,7 @@#include "cmdline_cman.h" #include "cmdline_mtr.h" #include "cmdline_tm.h" +#include "cmdline_settings.h" #include "bpf_cmd.h" static struct cmdline *testpmd_cl;
@@ -255,6 +256,9 @@ static void cmd_help_long_parsed(void *parsed_result,"show port (port_id) flow_ctrl" " Show flow control info of a port.\n\n" +"show port (port_id) link settings" +" Show link settings of a port.\n\n" +"dump_physmem\n" " Dumps all physical memory segment layouts\n\n"
@@ -661,6 +665,9 @@ static void cmd_help_long_parsed(void *parsed_result,"(max_thresh) (prob_inv)]\n" " Set congestion management configuration\n\n" +"set port (port_id) link settings advertising (bitmap_str)" +" Set link advertising settings of a port.\n\n" + ,list_pkt_forwarding_modes () ); }
@@ -13219,6 +13226,8 @@ static cmdline_parse_ctx_t builtin_ctx[] = { (cmdline_parse_inst_t *)&cmd_link_flow_control_set_macfwd, (cmdline_parse_inst_t *)&cmd_link_flow_control_set_autoneg, (cmdline_parse_inst_t *)&cmd_link_flow_control_show, + (cmdline_parse_inst_t *)&cmd_link_settings_show, + (cmdline_parse_inst_t *)&cmd_link_settings_set_advertising, (cmdline_parse_inst_t *)&cmd_priority_flow_control_set, (cmdline_parse_inst_t *)&cmd_queue_priority_flow_control_set, (cmdline_parse_inst_t *)&cmd_config_dcb,
app/test-pmd/cmdline_settings.c new file +516 -0
516 lines not on this page · raw message
app/test-pmd/cmdline_settings.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (c) 2024 Arista Networks, Inc. All rights reserved. +* Arista Networks, Inc. Confidential and Proprietary +*/ + +#ifndef _CMDLINE_SETTINGS_H +#define _CMDLINE_SETTINGS_H + +/* Link settings CLI */ +extern cmdline_parse_inst_t cmd_link_settings_show; +extern cmdline_parse_inst_t cmd_link_settings_set_advertising; + +#endif /* _CMDLINE_SETTINGS_H */ +
app/test-pmd/meson.build +1 -0
@@ -11,6 +11,7 @@ sources = files( 'cmdline_flow.c', 'cmdline_mtr.c', 'cmdline_tm.c', + 'cmdline_settings.c', 'cmd_flex_item.c', 'config.c', 'csumonly.c',
app/test-pmd/testpmd.h +1 -0
@@ -1187,6 +1187,7 @@ void eth_set_allmulticast_mode(uint16_t port, int enable);int eth_link_get_nowait_print_err (uint16_t port_id,struct rte_eth_link *link);int eth_macaddr_get_print_err (uint16_t port_id,struct rte_ether_addr *mac_addr); +int get_bit (const uint32_t *ptr,uint32_t pos);/* Functions to display the set of MAC addresses added to a port*/ void show_macs (portid_t port_id);
app/test-pmd/util.c +10 -0
@@ -17,6 +17,8 @@#define MAX_STRING_LEN 8192 +#define UINT_32_BIT_WIDTH (CHAR_BIT * sizeof(uint32_t)) +#define MKDUMPSTR (buf, buf_size, cur_len, ...) \ do { \ if (cur_len >= buf_size) \
@@ -525,3 +527,11 @@ eth_macaddr_get_print_err(uint16_t port_id, struct rte_ether_addr *mac_addr)return ret; } + +int +get_bit (const uint32_t *ptr,uint32_t pos) +{ +uint32_t byte_idx = pos /UINT_32_BIT_WIDTH ; +uint32_t bit_idx = pos %UINT_32_BIT_WIDTH ; +return (ptr[byte_idx] >> bit_idx) &0x1 ; +}
Signature · 1 line
2.41.0
Quoted 9 lines · Marek Pazdan
Add cmdline options for utilizing get/set link settings API added before in patch this patch depends on. Purpose of this change is to provide mechanism for testing link settings interface API.
Signed-off-by Marek Pazdan <[email protected]>---
Depends-on: patch-139082 ("lib: add get/set link settings interface")
Hi Marek,
This patch is based on your previous patch that adds 'rte_eth_dev_get_link_settings()', but it is unlikely that dependent patch will be accepted because it is duplication of existing APIs in DPDK. Please follow discussions in that thread.