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 9F0B8A0545; Wed, 21 Dec 2022 03:07:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8AF0B4113F; Wed, 21 Dec 2022 03:07:47 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id E366440684 for ; Wed, 21 Dec 2022 03:07:45 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BL1FORJ011577; Tue, 20 Dec 2022 18:07:45 -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=M5eWA3sxVDF/l/jT+Lc2bhPSquYRQlSdsP7h4uWrESk=; b=YybrghCfSUiuURwl4va28nz0I8HQTzcttwjbG5E6lO80uy3O0Lro4UcPywoURQvXe86F wCTdv02eDn6e471xQIqDTtAq3f7LpYmFyaKvK13FUUrwp36yfm9vX+j00A3YzWStw0sU +biO9TkzdrXnVrWVm8eRaTjia3bJY3JF031dMEc1UXEAVRTtFwphVhJAQAF66/uM2Mlj AGRnVKGDUNopJMQP20rs1W9rjVXCssSGnyiA9+vgqQb12x86f+1dmDJvCbUfKU7C0YW0 iDkz1KuvRLRJGDBanocoBn5u+mtKO6OqFb/TnycKx3U1P3+Wz4w/5rGHd/jrXTJZ8Oad qg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3mhe5rpv7m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 20 Dec 2022 18:07:45 -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 18:07:43 -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 18:07:43 -0800 Received: from localhost.localdomain (unknown [10.28.36.155]) by maili.marvell.com (Postfix) with ESMTP id 953C23F704D; Tue, 20 Dec 2022 18:07:40 -0800 (PST) From: Hanumanth Pothula To: Aman Singh , Yuying Zhang CC: , , , , , Subject: [PATCH v5 2/2] app/testpmd: add command to process Rx metadata negotiation Date: Wed, 21 Dec 2022 07:37:12 +0530 Message-ID: <20221221020713.2803232-2-hpothula@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221221020713.2803232-1-hpothula@marvell.com> References: <20221220200250.2413443-1-hpothula@marvell.com> <20221221020713.2803232-1-hpothula@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: 1_l2SPraWQiOIgH7mJYeKs0gtyQr_p8i X-Proofpoint-ORIG-GUID: 1_l2SPraWQiOIgH7mJYeKs0gtyQr_p8i 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_08,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 +- app/test-pmd/testpmd.h | 1 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 6 +++ 5 files changed, 77 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index b32dc8bfd4..e3abc9e830 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].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..60df47407e 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->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..66d5a2634a 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->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/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 7d24d25970..f44756173b 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -309,6 +309,7 @@ struct rte_port { uint8_t need_setup; /**< port just attached */ uint8_t need_reconfig; /**< need reconfiguring port or not */ uint8_t need_reconfig_queues; /**< need reconfiguring queues or not */ + uint8_t nic_to_pmd_rx_metadata; /**< send rx metadata to PMD. */ uint8_t rss_flag; /**< enable rss or not */ uint8_t dcb_flag; /**< enable dcb */ uint16_t nb_rx_desc[RTE_MAX_QUEUES_PER_PORT+1]; /**< per queue rx desc number */ 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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- 2.25.1