public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: alexandre.ferrieux@orange.com
To: Chengen Du <chengen.du@canonical.com>,
	Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, kaber@trash.net, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH v5] af_packet: Handle outgoing VLAN packets without hardware offloading
Date: Wed, 5 Jun 2024 16:22:43 +0200	[thread overview]
Message-ID: <6df76928-be7f-483e-9685-88ee245ef1bf@orange.com> (raw)
In-Reply-To: <CAPza5qctPn_yrFQrO_2NHXpz-kf1qTwxk_APn2t5VU30sY=-MQ@mail.gmail.com>



On 05/06/2024 08:03, Chengen Du wrote:
> On Wed, Jun 5, 2024 at 6:57 AM Willem de Bruijn
> <willemdebruijn.kernel@gmail.com> wrote:
> >
> > This adds some parsing overhead in the datapath. SOCK_RAW does not
> > need it, as it can see the whole VLAN tag. Perhaps limit the new
> > branches to SOCK_DGRAM cases? Then the above can also be simplified.
>
> I considered this approach before, but it would result in different
> metadata for SOCK_DGRAM and SOCK_RAW scenarios. This difference makes
> me hesitate because it might be better to provide consistent metadata
> to describe the same packet, regardless of the receiver's approach.
> These are just my thoughts and I'm open to further discussion.

FWIW, I vote for Willem's approach here: there is no problem with having 
different metadata in SOCK_DGRAM and SOCK_RAW, as the underlying parsing efforts 
are different anyway, along with the start offset for BPF.
(No, I'm not super happy to see BPF code reaching out to offset -4096 or so to 
get VLAN as metadata. That just smells like a horrendous kludge.)
To me, it makes plenty of sense to have:
  - SOCK_DGRAM for compatibility (used by everyone today), doing all historical 
shenanigans with VLANs and metadata
  - SOCK_RAW for a modern, new API, making no assumption on encapsulation, and 
presenting an untouched linear frame
  - yes this means different BPF code for the same filter between the two modes

Again, my .02c

-Alex

____________________________________________________________________________________________________________
Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
Thank you.

  reply	other threads:[~2024-06-05 14:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-04  5:48 [PATCH v5] af_packet: Handle outgoing VLAN packets without hardware offloading Chengen Du
2024-06-04  6:14 ` Chengen Du
2024-06-04 22:46   ` Willem de Bruijn
2024-06-04 22:57 ` Willem de Bruijn
2024-06-05  6:03   ` Chengen Du
2024-06-05 14:22     ` alexandre.ferrieux [this message]
2024-06-05 19:22       ` Willem de Bruijn
2024-06-05 19:24     ` Willem de Bruijn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6df76928-be7f-483e-9685-88ee245ef1bf@orange.com \
    --to=alexandre.ferrieux@orange.com \
    --cc=chengen.du@canonical.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kaber@trash.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=willemdebruijn.kernel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox