31 #include <linux/kernel.h>
33 #include <linux/module.h>
36 #include <linux/types.h>
37 #include <linux/string.h>
38 #include <linux/socket.h>
39 #include <linux/errno.h>
40 #include <linux/fcntl.h>
44 #include <asm/uaccess.h>
48 #include <linux/netdevice.h>
51 #include <linux/ethtool.h>
54 #include <linux/if_ether.h>
55 #include <linux/if_arp.h>
57 #include <linux/tcp.h>
87 u64_stats_update_begin(&lb_stats->
syncp);
88 lb_stats->
bytes += len;
90 u64_stats_update_end(&lb_stats->
syncp);
105 u64 tbytes, tpackets;
110 start = u64_stats_fetch_begin_bh(&lb_stats->
syncp);
111 tbytes = lb_stats->
bytes;
113 }
while (u64_stats_fetch_retry_bh(&lb_stats->
syncp, start));
129 static const struct ethtool_ops loopback_ethtool_ops = {
130 .get_link = always_on,
133 static int loopback_dev_init(
struct net_device *dev)
142 static void loopback_dev_free(
struct net_device *dev)
149 .ndo_init = loopback_dev_init,
150 .ndo_start_xmit= loopback_xmit,
151 .ndo_get_stats64 = loopback_get_stats64,
160 dev->
mtu = 64 * 1024;
195 dev_net_set(dev, net);
198 goto out_free_netdev;
209 panic(
"loopback: Failed to register netdevice: %d\n", err);
215 .init = loopback_net_init,