On Thu, Sep 1, 2016 at 4:16 PM, Eric Dumazet <eric.duma...@gmail.com> wrote: > On Thu, 2016-09-01 at 12:28 +0300, Hadar Hen Zion wrote: > >> >> As you suggested above, I can do it by adding "int action" to struct >> tcf_tunnel_key_paramse. >> But, it means that act_tunnel_key would have a different behavior than >> all the other actions and even though >> "struct tc_action" has a designated parameters to store this action we >> won't use it. >> So it won't be completely clean... >> >> Do you think we have a cleaner way to protect it? > > Fact that the act_ modules had a spinlock made them all share the same > structure. > > Now we want RCU protection, here is the thing. > > Say you want to access 3 different fields, A, B and C. > > If you put A and B in the rcu protected pointer, but leave C in the > 'control part, protected by spinlock' > > Then your fast path wont be able to have a consistent view of 3 > variables A, B C. > > It might read an old value of A & B, and the recently updated C, > > Or it might read an old C, and the updated values of A & B
Yes, agree. I'll add 'action' to struct tcf_tunnel_key_params. Thanks, Hadar > > As Cong very kindly pointed to us/me, if we want to be 'clean', we want > to make sure we read a consistent 3-tuple. > > I will send updates when I have time to act_mirred.c > >