From: "Toke Høiland-Jørgensen" <toke@toke.dk>
To: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Cc: Kalle Valo <kvalo@codeaurora.org>,
linux-wireless@vger.kernel.org, nbd@nbd.name, brouer@redhat.com
Subject: Re: [RFC 0/5] add XDP support to mt76x2e/mt76x0e drivers
Date: Thu, 29 Nov 2018 14:29:29 +0100 [thread overview]
Message-ID: <87pnuoqafa.fsf@toke.dk> (raw)
In-Reply-To: <20181129125929.GB6365@localhost.localdomain>
Lorenzo Bianconi <lorenzo.bianconi@redhat.com> writes:
>> Lorenzo Bianconi <lorenzo.bianconi@redhat.com> writes:
>>
>> > On Nov 28, Toke Høiland-Jørgensen wrote:
>> >> Lorenzo Bianconi <lorenzo.bianconi@redhat.com> writes:
>> >>
>> >> >> Lorenzo Bianconi <lorenzo.bianconi@redhat.com> writes:
>> >> >>
>> >> >> >> >> > This series is intended as a playground to start experimenting/developing
>> >> >> >> >> > with XDP/eBPF over WiFi and collect ideas/concerns about it.
>> >> >> >> >> > Introduce XDP support to mt76x2e/mt76x0e drivers. Currently supported
>> >> >> >> >> > actions are:
>> >> >> >> >> > - XDP_PASS
>> >> >> >> >> > - XDP_ABORTED
>> >> >> >> >> > - XDP_DROP
>> >> >> >> >> > Introduce ndo_bpf mac80211 callback in order to to load a bpf
>> >> >> >> >> > program into low level driver XDP rx hook.
>> >> >> >> >> > This series has been tested through a simple bpf program (available here:
>> >> >> >> >> > https://github.com/LorenzoBianconi/bpf-workspace/tree/master/mt76_xdp_stats)
>> >> >> >> >> > used to count frame types received by the device.
>> >> >> >> >> > Possible eBPF use cases could be:
>> >> >> >> >> > - implement new statistics through bpf maps
>> >> >> >> >> > - implement fast packet filtering (e.g in monitor mode)
>> >> >> >> >> > - ...
>> >> >> >> >
>> >> >> >> > Hi Kalle,
>> >> >> >> >
>> >> >> >> >>
>> >> >> >> >> This is most likely a stupid question, but why do this in the driver and
>> >> >> >> >> not in mac80211 so that all drivers could benefit from it? I guess there
>> >> >> >> >> are reasons for that, I just can't figure that out.
>> >> >> >>
>> >> >> >> XDP achieves its speedup by running the eBPF program inside the driver
>> >> >> >> NAPI loop, before the kernel even touches the data in any other capacity
>> >> >> >> (and in particular, before it allocates an SKB). Which kinda means the
>> >> >> >> hook needs to be in the driver... Could be a fallback in mac80211,
>> >> >> >> though; although we'd have to figure out how that interacts with Generic
>> >> >> >> XDP.
>> >> >> >>
>> >> >> >> > This is an early stage implementation, at this point I would collect
>> >> >> >> > other people opinions/concerns about using bpf/xdp directly on 802.11
>> >> >> >> > frames.
>> >> >> >>
>> >> >> >> Thanks for looking into this!
>> >> >> >
>> >> >> > Hi Toke,
>> >> >> >
>> >> >> >>
>> >> >> >> I have two concerns with running XDP on 802.11 frames:
>> >> >> >>
>> >> >> >> 1. It makes it more difficult to add other XDP actions (such as
>> >> >> >> REDIRECT), as the XDP program would then have to make sure that the
>> >> >> >> outer packet headers are removed before, say, redirecting the packet
>> >> >> >> out of an ethernet interface. Also, if we do add redirect, we would
>> >> >> >> be bypassing mac80211 entirely; to what extent would that mess up
>> >> >> >> internal state?
>> >> >> >>
>> >> >> >
>> >> >> > You are right, my assumption here is the logic/complexity is moved to
>> >> >> > the bpf program that needs to take care of all possible issues that
>> >> >> > can be introduced. More or less it is the same if a bpf program mess
>> >> >> > up with TCP segments on a wired connection, isn't it?
>> >> >>
>> >> >> No, I guess not; except here it potentially applies to all packets
>> >> >> (things like BAW tracking), and it is *in addition* to TCP.
>> >> >
>> >> > Yes, here it is a little bit harder, but I was meaning that the bpf program
>> >> > has to be very careful when dropping a packet :)
>> >>
>> >> Yeah. What kind of filtering were you thinking you would use this for in
>> >> the short term?
>> >>
>> >
>> > When I started working on XDP for mt76 I was thinking about BSSID
>> > filtering but I was looking for a more general solution respect to add
>> > that feature in the driver. Moreover we could use bpf for fast packet
>> > filtering when you add an interface in monitor mode.
>>
>> Yup, both of these make sense.
>>
>> > Nevertheless I guess there could be other use cases not limited to
>> > frame filtering. My primary goal with this series is to collect
>> > ideas/concerns on WiFi XDP/eBPF possible uses cases.
>>
>> Well, Michał's idea about offloading is cool if it is possible to get
>> vendors to implement it.
>>
>
> Yep, would be very cool :)
>
>> Other than that, if we can solve the issues with differences between
>> 802.11 and plain Ethernet frames, I see no reason why it wouldn't be
>> possible to implement an XDP fast-path for WiFi-to-Ethernet forwarding,
>> which might be useful in an access point, especially as WiFi speeds
>> increase.
>>
>
> Agree
>
>> The other direction will probably be more difficult, at least if 802.11
>> frames need to be built in software. It *might* be possible with the XDP
>> egress hook we are planning (with a suitable set of helpers, the eBPF
>> program could build the 802.11 frames), but I'm not really sure if that
>> is worth doing as I'm quite sure there are some hairy edge cases
>> there...
>
> The possible issue with XDP_DROP action you are referring to here is
> A-MPDU reordering on rx side, right? If so I guess the issue will be
> fixed by tid_agg_rx->reorder_timer. Are you referring to other
> possible edge cases?
I'm not sure, which is why I was being deliberately vague... ;)
Just something to be aware of when going beyond proof of concept, I
guess: here be dragons.
-Toke
next prev parent reply other threads:[~2018-11-29 13:29 UTC|newest]
Thread overview: 35+ 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 [this message]
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-29 10:30 ` Lorenzo Bianconi
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 15:45 ` Lorenzo Bianconi
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=87pnuoqafa.fsf@toke.dk \
--to=toke@toke.dk \
--cc=brouer@redhat.com \
--cc=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo.bianconi@redhat.com \
--cc=nbd@nbd.name \
/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).