aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/loopback.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2008-11-20 00:46:18 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-20 01:42:37 -0500
commitc02373bf2759dd210dc8c72c9c9b4a8f1c279cac (patch)
tree7cf270d2d9fc6d31320b56ddee9b05d2abf1b727 /drivers/net/loopback.c
parentccad637b0c57de1825ffd34c311bf71487545ac2 (diff)
netdev: convert loopback to net_device_ops
First device to convert over is the loopback device. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/loopback.c')
-rw-r--r--drivers/net/loopback.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index c4516b580ba..958450124de 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -87,7 +87,7 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev)
87 return 0; 87 return 0;
88} 88}
89 89
90static struct net_device_stats *get_stats(struct net_device *dev) 90static struct net_device_stats *loopback_get_stats(struct net_device *dev)
91{ 91{
92 const struct pcpu_lstats *pcpu_lstats; 92 const struct pcpu_lstats *pcpu_lstats;
93 struct net_device_stats *stats = &dev->stats; 93 struct net_device_stats *stats = &dev->stats;
@@ -143,13 +143,17 @@ static void loopback_dev_free(struct net_device *dev)
143 free_netdev(dev); 143 free_netdev(dev);
144} 144}
145 145
146static const struct net_device_ops loopback_ops = {
147 .ndo_init = loopback_dev_init,
148 .ndo_get_stats = loopback_get_stats,
149};
150
146/* 151/*
147 * The loopback device is special. There is only one instance 152 * The loopback device is special. There is only one instance
148 * per network namespace. 153 * per network namespace.
149 */ 154 */
150static void loopback_setup(struct net_device *dev) 155static void loopback_setup(struct net_device *dev)
151{ 156{
152 dev->get_stats = &get_stats;
153 dev->mtu = (16 * 1024) + 20 + 20 + 12; 157 dev->mtu = (16 * 1024) + 20 + 20 + 12;
154 dev->hard_start_xmit = loopback_xmit; 158 dev->hard_start_xmit = loopback_xmit;
155 dev->hard_header_len = ETH_HLEN; /* 14 */ 159 dev->hard_header_len = ETH_HLEN; /* 14 */
@@ -165,8 +169,8 @@ static void loopback_setup(struct net_device *dev)
165 | NETIF_F_NETNS_LOCAL; 169 | NETIF_F_NETNS_LOCAL;
166 dev->ethtool_ops = &loopback_ethtool_ops; 170 dev->ethtool_ops = &loopback_ethtool_ops;
167 dev->header_ops = &eth_header_ops; 171 dev->header_ops = &eth_header_ops;
168 dev->init = loopback_dev_init; 172 dev->netdev_ops = &loopback_ops;
169 dev->destructor = loopback_dev_free; 173 dev->destructor = loopback_dev_free;
170} 174}
171 175
172/* Setup and register the loopback device. */ 176/* Setup and register the loopback device. */