Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

Mtu

Altera_Forum
Honored Contributor II
1,180 Views

[h=2]MTU是什么[/h]提到以太网,离不开两个模型:OSI模型和TCP/IP模型。 

file:///C:/Users/martinfeng/AppData/Local/Temp/msohtmlclip1/01/clip_image002.png  

file:///C:/Users/martinfeng/AppData/Local/Temp/msohtmlclip1/01/clip_image004.png  

 

以太网对数据帧的长度有一个限制,最大值是1500。链路层的这个特性称作MTU(最大传输单元)。如果IP层数据报的长度比链路层的MTU还要大,那么IP层就需要进行分片,每一片都要小于MTU。 

[h=2]MTU怎么修改[/h]Windows下查看和修改方法: 

netsh interface ipv4 show subinterfaces 

netsh interface ipv4 set subinterface "本地连接" mtu=3800 store=persistent 

file:///C:/Users/martinfeng/AppData/Local/Temp/msohtmlclip1/01/clip_image010.jpg  

 

Linux下查看和修改方法: 

执行ifconfig或者“cat /sys/class/net/eth0/mtu” 

ifconfig eth0 down; echo "9800" > /sys/class/net/eth0/mtu; ifconfig eth0 up 

 

[h=2]Intel PSG SoC FPGA下怎么使mtu可以修改到9800呢?[/h]当然也是上面那么修改,只是在修改前,需要修改以下几个地方。据我经过一个晚上持续的打流测试,修改后能够稳定运行: 

1)修改drivers/net/ethernet/stmicro/stmmac/stmmac_common.h # define JUMBO_LEN 9800; 

2)修改设备树max-frame-size 为9800; 

3)编译内核和设备树。 

 

[h=2]验证方法:[/h] 

  1. 发送指定长度报文 

  2. Windows下使用ping命令,添加-l参数; 

  3. Linux下使用ping命令,添加-s参数; 

  4. 接收、分析报文 

  5. tcpdump或者wireshark工具抓包分析 

 

[h=2]遗留的问题[/h]虽然MTU能够设置为9800了,但是真实的收发报文达不到9800.现在只能达到8192。 

 

下图:Mtu都设置为9800,发8150能发送和接收,但8151没有收取到报文发送出来。 

file:///C:/Users/martinfeng/AppData/Local/Temp/msohtmlclip1/01/clip_image011.png  

file:///C:/Users/martinfeng/AppData/Local/Temp/msohtmlclip1/01/clip_image013.jpg  

file:///C:/Users/martinfeng/AppData/Local/Temp/msohtmlclip1/01/clip_image014.png
0 Kudos
0 Replies
Reply