Commit 2941a486 authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

[NET]: Convert net/{ipv4,ipv6,sched} to netdev_priv

Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a429d260
...@@ -188,7 +188,7 @@ static struct ip_tunnel * ipgre_tunnel_lookup(u32 remote, u32 local, u32 key) ...@@ -188,7 +188,7 @@ static struct ip_tunnel * ipgre_tunnel_lookup(u32 remote, u32 local, u32 key)
} }
if (ipgre_fb_tunnel_dev->flags&IFF_UP) if (ipgre_fb_tunnel_dev->flags&IFF_UP)
return ipgre_fb_tunnel_dev->priv; return netdev_priv(ipgre_fb_tunnel_dev);
return NULL; return NULL;
} }
...@@ -278,7 +278,7 @@ static struct ip_tunnel * ipgre_tunnel_locate(struct ip_tunnel_parm *parms, int ...@@ -278,7 +278,7 @@ static struct ip_tunnel * ipgre_tunnel_locate(struct ip_tunnel_parm *parms, int
return NULL; return NULL;
dev->init = ipgre_tunnel_init; dev->init = ipgre_tunnel_init;
nt = dev->priv; nt = netdev_priv(dev);
nt->parms = *parms; nt->parms = *parms;
if (register_netdevice(dev) < 0) { if (register_netdevice(dev) < 0) {
...@@ -286,9 +286,6 @@ static struct ip_tunnel * ipgre_tunnel_locate(struct ip_tunnel_parm *parms, int ...@@ -286,9 +286,6 @@ static struct ip_tunnel * ipgre_tunnel_locate(struct ip_tunnel_parm *parms, int
goto failed; goto failed;
} }
nt = dev->priv;
nt->parms = *parms;
dev_hold(dev); dev_hold(dev);
ipgre_tunnel_link(nt); ipgre_tunnel_link(nt);
return nt; return nt;
...@@ -299,7 +296,7 @@ static struct ip_tunnel * ipgre_tunnel_locate(struct ip_tunnel_parm *parms, int ...@@ -299,7 +296,7 @@ static struct ip_tunnel * ipgre_tunnel_locate(struct ip_tunnel_parm *parms, int
static void ipgre_tunnel_uninit(struct net_device *dev) static void ipgre_tunnel_uninit(struct net_device *dev)
{ {
ipgre_tunnel_unlink((struct ip_tunnel*)dev->priv); ipgre_tunnel_unlink(netdev_priv(dev));
dev_put(dev); dev_put(dev);
} }
...@@ -518,7 +515,7 @@ static void ipgre_err(struct sk_buff *skb, u32 info) ...@@ -518,7 +515,7 @@ static void ipgre_err(struct sk_buff *skb, u32 info)
skb2->dst->ops->update_pmtu(skb2->dst, rel_info); skb2->dst->ops->update_pmtu(skb2->dst, rel_info);
rel_info = htonl(rel_info); rel_info = htonl(rel_info);
} else if (type == ICMP_TIME_EXCEEDED) { } else if (type == ICMP_TIME_EXCEEDED) {
struct ip_tunnel *t = (struct ip_tunnel*)skb2->dev->priv; struct ip_tunnel *t = netdev_priv(skb2->dev);
if (t->parms.iph.ttl) { if (t->parms.iph.ttl) {
rel_type = ICMP_DEST_UNREACH; rel_type = ICMP_DEST_UNREACH;
rel_code = ICMP_HOST_UNREACH; rel_code = ICMP_HOST_UNREACH;
...@@ -669,7 +666,7 @@ static int ipgre_rcv(struct sk_buff *skb) ...@@ -669,7 +666,7 @@ static int ipgre_rcv(struct sk_buff *skb)
static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
struct ip_tunnel *tunnel = (struct ip_tunnel*)dev->priv; struct ip_tunnel *tunnel = netdev_priv(dev);
struct net_device_stats *stats = &tunnel->stat; struct net_device_stats *stats = &tunnel->stat;
struct iphdr *old_iph = skb->nh.iph; struct iphdr *old_iph = skb->nh.iph;
struct iphdr *tiph; struct iphdr *tiph;
...@@ -915,7 +912,7 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -915,7 +912,7 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
t = ipgre_tunnel_locate(&p, 0); t = ipgre_tunnel_locate(&p, 0);
} }
if (t == NULL) if (t == NULL)
t = (struct ip_tunnel*)dev->priv; t = netdev_priv(dev);
memcpy(&p, &t->parms, sizeof(p)); memcpy(&p, &t->parms, sizeof(p));
if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p))) if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p)))
err = -EFAULT; err = -EFAULT;
...@@ -955,7 +952,7 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -955,7 +952,7 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
} else { } else {
unsigned nflags=0; unsigned nflags=0;
t = (struct ip_tunnel*)dev->priv; t = netdev_priv(dev);
if (MULTICAST(p.iph.daddr)) if (MULTICAST(p.iph.daddr))
nflags = IFF_BROADCAST; nflags = IFF_BROADCAST;
...@@ -1004,7 +1001,7 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -1004,7 +1001,7 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
if ((t = ipgre_tunnel_locate(&p, 0)) == NULL) if ((t = ipgre_tunnel_locate(&p, 0)) == NULL)
goto done; goto done;
err = -EPERM; err = -EPERM;
if (t == ipgre_fb_tunnel_dev->priv) if (t == netdev_priv(ipgre_fb_tunnel_dev))
goto done; goto done;
dev = t->dev; dev = t->dev;
} }
...@@ -1021,12 +1018,12 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -1021,12 +1018,12 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
static struct net_device_stats *ipgre_tunnel_get_stats(struct net_device *dev) static struct net_device_stats *ipgre_tunnel_get_stats(struct net_device *dev)
{ {
return &(((struct ip_tunnel*)dev->priv)->stat); return &(((struct ip_tunnel*)netdev_priv(dev))->stat);
} }
static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu) static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu)
{ {
struct ip_tunnel *tunnel = (struct ip_tunnel*)dev->priv; struct ip_tunnel *tunnel = netdev_priv(dev);
if (new_mtu < 68 || new_mtu > 0xFFF8 - tunnel->hlen) if (new_mtu < 68 || new_mtu > 0xFFF8 - tunnel->hlen)
return -EINVAL; return -EINVAL;
dev->mtu = new_mtu; dev->mtu = new_mtu;
...@@ -1066,7 +1063,7 @@ static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu) ...@@ -1066,7 +1063,7 @@ static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu)
static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned short type,
void *daddr, void *saddr, unsigned len) void *daddr, void *saddr, unsigned len)
{ {
struct ip_tunnel *t = (struct ip_tunnel*)dev->priv; struct ip_tunnel *t = netdev_priv(dev);
struct iphdr *iph = (struct iphdr *)skb_push(skb, t->hlen); struct iphdr *iph = (struct iphdr *)skb_push(skb, t->hlen);
u16 *p = (u16*)(iph+1); u16 *p = (u16*)(iph+1);
...@@ -1093,7 +1090,7 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned sh ...@@ -1093,7 +1090,7 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned sh
static int ipgre_open(struct net_device *dev) static int ipgre_open(struct net_device *dev)
{ {
struct ip_tunnel *t = (struct ip_tunnel*)dev->priv; struct ip_tunnel *t = netdev_priv(dev);
if (MULTICAST(t->parms.iph.daddr)) { if (MULTICAST(t->parms.iph.daddr)) {
struct flowi fl = { .oif = t->parms.link, struct flowi fl = { .oif = t->parms.link,
...@@ -1117,7 +1114,7 @@ static int ipgre_open(struct net_device *dev) ...@@ -1117,7 +1114,7 @@ static int ipgre_open(struct net_device *dev)
static int ipgre_close(struct net_device *dev) static int ipgre_close(struct net_device *dev)
{ {
struct ip_tunnel *t = (struct ip_tunnel*)dev->priv; struct ip_tunnel *t = netdev_priv(dev);
if (MULTICAST(t->parms.iph.daddr) && t->mlink) { if (MULTICAST(t->parms.iph.daddr) && t->mlink) {
struct in_device *in_dev = inetdev_by_index(t->mlink); struct in_device *in_dev = inetdev_by_index(t->mlink);
if (in_dev) { if (in_dev) {
...@@ -1157,7 +1154,7 @@ static int ipgre_tunnel_init(struct net_device *dev) ...@@ -1157,7 +1154,7 @@ static int ipgre_tunnel_init(struct net_device *dev)
int mtu = ETH_DATA_LEN; int mtu = ETH_DATA_LEN;
int addend = sizeof(struct iphdr) + 4; int addend = sizeof(struct iphdr) + 4;
tunnel = (struct ip_tunnel*)dev->priv; tunnel = netdev_priv(dev);
iph = &tunnel->parms.iph; iph = &tunnel->parms.iph;
tunnel->dev = dev; tunnel->dev = dev;
...@@ -1221,7 +1218,7 @@ static int ipgre_tunnel_init(struct net_device *dev) ...@@ -1221,7 +1218,7 @@ static int ipgre_tunnel_init(struct net_device *dev)
static int __init ipgre_fb_tunnel_init(struct net_device *dev) static int __init ipgre_fb_tunnel_init(struct net_device *dev)
{ {
struct ip_tunnel *tunnel = (struct ip_tunnel*)dev->priv; struct ip_tunnel *tunnel = netdev_priv(dev);
struct iphdr *iph = &tunnel->parms.iph; struct iphdr *iph = &tunnel->parms.iph;
tunnel->dev = dev; tunnel->dev = dev;
......
...@@ -244,7 +244,7 @@ static struct ip_tunnel * ipip_tunnel_locate(struct ip_tunnel_parm *parms, int c ...@@ -244,7 +244,7 @@ static struct ip_tunnel * ipip_tunnel_locate(struct ip_tunnel_parm *parms, int c
if (dev == NULL) if (dev == NULL)
return NULL; return NULL;
nt = dev->priv; nt = netdev_priv(dev);
SET_MODULE_OWNER(dev); SET_MODULE_OWNER(dev);
dev->init = ipip_tunnel_init; dev->init = ipip_tunnel_init;
nt->parms = *parms; nt->parms = *parms;
...@@ -269,7 +269,7 @@ static void ipip_tunnel_uninit(struct net_device *dev) ...@@ -269,7 +269,7 @@ static void ipip_tunnel_uninit(struct net_device *dev)
tunnels_wc[0] = NULL; tunnels_wc[0] = NULL;
write_unlock_bh(&ipip_lock); write_unlock_bh(&ipip_lock);
} else } else
ipip_tunnel_unlink((struct ip_tunnel*)dev->priv); ipip_tunnel_unlink(netdev_priv(dev));
dev_put(dev); dev_put(dev);
} }
...@@ -443,7 +443,7 @@ static void ipip_err(struct sk_buff *skb, u32 info) ...@@ -443,7 +443,7 @@ static void ipip_err(struct sk_buff *skb, u32 info)
skb2->dst->ops->update_pmtu(skb2->dst, rel_info); skb2->dst->ops->update_pmtu(skb2->dst, rel_info);
rel_info = htonl(rel_info); rel_info = htonl(rel_info);
} else if (type == ICMP_TIME_EXCEEDED) { } else if (type == ICMP_TIME_EXCEEDED) {
struct ip_tunnel *t = (struct ip_tunnel*)skb2->dev->priv; struct ip_tunnel *t = netdev_priv(skb2->dev);
if (t->parms.iph.ttl) { if (t->parms.iph.ttl) {
rel_type = ICMP_DEST_UNREACH; rel_type = ICMP_DEST_UNREACH;
rel_code = ICMP_HOST_UNREACH; rel_code = ICMP_HOST_UNREACH;
...@@ -514,7 +514,7 @@ static int ipip_rcv(struct sk_buff *skb) ...@@ -514,7 +514,7 @@ static int ipip_rcv(struct sk_buff *skb)
static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
struct ip_tunnel *tunnel = (struct ip_tunnel*)dev->priv; struct ip_tunnel *tunnel = netdev_priv(dev);
struct net_device_stats *stats = &tunnel->stat; struct net_device_stats *stats = &tunnel->stat;
struct iphdr *tiph = &tunnel->parms.iph; struct iphdr *tiph = &tunnel->parms.iph;
u8 tos = tunnel->parms.iph.tos; u8 tos = tunnel->parms.iph.tos;
...@@ -674,7 +674,7 @@ ipip_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -674,7 +674,7 @@ ipip_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
t = ipip_tunnel_locate(&p, 0); t = ipip_tunnel_locate(&p, 0);
} }
if (t == NULL) if (t == NULL)
t = (struct ip_tunnel*)dev->priv; t = netdev_priv(dev);
memcpy(&p, &t->parms, sizeof(p)); memcpy(&p, &t->parms, sizeof(p));
if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p))) if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p)))
err = -EFAULT; err = -EFAULT;
...@@ -711,7 +711,7 @@ ipip_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -711,7 +711,7 @@ ipip_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
err = -EINVAL; err = -EINVAL;
break; break;
} }
t = (struct ip_tunnel*)dev->priv; t = netdev_priv(dev);
ipip_tunnel_unlink(t); ipip_tunnel_unlink(t);
t->parms.iph.saddr = p.iph.saddr; t->parms.iph.saddr = p.iph.saddr;
t->parms.iph.daddr = p.iph.daddr; t->parms.iph.daddr = p.iph.daddr;
...@@ -765,7 +765,7 @@ ipip_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -765,7 +765,7 @@ ipip_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
static struct net_device_stats *ipip_tunnel_get_stats(struct net_device *dev) static struct net_device_stats *ipip_tunnel_get_stats(struct net_device *dev)
{ {
return &(((struct ip_tunnel*)dev->priv)->stat); return &(((struct ip_tunnel*)netdev_priv(dev))->stat);
} }
static int ipip_tunnel_change_mtu(struct net_device *dev, int new_mtu) static 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,7 +800,7 @@ static int ipip_tunnel_init(struct net_device *dev)
struct ip_tunnel *tunnel; struct ip_tunnel *tunnel;
struct iphdr *iph; struct iphdr *iph;
tunnel = (struct ip_tunnel*)dev->priv; tunnel = netdev_priv(dev);
iph = &tunnel->parms.iph; iph = &tunnel->parms.iph;
tunnel->dev = dev; tunnel->dev = dev;
...@@ -838,7 +838,7 @@ static int ipip_tunnel_init(struct net_device *dev) ...@@ -838,7 +838,7 @@ static int ipip_tunnel_init(struct net_device *dev)
static int __init ipip_fb_tunnel_init(struct net_device *dev) static int __init ipip_fb_tunnel_init(struct net_device *dev)
{ {
struct ip_tunnel *tunnel = dev->priv; struct ip_tunnel *tunnel = netdev_priv(dev);
struct iphdr *iph = &tunnel->parms.iph; struct iphdr *iph = &tunnel->parms.iph;
tunnel->dev = dev; tunnel->dev = dev;
......
...@@ -178,8 +178,8 @@ static int reg_vif_num = -1; ...@@ -178,8 +178,8 @@ static int reg_vif_num = -1;
static int reg_vif_xmit(struct sk_buff *skb, struct net_device *dev) static int reg_vif_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
read_lock(&mrt_lock); read_lock(&mrt_lock);
((struct net_device_stats*)dev->priv)->tx_bytes += skb->len; ((struct net_device_stats*)netdev_priv(dev))->tx_bytes += skb->len;
((struct net_device_stats*)dev->priv)->tx_packets++; ((struct net_device_stats*)netdev_priv(dev))->tx_packets++;
ipmr_cache_report(skb, reg_vif_num, IGMPMSG_WHOLEPKT); ipmr_cache_report(skb, reg_vif_num, IGMPMSG_WHOLEPKT);
read_unlock(&mrt_lock); read_unlock(&mrt_lock);
kfree_skb(skb); kfree_skb(skb);
...@@ -188,7 +188,7 @@ static int reg_vif_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -188,7 +188,7 @@ static int reg_vif_xmit(struct sk_buff *skb, struct net_device *dev)
static struct net_device_stats *reg_vif_get_stats(struct net_device *dev) static struct net_device_stats *reg_vif_get_stats(struct net_device *dev)
{ {
return (struct net_device_stats*)dev->priv; return (struct net_device_stats*)netdev_priv(dev);
} }
static void reg_vif_setup(struct net_device *dev) static 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,8 +1149,8 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
if (vif->flags & VIFF_REGISTER) { if (vif->flags & VIFF_REGISTER) {
vif->pkt_out++; vif->pkt_out++;
vif->bytes_out+=skb->len; vif->bytes_out+=skb->len;
((struct net_device_stats*)vif->dev->priv)->tx_bytes += skb->len; ((struct net_device_stats*)netdev_priv(vif->dev))->tx_bytes += skb->len;
((struct net_device_stats*)vif->dev->priv)->tx_packets++; ((struct net_device_stats*)netdev_priv(vif->dev))->tx_packets++;
ipmr_cache_report(skb, vifi, IGMPMSG_WHOLEPKT); ipmr_cache_report(skb, vifi, IGMPMSG_WHOLEPKT);
kfree_skb(skb); kfree_skb(skb);
return; return;
...@@ -1210,8 +1210,8 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi) ...@@ -1210,8 +1210,8 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
if (vif->flags & VIFF_TUNNEL) { if (vif->flags & VIFF_TUNNEL) {
ip_encap(skb, vif->local, vif->remote); ip_encap(skb, vif->local, vif->remote);
/* FIXME: extra output firewall step used to be here. --RR */ /* FIXME: extra output firewall step used to be here. --RR */
((struct ip_tunnel *)vif->dev->priv)->stat.tx_packets++; ((struct ip_tunnel *)netdev_priv(vif->dev))->stat.tx_packets++;
((struct ip_tunnel *)vif->dev->priv)->stat.tx_bytes+=skb->len; ((struct ip_tunnel *)netdev_priv(vif->dev))->stat.tx_bytes+=skb->len;
} }
IPCB(skb)->flags |= IPSKB_FORWARDED; IPCB(skb)->flags |= IPSKB_FORWARDED;
...@@ -1467,8 +1467,8 @@ int pim_rcv_v1(struct sk_buff * skb) ...@@ -1467,8 +1467,8 @@ int pim_rcv_v1(struct sk_buff * skb)
skb->pkt_type = PACKET_HOST; skb->pkt_type = PACKET_HOST;
dst_release(skb->dst); dst_release(skb->dst);
skb->dst = NULL; skb->dst = NULL;
((struct net_device_stats*)reg_dev->priv)->rx_bytes += skb->len; ((struct net_device_stats*)netdev_priv(reg_dev))->rx_bytes += skb->len;
((struct net_device_stats*)reg_dev->priv)->rx_packets++; ((struct net_device_stats*)netdev_priv(reg_dev))->rx_packets++;
nf_reset(skb); nf_reset(skb);
netif_rx(skb); netif_rx(skb);
dev_put(reg_dev); dev_put(reg_dev);
...@@ -1522,8 +1522,8 @@ static int pim_rcv(struct sk_buff * skb) ...@@ -1522,8 +1522,8 @@ static int pim_rcv(struct sk_buff * skb)
skb->ip_summed = 0; skb->ip_summed = 0;
skb->pkt_type = PACKET_HOST; skb->pkt_type = PACKET_HOST;
dst_release(skb->dst); dst_release(skb->dst);
((struct net_device_stats*)reg_dev->priv)->rx_bytes += skb->len; ((struct net_device_stats*)netdev_priv(reg_dev))->rx_bytes += skb->len;
((struct net_device_stats*)reg_dev->priv)->rx_packets++; ((struct net_device_stats*)netdev_priv(reg_dev))->rx_packets++;
skb->dst = NULL; skb->dst = NULL;
nf_reset(skb); nf_reset(skb);
netif_rx(skb); netif_rx(skb);
......
...@@ -243,7 +243,7 @@ ip6_tnl_create(struct ip6_tnl_parm *p, struct ip6_tnl **pt) ...@@ -243,7 +243,7 @@ ip6_tnl_create(struct ip6_tnl_parm *p, struct ip6_tnl **pt)
if (dev == NULL) if (dev == NULL)
return -ENOMEM; return -ENOMEM;
t = dev->priv; t = netdev_priv(dev);
dev->init = ip6ip6_tnl_dev_init; dev->init = ip6ip6_tnl_dev_init;
t->parms = *p; t->parms = *p;
...@@ -308,7 +308,7 @@ ip6ip6_tnl_locate(struct ip6_tnl_parm *p, struct ip6_tnl **pt, int create) ...@@ -308,7 +308,7 @@ ip6ip6_tnl_locate(struct ip6_tnl_parm *p, struct ip6_tnl **pt, int create)
static void static void
ip6ip6_tnl_dev_uninit(struct net_device *dev) ip6ip6_tnl_dev_uninit(struct net_device *dev)
{ {
struct ip6_tnl *t = dev->priv; struct ip6_tnl *t = netdev_priv(dev);
if (dev == ip6ip6_fb_tnl_dev) { if (dev == ip6ip6_fb_tnl_dev) {
write_lock_bh(&ip6ip6_lock); write_lock_bh(&ip6ip6_lock);
...@@ -623,7 +623,7 @@ ip6ip6_tnl_addr_conflict(struct ip6_tnl *t, struct ipv6hdr *hdr) ...@@ -623,7 +623,7 @@ ip6ip6_tnl_addr_conflict(struct ip6_tnl *t, struct ipv6hdr *hdr)
static int static int
ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
struct ip6_tnl *t = (struct ip6_tnl *) dev->priv; struct ip6_tnl *t = netdev_priv(dev);
struct net_device_stats *stats = &t->stat; struct net_device_stats *stats = &t->stat;
struct ipv6hdr *ipv6h = skb->nh.ipv6h; struct ipv6hdr *ipv6h = skb->nh.ipv6h;
struct ipv6_txoptions *opt = NULL; struct ipv6_txoptions *opt = NULL;
...@@ -933,11 +933,11 @@ ip6ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -933,11 +933,11 @@ ip6ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
break; break;
} }
if ((err = ip6ip6_tnl_locate(&p, &t, 0)) == -ENODEV) if ((err = ip6ip6_tnl_locate(&p, &t, 0)) == -ENODEV)
t = (struct ip6_tnl *) dev->priv; t = netdev_priv(dev);
else if (err) else if (err)
break; break;
} else } else
t = (struct ip6_tnl *) dev->priv; t = netdev_priv(dev);
memcpy(&p, &t->parms, sizeof (p)); memcpy(&p, &t->parms, sizeof (p));
if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof (p))) { 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,7 +955,7 @@ ip6ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
break; break;
} }
if (!create && dev != ip6ip6_fb_tnl_dev) { if (!create && dev != ip6ip6_fb_tnl_dev) {
t = (struct ip6_tnl *) dev->priv; t = netdev_priv(dev);
} }
if (!t && (err = ip6ip6_tnl_locate(&p, &t, create))) { if (!t && (err = ip6ip6_tnl_locate(&p, &t, create))) {
break; break;
...@@ -991,12 +991,12 @@ ip6ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -991,12 +991,12 @@ ip6ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
err = ip6ip6_tnl_locate(&p, &t, 0); err = ip6ip6_tnl_locate(&p, &t, 0);
if (err) if (err)
break; break;
if (t == ip6ip6_fb_tnl_dev->priv) { if (t == netdev_priv(ip6ip6_fb_tnl_dev)) {
err = -EPERM; err = -EPERM;
break; break;
} }
} else { } else {
t = (struct ip6_tnl *) dev->priv; t = netdev_priv(dev);
} }
err = unregister_netdevice(t->dev); err = unregister_netdevice(t->dev);
break; break;
...@@ -1016,7 +1016,7 @@ ip6ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -1016,7 +1016,7 @@ ip6ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
static struct net_device_stats * static struct net_device_stats *
ip6ip6_tnl_get_stats(struct net_device *dev) ip6ip6_tnl_get_stats(struct net_device *dev)
{ {
return &(((struct ip6_tnl *) dev->priv)->stat); return &(((struct ip6_tnl *)netdev_priv(dev))->stat);
} }
/** /**
...@@ -1073,7 +1073,7 @@ static void ip6ip6_tnl_dev_setup(struct net_device *dev) ...@@ -1073,7 +1073,7 @@ static void ip6ip6_tnl_dev_setup(struct net_device *dev)
static inline void static inline void
ip6ip6_tnl_dev_init_gen(struct net_device *dev) ip6ip6_tnl_dev_init_gen(struct net_device *dev)
{ {
struct ip6_tnl *t = (struct ip6_tnl *) dev->priv; struct ip6_tnl *t = netdev_priv(dev);
t->fl.proto = IPPROTO_IPV6; t->fl.proto = IPPROTO_IPV6;
t->dev = dev; t->dev = dev;
strcpy(t->parms.name, dev->name); strcpy(t->parms.name, dev->name);
...@@ -1087,7 +1087,7 @@ ip6ip6_tnl_dev_init_gen(struct net_device *dev) ...@@ -1087,7 +1087,7 @@ ip6ip6_tnl_dev_init_gen(struct net_device *dev)
static int static int
ip6ip6_tnl_dev_init(struct net_device *dev) ip6ip6_tnl_dev_init(struct net_device *dev)
{ {
struct ip6_tnl *t = (struct ip6_tnl *) dev->priv; struct ip6_tnl *t = netdev_priv(dev);
ip6ip6_tnl_dev_init_gen(dev); ip6ip6_tnl_dev_init_gen(dev);
ip6ip6_tnl_link_config(t); ip6ip6_tnl_link_config(t);
return 0; return 0;
...@@ -1103,7 +1103,7 @@ ip6ip6_tnl_dev_init(struct net_device *dev) ...@@ -1103,7 +1103,7 @@ ip6ip6_tnl_dev_init(struct net_device *dev)
static int static int
ip6ip6_fb_tnl_dev_init(struct net_device *dev) ip6ip6_fb_tnl_dev_init(struct net_device *dev)
{ {
struct ip6_tnl *t = dev->priv; struct ip6_tnl *t = netdev_priv(dev);
ip6ip6_tnl_dev_init_gen(dev); ip6ip6_tnl_dev_init_gen(dev);
dev_hold(dev); dev_hold(dev);
tnls_wc[0] = t; tnls_wc[0] = t;
......
...@@ -184,7 +184,7 @@ static struct ip_tunnel * ipip6_tunnel_locate(struct ip_tunnel_parm *parms, int ...@@ -184,7 +184,7 @@ static struct ip_tunnel * ipip6_tunnel_locate(struct ip_tunnel_parm *parms, int
if (dev == NULL) if (dev == NULL)
return NULL; return NULL;
nt = dev->priv; nt = netdev_priv(dev);
dev->init = ipip6_tunnel_init; dev->init = ipip6_tunnel_init;
nt->parms = *parms; nt->parms = *parms;
...@@ -210,7 +210,7 @@ static void ipip6_tunnel_uninit(struct net_device *dev) ...@@ -210,7 +210,7 @@ static void ipip6_tunnel_uninit(struct net_device *dev)
write_unlock_bh(&ipip6_lock); write_unlock_bh(&ipip6_lock);
dev_put(dev); dev_put(dev);
} else { } else {
ipip6_tunnel_unlink((struct ip_tunnel*)dev->priv); ipip6_tunnel_unlink(netdev_priv(dev));
dev_put(dev); dev_put(dev);
} }
} }
...@@ -346,7 +346,7 @@ static void ipip6_err(struct sk_buff *skb, u32 info) ...@@ -346,7 +346,7 @@ static void ipip6_err(struct sk_buff *skb, u32 info)
rt6i = rt6_lookup(&iph6->daddr, &iph6->saddr, NULL, 0); rt6i = rt6_lookup(&iph6->daddr, &iph6->saddr, NULL, 0);
if (rt6i && rt6i->rt6i_dev && rt6i->rt6i_dev->type == ARPHRD_SIT) { if (rt6i && rt6i->rt6i_dev && rt6i->rt6i_dev->type == ARPHRD_SIT) {
struct ip_tunnel * t = (struct ip_tunnel*)rt6i->rt6i_dev->priv; struct ip_tunnel *t = netdev_priv(rt6i->rt6i_dev);
if (rel_type == ICMPV6_TIME_EXCEED && t->parms.iph.ttl) { if (rel_type == ICMPV6_TIME_EXCEED && t->parms.iph.ttl) {
rel_type = ICMPV6_DEST_UNREACH; rel_type = ICMPV6_DEST_UNREACH;
rel_code = ICMPV6_ADDR_UNREACH; rel_code = ICMPV6_ADDR_UNREACH;
...@@ -424,7 +424,7 @@ static inline u32 try_6to4(struct in6_addr *v6dst) ...@@ -424,7 +424,7 @@ static inline u32 try_6to4(struct in6_addr *v6dst)
static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
struct ip_tunnel *tunnel = (struct ip_tunnel*)dev->priv; struct ip_tunnel *tunnel = netdev_priv(dev);
struct net_device_stats *stats = &tunnel->stat; struct net_device_stats *stats = &tunnel->stat;
struct iphdr *tiph = &tunnel->parms.iph; struct iphdr *tiph = &tunnel->parms.iph;
struct ipv6hdr *iph6 = skb->nh.ipv6h; struct ipv6hdr *iph6 = skb->nh.ipv6h;
...@@ -610,7 +610,7 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -610,7 +610,7 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
t = ipip6_tunnel_locate(&p, 0); t = ipip6_tunnel_locate(&p, 0);
} }
if (t == NULL) if (t == NULL)
t = (struct ip_tunnel*)dev->priv; t = netdev_priv(dev);
memcpy(&p, &t->parms, sizeof(p)); memcpy(&p, &t->parms, sizeof(p));
if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p))) if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p)))
err = -EFAULT; err = -EFAULT;
...@@ -647,7 +647,7 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -647,7 +647,7 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
err = -EINVAL; err = -EINVAL;
break; break;
} }
t = (struct ip_tunnel*)dev->priv; t = netdev_priv(dev);
ipip6_tunnel_unlink(t); ipip6_tunnel_unlink(t);
t->parms.iph.saddr = p.iph.saddr; t->parms.iph.saddr = p.iph.saddr;
t->parms.iph.daddr = p.iph.daddr; t->parms.iph.daddr = p.iph.daddr;
...@@ -683,7 +683,7 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -683,7 +683,7 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
if ((t = ipip6_tunnel_locate(&p, 0)) == NULL) if ((t = ipip6_tunnel_locate(&p, 0)) == NULL)
goto done; goto done;
err = -EPERM; err = -EPERM;
if (t == ipip6_fb_tunnel_dev->priv) if (t == netdev_priv(ipip6_fb_tunnel_dev))
goto done; goto done;
dev = t->dev; dev = t->dev;
} }
...@@ -700,7 +700,7 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -700,7 +700,7 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
static struct net_device_stats *ipip6_tunnel_get_stats(struct net_device *dev) static struct net_device_stats *ipip6_tunnel_get_stats(struct net_device *dev)
{ {
return &(((struct ip_tunnel*)dev->priv)->stat); return &(((struct ip_tunnel*)netdev_priv(dev))->stat);
} }
static int ipip6_tunnel_change_mtu(struct net_device *dev, int new_mtu) static 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,7 +735,7 @@ static int ipip6_tunnel_init(struct net_device *dev)
struct ip_tunnel *tunnel; struct ip_tunnel *tunnel;
struct iphdr *iph; struct iphdr *iph;
tunnel = (struct ip_tunnel*)dev->priv; tunnel = netdev_priv(dev);
iph = &tunnel->parms.iph; iph = &tunnel->parms.iph;
tunnel->dev = dev; tunnel->dev = dev;
...@@ -775,7 +775,7 @@ static int ipip6_tunnel_init(struct net_device *dev) ...@@ -775,7 +775,7 @@ static int ipip6_tunnel_init(struct net_device *dev)
static int __init ipip6_fb_tunnel_init(struct net_device *dev) static int __init ipip6_fb_tunnel_init(struct net_device *dev)
{ {
struct ip_tunnel *tunnel = dev->priv; struct ip_tunnel *tunnel = netdev_priv(dev);
struct iphdr *iph = &tunnel->parms.iph; struct iphdr *iph = &tunnel->parms.iph;
tunnel->dev = dev; tunnel->dev = dev;
......
...@@ -274,7 +274,7 @@ teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, struct net_device *de ...@@ -274,7 +274,7 @@ teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, struct net_device *de
static int teql_master_xmit(struct sk_buff *skb, struct net_device *dev) static int teql_master_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
struct teql_master *master = (void*)dev->priv; struct teql_master *master = netdev_priv(dev);
struct Qdisc *start, *q; struct Qdisc *start, *q;
int busy; int busy;
int nores; int nores;
...@@ -350,7 +350,7 @@ static int teql_master_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -350,7 +350,7 @@ static int teql_master_xmit(struct sk_buff *skb, struct net_device *dev)
static int teql_master_open(struct net_device *dev) static int teql_master_open(struct net_device *dev)
{ {
struct Qdisc * q; struct Qdisc * q;
struct teql_master *m = (void*)dev->priv; struct teql_master *m = netdev_priv(dev);
int mtu = 0xFFFE; int mtu = 0xFFFE;
unsigned flags = IFF_NOARP|IFF_MULTICAST; unsigned flags = IFF_NOARP|IFF_MULTICAST;
...@@ -397,13 +397,13 @@ static int teql_master_close(struct net_device *dev) ...@@ -397,13 +397,13 @@ static int teql_master_close(struct net_device *dev)
static struct net_device_stats *teql_master_stats(struct net_device *dev) static struct net_device_stats *teql_master_stats(struct net_device *dev)
{ {
struct teql_master *m = (void*)dev->priv; struct teql_master *m = netdev_priv(dev);
return &m->stats; return &m->stats;
} }
static int teql_master_mtu(struct net_device *dev, int new_mtu) static int teql_master_mtu(struct net_device *dev, int new_mtu)
{ {
struct teql_master *m = (void*)dev->priv; struct teql_master *m = netdev_priv(dev);
struct Qdisc *q; struct Qdisc *q;
if (new_mtu < 68) if (new_mtu < 68)
...@@ -423,7 +423,7 @@ static int teql_master_mtu(struct net_device *dev, int new_mtu) ...@@ -423,7 +423,7 @@ static int teql_master_mtu(struct net_device *dev, int new_mtu)
static __init void teql_master_setup(struct net_device *dev) static __init void teql_master_setup(struct net_device *dev)
{ {
struct teql_master *master = dev->priv; struct teql_master *master = netdev_priv(dev);
struct Qdisc_ops *ops = &master->qops; struct Qdisc_ops *ops = &master->qops;
master->dev = dev; master->dev = dev;
...@@ -476,7 +476,7 @@ static int __init teql_init(void) ...@@ -476,7 +476,7 @@ static int __init teql_init(void)
break; break;
} }
master = dev->priv; master = netdev_priv(dev);
strlcpy(master->qops.id, dev->name, IFNAMSIZ); strlcpy(master->qops.id, dev->name, IFNAMSIZ);
err = register_qdisc(&master->qops); err = register_qdisc(&master->qops);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment