Lines Matching refs:l2

109 	struct layer2	*l2;
113 list_for_each_entry(l2, &mgr->layer2, list) {
114 if (l2->l2m.state > ST_L2_4) {
146 struct layer2 *l2;
151 list_for_each_entry(l2, &mgr->layer2, list) {
152 if (l2->l2m.state > ST_L2_4) {
234 tm->l2->sapi, tm->l2->tei, &vaf);
246 struct layer2 *l2;
248 list_for_each_entry(l2, &mgr->layer2, list) {
249 if (l2->ch.nr > 63) {
255 __set_bit(l2->ch.nr, ids);
270 struct layer2 *l2;
272 list_for_each_entry(l2, &mgr->layer2, list) {
273 if (l2->ch.nr == 0)
275 if ((l2->ch.addr & 0xff) != 0)
277 i = l2->ch.addr >> 8;
416 struct layer2 *l2;
420 list_for_each_entry(l2, &mgr->layer2, list) {
421 if ((l2->sapi == 0) && (l2->tei > 0) &&
422 (l2->tei != GROUP_TEI) && (l2->tei == tei))
425 l2 = NULL;
428 return l2;
460 if (tm->l2->tei != GROUP_TEI) {
463 tm->l2->tei);
480 struct layer2 *l2;
491 l2 = findtei(tm->mgr, tei);
492 if (l2) { /* same tei is in use */
493 if (ri != l2->tm->ri) {
496 tei_l2(l2, MDL_ERROR_RSP, 0);
501 tei_l2(tm->l2, MDL_ASSIGN_REQ, tei);
509 struct layer2 *l2;
520 l2 = findtei(tm->mgr, tei);
521 if (l2) { /* same tei is in use */
522 if (ri != l2->tm->ri) { /* and it wasn't our request */
525 mISDN_FsmEvent(&l2->tm->tei_m, EV_VERIFY, NULL);
556 if ((tm->l2->tei != GROUP_TEI) && ((tei == GROUP_TEI) ||
557 (tei == tm->l2->tei))) {
560 put_tei_msg(tm->mgr, ID_CHK_RES, random_ri(), tm->l2->tei);
574 if ((tm->l2->tei != GROUP_TEI) &&
575 ((tei == GROUP_TEI) || (tei == tm->l2->tei))) {
578 tei_l2(tm->l2, MDL_REMOVE_REQ, 0);
589 tm->l2->tei);
590 put_tei_msg(tm->mgr, ID_VERIFY, 0, tm->l2->tei);
610 tei_l2(tm->l2, MDL_ERROR_RSP, 0);
624 3 - tm->nval, tm->l2->tei);
625 put_tei_msg(tm->mgr, ID_VERIFY, 0, tm->l2->tei);
629 tm->l2->tei);
630 tei_l2(tm->l2, MDL_REMOVE_REQ, 0);
651 tei_l2remove(struct layer2 *l2)
653 put_tei_msg(l2->tm->mgr, ID_REMOVE, 0, l2->tei);
654 tei_l2(l2, MDL_REMOVE_REQ, 0);
655 list_del(&l2->ch.list);
656 l2->ch.ctrl(&l2->ch, CLOSE_CHANNEL, NULL);
665 if (tm->l2->tei == GROUP_TEI) {
675 put_tei_msg(tm->mgr, ID_ASSIGNED, tm->ri, tm->l2->tei);
686 tm->l2->tei);
688 put_tei_msg(tm->mgr, ID_CHK_REQ, 0, tm->l2->tei);
704 if (tei == tm->l2->tei)
718 tei, tm->l2->tei);
719 if (tei == tm->l2->tei)
731 "check req for tei %d successful\n", tm->l2->tei);
735 tei_l2remove(tm->l2);
740 3 - tm->nval, tm->l2->tei);
741 put_tei_msg(tm->mgr, ID_CHK_REQ, 0, tm->l2->tei);
745 tm->l2->tei);
747 tei_l2remove(tm->l2);
763 if (test_bit(FLG_FIXED_TEI, &tm->l2->flag))
787 struct layer2 *l2;
801 l2 = create_l2(mgr->up, ISDN_P_LAPD_NT, opt, tei, sapi);
802 if (!l2) {
806 l2->tm = kzalloc(sizeof(struct teimgr), GFP_KERNEL);
807 if (!l2->tm) {
808 kfree(l2);
812 l2->tm->mgr = mgr;
813 l2->tm->l2 = l2;
814 l2->tm->tei_m.debug = *debug & DEBUG_L2_TEIFSM;
815 l2->tm->tei_m.userdata = l2->tm;
816 l2->tm->tei_m.printdebug = tei_debug;
817 l2->tm->tei_m.fsm = &teifsmn;
818 l2->tm->tei_m.state = ST_TEI_NOP;
819 l2->tm->tval = 2000; /* T202 2 sec */
820 mISDN_FsmInitTimer(&l2->tm->tei_m, &l2->tm->timer);
823 list_add_tail(&l2->list, &mgr->layer2);
826 l2->ch.ctrl(&l2->ch, CLOSE_CHANNEL, NULL);
830 l2->ch.nr = id;
831 __add_layer2(&l2->ch, mgr->ch.st);
832 l2->ch.recv = mgr->ch.recv;
833 l2->ch.peer = mgr->ch.peer;
834 l2->ch.ctrl(&l2->ch, OPEN_CHANNEL, NULL);
840 l2->ch.ctrl(&l2->ch, CLOSE_CHANNEL, NULL);
841 l2 = NULL;
844 return l2;
851 struct layer2 *l2;
867 l2 = create_new_tei(mgr, tei, CTRL_SAPI);
868 if (!l2)
871 mISDN_FsmEvent(&l2->tm->tei_m, EV_ASSIGN_REQ, dp);
881 struct layer2 *l2, *nl2;
926 list_for_each_entry_safe(l2, nl2, &mgr->layer2, list) {
927 tei_ph_data_ind(l2->tm, mt, &skb->data[4], skb->len - 4);
934 l2_tei(struct layer2 *l2, u_int cmd, u_long arg)
936 struct teimgr *tm = l2->tm;
938 if (test_bit(FLG_FIXED_TEI, &l2->flag))
948 mISDN_FsmEvent(&tm->tei_m, EV_CHKREQ, &l2->tei);
969 TEIrelease(struct layer2 *l2)
971 struct teimgr *tm = l2->tm;
976 list_del(&l2->list);
978 l2->tm = NULL;
985 struct layer2 *l2;
1037 list_for_each_entry(l2, &mgr->layer2, list) {
1038 l2->up = mgr->up;
1039 l2->ch.ctrl(&l2->ch, OPEN_CHANNEL, NULL);
1045 l2 = create_l2(crq->ch, crq->protocol, opt,
1047 if (!l2)
1049 l2->tm = kzalloc(sizeof(struct teimgr), GFP_KERNEL);
1050 if (!l2->tm) {
1051 kfree(l2);
1055 l2->tm->mgr = mgr;
1056 l2->tm->l2 = l2;
1057 l2->tm->tei_m.debug = *debug & DEBUG_L2_TEIFSM;
1058 l2->tm->tei_m.userdata = l2->tm;
1059 l2->tm->tei_m.printdebug = tei_debug;
1061 l2->tm->tei_m.fsm = &teifsmu;
1062 l2->tm->tei_m.state = ST_TEI_NOP;
1063 l2->tm->tval = 1000; /* T201 1 sec */
1069 l2->tm->tei_m.fsm = &teifsmn;
1070 l2->tm->tei_m.state = ST_TEI_NOP;
1071 l2->tm->tval = 2000; /* T202 2 sec */
1077 mISDN_FsmInitTimer(&l2->tm->tei_m, &l2->tm->timer);
1080 list_add_tail(&l2->list, &mgr->layer2);
1083 l2->ch.nr = id;
1084 l2->up->nr = id;
1085 crq->ch = &l2->ch;
1091 l2->ch.ctrl(&l2->ch, CLOSE_CHANNEL, NULL);
1141 struct layer2 *l2, *nl2;
1148 list_for_each_entry_safe(l2, nl2, &mgr->layer2, list) {
1149 put_tei_msg(mgr, ID_REMOVE, 0, l2->tei);
1151 list_del(&l2->ch.list);
1153 l2->ch.ctrl(&l2->ch, CLOSE_CHANNEL, NULL);
1157 list_for_each_entry_safe(l2, nl2, &mgr->layer2, list) {
1158 l2->up = NULL;
1201 struct layer2 *l2;
1226 l2 = create_new_tei(mgr, tei, sapi);
1227 if (!l2) {
1233 ret = l2->ch.send(&l2->ch, skb);
1241 struct layer2 *l2, *nl2;
1245 list_for_each_entry_safe(l2, nl2, &mgr->layer2, list) {
1247 list_del(&l2->ch.list);
1249 l2->ch.ctrl(&l2->ch, CLOSE_CHANNEL, NULL);
1289 struct layer2 *l2;
1294 list_for_each_entry(l2, &mgr->layer2, list) {
1296 (l2->ch.addr & MISDN_ID_SAPI_MASK)) {
1297 if (list_is_last(&l2->list, &mgr->layer2)) {
1311 hhc->id = l2->ch.nr;
1318 __func__, l2->ch.nr,
1319 hh->prim, l2->ch.addr, ret);