Cases exist where, for an outgoing packet, the IP/SCTP/TCP/UDP checksum is computed in software, even though the hardware could have done it, or, worse, where the checksum is not computed in software even though the hardware is incapable of doing so. To avoid such cases, this patch moves the computation of checksums in software to the point right before the packet is passed to the driver.
This patch changes the following:
- mbuf.h: Make csum_data two bytes shorter and add offload_l3_hdr_offset and offload_l4_hdr_offset in the mbuf packet header.
- ip_output.c/ip6_output.c: Remove code that computes the checksum. Set offload_l4_hdr_offset.
- if_ethersubr.c/if_infiniband.c: Set offload_l3_hdr_offset.
- if.c: When an interface comes up or its capabilities have been changed, call the new if_offload_caps_changed, which sets ifp->if_transmit to the new if_offload_transmit if the interface driver does not support all expected offloading capabilities.
- if_offload.c: When if_offload_transmit is called, compute and insert all checksums that are still required and cannot be offloaded to the interface (driver), and call the original if_transmit function.