[dpdk-dev] about PKT_RX_VLAN_PKT mbuf flag

Olivier Matz olivier.matz at 6wind.com
Fri Jun 9 15:38:55 CEST 2017


Hi,

After a discussion on the ML [1][2], the commit b37b528d95 ("mbuf: add
new Rx flags for stripped VLAN") [3] marked the mbuf flag
PKT_RX_VLAN_PKT as deprecated, because its behavior was not consistent
among drivers.
It has been partially replaced by PKT_RX_VLAN_STRIPPED which is better
defined.

The flag was kept for 2 reasons:
- let the applications and PMDs move to the new flag
- let the ixgbe driver (maybe others?) implement a new way to do
  Rx vlan offload without vlan strip.

A future work was planned to do the cleanup, but it was never done.
Searching for this flag in the source shows that some PMDs still use
the old flag although it is deprecated.

We need to clean this up. I propose the following, which should not
hurt apps or PMDs too much, knowing PKT_RX_VLAN_PKT is deprecated since
16.07:

  Replace all occurences of PKT_RX_VLAN_PKT by a new flag
  PKT_RX_VLAN_SAVED. The meaning of this new flag is: "the vlan
  tci is saved in mbuf metadata".
  When PKT_RX_VLAN_STRIPPED is present, PKT_RX_VLAN_SAVED is
  implied.

About the RTE_PTYPE_L2_ETHER_VLAN packet type, and as described
in rte_mbuf_ptype.h, "the packet type gives information about the data
carried by the mbuf". It means that the packet type must not be
set to RTE_PTYPE_L2_ETHER_VLAN if the vlan was stripped.

Examples:

- Ether/Vlan/IP packet is received
  vlan stripping is off
  the resulting mbuf data contains Ether/Vlan/IP
  PKT_RX_VLAN_SAVED may be set, in this case m->vlan_tci contains
    the id of the vlan
  ptype is set to RTE_PTYPE_L2_ETHER_VLAN if supported

- Ether/Vlan/IP packet is received
  vlan stripping is on
  the resulting mbuf data contains Ether/IP
  PKT_RX_VLAN_STRIPPED is set and m->vlan_tci contains the id of
    the vlan which was stripped
  PKT_RX_VLAN_SAVED may be set, but anyway it is implied by
    PKT_RX_VLAN_STRIPPED
  ptype is set to RTE_PTYPE_L2_ETHER


Comments are welcome. PKT_RX_VLAN_SAVED is probably not the
best names, ideas are welcome.

Olivier


[1] http://dpdk.org/ml/archives/dev/2016-April/037837.html
[2] http://dpdk.org/ml/archives/dev/2016-June/041068.html
[3] http://dpdk.org/browse/dpdk/commit/?id=b37b528d957c


More information about the dev mailing list