[v2] examples/l3fwd: fix jumbo packet drop issue

Message ID 20211112031635.11400-1-rohit.raj@nxp.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers
Series [v2] examples/l3fwd: fix jumbo packet drop issue |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/github-robot: build success github build: passed
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing fail Testing issues
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS

Commit Message

Rohit Raj Nov. 12, 2021, 3:16 a.m. UTC
  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(+)
  

Comments

Ananyev, Konstantin Nov. 12, 2021, 9:40 a.m. UTC | #1
> 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.
> +		 */


From the code below, it looks like you always enable scatter if HW supports it.
Without paying attention to max_pkt_len provided by user. 

> +		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
  
Rohit Raj Nov. 16, 2021, 6:08 a.m. UTC | #2
> -----Original Message-----
> From: Ananyev, Konstantin <konstantin.ananyev@intel.com>
> Sent: Friday, November 12, 2021 3:11 PM
> To: Rohit Raj <rohit.raj@nxp.com>; dev@dpdk.org; Yigit, Ferruh
> <ferruh.yigit@intel.com>
> Cc: Nipun Gupta <nipun.gupta@nxp.com>; Sachin Saxena
> <sachin.saxena@nxp.com>; Vanshika Shukla <vanshika.shukla@nxp.com>
> Subject: [EXT] RE: [PATCH v2] examples/l3fwd: fix jumbo packet drop issue
> 
> Caution: EXT Email
> 
> > 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.
> > +              */
> 
> 
> From the code below, it looks like you always enable scatter if HW supports it.
> Without paying attention to max_pkt_len provided by user.

You are right. I will fix this check in next updated version of patch.
> 
> > +             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
  

Patch

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;