On Tue, 2014-01-14 at 23:51 +0200, Or Gerlitz wrote:
quoted
quoted
+ rcu_read_lock();
+
+ uo_priv = rcu_dereference(udp_offload_base);
+ for (; uo_priv != NULL; uo_priv = rcu_dereference(uo_priv->next)) {
+ if (uo_priv->offload->port == uh->dest &&
+ uo_priv->offload->callbacks.gro_complete)
+ goto found;
+ }
+
+ rcu_read_unlock();
+ return err;
+
+found:
+ atomic_inc(&uo_priv->refcount);
This is an expensive operation in the critical path.
I know, but I don't see how to get away without having the ref/unref
wrapping, ideas welcome
quoted
Can uo_priv be protected by rcu also?
uo_priv is the actual element which is rcu protected, not sure to
follow on your question.
Seems pretty easy : unlock rcu after calling gro_complete() as in :
found:
err = uo_priv->offload->callbacks.gro_complete(skb, nhoff + sizeof(struct udphdr));
rcu_read_unlock();
return err;