diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2021-06-18 14:10:17 +0200 |
---|---|---|
committer | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2021-06-18 18:56:57 +0200 |
commit | f47fa70b9f2bebe4b12ed9ef41d22a61c8ac657c (patch) | |
tree | c63a3cfcee23160bd96b05e5815d95ed748095cc | |
parent | 54d09313307fa9ea0430c969d7a3c910b98199a2 (diff) |
osmo-bts-trx: report PDCH interference levels to the PCU
The PDCH multiframe contains 48 data slots, 2 PTCCH slots, and
2 IDLE slots. The later two can be used for the interference
measurements, since the UEs shall not transmit on them.
bts_report_interf_meas() is called every 104 TDMA frames, what
corresponds to 2 PDCH multiframe periods. Report interference
levels on PDCH timeslots from this function.
Change-Id: I56f83db5264c246ec1b4b8a973105a4fc09931fb
Related: SYS#5313, OS#1569
-rw-r--r-- | include/osmo-bts/pcu_if.h | 2 | ||||
-rw-r--r-- | include/osmo-bts/pcuif_proto.h | 10 | ||||
-rw-r--r-- | src/common/pcu_sock.c | 27 | ||||
-rw-r--r-- | src/osmo-bts-trx/scheduler_trx.c | 33 |
4 files changed, 65 insertions, 7 deletions
diff --git a/include/osmo-bts/pcu_if.h b/include/osmo-bts/pcu_if.h index add37f85..6ef8dc57 100644 --- a/include/osmo-bts/pcu_if.h +++ b/include/osmo-bts/pcu_if.h @@ -15,6 +15,8 @@ int pcu_tx_rach_ind(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr, int16_t qta, uint16_t ra, uint32_t fn, uint8_t is_11bit, enum ph_burst_type burst_type, uint8_t sapi); int pcu_tx_time_ind(uint32_t fn); +int pcu_tx_interf_ind(uint8_t bts_nr, uint8_t trx_nr, uint32_t fn, + const uint8_t *pdch_interf); int pcu_tx_pag_req(const uint8_t *identity_lv, uint8_t chan_needed); int pcu_tx_pch_data_cnf(uint32_t fn, uint8_t *data, uint8_t len); int pcu_tx_susp_req(struct gsm_lchan *lchan, uint32_t tlli, const uint8_t *ra_id, uint8_t cause); diff --git a/include/osmo-bts/pcuif_proto.h b/include/osmo-bts/pcuif_proto.h index 8f726028..38ca4b65 100644 --- a/include/osmo-bts/pcuif_proto.h +++ b/include/osmo-bts/pcuif_proto.h @@ -21,6 +21,7 @@ #define PCU_IF_MSG_INFO_IND 0x32 /* retrieve BTS info */ #define PCU_IF_MSG_ACT_REQ 0x40 /* activate/deactivate PDCH */ #define PCU_IF_MSG_TIME_IND 0x52 /* GSM time indication */ +#define PCU_IF_MSG_INTERF_IND 0x53 /* interference report */ #define PCU_IF_MSG_PAG_REQ 0x60 /* paging request */ #define PCU_IF_MSG_TXT_IND 0x70 /* Text indication for BTS */ @@ -208,6 +209,14 @@ struct gsm_pcu_if_susp_req { uint8_t cause; } __attribute__ ((packed)); +/* Interference measurements on PDCH timeslots */ +struct gsm_pcu_if_interf_ind { + uint8_t trx_nr; + uint8_t spare[3]; + uint32_t fn; + uint8_t interf[8]; +} __attribute__ ((packed)); + struct gsm_pcu_if { /* context based information */ uint8_t msg_type; /* message type */ @@ -228,6 +237,7 @@ struct gsm_pcu_if { struct gsm_pcu_if_time_ind time_ind; struct gsm_pcu_if_pag_req pag_req; struct gsm_pcu_if_app_info_req app_info_req; + struct gsm_pcu_if_interf_ind interf_ind; } u; } __attribute__ ((packed)); diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c index 3a735702..5a04bf08 100644 --- a/src/common/pcu_sock.c +++ b/src/common/pcu_sock.c @@ -560,6 +560,27 @@ int pcu_tx_time_ind(uint32_t fn) return pcu_sock_send(&bts_gsmnet, msg); } +int pcu_tx_interf_ind(uint8_t bts_nr, uint8_t trx_nr, uint32_t fn, + const uint8_t *pdch_interf) +{ + struct gsm_pcu_if_interf_ind *interf_ind; + struct gsm_pcu_if *pcu_prim; + struct msgb *msg; + + msg = pcu_msgb_alloc(PCU_IF_MSG_INTERF_IND, bts_nr); + if (!msg) + return -ENOMEM; + pcu_prim = (struct gsm_pcu_if *) msg->data; + interf_ind = &pcu_prim->u.interf_ind; + + interf_ind->trx_nr = trx_nr; + interf_ind->fn = fn; + memcpy(&interf_ind->interf[0], &pdch_interf[0], + sizeof(interf_ind->interf)); + + return pcu_sock_send(&bts_gsmnet, msg); +} + int pcu_tx_pag_req(const uint8_t *identity_lv, uint8_t chan_needed) { struct pcu_sock_state *state = bts_gsmnet.pcu_state; @@ -914,7 +935,8 @@ static int pcu_sock_send(struct gsm_network *net, struct msgb *msg) struct gsm_pcu_if *pcu_prim = (struct gsm_pcu_if *) msg->data; if (!state) { - if (pcu_prim->msg_type != PCU_IF_MSG_TIME_IND) + if (pcu_prim->msg_type != PCU_IF_MSG_TIME_IND && + pcu_prim->msg_type != PCU_IF_MSG_INTERF_IND) LOGP(DPCU, LOGL_INFO, "PCU socket not created, " "dropping message\n"); msgb_free(msg); @@ -922,7 +944,8 @@ static int pcu_sock_send(struct gsm_network *net, struct msgb *msg) } conn_bfd = &state->conn_bfd; if (conn_bfd->fd <= 0) { - if (pcu_prim->msg_type != PCU_IF_MSG_TIME_IND) + if (pcu_prim->msg_type != PCU_IF_MSG_TIME_IND && + pcu_prim->msg_type != PCU_IF_MSG_INTERF_IND) LOGP(DPCU, LOGL_NOTICE, "PCU socket not connected, " "dropping message\n"); msgb_free(msg); diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c index 97c5ff33..ef50e8df 100644 --- a/src/osmo-bts-trx/scheduler_trx.c +++ b/src/osmo-bts-trx/scheduler_trx.c @@ -45,6 +45,7 @@ #include <osmo-bts/l1sap.h> #include <osmo-bts/scheduler.h> #include <osmo-bts/scheduler_backend.h> +#include <osmo-bts/pcu_if.h> #include "l1_if.h" #include "trx_if.h" @@ -101,14 +102,36 @@ static void ts_report_interf_meas(const struct gsm_bts_trx_ts *ts) } } -static void bts_report_interf_meas(const struct gsm_bts *bts) +static void bts_report_interf_meas(const struct gsm_bts *bts, + const uint32_t fn) { const struct gsm_bts_trx *trx; - unsigned int tn; llist_for_each_entry(trx, &bts->trx_list, list) { - for (tn = 0; tn < ARRAY_SIZE(trx->ts); tn++) - ts_report_interf_meas(&trx->ts[tn]); + uint8_t pdch_interf[8] = { 0 }; + unsigned int tn, pdch_num = 0; + + for (tn = 0; tn < ARRAY_SIZE(trx->ts); tn++) { + const struct gsm_bts_trx_ts *ts = &trx->ts[tn]; + const struct l1sched_ts *l1ts = ts->priv; + const struct l1sched_chan_state *l1cs; + + /* PS interference reports for the PCU */ + if (ts_pchan(ts) == GSM_PCHAN_PDCH) { + l1cs = &l1ts->chan_state[TRXC_IDLE]; + /* Interference value is encoded as -x dBm */ + pdch_interf[tn] = -1 * l1cs->meas.interf_avg; + pdch_num++; + continue; + } + + /* CS interference reports for the BSC */ + ts_report_interf_meas(ts); + } + + /* Report interference levels on PDCH to the PCU */ + if (pdch_num > 0) + pcu_tx_interf_ind(bts->nr, trx->nr, fn, pdch_interf); } } @@ -243,7 +266,7 @@ static void bts_sched_fn(struct gsm_bts *bts, const uint32_t fn) /* Report interference measurements */ if (fn % 104 == 0) /* SACCH period */ - bts_report_interf_meas(bts); + bts_report_interf_meas(bts, fn); /* send time indication */ l1if_mph_time_ind(bts, fn); |