wbokslag has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-tetra/+/33942 )
Change subject: Added support for slot stealing ......................................................................
Added support for slot stealing
Slot stealing is how a traffic slot can be partially or fully "stolen" by a control channel. This patch adds support for that and maintains the stealing status in the tetra_mac_state. This can be used to prevent passing a signalling half slot to the voice decoder.
Change-Id: I01a112e6e74f75401649d358b8f98c6248d2522b --- M src/lower_mac/tetra_lower_mac.c M src/tetra_common.h 2 files changed, 29 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-tetra refs/changes/42/33942/1
diff --git a/src/lower_mac/tetra_lower_mac.c b/src/lower_mac/tetra_lower_mac.c index 2a2cbbe..2ff8057 100644 --- a/src/lower_mac/tetra_lower_mac.c +++ b/src/lower_mac/tetra_lower_mac.c @@ -186,8 +186,15 @@ DEBUGP("%s %s type4: %s\n", tbp->name, time_str, osmo_ubit_dump(type4, tbp->type345_bits));
+ /* Handle block 1 slot stealing, see clause 19.4.4 */ + /* Block 1 is stolen if AACH says slot is traffic and burst used training sequence 1 */ + /* Block 2 is stolen if indicated in stolen block 1 resource len (-2) */ + if (tms->cur_burst.is_traffic && type == TPSAP_T_NDB && blk_num == BLK_1) { + tms->cur_burst.blk1_stolen = true; + } + /* If this is a traffic channel, dump. */ - if ((type == TPSAP_T_SCH_F) && tms->cur_burst.is_traffic && tms->dumpdir) { + if (tms->cur_burst.is_traffic && (type == TPSAP_T_SCH_F || (blk_num == BLK_2 && !tms->cur_burst.blk2_stolen))) { char fname[PATH_MAX]; int16_t block[690]; FILE *f; @@ -229,6 +236,7 @@ f = fopen(fname, "a"); fprintf(f, "%d\n", tms->ssi); fclose(f); + goto out; }
if (tbp->interleave_a) { @@ -333,6 +341,7 @@ msg->l4h = 0; }
+out: talloc_free(msg); talloc_free(ttp); } diff --git a/src/tetra_common.h b/src/tetra_common.h index dc538d0..3296a3f 100644 --- a/src/tetra_common.h +++ b/src/tetra_common.h @@ -3,8 +3,12 @@
#include <stdint.h> #include "tetra_mac_pdu.h" +#include <stdbool.h> #include <osmocom/core/linuxlist.h>
+#include "tetra_common.h" +#include "tetra_mac_pdu.h" + #ifdef DEBUG #define DEBUGP(x, args...) printf(x, ## args) #else @@ -46,12 +50,16 @@ struct llist_head voice_channels; struct { int is_traffic; + bool blk1_stolen; + bool blk2_stolen; } cur_burst; struct tetra_si_decoded last_sid;
char *dumpdir; /* Where to save traffic channel dump */ int ssi; /* SSI */ int tsn; /* Timeslon number */ + int usage_marker; /* Usage marker (if addressed)*/ + int addr_type; };
void tetra_mac_state_init(struct tetra_mac_state *tms);