This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Max gerrit-no-reply at lists.osmocom.org
Review at https://gerrit.osmocom.org/2313
Prepare for extended SI2quater support Supporting
SI2quater support as per 3GPP TS 44.018 will require chnages to the way
System Information is stored because it uses 1:n instead of 1:1 mapping
between SI type and generated SI content. This should not affect other
SI types though. To facilitate this transition:
* convert the code to always use GSM_LCHAN_SI helper instead of
accessing buffer directly
* move duplicated code to inline function
Requires I74e4e3cb86364cec869a1472a41b4a95af0d50dd in OpenBSC.
Change-Id: Ie97be6ead6ce6d2d425fbfac8429bb90afb95acc
Related: RT#8792
---
M src/common/rsl.c
M src/common/sysinfo.c
M tests/misc/misc_test.c
3 files changed, 32 insertions(+), 32 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/13/2313/1
diff --git a/src/common/rsl.c b/src/common/rsl.c
index 1d0bcea..7032d27 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -432,6 +432,30 @@
TLVP_VAL(&tp, RSL_IE_SMSCB_MSG));
}
+static inline void lapdm_ui_prefix(uint8_t *buf, uint32_t *valid, const uint8_t *current, uint8_t osmo_si, uint16_t len)
+{
+ /* We have to pre-fix with the two-byte LAPDM UI header */
+ if (len > sizeof(sysinfo_buf_t) - 2)
+ len = sizeof(sysinfo_buf_t) - 2;
+
+ (*valid) |= (1 << osmo_si);
+ buf[0] = 0x03; /* C/R + EA */
+ buf[1] = 0x03; /* UI frame */
+
+ memset(buf + 2, 0x2b, sizeof(sysinfo_buf_t) - 2);
+ memcpy(buf + 2, current, len);
+}
+
+static inline void lapdm_ui_prefix_bts(struct gsm_bts *bts, const uint8_t *current, uint8_t osmo_si, uint16_t len)
+{
+ lapdm_ui_prefix(GSM_BTS_SI(bts, osmo_si), &bts->si_valid, current, osmo_si, len);
+}
+
+static inline void lapdm_ui_prefix_lchan(struct gsm_lchan *lchan, const uint8_t *current, uint8_t osmo_si, uint16_t len)
+{
+ lapdm_ui_prefix(GSM_LCHAN_SI(lchan, osmo_si), &lchan->si.valid, current, osmo_si, len);
+}
+
/* 8.6.2 SACCH FILLING */
static int rsl_rx_sacch_fill(struct gsm_bts_trx *trx, struct msgb *msg)
{
@@ -457,15 +481,8 @@
}
if (TLVP_PRESENT(&tp, RSL_IE_L3_INFO)) {
uint16_t len = TLVP_LEN(&tp, RSL_IE_L3_INFO);
- /* We have to pre-fix with the two-byte LAPDM UI header */
- if (len > sizeof(sysinfo_buf_t)-2)
- len = sizeof(sysinfo_buf_t)-2;
- bts->si_valid |= (1 << osmo_si);
- bts->si_buf[osmo_si][0] = 0x03; /* C/R + EA */
- bts->si_buf[osmo_si][1] = 0x03; /* UI frame */
- memset(bts->si_buf[osmo_si]+2, 0x2b, sizeof(sysinfo_buf_t)-2);
- memcpy(bts->si_buf[osmo_si]+2,
- TLVP_VAL(&tp, RSL_IE_L3_INFO), len);
+ lapdm_ui_prefix_bts(bts, TLVP_VAL(&tp, RSL_IE_L3_INFO), osmo_si, len);
+
LOGP(DRSL, LOGL_INFO, " Rx RSL SACCH FILLING (SI%s)\n",
get_value_string(osmo_sitype_strs, osmo_si));
} else {
@@ -699,8 +716,7 @@
continue;
}
lchan->si.valid |= osmo_si_shifted;
- memcpy(lchan->si.buf[osmo_si], bts->si_buf[osmo_si],
- sizeof(sysinfo_buf_t));
+ memcpy(GSM_LCHAN_SI(lchan, osmo_si), GSM_BTS_SI(bts, osmo_si), sizeof(sysinfo_buf_t));
}
}
@@ -885,7 +901,6 @@
uint8_t rsl_si = *cur++;
uint8_t si_len = *cur++;
uint8_t osmo_si;
- uint8_t copy_len;
if (!OSMO_IN_ARRAY(rsl_si, rsl_sacch_sitypes))
return rsl_tx_error_report(msg->trx, RSL_ERR_IE_CONTENT);
@@ -896,15 +911,7 @@
return rsl_tx_error_report(msg->trx, RSL_ERR_IE_CONTENT);
}
- copy_len = si_len;
- /* We have to pre-fix with the two-byte LAPDM UI header */
- if (copy_len > sizeof(sysinfo_buf_t)-2)
- copy_len = sizeof(sysinfo_buf_t)-2;
- lchan->si.valid |= (1 << osmo_si);
- lchan->si.buf[osmo_si][0] = 0x03;
- lchan->si.buf[osmo_si][1] = 0x03;
- memset(lchan->si.buf[osmo_si]+2, 0x2b, sizeof(sysinfo_buf_t)-2);
- memcpy(lchan->si.buf[osmo_si]+2, cur, copy_len);
+ lapdm_ui_prefix_lchan(lchan, cur, osmo_si, si_len);
cur += si_len;
if (cur >= val + tot_len) {
@@ -1337,15 +1344,8 @@
}
if (TLVP_PRESENT(&tp, RSL_IE_L3_INFO)) {
uint16_t len = TLVP_LEN(&tp, RSL_IE_L3_INFO);
- /* We have to pre-fix with the two-byte LAPDM UI header */
- if (len > sizeof(sysinfo_buf_t)-2)
- len = sizeof(sysinfo_buf_t)-2;
- lchan->si.valid |= (1 << osmo_si);
- lchan->si.buf[osmo_si][0] = 0x03;
- lchan->si.buf[osmo_si][1] = 0x03;
- memset(lchan->si.buf[osmo_si]+2, 0x2b, sizeof(sysinfo_buf_t)-2);
- memcpy(lchan->si.buf[osmo_si]+2,
- TLVP_VAL(&tp, RSL_IE_L3_INFO), len);
+ lapdm_ui_prefix_lchan(lchan, TLVP_VAL(&tp, RSL_IE_L3_INFO), osmo_si, len);
+
LOGP(DRSL, LOGL_INFO, "%s Rx RSL SACCH FILLING (SI%s)\n",
gsm_lchan_name(lchan),
get_value_string(osmo_sitype_strs, osmo_si));
diff --git a/src/common/sysinfo.c b/src/common/sysinfo.c
index 177ed58..d8671c8 100644
--- a/src/common/sysinfo.c
+++ b/src/common/sysinfo.c
@@ -154,7 +154,7 @@
if (!(lchan->si.valid & (1 << tmp)))
continue;
lchan->si.last = tmp;
- return lchan->si.buf[tmp];
+ return GSM_LCHAN_SI(lchan, tmp);
}
return NULL;
}
diff --git a/tests/misc/misc_test.c b/tests/misc/misc_test.c
index 80dd317..c2918fb 100644
--- a/tests/misc/misc_test.c
+++ b/tests/misc/misc_test.c
@@ -142,7 +142,7 @@
/* initialize the input. */
for (i = 1; i < _MAX_SYSINFO_TYPE; ++i) {
lchan.si.valid |= (1 << i);
- memset(&lchan.si.buf[i], i, sizeof(lchan.si.buf[i]));
+ memset(GSM_LCHAN_SI(&lchan, i), i, GSM_MACBLOCK_LEN);
}
/* It will start with '1' */
--
To view, visit https://gerrit.osmocom.org/2313
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie97be6ead6ce6d2d425fbfac8429bb90afb95acc
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>