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 C794AA0543 for ; Tue, 21 Jun 2022 10:10:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B303042B70; Tue, 21 Jun 2022 10:10:22 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2076.outbound.protection.outlook.com [40.107.92.76]) by mails.dpdk.org (Postfix) with ESMTP id 0E72142B70 for ; Tue, 21 Jun 2022 10:10:21 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VOoIQjPj43cguexKKDoDnQ2eUtsxrnltHeMcEWXK4EhXgMw7mukgZp0i3fXMP/Mmqe0WnVXC9ji8iLKKdxY5nLieMtVo5RTstEu+deNrnR8outONFliDQm5UaHM4KJ4MNyEGHV2YKbVnZhRLIdEHFsBJyMNT98v/HBhC3j6Lt6tYfZJ1XnPal3IXyHwU9cs7y6pH9E4RdftqKSTOMNrdyneYuaTboNuUO+Ksig7H9cX9RJsFkNkijYuLUU0GnUpO0zpmbenSm+A/TgIiJaNP02/YCbRg5Ha39bcLLVnEmNTYF5rC5+lIPK9Mf++GoH0vSAVGAy07qVJiw5iVSAMAAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ummUaOTnJOuwLvMifoMas6KHhw2rdSfDCdsTPxjbPqo=; b=dY3NbZFgscJcKvicAIbtZ0ganL+78HMu282If0CCRfgUiC4WyGl0NqGQMVycR2TV51+WQg5OrpmrVfrS2vKYX1ea33zyDWkJGScKkO9vfGckCyWZRc2Urjw2s/HK8aXzlzMY/HH3NAomfbuoRM0+eI+fW/y7Je5EW9KzDBkt1dNNPQQujsVUfQsL6aha29vP5C+BLgHhrvcncAL2kajqAvyENx3SM69gF6wbUpZ26DXpPry+itrvCAJCcLoP/HIotYFA9I+XnJ4WYElZyPndyHoLZsdgnZiHNvnXCcKseU2H4RFyagAOOeQZlz0Sm9TngCoVGCKinRdT+f8n4s6weQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ummUaOTnJOuwLvMifoMas6KHhw2rdSfDCdsTPxjbPqo=; b=gkkqtFmxDD/3P7yVPPg9bZr2BKFL5sh+1NQdMZCq7OJk7l73U3bnPaQmCSMHg6ll7lYQINZLdO7VZAYtR6oUBOwG23M+WkPFdXNKwxamMaLS1X24348ropjpImGl4g/PgrGcSHA5FKj/dQAzyYhIdtWqD0E+k0mjqpRGdK3GTb3WFcyQW6Nk4WUuaR1jV9jeaBMsKuRG4smipswsbMxTrGg0G1v/QNZt+q+JzYfpIQKTZn2p6JX26Nh6Q7TwfrzdUJGT7w5sVTc7q9wWFpgtO6Ekj6p+eZuGxZsj6dzG9nojKniQnSouYArtxAXQNJ742CQxaoO7CHPAl68UsAxdNA== Received: from MWHPR22CA0040.namprd22.prod.outlook.com (2603:10b6:300:69::26) by SN1PR12MB2366.namprd12.prod.outlook.com (2603:10b6:802:25::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.15; Tue, 21 Jun 2022 08:10:18 +0000 Received: from CO1NAM11FT034.eop-nam11.prod.protection.outlook.com (2603:10b6:300:69:cafe::60) by MWHPR22CA0040.outlook.office365.com (2603:10b6:300:69::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.22 via Frontend Transport; Tue, 21 Jun 2022 08:10:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.238) by CO1NAM11FT034.mail.protection.outlook.com (10.13.174.248) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5353.14 via Frontend Transport; Tue, 21 Jun 2022 08:10:18 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Tue, 21 Jun 2022 08:10:17 +0000 Received: from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Tue, 21 Jun 2022 01:10:15 -0700 From: Xueming Li To: Dmitry Kozlyuk CC: Matan Azrad , dpdk stable Subject: patch 'app/testpmd: do not poll stopped queues' has been queued to stable release 20.11.6 Date: Tue, 21 Jun 2022 11:02:26 +0300 Message-ID: <20220621080301.2315720-81-xuemingl@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220621080301.2315720-1-xuemingl@nvidia.com> References: <20220621080301.2315720-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8dd5916d-60e8-49fd-6109-08da535d7aab X-MS-TrafficTypeDiagnostic: SN1PR12MB2366:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 01GjuI6EGFFKm/SUXhtJRcKnhQMTLhHBXN6wrc2aaviLixvHWYJyNBL+lGA/qw5onlnHMohmDCMf/GNpXzxgOOynJPLiJUCw9/AK64MVc7kUNBxPt6aT3sogztlPBZf/VcluUnwAhSVnmQOSoh9kL4zyDu7XHSnrbEM4rAsqMBLctaDd+931SX+7GNWxMOsC4OsvV3r1V9ABBNkYJkhXvY/aOXHpQx2Nk0LzBGZDoowyULC/qninrMVIAjnD8/ehPaWL4aLmOsD0zG8FwYOdulQTjRme5Ng/PFhdwWTv8QxAeOE85GA5nOvS9JQ1gF8VP1eyE5UqUm+MK/qCnBGdg4yNkqSzhoylHuXoklltl8Pqd7YiD06abQHs9cTyUjpEp6zc05mwJZXtACyeLkjvi67mKeUluKH7FwBgIDuSlMaW1zNX+j4YcNb34GZxFCjc5/vqeUjCJ5kmFWaJLZRtE3UZH3yHnILNyICh5m7jjEeiIFOiCQ/HDYUL0WLoAuWPCaJabPsmnwgTZ20xtihsBBWxLKxwG802Lw+m8sBadzqf0lp7QU9/d3UmA5pzzkiy1N0vYazNRS6o9vqgYXQkp0E5ELBbXKu9yKJ55vyn3ceISyqLijEEG983goWYcEGESF5o5X3jfPnIKm/JPiRmMIXfVRilQeism8zjUDUU/0UhhideVy7IuO9JoIhX9g6PY3Il3xA7gyKp/b3FoseCMopP9zuoJY3Fu7Bc2B7uER0cULKg3vY/WXtnxLAFn8FAuYK6IbhgNfOfaQTGUMIdIDw9KH5ID4zVMPtOxFMXGVqOTAh/Zk7iVWS5AgW9IQfvmRUHyS0X8NiVgN0QiVHWN36S/nNmw9ZQWn0hXJHu2dw= X-Forefront-Antispam-Report: CIP:12.22.5.238; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230016)(4636009)(136003)(346002)(39860400002)(376002)(396003)(36840700001)(40470700004)(46966006)(54906003)(4326008)(6636002)(7696005)(30864003)(86362001)(40460700003)(53546011)(6286002)(8676002)(55016003)(70206006)(37006003)(2906002)(82740400003)(356005)(966005)(26005)(6666004)(36860700001)(426003)(316002)(478600001)(70586007)(6862004)(82310400005)(40480700001)(8936002)(186003)(81166007)(16526019)(83380400001)(1076003)(2616005)(41300700001)(47076005)(40140700001)(336012)(36756003)(5660300002)(36900700001)(579004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2022 08:10:18.0056 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8dd5916d-60e8-49fd-6109-08da535d7aab X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.238]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT034.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2366 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 20.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/23/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/bdf2967cd5c84e5df7691a3c87a66cf5529f6134 Thanks. Xueming Li --- >From bdf2967cd5c84e5df7691a3c87a66cf5529f6134 Mon Sep 17 00:00:00 2001 From: Dmitry Kozlyuk Date: Mon, 7 Mar 2022 14:53:50 +0200 Subject: [PATCH] app/testpmd: do not poll stopped queues Cc: Xueming Li [ upstream commit 3c4426db54fc24e7a97f2b4000a0a4f30897a104 ] Calling Rx/Tx functions on a stopped queue is not supported. Do not run packet forwarding for streams that use stopped queues. Each stream has a read-only "disabled" field, so that lcore function can skip such streams. Forwarding engines can set this field using a new "stream_init" callback function by checking relevant queue states, which are stored along with queue configurations (not all PMDs implement rte_eth_rx/tx_queue_info_get() to query the state from there). Fixes: 5f4ec54f1d16 ("testpmd: queue start and stop") Signed-off-by: Dmitry Kozlyuk Acked-by: Matan Azrad --- app/test-pmd/5tswap.c | 13 +++++ app/test-pmd/cmdline.c | 45 +++++++++------ app/test-pmd/config.c | 4 +- app/test-pmd/csumonly.c | 13 +++++ app/test-pmd/flowgen.c | 13 +++++ app/test-pmd/icmpecho.c | 13 +++++ app/test-pmd/ieee1588fwd.c | 13 +++++ app/test-pmd/iofwd.c | 13 +++++ app/test-pmd/macfwd.c | 13 +++++ app/test-pmd/macswap.c | 13 +++++ app/test-pmd/noisy_vnf.c | 13 +++++ app/test-pmd/rxonly.c | 8 +++ app/test-pmd/testpmd.c | 81 +++++++++++++++++---------- app/test-pmd/testpmd.h | 19 ++++++- app/test-pmd/txonly.c | 8 +++ lib/librte_ethdev/rte_ethdev.h | 7 +++ lib/librte_ethdev/rte_ethdev_driver.h | 7 --- 17 files changed, 238 insertions(+), 58 deletions(-) diff --git a/app/test-pmd/5tswap.c b/app/test-pmd/5tswap.c index e8cef9623b..090798d68b 100644 --- a/app/test-pmd/5tswap.c +++ b/app/test-pmd/5tswap.c @@ -185,9 +185,22 @@ pkt_burst_5tuple_swap(struct fwd_stream *fs) get_end_cycles(fs, start_tsc); } +static void +stream_init_5tuple_swap(struct fwd_stream *fs) +{ + bool rx_stopped, tx_stopped; + + rx_stopped = ports[fs->rx_port].rxq[fs->rx_queue].state == + RTE_ETH_QUEUE_STATE_STOPPED; + tx_stopped = ports[fs->tx_port].txq[fs->tx_queue].state == + RTE_ETH_QUEUE_STATE_STOPPED; + fs->disabled = rx_stopped || tx_stopped; +} + struct fwd_engine five_tuple_swap_fwd_engine = { .fwd_mode_name = "5tswap", .port_fwd_begin = NULL, .port_fwd_end = NULL, + .stream_init = stream_init_5tuple_swap, .packet_fwd = pkt_burst_5tuple_swap, }; diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 481821b40a..b868081770 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -2557,8 +2557,10 @@ cmd_config_rxtx_queue_parsed(void *parsed_result, __rte_unused void *data) { struct cmd_config_rxtx_queue *res = parsed_result; + struct rte_port *port; uint8_t isrx; uint8_t isstart; + uint8_t *state; int ret = 0; if (test_done == 0) { @@ -2606,8 +2608,15 @@ cmd_config_rxtx_queue_parsed(void *parsed_result, else ret = rte_eth_dev_tx_queue_stop(res->portid, res->qid); - if (ret == -ENOTSUP) + if (ret == -ENOTSUP) { fprintf(stderr, "Function not supported in PMD\n"); + return; + } + + port = &ports[res->portid]; + state = isrx ? &port->rxq[res->qid].state : &port->txq[res->qid].state; + *state = isstart ? RTE_ETH_QUEUE_STATE_STARTED : + RTE_ETH_QUEUE_STATE_STOPPED; } cmdline_parse_token_string_t cmd_config_rxtx_queue_port = @@ -2676,11 +2685,11 @@ cmd_config_deferred_start_rxtx_queue_parsed(void *parsed_result, 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; + if (isrx && port->rxq[res->qid].conf.rx_deferred_start != ison) { + port->rxq[res->qid].conf.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; + } else if (!isrx && port->txq[res->qid].conf.tx_deferred_start != ison) { + port->txq[res->qid].conf.tx_deferred_start = ison; needreconfig = 1; } @@ -2799,7 +2808,7 @@ cmd_setup_rxtx_queue_parsed( res->qid, port->nb_rx_desc[res->qid], socket_id, - &port->rx_conf[res->qid], + &port->rxq[res->qid].conf, mp); if (ret) printf("Failed to setup RX queue\n"); @@ -2816,7 +2825,7 @@ cmd_setup_rxtx_queue_parsed( res->qid, port->nb_tx_desc[res->qid], socket_id, - &port->tx_conf[res->qid]); + &port->txq[res->qid].conf); if (ret) printf("Failed to setup TX queue\n"); } @@ -4569,7 +4578,7 @@ cmd_config_queue_tx_offloads(struct rte_port *port) /* Apply queue tx offloads configuration */ for (k = 0; k < port->dev_info.max_tx_queues; k++) - port->tx_conf[k].offloads = + port->txq[k].conf.offloads = port->dev_conf.txmode.offloads; } @@ -15412,7 +15421,7 @@ cmd_rx_offload_get_configuration_parsed( nb_rx_queues = dev_info.nb_rx_queues; for (q = 0; q < nb_rx_queues; q++) { - queue_offloads = port->rx_conf[q].offloads; + queue_offloads = port->rxq[q].conf.offloads; printf(" Queue[%2d] :", q); print_rx_offloads(queue_offloads); printf("\n"); @@ -15531,11 +15540,11 @@ cmd_config_per_port_rx_offload_parsed(void *parsed_result, if (!strcmp(res->on_off, "on")) { port->dev_conf.rxmode.offloads |= single_offload; for (q = 0; q < nb_rx_queues; q++) - port->rx_conf[q].offloads |= single_offload; + port->rxq[q].conf.offloads |= single_offload; } else { port->dev_conf.rxmode.offloads &= ~single_offload; for (q = 0; q < nb_rx_queues; q++) - port->rx_conf[q].offloads &= ~single_offload; + port->rxq[q].conf.offloads &= ~single_offload; } cmd_reconfig_device_queue(port_id, 1, 1); @@ -15639,9 +15648,9 @@ cmd_config_per_queue_rx_offload_parsed(void *parsed_result, } if (!strcmp(res->on_off, "on")) - port->rx_conf[queue_id].offloads |= single_offload; + port->rxq[queue_id].conf.offloads |= single_offload; else - port->rx_conf[queue_id].offloads &= ~single_offload; + port->rxq[queue_id].conf.offloads &= ~single_offload; cmd_reconfig_device_queue(port_id, 1, 1); } @@ -15823,7 +15832,7 @@ cmd_tx_offload_get_configuration_parsed( nb_tx_queues = dev_info.nb_tx_queues; for (q = 0; q < nb_tx_queues; q++) { - queue_offloads = port->tx_conf[q].offloads; + queue_offloads = port->txq[q].conf.offloads; printf(" Queue[%2d] :", q); print_tx_offloads(queue_offloads); printf("\n"); @@ -15946,11 +15955,11 @@ cmd_config_per_port_tx_offload_parsed(void *parsed_result, if (!strcmp(res->on_off, "on")) { port->dev_conf.txmode.offloads |= single_offload; for (q = 0; q < nb_tx_queues; q++) - port->tx_conf[q].offloads |= single_offload; + port->txq[q].conf.offloads |= single_offload; } else { port->dev_conf.txmode.offloads &= ~single_offload; for (q = 0; q < nb_tx_queues; q++) - port->tx_conf[q].offloads &= ~single_offload; + port->txq[q].conf.offloads &= ~single_offload; } cmd_reconfig_device_queue(port_id, 1, 1); @@ -16057,9 +16066,9 @@ cmd_config_per_queue_tx_offload_parsed(void *parsed_result, } if (!strcmp(res->on_off, "on")) - port->tx_conf[queue_id].offloads |= single_offload; + port->txq[queue_id].conf.offloads |= single_offload; else - port->tx_conf[queue_id].offloads &= ~single_offload; + port->txq[queue_id].conf.offloads &= ~single_offload; cmd_reconfig_device_queue(port_id, 1, 1); } diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index d6b43baaf4..ee2f560b61 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2816,8 +2816,8 @@ rxtx_config_display(void) nb_fwd_lcores, nb_fwd_ports); RTE_ETH_FOREACH_DEV(pid) { - struct rte_eth_rxconf *rx_conf = &ports[pid].rx_conf[0]; - struct rte_eth_txconf *tx_conf = &ports[pid].tx_conf[0]; + struct rte_eth_rxconf *rx_conf = &ports[pid].rxq[0].conf; + struct rte_eth_txconf *tx_conf = &ports[pid].txq[0].conf; uint16_t *nb_rx_desc = &ports[pid].nb_rx_desc[0]; uint16_t *nb_tx_desc = &ports[pid].nb_tx_desc[0]; struct rte_eth_rxq_info rx_qinfo; diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 282e87092f..8adac07cb6 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -1165,9 +1165,22 @@ tunnel_update: get_end_cycles(fs, start_tsc); } +static void +stream_init_checksum_forward(struct fwd_stream *fs) +{ + bool rx_stopped, tx_stopped; + + rx_stopped = ports[fs->rx_port].rxq[fs->rx_queue].state == + RTE_ETH_QUEUE_STATE_STOPPED; + tx_stopped = ports[fs->tx_port].txq[fs->tx_queue].state == + RTE_ETH_QUEUE_STATE_STOPPED; + fs->disabled = rx_stopped || tx_stopped; +} + struct fwd_engine csum_fwd_engine = { .fwd_mode_name = "csum", .port_fwd_begin = NULL, .port_fwd_end = NULL, + .stream_init = stream_init_checksum_forward, .packet_fwd = pkt_burst_checksum_forward, }; diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index bb4bf85519..506ff07086 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -206,9 +206,22 @@ pkt_burst_flow_gen(struct fwd_stream *fs) get_end_cycles(fs, start_tsc); } +static void +flowgen_stream_init(struct fwd_stream *fs) +{ + bool rx_stopped, tx_stopped; + + rx_stopped = ports[fs->rx_port].rxq[fs->rx_queue].state == + RTE_ETH_QUEUE_STATE_STOPPED; + tx_stopped = ports[fs->tx_port].txq[fs->tx_queue].state == + RTE_ETH_QUEUE_STATE_STOPPED; + fs->disabled = rx_stopped || tx_stopped; +} + struct fwd_engine flow_gen_engine = { .fwd_mode_name = "flowgen", .port_fwd_begin = NULL, .port_fwd_end = NULL, + .stream_init = flowgen_stream_init, .packet_fwd = pkt_burst_flow_gen, }; diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index a7b568e46e..989609fa5b 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -513,9 +513,22 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) get_end_cycles(fs, start_tsc); } +static void +icmpecho_stream_init(struct fwd_stream *fs) +{ + bool rx_stopped, tx_stopped; + + rx_stopped = ports[fs->rx_port].rxq[fs->rx_queue].state == + RTE_ETH_QUEUE_STATE_STOPPED; + tx_stopped = ports[fs->tx_port].txq[fs->tx_queue].state == + RTE_ETH_QUEUE_STATE_STOPPED; + fs->disabled = rx_stopped || tx_stopped; +} + struct fwd_engine icmp_echo_engine = { .fwd_mode_name = "icmpecho", .port_fwd_begin = NULL, .port_fwd_end = NULL, + .stream_init = icmpecho_stream_init, .packet_fwd = reply_to_icmp_echo_rqsts, }; diff --git a/app/test-pmd/ieee1588fwd.c b/app/test-pmd/ieee1588fwd.c index a949d24d5c..5876aafa5b 100644 --- a/app/test-pmd/ieee1588fwd.c +++ b/app/test-pmd/ieee1588fwd.c @@ -211,9 +211,22 @@ port_ieee1588_fwd_end(portid_t pi) rte_eth_timesync_disable(pi); } +static void +port_ieee1588_stream_init(struct fwd_stream *fs) +{ + bool rx_stopped, tx_stopped; + + rx_stopped = ports[fs->rx_port].rxq[fs->rx_queue].state == + RTE_ETH_QUEUE_STATE_STOPPED; + tx_stopped = ports[fs->tx_port].txq[fs->tx_queue].state == + RTE_ETH_QUEUE_STATE_STOPPED; + fs->disabled = rx_stopped || tx_stopped; +} + struct fwd_engine ieee1588_fwd_engine = { .fwd_mode_name = "ieee1588", .port_fwd_begin = port_ieee1588_fwd_begin, .port_fwd_end = port_ieee1588_fwd_end, + .stream_init = port_ieee1588_stream_init, .packet_fwd = ieee1588_packet_fwd, }; diff --git a/app/test-pmd/iofwd.c b/app/test-pmd/iofwd.c index 83d098adcb..de20d645b5 100644 --- a/app/test-pmd/iofwd.c +++ b/app/test-pmd/iofwd.c @@ -89,9 +89,22 @@ pkt_burst_io_forward(struct fwd_stream *fs) get_end_cycles(fs, start_tsc); } +static void +stream_init_forward(struct fwd_stream *fs) +{ + bool rx_stopped, tx_stopped; + + rx_stopped = ports[fs->rx_port].rxq[fs->rx_queue].state == + RTE_ETH_QUEUE_STATE_STOPPED; + tx_stopped = ports[fs->tx_port].txq[fs->tx_queue].state == + RTE_ETH_QUEUE_STATE_STOPPED; + fs->disabled = rx_stopped || tx_stopped; +} + struct fwd_engine io_fwd_engine = { .fwd_mode_name = "io", .port_fwd_begin = NULL, .port_fwd_end = NULL, + .stream_init = stream_init_forward, .packet_fwd = pkt_burst_io_forward, }; diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c index 0568ea794d..f8f55023b8 100644 --- a/app/test-pmd/macfwd.c +++ b/app/test-pmd/macfwd.c @@ -120,9 +120,22 @@ pkt_burst_mac_forward(struct fwd_stream *fs) get_end_cycles(fs, start_tsc); } +static void +stream_init_mac_forward(struct fwd_stream *fs) +{ + bool rx_stopped, tx_stopped; + + rx_stopped = ports[fs->rx_port].rxq[fs->rx_queue].state == + RTE_ETH_QUEUE_STATE_STOPPED; + tx_stopped = ports[fs->tx_port].txq[fs->tx_queue].state == + RTE_ETH_QUEUE_STATE_STOPPED; + fs->disabled = rx_stopped || tx_stopped; +} + struct fwd_engine mac_fwd_engine = { .fwd_mode_name = "mac", .port_fwd_begin = NULL, .port_fwd_end = NULL, + .stream_init = stream_init_mac_forward, .packet_fwd = pkt_burst_mac_forward, }; diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c index 310bca06af..ba9a148e1c 100644 --- a/app/test-pmd/macswap.c +++ b/app/test-pmd/macswap.c @@ -98,9 +98,22 @@ pkt_burst_mac_swap(struct fwd_stream *fs) get_end_cycles(fs, start_tsc); } +static void +stream_init_mac_swap(struct fwd_stream *fs) +{ + bool rx_stopped, tx_stopped; + + rx_stopped = ports[fs->rx_port].rxq[fs->rx_queue].state == + RTE_ETH_QUEUE_STATE_STOPPED; + tx_stopped = ports[fs->tx_port].txq[fs->tx_queue].state == + RTE_ETH_QUEUE_STATE_STOPPED; + fs->disabled = rx_stopped || tx_stopped; +} + struct fwd_engine mac_swap_engine = { .fwd_mode_name = "macswap", .port_fwd_begin = NULL, .port_fwd_end = NULL, + .stream_init = stream_init_mac_swap, .packet_fwd = pkt_burst_mac_swap, }; diff --git a/app/test-pmd/noisy_vnf.c b/app/test-pmd/noisy_vnf.c index e4434bea95..a92e810190 100644 --- a/app/test-pmd/noisy_vnf.c +++ b/app/test-pmd/noisy_vnf.c @@ -277,9 +277,22 @@ noisy_fwd_begin(portid_t pi) return 0; } +static void +stream_init_noisy_vnf(struct fwd_stream *fs) +{ + bool rx_stopped, tx_stopped; + + rx_stopped = ports[fs->rx_port].rxq[fs->rx_queue].state == + RTE_ETH_QUEUE_STATE_STOPPED; + tx_stopped = ports[fs->tx_port].txq[fs->tx_queue].state == + RTE_ETH_QUEUE_STATE_STOPPED; + fs->disabled = rx_stopped || tx_stopped; +} + struct fwd_engine noisy_vnf_engine = { .fwd_mode_name = "noisy", .port_fwd_begin = noisy_fwd_begin, .port_fwd_end = noisy_fwd_end, + .stream_init = stream_init_noisy_vnf, .packet_fwd = pkt_burst_noisy_vnf, }; diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c index c78fc4609a..83d0dcf670 100644 --- a/app/test-pmd/rxonly.c +++ b/app/test-pmd/rxonly.c @@ -69,9 +69,17 @@ pkt_burst_receive(struct fwd_stream *fs) get_end_cycles(fs, start_tsc); } +static void +stream_init_receive(struct fwd_stream *fs) +{ + fs->disabled = ports[fs->rx_port].rxq[fs->rx_queue].state == + RTE_ETH_QUEUE_STATE_STOPPED; +} + struct fwd_engine rx_only_engine = { .fwd_mode_name = "rxonly", .port_fwd_begin = NULL, .port_fwd_end = NULL, + .stream_init = stream_init_receive, .packet_fwd = pkt_burst_receive, }; diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 5da22fab57..0e553d19b9 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1429,10 +1429,10 @@ init_config_port_offloads(portid_t pid, uint32_t socket_id) /* Apply Rx offloads configuration */ for (i = 0; i < port->dev_info.max_rx_queues; i++) - port->rx_conf[i].offloads = port->dev_conf.rxmode.offloads; + port->rxq[i].conf.offloads = port->dev_conf.rxmode.offloads; /* Apply Tx offloads configuration */ for (i = 0; i < port->dev_info.max_tx_queues; i++) - port->tx_conf[i].offloads = port->dev_conf.txmode.offloads; + port->txq[i].conf.offloads = port->dev_conf.txmode.offloads; /* set flag to initialize port/queue */ port->need_reconfig = 1; @@ -1600,7 +1600,6 @@ reconfig(portid_t new_port_id, unsigned socket_id) init_port_config(); } - int init_fwd_streams(void) { @@ -1990,6 +1989,12 @@ flush_fwd_rx_queues(void) for (rxp = 0; rxp < cur_fwd_config.nb_fwd_ports; rxp++) { for (rxq = 0; rxq < nb_rxq; rxq++) { port_id = fwd_ports_ids[rxp]; + + /* Polling stopped queues is prohibited. */ + if (ports[port_id].rxq[rxq].state == + RTE_ETH_QUEUE_STATE_STOPPED) + continue; + /** * testpmd can stuck in the below do while loop * if rte_eth_rx_burst() always returns nonzero @@ -2035,7 +2040,8 @@ run_pkt_fwd_on_lcore(struct fwd_lcore *fc, packet_fwd_t pkt_fwd) nb_fs = fc->stream_nb; do { for (sm_id = 0; sm_id < nb_fs; sm_id++) - (*pkt_fwd)(fsm[sm_id]); + if (!fsm[sm_id]->disabled) + (*pkt_fwd)(fsm[sm_id]); #ifdef RTE_LIB_BITRATESTATS if (bitrate_enabled != 0 && bitrate_lcore_id == rte_lcore_id()) { @@ -2116,6 +2122,7 @@ start_packet_forwarding(int with_tx_first) { port_fwd_begin_t port_fwd_begin; port_fwd_end_t port_fwd_end; + stream_init_t stream_init = cur_fwd_eng->stream_init; unsigned int i; if (strcmp(cur_fwd_eng->fwd_mode_name, "rxonly") == 0 && !nb_rxq) @@ -2142,6 +2149,10 @@ start_packet_forwarding(int with_tx_first) fwd_config_setup(); + if (stream_init != NULL) + for (i = 0; i < cur_fwd_config.nb_fwd_streams; i++) + stream_init(fwd_streams[i]); + port_fwd_begin = cur_fwd_config.fwd_eng->port_fwd_begin; if (port_fwd_begin != NULL) { for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) { @@ -2404,7 +2415,7 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, ret = rte_eth_rx_queue_setup(port_id, rx_queue_id, nb_rx_desc, socket_id, rx_conf, mp); - return ret; + goto exit; } for (i = 0; i < rx_pkt_nb_segs; i++) { struct rte_eth_rxseg_split *rx_seg = &rx_useg[i].split; @@ -2429,6 +2440,10 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, socket_id, rx_conf, NULL); rx_conf->rx_seg = NULL; rx_conf->rx_nseg = 0; +exit: + ports[port_id].rxq[rx_queue_id].state = rx_conf->rx_deferred_start ? + RTE_ETH_QUEUE_STATE_STOPPED : + RTE_ETH_QUEUE_STATE_STARTED; return ret; } @@ -2508,20 +2523,28 @@ start_port(portid_t pid) port->need_reconfig_queues = 0; /* setup tx queues */ for (qi = 0; qi < nb_txq; qi++) { + struct rte_eth_txconf *conf = + &port->txq[qi].conf; + if ((numa_support) && (txring_numa[pi] != NUMA_NO_CONFIG)) diag = rte_eth_tx_queue_setup(pi, qi, port->nb_tx_desc[qi], txring_numa[pi], - &(port->tx_conf[qi])); + &(port->txq[qi].conf)); else diag = rte_eth_tx_queue_setup(pi, qi, port->nb_tx_desc[qi], port->socket_id, - &(port->tx_conf[qi])); + &(port->txq[qi].conf)); - if (diag == 0) + if (diag == 0) { + port->txq[qi].state = + conf->tx_deferred_start ? + RTE_ETH_QUEUE_STATE_STOPPED : + RTE_ETH_QUEUE_STATE_STARTED; continue; + } /* Fail to setup tx queue, return */ if (rte_atomic16_cmpset(&(port->port_status), @@ -2553,7 +2576,7 @@ start_port(portid_t pid) diag = rx_queue_setup(pi, qi, port->nb_rx_desc[qi], rxring_numa[pi], - &(port->rx_conf[qi]), + &(port->rxq[qi].conf), mp); } else { struct rte_mempool *mp = @@ -2569,7 +2592,7 @@ start_port(portid_t pid) diag = rx_queue_setup(pi, qi, port->nb_rx_desc[qi], port->socket_id, - &(port->rx_conf[qi]), + &(port->rxq[qi].conf), mp); } if (diag == 0) @@ -3293,51 +3316,51 @@ rxtx_port_config(struct rte_port *port) uint64_t offloads; for (qid = 0; qid < nb_rxq; qid++) { - offloads = port->rx_conf[qid].offloads; - port->rx_conf[qid] = port->dev_info.default_rxconf; + offloads = port->rxq[qid].conf.offloads; + port->rxq[qid].conf = port->dev_info.default_rxconf; if (offloads != 0) - port->rx_conf[qid].offloads = offloads; + port->rxq[qid].conf.offloads = offloads; /* Check if any Rx parameters have been passed */ if (rx_pthresh != RTE_PMD_PARAM_UNSET) - port->rx_conf[qid].rx_thresh.pthresh = rx_pthresh; + port->rxq[qid].conf.rx_thresh.pthresh = rx_pthresh; if (rx_hthresh != RTE_PMD_PARAM_UNSET) - port->rx_conf[qid].rx_thresh.hthresh = rx_hthresh; + port->rxq[qid].conf.rx_thresh.hthresh = rx_hthresh; if (rx_wthresh != RTE_PMD_PARAM_UNSET) - port->rx_conf[qid].rx_thresh.wthresh = rx_wthresh; + port->rxq[qid].conf.rx_thresh.wthresh = rx_wthresh; if (rx_free_thresh != RTE_PMD_PARAM_UNSET) - port->rx_conf[qid].rx_free_thresh = rx_free_thresh; + port->rxq[qid].conf.rx_free_thresh = rx_free_thresh; if (rx_drop_en != RTE_PMD_PARAM_UNSET) - port->rx_conf[qid].rx_drop_en = rx_drop_en; + port->rxq[qid].conf.rx_drop_en = rx_drop_en; port->nb_rx_desc[qid] = nb_rxd; } for (qid = 0; qid < nb_txq; qid++) { - offloads = port->tx_conf[qid].offloads; - port->tx_conf[qid] = port->dev_info.default_txconf; + offloads = port->txq[qid].conf.offloads; + port->txq[qid].conf = port->dev_info.default_txconf; if (offloads != 0) - port->tx_conf[qid].offloads = offloads; + port->txq[qid].conf.offloads = offloads; /* Check if any Tx parameters have been passed */ if (tx_pthresh != RTE_PMD_PARAM_UNSET) - port->tx_conf[qid].tx_thresh.pthresh = tx_pthresh; + port->txq[qid].conf.tx_thresh.pthresh = tx_pthresh; if (tx_hthresh != RTE_PMD_PARAM_UNSET) - port->tx_conf[qid].tx_thresh.hthresh = tx_hthresh; + port->txq[qid].conf.tx_thresh.hthresh = tx_hthresh; if (tx_wthresh != RTE_PMD_PARAM_UNSET) - port->tx_conf[qid].tx_thresh.wthresh = tx_wthresh; + port->txq[qid].conf.tx_thresh.wthresh = tx_wthresh; if (tx_rs_thresh != RTE_PMD_PARAM_UNSET) - port->tx_conf[qid].tx_rs_thresh = tx_rs_thresh; + port->txq[qid].conf.tx_rs_thresh = tx_rs_thresh; if (tx_free_thresh != RTE_PMD_PARAM_UNSET) - port->tx_conf[qid].tx_free_thresh = tx_free_thresh; + port->txq[qid].conf.tx_free_thresh = tx_free_thresh; port->nb_tx_desc[qid] = nb_txd; } @@ -3396,9 +3419,9 @@ update_jumbo_frame_offload(portid_t portid) /* Apply JUMBO_FRAME offload configuration to Rx queue(s) */ for (qid = 0; qid < port->dev_info.nb_rx_queues; qid++) { if (on) - port->rx_conf[qid].offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; + port->rxq[qid].conf.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else - port->rx_conf[qid].offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; + port->rxq[qid].conf.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; } } @@ -3610,7 +3633,7 @@ init_port_dcb_config(portid_t pid, if (port_conf.rxmode.mq_mode == ETH_MQ_RX_VMDQ_DCB) { port_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_RSS_HASH; for (i = 0; i < nb_rxq; i++) - rte_port->rx_conf[i].offloads &= + rte_port->rxq[i].conf.offloads &= ~DEV_RX_OFFLOAD_RSS_HASH; } diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 2a6312217d..5fa898eb96 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -128,6 +128,7 @@ struct fwd_stream { portid_t tx_port; /**< forwarding port of received packets */ queueid_t tx_queue; /**< TX queue to send forwarded packets */ streamid_t peer_addr; /**< index of peer ethernet address of packets */ + bool disabled; /**< the stream is disabled and should not run */ unsigned int retry_enabled; @@ -195,6 +196,18 @@ struct tunnel_ops { uint32_t items:1; }; +/** RX queue configuration and state. */ +struct port_rxqueue { + struct rte_eth_rxconf conf; + uint8_t state; /**< RTE_ETH_QUEUE_STATE_* value. */ +}; + +/** TX queue configuration and state. */ +struct port_txqueue { + struct rte_eth_txconf conf; + uint8_t state; /**< RTE_ETH_QUEUE_STATE_* value. */ +}; + /** * The data structure associated with each port. */ @@ -217,8 +230,8 @@ struct rte_port { uint8_t dcb_flag; /**< enable dcb */ uint16_t nb_rx_desc[RTE_MAX_QUEUES_PER_PORT+1]; /**< per queue rx desc number */ uint16_t nb_tx_desc[RTE_MAX_QUEUES_PER_PORT+1]; /**< per queue tx desc number */ - struct rte_eth_rxconf rx_conf[RTE_MAX_QUEUES_PER_PORT+1]; /**< per queue rx configuration */ - struct rte_eth_txconf tx_conf[RTE_MAX_QUEUES_PER_PORT+1]; /**< per queue tx configuration */ + struct port_rxqueue rxq[RTE_MAX_QUEUES_PER_PORT+1]; /**< per queue Rx config and state */ + struct port_txqueue txq[RTE_MAX_QUEUES_PER_PORT+1]; /**< per queue Tx config and state */ struct rte_ether_addr *mc_addr_pool; /**< pool of multicast addrs */ uint32_t mc_addr_nb; /**< nb. of addr. in mc_addr_pool */ uint8_t slave_flag; /**< bonding slave port */ @@ -271,12 +284,14 @@ struct fwd_lcore { */ typedef int (*port_fwd_begin_t)(portid_t pi); typedef void (*port_fwd_end_t)(portid_t pi); +typedef void (*stream_init_t)(struct fwd_stream *fs); typedef void (*packet_fwd_t)(struct fwd_stream *fs); struct fwd_engine { const char *fwd_mode_name; /**< Forwarding mode name. */ port_fwd_begin_t port_fwd_begin; /**< NULL if nothing special to do. */ port_fwd_end_t port_fwd_end; /**< NULL if nothing special to do. */ + stream_init_t stream_init; /**< NULL if nothing special to do. */ packet_fwd_t packet_fwd; /**< Mandatory. */ }; diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index 9f5087d215..a7cd3bff0d 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -493,9 +493,17 @@ tx_only_begin(portid_t pi) return 0; } +static void +tx_only_stream_init(struct fwd_stream *fs) +{ + fs->disabled = ports[fs->tx_port].txq[fs->tx_queue].state == + RTE_ETH_QUEUE_STATE_STOPPED; +} + struct fwd_engine tx_only_engine = { .fwd_mode_name = "txonly", .port_fwd_begin = tx_only_begin, .port_fwd_end = NULL, + .stream_init = tx_only_stream_init, .packet_fwd = pkt_burst_transmit, }; diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index dd7eef908d..5e8331da1c 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -1561,6 +1561,13 @@ struct rte_eth_dev_info { void *reserved_ptrs[2]; /**< Reserved for future fields */ }; +/** + * RX/TX queue states + */ +#define RTE_ETH_QUEUE_STATE_STOPPED 0 +#define RTE_ETH_QUEUE_STATE_STARTED 1 +#define RTE_ETH_QUEUE_STATE_HAIRPIN 2 + /** * Ethernet device RX queue information structure. * Used to retrieve information about configured queue. diff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h index afee4b8b80..6764ffb854 100644 --- a/lib/librte_ethdev/rte_ethdev_driver.h +++ b/lib/librte_ethdev/rte_ethdev_driver.h @@ -923,13 +923,6 @@ struct eth_dev_ops { /**< Disconnect the hairpin queues of a pair from each other. */ }; -/** - * RX/TX queue states - */ -#define RTE_ETH_QUEUE_STATE_STOPPED 0 -#define RTE_ETH_QUEUE_STATE_STARTED 1 -#define RTE_ETH_QUEUE_STATE_HAIRPIN 2 - /** * @internal * Check if the selected Rx queue is hairpin queue. -- 2.35.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-06-21 15:37:52.871831919 +0800 +++ 0080-app-testpmd-do-not-poll-stopped-queues.patch 2022-06-21 15:37:49.164451701 +0800 @@ -1 +1 @@ -From 3c4426db54fc24e7a97f2b4000a0a4f30897a104 Mon Sep 17 00:00:00 2001 +From bdf2967cd5c84e5df7691a3c87a66cf5529f6134 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 3c4426db54fc24e7a97f2b4000a0a4f30897a104 ] @@ -19 +21,0 @@ -Cc: stable@dpdk.org @@ -24,17 +26,18 @@ - app/test-pmd/5tswap.c | 13 ++++++ - app/test-pmd/cmdline.c | 45 ++++++++++-------- - app/test-pmd/config.c | 8 ++-- - app/test-pmd/csumonly.c | 13 ++++++ - app/test-pmd/flowgen.c | 13 ++++++ - app/test-pmd/icmpecho.c | 13 ++++++ - app/test-pmd/ieee1588fwd.c | 13 ++++++ - app/test-pmd/iofwd.c | 13 ++++++ - app/test-pmd/macfwd.c | 13 ++++++ - app/test-pmd/macswap.c | 13 ++++++ - app/test-pmd/noisy_vnf.c | 13 ++++++ - app/test-pmd/rxonly.c | 8 ++++ - app/test-pmd/shared_rxq_fwd.c | 8 ++++ - app/test-pmd/testpmd.c | 87 ++++++++++++++++++++++------------- - app/test-pmd/testpmd.h | 19 +++++++- - app/test-pmd/txonly.c | 8 ++++ - 16 files changed, 244 insertions(+), 56 deletions(-) + app/test-pmd/5tswap.c | 13 +++++ + app/test-pmd/cmdline.c | 45 +++++++++------ + app/test-pmd/config.c | 4 +- + app/test-pmd/csumonly.c | 13 +++++ + app/test-pmd/flowgen.c | 13 +++++ + app/test-pmd/icmpecho.c | 13 +++++ + app/test-pmd/ieee1588fwd.c | 13 +++++ + app/test-pmd/iofwd.c | 13 +++++ + app/test-pmd/macfwd.c | 13 +++++ + app/test-pmd/macswap.c | 13 +++++ + app/test-pmd/noisy_vnf.c | 13 +++++ + app/test-pmd/rxonly.c | 8 +++ + app/test-pmd/testpmd.c | 81 +++++++++++++++++---------- + app/test-pmd/testpmd.h | 19 ++++++- + app/test-pmd/txonly.c | 8 +++ + lib/librte_ethdev/rte_ethdev.h | 7 +++ + lib/librte_ethdev/rte_ethdev_driver.h | 7 --- + 17 files changed, 238 insertions(+), 58 deletions(-) @@ -43 +46 @@ -index 629d3e0d31..f041a5e1d5 100644 +index e8cef9623b..090798d68b 100644 @@ -70 +73 @@ -index 1e5b294ab3..d8900a0d07 100644 +index 481821b40a..b868081770 100644 @@ -73 +76 @@ -@@ -2654,8 +2654,10 @@ cmd_config_rxtx_queue_parsed(void *parsed_result, +@@ -2557,8 +2557,10 @@ cmd_config_rxtx_queue_parsed(void *parsed_result, @@ -84 +87 @@ -@@ -2703,8 +2705,15 @@ cmd_config_rxtx_queue_parsed(void *parsed_result, +@@ -2606,8 +2608,15 @@ cmd_config_rxtx_queue_parsed(void *parsed_result, @@ -101 +104 @@ -@@ -2773,11 +2782,11 @@ cmd_config_deferred_start_rxtx_queue_parsed(void *parsed_result, +@@ -2676,11 +2685,11 @@ cmd_config_deferred_start_rxtx_queue_parsed(void *parsed_result, @@ -117 +120 @@ -@@ -2895,7 +2904,7 @@ cmd_setup_rxtx_queue_parsed( +@@ -2799,7 +2808,7 @@ cmd_setup_rxtx_queue_parsed( @@ -125,2 +128,2 @@ - fprintf(stderr, "Failed to setup RX queue\n"); -@@ -2913,7 +2922,7 @@ cmd_setup_rxtx_queue_parsed( + printf("Failed to setup RX queue\n"); +@@ -2816,7 +2825,7 @@ cmd_setup_rxtx_queue_parsed( @@ -133 +136 @@ - fprintf(stderr, "Failed to setup TX queue\n"); + printf("Failed to setup TX queue\n"); @@ -135 +138 @@ -@@ -4689,7 +4698,7 @@ cmd_config_queue_tx_offloads(struct rte_port *port) +@@ -4569,7 +4578,7 @@ cmd_config_queue_tx_offloads(struct rte_port *port) @@ -144 +147 @@ -@@ -16201,7 +16210,7 @@ cmd_rx_offload_get_configuration_parsed( +@@ -15412,7 +15421,7 @@ cmd_rx_offload_get_configuration_parsed( @@ -153 +156 @@ -@@ -16321,11 +16330,11 @@ cmd_config_per_port_rx_offload_parsed(void *parsed_result, +@@ -15531,11 +15540,11 @@ cmd_config_per_port_rx_offload_parsed(void *parsed_result, @@ -167 +170 @@ -@@ -16431,9 +16440,9 @@ cmd_config_per_queue_rx_offload_parsed(void *parsed_result, +@@ -15639,9 +15648,9 @@ cmd_config_per_queue_rx_offload_parsed(void *parsed_result, @@ -179 +182 @@ -@@ -16620,7 +16629,7 @@ cmd_tx_offload_get_configuration_parsed( +@@ -15823,7 +15832,7 @@ cmd_tx_offload_get_configuration_parsed( @@ -188 +191 @@ -@@ -16744,11 +16753,11 @@ cmd_config_per_port_tx_offload_parsed(void *parsed_result, +@@ -15946,11 +15955,11 @@ cmd_config_per_port_tx_offload_parsed(void *parsed_result, @@ -202 +205 @@ -@@ -16857,9 +16866,9 @@ cmd_config_per_queue_tx_offload_parsed(void *parsed_result, +@@ -16057,9 +16066,9 @@ cmd_config_per_queue_tx_offload_parsed(void *parsed_result, @@ -215 +218 @@ -index dc9ef1e868..72d2606d19 100644 +index d6b43baaf4..ee2f560b61 100644 @@ -218 +221 @@ -@@ -3643,8 +3643,8 @@ rxtx_config_display(void) +@@ -2816,8 +2816,8 @@ rxtx_config_display(void) @@ -229,18 +231,0 @@ -@@ -3902,7 +3902,7 @@ fwd_stream_on_other_lcores(uint16_t domain_id, lcoreid_t src_lc, - fs = fwd_streams[sm_id]; - port = &ports[fs->rx_port]; - dev_info = &port->dev_info; -- rxq_conf = &port->rx_conf[fs->rx_queue]; -+ rxq_conf = &port->rxq[fs->rx_queue].conf; - if ((dev_info->dev_capa & RTE_ETH_DEV_CAPA_RXQ_SHARE) - == 0 || rxq_conf->share_group == 0) - /* Not shared rxq. */ -@@ -3962,7 +3962,7 @@ pkt_fwd_shared_rxq_check(void) - fs->lcore = fwd_lcores[lc_id]; - port = &ports[fs->rx_port]; - dev_info = &port->dev_info; -- rxq_conf = &port->rx_conf[fs->rx_queue]; -+ rxq_conf = &port->rxq[fs->rx_queue].conf; - if ((dev_info->dev_capa & RTE_ETH_DEV_CAPA_RXQ_SHARE) - == 0 || rxq_conf->share_group == 0) - /* Not shared rxq. */ @@ -248 +233 @@ -index 05763a71e8..7df201e047 100644 +index 282e87092f..8adac07cb6 100644 @@ -251 +236 @@ -@@ -1203,9 +1203,22 @@ tunnel_update: +@@ -1165,9 +1165,22 @@ tunnel_update: @@ -275 +260 @@ -index 9ceef3b54a..1e01120ae9 100644 +index bb4bf85519..506ff07086 100644 @@ -278,2 +263,2 @@ -@@ -207,9 +207,22 @@ flowgen_begin(portid_t pi) - return 0; +@@ -206,9 +206,22 @@ pkt_burst_flow_gen(struct fwd_stream *fs) + get_end_cycles(fs, start_tsc); @@ -296 +281 @@ - .port_fwd_begin = flowgen_begin, + .port_fwd_begin = NULL, @@ -302 +287 @@ -index 99c94cb282..066f2a3ab7 100644 +index a7b568e46e..989609fa5b 100644 @@ -305 +290 @@ -@@ -512,9 +512,22 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) +@@ -513,9 +513,22 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) @@ -329 +314 @@ -index 9ff817aa68..fc4e2d014c 100644 +index a949d24d5c..5876aafa5b 100644 @@ -356 +341 @@ -index 19cd920f70..71849aaf96 100644 +index 83d098adcb..de20d645b5 100644 @@ -359 +344 @@ -@@ -88,9 +88,22 @@ pkt_burst_io_forward(struct fwd_stream *fs) +@@ -89,9 +89,22 @@ pkt_burst_io_forward(struct fwd_stream *fs) @@ -383 +368 @@ -index 812a0c721f..79c9241d00 100644 +index 0568ea794d..f8f55023b8 100644 @@ -386 +371 @@ -@@ -119,9 +119,22 @@ pkt_burst_mac_forward(struct fwd_stream *fs) +@@ -120,9 +120,22 @@ pkt_burst_mac_forward(struct fwd_stream *fs) @@ -410 +395 @@ -index 4627ff83e9..acb0fd7fb4 100644 +index 310bca06af..ba9a148e1c 100644 @@ -413 +398 @@ -@@ -97,9 +97,22 @@ pkt_burst_mac_swap(struct fwd_stream *fs) +@@ -98,9 +98,22 @@ pkt_burst_mac_swap(struct fwd_stream *fs) @@ -464 +449 @@ -index d1a579d8d8..04457010f4 100644 +index c78fc4609a..83d0dcf670 100644 @@ -467 +452 @@ -@@ -68,9 +68,17 @@ pkt_burst_receive(struct fwd_stream *fs) +@@ -69,9 +69,17 @@ pkt_burst_receive(struct fwd_stream *fs) @@ -485,22 +469,0 @@ -diff --git a/app/test-pmd/shared_rxq_fwd.c b/app/test-pmd/shared_rxq_fwd.c -index da54a383fd..2e9047804b 100644 ---- a/app/test-pmd/shared_rxq_fwd.c -+++ b/app/test-pmd/shared_rxq_fwd.c -@@ -107,9 +107,17 @@ shared_rxq_fwd(struct fwd_stream *fs) - get_end_cycles(fs, start_tsc); - } - -+static void -+shared_rxq_stream_init(struct fwd_stream *fs) -+{ -+ fs->disabled = ports[fs->rx_port].rxq[fs->rx_queue].state == -+ RTE_ETH_QUEUE_STATE_STOPPED; -+} -+ - struct fwd_engine shared_rxq_engine = { - .fwd_mode_name = "shared_rxq", - .port_fwd_begin = NULL, - .port_fwd_end = NULL, -+ .stream_init = shared_rxq_stream_init, - .packet_fwd = shared_rxq_fwd, - }; @@ -508 +471 @@ -index 5b742911a8..99f2a31bb8 100644 +index 5da22fab57..0e553d19b9 100644 @@ -511 +474 @@ -@@ -1638,10 +1638,10 @@ init_config_port_offloads(portid_t pid, uint32_t socket_id) +@@ -1429,10 +1429,10 @@ init_config_port_offloads(portid_t pid, uint32_t socket_id) @@ -522,3 +485,3 @@ - if (eth_link_speed) - port->dev_conf.link_speeds = eth_link_speed; -@@ -1828,7 +1828,6 @@ reconfig(portid_t new_port_id, unsigned socket_id) + /* set flag to initialize port/queue */ + port->need_reconfig = 1; +@@ -1600,7 +1600,6 @@ reconfig(portid_t new_port_id, unsigned socket_id) @@ -532 +495 @@ -@@ -2233,6 +2232,12 @@ flush_fwd_rx_queues(void) +@@ -1990,6 +1989,12 @@ flush_fwd_rx_queues(void) @@ -545 +508 @@ -@@ -2278,7 +2283,8 @@ run_pkt_fwd_on_lcore(struct fwd_lcore *fc, packet_fwd_t pkt_fwd) +@@ -2035,7 +2040,8 @@ run_pkt_fwd_on_lcore(struct fwd_lcore *fc, packet_fwd_t pkt_fwd) @@ -555 +518 @@ -@@ -2360,6 +2366,7 @@ start_packet_forwarding(int with_tx_first) +@@ -2116,6 +2122,7 @@ start_packet_forwarding(int with_tx_first) @@ -563,3 +526,3 @@ -@@ -2390,6 +2397,10 @@ start_packet_forwarding(int with_tx_first) - if (!pkt_fwd_shared_rxq_check()) - return; +@@ -2142,6 +2149,10 @@ start_packet_forwarding(int with_tx_first) + + fwd_config_setup(); @@ -574 +537 @@ -@@ -2651,7 +2662,7 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, +@@ -2404,7 +2415,7 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, @@ -583 +546 @@ -@@ -2676,6 +2687,10 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, +@@ -2429,6 +2440,10 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, @@ -594,19 +557 @@ -@@ -2878,7 +2893,7 @@ start_port(portid_t pid) - for (k = 0; - k < port->dev_info.max_rx_queues; - k++) -- port->rx_conf[k].offloads |= -+ port->rxq[k].conf.offloads |= - dev_conf.rxmode.offloads; - } - /* Apply Tx offloads configuration */ -@@ -2889,7 +2904,7 @@ start_port(portid_t pid) - for (k = 0; - k < port->dev_info.max_tx_queues; - k++) -- port->tx_conf[k].offloads |= -+ port->txq[k].conf.offloads |= - dev_conf.txmode.offloads; - } - } -@@ -2897,20 +2912,28 @@ start_port(portid_t pid) +@@ -2508,20 +2523,28 @@ start_port(portid_t pid) @@ -643,2 +588,2 @@ - if (port->port_status == RTE_PORT_HANDLING) -@@ -2943,7 +2966,7 @@ start_port(portid_t pid) + if (rte_atomic16_cmpset(&(port->port_status), +@@ -2553,7 +2576,7 @@ start_port(portid_t pid) @@ -653 +598 @@ -@@ -2958,7 +2981,7 @@ start_port(portid_t pid) +@@ -2569,7 +2592,7 @@ start_port(portid_t pid) @@ -662,2 +607,2 @@ -@@ -3734,59 +3757,59 @@ rxtx_port_config(portid_t pid) - struct rte_port *port = &ports[pid]; +@@ -3293,51 +3316,51 @@ rxtx_port_config(struct rte_port *port) + uint64_t offloads; @@ -670,10 +614,0 @@ - - if (rxq_share > 0 && - (port->dev_info.dev_capa & RTE_ETH_DEV_CAPA_RXQ_SHARE)) { - /* Non-zero share group to enable RxQ share. */ -- port->rx_conf[qid].share_group = pid / rxq_share + 1; -- port->rx_conf[qid].share_qid = qid; /* Equal mapping. */ -+ port->rxq[qid].conf.share_group = pid / rxq_share + 1; -+ port->rxq[qid].conf.share_qid = qid; /* Equal mapping. */ - } - @@ -740,8 +675,9 @@ -@@ -3867,7 +3890,7 @@ init_port_config(void) - for (i = 0; - i < port->dev_info.nb_rx_queues; - i++) -- port->rx_conf[i].offloads &= -+ port->rxq[i].conf.offloads &= - ~RTE_ETH_RX_OFFLOAD_RSS_HASH; - } +@@ -3396,9 +3419,9 @@ update_jumbo_frame_offload(portid_t portid) + /* Apply JUMBO_FRAME offload configuration to Rx queue(s) */ + for (qid = 0; qid < port->dev_info.nb_rx_queues; qid++) { + if (on) +- port->rx_conf[qid].offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; ++ port->rxq[qid].conf.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; + else +- port->rx_conf[qid].offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; ++ port->rxq[qid].conf.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; @@ -749,3 +685,5 @@ -@@ -4041,7 +4064,7 @@ init_port_dcb_config(portid_t pid, - if (port_conf.rxmode.mq_mode == RTE_ETH_MQ_RX_VMDQ_DCB) { - port_conf.rxmode.offloads &= ~RTE_ETH_RX_OFFLOAD_RSS_HASH; + } + +@@ -3610,7 +3633,7 @@ init_port_dcb_config(portid_t pid, + if (port_conf.rxmode.mq_mode == ETH_MQ_RX_VMDQ_DCB) { + port_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_RSS_HASH; @@ -755 +693 @@ - ~RTE_ETH_RX_OFFLOAD_RSS_HASH; + ~DEV_RX_OFFLOAD_RSS_HASH; @@ -759 +697 @@ -index 8ee682b362..63e19c9aef 100644 +index 2a6312217d..5fa898eb96 100644 @@ -762 +700 @@ -@@ -136,6 +136,7 @@ struct fwd_stream { +@@ -128,6 +128,7 @@ struct fwd_stream { @@ -770,2 +708,2 @@ -@@ -240,6 +241,18 @@ struct xstat_display_info { - bool allocated; +@@ -195,6 +196,18 @@ struct tunnel_ops { + uint32_t items:1; @@ -789 +727 @@ -@@ -262,8 +275,8 @@ struct rte_port { +@@ -217,8 +230,8 @@ struct rte_port { @@ -799,2 +737,2 @@ - queueid_t queue_nb; /**< nb. of queues for flow rules */ -@@ -326,12 +339,14 @@ struct fwd_lcore { + uint8_t slave_flag; /**< bonding slave port */ +@@ -271,12 +284,14 @@ struct fwd_lcore { @@ -816 +754 @@ -index fc039a622c..e1bc78b73d 100644 +index 9f5087d215..a7cd3bff0d 100644 @@ -819 +757 @@ -@@ -504,9 +504,17 @@ tx_only_begin(portid_t pi) +@@ -493,9 +493,17 @@ tx_only_begin(portid_t pi) @@ -836,0 +775,36 @@ +diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h +index dd7eef908d..5e8331da1c 100644 +--- a/lib/librte_ethdev/rte_ethdev.h ++++ b/lib/librte_ethdev/rte_ethdev.h +@@ -1561,6 +1561,13 @@ struct rte_eth_dev_info { + void *reserved_ptrs[2]; /**< Reserved for future fields */ + }; + ++/** ++ * RX/TX queue states ++ */ ++#define RTE_ETH_QUEUE_STATE_STOPPED 0 ++#define RTE_ETH_QUEUE_STATE_STARTED 1 ++#define RTE_ETH_QUEUE_STATE_HAIRPIN 2 ++ + /** + * Ethernet device RX queue information structure. + * Used to retrieve information about configured queue. +diff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h +index afee4b8b80..6764ffb854 100644 +--- a/lib/librte_ethdev/rte_ethdev_driver.h ++++ b/lib/librte_ethdev/rte_ethdev_driver.h +@@ -923,13 +923,6 @@ struct eth_dev_ops { + /**< Disconnect the hairpin queues of a pair from each other. */ + }; + +-/** +- * RX/TX queue states +- */ +-#define RTE_ETH_QUEUE_STATE_STOPPED 0 +-#define RTE_ETH_QUEUE_STATE_STARTED 1 +-#define RTE_ETH_QUEUE_STATE_HAIRPIN 2 +- + /** + * @internal + * Check if the selected Rx queue is hairpin queue.