aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-sysmo/tch.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/osmo-bts-sysmo/tch.c')
-rw-r--r--src/osmo-bts-sysmo/tch.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/osmo-bts-sysmo/tch.c b/src/osmo-bts-sysmo/tch.c
index a63910f8..c6c782fa 100644
--- a/src/osmo-bts-sysmo/tch.c
+++ b/src/osmo-bts-sysmo/tch.c
@@ -443,6 +443,10 @@ void bts_model_rtp_rx_cb(struct osmo_rtp_socket *rs, const uint8_t *rtp_pl,
DEBUGP(DRTP, "%s RTP IN: %s\n", gsm_lchan_name(lchan),
osmo_hexdump(rtp_pl, rtp_pl_len));
+ /* skip processing of incoming RTP frames if we are in loopback mode */
+ if (lchan->loopback)
+ return;
+
msg = l1p_msgb_alloc();
if (!msg) {
LOGP(DRTP, LOGL_ERROR, "%s: Failed to allocate Rx payload.\n",
@@ -538,6 +542,42 @@ int l1if_tch_rx(struct gsm_lchan *lchan, struct msgb *l1p_msg)
}
payload_len = data_ind->msgUnitParam.u8Size - 1;
+ if (lchan->loopback) {
+ GsmL1_Prim_t *rl1p;
+ GsmL1_PhDataReq_t *data_req;
+ GsmL1_MsgUnitParam_t *msu_param;
+
+ struct msgb *tmp;
+ int count = 0;
+
+ /* generate a new msgb from the paylaod */
+ rmsg = l1p_msgb_alloc();
+ if (!rmsg)
+ return -ENOMEM;
+
+ rl1p = msgb_l1prim(rmsg);
+ data_req = &rl1p->u.phDataReq;
+ msu_param = &data_req->msgUnitParam;
+
+ memcpy(msu_param->u8Buffer,
+ data_ind->msgUnitParam.u8Buffer,
+ data_ind->msgUnitParam.u8Size);
+ msu_param->u8Size = data_ind->msgUnitParam.u8Size;
+
+ /* make sure the queue doesn't get too long */
+ llist_for_each_entry(tmp, &lchan->dl_tch_queue, list)
+ count++;
+ while (count >= 1) {
+ tmp = msgb_dequeue(&lchan->dl_tch_queue);
+ msgb_free(tmp);
+ count--;
+ }
+
+ msgb_enqueue(&lchan->dl_tch_queue, rmsg);
+
+ return 0;
+ }
+
switch (payload_type) {
case GsmL1_TchPlType_Fr:
#if defined(L1_HAS_EFR) && defined(USE_L1_RTP_MODE)