matanp submitted this change.
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(-)
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 change 32498. To unsubscribe, or for help writing mail filters, visit settings.