18 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
20 #include <linux/module.h>
21 #include <linux/errno.h>
22 #include <linux/types.h>
23 #include <linux/socket.h>
25 #include <linux/kernel.h>
28 #include <linux/string.h>
30 #include <linux/net.h>
32 #include <linux/if_arp.h>
34 #include <linux/slab.h>
36 #include <asm/uaccess.h>
37 #include <linux/fcntl.h>
40 #include <linux/stat.h>
50 static void lapb_free_cb(
struct lapb_cb *lapb)
69 static void __lapb_remove_cb(
struct lapb_cb *lapb)
71 if (lapb->
node.next) {
80 static void __lapb_insert_cb(
struct lapb_cb *lapb)
82 list_add(&lapb->
node, &lapb_list);
93 if (lapb->
dev == dev) {
110 rc = __lapb_devtostruct(dev);
118 static struct lapb_cb *lapb_create_cb(
void)
151 lapb = __lapb_devtostruct(dev);
157 lapb = lapb_create_cb();
165 __lapb_insert_cb(lapb);
181 lapb = __lapb_devtostruct(dev);
190 __lapb_remove_cb(lapb);
202 struct lapb_cb *lapb = lapb_devtostruct(dev);
207 parms->
t1 = lapb->
t1 /
HZ;
208 parms->
t2 = lapb->
t2 /
HZ;
209 parms->
n2 = lapb->
n2;
215 if (!timer_pending(&lapb->t1timer))
220 if (!timer_pending(&lapb->
t2timer))
234 struct lapb_cb *lapb = lapb_devtostruct(dev);
240 if (parms->
t1 < 1 || parms->
t2 < 1 || parms->
n2 < 1)
255 lapb->
t1 = parms->
t1 *
HZ;
256 lapb->
t2 = parms->
t2 *
HZ;
257 lapb->
n2 = parms->
n2;
268 struct lapb_cb *lapb = lapb_devtostruct(dev);
296 struct lapb_cb *lapb = lapb_devtostruct(dev);
302 switch (lapb->
state) {
340 struct lapb_cb *lapb = lapb_devtostruct(dev);
361 struct lapb_cb *lapb = lapb_devtostruct(dev);
375 if (lapb->
callbacks->connect_confirmation)
376 lapb->
callbacks->connect_confirmation(lapb->
dev, reason);
387 if (lapb->
callbacks->disconnect_confirmation)
388 lapb->
callbacks->disconnect_confirmation(lapb->
dev, reason);
393 if (lapb->
callbacks->disconnect_indication)
394 lapb->
callbacks->disconnect_indication(lapb->
dev, reason);
400 return lapb->
callbacks->data_indication(lapb->
dev, skb);
427 static int __init lapb_init(
void)
432 static void __exit lapb_exit(
void)
434 WARN_ON(!list_empty(&lapb_list));