From patchwork Thu Sep 20 13:55:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 45039 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 313ED6C9B; Thu, 20 Sep 2018 15:56:40 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id E99695F2D for ; Thu, 20 Sep 2018 15:56:32 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us3.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 02649B8007B; Thu, 20 Sep 2018 13:56:30 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 20 Sep 2018 06:56:10 -0700 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Thu, 20 Sep 2018 06:56:10 -0700 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id w8KDu93x005362; Thu, 20 Sep 2018 14:56:09 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id D90801626D2; Thu, 20 Sep 2018 14:56:08 +0100 (BST) From: Andrew Rybchenko To: Gaetan Rivet CC: , Ian Dolzhansky Date: Thu, 20 Sep 2018 14:55:49 +0100 Message-ID: <1537451752-28759-2-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1537451752-28759-1-git-send-email-arybchenko@solarflare.com> References: <1535526966-32456-1-git-send-email-arybchenko@solarflare.com> <1537451752-28759-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24106.004 X-TM-AS-Result: No-11.320800-4.000000-10 X-TMASE-MatchedRID: 56itn3ZFAM/NwJnbTIxiVQPZZctd3P4B9DuzN5Up01uGAVmsKRo2NL6Y VRYkPkYC8oCFebEm/7+Vpex4dzu4rOVvZ9VZp3eETd1FGyH+HrKUi9wB9gmcSmFB1xLJwzNXSnR XN9MDu2rZoTly3PGW4J0llj2LKQVU+g3TEidc8f8MH4SsGvRsA85rFUwYWoZKZ5yuplze9ptWFs MQfbcNE8dKHsOqpWBlo89x5YISWbFkcSw7ximNlhes/RxhysDbfS0Ip2eEHnz3IzXlXlpamPoLR 4+zsDTt/KO2LNTSuGNQW/s+auXH5ywIBfGfxMJByMUdsRVsTz5p7J+wntw7rQ== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--11.320800-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24106.004 X-MDID: 1537451791-pfrKYnVbw2N0 Subject: [dpdk-dev] [PATCH v2 1/4] app/testpmd: add queue deferred start switch X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Ian Dolzhansky Signed-off-by: Ian Dolzhansky Signed-off-by: Andrew Rybchenko Acked-by: Gaetan Rivet --- app/test-pmd/cmdline.c | 91 +++++++++++++++++++++ doc/guides/rel_notes/release_18_11.rst | 8 ++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 ++ 3 files changed, 106 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 0cbd340c1..0c5399dc4 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -883,6 +883,10 @@ static void cmd_help_long_parsed(void *parsed_result, " Start/stop a rx/tx queue of port X. Only take effect" " when port X is started\n\n" + "port (port_id) (rxq|txq) (queue_id) deferred_start (on|off)\n" + " Switch on/off a deferred start of port X rx/tx queue. Only" + " take effect when port X is stopped.\n\n" + "port (port_id) (rxq|txq) (queue_id) setup\n" " Setup a rx/tx queue of port X.\n\n" @@ -2439,6 +2443,92 @@ cmdline_parse_inst_t cmd_config_rxtx_queue = { }, }; +/* *** configure port rxq/txq deferred start on/off *** */ +struct cmd_config_deferred_start_rxtx_queue { + cmdline_fixed_string_t port; + portid_t port_id; + cmdline_fixed_string_t rxtxq; + uint16_t qid; + cmdline_fixed_string_t opname; + cmdline_fixed_string_t state; +}; + +static void +cmd_config_deferred_start_rxtx_queue_parsed(void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_config_deferred_start_rxtx_queue *res = parsed_result; + struct rte_port *port; + uint8_t isrx; + uint8_t ison; + uint8_t needreconfig = 0; + + if (port_id_is_invalid(res->port_id, ENABLED_WARN)) + return; + + if (port_is_started(res->port_id) != 0) { + printf("Please stop port %u first\n", res->port_id); + return; + } + + port = &ports[res->port_id]; + + isrx = !strcmp(res->rxtxq, "rxq"); + + if (isrx && rx_queue_id_is_invalid(res->qid)) + return; + else if (!isrx && tx_queue_id_is_invalid(res->qid)) + return; + + ison = !strcmp(res->state, "on"); + + if (isrx && port->rx_conf[res->qid].rx_deferred_start != ison) { + port->rx_conf[res->qid].rx_deferred_start = ison; + needreconfig = 1; + } else if (!isrx && port->tx_conf[res->qid].tx_deferred_start != ison) { + port->tx_conf[res->qid].tx_deferred_start = ison; + needreconfig = 1; + } + + if (needreconfig) + cmd_reconfig_device_queue(res->port_id, 0, 1); +} + +cmdline_parse_token_string_t cmd_config_deferred_start_rxtx_queue_port = + TOKEN_STRING_INITIALIZER(struct cmd_config_deferred_start_rxtx_queue, + port, "port"); +cmdline_parse_token_num_t cmd_config_deferred_start_rxtx_queue_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_config_deferred_start_rxtx_queue, + port_id, UINT16); +cmdline_parse_token_string_t cmd_config_deferred_start_rxtx_queue_rxtxq = + TOKEN_STRING_INITIALIZER(struct cmd_config_deferred_start_rxtx_queue, + rxtxq, "rxq#txq"); +cmdline_parse_token_num_t cmd_config_deferred_start_rxtx_queue_qid = + TOKEN_NUM_INITIALIZER(struct cmd_config_deferred_start_rxtx_queue, + qid, UINT16); +cmdline_parse_token_string_t cmd_config_deferred_start_rxtx_queue_opname = + TOKEN_STRING_INITIALIZER(struct cmd_config_deferred_start_rxtx_queue, + opname, "deferred_start"); +cmdline_parse_token_string_t cmd_config_deferred_start_rxtx_queue_state = + TOKEN_STRING_INITIALIZER(struct cmd_config_deferred_start_rxtx_queue, + state, "on#off"); + +cmdline_parse_inst_t cmd_config_deferred_start_rxtx_queue = { + .f = cmd_config_deferred_start_rxtx_queue_parsed, + .data = NULL, + .help_str = "port rxq|txq deferred_start on|off", + .tokens = { + (void *)&cmd_config_deferred_start_rxtx_queue_port, + (void *)&cmd_config_deferred_start_rxtx_queue_port_id, + (void *)&cmd_config_deferred_start_rxtx_queue_rxtxq, + (void *)&cmd_config_deferred_start_rxtx_queue_qid, + (void *)&cmd_config_deferred_start_rxtx_queue_opname, + (void *)&cmd_config_deferred_start_rxtx_queue_state, + NULL, + }, +}; + /* *** configure port rxq/txq setup *** */ struct cmd_setup_rxtx_queue { cmdline_fixed_string_t port; @@ -17709,6 +17799,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_config_rss, (cmdline_parse_inst_t *)&cmd_config_rxtx_ring_size, (cmdline_parse_inst_t *)&cmd_config_rxtx_queue, + (cmdline_parse_inst_t *)&cmd_config_deferred_start_rxtx_queue, (cmdline_parse_inst_t *)&cmd_setup_rxtx_queue, (cmdline_parse_inst_t *)&cmd_config_rss_reta, (cmdline_parse_inst_t *)&cmd_showport_reta, diff --git a/doc/guides/rel_notes/release_18_11.rst b/doc/guides/rel_notes/release_18_11.rst index 219b0b1cf..e9f3a415c 100644 --- a/doc/guides/rel_notes/release_18_11.rst +++ b/doc/guides/rel_notes/release_18_11.rst @@ -72,6 +72,14 @@ New Features choose the latest vector path that the platform supported. For example, users can use AVX2 vector path on BDW/HSW to get better performance. +* **Added ability to switch queue deferred start flag on testpmd app.** + + Added a console command to testpmd app, giving ability to switch + ``rx_deferred_start`` or ``tx_deferred_start`` flag of the specified queue of + the specified port. The port must be stopped before the command call in order + to reconfigure queues. + + API Changes ----------- diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index dde205a2b..3a73000a6 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -1765,6 +1765,13 @@ Start/stop a rx/tx queue on a specific port:: testpmd> port (port_id) (rxq|txq) (queue_id) (start|stop) +port config - queue deferred start +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Switch on/off deferred start of a specific port queue:: + + testpmd> port (port_id) (rxq|txq) (queue_id) deferred_start (on|off) + port setup queue ~~~~~~~~~~~~~~~~~~~~~