-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Set CONFIG_NET_ETH_PKTSIZE to 1514 for spresense #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set CONFIG_NET_ETH_PKTSIZE to 1514 for spresense #110
Conversation
Set CONFIG_NET_ETH_PKTSIZE to 1514 when performing $ tools/configure.sh spresense/rndis configuration CONFIG_NET_ETH_PKTSIZE defines the size of ethernet packet. Ethernet packet size is 1514 including the ethernet header. This commit can send 1514 bytes packet as follow: e.g) For OpenWrt Router nsh> ping -c 1 -s 1472 192.168.1.1 PING 192.168.1.1 1472 bytes of data 1472 bytes from 192.168.1.1: icmp_seq=0 time=0 ms 1 packets transmitted, 1 received, 0% packet loss, time 1010 ms nsh> https://tools.ietf.org/html/rfc894 said at Frame Format ``` The minimum length of the data field of a packet sent over an Ethernet is 1500 octets, thus the maximum length of an IP datagram sent over an Ethernet is 1500 octets. Implementations are encouraged to support full-length packets. `` Just for your information, include/nuttx/net/ethernet.h:78:#define ETH_HDRLEN 14 /* Header size: 2*6 + 2 */ Signed-off-by: Koichi Okamoto <Koichi.Okamoto@sony.com>
I am not sure but I think the last CRC (4Byte) isn't consider by software tcp/ip stack side. The cause of 1500 byte maximum issue comes from original comment of uIP source code. uIP original defines as follows: It seems to me that from the definition, UIP_BUFSIZE is considered to be a packet buffer including the header of Link Layer (14 bytes for Ethernet (excluding 4 bytes for FCS(CRC))) in the first place, so that the original comment misread. https://tools.ietf.org/html/rfc894 said The above two paragraph said the data area of ethernet is from 46 byte to 1500 byte. |
|
uIP is also used contiki os:
This side is fixed to 1514, not 1500. |
|
" am not sure but I think the last CRC (4Byte) isn't consider by software tcp/ip stack side." That is my experience too. The FCS is generated and consumed by hardware. I've also worked with Ethernet hardware that adds additional information at the end of the packet. There is a special configuration setting to allow additional space at the end of the packet for this hardware specific stuff. It is CONFIG_NET_GUARDSIZE. The total packet allocation size is the max payload (1500) plus the Ethernet header size (14) plus CONFIG_NET_GUARDSIZE. |
|
Don't use uIP documentation. The NuttX network does include a few things from uIP, but it is an original network and nothing you know about uIP applies here. Especially anything related to buffering. |
|
The confusion here is between packet size, MTU, and additional FCS bytes. The MTU does not include either the Ethernet header or the FCS bytes. CONFIG_NET_ETH_PKTSIZE is not the MTU and does include the Ethernet header (the FCS is provided by the GUARD size, if needed). So for an MTU of 1500, the correct value of CONFIG_NET_ETH_PKTSIZE is 1514. So your change is correct. Too much talking for such a simple change. |
|
@patacongo
I see. Thank your for your advice. |
|
@patacongo thanks for clarification |
Set CONFIG_NET_ETH_PKTSIZE to 1514 when performing
$ tools/configure.sh spresense/rndis
configuration
CONFIG_NET_ETH_PKTSIZE defines the size of ethernet packet.
Ethernet packet size is 1514 including the ethernet header.
This commit can send 1514 bytes packet as follow:
e.g) For OpenWrt Router
nsh> ping -c 1 -s 1472 192.168.1.1
PING 192.168.1.1 1472 bytes of data
1472 bytes from 192.168.1.1: icmp_seq=0 time=0 ms
1 packets transmitted, 1 received, 0% packet loss, time 1010 ms
nsh>
https://tools.ietf.org/html/rfc894
said at Frame Format