summaryrefslogtreecommitdiff
path: root/examples/ip_fragmentation
diff options
context:
space:
mode:
authorKonstantin Ananyev <konstantin.ananyev@intel.com>2019-01-16 12:55:46 +0000
committerThomas Monjalon <thomas@monjalon.net>2019-01-17 23:53:05 +0100
commit9d8293e6226b51c571124e0e5bbf0573377669f7 (patch)
tree20bfbc8950c087d8202cfb9090a89077799728fd /examples/ip_fragmentation
parent2e06c565651eaca8034c5e3e83f25f24d6b91503 (diff)
downloaddpdk-9d8293e6226b51c571124e0e5bbf0573377669f7.zip
dpdk-9d8293e6226b51c571124e0e5bbf0573377669f7.tar.gz
dpdk-9d8293e6226b51c571124e0e5bbf0573377669f7.tar.xz
examples/ip_fragmentation: fix MTU for i40e
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>
Diffstat (limited to 'examples/ip_fragmentation')
-rw-r--r--examples/ip_fragmentation/main.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
index 8d789b4..e90a61e 100644
--- a/examples/ip_fragmentation/main.c
+++ b/examples/ip_fragmentation/main.c
@@ -56,6 +56,13 @@
#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.
*/
#define IPV4_DEFAULT_PAYLOAD (IPV4_MTU_DEFAULT - sizeof(struct ipv4_hdr))
@@ -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: "