netns: Use net_eq() to compare net-namespaces for optimization.
Without CONFIG_NET_NS, namespace is always &init_net. Compiler will be able to omit namespace comparisons with this patch. Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
407d819cf0
commit
721499e893
@ -615,7 +615,7 @@ static int can_rcv(struct sk_buff *skb, struct net_device *dev,
|
||||
struct can_frame *cf = (struct can_frame *)skb->data;
|
||||
int matches;
|
||||
|
||||
if (dev->type != ARPHRD_CAN || dev_net(dev) != &init_net) {
|
||||
if (dev->type != ARPHRD_CAN || !net_eq(dev_net(dev), &init_net)) {
|
||||
kfree_skb(skb);
|
||||
return 0;
|
||||
}
|
||||
@ -728,7 +728,7 @@ static int can_notifier(struct notifier_block *nb, unsigned long msg,
|
||||
struct net_device *dev = (struct net_device *)data;
|
||||
struct dev_rcv_lists *d;
|
||||
|
||||
if (dev_net(dev) != &init_net)
|
||||
if (!net_eq(dev_net(dev), &init_net))
|
||||
return NOTIFY_DONE;
|
||||
|
||||
if (dev->type != ARPHRD_CAN)
|
||||
|
Reference in New Issue
Block a user