DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2] examples/ip_fragmentation: support big packets
@ 2019-01-13 11:37 Noa Ezra
  2019-01-14 12:55 ` Ananyev, Konstantin
  0 siblings, 1 reply; 3+ messages in thread
From: Noa Ezra @ 2019-01-13 11:37 UTC (permalink / raw)
  To: konstantin.ananyev; +Cc: Asaf Penso, dev, Noa Ezra

In some vendors the RX and TX configuration must be the same, therefore
the MTU size need to be equal to max_rx_pkt_len.
The MTU is the largest size packet in bytes that can be sent on the
network, therefore before changing this parameter, the NIC could not
receive packets larger than 1500 bytes, which is the default MTU size.
In addition, scatter-gather need to be enabled in order to receive
frames bigger than mbuf size.

Signed-off-by: Noa Ezra <noae@mellanox.com>
---
v2: move set_mtu() to be done after dev_configure().

 examples/ip_fragmentation/main.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
index 17a877d..8d789b4 100644
--- a/examples/ip_fragmentation/main.c
+++ b/examples/ip_fragmentation/main.c
@@ -141,6 +141,7 @@ struct lcore_queue_conf {
 		.max_rx_pkt_len = JUMBO_FRAME_MAX_SIZE,
 		.split_hdr_size = 0,
 		.offloads = (DEV_RX_OFFLOAD_CHECKSUM |
+			     DEV_RX_OFFLOAD_SCATTER |
 			     DEV_RX_OFFLOAD_JUMBO_FRAME),
 	},
 	.txmode = {
@@ -935,6 +936,16 @@ struct rte_lpm6_config lpm6_config = {
 				ret, portid);
 		}
 
+		/* set the mtu to the maximum received packet size */
+		ret = rte_eth_dev_set_mtu(portid,
+			local_port_conf.rxmode.max_rx_pkt_len);
+		if (ret < 0) {
+			printf("\n");
+			rte_exit(EXIT_FAILURE, "Set MTU failed: "
+				"err=%d, port=%d\n",
+			ret, portid);
+		}
+
 		ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd,
 					    &nb_txd);
 		if (ret < 0) {
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH v2] examples/ip_fragmentation: support big packets
  2019-01-13 11:37 [dpdk-dev] [PATCH v2] examples/ip_fragmentation: support big packets Noa Ezra
@ 2019-01-14 12:55 ` Ananyev, Konstantin
  2019-01-15  0:21   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Ananyev, Konstantin @ 2019-01-14 12:55 UTC (permalink / raw)
  To: Noa Ezra; +Cc: Asaf Penso, dev

> 
> In some vendors the RX and TX configuration must be the same, therefore
> the MTU size need to be equal to max_rx_pkt_len.
> The MTU is the largest size packet in bytes that can be sent on the
> network, therefore before changing this parameter, the NIC could not
> receive packets larger than 1500 bytes, which is the default MTU size.
> In addition, scatter-gather need to be enabled in order to receive
> frames bigger than mbuf size.
> 
> Signed-off-by: Noa Ezra <noae@mellanox.com>
> ---
> v2: move set_mtu() to be done after dev_configure().
> 
>  examples/ip_fragmentation/main.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
> index 17a877d..8d789b4 100644
> --- a/examples/ip_fragmentation/main.c
> +++ b/examples/ip_fragmentation/main.c
> @@ -141,6 +141,7 @@ struct lcore_queue_conf {
>  		.max_rx_pkt_len = JUMBO_FRAME_MAX_SIZE,
>  		.split_hdr_size = 0,
>  		.offloads = (DEV_RX_OFFLOAD_CHECKSUM |
> +			     DEV_RX_OFFLOAD_SCATTER |
>  			     DEV_RX_OFFLOAD_JUMBO_FRAME),
>  	},
>  	.txmode = {
> @@ -935,6 +936,16 @@ struct rte_lpm6_config lpm6_config = {
>  				ret, portid);
>  		}
> 
> +		/* set the mtu to the maximum received packet size */
> +		ret = rte_eth_dev_set_mtu(portid,
> +			local_port_conf.rxmode.max_rx_pkt_len);
> +		if (ret < 0) {
> +			printf("\n");
> +			rte_exit(EXIT_FAILURE, "Set MTU failed: "
> +				"err=%d, port=%d\n",
> +			ret, portid);
> +		}
> +
>  		ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd,
>  					    &nb_txd);
>  		if (ret < 0) {
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> 1.8.3.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH v2] examples/ip_fragmentation: support big packets
  2019-01-14 12:55 ` Ananyev, Konstantin
@ 2019-01-15  0:21   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2019-01-15  0:21 UTC (permalink / raw)
  To: Noa Ezra; +Cc: dev, Ananyev, Konstantin, Asaf Penso

14/01/2019 13:55, Ananyev, Konstantin:
> > 
> > In some vendors the RX and TX configuration must be the same, therefore
> > the MTU size need to be equal to max_rx_pkt_len.
> > The MTU is the largest size packet in bytes that can be sent on the
> > network, therefore before changing this parameter, the NIC could not
> > receive packets larger than 1500 bytes, which is the default MTU size.
> > In addition, scatter-gather need to be enabled in order to receive
> > frames bigger than mbuf size.
> > 
> > Signed-off-by: Noa Ezra <noae@mellanox.com>
> 
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-15  0:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-13 11:37 [dpdk-dev] [PATCH v2] examples/ip_fragmentation: support big packets Noa Ezra
2019-01-14 12:55 ` Ananyev, Konstantin
2019-01-15  0:21   ` Thomas Monjalon

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).