]> git.droids-corp.org - dpdk.git/commitdiff
net/netvsc: support receive without VLAN strip
authorStephen Hemminger <stephen@networkplumber.org>
Fri, 14 Dec 2018 01:26:19 +0000 (17:26 -0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 21 Dec 2018 15:22:40 +0000 (16:22 +0100)
In some cases, VLAN stripping is not desireable. If necessary
re-insert stripped VLAN tag.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
drivers/net/netvsc/hn_ethdev.c
drivers/net/netvsc/hn_rxtx.c
drivers/net/netvsc/hn_var.h

index 1256fa399b16327636a474c8b313aef6e660935f..22561471aa79ddec04062fc86ede55f5d57fdff7 100644 (file)
@@ -378,6 +378,8 @@ static int hn_dev_configure(struct rte_eth_dev *dev)
                return -EINVAL;
        }
 
+       hv->vlan_strip = !!(rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP);
+
        err = hn_rndis_conf_offload(hv, txmode->offloads,
                                    rxmode->offloads);
        if (err) {
index f4a36641b6c38b2e3dd7bc4b6a74f8570f1a5686..622a83983e10251857e427befcf1a80230785cbb 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) {
index e1072c7cfa55ebb6e1b8b2503984346d574aad21..cd173f6af94269d33760c412bc98147694238e2d 100644 (file)
@@ -97,8 +97,9 @@ struct hn_data {
        struct rte_eth_dev *vf_dev;             /* Subordinate device */
        rte_spinlock_t  vf_lock;
        uint16_t        port_id;
-       bool            closed;
-       bool            vf_present;
+       uint8_t         closed;
+       uint8_t         vf_present;
+       uint8_t         vlan_strip;
        uint32_t        link_status;
        uint32_t        link_speed;