cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Contributor
Contributor
7,895 Views
Registered: ‎11-09-2012

LwIP netif->mtu in xilinx driver

I am using LwIP with the AXI Ethernet IP core and a MicroBlaze in Vivado/SDK 2015.4. I found the following assignment in xaxiemacif.c:

netif->mtu = XAE_MTU - XAE_HDR_SIZE;

where XAE_MTU is defined as 1500 and XAE_HDR_SIZE as 14 in xaxietherent.h. In ip.c, LwIP uses netif->mtu as the maximum size of the IP packet that can be sent as the Ethernet payload without requiring fragmentation (or jumbo frames). The true MTU of Ethernet is 1500 bytes. However, it appears to me that it is erroneously defined as 1486 bytes in the Xilinx driver by incorrectly subtracting the Ethernet header size (14) from 1500. This causes IP packets between 1486 and 1500 bytes in length to be unnecessarily fragmented.

 

To my knowledge, the Ethernet MTU of 1500 bytes is the maximum size of the payload (excluding the header). Accordingly, it appears to me that netif->mtu should be set to 1500 in xaxiemacif.c.

netif->mtu = XAE_MTU;

Can anyone else confirm this or correct me?

Tags (1)
0 Kudos
1 Reply
Highlighted
Visitor
Visitor
2,291 Views
Registered: ‎10-03-2012

Yes you are correct. I've made the same correction to my LwIP code (way back from ISE 14.4, I can't believe this bug is still here!) to remove the - XAE_HDR_SIZE. I also made a change to xaxiemacif_dma.c. Could be different now:

 

#ifdef USE_JUMBO_FRAMES
    max_frame_size = XAE_MAX_JUMBO_FRAME_SIZE - 18;
#else
    max_frame_size = XAE_MAX_FRAME_SIZE - 18;
#endif

 

to

 

#ifdef USE_JUMBO_FRAMES
    max_frame_size = XAE_MAX_JUMBO_FRAME_SIZE;
#else
    max_frame_size = XAE_MAX_FRAME_SIZE;
#endif

 

0 Kudos