> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of Liron
> Himi
> Sent: Wednesday, November 29, 2017 3:13 PM
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] L4 offset
>
> 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
I had planned to remove the word "valid" from there. This is an old function
and since then we have added parser configuration options into pktio API.
/**
* Parser configuration
*/
typedef struct odp_pktio_parser_config_t {
/** Protocol parsing level in packet input
*
* Parse protocol layers in minimum up to this level during packet
* input. The default value is ODP_PKTIO_PARSER_LAYER_ALL. */
odp_pktio_parser_layer_t layer;
} odp_pktio_parser_config_t;
These l3/l4 offsets refer to the metadata set at packet input parsing time. I
think we could update it to:
... Returns offset to the start of the layer 4...
* @return Layer 4 start offset
* @retval ODP_PACKET_OFFSET_INVALID packet does not contain L4
So, we could remove both "valid" and "header".
-Petri