Attention is currently required from: laforge.
Hello Jenkins Builder, laforge,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-upf/+/27217
to look at the new patch set (#4).
Change subject: libosmo-gtlv: add generic TLV de- and encoder
......................................................................
libosmo-gtlv: add generic TLV de- and encoder
An all new TLV parser supporting:
- Any size of T and L (determined by callback function),
- "Grouped IEs", so that an IE payload is a nested IE structure,
- optional/mandatory/multi-occurence IEs,
- decoding unordered tags (or enforcing strict order).
Will be used for PFCP message decoding and encoding, a T16L16V protocol
which requires above features.
Upcoming patches add
- translating PDUs to plain C structs and vice versa
- TLV generator to reduce repetition a in protocol definition
- TLIV capability
Previously, the way we deal with TLVs causes a lot of code
re-implementation: the TL decoding is taken care of by the API, but for
encoding, we essentially re-implement each protocol and each encoded
message in the individual programs. This API is an improvement in that
we only once implement the TL coding (or just use osmo_t8l8v_cfg /
osmo_t16l16v_cfg), get symmetric de- and encoding of the TL, and only
need to deal with the value part of each IE.
The common pattern of
- store TL preliminarily,
- write V data and
- update L after V is complete
is conveniently done by osmo_gtlv_put_update_tl().
Related: SYS#5599
Change-Id: Ib0fd00d9f288ffe13b7e67701f3e47073587404a
---
M configure.ac
M include/osmocom/Makefile.am
A include/osmocom/gtlv/Makefile.am
A include/osmocom/gtlv/gtlv.h
M src/Makefile.am
A src/libosmo-gtlv/Makefile.am
A src/libosmo-gtlv/gtlv.c
M tests/Makefile.am
A tests/libosmo-gtlv/Makefile.am
A tests/libosmo-gtlv/gtlv_test.c
A tests/libosmo-gtlv/gtlv_test.ok
M tests/testsuite.at
12 files changed, 1,258 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-upf refs/changes/17/27217/4
--
To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/27217
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-upf
Gerrit-Branch: master
Gerrit-Change-Id: Ib0fd00d9f288ffe13b7e67701f3e47073587404a
Gerrit-Change-Number: 27217
Gerrit-PatchSet: 4
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newpatchset
Attention is currently required from: neels.
Hello Jenkins Builder, pespin,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-upf/+/27218
to look at the new patch set (#8).
Change subject: libosmo-gtlv: add auto dec/enc to/from structs
......................................................................
libosmo-gtlv: add auto dec/enc to/from structs
Add osmo_gtlv_coding: describe the value part of a TLV (decode and
encode), describe a struct with its members, and get/put readily decoded
structs from/to a raw PDU, directly.
With osmo_gtlv_coding defined for a protocol's tags, we only deal with
encoded PDUs or fully decoded C structs, no TLV related
re-implementations clutter up the message handling code.
A usage example is given in gtlv_dec_enc_test. The first real use will be
the PFCP protocol in osmo-upf.git.
With osmo_gtlv_coding, there still is a lot of monkey work involved in
describing the decoded structs. A subsequent patch adds a generator for
osmo_gtlv_coding and message structs from tag value lists.
Related: SYS#5599
Change-Id: I65de793105882a452124ee58adb0e58469e6e796
---
M include/osmocom/gtlv/Makefile.am
A include/osmocom/gtlv/gtlv_dec_enc.h
M src/libosmo-gtlv/Makefile.am
A src/libosmo-gtlv/gtlv_dec_enc.c
M tests/libosmo-gtlv/Makefile.am
A tests/libosmo-gtlv/gtlv_dec_enc_test.c
A tests/libosmo-gtlv/gtlv_dec_enc_test.ok
M tests/testsuite.at
8 files changed, 1,288 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-upf refs/changes/18/27218/8
--
To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/27218
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-upf
Gerrit-Branch: master
Gerrit-Change-Id: I65de793105882a452124ee58adb0e58469e6e796
Gerrit-Change-Number: 27218
Gerrit-PatchSet: 8
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: newpatchset
Attention is currently required from: neels.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-upf/+/27219
to look at the new patch set (#6).
Change subject: libosmo-gtlv: add C code generator for IE structs and arrays
......................................................................
libosmo-gtlv: add C code generator for IE structs and arrays
Defining a protocol of message types with lists of IEs bears a lot of
repetitive, copy-paste-error-prone writing out of data structures.
Add a third layer to libosmo-gtlv, which allows helpful code generation.
By non-repetitive data structures that briefly describe the protocol's
messages and IEs, generate possibly repetitive IE list arrays and
decoded-struct definitions automatically, avoiding grunt work errors.
I tried C macros for this at first, but it became too convoluted.
Generating C code that can be read and grepped makes things easier.
A usage example is found in tests/libosmo-gtlv/test_gtlv_gen/.
Related: SYS#5599
Change-Id: Ifb3ea54d2797ce060b95834aa117725ec2d6c4cf
---
M configure.ac
M include/osmocom/gtlv/Makefile.am
A include/osmocom/gtlv/gtlv_gen.h
M src/libosmo-gtlv/Makefile.am
A src/libosmo-gtlv/gtlv_gen.c
M tests/libosmo-gtlv/Makefile.am
A tests/libosmo-gtlv/test_gtlv_gen/Makefile.am
A tests/libosmo-gtlv/test_gtlv_gen/gen__myproto_ies_auto.c
A tests/libosmo-gtlv/test_gtlv_gen/gtlv_gen_test.c
A tests/libosmo-gtlv/test_gtlv_gen/gtlv_gen_test.ok
A tests/libosmo-gtlv/test_gtlv_gen/myproto_ies_custom.c
A tests/libosmo-gtlv/test_gtlv_gen/myproto_ies_custom.h
M tests/testsuite.at
13 files changed, 1,442 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-upf refs/changes/19/27219/6
--
To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/27219
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-upf
Gerrit-Branch: master
Gerrit-Change-Id: Ifb3ea54d2797ce060b95834aa117725ec2d6c4cf
Gerrit-Change-Number: 27219
Gerrit-PatchSet: 6
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: newpatchset
Attention is currently required from: neels, pespin.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-upf/+/27529
to look at the new patch set (#6).
Change subject: libosmo-gtlv: add TLIV capability
......................................................................
libosmo-gtlv: add TLIV capability
During code review, it was indicated that some TLV protocols that we
will likely deal with in the near future also employ an I, and instance
value of a tag. Add TLIV support.
A usage example for a manually implemented TLIV structure is found in
tests/libosmo-gtlv/gtlv_test.c.
A usage example for a generated TLIV protocol is found in
tests/libosmo-gtlv/test_tliv/.
Related: SYS#5599
Change-Id: I0a076e54dfba6038cc779cb7c8f3967d212226aa
---
M configure.ac
M include/osmocom/gtlv/gtlv.h
M include/osmocom/gtlv/gtlv_dec_enc.h
M include/osmocom/gtlv/gtlv_gen.h
M src/libosmo-gtlv/gtlv.c
M src/libosmo-gtlv/gtlv_dec_enc.c
M src/libosmo-gtlv/gtlv_gen.c
M tests/libosmo-gtlv/Makefile.am
M tests/libosmo-gtlv/gtlv_dec_enc_test.c
M tests/libosmo-gtlv/gtlv_test.c
M tests/libosmo-gtlv/gtlv_test.ok
A tests/libosmo-gtlv/test_tliv/Makefile.am
A tests/libosmo-gtlv/test_tliv/gen__myproto_ies_auto.c
A tests/libosmo-gtlv/test_tliv/myproto_ies_custom.c
A tests/libosmo-gtlv/test_tliv/myproto_ies_custom.h
A tests/libosmo-gtlv/test_tliv/tliv_test.c
A tests/libosmo-gtlv/test_tliv/tliv_test.ok
M tests/testsuite.at
18 files changed, 938 insertions(+), 172 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-upf refs/changes/29/27529/6
--
To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/27529
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-upf
Gerrit-Branch: master
Gerrit-Change-Id: I0a076e54dfba6038cc779cb7c8f3967d212226aa
Gerrit-Change-Number: 27529
Gerrit-PatchSet: 6
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newpatchset
Attention is currently required from: pespin.
Hello Jenkins Builder, laforge,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-upf/+/27221
to look at the new patch set (#7).
Change subject: libosmo-pfcp: add pfcp_proto.h pfcp_strs.h
......................................................................
libosmo-pfcp: add pfcp_proto.h pfcp_strs.h
Related: SYS#5599
Change-Id: I568b821e89007ed52eeefcdbcb6edd8052a8b5be
---
M configure.ac
M include/osmocom/Makefile.am
A include/osmocom/pfcp/Makefile.am
A include/osmocom/pfcp/pfcp_proto.h
A include/osmocom/pfcp/pfcp_strs.h
M src/Makefile.am
A src/libosmo-pfcp/Makefile.am
A src/libosmo-pfcp/pfcp_strs.c
8 files changed, 1,152 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-upf refs/changes/21/27221/7
--
To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/27221
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-upf
Gerrit-Branch: master
Gerrit-Change-Id: I568b821e89007ed52eeefcdbcb6edd8052a8b5be
Gerrit-Change-Number: 27221
Gerrit-PatchSet: 7
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newpatchset
Attention is currently required from: pespin.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-upf/+/27222
to look at the new patch set (#11).
Change subject: libosmo-pfcp: implement/generate TLV and IE value coding
......................................................................
libosmo-pfcp: implement/generate TLV and IE value coding
Related: SYS#5599
Change-Id: I3069045b2d42dac88d955c636230adc64a7a4aa7
---
M include/osmocom/pfcp/Makefile.am
A include/osmocom/pfcp/pfcp_ies_custom.h
M src/libosmo-pfcp/Makefile.am
A src/libosmo-pfcp/gen__pfcp_ies_auto.c
A src/libosmo-pfcp/pfcp_ies_custom.c
5 files changed, 1,565 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-upf refs/changes/22/27222/11
--
To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/27222
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-upf
Gerrit-Branch: master
Gerrit-Change-Id: I3069045b2d42dac88d955c636230adc64a7a4aa7
Gerrit-Change-Number: 27222
Gerrit-PatchSet: 11
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newpatchset
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/27559 )
Change subject: osmo-bts-trx: detect half burst filling, filter BER10k
......................................................................
osmo-bts-trx: detect half burst filling, filter BER10k
According to 3GPP TS 45.002, section A.2.2, in DTXu mode the MS may
use half burst filling, so that only half of the encoded block is
present. In this case we can still decode a valid L2 frame (partial
SID), but as expected the calulated BER would be around 50%.
Half burst filling for TCH/F can be visualized as follows:
7 6 5 4 3 2 1 0
+---+---+---+---+---+---+---+---+---+---+---+---+
| | | | | | | | | a | b | c | d | Partial SID (BER ~50%)
+---+---+---+---+---+---+---+---+---+---+---+---+
| | | | | a | b | c | d | e | f | g | h | SID (BER 0%)
+---+---+---+---+---+---+---+---+---+---+---+---+
| a | b | c | d | e | f | g | h | | | | | Partial SID (BER ~50%)
+---+---+---+---+---+---+---+---+---+---+---+---+
|<----------------------------->|
Burst buffer
Half burst filling for TCH/H can be visualized as follows:
7 6 5 4 3 2 1 0
+---+---+---+---+---+---+---+---+
| | | | | a | b | c | d | Partial SID (BER ~50%)
+---+---+---+---+---+---+---+---+
| | | a | b | c | d | | | SID (BER 0%)
+---+---+---+---+---+---+---+---+
| a | b | c | d | | | | | Partial SID (BER ~50%)
+---+---+---+---+---+---+---+---+
|<--------------------->|
Burst buffer
In both cases an empty cell corresponds to a NOPE.ind (missing burst).
We need to detect such cases and fliter out the expected BER of 50%.
This can be achieved by checking completeness of the burst buffer,
in particular by maintaining an additional sliding mask of NOPE.ind.
Change-Id: Ia46d68603292b5c5c65f5c6552494223f10ee813
Related: SYS#5853
---
M include/osmo-bts/scheduler.h
M src/osmo-bts-trx/sched_lchan_tchf.c
M src/osmo-bts-trx/sched_lchan_tchh.c
3 files changed, 77 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/59/27559/1
diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h
index e39315f..ff7c36f 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -101,6 +101,7 @@
sbit_t *ul_bursts_prev;/* previous burst buffer for RX (repeated SACCH) */
uint32_t ul_first_fn; /* fn of first burst */
uint8_t ul_mask; /* mask of received bursts */
+ uint16_t nope_mask; /* mask of received NOPE.ind */
/* loss detection */
uint8_t lost_frames; /* how many L2 frames were lost */
diff --git a/src/osmo-bts-trx/sched_lchan_tchf.c b/src/osmo-bts-trx/sched_lchan_tchf.c
index 6a9a0f0..e1593e4 100644
--- a/src/osmo-bts-trx/sched_lchan_tchf.c
+++ b/src/osmo-bts-trx/sched_lchan_tchf.c
@@ -45,12 +45,33 @@
#include <sched_utils.h>
#include <loops.h>
+static bool is_partial_sid(const struct gsm_lchan *lchan, uint16_t nope_mask)
+{
+ /* 7 6 5 4 3 2 1 0
+ * +---+---+---+---+---+---+---+---+---+---+---+---+
+ * | | | | | | | | | a | b | c | d | Partial SID (BER ~50%)
+ * +---+---+---+---+---+---+---+---+---+---+---+---+
+ * | | | | | a | b | c | d | e | f | g | h | SID (BER 0%)
+ * +---+---+---+---+---+---+---+---+---+---+---+---+
+ * | a | b | c | d | e | f | g | h | | | | | Partial SID (BER ~50%)
+ * +---+---+---+---+---+---+---+---+---+---+---+---+
+ * |<----------------------------->|
+ * Burst buffer
+ */
+ if (!lchan->tch.dtx.ul_sid)
+ return false;
+ if ((~nope_mask & 0xff) == 0xff)
+ return false;
+ return true;
+}
+
/*! \brief a single TCH/F burst was received by the PHY, process it */
int rx_tchf_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi)
{
struct l1sched_chan_state *chan_state = &l1ts->chan_state[bi->chan];
struct gsm_lchan *lchan = chan_state->lchan;
sbit_t *burst, **bursts_p = &chan_state->ul_bursts;
+ uint16_t *nope_mask = &chan_state->nope_mask;
uint8_t *mask = &chan_state->ul_mask;
uint8_t rsl_cmode = chan_state->rsl_cmode;
uint8_t tch_mode = chan_state->tch_mode;
@@ -85,11 +106,15 @@
if (bi->bid == 0) {
memcpy(*bursts_p, *bursts_p + 464, 464);
memset(*bursts_p + 464, 0, 464);
+ *nope_mask = *nope_mask << 4;
*mask = *mask << 4;
}
/* update mask */
*mask |= (1 << bi->bid);
+ /* update NOPE.ind mask */
+ if (bi->flags & TRX_BI_F_NOPE_IND)
+ *nope_mask |= (1 << bi->bid);
/* store measurements */
trx_sched_meas_push(chan_state, bi);
@@ -206,6 +231,8 @@
return -EINVAL;
}
+ ber10k = compute_ber10k(n_bits_total, n_errors);
+
/* average measurements of the last N (depends on mode) bursts */
trx_sched_meas_avg(chan_state, &meas_avg, meas_avg_mode);
/* meas_avg.fn now contains TDMA frame number of the first burst */
@@ -221,12 +248,23 @@
"Received bad data (%u/%u) with invalid codec mode %d\n",
bi->fn % l1ts->mf_period, l1ts->mf_period, rc);
bfi_flag = true;
+ } else if (ber10k > 0 && is_partial_sid(lchan, *nope_mask)) {
+ /* In DTXu mode the MS may use half burst filling (see 3GPP TS 45.002,
+ * section A.2.2), so that only half of the encoded block is present.
+ * In this case we can still decode a valid L2 frame (partial SID),
+ * but as expected the calulated BER would be around 50%. */
+ LOGL1SB(DL1P, LOGL_DEBUG, l1ts, bi,
+ "Half burst filling detected: mask=0x%04x, ber10k=%d (%d/%d)\n",
+ *nope_mask, ber10k, n_errors, n_bits_total);
+ /* Filter out the expected 50% of BER (+1% to be sure) */
+ if (ber10k < 5100)
+ ber10k = 0;
+ /* TODO: shall we set is_sub=1 for partial SID frames? */
}
if (rc != GSM_MACBLOCK_LEN && lchan->ecu_state)
osmo_ecu_frame_in(lchan->ecu_state, bfi_flag, tch_data, rc);
- ber10k = compute_ber10k(n_bits_total, n_errors);
if (bfi_flag)
goto bfi;
diff --git a/src/osmo-bts-trx/sched_lchan_tchh.c b/src/osmo-bts-trx/sched_lchan_tchh.c
index 369e35b..36f8abb 100644
--- a/src/osmo-bts-trx/sched_lchan_tchh.c
+++ b/src/osmo-bts-trx/sched_lchan_tchh.c
@@ -45,12 +45,33 @@
#include <sched_utils.h>
#include <loops.h>
+static bool is_partial_sid(const struct gsm_lchan *lchan, uint16_t nope_mask)
+{
+ /* 7 6 5 4 3 2 1 0
+ * +---+---+---+---+---+---+---+---+
+ * | | | | | a | b | c | d | Partial SID (BER ~50%)
+ * +---+---+---+---+---+---+---+---+
+ * | | | a | b | c | d | | | SID (BER 0%)
+ * +---+---+---+---+---+---+---+---+
+ * | a | b | c | d | | | | | Partial SID (BER ~50%)
+ * +---+---+---+---+---+---+---+---+
+ * |<--------------------->|
+ * Burst buffer
+ */
+ if (!lchan->tch.dtx.ul_sid)
+ return false;
+ if ((~nope_mask & 0x3c) == 0x3c)
+ return false;
+ return true;
+}
+
/*! \brief a single TCH/H burst was received by the PHY, process it */
int rx_tchh_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi)
{
struct l1sched_chan_state *chan_state = &l1ts->chan_state[bi->chan];
struct gsm_lchan *lchan = chan_state->lchan;
sbit_t *burst, **bursts_p = &chan_state->ul_bursts;
+ uint16_t *nope_mask = &chan_state->nope_mask;
uint8_t *mask = &chan_state->ul_mask;
uint8_t rsl_cmode = chan_state->rsl_cmode;
uint8_t tch_mode = chan_state->tch_mode;
@@ -91,11 +112,15 @@
memcpy(*bursts_p, *bursts_p + 232, 232);
memcpy(*bursts_p + 232, *bursts_p + 464, 232);
memset(*bursts_p + 464, 0, 232);
+ *nope_mask = *nope_mask << 2;
*mask = *mask << 2;
}
/* update mask */
*mask |= (1 << bi->bid);
+ /* update NOPE.ind mask */
+ if (bi->flags & TRX_BI_F_NOPE_IND)
+ *nope_mask |= (1 << bi->bid);
/* store measurements */
trx_sched_meas_push(chan_state, bi);
@@ -248,6 +273,18 @@
"Received bad data (%u/%u) with invalid codec mode %d\n",
bi->fn % l1ts->mf_period, l1ts->mf_period, rc);
bfi_flag = true;
+ } else if (ber10k > 0 && is_partial_sid(lchan, *nope_mask)) {
+ /* In DTXu mode the MS may use half burst filling (see 3GPP TS 45.002,
+ * section A.2.2), so that only half of the encoded block is present.
+ * In this case we can still decode a valid L2 frame (partial SID),
+ * but as expected the calulated BER would be around 50%. */
+ LOGL1SB(DL1P, LOGL_DEBUG, l1ts, bi,
+ "Half burst filling detected: mask=0x%04x, ber10k=%d (%d/%d)\n",
+ *nope_mask, ber10k, n_errors, n_bits_total);
+ /* Filter out the expected 50% of BER (+1% to be sure) */
+ if (ber10k < 5100)
+ ber10k = 0;
+ /* TODO: shall we set is_sub=1 for partial SID frames? */
}
if (rc != GSM_MACBLOCK_LEN && lchan->ecu_state)
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/27559
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ia46d68603292b5c5c65f5c6552494223f10ee813
Gerrit-Change-Number: 27559
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newchange
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/27557 )
Change subject: osmo-bts-trx: rx_{tchh,tchf}_fn(): use AMR CMI lookup tables
......................................................................
osmo-bts-trx: rx_{tchh,tchf}_fn(): use AMR CMI lookup tables
3GPP TS 45.009 defines that Codec Mode Indications shall be sent
with speech frames having specific TDMA frame numbers of their
*first* bursts, which are defined in tables 3.2.1.3-{1,2,3,4}.
Performance-wise it's batter to have these tables implemented as
arrays, rather then using the 'switch' statement. We can simplify
things even further and have TDMA frame numbers corresponding to
the *last* bursts in them. This eliminates the need of doing an
additional last-to-first mapping, so that bi->fn can be used.
Change-Id: I46def864729c8f9063af201750456771ea5558d5
---
M src/osmo-bts-trx/sched_lchan_tchf.c
M src/osmo-bts-trx/sched_lchan_tchh.c
M src/osmo-bts-trx/sched_utils.h
3 files changed, 20 insertions(+), 12 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/57/27557/1
diff --git a/src/osmo-bts-trx/sched_lchan_tchf.c b/src/osmo-bts-trx/sched_lchan_tchf.c
index c8ad383..6a9a0f0 100644
--- a/src/osmo-bts-trx/sched_lchan_tchf.c
+++ b/src/osmo-bts-trx/sched_lchan_tchf.c
@@ -131,8 +131,7 @@
* the first FN 4,13,21 defines that CMR is included in frame.
* NOTE: A frame ends 7 FN after start.
*/
- fn_begin = trx_sched_lookup_fn(chan_state, 8);
- amr_is_cmr = !ul_amr_fn_is_cmi(fn_begin);
+ amr_is_cmr = !sched_tchf_ul_amr_cmi_map[bi->fn % 26];
/* The AFS_ONSET frame itself does not result into an RTP frame
* since it only contains a recognition pattern that marks the
diff --git a/src/osmo-bts-trx/sched_lchan_tchh.c b/src/osmo-bts-trx/sched_lchan_tchh.c
index 1778d36..369e35b 100644
--- a/src/osmo-bts-trx/sched_lchan_tchh.c
+++ b/src/osmo-bts-trx/sched_lchan_tchh.c
@@ -165,16 +165,7 @@
break;
}
- /* Calculate the frame number where the block begins. Note that
- * we need to traverse the measurement histort back by 6 bursts,
- * not by 4 bursts. The reason for this is that the burst shift
- * buffer we use for decoding is 6 bursts wide (one SACCH block) but
- * TCH/H blocks are only 4 bursts wide. The decoder functions look
- * at the beginning of the buffer while we shift into it at the end,
- * this means that TCH/H blocks always decoded delayed by two frame
- * number positions late. */
- fn_begin = trx_sched_lookup_fn(chan_state, 6);
- fn_is_cmi = ul_amr_fn_is_cmi(fn_begin);
+ fn_is_cmi = sched_tchh_ul_amr_cmi_map[bi->fn % 26];
/* See comment in function rx_tchf_fn() */
amr = 2;
diff --git a/src/osmo-bts-trx/sched_utils.h b/src/osmo-bts-trx/sched_utils.h
index f76e49b..398083d 100644
--- a/src/osmo-bts-trx/sched_utils.h
+++ b/src/osmo-bts-trx/sched_utils.h
@@ -37,6 +37,24 @@
return 10000 * n_errors / n_bits_total;
}
+/* 3GPP TS 45.009, table 3.2.1.3-{1,3}: AMR on Uplink TCH/F */
+static const uint8_t sched_tchf_ul_amr_cmi_map[26] = {
+ [7] = 1, /* TCH/F: first=0 / last=7 */
+ [16] = 1, /* TCH/F: first=8 / last=16 */
+ [24] = 1, /* TCH/F: first=17 / last=24 */
+};
+
+/* 3GPP TS 45.009, table 3.2.1.3-{2,4}: AMR on Uplink TCH/H */
+static const uint8_t sched_tchh_ul_amr_cmi_map[26] = {
+ [6] = 1, /* TCH/H(0): first=0 / last=6 */
+ [15] = 1, /* TCH/H(0): first=8 / last=15 */
+ [23] = 1, /* TCH/H(0): first=17 / last=23 */
+
+ [7] = 1, /* TCH/H(1): first=1 / last=7 */
+ [16] = 1, /* TCH/H(1): first=9 / last=16 */
+ [24] = 1, /* TCH/H(1): first=18 / last=24 */
+};
+
/*! determine whether an uplink AMR block is CMI according to 3GPP TS 45.009.
* \param[in] fn_begin frame number of the beginning of the block.
* \returns true in case of CMI; false otherwise. */
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/27557
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I46def864729c8f9063af201750456771ea5558d5
Gerrit-Change-Number: 27557
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newchange