My question for Greg was: Is there an assumption that CONFIG_NET_ETH_PKTSIZE
has to be 1514? So that ultimately a frame must be received completely into
one buffer?

Search for packet and frame in the Ethernet section of the reference manual.  The hardware will DMA up to (I think it was) 2048 bytes without Jumbo mode.  These are the 2K packets.  This is for the H7 (and probably the F7).

However, that should not happen because nothing should ever send packets that large to the station (and PROMISCUOUS mode should be disabled).

From what you are saying, the packet buffer should also be aligned to the cache line and be a multiple of the cache line size.  So for an MTU of X, I think that should be

   mask = Y - 1

   size = ( (X + 18) + mask) & ~mask

   buffer = memalign(Y, size);

where

 * X is the MTU (like 1500).  The MTU does not include the Ethernet
   overhead.
 * Y is the cache line size, usually 32.
 * 18 is the Ethernet overhead (14 byte Ethernet header + 2 byte FCS at
   the end).  The FCS is usually accounted for the the
   CONFIG_GUARD_SIZE which defaults to 2.  But some hardware transfers
   additional info after the FCS.

The 1514 packet size you mention may not be meaningful without some clarification.  The packet buffer size of 1518 is a 1500 byte MTU plus the 18 byte Ethernet overhead.  Some hardware verifies the FCS and does not transfer it to memory ... that would make 1514.  But that is not a typical case.

The selection of the MTU should not matter on most networks or with most network hardware.  TCP should follow the negotiated MSS and everything else should be small.  The MTU should be selected based on the configured properties of the network, resources available in the target, and the needs of the application

   IP size = Ethernet header + MTU + FCS

            = Ethernet header + IP header + protocol header + MSS + FCS

IPv4 hosts are required to be able to handle an MSS of at least 536 bytes; IPv6 hosts are required to be able to handle an MSS of 1220 bytes.  This results in the minimum sizes and is correct.




Reply via email to