[dpdk-dev] ip_frag: handle MTU sizes not aligned to 8 bytes

Ananyev, Konstantin konstantin.ananyev at intel.com
Sun Jun 4 18:55:46 CEST 2017



> 
> The rte_ipv4_fragment_packet API expects that the link/interface MTU value
> passed in be divisible by 8 bytes.  Given the name of the parameter is
> "mtu" rather than "frag_size" it is not necessarily the case that it will
> be divisible by 8.  An MTU of 1500 happens to produce a max fragment size
> of 1480 (1500 - sizeof(ipv4_hdr)) which is divisible by 8 but other MTU
> values such as 1600 or 9000 do not produce values that are divisible by 8.
> 
> Unfortunately, the API checks that the frag_size value produced is
> divisible by 8 with a call to RTE_ASSERT which is only enabled when the
> RTE_LOG_LEVEL >= RTE_LOG_DEBUG.  In cases where the log level is set
> normally the code silently continues and produces IP fragments that have
> invalid fragment offset values.
> 
> An application may not have control over what MTU a user selects and rather
> than have each application adjust the MTU to pass a suitable value to the
> fragmentation API this change modifies the fragmentation API to handle
> cases where the "mtu" argument is not divisible by 8 and automatically
> adjust the internal "frag_size".
> 
> Signed-off-by: Allain Legacy <allain.legacy at windriver.com>
> ---

Acked-by: Konstantin Ananyev <konstantin.ananyev at intel.com>




More information about the dev mailing list