Lines Matching refs:hdlc
171 static inline struct frad_state* state(hdlc_device *hdlc) in state() argument
173 return(struct frad_state *)(hdlc->state); in state()
177 static inline struct pvc_device *find_pvc(hdlc_device *hdlc, u16 dlci) in find_pvc() argument
179 struct pvc_device *pvc = state(hdlc)->first_pvc; in find_pvc()
195 hdlc_device *hdlc = dev_to_hdlc(dev); in add_pvc() local
196 struct pvc_device *pvc, **pvc_p = &state(hdlc)->first_pvc; in add_pvc()
247 static inline void delete_unused_pvcs(hdlc_device *hdlc) in delete_unused_pvcs() argument
249 struct pvc_device **pvc_p = &state(hdlc)->first_pvc; in delete_unused_pvcs()
352 hdlc_device *hdlc = dev_to_hdlc(pvc->frad); in pvc_open() local
353 if (state(hdlc)->settings.lmi == LMI_NONE) in pvc_open()
357 state(hdlc)->dce_changed = 1; in pvc_open()
369 hdlc_device *hdlc = dev_to_hdlc(pvc->frad); in pvc_close() local
370 if (state(hdlc)->settings.lmi == LMI_NONE) in pvc_close()
373 if (state(hdlc)->settings.dce) { in pvc_close()
374 state(hdlc)->dce_changed = 1; in pvc_close()
471 hdlc_device *hdlc = dev_to_hdlc(dev); in fr_lmi_send() local
473 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_lmi_send()
474 int lmi = state(hdlc)->settings.lmi; in fr_lmi_send()
475 int dce = state(hdlc)->settings.dce; in fr_lmi_send()
482 len += state(hdlc)->dce_pvc_count * (2 + stat_len); in fr_lmi_send()
514 data[i++] = state(hdlc)->txseq = in fr_lmi_send()
515 fr_lmi_nextseq(state(hdlc)->txseq); in fr_lmi_send()
516 data[i++] = state(hdlc)->rxseq; in fr_lmi_send()
525 if (state(hdlc)->reliable && !pvc->state.exist) { in fr_lmi_send()
569 hdlc_device *hdlc = dev_to_hdlc(dev); in fr_set_link_state() local
570 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_set_link_state()
572 state(hdlc)->reliable = reliable; in fr_set_link_state()
575 state(hdlc)->n391cnt = 0; /* Request full status */ in fr_set_link_state()
576 state(hdlc)->dce_changed = 1; in fr_set_link_state()
578 if (state(hdlc)->settings.lmi == LMI_NONE) { in fr_set_link_state()
592 if (!state(hdlc)->settings.dce) in fr_set_link_state()
603 hdlc_device *hdlc = dev_to_hdlc(dev); in fr_timer() local
607 if (state(hdlc)->settings.dce) { in fr_timer()
608 reliable = state(hdlc)->request && in fr_timer()
609 time_before(jiffies, state(hdlc)->last_poll + in fr_timer()
610 state(hdlc)->settings.t392 * HZ); in fr_timer()
611 state(hdlc)->request = 0; in fr_timer()
613 state(hdlc)->last_errors <<= 1; /* Shift the list */ in fr_timer()
614 if (state(hdlc)->request) { in fr_timer()
615 if (state(hdlc)->reliable) in fr_timer()
617 state(hdlc)->last_errors |= 1; in fr_timer()
620 list = state(hdlc)->last_errors; in fr_timer()
621 for (i = 0; i < state(hdlc)->settings.n393; i++, list >>= 1) in fr_timer()
624 reliable = (cnt < state(hdlc)->settings.n392); in fr_timer()
627 if (state(hdlc)->reliable != reliable) { in fr_timer()
632 if (state(hdlc)->settings.dce) in fr_timer()
633 state(hdlc)->timer.expires = jiffies + in fr_timer()
634 state(hdlc)->settings.t392 * HZ; in fr_timer()
636 if (state(hdlc)->n391cnt) in fr_timer()
637 state(hdlc)->n391cnt--; in fr_timer()
639 fr_lmi_send(dev, state(hdlc)->n391cnt == 0); in fr_timer()
641 state(hdlc)->last_poll = jiffies; in fr_timer()
642 state(hdlc)->request = 1; in fr_timer()
643 state(hdlc)->timer.expires = jiffies + in fr_timer()
644 state(hdlc)->settings.t391 * HZ; in fr_timer()
647 state(hdlc)->timer.function = fr_timer; in fr_timer()
648 state(hdlc)->timer.data = arg; in fr_timer()
649 add_timer(&state(hdlc)->timer); in fr_timer()
655 hdlc_device *hdlc = dev_to_hdlc(dev); in fr_lmi_recv() local
658 int lmi = state(hdlc)->settings.lmi; in fr_lmi_recv()
659 int dce = state(hdlc)->settings.dce; in fr_lmi_recv()
730 state(hdlc)->rxseq = skb->data[i++]; /* TX sequence from peer */ in fr_lmi_recv()
733 txseq = state(hdlc)->txseq; in fr_lmi_recv()
736 state(hdlc)->last_poll = jiffies; in fr_lmi_recv()
739 if (!state(hdlc)->reliable) in fr_lmi_recv()
743 state(hdlc)->n391cnt = 0; in fr_lmi_recv()
748 if (state(hdlc)->fullrep_sent && !error) { in fr_lmi_recv()
750 state(hdlc)->fullrep_sent = 0; in fr_lmi_recv()
751 pvc = state(hdlc)->first_pvc; in fr_lmi_recv()
757 state(hdlc)->dce_changed = 1; in fr_lmi_recv()
763 if (state(hdlc)->dce_changed) { in fr_lmi_recv()
765 state(hdlc)->fullrep_sent = 1; in fr_lmi_recv()
766 state(hdlc)->dce_changed = 0; in fr_lmi_recv()
769 state(hdlc)->request = 1; /* got request */ in fr_lmi_recv()
776 state(hdlc)->request = 0; /* got response, no request pending */ in fr_lmi_recv()
784 pvc = state(hdlc)->first_pvc; in fr_lmi_recv()
849 pvc = state(hdlc)->first_pvc; in fr_lmi_recv()
863 state(hdlc)->n391cnt = state(hdlc)->settings.n391; in fr_lmi_recv()
872 hdlc_device *hdlc = dev_to_hdlc(frad); in fr_rx() local
885 (state(hdlc)->settings.lmi == LMI_ANSI || in fr_rx()
886 state(hdlc)->settings.lmi == LMI_CCITT)) || in fr_rx()
888 state(hdlc)->settings.lmi == LMI_CISCO)) { in fr_rx()
895 pvc = find_pvc(hdlc, dlci); in fr_rx()
993 hdlc_device *hdlc = dev_to_hdlc(dev); in fr_start() local
997 if (state(hdlc)->settings.lmi != LMI_NONE) { in fr_start()
998 state(hdlc)->reliable = 0; in fr_start()
999 state(hdlc)->dce_changed = 1; in fr_start()
1000 state(hdlc)->request = 0; in fr_start()
1001 state(hdlc)->fullrep_sent = 0; in fr_start()
1002 state(hdlc)->last_errors = 0xFFFFFFFF; in fr_start()
1003 state(hdlc)->n391cnt = 0; in fr_start()
1004 state(hdlc)->txseq = state(hdlc)->rxseq = 0; in fr_start()
1006 init_timer(&state(hdlc)->timer); in fr_start()
1008 state(hdlc)->timer.expires = jiffies + HZ; in fr_start()
1009 state(hdlc)->timer.function = fr_timer; in fr_start()
1010 state(hdlc)->timer.data = (unsigned long)dev; in fr_start()
1011 add_timer(&state(hdlc)->timer); in fr_start()
1019 hdlc_device *hdlc = dev_to_hdlc(dev); in fr_stop() local
1023 if (state(hdlc)->settings.lmi != LMI_NONE) in fr_stop()
1024 del_timer_sync(&state(hdlc)->timer); in fr_stop()
1031 hdlc_device *hdlc = dev_to_hdlc(dev); in fr_close() local
1032 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_close()
1063 hdlc_device *hdlc = dev_to_hdlc(frad); in fr_add_pvc() local
1086 delete_unused_pvcs(hdlc); in fr_add_pvc()
1104 delete_unused_pvcs(hdlc); in fr_add_pvc()
1111 state(hdlc)->dce_changed = 1; in fr_add_pvc()
1112 state(hdlc)->dce_pvc_count++; in fr_add_pvc()
1119 static int fr_del_pvc(hdlc_device *hdlc, unsigned int dlci, int type) in fr_del_pvc() argument
1124 if ((pvc = find_pvc(hdlc, dlci)) == NULL) in fr_del_pvc()
1137 state(hdlc)->dce_pvc_count--; in fr_del_pvc()
1138 state(hdlc)->dce_changed = 1; in fr_del_pvc()
1140 delete_unused_pvcs(hdlc); in fr_del_pvc()
1148 hdlc_device *hdlc = dev_to_hdlc(frad); in fr_destroy() local
1149 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_destroy()
1150 state(hdlc)->first_pvc = NULL; /* All PVCs destroyed */ in fr_destroy()
1151 state(hdlc)->dce_pvc_count = 0; in fr_destroy()
1152 state(hdlc)->dce_changed = 1; in fr_destroy()
1185 hdlc_device *hdlc = dev_to_hdlc(dev); in fr_ioctl() local
1198 if (copy_to_user(fr_s, &state(hdlc)->settings, size)) in fr_ioctl()
1229 result=hdlc->attach(dev, ENCODING_NRZ,PARITY_CRC16_PR1_CCITT); in fr_ioctl()
1238 state(hdlc)->first_pvc = NULL; in fr_ioctl()
1239 state(hdlc)->dce_pvc_count = 0; in fr_ioctl()
1241 memcpy(&state(hdlc)->settings, &new_settings, size); in fr_ioctl()
1272 return fr_del_pvc(hdlc, pvc.dlci, result); in fr_ioctl()