BPF List
 help / color / mirror / Atom feed
From: Alexandre Cassen <acassen@gmail.com>
To: Stanislav Fomichev <sdf@google.com>
Cc: bpf@vger.kernel.org
Subject: Re: PF_PACKET RPS like using bpf
Date: Fri, 15 Mar 2024 19:06:37 +0100	[thread overview]
Message-ID: <dc02f7f4-6996-4a1e-a45d-09784c164939@gmail.com> (raw)
In-Reply-To: <ZfSF6aNQ419Dx9yS@google.com>



On 15/03/2024 18:31, Stanislav Fomichev wrote:
> On 03/14, Alexandre Cassen wrote:
>> Hello,
>>
>> While implementing a large scale L2 processing soft, there is a need for
>> high perf ingress handling.
>>
>> In short: using BPF socket_filter prog with a hash func over ethernet
>> address to distribute load across multiple PF_PACKET sockets: mainly
>> filtering out non related hkey packets. It simplify userland app by using
>> multiple PF_PACKET sockets in dedicated pthread.
>>
>> Longer discussion + quick source code illustration here:
>>
>> https://github.com/acassen/bpf-pfpacket-rps
>>
>>
>> My question would be related to sockmap. I tried to figure out how to
>> perform the same policing design using sockmap. And cant find my way around
>> it :/ If bpf verdict prog can get socket fd from __sk_buff then it could
>> drives the same hash/policing decision.
>>
>> Is it possible to get socket fd from __sk_buff from sockmap verdict prog ?
> 
> Don't have an answer about sockmap, but I'd suggest you look at AF_XDP
> if you want the best perf out there with raw frames.
> IIRC, it just recently got a mode where you can redirect into multiple
> sockets (== consumer threads):
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=2863d665ea41

thanks for replying, __sk_buff bpf mirror doesnt export struct sock as 
present into kernel skbuff, so no options but extending.
AF_XDP is an option. Will extend test code with it later on.

  reply	other threads:[~2024-03-15 18:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-14  8:05 PF_PACKET RPS like using bpf Alexandre Cassen
2024-03-15 17:31 ` Stanislav Fomichev
2024-03-15 18:06   ` Alexandre Cassen [this message]
2024-03-15 18:30     ` Stanislav Fomichev
2024-03-18 16:40       ` Yonghong Song
2024-03-18 21:45         ` Alexandre Cassen

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=dc02f7f4-6996-4a1e-a45d-09784c164939@gmail.com \
    --to=acassen@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=sdf@google.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