Re: [PATCH net-next RFC] Generic XDP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>
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.




[Index of Archives]     [Linux Networking Development]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite Campsites]

  Powered by Linux