From patchwork Tue Jan 2 07:28:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Kudurumalla X-Patchwork-Id: 135673 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 05233437F9; Tue, 2 Jan 2024 08:28:33 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F0D3C4067B; Tue, 2 Jan 2024 08:28:29 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id F388C4064C for ; Tue, 2 Jan 2024 08:28:28 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 401NecDC022343 for ; Mon, 1 Jan 2024 23:28:28 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= pfpt0220; bh=wT8x+NZpwelkF8R8RVXeFnOhkdzQYuoxQYaHqY0scPE=; b=dfs tNlAfFqgQXI0Gv7hWyMqOL31cf21wr8XQeKRO0Hss7jHnbnzj+OFtCOjbO+oaOAb SEMm/G6OxYM1eOzofmbbmmePAhouhYyIRsuWFBZBTJ6yEPeJRuPrXp+RZ1yg/STN XNSMtdg+9e2BBOCtvxfUabNVqRKujSEvdUxcoWCqzwleQF0Gs8JfqbO56kervYtt 8u1sAWuNXZh30zSMkJ6eeNRsGQRhHR7s+YXWnM0KfKEnpCeOcT+pM1FUdZ+h9B++ qQuKDU3EQDqAmRkWhcpOinL7ULUK1mWeGt2dsInzXO+uYJ3vQYokgNlOZvm3qc0D G9cu2f/eHPjdKHC+nsA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3vakkkx8ch-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 01 Jan 2024 23:28:28 -0800 (PST) Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Mon, 1 Jan 2024 23:28:26 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Mon, 1 Jan 2024 23:28:26 -0800 Received: from localhost.localdomain (unknown [10.28.36.154]) by maili.marvell.com (Postfix) with ESMTP id 3B46E3F7080; Mon, 1 Jan 2024 23:28:23 -0800 (PST) From: Rakesh Kudurumalla To: Sunil Kumar Kori , Rakesh Kudurumalla CC: , , Subject: [PATCH v9 2/3] app/graph: add ethdev forward command Date: Tue, 2 Jan 2024 12:58:17 +0530 Message-ID: <20240102072818.886476-2-rkudurumalla@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240102072818.886476-1-rkudurumalla@marvell.com> References: <20240101083726.875161-1-rkudurumalla@marvell.com> <20240102072818.886476-1-rkudurumalla@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: j2WxTouoGNslsBokb0wzrrnJF3aJH9OC X-Proofpoint-GUID: j2WxTouoGNslsBokb0wzrrnJF3aJH9OC X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_02,2023-12-07_01,2023-05-22_02 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Adds a txport to forward packet for every rxport Mapping will be used to forward packets to txport received on rxport Following commands are exposed: - ethdev forward " Signed-off-by: Rakesh Kudurumalla Acked-by: Sunil Kumar Kori --- app/graph/cli.c | 1 + app/graph/ethdev.c | 63 ++++++++++++++++++++++++++++++++++++++ app/graph/ethdev.h | 1 + app/graph/ethdev_priv.h | 8 +++++ doc/guides/tools/graph.rst | 4 +++ 5 files changed, 77 insertions(+) diff --git a/app/graph/cli.c b/app/graph/cli.c index 30b12312d6..76f5b8e670 100644 --- a/app/graph/cli.c +++ b/app/graph/cli.c @@ -32,6 +32,7 @@ cmdline_parse_ctx_t modules_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_forward_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, diff --git a/app/graph/ethdev.c b/app/graph/ethdev.c index c9b09168c1..bb502a6134 100644 --- a/app/graph/ethdev.c +++ b/app/graph/ethdev.c @@ -38,6 +38,9 @@ cmd_ethdev_ip4_addr_help[] = "ethdev ip4 addr add netmask tx_port_id = portid_tx; + rc = 0; + } else { + rc = -EINVAL; + } + + return rc; +} + +static void +cli_ethdev_forward(void *parsed_result, __rte_unused struct cmdline *cl, void *data __rte_unused) +{ + struct ethdev_fwd_cmd_tokens *res = parsed_result; + int rc = -EINVAL; + + rc = ethdev_forward_config(res->tx_dev, res->rx_dev); + if (rc < 0) + printf(MSG_CMD_FAIL, res->cmd); +} + +cmdline_parse_token_string_t ethdev_fwd_cfg = + TOKEN_STRING_INITIALIZER(struct ethdev_fwd_cmd_tokens, cmd, "ethdev"); +cmdline_parse_token_string_t ethdev_fwd_cmd = + TOKEN_STRING_INITIALIZER(struct ethdev_fwd_cmd_tokens, fwd, "forward"); +cmdline_parse_token_string_t ethdev_tx_device = + TOKEN_STRING_INITIALIZER(struct ethdev_fwd_cmd_tokens, tx_dev, NULL); +cmdline_parse_token_string_t ethdev_rx_device = + TOKEN_STRING_INITIALIZER(struct ethdev_fwd_cmd_tokens, rx_dev, NULL); + +cmdline_parse_inst_t ethdev_forward_cmd_ctx = { + .f = cli_ethdev_forward, + .data = NULL, + .help_str = cmd_ethdev_forward_help, + .tokens = { + (void *)ðdev_fwd_cfg, + (void *)ðdev_fwd_cmd, + (void *)ðdev_tx_device, + (void *)ðdev_rx_device, + NULL, + }, +}; diff --git a/app/graph/ethdev.h b/app/graph/ethdev.h index 94d3247a2c..836052046b 100644 --- a/app/graph/ethdev.h +++ b/app/graph/ethdev.h @@ -15,6 +15,7 @@ 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_forward_cmd_ctx; extern cmdline_parse_inst_t ethdev_cmd_ctx; extern cmdline_parse_inst_t ethdev_help_cmd_ctx; diff --git a/app/graph/ethdev_priv.h b/app/graph/ethdev_priv.h index f231f3f3e1..af79553438 100644 --- a/app/graph/ethdev_priv.h +++ b/app/graph/ethdev_priv.h @@ -61,6 +61,13 @@ struct ethdev_ip6_cmd_tokens { cmdline_fixed_string_t mask; }; +struct ethdev_fwd_cmd_tokens { + cmdline_fixed_string_t cmd; + cmdline_fixed_string_t fwd; + cmdline_fixed_string_t tx_dev; + cmdline_fixed_string_t rx_dev; +}; + struct ethdev_cmd_tokens { cmdline_fixed_string_t cmd; cmdline_fixed_string_t dev; @@ -104,6 +111,7 @@ struct ethdev_config { struct ethdev { TAILQ_ENTRY(ethdev) next; + uint16_t tx_port_id; struct ethdev_config config; struct ipv4_addr_config ip4_addr; struct ipv6_addr_config ip6_addr; diff --git a/doc/guides/tools/graph.rst b/doc/guides/tools/graph.rst index 1855d12891..0aab41cbca 100644 --- a/doc/guides/tools/graph.rst +++ b/doc/guides/tools/graph.rst @@ -195,6 +195,9 @@ file to express the requested use case configuration. | ethdev mtu | | Command to configure MTU of DPDK| Yes | Yes | | | | port. | | | +--------------------------------------+-----------------------------------+---------+----------+ + | | ethdev forward | | Command to configure port | No | Yes | + | | | | forwarding of DPDK | | | + +--------------------------------------+-----------------------------------+---------+----------+ | | ethdev promiscuous | | Command to enable/disable | Yes | Yes | | | | | promiscuous mode on DPDK port. | | | +--------------------------------------+-----------------------------------+---------+----------+ @@ -297,6 +300,7 @@ Example: ``dpdk-graph`` is started with ``-h 10.28.35.207`` and ``-p 50000`` the ethdev rxq txq ethdev ip4 addr add netmask ethdev ip6 addr add netmask + ethdev forward ethdev promiscuous ethdev mtu ethdev stats