All of lore.kernel.org
 help / color / mirror / Atom feed
From: rohit.raj@nxp.com
To: dev@dpdk.org, ferruh.yigit@intel.com
Cc: nipun.gupta@nxp.com, Rohit Raj <rohit.raj@nxp.com>,
	Sachin Saxena <sachin.saxena@nxp.com>,
	Vanshika Shukla <vanshika.shukla@nxp.com>
Subject: [PATCH v2] examples/l3fwd: fix jumbo packet drop issue
Date: Fri, 12 Nov 2021 08:46:35 +0530	[thread overview]
Message-ID: <20211112031635.11400-1-rohit.raj@nxp.com> (raw)
In-Reply-To: <20210727092523.22718-1-rohit.raj@nxp.com>

From: Rohit Raj <rohit.raj@nxp.com>

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 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 <rohit.raj@nxp.com>
Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
---

v2:
* Improved the check to not enable Rx scatter when packets fits into
  buffer.
* Check if jumbo packet is enabled using max_rx_pktlen instead of
  jumbo packet flag.

 examples/l3fwd/main.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index d69373f881..61448c759c 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -1109,6 +1109,19 @@ l3fwd_poll_resource_setup(void)
 				"Invalid max packet length: %u (port %u)\n",
 				max_pkt_len, portid);
 
+		/* Enable Receive side SCATTER, if supported by NIC,
+		 * when jumbo packet is enabled.
+		 */
+		if (dev_info.max_rx_pktlen > RTE_MBUF_DEFAULT_DATAROOM) {
+			if (dev_info.rx_offload_capa &
+			    RTE_ETH_RX_OFFLOAD_SCATTER)
+				local_port_conf.rxmode.offloads |=
+						RTE_ETH_RX_OFFLOAD_SCATTER;
+			else
+				rte_exit(EXIT_FAILURE,
+					 "Max packet length greater than default MBUF size\n");
+		}
+
 		if (dev_info.tx_offload_capa & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)
 			local_port_conf.txmode.offloads |=
 				RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
-- 
2.17.1


  parent reply	other threads:[~2021-11-12  3:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27  9:25 [dpdk-dev] [PATCH v1] examples/l3fwd: fix jumbo packet drop issue rohit.raj
2021-08-11 10:19 ` Singh, Aman Deep
2021-08-11 11:30 ` Ferruh Yigit
2021-11-12  3:16 ` rohit.raj [this message]
2021-11-12  9:40   ` [PATCH v2] " Ananyev, Konstantin
2021-11-16  6:08     ` [EXT] " Rohit Raj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211112031635.11400-1-rohit.raj@nxp.com \
    --to=rohit.raj@nxp.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=nipun.gupta@nxp.com \
    --cc=sachin.saxena@nxp.com \
    --cc=vanshika.shukla@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.