From patchwork Tue Jul 27 09:25:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rohit Raj X-Patchwork-Id: 96324 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 306D4A0C47; Tue, 27 Jul 2021 11:25:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AE299410ED; Tue, 27 Jul 2021 11:25:27 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by mails.dpdk.org (Postfix) with ESMTP id B659C410EC for ; Tue, 27 Jul 2021 11:25:25 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 724D91A0D33; Tue, 27 Jul 2021 11:25:25 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 3AE981A0D30; Tue, 27 Jul 2021 11:25:25 +0200 (CEST) Received: from lsv03196.swis.in-blr01.nxp.com (lsv03196.swis.in-blr01.nxp.com [92.120.146.192]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 41710183AD14; Tue, 27 Jul 2021 17:25:24 +0800 (+08) From: rohit.raj@nxp.com To: Cc: dev@dpdk.org, nipun.gupta@nxp.com, hemant.agrawal@nxp.com, Rohit Raj , Sachin Saxena , Vanshika Shukla Date: Tue, 27 Jul 2021 14:55:23 +0530 Message-Id: <20210727092523.22718-1-rohit.raj@nxp.com> X-Mailer: git-send-email 2.17.1 X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v1] examples/l3fwd: fix jumbo packet drop issue 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 Sender: "dev" From: Rohit Raj l3fwd uses mbufs with 2KB data size. If we enable jumbo packets, it is not able to store packets with size greater than 2KB, hence these packets are dropped. This patch fixes this issue by enabling scatter for jumbo packet, if it is supported by NIC. If scatter is not supported by NIC and max jumbo packet length is greater than default mbuf data size, then application exits with proper error message. Fixes: f68aad7904f ("examples/l3fwd: update") Signed-off-by: Rohit Raj Signed-off-by: Sachin Saxena Signed-off-by: Vanshika Shukla Acked-by: Aman Deep Singh --- examples/l3fwd/main.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index 4cb800aa15..6aaaa8ecb5 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -1035,6 +1035,20 @@ l3fwd_poll_resource_setup(void) "Error during getting device (port %u) info: %s\n", portid, strerror(-ret)); + /* Enable Receive side SCATTER, if supported by NIC, + * when jumbo packet is enabled. + */ + if (local_port_conf.rxmode.offloads & + DEV_RX_OFFLOAD_JUMBO_FRAME){ + if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_SCATTER) + local_port_conf.rxmode.offloads |= + DEV_RX_OFFLOAD_SCATTER; + else if (local_port_conf.rxmode.max_rx_pkt_len > + RTE_MBUF_DEFAULT_DATAROOM) + rte_exit(EXIT_FAILURE, + "Max packet length greater than default MBUF size\n"); + } + if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE) local_port_conf.txmode.offloads |= DEV_TX_OFFLOAD_MBUF_FAST_FREE;