Commit 2941a4863154982918d39a639632c76eeacfa884
Committed by
David S. Miller
1 parent
a429d2609c
Exists in
master
and in
7 other branches
[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>
Showing 6 changed files with 63 additions and 66 deletions Side-by-side Diff
net/ipv4/ip_gre.c
... | ... | @@ -188,7 +188,7 @@ |
188 | 188 | } |
189 | 189 | |
190 | 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 | 192 | return NULL; |
193 | 193 | } |
194 | 194 | |
... | ... | @@ -278,7 +278,7 @@ |
278 | 278 | return NULL; |
279 | 279 | |
280 | 280 | dev->init = ipgre_tunnel_init; |
281 | - nt = dev->priv; | |
281 | + nt = netdev_priv(dev); | |
282 | 282 | nt->parms = *parms; |
283 | 283 | |
284 | 284 | if (register_netdevice(dev) < 0) { |
... | ... | @@ -286,9 +286,6 @@ |
286 | 286 | goto failed; |
287 | 287 | } |
288 | 288 | |
289 | - nt = dev->priv; | |
290 | - nt->parms = *parms; | |
291 | - | |
292 | 289 | dev_hold(dev); |
293 | 290 | ipgre_tunnel_link(nt); |
294 | 291 | return nt; |
... | ... | @@ -299,7 +296,7 @@ |
299 | 296 | |
300 | 297 | static 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 | 300 | dev_put(dev); |
304 | 301 | } |
305 | 302 | |
... | ... | @@ -518,7 +515,7 @@ |
518 | 515 | skb2->dst->ops->update_pmtu(skb2->dst, rel_info); |
519 | 516 | rel_info = htonl(rel_info); |
520 | 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 | 519 | if (t->parms.iph.ttl) { |
523 | 520 | rel_type = ICMP_DEST_UNREACH; |
524 | 521 | rel_code = ICMP_HOST_UNREACH; |
... | ... | @@ -669,7 +666,7 @@ |
669 | 666 | |
670 | 667 | static 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 | 670 | struct net_device_stats *stats = &tunnel->stat; |
674 | 671 | struct iphdr *old_iph = skb->nh.iph; |
675 | 672 | struct iphdr *tiph; |
... | ... | @@ -915,7 +912,7 @@ |
915 | 912 | t = ipgre_tunnel_locate(&p, 0); |
916 | 913 | } |
917 | 914 | if (t == NULL) |
918 | - t = (struct ip_tunnel*)dev->priv; | |
915 | + t = netdev_priv(dev); | |
919 | 916 | memcpy(&p, &t->parms, sizeof(p)); |
920 | 917 | if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p))) |
921 | 918 | err = -EFAULT; |
... | ... | @@ -955,7 +952,7 @@ |
955 | 952 | } else { |
956 | 953 | unsigned nflags=0; |
957 | 954 | |
958 | - t = (struct ip_tunnel*)dev->priv; | |
955 | + t = netdev_priv(dev); | |
959 | 956 | |
960 | 957 | if (MULTICAST(p.iph.daddr)) |
961 | 958 | nflags = IFF_BROADCAST; |
... | ... | @@ -1004,7 +1001,7 @@ |
1004 | 1001 | if ((t = ipgre_tunnel_locate(&p, 0)) == NULL) |
1005 | 1002 | goto done; |
1006 | 1003 | err = -EPERM; |
1007 | - if (t == ipgre_fb_tunnel_dev->priv) | |
1004 | + if (t == netdev_priv(ipgre_fb_tunnel_dev)) | |
1008 | 1005 | goto done; |
1009 | 1006 | dev = t->dev; |
1010 | 1007 | } |
1011 | 1008 | |
... | ... | @@ -1021,12 +1018,12 @@ |
1021 | 1018 | |
1022 | 1019 | static 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 | |
1027 | 1024 | static 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 | 1027 | if (new_mtu < 68 || new_mtu > 0xFFF8 - tunnel->hlen) |
1031 | 1028 | return -EINVAL; |
1032 | 1029 | dev->mtu = new_mtu; |
... | ... | @@ -1066,7 +1063,7 @@ |
1066 | 1063 | static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, |
1067 | 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 | 1067 | struct iphdr *iph = (struct iphdr *)skb_push(skb, t->hlen); |
1071 | 1068 | u16 *p = (u16*)(iph+1); |
1072 | 1069 | |
... | ... | @@ -1093,7 +1090,7 @@ |
1093 | 1090 | |
1094 | 1091 | static 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 | 1095 | if (MULTICAST(t->parms.iph.daddr)) { |
1099 | 1096 | struct flowi fl = { .oif = t->parms.link, |
... | ... | @@ -1117,7 +1114,7 @@ |
1117 | 1114 | |
1118 | 1115 | static 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 | 1118 | if (MULTICAST(t->parms.iph.daddr) && t->mlink) { |
1122 | 1119 | struct in_device *in_dev = inetdev_by_index(t->mlink); |
1123 | 1120 | if (in_dev) { |
... | ... | @@ -1157,7 +1154,7 @@ |
1157 | 1154 | int mtu = ETH_DATA_LEN; |
1158 | 1155 | int addend = sizeof(struct iphdr) + 4; |
1159 | 1156 | |
1160 | - tunnel = (struct ip_tunnel*)dev->priv; | |
1157 | + tunnel = netdev_priv(dev); | |
1161 | 1158 | iph = &tunnel->parms.iph; |
1162 | 1159 | |
1163 | 1160 | tunnel->dev = dev; |
... | ... | @@ -1221,7 +1218,7 @@ |
1221 | 1218 | |
1222 | 1219 | static 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 | 1222 | struct iphdr *iph = &tunnel->parms.iph; |
1226 | 1223 | |
1227 | 1224 | tunnel->dev = dev; |
net/ipv4/ipip.c
... | ... | @@ -244,7 +244,7 @@ |
244 | 244 | if (dev == NULL) |
245 | 245 | return NULL; |
246 | 246 | |
247 | - nt = dev->priv; | |
247 | + nt = netdev_priv(dev); | |
248 | 248 | SET_MODULE_OWNER(dev); |
249 | 249 | dev->init = ipip_tunnel_init; |
250 | 250 | nt->parms = *parms; |
... | ... | @@ -269,7 +269,7 @@ |
269 | 269 | tunnels_wc[0] = NULL; |
270 | 270 | write_unlock_bh(&ipip_lock); |
271 | 271 | } else |
272 | - ipip_tunnel_unlink((struct ip_tunnel*)dev->priv); | |
272 | + ipip_tunnel_unlink(netdev_priv(dev)); | |
273 | 273 | dev_put(dev); |
274 | 274 | } |
275 | 275 | |
... | ... | @@ -443,7 +443,7 @@ |
443 | 443 | skb2->dst->ops->update_pmtu(skb2->dst, rel_info); |
444 | 444 | rel_info = htonl(rel_info); |
445 | 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 | 447 | if (t->parms.iph.ttl) { |
448 | 448 | rel_type = ICMP_DEST_UNREACH; |
449 | 449 | rel_code = ICMP_HOST_UNREACH; |
... | ... | @@ -514,7 +514,7 @@ |
514 | 514 | |
515 | 515 | static 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 | 518 | struct net_device_stats *stats = &tunnel->stat; |
519 | 519 | struct iphdr *tiph = &tunnel->parms.iph; |
520 | 520 | u8 tos = tunnel->parms.iph.tos; |
... | ... | @@ -674,7 +674,7 @@ |
674 | 674 | t = ipip_tunnel_locate(&p, 0); |
675 | 675 | } |
676 | 676 | if (t == NULL) |
677 | - t = (struct ip_tunnel*)dev->priv; | |
677 | + t = netdev_priv(dev); | |
678 | 678 | memcpy(&p, &t->parms, sizeof(p)); |
679 | 679 | if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p))) |
680 | 680 | err = -EFAULT; |
... | ... | @@ -711,7 +711,7 @@ |
711 | 711 | err = -EINVAL; |
712 | 712 | break; |
713 | 713 | } |
714 | - t = (struct ip_tunnel*)dev->priv; | |
714 | + t = netdev_priv(dev); | |
715 | 715 | ipip_tunnel_unlink(t); |
716 | 716 | t->parms.iph.saddr = p.iph.saddr; |
717 | 717 | t->parms.iph.daddr = p.iph.daddr; |
... | ... | @@ -765,7 +765,7 @@ |
765 | 765 | |
766 | 766 | static 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 | |
771 | 771 | static int ipip_tunnel_change_mtu(struct net_device *dev, int new_mtu) |
... | ... | @@ -800,7 +800,7 @@ |
800 | 800 | struct ip_tunnel *tunnel; |
801 | 801 | struct iphdr *iph; |
802 | 802 | |
803 | - tunnel = (struct ip_tunnel*)dev->priv; | |
803 | + tunnel = netdev_priv(dev); | |
804 | 804 | iph = &tunnel->parms.iph; |
805 | 805 | |
806 | 806 | tunnel->dev = dev; |
... | ... | @@ -838,7 +838,7 @@ |
838 | 838 | |
839 | 839 | static 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 | 842 | struct iphdr *iph = &tunnel->parms.iph; |
843 | 843 | |
844 | 844 | tunnel->dev = dev; |
net/ipv4/ipmr.c
... | ... | @@ -178,8 +178,8 @@ |
178 | 178 | static int reg_vif_xmit(struct sk_buff *skb, struct net_device *dev) |
179 | 179 | { |
180 | 180 | read_lock(&mrt_lock); |
181 | - ((struct net_device_stats*)dev->priv)->tx_bytes += skb->len; | |
182 | - ((struct net_device_stats*)dev->priv)->tx_packets++; | |
181 | + ((struct net_device_stats*)netdev_priv(dev))->tx_bytes += skb->len; | |
182 | + ((struct net_device_stats*)netdev_priv(dev))->tx_packets++; | |
183 | 183 | ipmr_cache_report(skb, reg_vif_num, IGMPMSG_WHOLEPKT); |
184 | 184 | read_unlock(&mrt_lock); |
185 | 185 | kfree_skb(skb); |
... | ... | @@ -188,7 +188,7 @@ |
188 | 188 | |
189 | 189 | static 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 | |
194 | 194 | static void reg_vif_setup(struct net_device *dev) |
... | ... | @@ -1149,8 +1149,8 @@ |
1149 | 1149 | if (vif->flags & VIFF_REGISTER) { |
1150 | 1150 | vif->pkt_out++; |
1151 | 1151 | vif->bytes_out+=skb->len; |
1152 | - ((struct net_device_stats*)vif->dev->priv)->tx_bytes += skb->len; | |
1153 | - ((struct net_device_stats*)vif->dev->priv)->tx_packets++; | |
1152 | + ((struct net_device_stats*)netdev_priv(vif->dev))->tx_bytes += skb->len; | |
1153 | + ((struct net_device_stats*)netdev_priv(vif->dev))->tx_packets++; | |
1154 | 1154 | ipmr_cache_report(skb, vifi, IGMPMSG_WHOLEPKT); |
1155 | 1155 | kfree_skb(skb); |
1156 | 1156 | return; |
... | ... | @@ -1210,8 +1210,8 @@ |
1210 | 1210 | if (vif->flags & VIFF_TUNNEL) { |
1211 | 1211 | ip_encap(skb, vif->local, vif->remote); |
1212 | 1212 | /* FIXME: extra output firewall step used to be here. --RR */ |
1213 | - ((struct ip_tunnel *)vif->dev->priv)->stat.tx_packets++; | |
1214 | - ((struct ip_tunnel *)vif->dev->priv)->stat.tx_bytes+=skb->len; | |
1213 | + ((struct ip_tunnel *)netdev_priv(vif->dev))->stat.tx_packets++; | |
1214 | + ((struct ip_tunnel *)netdev_priv(vif->dev))->stat.tx_bytes+=skb->len; | |
1215 | 1215 | } |
1216 | 1216 | |
1217 | 1217 | IPCB(skb)->flags |= IPSKB_FORWARDED; |
... | ... | @@ -1467,8 +1467,8 @@ |
1467 | 1467 | skb->pkt_type = PACKET_HOST; |
1468 | 1468 | dst_release(skb->dst); |
1469 | 1469 | skb->dst = NULL; |
1470 | - ((struct net_device_stats*)reg_dev->priv)->rx_bytes += skb->len; | |
1471 | - ((struct net_device_stats*)reg_dev->priv)->rx_packets++; | |
1470 | + ((struct net_device_stats*)netdev_priv(reg_dev))->rx_bytes += skb->len; | |
1471 | + ((struct net_device_stats*)netdev_priv(reg_dev))->rx_packets++; | |
1472 | 1472 | nf_reset(skb); |
1473 | 1473 | netif_rx(skb); |
1474 | 1474 | dev_put(reg_dev); |
... | ... | @@ -1522,8 +1522,8 @@ |
1522 | 1522 | skb->ip_summed = 0; |
1523 | 1523 | skb->pkt_type = PACKET_HOST; |
1524 | 1524 | dst_release(skb->dst); |
1525 | - ((struct net_device_stats*)reg_dev->priv)->rx_bytes += skb->len; | |
1526 | - ((struct net_device_stats*)reg_dev->priv)->rx_packets++; | |
1525 | + ((struct net_device_stats*)netdev_priv(reg_dev))->rx_bytes += skb->len; | |
1526 | + ((struct net_device_stats*)netdev_priv(reg_dev))->rx_packets++; | |
1527 | 1527 | skb->dst = NULL; |
1528 | 1528 | nf_reset(skb); |
1529 | 1529 | netif_rx(skb); |
net/ipv6/ip6_tunnel.c
... | ... | @@ -243,7 +243,7 @@ |
243 | 243 | if (dev == NULL) |
244 | 244 | return -ENOMEM; |
245 | 245 | |
246 | - t = dev->priv; | |
246 | + t = netdev_priv(dev); | |
247 | 247 | dev->init = ip6ip6_tnl_dev_init; |
248 | 248 | t->parms = *p; |
249 | 249 | |
... | ... | @@ -308,7 +308,7 @@ |
308 | 308 | static void |
309 | 309 | ip6ip6_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 | 313 | if (dev == ip6ip6_fb_tnl_dev) { |
314 | 314 | write_lock_bh(&ip6ip6_lock); |
... | ... | @@ -623,7 +623,7 @@ |
623 | 623 | static int |
624 | 624 | ip6ip6_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 | 627 | struct net_device_stats *stats = &t->stat; |
628 | 628 | struct ipv6hdr *ipv6h = skb->nh.ipv6h; |
629 | 629 | struct ipv6_txoptions *opt = NULL; |
630 | 630 | |
... | ... | @@ -933,11 +933,11 @@ |
933 | 933 | break; |
934 | 934 | } |
935 | 935 | if ((err = ip6ip6_tnl_locate(&p, &t, 0)) == -ENODEV) |
936 | - t = (struct ip6_tnl *) dev->priv; | |
936 | + t = netdev_priv(dev); | |
937 | 937 | else if (err) |
938 | 938 | break; |
939 | 939 | } else |
940 | - t = (struct ip6_tnl *) dev->priv; | |
940 | + t = netdev_priv(dev); | |
941 | 941 | |
942 | 942 | memcpy(&p, &t->parms, sizeof (p)); |
943 | 943 | if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof (p))) { |
... | ... | @@ -955,7 +955,7 @@ |
955 | 955 | break; |
956 | 956 | } |
957 | 957 | if (!create && dev != ip6ip6_fb_tnl_dev) { |
958 | - t = (struct ip6_tnl *) dev->priv; | |
958 | + t = netdev_priv(dev); | |
959 | 959 | } |
960 | 960 | if (!t && (err = ip6ip6_tnl_locate(&p, &t, create))) { |
961 | 961 | break; |
962 | 962 | |
... | ... | @@ -991,12 +991,12 @@ |
991 | 991 | err = ip6ip6_tnl_locate(&p, &t, 0); |
992 | 992 | if (err) |
993 | 993 | break; |
994 | - if (t == ip6ip6_fb_tnl_dev->priv) { | |
994 | + if (t == netdev_priv(ip6ip6_fb_tnl_dev)) { | |
995 | 995 | err = -EPERM; |
996 | 996 | break; |
997 | 997 | } |
998 | 998 | } else { |
999 | - t = (struct ip6_tnl *) dev->priv; | |
999 | + t = netdev_priv(dev); | |
1000 | 1000 | } |
1001 | 1001 | err = unregister_netdevice(t->dev); |
1002 | 1002 | break; |
... | ... | @@ -1016,7 +1016,7 @@ |
1016 | 1016 | static struct net_device_stats * |
1017 | 1017 | ip6ip6_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 @@ |
1073 | 1073 | static inline void |
1074 | 1074 | ip6ip6_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 | 1077 | t->fl.proto = IPPROTO_IPV6; |
1078 | 1078 | t->dev = dev; |
1079 | 1079 | strcpy(t->parms.name, dev->name); |
... | ... | @@ -1087,7 +1087,7 @@ |
1087 | 1087 | static int |
1088 | 1088 | ip6ip6_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 | 1091 | ip6ip6_tnl_dev_init_gen(dev); |
1092 | 1092 | ip6ip6_tnl_link_config(t); |
1093 | 1093 | return 0; |
... | ... | @@ -1103,7 +1103,7 @@ |
1103 | 1103 | static int |
1104 | 1104 | ip6ip6_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 | 1107 | ip6ip6_tnl_dev_init_gen(dev); |
1108 | 1108 | dev_hold(dev); |
1109 | 1109 | tnls_wc[0] = t; |
net/ipv6/sit.c
... | ... | @@ -184,7 +184,7 @@ |
184 | 184 | if (dev == NULL) |
185 | 185 | return NULL; |
186 | 186 | |
187 | - nt = dev->priv; | |
187 | + nt = netdev_priv(dev); | |
188 | 188 | dev->init = ipip6_tunnel_init; |
189 | 189 | nt->parms = *parms; |
190 | 190 | |
... | ... | @@ -210,7 +210,7 @@ |
210 | 210 | write_unlock_bh(&ipip6_lock); |
211 | 211 | dev_put(dev); |
212 | 212 | } else { |
213 | - ipip6_tunnel_unlink((struct ip_tunnel*)dev->priv); | |
213 | + ipip6_tunnel_unlink(netdev_priv(dev)); | |
214 | 214 | dev_put(dev); |
215 | 215 | } |
216 | 216 | } |
... | ... | @@ -346,7 +346,7 @@ |
346 | 346 | rt6i = rt6_lookup(&iph6->daddr, &iph6->saddr, NULL, 0); |
347 | 347 | |
348 | 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 | 350 | if (rel_type == ICMPV6_TIME_EXCEED && t->parms.iph.ttl) { |
351 | 351 | rel_type = ICMPV6_DEST_UNREACH; |
352 | 352 | rel_code = ICMPV6_ADDR_UNREACH; |
... | ... | @@ -424,7 +424,7 @@ |
424 | 424 | |
425 | 425 | static 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 | 428 | struct net_device_stats *stats = &tunnel->stat; |
429 | 429 | struct iphdr *tiph = &tunnel->parms.iph; |
430 | 430 | struct ipv6hdr *iph6 = skb->nh.ipv6h; |
... | ... | @@ -610,7 +610,7 @@ |
610 | 610 | t = ipip6_tunnel_locate(&p, 0); |
611 | 611 | } |
612 | 612 | if (t == NULL) |
613 | - t = (struct ip_tunnel*)dev->priv; | |
613 | + t = netdev_priv(dev); | |
614 | 614 | memcpy(&p, &t->parms, sizeof(p)); |
615 | 615 | if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p))) |
616 | 616 | err = -EFAULT; |
... | ... | @@ -647,7 +647,7 @@ |
647 | 647 | err = -EINVAL; |
648 | 648 | break; |
649 | 649 | } |
650 | - t = (struct ip_tunnel*)dev->priv; | |
650 | + t = netdev_priv(dev); | |
651 | 651 | ipip6_tunnel_unlink(t); |
652 | 652 | t->parms.iph.saddr = p.iph.saddr; |
653 | 653 | t->parms.iph.daddr = p.iph.daddr; |
... | ... | @@ -683,7 +683,7 @@ |
683 | 683 | if ((t = ipip6_tunnel_locate(&p, 0)) == NULL) |
684 | 684 | goto done; |
685 | 685 | err = -EPERM; |
686 | - if (t == ipip6_fb_tunnel_dev->priv) | |
686 | + if (t == netdev_priv(ipip6_fb_tunnel_dev)) | |
687 | 687 | goto done; |
688 | 688 | dev = t->dev; |
689 | 689 | } |
... | ... | @@ -700,7 +700,7 @@ |
700 | 700 | |
701 | 701 | static 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 | |
706 | 706 | static int ipip6_tunnel_change_mtu(struct net_device *dev, int new_mtu) |
... | ... | @@ -735,7 +735,7 @@ |
735 | 735 | struct ip_tunnel *tunnel; |
736 | 736 | struct iphdr *iph; |
737 | 737 | |
738 | - tunnel = (struct ip_tunnel*)dev->priv; | |
738 | + tunnel = netdev_priv(dev); | |
739 | 739 | iph = &tunnel->parms.iph; |
740 | 740 | |
741 | 741 | tunnel->dev = dev; |
... | ... | @@ -775,7 +775,7 @@ |
775 | 775 | |
776 | 776 | static 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 | 779 | struct iphdr *iph = &tunnel->parms.iph; |
780 | 780 | |
781 | 781 | tunnel->dev = dev; |
net/sched/sch_teql.c
... | ... | @@ -274,7 +274,7 @@ |
274 | 274 | |
275 | 275 | static 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 | 278 | struct Qdisc *start, *q; |
279 | 279 | int busy; |
280 | 280 | int nores; |
... | ... | @@ -350,7 +350,7 @@ |
350 | 350 | static int teql_master_open(struct net_device *dev) |
351 | 351 | { |
352 | 352 | struct Qdisc * q; |
353 | - struct teql_master *m = (void*)dev->priv; | |
353 | + struct teql_master *m = netdev_priv(dev); | |
354 | 354 | int mtu = 0xFFFE; |
355 | 355 | unsigned flags = IFF_NOARP|IFF_MULTICAST; |
356 | 356 | |
357 | 357 | |
... | ... | @@ -397,13 +397,13 @@ |
397 | 397 | |
398 | 398 | static 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 | 401 | return &m->stats; |
402 | 402 | } |
403 | 403 | |
404 | 404 | static 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 | 407 | struct Qdisc *q; |
408 | 408 | |
409 | 409 | if (new_mtu < 68) |
... | ... | @@ -423,7 +423,7 @@ |
423 | 423 | |
424 | 424 | static __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 | 427 | struct Qdisc_ops *ops = &master->qops; |
428 | 428 | |
429 | 429 | master->dev = dev; |
... | ... | @@ -476,7 +476,7 @@ |
476 | 476 | break; |
477 | 477 | } |
478 | 478 | |
479 | - master = dev->priv; | |
479 | + master = netdev_priv(dev); | |
480 | 480 | |
481 | 481 | strlcpy(master->qops.id, dev->name, IFNAMSIZ); |
482 | 482 | err = register_qdisc(&master->qops); |