Lines Matching refs:hdlc
35 #include <linux/hdlc.h>
169 static inline struct frad_state* state(hdlc_device *hdlc)
171 return(struct frad_state *)(hdlc->state);
175 static inline struct pvc_device *find_pvc(hdlc_device *hdlc, u16 dlci)
177 struct pvc_device *pvc = state(hdlc)->first_pvc;
193 hdlc_device *hdlc = dev_to_hdlc(dev);
194 struct pvc_device *pvc, **pvc_p = &state(hdlc)->first_pvc;
245 static inline void delete_unused_pvcs(hdlc_device *hdlc)
247 struct pvc_device **pvc_p = &state(hdlc)->first_pvc;
347 hdlc_device *hdlc = dev_to_hdlc(pvc->frad);
348 if (state(hdlc)->settings.lmi == LMI_NONE)
352 state(hdlc)->dce_changed = 1;
364 hdlc_device *hdlc = dev_to_hdlc(pvc->frad);
365 if (state(hdlc)->settings.lmi == LMI_NONE)
368 if (state(hdlc)->settings.dce) {
369 state(hdlc)->dce_changed = 1;
479 hdlc_device *hdlc = dev_to_hdlc(dev);
481 struct pvc_device *pvc = state(hdlc)->first_pvc;
482 int lmi = state(hdlc)->settings.lmi;
483 int dce = state(hdlc)->settings.dce;
490 len += state(hdlc)->dce_pvc_count * (2 + stat_len);
520 data[i++] = state(hdlc)->txseq =
521 fr_lmi_nextseq(state(hdlc)->txseq);
522 data[i++] = state(hdlc)->rxseq;
531 if (state(hdlc)->reliable && !pvc->state.exist) {
576 hdlc_device *hdlc = dev_to_hdlc(dev);
577 struct pvc_device *pvc = state(hdlc)->first_pvc;
579 state(hdlc)->reliable = reliable;
582 state(hdlc)->n391cnt = 0; /* Request full status */
583 state(hdlc)->dce_changed = 1;
585 if (state(hdlc)->settings.lmi == LMI_NONE) {
599 if (!state(hdlc)->settings.dce)
611 hdlc_device *hdlc = dev_to_hdlc(dev);
615 if (state(hdlc)->settings.dce) {
616 reliable = state(hdlc)->request &&
617 time_before(jiffies, state(hdlc)->last_poll +
618 state(hdlc)->settings.t392 * HZ);
619 state(hdlc)->request = 0;
621 state(hdlc)->last_errors <<= 1; /* Shift the list */
622 if (state(hdlc)->request) {
623 if (state(hdlc)->reliable)
625 state(hdlc)->last_errors |= 1;
628 list = state(hdlc)->last_errors;
629 for (i = 0; i < state(hdlc)->settings.n393; i++, list >>= 1)
632 reliable = (cnt < state(hdlc)->settings.n392);
635 if (state(hdlc)->reliable != reliable) {
640 if (state(hdlc)->settings.dce)
641 state(hdlc)->timer.expires = jiffies +
642 state(hdlc)->settings.t392 * HZ;
644 if (state(hdlc)->n391cnt)
645 state(hdlc)->n391cnt--;
647 fr_lmi_send(dev, state(hdlc)->n391cnt == 0);
649 state(hdlc)->last_poll = jiffies;
650 state(hdlc)->request = 1;
651 state(hdlc)->timer.expires = jiffies +
652 state(hdlc)->settings.t391 * HZ;
655 add_timer(&state(hdlc)->timer);
661 hdlc_device *hdlc = dev_to_hdlc(dev);
664 int lmi = state(hdlc)->settings.lmi;
665 int dce = state(hdlc)->settings.dce;
736 state(hdlc)->rxseq = skb->data[i++]; /* TX sequence from peer */
739 txseq = state(hdlc)->txseq;
742 state(hdlc)->last_poll = jiffies;
745 if (!state(hdlc)->reliable)
749 state(hdlc)->n391cnt = 0;
754 if (state(hdlc)->fullrep_sent && !error) {
756 state(hdlc)->fullrep_sent = 0;
757 pvc = state(hdlc)->first_pvc;
763 state(hdlc)->dce_changed = 1;
769 if (state(hdlc)->dce_changed) {
771 state(hdlc)->fullrep_sent = 1;
772 state(hdlc)->dce_changed = 0;
775 state(hdlc)->request = 1; /* got request */
782 state(hdlc)->request = 0; /* got response, no request pending */
790 pvc = state(hdlc)->first_pvc;
855 pvc = state(hdlc)->first_pvc;
869 state(hdlc)->n391cnt = state(hdlc)->settings.n391;
878 hdlc_device *hdlc = dev_to_hdlc(frad);
891 (state(hdlc)->settings.lmi == LMI_ANSI ||
892 state(hdlc)->settings.lmi == LMI_CCITT)) ||
894 state(hdlc)->settings.lmi == LMI_CISCO)) {
901 pvc = find_pvc(hdlc, dlci);
999 hdlc_device *hdlc = dev_to_hdlc(dev);
1003 if (state(hdlc)->settings.lmi != LMI_NONE) {
1004 state(hdlc)->reliable = 0;
1005 state(hdlc)->dce_changed = 1;
1006 state(hdlc)->request = 0;
1007 state(hdlc)->fullrep_sent = 0;
1008 state(hdlc)->last_errors = 0xFFFFFFFF;
1009 state(hdlc)->n391cnt = 0;
1010 state(hdlc)->txseq = state(hdlc)->rxseq = 0;
1012 state(hdlc)->dev = dev;
1013 timer_setup(&state(hdlc)->timer, fr_timer, 0);
1015 state(hdlc)->timer.expires = jiffies + HZ;
1016 add_timer(&state(hdlc)->timer);
1024 hdlc_device *hdlc = dev_to_hdlc(dev);
1028 if (state(hdlc)->settings.lmi != LMI_NONE)
1029 del_timer_sync(&state(hdlc)->timer);
1036 hdlc_device *hdlc = dev_to_hdlc(dev);
1037 struct pvc_device *pvc = state(hdlc)->first_pvc;
1067 hdlc_device *hdlc = dev_to_hdlc(frad);
1090 delete_unused_pvcs(hdlc);
1111 delete_unused_pvcs(hdlc);
1118 state(hdlc)->dce_changed = 1;
1119 state(hdlc)->dce_pvc_count++;
1126 static int fr_del_pvc(hdlc_device *hdlc, unsigned int dlci, int type)
1131 if ((pvc = find_pvc(hdlc, dlci)) == NULL)
1144 state(hdlc)->dce_pvc_count--;
1145 state(hdlc)->dce_changed = 1;
1147 delete_unused_pvcs(hdlc);
1155 hdlc_device *hdlc = dev_to_hdlc(frad);
1156 struct pvc_device *pvc = state(hdlc)->first_pvc;
1157 state(hdlc)->first_pvc = NULL; /* All PVCs destroyed */
1158 state(hdlc)->dce_pvc_count = 0;
1159 state(hdlc)->dce_changed = 1;
1192 hdlc_device *hdlc = dev_to_hdlc(dev);
1205 if (copy_to_user(fr_s, &state(hdlc)->settings, size))
1236 result=hdlc->attach(dev, ENCODING_NRZ,PARITY_CRC16_PR1_CCITT);
1245 state(hdlc)->first_pvc = NULL;
1246 state(hdlc)->dce_pvc_count = 0;
1248 memcpy(&state(hdlc)->settings, &new_settings, size);
1280 return fr_del_pvc(hdlc, pvc.dlci, result);