From patchwork Tue Dec 20 20:02:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanumanth Pothula X-Patchwork-Id: 121138 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru 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 CCFDDA0545; Tue, 20 Dec 2022 21:03:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8222C40698; Tue, 20 Dec 2022 21:03:12 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 9F51240684 for ; Tue, 20 Dec 2022 21:03:11 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BKHPRDx015534; Tue, 20 Dec 2022 12:03:08 -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=tIMZEaDYEnH7qsbtk5jl4U8TJiGG7qMIHMviu0LDwcM=; b=b/Sa7nlSGm6k51UkLAY+qx/10eA7iG4SAW+JNjStNv08Wu1zSf5f8BRTSb/dLMkpy9UZ Go9tm33MtPHrFgMo9L8rC1kVoyutp+JxGNCjk5HIabG8a0gYy69QsiquIadH+uA8ba3Q PJSxqyYGD2IsoWhc/zZd82x7i19PG03N5ITSGVn3n0lcxgkmLQAOgA4hKqq4NZ4hM62r E/hxL2+H0BDdCYqvZFCgmTnDIfPt5CAwWPOZ+/2MCJN9h9nTkrDDGHhuG+FUWPG/oGDW w7k6C52r1nI2M/7XvnUDpBxEsWF09nPW0LsmZOIgklgyhSvBqC7yqFkmCdxmmfJcZxlA kA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3mkapj2ye1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 20 Dec 2022 12:03:08 -0800 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.42; Tue, 20 Dec 2022 12:03:06 -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.42 via Frontend Transport; Tue, 20 Dec 2022 12:03:06 -0800 Received: from localhost.localdomain (unknown [10.28.36.155]) by maili.marvell.com (Postfix) with ESMTP id 5DE523F7063; Tue, 20 Dec 2022 12:03:04 -0800 (PST) From: Hanumanth Pothula To: Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: , , , , Subject: [PATCH v4 1/2] ethdev: control Rx metadata negotiation Date: Wed, 21 Dec 2022 01:32:49 +0530 Message-ID: <20221220200250.2413443-1-hpothula@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221006183522.1330826-1-hpothula@marvell.com> References: <20221006183522.1330826-1-hpothula@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: C2MjTBh3SKoFnZitJNHbbfJbaJJOuihQ X-Proofpoint-GUID: C2MjTBh3SKoFnZitJNHbbfJbaJJOuihQ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-20_06,2022-12-20_01,2022-06-22_01 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 Presently, Rx metadata is sent to PMD by default, leading to a performance drop as processing for the same in Rx path takes extra cycles. Hence, adding a new eth port configuration filed, 'nic_to_pmd_rx_metadata', to control NIC to PMD Rx metadata negotiation. Also, reset dev_configured flag as part of device reset, this helps in reconfiguring porting cleanly. Rx metadata negotiation, rte_eth_rx_metadata_negotiate(), is allowed only when dev_configured flag is reset. Signed-off-by: Hanumanth Pothula --- v4: - As per spec rte_eth_rx_metadata_negotiate() is processed only when dev_configured is set. Hence can't enable automatically when a flow command requests metadata. - Add new testpmd command to allow NIC to PMD Rx metadata negotiation. v3: - Updated run_app.rst with the new command line argument, nic-to-pmd-rx-metadata. - Updated commit text. v2: - taken cared alignment issues - renamed command line argument from rx-metadata to nic-to-pmd-rx-metadata - renamed variable name from rx-metadata to nic_to_pmd_rx_metadata --- lib/ethdev/rte_ethdev.c | 2 ++ lib/ethdev/rte_ethdev.h | 1 + 2 files changed, 3 insertions(+) diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 5d5e18db1e..18c59044bc 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -1629,6 +1629,8 @@ rte_eth_dev_reset(uint16_t port_id) port_id, rte_strerror(-ret)); } ret = dev->dev_ops->dev_reset(dev); + if (!ret) + dev->data->dev_configured = 0; return eth_err(port_id, ret); } diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index c129ca1eaf..f1160a8aca 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -1487,6 +1487,7 @@ struct rte_eth_conf { is needed,and the variable must be set RTE_ETH_DCB_PFC_SUPPORT. */ uint32_t dcb_capability_en; struct rte_eth_intr_conf intr_conf; /**< Interrupt mode configuration. */ + uint8_t nic_to_pmd_rx_metadata; /**< send rx metadata to PMD. */ }; /** From patchwork Tue Dec 20 20:02:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanumanth Pothula X-Patchwork-Id: 121139 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru 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 690BEA0545; Tue, 20 Dec 2022 21:03:24 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 576EE42D10; Tue, 20 Dec 2022 21:03:24 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id F05BC40684 for ; Tue, 20 Dec 2022 21:03:21 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BKHOmq4018275; Tue, 20 Dec 2022 12:03:21 -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=0GH9XIQkbjvKO79hMHqWh79OYQ/bZdgYxDzPZBoE6o4=; b=YYg7VaRf0cNd3K3p9PxF1mhLw8YT7+BmfwLsMRRrKtXKJQIZVpcRhMU7kkx6m4bfT5Lf lNuBH7opmHjDcjB7f3hhzRj+uCJYfOt62QgZgyxAl+Qbums09KFotnjOmoaEImKko296 3D9Blqx2vUymv2qtZP5iC/8FBc/ZIxikpxhohXCFG0Qgm8c+qsdgzW/oMoi0ZIMBIsu9 AMad34h0+qJXbCSKy4mfGdtcjrsyVVEKMr5iOMj/hwfju+9IMhBoi7isnmSX4tHAFL43 NpO1SnRBsnrTaxCvo6eiWIG0wg++3xkd2ShetItAXEuoXMOqMev8PJHGDQI5YtSbtDuL GA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3mkapj2yft-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 20 Dec 2022 12:03:21 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Tue, 20 Dec 2022 12:03:19 -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.42 via Frontend Transport; Tue, 20 Dec 2022 12:03:19 -0800 Received: from localhost.localdomain (unknown [10.28.36.155]) by maili.marvell.com (Postfix) with ESMTP id 4BFA03F7063; Tue, 20 Dec 2022 12:03:15 -0800 (PST) From: Hanumanth Pothula To: Aman Singh , Yuying Zhang CC: , , , , , Subject: [PATCH v4 2/2] app/testpmd: add command to process Rx metadata negotiation Date: Wed, 21 Dec 2022 01:32:50 +0530 Message-ID: <20221220200250.2413443-2-hpothula@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221220200250.2413443-1-hpothula@marvell.com> References: <20221006183522.1330826-1-hpothula@marvell.com> <20221220200250.2413443-1-hpothula@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: ndk9Yw26e93-dIxBOg7Kprk7pl_2ZNq1 X-Proofpoint-GUID: ndk9Yw26e93-dIxBOg7Kprk7pl_2ZNq1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-20_06,2022-12-20_01,2022-06-22_01 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 Presently, Rx metadata is sent to PMD by default, leading to a performance drop as processing for the same in Rx path takes extra cycles. Hence, add new testpmd command, 'enable port nic_to_pmd_rx_metadata' This command helps in sending Rx metadata to PMD and thereby Rx metadata flow command requests are processed. Signed-off-by: Hanumanth Pothula --- app/test-pmd/cmdline.c | 58 +++++++++++++++++++++ app/test-pmd/config.c | 9 ++++ app/test-pmd/testpmd.c | 5 +- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 6 +++ 4 files changed, 76 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index b32dc8bfd4..56946b2520 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -610,6 +610,9 @@ static void cmd_help_long_parsed(void *parsed_result, "set port (port_id) fec_mode auto|off|rs|baser\n" " set fec mode for a specific port\n\n" + "enable port nic_to_pmd_rx_metadata" + " Allow nic to pmd Rx metadata negotiation\n\n" + , list_pkt_forwarding_modes() ); } @@ -12621,6 +12624,60 @@ static cmdline_parse_inst_t cmd_show_port_flow_transfer_proxy = { } }; +/* Allow negotiating Rx metadata between NIC and PMD */ +struct cmd_config_port_rx_metadata { + cmdline_fixed_string_t enable; + cmdline_fixed_string_t port; + uint16_t port_id; + cmdline_fixed_string_t nic_to_pmd_rx_metadata; +}; + +static void +cmd_config_port_rx_metadata_parsed(void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ + struct cmd_config_port_rx_metadata *res = parsed_result; + + if (port_id_is_invalid(res->port_id, ENABLED_WARN)) + return; + if (!port_is_stopped(res->port_id)) { + fprintf(stderr, "Please stop port %u first\n", res->port_id); + return; + } + + ports[res->port_id].dev_conf.nic_to_pmd_rx_metadata = 1; + + reset_port(res->port_id); +} + + +static cmdline_parse_token_string_t cmd_config_port_rx_metadata_enable = + TOKEN_STRING_INITIALIZER(struct cmd_config_port_rx_metadata, enable, + "enable"); +static cmdline_parse_token_string_t cmd_config_port_rx_metadata_port = + TOKEN_STRING_INITIALIZER(struct cmd_config_port_rx_metadata, port, + "port"); +static cmdline_parse_token_num_t cmd_config_port_rx_metadata_id = + TOKEN_NUM_INITIALIZER(struct cmd_config_port_rx_metadata, port_id, + RTE_UINT16); +static cmdline_parse_token_string_t cmd_config_port_rx_metadata_nic_to_pmd_rx_metadata = + TOKEN_STRING_INITIALIZER(struct cmd_config_port_rx_metadata, nic_to_pmd_rx_metadata, + "nic_to_pmd_rx_metadata"); + +static cmdline_parse_inst_t cmd_config_port_rx_metadata_parse = { + .f = cmd_config_port_rx_metadata_parsed, + .data = NULL, + .help_str = "enable port nic_to_pmd_rx_metadata", + .tokens = { + (void *)&cmd_config_port_rx_metadata_enable, + (void *)&cmd_config_port_rx_metadata_port, + (void *)&cmd_config_port_rx_metadata_id, + (void *)&cmd_config_port_rx_metadata_nic_to_pmd_rx_metadata, + NULL, + }, +}; + /* ******************************************************************************** */ /* list of instructions */ @@ -12851,6 +12908,7 @@ static cmdline_parse_ctx_t builtin_ctx[] = { (cmdline_parse_inst_t *)&cmd_show_capability, (cmdline_parse_inst_t *)&cmd_set_flex_is_pattern, (cmdline_parse_inst_t *)&cmd_set_flex_spec_pattern, + (cmdline_parse_inst_t *)&cmd_config_port_rx_metadata_parse, NULL, }; diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index acccb6b035..47fce3accb 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -3249,6 +3249,15 @@ port_flow_create(portid_t port_id, } id = port->flow_list->id + 1; } + + if (port->dev_conf.nic_to_pmd_rx_metadata == 0 && + (actions->type == RTE_FLOW_ACTION_TYPE_MARK || + actions->type == RTE_FLOW_ACTION_TYPE_FLAG)) { + fprintf(stderr, + "rx metadata is not negotiated with PMD\n"); + return -EINVAL; + } + if (tunnel_ops->enabled) { pft = port_flow_tunnel_offload_cmd_prep(port_id, pattern, actions, tunnel_ops); diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 134d79a555..22e5e08fc1 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1604,8 +1604,6 @@ init_config_port_offloads(portid_t pid, uint32_t socket_id) int ret; int i; - eth_rx_metadata_negotiate_mp(pid); - port->dev_conf.txmode = tx_mode; port->dev_conf.rxmode = rx_mode; @@ -2946,6 +2944,9 @@ start_port(portid_t pid) port->update_conf = 0; } + if (port->dev_conf.nic_to_pmd_rx_metadata) + eth_rx_metadata_negotiate_mp(pi); + /* configure port */ diag = eth_dev_configure_mp(pi, nb_rxq + nb_hairpinq, nb_txq + nb_hairpinq, diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 0037506a79..024dbf6012 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -1558,6 +1558,12 @@ Enable or disable a per port Rx offloading on all Rx queues of a port:: This command should be run when the port is stopped, or else it will fail. +Enable Rx metadata negotiation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Enable NIC to PMD Rx metadata negotiation:: + testpmd> enable port nic_to_pmd_rx_metadata + config per queue Rx offloading ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~