Add capabilities RXCSUM and RXCSUM6 as well as TXCSUM and TXCSUM6 for TCP and UDP to the epair interface and enable them by default.
RXCSUM and RXCSUM6 are enabled because an epair interface may receive a packet with the mbuf flag CSUM_DATA_VALID set, which is expected only if these capabilities are enabled. Since it seems not helpful to remove this flag, it is not possible to disable these capabilities.
With TXCSUM or TXCSUM6 enabled, the sender does not compute the checksum but sets the mbuf flag CSUM_TCP or CSUM_UDP. The sending epair interface end just transmits the mbuf with the flag set to the other epair interface end. If the packet in the mbuf leaves the host, because, after received by the other end, a bridge switches or IP routes the packet out over a physical interface, that interface computes the checksum.
TXCSUM and TXCSUM6 are synchronized between the two epair interface ends. If enabled/disabled on one end, it will be enabled/disabled on the other end. If the sending epair interface end has TXCSUM or TXCSUM6 enabled and the receiving end is in a bridge, it is assumed that all interfaces in the bridge have that capability enabled. Otherwise the bridge would have disabled that capability on the receiving epair interface end in the bridge which would have disabled that capability on the sending epair interface end as well due to the synchronization.
Note that in case the packet leaves the host due to IP routing, the outgoing interface may not have TXCSUM or TXCSUM6 enabled. Since the code changes in D51475 the checksum is computed in software in that case.
Also note that if the packet is for the local host, since the code changes in D51475 the host accept the packet even if the checksum is incorrect due to offloading.