@@ -51,16 +51,20 @@ extern "C" {
5151#define UDPARD_SUCCESS 0
5252
5353/// MTU values for the supported protocols.
54- #define UDPARD_MTU_UDP_IPV4 576U
55- #define UDPARD_MTU_UDP_IPV6 1280U
56- #define UDPARD_MTU_UDP_IPV4_TEMP 64U
57- #define UDPARD_MTU_MAX UDPARD_MTU_UDP_IPV6 /// We may want to set this to 1400/1500 for Ethernet MTU
54+ /// RFC 791 states that hosts must be prepared to accept datagrams of up to 576 octets and it is expected that this
55+ /// library will receive non ip-fragmented datagrams thus the minimum MTU should be larger than 576.
56+ /// That being said, the MTU here is set to 1408 which is derived from
57+ /// A 1500B Ethernet MTU RFC 894 - 60B IPv4 max header - 8B UDP Header - 24B Cyphal header which is equal to 1408B
58+ #define UDPARD_MTU_MAX 1408U // Note that to guarantee a single frame transfer your max payload size shall be 1404
59+ // This value is to accomodate for a 4B CRC which is appended to the transfer.
60+ #define UDPARD_MTU_UDP_IPV4 UDPARD_MTU_MAX
61+ #define UDPARD_MTU_UDP_IPV6 UDPARD_MTU_MAX
5862
5963/// Parameter ranges are inclusive; the lower bound is zero for all. See Cyphal/UDP Specification for background.
6064#define UDPARD_SUBJECT_ID_MAX 32767U /// 15 bits subject ID
6165#define UDPARD_SERVICE_ID_MAX 65535U /// The hard limit for ports
6266#define UDPARD_NODE_SUBNET_MAX 31U /// 5 bits for subnet
63- #define UDPARD_NODE_ID_MAX 65535U /// 16 bits is the hard limit. But this may change pending implementations
67+ #define UDPARD_NODE_ID_MAX 65534U /// 16 bits - 1 is the hard limit. But this may change pending implementations
6468#define UDPARD_PRIORITY_MAX 7U
6569#define UDPARD_TRANSFER_ID_BIT_LENGTH 63ULL
6670#define UDPARD_TRANSFER_ID_MAX ((1ULL << UDPARD_TRANSFER_ID_BIT_LENGTH) - 1ULL)
@@ -541,7 +545,6 @@ int8_t udpardRxAccept(UdpardInstance* const ins,
541545 const UdpardMicrosecond timestamp_usec ,
542546 UdpardFrame * const frame ,
543547 const uint8_t redundant_transport_index ,
544- UdpardSessionSpecifier * const specifier ,
545548 UdpardRxTransfer * const out_transfer ,
546549 UdpardRxSubscription * * const out_subscription );
547550
0 commit comments