diff options
author | Luca Melette <luca@srlabs.de> | 2012-02-06 03:20:06 +0100 |
---|---|---|
committer | Luca Melette <luca@srlabs.de> | 2012-02-06 03:20:06 +0100 |
commit | 1a2916dab0f504dddf9ee642699dc12658bd0980 (patch) | |
tree | 394c079df868701475f1af07ca423f98478dd556 | |
parent | ac07dfab60e4eb562e7df0782745f0cd074aa54f (diff) |
New resync policy (new state), removed not needed resets
-rw-r--r-- | src/host/layer23/src/misc/app_ccch_scan.c | 3 | ||||
-rw-r--r-- | src/host/layer23/src/misc/cell_log.c | 49 |
2 files changed, 27 insertions, 25 deletions
diff --git a/src/host/layer23/src/misc/app_ccch_scan.c b/src/host/layer23/src/misc/app_ccch_scan.c index 494df5b6..413ba01f 100644 --- a/src/host/layer23/src/misc/app_ccch_scan.c +++ b/src/host/layer23/src/misc/app_ccch_scan.c @@ -794,8 +794,6 @@ static int signal_cb(unsigned int subsys, unsigned int signal, break; case S_L1CTL_FBSB_ERR: - layer3_app_reset(); - sleep(1); return l1ctl_tx_fbsb_req(app_state.ms, app_state.ms->test_arfcn, L1CTL_FBSB_F_FB01SB, 100, 0, CCCH_MODE_NONE); @@ -804,7 +802,6 @@ static int signal_cb(unsigned int subsys, unsigned int signal, loss_count++; if (loss_count > 10) { loss_count = 0; - layer3_app_reset(); return l1ctl_tx_fbsb_req(app_state.ms, app_state.ms->test_arfcn, L1CTL_FBSB_F_FB01SB, 100, 0, CCCH_MODE_NONE); diff --git a/src/host/layer23/src/misc/cell_log.c b/src/host/layer23/src/misc/cell_log.c index 32d295dd..cd307631 100644 --- a/src/host/layer23/src/misc/cell_log.c +++ b/src/host/layer23/src/misc/cell_log.c @@ -62,7 +62,8 @@ extern char *scan_band; enum { SCAN_STATE_PM, SCAN_STATE_SYNC, - SCAN_STATE_READ, + SCAN_STATE_BCCH, + SCAN_STATE_READY, SCAN_STATE_RACH, }; @@ -264,8 +265,9 @@ static void timeout_cb(void *arg) stop_raw = 1; } switch (state) { - case SCAN_STATE_READ: + case SCAN_STATE_BCCH: LOGP(DRR, LOGL_INFO, "Timeout reading BCCH\n"); + case SCAN_STATE_READY: printf("Timeout\n"); start_sync(); break; @@ -462,34 +464,37 @@ static int signal_cb(unsigned int subsys, unsigned int signal, start_pm(); break; case S_L1CTL_FBSB_RESP: + loss_count = 0; if (sdcch) break; if (!scan_only) printf("ARFCN %d: got sync\n", arfcn); - state = SCAN_STATE_READ; - fr = signal_data; - ms = fr->ms; - sysinfo.bsic = fr->bsic; - memset(&ms->meas, 0, sizeof(ms->meas)); - memset(&log_si, 0, sizeof(log_si)); - loss_count = 0; - log_si.flags |= INFO_FLG_SYNC; - log_si.ta = 0xff; /* invalid */ + if (state < SCAN_STATE_BCCH) { + state = SCAN_STATE_BCCH; + fr = signal_data; + ms = fr->ms; + sysinfo.bsic = fr->bsic; + memset(&ms->meas, 0, sizeof(ms->meas)); + memset(&log_si, 0, sizeof(log_si)); + log_si.flags |= INFO_FLG_SYNC; + log_si.ta = 0xff; /* invalid */ + } if (!collecting) { start_timer(READ_WAIT); } LOGP(DRR, LOGL_INFO, "Synchronized, start reading\n"); break; case S_L1CTL_FBSB_ERR: - if (scan_only || (sync_retry > wait_time/60)) { + if (scan_only || (state < SCAN_STATE_BCCH)) { start_sync(); - } else { + break; + } + if (sync_retry < wait_time/60) { printf("ARFCN %d: resync\n", arfcn); + sync_retry++; fr = signal_data; ms = fr->ms; - sync_retry++; l1ctl_tx_dm_rel_req(ms); - sleep(1); return l1ctl_tx_fbsb_req(ms, arfcn, L1CTL_FBSB_F_FB01SB, 100, 0, CCCH_MODE_NONE); @@ -537,6 +542,9 @@ static int pch_agch(struct osmocom_ms *ms, struct msgb *msg) { struct gsm48_system_information_type_header *sih = msgb_l3(msg); + if (sdcch || (state != SCAN_STATE_READY)) + return 0; + switch (sih->system_information) { case GSM48_MT_RR_PAG_REQ_1: case GSM48_MT_RR_PAG_REQ_2: @@ -589,6 +597,8 @@ static int new_sysinfo(void) log_sysinfo(); + state = SCAN_STATE_READY; + start_timer(IMM_WAIT); return 0; @@ -688,7 +698,7 @@ static int unit_data_ind(struct osmocom_ms *ms, struct msgb *msg) } msg->l3h = (uint8_t *) TLVP_VAL(&tv, RSL_IE_L3_INFO); - if (state != SCAN_STATE_READ && state != SCAN_STATE_RACH) { + if (state < SCAN_STATE_BCCH && state != SCAN_STATE_RACH) { return -EINVAL; } @@ -861,9 +871,6 @@ static int gsm48_rx_imm_ass(struct msgb *msg, struct osmocom_ms *ms) uint8_t ch_type, ch_subch, ch_ts; int rv; - if (sdcch) - return 0; - /* If we're busy ... */ if (app_state.dch_state != DCH_NONE) return 0; @@ -880,8 +887,6 @@ static int gsm48_rx_imm_ass(struct msgb *msg, struct osmocom_ms *ms) printf("ARFCN %d: got SDCCH assignment\n", arfcn); } - layer3_app_reset(); - rsl_dec_chan_nr(ia->chan_desc.chan_nr, &ch_type, &ch_subch, &ch_ts); if (!ia->chan_desc.h0.h) { @@ -931,7 +936,7 @@ static int gsm48_rx_imm_ass(struct msgb *msg, struct osmocom_ms *ms) if (!ma_len) { if (ia->page_mode & 0xf0) got_data = 0; - return; + return -1; } /* request L1 to go to dedicated mode on assigned channel */ |