Hi Maciej, sorry for the delay in getting a response to you on this. See inline.
On Thu, Oct 13, 2016 at 6:33 AM, Maciej Czekaj < [email protected]> wrote: > > Guys, > > I was going to implement checksum offload for OFP project based on Monarch > checksum offload capability and I found out that there is no example for > using that API. Also, documentation seams to leave some room for various > interpretations, so I would like to clarify that and post a patch to > documentation, too. > > > This is an exempt from pktio.h from Monarch LTS: > > > /** > * Packet output configuration options bit field > * > * Packet output configuration options listed in a bit field structure. > Packet > * output checksum insertion may be enabled or disabled. When it is > enabled, > * implementation will calculate and insert checksum into every outgoing > packet > * by default. Application may use a packet metadata flag to disable > checksum > * insertion per packet bases. For correct operation, packet metadata must > * provide valid offsets for the appropriate protocols. For example, UDP > * checksum calculation needs both L3 and L4 offsets (to access IP and UDP > * headers). When application (e.g. a switch) does not modify L3/L4 data > and > * thus checksum does not need to be updated, output checksum insertion > should > * be disabled for optimal performance. > > > > From my contact with varoius NICs, including Octeon PKO & VNIC from > ThunderX, offloading H/W needs at least: > > For L4 offload: > L4 packet type: TCP/UDP/SCTP > L4 header offset > L3 header offset > L3 type may or may not be required but it is good to define it for > consistency > > For L3 checksum: > L3 packet type: IPv4 > L3 header offset > Yes, this info will be set by the ODP classifier. If you're constructing packets "by hand" then these fields should be set with appropriate odp_packet_xxx_set() calls. > > There is also a second thing: how to disable checksum calculation > per-packet? > If packet has no type in metadata, then obviously checksum will not be > computed. I think that would be the recommended method for now, even if ODP > community plans to extend odp_packet API in the future to cover that case. > We've talked about doing this but currently have no APIs for exposing this capability. Do you have a use case in mind? > > Maybe that is implicit that packet types should be set along header > offsets, but it is good to state that clearly and provide some usage > example, e.g. in examples/generator. I can send a patch for both doc and > generator but I would like to make sure we are on the same page. > Patches always welcome. :) Thanks. > > > Regards > Maciej > > > >
