@@ -44,7 +44,6 @@ struct l2tp_eth {
44
44
struct net_device * dev ;
45
45
struct sock * tunnel_sock ;
46
46
struct l2tp_session * session ;
47
- struct list_head list ;
48
47
atomic_long_t tx_bytes ;
49
48
atomic_long_t tx_packets ;
50
49
atomic_long_t tx_dropped ;
@@ -58,17 +57,6 @@ struct l2tp_eth_sess {
58
57
struct net_device * dev ;
59
58
};
60
59
61
- /* per-net private data for this module */
62
- static unsigned int l2tp_eth_net_id ;
63
- struct l2tp_eth_net {
64
- struct list_head l2tp_eth_dev_list ;
65
- spinlock_t l2tp_eth_lock ;
66
- };
67
-
68
- static inline struct l2tp_eth_net * l2tp_eth_pernet (struct net * net )
69
- {
70
- return net_generic (net , l2tp_eth_net_id );
71
- }
72
60
73
61
static int l2tp_eth_dev_init (struct net_device * dev )
74
62
{
@@ -84,12 +72,6 @@ static int l2tp_eth_dev_init(struct net_device *dev)
84
72
85
73
static void l2tp_eth_dev_uninit (struct net_device * dev )
86
74
{
87
- struct l2tp_eth * priv = netdev_priv (dev );
88
- struct l2tp_eth_net * pn = l2tp_eth_pernet (dev_net (dev ));
89
-
90
- spin_lock (& pn -> l2tp_eth_lock );
91
- list_del_init (& priv -> list );
92
- spin_unlock (& pn -> l2tp_eth_lock );
93
75
dev_put (dev );
94
76
}
95
77
@@ -273,7 +255,6 @@ static int l2tp_eth_create(struct net *net, struct l2tp_tunnel *tunnel,
273
255
struct l2tp_eth * priv ;
274
256
struct l2tp_eth_sess * spriv ;
275
257
int rc ;
276
- struct l2tp_eth_net * pn ;
277
258
278
259
if (cfg -> ifname ) {
279
260
strlcpy (name , cfg -> ifname , IFNAMSIZ );
@@ -305,7 +286,6 @@ static int l2tp_eth_create(struct net *net, struct l2tp_tunnel *tunnel,
305
286
priv = netdev_priv (dev );
306
287
priv -> dev = dev ;
307
288
priv -> session = session ;
308
- INIT_LIST_HEAD (& priv -> list );
309
289
310
290
priv -> tunnel_sock = tunnel -> sock ;
311
291
session -> recv_skb = l2tp_eth_dev_recv ;
@@ -326,10 +306,6 @@ static int l2tp_eth_create(struct net *net, struct l2tp_tunnel *tunnel,
326
306
strlcpy (session -> ifname , dev -> name , IFNAMSIZ );
327
307
328
308
dev_hold (dev );
329
- pn = l2tp_eth_pernet (dev_net (dev ));
330
- spin_lock (& pn -> l2tp_eth_lock );
331
- list_add (& priv -> list , & pn -> l2tp_eth_dev_list );
332
- spin_unlock (& pn -> l2tp_eth_lock );
333
309
334
310
return 0 ;
335
311
@@ -342,22 +318,6 @@ static int l2tp_eth_create(struct net *net, struct l2tp_tunnel *tunnel,
342
318
return rc ;
343
319
}
344
320
345
- static __net_init int l2tp_eth_init_net (struct net * net )
346
- {
347
- struct l2tp_eth_net * pn = net_generic (net , l2tp_eth_net_id );
348
-
349
- INIT_LIST_HEAD (& pn -> l2tp_eth_dev_list );
350
- spin_lock_init (& pn -> l2tp_eth_lock );
351
-
352
- return 0 ;
353
- }
354
-
355
- static struct pernet_operations l2tp_eth_net_ops = {
356
- .init = l2tp_eth_init_net ,
357
- .id = & l2tp_eth_net_id ,
358
- .size = sizeof (struct l2tp_eth_net ),
359
- };
360
-
361
321
362
322
static const struct l2tp_nl_cmd_ops l2tp_eth_nl_cmd_ops = {
363
323
.session_create = l2tp_eth_create ,
@@ -371,25 +331,18 @@ static int __init l2tp_eth_init(void)
371
331
372
332
err = l2tp_nl_register_ops (L2TP_PWTYPE_ETH , & l2tp_eth_nl_cmd_ops );
373
333
if (err )
374
- goto out ;
375
-
376
- err = register_pernet_device (& l2tp_eth_net_ops );
377
- if (err )
378
- goto out_unreg ;
334
+ goto err ;
379
335
380
336
pr_info ("L2TP ethernet pseudowire support (L2TPv3)\n" );
381
337
382
338
return 0 ;
383
339
384
- out_unreg :
385
- l2tp_nl_unregister_ops (L2TP_PWTYPE_ETH );
386
- out :
340
+ err :
387
341
return err ;
388
342
}
389
343
390
344
static void __exit l2tp_eth_exit (void )
391
345
{
392
- unregister_pernet_device (& l2tp_eth_net_ops );
393
346
l2tp_nl_unregister_ops (L2TP_PWTYPE_ETH );
394
347
}
395
348
0 commit comments