diff options
author | Patrick McHardy <kaber@trash.net> | 2006-01-09 01:05:26 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-01-09 17:16:03 -0500 |
commit | 2941a4863154982918d39a639632c76eeacfa884 (patch) | |
tree | 4d61d12a1f172635b2e3295b35d072738f157dc0 /net/ipv4/ip_gre.c | |
parent | a429d2609c153882c421b067ad5ae5a38851459e (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/ipv4/ip_gre.c')
-rw-r--r-- | net/ipv4/ip_gre.c | 33 |
1 files changed, 15 insertions, 18 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 | ||
300 | static void ipgre_tunnel_uninit(struct net_device *dev) | 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 | 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 | ||
670 | static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | 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 | 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 | ||
1022 | static struct net_device_stats *ipgre_tunnel_get_stats(struct net_device *dev) | 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 | static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu) | 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 | 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) | |||
1066 | static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, | 1063 | static 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 | ||
1094 | static int ipgre_open(struct net_device *dev) | 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 | 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 | ||
1118 | static int ipgre_close(struct net_device *dev) | 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 | 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 | ||
1222 | static int __init ipgre_fb_tunnel_init(struct net_device *dev) | 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 | struct iphdr *iph = &tunnel->parms.iph; | 1222 | struct iphdr *iph = &tunnel->parms.iph; |
1226 | 1223 | ||
1227 | tunnel->dev = dev; | 1224 | tunnel->dev = dev; |