i40evf: fix link info update
[dpdk.git] / examples / vhost / main.c
index ceabbce..28c17af 100644 (file)
@@ -1163,10 +1163,13 @@ static void virtio_tx_offload(struct rte_mbuf *m)
 
        l3_hdr = (char *)eth_hdr + m->l2_len;
 
-       ipv4_hdr = (struct ipv4_hdr *)l3_hdr;
+       if (m->ol_flags & PKT_TX_IPV4) {
+               ipv4_hdr = l3_hdr;
+               ipv4_hdr->hdr_checksum = 0;
+               m->ol_flags |= PKT_TX_IP_CKSUM;
+       }
+
        tcp_hdr = (struct tcp_hdr *)((char *)l3_hdr + m->l3_len);
-       m->ol_flags |= PKT_TX_IP_CKSUM;
-       ipv4_hdr->hdr_checksum = 0;
        tcp_hdr->cksum = get_psd_sum(l3_hdr, m->ol_flags);
 }
 
@@ -1393,8 +1396,10 @@ switch_worker(__attribute__((unused)) void *arg)
                                                        rte_pktmbuf_free(pkts_burst[--tx_count]);
                                        }
                                }
-                               for (i = 0; i < tx_count; ++i)
-                                       virtio_tx_route(vdev, pkts_burst[i], (uint16_t)dev->device_fh);
+                               for (i = 0; i < tx_count; ++i) {
+                                       virtio_tx_route(vdev, pkts_burst[i],
+                                               vlan_tags[(uint16_t)dev->device_fh]);
+                               }
                        }
 
                        /*move to the next device in the list*/