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 067384372C; Mon, 18 Dec 2023 09:49:10 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EA5F640276; Mon, 18 Dec 2023 09:49:09 +0100 (CET) Received: from mail-qt1-f177.google.com (mail-qt1-f177.google.com [209.85.160.177]) by mails.dpdk.org (Postfix) with ESMTP id 57EE84026A for ; Mon, 18 Dec 2023 09:49:07 +0100 (CET) Received: by mail-qt1-f177.google.com with SMTP id d75a77b69052e-4259c7dfb63so20717761cf.1 for ; Mon, 18 Dec 2023 00:49:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702889347; x=1703494147; darn=dpdk.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=t32A1N8u+5tXiv4nRaIN0m3qc6mARSF1gpAq6NBPnKE=; b=YZ2qLqTrLrF+s9f9jrgpYM0sBoWDqMpP/6lBpwgMr97MHXYDXMq4lZrSVp3yWG7gR5 hztVrNdKsRaeaMgygGwOT+HIofQEtn1tnG5m4ApK3RX5nJaafTHPV6C0osISoGA1XeSV L5x1hIPGtxOVkpjNMBOZHV14NespjwtROP7F2pjiWoCHcgfNAwn9O0CUmgAn4DLqGzFs MRF150Xz4WcBeqQHJWQ+IRKWwUNVWvapQ/1oBg573W3ChUQG8CEk4PErS7asKwIi04qx i+49kxlkdmwjz413NGN/YKW1WCCkJ54gF5j0fD3UK0KtZ/X6FJcmxUoSE3FbxR+p3dJb 95mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702889347; x=1703494147; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t32A1N8u+5tXiv4nRaIN0m3qc6mARSF1gpAq6NBPnKE=; b=DHDXGOtLhJw/NSKojFOdIojbJD/QQscAT67QkQ5jPd0UTiFXxsLkTxRLPNrO2TWNiU 7Oxvtw5phA2/eYiufJbpVv+JllWm5dDh8NP8yb47EKLiAwwBP3QIDA1t7UtWXiL28SSh GPzN2btgALIA6GuEHiSRUKEqzc9SXrDXZv0WhXy+GzWWzo2aogAuSLlVwYelymbUSqQk 0jz3Z0qHrIRqPBk7VJACf3lci4i9NL9f24xU/z4s1LjmOwIaRCjtGSkDTA7gDaeo0HV2 nkcA7pjZGhOCmlAvlP6wHeiOd6CCaGZ++GMzGRisS2b2ejd3W8wgjFvkc6Go3q/Jmkac lR6g== X-Gm-Message-State: AOJu0YwnENCdY8BLGR/MRHkoQK4bOBVZALO1cMjPv0mdPgOidqvcz1UY deaC5rzoxrSqwPnwLmMZCAhKgOC8+JnP4MIpxe4= X-Google-Smtp-Source: AGHT+IEeeNj5tacT26ktW3+hLhF6HedVblGevE+Ey7ryHjmdlbiH0TXaOrFcPt0yHqdHEAA75DHezbJDXIQkWseFLBQ= X-Received: by 2002:a05:622a:64a:b0:425:4043:2a0d with SMTP id a10-20020a05622a064a00b0042540432a0dmr22385554qtb.136.1702889346225; Mon, 18 Dec 2023 00:49:06 -0800 (PST) MIME-Version: 1.0 References: <20231207071205.3008880-1-skori@marvell.com> <20231212170545.209838-1-skori@marvell.com> In-Reply-To: <20231212170545.209838-1-skori@marvell.com> From: Nithin Dabilpuram Date: Mon, 18 Dec 2023 14:18:53 +0530 Message-ID: Subject: Re: [PATCH v2 1/1] app/graph: generate cmdline boilerplate To: skori@marvell.com Cc: Rakesh Kudurumalla , dev@dpdk.org, Bruce Richardson Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 Acked-by: Nithin Dabilpuram On Tue, Dec 12, 2023 at 10:36=E2=80=AFPM wrote: > > 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. > > Signed-off-by: Sunil Kumar Kori > Acked-by: Bruce Richardson > --- > v1..v2: > - Rebase and remove Depends-On: tag as dependent series is applied. > > 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[] =3D { > - (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)>ca= pt_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 <= UINT16>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 Et= hernet device > +ethdev __dev promiscuous <(on,off)>enable # Set promiscuo= us mode on Ethernet device > +ethdev __dev show # Command to du= mp Ethernet device info > +ethdev __dev stats # Command to du= mp 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 ne= ighbour for IPv4 > +neigh add ipv6 ip mac # Add static ne= ighbour 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, voi= d *data __rte_unused) > +void > +cmd_ethdev_dev_mtu_parsed(void *parsed_result, __rte_unused struct cmdli= ne *cl, > + void *data __rte_unused) > { > - struct ethdev_mtu_cmd_tokens *res =3D parsed_result; > + struct cmd_ethdev_dev_mtu_result *res =3D parsed_result; > int rc =3D -EINVAL; > > rc =3D 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 *c= l, void *data __rte_unused) > +void > +cmd_ethdev_dev_promiscuous_parsed(void *parsed_result, __rte_unused stru= ct cmdline *cl, > + void *data __rte_unused) > { > - struct ethdev_prom_mode_cmd_tokens *res =3D parsed_result; > + struct cmd_ethdev_dev_promiscuous_result *res =3D parsed_result; > bool enable =3D false; > int rc =3D -EINVAL; > > @@ -583,57 +583,49 @@ cli_ethdev_prom_mode(void *parsed_result, __rte_unu= sed struct cmdline *cl, void > > rc =3D 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 str= uct cmdline *cl, > + void *data __rte_unused) > { > - struct ethdev_ip4_cmd_tokens *res =3D parsed_result; > + struct cmd_ethdev_dev_ip4_addr_add_result *res =3D parsed_result; > struct ipv4_addr_config config; > int rc =3D -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 =3D rte_be_to_cpu_32(res->ip.addr.ipv4.s_addr); > + config.mask =3D rte_be_to_cpu_32(res->mask.addr.ipv4.s_addr); > > rc =3D 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 str= uct cmdline *cl, > + void *data __rte_unused) > { > - struct ethdev_ip6_cmd_tokens *res =3D parsed_result; > + struct cmd_ethdev_dev_ip6_addr_add_result *res =3D parsed_result; > struct ipv6_addr_config config; > - int rc =3D -EINVAL; > + int rc =3D -EINVAL, i; > > - if (parser_ip6_read(config.ip, res->ip)) { > - printf(MSG_ARG_INVALID, "ip"); > - return; > - } > + for (i =3D 0; i < ETHDEV_IPV6_ADDR_LEN; i++) > + config.ip[i] =3D res->ip.addr.ipv6.s6_addr[i]; > > - if (parser_ip6_read(config.mask, res->mask)) { > - printf(MSG_ARG_INVALID, "netmask"); > - return; > - } > + for (i =3D 0; i < ETHDEV_IPV6_ADDR_LEN; i++) > + config.mask[i] =3D res->mask.addr.ipv6.s6_addr[i]; > > rc =3D 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, vo= id *data __rte_unused) > +void > +cmd_ethdev_dev_show_parsed(void *parsed_result, __rte_unused struct cmdl= ine *cl, > + void *data __rte_unused) > { > - struct ethdev_show_cmd_tokens *res =3D parsed_result; > + struct cmd_ethdev_dev_show_result *res =3D parsed_result; > int rc =3D -EINVAL; > > rc =3D ethdev_show(res->dev); > @@ -641,10 +633,11 @@ cli_ethdev_show(void *parsed_result, __rte_unused s= truct cmdline *cl, void *data > printf(MSG_ARG_INVALID, res->dev); > } > > -static void > -cli_ethdev_stats(void *parsed_result, __rte_unused struct cmdline *cl, v= oid *data __rte_unused) > +void > +cmd_ethdev_dev_stats_parsed(void *parsed_result, __rte_unused struct cmd= line *cl, > + void *data __rte_unused) > { > - struct ethdev_stats_cmd_tokens *res =3D parsed_result; > + struct cmd_ethdev_dev_stats_result *res =3D parsed_result; > int rc =3D -EINVAL; > > rc =3D 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 *d= ata __rte_unused) > +void > +cmd_ethdev_parsed(void *parsed_result, __rte_unused struct cmdline *cl, = void *data __rte_unused) > { > - struct ethdev_cmd_tokens *res =3D parsed_result; > + struct cmd_ethdev_result *res =3D 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 =3D 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 cm= dline *cl, > - __rte_unused void *data) > +void > +cmd_help_ethdev_parsed(__rte_unused void *parsed_result, __rte_unused st= ruct 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 =3D strlen(conn->msg_out); > conn->msg_out_len_max -=3D len; > } > - > -cmdline_parse_token_string_t ethdev_stats_cmd =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_stats_cmd_tokens, cmd, "et= hdev"); > -cmdline_parse_token_string_t ethdev_stats_dev =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_stats_cmd_tokens, dev, NUL= L); > -cmdline_parse_token_string_t ethdev_stats_stats =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_stats_cmd_tokens, stats, "= stats"); > - > -cmdline_parse_inst_t ethdev_stats_cmd_ctx =3D { > - .f =3D cli_ethdev_stats, > - .data =3D NULL, > - .help_str =3D "", > - .tokens =3D { > - (void *)ðdev_stats_cmd, > - (void *)ðdev_stats_dev, > - (void *)ðdev_stats_stats, > - NULL, > - }, > -}; > - > -cmdline_parse_token_string_t ethdev_show_cmd =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_show_cmd_tokens, cmd, "eth= dev"); > -cmdline_parse_token_string_t ethdev_show_dev =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_show_cmd_tokens, dev, NULL= ); > -cmdline_parse_token_string_t ethdev_show_show =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_show_cmd_tokens, show, "sh= ow"); > - > -cmdline_parse_inst_t ethdev_show_cmd_ctx =3D { > - .f =3D cli_ethdev_show, > - .data =3D NULL, > - .help_str =3D cmd_ethdev_show_help, > - .tokens =3D { > - (void *)ðdev_show_cmd, > - (void *)ðdev_show_dev, > - (void *)ðdev_show_show, > - NULL, > - }, > -}; > - > -cmdline_parse_token_string_t ethdev_mtu_cmd =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_mtu_cmd_tokens, cmd, "ethd= ev"); > -cmdline_parse_token_string_t ethdev_mtu_dev =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_mtu_cmd_tokens, dev, NULL)= ; > -cmdline_parse_token_string_t ethdev_mtu_mtu =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_mtu_cmd_tokens, mtu, "mtu"= ); > -cmdline_parse_token_num_t ethdev_mtu_size =3D > - TOKEN_NUM_INITIALIZER(struct ethdev_mtu_cmd_tokens, size, RTE_UIN= T16); > - > -cmdline_parse_inst_t ethdev_mtu_cmd_ctx =3D { > - .f =3D cli_ethdev_mtu, > - .data =3D NULL, > - .help_str =3D cmd_ethdev_mtu_help, > - .tokens =3D { > - (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 =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_prom_mode_cmd_tokens, cmd,= "ethdev"); > -cmdline_parse_token_string_t ethdev_prom_mode_dev =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_prom_mode_cmd_tokens, dev,= NULL); > -cmdline_parse_token_string_t ethdev_prom_mode_prom =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_prom_mode_cmd_tokens, prom= , "promiscuous"); > -cmdline_parse_token_string_t ethdev_prom_mode_enable =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_prom_mode_cmd_tokens, enab= le, "on#off"); > - > -cmdline_parse_inst_t ethdev_prom_mode_cmd_ctx =3D { > - .f =3D cli_ethdev_prom_mode, > - .data =3D NULL, > - .help_str =3D cmd_ethdev_prom_mode_help, > - .tokens =3D { > - (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 =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_ip4_cmd_tokens, cmd, "ethd= ev"); > -cmdline_parse_token_string_t ethdev_ip4_dev =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_ip4_cmd_tokens, dev, NULL)= ; > -cmdline_parse_token_string_t ethdev_ip4_ip4 =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_ip4_cmd_tokens, ip4, "ip4"= ); > -cmdline_parse_token_string_t ethdev_ip4_addr =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_ip4_cmd_tokens, addr, "add= r"); > -cmdline_parse_token_string_t ethdev_ip4_add =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_ip4_cmd_tokens, add, "add"= ); > -cmdline_parse_token_string_t ethdev_ip4_ip =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_ip4_cmd_tokens, ip, NULL); > -cmdline_parse_token_string_t ethdev_ip4_netmask =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_ip4_cmd_tokens, netmask, "= netmask"); > -cmdline_parse_token_string_t ethdev_ip4_mask =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_ip4_cmd_tokens, mask, NULL= ); > - > -cmdline_parse_inst_t ethdev_ip4_cmd_ctx =3D { > - .f =3D cli_ip4_addr, > - .data =3D NULL, > - .help_str =3D cmd_ethdev_ip4_addr_help, > - .tokens =3D { > - (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 =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_ip6_cmd_tokens, cmd, "ethd= ev"); > -cmdline_parse_token_string_t ethdev_ip6_dev =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_ip6_cmd_tokens, dev, NULL)= ; > -cmdline_parse_token_string_t ethdev_ip6_ip6 =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_ip6_cmd_tokens, ip6, "ip6"= ); > -cmdline_parse_token_string_t ethdev_ip6_addr =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_ip6_cmd_tokens, addr, "add= r"); > -cmdline_parse_token_string_t ethdev_ip6_add =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_ip6_cmd_tokens, add, "add"= ); > -cmdline_parse_token_string_t ethdev_ip6_ip =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_ip6_cmd_tokens, ip, NULL); > -cmdline_parse_token_string_t ethdev_ip6_netmask =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_ip6_cmd_tokens, netmask, "= netmask"); > -cmdline_parse_token_string_t ethdev_ip6_mask =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_ip6_cmd_tokens, mask, NULL= ); > - > -cmdline_parse_inst_t ethdev_ip6_cmd_ctx =3D { > - .f =3D cli_ip6_addr, > - .data =3D NULL, > - .help_str =3D cmd_ethdev_ip6_addr_help, > - .tokens =3D { > - (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 =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_cmd_tokens, cmd, "ethdev")= ; > -cmdline_parse_token_string_t ethdev_dev =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_cmd_tokens, dev, NULL); > -cmdline_parse_token_string_t ethdev_rxq =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_cmd_tokens, rxq, "rxq"); > -cmdline_parse_token_num_t ethdev_nb_rxq =3D > - TOKEN_NUM_INITIALIZER(struct ethdev_cmd_tokens, nb_rxq, RTE_UINT1= 6); > -cmdline_parse_token_string_t ethdev_txq =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_cmd_tokens, txq, "txq"); > -cmdline_parse_token_num_t ethdev_nb_txq =3D > - TOKEN_NUM_INITIALIZER(struct ethdev_cmd_tokens, nb_txq, RTE_UINT1= 6); > -cmdline_parse_token_string_t ethdev_mempool =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_cmd_tokens, mempool, NULL)= ; > - > -cmdline_parse_inst_t ethdev_cmd_ctx =3D { > - .f =3D cli_ethdev, > - .data =3D NULL, > - .help_str =3D cmd_ethdev_help, > - .tokens =3D { > - (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 =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_help_cmd_tokens, help, "he= lp"); > -cmdline_parse_token_string_t ethdev_help_ethdev =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_help_cmd_tokens, ethdev, "= ethdev"); > - > -cmdline_parse_inst_t ethdev_help_cmd_ctx =3D { > - .f =3D cli_ethdev_help, > - .data =3D NULL, > - .help_str =3D "", > - .tokens =3D { > - (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 =3D strlen(conn->msg_out); > conn->msg_out +=3D 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 =3D strlen(conn->msg_out); > conn->msg_out_len_max -=3D 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 c= mdline *cl, > + void *data __rte_unused) > { > - struct ethdev_rx_cmd_tokens *res =3D parsed_result; > + struct cmd_ethdev_rx_map_port_result *res =3D parsed_result; > int rc =3D -EINVAL; > > rc =3D 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 =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_rx_cmd_tokens, cmd, "ethde= v_rx"); > -cmdline_parse_token_string_t ethdev_rx_map =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_rx_cmd_tokens, map, "map")= ; > -cmdline_parse_token_string_t ethdev_rx_port =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_rx_cmd_tokens, port, "port= "); > -cmdline_parse_token_string_t ethdev_rx_dev =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_rx_cmd_tokens, dev, NULL); > -cmdline_parse_token_string_t ethdev_rx_queue =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_rx_cmd_tokens, queue, "que= ue"); > -cmdline_parse_token_num_t ethdev_rx_qid =3D > - TOKEN_NUM_INITIALIZER(struct ethdev_rx_cmd_tokens, qid, RTE_UINT3= 2); > -cmdline_parse_token_string_t ethdev_rx_core =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_rx_cmd_tokens, core, "core= "); > -cmdline_parse_token_num_t ethdev_rx_core_id =3D > - TOKEN_NUM_INITIALIZER(struct ethdev_rx_cmd_tokens, core_id, RTE_U= INT32); > - > -cmdline_parse_inst_t ethdev_rx_cmd_ctx =3D { > - .f =3D cli_ethdev_rx, > - .data =3D NULL, > - .help_str =3D cmd_ethdev_rx_help, > - .tokens =3D { > - (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 =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_rx_help_cmd_tokens, cmd, "= help"); > -cmdline_parse_token_string_t ethdev_rx_help_module =3D > - TOKEN_STRING_INITIALIZER(struct ethdev_rx_help_cmd_tokens, module= , "ethdev_rx"); > - > -cmdline_parse_inst_t ethdev_rx_help_cmd_ctx =3D { > - .f =3D cli_ethdev_rx_help, > - .data =3D NULL, > - .help_str =3D "", > - .tokens =3D { > - (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.2= 55.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 netma= sk FFFF:FFFF:FFFF:FFFF:FF00:0000:0000:0000 via 5220:DA4F:6870:5220:DA4F:687= 0:5220:DA4A > +ipv6_lookup route add ipv6 6220:DA4F:6870:5220:DA4F:6870:5220:DA4B netma= sk FFFF:FFFF:FFFF:FFFF:FF00:0000:0000:0000 via 6220:DA4F:6870:5220:DA4F:687= 0: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 ne= tmask FFFF:FFFF:FFFF:FFFF:FF00:0000:0000:0000 > +ethdev net_pcap1 ip6 addr add 6220:DA4F:6870:5220:DA4F:6870:5220:DA4B ne= tmask 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 netma= sk FFFF:FFFF:FFFF:FFFF:FF00:0000:0000:0000 via 5220:DA4F:6870:5220:DA4F:687= 0:5220:DA4A > +ipv6_lookup route add ipv6 6220:DA4F:6870:5220:DA4F:6870:5220:DA4B netma= sk FFFF:FFFF:FFFF:FFFF:FF00:0000:0000:0000 via 6220:DA4F:6870:5220:DA4F:687= 0: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[] =3D "graph bsz tmo coremask " > +cmd_graph_help[] =3D "graph coremask bsz tmo= " > "model pcap_enable <0 | 1> num_p= cap_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 cm= dline *cl, > +void > +cmd_graph_stats_show_parsed(__rte_unused void *parsed_result, __rte_unus= ed 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 cm= dline *cl, > +void > +cmd_graph_start_parsed(__rte_unused void *parsed_result, __rte_unused st= ruct 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_un= used void *data) > +void > +cmd_graph_parsed(void *parsed_result, __rte_unused struct cmdline *cl, _= _rte_unused void *data) > { > - struct graph_config_cmd_tokens *res =3D parsed_result; > + struct cmd_graph_result *res =3D parsed_result; > struct graph_config config; > char *model_name; > uint8_t model; > @@ -424,9 +424,9 @@ cli_graph(void *parsed_result, __rte_unused struct cm= dline *cl, __rte_unused voi > } > } > > -static void > -cli_graph_help(__rte_unused void *parsed_result, __rte_unused struct cmd= line *cl, > - __rte_unused void *data) > +void > +cmd_help_graph_parsed(__rte_unused void *parsed_result, __rte_unused str= uct 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 =3D strlen(conn->msg_out); > conn->msg_out_len_max -=3D len; > } > - > -cmdline_parse_token_string_t graph_display_graph =3D > - TOKEN_STRING_INITIALIZER(struct graph_stats_cmd_tokens, graph, "g= raph"); > -cmdline_parse_token_string_t graph_display_stats =3D > - TOKEN_STRING_INITIALIZER(struct graph_stats_cmd_tokens, stats, "s= tats"); > -cmdline_parse_token_string_t graph_display_show =3D > - TOKEN_STRING_INITIALIZER(struct graph_stats_cmd_tokens, show, "sh= ow"); > - > -cmdline_parse_inst_t graph_stats_cmd_ctx =3D { > - .f =3D cli_graph_stats, > - .data =3D NULL, > - .help_str =3D "graph stats show", > - .tokens =3D { > - (void *)&graph_display_graph, > - (void *)&graph_display_stats, > - (void *)&graph_display_show, > - NULL, > - }, > -}; > - > -cmdline_parse_token_string_t graph_config_start_graph =3D > - TOKEN_STRING_INITIALIZER(struct graph_start_cmd_tokens, graph, "g= raph"); > -cmdline_parse_token_string_t graph_config_start =3D > - TOKEN_STRING_INITIALIZER(struct graph_start_cmd_tokens, start, "s= tart"); > - > -cmdline_parse_inst_t graph_start_cmd_ctx =3D { > - .f =3D cli_graph_start, > - .data =3D NULL, > - .help_str =3D "graph start", > - .tokens =3D { > - (void *)&graph_config_start_graph, > - (void *)&graph_config_start, > - NULL, > - }, > -}; > - > -cmdline_parse_token_string_t graph_config_add_graph =3D > - TOKEN_STRING_INITIALIZER(struct graph_config_cmd_tokens, graph, "= graph"); > -cmdline_parse_token_string_t graph_config_add_usecase =3D > - TOKEN_STRING_INITIALIZER(struct graph_config_cmd_tokens, usecase,= NULL); > -cmdline_parse_token_string_t graph_config_add_coremask =3D > - TOKEN_STRING_INITIALIZER(struct graph_config_cmd_tokens, coremask= , "coremask"); > -cmdline_parse_token_num_t graph_config_add_mask =3D > - TOKEN_NUM_INITIALIZER(struct graph_config_cmd_tokens, mask, RTE_U= INT64); > -cmdline_parse_token_string_t graph_config_add_bsz =3D > - TOKEN_STRING_INITIALIZER(struct graph_config_cmd_tokens, bsz, "bs= z"); > -cmdline_parse_token_num_t graph_config_add_size =3D > - TOKEN_NUM_INITIALIZER(struct graph_config_cmd_tokens, size, RTE_U= INT16); > -cmdline_parse_token_string_t graph_config_add_tmo =3D > - TOKEN_STRING_INITIALIZER(struct graph_config_cmd_tokens, tmo, "tm= o"); > -cmdline_parse_token_num_t graph_config_add_ns =3D > - TOKEN_NUM_INITIALIZER(struct graph_config_cmd_tokens, ns, RTE_UIN= T64); > -cmdline_parse_token_string_t graph_config_add_model =3D > - TOKEN_STRING_INITIALIZER(struct graph_config_cmd_tokens, model, "= model"); > -cmdline_parse_token_string_t graph_config_add_model_name =3D > - TOKEN_STRING_INITIALIZER(struct graph_config_cmd_tokens, model_na= me, "rtc#mcd#default"); > -cmdline_parse_token_string_t graph_config_add_capt_ena =3D > - TOKEN_STRING_INITIALIZER(struct graph_config_cmd_tokens, capt_ena= , "pcap_enable"); > -cmdline_parse_token_num_t graph_config_add_pcap_ena =3D > - TOKEN_NUM_INITIALIZER(struct graph_config_cmd_tokens, pcap_ena, R= TE_UINT8); > -cmdline_parse_token_string_t graph_config_add_capt_pkts_count =3D > - TOKEN_STRING_INITIALIZER(struct graph_config_cmd_tokens, capt_pkt= s_count, "num_pcap_pkts"); > -cmdline_parse_token_num_t graph_config_add_num_pcap_pkts =3D > - TOKEN_NUM_INITIALIZER(struct graph_config_cmd_tokens, num_pcap_pk= ts, RTE_UINT64); > -cmdline_parse_token_string_t graph_config_add_capt_file =3D > - TOKEN_STRING_INITIALIZER(struct graph_config_cmd_tokens, capt_fil= e, "pcap_file"); > -cmdline_parse_token_string_t graph_config_add_pcap_file =3D > - TOKEN_STRING_INITIALIZER(struct graph_config_cmd_tokens, pcap_fil= e, NULL); > - > -cmdline_parse_inst_t graph_config_cmd_ctx =3D { > - .f =3D cli_graph, > - .data =3D NULL, > - .help_str =3D cmd_graph_help, > - .tokens =3D { > - (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 =3D > - TOKEN_STRING_INITIALIZER(struct graph_help_cmd_tokens, help, "hel= p"); > -cmdline_parse_token_string_t graph_help_graph =3D > - TOKEN_STRING_INITIALIZER(struct graph_help_cmd_tokens, graph, "gr= aph"); > - > -cmdline_parse_inst_t graph_help_cmd_ctx =3D { > - .f =3D cli_graph_help, > - .data =3D NULL, > - .help_str =3D "", > - .tokens =3D { > - (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 =3D 0x01, > GRAPH_MODEL_MCD =3D 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[] =3D "ipv4_lookup route add ipv4 = netmask via > struct ip4_route route4 =3D TAILQ_HEAD_INITIALIZER(route4); > > - > void > route_ip4_list_clean(void) > { > @@ -127,9 +126,9 @@ route_ip4_add_to_lookup(void) > return 0; > } > > -static void > -cli_ipv4_lookup_help(__rte_unused void *parsed_result, __rte_unused stru= ct cmdline *cl, > - __rte_unused void *data) > +void > +cmd_help_ipv4_lookup_parsed(__rte_unused void *parsed_result, __rte_unus= ed struct cmdline *cl, > + __rte_unused void *data) > { > size_t len; > > @@ -143,82 +142,19 @@ cli_ipv4_lookup_help(__rte_unused void *parsed_resu= lt, __rte_unused struct cmdli > conn->msg_out_len_max -=3D len; > } > > -static void > -cli_ipv4_lookup(void *parsed_result, __rte_unused struct cmdline *cl, vo= id *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 =3D parsed_result; > + struct cmd_ipv4_lookup_route_add_ipv4_result *res =3D parsed_resu= lt; > struct route_ipv4_config config; > int rc =3D -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 =3D rte_be_to_cpu_32(res->ip.addr.ipv4.s_addr); > + config.netmask =3D rte_be_to_cpu_32(res->mask.addr.ipv4.s_addr); > + config.via =3D rte_be_to_cpu_32(res->via_ip.addr.ipv4.s_addr); > > rc =3D 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 =3D > - TOKEN_STRING_INITIALIZER(struct ip4_lookup_cmd_tokens, cmd, "ipv4= _lookup"); > -cmdline_parse_token_string_t ip4_lookup_route =3D > - TOKEN_STRING_INITIALIZER(struct ip4_lookup_cmd_tokens, route, "ro= ute"); > -cmdline_parse_token_string_t ip4_lookup_add =3D > - TOKEN_STRING_INITIALIZER(struct ip4_lookup_cmd_tokens, add, "add"= ); > -cmdline_parse_token_string_t ip4_lookup_ip4 =3D > - TOKEN_STRING_INITIALIZER(struct ip4_lookup_cmd_tokens, ip4, "ipv4= "); > -cmdline_parse_token_string_t ip4_lookup_ip =3D > - TOKEN_STRING_INITIALIZER(struct ip4_lookup_cmd_tokens, ip, NULL); > -cmdline_parse_token_string_t ip4_lookup_netmask =3D > - TOKEN_STRING_INITIALIZER(struct ip4_lookup_cmd_tokens, netmask, "= netmask"); > -cmdline_parse_token_string_t ip4_lookup_mask =3D > - TOKEN_STRING_INITIALIZER(struct ip4_lookup_cmd_tokens, mask, NULL= ); > -cmdline_parse_token_string_t ip4_lookup_via =3D > - TOKEN_STRING_INITIALIZER(struct ip4_lookup_cmd_tokens, via, "via"= ); > -cmdline_parse_token_string_t ip4_lookup_via_ip =3D > - TOKEN_STRING_INITIALIZER(struct ip4_lookup_cmd_tokens, via_ip, NU= LL); > - > -cmdline_parse_inst_t ipv4_lookup_cmd_ctx =3D { > - .f =3D cli_ipv4_lookup, > - .data =3D NULL, > - .help_str =3D cmd_ipv4_lookup_help, > - .tokens =3D { > - (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 =3D > - TOKEN_STRING_INITIALIZER(struct ipv4_lookup_help_cmd_tokens, cmd,= "help"); > -cmdline_parse_token_string_t ipv4_lookup_help_module =3D > - TOKEN_STRING_INITIALIZER(struct ipv4_lookup_help_cmd_tokens, modu= le, "ipv4_lookup"); > - > -cmdline_parse_inst_t ipv4_lookup_help_cmd_ctx =3D { > - .f =3D cli_ipv4_lookup_help, > - .data =3D NULL, > - .help_str =3D "", > - .tokens =3D { > - (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 stru= ct cmdline *cl, > - __rte_unused void *data) > +void > +cmd_help_ipv6_lookup_parsed(__rte_unused void *parsed_result, __rte_unus= ed struct cmdline *cl, > + __rte_unused void *data) > { > size_t len; > > @@ -148,82 +148,24 @@ cli_ipv6_lookup_help(__rte_unused void *parsed_resu= lt, __rte_unused struct cmdli > conn->msg_out_len_max -=3D len; > } > > -static void > -cli_ipv6_lookup(void *parsed_result, __rte_unused struct cmdline *cl, vo= id *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 =3D parsed_result; > + struct cmd_ipv6_lookup_route_add_ipv6_result *res =3D parsed_resu= lt; > struct route_ipv6_config config; > - int rc =3D -EINVAL; > + int rc =3D -EINVAL, i; > > - if (parser_ip6_read(config.ip, res->ip)) { > - printf(MSG_ARG_INVALID, "ipv6"); > - return; > - } > + for (i =3D 0; i < ETHDEV_IPV6_ADDR_LEN; i++) > + config.ip[i] =3D res->ip.addr.ipv6.s6_addr[i]; > > - if (parser_ip6_read(config.mask, res->mask)) { > - printf(MSG_ARG_INVALID, "netmask"); > - return; > - } > + for (i =3D 0; i < ETHDEV_IPV6_ADDR_LEN; i++) > + config.mask[i] =3D 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 =3D 0; i < ETHDEV_IPV6_ADDR_LEN; i++) > + config.gateway[i] =3D res->via_ip.addr.ipv6.s6_addr[i]; > > rc =3D 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 =3D > - TOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, cmd, "ipv6= _lookup"); > -cmdline_parse_token_string_t ip6_lookup_route =3D > - TOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, route, "ro= ute"); > -cmdline_parse_token_string_t ip6_lookup_add =3D > - TOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, add, "add"= ); > -cmdline_parse_token_string_t ip6_lookup_ip6 =3D > - TOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, ip6, "ipv6= "); > -cmdline_parse_token_string_t ip6_lookup_ip =3D > - TOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, ip, NULL); > -cmdline_parse_token_string_t ip6_lookup_netmask =3D > - TOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, netmask, "= netmask"); > -cmdline_parse_token_string_t ip6_lookup_mask =3D > - TOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, mask, NULL= ); > -cmdline_parse_token_string_t ip6_lookup_via =3D > - TOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, via, "via"= ); > -cmdline_parse_token_string_t ip6_lookup_via_ip =3D > - TOKEN_STRING_INITIALIZER(struct ip6_lookup_cmd_tokens, via_ip, NU= LL); > - > -cmdline_parse_inst_t ipv6_lookup_cmd_ctx =3D { > - .f =3D cli_ipv6_lookup, > - .data =3D NULL, > - .help_str =3D cmd_ipv6_lookup_help, > - .tokens =3D { > - (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 =3D > - TOKEN_STRING_INITIALIZER(struct ipv6_lookup_help_cmd_tokens, cmd,= "help"); > -cmdline_parse_token_string_t ipv6_lookup_help_module =3D > - TOKEN_STRING_INITIALIZER(struct ipv6_lookup_help_cmd_tokens, modu= le, "ipv6_lookup"); > - > -cmdline_parse_inst_t ipv6_lookup_help_cmd_ctx =3D { > - .f =3D cli_ipv6_lookup_help, > - .data =3D NULL, > - .help_str =3D "", > - .tokens =3D { > - (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 c= mdline *cl, > - __rte_unused void *data) > +void > +cmd_help_mempool_parsed(__rte_unused void *parsed_result, __rte_unused s= truct 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 -=3D 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 =3D parsed_result; > + struct cmd_mempool_result *res =3D parsed_result; > struct mempool_config config; > int rc =3D -EINVAL; > > @@ -82,59 +82,3 @@ cli_mempool(void *parsed_result, __rte_unused struct c= mdline *cl, __rte_unused v > if (rc < 0) > printf(MSG_CMD_FAIL, "mempool"); > } > - > -cmdline_parse_token_string_t mempool_config_add_mempool =3D > - TOKEN_STRING_INITIALIZER(struct mempool_config_cmd_tokens, mempoo= l, "mempool"); > -cmdline_parse_token_string_t mempool_config_add_name =3D > - TOKEN_STRING_INITIALIZER(struct mempool_config_cmd_tokens, name, = NULL); > -cmdline_parse_token_string_t mempool_config_add_size =3D > - TOKEN_STRING_INITIALIZER(struct mempool_config_cmd_tokens, size, = "size"); > -cmdline_parse_token_num_t mempool_config_add_buf_sz =3D > - TOKEN_NUM_INITIALIZER(struct mempool_config_cmd_tokens, buf_sz, R= TE_UINT16); > -cmdline_parse_token_string_t mempool_config_add_buffers =3D > - TOKEN_STRING_INITIALIZER(struct mempool_config_cmd_tokens, buffer= s, "buffers"); > -cmdline_parse_token_num_t mempool_config_add_nb_bufs =3D > - TOKEN_NUM_INITIALIZER(struct mempool_config_cmd_tokens, nb_bufs, = RTE_UINT16); > -cmdline_parse_token_string_t mempool_config_add_cache =3D > - TOKEN_STRING_INITIALIZER(struct mempool_config_cmd_tokens, cache,= "cache"); > -cmdline_parse_token_num_t mempool_config_add_cache_size =3D > - TOKEN_NUM_INITIALIZER(struct mempool_config_cmd_tokens, cache_siz= e, RTE_UINT16); > -cmdline_parse_token_string_t mempool_config_add_numa =3D > - TOKEN_STRING_INITIALIZER(struct mempool_config_cmd_tokens, numa, = "numa"); > -cmdline_parse_token_num_t mempool_config_add_node =3D > - TOKEN_NUM_INITIALIZER(struct mempool_config_cmd_tokens, node, RTE= _UINT16); > - > -cmdline_parse_inst_t mempool_config_cmd_ctx =3D { > - .f =3D cli_mempool, > - .data =3D NULL, > - .help_str =3D cmd_mempool_help, > - .tokens =3D { > - (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 =3D > - TOKEN_STRING_INITIALIZER(struct mempool_help_cmd_tokens, help, "h= elp"); > -cmdline_parse_token_string_t mempool_help_mempool =3D > - TOKEN_STRING_INITIALIZER(struct mempool_help_cmd_tokens, mempool,= "mempool"); > - > -cmdline_parse_inst_t mempool_help_cmd_ctx =3D { > - .f =3D cli_mempool_help, > - .data =3D NULL, > - .help_str =3D "", > - .tokens =3D { > - (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 =3D files( > 'neigh.c', > 'utils.c', > ) > + > +cmd_h =3D custom_target('commands_hdr', > + output: 'commands.h', > + input: files('commands.list'), > + capture: true, > + command: [cmdline_gen_cmd, '--context-name=3Dmodules_ctx', '@INP= UT@'] > +) > +sources +=3D 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 cmdli= ne *cl, > + void *data __rte_unused) > { > - struct neigh_v4_cmd_tokens *res =3D parsed_result; > + struct cmd_neigh_add_ipv4_result *res =3D parsed_result; > int rc =3D -EINVAL; > uint64_t mac; > uint32_t ip; > > - if (parser_ip4_read(&ip, res->ip)) { > - printf(MSG_ARG_INVALID, "ip"); > - return; > - } > + ip =3D 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 stru= ct cmdline *cl, void *data __ > > rc =3D 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 cmdli= ne *cl, > + void *data __rte_unused) > { > - struct neigh_v6_cmd_tokens *res =3D parsed_result; > + struct cmd_neigh_add_ipv6_result *res =3D parsed_result; > uint8_t ip[ETHDEV_IPV6_ADDR_LEN]; > - int rc =3D -EINVAL; > + int rc =3D -EINVAL, i; > uint64_t mac; > > - if (parser_ip6_read(ip, res->ip)) { > - printf(MSG_ARG_INVALID, "ip"); > - return; > - } > + for (i =3D 0; i < ETHDEV_IPV6_ADDR_LEN; i++) > + ip[i] =3D 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 stru= ct cmdline *cl, void *data __ > > rc =3D 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 cmd= line *cl, > - __rte_unused void *data) > +void > +cmd_help_neigh_parsed(__rte_unused void *parsed_result, __rte_unused str= uct cmdline *cl, > + __rte_unused void *data) > { > size_t len; > > @@ -296,69 +293,3 @@ cli_neigh_help(__rte_unused void *parsed_result, __r= te_unused struct cmdline *cl > len =3D strlen(conn->msg_out); > conn->msg_out_len_max -=3D len; > } > - > -cmdline_parse_token_string_t neigh_v4_cmd =3D > - TOKEN_STRING_INITIALIZER(struct neigh_v4_cmd_tokens, cmd, "neigh"= ); > -cmdline_parse_token_string_t neigh_v4_add =3D > - TOKEN_STRING_INITIALIZER(struct neigh_v4_cmd_tokens, add, "add"); > -cmdline_parse_token_string_t neigh_v4_ip4 =3D > - TOKEN_STRING_INITIALIZER(struct neigh_v4_cmd_tokens, ip4, "ipv4")= ; > -cmdline_parse_token_string_t neigh_v4_ip =3D > - TOKEN_STRING_INITIALIZER(struct neigh_v4_cmd_tokens, ip, NULL); > -cmdline_parse_token_string_t neigh_v4_mac =3D > - TOKEN_STRING_INITIALIZER(struct neigh_v4_cmd_tokens, mac, NULL); > - > -cmdline_parse_inst_t neigh_v4_cmd_ctx =3D { > - .f =3D cli_neigh_v4, > - .data =3D NULL, > - .help_str =3D cmd_neigh_v4_help, > - .tokens =3D { > - (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 =3D > - TOKEN_STRING_INITIALIZER(struct neigh_v6_cmd_tokens, cmd, "neigh"= ); > -cmdline_parse_token_string_t neigh_v6_add =3D > - TOKEN_STRING_INITIALIZER(struct neigh_v6_cmd_tokens, add, "add"); > -cmdline_parse_token_string_t neigh_v6_ip6 =3D > - TOKEN_STRING_INITIALIZER(struct neigh_v6_cmd_tokens, ip6, "ipv6")= ; > -cmdline_parse_token_string_t neigh_v6_ip =3D > - TOKEN_STRING_INITIALIZER(struct neigh_v6_cmd_tokens, ip, NULL); > -cmdline_parse_token_string_t neigh_v6_mac =3D > - TOKEN_STRING_INITIALIZER(struct neigh_v6_cmd_tokens, mac, NULL); > - > -cmdline_parse_inst_t neigh_v6_cmd_ctx =3D { > - .f =3D cli_neigh_v6, > - .data =3D NULL, > - .help_str =3D cmd_neigh_v6_help, > - .tokens =3D { > - (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 =3D > - TOKEN_STRING_INITIALIZER(struct neigh_help_cmd_tokens, cmd, "help= "); > -cmdline_parse_token_string_t neigh_help_module =3D > - TOKEN_STRING_INITIALIZER(struct neigh_help_cmd_tokens, module, "n= eigh"); > - > -cmdline_parse_inst_t neigh_help_cmd_ctx =3D { > - .f =3D cli_neigh_help, > - .data =3D NULL, > - .help_str =3D "", > - .tokens =3D { > - (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 >