Page MenuHomeFreeBSD

ix(4),ixv(4): Fix TSO offloads when TXCSUM is disabled
ClosedPublic

Authored by piotr.pietruszewski_intel.com on Dec 7 2018, 1:28 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 21, 2:19 PM
Unknown Object (File)
Thu, Nov 21, 11:59 AM
Unknown Object (File)
Mon, Nov 11, 6:06 AM
Unknown Object (File)
Sat, Nov 2, 6:04 PM
Unknown Object (File)
Oct 16 2024, 2:33 PM
Unknown Object (File)
Oct 11 2024, 8:42 AM
Unknown Object (File)
Oct 11 2024, 8:42 AM
Unknown Object (File)
Oct 11 2024, 8:42 AM

Details

Summary

The iflib stack does not disable TSO automatically when TXCSUM is
disabled, instead assuming that the driver will correctly handle TSOs
even when CSUM_IP is not set.

This results in iflib calling ixgbe_isc_txd_encap with packets which have
CSUM_IP_TSO, but do not have CSUM_IP or CSUM_IP_TCP set. Because of
this, ixgbe_tx_ctx_setup will not setup the IPv4 checksum offloading.

This results in bad TSO packets being sent if a user disables TXCSUM
without disabling TSO.

Fix this by updating the ixgbe_tx_ctx_setup function to check both
CSUM_IP and CSUM_IP_TSO when deciding whether to enable checksums.

Once this is corrected, another issue for TSO packets is revealed. The
driver sets IFLIB_NEED_ZERO_CSUM in order to enable a work around that
causes the ip->sum field to be zero'd. This is necessary for ix
hardware to correctly perform TSOs.

However, if TXCSUM is disabled, then the work around is not enabled, as
CSUM_IP will not be set when the iflib stack checks to see if it should
clear the sum field.

Fix this by adding IFLIB_TSO_INIT_IP to the iflib flags for the ix and
ixv interface files.

Once both of these changes are made, the ix and ixv drivers should
correctly offload TSO packets when TSO offload is enabled, regardless
of whether TXCSUM is enabled or disabled.

This patch and commit message is based on rS340256
created by Jacob Keller.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sbruno added a subscriber: jeffrey.e.pieper_intel.com.

I guess this will wait for @jeffrey.e.pieper_intel.com to test or approve? This looks correct to my eye.

This revision is now accepted and ready to land.Dec 10 2018, 3:42 PM
This revision now requires review to proceed.Dec 11 2018, 2:01 PM

The description should mention that this also affects/fixes ixv(4), too.

Change commit message to mention also ixv driver.

piotr.pietruszewski_intel.com retitled this revision from ix(4): Fix TSO offloads when TXCSUM is disabled to ix(4),ixv(4): Fix TSO offloads when TXCSUM is disabled.Dec 12 2018, 11:30 AM
piotr.pietruszewski_intel.com edited the summary of this revision. (Show Details)

We are seeing tx hangs with UDP using multiple clients when offloads are disabled. Cannot reproduce on 12.0-RELEASE. Reproducible on X520 and X550.

This revision now requires changes to proceed.Dec 18 2018, 6:17 PM

We are seeing tx hangs with UDP using multiple clients when offloads are disabled. Cannot reproduce on 12.0-RELEASE. Reproducible on X520 and X550.

Huh? Does this review break things for you? Or are you bringing up a new problem?

We are seeing tx hangs with UDP using multiple clients when offloads are disabled. Cannot reproduce on 12.0-RELEASE. Reproducible on X520 and X550.

Huh? Does this review break things for you? Or are you bringing up a new problem?

Just reporting issues/regressions we found while testing this :)

We are seeing tx hangs with UDP using multiple clients when offloads are disabled. Cannot reproduce on 12.0-RELEASE. Reproducible on X520 and X550.

Huh? Does this review break things for you? Or are you bringing up a new problem?

Just reporting issues/regressions we found while testing this :)

So, is UDP broken without this review?

We are seeing tx hangs with UDP using multiple clients when offloads are disabled. Cannot reproduce on 12.0-RELEASE. Reproducible on X520 and X550.

This sounds like it can't reproduce on 12-release, meaning that it's a bug with this patch applied? Is that a correct interpretation of the statement?

Clarification would help here.

We are seeing tx hangs with UDP using multiple clients when offloads are disabled. Cannot reproduce on 12.0-RELEASE. Reproducible on X520 and X550.

This sounds like it can't reproduce on 12-release, meaning that it's a bug with this patch applied? Is that a correct interpretation of the statement?

Clarification would help here.

That would be correct. We cannot repro on 13-CURRENT or 12.0-RELEASE, so this patch somehow breaks UDP with offloads disabled.

I think I see what's wrong... we check CSUM_TSO for IPPROTO_UDP and IPPROTO_SCTP. That doesn't make sense, since TSO is only for TCP

We probably should only check CSUM_TSO for TCP packets..

sys/dev/ixgbe/ix_txrx.c
123 ↗(On Diff #51901)

In fact, we already do a check for enabling IP checksums when CSUM_TSO is on, but CSUM_IP is off, here.

134 ↗(On Diff #51901)

This line is correct, but...

140 ↗(On Diff #51901)

I don't think we want to enable UDP checksums if CSUM_TSO is on, but UDP checksums are off?

146 ↗(On Diff #51901)

Same here, I think the check for CSUM_TSO here is incorrect.

@jeffrey.e.pieper_intel.com you should re-test this, now that Piotr has updated the patch.

This revision is now accepted and ready to land.Jan 31 2019, 4:20 PM
This revision was automatically updated to reflect the committed changes.