Development discussion of WireGuard
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: "Toke Høiland-Jørgensen" <toke@toke.dk>
Cc: Adhipati Blambangan <adhipati@tuta.io>,
	WireGuard mailing list <wireguard@lists.zx2c4.com>
Subject: Re: Attaching XDP program into wireguard interface
Date: Fri, 24 Apr 2020 16:02:40 -0600	[thread overview]
Message-ID: <CAHmME9rssE6_0hT3nS5703YTS0EG_Pug6vGonx9_tU6yLC2UUg@mail.gmail.com> (raw)
In-Reply-To: <87a73035qd.fsf@toke.dk>

On Fri, Apr 24, 2020 at 3:59 PM Toke Høiland-Jørgensen <toke@toke.dk> wrote:
>
> "Jason A. Donenfeld" <Jason@zx2c4.com> writes:
>
> > Oh. Set XDP_FLAGS_SKB_MODE.
>
> Yeah, you'd definitely need to run this in skb/generic XDP mode.
>
> -Toke

It looks like the code in question is likely:

        bpf_op = bpf_chk = ops->ndo_bpf;
       if (!bpf_op && (flags & (XDP_FLAGS_DRV_MODE | XDP_FLAGS_HW_MODE))) {
               NL_SET_ERR_MSG(extack, "underlying driver does not
support XDP in native mode");
               return -EOPNOTSUPP;
       }
       if (!bpf_op || (flags & XDP_FLAGS_SKB_MODE))
               bpf_op = generic_xdp_install;
       if (bpf_op == bpf_chk)
               bpf_chk = generic_xdp_install;

It looks like bpf_op == generic_xdp_install is the case when neither
XDP_FLAGS_DRV_MODE or XDP_FLAGS_HW_MODE is set. Setting
XDP_FLAGS_SKB_MODE explicitly will force it on all drivers, but not
specifying it will fallback to it if the driver doesn't have hardware
support, which is WireGuard's case, unless either XDP_FLAGS_DRV_MODE
or XDP_FLAGS_HW_MODE are set.

  reply	other threads:[~2020-04-24 22:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-22 13:05 Adhipati Blambangan
2020-04-24 20:55 ` Jason A. Donenfeld
2020-04-24 21:01   ` Jason A. Donenfeld
2020-04-24 21:06     ` Jason A. Donenfeld
2020-04-24 21:59     ` Toke Høiland-Jørgensen
2020-04-24 22:02       ` Jason A. Donenfeld [this message]
2020-04-24 22:25         ` Toke Høiland-Jørgensen

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=CAHmME9rssE6_0hT3nS5703YTS0EG_Pug6vGonx9_tU6yLC2UUg@mail.gmail.com \
    --to=jason@zx2c4.com \
    --cc=adhipati@tuta.io \
    --cc=toke@toke.dk \
    --cc=wireguard@lists.zx2c4.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;
as well as URLs for NNTP newsgroup(s).