make sure the nic supports DEV_RX_OFFLOAD_VLAN_STRIP feature by checking device information .
there are two ways to configure vlan striping in DPDK,one is to set the .hw_vlan_strip bit of rte_eth_conf during device configuration phase,another way is to configure at runtime,rte_eth_dev_set_vlan_offload(port_id,rte_eth_dev_get_vlan_offload()|ETH_VLAN_STRIP_OFFLOAD) .
upon receiving a packet,we see if it's a vlan packet ,'PKT_RX_VLAN_PKT' will be set,and then we could also find PKT_RX_VLAN_STRIPPED bit is set ,and rte-mbuf.vlan_tci is the tci of real vlan header .
-vlan filter offloading
vlan filtering offloading allows nic to filter VLAN packets basing on the vlan white list,still ,we need to configure by doing so:rte_eth_dev_set_vlan_offload(port_id,rte_eth_dev_get_vlan_offload()|ETH_VLAN_FILTER_OFFLOAD) ,and then we could call rte_eth_dev_vlan_filter() to add a vlan to white list. there is no feature bit indicating the packet is allowed after vlan filtering in rte_mbuf.
-vlan insertion offloading
if NIC supports DEV_TX_OFFLOAD_VLAN_INSERT ,then we could use the following code to make NIC insert a vlan header during transmission:
first check TX checksum features the NIC supports . for example ,the NIC supports IP checksum tx offloading ,then before transmission ,we set setup offloading flags as follows: