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 F2FDB431DE; Mon, 23 Oct 2023 09:04:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E2D174064E; Mon, 23 Oct 2023 09:04:51 +0200 (CEST) Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) by mails.dpdk.org (Postfix) with ESMTP id 73B504069F for ; Mon, 23 Oct 2023 09:04:50 +0200 (CEST) Received: by mail-qk1-f182.google.com with SMTP id af79cd13be357-778a92c06d6so183062885a.2 for ; Mon, 23 Oct 2023 00:04:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698044690; x=1698649490; 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=FTQQul3p2Ldr5yZKrC+5Z1v33112I0SueV9+7PF21m0=; b=KpWm+/myCrL7Pdp0mGzvYipoWkyV3fkVpE4nAkKQgDMOrMVMn1vepHbL/KeM8NXSNB 9HMZ5NitHLqa5Wc0nC+/UOZ18JdA9qtdzWhlJ9k3sRkKjgflosoacRPYfqnIJXIEUvaX Gs9m4898DurrBY/cZqAmlIGCjKaPKYF4HTwrWIJEsQqfitHBX0GjGzxDFC7XRLUvAexS 8vw1J8XMVlu3maV2z0LU5tDt29/gTl9AnpV6JrxwxnU2lOwkWL0JFRLt5v6ui48huDPr vqnh58wfJUtAnfk7udjLNJ0nG4evDAe4YnUjIG6Yk/ph2ny71H70m14bV8xFpbY3uNdc 0rJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698044690; x=1698649490; 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=FTQQul3p2Ldr5yZKrC+5Z1v33112I0SueV9+7PF21m0=; b=HZIx6V/BsNuwFsk9OsMVKgrH4QSfv6oX5WH9egZEpjpHjFd6vj1U0uepi1yCG9GIgh zcbdbg6Xt/2Z5NNB7d6UQRnc4rScCcAojgkMLi2FGg+dj4DNxBtxCqoZOM+oxH5XW0XB gFwEc+Ou2O4JivpByYhsdYnGpzvY+3uR4Ifyy2s/WjPtCqce8BJ0NFg/Zo56hVXGvHDE kbK0CuwWue5FBPgKtOZwLdAPB/MLo10yuI09QQldkLPNCImd9Uoi8k9BHfZ93nnq/OuH H5SY/JDZsaFiRHe+4003Xmq9tVMd2aqPqM6A9qDgwjmq0Fgpa4g5nBCuxyOoSgMoUUUM oDlA== X-Gm-Message-State: AOJu0YxSZH/w4vHzKuVzomKGvL2d3ZeH5YQHk2woW8iVkNG4m32zw2QQ p9/YwJ44L9ONhutbw4NO3T2VjHuCyMEH+7Yg7Ig= X-Google-Smtp-Source: AGHT+IH4E0yDYThJ2OKROjGJVg9g4CtJVt5ofFp8DWAmUfQxqE92Nz2MxpGK+7o+TZlaD5WAE60HUC4GhTOa56DSbjE= X-Received: by 2002:ac8:7f87:0:b0:417:b00f:9c8a with SMTP id z7-20020ac87f87000000b00417b00f9c8amr8864465qtj.27.1698044689581; Mon, 23 Oct 2023 00:04:49 -0700 (PDT) MIME-Version: 1.0 References: <20231019105000.520914-13-skori@marvell.com> <20231019173011.1186656-1-skori@marvell.com> <20231019173011.1186656-6-skori@marvell.com> In-Reply-To: <20231019173011.1186656-6-skori@marvell.com> From: Nithin Dabilpuram Date: Mon, 23 Oct 2023 12:34:35 +0530 Message-ID: Subject: Re: [PATCH v11 05/12] app/graph: support ethdev command line interfaces To: skori@marvell.com Cc: Rakesh Kudurumalla , dev@dpdk.org, Jerin Jacob 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 Fri, Oct 20, 2023 at 3:47=E2=80=AFAM wrote: > > From: Sunil Kumar Kori > > Adds ethdev module to configure ethernet devices. > > Following commands are exposed: > - ethdev rxq txq > - ethdev mtu > - ethdev promiscuous > - ethdev show > - ethdev stats > - ethdev ip4 addr add netmask > - ethdev ip6 addr add netmask > - help ethdev > > Signed-off-by: Sunil Kumar Kori > Signed-off-by: Rakesh Kudurumalla > Acked-by: Jerin Jacob > --- > app/graph/cli.c | 8 + > app/graph/ethdev.c | 887 +++++++++++++++++++++++++++++++++++++ > app/graph/ethdev.h | 40 ++ > app/graph/ethdev_priv.h | 112 +++++ > app/graph/main.c | 1 + > app/graph/meson.build | 1 + > app/graph/module_api.h | 1 + > doc/guides/tools/graph.rst | 50 ++- > 8 files changed, 1099 insertions(+), 1 deletion(-) > create mode 100644 app/graph/ethdev.c > create mode 100644 app/graph/ethdev.h > create mode 100644 app/graph/ethdev_priv.h > > diff --git a/app/graph/cli.c b/app/graph/cli.c > index cf544d5f8f..fa394fade6 100644 > --- a/app/graph/cli.c > +++ b/app/graph/cli.c > @@ -22,6 +22,14 @@ > cmdline_parse_ctx_t modules_ctx[] =3D { > (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, > NULL, > }; > > diff --git a/app/graph/ethdev.c b/app/graph/ethdev.c > new file mode 100644 > index 0000000000..8df55b4b12 > --- /dev/null > +++ b/app/graph/ethdev.c > @@ -0,0 +1,887 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2023 Marvell. > + */ > + > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "ethdev_priv.h" > +#include "module_api.h" > + > +static const char > +cmd_ethdev_mtu_help[] =3D "ethdev mtu "; > + > +static const char > +cmd_ethdev_prom_mode_help[] =3D "ethdev promiscuous "; > + > +static const char > +cmd_ethdev_help[] =3D "ethdev rxq txq "; > + > +static const char > +cmd_ethdev_stats_help[] =3D "ethdev stats"; > + > +static const char > +cmd_ethdev_show_help[] =3D "ethdev show"; > + > +static const char > +cmd_ethdev_ip4_addr_help[] =3D "ethdev ip4 addr add n= etmask "; > + > +static const char > +cmd_ethdev_ip6_addr_help[] =3D "ethdev ip6 addr add n= etmask "; > + > +static struct rte_eth_conf port_conf_default =3D { > + .link_speeds =3D 0, > + .rxmode =3D { > + .mq_mode =3D RTE_ETH_MQ_RX_NONE, > + .mtu =3D 9000 - (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN), = /* Jumbo frame MTU */ > + }, > + .rx_adv_conf =3D { > + .rss_conf =3D { > + .rss_key =3D NULL, > + .rss_key_len =3D 40, > + .rss_hf =3D 0, > + }, > + }, > + .txmode =3D { > + .mq_mode =3D RTE_ETH_MQ_TX_NONE, > + }, > + .lpbk_mode =3D 0, > +}; > + > +uint32_t enabled_port_mask; > +static struct ethdev_head eth_node =3D TAILQ_HEAD_INITIALIZER(eth_node); > + > + > +static struct ethdev* > +ethdev_port_by_id(uint16_t port_id) > +{ > + struct ethdev *port; > + > + TAILQ_FOREACH(port, ð_node, next) { > + if (port->config.port_id =3D=3D port_id) > + return port; > + } > + return NULL; > +} > + > +void * > +ethdev_mempool_list_by_portid(uint16_t portid) > +{ > + struct ethdev *port; > + > + if (portid >=3D RTE_MAX_ETHPORTS) > + return NULL; > + > + port =3D ethdev_port_by_id(portid); > + if (port) > + return &(port->config.rx.mp); > + else > + return NULL; > +} > + > +int16_t > +ethdev_portid_by_ip4(uint32_t ip, uint32_t mask) > +{ > + int portid =3D -EINVAL; > + struct ethdev *port; > + > + TAILQ_FOREACH(port, ð_node, next) { > + if (mask =3D=3D 0) { > + if ((port->ip4_addr.ip & port->ip4_addr.mask) =3D= =3D (ip & port->ip4_addr.mask)) > + return port->config.port_id; > + } else { > + if ((port->ip4_addr.ip & port->ip4_addr.mask) =3D= =3D (ip & mask)) > + return port->config.port_id; > + } > + } > + > + return portid; > +} > + > +int16_t > +ethdev_portid_by_ip6(uint8_t *ip, uint8_t *mask) > +{ > + int portid =3D -EINVAL; > + struct ethdev *port; > + int j; > + > + TAILQ_FOREACH(port, ð_node, next) { > + for (j =3D 0; j < ETHDEV_IPV6_ADDR_LEN; j++) { > + if (mask =3D=3D NULL) { > + if ((port->ip6_addr.ip[j] & port->ip6_add= r.mask[j]) !=3D > + (ip[j] & port->ip6_addr.mask[j])) > + break; > + > + } else { > + if ((port->ip6_addr.ip[j] & port->ip6_add= r.mask[j]) !=3D > + (ip[j] & mask[j])) > + break; > + } > + } > + if (j =3D=3D ETHDEV_IPV6_ADDR_LEN) > + return port->config.port_id; > + } > + > + return portid; > +} > + > +void > +ethdev_list_clean(void) > +{ > + struct ethdev *port; > + > + while (!TAILQ_EMPTY(ð_node)) { > + port =3D TAILQ_FIRST(ð_node); > + TAILQ_REMOVE(ð_node, port, next); > + } > +} > + > +void > +ethdev_stop(void) > +{ > + uint16_t portid; > + int rc; > + > + RTE_ETH_FOREACH_DEV(portid) { > + if ((enabled_port_mask & (1 << portid)) =3D=3D 0) > + continue; > + printf("Closing port %d...", portid); > + rc =3D rte_eth_dev_stop(portid); > + if (rc !=3D 0) > + printf("Failed to stop port %u: %s\n", > + portid, rte_strerror(-rc)); > + rte_eth_dev_close(portid); > + printf(" Done\n"); > + } > + > + ethdev_list_clean(); > + rte_eal_cleanup(); > + printf("Bye...\n"); > +} > + > +void > +ethdev_start(void) > +{ > + uint16_t portid; > + int rc; > + > + RTE_ETH_FOREACH_DEV(portid) > + { > + if ((enabled_port_mask & (1 << portid)) =3D=3D 0) > + continue; > + > + rc =3D rte_eth_dev_start(portid); > + if (rc < 0) > + rte_exit(EXIT_FAILURE, "rte_eth_dev_start: err=3D= %d, port=3D%d\n", rc, portid); > + } > +} > + > + > +static int > +ethdev_show(const char *name) > +{ > + uint16_t mtu =3D 0, port_id =3D 0; > + struct rte_eth_dev_info info; > + struct rte_eth_stats stats; > + struct rte_ether_addr addr; > + struct rte_eth_link link; > + uint32_t length; > + int rc; > + > + rc =3D rte_eth_dev_get_port_by_name(name, &port_id); > + if (rc < 0) > + return rc; > + > + rte_eth_dev_info_get(port_id, &info); > + rte_eth_stats_get(port_id, &stats); > + rte_eth_macaddr_get(port_id, &addr); > + rte_eth_link_get(port_id, &link); > + rte_eth_dev_get_mtu(port_id, &mtu); > + > + length =3D strlen(conn->msg_out); > + conn->msg_out +=3D length; > + snprintf(conn->msg_out, conn->msg_out_len_max, > + "%s: flags=3D<%s> mtu %u\n" > + "\tether " RTE_ETHER_ADDR_PRT_FMT " rxqueues %u txqueues= %u\n" > + "\tport# %u speed %s\n" > + "\tRX packets %" PRIu64" bytes %" PRIu64"\n" > + "\tRX errors %" PRIu64" missed %" PRIu64" no-mbuf %" P= RIu64"\n" > + "\tTX packets %" PRIu64" bytes %" PRIu64"\n" > + "\tTX errors %" PRIu64"\n\n", > + name, > + link.link_status ? "UP" : "DOWN", > + mtu, > + RTE_ETHER_ADDR_BYTES(&addr), > + info.nb_rx_queues, > + info.nb_tx_queues, > + port_id, > + rte_eth_link_speed_to_str(link.link_speed), > + stats.ipackets, > + stats.ibytes, > + stats.ierrors, > + stats.imissed, > + stats.rx_nombuf, > + stats.opackets, > + stats.obytes, > + stats.oerrors); > + > + length =3D strlen(conn->msg_out); > + conn->msg_out_len_max -=3D length; > + return 0; > +} > + > +static int > +ethdev_ip4_addr_add(const char *name, struct ipv4_addr_config *config) > +{ > + struct ethdev *eth_hdl; > + uint16_t portid =3D 0; > + int rc; > + > + rc =3D rte_eth_dev_get_port_by_name(name, &portid); > + if (rc < 0) > + return rc; > + > + eth_hdl =3D ethdev_port_by_id(portid); > + > + if (eth_hdl) { > + eth_hdl->ip4_addr.ip =3D config->ip; > + eth_hdl->ip4_addr.mask =3D config->mask; > + return 0; > + } > + > + rc =3D -EINVAL; > + return rc; > +} > + > +static int > +ethdev_ip6_addr_add(const char *name, struct ipv6_addr_config *config) > +{ > + struct ethdev *eth_hdl; > + uint16_t portid =3D 0; > + int rc, i; > + > + rc =3D rte_eth_dev_get_port_by_name(name, &portid); > + if (rc < 0) > + return rc; > + > + eth_hdl =3D ethdev_port_by_id(portid); > + > + if (eth_hdl) { > + for (i =3D 0; i < ETHDEV_IPV6_ADDR_LEN; i++) { > + eth_hdl->ip6_addr.ip[i] =3D config->ip[i]; > + eth_hdl->ip6_addr.mask[i] =3D config->mask[i]; > + } > + return 0; > + } > + rc =3D -EINVAL; > + return rc; > +} > + > +static int > +ethdev_prom_mode_config(const char *name, bool enable) > +{ > + struct ethdev *eth_hdl; > + uint16_t portid =3D 0; > + int rc; > + > + rc =3D rte_eth_dev_get_port_by_name(name, &portid); > + if (rc < 0) > + return rc; > + > + eth_hdl =3D ethdev_port_by_id(portid); > + > + if (eth_hdl) { > + if (enable) > + rc =3D rte_eth_promiscuous_enable(portid); > + else > + rc =3D rte_eth_promiscuous_disable(portid); > + if (rc < 0) > + return rc; > + > + eth_hdl->config.promiscuous =3D enable; > + return 0; > + } > + > + rc =3D -EINVAL; > + return rc; > +} > + > +static int > +ethdev_mtu_config(const char *name, uint32_t mtu) > +{ > + struct ethdev *eth_hdl; > + uint16_t portid =3D 0; > + int rc; > + > + rc =3D rte_eth_dev_get_port_by_name(name, &portid); > + if (rc < 0) > + return rc; > + > + eth_hdl =3D ethdev_port_by_id(portid); > + > + if (eth_hdl) { > + rc =3D rte_eth_dev_set_mtu(portid, mtu); > + if (rc < 0) > + return rc; > + > + eth_hdl->config.mtu =3D mtu; > + return 0; > + } > + > + rc =3D -EINVAL; > + return rc; > +} > + > + > +static int > +ethdev_process(const char *name, struct ethdev_config *params) > +{ > + struct rte_eth_dev_info port_info; > + struct rte_eth_conf port_conf; > + struct ethdev_rss_config *rss; > + struct rte_mempool *mempool; > + struct ethdev *ethdev_port; > + struct rte_ether_addr smac; > + uint16_t port_id =3D 0; > + int numa_node, rc; > + uint32_t i; > + > + /* Check input params */ > + if (!name || !name[0] || !params || !params->rx.n_queues || !para= ms->rx.queue_size || > + !params->tx.n_queues || !params->tx.queue_size) > + return -EINVAL; > + > + rc =3D rte_eth_dev_get_port_by_name(name, &port_id); > + if (rc) > + return -EINVAL; > + > + if (!ethdev_port_by_id(port_id)) { > + ethdev_port =3D malloc(sizeof(struct ethdev)); > + if (!ethdev_port) > + return -EINVAL; > + } else { > + return 0; > + } > + > + rc =3D rte_eth_dev_info_get(port_id, &port_info); > + if (rc) { > + rc =3D -EINVAL; > + goto exit; > + } > + > + mempool =3D rte_mempool_lookup(params->rx.mempool_name); > + if (!mempool) { > + rc =3D -EINVAL; > + goto exit; > + } > + > + params->rx.mp =3D mempool; > + > + rss =3D params->rx.rss; > + if (rss) { > + if (!port_info.reta_size || port_info.reta_size > RTE_ETH= _RSS_RETA_SIZE_512) { > + rc =3D -EINVAL; > + goto exit; > + } > + > + if (!rss->n_queues || rss->n_queues >=3D ETHDEV_RXQ_RSS_M= AX) { > + rc =3D -EINVAL; > + goto exit; > + } > + > + for (i =3D 0; i < rss->n_queues; i++) > + if (rss->queue_id[i] >=3D port_info.max_rx_queues= ) { > + rc =3D -EINVAL; > + goto exit; > + } > + } > + > + /* Port */ > + memcpy(&port_conf, &port_conf_default, sizeof(struct rte_eth_conf= )); > + if (rss) { > + uint64_t rss_hf =3D RTE_ETH_RSS_IP | RTE_ETH_RSS_TCP | RT= E_ETH_RSS_UDP; > + > + port_conf.rxmode.mq_mode =3D RTE_ETH_MQ_RX_RSS; > + port_conf.rx_adv_conf.rss_conf.rss_hf =3D rss_hf & port_i= nfo.flow_type_rss_offloads; > + } > + > + numa_node =3D rte_eth_dev_socket_id(port_id); > + if (numa_node =3D=3D SOCKET_ID_ANY) > + numa_node =3D 0; > + > + if (params->mtu) > + port_conf.rxmode.mtu =3D params->mtu; > + > + rc =3D rte_eth_dev_configure(port_id, params->rx.n_queues, params= ->tx.n_queues, > + &port_conf); > + if (rc < 0) { > + rc =3D -EINVAL; > + goto exit; > + } > + > + rc =3D rte_eth_macaddr_get(port_id, &smac); > + if (rc < 0) { > + rc =3D -EINVAL; > + goto exit; > + } > + > + printf("Port_id =3D %d srcmac =3D %x:%x:%x:%x:%x:%x\n", port_id, > + smac.addr_bytes[0], smac.addr_bytes[1], > + smac.addr_bytes[2], smac.addr_bytes[3], > + smac.addr_bytes[4], smac.addr_bytes[5]); > + > + /* Port RX */ > + for (i =3D 0; i < params->rx.n_queues; i++) { > + rc =3D rte_eth_rx_queue_setup(port_id, i, params->rx.queu= e_size, numa_node, NULL, > + mempool); > + if (rc < 0) { > + rc =3D -EINVAL; > + goto exit; > + } > + } > + > + /* Port TX */ > + for (i =3D 0; i < params->tx.n_queues; i++) { > + rc =3D rte_eth_tx_queue_setup(port_id, i, params->tx.queu= e_size, numa_node, NULL); > + if (rc < 0) { > + rc =3D -EINVAL; > + goto exit; > + } > + } > + > + memcpy(ðdev_port->config, params, sizeof(struct ethdev_config)= ); > + memcpy(ethdev_port->config.dev_name, name, strlen(name)); > + ethdev_port->config.port_id =3D port_id; > + enabled_port_mask |=3D RTE_BIT32(port_id); > + > + TAILQ_INSERT_TAIL(ð_node, ethdev_port, next); > + return 0; > +exit: > + free(ethdev_port); > + return rc; > + > +} > + > +static int > +ethdev_stats_show(const char *name) > +{ > + uint64_t diff_pkts_rx, diff_pkts_tx, diff_bytes_rx, diff_bytes_tx= ; > + static uint64_t prev_pkts_rx[RTE_MAX_ETHPORTS]; > + static uint64_t prev_pkts_tx[RTE_MAX_ETHPORTS]; > + static uint64_t prev_bytes_rx[RTE_MAX_ETHPORTS]; > + static uint64_t prev_bytes_tx[RTE_MAX_ETHPORTS]; > + static uint64_t prev_cycles[RTE_MAX_ETHPORTS]; > + uint64_t mpps_rx, mpps_tx, mbps_rx, mbps_tx; > + uint64_t diff_ns, diff_cycles, curr_cycles; > + struct rte_eth_stats stats; > + static const char *nic_stats_border =3D "########################= "; > + uint16_t port_id, len; > + int rc; > + > + rc =3D rte_eth_dev_get_port_by_name(name, &port_id); > + if (rc < 0) > + return rc; > + > + rc =3D rte_eth_stats_get(port_id, &stats); > + if (rc !=3D 0) { > + fprintf(stderr, > + "%s: Error: failed to get stats (port %u): %d", > + __func__, port_id, rc); > + return rc; > + } > + > + len =3D strlen(conn->msg_out); > + conn->msg_out +=3D len; > + snprintf(conn->msg_out, conn->msg_out_len_max, > + "\n %s NIC statistics for port %-2d %s\n" > + " RX-packets: %-10"PRIu64" RX-missed: %-10"PRIu64" RX-b= ytes: ""%-"PRIu64"\n" > + " RX-errors: %-"PRIu64"\n" > + " RX-nombuf: %-10"PRIu64"\n" > + " TX-packets: %-10"PRIu64" TX-errors: %-10"PRIu64" TX-b= ytes: ""%-"PRIu64"\n", > + nic_stats_border, port_id, nic_stats_border, stats.ipack= ets, stats.imissed, > + stats.ibytes, stats.ierrors, stats.rx_nombuf, stats.opac= kets, stats.oerrors, > + stats.obytes); > + > + len =3D strlen(conn->msg_out) - len; > + conn->msg_out_len_max -=3D len; > + > + diff_ns =3D 0; > + diff_cycles =3D 0; > + > + curr_cycles =3D rte_rdtsc(); > + if (prev_cycles[port_id] !=3D 0) > + diff_cycles =3D curr_cycles - prev_cycles[port_id]; > + > + prev_cycles[port_id] =3D curr_cycles; > + diff_ns =3D diff_cycles > 0 ? > + diff_cycles * (1 / (double)rte_get_tsc_hz()) * NS_PER_SEC= : 0; > + > + diff_pkts_rx =3D (stats.ipackets > prev_pkts_rx[port_id]) ? > + (stats.ipackets - prev_pkts_rx[port_id]) : 0; > + diff_pkts_tx =3D (stats.opackets > prev_pkts_tx[port_id]) ? > + (stats.opackets - prev_pkts_tx[port_id]) : 0; > + prev_pkts_rx[port_id] =3D stats.ipackets; > + prev_pkts_tx[port_id] =3D stats.opackets; > + mpps_rx =3D diff_ns > 0 ? > + (double)diff_pkts_rx / diff_ns * NS_PER_SEC : 0; > + mpps_tx =3D diff_ns > 0 ? > + (double)diff_pkts_tx / diff_ns * NS_PER_SEC : 0; > + > + diff_bytes_rx =3D (stats.ibytes > prev_bytes_rx[port_id]) ? > + (stats.ibytes - prev_bytes_rx[port_id]) : 0; > + diff_bytes_tx =3D (stats.obytes > prev_bytes_tx[port_id]) ? > + (stats.obytes - prev_bytes_tx[port_id]) : 0; > + prev_bytes_rx[port_id] =3D stats.ibytes; > + prev_bytes_tx[port_id] =3D stats.obytes; > + mbps_rx =3D diff_ns > 0 ? > + (double)diff_bytes_rx / diff_ns * NS_PER_SEC : 0; > + mbps_tx =3D diff_ns > 0 ? > + (double)diff_bytes_tx / diff_ns * NS_PER_SEC : 0; > + > + len =3D strlen(conn->msg_out); > + snprintf(conn->msg_out + len, conn->msg_out_len_max, > + "\n Throughput (since last show)\n" > + " Rx-pps: %12"PRIu64" Rx-bps: %12"PRIu64"\n T= x-pps: %12" > + PRIu64" Tx-bps: %12"PRIu64"\n" > + " %s############################%s\n", > + mpps_rx, mbps_rx * 8, mpps_tx, mbps_tx * 8, nic_stats_bo= rder, nic_stats_border); > + return 0; > +} > + > +static void > +cli_ethdev_mtu(void *parsed_result, __rte_unused struct cmdline *cl, voi= d *data __rte_unused) > +{ > + struct ethdev_mtu_cmd_tokens *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); > +} > + > +static void > +cli_ethdev_prom_mode(void *parsed_result, __rte_unused struct cmdline *c= l, void *data __rte_unused) > +{ > + struct ethdev_prom_mode_cmd_tokens *res =3D parsed_result; > + bool enable =3D false; > + int rc =3D -EINVAL; > + > + if (!strcmp(res->enable, "on")) > + enable =3D true; > + > + rc =3D ethdev_prom_mode_config(res->dev, enable); > + if (rc < 0) > + printf(MSG_CMD_FAIL, res->cmd); > +} > + > +static void > +cli_ip4_addr(void *parsed_result, __rte_unused struct cmdline *cl, void = *data __rte_unused) > +{ > + struct ethdev_ip4_cmd_tokens *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; > + } > + > + rc =3D ethdev_ip4_addr_add(res->dev, &config); > + if (rc < 0) > + printf(MSG_CMD_FAIL, res->cmd); > +} > + > +static void > +cli_ip6_addr(void *parsed_result, __rte_unused struct cmdline *cl, void = *data __rte_unused) > +{ > + struct ethdev_ip6_cmd_tokens *res =3D parsed_result; > + struct ipv6_addr_config config; > + int rc =3D -EINVAL; > + > + if (parser_ip6_read(config.ip, res->ip)) { > + printf(MSG_ARG_INVALID, "ip"); > + return; > + } > + > + if (parser_ip6_read(config.mask, res->mask)) { > + printf(MSG_ARG_INVALID, "netmask"); > + return; > + } > + > + rc =3D ethdev_ip6_addr_add(res->dev, &config); > + if (rc < 0) > + printf(MSG_CMD_FAIL, res->cmd); > +} > + > +static void > +cli_ethdev_show(void *parsed_result, __rte_unused struct cmdline *cl, vo= id *data __rte_unused) > +{ > + struct ethdev_show_cmd_tokens *res =3D parsed_result; > + int rc =3D -EINVAL; > + > + rc =3D ethdev_show(res->dev); > + if (rc < 0) > + printf(MSG_ARG_INVALID, res->dev); > +} > + > +static void > +cli_ethdev_stats(void *parsed_result, __rte_unused struct cmdline *cl, v= oid *data __rte_unused) > +{ > + struct ethdev_stats_cmd_tokens *res =3D parsed_result; > + int rc =3D -EINVAL; > + > + rc =3D ethdev_stats_show(res->dev); > + if (rc < 0) > + printf(MSG_ARG_INVALID, res->dev); > +} > + > +static void > +cli_ethdev(void *parsed_result, __rte_unused struct cmdline *cl, void *d= ata __rte_unused) > +{ > + struct ethdev_cmd_tokens *res =3D parsed_result; > + struct ethdev_config config; > + int rc; > + > + memset(&config, 0, sizeof(struct ethdev_config)); > + config.rx.n_queues =3D res->nb_rxq; > + config.rx.queue_size =3D ETHDEV_RX_DESC_DEFAULT; > + memcpy(config.rx.mempool_name, res->mempool, strlen(res->mempool)= ); > + > + config.tx.n_queues =3D res->nb_txq; > + config.tx.queue_size =3D ETHDEV_TX_DESC_DEFAULT; > + > + config.mtu =3D port_conf_default.rxmode.mtu; > + > + rc =3D ethdev_process(res->dev, &config); > + if (rc < 0) > + printf(MSG_CMD_FAIL, res->cmd); > +} > + > +static void > +cli_ethdev_help(__rte_unused void *parsed_result, __rte_unused struct cm= dline *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%s\n%s\= n%s\n%s\n%s\n%s\n", > + "----------------------------- ethdev command help -----= ------------------------", > + cmd_ethdev_help, cmd_ethdev_ip4_addr_help, cmd_ethdev_ip= 6_addr_help, > + cmd_ethdev_prom_mode_help, cmd_ethdev_mtu_help, cmd_ethd= ev_stats_help, > + cmd_ethdev_show_help); > + > + 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 > new file mode 100644 > index 0000000000..94d3247a2c > --- /dev/null > +++ b/app/graph/ethdev.h > @@ -0,0 +1,40 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2023 Marvell. > + */ > + > +#ifndef APP_GRAPH_ETHDEV_H > +#define APP_GRAPH_ETHDEV_H > + > +#include > + > +#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; > +}; > + > +struct ipv6_addr_config { > + uint8_t ip[ETHDEV_IPV6_ADDR_LEN]; > + uint8_t mask[ETHDEV_IPV6_ADDR_LEN]; > +}; > + > +extern uint32_t enabled_port_mask; > + > +void ethdev_start(void); > +void ethdev_stop(void); > +void *ethdev_mempool_list_by_portid(uint16_t portid); > +int16_t ethdev_portid_by_ip4(uint32_t ip, uint32_t mask); > +int16_t ethdev_portid_by_ip6(uint8_t *ip, uint8_t *mask); > +void ethdev_list_clean(void); > + > +#endif > diff --git a/app/graph/ethdev_priv.h b/app/graph/ethdev_priv.h > new file mode 100644 > index 0000000000..f231f3f3e1 > --- /dev/null > +++ b/app/graph/ethdev_priv.h > @@ -0,0 +1,112 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2023 Marvell. > + */ > + > +#ifndef APP_GRAPH_ETHDEV_PRIV_H > +#define APP_GRAPH_ETHDEV_PRIV_H > + > +#include "ethdev.h" > + > +#define NS_PER_SEC 1E9 > + > +#define ETHDEV_RXQ_RSS_MAX 16 > +#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; > +}; > + > +struct ethdev_config { > + char dev_name[RTE_ETH_NAME_MAX_LEN]; > + uint16_t port_id; > + > + struct { > + uint32_t n_queues; > + uint32_t queue_size; > + char mempool_name[RTE_MEMPOOL_NAMESIZE]; > + struct rte_mempool *mp; > + struct ethdev_rss_config *rss; > + } rx; > + > + struct { > + uint32_t n_queues; > + uint32_t queue_size; > + } tx; > + > + int promiscuous; > + uint32_t mtu; > +}; > + > +struct ethdev { > + TAILQ_ENTRY(ethdev) next; > + struct ethdev_config config; > + struct ipv4_addr_config ip4_addr; > + struct ipv6_addr_config ip6_addr; > +}; > +TAILQ_HEAD(ethdev_head, ethdev); > +#endif > diff --git a/app/graph/main.c b/app/graph/main.c > index 96548f49e7..c1cb435588 100644 > --- a/app/graph/main.c > +++ b/app/graph/main.c > @@ -215,6 +215,7 @@ main(int argc, char **argv) > > exit: > conn_free(conn); > + ethdev_stop(); > cli_exit(); > rte_eal_cleanup(); > return 0; > diff --git a/app/graph/meson.build b/app/graph/meson.build > index 5dc23c875b..c17e0cc63e 100644 > --- a/app/graph/meson.build > +++ b/app/graph/meson.build > @@ -12,6 +12,7 @@ deps +=3D ['graph', 'eal', 'lpm', 'ethdev', 'node', 'cm= dline'] > sources =3D files( > 'cli.c', > 'conn.c', > + 'ethdev.c', > 'main.c', > 'mempool.c', > 'utils.c', > diff --git a/app/graph/module_api.h b/app/graph/module_api.h > index b45419811b..e8a6ccb562 100644 > --- a/app/graph/module_api.h > +++ b/app/graph/module_api.h > @@ -10,6 +10,7 @@ > > #include "cli.h" > #include "conn.h" > +#include "ethdev.h" > #include "mempool.h" > #include "utils.h" > /* > diff --git a/doc/guides/tools/graph.rst b/doc/guides/tools/graph.rst > index 6009b0c291..5dedea97de 100644 > --- a/doc/guides/tools/graph.rst > +++ b/doc/guides/tools/graph.rst > @@ -78,7 +78,39 @@ file to express the requested use case configuration. > +--------------------------------------+-----------------------------= ------+---------+----------+ > | help mempool | | Command to dump mempool he= lp | Yes | Yes | > | | | message. = | | | > - | | = | | | > + +--------------------------------------+-----------------------------= ------+---------+----------+ > + | | ethdev rxq | | Command to create DPDK por= t with| No | No | > + | | txq | | given number of Rx and Tx = queues| | | > + | | | . Also attach RxQ with giv= en | | | > + | | | mempool. Each port can hav= e | | | > + | | | single mempool only i.e. a= ll | | | > + | | | RxQs will share the same m= empool| | | > + | | | . = | | | > + +--------------------------------------+-----------------------------= ------+---------+----------+ > + | ethdev mtu | | Command to configure MTU o= f DPDK| Yes | Yes | > + | | | port. = | | | > + +--------------------------------------+-----------------------------= ------+---------+----------+ > + | | ethdev promiscuous | | Command to enable/disable = | Yes | Yes | > + | | | | promiscuous mode on DPDK p= ort. | | | > + +--------------------------------------+-----------------------------= ------+---------+----------+ > + | ethdev show | | Command to dump current et= hdev | Yes | Yes | > + | | | configuration. = | | | > + +--------------------------------------+-----------------------------= ------+---------+----------+ > + | ethdev stats | | Command to dump current et= hdev | Yes | Yes | > + | | | statistics. = | | | > + +--------------------------------------+-----------------------------= ------+---------+----------+ > + | | ethdev ip4 addr add | | Command to configure IPv4 = | Yes | Yes | > + | | netmask | | address on given PCI devic= e. It | | | > + | | | is needed if user wishes t= o use | | | > + | | | ``ipv4_lookup`` node. = | | | > + +--------------------------------------+-----------------------------= ------+---------+----------+ > + | | ethdev ip6 addr add | | Command to configure IPv6 = | Yes | Yes | > + | | netmask | | address on given PCI devic= e. It | | | > + | | | is needed if user wishes t= o use | | | > + | | | ``ipv6_lookup`` node. = | | | > + +--------------------------------------+-----------------------------= ------+---------+----------+ > + | help ethdev | | Command to dump ethdev hel= p | Yes | Yes | > + | | | message. = | | | > +--------------------------------------+-----------------------------= ------+---------+----------+ > > Runtime configuration > @@ -113,6 +145,22 @@ Example: ``dpdk-graph`` is started with -h 10.28.35.= 207 and -p 50000 then > > graph> > graph> > + graph> help ethdev > + > + ----------------------------- ethdev command help -------------------= ---------- > + ethdev rxq txq > + ethdev ip4 addr add netmask > + ethdev ip6 addr add netmask > + ethdev promiscuous > + ethdev mtu > + ethdev stats > + ethdev show > + graph> > + > +To exit the telnet session, type ``Ctrl + ]``. This changes the ``graph>= `` command prompt to > +``telnet>`` command prompt. Now running ``close`` or ``quit`` command on= ``telnet>`` prompt > +will terminate the telnet session. > + > Created graph for use case > -------------------------- > > -- > 2.25.1 >