bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: "Toke Høiland-Jørgensen" <toke@redhat.com>,
	"John Fastabend" <john.fastabend@gmail.com>,
	"John Fastabend" <john.fastabend@gmail.com>,
	"Hangbin Liu" <liuhangbin@gmail.com>
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org,
	"Jiri Benc" <jbenc@redhat.com>,
	"Jesper Dangaard Brouer" <brouer@redhat.com>,
	"Eelco Chaudron" <echaudro@redhat.com>,
	ast@kernel.org, "Daniel Borkmann" <daniel@iogearbox.net>,
	"Lorenzo Bianconi" <lorenzo.bianconi@redhat.com>,
	"David Ahern" <dsahern@gmail.com>,
	"Andrii Nakryiko" <andrii.nakryiko@gmail.com>,
	"Alexei Starovoitov" <alexei.starovoitov@gmail.com>,
	"Maciej Fijalkowski" <maciej.fijalkowski@intel.com>,
	"Björn Töpel" <bjorn.topel@gmail.com>
Subject: Re: [PATCHv4 bpf-next 2/4] xdp: extend xdp_redirect_map with broadcast support
Date: Thu, 08 Apr 2021 16:30:45 -0700	[thread overview]
Message-ID: <606f922584d89_c8b92089a@john-XPS-13-9370.notmuch> (raw)
In-Reply-To: <87h7kj2enn.fsf@toke.dk>

Toke Høiland-Jørgensen wrote:
> John Fastabend <john.fastabend@gmail.com> writes:
> 
> > Toke Høiland-Jørgensen wrote:
> >> John Fastabend <john.fastabend@gmail.com> writes:
> >> 
> >> > Toke Høiland-Jørgensen wrote:
> >> >> Hangbin Liu <liuhangbin@gmail.com> writes:
> >> >> 
> >> >> > On Mon, Apr 05, 2021 at 05:24:48PM -0700, John Fastabend wrote:
> >> >> >> Hangbin Liu wrote:
> >> >> >> > This patch add two flags BPF_F_BROADCAST and BPF_F_EXCLUDE_INGRESS to extend
> >> >> >> > xdp_redirect_map for broadcast support.

[...]

> >> > Have we consider doing something like the batch lookup ops over hashtab?
> >> > I don't mind "missing" values so if we just walk the list?
> >> >
> >> >      head = dev_map_index_hash(dtab, i)
> >> >      // collect all my devs and get ready to send multicast
> >> >      hlist_nulls_for_each_entry_safe(dev, next, head, index_hlist) {
> >> > 		enqueue(dev, skb)
> >> >      }
> >> >      // submit the queue of entries and do all the work to actually xmit
> >> >      submit_enqueued();
> >> >
> >> > We don't have to care about keys just walk the hash list?
> >> 
> >> So you'd wrap that in a loop like:
> >> 
> >> for (i = 0; i < dtab->n_buckets; i++) {
> >> 	head = dev_map_index_hash(dtab, i);
> >> 	hlist_nulls_for_each_entry_safe(dev, next, head, index_hlist) {
> >> 		bq_enqueue(dev, xdpf, dev_rx, obj->xdp_prog);
> >> 	}
> >> }
> >> 
> >> or? Yeah, I guess that would work!
> >
> > Nice. Thanks for sticking with this Hangbin its taking us a bit, but
> > I think above works on my side at least.
> >
> >> 
> >> It would mean that dev_map_enqueue_multi() would need more in-depth
> >> knowledge into the map type, so would likely need to be two different
> >> functions for the two different map types, living in devmap.c - but
> >> that's probably acceptable.
> >
> > Yeah, I think thats fine.
> >
> >> 
> >> And while we're doing that, the array-map version can also loop over all
> >> indexes up to max_entries, instead of stopping at the first index that
> >> doesn't have an entry like it does now (right now, it looks like if you
> >> populate entries 0 and 2 in an array-map only one copy of the packet
> >> will be sent, to index 0).
> >
> > Right, this is likely needed anyways. At least when I was doing prototypes
> > of using array maps I often ended up with holes in the map. Just imagine
> > adding a set of devs and then removing one, its not likely to be the
> > last one you insert.
> 
> Yeah, totally. Would have pointed it out if I'd noticed before, but I
> was too trusting in the abstraction of get_next_key() etc :)
 
Hangbin,

If possible please try to capture some of the design discussion in
the commit message on the next rev along with the tradeoffs we are making
so we don't lose these important details. Some of these points are fairly
subtle calling them out will surely save (for me at least) some thinking
when I pick this up when it lands in a released kernel.

Thanks!

  reply	other threads:[~2021-04-08 23:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-02 12:19 [PATCHv4 bpf-next 0/4] xdp: extend xdp_redirect_map with broadcast support Hangbin Liu
2021-04-02 12:19 ` [PATCHv4 bpf-next 1/4] bpf: run devmap xdp_prog on flush instead of bulk enqueue Hangbin Liu
2021-04-02 12:19 ` [PATCHv4 bpf-next 2/4] xdp: extend xdp_redirect_map with broadcast support Hangbin Liu
2021-04-06  0:24   ` John Fastabend
2021-04-06  6:38     ` Hangbin Liu
2021-04-06 10:19       ` Toke Høiland-Jørgensen
2021-04-06 21:49         ` John Fastabend
2021-04-06 22:19           ` Toke Høiland-Jørgensen
2021-04-06 22:29             ` John Fastabend
2021-04-06 23:10               ` Toke Høiland-Jørgensen
2021-04-08 23:30                 ` John Fastabend [this message]
2021-04-09  2:45                   ` Hangbin Liu
2021-04-06 11:17   ` Toke Høiland-Jørgensen
2021-04-02 12:19 ` [PATCHv4 bpf-next 3/4] sample/bpf: add xdp_redirect_map_multi for redirect_map broadcast test Hangbin Liu
2021-04-02 12:19 ` [PATCHv4 bpf-next 4/4] selftests/bpf: add xdp_redirect_multi test Hangbin Liu

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=606f922584d89_c8b92089a@john-XPS-13-9370.notmuch \
    --to=john.fastabend@gmail.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=ast@kernel.org \
    --cc=bjorn.topel@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=brouer@redhat.com \
    --cc=daniel@iogearbox.net \
    --cc=dsahern@gmail.com \
    --cc=echaudro@redhat.com \
    --cc=jbenc@redhat.com \
    --cc=liuhangbin@gmail.com \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=maciej.fijalkowski@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=toke@redhat.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).