HomeFreeBSD

ena: properly handle IPv6 L4 checksum offload

Description

ena: properly handle IPv6 L4 checksum offload

ena_tx_csum function did not check if IPv6 checksum offload was
requested it only checked checksum offloading flags for IPv4 packets.
Because of that, when encountering CSUM_IP6_* flags, the function simply
returned without actually setting checksum offloading in ena_ctx.
Check CUSM_IP6_* flags to enable IPv6 checksum offload.

Additionally, only IPv4 header was being parsed regardless of EtherType
field, because of that, value of L4 protocol read when actually trying
to send IPv6 packets was wrong. Use ip6_lasthdr function to get length
of all IPv6 headers and payload protocol.

Set the DF flag to 1 in order to allow the device to offload the IPv6
checksum calculation and achieve optimal performance.

Add CSUM6_OFFLOAD and CSUM_OFFLOAD definitions into ena_datapath.h.

Submitted by: Dawid Gorecki <dgr@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 2bbef9d95dc10a69a3c5813a517f6e8fe583539a)

Details

Provenance
dgr_semihalf.comAuthored on Jan 3 2022, 1:49 PM
mwCommitted on Feb 24 2022, 12:53 PM
Parents
rG5922f5218fcf: ena: merge ena-com v2.5.0 upgrade
Branches
Unknown
Tags
Unknown