aboutsummaryrefslogtreecommitdiff
path: root/hw/net/virtio-net.c
diff options
context:
space:
mode:
authorBin Meng <bin.meng@windriver.com>2020-12-11 17:35:12 +0800
committerJason Wang <jasowang@redhat.com>2021-01-25 17:04:56 +0800
commitf574633529926697ced51b6865e5c50bbb78bf1b (patch)
tree98d77919083dfcbec0247c6980c479d08bc07d3b /hw/net/virtio-net.c
parentd97f11590a0f60cd911ace8bb68180b5a09a068d (diff)
downloadqemu-f574633529926697ced51b6865e5c50bbb78bf1b.zip
qemu-f574633529926697ced51b6865e5c50bbb78bf1b.tar.gz
qemu-f574633529926697ced51b6865e5c50bbb78bf1b.tar.bz2
net: checksum: Introduce fine control over checksum type
At present net_checksum_calculate() blindly calculates all types of checksums (IP, TCP, UDP). Some NICs may have a per type setting in their BDs to control what checksum should be offloaded. To support such hardware behavior, introduce a 'csum_flag' parameter to the net_checksum_calculate() API to allow fine control over what type checksum is calculated. Existing users of this API are updated accordingly. Signed-off-by: Bin Meng <bin.meng@windriver.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'hw/net/virtio-net.c')
-rw-r--r--hw/net/virtio-net.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 09ceb02..5150f29 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -1464,7 +1464,7 @@ static void work_around_broken_dhclient(struct virtio_net_hdr *hdr,
(buf[12] == 0x08 && buf[13] == 0x00) && /* ethertype == IPv4 */
(buf[23] == 17) && /* ip.protocol == UDP */
(buf[34] == 0 && buf[35] == 67)) { /* udp.srcport == bootps */
- net_checksum_calculate(buf, size);
+ net_checksum_calculate(buf, size, CSUM_UDP);
hdr->flags &= ~VIRTIO_NET_HDR_F_NEEDS_CSUM;
}
}