summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Stumpf <sebastian.stumpf87@googlemail.com>2017-03-07 17:59:54 +0100
committerHarald Welte <laforge@gnumonks.org>2017-07-12 23:26:26 +0200
commit7ea7b8ac050b1d52f175e70446b2bd8eb768bb39 (patch)
tree5d51ddf585f998bbe1674f5ff42067a77a862f45
parentc1705d53db746551a12fe85229bda41a4d5b508a (diff)
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
-rw-r--r--src/host/virt_phy/include/virtphy/virt_l1_model.h1
-rw-r--r--src/host/virt_phy/src/gsmtapl1_if.c22
-rw-r--r--src/host/virt_phy/src/l1ctl_sap.c9
-rw-r--r--src/host/virt_phy/src/virtphy.c2
4 files changed, 18 insertions, 16 deletions
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 69115f26..d4969eb6 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 @@ struct l1_state_ms {
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 155b4dc5..b84186ac 100644
--- a/src/host/virt_phy/src/gsmtapl1_if.c
+++ b/src/host/virt_phy/src/gsmtapl1_if.c
@@ -162,12 +162,10 @@ void gsmtapl1_rx_from_virt_um_inst_cb(struct virt_um_inst *vui,
}
// 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 @@ void gsmtapl1_rx_from_virt_um_inst_cb(struct virt_um_inst *vui,
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 @@ void gsmtapl1_rx_from_virt_um_inst_cb(struct virt_um_inst *vui,
"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 @@ void gsmtapl1_rx_from_virt_um_inst_cb(struct virt_um_inst *vui,
#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 @@ void gsmtapl1_rx_from_virt_um_inst_cb(struct virt_um_inst *vui,
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 bd6051be..b6c4508f 100644
--- a/src/host/virt_phy/src/l1ctl_sap.c
+++ b/src/host/virt_phy/src/l1ctl_sap.c
@@ -244,7 +244,6 @@ void l1ctl_sap_handler(struct msgb *msg)
*
* 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 @@ void l1ctl_rx_dm_est_req(struct msgb *msg)
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 @@ void l1ctl_rx_dm_rel_req(struct msgb *msg)
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 70265a05..1454c4e1 100644
--- a/src/host/virt_phy/src/virtphy.c
+++ b/src/host/virt_phy/src/virtphy.c
@@ -44,7 +44,7 @@ int main( int argc, char *argv[] )
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)