net/virtio: do not touch Tx offload flags
authorDavid Marchand <david.marchand@redhat.com>
Mon, 3 May 2021 16:43:42 +0000 (18:43 +0200)
committerMaxime Coquelin <maxime.coquelin@redhat.com>
Tue, 4 May 2021 08:22:17 +0000 (10:22 +0200)
Tx offload flags are of the application responsibility.
Leave the mbuf alone and use a local storage for implicit tcp checksum
offloading in case of TSO.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
drivers/net/virtio/virtqueue.h

index e9992b7..ed3b850 100644 (file)
@@ -622,10 +622,12 @@ virtqueue_xmit_offload(struct virtio_net_hdr *hdr,
                        uint8_t offload)
 {
        if (offload) {
+               uint64_t csum_l4 = cookie->ol_flags & PKT_TX_L4_MASK;
+
                if (cookie->ol_flags & PKT_TX_TCP_SEG)
-                       cookie->ol_flags |= PKT_TX_TCP_CKSUM;
+                       csum_l4 |= PKT_TX_TCP_CKSUM;
 
-               switch (cookie->ol_flags & PKT_TX_L4_MASK) {
+               switch (csum_l4) {
                case PKT_TX_UDP_CKSUM:
                        hdr->csum_start = cookie->l2_len + cookie->l3_len;
                        hdr->csum_offset = offsetof(struct rte_udp_hdr,