From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id DA035A0032;
	Fri,  1 Oct 2021 10:49:55 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 5E1714067A;
	Fri,  1 Oct 2021 10:49:55 +0200 (CEST)
Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com
 [209.85.208.41]) by mails.dpdk.org (Postfix) with ESMTP id 7B0F540040
 for <dev@dpdk.org>; Fri,  1 Oct 2021 10:49:53 +0200 (CEST)
Received: by mail-ed1-f41.google.com with SMTP id v10so32394646edj.10
 for <dev@dpdk.org>; Fri, 01 Oct 2021 01:49:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=1D1SUPVBxheI4BbBWBy0bwZS33DPS1RlmFrVM1dGEBc=;
 b=avT61jXteEwT3hCmR5skembZ9FIwbZpN9ISzSeT58ayqyfK3wAlCfgFBc8HBDdYHwe
 sWFICN87zlWydeM7siwM6n2PgjreBP7eUS/QKomBcuSDud31v3sXFGImMvohg7FRXX13
 cs55iPprJdwaJxLJJTTOuYdblKBiHtyojSKfJRyjY3Ud1slhDiT6Yk+ZiIJ2Px5b2eWF
 jPtNiFgL61LUdaAZcVusVD5yRzEycBARkzvE5mYymGSV4OVraa9hRQYSBqLwiB0UlGm+
 Ib/6YlpGh+5Z1H2iel0VKCRR02goiCa5cMShOYRpUHXT8exlwo5zcXBIfxuW7+TGySCI
 /NMg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=1D1SUPVBxheI4BbBWBy0bwZS33DPS1RlmFrVM1dGEBc=;
 b=XG5x8FJlUenOVXWgaBT1C0euV8oSvTwjEXxZFzPonIpKQ/TrtHMuq7RFvRMkfejQ6D
 anRwBQKkiJhMW9jMR90xkMEADxFlf9id6CzlooGZB5cjf8GC1uus1ccYO9urORFXwr32
 XAeq/qkvpCbEN4338j/gK7FKVoUdqmtKanh82SaF70dr07JHCqnm8f19kfy0mQyL/kOl
 UL13v7BuIqZQaJXJi+YbkKckODI1yRKEcj45mJQ+l9DwRBqf79Rs6n7lb5i9qZM0i2kx
 8khYTjDbkz6xy1vKJ3dIM5GkeOQpd6dvgAjOzDW9Oo03qJiV75sTAnq9ITaltJ0fp5Z6
 kTNg==
X-Gm-Message-State: AOAM532nKIIbdr7ys/95sd+lqQ7bWgQLYhdoNrIcTuPHMg4NJ16TffaC
 Mq8u0VEgvkWdKc+Dq7dq/G1uaIv+8T5GRQ+UG9Q=
X-Google-Smtp-Source: ABdhPJwQxks9wS0RRvD0VwppCPDOP1Tjs7hNtzgK8wB1D99anSr/byMVWUWH+KlqKczs07zT2cjgf8OS5w39U69nsow=
X-Received: by 2002:a17:906:6d0:: with SMTP id
 v16mr4909366ejb.258.1633078193125; 
 Fri, 01 Oct 2021 01:49:53 -0700 (PDT)
MIME-Version: 1.0
References: <1632483885-84732-1-git-send-email-tudor.cornea@gmail.com>
 <1632924497-60394-1-git-send-email-tudor.cornea@gmail.com>
 <a89ee252-5f23-cb2d-d4f8-7ab9ef27f4ef@intel.com>
In-Reply-To: <a89ee252-5f23-cb2d-d4f8-7ab9ef27f4ef@intel.com>
From: Tudor Cornea <tudor.cornea@gmail.com>
Date: Fri, 1 Oct 2021 11:49:42 +0300
Message-ID: <CAOuQ8vVsZ98zKc62ZMg5D9JF5TNoR=EgzPE0Y18yqqRGdAW2cQ@mail.gmail.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>, linville@tuxdriver.com, 
 Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
 Thomas Monjalon <thomas@monjalon.net>, jerinj@marvell.com, dev@dpdk.org
Content-Type: text/plain; charset="UTF-8"
X-Content-Filtered-By: Mailman/MimeDel 2.1.29
Subject: Re: [dpdk-dev] [PATCH v4] net/af_packet: reinsert the stripped vlan
 tag
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Hi Ferruh,

 Also driver was already working with VLAN, the change is VLAN is not
> force stripped anymore.


 Agreed. It makes more sense to inform the users that the default behavior
of the PMD has changed w.r.t VLAN stripping.

I have updated the patch

On Thu, 30 Sept 2021 at 11:14, Ferruh Yigit <ferruh.yigit@intel.com> wrote:

> On 9/29/2021 3:08 PM, Tudor Cornea 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@gmail.com>
> >
> > ---
> > v4:
> > * Updated the af_packet documentation
> > v3:
> > * Updated release note and documentation
> > * Updated commit with performance measurements
> > v2:
> > * Added DEV_RX_OFFLOAD_VLAN_STRIP to rxmode->offloads
> > ---
> >  doc/guides/nics/af_packet.rst             |  5 +++++
> >  doc/guides/rel_notes/release_21_11.rst    |  4 ++++
> >  drivers/net/af_packet/rte_eth_af_packet.c | 12 ++++++++++++
> >  3 files changed, 21 insertions(+)
> >
> > diff --git a/doc/guides/nics/af_packet.rst
> b/doc/guides/nics/af_packet.rst
> > index efd6f1c..c87310b 100644
> > --- a/doc/guides/nics/af_packet.rst
> > +++ b/doc/guides/nics/af_packet.rst
> > @@ -65,3 +65,8 @@ framecnt=512):
> >  .. code-block:: console
> >
> >
> --vdev=eth_af_packet0,iface=tap0,blocksz=4096,framesz=2048,framecnt=512,qpairs=1,qdisc_bypass=0
> > +
> > +Features and Limitations of the af_packet PMD
> > +---------------------------------------------
> > +
> > +Af_packet PMD now works with VLAN's on Linux
>
> Thanks Tudor.
>
> I see this is suggested by Stephen, but I think 'now' is confusing in the
> driver
> guide. Also driver was already working with VLAN, the change is VLAN is not
> force stripped anymore.
>
> I think following part from your previous version is better, what do you
> think
> something like following?
> "
> The PMD will re-insert the VLAN tag transparently to the packet
> if the kernel strips it, as long as the ``DEV_RX_OFFLOAD_VLAN_STRIP`` is
> not
> enabled by application.
> "
>
> > diff --git a/doc/guides/rel_notes/release_21_11.rst
> b/doc/guides/rel_notes/release_21_11.rst
> > index ad7c1af..095fd5b 100644
> > --- a/doc/guides/rel_notes/release_21_11.rst
> > +++ b/doc/guides/rel_notes/release_21_11.rst
> > @@ -66,6 +66,10 @@ New Features
> >
> >    * Added rte_flow support for dual VLAN insert and strip actions.
> >
> > +* **Updated af_packet ethdev driver.**
> > +
> > +  * Added DEV_RX_OFFLOAD_VLAN_STRIP capability.
> > +
>
> I think change in the default behavior is more important in the release
> notes,
> again what do you think to have your following update here:
>
> "
> Default VLAN strip behavior changed. If previously,
> the vlan tag was stripped, if the application now requires the same
> behavior,
> it will need to configure ``DEV_RX_OFFLOAD_VLAN_STRIP``.
> "
>