diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2021-05-19 02:48:40 +0200 |
---|---|---|
committer | Neels Hofmeyr <neels@hofmeyr.de> | 2021-06-10 16:15:35 +0200 |
commit | ee921cf90366caaf693df7ced024c786e7e71eec (patch) | |
tree | f09fb862e37df22cd7cbc4fe30df57709b6ee905 /src/osmo-bsc | |
parent | a99899ea967439f4063a3b5f6abb8d0ed6ddbcd2 (diff) |
VTY: add lchan re-assignment command
Add VTY command to trigger an intra-cell re-assignment, also allowing to
re-assign to a secondary VAMOS lchan.
Related: SYS#5315 OS#4940
Change-Id: If006f5caaf83b07675f57e5665cfa79328da55e6
Diffstat (limited to 'src/osmo-bsc')
-rw-r--r-- | src/osmo-bsc/bsc_vty.c | 89 | ||||
-rw-r--r-- | src/osmo-bsc/gsm_data.c | 1 |
2 files changed, 90 insertions, 0 deletions
diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c index 71a0f0b7d..430863bc5 100644 --- a/src/osmo-bsc/bsc_vty.c +++ b/src/osmo-bsc/bsc_vty.c @@ -6590,6 +6590,94 @@ DEFUN(lchan_mdcx, lchan_mdcx_cmd, return CMD_SUCCESS; } +DEFUN(lchan_reassign, lchan_reassign_cmd, + "bts <0-255> trx <0-255> timeslot <0-7> (sub-slot|vamos-sub-slot) <0-7> " + "reassign-to trx <0-255> timeslot <0-7> (sub-slot|vamos-sub-slot) <0-7> " + TSC_ARGS_OPT, + BTS_NR_TRX_TS_STR2 + "Primary sub-slot\n" "VAMOS secondary shadow subslot, range <0-1>, only valid for TCH type timeslots\n" + SS_NR_STR + "Trigger Assignment to an unused lchan on the same cell\n" + "Target TRX\nTRX nr\nTarget timeslot\ntimeslot nr\n" + "Primary sub-slot\n" "VAMOS secondary shadow subslot, range <0-1>, only valid for TCH type timeslots\n" + SS_NR_STR + TSC_ARGS_DOC) +{ + const char *bts_str = argv[0]; + const char *from_trx_str = argv[1]; + const char *from_ts_str = argv[2]; + bool from_vamos = (strcmp(argv[3], "vamos-sub-slot") == 0); + int from_ss_nr = atoi(argv[4]); + const char *to_trx_str = argv[5]; + const char *to_ts_str = argv[6]; + bool to_vamos = (strcmp(argv[7], "vamos-sub-slot") == 0); + int to_ss_nr = atoi(argv[8]); + int tsc_set = (argc > 10) ? atoi(argv[10]) : -1; + int tsc = (argc > 11) ? atoi(argv[11]) : -1; + + struct gsm_bts_trx_ts *from_ts; + struct gsm_bts_trx_ts *to_ts; + struct gsm_lchan *from_lchan; + struct gsm_lchan *to_lchan; + + from_ts = vty_get_ts(vty, bts_str, from_trx_str, from_ts_str); + if (!from_ts) + return CMD_WARNING; + to_ts = vty_get_ts(vty, bts_str, to_trx_str, to_ts_str); + if (!to_ts) + return CMD_WARNING; + + if (!ts_is_capable_of_pchan(to_ts, from_ts->pchan_is)) { + vty_out(vty, "cannot re-assign, target timeslot has mismatching physical channel config: %s -> %s%s", + gsm_pchan_name(from_ts->pchan_is), gsm_pchan_name(to_ts->pchan_on_init), VTY_NEWLINE); + return CMD_WARNING; + } + + if (from_ss_nr >= from_ts->max_primary_lchans) { + vty_out(vty, "cannot re-assign, invalid source subslot number: %d%s", + from_ss_nr, VTY_NEWLINE); + return CMD_WARNING; + } + + if (to_ss_nr >= to_ts->max_primary_lchans) { + vty_out(vty, "cannot re-assign, invalid target subslot number: %d%s", + to_ss_nr, VTY_NEWLINE); + return CMD_WARNING; + } + + if (from_vamos) + from_ss_nr += from_ts->max_primary_lchans; + from_lchan = &from_ts->lchan[from_ss_nr]; + + if (to_vamos) + to_ss_nr += to_ts->max_primary_lchans; + to_lchan = &to_ts->lchan[to_ss_nr]; + + if (!lchan_state_is(from_lchan, LCHAN_ST_ESTABLISHED)) { + vty_out(vty, "cannot re-assign, source lchan is not in ESTABLISHED state%s", VTY_NEWLINE); + return CMD_WARNING; + } + if (!lchan_state_is(to_lchan, LCHAN_ST_UNUSED)) { + vty_out(vty, "cannot re-assign, target lchan is already in use%s", VTY_NEWLINE); + return CMD_WARNING; + } + + /* lchan_select_*() sets the lchan->type, we need to do the same here, so that activation will work out. */ + to_lchan->type = chan_mode_to_chan_type(from_lchan->current_ch_mode_rate.chan_mode, + from_lchan->current_ch_mode_rate.chan_rate); + + LOG_LCHAN(from_lchan, LOGL_NOTICE, "VTY requests re-assignment of this lchan to %s%s\n", + gsm_lchan_name(to_lchan), to_lchan->vamos.is_secondary ? " (to VAMOS mode)" : ""); + LOG_LCHAN(to_lchan, LOGL_NOTICE, "VTY requests re-assignment of %s to this lchan%s TSC %d/%d\n", + gsm_lchan_name(from_lchan), to_lchan->vamos.is_secondary ? " (to VAMOS mode)" : "", + tsc_set, tsc); + if (reassignment_request_to_lchan(ASSIGN_FOR_VTY, from_lchan, to_lchan, tsc_set, tsc)) { + vty_out(vty, "failed to request re-assignment%s", VTY_NEWLINE); + return CMD_WARNING; + } + return CMD_SUCCESS; +} + DEFUN(ctrl_trap, ctrl_trap_cmd, "ctrl-interface generate-trap TRAP VALUE", "Commands related to the CTRL Interface\n" @@ -8069,6 +8157,7 @@ int bsc_vty_init(struct gsm_network *network) install_element(ENABLE_NODE, &vamos_modify_lchan_cmd); install_element(ENABLE_NODE, &lchan_mdcx_cmd); install_element(ENABLE_NODE, &lchan_set_borken_cmd); + install_element(ENABLE_NODE, &lchan_reassign_cmd); install_element(ENABLE_NODE, &handover_subscr_conn_cmd); install_element(ENABLE_NODE, &assignment_subscr_conn_cmd); diff --git a/src/osmo-bsc/gsm_data.c b/src/osmo-bsc/gsm_data.c index 33a224921..0d1395c70 100644 --- a/src/osmo-bsc/gsm_data.c +++ b/src/osmo-bsc/gsm_data.c @@ -1061,6 +1061,7 @@ const struct value_string assign_for_names[] = { OSMO_VALUE_STRING(ASSIGN_FOR_NONE), OSMO_VALUE_STRING(ASSIGN_FOR_BSSMAP_REQ), OSMO_VALUE_STRING(ASSIGN_FOR_CONGESTION_RESOLUTION), + OSMO_VALUE_STRING(ASSIGN_FOR_VTY), {} }; |