int create_l1(struct dchannel *dch, dchannel_l1callback *dcb) { struct layer1 *nl1; nl1 = kzalloc(sizeof(struct layer1), GFP_ATOMIC); if (!nl1) { printk(KERN_ERR "kmalloc struct layer1 failed\n"); return -ENOMEM; } nl1->l1m.fsm = &l1fsm_s; nl1->l1m.state = ST_L1_F3; nl1->Flags = 0; nl1->t3_value = TIMER3_DEFAULT_VALUE; nl1->l1m.debug = *debug & DEBUG_L1_FSM; nl1->l1m.userdata = nl1; nl1->l1m.userint = 0; nl1->l1m.printdebug = l1m_debug; nl1->dch = dch; nl1->dcb = dcb; mISDN_FsmInitTimer(&nl1->l1m, &nl1->timer3); mISDN_FsmInitTimer(&nl1->l1m, &nl1->timerX); __module_get(THIS_MODULE); dch->l1 = nl1; return 0; }
int create_teimgr(layer2_t *l2) { teimgr_t *ntei; if (!l2) { printk(KERN_ERR "create_tei no layer2\n"); return(-EINVAL); } if (!(ntei = kmalloc(sizeof(teimgr_t), GFP_ATOMIC))) { printk(KERN_ERR "kmalloc teimgr failed\n"); return(-ENOMEM); } memset(ntei, 0, sizeof(teimgr_t)); ntei->l2 = l2; ntei->T202 = 2000; /* T202 2000 milliseconds */ ntei->debug = l2->debug; ntei->tei_m.debug = l2->debug; ntei->tei_m.userdata = ntei; ntei->tei_m.printdebug = tei_debug; if (test_bit(FLG_LAPD_NET, &l2->flag)) { ntei->tei_m.fsm = &teifsm; ntei->tei_m.state = ST_TEI_NOP; } else { ntei->tei_m.fsm = &teifsm; ntei->tei_m.state = ST_TEI_NOP; } mISDN_FsmInitTimer(&ntei->tei_m, &ntei->t202); l2->tm = ntei; return(0); }
void init_l3(layer3_t *l3) { INIT_LIST_HEAD(&l3->plist); l3->global = NULL; l3->dummy = NULL; l3->entity = MISDN_ENTITY_NONE; l3->next_id = 1; skb_queue_head_init(&l3->squeue); l3->l3m.fsm = &l3fsm; l3->l3m.state = ST_L3_LC_REL; l3->l3m.debug = l3->debug; l3->l3m.userdata = l3; l3->l3m.userint = 0; l3->l3m.printdebug = l3m_debug; mISDN_FsmInitTimer(&l3->l3m, &l3->l3m_timer); }