This patch is independent of the IPsec patch series and should be a
separate patch.

On Fri, Mar 24, 2017 at 10:04 AM, Petri Savolainen
<[email protected]> wrote:
> Checksum insertion has pktio interface level configuration
> options. Per packet override is needed for example when
> L4 checksumming is enabled and application forwards packets.
> Forwarded packets need to maintain original, end-to-end checksum
> value.
>
> Signed-off-by: Petri Savolainen <[email protected]>
> ---
>  include/odp/api/spec/packet.h | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
>
> diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h
> index 92c35ae..42ef51f 100644
> --- a/include/odp/api/spec/packet.h
> +++ b/include/odp/api/spec/packet.h
> @@ -1366,6 +1366,25 @@ uint32_t odp_packet_l4_offset(odp_packet_t pkt);
>  int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset);
>
>  /**
> + * Force checksum insertion
> + *
> + * Override checksum insertion configuration per packet.
> + *
> + * @param pkt     Packet handle
> + * @param l3       0: do not insert L3 checksum
> + *                 1: insert L3 checksum
> + *                -1: use default L3 checksum configuration
> + *
> + * @param l4       0: do not insert L4 checksum
> + *                 1: insert L4 checksum
> + *                -1: use default L4 checksum configuration
> + *
> + * @retval  0 on success
> + * @retval <0 on failure
> + */
> +int odp_packet_chksum_force(odp_packet_t pkt, int l3, int l4);

Several comments.

1. Why is this not a void function, as presumably this function is
advisory in nature? How would it fail and what would an application be
expected to do in the event of a reported failure? Having to check
return codes for this would seem to be adding a lot of overhead for
little benefit.

2. "force" sounds awkward. Perhaps odp_packet_chksum_override(),
odp_packet_chksum_insert(), or simply odp_packet_chksum() might be
better?

3. To make this useful, shouldn't it be coupled with an
odp_pktio_capability() extension that reports whether per-packet
chksum overrides are supported on this interface, since checksum
insertion on output is configured as part of the
odp_pktout_config_opt_t for each odp_pktio_t?

> +
> +/**
>   * Packet flow hash value
>   *
>   * Returns the hash generated from the packet header. Use
> --
> 2.8.1
>

Reply via email to