DPDK patches and discussions
 help / color / mirror / Atom feed
From: Konstantin Ananyev <konstantin.ananyev@intel.com>
To: dev@dpdk.org
Cc: Konstantin Ananyev <konstantin.ananyev@intel.com>
Subject: [dpdk-dev] [PATCH] examples/ip_fragmentation: fix fail to start on i40e
Date: Wed, 16 Jan 2019 12:55:46 +0000	[thread overview]
Message-ID: <1547643346-24486-1-git-send-email-konstantin.ananyev@intel.com> (raw)

Previous commit sets mtu to the same value as max_rx_pkt_len.
Though PMDs (at least Intel ones) consider MTU as
max_rx_pkt_len minus ether header, crc bytes, vlan tags.

Fixes: 73d2c1d3f33c ("examples/ip_fragmentation: support big packets")
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 examples/ip_fragmentation/main.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
index 8d789b417..e90a61e35 100644
--- a/examples/ip_fragmentation/main.c
+++ b/examples/ip_fragmentation/main.c
@@ -55,6 +55,13 @@
 #define	IPV4_MTU_DEFAULT	ETHER_MTU
 #define	IPV6_MTU_DEFAULT	ETHER_MTU
 
+/*
+ * The overhead from max frame size to MTU.
+ * We have to consider the max possible overhead.
+ */
+#define MTU_OVERHEAD	\
+	(ETHER_HDR_LEN + ETHER_CRC_LEN + 2 * sizeof(struct vlan_hdr))
+
 /*
  * Default payload in bytes for the IPv6 packet.
  */
@@ -938,7 +945,7 @@ main(int argc, char **argv)
 
 		/* set the mtu to the maximum received packet size */
 		ret = rte_eth_dev_set_mtu(portid,
-			local_port_conf.rxmode.max_rx_pkt_len);
+			local_port_conf.rxmode.max_rx_pkt_len - MTU_OVERHEAD);
 		if (ret < 0) {
 			printf("\n");
 			rte_exit(EXIT_FAILURE, "Set MTU failed: "
-- 
2.17.1

             reply	other threads:[~2019-01-16 12:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-16 12:55 Konstantin Ananyev [this message]
2019-01-17 22:52 ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1547643346-24486-1-git-send-email-konstantin.ananyev@intel.com \
    --to=konstantin.ananyev@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).