diff options
-rw-r--r-- | include/osmocom/bsc/gsm_data.h | 5 | ||||
-rw-r--r-- | src/osmo-bsc/abis_rsl.c | 1 | ||||
-rw-r--r-- | src/osmo-bsc/lchan_fsm.c | 34 |
3 files changed, 32 insertions, 8 deletions
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index 4411555f0..ba3af3bdb 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -628,6 +628,11 @@ struct lchan_activate_info { int tsc; bool vamos; + + /* A copy of bts->imm_ass_time at the time where Channel Activation was requested. A change in the VTY + * configuration has immediate effect on the value, so make sure we don't get mixed up when it gets changed + * while a channel activation is in progress. */ + enum imm_ass_time imm_ass_time; }; enum lchan_modify_for { diff --git a/src/osmo-bsc/abis_rsl.c b/src/osmo-bsc/abis_rsl.c index d5b0d532e..df319821d 100644 --- a/src/osmo-bsc/abis_rsl.c +++ b/src/osmo-bsc/abis_rsl.c @@ -2057,6 +2057,7 @@ void abis_rsl_chan_rqd_queue_poll(struct gsm_bts *bts) .ta_known = true, .tsc_set = -1, .tsc = -1, + .imm_ass_time = bts->imm_ass_time, }; lchan_activate(lchan, &info); diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c index 68cafb3c8..1eb9505a8 100644 --- a/src/osmo-bsc/lchan_fsm.c +++ b/src/osmo-bsc/lchan_fsm.c @@ -657,6 +657,21 @@ static int lchan_activate_set_ch_mode_rate_and_mr_config(struct gsm_lchan *lchan return 0; } +static int lchan_send_imm_ass(struct osmo_fsm_inst *fi) +{ + int rc; + struct gsm_lchan *lchan = lchan_fi_lchan(fi); + rc = rsl_tx_imm_assignment(lchan); + if (rc) { + lchan_fail("Failed to Tx RR Immediate Assignment message (rc=%d %s)", + rc, strerror(-rc)); + return rc; + } + LOG_LCHAN(lchan, LOGL_DEBUG, "Tx RR Immediate Assignment\n"); + lchan->activate.immediate_assignment_sent = true; + return rc; +} + static void lchan_fsm_wait_ts_ready_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state) { struct gsm_lchan *lchan = lchan_fi_lchan(fi); @@ -801,6 +816,12 @@ static void lchan_fsm_wait_activ_ack_onenter(struct osmo_fsm_inst *fi, uint32_t if (lchan->activate.info.ta_known) lchan->last_ta = lchan->activate.info.ta; + + if (lchan->activate.info.imm_ass_time == IMM_ASS_TIME_PRE_CHAN_ACK) { + /* Send the Immediate Assignment directly after the Channel Activation request, saving one Abis + * roundtrip between ChanRqd and Imm Ass. */ + lchan_send_imm_ass(fi); + } } static void lchan_fsm_post_activ_ack(struct osmo_fsm_inst *fi); @@ -861,7 +882,6 @@ static void lchan_fsm_wait_activ_ack(struct osmo_fsm_inst *fi, uint32_t event, v static void lchan_fsm_post_activ_ack(struct osmo_fsm_inst *fi) { - int rc; struct gsm_lchan *lchan = lchan_fi_lchan(fi); lchan->current_ch_mode_rate = lchan->activate.ch_mode_rate; @@ -880,14 +900,12 @@ static void lchan_fsm_post_activ_ack(struct osmo_fsm_inst *fi) switch (lchan->activate.info.activ_for) { case ACTIVATE_FOR_MS_CHANNEL_REQUEST: - rc = rsl_tx_imm_assignment(lchan); - if (rc) { - lchan_fail("Failed to Tx RR Immediate Assignment message (rc=%d %s)", - rc, strerror(-rc)); - return; + if (lchan->activate.info.imm_ass_time == IMM_ASS_TIME_POST_CHAN_ACK) { + if (lchan_send_imm_ass(fi)) { + /* lchan_fail() was already called in lchan_send_imm_ass() */ + return; + } } - LOG_LCHAN(lchan, LOGL_DEBUG, "Tx RR Immediate Assignment\n"); - lchan->activate.immediate_assignment_sent = true; break; case ACTIVATE_FOR_ASSIGNMENT: |