Lines Matching refs:state
134 }state; member
171 static inline struct frad_state* state(hdlc_device *hdlc) in state() function
173 return(struct frad_state *)(hdlc->state); in state()
179 struct pvc_device *pvc = state(hdlc)->first_pvc; in find_pvc()
196 struct pvc_device *pvc, **pvc_p = &state(hdlc)->first_pvc; in add_pvc()
249 struct pvc_device **pvc_p = &state(hdlc)->first_pvc; in delete_unused_pvcs()
353 if (state(hdlc)->settings.lmi == LMI_NONE) in pvc_open()
354 pvc->state.active = netif_carrier_ok(pvc->frad); in pvc_open()
356 pvc_carrier(pvc->state.active, pvc); in pvc_open()
357 state(hdlc)->dce_changed = 1; in pvc_open()
370 if (state(hdlc)->settings.lmi == LMI_NONE) in pvc_close()
371 pvc->state.active = 0; in pvc_close()
373 if (state(hdlc)->settings.dce) { in pvc_close()
374 state(hdlc)->dce_changed = 1; in pvc_close()
375 pvc->state.active = 0; in pvc_close()
415 if (pvc->state.active) { in pvc_xmit()
435 if (pvc->state.fecn) /* TX Congestion counter */ in pvc_xmit()
455 pvc->state.new ? " new" : "", in fr_log_dlci_active()
456 !pvc->state.exist ? "deleted" : in fr_log_dlci_active()
457 pvc->state.active ? "active" : "inactive"); in fr_log_dlci_active()
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()
526 pvc->state.exist = pvc->state.new = 1; in fr_lmi_send()
531 if (pvc->open_count && !pvc->state.active && in fr_lmi_send()
532 pvc->state.exist && !pvc->state.new) { in fr_lmi_send()
534 pvc->state.active = 1; in fr_lmi_send()
547 if (pvc->state.new) in fr_lmi_send()
549 else if (pvc->state.active) in fr_lmi_send()
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()
581 pvc->state.exist = pvc->state.active = 1; in fr_set_link_state()
582 pvc->state.new = 0; in fr_set_link_state()
590 pvc->state.exist = pvc->state.active = 0; in fr_set_link_state()
591 pvc->state.new = 0; in fr_set_link_state()
592 if (!state(hdlc)->settings.dce) in fr_set_link_state()
593 pvc->state.bandwidth = 0; in fr_set_link_state()
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()
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()
753 if (pvc->state.new) { in fr_lmi_recv()
754 pvc->state.new = 0; 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()
787 pvc->state.deleted = 1; in fr_lmi_recv()
832 pvc->state.exist = 1; in fr_lmi_recv()
833 pvc->state.deleted = 0; in fr_lmi_recv()
834 if (active != pvc->state.active || in fr_lmi_recv()
835 new != pvc->state.new || in fr_lmi_recv()
836 bw != pvc->state.bandwidth || in fr_lmi_recv()
837 !pvc->state.exist) { in fr_lmi_recv()
838 pvc->state.new = new; in fr_lmi_recv()
839 pvc->state.active = active; in fr_lmi_recv()
840 pvc->state.bandwidth = bw; in fr_lmi_recv()
849 pvc = state(hdlc)->first_pvc; in fr_lmi_recv()
852 if (pvc->state.deleted && pvc->state.exist) { in fr_lmi_recv()
854 pvc->state.active = pvc->state.new = 0; in fr_lmi_recv()
855 pvc->state.exist = 0; in fr_lmi_recv()
856 pvc->state.bandwidth = 0; in fr_lmi_recv()
863 state(hdlc)->n391cnt = state(hdlc)->settings.n391; in fr_lmi_recv()
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()
905 if (pvc->state.fecn != fh->fecn) { in fr_rx()
910 pvc->state.fecn ^= 1; in fr_rx()
913 if (pvc->state.becn != fh->becn) { in fr_rx()
918 pvc->state.becn ^= 1; in fr_rx()
973 if (pvc->state.becn) in fr_rx()
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()
1023 if (state(hdlc)->settings.lmi != LMI_NONE) in fr_stop()
1024 del_timer_sync(&state(hdlc)->timer); in fr_stop()
1032 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_close()
1111 state(hdlc)->dce_changed = 1; in fr_add_pvc()
1112 state(hdlc)->dce_pvc_count++; in fr_add_pvc()
1137 state(hdlc)->dce_pvc_count--; in fr_del_pvc()
1138 state(hdlc)->dce_changed = 1; in fr_del_pvc()
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()
1198 if (copy_to_user(fr_s, &state(hdlc)->settings, size)) 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()