From patchwork Fri Feb 16 03:47:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kumara Parameshwaran X-Patchwork-Id: 136842 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E42E743B24; Fri, 16 Feb 2024 04:48:10 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 69A0E40284; Fri, 16 Feb 2024 04:48:10 +0100 (CET) Received: from mail-il1-f177.google.com (mail-il1-f177.google.com [209.85.166.177]) by mails.dpdk.org (Postfix) with ESMTP id 0A4334027C for ; Fri, 16 Feb 2024 04:48:09 +0100 (CET) Received: by mail-il1-f177.google.com with SMTP id e9e14a558f8ab-363afc38a1cso5417055ab.3 for ; Thu, 15 Feb 2024 19:48:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708055288; x=1708660088; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Yx9mRb3bCGyPzLEnUyeWhggPDSCUqJWQrssl/60fGWs=; b=QrcSXCXpUQMMa770/B2Wr8myfkAcBrsYaEK1paDRBxkFPDPcLfiVD8R9GroSzSqjQL 2snfRkrLyaReyP8JMI3jm1vbtzrhKMQKFEIOM7WTjUuQizYQDpQQcahfh0Ylvuv6yqQu NG5doqn9961cuZvgnxqUyqMpLRU5kLteeagbWHpku5h+O+VGApxmHXoTta630D+AWAa7 Pje4HfyW+ykR6c57NQ6PHrgA++EtAJgz7KrmJF0qGul8nWa5iY6MnHy2yOnrzU+UYD1n GlvxI6+xwLa24XIxjjabjzmMKdJ/cCbaayUU5hi3QWLXYoBkQb1lJruAYkoLy+0vjjFa i6XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708055288; x=1708660088; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Yx9mRb3bCGyPzLEnUyeWhggPDSCUqJWQrssl/60fGWs=; b=EemB8yH/sny97WbCQ0B/rpRQhAqAf2DwPVFL1QNI45L1QiraoMrBaRH/e75pbdJt0r o2skaVmr+69f2NbPlmn1iQejOA58RLLVtxx0QpQRI1NR8JRKDNhhMChDYJRzUs4fXEaY EsE4oDtczwApndQ2T9rrw3NeYTFzPw5WwFBVUi7gVQzPHUgk0Y9lopM3n3nARekNNi8A 2aO6GdWGo6C+dwjWbI/kwCNneES9P9Nn0tAGyxsyp98wHVFvqNZPHsbjB+slJWLOr4+w 7smhHiv/xPWgR6x4L/i1KaSmNTc+s3PltkeawH0zUEy7h3dRij/TXWnj9HaBp8GqsdiE lWKw== X-Gm-Message-State: AOJu0Yy372KbRO235sPJel0NoMZv9/1zxM4OEkXPqqSY00DIuOFgvcPM LQaLPv8yDIUUg6izmpbnxU1IRgfIxujcBER7fibnqxjcZ1kxhAQC X-Google-Smtp-Source: AGHT+IGymUlc5nuNfdH0t9+liW8/mJ0B6ZS0zN9IcWkuP3fdujgaR5ZK+8eWNUVnhK3Ih0UZphl5Ww== X-Received: by 2002:a92:cd10:0:b0:364:f536:b8a7 with SMTP id z16-20020a92cd10000000b00364f536b8a7mr3958634iln.10.1708055288147; Thu, 15 Feb 2024 19:48:08 -0800 (PST) Received: from IDCREDBOX918.fareast.corp.microsoft.com ([167.220.238.89]) by smtp.gmail.com with ESMTPSA id p15-20020a637f4f000000b005dc832ed816sm2194065pgn.59.2024.02.15.19.48.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 19:48:07 -0800 (PST) From: Kumara Parameshwaran To: hujiayu.hu@foxmail.com Cc: dev@dpdk.org, Kumara Parameshwaran Subject: [PATCH v8] app/testpmd : fix packets not getting flushed in heavy-weight mode API Date: Fri, 16 Feb 2024 09:17:50 +0530 Message-Id: <20240216034750.47539-1-kumaraparamesh92@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240117195228.423261-1-kumaraparamesh92@gmail.com> References: <20240117195228.423261-1-kumaraparamesh92@gmail.com> MIME-Version: 1.0 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 In heavy-weight mode GRO which is based on timer, the GRO packets will not be flushed in spite of timer expiry if there is no packet in the current poll. If timer mode GRO is enabled the rte_gro_timeout_flush API should be invoked. Fixes: b7091f1dcfbc ("app/testpmd: enable the heavyweight mode TCP/IPv4 GRO") Cc: hujiayu.hu@foxmail.com Signed-off-by: Kumara Parameshwaran Reviewed-by: Ferruh Yigit --- v1: Changes to make sure that the GRO flush API is invoked if there are no packets in current poll and timer expiry. v2: Fix code organisation issue v3: Fix warnings v4: Fix error and warnings v5: Fix compilation issue when GRO is not defined v6: Address review comments v7: Address review comments v8: Fix spell check warnings app/test-pmd/csumonly.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index c103e54111..a922160f6d 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -863,16 +863,29 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) /* receive a burst of packet */ nb_rx = common_fwd_stream_receive(fs, pkts_burst, nb_pkt_per_burst); - if (unlikely(nb_rx == 0)) + if (unlikely(nb_rx == 0)) { +#ifndef RTE_LIB_GRO return false; +#else + gro_enable = gro_ports[fs->rx_port].enable; + /* + * Make sure that in case of Heavyweight mode GRO the packets in + * GRO cache should be flushed as the timer could have expired. + * + * The order of conditions should be the same as gro_ctx is valid + * only when gro_flush_cycles is not the GRO_DEFAULT_FLUSH_CYCLES which + * indicates light weight mode GRO + */ + if (!gro_enable || (gro_flush_cycles == GRO_DEFAULT_FLUSH_CYCLES) || + (rte_gro_get_pkt_count(current_fwd_lcore()->gro_ctx) == 0)) + return false; +#endif + } rx_bad_ip_csum = 0; rx_bad_l4_csum = 0; rx_bad_outer_l4_csum = 0; rx_bad_outer_ip_csum = 0; -#ifdef RTE_LIB_GRO - gro_enable = gro_ports[fs->rx_port].enable; -#endif txp = &ports[fs->tx_port]; tx_offloads = txp->dev_conf.txmode.offloads; @@ -1103,6 +1116,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) } #ifdef RTE_LIB_GRO + gro_enable = gro_ports[fs->rx_port].enable; if (unlikely(gro_enable)) { if (gro_flush_cycles == GRO_DEFAULT_FLUSH_CYCLES) { nb_rx = rte_gro_reassemble_burst(pkts_burst, nb_rx,