On Tue, Mar 28, 2017 at 6:39 AM, Savolainen, Petri (Nokia - FI/Espoo) <[email protected]> wrote: > It's a mandatory feature when forwarding: "Forwarded packets need to maintain > original, end-to-end checksum value.". A box in the middle must not > re-compute e.g. L4 checksum. If it would do that, it could introduce an error > in payload data and update the checksum accordingly. The receiving end would > not notice the error, since checksum matches.
If the middle box can't be trusted not to tamper with the payload when forwarding, why would you trust it not to "cover its tracks" by recomputing checksums, or remember to call this API? End-to-end integrity is why protocols like IPsec are used. > > > >> -----Original Message----- >> From: Bill Fischofer [mailto:[email protected]] >> Sent: Tuesday, March 28, 2017 2:24 PM >> To: Petri Savolainen <[email protected]> >> Cc: lng-odp-forward <[email protected]> >> Subject: Re: [lng-odp] [API-NEXT PATCH] api: packet: add per packet >> checksum control >> >> These look good, but shouldn't these be documented as advisory? When >> dealing with well-formed packets, it should not matter if HW always >> recomputes checksums on transmit. The only time you'd need to suppress >> checksum generation would be in diagnostic packet generators that are >> intentionally emitting packets with incorrect checksums for testing >> purposes. >> >> On Tue, Mar 28, 2017 at 6:07 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 | 26 ++++++++++++++++++++++++++ >> > 1 file changed, 26 insertions(+) >> > >> > diff --git a/include/odp/api/spec/packet.h >> b/include/odp/api/spec/packet.h >> > index 92c35ae..5439f23 100644 >> > --- a/include/odp/api/spec/packet.h >> > +++ b/include/odp/api/spec/packet.h >> > @@ -1366,6 +1366,32 @@ uint32_t odp_packet_l4_offset(odp_packet_t pkt); >> > int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset); >> > >> > /** >> > + * Layer 3 checksum insertion override >> > + * >> > + * Override checksum insertion configuration per packet. This per >> packet setting >> > + * overrides a higher level configuration for checksum insertion into a >> L3 >> > + * header during packet output processing. >> > + * >> > + * @param pkt Packet handle >> > + * @param l3 0: do not insert L3 checksum >> > + * 1: insert L3 checksum >> > + */ >> > +void odp_packet_l3_chksum_insert(odp_packet_t pkt, int l3); >> > + >> > +/** >> > + * Layer 4 checksum insertion override >> > + * >> > + * Override checksum insertion configuration per packet. This per >> packet setting >> > + * overrides a higher level configuration for checksum insertion into a >> L4 >> > + * header during packet output processing. >> > + * >> > + * @param pkt Packet handle >> > + * @param l4 0: do not insert L4 checksum >> > + * 1: insert L4 checksum >> > + */ >> > +void odp_packet_l4_chksum_insert(odp_packet_t pkt, int l4); >> > + >> > +/** >> > * Packet flow hash value >> > * >> > * Returns the hash generated from the packet header. Use >> > -- >> > 2.8.1 >> >
