aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2006-01-09 01:05:26 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-01-09 17:16:03 -0500
commit2941a4863154982918d39a639632c76eeacfa884 (patch)
tree4d61d12a1f172635b2e3295b35d072738f157dc0 /net
parenta429d2609c153882c421b067ad5ae5a38851459e (diff)
[NET]: Convert net/{ipv4,ipv6,sched} to netdev_priv
Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/ip_gre.c33
-rw-r--r--net/ipv4/ipip.c18
-rw-r--r--net/ipv4/ipmr.c22
-rw-r--r--net/ipv6/ip6_tunnel.c24
-rw-r--r--net/ipv6/sit.c20
-rw-r--r--net/sched/sch_teql.c12
6 files changed, 63 insertions, 66 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index de16e944777f..1e93eafa7af1 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -188,7 +188,7 @@ static struct ip_tunnel * ipgre_tunnel_lookup(u32 remote, u32 local, u32 key)
188 } 188 }
189 189
190 if (ipgre_fb_tunnel_dev->flags&IFF_UP) 190 if (ipgre_fb_tunnel_dev->flags&IFF_UP)
191 return ipgre_fb_tunnel_dev->priv; 191 return netdev_priv(ipgre_fb_tunnel_dev);
192 return NULL; 192 return NULL;
193} 193}
194 194
@@ -278,7 +278,7 @@ static struct ip_tunnel * ipgre_tunnel_locate(struct ip_tunnel_parm *parms, int
278 return NULL; 278 return NULL;
279 279
280 dev->init = ipgre_tunnel_init; 280 dev->init = ipgre_tunnel_init;
281 nt = dev->priv; 281 nt = netdev_priv(dev);
282 nt->parms = *parms; 282 nt->parms = *parms;
283 283
284 if (register_netdevice(dev) < 0) { 284 if (register_netdevice(dev) < 0) {
@@ -286,9 +286,6 @@ static struct ip_tunnel * ipgre_tunnel_locate(struct ip_tunnel_parm *parms, int
286 goto failed; 286 goto failed;
287 } 287 }
288 288
289 nt = dev->priv;
290 nt->parms = *parms;
291
292 dev_hold(dev); 289 dev_hold(dev);
293 ipgre_tunnel_link(nt); 290 ipgre_tunnel_link(nt);
294 return nt; 291 return nt;
@@ -299,7 +296,7 @@ failed:
299 296
300static void ipgre_tunnel_uninit(struct net_device *dev) 297static void ipgre_tunnel_uninit(struct net_device *dev)
301{ 298{
302 ipgre_tunnel_unlink((struct ip_tunnel*)dev->priv); 299 ipgre_tunnel_unlink(netdev_priv(dev));
303 dev_put(dev); 300 dev_put(dev);
304} 301}
305 302
@@ -518,7 +515,7 @@ out:
518 skb2->dst->ops->update_pmtu(skb2->dst, rel_info); 515 skb2->dst->ops->update_pmtu(skb2->dst, rel_info);
519 rel_info = htonl(rel_info); 516 rel_info = htonl(rel_info);
520 } else if (type == ICMP_TIME_EXCEEDED) { 517 } else if (type == ICMP_TIME_EXCEEDED) {
521 struct ip_tunnel *t = (struct ip_tunnel*)skb2->dev->priv; 518 struct ip_tunnel *t = netdev_priv(skb2->dev);
522 if (t->parms.iph.ttl) { 519 if (t->parms.iph.ttl) {
523 rel_type = ICMP_DEST_UNREACH; 520 rel_type = ICMP_DEST_UNREACH;
524 rel_code = ICMP_HOST_UNREACH; 521 rel_code = ICMP_HOST_UNREACH;
@@ -669,7 +666,7 @@ drop_nolock:
669 666
670static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) 667static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
671{ 668{
672 struct ip_tunnel *tunnel = (struct ip_tunnel*)dev->priv; 669 struct ip_tunnel *tunnel = netdev_priv(dev);
673 struct net_device_stats *stats = &tunnel->stat; 670 struct net_device_stats *stats = &tunnel->stat;
674 struct iphdr *old_iph = skb->nh.iph; 671 struct iphdr *old_iph = skb->nh.iph;
675 struct iphdr *tiph; 672 struct iphdr *tiph;
@@ -915,7 +912,7 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
915 t = ipgre_tunnel_locate(&p, 0); 912 t = ipgre_tunnel_locate(&p, 0);
916 } 913 }
917 if (t == NULL) 914 if (t == NULL)
918 t = (struct ip_tunnel*)dev->priv; 915 t = netdev_priv(dev);
919 memcpy(&p, &t->parms, sizeof(p)); 916 memcpy(&p, &t->parms, sizeof(p));
920 if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p))) 917 if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p)))
921 err = -EFAULT; 918 err = -EFAULT;
@@ -955,7 +952,7 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
955 } else { 952 } else {
956 unsigned nflags=0; 953 unsigned nflags=0;
957 954
958 t = (struct ip_tunnel*)dev->priv; 955 t = netdev_priv(dev);
959 956
960 if (MULTICAST(p.iph.daddr)) 957 if (MULTICAST(p.iph.daddr))
961 nflags = IFF_BROADCAST; 958 nflags = IFF_BROADCAST;
@@ -1004,7 +1001,7 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
1004 if ((t = ipgre_tunnel_locate(&p, 0)) == NULL) 1001 if ((t = ipgre_tunnel_locate(&p, 0)) == NULL)
1005 goto done; 1002 goto done;
1006 err = -EPERM; 1003 err = -EPERM;
1007 if (t == ipgre_fb_tunnel_dev->priv) 1004 if (t == netdev_priv(ipgre_fb_tunnel_dev))
1008 goto done; 1005 goto done;
1009 dev = t->dev; 1006 dev = t->dev;
1010 } 1007 }
@@ -1021,12 +1018,12 @@ done:
1021 1018
1022static struct net_device_stats *ipgre_tunnel_get_stats(struct net_device *dev) 1019static struct net_device_stats *ipgre_tunnel_get_stats(struct net_device *dev)
1023{ 1020{
1024 return &(((struct ip_tunnel*)dev->priv)->stat); 1021 return &(((struct ip_tunnel*)netdev_priv(dev))->stat);
1025} 1022}
1026 1023
1027static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu) 1024static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu)
1028{ 1025{
1029 struct ip_tunnel *tunnel = (struct ip_tunnel*)dev->priv; 1026 struct ip_tunnel *tunnel = netdev_priv(dev);
1030 if (new_mtu < 68 || new_mtu > 0xFFF8 - tunnel->hlen) 1027 if (new_mtu < 68 || new_mtu > 0xFFF8 - tunnel->hlen)
1031 return -EINVAL; 1028 return -EINVAL;
1032 dev->mtu = new_mtu; 1029 dev->mtu = new_mtu;
@@ -1066,7 +1063,7 @@ static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu)
1066static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, 1063static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned short type,
1067 void *daddr, void *saddr, unsigned len) 1064 void *daddr, void *saddr, unsigned len)
1068{ 1065{
1069 struct ip_tunnel *t = (struct ip_tunnel*)dev->priv; 1066 struct ip_tunnel *t = netdev_priv(dev);
1070 struct iphdr *iph = (struct iphdr *)skb_push(skb, t->hlen); 1067 struct iphdr *iph = (struct iphdr *)skb_push(skb, t->hlen);
1071 u16 *p = (u16*)(iph+1); 1068 u16 *p = (u16*)(iph+1);
1072 1069
@@ -1093,7 +1090,7 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned sh
1093 1090
1094static int ipgre_open(struct net_device *dev) 1091static int ipgre_open(struct net_device *dev)
1095{ 1092{
1096 struct ip_tunnel *t = (struct ip_tunnel*)dev->priv; 1093 struct ip_tunnel *t = netdev_priv(dev);
1097 1094
1098 if (MULTICAST(t->parms.iph.daddr)) { 1095 if (MULTICAST(t->parms.iph.daddr)) {
1099 struct flowi fl = { .oif = t->parms.link, 1096 struct flowi fl = { .oif = t->parms.link,
@@ -1117,7 +1114,7 @@ static int ipgre_open(struct net_device *dev)
1117 1114
1118static int ipgre_close(struct net_device *dev) 1115static int ipgre_close(struct net_device *dev)
1119{ 1116{
1120 struct ip_tunnel *t = (struct ip_tunnel*)dev->priv; 1117 struct ip_tunnel *t = netdev_priv(dev);
1121 if (MULTICAST(t->parms.iph.daddr) && t->mlink) { 1118 if (MULTICAST(t->parms.iph.daddr) && t->mlink) {
1122 struct in_device *in_dev = inetdev_by_index(t->mlink); 1119 struct in_device *in_dev = inetdev_by_index(t->mlink);
1123 if (in_dev) { 1120 if (in_dev) {
@@ -1157,7 +1154,7 @@ static int ipgre_tunnel_init(struct net_device *dev)
1157 int mtu = ETH_DATA_LEN; 1154 int mtu = ETH_DATA_LEN;
1158 int addend = sizeof(struct iphdr) + 4; 1155 int addend = sizeof(struct iphdr) + 4;
1159 1156
1160 tunnel = (struct ip_tunnel*)dev->priv; 1157 tunnel = netdev_priv(dev);
1161 iph = &tunnel->parms.iph; 1158 iph = &tunnel->parms.iph;
1162 1159
1163 tunnel->dev = dev; 1160 tunnel->dev = dev;
@@ -1221,7 +1218,7 @@ static int ipgre_tunnel_init(struct net_device *dev)
1221 1218
1222static int __init ipgre_fb_tunnel_init(struct net_device *dev) 1219static int __init ipgre_fb_tunnel_init(struct net_device *dev)
1223{ 1220{
1224 struct ip_tunnel *tunnel = (struct ip_tunnel*)dev->priv; 1221 struct ip_tunnel *tunnel = netdev_priv(dev);
1225 struct iphdr *iph = &tunnel->parms.iph; 1222 struct iphdr *iph = &tunnel->parms.iph;
1226 1223
1227 tunnel->dev = dev; 1224 tunnel->dev = dev;
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index bbd85f5ec985..bc5ca23b2646 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -244,7 +244,7 @@ static struct ip_tunnel * ipip_tunnel_locate(struct ip_tunnel_parm *parms, int c
244 if (dev == NULL) 244 if (dev == NULL)
245 return NULL; 245 return NULL;
246 246
247 nt = dev->priv; 247 nt = netdev_priv(dev);
248 SET_MODULE_OWNER(dev); 248 SET_MODULE_OWNER(dev);
249 dev->init = ipip_tunnel_init; 249 dev->init = ipip_tunnel_init;
250 nt->parms = *parms; 250 nt->parms = *parms;
@@ -269,7 +269,7 @@ static void ipip_tunnel_uninit(struct net_device *dev)
269 tunnels_wc[0] = NULL; 269 tunnels_wc[0] = NULL;
270 write_unlock_bh(&ipip_lock); 270 write_unlock_bh(&ipip_lock);
271 } else 271 } else
272 ipip_tunnel_unlink((struct ip_tunnel*)dev->priv); 272 ipip_tunnel_unlink(netdev_priv(dev));
273 dev_put(dev); 273 dev_put(dev);
274} 274}
275 275
@@ -443,7 +443,7 @@ out:
443 skb2->dst->ops->update_pmtu(skb2->dst, rel_info); 443 skb2->dst->ops->update_pmtu(skb2->dst, rel_info);
444 rel_info = htonl(rel_info); 444 rel_info = htonl(rel_info);
445 } else if (type == ICMP_TIME_EXCEEDED) { 445 } else if (type == ICMP_TIME_EXCEEDED) {
446 struct ip_tunnel *t = (struct ip_tunnel*)skb2->dev->priv; 446 struct ip_tunnel *t = netdev_priv(skb2->dev);
447 if (t->parms.iph.ttl) { 447 if (t->parms.iph.ttl) {
448 rel_type = ICMP_DEST_UNREACH; 448 rel_type = ICMP_DEST_UNREACH;
449 rel_code = ICMP_HOST_UNREACH; 449 rel_code = ICMP_HOST_UNREACH;
@@ -514,7 +514,7 @@ out:
514 514
515static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) 515static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
516{ 516{
517 struct ip_tunnel *tunnel = (struct ip_tunnel*)dev->priv; 517 struct ip_tunnel *tunnel = netdev_priv(dev);
518 struct net_device_stats *stats = &tunnel->stat; 518 struct net_device_stats *stats = &tunnel->stat;
519 struct iphdr *tiph = &tunnel->parms.iph; 519 struct iphdr *tiph = &tunnel->parms.iph;
520 u8 tos = tunnel->parms.iph.tos; 520 u8 tos = tunnel->parms.iph.tos;
@@ -674,7 +674,7 @@ ipip_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
674 t = ipip_tunnel_locate(&p, 0); 674 t = ipip_tunnel_locate(&p, 0);
675 } 675 }
676 if (t == NULL) 676 if (t == NULL)
677 t = (struct ip_tunnel*)dev->priv; 677 t = netdev_priv(dev);
678 memcpy(&p, &t->parms, sizeof(p)); 678 memcpy(&p, &t->parms, sizeof(p));
679 if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p))) 679 if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p)))
680 err = -EFAULT; 680 err = -EFAULT;
@@ -711,7 +711,7 @@ ipip_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
711 err = -EINVAL; 711 err = -EINVAL;
712 break; 712 break;
713 } 713 }
714 t = (struct ip_tunnel*)dev->priv; 714 t = netdev_priv(dev);
715 ipip_tunnel_unlink(t); 715 ipip_tunnel_unlink(t);
716 t->parms.iph.saddr = p.iph.saddr; 716 t->parms.iph.saddr = p.iph.saddr;
717 t->parms.iph.daddr = p.iph.daddr; 717 t->parms.iph.daddr = p.iph.daddr;
@@ -765,7 +765,7 @@ done:
765 765
766static struct net_device_stats *ipip_tunnel_get_stats(struct net_device *dev) 766static struct net_device_stats *ipip_tunnel_get_stats(struct net_device *dev)
767{ 767{
768 return &(((struct ip_tunnel*)dev->priv)->stat); 768 return &(((struct ip_tunnel*)netdev_priv(dev))->stat);
769} 769}
770 770
771static int ipip_tunnel_change_mtu(struct net_device *dev, int new_mtu) 771static int ipip_tunnel_change_mtu(struct net_device *dev, int new_mtu)
@@ -800,7 +800,7 @@ static int ipip_tunnel_init(struct net_device *dev)
800 struct ip_tunnel *tunnel; 800 struct ip_tunnel *tunnel;
801 struct iphdr *iph; 801 struct iphdr *iph;
802 802
803 tunnel = (struct ip_tunnel*)dev->priv; 803 tunnel = netdev_priv(dev);
804 iph = &tunnel->parms.iph; 804 iph = &tunnel->parms.iph;
805 805
806 tunnel->dev = dev; 806 tunnel->dev = dev;
@@ -838,7 +838,7 @@ static int ipip_tunnel_init(struct net_device *dev)
838 838
839static int __init ipip_fb_tunnel_init(struct net_device *dev) 839static int __init ipip_fb_tunnel_init(struct net_device *dev)
840{ 840{
841 struct ip_tunnel *tunnel = dev->priv; 841 struct ip_tunnel *tunnel = netdev_priv(dev);
842 struct iphdr *iph = &tunnel->parms.iph; 842 struct iphdr *iph = &tunnel->parms.iph;
843 843
844 tunnel->dev = dev; 844 tunnel->dev = dev;
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 9a5c0ce7ff35..f58ac9854c3f 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -178,8 +178,8 @@ static int reg_vif_num = -1;
178static int reg_vif_xmit(struct sk_buff *skb, struct net_device *dev) 178static int reg_vif_xmit(struct sk_buff *skb, struct net_device *dev)
179{ 179{
180 read_lock(&mrt_lock); 180 read_lock(&mrt_lock);
181 ((struct net_device_stats*)dev->priv)->tx_bytes += skb->len; 181 ((struct net_device_stats*)netdev_priv(dev))->tx_bytes += skb->len;
182 ((struct net_device_stats*)dev->priv)->tx_packets++; 182 ((struct net_device_stats*)netdev_priv(dev))->tx_packets++;
183 ipmr_cache_report(skb, reg_vif_num, IGMPMSG_WHOLEPKT); 183 ipmr_cache_report(skb, reg_vif_num, IGMPMSG_WHOLEPKT);
184 read_unlock(&mrt_lock); 184 read_unlock(&mrt_lock);
185 kfree_skb(skb); 185 kfree_skb(skb);
@@ -188,7 +188,7 @@ static int reg_vif_xmit(struct sk_buff *skb, struct net_device *dev)
188 188
189static struct net_device_stats *reg_vif_get_stats(struct net_device *dev) 189static struct net_device_stats *reg_vif_get_stats(struct net_device *dev)
190{ 190{
191 return (struct net_device_stats*)dev->priv; 191 return (struct net_device_stats*)netdev_priv(dev);
192} 192}
193 193
194static void reg_vif_setup(struct net_device *dev) 194static void reg_vif_setup(struct net_device *dev)
@@ -1149,8 +1149,8 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
1149 if (vif->flags & VIFF_REGISTER) { 1149 if (vif->flags & VIFF_REGISTER) {
1150 vif->pkt_out++; 1150 vif->pkt_out++;
1151 vif->bytes_out+=skb->len; 1151 vif->bytes_out+=skb->len;
1152 ((struct net_device_stats*)vif->dev->priv)->tx_bytes += skb->len; 1152 ((struct net_device_stats*)netdev_priv(vif->dev))->tx_bytes += skb->len;
1153 ((struct net_device_stats*)vif->dev->priv)->tx_packets++; 1153 ((struct net_device_stats*)netdev_priv(vif->dev))->tx_packets++;
1154 ipmr_cache_report(skb, vifi, IGMPMSG_WHOLEPKT); 1154 ipmr_cache_report(skb, vifi, IGMPMSG_WHOLEPKT);
1155 kfree_skb(skb); 1155 kfree_skb(skb);
1156 return; 1156 return;
@@ -1210,8 +1210,8 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
1210 if (vif->flags & VIFF_TUNNEL) { 1210 if (vif->flags & VIFF_TUNNEL) {
1211 ip_encap(skb, vif->local, vif->remote); 1211 ip_encap(skb, vif->local, vif->remote);
1212 /* FIXME: extra output firewall step used to be here. --RR */ 1212 /* FIXME: extra output firewall step used to be here. --RR */
1213 ((struct ip_tunnel *)vif->dev->priv)->stat.tx_packets++; 1213 ((struct ip_tunnel *)netdev_priv(vif->dev))->stat.tx_packets++;
1214 ((struct ip_tunnel *)vif->dev->priv)->stat.tx_bytes+=skb->len; 1214 ((struct ip_tunnel *)netdev_priv(vif->dev))->stat.tx_bytes+=skb->len;
1215 } 1215 }
1216 1216
1217 IPCB(skb)->flags |= IPSKB_FORWARDED; 1217 IPCB(skb)->flags |= IPSKB_FORWARDED;
@@ -1467,8 +1467,8 @@ int pim_rcv_v1(struct sk_buff * skb)
1467 skb->pkt_type = PACKET_HOST; 1467 skb->pkt_type = PACKET_HOST;
1468 dst_release(skb->dst); 1468 dst_release(skb->dst);
1469 skb->dst = NULL; 1469 skb->dst = NULL;
1470 ((struct net_device_stats*)reg_dev->priv)->rx_bytes += skb->len; 1470 ((struct net_device_stats*)netdev_priv(reg_dev))->rx_bytes += skb->len;
1471 ((struct net_device_stats*)reg_dev->priv)->rx_packets++; 1471 ((struct net_device_stats*)netdev_priv(reg_dev))->rx_packets++;
1472 nf_reset(skb); 1472 nf_reset(skb);
1473 netif_rx(skb); 1473 netif_rx(skb);
1474 dev_put(reg_dev); 1474 dev_put(reg_dev);
@@ -1522,8 +1522,8 @@ static int pim_rcv(struct sk_buff * skb)
1522 skb->ip_summed = 0; 1522 skb->ip_summed = 0;
1523 skb->pkt_type = PACKET_HOST; 1523 skb->pkt_type = PACKET_HOST;
1524 dst_release(skb->dst); 1524 dst_release(skb->dst);
1525 ((struct net_device_stats*)reg_dev->priv)->rx_bytes += skb->len; 1525 ((struct net_device_stats*)netdev_priv(reg_dev))->rx_bytes += skb->len;
1526 ((struct net_device_stats*)reg_dev->priv)->rx_packets++; 1526 ((struct net_device_stats*)netdev_priv(reg_dev))->rx_packets++;
1527 skb->dst = NULL; 1527 skb->dst = NULL;
1528 nf_reset(skb); 1528 nf_reset(skb);
1529 netif_rx(skb); 1529 netif_rx(skb);
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index f079621c8b67..c3c2bf699a67 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -243,7 +243,7 @@ ip6_tnl_create(struct ip6_tnl_parm *p, struct ip6_tnl **pt)
243 if (dev == NULL) 243 if (dev == NULL)
244 return -ENOMEM; 244 return -ENOMEM;
245 245
246 t = dev->priv; 246 t = netdev_priv(dev);
247 dev->init = ip6ip6_tnl_dev_init; 247 dev->init = ip6ip6_tnl_dev_init;
248 t->parms = *p; 248 t->parms = *p;
249 249
@@ -308,7 +308,7 @@ ip6ip6_tnl_locate(struct ip6_tnl_parm *p, struct ip6_tnl **pt, int create)
308static void 308static void
309ip6ip6_tnl_dev_uninit(struct net_device *dev) 309ip6ip6_tnl_dev_uninit(struct net_device *dev)
310{ 310{
311 struct ip6_tnl *t = dev->priv; 311 struct ip6_tnl *t = netdev_priv(dev);
312 312
313 if (dev == ip6ip6_fb_tnl_dev) { 313 if (dev == ip6ip6_fb_tnl_dev) {
314 write_lock_bh(&ip6ip6_lock); 314 write_lock_bh(&ip6ip6_lock);
@@ -623,7 +623,7 @@ ip6ip6_tnl_addr_conflict(struct ip6_tnl *t, struct ipv6hdr *hdr)
623static int 623static int
624ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) 624ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
625{ 625{
626 struct ip6_tnl *t = (struct ip6_tnl *) dev->priv; 626 struct ip6_tnl *t = netdev_priv(dev);
627 struct net_device_stats *stats = &t->stat; 627 struct net_device_stats *stats = &t->stat;
628 struct ipv6hdr *ipv6h = skb->nh.ipv6h; 628 struct ipv6hdr *ipv6h = skb->nh.ipv6h;
629 struct ipv6_txoptions *opt = NULL; 629 struct ipv6_txoptions *opt = NULL;
@@ -933,11 +933,11 @@ ip6ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
933 break; 933 break;
934 } 934 }
935 if ((err = ip6ip6_tnl_locate(&p, &t, 0)) == -ENODEV) 935 if ((err = ip6ip6_tnl_locate(&p, &t, 0)) == -ENODEV)
936 t = (struct ip6_tnl *) dev->priv; 936 t = netdev_priv(dev);
937 else if (err) 937 else if (err)
938 break; 938 break;
939 } else 939 } else
940 t = (struct ip6_tnl *) dev->priv; 940 t = netdev_priv(dev);
941 941
942 memcpy(&p, &t->parms, sizeof (p)); 942 memcpy(&p, &t->parms, sizeof (p));
943 if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof (p))) { 943 if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof (p))) {
@@ -955,7 +955,7 @@ ip6ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
955 break; 955 break;
956 } 956 }
957 if (!create && dev != ip6ip6_fb_tnl_dev) { 957 if (!create && dev != ip6ip6_fb_tnl_dev) {
958 t = (struct ip6_tnl *) dev->priv; 958 t = netdev_priv(dev);
959 } 959 }
960 if (!t && (err = ip6ip6_tnl_locate(&p, &t, create))) { 960 if (!t && (err = ip6ip6_tnl_locate(&p, &t, create))) {
961 break; 961 break;
@@ -991,12 +991,12 @@ ip6ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
991 err = ip6ip6_tnl_locate(&p, &t, 0); 991 err = ip6ip6_tnl_locate(&p, &t, 0);
992 if (err) 992 if (err)
993 break; 993 break;
994 if (t == ip6ip6_fb_tnl_dev->priv) { 994 if (t == netdev_priv(ip6ip6_fb_tnl_dev)) {
995 err = -EPERM; 995 err = -EPERM;
996 break; 996 break;
997 } 997 }
998 } else { 998 } else {
999 t = (struct ip6_tnl *) dev->priv; 999 t = netdev_priv(dev);
1000 } 1000 }
1001 err = unregister_netdevice(t->dev); 1001 err = unregister_netdevice(t->dev);
1002 break; 1002 break;
@@ -1016,7 +1016,7 @@ ip6ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1016static struct net_device_stats * 1016static struct net_device_stats *
1017ip6ip6_tnl_get_stats(struct net_device *dev) 1017ip6ip6_tnl_get_stats(struct net_device *dev)
1018{ 1018{
1019 return &(((struct ip6_tnl *) dev->priv)->stat); 1019 return &(((struct ip6_tnl *)netdev_priv(dev))->stat);
1020} 1020}
1021 1021
1022/** 1022/**
@@ -1073,7 +1073,7 @@ static void ip6ip6_tnl_dev_setup(struct net_device *dev)
1073static inline void 1073static inline void
1074ip6ip6_tnl_dev_init_gen(struct net_device *dev) 1074ip6ip6_tnl_dev_init_gen(struct net_device *dev)
1075{ 1075{
1076 struct ip6_tnl *t = (struct ip6_tnl *) dev->priv; 1076 struct ip6_tnl *t = netdev_priv(dev);
1077 t->fl.proto = IPPROTO_IPV6; 1077 t->fl.proto = IPPROTO_IPV6;
1078 t->dev = dev; 1078 t->dev = dev;
1079 strcpy(t->parms.name, dev->name); 1079 strcpy(t->parms.name, dev->name);
@@ -1087,7 +1087,7 @@ ip6ip6_tnl_dev_init_gen(struct net_device *dev)
1087static int 1087static int
1088ip6ip6_tnl_dev_init(struct net_device *dev) 1088ip6ip6_tnl_dev_init(struct net_device *dev)
1089{ 1089{
1090 struct ip6_tnl *t = (struct ip6_tnl *) dev->priv; 1090 struct ip6_tnl *t = netdev_priv(dev);
1091 ip6ip6_tnl_dev_init_gen(dev); 1091 ip6ip6_tnl_dev_init_gen(dev);
1092 ip6ip6_tnl_link_config(t); 1092 ip6ip6_tnl_link_config(t);
1093 return 0; 1093 return 0;
@@ -1103,7 +1103,7 @@ ip6ip6_tnl_dev_init(struct net_device *dev)
1103static int 1103static int
1104ip6ip6_fb_tnl_dev_init(struct net_device *dev) 1104ip6ip6_fb_tnl_dev_init(struct net_device *dev)
1105{ 1105{
1106 struct ip6_tnl *t = dev->priv; 1106 struct ip6_tnl *t = netdev_priv(dev);
1107 ip6ip6_tnl_dev_init_gen(dev); 1107 ip6ip6_tnl_dev_init_gen(dev);
1108 dev_hold(dev); 1108 dev_hold(dev);
1109 tnls_wc[0] = t; 1109 tnls_wc[0] = t;
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 02872ae8a439..0dae48aa1cec 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -184,7 +184,7 @@ static struct ip_tunnel * ipip6_tunnel_locate(struct ip_tunnel_parm *parms, int
184 if (dev == NULL) 184 if (dev == NULL)
185 return NULL; 185 return NULL;
186 186
187 nt = dev->priv; 187 nt = netdev_priv(dev);
188 dev->init = ipip6_tunnel_init; 188 dev->init = ipip6_tunnel_init;
189 nt->parms = *parms; 189 nt->parms = *parms;
190 190
@@ -210,7 +210,7 @@ static void ipip6_tunnel_uninit(struct net_device *dev)
210 write_unlock_bh(&ipip6_lock); 210 write_unlock_bh(&ipip6_lock);
211 dev_put(dev); 211 dev_put(dev);
212 } else { 212 } else {
213 ipip6_tunnel_unlink((struct ip_tunnel*)dev->priv); 213 ipip6_tunnel_unlink(netdev_priv(dev));
214 dev_put(dev); 214 dev_put(dev);
215 } 215 }
216} 216}
@@ -346,7 +346,7 @@ out:
346 rt6i = rt6_lookup(&iph6->daddr, &iph6->saddr, NULL, 0); 346 rt6i = rt6_lookup(&iph6->daddr, &iph6->saddr, NULL, 0);
347 347
348 if (rt6i && rt6i->rt6i_dev && rt6i->rt6i_dev->type == ARPHRD_SIT) { 348 if (rt6i && rt6i->rt6i_dev && rt6i->rt6i_dev->type == ARPHRD_SIT) {
349 struct ip_tunnel * t = (struct ip_tunnel*)rt6i->rt6i_dev->priv; 349 struct ip_tunnel *t = netdev_priv(rt6i->rt6i_dev);
350 if (rel_type == ICMPV6_TIME_EXCEED && t->parms.iph.ttl) { 350 if (rel_type == ICMPV6_TIME_EXCEED && t->parms.iph.ttl) {
351 rel_type = ICMPV6_DEST_UNREACH; 351 rel_type = ICMPV6_DEST_UNREACH;
352 rel_code = ICMPV6_ADDR_UNREACH; 352 rel_code = ICMPV6_ADDR_UNREACH;
@@ -424,7 +424,7 @@ static inline u32 try_6to4(struct in6_addr *v6dst)
424 424
425static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) 425static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
426{ 426{
427 struct ip_tunnel *tunnel = (struct ip_tunnel*)dev->priv; 427 struct ip_tunnel *tunnel = netdev_priv(dev);
428 struct net_device_stats *stats = &tunnel->stat; 428 struct net_device_stats *stats = &tunnel->stat;
429 struct iphdr *tiph = &tunnel->parms.iph; 429 struct iphdr *tiph = &tunnel->parms.iph;
430 struct ipv6hdr *iph6 = skb->nh.ipv6h; 430 struct ipv6hdr *iph6 = skb->nh.ipv6h;
@@ -610,7 +610,7 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
610 t = ipip6_tunnel_locate(&p, 0); 610 t = ipip6_tunnel_locate(&p, 0);
611 } 611 }
612 if (t == NULL) 612 if (t == NULL)
613 t = (struct ip_tunnel*)dev->priv; 613 t = netdev_priv(dev);
614 memcpy(&p, &t->parms, sizeof(p)); 614 memcpy(&p, &t->parms, sizeof(p));
615 if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p))) 615 if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p)))
616 err = -EFAULT; 616 err = -EFAULT;
@@ -647,7 +647,7 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
647 err = -EINVAL; 647 err = -EINVAL;
648 break; 648 break;
649 } 649 }
650 t = (struct ip_tunnel*)dev->priv; 650 t = netdev_priv(dev);
651 ipip6_tunnel_unlink(t); 651 ipip6_tunnel_unlink(t);
652 t->parms.iph.saddr = p.iph.saddr; 652 t->parms.iph.saddr = p.iph.saddr;
653 t->parms.iph.daddr = p.iph.daddr; 653 t->parms.iph.daddr = p.iph.daddr;
@@ -683,7 +683,7 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
683 if ((t = ipip6_tunnel_locate(&p, 0)) == NULL) 683 if ((t = ipip6_tunnel_locate(&p, 0)) == NULL)
684 goto done; 684 goto done;
685 err = -EPERM; 685 err = -EPERM;
686 if (t == ipip6_fb_tunnel_dev->priv) 686 if (t == netdev_priv(ipip6_fb_tunnel_dev))
687 goto done; 687 goto done;
688 dev = t->dev; 688 dev = t->dev;
689 } 689 }
@@ -700,7 +700,7 @@ done:
700 700
701static struct net_device_stats *ipip6_tunnel_get_stats(struct net_device *dev) 701static struct net_device_stats *ipip6_tunnel_get_stats(struct net_device *dev)
702{ 702{
703 return &(((struct ip_tunnel*)dev->priv)->stat); 703 return &(((struct ip_tunnel*)netdev_priv(dev))->stat);
704} 704}
705 705
706static int ipip6_tunnel_change_mtu(struct net_device *dev, int new_mtu) 706static int ipip6_tunnel_change_mtu(struct net_device *dev, int new_mtu)
@@ -735,7 +735,7 @@ static int ipip6_tunnel_init(struct net_device *dev)
735 struct ip_tunnel *tunnel; 735 struct ip_tunnel *tunnel;
736 struct iphdr *iph; 736 struct iphdr *iph;
737 737
738 tunnel = (struct ip_tunnel*)dev->priv; 738 tunnel = netdev_priv(dev);
739 iph = &tunnel->parms.iph; 739 iph = &tunnel->parms.iph;
740 740
741 tunnel->dev = dev; 741 tunnel->dev = dev;
@@ -775,7 +775,7 @@ static int ipip6_tunnel_init(struct net_device *dev)
775 775
776static int __init ipip6_fb_tunnel_init(struct net_device *dev) 776static int __init ipip6_fb_tunnel_init(struct net_device *dev)
777{ 777{
778 struct ip_tunnel *tunnel = dev->priv; 778 struct ip_tunnel *tunnel = netdev_priv(dev);
779 struct iphdr *iph = &tunnel->parms.iph; 779 struct iphdr *iph = &tunnel->parms.iph;
780 780
781 tunnel->dev = dev; 781 tunnel->dev = dev;
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c
index c4a2a8c4c339..79b8ef34c6e4 100644
--- a/net/sched/sch_teql.c
+++ b/net/sched/sch_teql.c
@@ -274,7 +274,7 @@ teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, struct net_device *de
274 274
275static int teql_master_xmit(struct sk_buff *skb, struct net_device *dev) 275static int teql_master_xmit(struct sk_buff *skb, struct net_device *dev)
276{ 276{
277 struct teql_master *master = (void*)dev->priv; 277 struct teql_master *master = netdev_priv(dev);
278 struct Qdisc *start, *q; 278 struct Qdisc *start, *q;
279 int busy; 279 int busy;
280 int nores; 280 int nores;
@@ -350,7 +350,7 @@ drop:
350static int teql_master_open(struct net_device *dev) 350static int teql_master_open(struct net_device *dev)
351{ 351{
352 struct Qdisc * q; 352 struct Qdisc * q;
353 struct teql_master *m = (void*)dev->priv; 353 struct teql_master *m = netdev_priv(dev);
354 int mtu = 0xFFFE; 354 int mtu = 0xFFFE;
355 unsigned flags = IFF_NOARP|IFF_MULTICAST; 355 unsigned flags = IFF_NOARP|IFF_MULTICAST;
356 356
@@ -397,13 +397,13 @@ static int teql_master_close(struct net_device *dev)
397 397
398static struct net_device_stats *teql_master_stats(struct net_device *dev) 398static struct net_device_stats *teql_master_stats(struct net_device *dev)
399{ 399{
400 struct teql_master *m = (void*)dev->priv; 400 struct teql_master *m = netdev_priv(dev);
401 return &m->stats; 401 return &m->stats;
402} 402}
403 403
404static int teql_master_mtu(struct net_device *dev, int new_mtu) 404static int teql_master_mtu(struct net_device *dev, int new_mtu)
405{ 405{
406 struct teql_master *m = (void*)dev->priv; 406 struct teql_master *m = netdev_priv(dev);
407 struct Qdisc *q; 407 struct Qdisc *q;
408 408
409 if (new_mtu < 68) 409 if (new_mtu < 68)
@@ -423,7 +423,7 @@ static int teql_master_mtu(struct net_device *dev, int new_mtu)
423 423
424static __init void teql_master_setup(struct net_device *dev) 424static __init void teql_master_setup(struct net_device *dev)
425{ 425{
426 struct teql_master *master = dev->priv; 426 struct teql_master *master = netdev_priv(dev);
427 struct Qdisc_ops *ops = &master->qops; 427 struct Qdisc_ops *ops = &master->qops;
428 428
429 master->dev = dev; 429 master->dev = dev;
@@ -476,7 +476,7 @@ static int __init teql_init(void)
476 break; 476 break;
477 } 477 }
478 478
479 master = dev->priv; 479 master = netdev_priv(dev);
480 480
481 strlcpy(master->qops.id, dev->name, IFNAMSIZ); 481 strlcpy(master->qops.id, dev->name, IFNAMSIZ);
482 err = register_qdisc(&master->qops); 482 err = register_qdisc(&master->qops);