* [dpdk-dev] [PATCH v1] examples/l3fwd: fix jumbo packet drop issue
@ 2021-07-27 9:25 rohit.raj
2021-08-11 10:19 ` Singh, Aman Deep
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: rohit.raj @ 2021-07-27 9:25 UTC (permalink / raw)
Cc: dev, nipun.gupta, hemant.agrawal, Rohit Raj, Sachin Saxena,
Vanshika Shukla
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 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 <rohit.raj@nxp.com>
Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
---
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;
--
2.17.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH v1] examples/l3fwd: fix jumbo packet drop issue
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 ` [PATCH v2] " rohit.raj
2 siblings, 0 replies; 9+ messages in thread
From: Singh, Aman Deep @ 2021-08-11 10:19 UTC (permalink / raw)
To: rohit.raj
Cc: dev, nipun.gupta, hemant.agrawal, Sachin Saxena, Vanshika Shukla
Hi Rohit,
On 7/27/2021 2:55 PM, rohit.raj@nxp.com wrote:
> 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 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 <rohit.raj@nxp.com>
> Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
> Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
> ---
> 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;
Acked-by: Aman Deep Singh <aman.deep.singh@intel.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH v1] examples/l3fwd: fix jumbo packet drop issue
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 ` [PATCH v2] " rohit.raj
2 siblings, 0 replies; 9+ messages in thread
From: Ferruh Yigit @ 2021-08-11 11:30 UTC (permalink / raw)
To: rohit.raj
Cc: dev, nipun.gupta, hemant.agrawal, Sachin Saxena, Vanshika Shukla
On 7/27/2021 10:25 AM, rohit.raj@nxp.com wrote:
> 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 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 <rohit.raj@nxp.com>
> Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
> Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
> ---
> 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");
This is a configuration set by application. So application is failing itself
because of configuration it sets, seems odd.
I guess the jumbo frame can be enabled when user provides '--enable-jumbo'
argument. What do you think adding above check where that argument is parsed.
Btw, no need to enable scattered Rx if the packets fits into buffer, so above
check can be done slightly different:
if (max_rx_pkt_len > buffer_size)
if (OFFLOAD_SCATTER supported)
enable OFFLOAD_SCATTER
else
fail
> + }
> +
> if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
> local_port_conf.txmode.offloads |=
> DEV_TX_OFFLOAD_MBUF_FAST_FREE;
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2] examples/l3fwd: fix jumbo packet drop issue
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
2021-11-12 9:40 ` Ananyev, Konstantin
2 siblings, 1 reply; 9+ messages in thread
From: rohit.raj @ 2021-11-12 3:16 UTC (permalink / raw)
To: dev, ferruh.yigit; +Cc: nipun.gupta, Rohit Raj, Sachin Saxena, Vanshika Shukla
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH v2] examples/l3fwd: fix jumbo packet drop issue
2021-11-12 3:16 ` [PATCH v2] " rohit.raj
@ 2021-11-12 9:40 ` Ananyev, Konstantin
2021-11-16 6:08 ` [EXT] " Rohit Raj
0 siblings, 1 reply; 9+ messages in thread
From: Ananyev, Konstantin @ 2021-11-12 9:40 UTC (permalink / raw)
To: rohit.raj, dev, Yigit, Ferruh; +Cc: nipun.gupta, Sachin Saxena, Vanshika Shukla
> 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [EXT] RE: [PATCH v2] examples/l3fwd: fix jumbo packet drop issue
2021-11-12 9:40 ` Ananyev, Konstantin
@ 2021-11-16 6:08 ` Rohit Raj
0 siblings, 0 replies; 9+ messages in thread
From: Rohit Raj @ 2021-11-16 6:08 UTC (permalink / raw)
To: Ananyev, Konstantin, dev, Yigit, Ferruh
Cc: Nipun Gupta, Sachin Saxena, Vanshika Shukla
> -----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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH v1] examples/l3fwd: fix jumbo packet drop issue
@ 2021-08-13 4:48 Rohit Raj
2021-08-13 8:42 ` Ferruh Yigit
0 siblings, 1 reply; 9+ messages in thread
From: Rohit Raj @ 2021-08-13 4:48 UTC (permalink / raw)
To: Ferruh Yigit
Cc: dev, Nipun Gupta, Hemant Agrawal, Sachin Saxena, Vanshika Shukla
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Wednesday, August 11, 2021 5:01 PM
> To: Rohit Raj <rohit.raj@nxp.com>
> Cc: dev@dpdk.org; Nipun Gupta <nipun.gupta@nxp.com>; Hemant Agrawal
> <hemant.agrawal@nxp.com>; Sachin Saxena <sachin.saxena@nxp.com>;
> Vanshika Shukla <vanshika.shukla@nxp.com>
> Subject: Re: [dpdk-dev] [PATCH v1] examples/l3fwd: fix jumbo packet drop
> issue
>
> On 7/27/2021 10:25 AM, rohit.raj@nxp.com wrote:
> > 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 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 <rohit.raj@nxp.com>
> > Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
> > Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
> > ---
> > 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");
>
> This is a configuration set by application. So application is failing itself because
> of configuration it sets, seems odd.
>
> I guess the jumbo frame can be enabled when user provides '--enable-jumbo'
> argument. What do you think adding above check where that argument is
> parsed.
We need to check if hardware supports Rx scatter. To do this, we need to get Rx
capability. Hence, this is a better place to perform this check.
>
> Btw, no need to enable scattered Rx if the packets fits into buffer, so above
> check can be done slightly different:
>
> if (max_rx_pkt_len > buffer_size)
> if (OFFLOAD_SCATTER supported)
> enable OFFLOAD_SCATTER
> else
> fail
Agreed. I will do this in next version of the patch.
>
>
> > + }
> > +
> > if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
> > local_port_conf.txmode.offloads |=
> > DEV_TX_OFFLOAD_MBUF_FAST_FREE;
> >
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH v1] examples/l3fwd: fix jumbo packet drop issue
2021-08-13 4:48 [dpdk-dev] [PATCH v1] " Rohit Raj
@ 2021-08-13 8:42 ` Ferruh Yigit
2021-10-19 21:22 ` Ferruh Yigit
0 siblings, 1 reply; 9+ messages in thread
From: Ferruh Yigit @ 2021-08-13 8:42 UTC (permalink / raw)
To: Rohit Raj
Cc: dev, Nipun Gupta, Hemant Agrawal, Sachin Saxena, Vanshika Shukla
On 8/13/2021 5:48 AM, Rohit Raj wrote:
>
>
>> -----Original Message-----
>> From: Ferruh Yigit <ferruh.yigit@intel.com>
>> Sent: Wednesday, August 11, 2021 5:01 PM
>> To: Rohit Raj <rohit.raj@nxp.com>
>> Cc: dev@dpdk.org; Nipun Gupta <nipun.gupta@nxp.com>; Hemant Agrawal
>> <hemant.agrawal@nxp.com>; Sachin Saxena <sachin.saxena@nxp.com>;
>> Vanshika Shukla <vanshika.shukla@nxp.com>
>> Subject: Re: [dpdk-dev] [PATCH v1] examples/l3fwd: fix jumbo packet drop
>> issue
>>
>> On 7/27/2021 10:25 AM, rohit.raj@nxp.com wrote:
>>> 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 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 <rohit.raj@nxp.com>
>>> Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
>>> Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
>>> ---
>>> 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");
>>
>> This is a configuration set by application. So application is failing itself because
>> of configuration it sets, seems odd.
>>
>> I guess the jumbo frame can be enabled when user provides '--enable-jumbo'
>> argument. What do you think adding above check where that argument is
>> parsed.
>
> We need to check if hardware supports Rx scatter. To do this, we need to get Rx
> capability. Hence, this is a better place to perform this check.
>
Got it.
There is already a patch [1] that I am trying to update the 'max_rx_pkt_len'
usage and remove OFFLOAD_JUMBO_FRAME flag [2] etc.. Those touch to the same
piece of code, can you please check them?
After those patches, your update can be put into 'config_port_max_pkt_len()' I
think. Can you be OK to wait them to merged first and make you patch on top of it?
[1]
https://patches.dpdk.org/project/dpdk/patch/20210722172113.3236450-1-ferruh.yigit@intel.com/
[2]
https://patches.dpdk.org/project/dpdk/patch/20210722172113.3236450-4-ferruh.yigit@intel.com/
>>
>> Btw, no need to enable scattered Rx if the packets fits into buffer, so above
>> check can be done slightly different:
>>
>> if (max_rx_pkt_len > buffer_size)
>> if (OFFLOAD_SCATTER supported)
>> enable OFFLOAD_SCATTER
>> else
>> fail
>
> Agreed. I will do this in next version of the patch.
>
>>
>>
>>> + }
>>> +
>>> if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
>>> local_port_conf.txmode.offloads |=
>>> DEV_TX_OFFLOAD_MBUF_FAST_FREE;
>>>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH v1] examples/l3fwd: fix jumbo packet drop issue
2021-08-13 8:42 ` Ferruh Yigit
@ 2021-10-19 21:22 ` Ferruh Yigit
0 siblings, 0 replies; 9+ messages in thread
From: Ferruh Yigit @ 2021-10-19 21:22 UTC (permalink / raw)
To: Rohit Raj
Cc: dev, Nipun Gupta, Hemant Agrawal, Sachin Saxena, Vanshika Shukla
On 8/13/2021 9:42 AM, Ferruh Yigit wrote:
> On 8/13/2021 5:48 AM, Rohit Raj wrote:
>>
>>
>>> -----Original Message-----
>>> From: Ferruh Yigit <ferruh.yigit@intel.com>
>>> Sent: Wednesday, August 11, 2021 5:01 PM
>>> To: Rohit Raj <rohit.raj@nxp.com>
>>> Cc: dev@dpdk.org; Nipun Gupta <nipun.gupta@nxp.com>; Hemant Agrawal
>>> <hemant.agrawal@nxp.com>; Sachin Saxena <sachin.saxena@nxp.com>;
>>> Vanshika Shukla <vanshika.shukla@nxp.com>
>>> Subject: Re: [dpdk-dev] [PATCH v1] examples/l3fwd: fix jumbo packet drop
>>> issue
>>>
>>> On 7/27/2021 10:25 AM, rohit.raj@nxp.com wrote:
>>>> 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 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 <rohit.raj@nxp.com>
>>>> Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
>>>> Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
>>>> ---
>>>> 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");
>>>
>>> This is a configuration set by application. So application is failing itself because
>>> of configuration it sets, seems odd.
>>>
>>> I guess the jumbo frame can be enabled when user provides '--enable-jumbo'
>>> argument. What do you think adding above check where that argument is
>>> parsed.
>>
>> We need to check if hardware supports Rx scatter. To do this, we need to get Rx
>> capability. Hence, this is a better place to perform this check.
>>
>
> Got it.
>
> There is already a patch [1] that I am trying to update the 'max_rx_pkt_len'
> usage and remove OFFLOAD_JUMBO_FRAME flag [2] etc.. Those touch to the same
> piece of code, can you please check them?
>
> After those patches, your update can be put into 'config_port_max_pkt_len()' I
> think. Can you be OK to wait them to merged first and make you patch on top of it?
>
> [1]
> https://patches.dpdk.org/project/dpdk/patch/20210722172113.3236450-1-ferruh.yigit@intel.com/
>
> [2]
> https://patches.dpdk.org/project/dpdk/patch/20210722172113.3236450-4-ferruh.yigit@intel.com/
>
Hi Rohit,
Can you please check this patch on top of latest next-net?
Since 'DEV_RX_OFFLOAD_JUMBO_FRAME' is removed, only 'DEV_RX_OFFLOAD_SCATTER' capability
check can be sufficient.
And still same comment on 'RTE_MBUF_DEFAULT_DATAROOM' check, it is application's
responsibility to allocate the mempool for mbufs, so instead of checking the
mbuf buffer size and fail, application can allocate mempool size based on
user provided frame size value if driver doesn't support scattered Rx.
Thanks,
ferruh
>>>
>>> Btw, no need to enable scattered Rx if the packets fits into buffer, so above
>>> check can be done slightly different:
>>>
>>> if (max_rx_pkt_len > buffer_size)
>>> if (OFFLOAD_SCATTER supported)
>>> enable OFFLOAD_SCATTER
>>> else
>>> fail
>>
>> Agreed. I will do this in next version of the patch.
>>
>>>
>>>
>>>> + }
>>>> +
>>>> if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
>>>> local_port_conf.txmode.offloads |=
>>>> DEV_TX_OFFLOAD_MBUF_FAST_FREE;
>>>>
>>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-11-16 6:08 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH v2] " rohit.raj
2021-11-12 9:40 ` Ananyev, Konstantin
2021-11-16 6:08 ` [EXT] " Rohit Raj
2021-08-13 4:48 [dpdk-dev] [PATCH v1] " Rohit Raj
2021-08-13 8:42 ` Ferruh Yigit
2021-10-19 21:22 ` Ferruh Yigit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).