matanp has submitted this change. (
https://gerrit.osmocom.org/c/osmo-bsc/+/32498 )
Change subject: ctrl: Add penalty time control
......................................................................
ctrl: Add penalty time control
The penalty time gives the duration for which the temporary
offset is applied.
Change-Id: Idfdd54dec72fb5f52eee22df018161d75b8c48c8
---
M src/osmo-bsc/bts_ctrl.c
1 file changed, 74 insertions(+), 0 deletions(-)
Approvals:
fixeria: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/osmo-bsc/bts_ctrl.c b/src/osmo-bsc/bts_ctrl.c
index 5ac1e0d..bd8a442 100644
--- a/src/osmo-bsc/bts_ctrl.c
+++ b/src/osmo-bsc/bts_ctrl.c
@@ -741,6 +741,67 @@
CTRL_CMD_DEFINE(bts_cell_reselection_offset, "cell-reselection-offset");
+static int verify_bts_cell_reselection_penalty_time(struct ctrl_cmd *cmd, const char
*value, void *_data)
+{
+ int penalty_time;
+
+ if (strcmp(value, "reserved") == 0)
+ return 0;
+
+ penalty_time = atoi(value);
+
+ if (penalty_time < 20 || penalty_time > 620) {
+ cmd->reply = "Value is out of range";
+ return 1;
+ } else if (penalty_time % 20 != 0) {
+ cmd->reply = "Value must be a multiple of 20";
+ return 1;
+ }
+
+ return 0;
+}
+
+/* According to 3GPP TS 45.008, PENALTY_TIME in the Control parameters section */
+static int get_bts_cell_reselection_penalty_time(struct ctrl_cmd *cmd, void *data)
+{
+ struct gsm_bts *bts = cmd->node;
+
+ if (!bts->si_common.cell_ro_sel_par.present) {
+ cmd->reply = "0";
+ return CTRL_CMD_REPLY;
+ }
+
+ if (bts->si_common.cell_ro_sel_par.penalty_time == 31) {
+ cmd->reply = "reserved";
+ return CTRL_CMD_REPLY;
+ }
+
+ /* Calculate the penalty time in seconds */
+ cmd->reply = talloc_asprintf(cmd, "%u",
(bts->si_common.cell_ro_sel_par.penalty_time * 20) + 20);
+ if (!cmd->reply) {
+ cmd->reply = "OOM";
+ return CTRL_CMD_ERROR;
+ }
+
+ return CTRL_CMD_REPLY;
+}
+
+static int set_bts_cell_reselection_penalty_time(struct ctrl_cmd *cmd, void *data)
+{
+ struct gsm_bts *bts = cmd->node;
+ bts->si_common.cell_ro_sel_par.present = 1;
+
+ if (strcmp(cmd->value, "reserved") == 0)
+ bts->si_common.cell_ro_sel_par.penalty_time = 31;
+ else
+ bts->si_common.cell_ro_sel_par.penalty_time = (atoi(cmd->value) - 20) / 20;
+
+ cmd->reply = "OK";
+ return CTRL_CMD_REPLY;
+}
+
+CTRL_CMD_DEFINE(bts_cell_reselection_penalty_time,
"cell-reselection-penalty-time");
+
int bsc_bts_ctrl_cmds_install(void)
{
int rc = 0;
@@ -764,6 +825,7 @@
rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_si2quater_neighbor_list_del_earfcn);
rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_si2quater_neighbor_list_del_uarfcn);
rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_cell_reselection_offset);
+ rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_cell_reselection_penalty_time);
rc |= neighbor_ident_ctrl_init();
--
To view, visit
https://gerrit.osmocom.org/c/osmo-bsc/+/32498
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Idfdd54dec72fb5f52eee22df018161d75b8c48c8
Gerrit-Change-Number: 32498
Gerrit-PatchSet: 7
Gerrit-Owner: matanp <matan1008(a)gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: matanp <matan1008(a)gmail.com>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: dexter <pmaier(a)sysmocom.de>
Gerrit-MessageType: merged