Lines Matching refs:hdlc
162 static inline struct frad_state *state(hdlc_device *hdlc) in state() argument
164 return (struct frad_state *)(hdlc->state); in state()
167 static inline struct pvc_device *find_pvc(hdlc_device *hdlc, u16 dlci) in find_pvc() argument
169 struct pvc_device *pvc = state(hdlc)->first_pvc; in find_pvc()
184 hdlc_device *hdlc = dev_to_hdlc(dev); in add_pvc() local
185 struct pvc_device *pvc, **pvc_p = &state(hdlc)->first_pvc; in add_pvc()
233 static inline void delete_unused_pvcs(hdlc_device *hdlc) in delete_unused_pvcs() argument
235 struct pvc_device **pvc_p = &state(hdlc)->first_pvc; in delete_unused_pvcs()
331 hdlc_device *hdlc = dev_to_hdlc(pvc->frad); in pvc_open() local
333 if (state(hdlc)->settings.lmi == LMI_NONE) in pvc_open()
337 state(hdlc)->dce_changed = 1; in pvc_open()
347 hdlc_device *hdlc = dev_to_hdlc(pvc->frad); in pvc_close() local
349 if (state(hdlc)->settings.lmi == LMI_NONE) in pvc_close()
352 if (state(hdlc)->settings.dce) { in pvc_close()
353 state(hdlc)->dce_changed = 1; in pvc_close()
458 hdlc_device *hdlc = dev_to_hdlc(dev); in fr_lmi_send() local
460 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_lmi_send()
461 int lmi = state(hdlc)->settings.lmi; in fr_lmi_send()
462 int dce = state(hdlc)->settings.dce; in fr_lmi_send()
469 len += state(hdlc)->dce_pvc_count * (2 + stat_len); in fr_lmi_send()
498 data[i++] = state(hdlc)->txseq = in fr_lmi_send()
499 fr_lmi_nextseq(state(hdlc)->txseq); in fr_lmi_send()
500 data[i++] = state(hdlc)->rxseq; in fr_lmi_send()
509 if (state(hdlc)->reliable && !pvc->state.exist) { in fr_lmi_send()
552 hdlc_device *hdlc = dev_to_hdlc(dev); in fr_set_link_state() local
553 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_set_link_state()
555 state(hdlc)->reliable = reliable; in fr_set_link_state()
558 state(hdlc)->n391cnt = 0; /* Request full status */ in fr_set_link_state()
559 state(hdlc)->dce_changed = 1; in fr_set_link_state()
561 if (state(hdlc)->settings.lmi == LMI_NONE) { in fr_set_link_state()
575 if (!state(hdlc)->settings.dce) in fr_set_link_state()
586 hdlc_device *hdlc = dev_to_hdlc(dev); in fr_timer() local
590 if (state(hdlc)->settings.dce) { in fr_timer()
591 reliable = state(hdlc)->request && in fr_timer()
592 time_before(jiffies, state(hdlc)->last_poll + in fr_timer()
593 state(hdlc)->settings.t392 * HZ); in fr_timer()
594 state(hdlc)->request = 0; in fr_timer()
596 state(hdlc)->last_errors <<= 1; /* Shift the list */ in fr_timer()
597 if (state(hdlc)->request) { in fr_timer()
598 if (state(hdlc)->reliable) in fr_timer()
600 state(hdlc)->last_errors |= 1; in fr_timer()
603 list = state(hdlc)->last_errors; in fr_timer()
604 for (i = 0; i < state(hdlc)->settings.n393; i++, list >>= 1) in fr_timer()
607 reliable = (cnt < state(hdlc)->settings.n392); in fr_timer()
610 if (state(hdlc)->reliable != reliable) { in fr_timer()
615 if (state(hdlc)->settings.dce) { in fr_timer()
616 state(hdlc)->timer.expires = jiffies + in fr_timer()
617 state(hdlc)->settings.t392 * HZ; in fr_timer()
619 if (state(hdlc)->n391cnt) in fr_timer()
620 state(hdlc)->n391cnt--; in fr_timer()
622 fr_lmi_send(dev, state(hdlc)->n391cnt == 0); in fr_timer()
624 state(hdlc)->last_poll = jiffies; in fr_timer()
625 state(hdlc)->request = 1; in fr_timer()
626 state(hdlc)->timer.expires = jiffies + in fr_timer()
627 state(hdlc)->settings.t391 * HZ; in fr_timer()
630 add_timer(&state(hdlc)->timer); in fr_timer()
635 hdlc_device *hdlc = dev_to_hdlc(dev); in fr_lmi_recv() local
638 int lmi = state(hdlc)->settings.lmi; in fr_lmi_recv()
639 int dce = state(hdlc)->settings.dce; in fr_lmi_recv()
711 state(hdlc)->rxseq = skb->data[i++]; /* TX sequence from peer */ in fr_lmi_recv()
714 txseq = state(hdlc)->txseq; in fr_lmi_recv()
717 state(hdlc)->last_poll = jiffies; in fr_lmi_recv()
720 if (!state(hdlc)->reliable) in fr_lmi_recv()
724 state(hdlc)->n391cnt = 0; in fr_lmi_recv()
729 if (state(hdlc)->fullrep_sent && !error) { in fr_lmi_recv()
731 state(hdlc)->fullrep_sent = 0; in fr_lmi_recv()
732 pvc = state(hdlc)->first_pvc; in fr_lmi_recv()
738 state(hdlc)->dce_changed = 1; in fr_lmi_recv()
744 if (state(hdlc)->dce_changed) { in fr_lmi_recv()
746 state(hdlc)->fullrep_sent = 1; in fr_lmi_recv()
747 state(hdlc)->dce_changed = 0; in fr_lmi_recv()
750 state(hdlc)->request = 1; /* got request */ in fr_lmi_recv()
757 state(hdlc)->request = 0; /* got response, no request pending */ in fr_lmi_recv()
765 pvc = state(hdlc)->first_pvc; in fr_lmi_recv()
830 pvc = state(hdlc)->first_pvc; in fr_lmi_recv()
844 state(hdlc)->n391cnt = state(hdlc)->settings.n391; in fr_lmi_recv()
892 hdlc_device *hdlc = dev_to_hdlc(frad); in fr_rx() local
905 (state(hdlc)->settings.lmi == LMI_ANSI || in fr_rx()
906 state(hdlc)->settings.lmi == LMI_CCITT)) || in fr_rx()
908 state(hdlc)->settings.lmi == LMI_CISCO)) { in fr_rx()
915 pvc = find_pvc(hdlc, dlci); in fr_rx()
998 hdlc_device *hdlc = dev_to_hdlc(dev); in fr_start() local
1002 if (state(hdlc)->settings.lmi != LMI_NONE) { in fr_start()
1003 state(hdlc)->reliable = 0; in fr_start()
1004 state(hdlc)->dce_changed = 1; in fr_start()
1005 state(hdlc)->request = 0; in fr_start()
1006 state(hdlc)->fullrep_sent = 0; in fr_start()
1007 state(hdlc)->last_errors = 0xFFFFFFFF; in fr_start()
1008 state(hdlc)->n391cnt = 0; in fr_start()
1009 state(hdlc)->txseq = state(hdlc)->rxseq = 0; in fr_start()
1011 state(hdlc)->dev = dev; in fr_start()
1012 timer_setup(&state(hdlc)->timer, fr_timer, 0); in fr_start()
1014 state(hdlc)->timer.expires = jiffies + HZ; in fr_start()
1015 add_timer(&state(hdlc)->timer); in fr_start()
1023 hdlc_device *hdlc = dev_to_hdlc(dev); in fr_stop() local
1027 if (state(hdlc)->settings.lmi != LMI_NONE) in fr_stop()
1028 del_timer_sync(&state(hdlc)->timer); in fr_stop()
1034 hdlc_device *hdlc = dev_to_hdlc(dev); in fr_close() local
1035 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_close()
1064 hdlc_device *hdlc = dev_to_hdlc(frad); in fr_add_pvc() local
1088 delete_unused_pvcs(hdlc); in fr_add_pvc()
1111 delete_unused_pvcs(hdlc); in fr_add_pvc()
1118 state(hdlc)->dce_changed = 1; in fr_add_pvc()
1119 state(hdlc)->dce_pvc_count++; in fr_add_pvc()
1124 static int fr_del_pvc(hdlc_device *hdlc, unsigned int dlci, int type) in fr_del_pvc() argument
1129 pvc = find_pvc(hdlc, dlci); in fr_del_pvc()
1144 state(hdlc)->dce_pvc_count--; in fr_del_pvc()
1145 state(hdlc)->dce_changed = 1; in fr_del_pvc()
1147 delete_unused_pvcs(hdlc); in fr_del_pvc()
1153 hdlc_device *hdlc = dev_to_hdlc(frad); in fr_destroy() local
1154 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_destroy()
1156 state(hdlc)->first_pvc = NULL; /* All PVCs destroyed */ in fr_destroy()
1157 state(hdlc)->dce_pvc_count = 0; in fr_destroy()
1158 state(hdlc)->dce_changed = 1; in fr_destroy()
1189 hdlc_device *hdlc = dev_to_hdlc(dev); in fr_ioctl() local
1202 if (copy_to_user(fr_s, &state(hdlc)->settings, size)) in fr_ioctl()
1233 result = hdlc->attach(dev, ENCODING_NRZ, in fr_ioctl()
1243 state(hdlc)->first_pvc = NULL; in fr_ioctl()
1244 state(hdlc)->dce_pvc_count = 0; in fr_ioctl()
1246 memcpy(&state(hdlc)->settings, &new_settings, size); in fr_ioctl()
1278 return fr_del_pvc(hdlc, pvc.dlci, result); in fr_ioctl()