netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: johannes@sipsolutions.net
Cc: netdev@vger.kernel.org, xdp-newbies@vger.kernel.org
Subject: Re: [PATCH net-next RFC] Generic XDP
Date: Sun, 09 Apr 2017 12:47:26 -0700 (PDT)	[thread overview]
Message-ID: <20170409.124726.911932420824458401.davem@davemloft.net> (raw)
In-Reply-To: <1491721447.4309.2.camel@sipsolutions.net>

From: Johannes Berg <johannes@sipsolutions.net>
Date: Sun, 09 Apr 2017 09:04:07 +0200

> On Sun, 2017-04-09 at 08:25 +0200, Johannes Berg wrote:
>> That would also let you use rcu_assign_pointer() which seems like the
>> right thing to do here, along with marking the xdp_prog pointer as
>> __rcu? That'd also let you use rcu_dereference() instead of
>> READ_ONCE() which seems like the better annotation?
> 
> Looks like drivers do it exactly this way too though.

Every driver does things differently.  For example bnxt_en (which I
largely based my patch upon) uses xchg(), whilst mlx4 uses RCU
operations.

It just goes to show why it's good to have a common implementation of
XDP like this.

> What I forgot: I guess we could make drivers use dev->xdp_prog after
> this, instead of having their own?

Yes, but we have to resolve xchg() vs. RCU in order for that to work.

When evaluating this, we have to keep in mind that drivers tend to
have an extra pointer to the XDP program in their per-queue
datastructures.  They do this for the purposes of locality of
refernece during packet processing.

Instinctively I agree with you that RCU should be the way to go so
for now I'll adjust my patch to do things that way.

Thanks.

  reply	other threads:[~2017-04-09 19:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-09  3:07 [PATCH net-next RFC] Generic XDP David Miller
2017-04-09  5:17 ` Andy Gospodarek
2017-04-09 19:25   ` David Miller
2017-04-09  6:25 ` Johannes Berg
2017-04-09  7:04   ` Johannes Berg
2017-04-09 19:47     ` David Miller [this message]
2017-04-09 13:46 ` Andrew Lunn
2017-04-09 19:24   ` David Miller

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=20170409.124726.911932420824458401.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=johannes@sipsolutions.net \
    --cc=netdev@vger.kernel.org \
    --cc=xdp-newbies@vger.kernel.org \
    /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).