Lines Matching refs:hdlc

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