aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2021-08-07 03:41:37 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2021-08-16 02:13:17 +0200
commitc746509d3c244f2acc832f8a5fcc52a529f192d0 (patch)
tree5b2a81df22ee74001246a0086cf0e3c3aaea33e6
parenteec43fa5327a15969af158ef53711eabcc0e9695 (diff)
early IMM ASS 3/n: implement 'pre-ts-ack'
Add experimental 'pre-ts-ack' to the 'immediate-assignment' options: send the IMM ASS even before a dynamic timeslot is switched. This possibly saves an Abis roundtrip, but may be racy. When pre-ts-ack is chosen, already do the IMM ASS before the dyn TS pchan switch is ACKed. In Immediate Assignment, in case the dyn TS is not ready yet, get the pchan kind from lchan->type, which already reflects the target type, and not from ts->pchan_is, which still reflects the previous pchan type. Related test is in I2ae28cd92910d4bc341a88571599347a64a18fe5 Related: SYS#5559 Change-Id: I19e6a3d614aa5ae24d64eed96caf53e6f0e8bb74
-rw-r--r--include/osmocom/bsc/gsm_data.h1
-rw-r--r--src/osmo-bsc/abis_rsl.c11
-rw-r--r--src/osmo-bsc/bts_vty.c13
-rw-r--r--src/osmo-bsc/lchan_fsm.c6
-rw-r--r--tests/osmo-bsc.vty8
5 files changed, 35 insertions, 4 deletions
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index ba3af3bdb..d6c06de3d 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -604,6 +604,7 @@ static inline const char *lchan_activate_mode_name(enum lchan_activate_for activ
enum imm_ass_time {
IMM_ASS_TIME_POST_CHAN_ACK = 0,
IMM_ASS_TIME_PRE_CHAN_ACK,
+ IMM_ASS_TIME_PRE_TS_ACK,
};
struct lchan_activate_info {
diff --git a/src/osmo-bsc/abis_rsl.c b/src/osmo-bsc/abis_rsl.c
index df319821d..26231ac9d 100644
--- a/src/osmo-bsc/abis_rsl.c
+++ b/src/osmo-bsc/abis_rsl.c
@@ -2072,6 +2072,7 @@ int rsl_tx_imm_assignment(struct gsm_lchan *lchan)
struct gsm_bts *bts = lchan->ts->trx->bts;
uint8_t buf[GSM_MACBLOCK_LEN];
struct gsm48_imm_ass *ia = (struct gsm48_imm_ass *) buf;
+ enum gsm_phys_chan_config pchan;
/* create IMMEDIATE ASSIGN 04.08 message */
memset(ia, 0, sizeof(*ia));
@@ -2079,7 +2080,15 @@ int rsl_tx_imm_assignment(struct gsm_lchan *lchan)
ia->proto_discr = GSM48_PDISC_RR;
ia->msg_type = GSM48_MT_RR_IMM_ASS;
ia->page_mode = GSM48_PM_SAME;
- rc = gsm48_lchan2chan_desc(&ia->chan_desc, lchan, lchan->tsc, true);
+
+ /* In case the dyn TS is not ready yet, ts->pchan_is still reflects the previous pchan type; so get the pchan
+ * kind from lchan->type, which already reflects the target type. This only happens for dynamic timeslots.
+ * gsm_pchan_by_lchan_type() isn't always exact, which is fine for dyn TS with their limited pchan kinds. */
+ if (lchan_state_is(lchan, LCHAN_ST_WAIT_TS_READY))
+ pchan = gsm_pchan_by_lchan_type(lchan->type);
+ else
+ pchan = lchan->ts->pchan_is;
+ rc = gsm48_lchan_and_pchan2chan_desc(&ia->chan_desc, lchan, pchan, lchan->tsc, true);
if (rc) {
LOG_LCHAN(lchan, LOGL_ERROR, "Error encoding Channel Number\n");
return rc;
diff --git a/src/osmo-bsc/bts_vty.c b/src/osmo-bsc/bts_vty.c
index cba0bb0db..577feeca7 100644
--- a/src/osmo-bsc/bts_vty.c
+++ b/src/osmo-bsc/bts_vty.c
@@ -2807,16 +2807,20 @@ DEFUN_ATTR(cfg_bts_srvcc_fast_return, cfg_bts_srvcc_fast_return_cmd,
}
DEFUN_ATTR(cfg_bts_immediate_assignment, cfg_bts_immediate_assignment_cmd,
- "immediate-assignment (post-chan-ack|pre-chan-ack)",
+ "immediate-assignment (post-chan-ack|pre-chan-ack|pre-ts-ack)",
"Configure time of Immediate Assignment after ChanRqd RACH (Abis optimization)\n"
"Send the Immediate Assignment after the Channel Activation ACK (normal sequence)\n"
"Send the Immediate Assignment directly after Channel Activation (early), without waiting for the ACK;"
- " This may help with double allocations on high latency Abis links\n",
+ " This may help with double allocations on high latency Abis links\n"
+ "EXPERIMENTAL: If a dynamic timeslot switch is necessary, send the Immediate Assignment even before the"
+ " timeslot is switched, i.e. even before the Channel Activation is sent (very early)\n",
CMD_ATTR_IMMEDIATE)
{
struct gsm_bts *bts = vty->index;
- if (!strcmp(argv[0], "pre-chan-ack"))
+ if (!strcmp(argv[0], "pre-ts-ack"))
+ bts->imm_ass_time = IMM_ASS_TIME_PRE_TS_ACK;
+ else if (!strcmp(argv[0], "pre-chan-ack"))
bts->imm_ass_time = IMM_ASS_TIME_PRE_CHAN_ACK;
else
bts->imm_ass_time = IMM_ASS_TIME_POST_CHAN_ACK;
@@ -4005,6 +4009,9 @@ static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
case IMM_ASS_TIME_PRE_CHAN_ACK:
vty_out(vty, " immediate-assignment pre-chan-ack%s", VTY_NEWLINE);
break;
+ case IMM_ASS_TIME_PRE_TS_ACK:
+ vty_out(vty, " immediate-assignment pre-ts-ack%s", VTY_NEWLINE);
+ break;
}
/* BS/MS Power Control parameters */
diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c
index 1eb9505a8..def70de00 100644
--- a/src/osmo-bsc/lchan_fsm.c
+++ b/src/osmo-bsc/lchan_fsm.c
@@ -739,6 +739,12 @@ static void lchan_fsm_wait_ts_ready_onenter(struct osmo_fsm_inst *fi, uint32_t p
/* Prepare an MGW endpoint CI if appropriate. */
if (lchan->activate.info.requires_voice_stream)
lchan_rtp_fsm_start(lchan);
+
+ if (lchan->activate.info.imm_ass_time == IMM_ASS_TIME_PRE_TS_ACK) {
+ /* Send the Immediate Assignment even before the timeslot is ready, saving a dyn TS timeslot roundtrip
+ * on Abis (experimental). */
+ lchan_send_imm_ass(fi);
+ }
}
static void lchan_fsm_wait_ts_ready(struct osmo_fsm_inst *fi, uint32_t event, void *data)
diff --git a/tests/osmo-bsc.vty b/tests/osmo-bsc.vty
index b837d2560..402750243 100644
--- a/tests/osmo-bsc.vty
+++ b/tests/osmo-bsc.vty
@@ -210,6 +210,7 @@ OsmoBSC(config-net-bts)# immediate-assignment?
OsmoBSC(config-net-bts)# immediate-assignment ?
post-chan-ack Send the Immediate Assignment after the Channel Activation ACK (normal sequence)
pre-chan-ack Send the Immediate Assignment directly after Channel Activation (early), without waiting for the ACK; This may help with double allocations on high latency Abis links
+ pre-ts-ack EXPERIMENTAL: If a dynamic timeslot switch is necessary, send the Immediate Assignment even before the timeslot is switched, i.e. even before the Channel Activation is sent (very early)
OsmoBSC(config-net-bts)# show running-config
... !immediate-assignment
OsmoBSC(config-net-bts)# immediate-assignment pre-chan-ack
@@ -219,6 +220,13 @@ OsmoBSC(config-net-bts)# show running-config
...
immediate-assignment pre-chan-ack
...
+OsmoBSC(config-net-bts)# immediate-assignment pre-ts-ack
+OsmoBSC(config-net-bts)# show running-config
+...
+ bts 0
+...
+ immediate-assignment pre-ts-ack
+...
OsmoBSC(config-net-bts)# immediate-assignment post-chan-ack
OsmoBSC(config-net-bts)# show running-config
... !immediate-assignment