[MERGED] osmocom-bb[master]: VIRT-PHY: Add downlink filter for msg on dedicated channels.

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Jul 12 21:48:53 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: VIRT-PHY: Add downlink filter for msg on dedicated channels.
......................................................................


VIRT-PHY: Add downlink filter for msg on dedicated channels.

Messages incoming on dedicated channel (SDCCH/8, SDCCH/4) are no longer
forwarded to l23 if their timeslot/subchannel is not fitting the ones
configured by l23 via L1CTL_DM_EST_REQ.

Change-Id: I6112b20e31c25636e53d3a6cda6f7443a94ff9c3
---
M src/host/virt_phy/include/virtphy/virt_l1_model.h
M src/host/virt_phy/src/gsmtapl1_if.c
M src/host/virt_phy/src/l1ctl_sap.c
M src/host/virt_phy/src/virtphy.c
4 files changed, 18 insertions(+), 16 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/host/virt_phy/include/virtphy/virt_l1_model.h b/src/host/virt_phy/include/virtphy/virt_l1_model.h
index 69115f2..d4969eb 100644
--- a/src/host/virt_phy/include/virtphy/virt_l1_model.h
+++ b/src/host/virt_phy/include/virtphy/virt_l1_model.h
@@ -67,6 +67,7 @@
 		uint8_t chan_type; // like rsl chantype 08.58 -> Chapter 9.3.1 */
 
 		uint8_t tn; // timeslot number 1-7
+		uint8_t subslot; // subslot of the dedicated channel, SDCCH/4:[0-3], SDCCH/8:[0-7]
 
 		uint8_t scn; // single-hop cellular network? (ununsed in virtual um)
 		uint8_t tsc; // training sequence code (ununsed in virtual um)
diff --git a/src/host/virt_phy/src/gsmtapl1_if.c b/src/host/virt_phy/src/gsmtapl1_if.c
index 155b4dc..b84186a 100644
--- a/src/host/virt_phy/src/gsmtapl1_if.c
+++ b/src/host/virt_phy/src/gsmtapl1_if.c
@@ -162,12 +162,10 @@
 	}
 	// we do not forward messages to l23 if we are in network search state
 	if (l1_model_ms->state->state == MS_STATE_IDLE_SEARCHING) {
-		talloc_free(msg);
-		return;
+		goto freemsg;
 	}
 
 	struct gsmtap_hdr *gh = msgb_l1(msg);
-	struct msgb *l1ctl_msg = NULL;
 	uint32_t fn = ntohl(gh->frame_number); // frame number of the rcv msg
 	uint16_t arfcn = ntohs(gh->arfcn); // arfcn of the received msg
 	uint8_t gsmtap_chantype = gh->sub_type; // gsmtap channel type
@@ -183,7 +181,7 @@
 	if (arfcn & GSMTAP_ARFCN_F_UPLINK) {
 		LOGP(DVIRPHY, LOGL_NOTICE,
 		     "Ignoring gsmtap msg from virt um - uplink flag set!\n");
-		goto nomessage;
+		goto freemsg;
 	}
 
 	// forward downlink msg to fbsb sync routine if we are in sync state
@@ -199,7 +197,7 @@
 		     "Ignoring gsmtap msg from virt um - msg arfcn=%d not equal synced arfcn=%d!\n",
 		     arfcn,
 		     l1_model_ms->state->serving_cell.arfcn);
-		goto nomessage;
+		goto freemsg;
 	}
 
 	msg->l2h = msgb_pull(msg, sizeof(*gh));
@@ -230,11 +228,17 @@
 #endif
 	case GSMTAP_CHANNEL_SDCCH4:
 	case GSMTAP_CHANNEL_SDCCH8:
+		// only forward messages on dedicated channels to l2, if the timeslot and subslot is fitting
+		if(l1_model_ms->state->dedicated.tn == timeslot && l1_model_ms->state->dedicated.subslot == subslot) {
+			l1ctl_tx_data_ind(msg, arfcn, link_id, chan_nr, fn, snr,
+					                  signal_dbm, 0, 0);
+		}
+		break;
 	case GSMTAP_CHANNEL_AGCH:
 	case GSMTAP_CHANNEL_PCH:
 	case GSMTAP_CHANNEL_BCCH:
 		l1ctl_tx_data_ind(msg, arfcn, link_id, chan_nr, fn, snr,
-		                  signal_dbm, 0, 0);
+						  signal_dbm, 0, 0);
 		break;
 	case GSMTAP_CHANNEL_RACH:
 		LOGP(DVIRPHY,
@@ -259,11 +263,7 @@
 		break;
 	}
 
-	/* forward l1ctl message to l2 */
-	if (l1ctl_msg) {
-		l1ctl_sap_tx_to_l23(l1ctl_msg);
-	}
-	nomessage:
+	freemsg:
 	// handle memory deallocation
 	talloc_free(msg);
 }
diff --git a/src/host/virt_phy/src/l1ctl_sap.c b/src/host/virt_phy/src/l1ctl_sap.c
index bd6051b..b6c4508 100644
--- a/src/host/virt_phy/src/l1ctl_sap.c
+++ b/src/host/virt_phy/src/l1ctl_sap.c
@@ -244,7 +244,6 @@
  *
  * Handle state change from idle to dedicated mode.
  *
- * TODO: Implement this handler routine!
  */
 void l1ctl_rx_dm_est_req(struct msgb *msg)
 {
@@ -257,12 +256,12 @@
 	rsl_dec_chan_nr(ul->chan_nr, &rsl_chantype, &subslot, &timeslot);
 
 	DEBUGP(DL1C,
-	                "Received and handled from l23 - L1CTL_DM_EST_REQ (chan_nr=0x%02x, tn=%u)\n",
-	                ul->chan_nr, timeslot);
+	                "Received and handled from l23 - L1CTL_DM_EST_REQ (chan_nr=0x%02x, tn=%u, ss=%u)\n",
+	                ul->chan_nr, timeslot, subslot);
 
 	l1_model_ms->state->dedicated.chan_type = rsl_chantype;
 	l1_model_ms->state->dedicated.tn = timeslot;
-
+	l1_model_ms->state->dedicated.subslot = subslot;
 	/* TCH config */
 	if (rsl_chantype == RSL_CHAN_Bm_ACCHs
 	                || rsl_chantype == RSL_CHAN_Lm_ACCHs) {
@@ -348,6 +347,8 @@
 	DEBUGP(DL1C, "Received and handled from l23 - L1CTL_DM_REL_REQ\n");
 
 	l1_model_ms->state->dedicated.chan_type = 0;
+	l1_model_ms->state->dedicated.tn = 0;
+	l1_model_ms->state->dedicated.subslot = 0;
 	l1_model_ms->state->tch_mode = GSM48_CMODE_SIGN;
 
 	// TODO: disable ciphering
diff --git a/src/host/virt_phy/src/virtphy.c b/src/host/virt_phy/src/virtphy.c
index 70265a0..1454c4e 100644
--- a/src/host/virt_phy/src/virtphy.c
+++ b/src/host/virt_phy/src/virtphy.c
@@ -44,7 +44,7 @@
 	virt_l1_sched_init(model);
 
 	LOGP(DVIRPHY, LOGL_INFO, "Virtual physical layer ready...\n \
-			Waiting for l23 app on %s", l1ctl_sock_path);
+			Waiting for l23 app on %s", l1ctl_sock_path ? l1ctl_sock_path : L1CTL_SOCK_PATH);
 
 	while (1) {
 		// handle osmocom fd READ events (l1ctl-unix-socket, virtual-um-mcast-socket)

-- 
To view, visit https://gerrit.osmocom.org/3212
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6112b20e31c25636e53d3a6cda6f7443a94ff9c3
Gerrit-PatchSet: 2
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: BastusIII <sebastian.stumpf87 at googlemail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list