net/netvsc: support receive without VLAN strip
[dpdk.git] / drivers / net / netvsc / hn_rxtx.c
index f4a3664..622a839 100644 (file)
@@ -501,6 +501,14 @@ static void hn_rxpkt(struct hn_rx_queue *rxq, struct hn_rx_bufinfo *rxb,
        if (info->vlan_info != HN_NDIS_VLAN_INFO_INVALID) {
                m->vlan_tci = info->vlan_info;
                m->ol_flags |= PKT_RX_VLAN_STRIPPED | PKT_RX_VLAN;
+
+               /* NDIS always strips tag, put it back if necessary */
+               if (!hv->vlan_strip && rte_vlan_insert(&m)) {
+                       PMD_DRV_LOG(DEBUG, "vlan insert failed");
+                       ++rxq->stats.errors;
+                       rte_pktmbuf_free(m);
+                       return;
+               }
        }
 
        if (info->csum_info != HN_NDIS_RXCSUM_INFO_INVALID) {