Change in osmo-bts[master]: osmo-bts-virtual: implement GSMTAP_CHANNEL_VOICE

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/.

neels gerrit-no-reply at lists.osmocom.org
Thu Mar 5 12:28:08 UTC 2020


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/17377 )


Change subject: osmo-bts-virtual: implement GSMTAP_CHANNEL_VOICE
......................................................................

osmo-bts-virtual: implement GSMTAP_CHANNEL_VOICE

This allows doing voice calls over virtphy. Only TCH/F tested so far.

Change-Id: I1cd9a251ce0b87181a0822d7940bbfc9f1428543
---
M src/osmo-bts-virtual/l1_if.c
M src/osmo-bts-virtual/scheduler_virtbts.c
2 files changed, 33 insertions(+), 17 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/77/17377/1

diff --git a/src/osmo-bts-virtual/l1_if.c b/src/osmo-bts-virtual/l1_if.c
index ab2cb76..fd7fa54 100644
--- a/src/osmo-bts-virtual/l1_if.c
+++ b/src/osmo-bts-virtual/l1_if.c
@@ -87,6 +87,7 @@
 	uint8_t link_id;			/* rsl link id tells if this is an ssociated or dedicated link */
 	uint8_t chan_nr;			/* encoded rsl channel type, timeslot and mf subslot */
 	struct osmo_phsap_prim l1sap;
+	struct msgb *msg_tch;
 
 	memset(&l1sap, 0, sizeof(l1sap));
 	/* get rid of l1 gsmtap hdr */
@@ -128,12 +129,7 @@
 		break;
 	case GSMTAP_CHANNEL_TCH_F:
 	case GSMTAP_CHANNEL_TCH_H:
-#if 0
-		/* TODO: handle voice messages */
-		if (!facch && ! tch_acch) {
-			osmo_prim_init(&l1sap.oph, SAP_GSM_PH, PRIM_TCH, PRIM_OP_INDICATION, msg);
-		}
-#endif
+		/* This is TCH signalling, for voice frames see GSMTAP_CHANNEL_VOICE */
 	case GSMTAP_CHANNEL_SDCCH4:
 	case GSMTAP_CHANNEL_SDCCH8:
 	case GSMTAP_CHANNEL_PACCH:
@@ -151,6 +147,14 @@
 		l1sap.u.data.pdch_presence_info = PRES_INFO_BOTH;
 		l1if_process_meas_res(pinst->trx, timeslot, fn, chan_nr, 0, 0, 0, 0);
 		break;
+	case GSMTAP_CHANNEL_VOICE:
+		msg_tch = msgb_alloc_headroom(sizeof(l1sap) + msg->len, sizeof(l1sap),
+					      "virtphy-voice-frame-from-GSMTAP-to-Um");
+		msgb_put(msg_tch, msg->len);
+		memcpy(msg_tch->data, msg->data, msg->len);
+		add_l1sap_header(pinst->trx, msg_tch, NULL, chan_nr, fn,
+				 0, 10 * signal_dbm, 0, 0, 0);
+		return;
 	case GSMTAP_CHANNEL_AGCH:
 	case GSMTAP_CHANNEL_PCH:
 	case GSMTAP_CHANNEL_BCCH:
diff --git a/src/osmo-bts-virtual/scheduler_virtbts.c b/src/osmo-bts-virtual/scheduler_virtbts.c
index 91d9153..aae78fe 100644
--- a/src/osmo-bts-virtual/scheduler_virtbts.c
+++ b/src/osmo-bts-virtual/scheduler_virtbts.c
@@ -51,8 +51,8 @@
  * This will at first wrap the msg with a GSMTAP header and then write it to the declared multicast socket.
  * TODO: we might want to remove unused argument uint8_t tn
  */
-static void tx_to_virt_um(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
-			  enum trx_chan_type chan, struct msgb *msg)
+static void _tx_to_virt_um(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
+			   enum trx_chan_type chan, struct msgb *msg, bool is_voice_frame)
 {
 	const struct trx_chan_desc *chdesc = &trx_chan_desc[chan];
 	struct msgb *outmsg;			/* msg to send with gsmtap header prepended */
@@ -69,9 +69,11 @@
 	rsl_dec_chan_nr(chdesc->chan_nr, &rsl_chantype, &subslot, &timeslot);
 	/* the timeslot is not encoded in the chan_nr of the chdesc, and so has to be overwritten */
 	timeslot = tn;
+	if (is_voice_frame)
+		gsmtap_chantype = GSMTAP_CHANNEL_VOICE;
 	/* in Osmocom, AGCH is only sent on ccch block 0. no idea why. this seems to cause false GSMTAP channel
 	 * types for agch and pch. */
-	if (rsl_chantype == RSL_CHAN_PCH_AGCH &&
+	else if (rsl_chantype == RSL_CHAN_PCH_AGCH &&
 	    l1sap_fn2ccch_block(fn) >= num_agch(l1t->trx, "PH-DATA-REQ"))
 		gsmtap_chantype = GSMTAP_CHANNEL_PCH;
 	else
@@ -104,6 +106,18 @@
 	msgb_free(msg);
 }
 
+static void tx_to_virt_um(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
+			  enum trx_chan_type chan, struct msgb *msg)
+{
+	_tx_to_virt_um(l1t, tn, fn, chan, msg, false);
+}
+
+static void tx_to_virt_um_voice_frame(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
+				      enum trx_chan_type chan, struct msgb *msg)
+{
+	_tx_to_virt_um(l1t, tn, fn, chan, msg, true);
+}
+
 /*
  * TX on downlink
  */
@@ -410,11 +424,10 @@
 		goto send_burst;
 	}
 
-	if (msg_facch) {
+	if (msg_facch)
 		tx_to_virt_um(l1t, tn, fn, chan, msg_facch);
-		msgb_free(msg_tch);
-	} else
-		tx_to_virt_um(l1t, tn, fn, chan, msg_tch);
+	if (msg_tch)
+		tx_to_virt_um_voice_frame(l1t, tn, fn, chan, msg_tch);
 
 send_burst:
 
@@ -451,11 +464,10 @@
 		goto send_burst;
 	}
 
-	if (msg_facch) {
+	if (msg_facch)
 		tx_to_virt_um(l1t, tn, fn, chan, msg_facch);
-		msgb_free(msg_tch);
-	} else if (msg_tch)
-		tx_to_virt_um(l1t, tn, fn, chan, msg_tch);
+	if (msg_tch)
+		tx_to_virt_um_voice_frame(l1t, tn, fn, chan, msg_tch);
 
 send_burst:
 	return NULL;

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/17377
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I1cd9a251ce0b87181a0822d7940bbfc9f1428543
Gerrit-Change-Number: 17377
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200305/cab0d71b/attachment.htm>


More information about the gerrit-log mailing list