diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-03-25 08:47:49 -0400 |
---|---|---|
committer | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-03-25 15:39:53 -0400 |
commit | c346dca10840a874240c78efe3f39acf4312a1f2 (patch) | |
tree | c04cff20124eba5cc337cc5ec260ad2513eeb065 /net/packet/af_packet.c | |
parent | 7cbca67c073263c179f605bdbbdc565ab29d801d (diff) |
[NET] NETNS: Omit net_device->nd_net without CONFIG_NET_NS.
Introduce per-net_device inlines: dev_net(), dev_net_set().
Without CONFIG_NET_NS, no namespace other than &init_net exists.
Let's explicitly define them to help compiler optimizations.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Diffstat (limited to 'net/packet/af_packet.c')
-rw-r--r-- | net/packet/af_packet.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index a56ed2120e07..baa290d3444a 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -263,7 +263,7 @@ static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev, struct | |||
263 | if (skb->pkt_type == PACKET_LOOPBACK) | 263 | if (skb->pkt_type == PACKET_LOOPBACK) |
264 | goto out; | 264 | goto out; |
265 | 265 | ||
266 | if (dev->nd_net != sk->sk_net) | 266 | if (dev_net(dev) != sk->sk_net) |
267 | goto out; | 267 | goto out; |
268 | 268 | ||
269 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) | 269 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) |
@@ -451,7 +451,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet | |||
451 | sk = pt->af_packet_priv; | 451 | sk = pt->af_packet_priv; |
452 | po = pkt_sk(sk); | 452 | po = pkt_sk(sk); |
453 | 453 | ||
454 | if (dev->nd_net != sk->sk_net) | 454 | if (dev_net(dev) != sk->sk_net) |
455 | goto drop; | 455 | goto drop; |
456 | 456 | ||
457 | skb->dev = dev; | 457 | skb->dev = dev; |
@@ -568,7 +568,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe | |||
568 | sk = pt->af_packet_priv; | 568 | sk = pt->af_packet_priv; |
569 | po = pkt_sk(sk); | 569 | po = pkt_sk(sk); |
570 | 570 | ||
571 | if (dev->nd_net != sk->sk_net) | 571 | if (dev_net(dev) != sk->sk_net) |
572 | goto drop; | 572 | goto drop; |
573 | 573 | ||
574 | if (dev->header_ops) { | 574 | if (dev->header_ops) { |
@@ -1450,7 +1450,7 @@ static int packet_notifier(struct notifier_block *this, unsigned long msg, void | |||
1450 | struct sock *sk; | 1450 | struct sock *sk; |
1451 | struct hlist_node *node; | 1451 | struct hlist_node *node; |
1452 | struct net_device *dev = data; | 1452 | struct net_device *dev = data; |
1453 | struct net *net = dev->nd_net; | 1453 | struct net *net = dev_net(dev); |
1454 | 1454 | ||
1455 | read_lock(&net->packet.sklist_lock); | 1455 | read_lock(&net->packet.sklist_lock); |
1456 | sk_for_each(sk, node, &net->packet.sklist) { | 1456 | sk_for_each(sk, node, &net->packet.sklist) { |