projects
/
firefly-linux-kernel-4.4.55.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1326c3d
)
ipgre: convert to netdevice_ops
author
Stephen Hemminger
<shemminger@vyatta.com>
Fri, 21 Nov 2008 04:34:29 +0000
(20:34 -0800)
committer
David S. Miller
<davem@davemloft.net>
Fri, 21 Nov 2008 04:34:29 +0000
(20:34 -0800)
Convert ipgre tunnel to netdevice ops.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ip_gre.c
patch
|
blob
|
history
diff --git
a/net/ipv4/ip_gre.c
b/net/ipv4/ip_gre.c
index 191ef7588134b501571d8922d96fded4697170b6..bf5b338f134352d0f7b19b7c2620e92f2a0cfd2a 100644
(file)
--- a/
net/ipv4/ip_gre.c
+++ b/
net/ipv4/ip_gre.c
@@
-126,8
+126,6
@@
static int ipgre_tunnel_bind_dev(struct net_device *dev);
/* Fallback tunnel: no source, no destination, no key, no options */
/* Fallback tunnel: no source, no destination, no key, no options */
-static int ipgre_fb_tunnel_init(struct net_device *dev);
-
#define HASH_SIZE 16
static int ipgre_net_id;
#define HASH_SIZE 16
static int ipgre_net_id;
@@
-1142,6
+1140,7
@@
static int ipgre_open(struct net_device *dev)
static int ipgre_close(struct net_device *dev)
{
struct ip_tunnel *t = netdev_priv(dev);
static int ipgre_close(struct net_device *dev)
{
struct ip_tunnel *t = netdev_priv(dev);
+
if (ipv4_is_multicast(t->parms.iph.daddr) && t->mlink) {
struct in_device *in_dev;
in_dev = inetdev_by_index(dev_net(dev), t->mlink);
if (ipv4_is_multicast(t->parms.iph.daddr) && t->mlink) {
struct in_device *in_dev;
in_dev = inetdev_by_index(dev_net(dev), t->mlink);
@@
-1155,14
+1154,22
@@
static int ipgre_close(struct net_device *dev)
#endif
#endif
+static const struct net_device_ops ipgre_netdev_ops = {
+ .ndo_init = ipgre_tunnel_init,
+ .ndo_uninit = ipgre_tunnel_uninit,
+#ifdef CONFIG_NET_IPGRE_BROADCAST
+ .ndo_open = ipgre_open,
+ .ndo_stop = ipgre_close,
+#endif
+ .ndo_start_xmit = ipgre_tunnel_xmit,
+ .ndo_do_ioctl = ipgre_tunnel_ioctl,
+ .ndo_change_mtu = ipgre_tunnel_change_mtu,
+};
+
static void ipgre_tunnel_setup(struct net_device *dev)
{
static void ipgre_tunnel_setup(struct net_device *dev)
{
- dev->init = ipgre_tunnel_init;
- dev->uninit = ipgre_tunnel_uninit;
+ dev->netdev_ops = &ipgre_netdev_ops;
dev->destructor = free_netdev;
dev->destructor = free_netdev;
- dev->hard_start_xmit = ipgre_tunnel_xmit;
- dev->do_ioctl = ipgre_tunnel_ioctl;
- dev->change_mtu = ipgre_tunnel_change_mtu;
dev->type = ARPHRD_IPGRE;
dev->needed_headroom = LL_MAX_HEADER + sizeof(struct iphdr) + 4;
dev->type = ARPHRD_IPGRE;
dev->needed_headroom = LL_MAX_HEADER + sizeof(struct iphdr) + 4;
@@
-1194,8
+1201,6
@@
static int ipgre_tunnel_init(struct net_device *dev)
return -EINVAL;
dev->flags = IFF_BROADCAST;
dev->header_ops = &ipgre_header_ops;
return -EINVAL;
dev->flags = IFF_BROADCAST;
dev->header_ops = &ipgre_header_ops;
- dev->open = ipgre_open;
- dev->stop = ipgre_close;
}
#endif
} else
}
#endif
} else
@@
-1204,7
+1209,7
@@
static int ipgre_tunnel_init(struct net_device *dev)
return 0;
}
return 0;
}
-static
int
ipgre_fb_tunnel_init(struct net_device *dev)
+static
void
ipgre_fb_tunnel_init(struct net_device *dev)
{
struct ip_tunnel *tunnel = netdev_priv(dev);
struct iphdr *iph = &tunnel->parms.iph;
{
struct ip_tunnel *tunnel = netdev_priv(dev);
struct iphdr *iph = &tunnel->parms.iph;
@@
-1220,7
+1225,6
@@
static int ipgre_fb_tunnel_init(struct net_device *dev)
dev_hold(dev);
ign->tunnels_wc[0] = tunnel;
dev_hold(dev);
ign->tunnels_wc[0] = tunnel;
- return 0;
}
}
@@
-1265,7
+1269,7
@@
static int ipgre_init_net(struct net *net)
goto err_alloc_dev;
}
goto err_alloc_dev;
}
- i
gn->fb_tunnel_dev->init = ipgre_fb_tunnel_init
;
+ i
pgre_fb_tunnel_init(ign->fb_tunnel_dev)
;
dev_net_set(ign->fb_tunnel_dev, net);
ign->fb_tunnel_dev->rtnl_link_ops = &ipgre_link_ops;
dev_net_set(ign->fb_tunnel_dev, net);
ign->fb_tunnel_dev->rtnl_link_ops = &ipgre_link_ops;
@@
-1397,16
+1401,22
@@
static int ipgre_tap_init(struct net_device *dev)
return 0;
}
return 0;
}
+static const struct net_device_ops ipgre_tap_netdev_ops = {
+ .ndo_init = ipgre_tap_init,
+ .ndo_uninit = ipgre_tunnel_uninit,
+ .ndo_start_xmit = ipgre_tunnel_xmit,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+ .ndo_change_mtu = ipgre_tunnel_change_mtu,
+};
+
static void ipgre_tap_setup(struct net_device *dev)
{
ether_setup(dev);
static void ipgre_tap_setup(struct net_device *dev)
{
ether_setup(dev);
- dev->init = ipgre_tap_init;
- dev->uninit = ipgre_tunnel_uninit;
+ dev->netdev_ops = &ipgre_netdev_ops;
dev->destructor = free_netdev;
dev->destructor = free_netdev;
- dev->hard_start_xmit = ipgre_tunnel_xmit;
- dev->change_mtu = ipgre_tunnel_change_mtu;
dev->iflink = 0;
dev->features |= NETIF_F_NETNS_LOCAL;
dev->iflink = 0;
dev->features |= NETIF_F_NETNS_LOCAL;