patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] examples/ip_fragmentation: support big packets
@ 2018-12-26 13:08 Noa Ezra
  2019-01-04 12:25 ` Ananyev, Konstantin
  0 siblings, 1 reply; 4+ messages in thread
From: Noa Ezra @ 2018-12-26 13:08 UTC (permalink / raw)
  To: konstantin.ananyev; +Cc: Asaf Penso, dev, Noa Ezra, stable

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);
+		}
+
 		/* 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

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

* Re: [dpdk-stable] [PATCH] examples/ip_fragmentation: support big packets
  2018-12-26 13:08 [dpdk-stable] [PATCH] examples/ip_fragmentation: support big packets Noa Ezra
@ 2019-01-04 12:25 ` Ananyev, Konstantin
  0 siblings, 0 replies; 4+ messages in thread
From: Ananyev, Konstantin @ 2019-01-04 12:25 UTC (permalink / raw)
  To: Noa Ezra; +Cc: Asaf Penso, dev, stable

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

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

* Re: [dpdk-stable] [PATCH] examples/ip_fragmentation: support big packets
  2018-12-26 12:15 Noa Ezra
@ 2018-12-28 10:06 ` Yongseok Koh
  0 siblings, 0 replies; 4+ messages in thread
From: Yongseok Koh @ 2018-12-28 10:06 UTC (permalink / raw)
  To: Noa Ezra; +Cc: stable


> On Dec 26, 2018, at 4:15 AM, Noa Ezra <noae@mellanox.com> wrote:
> 
> 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>
> ---

Hi Noa,

I can see the same patch in the dev mailing list. You don't need to send the
same fix to stable mailing list separately but you just need to add "Fixes: ..."
tag and "Cc: stable@dpdk.org" to your original patch. Please refer to the
contribution guideline.


Thanks,
Yongseok


> examples/ip_fragmentation/main.c | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
> index 17a877d..7420420 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 = {
> @@ -425,7 +426,6 @@ struct rte_lpm6_config lpm6_config = {
> 		 * Read packet from RX queues
> 		 */
> 		for (i = 0; i < qconf->n_rx_queue; i++) {
> -
> 			portid = qconf->rx_queue_list[i].portid;
> 			nb_rx = rte_eth_rx_burst(portid, 0, pkts_burst,
> 						 MAX_PKT_BURST);
> @@ -777,7 +777,6 @@ struct rte_lpm6_config lpm6_config = {
> 			RTE_LOG(INFO, IP_FRAG, "Creating direct mempool on socket %i\n",
> 					socket);
> 			snprintf(buf, sizeof(buf), "pool_direct_%i", socket);
> -
> 			mp = rte_pktmbuf_pool_create(buf, NB_MBUF, 32,
> 				0, RTE_MBUF_DEFAULT_BUF_SIZE, socket);
> 			if (mp == NULL) {
> @@ -892,6 +891,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) {
> @@ -927,7 +936,7 @@ struct rte_lpm6_config lpm6_config = {
> 			local_port_conf.txmode.offloads |=
> 				DEV_TX_OFFLOAD_MBUF_FAST_FREE;
> 		ret = rte_eth_dev_configure(portid, 1, (uint16_t)n_tx_queue,
> -					    &local_port_conf);
> +						&local_port_conf);
> 		if (ret < 0) {
> 			printf("\n");
> 			rte_exit(EXIT_FAILURE, "Cannot configure device: "
> @@ -936,7 +945,7 @@ struct rte_lpm6_config lpm6_config = {
> 		}
> 
> 		ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd,
> -					    &nb_txd);
> +					&nb_txd);
> 		if (ret < 0) {
> 			printf("\n");
> 			rte_exit(EXIT_FAILURE, "Cannot adjust number of "
> -- 
> 1.8.3.1
> 

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

* [dpdk-stable] [PATCH] examples/ip_fragmentation: support big packets
@ 2018-12-26 12:15 Noa Ezra
  2018-12-28 10:06 ` Yongseok Koh
  0 siblings, 1 reply; 4+ messages in thread
From: Noa Ezra @ 2018-12-26 12:15 UTC (permalink / raw)
  To: Noa Ezra; +Cc: stable

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 | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
index 17a877d..7420420 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 = {
@@ -425,7 +426,6 @@ struct rte_lpm6_config lpm6_config = {
 		 * Read packet from RX queues
 		 */
 		for (i = 0; i < qconf->n_rx_queue; i++) {
-
 			portid = qconf->rx_queue_list[i].portid;
 			nb_rx = rte_eth_rx_burst(portid, 0, pkts_burst,
 						 MAX_PKT_BURST);
@@ -777,7 +777,6 @@ struct rte_lpm6_config lpm6_config = {
 			RTE_LOG(INFO, IP_FRAG, "Creating direct mempool on socket %i\n",
 					socket);
 			snprintf(buf, sizeof(buf), "pool_direct_%i", socket);
-
 			mp = rte_pktmbuf_pool_create(buf, NB_MBUF, 32,
 				0, RTE_MBUF_DEFAULT_BUF_SIZE, socket);
 			if (mp == NULL) {
@@ -892,6 +891,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) {
@@ -927,7 +936,7 @@ struct rte_lpm6_config lpm6_config = {
 			local_port_conf.txmode.offloads |=
 				DEV_TX_OFFLOAD_MBUF_FAST_FREE;
 		ret = rte_eth_dev_configure(portid, 1, (uint16_t)n_tx_queue,
-					    &local_port_conf);
+						&local_port_conf);
 		if (ret < 0) {
 			printf("\n");
 			rte_exit(EXIT_FAILURE, "Cannot configure device: "
@@ -936,7 +945,7 @@ struct rte_lpm6_config lpm6_config = {
 		}
 
 		ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd,
-					    &nb_txd);
+					&nb_txd);
 		if (ret < 0) {
 			printf("\n");
 			rte_exit(EXIT_FAILURE, "Cannot adjust number of "
-- 
1.8.3.1

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

end of thread, other threads:[~2019-01-04 12:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-26 13:08 [dpdk-stable] [PATCH] examples/ip_fragmentation: support big packets Noa Ezra
2019-01-04 12:25 ` Ananyev, Konstantin
  -- strict thread matches above, loose matches on Subject: below --
2018-12-26 12:15 Noa Ezra
2018-12-28 10:06 ` Yongseok Koh

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