aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatan Perelman <matan1008@gmail.com>2023-09-24 17:06:53 +0300
committerlaforge <laforge@osmocom.org>2023-09-24 16:05:29 +0000
commiteff19b55b0c752c5de2c9d0b4fc72920ae4dd99b (patch)
tree1079ef80b3ab4ac3c5d3f60c4dc5e2a7ed79dd9c
parent8fcd6ab174e162e2b8d2b86dd8d7a367b2099d63 (diff)
si2quater: Invalidate thresh_lo, prio and qrxlm when needed
-rw-r--r--include/osmocom/bsc/system_information.h1
-rw-r--r--src/osmo-bsc/bts_ctrl.c6
-rw-r--r--src/osmo-bsc/bts_vty.c6
-rw-r--r--src/osmo-bsc/system_information.c22
4 files changed, 26 insertions, 9 deletions
diff --git a/include/osmocom/bsc/system_information.h b/include/osmocom/bsc/system_information.h
index 7b1cff0f2..f74ef6dcb 100644
--- a/include/osmocom/bsc/system_information.h
+++ b/include/osmocom/bsc/system_information.h
@@ -17,6 +17,7 @@ unsigned range512_q(unsigned m);
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 fdb4638d6..cfcbe9d50 100644
--- a/src/osmo-bsc/bts_ctrl.c
+++ b/src/osmo-bsc/bts_ctrl.c
@@ -717,7 +717,6 @@ CTRL_CMD_DEFINE_WO(bts_neighbor_list_mode, "neighbor-list mode");
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 @@ static int set_bts_si2quater_neighbor_list_del_earfcn(struct ctrl_cmd *cmd, void
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 verify_bts_si2quater_neighbor_list_add_earfcn(struct ctrl_cmd *cmd, c
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 @@ static int set_bts_si2quater_neighbor_list_add_earfcn(struct ctrl_cmd *cmd, void
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 9f5ca5bb4..6602ad1ed 100644
--- a/src/osmo-bsc/bts_vty.c
+++ b/src/osmo-bsc/bts_vty.c
@@ -2087,7 +2087,6 @@ DEFUN_USRATTR(cfg_bts_si2quater_neigh_add,
"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 @@ DEFUN_USRATTR(cfg_bts_si2quater_neigh_add,
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 @@ DEFUN_USRATTR(cfg_bts_si2quater_neigh_del,
"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 461f86a9a..799028e65 100644
--- a/src/osmo-bsc/system_information.c
+++ b/src/osmo-bsc/system_information.c
@@ -216,6 +216,26 @@ static inline uint16_t encode_fdd(uint16_t scramble, bool diversity)
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 bts_earfcn_add(struct gsm_bts *bts, uint16_t earfcn, uint8_t thresh_hi, uint
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)