Lines Matching refs:l2
118 struct layer2 *l2; in da_deactivate() local
122 list_for_each_entry(l2, &mgr->layer2, list) { in da_deactivate()
123 if (l2->l2m.state > ST_L2_4) { in da_deactivate()
155 struct layer2 *l2; in da_timer() local
160 list_for_each_entry(l2, &mgr->layer2, list) { in da_timer()
161 if (l2->l2m.state > ST_L2_4) { in da_timer()
243 tm->l2->sapi, tm->l2->tei, &vaf); in tei_debug()
255 struct layer2 *l2; in get_free_id() local
257 list_for_each_entry(l2, &mgr->layer2, list) { in get_free_id()
258 if (l2->ch.nr > 63) { in get_free_id()
264 __set_bit(l2->ch.nr, ids); in get_free_id()
279 struct layer2 *l2; in get_free_tei() local
281 list_for_each_entry(l2, &mgr->layer2, list) { in get_free_tei()
282 if (l2->ch.nr == 0) in get_free_tei()
284 if ((l2->ch.addr & 0xff) != 0) in get_free_tei()
286 i = l2->ch.addr >> 8; in get_free_tei()
425 struct layer2 *l2; in findtei() local
429 list_for_each_entry(l2, &mgr->layer2, list) { in findtei()
430 if ((l2->sapi == 0) && (l2->tei > 0) && in findtei()
431 (l2->tei != GROUP_TEI) && (l2->tei == tei)) in findtei()
434 l2 = NULL; in findtei()
437 return l2; in findtei()
469 if (tm->l2->tei != GROUP_TEI) { in tei_id_request()
472 tm->l2->tei); in tei_id_request()
489 struct layer2 *l2; in tei_id_assign() local
500 l2 = findtei(tm->mgr, tei); in tei_id_assign()
501 if (l2) { /* same tei is in use */ in tei_id_assign()
502 if (ri != l2->tm->ri) { in tei_id_assign()
505 tei_l2(l2, MDL_ERROR_RSP, 0); in tei_id_assign()
510 tei_l2(tm->l2, MDL_ASSIGN_REQ, tei); in tei_id_assign()
518 struct layer2 *l2; in tei_id_test_dup() local
529 l2 = findtei(tm->mgr, tei); in tei_id_test_dup()
530 if (l2) { /* same tei is in use */ in tei_id_test_dup()
531 if (ri != l2->tm->ri) { /* and it wasn't our request */ in tei_id_test_dup()
534 mISDN_FsmEvent(&l2->tm->tei_m, EV_VERIFY, NULL); in tei_id_test_dup()
565 if ((tm->l2->tei != GROUP_TEI) && ((tei == GROUP_TEI) || in tei_id_chk_req()
566 (tei == tm->l2->tei))) { in tei_id_chk_req()
569 put_tei_msg(tm->mgr, ID_CHK_RES, random_ri(), tm->l2->tei); in tei_id_chk_req()
583 if ((tm->l2->tei != GROUP_TEI) && in tei_id_remove()
584 ((tei == GROUP_TEI) || (tei == tm->l2->tei))) { in tei_id_remove()
587 tei_l2(tm->l2, MDL_REMOVE_REQ, 0); in tei_id_remove()
598 tm->l2->tei); in tei_id_verify()
599 put_tei_msg(tm->mgr, ID_VERIFY, 0, tm->l2->tei); in tei_id_verify()
619 tei_l2(tm->l2, MDL_ERROR_RSP, 0); in tei_id_req_tout()
633 3 - tm->nval, tm->l2->tei); in tei_id_ver_tout()
634 put_tei_msg(tm->mgr, ID_VERIFY, 0, tm->l2->tei); in tei_id_ver_tout()
638 tm->l2->tei); in tei_id_ver_tout()
639 tei_l2(tm->l2, MDL_REMOVE_REQ, 0); in tei_id_ver_tout()
660 tei_l2remove(struct layer2 *l2) in tei_l2remove() argument
662 put_tei_msg(l2->tm->mgr, ID_REMOVE, 0, l2->tei); in tei_l2remove()
663 tei_l2(l2, MDL_REMOVE_REQ, 0); in tei_l2remove()
664 list_del(&l2->ch.list); in tei_l2remove()
665 l2->ch.ctrl(&l2->ch, CLOSE_CHANNEL, NULL); in tei_l2remove()
674 if (tm->l2->tei == GROUP_TEI) { in tei_assign_req()
684 put_tei_msg(tm->mgr, ID_ASSIGNED, tm->ri, tm->l2->tei); in tei_assign_req()
695 tm->l2->tei); in tei_id_chk_req_net()
697 put_tei_msg(tm->mgr, ID_CHK_REQ, 0, tm->l2->tei); in tei_id_chk_req_net()
713 if (tei == tm->l2->tei) in tei_id_chk_resp()
727 tei, tm->l2->tei); in tei_id_verify_net()
728 if (tei == tm->l2->tei) in tei_id_verify_net()
740 "check req for tei %d successful\n", tm->l2->tei); in tei_id_ver_tout_net()
744 tei_l2remove(tm->l2); in tei_id_ver_tout_net()
749 3 - tm->nval, tm->l2->tei); in tei_id_ver_tout_net()
750 put_tei_msg(tm->mgr, ID_CHK_REQ, 0, tm->l2->tei); in tei_id_ver_tout_net()
754 tm->l2->tei); in tei_id_ver_tout_net()
756 tei_l2remove(tm->l2); in tei_id_ver_tout_net()
772 if (test_bit(FLG_FIXED_TEI, &tm->l2->flag)) in tei_ph_data_ind()
796 struct layer2 *l2; in create_new_tei() local
810 l2 = create_l2(mgr->up, ISDN_P_LAPD_NT, opt, tei, sapi); in create_new_tei()
811 if (!l2) { in create_new_tei()
815 l2->tm = kzalloc(sizeof(struct teimgr), GFP_KERNEL); in create_new_tei()
816 if (!l2->tm) { in create_new_tei()
817 kfree(l2); in create_new_tei()
821 l2->tm->mgr = mgr; in create_new_tei()
822 l2->tm->l2 = l2; in create_new_tei()
823 l2->tm->tei_m.debug = *debug & DEBUG_L2_TEIFSM; in create_new_tei()
824 l2->tm->tei_m.userdata = l2->tm; in create_new_tei()
825 l2->tm->tei_m.printdebug = tei_debug; in create_new_tei()
826 l2->tm->tei_m.fsm = &teifsmn; in create_new_tei()
827 l2->tm->tei_m.state = ST_TEI_NOP; in create_new_tei()
828 l2->tm->tval = 2000; /* T202 2 sec */ in create_new_tei()
829 mISDN_FsmInitTimer(&l2->tm->tei_m, &l2->tm->timer); in create_new_tei()
832 list_add_tail(&l2->list, &mgr->layer2); in create_new_tei()
835 l2->ch.ctrl(&l2->ch, CLOSE_CHANNEL, NULL); in create_new_tei()
839 l2->ch.nr = id; in create_new_tei()
840 __add_layer2(&l2->ch, mgr->ch.st); in create_new_tei()
841 l2->ch.recv = mgr->ch.recv; in create_new_tei()
842 l2->ch.peer = mgr->ch.peer; in create_new_tei()
843 l2->ch.ctrl(&l2->ch, OPEN_CHANNEL, NULL); in create_new_tei()
849 l2->ch.ctrl(&l2->ch, CLOSE_CHANNEL, NULL); in create_new_tei()
850 l2 = NULL; in create_new_tei()
853 return l2; in create_new_tei()
860 struct layer2 *l2; in new_tei_req() local
876 l2 = create_new_tei(mgr, tei, CTRL_SAPI); in new_tei_req()
877 if (!l2) in new_tei_req()
880 mISDN_FsmEvent(&l2->tm->tei_m, EV_ASSIGN_REQ, dp); in new_tei_req()
890 struct layer2 *l2, *nl2; in ph_data_ind() local
935 list_for_each_entry_safe(l2, nl2, &mgr->layer2, list) { in ph_data_ind()
936 tei_ph_data_ind(l2->tm, mt, &skb->data[4], skb->len - 4); in ph_data_ind()
943 l2_tei(struct layer2 *l2, u_int cmd, u_long arg) in l2_tei() argument
945 struct teimgr *tm = l2->tm; in l2_tei()
947 if (test_bit(FLG_FIXED_TEI, &l2->flag)) in l2_tei()
957 mISDN_FsmEvent(&tm->tei_m, EV_CHKREQ, &l2->tei); in l2_tei()
978 TEIrelease(struct layer2 *l2) in TEIrelease() argument
980 struct teimgr *tm = l2->tm; in TEIrelease()
985 list_del(&l2->list); in TEIrelease()
987 l2->tm = NULL; in TEIrelease()
994 struct layer2 *l2; in create_teimgr() local
1046 list_for_each_entry(l2, &mgr->layer2, list) { in create_teimgr()
1047 l2->up = mgr->up; in create_teimgr()
1048 l2->ch.ctrl(&l2->ch, OPEN_CHANNEL, NULL); in create_teimgr()
1054 l2 = create_l2(crq->ch, crq->protocol, opt, in create_teimgr()
1056 if (!l2) in create_teimgr()
1058 l2->tm = kzalloc(sizeof(struct teimgr), GFP_KERNEL); in create_teimgr()
1059 if (!l2->tm) { in create_teimgr()
1060 kfree(l2); in create_teimgr()
1064 l2->tm->mgr = mgr; in create_teimgr()
1065 l2->tm->l2 = l2; in create_teimgr()
1066 l2->tm->tei_m.debug = *debug & DEBUG_L2_TEIFSM; in create_teimgr()
1067 l2->tm->tei_m.userdata = l2->tm; in create_teimgr()
1068 l2->tm->tei_m.printdebug = tei_debug; in create_teimgr()
1070 l2->tm->tei_m.fsm = &teifsmu; in create_teimgr()
1071 l2->tm->tei_m.state = ST_TEI_NOP; in create_teimgr()
1072 l2->tm->tval = 1000; /* T201 1 sec */ in create_teimgr()
1078 l2->tm->tei_m.fsm = &teifsmn; in create_teimgr()
1079 l2->tm->tei_m.state = ST_TEI_NOP; in create_teimgr()
1080 l2->tm->tval = 2000; /* T202 2 sec */ in create_teimgr()
1086 mISDN_FsmInitTimer(&l2->tm->tei_m, &l2->tm->timer); in create_teimgr()
1089 list_add_tail(&l2->list, &mgr->layer2); in create_teimgr()
1092 l2->ch.nr = id; in create_teimgr()
1093 l2->up->nr = id; in create_teimgr()
1094 crq->ch = &l2->ch; in create_teimgr()
1100 l2->ch.ctrl(&l2->ch, CLOSE_CHANNEL, NULL); in create_teimgr()
1150 struct layer2 *l2, *nl2; in free_teimanager() local
1157 list_for_each_entry_safe(l2, nl2, &mgr->layer2, list) { in free_teimanager()
1158 put_tei_msg(mgr, ID_REMOVE, 0, l2->tei); in free_teimanager()
1160 list_del(&l2->ch.list); in free_teimanager()
1162 l2->ch.ctrl(&l2->ch, CLOSE_CHANNEL, NULL); in free_teimanager()
1166 list_for_each_entry_safe(l2, nl2, &mgr->layer2, list) { in free_teimanager()
1167 l2->up = NULL; in free_teimanager()
1211 struct layer2 *l2; in check_data() local
1236 l2 = create_new_tei(mgr, tei, sapi); in check_data()
1237 if (!l2) { in check_data()
1243 ret = l2->ch.send(&l2->ch, skb); in check_data()
1251 struct layer2 *l2, *nl2; in delete_teimanager() local
1255 list_for_each_entry_safe(l2, nl2, &mgr->layer2, list) { in delete_teimanager()
1257 list_del(&l2->ch.list); in delete_teimanager()
1259 l2->ch.ctrl(&l2->ch, CLOSE_CHANNEL, NULL); in delete_teimanager()
1299 struct layer2 *l2; in mgr_bcast() local
1304 list_for_each_entry(l2, &mgr->layer2, list) { in mgr_bcast()
1306 (l2->ch.addr & MISDN_ID_SAPI_MASK)) { in mgr_bcast()
1307 if (list_is_last(&l2->list, &mgr->layer2)) { in mgr_bcast()
1321 hhc->id = l2->ch.nr; in mgr_bcast()
1328 __func__, l2->ch.nr, in mgr_bcast()
1329 hh->prim, l2->ch.addr, ret); in mgr_bcast()