diff options
author | Ed Swierk via Qemu-devel | 2017-11-15 00:23:34 +0100 |
---|---|---|
committer | Jason Wang | 2017-12-22 02:53:50 +0100 |
commit | d62644b46a86bce2c069af7122501e3ffd349d3c (patch) | |
tree | a4ed379425aaf3cd4a089382cfbac836eed7d556 /include | |
parent | e1000, e1000e: Move per-packet TX offload flags out of context state (diff) | |
download | qemu-d62644b46a86bce2c069af7122501e3ffd349d3c.tar.gz qemu-d62644b46a86bce2c069af7122501e3ffd349d3c.tar.xz qemu-d62644b46a86bce2c069af7122501e3ffd349d3c.zip |
e1000: Separate TSO and non-TSO contexts, fixing UDP TX corruption
The device is supposed to maintain two distinct contexts for transmit
offloads: one has parameters for both segmentation and checksum
offload, the other only for checksum offload. The guest driver can
send two context descriptors, one for each context (the TSE flag
specifies which). Then the guest can refer to one or the other context
in subsequent transmit data descriptors, depending on what offloads it
wants applied to each packet.
Currently the e1000 device stores just one context, and misinterprets
the TSE flags in the context and data descriptors. This is often okay:
Linux happens to send a fresh context descriptor before every data
descriptor, so forgetting the other context doesn't matter. Windows
does rely on separate contexts for TSO vs. non-TSO packets, but for
mostly-TCP traffic the two contexts have identical TCP-specific
offload parameters so confusing them doesn't matter.
One case where this confusion matters is when a Windows guest sets up
a TSO context for TCP and a non-TSO context for UDP, and then
transmits both TCP and UDP traffic in parallel. The e1000 device
sometimes ends up using TCP-specific parameters while doing checksum
offload on a UDP datagram: it writes the checksum to offset 16 (the
correct location for a TCP checksum), stomping on two bytes of UDP
data, and leaving the wrong value in the actual UDP checksum field at
offset 6. (Even worse, the host network stack may then recompute the
UDP checksum, "correcting" it to match the corrupt data before sending
it out a physical interface.)
Correct this by tracking the TSO context independently of the non-TSO
context, and selecting the appropriate context based on the TSE flag
in each transmit data descriptor.
Signed-off-by: Ed Swierk <eswierk@skyportsystems.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions