[dpdk-dev] [PATCH v5] net/af_packet: reinsert the stripped vlan tag
Stephen Hemminger
stephen at networkplumber.org
Fri Oct 1 17:02:25 CEST 2021
On Fri, 1 Oct 2021 11:35:01 +0300
Tudor Cornea <tudor.cornea at gmail.com> wrote:
> The af_packet pmd driver binds to a raw socket and allows
> sending and receiving of packets through the kernel.
>
> Since commit [1], the kernel strips the vlan tags early in
> __netif_receive_skb_core(), so we receive untagged packets while
> running with the af_packet pmd.
>
> Luckily for us, the skb vlan-related fields are still populated from the
> stripped vlan tags, so we end up having all the information
> that we need in the mbuf.
>
> Having the pmd driver support DEV_RX_OFFLOAD_VLAN_STRIP allows the
> application to control the desired vlan stripping behavior,
> until we have a way to describe offloads that can't be disabled by
> pmd drivers.
>
> This patch will cause a change in the default way that the af_packet
> pmd treats received vlan-tagged frames. While previously, the
> application was required to check the PKT_RX_VLAN_STRIPPED flag, after
> this patch, the pmd will re-insert the vlan tag transparently to the
> user, unless the DEV_RX_OFFLOAD_VLAN_STRIP is enabled in
> rxmode.offloads.
>
> I've attempted a preliminary benchmark to understand if the change could
> cause a sizable performance hit.
>
> Setup:
> Two virtual machines running on top of an ESXi hypervisor
>
> Tx: DPDK app (running on top of vmxnet3 PMD)
> Rx: af_packet (running on top of a kernel vmxnet3 interface)
> Packet size :68 (packet contains a vlan tag)
>
> Rates:
> Tx - 1.419 Mpps
> Rx (without vlan insertion) - 1227636 pps
> Rx (with vlan insertion) - 1220081 pps
>
> At a first glance, we don't seem to have a large degradation in terms
> of packet rate.
>
> [1] https://github.com/torvalds/linux/commit/bcc6d47903612c3861201cc3a866fb604f26b8b2
>
> Signed-off-by: Tudor Cornea <tudor.cornea at gmail.com>
Acked-by: Stephen Hemminger <stephen at networkplumber.org>
More information about the dev
mailing list