12 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
14 #include <linux/module.h>
16 #include <linux/socket.h>
17 #include <linux/hash.h>
18 #include <linux/l2tp.h>
37 #define L2TP_ETH_DEV_NAME "l2tpeth%d"
59 static unsigned int l2tp_eth_net_id;
76 eth_hw_addr_random(dev);
88 list_del_init(&priv->
list);
95 struct l2tp_eth *priv = netdev_priv(dev);
97 unsigned int len = skb->
len;
101 atomic_long_add(len, &priv->
tx_bytes);
112 struct l2tp_eth *priv = netdev_priv(dev);
125 .ndo_init = l2tp_eth_dev_init,
126 .ndo_uninit = l2tp_eth_dev_uninit,
127 .ndo_start_xmit = l2tp_eth_dev_xmit,
128 .ndo_get_stats64 = l2tp_eth_get_stats64,
131 static void l2tp_eth_dev_setup(
struct net_device *dev)
144 struct l2tp_eth *priv = netdev_priv(dev);
150 if (!pskb_may_pull(skb, length))
170 atomic_long_add(data_len, &priv->
rx_bytes);
181 static void l2tp_eth_delete(
struct l2tp_session *session)
187 spriv = l2tp_session_priv(session);
197 #if defined(CONFIG_L2TP_DEBUGFS) || defined(CONFIG_L2TP_DEBUGFS_MODULE)
198 static void l2tp_eth_show(
struct seq_file *
m,
void *
arg)
243 peer_session_id, cfg);
249 dev =
alloc_netdev(
sizeof(*priv), name, l2tp_eth_dev_setup);
252 goto out_del_session;
255 dev_net_set(dev, net);
256 if (session->
mtu == 0)
261 priv = netdev_priv(dev);
264 INIT_LIST_HEAD(&priv->
list);
267 session->
recv_skb = l2tp_eth_dev_recv;
269 #if defined(CONFIG_L2TP_DEBUGFS) || defined(CONFIG_L2TP_DEBUGFS_MODULE)
270 session->show = l2tp_eth_show;
273 spriv = l2tp_session_priv(session);
285 pn = l2tp_eth_pernet(dev_net(dev));
301 static __net_init int l2tp_eth_init_net(
struct net *net)
312 .init = l2tp_eth_init_net,
313 .id = &l2tp_eth_net_id,
319 .session_create = l2tp_eth_create,
324 static int __init l2tp_eth_init(
void)
336 pr_info(
"L2TP ethernet pseudowire support (L2TPv3)\n");
346 static void __exit l2tp_eth_exit(
void)