laforge submitted this change.
2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
csd_v110_rtp_decode: preserve E2 & E3 bits for RLP alignment
Modify CSD RTP input path code so incoming bits E2 & E3 from V.110
frames reach the TCH-RTS.ind handler in l1sap. These bits will be
used in the next patch to ensure proper alignment of DL RLP frames
in non-transparent CSD modes.
Related: OS#6579
Change-Id: I43b97caa6030b9401779998ca5dddc4cfe636e2f
---
M include/osmo-bts/csd_v110.h
M include/osmo-bts/msg_utils.h
M src/common/csd_v110.c
M src/common/l1sap.c
M tests/csd/csd_test.c
5 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/include/osmo-bts/csd_v110.h b/include/osmo-bts/csd_v110.h
index a7c3a1b..7d67ff0 100644
--- a/include/osmo-bts/csd_v110.h
+++ b/include/osmo-bts/csd_v110.h
@@ -17,4 +17,4 @@
const uint8_t *data, size_t data_len,
uint8_t nt48_half_num);
int csd_v110_rtp_decode(const struct gsm_lchan *lchan, uint8_t *data,
- const uint8_t *rtp, size_t rtp_len);
+ uint8_t *align_bits, const uint8_t *rtp, size_t rtp_len);
diff --git a/include/osmo-bts/msg_utils.h b/include/osmo-bts/msg_utils.h
index fb8e11a..db7142d 100644
--- a/include/osmo-bts/msg_utils.h
+++ b/include/osmo-bts/msg_utils.h
@@ -25,6 +25,9 @@
/* Access 4th part of msgb control buffer */
#define rtpmsg_is_rfc5993_sid(x) ((x)->cb[3])
+/* Access 5th part of msgb control buffer */
+#define rtpmsg_csd_align_bits(x) ((x)->cb[4])
+
/**
* Classification of OML message. ETSI for plain GSM 12.21
* messages and IPA/Osmo for manufacturer messages.
diff --git a/src/common/csd_v110.c b/src/common/csd_v110.c
index b2d2b42..e307a6e 100644
--- a/src/common/csd_v110.c
+++ b/src/common/csd_v110.c
@@ -166,10 +166,11 @@
}
int csd_v110_rtp_decode(const struct gsm_lchan *lchan, uint8_t *data,
- const uint8_t *rtp, size_t rtp_len)
+ uint8_t *align_bits, const uint8_t *rtp, size_t rtp_len)
{
const struct csd_v110_lchan_desc *desc;
ubit_t ra_bits[80 * 4];
+ uint8_t align_accum = 0;
OSMO_ASSERT(lchan->tch_mode < ARRAY_SIZE(csd_v110_lchan_desc));
desc = &csd_v110_lchan_desc[lchan->tch_mode];
@@ -207,7 +208,13 @@
osmo_csd_12k_6k_encode_frame(&data[i * 60], 60, &df);
else /* desc->num_bits == 36 */
osmo_csd_3k6_encode_frame(&data[i * 36], 36, &df);
+ /* save bits E2 & E3 that may be needed for RLP alignment */
+ align_accum <<= 2;
+ align_accum |= df.e_bits[1] << 1;
+ align_accum |= df.e_bits[2] << 0;
}
+ if (align_bits)
+ *align_bits = align_accum;
return desc->num_blocks * desc->num_bits;
}
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 65ebf35..1abc409 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -2597,6 +2597,7 @@
struct gsm_bts *bts = lchan->ts->trx->bts;
struct msgb *msg;
bool rfc5993_sid = false;
+ uint8_t csd_align_bits = 0;
rate_ctr_inc2(bts->ctrs, BTS_CTR_RTP_RX_TOTAL);
if (marker)
@@ -2631,7 +2632,7 @@
return;
if (lchan->rsl_cmode == RSL_CMOD_SPD_DATA) {
- int rc = csd_v110_rtp_decode(lchan, msg->tail,
+ int rc = csd_v110_rtp_decode(lchan, msg->tail, &csd_align_bits,
rtp_pl, rtp_pl_len);
if (rc > 0) {
/* 'fake' tch_ind containing all-zero so gsmtap code can be shared
@@ -2664,6 +2665,8 @@
rtpmsg_ts(msg) = timestamp;
/* Store RFC 5993 SID flag likewise */
rtpmsg_is_rfc5993_sid(msg) = rfc5993_sid;
+ /* ditto with CSD alignment bits */
+ rtpmsg_csd_align_bits(msg) = csd_align_bits;
/* make sure the queue doesn't get too long */
lchan_dl_tch_queue_enqueue(lchan, msg, 1);
diff --git a/tests/csd/csd_test.c b/tests/csd/csd_test.c
index 15ee84f..e52bde2 100644
--- a/tests/csd/csd_test.c
+++ b/tests/csd/csd_test.c
@@ -133,7 +133,7 @@
fprintf(stderr, " %s\n", osmo_hexdump(&rtp[i * 16], 16));
/* decode the encoded RTP frame */
- rc = csd_v110_rtp_decode(&lchan, &data_dec[0], &rtp[0], sizeof(rtp));
+ rc = csd_v110_rtp_decode(&lchan, &data_dec[0], NULL, &rtp[0], sizeof(rtp));
fprintf(stderr, "[i] csd_v110_rtp_decode() returns %d\n", rc);
if (rc != bit_num)
return;
To view, visit change 38556. To unsubscribe, or for help writing mail filters, visit settings.