matanp has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/34515?usp=email )
Change subject: si2quater: Invalidate thresh_lo, prio and qrxlm when needed ...................................................................... si2quater: Invalidate thresh_lo, prio and qrxlm when needed Change-Id: I5910ce8db2d085295b327b12096ba129369eb532 --- M src/osmo-bsc/bts_ctrl.c M src/osmo-bsc/bts_vty.c M src/osmo-bsc/system_information.c 3 files changed, 34 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/15/34515/1 diff --git a/src/osmo-bsc/bts_ctrl.c b/src/osmo-bsc/bts_ctrl.c index fdb4638..cfcbe9d 100644 --- a/src/osmo-bsc/bts_ctrl.c +++ b/src/osmo-bsc/bts_ctrl.c @@ -717,7 +717,6 @@ static int set_bts_si2quater_neighbor_list_del_earfcn(struct ctrl_cmd *cmd, void *data) { struct gsm_bts *bts = (struct gsm_bts *)cmd->node; - struct osmo_earfcn_si2q *e = &bts->si_common.si2quater_neigh_list; int earfcn; if (osmo_str_to_int(&earfcn, cmd->value, 10, 0, 65535) < 0) { @@ -725,7 +724,7 @@ return CTRL_CMD_ERROR; } - if (osmo_earfcn_del(e, earfcn) < 0) { + if (bts_earfcn_del(bts, earfcn) < 0) { cmd->reply = "Failed to delete a (not existent?) neighbor EARFCN"; return CTRL_CMD_ERROR; } @@ -835,7 +834,6 @@ static int set_bts_si2quater_neighbor_list_add_earfcn(struct ctrl_cmd *cmd, void *data) { struct gsm_bts *bts = (struct gsm_bts *)cmd->node; - struct osmo_earfcn_si2q *neighbors = &bts->si_common.si2quater_neigh_list; char *earfcn_str, *thresh_hi_str, *thresh_lo_str, *prio_str, *qrxlv_str, *meas_str, *saveptr, *tmp; int earfcn, thresh_hi, thresh_lo, prio, qrxlv, meas, result; @@ -914,7 +912,7 @@ cmd->reply = "OOM"; } - if (osmo_earfcn_del(neighbors, earfcn) != 0) + if (bts_earfcn_del(bts, earfcn) != 0) cmd->reply = "Failed to roll-back adding EARFCN"; return CTRL_CMD_ERROR; diff --git a/src/osmo-bsc/bts_vty.c b/src/osmo-bsc/bts_vty.c index 9f5ca5b..6602ad1 100644 --- a/src/osmo-bsc/bts_vty.c +++ b/src/osmo-bsc/bts_vty.c @@ -2087,7 +2087,6 @@ "measurement bandwidth\n" "measurement bandwidth (8 means NA)\n") { struct gsm_bts *bts = vty->index; - struct osmo_earfcn_si2q *e = &bts->si_common.si2quater_neigh_list; uint16_t arfcn = atoi(argv[0]); uint8_t thresh_hi = atoi(argv[1]), thresh_lo = atoi(argv[2]), prio = atoi(argv[3]), qrx = atoi(argv[4]), meas = atoi(argv[5]); @@ -2123,7 +2122,7 @@ vty_out(vty, "%% Warning: not enough space in SI2quater (%u/%u used) for a given EARFCN %u%s", bts->si2q_count, SI2Q_MAX_NUM, arfcn, VTY_NEWLINE); - if (osmo_earfcn_del(e, arfcn) != 0) + if (bts_earfcn_del(bts, arfcn) != 0) vty_out(vty, "%% Failed to roll-back adding EARFCN %u%s", arfcn, VTY_NEWLINE); return CMD_WARNING; @@ -2140,9 +2139,8 @@ "EARFCN\n") { struct gsm_bts *bts = vty->index; - struct osmo_earfcn_si2q *e = &bts->si_common.si2quater_neigh_list; uint16_t arfcn = atoi(argv[0]); - int r = osmo_earfcn_del(e, arfcn); + int r = bts_earfcn_del(bts, arfcn); if (r < 0) { vty_out(vty, "%% Unable to delete arfcn %u: %s%s", arfcn, strerror(-r), VTY_NEWLINE); diff --git a/src/osmo-bsc/system_information.c b/src/osmo-bsc/system_information.c index 461f86a..67730d4 100644 --- a/src/osmo-bsc/system_information.c +++ b/src/osmo-bsc/system_information.c @@ -216,6 +216,26 @@ return scramble; } +int bts_earfcn_del(struct gsm_bts *bts, uint16_t earfcn) +{ + struct osmo_earfcn_si2q *e = &bts->si_common.si2quater_neigh_list; + int r; + + r = osmo_earfcn_del(e, earfcn); + + if (r < 0) + return r; + + /* If the last earfcn was removed, invlidate common neighbours limitations */ + if (e->length == 0) { + e->thresh_lo_valid = false; + e->qrxlm_valid = false; + e->prio_valid = false; + } + + return r; +} + int bts_earfcn_add(struct gsm_bts *bts, uint16_t earfcn, uint8_t thresh_hi, uint8_t thresh_lo, uint8_t prio, uint8_t qrx, uint8_t meas_bw) { @@ -223,7 +243,7 @@ int r; /* EARFCN may already exist, so we delete it to avoid duplicates */ - if (osmo_earfcn_del(e, earfcn) == 0) + if (bts_earfcn_del(bts, earfcn) == 0) LOGP(DRR, LOGL_NOTICE, "EARFCN %u is already in the list, modifying\n", earfcn); if (meas_bw < EARFCN_MEAS_BW_INVALID) -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/34515?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I5910ce8db2d085295b327b12096ba129369eb532 Gerrit-Change-Number: 34515 Gerrit-PatchSet: 1 Gerrit-Owner: matanp <matan1...@gmail.com> Gerrit-MessageType: newchange