laforge has submitted this change. (
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 include/osmocom/bsc/system_information.h
M src/osmo-bsc/bts_ctrl.c
M src/osmo-bsc/bts_vty.c
M src/osmo-bsc/system_information.c
4 files changed, 35 insertions(+), 9 deletions(-)
Approvals:
pespin: Looks good to me, but someone else must approve
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/include/osmocom/bsc/system_information.h
b/include/osmocom/bsc/system_information.h
index 7b1cff0..f74ef6d 100644
--- a/include/osmocom/bsc/system_information.h
+++ b/include/osmocom/bsc/system_information.h
@@ -17,6 +17,7 @@
int range_encode(enum osmo_gsm48_range r, int *arfcns, int arfcns_used, int *w,
int f0, uint8_t *chan_list);
uint8_t si2q_num(struct gsm_bts *bts);
+int bts_earfcn_del(struct gsm_bts *bts, uint16_t earfcn);
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);
int bts_uarfcn_del(struct gsm_bts *bts, uint16_t arfcn, uint16_t scramble);
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..799028e 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 (si2q_earfcn_count(e) == 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: 4
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: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged