udp - The relationship between MTU and size of skb in xmit function -
I encounter a problem when I develop a network card driver in Linux. As we all know that the MTU fragment refers to the maximum size of the IP packet. And the squad will be sent to the exclamation function, which will include 14bytes including DST MAC Adrer, SRC MACEdre and LNG. But it is very strange that when I use different values for MTU, the pair size is different, sometimes it is 10bytes, sometimes it is 14bytes, it is based on the size of the MTU For example, I use 7828 as the size of the UDP payload, when MTU is 7700, the size of the scab in the XMT function is 7714, while when MTU is 7800, the size of the scalable is 7810. Can anyone explain this? I think there are some aligned boundaries for the IP packet, but I did not find it.
I searched the answers from the Internet, and I found that there is a line limit for the payload field. The frame payload field must be aligned to 8 bytes. So if MTU is 7700, then the correct size of the IP frame should be 7680 + 20 = 7700 because 7680 can be divisible by 8. Although MTU is 7800, the correct size of the IP frame should be 7776 + 20 = 7796 because 7780 can not be divisible by 8, the previous 4 bytes will be assigned to the next IP fragment.
Comments
Post a Comment