aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2017-06-26 11:07:38 +0200
committerMax <msuraev@sysmocom.de>2017-06-26 10:07:18 +0000
commit0d0d1d6a70a945ab3605b4da7cc9086d30e91c94 (patch)
tree55422fe21e1479abddd57ad08cf3813afca7cd34 /src
parent2a4c5fa2b388e6395b0e5d44bbf7ee60c7a82bcb (diff)
RSL: receive and send multiple SI2q messagesuser/max/si2q-test
* change BCCH Info handler to explicitly support multiple SI2quater messages sent from BSC * change SI scheduler to send SI2q in round-robin way That's resubmission of 340cff51f49f6e798cb5fb6d1b9febdd09902906 and 186c6bac0758b6f94aa101e151664b0dea5d8975 with memory initialization order change to fix the issue detected by osmo-gsm-tester - see OS#2338. Change-Id: Ib595733cde108387bc7ee76b1b11ada6a235f13c Related: OS#1660, OS#2338
Diffstat (limited to 'src')
-rw-r--r--src/common/rsl.c39
-rw-r--r--src/common/sysinfo.c16
2 files changed, 41 insertions, 14 deletions
diff --git a/src/common/rsl.c b/src/common/rsl.c
index eab93797..fa49071f 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -264,7 +264,7 @@ static int rsl_rx_bcch_info(struct gsm_bts_trx *trx, struct msgb *msg)
{
struct gsm_bts *bts = trx->bts;
struct tlv_parsed tp;
- uint8_t rsl_si, si2q_index, si2q_count;
+ uint8_t rsl_si, count;
enum osmo_sysinfo_type osmo_si;
struct gsm48_system_information_type_2quater *si2q;
struct bitvec bv;
@@ -307,21 +307,34 @@ static int rsl_rx_bcch_info(struct gsm_bts_trx *trx, struct msgb *msg)
}
if (SYSINFO_TYPE_2quater == osmo_si) {
- si2q = (struct gsm48_system_information_type_2quater *)
- bts->si_buf[SYSINFO_TYPE_2quater];
+ si2q = (struct gsm48_system_information_type_2quater *) TLVP_VAL(&tp, RSL_IE_FULL_BCCH_INFO);
bv.data = si2q->rest_octets;
- bv.data_len = 20;
+ bv.data_len = GSM_MACBLOCK_LEN;
bv.cur_bit = 3;
- si2q_index = (uint8_t) bitvec_get_uint(&bv, 4);
- si2q_count = (uint8_t) bitvec_get_uint(&bv, 4);
- if (si2q_index || si2q_count) {
- LOGP(DRSL, LOGL_ERROR,
- " Rx RSL SI2quater witn unsupported "
- "index %u, count %u\n",
- si2q_index, si2q_count);
- return rsl_tx_error_report(trx,
- RSL_ERR_IE_CONTENT);
+ bts->si2q_index = (uint8_t) bitvec_get_uint(&bv, 4);
+
+ count = (uint8_t) bitvec_get_uint(&bv, 4);
+ if (bts->si2q_count && bts->si2q_count != count) {
+ LOGP(DRSL, LOGL_ERROR, " Rx RSL SI2quater count changed while receiving: %u -> %d\n",
+ bts->si2q_count, count);
+ return rsl_tx_error_report(trx, RSL_ERR_IE_CONTENT);
+ }
+
+ bts->si2q_count = count;
+ if (bts->si2q_index > bts->si2q_count) {
+ LOGP(DRSL, LOGL_ERROR, " Rx RSL SI2quater witn index %u > count %u\n",
+ bts->si2q_index, bts->si2q_count);
+ return rsl_tx_error_report(trx, RSL_ERR_IE_CONTENT);
}
+
+ if (bts->si2q_index > SI2Q_MAX_NUM || bts->si2q_count > SI2Q_MAX_NUM) {
+ LOGP(DRSL, LOGL_ERROR, " Rx RSL SI2quater witn impossible parameters: index %u, count %u"
+ "should be <= %u\n", bts->si2q_index, bts->si2q_count, SI2Q_MAX_NUM);
+ return rsl_tx_error_report(trx, RSL_ERR_IE_CONTENT);
+ }
+
+ memset(GSM_BTS_SI2Q(bts, bts->si2q_index), GSM_MACBLOCK_PADDING, sizeof(sysinfo_buf_t));
+ memcpy(GSM_BTS_SI2Q(bts, bts->si2q_index), TLVP_VAL(&tp, RSL_IE_FULL_BCCH_INFO), len);
}
} else if (TLVP_PRESENT(&tp, RSL_IE_L3_INFO)) {
uint16_t len = TLVP_LEN(&tp, RSL_IE_L3_INFO);
diff --git a/src/common/sysinfo.c b/src/common/sysinfo.c
index 7a536274..9276c7bb 100644
--- a/src/common/sysinfo.c
+++ b/src/common/sysinfo.c
@@ -25,6 +25,16 @@
#include <osmo-bts/logging.h>
#include <osmo-bts/gsm_data.h>
+/* properly increment SI2q index and return SI2q data for scheduling */
+static inline uint8_t *get_si2q_inc_index(struct gsm_bts *bts)
+{
+ uint8_t i = bts->si2q_index;
+ /* si2q_count is the max si2q_index value, not the number of messages */
+ bts->si2q_index = (bts->si2q_index + 1) % (bts->si2q_count + 1);
+
+ return (uint8_t *)GSM_BTS_SI2Q(bts, i);
+}
+
/* Apply the rules from 05.02 6.3.1.3 Mapping of BCCH Data */
uint8_t *bts_sysinfo_get(struct gsm_bts *bts, const struct gsm_time *g_time)
{
@@ -99,6 +109,10 @@ uint8_t *bts_sysinfo_get(struct gsm_bts *bts, const struct gsm_time *g_time)
else {
/* increment static counter by one, modulo count */
btsb->si.tc4_ctr = (btsb->si.tc4_ctr + 1) % tc4_cnt;
+
+ if (tc4_sub[btsb->si.tc4_ctr] == SYSINFO_TYPE_2quater)
+ return get_si2q_inc_index(bts);
+
return GSM_BTS_SI(bts, tc4_sub[btsb->si.tc4_ctr]);
}
case 5:
@@ -114,7 +128,7 @@ uint8_t *bts_sysinfo_get(struct gsm_bts *bts, const struct gsm_time *g_time)
else if (GSM_BTS_HAS_SI(bts, SYSINFO_TYPE_2quater) &&
!GSM_BTS_HAS_SI(bts, SYSINFO_TYPE_2bis) && !GSM_BTS_HAS_SI(bts, SYSINFO_TYPE_2ter))
- return GSM_BTS_SI(bts, SYSINFO_TYPE_2quater);
+ return get_si2q_inc_index(bts);
break;
case 6:
return GSM_BTS_SI(bts, SYSINFO_TYPE_3);