examples/ip_fragmentation: support big packets

Message ID 1545829642-18896-1-git-send-email-noae@mellanox.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series examples/ip_fragmentation: support big packets |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Noa Ezra Dec. 26, 2018, 1:08 p.m. UTC
  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.

Cc: stable@dpdk.org

Signed-off-by: Noa Ezra <noae@mellanox.com>
---
 examples/ip_fragmentation/main.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
  

Comments

Ananyev, Konstantin Jan. 4, 2019, 12:25 p.m. UTC | #1
Hi ,

> 
> 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.
> 
> Cc: stable@dpdk.org
> 
> Signed-off-by: Noa Ezra <noae@mellanox.com>
> ---
>  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..d294f5f 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 = {
> @@ -892,6 +893,16 @@ struct rte_lpm6_config lpm6_config = {
>  		    dev_info.max_rx_pktlen,
>  		    local_port_conf.rxmode.max_rx_pkt_len);
> 
> +		/* 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);
> +		}
> +

It probably doesn't matter for that particular case, but
shouldn't set_mtu() be done after dev_configure()?
To avoid situation when max_rx_pkt_len will be set by set_mtu()
and then overwritten by dev_configure().
Konstantin 


>  		/* get the lcore_id for this port */
>  		while (rte_lcore_is_enabled(rx_lcore_id) == 0 ||
>  		       qconf->n_rx_queue == (unsigned)rx_queue_per_lcore) {
> --
> 1.8.3.1
  

Patch

diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
index 17a877d..d294f5f 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 = {
@@ -892,6 +893,16 @@  struct rte_lpm6_config lpm6_config = {
 		    dev_info.max_rx_pktlen,
 		    local_port_conf.rxmode.max_rx_pkt_len);
 
+		/* 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);
+		}
+
 		/* get the lcore_id for this port */
 		while (rte_lcore_is_enabled(rx_lcore_id) == 0 ||
 		       qconf->n_rx_queue == (unsigned)rx_queue_per_lcore) {