From 6384c73fbfd852d45a63b729389afa2f92e02fb2 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 31 Aug 2017 13:52:10 +0200 Subject: [PATCH] Support sending SI13 to PCU * explicitly set SAPI when sending data_ind to PCU * drop unused receiving code for BCCH SAPI * send SI13 when PCU is connected * send SI13 when new SI is received Change-Id: I9e83ef792585aa962f99897d9973cef12f186bcf Related: OS#2400 --- include/osmo-bts/pcu_if.h | 1 + src/common/l1sap.c | 5 +++-- src/common/pcu_sock.c | 39 ++++++++++++++++++++++++--------------- src/common/rsl.c | 4 ++++ 4 files changed, 32 insertions(+), 17 deletions(-) diff --git a/include/osmo-bts/pcu_if.h b/include/osmo-bts/pcu_if.h index a020c050b..ba3873e1e 100644 --- a/include/osmo-bts/pcu_if.h +++ b/include/osmo-bts/pcu_if.h @@ -6,6 +6,7 @@ extern int pcu_direct; int pcu_tx_info_ind(void); +int pcu_tx_si13(const struct gsm_bts *bts); int pcu_tx_rts_req(struct gsm_bts_trx_ts *ts, uint8_t is_ptcch, uint32_t fn, uint16_t arfcn, uint8_t block_nr); int pcu_tx_data_ind(struct gsm_bts_trx_ts *ts, uint8_t is_ptcch, uint32_t fn, diff --git a/src/common/l1sap.c b/src/common/l1sap.c index 21d9dc69a..1b3a3ad83 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -52,6 +52,7 @@ #include #include #include +#include struct gsm_lchan *get_lchan_by_chan_nr(struct gsm_bts_trx *trx, unsigned int chan_nr) @@ -1013,7 +1014,7 @@ static int l1sap_ph_data_ind(struct gsm_bts_trx *trx, if (len == 0) return -EINVAL; if (L1SAP_IS_PTCCH(fn)) { - pcu_tx_data_ind(&trx->ts[tn], 1, fn, + pcu_tx_data_ind(&trx->ts[tn], PCU_IF_SAPI_PTCCH, fn, 0 /* ARFCN */, L1SAP_FN2PTCCHBLOCK(fn), data, len, rssi, data_ind->ber10k, data_ind->ta_offs_qbits, @@ -1023,7 +1024,7 @@ static int l1sap_ph_data_ind(struct gsm_bts_trx *trx, if (pr_info != PRES_INFO_BOTH) return 0; /* PDTCH / PACCH frame handling */ - pcu_tx_data_ind(&trx->ts[tn], 0, fn, 0 /* ARFCN */, + pcu_tx_data_ind(&trx->ts[tn], PCU_IF_SAPI_PDTCH, fn, 0 /* ARFCN */, L1SAP_FN2MACBLOCK(fn), data, len, rssi, data_ind->ber10k, data_ind->ta_offs_qbits, data_ind->lqual_cb); } diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c index a4ddc0522..0a9ba2db8 100644 --- a/src/common/pcu_sock.c +++ b/src/common/pcu_sock.c @@ -322,7 +322,7 @@ int pcu_tx_rts_req(struct gsm_bts_trx_ts *ts, uint8_t is_ptcch, uint32_t fn, return pcu_sock_send(&bts_gsmnet, msg); } -int pcu_tx_data_ind(struct gsm_bts_trx_ts *ts, uint8_t is_ptcch, uint32_t fn, +int pcu_tx_data_ind(struct gsm_bts_trx_ts *ts, uint8_t sapi, uint32_t fn, uint16_t arfcn, uint8_t block_nr, uint8_t *data, uint8_t len, int8_t rssi, uint16_t ber10k, int16_t bto, int16_t lqual) { @@ -332,9 +332,8 @@ int pcu_tx_data_ind(struct gsm_bts_trx_ts *ts, uint8_t is_ptcch, uint32_t fn, struct gsm_bts *bts = ts->trx->bts; struct gsm_bts_role_bts *btsb = bts_role_bts(bts); - LOGP(DPCU, LOGL_DEBUG, "Sending data indication: is_ptcch=%d arfcn=%d " - "block=%d data=%s\n", is_ptcch, arfcn, block_nr, - osmo_hexdump(data, len)); + LOGP(DPCU, LOGL_DEBUG, "Sending data indication: sapi=%s arfcn=%d block=%d data=%s\n", + sapi_string[sapi], arfcn, block_nr, osmo_hexdump(data, len)); if (lqual / 10 < btsb->min_qual_norm) { LOGP(DPCU, LOGL_DEBUG, "Link quality %"PRId16" is below threshold %f, dropping packet\n", @@ -348,7 +347,7 @@ int pcu_tx_data_ind(struct gsm_bts_trx_ts *ts, uint8_t is_ptcch, uint32_t fn, pcu_prim = (struct gsm_pcu_if *) msg->data; data_ind = &pcu_prim->u.data_ind; - data_ind->sapi = (is_ptcch) ? PCU_IF_SAPI_PTCCH : PCU_IF_SAPI_PDTCH; + data_ind->sapi = sapi; data_ind->rssi = rssi; data_ind->fn = fn; data_ind->arfcn = arfcn; @@ -488,16 +487,6 @@ static int pcu_rx_data_req(struct gsm_bts *bts, uint8_t msg_type, osmo_hexdump(data_req->data, data_req->len)); switch (data_req->sapi) { - case PCU_IF_SAPI_BCCH: - if (data_req->len == 23) { - bts->si_valid |= (1 << SYSINFO_TYPE_13); - memcpy(bts->si_buf[SYSINFO_TYPE_13], data_req->data, - data_req->len); - } else { - bts->si_valid &= ~(1 << SYSINFO_TYPE_13); - } - osmo_signal_dispatch(SS_GLOBAL, S_NEW_SYSINFO, bts); - break; case PCU_IF_SAPI_PCH: if (msg_type == PCU_IF_MSG_PAG_REQ) { /* FIXME: Add function to schedule paging request. @@ -546,6 +535,21 @@ static int pcu_rx_data_req(struct gsm_bts *bts, uint8_t msg_type, return rc; } +int pcu_tx_si13(const struct gsm_bts *bts) +{ + /* the SI is per-BTS so it doesn't matter which TRX we use */ + struct gsm_bts_trx *trx = gsm_bts_trx_num(bts, 0); + + /* The low-level data like FN, ARFCN etc will be ignored but we have to set lqual high enough to bypass + the check at lower levels */ + int rc = pcu_tx_data_ind(&trx->ts[0], PCU_IF_SAPI_BCCH, 0, 0, 0, GSM_BTS_SI(bts, SYSINFO_TYPE_13), + GSM_MACBLOCK_LEN, 0, 0, 0, INT16_MAX); + if (rc < 0) + LOGP(DPCU, LOGL_NOTICE, "Failed to send SI13 to PCU: %d\n", rc); + + return rc; +} + static int pcu_rx_txt_ind(struct gsm_bts *bts, struct gsm_pcu_if_txt_ind *txt) { @@ -555,6 +559,11 @@ static int pcu_rx_txt_ind(struct gsm_bts *bts, txt->text); osmo_signal_dispatch(SS_FAIL, OSMO_EVT_PCU_VERS, txt->text); osmo_strlcpy(bts->pcu_version, txt->text, MAX_VERSION_LENGTH); + + if (GSM_BTS_HAS_SI(bts, SYSINFO_TYPE_13)) + return pcu_tx_si13(bts); + else + LOGP(DPCU, LOGL_INFO, "SI13 is not available on PCU connection\n"); break; case PCU_OML_ALERT: osmo_signal_dispatch(SS_FAIL, OSMO_EVT_EXT_ALARM, txt->text); diff --git a/src/common/rsl.c b/src/common/rsl.c index dc176ea74..69ecf2e77 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -50,6 +50,7 @@ #include #include #include +#include //#define FAKE_CIPH_MODE_COMPL @@ -306,6 +307,9 @@ static int rsl_rx_bcch_info(struct gsm_bts_trx *trx, struct msgb *msg) LCHAN_REL_ACT_REACT; } + if (SYSINFO_TYPE_13 == osmo_si) + pcu_tx_si13(trx->bts); + if (SYSINFO_TYPE_2quater == osmo_si) { si2q = (struct gsm48_system_information_type_2quater *) TLVP_VAL(&tp, RSL_IE_FULL_BCCH_INFO); bv.data = si2q->rest_octets;