Lines Matching refs:hdlc

169 static inline struct frad_state* state(hdlc_device *hdlc)  in state()  argument
171 return(struct frad_state *)(hdlc->state); in state()
175 static inline struct pvc_device *find_pvc(hdlc_device *hdlc, u16 dlci) in find_pvc() argument
177 struct pvc_device *pvc = state(hdlc)->first_pvc; in find_pvc()
193 hdlc_device *hdlc = dev_to_hdlc(dev); in add_pvc() local
194 struct pvc_device *pvc, **pvc_p = &state(hdlc)->first_pvc; in add_pvc()
245 static inline void delete_unused_pvcs(hdlc_device *hdlc) in delete_unused_pvcs() argument
247 struct pvc_device **pvc_p = &state(hdlc)->first_pvc; in delete_unused_pvcs()
350 hdlc_device *hdlc = dev_to_hdlc(pvc->frad); in pvc_open() local
351 if (state(hdlc)->settings.lmi == LMI_NONE) in pvc_open()
355 state(hdlc)->dce_changed = 1; in pvc_open()
367 hdlc_device *hdlc = dev_to_hdlc(pvc->frad); in pvc_close() local
368 if (state(hdlc)->settings.lmi == LMI_NONE) in pvc_close()
371 if (state(hdlc)->settings.dce) { in pvc_close()
372 state(hdlc)->dce_changed = 1; in pvc_close()
469 hdlc_device *hdlc = dev_to_hdlc(dev); in fr_lmi_send() local
471 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_lmi_send()
472 int lmi = state(hdlc)->settings.lmi; in fr_lmi_send()
473 int dce = state(hdlc)->settings.dce; in fr_lmi_send()
480 len += state(hdlc)->dce_pvc_count * (2 + stat_len); in fr_lmi_send()
512 data[i++] = state(hdlc)->txseq = in fr_lmi_send()
513 fr_lmi_nextseq(state(hdlc)->txseq); in fr_lmi_send()
514 data[i++] = state(hdlc)->rxseq; in fr_lmi_send()
523 if (state(hdlc)->reliable && !pvc->state.exist) { in fr_lmi_send()
567 hdlc_device *hdlc = dev_to_hdlc(dev); in fr_set_link_state() local
568 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_set_link_state()
570 state(hdlc)->reliable = reliable; in fr_set_link_state()
573 state(hdlc)->n391cnt = 0; /* Request full status */ in fr_set_link_state()
574 state(hdlc)->dce_changed = 1; in fr_set_link_state()
576 if (state(hdlc)->settings.lmi == LMI_NONE) { in fr_set_link_state()
590 if (!state(hdlc)->settings.dce) in fr_set_link_state()
602 hdlc_device *hdlc = dev_to_hdlc(dev); in fr_timer() local
606 if (state(hdlc)->settings.dce) { in fr_timer()
607 reliable = state(hdlc)->request && in fr_timer()
608 time_before(jiffies, state(hdlc)->last_poll + in fr_timer()
609 state(hdlc)->settings.t392 * HZ); in fr_timer()
610 state(hdlc)->request = 0; in fr_timer()
612 state(hdlc)->last_errors <<= 1; /* Shift the list */ in fr_timer()
613 if (state(hdlc)->request) { in fr_timer()
614 if (state(hdlc)->reliable) in fr_timer()
616 state(hdlc)->last_errors |= 1; in fr_timer()
619 list = state(hdlc)->last_errors; in fr_timer()
620 for (i = 0; i < state(hdlc)->settings.n393; i++, list >>= 1) in fr_timer()
623 reliable = (cnt < state(hdlc)->settings.n392); in fr_timer()
626 if (state(hdlc)->reliable != reliable) { in fr_timer()
631 if (state(hdlc)->settings.dce) in fr_timer()
632 state(hdlc)->timer.expires = jiffies + in fr_timer()
633 state(hdlc)->settings.t392 * HZ; in fr_timer()
635 if (state(hdlc)->n391cnt) in fr_timer()
636 state(hdlc)->n391cnt--; in fr_timer()
638 fr_lmi_send(dev, state(hdlc)->n391cnt == 0); in fr_timer()
640 state(hdlc)->last_poll = jiffies; in fr_timer()
641 state(hdlc)->request = 1; in fr_timer()
642 state(hdlc)->timer.expires = jiffies + in fr_timer()
643 state(hdlc)->settings.t391 * HZ; in fr_timer()
646 add_timer(&state(hdlc)->timer); in fr_timer()
652 hdlc_device *hdlc = dev_to_hdlc(dev); in fr_lmi_recv() local
655 int lmi = state(hdlc)->settings.lmi; in fr_lmi_recv()
656 int dce = state(hdlc)->settings.dce; in fr_lmi_recv()
727 state(hdlc)->rxseq = skb->data[i++]; /* TX sequence from peer */ in fr_lmi_recv()
730 txseq = state(hdlc)->txseq; in fr_lmi_recv()
733 state(hdlc)->last_poll = jiffies; in fr_lmi_recv()
736 if (!state(hdlc)->reliable) in fr_lmi_recv()
740 state(hdlc)->n391cnt = 0; in fr_lmi_recv()
745 if (state(hdlc)->fullrep_sent && !error) { in fr_lmi_recv()
747 state(hdlc)->fullrep_sent = 0; in fr_lmi_recv()
748 pvc = state(hdlc)->first_pvc; in fr_lmi_recv()
754 state(hdlc)->dce_changed = 1; in fr_lmi_recv()
760 if (state(hdlc)->dce_changed) { in fr_lmi_recv()
762 state(hdlc)->fullrep_sent = 1; in fr_lmi_recv()
763 state(hdlc)->dce_changed = 0; in fr_lmi_recv()
766 state(hdlc)->request = 1; /* got request */ in fr_lmi_recv()
773 state(hdlc)->request = 0; /* got response, no request pending */ in fr_lmi_recv()
781 pvc = state(hdlc)->first_pvc; in fr_lmi_recv()
846 pvc = state(hdlc)->first_pvc; in fr_lmi_recv()
860 state(hdlc)->n391cnt = state(hdlc)->settings.n391; in fr_lmi_recv()
869 hdlc_device *hdlc = dev_to_hdlc(frad); in fr_rx() local
882 (state(hdlc)->settings.lmi == LMI_ANSI || in fr_rx()
883 state(hdlc)->settings.lmi == LMI_CCITT)) || in fr_rx()
885 state(hdlc)->settings.lmi == LMI_CISCO)) { in fr_rx()
892 pvc = find_pvc(hdlc, dlci); in fr_rx()
990 hdlc_device *hdlc = dev_to_hdlc(dev); in fr_start() local
994 if (state(hdlc)->settings.lmi != LMI_NONE) { in fr_start()
995 state(hdlc)->reliable = 0; in fr_start()
996 state(hdlc)->dce_changed = 1; in fr_start()
997 state(hdlc)->request = 0; in fr_start()
998 state(hdlc)->fullrep_sent = 0; in fr_start()
999 state(hdlc)->last_errors = 0xFFFFFFFF; in fr_start()
1000 state(hdlc)->n391cnt = 0; in fr_start()
1001 state(hdlc)->txseq = state(hdlc)->rxseq = 0; in fr_start()
1003 state(hdlc)->dev = dev; in fr_start()
1004 timer_setup(&state(hdlc)->timer, fr_timer, 0); in fr_start()
1006 state(hdlc)->timer.expires = jiffies + HZ; in fr_start()
1007 add_timer(&state(hdlc)->timer); in fr_start()
1015 hdlc_device *hdlc = dev_to_hdlc(dev); in fr_stop() local
1019 if (state(hdlc)->settings.lmi != LMI_NONE) in fr_stop()
1020 del_timer_sync(&state(hdlc)->timer); in fr_stop()
1027 hdlc_device *hdlc = dev_to_hdlc(dev); in fr_close() local
1028 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_close()
1058 hdlc_device *hdlc = dev_to_hdlc(frad); in fr_add_pvc() local
1081 delete_unused_pvcs(hdlc); in fr_add_pvc()
1101 delete_unused_pvcs(hdlc); in fr_add_pvc()
1108 state(hdlc)->dce_changed = 1; in fr_add_pvc()
1109 state(hdlc)->dce_pvc_count++; in fr_add_pvc()
1116 static int fr_del_pvc(hdlc_device *hdlc, unsigned int dlci, int type) in fr_del_pvc() argument
1121 if ((pvc = find_pvc(hdlc, dlci)) == NULL) in fr_del_pvc()
1134 state(hdlc)->dce_pvc_count--; in fr_del_pvc()
1135 state(hdlc)->dce_changed = 1; in fr_del_pvc()
1137 delete_unused_pvcs(hdlc); in fr_del_pvc()
1145 hdlc_device *hdlc = dev_to_hdlc(frad); in fr_destroy() local
1146 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_destroy()
1147 state(hdlc)->first_pvc = NULL; /* All PVCs destroyed */ in fr_destroy()
1148 state(hdlc)->dce_pvc_count = 0; in fr_destroy()
1149 state(hdlc)->dce_changed = 1; in fr_destroy()
1182 hdlc_device *hdlc = dev_to_hdlc(dev); in fr_ioctl() local
1195 if (copy_to_user(fr_s, &state(hdlc)->settings, size)) in fr_ioctl()
1226 result=hdlc->attach(dev, ENCODING_NRZ,PARITY_CRC16_PR1_CCITT); in fr_ioctl()
1235 state(hdlc)->first_pvc = NULL; in fr_ioctl()
1236 state(hdlc)->dce_pvc_count = 0; in fr_ioctl()
1238 memcpy(&state(hdlc)->settings, &new_settings, size); in fr_ioctl()
1270 return fr_del_pvc(hdlc, pvc.dlci, result); in fr_ioctl()