18 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
20 #include <linux/errno.h>
21 #include <linux/types.h>
22 #include <linux/socket.h>
24 #include <linux/kernel.h>
26 #include <linux/string.h>
28 #include <linux/net.h>
30 #include <linux/netdevice.h>
32 #include <linux/slab.h>
34 #include <asm/uaccess.h>
35 #include <linux/fcntl.h>
47 switch (frame->
type) {
52 lapb->
dev, frame->
pf);
57 lapb->
dev, frame->
pf);
77 lapb->
dev, frame->
pf);
92 lapb->
dev, frame->
pf);
118 switch (frame->
type) {
123 lapb->
dev, frame->
pf);
128 lapb->
dev, frame->
pf);
138 lapb->
dev, frame->
pf);
143 lapb->
dev, frame->
pf);
191 static void lapb_state2_machine(
struct lapb_cb *lapb,
struct sk_buff *skb,
194 switch (frame->
type) {
197 lapb_dbg(1,
"(%p) S2 RX {SABM,SABME}(%d)\n",
198 lapb->
dev, frame->
pf);
235 lapb_dbg(1,
"(%p) S2 RX {I,REJ,RNR,RR}(%d)\n",
236 lapb->
dev, frame->
pf);
251 static void lapb_state3_machine(
struct lapb_cb *lapb,
struct sk_buff *skb,
258 switch (frame->
type) {
263 lapb->
dev, frame->
pf);
268 lapb->
dev, frame->
pf);
286 lapb->
dev, frame->
pf);
299 lapb->
dev, frame->
pf);
327 lapb_dbg(1,
"(%p) S3 RX RNR(%d) R%d\n",
328 lapb->
dev, frame->
pf, frame->
nr);
346 lapb_dbg(1,
"(%p) S3 RX RR(%d) R%d\n",
347 lapb->
dev, frame->
pf, frame->
nr);
365 lapb_dbg(1,
"(%p) S3 RX REJ(%d) R%d\n",
366 lapb->
dev, frame->
pf, frame->
nr);
387 lapb_dbg(1,
"(%p) S3 RX I(%d) S%d R%d\n",
388 lapb->
dev, frame->
pf, frame->
ns, frame->
nr);
405 if (frame->
ns == lapb->
vr) {
420 lapb->
vr = (lapb->
vr + 1) % modulus;
436 lapb_dbg(1,
"(%p) S3 TX REJ(%d) R%d\n",
437 lapb->
dev, frame->
pf, lapb->
vr);
447 lapb_dbg(1,
"(%p) S3 RX FRMR(%d) %02X %02X %02X %02X %02X\n",
448 lapb->
dev, frame->
pf,
458 lapb_dbg(1,
"(%p) S3 RX ILLEGAL(%d)\n", lapb->
dev, frame->
pf);
478 static void lapb_state4_machine(
struct lapb_cb *lapb,
struct sk_buff *skb,
481 switch (frame->
type) {
486 lapb->
dev, frame->
pf);
491 lapb->
dev, frame->
pf);
511 lapb->
dev, frame->
pf);
526 lapb->
dev, frame->
pf);
548 switch (lapb->
state) {
550 lapb_state0_machine(lapb, skb, &frame);
break;
552 lapb_state1_machine(lapb, skb, &frame);
break;
554 lapb_state2_machine(lapb, skb, &frame);
break;
556 lapb_state3_machine(lapb, skb, &frame);
break;
558 lapb_state4_machine(lapb, skb, &frame);
break;