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

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.

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.


Regards
Maciej



Reply via email to