From 4f03a851f04da69349204211b7978254a4ef4fc1 Mon Sep 17 00:00:00 2001 From: "Andreas.Eversberg" Date: Sat, 5 Jun 2010 19:46:10 +0000 Subject: [PATCH 1/1] Fixed of bugs while testing layer 2. --- src/host/layer23/src/app_mobile.c | 2 +- src/host/layer23/src/gsm322.c | 3 ++ src/host/layer23/src/gsm48_mm.c | 11 +++-- src/host/layer23/src/gsm48_rr.c | 72 +++++++++++++++++++------------ 4 files changed, 55 insertions(+), 33 deletions(-) diff --git a/src/host/layer23/src/app_mobile.c b/src/host/layer23/src/app_mobile.c index b1e1507..46e0e06 100644 --- a/src/host/layer23/src/app_mobile.c +++ b/src/host/layer23/src/app_mobile.c @@ -139,7 +139,7 @@ int l23_app_init(struct osmocom_ms *ms) { int rc; - log_parse_category_mask(stderr_target, "DCS:DPLMN:DRR:DMM:DCC:DMNCC:DPAG"); + log_parse_category_mask(stderr_target, "DRSL:DLAPDM:DCS:DPLMN:DRR:DMM:DCC:DMNCC:DPAG"); srand(time(NULL)); diff --git a/src/host/layer23/src/gsm322.c b/src/host/layer23/src/gsm322.c index aa46942..da01258 100644 --- a/src/host/layer23/src/gsm322.c +++ b/src/host/layer23/src/gsm322.c @@ -2311,6 +2311,7 @@ static int gsm322_l1_signal(unsigned int subsys, unsigned int signal, } break; case S_L1CTL_FBSB_ERR: + LOGP(DCS, LOGL_INFO, "Channel sync error.\n"); ms = signal_data; cs = &ms->cellsel; @@ -2739,6 +2740,8 @@ static int gsm322_c_conn_mode_1(struct osmocom_ms *ms, struct msgb *msg) cs->ccch_state = GSM322_CCCH_ST_INIT; l1ctl_tx_fbsb_req(ms, cs->arfcn, L1CTL_FBSB_F_FB01SB, 100, 0); cs->si = cs->list[cs->arfcn].sysinfo; +#warning TESTING: laforge must fix the sync error when sending fbsb request too close to each other. also we must get a response with arfcn or a confirm, so we know where the response belongs to. +usleep(300000); return 0; } diff --git a/src/host/layer23/src/gsm48_mm.c b/src/host/layer23/src/gsm48_mm.c index d1dc65a..f424dd3 100644 --- a/src/host/layer23/src/gsm48_mm.c +++ b/src/host/layer23/src/gsm48_mm.c @@ -272,9 +272,11 @@ int gsm48_encode_mi(uint8_t *buf, struct msgb *msg, struct osmocom_ms *ms, default: buf[0] = GSM48_IE_MOBILE_ID; buf[1] = 1; - buf[2] = 0xf0 | GSM_MI_TYPE_NONE; + buf[2] = 0xf0; break; } + /* alter MI type */ + buf[2] = (buf[2] & 0xf8) | mi_type; if (msg) { /* MI as LV */ @@ -1595,6 +1597,7 @@ static int gsm48_mm_rx_id_req(struct osmocom_ms *ms, struct msgb *msg) return gsm48_mm_tx_mm_status(ms, GSM48_REJECT_MSG_NOT_COMPATIBLE); } + LOGP(DMM, LOGL_INFO, "IDENTITY REQUEST (mi_type %d)\n", mi_type); return gsm48_mm_tx_id_rsp(ms, mi_type); } @@ -1860,12 +1863,12 @@ static int gsm48_mm_rx_info(struct osmocom_ms *ms, struct msgb *msg) /* long name */ if (TLVP_PRESENT(&tp, GSM48_IE_NAME_LONG)) { decode_network_name(mm->name_long, sizeof(mm->name_long), - TLVP_VAL(&tp, GSM48_IE_FACILITY)-1); + TLVP_VAL(&tp, GSM48_IE_NAME_LONG)-1); } /* short name */ if (TLVP_PRESENT(&tp, GSM48_IE_NAME_SHORT)) { decode_network_name(mm->name_short, sizeof(mm->name_short), - TLVP_VAL(&tp, GSM48_IE_FACILITY)-1); + TLVP_VAL(&tp, GSM48_IE_NAME_SHORT)-1); } return 0; @@ -2210,7 +2213,7 @@ static int gsm48_mm_rx_loc_upd_acc(struct osmocom_ms *ms, struct msgb *msg) uint8_t mi_type; uint32_t tmsi; - mi = TLVP_VAL(&tp, GSM48_IE_FACILITY)-1; + mi = TLVP_VAL(&tp, GSM48_IE_MOBILE_ID)-1; if (mi[0] < 1) goto short_read; mi_type = mi[1] & GSM_MI_TYPE_MASK; diff --git a/src/host/layer23/src/gsm48_rr.c b/src/host/layer23/src/gsm48_rr.c index f355a65..06318b5 100644 --- a/src/host/layer23/src/gsm48_rr.c +++ b/src/host/layer23/src/gsm48_rr.c @@ -2839,6 +2839,7 @@ static int gsm48_rr_estab_cnf(struct osmocom_ms *ms, struct msgb *msg) { struct gsm48_rrlayer *rr = &ms->rrlayer; struct msgb *nmsg; + uint8_t *mode; /* if MM has releases before confirm, we start release */ if (rr->state == GSM48_RR_ST_IDLE) { @@ -2847,6 +2848,9 @@ static int gsm48_rr_estab_cnf(struct osmocom_ms *ms, struct msgb *msg) nmsg = gsm48_l3_msgb_alloc(); if (!nmsg) return -ENOMEM; + mode = msgb_put(nmsg, 2); + mode[0] = RSL_IE_RELEASE_MODE; + mode[1] = 0; /* normal release */ /* start release */ return gsm48_send_rsl(ms, RSL_MT_REL_REQ, nmsg); } @@ -3234,37 +3238,36 @@ for(i=0;iname, get_rsl_name(msg_type), + gsm48_rr_state_names[rr->state]); + } + /* find function for current state and message */ for (i = 0; i < DLDATASLLEN; i++) if ((msg_type == dldatastatelist[i].type) && ((1 << rr->state) & dldatastatelist[i].states)) break; if (i == DLDATASLLEN) { - LOGP(DRSL, LOGL_NOTICE, "RSLms message 0x%02x unhandled at " - "state %s.\n", msg_type, gsm48_rr_state_names[rr->state]); + LOGP(DRSL, LOGL_NOTICE, "RSLms message unhandled\n"); msgb_free(msg); return 0; } - LOGP(DRSL, LOGL_INFO, "(ms %s) Received 'RSL_MT_%s' from RSL in state " - "%s\n", ms->name, dldatastatelist[i].type_name, - gsm48_rr_state_names[rr->state]); - if (dldatastatelist[i].rout != gsm48_rr_unit_data_ind) - LOGP(DRR, LOGL_INFO, "(ms %s) Received 'RSL_MT_%s' from in " - "state %s\n", ms->name, dldatastatelist[i].type_name, - gsm48_rr_state_names[rr->state]); rc = dldatastatelist[i].rout(ms, msg); @@ -3458,11 +3459,17 @@ they queue must be flushed when rr fails static int gsm48_rr_abort_req(struct osmocom_ms *ms, struct gsm48_rr *rrmsg) { struct gsm48_rrlayer *rr = ms->rrlayer; + uint8_t *mode; + stop_rr_t3126(rr); if (rr->state == GSM48_RR_ST_DEDICATED) { - struct gsm_dl dlmsg; - - memset(&dlmsg, 0, sizeof(dlmsg)); + /* release message */ + nmsg = gsm48_l3_msgb_alloc(); + if (!nmsg) + return -ENOMEM; + mode = msgb_put(nmsg, 2); + mode[0] = RSL_IE_RELEASE_MODE; + mode[1] = 0; /* normal release */ return gsm48_send_rsl(ms, RSL_MT_REL_REQ, nmsg); } new_rr_state(rr, GSM48_RR_ST_IDLE); @@ -3681,12 +3688,12 @@ static int gsm48_rr_rx_hando_cmd(struct osmocom_ms *ms, struct msgb *msg) /* Synchronization Indication */ if (TLVP_PRESENT(&tp, GSM48_IE_SYNC_IND)) gsm48_decode_sync_ind(rr, - TLVP_VAL(&tp, GSM48_IE_MOBILE_ALLOC)-1, &cd); + TLVP_VAL(&tp, GSM48_IE_SYNC_IND)-1, &cd); /* Frequency Sort List */ if (TLVP_PRESENT(&tp, GSM48_IE_FREQ_SHORT_LIST)) gsm48_decode_freq_list(&ms->support, s->freq, - TLVP_VAL(&tp, GSM48_IE_MOBILE_ALLOC), - *(TLVP_VAL(&tp, GSM48_IE_MOBILE_ALLOC)-1), + TLVP_VAL(&tp, GSM48_IE_FREQ_SHORT_LIST), + *(TLVP_VAL(&tp, GSM48_IE_FREQ_SHORT_LIST)-1), 0xce, FREQ_TYPE_SERV); @@ -3765,6 +3772,15 @@ static int gsm48_rr_mdl_error_ind(struct osmocom_ms *ms, struct msgb *msg) struct msgb *nmsg; struct gsm_rr_hdr *nrrh; + printing of the cause + + switch (msg->l3h[0]) { + case RLL_CAUSE_SEQ_ERR: + case RLL_CAUSE_UNSOL_DM_RESP_MF: + einige muessen ignoriert werden + andere gelten als release + } + if (rr->hando_susp_state || rr->assign_susp_state) { if (!rr->resume_last_state) { rr->resume_last_state = 1; @@ -3780,7 +3796,7 @@ static int gsm48_rr_mdl_error_ind(struct osmocom_ms *ms, struct msgb *msg) nmsg = gsm48_l3_msgb_alloc(); if (!nmsg) return -ENOMEM; - return gsm48_send_rsl(ms, RSL_MT_EST_REQ, nmsg); + return gsm48_send_rsl(ms, RSL_MT_RECON_REQ, nmsg); } rr->resume_last_state = 0; } -- 2.20.1