What exactly do the rx-vlan-offload and tx-vlan-offload ethtool options do?

Christian picture Christian · Dec 21, 2016 · Viewed 8.3k times · Source

The ethtool manpage only gives a nebulous explanation:

   rxvlan on|off
          Specifies whether RX VLAN acceleration should be enabled

   txvlan on|off
          Specifies whether TX VLAN acceleration should be enabled

What exactly do the options accomplish, assuming you can enable them?

Answer

haggai_e picture haggai_e · Jun 29, 2017

Apparently, rxvlan and txvlan are aliases for the kernel features rx-vlan-hw-parse and tx-vlan-hw-insert respectively (see ethtool.c).

In the kernel they are translated to the netdev features NETIF_F_HW_VLAN_CTAG_RX_BIT and NETIF_F_HW_VLAN_CTAG_TX_BIT. (See net/core/ethtool.c)

To the best of my knowledge, the TX_BIT allows the NIC to add the VLAN tag during transmission without explicitly placing it in the packet. See the relevant code in the VLAN driver.

Similarly, when the RX_BIT is enabled, the NIC can strip the VLAN tag from incoming packets and let the driver place the information from the VLAN tag in the relevant skb.