Lines Matching refs:lapb
42 static void lapb_state0_machine(struct lapb_cb *lapb, struct sk_buff *skb, in lapb_state0_machine() argument
49 lapb->dev, frame->pf); in lapb_state0_machine()
51 if (lapb->mode & LAPB_EXTENDED) { in lapb_state0_machine()
54 lapb->dev, frame->pf); in lapb_state0_machine()
56 lapb_send_control(lapb, LAPB_DM, frame->pf, in lapb_state0_machine()
61 lapb->dev, frame->pf); in lapb_state0_machine()
65 lapb->dev); in lapb_state0_machine()
67 lapb_send_control(lapb, LAPB_UA, frame->pf, in lapb_state0_machine()
69 lapb_stop_t1timer(lapb); in lapb_state0_machine()
70 lapb_stop_t2timer(lapb); in lapb_state0_machine()
71 lapb->state = LAPB_STATE_3; in lapb_state0_machine()
72 lapb->condition = 0x00; in lapb_state0_machine()
73 lapb->n2count = 0; in lapb_state0_machine()
74 lapb->vs = 0; in lapb_state0_machine()
75 lapb->vr = 0; in lapb_state0_machine()
76 lapb->va = 0; in lapb_state0_machine()
77 lapb_connect_indication(lapb, LAPB_OK); in lapb_state0_machine()
84 lapb->dev, frame->pf); in lapb_state0_machine()
86 if (lapb->mode & LAPB_EXTENDED) { in lapb_state0_machine()
89 lapb->dev, frame->pf); in lapb_state0_machine()
93 lapb->dev); in lapb_state0_machine()
95 lapb_send_control(lapb, LAPB_UA, frame->pf, in lapb_state0_machine()
97 lapb_stop_t1timer(lapb); in lapb_state0_machine()
98 lapb_stop_t2timer(lapb); in lapb_state0_machine()
99 lapb->state = LAPB_STATE_3; in lapb_state0_machine()
100 lapb->condition = 0x00; in lapb_state0_machine()
101 lapb->n2count = 0; in lapb_state0_machine()
102 lapb->vs = 0; in lapb_state0_machine()
103 lapb->vr = 0; in lapb_state0_machine()
104 lapb->va = 0; in lapb_state0_machine()
105 lapb_connect_indication(lapb, LAPB_OK); in lapb_state0_machine()
109 lapb->dev, frame->pf); in lapb_state0_machine()
111 lapb_send_control(lapb, LAPB_DM, frame->pf, in lapb_state0_machine()
119 lapb->dev, frame->pf); in lapb_state0_machine()
121 lapb->dev, frame->pf); in lapb_state0_machine()
123 lapb_send_control(lapb, LAPB_UA, frame->pf, in lapb_state0_machine()
138 static void lapb_state1_machine(struct lapb_cb *lapb, struct sk_buff *skb, in lapb_state1_machine() argument
145 lapb->dev, frame->pf); in lapb_state1_machine()
147 if (lapb->mode & LAPB_EXTENDED) { in lapb_state1_machine()
150 lapb->dev, frame->pf); in lapb_state1_machine()
152 lapb_send_control(lapb, LAPB_DM, frame->pf, in lapb_state1_machine()
157 lapb->dev, frame->pf); in lapb_state1_machine()
159 lapb_send_control(lapb, LAPB_UA, frame->pf, in lapb_state1_machine()
167 lapb->dev, frame->pf); in lapb_state1_machine()
169 if (lapb->mode & LAPB_EXTENDED) { in lapb_state1_machine()
172 lapb->dev, frame->pf); in lapb_state1_machine()
174 lapb_send_control(lapb, LAPB_UA, frame->pf, in lapb_state1_machine()
179 lapb->dev, frame->pf); in lapb_state1_machine()
181 lapb_send_control(lapb, LAPB_DM, frame->pf, in lapb_state1_machine()
189 lapb->dev, frame->pf); in lapb_state1_machine()
191 lapb->dev, frame->pf); in lapb_state1_machine()
193 lapb_send_control(lapb, LAPB_DM, frame->pf, in lapb_state1_machine()
200 lapb->dev, frame->pf); in lapb_state1_machine()
205 lapb->dev); in lapb_state1_machine()
207 lapb_stop_t1timer(lapb); in lapb_state1_machine()
208 lapb_stop_t2timer(lapb); in lapb_state1_machine()
209 lapb->state = LAPB_STATE_3; in lapb_state1_machine()
210 lapb->condition = 0x00; in lapb_state1_machine()
211 lapb->n2count = 0; in lapb_state1_machine()
212 lapb->vs = 0; in lapb_state1_machine()
213 lapb->vr = 0; in lapb_state1_machine()
214 lapb->va = 0; in lapb_state1_machine()
215 lapb_connect_confirmation(lapb, LAPB_OK); in lapb_state1_machine()
222 lapb->dev, frame->pf); in lapb_state1_machine()
227 lapb->dev); in lapb_state1_machine()
229 lapb_clear_queues(lapb); in lapb_state1_machine()
230 lapb->state = LAPB_STATE_0; in lapb_state1_machine()
231 lapb_start_t1timer(lapb); in lapb_state1_machine()
232 lapb_stop_t2timer(lapb); in lapb_state1_machine()
233 lapb_disconnect_indication(lapb, LAPB_REFUSED); in lapb_state1_machine()
245 static void lapb_state2_machine(struct lapb_cb *lapb, struct sk_buff *skb, in lapb_state2_machine() argument
253 lapb->dev, frame->pf); in lapb_state2_machine()
255 lapb->dev, frame->pf); in lapb_state2_machine()
257 lapb_send_control(lapb, LAPB_DM, frame->pf, in lapb_state2_machine()
264 lapb->dev, frame->pf); in lapb_state2_machine()
266 lapb->dev, frame->pf); in lapb_state2_machine()
268 lapb_send_control(lapb, LAPB_UA, frame->pf, in lapb_state2_machine()
275 lapb->dev, frame->pf); in lapb_state2_machine()
280 lapb->dev); in lapb_state2_machine()
282 lapb->state = LAPB_STATE_0; in lapb_state2_machine()
283 lapb_start_t1timer(lapb); in lapb_state2_machine()
284 lapb_stop_t2timer(lapb); in lapb_state2_machine()
285 lapb_disconnect_confirmation(lapb, LAPB_OK); in lapb_state2_machine()
292 lapb->dev, frame->pf); in lapb_state2_machine()
297 lapb->dev); in lapb_state2_machine()
299 lapb->state = LAPB_STATE_0; in lapb_state2_machine()
300 lapb_start_t1timer(lapb); in lapb_state2_machine()
301 lapb_stop_t2timer(lapb); in lapb_state2_machine()
302 lapb_disconnect_confirmation(lapb, in lapb_state2_machine()
313 "(%d)\n", lapb->dev, frame->pf); in lapb_state2_machine()
315 lapb->dev, frame->pf); in lapb_state2_machine()
318 lapb_send_control(lapb, LAPB_DM, frame->pf, in lapb_state2_machine()
330 static void lapb_state3_machine(struct lapb_cb *lapb, struct sk_buff *skb, in lapb_state3_machine() argument
334 int modulus = (lapb->mode & LAPB_EXTENDED) ? LAPB_EMODULUS : in lapb_state3_machine()
341 lapb->dev, frame->pf); in lapb_state3_machine()
343 if (lapb->mode & LAPB_EXTENDED) { in lapb_state3_machine()
346 lapb->dev, frame->pf); in lapb_state3_machine()
348 lapb_send_control(lapb, LAPB_DM, frame->pf, in lapb_state3_machine()
353 lapb->dev, frame->pf); in lapb_state3_machine()
355 lapb_send_control(lapb, LAPB_UA, frame->pf, in lapb_state3_machine()
357 lapb_stop_t1timer(lapb); in lapb_state3_machine()
358 lapb_stop_t2timer(lapb); in lapb_state3_machine()
359 lapb->condition = 0x00; in lapb_state3_machine()
360 lapb->n2count = 0; in lapb_state3_machine()
361 lapb->vs = 0; in lapb_state3_machine()
362 lapb->vr = 0; in lapb_state3_machine()
363 lapb->va = 0; in lapb_state3_machine()
364 lapb_requeue_frames(lapb); in lapb_state3_machine()
371 lapb->dev, frame->pf); in lapb_state3_machine()
373 if (lapb->mode & LAPB_EXTENDED) { in lapb_state3_machine()
376 lapb->dev, frame->pf); in lapb_state3_machine()
378 lapb_send_control(lapb, LAPB_UA, frame->pf, in lapb_state3_machine()
380 lapb_stop_t1timer(lapb); in lapb_state3_machine()
381 lapb_stop_t2timer(lapb); in lapb_state3_machine()
382 lapb->condition = 0x00; in lapb_state3_machine()
383 lapb->n2count = 0; in lapb_state3_machine()
384 lapb->vs = 0; in lapb_state3_machine()
385 lapb->vr = 0; in lapb_state3_machine()
386 lapb->va = 0; in lapb_state3_machine()
387 lapb_requeue_frames(lapb); in lapb_state3_machine()
391 lapb->dev, frame->pf); in lapb_state3_machine()
393 lapb_send_control(lapb, LAPB_DM, frame->pf, in lapb_state3_machine()
401 lapb->dev, frame->pf); in lapb_state3_machine()
405 lapb->dev); in lapb_state3_machine()
407 lapb_clear_queues(lapb); in lapb_state3_machine()
408 lapb_send_control(lapb, LAPB_UA, frame->pf, in lapb_state3_machine()
410 lapb_start_t1timer(lapb); in lapb_state3_machine()
411 lapb_stop_t2timer(lapb); in lapb_state3_machine()
412 lapb->state = LAPB_STATE_0; in lapb_state3_machine()
413 lapb_disconnect_indication(lapb, LAPB_OK); in lapb_state3_machine()
419 lapb->dev, frame->pf); in lapb_state3_machine()
423 lapb->dev); in lapb_state3_machine()
425 lapb_clear_queues(lapb); in lapb_state3_machine()
426 lapb->state = LAPB_STATE_0; in lapb_state3_machine()
427 lapb_start_t1timer(lapb); in lapb_state3_machine()
428 lapb_stop_t2timer(lapb); in lapb_state3_machine()
429 lapb_disconnect_indication(lapb, LAPB_NOTCONNECTED); in lapb_state3_machine()
435 lapb->dev, frame->pf, frame->nr); in lapb_state3_machine()
437 lapb->condition |= LAPB_PEER_RX_BUSY_CONDITION; in lapb_state3_machine()
438 lapb_check_need_response(lapb, frame->cr, frame->pf); in lapb_state3_machine()
439 if (lapb_validate_nr(lapb, frame->nr)) { in lapb_state3_machine()
440 lapb_check_iframes_acked(lapb, frame->nr); in lapb_state3_machine()
442 lapb->frmr_data = *frame; in lapb_state3_machine()
443 lapb->frmr_type = LAPB_FRMR_Z; in lapb_state3_machine()
444 lapb_transmit_frmr(lapb); in lapb_state3_machine()
447 lapb->dev); in lapb_state3_machine()
449 lapb_start_t1timer(lapb); in lapb_state3_machine()
450 lapb_stop_t2timer(lapb); in lapb_state3_machine()
451 lapb->state = LAPB_STATE_4; in lapb_state3_machine()
452 lapb->n2count = 0; in lapb_state3_machine()
459 lapb->dev, frame->pf, frame->nr); in lapb_state3_machine()
461 lapb->condition &= ~LAPB_PEER_RX_BUSY_CONDITION; in lapb_state3_machine()
462 lapb_check_need_response(lapb, frame->cr, frame->pf); in lapb_state3_machine()
463 if (lapb_validate_nr(lapb, frame->nr)) { in lapb_state3_machine()
464 lapb_check_iframes_acked(lapb, frame->nr); in lapb_state3_machine()
466 lapb->frmr_data = *frame; in lapb_state3_machine()
467 lapb->frmr_type = LAPB_FRMR_Z; in lapb_state3_machine()
468 lapb_transmit_frmr(lapb); in lapb_state3_machine()
471 lapb->dev); in lapb_state3_machine()
473 lapb_start_t1timer(lapb); in lapb_state3_machine()
474 lapb_stop_t2timer(lapb); in lapb_state3_machine()
475 lapb->state = LAPB_STATE_4; in lapb_state3_machine()
476 lapb->n2count = 0; in lapb_state3_machine()
483 lapb->dev, frame->pf, frame->nr); in lapb_state3_machine()
485 lapb->condition &= ~LAPB_PEER_RX_BUSY_CONDITION; in lapb_state3_machine()
486 lapb_check_need_response(lapb, frame->cr, frame->pf); in lapb_state3_machine()
487 if (lapb_validate_nr(lapb, frame->nr)) { in lapb_state3_machine()
488 lapb_frames_acked(lapb, frame->nr); in lapb_state3_machine()
489 lapb_stop_t1timer(lapb); in lapb_state3_machine()
490 lapb->n2count = 0; in lapb_state3_machine()
491 lapb_requeue_frames(lapb); in lapb_state3_machine()
493 lapb->frmr_data = *frame; in lapb_state3_machine()
494 lapb->frmr_type = LAPB_FRMR_Z; in lapb_state3_machine()
495 lapb_transmit_frmr(lapb); in lapb_state3_machine()
498 lapb->dev); in lapb_state3_machine()
500 lapb_start_t1timer(lapb); in lapb_state3_machine()
501 lapb_stop_t2timer(lapb); in lapb_state3_machine()
502 lapb->state = LAPB_STATE_4; in lapb_state3_machine()
503 lapb->n2count = 0; in lapb_state3_machine()
510 lapb->dev, frame->pf, frame->ns, frame->nr); in lapb_state3_machine()
512 if (!lapb_validate_nr(lapb, frame->nr)) { in lapb_state3_machine()
513 lapb->frmr_data = *frame; in lapb_state3_machine()
514 lapb->frmr_type = LAPB_FRMR_Z; in lapb_state3_machine()
515 lapb_transmit_frmr(lapb); in lapb_state3_machine()
518 lapb->dev); in lapb_state3_machine()
520 lapb_start_t1timer(lapb); in lapb_state3_machine()
521 lapb_stop_t2timer(lapb); in lapb_state3_machine()
522 lapb->state = LAPB_STATE_4; in lapb_state3_machine()
523 lapb->n2count = 0; in lapb_state3_machine()
526 if (lapb->condition & LAPB_PEER_RX_BUSY_CONDITION) in lapb_state3_machine()
527 lapb_frames_acked(lapb, frame->nr); in lapb_state3_machine()
529 lapb_check_iframes_acked(lapb, frame->nr); in lapb_state3_machine()
531 if (frame->ns == lapb->vr) { in lapb_state3_machine()
533 cn = lapb_data_indication(lapb, skb); in lapb_state3_machine()
547 lapb->vr = (lapb->vr + 1) % modulus; in lapb_state3_machine()
548 lapb->condition &= ~LAPB_REJECT_CONDITION; in lapb_state3_machine()
550 lapb_enquiry_response(lapb); in lapb_state3_machine()
552 if (!(lapb->condition & in lapb_state3_machine()
554 lapb->condition |= LAPB_ACK_PENDING_CONDITION; in lapb_state3_machine()
555 lapb_start_t2timer(lapb); in lapb_state3_machine()
559 if (lapb->condition & LAPB_REJECT_CONDITION) { in lapb_state3_machine()
561 lapb_enquiry_response(lapb); in lapb_state3_machine()
566 lapb->dev, frame->pf, lapb->vr); in lapb_state3_machine()
568 lapb->condition |= LAPB_REJECT_CONDITION; in lapb_state3_machine()
569 lapb_send_control(lapb, LAPB_REJ, in lapb_state3_machine()
572 lapb->condition &= ~LAPB_ACK_PENDING_CONDITION; in lapb_state3_machine()
580 "%02X %02X %02X %02X\n", lapb->dev, frame->pf, in lapb_state3_machine()
584 lapb_establish_data_link(lapb); in lapb_state3_machine()
587 lapb->dev); in lapb_state3_machine()
589 lapb_requeue_frames(lapb); in lapb_state3_machine()
590 lapb->state = LAPB_STATE_1; in lapb_state3_machine()
596 lapb->dev, frame->pf); in lapb_state3_machine()
598 lapb->frmr_data = *frame; in lapb_state3_machine()
599 lapb->frmr_type = LAPB_FRMR_W; in lapb_state3_machine()
600 lapb_transmit_frmr(lapb); in lapb_state3_machine()
602 printk(KERN_DEBUG "lapb: (%p) S3 -> S4\n", lapb->dev); in lapb_state3_machine()
604 lapb_start_t1timer(lapb); in lapb_state3_machine()
605 lapb_stop_t2timer(lapb); in lapb_state3_machine()
606 lapb->state = LAPB_STATE_4; in lapb_state3_machine()
607 lapb->n2count = 0; in lapb_state3_machine()
619 static void lapb_state4_machine(struct lapb_cb *lapb, struct sk_buff *skb, in lapb_state4_machine() argument
626 lapb->dev, frame->pf); in lapb_state4_machine()
628 if (lapb->mode & LAPB_EXTENDED) { in lapb_state4_machine()
631 lapb->dev, frame->pf); in lapb_state4_machine()
633 lapb_send_control(lapb, LAPB_DM, frame->pf, in lapb_state4_machine()
638 lapb->dev, frame->pf); in lapb_state4_machine()
642 lapb->dev); in lapb_state4_machine()
644 lapb_send_control(lapb, LAPB_UA, frame->pf, in lapb_state4_machine()
646 lapb_stop_t1timer(lapb); in lapb_state4_machine()
647 lapb_stop_t2timer(lapb); in lapb_state4_machine()
648 lapb->state = LAPB_STATE_3; in lapb_state4_machine()
649 lapb->condition = 0x00; in lapb_state4_machine()
650 lapb->n2count = 0; in lapb_state4_machine()
651 lapb->vs = 0; in lapb_state4_machine()
652 lapb->vr = 0; in lapb_state4_machine()
653 lapb->va = 0; in lapb_state4_machine()
654 lapb_connect_indication(lapb, LAPB_OK); in lapb_state4_machine()
661 lapb->dev, frame->pf); in lapb_state4_machine()
663 if (lapb->mode & LAPB_EXTENDED) { in lapb_state4_machine()
666 lapb->dev, frame->pf); in lapb_state4_machine()
670 lapb->dev); in lapb_state4_machine()
672 lapb_send_control(lapb, LAPB_UA, frame->pf, in lapb_state4_machine()
674 lapb_stop_t1timer(lapb); in lapb_state4_machine()
675 lapb_stop_t2timer(lapb); in lapb_state4_machine()
676 lapb->state = LAPB_STATE_3; in lapb_state4_machine()
677 lapb->condition = 0x00; in lapb_state4_machine()
678 lapb->n2count = 0; in lapb_state4_machine()
679 lapb->vs = 0; in lapb_state4_machine()
680 lapb->vr = 0; in lapb_state4_machine()
681 lapb->va = 0; in lapb_state4_machine()
682 lapb_connect_indication(lapb, LAPB_OK); in lapb_state4_machine()
686 lapb->dev, frame->pf); in lapb_state4_machine()
688 lapb_send_control(lapb, LAPB_DM, frame->pf, in lapb_state4_machine()
700 void lapb_data_input(struct lapb_cb *lapb, struct sk_buff *skb) in lapb_data_input() argument
704 if (lapb_decode(lapb, skb, &frame) < 0) { in lapb_data_input()
709 switch (lapb->state) { in lapb_data_input()
711 lapb_state0_machine(lapb, skb, &frame); break; in lapb_data_input()
713 lapb_state1_machine(lapb, skb, &frame); break; in lapb_data_input()
715 lapb_state2_machine(lapb, skb, &frame); break; in lapb_data_input()
717 lapb_state3_machine(lapb, skb, &frame); break; in lapb_data_input()
719 lapb_state4_machine(lapb, skb, &frame); break; in lapb_data_input()
722 lapb_kick(lapb); in lapb_data_input()