From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 42CBBA04C8; Sat, 19 Sep 2020 12:47:54 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8A7D51D9D6; Sat, 19 Sep 2020 12:47:36 +0200 (CEST) Received: from m12-13.163.com (m12-13.163.com [220.181.12.13]) by dpdk.org (Postfix) with ESMTP id 20C4A1C1AD for ; Sat, 19 Sep 2020 12:47:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=rI2GL5Kf6Fe10OduMz 6n8CaFFq0fzChodrOez4FZ96c=; b=SfQg5En5lN01aVvrfQaxEoENUlmdxEed7G JCYCRylfLg0zSkAsUs7GzXY2aM6LAK1damgs7kPLBmDBRsilWXGORrO1DyyCKnF5 zntAo7RDk7hgINNL4R6SWCitZR3Dq4YPT1L5NLu/5VdCwCqsfXtN/a4OWG+eMweU GpDqROQFo= Received: from localhost.localdomain (unknown [65.49.108.226]) by smtp9 (Coremail) with SMTP id DcCowAB3fIit4WVfEoCpHA--.12337S5; Sat, 19 Sep 2020 18:47:33 +0800 (CST) From: "Wei Hu (Xavier)" To: dev@dpdk.org Cc: xavier.huwei@huawei.com Date: Sat, 19 Sep 2020 18:47:05 +0800 Message-Id: <20200919104708.58451-4-xavier_huwei@163.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20200919104708.58451-1-xavier_huwei@163.com> References: <20200818120254.72792-1-huwei013@chinasoftinc.com> <20200919104708.58451-1-xavier_huwei@163.com> X-CM-TRANSID: DcCowAB3fIit4WVfEoCpHA--.12337S5 X-Coremail-Antispam: 1Uf129KBjvJXoW7Cry7Aw1ktF4UGFW5Gw4DArb_yoW5JFy3pF 4fKa4Skw48tr4akrW3J3W8K3WfKr4fWw4UJr93Gr1DJr1kJF4xWr4kK34xZrykGryDJFWr ZrZIgFs5Kr1DX3DanT9S1TB71UUUUUDqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jDSdgUUUUU= X-Originating-IP: [65.49.108.226] X-CM-SenderInfo: 50dyxv5ubk34lhl6il2tof0z/1tbiQAWko1SIgZe27QAAsT Subject: [dpdk-dev] [PATCH v3 3/6] app/testpmd: remove restriction on txpkts set 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: Chengchang Tang Currently, if nb_txd is not set, the txpkts is not allowed to be set because the nb_txd is used to avoid the numer of segments exceed the Tx ring size and the default value of nb_txd is 0. And there is a bug that nb_txd is the global configuration for Tx ring size and the ring size could be changed by some command per queue. So these valid check is unreliable and introduced unnecessary constraints. This patch adds a valid check function to use the real Tx ring size to check the validity of txpkts. Fixes: af75078fece3 ("first public release") Cc: stable@dpdk.org Signed-off-by: Chengchang Tang Signed-off-by: Wei Hu (Xavier) --- app/test-pmd/config.c | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 4e33208..882de2d 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2984,17 +2984,51 @@ show_tx_pkt_segments(void) printf("Split packet: %s\n", split); } +static bool +nb_segs_is_invalid(unsigned int nb_segs) +{ + uint16_t port_id; + + RTE_ETH_FOREACH_DEV(port_id) { + struct rte_port *port = &ports[port_id]; + uint16_t ring_size; + uint16_t queue_id; + + /* + * When configure the txq by rte_eth_tx_queue_setup with + * nb_tx_desc being 0, it will use a default value provided by + * PMDs to setup this txq. If the default value is 0, it will + * use the RTE_ETH_DEV_FALLBACK_TX_RINGSIZE to setup this txq. + */ + for (queue_id = 0; queue_id < nb_txq; queue_id++) { + if (port->nb_tx_desc[queue_id]) + ring_size = port->nb_tx_desc[queue_id]; + else if (port->dev_info.default_txportconf.ring_size) + ring_size = + port->dev_info.default_txportconf.ring_size; + else + ring_size = RTE_ETH_DEV_FALLBACK_TX_RINGSIZE; + + if (ring_size < nb_segs) { + printf("nb segments per TX packets=%u >= TX " + "queue(%u) ring_size=%u - ignored\n", + nb_segs, queue_id, ring_size); + return true; + } + } + } + + return false; +} + void set_tx_pkt_segments(unsigned *seg_lengths, unsigned nb_segs) { uint16_t tx_pkt_len; unsigned i; - if (nb_segs >= (unsigned) nb_txd) { - printf("nb segments per TX packets=%u >= nb_txd=%u - ignored\n", - nb_segs, (unsigned int) nb_txd); + if (nb_segs_is_invalid(nb_segs)) return; - } /* * Check that each segment length is greater or equal than -- 2.9.5