How to set jumbo frame?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How to set jumbo frame?

跳至解决方案
4,665 次查看
coindu
Contributor IV

Hi community:

      I use IMX8MQ-EVK board with L4.19.35 BSP, The network mtu is max to 1500 .  And need to  set mtu from 1500 to 9000, how to do it?

      I hava modified the max_mtu as below.

--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -359,7 +359,7 @@ void ether_setup(struct net_device *dev)
dev->min_header_len = ETH_HLEN;
dev->mtu = ETH_DATA_LEN;
dev->min_mtu = ETH_MIN_MTU;
- dev->max_mtu = ETH_DATA_LEN;
+ dev->max_mtu = ETH_MAX_MTU;
dev->addr_len = ETH_ALEN;
dev->tx_queue_len = DEFAULT_TX_QUEUE_LEN;
dev->flags = IFF_BROADCAST|IFF_MULTICAST;

When this value is modified, the development board which is connected to the computer directly, using tcpdump to capture packets can see that jumbo frames can be sent, but the development board cannot accept jumbo frames,I don't know the reason.

 

ifconfig eth0 mtu 9000 up

ping ip -s 8000

标签 (1)
0 项奖励
回复
1 解答
4,518 次查看
karangajjar
Senior Contributor II

Hi coin du,

We are glad you figured out the solution. 

Let us know in case of any concerns.

Regards,

Karan Gajjar

在原帖中查看解决方案

0 项奖励
回复
5 回复数
4,518 次查看
karangajjar
Senior Contributor II

Hi coin du,

i.MX8MQ implements MAC ethernet IEEE802.3-2002 standard. From the below thread you may find out the reason for not setting the MTU size more than 1500:
Linux imx change MTU size > 1500 

Moreover, instead of the change that you may just change following in include/uapi/linux/if_ether.h:
-#define ETH_DATA_LEN 1500 /* Max. octets in payload */
-#define ETH_FRAME_LEN 1514 /* Max. octets in frame sans FCS */
+#define ETH_DATA_LEN 9000 /* Max. octets in payload */
+#define ETH_FRAME_LEN 9014 /* Max. octets in frame sans FCS */

With these changes we were able to get eth0 up with 9000 MTU and ping the machine:
root@imx8mqevk:~# ifconfig
eth0 Link encap:Ethernet HWaddr XX:XX:XX:XX:XX:XX 
inet6 addr: XXXX:XXXXScope:Link
UP BROADCAST RUNNING MULTICAST MTU:9000 Metric:1
RX packets:1 errors:0 dropped:0 overruns:0 frame:0
TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:348 (348.0 B) TX bytes:1341 (1.3 KiB)

root@imx8mqevk:~# ping <connected_machine_ip_addr> -s 8000
PING XXXX:XXXX (XXXX:XXXX): 8000 data bytes
8008 bytes from XXXX:XXXX seq=0 ttl=64 time=3.905 ms
8008 bytes from XXXX:XXXX seq=1 ttl=64 time=2.278 ms
8008 bytes from XXXX:XXXX seq=2 ttl=64 time=2.254 ms
8008 bytes from XXXX:XXXX seq=3 ttl=64 time=2.223 ms

But, along with these changes as suggested in the thread above, you might need to change the driver as well to avoid data loss.

Regards,

Karan Gajjar

0 项奖励
回复
2,523 次查看
Vlongobardi
Contributor II

Hi,

I tried to follow your steps modifying ETH_DATA_LEN and ETH_FRAME_LEN inside the kernel, and I actually see MTU set to 9000. When I execute ifconfing command:

root@imx8qmmek:~# ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 9000
inet XXX.XXX.XXX.XXX netmask XXX.XXX.XXX.XXX broadcast XXX.XXX.XXX.XXX
inet6 XXX.XXX.XXX.XXX prefixlen 64 scopeid 0x20<link>
ether XX:XX:XX:XX:XX:XX txqueuelen 1000 (Ethernet)
RX packets 831 bytes 90815 (88.6 KiB)
RX errors 241 dropped 317 overruns 0 frame 723
TX packets 379 bytes 1689274 (1.6 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

 

But when I execute the ping command with a packet of 8000 bytes it doesn't receive any packet:
root@imx8qmmek:~# ping XXX.XXX.XXX.XXX -s 8000
PING XXX.XXX.XXX.XXX (XXX.XXX.XXX.XXX) 8000(8028) bytes of data.
^C
--- XXX.XXX.XXX.XXX ping statistics ---
21 packets transmitted, 0 received, 100% packet loss, time 20483ms

 

Instead if I use a smaller size:
root@imx8qmmek:~# ping XXX.XXX.XXX.XXX -s 1900
PING XXX.XXX.XXX.XXX (XXX.XXX.XXX.XXX) 1900(1928) bytes of data.
1908 bytes from XXX.XXX.XXX.XXX: icmp_seq=1 ttl=64 time=1.18 ms
...
1908 bytes from XXX.XXX.XXX.XXX: icmp_seq=6 ttl=64 time=1.09 ms
^C
--- 10.10.140.53 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5006ms
rtt min/avg/max/mdev = 1.093/1.108/1.175/0.029 ms

I also tried to ping using a slightly bigger packet, like 2000, but it still doesn't work.


In my opinion I just see a higher MTU, but the MTU is still the same.
Executing the following command:
root@imx8qmmek:~# ip -d link list eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 00:04:9f:06:95:16 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 68 maxmtu 1966 addrgenmode eui64 numtxqueues 3 numrxqueues 3 gso_max_size 65536 gso_max_segs 100 parentbus platform parentdev

You can get the maximum MTU supported, which is 1966.
Indeed, if i try to ping using a size bigger than 1966 it won't work. 

Do you have any suggest, please? 

 

0 项奖励
回复
4,518 次查看
coindu
Contributor IV

Thanks for your reply. I view the thread and refer othear patch to set MTU up to 1956.

[PATCH/RFC,net-next] net: fec: allow "mini jumbo" frames - Patchwork 

0 项奖励
回复
4,518 次查看
b36401
NXP Employee
NXP Employee

Thanx for letting it know. We are closing the thread.

0 项奖励
回复
4,519 次查看
karangajjar
Senior Contributor II

Hi coin du,

We are glad you figured out the solution. 

Let us know in case of any concerns.

Regards,

Karan Gajjar

0 项奖励
回复