Hi,

I'm trying to understand when pktio implementation should set the L4 offset.
In point of view, if there is a known L3 header than the L4 offset should be 
set to the L3-offset + L3 header length.
I noticed that Linux generic implementation is not as above. E.g. if there is 
only IP header and payload, than L4 offset is set to 
'ODP_PACKET_OFFSET_INVALID'.
Is the above is the real intention?
The API is documented as foolowed:
/**
* Layer 4 start offset
*
* Returns offset to the start of the layer 4 header. The offset is calculated
* from the current odp_packet_data() position in bytes.
*
* User is responsible to update the offset when modifying the packet data
* pointer position.
*
* @param pkt  Packet handle
*
* @return  Layer 4 start offset
* @retval ODP_PACKET_OFFSET_INVALID packet does not contain a valid L4 header
*
* @see odp_packet_l4_offset_set(), odp_packet_has_l4()
*/
uint32_t odp_packet_l4_offset(odp_packet_t pkt);

What is the meaning of a valid L4 header? A payload is a valid L4? Maybe you 
should remove the 'header' and just mention that there is a L4 layer.

In order to calculate IP checksum, the IP-Header-length is needed and in 
absence of this exact value, the L4 offset can be used to calculate it.

Regards,
Liron

Reply via email to