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 9445C42A90; Mon, 8 May 2023 05:12:54 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6BA6B40DDC; Mon, 8 May 2023 05:12:54 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 688DC40A84 for ; Mon, 8 May 2023 05:12:52 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4QF5pd19t6zpTwt; Mon, 8 May 2023 11:08:41 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemi500020.china.huawei.com (7.221.188.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 8 May 2023 11:12:49 +0800 From: Jie Hai To: Aman Singh , Yuying Zhang , Anatoly Burakov , Matan Azrad , Dmitry Kozlyuk CC: , Subject: [PATCH v2] app/test-pmd: fix not polling all queues without deferred starting Date: Mon, 8 May 2023 11:10:45 +0800 Message-ID: <20230508031046.34346-1-haijie1@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230506092635.35968-1-haijie1@huawei.com> References: <20230506092635.35968-1-haijie1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemi500020.china.huawei.com (7.221.188.8) X-CFilter-Loop: Reflected 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 Each stream has a read-only "disabled" field that control if this stream should be used to forward. This field depends on states of Rx/Tx queues, please see commit 3c4426db54fc ("app/testpmd: do not poll stopped queues"). Currently, the testpmd and DPDK frameworks maintain queue state separately. That of the primary process of testpmd are set by deferred_start in the queue configuration. And that of the framework(dev->data->rx_queue_state or dev->data->tx_queue_state) is set when the driver enables/disables the queue, and it is shared between the primary/secondary process. If the deferred_start is set, the queue is disabled and the corresponding queue state in the framework changes to stopped. However, the queue state in the framework does not only come from this. If the primary/secondary process stops a queue, the related queue state will change, too. However, the primary process of testpmd does not know the change brought by this operation. Therefore, setting the queue state in the primary testpmd by only the deferred_start is unsafe. For example, Rx/Tx queues who are stopped before the operations of stopping and starting port cannot forward packets after these operations on primary process. Therefore, the primary process should getting the queue state from of the framework as the secondary process does, please see commit e065c9aa3e05 ("app/testpmd: fix secondary process packet forwarding"). Fixes: 3c4426db54fc ("app/testpmd: do not poll stopped queues") Cc: stable@dpdk.org Signed-off-by: Jie Hai --- v1-v2: 1. Fix misspelled word 'deferred'. 2. Fix incorrect format of reference to commits. --- app/test-pmd/testpmd.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 5cb6f9252395..a07a67a2639e 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -2502,8 +2502,7 @@ start_packet_forwarding(int with_tx_first) return; if (stream_init != NULL) { - if (rte_eal_process_type() == RTE_PROC_SECONDARY) - update_queue_state(); + update_queue_state(); for (i = 0; i < cur_fwd_config.nb_fwd_streams; i++) stream_init(fwd_streams[i]); } @@ -2860,9 +2859,6 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, socket_id, rx_conf, mp); } - 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; } @@ -3129,9 +3125,6 @@ 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, @@ -3144,13 +3137,8 @@ start_port(portid_t pid) port->socket_id, &(port->txq[qi].conf)); - if (diag == 0) { - port->txq[qi].state = - conf->tx_deferred_start ? - RTE_ETH_QUEUE_STATE_STOPPED : - RTE_ETH_QUEUE_STATE_STARTED; + if (diag == 0) continue; - } /* Fail to setup tx queue, return */ if (port->port_status == RTE_PORT_HANDLING) @@ -3266,8 +3254,7 @@ start_port(portid_t pid) pl[cfg_pi++] = pi; } - if (rte_eal_process_type() == RTE_PROC_SECONDARY) - update_queue_state(); + update_queue_state(); if (at_least_one_port_successfully_started && !no_link_check) check_all_ports_link_status(RTE_PORT_ALL); -- 2.33.0