From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
To: "Toke Høiland-Jørgensen" <toke@toke.dk>
Cc: Jesper Dangaard Brouer <brouer@redhat.com>,
Kalle Valo <kvalo@codeaurora.org>,
linux-wireless@vger.kernel.org, nbd@nbd.name,
Daniel Borkmann <borkmann@iogearbox.net>,
Alexei Starovoitov <alexei.starovoitov@gmail.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [RFC 0/5] add XDP support to mt76x2e/mt76x0e drivers
Date: Thu, 29 Nov 2018 16:45:03 +0100 [thread overview]
Message-ID: <20181129154502.GA29066@localhost.localdomain> (raw)
In-Reply-To: <87h8g0q8py.fsf@toke.dk>
> Lorenzo Bianconi <lorenzo.bianconi@redhat.com> writes:
>
> >> Lorenzo Bianconi <lorenzo.bianconi@redhat.com> writes:
> >>
> >> >> On Wed, 28 Nov 2018 13:36:26 +0100
> >> >> Toke Høiland-Jørgensen <toke@toke.dk> wrote:
> >> >>
[...]
> >> >
> >> > I guess it will be enough to avoid loading a 'non-WiFi' bpf program on
> >> > a 802.11 netdevice (and vice versa). We could add a flag (or something
> >> > similar) in XDP_SETUP_PROG section of netdev_bpf data structure and
> >> > use ieee80211_ptr netdevice pointer in order to guarantee that the bpf
> >> > program will work on the expected 'frame-type'
> >>
> >> Yeah, a flag would be good; we've been discussing that for other XDP use
> >> cases; it's not a done deal yet, but I think it would be useful.
> >
> > Do you think something wifi specific is ok (e.g bool wifi) or do you prefer
> > something more general (e.g u32 frame_type)?
>
> My thought was a feature flag where the program can set a flag which
> means "I expect 802.11 frames", and the driver can set a flag saying "I
> emit 802.11 frames", and if those two flags don't match, the verifier
> can refuse to load the program. This would not be fool-proof (an XDP
> program can still corrupt things if written incorrectly), but it would
> at least protect against the most obvious mistakes.
I guess we can use iee80211_ptr in dev_xdp_install to double check if it is
allowed to upload a 802.11 (or 802.3) bpf program
>
> >> >> Option#2, leave it up to eBPF-programmer if they want to add runtime
> >> >> checks. By extending xdp_rxq_info with frame-type (default to
> >> >> Ethernet), which allow the eBPF-programmer choose to write a generic
> >> >> XDP program that both work on Ethernet and WiFi, or skip-check as they
> >> >> know this will e.g. only run on Wifi. (Note xdp_rxq_info is static
> >> >> read-only info per RX-queue, will all Wifi frames have same frame-type?.
> >> >>
> >> >
> >> > 802.11 standards define three frame subtype (data, management and control).
> >> > Subtypes could be detected parsing 802.11 header
> >> >
> >> >>
> >> >> Also consider what happens in case of XDP_REDIRECT, from a Wifi NIC to
> >> >> an Ethernet NIC. It would of-cause be cool to get this working cross,
> >> >> Wifi-Ethernet.
> >> >>
> >> >
> >> > Very cool :) On tx side the driver will accept standard ethernet frames in
> >> > ndo_xdp_xmit pointer
> >>
> >> How do you envision that will work with drivers that build software
> >> 802.11 frames? The TX hook would have to be in mac80211 somewhere,
> >> wouldn't it?
> >
> > In order to perform 802.3 --> 802.11 xdp forwarding my current idea is
> > is to have ndo_xdp_xmit pointer in mac80211 that will forward the
> > frame to the low-level driver (more or less what I did in the RFC
> > series to upload the bpf program to mt76). We will probably need to
> > pass some info to the driver from mac80211 (e.g sequence number or hw
> > key idx to use)
>
> So this means that the driver will need to do the 802.11 encapsulation?
> I guess we could have a fallback implementation in mac80211; but there
> is possibly quite a bit of refactoring needed to make the existing code
> work without an skb. Also, we need to think about queueing; I'm not sure
> it's a good idea to have redirected frames bypass the TXQs...
>
good point :)
Regards,
Lorenzo
> -Toke
next prev parent reply other threads:[~2018-11-29 15:45 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-27 22:21 [RFC 0/5] add XDP support to mt76x2e/mt76x0e drivers Lorenzo Bianconi
2018-11-27 22:21 ` [RFC 1/5] mac80211: introduce ieee80211_xdp handler Lorenzo Bianconi
2018-11-27 22:21 ` [RFC 2/5] mac80211: introduce ieee80211_vif_to_netdev routine Lorenzo Bianconi
2018-11-27 22:21 ` [RFC 3/5] mt76: split mt76_dma_rx_reset in init_rx_reset and complete_rx_reset Lorenzo Bianconi
2018-11-27 22:21 ` [RFC 4/5] mt76: make mt76x02_vif_init return int Lorenzo Bianconi
2018-11-27 22:21 ` [RFC 5/5] mt76: add XDP support Lorenzo Bianconi
2018-11-28 10:15 ` [RFC 0/5] add XDP support to mt76x2e/mt76x0e drivers Kalle Valo
2018-11-28 10:44 ` Lorenzo Bianconi
2018-11-28 12:36 ` Toke Høiland-Jørgensen
2018-11-28 12:53 ` Michał Kazior
2018-11-28 14:19 ` Toke Høiland-Jørgensen
2018-11-28 13:11 ` Lorenzo Bianconi
2018-11-28 14:21 ` Toke Høiland-Jørgensen
2018-11-28 14:35 ` Lorenzo Bianconi
2018-11-28 14:43 ` Toke Høiland-Jørgensen
2018-11-28 15:35 ` Lorenzo Bianconi
2018-11-28 23:12 ` Toke Høiland-Jørgensen
2018-11-29 12:59 ` Lorenzo Bianconi
2018-11-29 13:29 ` Toke Høiland-Jørgensen
2018-11-29 13:45 ` Michał Kazior
2018-11-29 13:53 ` Toke Høiland-Jørgensen
2018-12-03 17:57 ` Johannes Berg
2018-12-03 19:36 ` Toke Høiland-Jørgensen
2018-12-03 19:41 ` Johannes Berg
2018-12-03 19:51 ` Toke Høiland-Jørgensen
2018-12-03 20:00 ` Lorenzo Bianconi
2018-11-28 15:43 ` Jesper Dangaard Brouer
2018-11-28 15:43 ` Jesper Dangaard Brouer
2018-11-29 10:30 ` Lorenzo Bianconi
2018-11-29 13:27 ` Toke Høiland-Jørgensen
2018-11-29 13:27 ` Toke Høiland-Jørgensen
2018-11-29 13:41 ` Michał Kazior
2018-11-29 13:48 ` Toke Høiland-Jørgensen
2018-11-29 13:58 ` Lorenzo Bianconi
2018-11-29 14:06 ` Toke Høiland-Jørgensen
2018-11-29 14:06 ` Toke Høiland-Jørgensen
2018-11-29 15:45 ` Lorenzo Bianconi [this message]
2018-11-29 16:06 ` 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=20181129154502.GA29066@localhost.localdomain \
--to=lorenzo.bianconi@redhat.com \
--cc=alexei.starovoitov@gmail.com \
--cc=borkmann@iogearbox.net \
--cc=brouer@redhat.com \
--cc=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
--cc=nbd@nbd.name \
--cc=netdev@vger.kernel.org \
--cc=toke@toke.dk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.