aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-03-25 08:47:49 -0400
committerYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-03-25 15:39:53 -0400
commitc346dca10840a874240c78efe3f39acf4312a1f2 (patch)
treec04cff20124eba5cc337cc5ec260ad2513eeb065 /drivers/net
parent7cbca67c073263c179f605bdbbdc565ab29d801d (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 'drivers/net')
-rw-r--r--drivers/net/bonding/bond_3ad.c2
-rw-r--r--drivers/net/bonding/bond_alb.c2
-rw-r--r--drivers/net/bonding/bond_main.c6
-rw-r--r--drivers/net/hamradio/bpqether.c4
-rw-r--r--drivers/net/loopback.c2
-rw-r--r--drivers/net/macvlan.c2
-rw-r--r--drivers/net/pppoe.c6
-rw-r--r--drivers/net/veth.c2
-rw-r--r--drivers/net/via-velocity.c2
-rw-r--r--drivers/net/wan/dlci.c2
-rw-r--r--drivers/net/wan/hdlc.c4
-rw-r--r--drivers/net/wan/lapbether.c4
-rw-r--r--drivers/net/wan/syncppp.c2
13 files changed, 20 insertions, 20 deletions
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index cb3c6faa7888..457d81f73e39 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -2429,7 +2429,7 @@ int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct pac
2429 struct slave *slave = NULL; 2429 struct slave *slave = NULL;
2430 int ret = NET_RX_DROP; 2430 int ret = NET_RX_DROP;
2431 2431
2432 if (dev->nd_net != &init_net) 2432 if (dev_net(dev) != &init_net)
2433 goto out; 2433 goto out;
2434 2434
2435 if (!(dev->flags & IFF_MASTER)) 2435 if (!(dev->flags & IFF_MASTER))
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index b57bc9467dbe..b986dacf5d33 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -345,7 +345,7 @@ static int rlb_arp_recv(struct sk_buff *skb, struct net_device *bond_dev, struct
345 struct arp_pkt *arp = (struct arp_pkt *)skb->data; 345 struct arp_pkt *arp = (struct arp_pkt *)skb->data;
346 int res = NET_RX_DROP; 346 int res = NET_RX_DROP;
347 347
348 if (bond_dev->nd_net != &init_net) 348 if (dev_net(bond_dev) != &init_net)
349 goto out; 349 goto out;
350 350
351 if (!(bond_dev->flags & IFF_MASTER)) 351 if (!(bond_dev->flags & IFF_MASTER))
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 5fc9d8d58ece..ac688fcb27d7 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2629,7 +2629,7 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack
2629 unsigned char *arp_ptr; 2629 unsigned char *arp_ptr;
2630 __be32 sip, tip; 2630 __be32 sip, tip;
2631 2631
2632 if (dev->nd_net != &init_net) 2632 if (dev_net(dev) != &init_net)
2633 goto out; 2633 goto out;
2634 2634
2635 if (!(dev->priv_flags & IFF_BONDING) || !(dev->flags & IFF_MASTER)) 2635 if (!(dev->priv_flags & IFF_BONDING) || !(dev->flags & IFF_MASTER))
@@ -3470,7 +3470,7 @@ static int bond_netdev_event(struct notifier_block *this, unsigned long event, v
3470{ 3470{
3471 struct net_device *event_dev = (struct net_device *)ptr; 3471 struct net_device *event_dev = (struct net_device *)ptr;
3472 3472
3473 if (event_dev->nd_net != &init_net) 3473 if (dev_net(event_dev) != &init_net)
3474 return NOTIFY_DONE; 3474 return NOTIFY_DONE;
3475 3475
3476 dprintk("event_dev: %s, event: %lx\n", 3476 dprintk("event_dev: %s, event: %lx\n",
@@ -3508,7 +3508,7 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event,
3508 struct bonding *bond, *bond_next; 3508 struct bonding *bond, *bond_next;
3509 struct vlan_entry *vlan, *vlan_next; 3509 struct vlan_entry *vlan, *vlan_next;
3510 3510
3511 if (ifa->ifa_dev->dev->nd_net != &init_net) 3511 if (dev_net(ifa->ifa_dev->dev) != &init_net)
3512 return NOTIFY_DONE; 3512 return NOTIFY_DONE;
3513 3513
3514 list_for_each_entry_safe(bond, bond_next, &bond_dev_list, bond_list) { 3514 list_for_each_entry_safe(bond, bond_next, &bond_dev_list, bond_list) {
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index 5ddf8b0c34f9..5f4b4c6c9f76 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -172,7 +172,7 @@ static int bpq_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty
172 struct ethhdr *eth; 172 struct ethhdr *eth;
173 struct bpqdev *bpq; 173 struct bpqdev *bpq;
174 174
175 if (dev->nd_net != &init_net) 175 if (dev_net(dev) != &init_net)
176 goto drop; 176 goto drop;
177 177
178 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) 178 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
@@ -553,7 +553,7 @@ static int bpq_device_event(struct notifier_block *this,unsigned long event, voi
553{ 553{
554 struct net_device *dev = (struct net_device *)ptr; 554 struct net_device *dev = (struct net_device *)ptr;
555 555
556 if (dev->nd_net != &init_net) 556 if (dev_net(dev) != &init_net)
557 return NOTIFY_DONE; 557 return NOTIFY_DONE;
558 558
559 if (!dev_is_ethdev(dev)) 559 if (!dev_is_ethdev(dev))
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index f2a6e7132241..41b774baac4d 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -258,7 +258,7 @@ static __net_init int loopback_net_init(struct net *net)
258 if (!dev) 258 if (!dev)
259 goto out; 259 goto out;
260 260
261 dev->nd_net = net; 261 dev_net_set(dev, net);
262 err = register_netdev(dev); 262 err = register_netdev(dev);
263 if (err) 263 if (err)
264 goto out_free_netdev; 264 goto out_free_netdev;
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index f651a816b280..2056cfc624dc 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -402,7 +402,7 @@ static int macvlan_newlink(struct net_device *dev,
402 if (!tb[IFLA_LINK]) 402 if (!tb[IFLA_LINK])
403 return -EINVAL; 403 return -EINVAL;
404 404
405 lowerdev = __dev_get_by_index(dev->nd_net, nla_get_u32(tb[IFLA_LINK])); 405 lowerdev = __dev_get_by_index(dev_net(dev), nla_get_u32(tb[IFLA_LINK]));
406 if (lowerdev == NULL) 406 if (lowerdev == NULL)
407 return -ENODEV; 407 return -ENODEV;
408 408
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index ac0ac98b19cd..4fad4ddb3504 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -301,7 +301,7 @@ static int pppoe_device_event(struct notifier_block *this,
301{ 301{
302 struct net_device *dev = (struct net_device *) ptr; 302 struct net_device *dev = (struct net_device *) ptr;
303 303
304 if (dev->nd_net != &init_net) 304 if (dev_net(dev) != &init_net)
305 return NOTIFY_DONE; 305 return NOTIFY_DONE;
306 306
307 /* Only look at sockets that are using this specific device. */ 307 /* Only look at sockets that are using this specific device. */
@@ -392,7 +392,7 @@ static int pppoe_rcv(struct sk_buff *skb,
392 if (!(skb = skb_share_check(skb, GFP_ATOMIC))) 392 if (!(skb = skb_share_check(skb, GFP_ATOMIC)))
393 goto out; 393 goto out;
394 394
395 if (dev->nd_net != &init_net) 395 if (dev_net(dev) != &init_net)
396 goto drop; 396 goto drop;
397 397
398 if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr))) 398 if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr)))
@@ -424,7 +424,7 @@ static int pppoe_disc_rcv(struct sk_buff *skb,
424 struct pppoe_hdr *ph; 424 struct pppoe_hdr *ph;
425 struct pppox_sock *po; 425 struct pppox_sock *po;
426 426
427 if (dev->nd_net != &init_net) 427 if (dev_net(dev) != &init_net)
428 goto abort; 428 goto abort;
429 429
430 if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr))) 430 if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr)))
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index e2ad98bee6e7..31cd817f33f9 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -375,7 +375,7 @@ static int veth_newlink(struct net_device *dev,
375 else 375 else
376 snprintf(ifname, IFNAMSIZ, DRV_NAME "%%d"); 376 snprintf(ifname, IFNAMSIZ, DRV_NAME "%%d");
377 377
378 peer = rtnl_create_link(dev->nd_net, ifname, &veth_link_ops, tbp); 378 peer = rtnl_create_link(dev_net(dev), ifname, &veth_link_ops, tbp);
379 if (IS_ERR(peer)) 379 if (IS_ERR(peer))
380 return PTR_ERR(peer); 380 return PTR_ERR(peer);
381 381
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 1525e8a89844..ed1afaf683a4 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -3464,7 +3464,7 @@ static int velocity_netdev_event(struct notifier_block *nb, unsigned long notifi
3464 struct velocity_info *vptr; 3464 struct velocity_info *vptr;
3465 unsigned long flags; 3465 unsigned long flags;
3466 3466
3467 if (dev->nd_net != &init_net) 3467 if (dev_net(dev) != &init_net)
3468 return NOTIFY_DONE; 3468 return NOTIFY_DONE;
3469 3469
3470 spin_lock_irqsave(&velocity_dev_list_lock, flags); 3470 spin_lock_irqsave(&velocity_dev_list_lock, flags);
diff --git a/drivers/net/wan/dlci.c b/drivers/net/wan/dlci.c
index 96b232446c0b..b14242768fad 100644
--- a/drivers/net/wan/dlci.c
+++ b/drivers/net/wan/dlci.c
@@ -517,7 +517,7 @@ static int dlci_dev_event(struct notifier_block *unused,
517{ 517{
518 struct net_device *dev = (struct net_device *) ptr; 518 struct net_device *dev = (struct net_device *) ptr;
519 519
520 if (dev->nd_net != &init_net) 520 if (dev_net(dev) != &init_net)
521 return NOTIFY_DONE; 521 return NOTIFY_DONE;
522 522
523 if (event == NETDEV_UNREGISTER) { 523 if (event == NETDEV_UNREGISTER) {
diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c
index 39951d0c34d6..9a83c9d5b8cf 100644
--- a/drivers/net/wan/hdlc.c
+++ b/drivers/net/wan/hdlc.c
@@ -68,7 +68,7 @@ static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev,
68{ 68{
69 struct hdlc_device *hdlc = dev_to_hdlc(dev); 69 struct hdlc_device *hdlc = dev_to_hdlc(dev);
70 70
71 if (dev->nd_net != &init_net) { 71 if (dev_net(dev) != &init_net) {
72 kfree_skb(skb); 72 kfree_skb(skb);
73 return 0; 73 return 0;
74 } 74 }
@@ -105,7 +105,7 @@ static int hdlc_device_event(struct notifier_block *this, unsigned long event,
105 unsigned long flags; 105 unsigned long flags;
106 int on; 106 int on;
107 107
108 if (dev->nd_net != &init_net) 108 if (dev_net(dev) != &init_net)
109 return NOTIFY_DONE; 109 return NOTIFY_DONE;
110 110
111 if (dev->get_stats != hdlc_get_stats) 111 if (dev->get_stats != hdlc_get_stats)
diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c
index fb37b8095231..629c909e05f9 100644
--- a/drivers/net/wan/lapbether.c
+++ b/drivers/net/wan/lapbether.c
@@ -91,7 +91,7 @@ static int lapbeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
91 int len, err; 91 int len, err;
92 struct lapbethdev *lapbeth; 92 struct lapbethdev *lapbeth;
93 93
94 if (dev->nd_net != &init_net) 94 if (dev_net(dev) != &init_net)
95 goto drop; 95 goto drop;
96 96
97 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) 97 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
@@ -393,7 +393,7 @@ static int lapbeth_device_event(struct notifier_block *this,
393 struct lapbethdev *lapbeth; 393 struct lapbethdev *lapbeth;
394 struct net_device *dev = ptr; 394 struct net_device *dev = ptr;
395 395
396 if (dev->nd_net != &init_net) 396 if (dev_net(dev) != &init_net)
397 return NOTIFY_DONE; 397 return NOTIFY_DONE;
398 398
399 if (!dev_is_ethdev(dev)) 399 if (!dev_is_ethdev(dev))
diff --git a/drivers/net/wan/syncppp.c b/drivers/net/wan/syncppp.c
index 61e24b7a45a3..29b4b94e4947 100644
--- a/drivers/net/wan/syncppp.c
+++ b/drivers/net/wan/syncppp.c
@@ -1444,7 +1444,7 @@ static void sppp_print_bytes (u_char *p, u16 len)
1444 1444
1445static int sppp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *p, struct net_device *orig_dev) 1445static int sppp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *p, struct net_device *orig_dev)
1446{ 1446{
1447 if (dev->nd_net != &init_net) { 1447 if (dev_net(dev) != &init_net) {
1448 kfree_skb(skb); 1448 kfree_skb(skb);
1449 return 0; 1449 return 0;
1450 } 1450 }