On Thu, 2016-05-12 at 13:27 -0700, Alexander Duyck wrote: > I'm assuming this was using skb_dst(skb)->dev in order to allow for > use of this function by other callers since the original function > __udp4_lib_lookup_skb was using that. If we change this then it > reduces the likelihood of the code being reusable by other callers. > In such a case I would probably want to go through and also rename the > functions to make sure they are tagged as being GRO specific. >
__udp4_lib_lookup_skb() should use skb->dev as well, or get the net pointer from its caller. It is called from __udp4_lib_rcv() and this one simply does : struct net *net = dev_net(skb->dev); So for consistency (and small performance gain) I would suggest : diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index f67f52ba4809..d9006f2d28eb 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -604,7 +604,7 @@ static inline struct sock *__udp4_lib_lookup_skb(struct sk_buff *skb, { const struct iphdr *iph = ip_hdr(skb); - return __udp4_lib_lookup(dev_net(skb_dst(skb)->dev), iph->saddr, sport, + return __udp4_lib_lookup(dev_net(skb->dev), iph->saddr, sport, iph->daddr, dport, inet_iif(skb), udptable, skb); }