aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-11-12 16:30:30 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2019-11-12 16:35:10 +0100
commit1e847053157633f2ac89fb4a98e6aa879837fbb3 (patch)
tree7103b3ee805bd83e674a2f0e05c57efa2c3502ab
parent82a8bc07450fce2b6fc626006e49107fb0b427a9 (diff)
bsc: Send MS Power Control msg upon max MS power changepespin/ms-power
Lots of times, the MS power class is unknown until after the first channel has been activated, at which point the MS power class is received in messages such as LU update or CM Service Requet. Since the MS Power level is sent upon CHAN ACT, the only way to communicate the change of maximum MS Power (based on MS power class) after CHAN ACT is to send a MS Power Control msg. Let's do that. Related: OS#4244 Change-Id: I3d6b75578e5cb9b2ad474a0ad01362d846ebe135
-rw-r--r--src/ipaccess/ipaccess-config.c6
-rw-r--r--src/ipaccess/ipaccess-proxy.c6
-rw-r--r--src/osmo-bsc/abis_rsl.c4
-rw-r--r--src/osmo-bsc/gsm_data.c13
-rw-r--r--src/utils/bs11_config.c1
-rw-r--r--src/utils/meas_json.c1
-rw-r--r--tests/abis/abis_test.c1
-rw-r--r--tests/bsc/bsc_test.c1
-rw-r--r--tests/gsm0408/gsm0408_test.c2
-rw-r--r--tests/nanobts_omlattr/nanobts_omlattr_test.c1
10 files changed, 33 insertions, 3 deletions
diff --git a/src/ipaccess/ipaccess-config.c b/src/ipaccess/ipaccess-config.c
index 54e4efd09..4fb3426cf 100644
--- a/src/ipaccess/ipaccess-config.c
+++ b/src/ipaccess/ipaccess-config.c
@@ -1141,3 +1141,9 @@ int osmo_bsc_sigtran_open_conn(struct gsm_subscriber_connection *conn, struct ms
{
return 0;
}
+
+/* Stub */
+int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan)
+{
+ return 0;
+}
diff --git a/src/ipaccess/ipaccess-proxy.c b/src/ipaccess/ipaccess-proxy.c
index 26c5bcd92..5ce11287d 100644
--- a/src/ipaccess/ipaccess-proxy.c
+++ b/src/ipaccess/ipaccess-proxy.c
@@ -1248,3 +1248,9 @@ int main(int argc, char **argv)
osmo_select_main(0);
}
}
+
+/* Stub */
+int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan)
+{
+ return 0;
+}
diff --git a/src/osmo-bsc/abis_rsl.c b/src/osmo-bsc/abis_rsl.c
index fe6fa13fd..be4d48880 100644
--- a/src/osmo-bsc/abis_rsl.c
+++ b/src/osmo-bsc/abis_rsl.c
@@ -24,6 +24,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
+#include <inttypes.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -301,6 +302,9 @@ int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan)
struct msgb *msg;
uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
+ LOG_LCHAN(lchan, LOGL_DEBUG, "Tx MS POWER CONTROL %" PRIu8 "\n",
+ lchan->ms_power);
+
msg = rsl_msgb_alloc();
dh = (struct abis_rsl_dchan_hdr *) msgb_put(msg, sizeof(*dh));
diff --git a/src/osmo-bsc/gsm_data.c b/src/osmo-bsc/gsm_data.c
index 7745449ab..0662c8082 100644
--- a/src/osmo-bsc/gsm_data.c
+++ b/src/osmo-bsc/gsm_data.c
@@ -39,6 +39,7 @@
#include <osmocom/bsc/gsm_data.h>
#include <osmocom/bsc/osmo_bsc_lcls.h>
+#include <osmocom/bsc/abis_rsl.h>
#include <osmocom/bsc/abis_nm.h>
#include <osmocom/bsc/handover_cfg.h>
#include <osmocom/bsc/timeslot_fsm.h>
@@ -1705,6 +1706,7 @@ void lchan_update_ms_power_ctrl_level(struct gsm_lchan *lchan, int ms_power_dbm)
struct gsm_bts *bts = lchan->ts->trx->bts;
struct gsm_subscriber_connection *conn = lchan->conn;
int max_pwr_dbm_pwclass, new_pwr;
+ bool send_pwr_ctrl_msg = false;
LOG_LCHAN(lchan, LOGL_DEBUG,
"MS Power level update requested: %d dBm\n", ms_power_dbm);
@@ -1741,10 +1743,15 @@ ms_power_default:
"MS Power level update (power class %" PRIu8 "): %" PRIu8 " -> %d\n",
conn ? conn->ms_power_class : 0, lchan->ms_power, new_pwr);
+ /* If chan was already activated and max ms_power changes (due to power
+ classmark received), send an MS Power Control message */
+ if (lchan->activate.activ_ack && new_pwr != lchan->ms_power)
+ send_pwr_ctrl_msg = true;
+
lchan->ms_power = new_pwr;
- /* FIXME: if chan is active and lchan->ms_power != new_pwr, consider
- sending an MS Power Control message (RSL) towards BTS to announce the
- new max ms power lvl, see rsl_chan_ms_power_ctrl() */
+
+ if (send_pwr_ctrl_msg)
+ rsl_chan_ms_power_ctrl(lchan);
}
const struct value_string lchan_activate_mode_names[] = {
diff --git a/src/utils/bs11_config.c b/src/utils/bs11_config.c
index 39acb7fd9..2a2340c4a 100644
--- a/src/utils/bs11_config.c
+++ b/src/utils/bs11_config.c
@@ -983,3 +983,4 @@ int osmo_bsc_sigtran_open_conn(struct gsm_subscriber_connection *conn, struct ms
void ts_fsm_alloc(struct gsm_bts_trx_ts *ts) {}
int abis_rsl_rcvmsg(struct msgb *msg) { return 0; }
+int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan) { return 0; }
diff --git a/src/utils/meas_json.c b/src/utils/meas_json.c
index 365b450f4..a3526de5d 100644
--- a/src/utils/meas_json.c
+++ b/src/utils/meas_json.c
@@ -190,3 +190,4 @@ int main(int argc, char **argv)
void ts_fsm_alloc(struct gsm_bts_trx_ts *ts) {}
int abis_rsl_rcvmsg(struct msgb *msg) { return 0; }
+int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan) { return 0; }
diff --git a/tests/abis/abis_test.c b/tests/abis/abis_test.c
index 5102aea6b..43934f364 100644
--- a/tests/abis/abis_test.c
+++ b/tests/abis/abis_test.c
@@ -189,3 +189,4 @@ struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_network *ne
bool on_gsm_ts_init(struct gsm_bts_trx_ts *ts) { return true; }
void ts_fsm_alloc(struct gsm_bts_trx_ts *ts) {}
+int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan) { return 0; }
diff --git a/tests/bsc/bsc_test.c b/tests/bsc/bsc_test.c
index 103e0bbb8..86b72824d 100644
--- a/tests/bsc/bsc_test.c
+++ b/tests/bsc/bsc_test.c
@@ -252,3 +252,4 @@ void ts_fsm_alloc(struct gsm_bts_trx_ts *ts) {}
void lchan_activate(struct gsm_lchan *lchan, void *info) {}
bool neighbor_ident_bts_entry_exists(uint8_t from_bts) { return false; }
const char *handover_status(struct gsm_subscriber_connection *conn) { return "x"; }
+int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan) { return 0; }
diff --git a/tests/gsm0408/gsm0408_test.c b/tests/gsm0408/gsm0408_test.c
index a30aaf841..f850274a7 100644
--- a/tests/gsm0408/gsm0408_test.c
+++ b/tests/gsm0408/gsm0408_test.c
@@ -996,3 +996,5 @@ void lchan_release(struct gsm_lchan *lchan, bool do_rr_release,
int rsl_data_request(struct msgb *msg, uint8_t link_id) { return 0; }
int rsl_encryption_cmd(struct msgb *msg) { return 0; }
+
+int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan) { return 0; }
diff --git a/tests/nanobts_omlattr/nanobts_omlattr_test.c b/tests/nanobts_omlattr/nanobts_omlattr_test.c
index 65eb05563..a3ba8e006 100644
--- a/tests/nanobts_omlattr/nanobts_omlattr_test.c
+++ b/tests/nanobts_omlattr/nanobts_omlattr_test.c
@@ -318,3 +318,4 @@ bool on_gsm_ts_init(struct gsm_bts_trx_ts *ts)
{ return true; }
void ts_fsm_alloc(struct gsm_bts_trx_ts *ts) {}
+int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan) { return 0; }