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 0066245DA7; Tue, 26 Nov 2024 08:39:30 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8DC774025F; Tue, 26 Nov 2024 08:39:30 +0100 (CET) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by mails.dpdk.org (Postfix) with ESMTP id 62895400EF for ; Tue, 26 Nov 2024 08:39:29 +0100 (CET) Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4XyDtS2yN1z2Gbrx; Tue, 26 Nov 2024 15:37:20 +0800 (CST) Received: from kwepemf500004.china.huawei.com (unknown [7.202.181.242]) by mail.maildlp.com (Postfix) with ESMTPS id DE6301A0188; Tue, 26 Nov 2024 15:39:26 +0800 (CST) Received: from [10.67.121.175] (10.67.121.175) by kwepemf500004.china.huawei.com (7.202.181.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 26 Nov 2024 15:39:26 +0800 Message-ID: <4e9583d6-24ef-b76d-7b31-9d9960a3af1b@huawei.com> Date: Tue, 26 Nov 2024 15:39:25 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH] examples/l3fwd: fix Tx performance deteriorate To: Konstantin Ananyev , "dev@dpdk.org" , "thomas@monjalon.net" , "ferruh.yigit@amd.com" , =?UTF-8?Q?Morten_Br=c3=b8rup?= , Fengchengwen , "lihuisong (C)" CC: huangdengdui References: <20241122071336.18470-1-haijie1@huawei.com> From: Jie Hai In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.121.175] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemf500004.china.huawei.com (7.202.181.242) 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 Hi, konstantin.ananyev, That sounds better, will send V2。 Thanks, Jie Hai > > In commit: > examples/l3fwd: add option to set Rx burst size > you introduced new global > uint32_t nb_pkt_per_burst; > Why not to use it for both (rx and tx) paths? > Or if necessary introduce another one for tx, so we'll have: > uint32_t nb_rx_pkt_per_burst, nb_tx_pkt_per_burst,; > To me that is much better then create some hardcoded > and implicit thresholds. > >> Fixes: d5c4897ecfb2 ("examples/l3fwd: add option to set Rx burst size") >> >> Signed-off-by: Jie Hai >> --- >> examples/l3fwd/l3fwd.h | 8 +++++--- >> examples/l3fwd/l3fwd_common.h | 6 +++--- >> 2 files changed, 8 insertions(+), 6 deletions(-) >> >> diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h >> index 0cce3406ee7d..a01fecd51261 100644 >> --- a/examples/l3fwd/l3fwd.h >> +++ b/examples/l3fwd/l3fwd.h >> @@ -35,7 +35,7 @@ >> /* >> * Try to avoid TX buffering if we have at least MAX_TX_BURST packets to send. >> */ >> -#define MAX_TX_BURST (MAX_PKT_BURST / 2) >> +#define MAX_TX_BURST DEFAULT_PKT_BURST >> >> #define NB_SOCKETS 8 >> >> @@ -57,6 +57,8 @@ >> #define L3FWD_HASH_ENTRIES (1024*1024*1) >> #endif >> >> +static_assert(MAX_TX_BURST <= MAX_PKT_BURST, "MAX_TX_BURST should be at most MAX_PKT_BURST"); >> + >> struct parm_cfg { >> const char *rule_ipv4_name; >> const char *rule_ipv6_name; >> @@ -152,8 +154,8 @@ send_single_packet(struct lcore_conf *qconf, >> len++; >> >> /* enough pkts to be sent */ >> - if (unlikely(len == MAX_PKT_BURST)) { >> - send_burst(qconf, MAX_PKT_BURST, port); >> + if (unlikely(len == MAX_TX_BURST)) { >> + send_burst(qconf, MAX_TX_BURST, port); >> len = 0; >> } >> >> diff --git a/examples/l3fwd/l3fwd_common.h b/examples/l3fwd/l3fwd_common.h >> index d94e5f135791..3f504dc0a552 100644 >> --- a/examples/l3fwd/l3fwd_common.h >> +++ b/examples/l3fwd/l3fwd_common.h >> @@ -71,7 +71,7 @@ send_packetsx4(struct lcore_conf *qconf, uint16_t port, struct rte_mbuf *m[], >> * If TX buffer for that queue is empty, and we have enough packets, >> * then send them straightway. >> */ >> - if (num >= MAX_TX_BURST && len == 0) { >> + if (num >= MAX_TX_BURST / 2 && len == 0) { >> n = rte_eth_tx_burst(port, qconf->tx_queue_id[port], m, num); >> if (unlikely(n < num)) { >> do { >> @@ -112,9 +112,9 @@ send_packetsx4(struct lcore_conf *qconf, uint16_t port, struct rte_mbuf *m[], >> len += n; >> >> /* enough pkts to be sent */ >> - if (unlikely(len == MAX_PKT_BURST)) { >> + if (unlikely(len > MAX_TX_BURST)) { >> >> - send_burst(qconf, MAX_PKT_BURST, port); >> + send_burst(qconf, len, port); >> >> /* copy rest of the packets into the TX buffer. */ >> len = num - n; >> -- >> 2.22.0 >