From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E107A43696; Thu, 7 Dec 2023 08:12:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 70D1A42E7A; Thu, 7 Dec 2023 08:12:18 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 5FD6F40042 for ; Thu, 7 Dec 2023 08:12:16 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3B6JJ4oa027702 for ; Wed, 6 Dec 2023 23:12:15 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=go8KFzbcWxIvx96We91gwUYfSMxdqiBdSRlJhDx9DsY=; b=gLqa4G/ZBZXXmro6JtILaFLN7lJm4DCCTbTswT2yKhgz+F1DcW97Y5RSfmXbekvEzQe2 4qcQs2i3B1pcrPoim1xMLBuXrW1W5swYaZ4+oxYU3K1pW9d/w2c44fUUCHMux8tF5jVH ueIex3KszzKRrMPWgyq3fK4uHGyzlkM1dilx4nnUWESzTR3PLBPELzCyDjqZIVOhnYqT 8Xxmql9sIcB1UhGsGg4uwtDklNIHuUrWyLAhv2ACaavfxw5ch9G05iYv39A4jIN/jwDY 9yop5+pkC962rClRxiqrP3hq9N/FR4xRNY91v7GyjXZsyLFpCp3gDqpHr+EO4J6Naz7P wQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3uty0jj1xt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 06 Dec 2023 23:12:15 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 6 Dec 2023 23:12:12 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 6 Dec 2023 23:12:12 -0800 Received: from localhost.localdomain (unknown [10.28.34.25]) by maili.marvell.com (Postfix) with ESMTP id 7DA793F7051; Wed, 6 Dec 2023 23:12:10 -0800 (PST) From: To: Sunil Kumar Kori , Rakesh Kudurumalla CC: Subject: [PATCH] app/graph: generate cmdline boilerplate Date: Thu, 7 Dec 2023 12:42:05 +0530 Message-ID: <20231207071205.3008880-1-skori@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: njK2qxnk_oeLrxF9o2ztFvcKviPm-P9i X-Proofpoint-ORIG-GUID: njK2qxnk_oeLrxF9o2ztFvcKviPm-P9i X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-07_04,2023-12-06_01,2023-05-22_02 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Sunil Kumar Kori Use the dpdk-cmdline-gen script to autogenerate all the boilerplate structs and defines for the commandline part of the application. Depends-on: series-30459 ("enhancements for dpdk-cmdline-gen script") Signed-off-by: Sunil Kumar Kori --- app/graph/cli.c | 27 --- app/graph/commands.list | 32 ++++ app/graph/ethdev.c | 288 +++++------------------------- app/graph/ethdev.h | 9 - app/graph/ethdev_priv.h | 63 ------- app/graph/ethdev_rx.c | 67 +------ app/graph/ethdev_rx.h | 2 - app/graph/ethdev_rx_priv.h | 16 -- app/graph/examples/l3fwd.cli | 12 +- app/graph/examples/l3fwd_pcap.cli | 12 +- app/graph/graph.c | 131 ++------------ app/graph/graph.h | 5 - app/graph/graph_priv.h | 35 ---- app/graph/ip4_route.c | 86 ++------- app/graph/ip6_route.c | 88 ++------- app/graph/mempool.c | 68 +------ app/graph/mempool.h | 3 - app/graph/mempool_priv.h | 18 -- app/graph/meson.build | 8 + app/graph/module_api.h | 1 + app/graph/neigh.c | 103 ++--------- app/graph/neigh.h | 4 - app/graph/neigh_priv.h | 21 --- app/graph/route.h | 5 - app/graph/route_priv.h | 34 ---- 25 files changed, 164 insertions(+), 974 deletions(-) create mode 100644 app/graph/commands.list diff --git a/app/graph/cli.c b/app/graph/cli.c index 30b12312d6..0f23aa2586 100644 --- a/app/graph/cli.c +++ b/app/graph/cli.c @@ -19,33 +19,6 @@ #define CMD_MAX_TOKENS 256 #define MAX_LINE_SIZE 2048 -cmdline_parse_ctx_t modules_ctx[] = { - (cmdline_parse_inst_t *)&graph_config_cmd_ctx, - (cmdline_parse_inst_t *)&graph_start_cmd_ctx, - (cmdline_parse_inst_t *)&graph_stats_cmd_ctx, - (cmdline_parse_inst_t *)&graph_help_cmd_ctx, - (cmdline_parse_inst_t *)&mempool_config_cmd_ctx, - (cmdline_parse_inst_t *)&mempool_help_cmd_ctx, - (cmdline_parse_inst_t *)ðdev_show_cmd_ctx, - (cmdline_parse_inst_t *)ðdev_stats_cmd_ctx, - (cmdline_parse_inst_t *)ðdev_mtu_cmd_ctx, - (cmdline_parse_inst_t *)ðdev_prom_mode_cmd_ctx, - (cmdline_parse_inst_t *)ðdev_ip4_cmd_ctx, - (cmdline_parse_inst_t *)ðdev_ip6_cmd_ctx, - (cmdline_parse_inst_t *)ðdev_cmd_ctx, - (cmdline_parse_inst_t *)ðdev_help_cmd_ctx, - (cmdline_parse_inst_t *)ðdev_rx_cmd_ctx, - (cmdline_parse_inst_t *)ðdev_rx_help_cmd_ctx, - (cmdline_parse_inst_t *)&ipv4_lookup_cmd_ctx, - (cmdline_parse_inst_t *)&ipv4_lookup_help_cmd_ctx, - (cmdline_parse_inst_t *)&ipv6_lookup_cmd_ctx, - (cmdline_parse_inst_t *)&ipv6_lookup_help_cmd_ctx, - (cmdline_parse_inst_t *)&neigh_v4_cmd_ctx, - (cmdline_parse_inst_t *)&neigh_v6_cmd_ctx, - (cmdline_parse_inst_t *)&neigh_help_cmd_ctx, - NULL, -}; - static struct cmdline *cl; static int diff --git a/app/graph/commands.list b/app/graph/commands.list new file mode 100644 index 0000000000..1f3f43cdba --- /dev/null +++ b/app/graph/commands.list @@ -0,0 +1,32 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2023 Marvell. +# +graph usecase coremask mask bsz size tmo ns model <(rtc,mcd,default)>model_name <(pcap_enable)>capt_ena pcap_ena <(num_pcap_pkts)>capt_pkts_count num_pcap_pkts <(pcap_file)>capt_file pcap_file # Command to create graph for given usecase +graph start # Comanmd to start a graph +graph stats show # Command to dump graph stats +help graph # Print help on graph commands + +mempool name size buf_sz buffers nb_bufs cache cache_size numa node # Create mempool +help mempool # Print help on mempool commands + +ethdev dev rxq nb_rxq txq nb_txq mempool # Create Ethernet device +ethdev __dev mtu size # Set MTU on Ethernet device +ethdev __dev promiscuous <(on,off)>enable # Set promiscuous mode on Ethernet device +ethdev __dev show # Command to dump Ethernet device info +ethdev __dev stats # Command to dump Ethernet device stats +ethdev __dev ip4 addr add ip netmask mask # Set IPv4 address on Ethernet device +ethdev __dev ip6 addr add ip netmask mask # Set IPv6 address on Ethernet device +help ethdev # Print help on ethdev commands + +ethdev_rx map port dev queue qid core core_id # Port-Queue-Core mapping +help ethdev_rx # Print help on ethdev_rx commands + +ipv4_lookup route add ipv4 ip netmask mask via via_ip # Add IPv4 route to LPM table +help ipv4_lookup # Print help on ipv4_lookup commands + +ipv6_lookup route add ipv6 ip netmask mask via via_ip # Add IPv6 route to LPM6 table +help ipv6_lookup # Print help on ipv6_lookup commands + +neigh add ipv4 ip mac # Add static neighbour for IPv4 +neigh add ipv6 ip mac # Add static neighbour for IPv6 +help neigh # Print help on neigh commands diff --git a/app/graph/ethdev.c b/app/graph/ethdev.c index c9b09168c1..c64cac10f1 100644 --- a/app/graph/ethdev.c +++ b/app/graph/ethdev.c @@ -188,7 +188,6 @@ ethdev_start(void) } } - static int ethdev_show(const char *name) { @@ -344,7 +343,6 @@ ethdev_mtu_config(const char *name, uint32_t mtu) return rc; } - static int ethdev_process(const char *name, struct ethdev_config *params) { @@ -560,21 +558,23 @@ ethdev_stats_show(const char *name) return 0; } -static void -cli_ethdev_mtu(void *parsed_result, __rte_unused struct cmdline *cl, void *data __rte_unused) +void +cmd_ethdev_dev_mtu_parsed(void *parsed_result, __rte_unused struct cmdline *cl, + void *data __rte_unused) { - struct ethdev_mtu_cmd_tokens *res = parsed_result; + struct cmd_ethdev_dev_mtu_result *res = parsed_result; int rc = -EINVAL; rc = ethdev_mtu_config(res->dev, res->size); if (rc < 0) - printf(MSG_CMD_FAIL, res->cmd); + printf(MSG_CMD_FAIL, res->ethdev); } -static void -cli_ethdev_prom_mode(void *parsed_result, __rte_unused struct cmdline *cl, void *data __rte_unused) +void +cmd_ethdev_dev_promiscuous_parsed(void *parsed_result, __rte_unused struct cmdline *cl, + void *data __rte_unused) { - struct ethdev_prom_mode_cmd_tokens *res = parsed_result; + struct cmd_ethdev_dev_promiscuous_result *res = parsed_result; bool enable = false; int rc = -EINVAL; @@ -583,57 +583,49 @@ cli_ethdev_prom_mode(void *parsed_result, __rte_unused struct cmdline *cl, void rc = ethdev_prom_mode_config(res->dev, enable); if (rc < 0) - printf(MSG_CMD_FAIL, res->cmd); + printf(MSG_CMD_FAIL, res->ethdev); } -static void -cli_ip4_addr(void *parsed_result, __rte_unused struct cmdline *cl, void *data __rte_unused) +void +cmd_ethdev_dev_ip4_addr_add_parsed(void *parsed_result, __rte_unused struct cmdline *cl, + void *data __rte_unused) { - struct ethdev_ip4_cmd_tokens *res = parsed_result; + struct cmd_ethdev_dev_ip4_addr_add_result *res = parsed_result; struct ipv4_addr_config config; int rc = -EINVAL; - if (parser_ip4_read(&config.ip, res->ip)) { - printf(MSG_ARG_INVALID, "ip"); - return; - } - - if (parser_ip4_read(&config.mask, res->mask)) { - printf(MSG_ARG_INVALID, "netmask"); - return; - } + config.ip = rte_be_to_cpu_32(res->ip.addr.ipv4.s_addr); + config.mask = rte_be_to_cpu_32(res->mask.addr.ipv4.s_addr); rc = ethdev_ip4_addr_add(res->dev, &config); if (rc < 0) - printf(MSG_CMD_FAIL, res->cmd); + printf(MSG_CMD_FAIL, res->ethdev); } -static void -cli_ip6_addr(void *parsed_result, __rte_unused struct cmdline *cl, void *data __rte_unused) +void +cmd_ethdev_dev_ip6_addr_add_parsed(void *parsed_result, __rte_unused struct cmdline *cl, + void *data __rte_unused) { - struct ethdev_ip6_cmd_tokens *res = parsed_result; + struct cmd_ethdev_dev_ip6_addr_add_result *res = parsed_result; struct ipv6_addr_config config; - int rc = -EINVAL; + int rc = -EINVAL, i; - if (parser_ip6_read(config.ip, res->ip)) { - printf(MSG_ARG_INVALID, "ip"); - return; - } + for (i = 0; i < ETHDEV_IPV6_ADDR_LEN; i++) + config.ip[i] = res->ip.addr.ipv6.s6_addr[i]; - if (parser_ip6_read(config.mask, res->mask)) { - printf(MSG_ARG_INVALID, "netmask"); - return; - } + for (i = 0; i < ETHDEV_IPV6_ADDR_LEN; i++) + config.mask[i] = res->mask.addr.ipv6.s6_addr[i]; rc = ethdev_ip6_addr_add(res->dev, &config); if (rc < 0) - printf(MSG_CMD_FAIL, res->cmd); + printf(MSG_CMD_FAIL, res->ethdev); } -static void -cli_ethdev_show(void *parsed_result, __rte_unused struct cmdline *cl, void *data __rte_unused) +void +cmd_ethdev_dev_show_parsed(void *parsed_result, __rte_unused struct cmdline *cl, + void *data __rte_unused) { - struct ethdev_show_cmd_tokens *res = parsed_result; + struct cmd_ethdev_dev_show_result *res = parsed_result; int rc = -EINVAL; rc = ethdev_show(res->dev); @@ -641,10 +633,11 @@ cli_ethdev_show(void *parsed_result, __rte_unused struct cmdline *cl, void *data printf(MSG_ARG_INVALID, res->dev); } -static void -cli_ethdev_stats(void *parsed_result, __rte_unused struct cmdline *cl, void *data __rte_unused) +void +cmd_ethdev_dev_stats_parsed(void *parsed_result, __rte_unused struct cmdline *cl, + void *data __rte_unused) { - struct ethdev_stats_cmd_tokens *res = parsed_result; + struct cmd_ethdev_dev_stats_result *res = parsed_result; int rc = -EINVAL; rc = ethdev_stats_show(res->dev); @@ -652,10 +645,10 @@ cli_ethdev_stats(void *parsed_result, __rte_unused struct cmdline *cl, void *dat printf(MSG_ARG_INVALID, res->dev); } -static void -cli_ethdev(void *parsed_result, __rte_unused struct cmdline *cl, void *data __rte_unused) +void +cmd_ethdev_parsed(void *parsed_result, __rte_unused struct cmdline *cl, void *data __rte_unused) { - struct ethdev_cmd_tokens *res = parsed_result; + struct cmd_ethdev_result *res = parsed_result; struct ethdev_config config; int rc; @@ -671,12 +664,12 @@ cli_ethdev(void *parsed_result, __rte_unused struct cmdline *cl, void *data __rt rc = ethdev_process(res->dev, &config); if (rc < 0) - printf(MSG_CMD_FAIL, res->cmd); + printf(MSG_CMD_FAIL, res->ethdev); } -static void -cli_ethdev_help(__rte_unused void *parsed_result, __rte_unused struct cmdline *cl, - __rte_unused void *data) +void +cmd_help_ethdev_parsed(__rte_unused void *parsed_result, __rte_unused struct cmdline *cl, + __rte_unused void *data) { size_t len; @@ -691,200 +684,3 @@ cli_ethdev_help(__rte_unused void *parsed_result, __rte_unused struct cmdline *c len = strlen(conn->msg_out); conn->msg_out_len_max -= len; } - -cmdline_parse_token_string_t ethdev_stats_cmd = - TOKEN_STRING_INITIALIZER(struct ethdev_stats_cmd_tokens, cmd, "ethdev"); -cmdline_parse_token_string_t ethdev_stats_dev = - TOKEN_STRING_INITIALIZER(struct ethdev_stats_cmd_tokens, dev, NULL); -cmdline_parse_token_string_t ethdev_stats_stats = - TOKEN_STRING_INITIALIZER(struct ethdev_stats_cmd_tokens, stats, "stats"); - -cmdline_parse_inst_t ethdev_stats_cmd_ctx = { - .f = cli_ethdev_stats, - .data = NULL, - .help_str = "", - .tokens = { - (void *)ðdev_stats_cmd, - (void *)ðdev_stats_dev, - (void *)ðdev_stats_stats, - NULL, - }, -}; - -cmdline_parse_token_string_t ethdev_show_cmd = - TOKEN_STRING_INITIALIZER(struct ethdev_show_cmd_tokens, cmd, "ethdev"); -cmdline_parse_token_string_t ethdev_show_dev = - TOKEN_STRING_INITIALIZER(struct ethdev_show_cmd_tokens, dev, NULL); -cmdline_parse_token_string_t ethdev_show_show = - TOKEN_STRING_INITIALIZER(struct ethdev_show_cmd_tokens, show, "show"); - -cmdline_parse_inst_t ethdev_show_cmd_ctx = { - .f = cli_ethdev_show, - .data = NULL, - .help_str = cmd_ethdev_show_help, - .tokens = { - (void *)ðdev_show_cmd, - (void *)ðdev_show_dev, - (void *)ðdev_show_show, - NULL, - }, -}; - -cmdline_parse_token_string_t ethdev_mtu_cmd = - TOKEN_STRING_INITIALIZER(struct ethdev_mtu_cmd_tokens, cmd, "ethdev"); -cmdline_parse_token_string_t ethdev_mtu_dev = - TOKEN_STRING_INITIALIZER(struct ethdev_mtu_cmd_tokens, dev, NULL); -cmdline_parse_token_string_t ethdev_mtu_mtu = - TOKEN_STRING_INITIALIZER(struct ethdev_mtu_cmd_tokens, mtu, "mtu"); -cmdline_parse_token_num_t ethdev_mtu_size = - TOKEN_NUM_INITIALIZER(struct ethdev_mtu_cmd_tokens, size, RTE_UINT16); - -cmdline_parse_inst_t ethdev_mtu_cmd_ctx = { - .f = cli_ethdev_mtu, - .data = NULL, - .help_str = cmd_ethdev_mtu_help, - .tokens = { - (void *)ðdev_mtu_cmd, - (void *)ðdev_mtu_dev, - (void *)ðdev_mtu_mtu, - (void *)ðdev_mtu_size, - NULL, - }, -}; - -cmdline_parse_token_string_t ethdev_prom_mode_cmd = - TOKEN_STRING_INITIALIZER(struct ethdev_prom_mode_cmd_tokens, cmd, "ethdev"); -cmdline_parse_token_string_t ethdev_prom_mode_dev = - TOKEN_STRING_INITIALIZER(struct ethdev_prom_mode_cmd_tokens, dev, NULL); -cmdline_parse_token_string_t ethdev_prom_mode_prom = - TOKEN_STRING_INITIALIZER(struct ethdev_prom_mode_cmd_tokens, prom, "promiscuous"); -cmdline_parse_token_string_t ethdev_prom_mode_enable = - TOKEN_STRING_INITIALIZER(struct ethdev_prom_mode_cmd_tokens, enable, "on#off"); - -cmdline_parse_inst_t ethdev_prom_mode_cmd_ctx = { - .f = cli_ethdev_prom_mode, - .data = NULL, - .help_str = cmd_ethdev_prom_mode_help, - .tokens = { - (void *)ðdev_prom_mode_cmd, - (void *)ðdev_prom_mode_dev, - (void *)ðdev_prom_mode_prom, - (void *)ðdev_prom_mode_enable, - NULL, - }, -}; - -cmdline_parse_token_string_t ethdev_ip4_cmd = - TOKEN_STRING_INITIALIZER(struct ethdev_ip4_cmd_tokens, cmd, "ethdev"); -cmdline_parse_token_string_t ethdev_ip4_dev = - TOKEN_STRING_INITIALIZER(struct ethdev_ip4_cmd_tokens, dev, NULL); -cmdline_parse_token_string_t ethdev_ip4_ip4 = - TOKEN_STRING_INITIALIZER(struct ethdev_ip4_cmd_tokens, ip4, "ip4"); -cmdline_parse_token_string_t ethdev_ip4_addr = - TOKEN_STRING_INITIALIZER(struct ethdev_ip4_cmd_tokens, addr, "addr"); -cmdline_parse_token_string_t ethdev_ip4_add = - TOKEN_STRING_INITIALIZER(struct ethdev_ip4_cmd_tokens, add, "add"); -cmdline_parse_token_string_t ethdev_ip4_ip = - TOKEN_STRING_INITIALIZER(struct ethdev_ip4_cmd_tokens, ip, NULL); -cmdline_parse_token_string_t ethdev_ip4_netmask = - TOKEN_STRING_INITIALIZER(struct ethdev_ip4_cmd_tokens, netmask, "netmask"); -cmdline_parse_token_string_t ethdev_ip4_mask = - TOKEN_STRING_INITIALIZER(struct ethdev_ip4_cmd_tokens, mask, NULL); - -cmdline_parse_inst_t ethdev_ip4_cmd_ctx = { - .f = cli_ip4_addr, - .data = NULL, - .help_str = cmd_ethdev_ip4_addr_help, - .tokens = { - (void *)ðdev_ip4_cmd, - (void *)ðdev_ip4_dev, - (void *)ðdev_ip4_ip4, - (void *)ðdev_ip4_addr, - (void *)ðdev_ip4_add, - (void *)ðdev_ip4_ip, - (void *)ðdev_ip4_netmask, - (void *)ðdev_ip4_mask, - NULL, - }, -}; - -cmdline_parse_token_string_t ethdev_ip6_cmd = - TOKEN_STRING_INITIALIZER(struct ethdev_ip6_cmd_tokens, cmd, "ethdev"); -cmdline_parse_token_string_t ethdev_ip6_dev = - TOKEN_STRING_INITIALIZER(struct ethdev_ip6_cmd_tokens, dev, NULL); -cmdline_parse_token_string_t ethdev_ip6_ip6 = - TOKEN_STRING_INITIALIZER(struct ethdev_ip6_cmd_tokens, ip6, "ip6"); -cmdline_parse_token_string_t ethdev_ip6_addr = - TOKEN_STRING_INITIALIZER(struct ethdev_ip6_cmd_tokens, addr, "addr"); -cmdline_parse_token_string_t ethdev_ip6_add = - TOKEN_STRING_INITIALIZER(struct ethdev_ip6_cmd_tokens, add, "add"); -cmdline_parse_token_string_t ethdev_ip6_ip = - TOKEN_STRING_INITIALIZER(struct ethdev_ip6_cmd_tokens, ip, NULL); -cmdline_parse_token_string_t ethdev_ip6_netmask = - TOKEN_STRING_INITIALIZER(struct ethdev_ip6_cmd_tokens, netmask, "netmask"); -cmdline_parse_token_string_t ethdev_ip6_mask = - TOKEN_STRING_INITIALIZER(struct ethdev_ip6_cmd_tokens, mask, NULL); - -cmdline_parse_inst_t ethdev_ip6_cmd_ctx = { - .f = cli_ip6_addr, - .data = NULL, - .help_str = cmd_ethdev_ip6_addr_help, - .tokens = { - (void *)ðdev_ip6_cmd, - (void *)ðdev_ip6_dev, - (void *)ðdev_ip6_ip6, - (void *)ðdev_ip6_addr, - (void *)ðdev_ip6_add, - (void *)ðdev_ip6_ip, - (void *)ðdev_ip6_netmask, - (void *)ðdev_ip6_mask, - NULL, - }, -}; - -cmdline_parse_token_string_t ethdev_cmd = - TOKEN_STRING_INITIALIZER(struct ethdev_cmd_tokens, cmd, "ethdev"); -cmdline_parse_token_string_t ethdev_dev = - TOKEN_STRING_INITIALIZER(struct ethdev_cmd_tokens, dev, NULL); -cmdline_parse_token_string_t ethdev_rxq = - TOKEN_STRING_INITIALIZER(struct ethdev_cmd_tokens, rxq, "rxq"); -cmdline_parse_token_num_t ethdev_nb_rxq = - TOKEN_NUM_INITIALIZER(struct ethdev_cmd_tokens, nb_rxq, RTE_UINT16); -cmdline_parse_token_string_t ethdev_txq = - TOKEN_STRING_INITIALIZER(struct ethdev_cmd_tokens, txq, "txq"); -cmdline_parse_token_num_t ethdev_nb_txq = - TOKEN_NUM_INITIALIZER(struct ethdev_cmd_tokens, nb_txq, RTE_UINT16); -cmdline_parse_token_string_t ethdev_mempool = - TOKEN_STRING_INITIALIZER(struct ethdev_cmd_tokens, mempool, NULL); - -cmdline_parse_inst_t ethdev_cmd_ctx = { - .f = cli_ethdev, - .data = NULL, - .help_str = cmd_ethdev_help, - .tokens = { - (void *)ðdev_cmd, - (void *)ðdev_dev, - (void *)ðdev_rxq, - (void *)ðdev_nb_rxq, - (void *)ðdev_txq, - (void *)ðdev_nb_txq, - (void *)ðdev_mempool, - NULL, - }, -}; - -cmdline_parse_token_string_t ethdev_help_cmd = - TOKEN_STRING_INITIALIZER(struct ethdev_help_cmd_tokens, help, "help"); -cmdline_parse_token_string_t ethdev_help_ethdev = - TOKEN_STRING_INITIALIZER(struct ethdev_help_cmd_tokens, ethdev, "ethdev"); - -cmdline_parse_inst_t ethdev_help_cmd_ctx = { - .f = cli_ethdev_help, - .data = NULL, - .help_str = "", - .tokens = { - (void *)ðdev_help_cmd, - (void *)ðdev_help_ethdev, - NULL, - }, -}; diff --git a/app/graph/ethdev.h b/app/graph/ethdev.h index 94d3247a2c..39ed723b8b 100644 --- a/app/graph/ethdev.h +++ b/app/graph/ethdev.h @@ -9,15 +9,6 @@ #define ETHDEV_IPV6_ADDR_LEN 16 -extern cmdline_parse_inst_t ethdev_show_cmd_ctx; -extern cmdline_parse_inst_t ethdev_stats_cmd_ctx; -extern cmdline_parse_inst_t ethdev_mtu_cmd_ctx; -extern cmdline_parse_inst_t ethdev_prom_mode_cmd_ctx; -extern cmdline_parse_inst_t ethdev_ip4_cmd_ctx; -extern cmdline_parse_inst_t ethdev_ip6_cmd_ctx; -extern cmdline_parse_inst_t ethdev_cmd_ctx; -extern cmdline_parse_inst_t ethdev_help_cmd_ctx; - struct ipv4_addr_config { uint32_t ip; uint32_t mask; diff --git a/app/graph/ethdev_priv.h b/app/graph/ethdev_priv.h index f231f3f3e1..043ca625de 100644 --- a/app/graph/ethdev_priv.h +++ b/app/graph/ethdev_priv.h @@ -13,69 +13,6 @@ #define ETHDEV_RX_DESC_DEFAULT 1024 #define ETHDEV_TX_DESC_DEFAULT 1024 -struct ethdev_show_cmd_tokens { - cmdline_fixed_string_t cmd; - cmdline_fixed_string_t dev; - cmdline_fixed_string_t show; -}; - -struct ethdev_stats_cmd_tokens { - cmdline_fixed_string_t cmd; - cmdline_fixed_string_t dev; - cmdline_fixed_string_t stats; -}; - -struct ethdev_mtu_cmd_tokens { - cmdline_fixed_string_t cmd; - cmdline_fixed_string_t dev; - cmdline_fixed_string_t mtu; - uint16_t size; -}; - -struct ethdev_prom_mode_cmd_tokens { - cmdline_fixed_string_t cmd; - cmdline_fixed_string_t dev; - cmdline_fixed_string_t prom; - cmdline_fixed_string_t enable; -}; - -struct ethdev_ip4_cmd_tokens { - cmdline_fixed_string_t cmd; - cmdline_fixed_string_t dev; - cmdline_fixed_string_t ip4; - cmdline_fixed_string_t addr; - cmdline_fixed_string_t add; - cmdline_fixed_string_t ip; - cmdline_fixed_string_t netmask; - cmdline_fixed_string_t mask; -}; - -struct ethdev_ip6_cmd_tokens { - cmdline_fixed_string_t cmd; - cmdline_fixed_string_t dev; - cmdline_fixed_string_t ip6; - cmdline_fixed_string_t addr; - cmdline_fixed_string_t add; - cmdline_fixed_string_t ip; - cmdline_fixed_string_t netmask; - cmdline_fixed_string_t mask; -}; - -struct ethdev_cmd_tokens { - cmdline_fixed_string_t cmd; - cmdline_fixed_string_t dev; - cmdline_fixed_string_t rxq; - cmdline_fixed_string_t txq; - cmdline_fixed_string_t mempool; - uint16_t nb_rxq; - uint16_t nb_txq; -}; - -struct ethdev_help_cmd_tokens { - cmdline_fixed_string_t help; - cmdline_fixed_string_t ethdev; -}; - struct ethdev_rss_config { uint32_t queue_id[ETHDEV_RXQ_RSS_MAX]; uint32_t n_queues; diff --git a/app/graph/ethdev_rx.c b/app/graph/ethdev_rx.c index 03f8effcca..25c439b9a3 100644 --- a/app/graph/ethdev_rx.c +++ b/app/graph/ethdev_rx.c @@ -83,83 +83,34 @@ ethdev_rx_map_add(char *name, uint32_t queue, uint32_t core) return 0; } -static void -cli_ethdev_rx_help(__rte_unused void *parsed_result, __rte_unused struct cmdline *cl, - __rte_unused void *data) +void +cmd_help_ethdev_rx_parsed(__rte_unused void *parsed_result, __rte_unused struct cmdline *cl, + __rte_unused void *data) { size_t len; len = strlen(conn->msg_out); conn->msg_out += len; snprintf(conn->msg_out, conn->msg_out_len_max, "\n%s\n%s\n", - "----------------------------- ethdev_rx command help -----------------------------", + "---------------------------- ethdev_rx command help ----------------------------", cmd_ethdev_rx_help); len = strlen(conn->msg_out); conn->msg_out_len_max -= len; } -static void -cli_ethdev_rx(void *parsed_result, __rte_unused struct cmdline *cl, void *data __rte_unused) +void +cmd_ethdev_rx_map_port_parsed(void *parsed_result, __rte_unused struct cmdline *cl, + void *data __rte_unused) { - struct ethdev_rx_cmd_tokens *res = parsed_result; + struct cmd_ethdev_rx_map_port_result *res = parsed_result; int rc = -EINVAL; rc = ethdev_rx_map_add(res->dev, res->qid, res->core_id); if (rc < 0) { cli_exit(); - printf(MSG_CMD_FAIL, res->cmd); + printf(MSG_CMD_FAIL, res->ethdev_rx); rte_exit(EXIT_FAILURE, "input core is Invalid\n"); } } - -cmdline_parse_token_string_t ethdev_rx_cmd = - TOKEN_STRING_INITIALIZER(struct ethdev_rx_cmd_tokens, cmd, "ethdev_rx"); -cmdline_parse_token_string_t ethdev_rx_map = - TOKEN_STRING_INITIALIZER(struct ethdev_rx_cmd_tokens, map, "map"); -cmdline_parse_token_string_t ethdev_rx_port = - TOKEN_STRING_INITIALIZER(struct ethdev_rx_cmd_tokens, port, "port"); -cmdline_parse_token_string_t ethdev_rx_dev = - TOKEN_STRING_INITIALIZER(struct ethdev_rx_cmd_tokens, dev, NULL); -cmdline_parse_token_string_t ethdev_rx_queue = - TOKEN_STRING_INITIALIZER(struct ethdev_rx_cmd_tokens, queue, "queue"); -cmdline_parse_token_num_t ethdev_rx_qid = - TOKEN_NUM_INITIALIZER(struct ethdev_rx_cmd_tokens, qid, RTE_UINT32); -cmdline_parse_token_string_t ethdev_rx_core = - TOKEN_STRING_INITIALIZER(struct ethdev_rx_cmd_tokens, core, "core"); -cmdline_parse_token_num_t ethdev_rx_core_id = - TOKEN_NUM_INITIALIZER(struct ethdev_rx_cmd_tokens, core_id, RTE_UINT32); - -cmdline_parse_inst_t ethdev_rx_cmd_ctx = { - .f = cli_ethdev_rx, - .data = NULL, - .help_str = cmd_ethdev_rx_help, - .tokens = { - (void *)ðdev_rx_cmd, - (void *)ðdev_rx_map, - (void *)ðdev_rx_port, - (void *)ðdev_rx_dev, - (void *)ðdev_rx_queue, - (void *)ðdev_rx_qid, - (void *)ðdev_rx_core, - (void *)ðdev_rx_core_id, - NULL, - }, -}; - -cmdline_parse_token_string_t ethdev_rx_help_cmd = - TOKEN_STRING_INITIALIZER(struct ethdev_rx_help_cmd_tokens, cmd, "help"); -cmdline_parse_token_string_t ethdev_rx_help_module = - TOKEN_STRING_INITIALIZER(struct ethdev_rx_help_cmd_tokens, module, "ethdev_rx"); - -cmdline_parse_inst_t ethdev_rx_help_cmd_ctx = { - .f = cli_ethdev_rx_help, - .data = NULL, - .help_str = "", - .tokens = { - (void *)ðdev_rx_help_cmd, - (void *)ðdev_rx_help_module, - NULL, - }, -}; diff --git a/app/graph/ethdev_rx.h b/app/graph/ethdev_rx.h index 8e7b31448c..ec3c97286a 100644 --- a/app/graph/ethdev_rx.h +++ b/app/graph/ethdev_rx.h @@ -29,8 +29,6 @@ uint8_t ethdev_rx_num_rx_queues_get(uint16_t port); extern struct rte_node_ethdev_config ethdev_conf[RTE_MAX_ETHPORTS]; extern struct lcore_conf lcore_conf[RTE_MAX_LCORE]; -extern cmdline_parse_inst_t ethdev_rx_help_cmd_ctx; -extern cmdline_parse_inst_t ethdev_rx_cmd_ctx; extern struct lcore_params *lcore_params; extern uint16_t nb_lcore_params; diff --git a/app/graph/ethdev_rx_priv.h b/app/graph/ethdev_rx_priv.h index 5d155be043..d714f83739 100644 --- a/app/graph/ethdev_rx_priv.h +++ b/app/graph/ethdev_rx_priv.h @@ -14,22 +14,6 @@ #define MAX_JUMBO_PKT_LEN 9600 #define NB_SOCKETS 8 -struct ethdev_rx_cmd_tokens { - cmdline_fixed_string_t cmd; - cmdline_fixed_string_t map; - cmdline_fixed_string_t port; - cmdline_fixed_string_t dev; - cmdline_fixed_string_t queue; - cmdline_fixed_string_t core; - uint32_t core_id; - uint32_t qid; -}; - -struct ethdev_rx_help_cmd_tokens { - cmdline_fixed_string_t cmd; - cmdline_fixed_string_t module; -}; - struct lcore_params { uint16_t port_id; uint8_t queue_id; diff --git a/app/graph/examples/l3fwd.cli b/app/graph/examples/l3fwd.cli index c4977d4322..2badbbfca5 100644 --- a/app/graph/examples/l3fwd.cli +++ b/app/graph/examples/l3fwd.cli @@ -32,8 +32,8 @@ ethdev 0002:03:00.0 ip4 addr add 20.0.2.1 netmask 255.255.255.0 ; ; IPv6 addresses assigned to DPDK devices ; -ethdev 0002:02:00.0 ip6 addr add 52:20:DA:4F:68:70:52:20:DA:4F:68:70:52:20:DA:4A netmask FF:FF:FF:FF:FF:FF:FF:FF:FF:00:00:00:00:00:00:00 -ethdev 0002:03:00.0 ip6 addr add 62:20:DA:4F:68:70:52:20:DA:4F:68:70:52:20:DA:4B netmask FF:FF:FF:FF:FF:FF:FF:FF:FF:00:00:00:00:00:00:00 +ethdev 0002:02:00.0 ip6 addr add 5220:DA4F:6870:5220:DA4F:6870:5220:DA4A netmask FFFF:FFFF:FFFF:FFFF:FF00:0000:0000:0000 +ethdev 0002:03:00.0 ip6 addr add 6220:DA4F:6870:5220:DA4F:6870:5220:DA4B netmask FFFF:FFFF:FFFF:FFFF:FF00:0000:0000:0000 ; ; IPv4 routes which are installed to ipv4_lookup node for LPM processing @@ -44,8 +44,8 @@ ipv4_lookup route add ipv4 20.0.2.0 netmask 255.255.255.0 via 20.0.2.1 ; ; IPv6 routes which are installed to ipv6_lookup node for LPM processing ; -ipv6_lookup route add ipv6 52:20:DA:4F:68:70:52:20:DA:4F:68:70:52:20:DA:4A netmask FF:FF:FF:FF:FF:FF:FF:FF:FF:00:00:00:00:00:00:00 via 52:20:DA:4F:68:70:52:20:DA:4F:68:70:52:20:DA:4A -ipv6_lookup route add ipv6 62:20:DA:4F:68:70:52:20:DA:4F:68:70:52:20:DA:4B netmask FF:FF:FF:FF:FF:FF:FF:FF:FF:00:00:00:00:00:00:00 via 62:20:DA:4F:68:70:52:20:DA:4F:68:70:52:20:DA:4B +ipv6_lookup route add ipv6 5220:DA4F:6870:5220:DA4F:6870:5220:DA4A netmask FFFF:FFFF:FFFF:FFFF:FF00:0000:0000:0000 via 5220:DA4F:6870:5220:DA4F:6870:5220:DA4A +ipv6_lookup route add ipv6 6220:DA4F:6870:5220:DA4F:6870:5220:DA4B netmask FFFF:FFFF:FFFF:FFFF:FF00:0000:0000:0000 via 6220:DA4F:6870:5220:DA4F:6870:5220:DA4B ; ; Peer MAC and IPv4 address mapping @@ -56,8 +56,8 @@ neigh add ipv4 20.0.2.2 62:20:DA:4F:68:70 ; ; Peer MAC and IPv6 address mapping ; -neigh add ipv6 52:20:DA:4F:68:70:52:20:DA:4F:68:70:52:20:DA:4A 52:20:DA:4F:68:70 -neigh add ipv6 62:20:DA:4F:68:70:52:20:DA:4F:68:70:52:20:DA:4B 62:20:DA:4F:68:70 +neigh add ipv6 5220:DA4F:6870:5220:DA4F:6870:5220:DA4A 52:20:DA:4F:68:70 +neigh add ipv6 6220:DA4F:6870:5220:DA4F:6870:5220:DA4B 62:20:DA:4F:68:70 ; ; Port-Queue-Core mapping for ethdev_rx node diff --git a/app/graph/examples/l3fwd_pcap.cli b/app/graph/examples/l3fwd_pcap.cli index 30dde74a65..93e4249444 100644 --- a/app/graph/examples/l3fwd_pcap.cli +++ b/app/graph/examples/l3fwd_pcap.cli @@ -30,8 +30,8 @@ ethdev net_pcap1 ip4 addr add 20.0.2.1 netmask 255.255.255.0 ; ; IPv6 addresses assigned to DPDK devices ; -ethdev net_pcap0 ip6 addr add 52:20:DA:4F:68:70:52:20:DA:4F:68:70:52:20:DA:4A netmask FF:FF:FF:FF:FF:FF:FF:FF:FF:00:00:00:00:00:00:00 -ethdev net_pcap1 ip6 addr add 62:20:DA:4F:68:70:52:20:DA:4F:68:70:52:20:DA:4B netmask FF:FF:FF:FF:FF:FF:FF:FF:FF:00:00:00:00:00:00:00 +ethdev net_pcap0 ip6 addr add 5220:DA4F:6870:5220:DA4F:6870:5220:DA4A netmask FFFF:FFFF:FFFF:FFFF:FF00:0000:0000:0000 +ethdev net_pcap1 ip6 addr add 6220:DA4F:6870:5220:DA4F:6870:5220:DA4B netmask FFFF:FFFF:FFFF:FFFF:FF00:0000:0000:0000 ; ; IPv4 routes which are installed to ipv4_lookup node for LPM processing @@ -42,8 +42,8 @@ ipv4_lookup route add ipv4 20.0.2.0 netmask 255.255.255.0 via 20.0.2.1 ; ; IPv6 routes which are installed to ipv6_lookup node for LPM processing ; -ipv6_lookup route add ipv6 52:20:DA:4F:68:70:52:20:DA:4F:68:70:52:20:DA:4A netmask FF:FF:FF:FF:FF:FF:FF:FF:FF:00:00:00:00:00:00:00 via 52:20:DA:4F:68:70:52:20:DA:4F:68:70:52:20:DA:4A -ipv6_lookup route add ipv6 62:20:DA:4F:68:70:52:20:DA:4F:68:70:52:20:DA:4B netmask FF:FF:FF:FF:FF:FF:FF:FF:FF:00:00:00:00:00:00:00 via 62:20:DA:4F:68:70:52:20:DA:4F:68:70:52:20:DA:4B +ipv6_lookup route add ipv6 5220:DA4F:6870:5220:DA4F:6870:5220:DA4A netmask FFFF:FFFF:FFFF:FFFF:FF00:0000:0000:0000 via 5220:DA4F:6870:5220:DA4F:6870:5220:DA4A +ipv6_lookup route add ipv6 6220:DA4F:6870:5220:DA4F:6870:5220:DA4B netmask FFFF:FFFF:FFFF:FFFF:FF00:0000:0000:0000 via 6220:DA4F:6870:5220:DA4F:6870:5220:DA4B ; ; Peer MAC and IPv4 address mapping @@ -54,8 +54,8 @@ neigh add ipv4 20.0.2.2 62:20:DA:4F:68:70 ; ; Peer MAC and IPv6 address mapping ; -neigh add ipv6 52:20:DA:4F:68:70:52:20:DA:4F:68:70:52:20:DA:4A 52:20:DA:4F:68:70 -neigh add ipv6 62:20:DA:4F:68:70:52:20:DA:4F:68:70:52:20:DA:4B 62:20:DA:4F:68:70 +neigh add ipv6 5220:DA4F:6870:5220:DA4F:6870:5220:DA4A 52:20:DA:4F:68:70 +neigh add ipv6 6220:DA4F:6870:5220:DA4F:6870:5220:DA4B 62:20:DA:4F:68:70 ; ; Port-Queue-Core mapping for ethdev_rx node diff --git a/app/graph/graph.c b/app/graph/graph.c index a65723a196..8e3505d213 100644 --- a/app/graph/graph.c +++ b/app/graph/graph.c @@ -20,7 +20,7 @@ #define RTE_LOGTYPE_APP_GRAPH RTE_LOGTYPE_USER1 static const char -cmd_graph_help[] = "graph bsz tmo coremask " +cmd_graph_help[] = "graph coremask bsz tmo " "model pcap_enable <0 | 1> num_pcap_pkts " "pcap_file "; @@ -244,8 +244,8 @@ graph_stats_print_to_file(void) fclose(fp); } -static void -cli_graph_stats(__rte_unused void *parsed_result, __rte_unused struct cmdline *cl, +void +cmd_graph_stats_show_parsed(__rte_unused void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data) { graph_stats_print_to_file(); @@ -257,8 +257,8 @@ graph_status_get(void) return graph_started; } -static void -cli_graph_start(__rte_unused void *parsed_result, __rte_unused struct cmdline *cl, +void +cmd_graph_start_parsed(__rte_unused void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data) { struct rte_node_ethdev_config *conf; @@ -388,10 +388,10 @@ graph_coremask_get(void) return graph_config.params.coremask; } -static void -cli_graph(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data) +void +cmd_graph_parsed(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data) { - struct graph_config_cmd_tokens *res = parsed_result; + struct cmd_graph_result *res = parsed_result; struct graph_config config; char *model_name; uint8_t model; @@ -424,9 +424,9 @@ cli_graph(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused voi } } -static void -cli_graph_help(__rte_unused void *parsed_result, __rte_unused struct cmdline *cl, - __rte_unused void *data) +void +cmd_help_graph_parsed(__rte_unused void *parsed_result, __rte_unused struct cmdline *cl, + __rte_unused void *data) { size_t len; @@ -439,112 +439,3 @@ cli_graph_help(__rte_unused void *parsed_result, __rte_unused struct cmdline *cl len = strlen(conn->msg_out); conn->msg_out_len_max -= len; } - -cmdline_parse_token_string_t graph_display_graph = - TOKEN_STRING_INITIALIZER(struct graph_stats_cmd_tokens, graph, "graph"); -cmdline_parse_token_string_t graph_display_stats = - TOKEN_STRING_INITIALIZER(struct graph_stats_cmd_tokens, stats, "stats"); -cmdline_parse_token_string_t graph_display_show = - TOKEN_STRING_INITIALIZER(struct graph_stats_cmd_tokens, show, "show"); - -cmdline_parse_inst_t graph_stats_cmd_ctx = { - .f = cli_graph_stats, - .data = NULL, - .help_str = "graph stats show", - .tokens = { - (void *)&graph_display_graph, - (void *)&graph_display_stats, - (void *)&graph_display_show, - NULL, - }, -}; - -cmdline_parse_token_string_t graph_config_start_graph = - TOKEN_STRING_INITIALIZER(struct graph_start_cmd_tokens, graph, "graph"); -cmdline_parse_token_string_t graph_config_start = - TOKEN_STRING_INITIALIZER(struct graph_start_cmd_tokens, start, "start"); - -cmdline_parse_inst_t graph_start_cmd_ctx = { - .f = cli_graph_start, - .data = NULL, - .help_str = "graph start", - .tokens = { - (void *)&graph_config_start_graph, - (void *)&graph_config_start, - NULL, - }, -}; - -cmdline_parse_token_string_t graph_config_add_graph = - TOKEN_STRING_INITIALIZER(struct graph_config_cmd_tokens, graph, "graph"); -cmdline_parse_token_string_t graph_config_add_usecase = - TOKEN_STRING_INITIALIZER(struct graph_config_cmd_tokens, usecase, NULL); -cmdline_parse_token_string_t graph_config_add_coremask = - TOKEN_STRING_INITIALIZER(struct graph_config_cmd_tokens, coremask, "coremask"); -cmdline_parse_token_num_t graph_config_add_mask = - TOKEN_NUM_INITIALIZER(struct graph_config_cmd_tokens, mask, RTE_UINT64); -cmdline_parse_token_string_t graph_config_add_bsz = - TOKEN_STRING_INITIALIZER(struct graph_config_cmd_tokens, bsz, "bsz"); -cmdline_parse_token_num_t graph_config_add_size = - TOKEN_NUM_INITIALIZER(struct graph_config_cmd_tokens, size, RTE_UINT16); -cmdline_parse_token_string_t graph_config_add_tmo = - TOKEN_STRING_INITIALIZER(struct graph_config_cmd_tokens, tmo, "tmo"); -cmdline_parse_token_num_t graph_config_add_ns = - TOKEN_NUM_INITIALIZER(struct graph_config_cmd_tokens, ns, RTE_UINT64); -cmdline_parse_token_string_t graph_config_add_model = - TOKEN_STRING_INITIALIZER(struct graph_config_cmd_tokens, model, "model"); -cmdline_parse_token_string_t graph_config_add_model_name = - TOKEN_STRING_INITIALIZER(struct graph_config_cmd_tokens, model_name, "rtc#mcd#default"); -cmdline_parse_token_string_t graph_config_add_capt_ena = - TOKEN_STRING_INITIALIZER(struct graph_config_cmd_tokens, capt_ena, "pcap_enable"); -cmdline_parse_token_num_t graph_config_add_pcap_ena = - TOKEN_NUM_INITIALIZER(struct graph_config_cmd_tokens, pcap_ena, RTE_UINT8); -cmdline_parse_token_string_t graph_config_add_capt_pkts_count = - TOKEN_STRING_INITIALIZER(struct graph_config_cmd_tokens, capt_pkts_count, "num_pcap_pkts"); -cmdline_parse_token_num_t graph_config_add_num_pcap_pkts = - TOKEN_NUM_INITIALIZER(struct graph_config_cmd_tokens, num_pcap_pkts, RTE_UINT64); -cmdline_parse_token_string_t graph_config_add_capt_file = - TOKEN_STRING_INITIALIZER(struct graph_config_cmd_tokens, capt_file, "pcap_file"); -cmdline_parse_token_string_t graph_config_add_pcap_file = - TOKEN_STRING_INITIALIZER(struct graph_config_cmd_tokens, pcap_file, NULL); - -cmdline_parse_inst_t graph_config_cmd_ctx = { - .f = cli_graph, - .data = NULL, - .help_str = cmd_graph_help, - .tokens = { - (void *)&graph_config_add_graph, - (void *)&graph_config_add_usecase, - (void *)&graph_config_add_coremask, - (void *)&graph_config_add_mask, - (void *)&graph_config_add_bsz, - (void *)&graph_config_add_size, - (void *)&graph_config_add_tmo, - (void *)&graph_config_add_ns, - (void *)&graph_config_add_model, - (void *)&graph_config_add_model_name, - (void *)&graph_config_add_capt_ena, - (void *)&graph_config_add_pcap_ena, - (void *)&graph_config_add_capt_pkts_count, - (void *)&graph_config_add_num_pcap_pkts, - (void *)&graph_config_add_capt_file, - (void *)&graph_config_add_pcap_file, - NULL, - }, -}; - -cmdline_parse_token_string_t graph_help_cmd = - TOKEN_STRING_INITIALIZER(struct graph_help_cmd_tokens, help, "help"); -cmdline_parse_token_string_t graph_help_graph = - TOKEN_STRING_INITIALIZER(struct graph_help_cmd_tokens, graph, "graph"); - -cmdline_parse_inst_t graph_help_cmd_ctx = { - .f = cli_graph_help, - .data = NULL, - .help_str = "", - .tokens = { - (void *)&graph_help_cmd, - (void *)&graph_help_graph, - NULL, - }, -}; diff --git a/app/graph/graph.h b/app/graph/graph.h index a14fa37ccd..c851b71e7e 100644 --- a/app/graph/graph.h +++ b/app/graph/graph.h @@ -7,11 +7,6 @@ #include -extern cmdline_parse_inst_t graph_config_cmd_ctx; -extern cmdline_parse_inst_t graph_start_cmd_ctx; -extern cmdline_parse_inst_t graph_stats_cmd_ctx; -extern cmdline_parse_inst_t graph_help_cmd_ctx; - int graph_walk_start(void *conf); void graph_stats_print(void); void graph_pcap_config_get(uint8_t *pcap_ena, uint64_t *num_pkts, char **file); diff --git a/app/graph/graph_priv.h b/app/graph/graph_priv.h index a48a35daa3..3306edda63 100644 --- a/app/graph/graph_priv.h +++ b/app/graph/graph_priv.h @@ -7,41 +7,6 @@ #define MAX_GRAPH_USECASES 32 -struct graph_help_cmd_tokens { - cmdline_fixed_string_t help; - cmdline_fixed_string_t graph; -}; - -struct graph_start_cmd_tokens { - cmdline_fixed_string_t graph; - cmdline_fixed_string_t start; -}; - -struct graph_stats_cmd_tokens { - cmdline_fixed_string_t show; - cmdline_fixed_string_t graph; - cmdline_fixed_string_t stats; -}; - -struct graph_config_cmd_tokens { - cmdline_fixed_string_t graph; - cmdline_fixed_string_t usecase; - cmdline_fixed_string_t bsz; - cmdline_fixed_string_t tmo; - cmdline_fixed_string_t coremask; - cmdline_fixed_string_t model; - cmdline_fixed_string_t capt_ena; - cmdline_fixed_string_t capt_pkts_count; - cmdline_fixed_string_t capt_file; - cmdline_fixed_string_t model_name; - cmdline_fixed_string_t pcap_file; - uint16_t size; - uint64_t ns; - uint64_t mask; - uint64_t num_pcap_pkts; - uint8_t pcap_ena; -}; - enum graph_model { GRAPH_MODEL_RTC = 0x01, GRAPH_MODEL_MCD = 0x02, diff --git a/app/graph/ip4_route.c b/app/graph/ip4_route.c index fc83586427..48ea912597 100644 --- a/app/graph/ip4_route.c +++ b/app/graph/ip4_route.c @@ -20,7 +20,6 @@ cmd_ipv4_lookup_help[] = "ipv4_lookup route add ipv4 netmask via msg_out_len_max -= len; } -static void -cli_ipv4_lookup(void *parsed_result, __rte_unused struct cmdline *cl, void *data __rte_unused) +void +cmd_ipv4_lookup_route_add_ipv4_parsed(void *parsed_result, __rte_unused struct cmdline *cl, + void *data __rte_unused) { - struct ip4_lookup_cmd_tokens *res = parsed_result; + struct cmd_ipv4_lookup_route_add_ipv4_result *res = parsed_result; struct route_ipv4_config config; int rc = -EINVAL; - if (parser_ip4_read(&config.ip, res->ip)) { - printf(MSG_ARG_INVALID, "ipv4"); - return; - } - - if (parser_ip4_read(&config.netmask, res->mask)) { - printf(MSG_ARG_INVALID, "netmask"); - return; - } - - if (parser_ip4_read(&config.via, res->via_ip)) { - printf(MSG_ARG_INVALID, "via ip"); - return; - } + config.ip = rte_be_to_cpu_32(res->ip.addr.ipv4.s_addr); + config.netmask = rte_be_to_cpu_32(res->mask.addr.ipv4.s_addr); + config.via = rte_be_to_cpu_32(res->via_ip.addr.ipv4.s_addr); rc = route_ip4_add(&config); if (rc < 0) - printf(MSG_CMD_FAIL, res->cmd); + printf(MSG_CMD_FAIL, res->ipv4_lookup); } - -cmdline_parse_token_string_t ip4_lookup_cmd = - TOKEN_STRING_INITIALIZER(struct ip4_lookup_cmd_tokens, cmd, "ipv4_lookup"); -cmdline_parse_token_string_t ip4_lookup_route = - TOKEN_STRING_INITIALIZER(struct ip4_lookup_cmd_tokens, route, "route"); -cmdline_parse_token_string_t ip4_lookup_add = - TOKEN_STRING_INITIALIZER(struct ip4_lookup_cmd_tokens, add, "add"); -cmdline_parse_token_string_t ip4_lookup_ip4 = - TOKEN_STRING_INITIALIZER(struct ip4_lookup_cmd_tokens, ip4, "ipv4"); -cmdline_parse_token_string_t ip4_lookup_ip = - TOKEN_STRING_INITIALIZER(struct ip4_lookup_cmd_tokens, ip, NULL); -cmdline_parse_token_string_t ip4_lookup_netmask = - TOKEN_STRING_INITIALIZER(struct ip4_lookup_cmd_tokens, netmask, "netmask"); -cmdline_parse_token_string_t ip4_lookup_mask = - TOKEN_STRING_INITIALIZER(struct ip4_lookup_cmd_tokens, mask, NULL); -cmdline_parse_token_string_t ip4_lookup_via = - TOKEN_STRING_INITIALIZER(struct ip4_lookup_cmd_tokens, via, "via"); -cmdline_parse_token_string_t ip4_lookup_via_ip = - TOKEN_STRING_INITIALIZER(struct ip4_lookup_cmd_tokens, via_ip, NULL); - -cmdline_parse_inst_t ipv4_lookup_cmd_ctx = { - .f = cli_ipv4_lookup, - .data = NULL, - .help_str = cmd_ipv4_lookup_help, - .tokens = { - (void *)&ip4_lookup_cmd, - (void *)&ip4_lookup_route, - (void *)&ip4_lookup_add, - (void *)&ip4_lookup_ip4, - (void *)&ip4_lookup_ip, - (void *)&ip4_lookup_netmask, - (void *)&ip4_lookup_mask, - (void *)&ip4_lookup_via, - (void *)&ip4_lookup_via_ip, - NULL, - }, -}; - -cmdline_parse_token_string_t ipv4_lookup_help_cmd = - TOKEN_STRING_INITIALIZER(struct ipv4_lookup_help_cmd_tokens, cmd, "help"); -cmdline_parse_token_string_t ipv4_lookup_help_module = - TOKEN_STRING_INITIALIZER(struct ipv4_lookup_help_cmd_tokens, module, "ipv4_lookup"); - -cmdline_parse_inst_t ipv4_lookup_help_cmd_ctx = { - .f = cli_ipv4_lookup_help, - .data = NULL, - .help_str = "", - .tokens = { - (void *)&ipv4_lookup_help_cmd, - (void *)&ipv4_lookup_help_module, - NULL, - }, -}; diff --git a/app/graph/ip6_route.c b/app/graph/ip6_route.c index 1fa4865220..834719ecae 100644 --- a/app/graph/ip6_route.c +++ b/app/graph/ip6_route.c @@ -132,9 +132,9 @@ route_ip6_add_to_lookup(void) return 0; } -static void -cli_ipv6_lookup_help(__rte_unused void *parsed_result, __rte_unused struct cmdline *cl, - __rte_unused void *data) +void +cmd_help_ipv6_lookup_parsed(__rte_unused void *parsed_result, __rte_unused struct cmdline *cl, + __rte_unused void *data) { size_t len; @@ -148,82 +148,24 @@ cli_ipv6_lookup_help(__rte_unused void *parsed_result, __rte_unused struct cmdli conn->msg_out_len_max -= len; } -static void -cli_ipv6_lookup(void *parsed_result, __rte_unused struct cmdline *cl, void *data __rte_unused) +void +cmd_ipv6_lookup_route_add_ipv6_parsed(void *parsed_result, __rte_unused struct cmdline *cl, + void *data __rte_unused) { - struct ip6_lookup_cmd_tokens *res = parsed_result; + struct cmd_ipv6_lookup_route_add_ipv6_result *res = parsed_result; struct route_ipv6_config config; - int rc = -EINVAL; + int rc = -EINVAL, i; - if (parser_ip6_read(config.ip, res->ip)) { - printf(MSG_ARG_INVALID, "ipv6"); - return; - } + for (i = 0; i < ETHDEV_IPV6_ADDR_LEN; i++) + config.ip[i] = res->ip.addr.ipv6.s6_addr[i]; - if (parser_ip6_read(config.mask, res->mask)) { - printf(MSG_ARG_INVALID, "netmask"); - return; - } + for (i = 0; i < ETHDEV_IPV6_ADDR_LEN; i++) + config.mask[i] = res->mask.addr.ipv6.s6_addr[i]; - if (parser_ip6_read(config.gateway, res->via_ip)) { - printf(MSG_ARG_INVALID, "gateway ip"); - return; - } + for (i = 0; i < ETHDEV_IPV6_ADDR_LEN; i++) + config.gateway[i] = res->via_ip.addr.ipv6.s6_addr[i]; rc = route_ip6_add(&config); if (rc) - printf(MSG_CMD_FAIL, res->cmd); + printf(MSG_CMD_FAIL, res->ipv6_lookup); } - -cmdline_parse_token_string_t ip6_lookup_cmd = - TOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, cmd, "ipv6_lookup"); -cmdline_parse_token_string_t ip6_lookup_route = - TOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, route, "route"); -cmdline_parse_token_string_t ip6_lookup_add = - TOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, add, "add"); -cmdline_parse_token_string_t ip6_lookup_ip6 = - TOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, ip6, "ipv6"); -cmdline_parse_token_string_t ip6_lookup_ip = - TOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, ip, NULL); -cmdline_parse_token_string_t ip6_lookup_netmask = - TOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, netmask, "netmask"); -cmdline_parse_token_string_t ip6_lookup_mask = - TOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, mask, NULL); -cmdline_parse_token_string_t ip6_lookup_via = - TOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, via, "via"); -cmdline_parse_token_string_t ip6_lookup_via_ip = - TOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, via_ip, NULL); - -cmdline_parse_inst_t ipv6_lookup_cmd_ctx = { - .f = cli_ipv6_lookup, - .data = NULL, - .help_str = cmd_ipv6_lookup_help, - .tokens = { - (void *)&ip6_lookup_cmd, - (void *)&ip6_lookup_route, - (void *)&ip6_lookup_add, - (void *)&ip6_lookup_ip6, - (void *)&ip6_lookup_ip, - (void *)&ip6_lookup_netmask, - (void *)&ip6_lookup_mask, - (void *)&ip6_lookup_via, - (void *)&ip6_lookup_via_ip, - NULL, - }, -}; - -cmdline_parse_token_string_t ipv6_lookup_help_cmd = - TOKEN_STRING_INITIALIZER(struct ipv6_lookup_help_cmd_tokens, cmd, "help"); -cmdline_parse_token_string_t ipv6_lookup_help_module = - TOKEN_STRING_INITIALIZER(struct ipv6_lookup_help_cmd_tokens, module, "ipv6_lookup"); - -cmdline_parse_inst_t ipv6_lookup_help_cmd_ctx = { - .f = cli_ipv6_lookup_help, - .data = NULL, - .help_str = "", - .tokens = { - (void *)&ipv6_lookup_help_cmd, - (void *)&ipv6_lookup_help_module, - NULL, - }, -}; diff --git a/app/graph/mempool.c b/app/graph/mempool.c index 9fd3f8460b..fbb0ca8f05 100644 --- a/app/graph/mempool.c +++ b/app/graph/mempool.c @@ -47,9 +47,9 @@ mempool_process(struct mempool_config *config) return 0; } -static void -cli_mempool_help(__rte_unused void *parsed_result, __rte_unused struct cmdline *cl, - __rte_unused void *data) +void +cmd_help_mempool_parsed(__rte_unused void *parsed_result, __rte_unused struct cmdline *cl, + __rte_unused void *data) { size_t len; @@ -63,10 +63,10 @@ cli_mempool_help(__rte_unused void *parsed_result, __rte_unused struct cmdline * conn->msg_out_len_max -= len; } -static void -cli_mempool(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data) +void +cmd_mempool_parsed(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data) { - struct mempool_config_cmd_tokens *res = parsed_result; + struct cmd_mempool_result *res = parsed_result; struct mempool_config config; int rc = -EINVAL; @@ -82,59 +82,3 @@ cli_mempool(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused v if (rc < 0) printf(MSG_CMD_FAIL, "mempool"); } - -cmdline_parse_token_string_t mempool_config_add_mempool = - TOKEN_STRING_INITIALIZER(struct mempool_config_cmd_tokens, mempool, "mempool"); -cmdline_parse_token_string_t mempool_config_add_name = - TOKEN_STRING_INITIALIZER(struct mempool_config_cmd_tokens, name, NULL); -cmdline_parse_token_string_t mempool_config_add_size = - TOKEN_STRING_INITIALIZER(struct mempool_config_cmd_tokens, size, "size"); -cmdline_parse_token_num_t mempool_config_add_buf_sz = - TOKEN_NUM_INITIALIZER(struct mempool_config_cmd_tokens, buf_sz, RTE_UINT16); -cmdline_parse_token_string_t mempool_config_add_buffers = - TOKEN_STRING_INITIALIZER(struct mempool_config_cmd_tokens, buffers, "buffers"); -cmdline_parse_token_num_t mempool_config_add_nb_bufs = - TOKEN_NUM_INITIALIZER(struct mempool_config_cmd_tokens, nb_bufs, RTE_UINT16); -cmdline_parse_token_string_t mempool_config_add_cache = - TOKEN_STRING_INITIALIZER(struct mempool_config_cmd_tokens, cache, "cache"); -cmdline_parse_token_num_t mempool_config_add_cache_size = - TOKEN_NUM_INITIALIZER(struct mempool_config_cmd_tokens, cache_size, RTE_UINT16); -cmdline_parse_token_string_t mempool_config_add_numa = - TOKEN_STRING_INITIALIZER(struct mempool_config_cmd_tokens, numa, "numa"); -cmdline_parse_token_num_t mempool_config_add_node = - TOKEN_NUM_INITIALIZER(struct mempool_config_cmd_tokens, node, RTE_UINT16); - -cmdline_parse_inst_t mempool_config_cmd_ctx = { - .f = cli_mempool, - .data = NULL, - .help_str = cmd_mempool_help, - .tokens = { - (void *)&mempool_config_add_mempool, - (void *)&mempool_config_add_name, - (void *)&mempool_config_add_size, - (void *)&mempool_config_add_buf_sz, - (void *)&mempool_config_add_buffers, - (void *)&mempool_config_add_nb_bufs, - (void *)&mempool_config_add_cache, - (void *)&mempool_config_add_cache_size, - (void *)&mempool_config_add_numa, - (void *)&mempool_config_add_node, - NULL, - }, -}; - -cmdline_parse_token_string_t mempool_help_cmd = - TOKEN_STRING_INITIALIZER(struct mempool_help_cmd_tokens, help, "help"); -cmdline_parse_token_string_t mempool_help_mempool = - TOKEN_STRING_INITIALIZER(struct mempool_help_cmd_tokens, mempool, "mempool"); - -cmdline_parse_inst_t mempool_help_cmd_ctx = { - .f = cli_mempool_help, - .data = NULL, - .help_str = "", - .tokens = { - (void *)&mempool_help_cmd, - (void *)&mempool_help_mempool, - NULL, - }, -}; diff --git a/app/graph/mempool.h b/app/graph/mempool.h index 0808c4259e..dc6e37dac1 100644 --- a/app/graph/mempool.h +++ b/app/graph/mempool.h @@ -16,9 +16,6 @@ struct mempool_config { int numa_node; }; -extern cmdline_parse_inst_t mempool_config_cmd_ctx; -extern cmdline_parse_inst_t mempool_help_cmd_ctx; - int mempool_process(struct mempool_config *config); #endif diff --git a/app/graph/mempool_priv.h b/app/graph/mempool_priv.h index 3ce64702a9..5a55722b32 100644 --- a/app/graph/mempool_priv.h +++ b/app/graph/mempool_priv.h @@ -7,24 +7,6 @@ #include "mempool.h" -struct mempool_config_cmd_tokens { - cmdline_fixed_string_t mempool; - cmdline_fixed_string_t size; - cmdline_fixed_string_t buffers; - cmdline_fixed_string_t cache; - cmdline_fixed_string_t numa; - cmdline_fixed_string_t name; - uint16_t buf_sz; - uint16_t nb_bufs; - uint16_t cache_size; - uint16_t node; -}; - -struct mempool_help_cmd_tokens { - cmdline_fixed_string_t help; - cmdline_fixed_string_t mempool; -}; - struct mempools { struct mempool_config config[RTE_MAX_ETHPORTS]; struct rte_mempool *mp[RTE_MAX_ETHPORTS]; diff --git a/app/graph/meson.build b/app/graph/meson.build index 5b0f966d99..9cb62f493e 100644 --- a/app/graph/meson.build +++ b/app/graph/meson.build @@ -23,3 +23,11 @@ sources = files( 'neigh.c', 'utils.c', ) + +cmd_h = custom_target('commands_hdr', + output: 'commands.h', + input: files('commands.list'), + capture: true, + command: [cmdline_gen_cmd, '--context-name=modules_ctx', '@INPUT@'] +) +sources += cmd_h diff --git a/app/graph/module_api.h b/app/graph/module_api.h index 7193e0b616..6bf63278fa 100644 --- a/app/graph/module_api.h +++ b/app/graph/module_api.h @@ -10,6 +10,7 @@ #include "cli.h" #include "conn.h" +#include "commands.h" #include "ethdev.h" #include "ethdev_rx.h" #include "graph.h" diff --git a/app/graph/neigh.c b/app/graph/neigh.c index 22be7361e3..79fd542c89 100644 --- a/app/graph/neigh.c +++ b/app/graph/neigh.c @@ -235,18 +235,16 @@ neigh_ip6_add_to_rewrite(void) return 0; } -static void -cli_neigh_v4(void *parsed_result, __rte_unused struct cmdline *cl, void *data __rte_unused) +void +cmd_neigh_add_ipv4_parsed(void *parsed_result, __rte_unused struct cmdline *cl, + void *data __rte_unused) { - struct neigh_v4_cmd_tokens *res = parsed_result; + struct cmd_neigh_add_ipv4_result *res = parsed_result; int rc = -EINVAL; uint64_t mac; uint32_t ip; - if (parser_ip4_read(&ip, res->ip)) { - printf(MSG_ARG_INVALID, "ip"); - return; - } + ip = rte_be_to_cpu_32(res->ip.addr.ipv4.s_addr); if (parser_mac_read(&mac, res->mac)) { printf(MSG_ARG_INVALID, "mac"); @@ -255,21 +253,20 @@ cli_neigh_v4(void *parsed_result, __rte_unused struct cmdline *cl, void *data __ rc = neigh_ip4_add(ip, mac); if (rc < 0) - printf(MSG_CMD_FAIL, res->cmd); + printf(MSG_CMD_FAIL, res->neigh); } -static void -cli_neigh_v6(void *parsed_result, __rte_unused struct cmdline *cl, void *data __rte_unused) +void +cmd_neigh_add_ipv6_parsed(void *parsed_result, __rte_unused struct cmdline *cl, + void *data __rte_unused) { - struct neigh_v6_cmd_tokens *res = parsed_result; + struct cmd_neigh_add_ipv6_result *res = parsed_result; uint8_t ip[ETHDEV_IPV6_ADDR_LEN]; - int rc = -EINVAL; + int rc = -EINVAL, i; uint64_t mac; - if (parser_ip6_read(ip, res->ip)) { - printf(MSG_ARG_INVALID, "ip"); - return; - } + for (i = 0; i < ETHDEV_IPV6_ADDR_LEN; i++) + ip[i] = res->ip.addr.ipv6.s6_addr[i]; if (parser_mac_read(&mac, res->mac)) { printf(MSG_ARG_INVALID, "mac"); @@ -278,12 +275,12 @@ cli_neigh_v6(void *parsed_result, __rte_unused struct cmdline *cl, void *data __ rc = neigh_ip6_add(ip, mac); if (rc < 0) - printf(MSG_CMD_FAIL, res->cmd); + printf(MSG_CMD_FAIL, res->neigh); } -static void -cli_neigh_help(__rte_unused void *parsed_result, __rte_unused struct cmdline *cl, - __rte_unused void *data) +void +cmd_help_neigh_parsed(__rte_unused void *parsed_result, __rte_unused struct cmdline *cl, + __rte_unused void *data) { size_t len; @@ -296,69 +293,3 @@ cli_neigh_help(__rte_unused void *parsed_result, __rte_unused struct cmdline *cl len = strlen(conn->msg_out); conn->msg_out_len_max -= len; } - -cmdline_parse_token_string_t neigh_v4_cmd = - TOKEN_STRING_INITIALIZER(struct neigh_v4_cmd_tokens, cmd, "neigh"); -cmdline_parse_token_string_t neigh_v4_add = - TOKEN_STRING_INITIALIZER(struct neigh_v4_cmd_tokens, add, "add"); -cmdline_parse_token_string_t neigh_v4_ip4 = - TOKEN_STRING_INITIALIZER(struct neigh_v4_cmd_tokens, ip4, "ipv4"); -cmdline_parse_token_string_t neigh_v4_ip = - TOKEN_STRING_INITIALIZER(struct neigh_v4_cmd_tokens, ip, NULL); -cmdline_parse_token_string_t neigh_v4_mac = - TOKEN_STRING_INITIALIZER(struct neigh_v4_cmd_tokens, mac, NULL); - -cmdline_parse_inst_t neigh_v4_cmd_ctx = { - .f = cli_neigh_v4, - .data = NULL, - .help_str = cmd_neigh_v4_help, - .tokens = { - (void *)&neigh_v4_cmd, - (void *)&neigh_v4_add, - (void *)&neigh_v4_ip4, - (void *)&neigh_v4_ip, - (void *)&neigh_v4_mac, - NULL, - }, -}; - -cmdline_parse_token_string_t neigh_v6_cmd = - TOKEN_STRING_INITIALIZER(struct neigh_v6_cmd_tokens, cmd, "neigh"); -cmdline_parse_token_string_t neigh_v6_add = - TOKEN_STRING_INITIALIZER(struct neigh_v6_cmd_tokens, add, "add"); -cmdline_parse_token_string_t neigh_v6_ip6 = - TOKEN_STRING_INITIALIZER(struct neigh_v6_cmd_tokens, ip6, "ipv6"); -cmdline_parse_token_string_t neigh_v6_ip = - TOKEN_STRING_INITIALIZER(struct neigh_v6_cmd_tokens, ip, NULL); -cmdline_parse_token_string_t neigh_v6_mac = - TOKEN_STRING_INITIALIZER(struct neigh_v6_cmd_tokens, mac, NULL); - -cmdline_parse_inst_t neigh_v6_cmd_ctx = { - .f = cli_neigh_v6, - .data = NULL, - .help_str = cmd_neigh_v6_help, - .tokens = { - (void *)&neigh_v6_cmd, - (void *)&neigh_v6_add, - (void *)&neigh_v6_ip6, - (void *)&neigh_v6_ip, - (void *)&neigh_v6_mac, - NULL, - }, -}; - -cmdline_parse_token_string_t neigh_help_cmd = - TOKEN_STRING_INITIALIZER(struct neigh_help_cmd_tokens, cmd, "help"); -cmdline_parse_token_string_t neigh_help_module = - TOKEN_STRING_INITIALIZER(struct neigh_help_cmd_tokens, module, "neigh"); - -cmdline_parse_inst_t neigh_help_cmd_ctx = { - .f = cli_neigh_help, - .data = NULL, - .help_str = "", - .tokens = { - (void *)&neigh_help_cmd, - (void *)&neigh_help_module, - NULL, - }, -}; diff --git a/app/graph/neigh.h b/app/graph/neigh.h index 928981fc31..2688bd9434 100644 --- a/app/graph/neigh.h +++ b/app/graph/neigh.h @@ -5,10 +5,6 @@ #ifndef APP_GRAPH_NEIGH_H #define APP_GRAPH_NEIGH_H -extern cmdline_parse_inst_t neigh_v4_cmd_ctx; -extern cmdline_parse_inst_t neigh_v6_cmd_ctx; -extern cmdline_parse_inst_t neigh_help_cmd_ctx; - void neigh4_list_clean(void); void neigh6_list_clean(void); int neigh_ip4_add_to_rewrite(void); diff --git a/app/graph/neigh_priv.h b/app/graph/neigh_priv.h index 0ec9b1510f..1a7106c309 100644 --- a/app/graph/neigh_priv.h +++ b/app/graph/neigh_priv.h @@ -7,27 +7,6 @@ #define MAX_NEIGH_ENTRIES 32 -struct neigh_v4_cmd_tokens { - cmdline_fixed_string_t cmd; - cmdline_fixed_string_t add; - cmdline_fixed_string_t ip4; - cmdline_fixed_string_t ip; - cmdline_fixed_string_t mac; -}; - -struct neigh_v6_cmd_tokens { - cmdline_fixed_string_t cmd; - cmdline_fixed_string_t add; - cmdline_fixed_string_t ip6; - cmdline_fixed_string_t ip; - cmdline_fixed_string_t mac; -}; - -struct neigh_help_cmd_tokens { - cmdline_fixed_string_t cmd; - cmdline_fixed_string_t module; -}; - struct neigh_ipv4_config { TAILQ_ENTRY(neigh_ipv4_config) next; uint32_t ip; diff --git a/app/graph/route.h b/app/graph/route.h index 0d271d1350..23a7951d2d 100644 --- a/app/graph/route.h +++ b/app/graph/route.h @@ -7,11 +7,6 @@ #define MAX_ROUTE_ENTRIES 32 -extern cmdline_parse_inst_t ipv4_lookup_cmd_ctx; -extern cmdline_parse_inst_t ipv6_lookup_cmd_ctx; -extern cmdline_parse_inst_t ipv4_lookup_help_cmd_ctx; -extern cmdline_parse_inst_t ipv6_lookup_help_cmd_ctx; - struct route_ipv4_config { TAILQ_ENTRY(route_ipv4_config) next; uint32_t ip; diff --git a/app/graph/route_priv.h b/app/graph/route_priv.h index f363a551a9..6a30711acd 100644 --- a/app/graph/route_priv.h +++ b/app/graph/route_priv.h @@ -7,38 +7,4 @@ #define MAX_ROUTE_ENTRIES 32 -struct ip4_lookup_cmd_tokens { - cmdline_fixed_string_t cmd; - cmdline_fixed_string_t route; - cmdline_fixed_string_t add; - cmdline_fixed_string_t ip4; - cmdline_fixed_string_t ip; - cmdline_fixed_string_t netmask; - cmdline_fixed_string_t mask; - cmdline_fixed_string_t via; - cmdline_fixed_string_t via_ip; -}; - -struct ip6_lookup_cmd_tokens { - cmdline_fixed_string_t cmd; - cmdline_fixed_string_t route; - cmdline_fixed_string_t add; - cmdline_fixed_string_t ip6; - cmdline_fixed_string_t ip; - cmdline_fixed_string_t netmask; - cmdline_fixed_string_t mask; - cmdline_fixed_string_t via; - cmdline_fixed_string_t via_ip; -}; - -struct ipv4_lookup_help_cmd_tokens { - cmdline_fixed_string_t cmd; - cmdline_fixed_string_t module; -}; - -struct ipv6_lookup_help_cmd_tokens { - cmdline_fixed_string_t cmd; - cmdline_fixed_string_t module; -}; - #endif -- 2.25.1