[MERGED] osmocom-bb[master]: VIRT-PHY: reorganize data structures

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 19 11:58:47 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: VIRT-PHY: reorganize data structures
......................................................................


VIRT-PHY: reorganize data structures

* l1_model_ms can become a static member of l1_model_ms
* crypto_info_ms can become a static member of l1_state_ms

Change-Id: I94ca4dad1c6c668ce6307d5e5d728b1c1502af12
---
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/virt_l1_model.c
M src/host/virt_phy/src/virt_l1_sched_simple.c
M src/host/virt_phy/src/virt_prim_data.c
M src/host/virt_phy/src/virt_prim_fbsb.c
M src/host/virt_phy/src/virt_prim_pm.c
M src/host/virt_phy/src/virt_prim_rach.c
M src/host/virt_phy/src/virt_prim_traffic.c
M src/host/virt_phy/src/virtphy.c
11 files changed, 82 insertions(+), 77 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 991cb1a..61776ec 100644
--- a/src/host/virt_phy/include/virtphy/virt_l1_model.h
+++ b/src/host/virt_phy/include/virtphy/virt_l1_model.h
@@ -18,13 +18,6 @@
 };
 
 
-struct l1_model_ms {
-	struct l1ctl_sock_inst *lsi;
-	struct virt_um_inst *vui;
-	struct l1_state_ms *state;
-	struct crypto_info_ms *crypto_inf;
-};
-
 /* structure representing L1 sync information about a cell */
 struct l1_cell_info {
 	/* on which ARFCN (+band) is the cell? */
@@ -53,12 +46,13 @@
 	struct gsm_time	downlink_time;	/* current GSM time received on downlink */
 	struct gsm_time current_time; /* GSM time used internally for scheduling */
 
-	uint8_t state; // the ms state like in ms_state
+	enum ms_state state;
 
 	/* the cell on which we are camping right now */
 	struct l1_cell_info serving_cell;
 	/* neighbor cell sync info */
 	struct l1_cell_info neigh_cell[L1S_NUM_NEIGH_CELL];
+	struct crypto_info_ms crypto_inf;
 
 	/* TCH info */
 	uint8_t tch_mode; // see enum gsm48_chan_mode in gsm_04_08.h
@@ -94,6 +88,13 @@
 	} pm;
 };
 
+struct l1_model_ms {
+	struct l1ctl_sock_inst *lsi;
+	struct virt_um_inst *vui;
+	struct l1_state_ms state;
+};
+
+
 struct l1_model_ms *l1_model_ms_init(void *ctx);
 
 void l1_model_ms_destroy(struct l1_model_ms *model);
diff --git a/src/host/virt_phy/src/gsmtapl1_if.c b/src/host/virt_phy/src/gsmtapl1_if.c
index 2624046..18580b4 100644
--- a/src/host/virt_phy/src/gsmtapl1_if.c
+++ b/src/host/virt_phy/src/gsmtapl1_if.c
@@ -55,7 +55,7 @@
 	struct l1ctl_info_ul *ul = (struct l1ctl_info_ul *)l1h->data;
 	struct gsmtap_hdr *gh;
 	struct msgb *outmsg;	/* msg to send with gsmtap header prepended */
-	uint16_t arfcn = l1_model_ms->state->serving_cell.arfcn;	/* arfcn of the cell we currently camp on */
+	uint16_t arfcn = l1_model_ms->state.serving_cell.arfcn;	/* arfcn of the cell we currently camp on */
 	uint8_t signal_dbm = 63;	/* signal strength */
 	uint8_t snr = 63;	/* signal noise ratio, 63 is best */
 	uint8_t *data = msgb_l2(msg);	/* data to transmit (whole message without l1 header) */
@@ -145,19 +145,19 @@
 		goto freemsg;
 	}
 	/* we do not forward messages to l23 if we are in network search state */
-	if (l1_model_ms->state->state == MS_STATE_IDLE_SEARCHING)
+	if (l1_model_ms->state.state == MS_STATE_IDLE_SEARCHING)
 		goto freemsg;
 
 	/* forward downlink msg to fbsb sync routine if we are in sync state */
-	if (l1_model_ms->state->state == MS_STATE_IDLE_SYNCING) {
+	if (l1_model_ms->state.state == MS_STATE_IDLE_SYNCING) {
 		prim_fbsb_sync(msg);
 		return;
 	}
 	/* generally ignore all messages coming from another arfcn than the camped one */
-	if (l1_model_ms->state->serving_cell.arfcn != arfcn) {
+	if (l1_model_ms->state.serving_cell.arfcn != arfcn) {
 		LOGP(DVIRPHY, LOGL_NOTICE,
 		     "Ignoring gsmtap msg from virt um - msg arfcn=%d not equal synced arfcn=%d!\n",
-		     arfcn, l1_model_ms->state->serving_cell.arfcn);
+		     arfcn, l1_model_ms->state.serving_cell.arfcn);
 		goto freemsg;
 	}
 
@@ -166,8 +166,8 @@
 	/* see TS 08.58 -> 9.3.1 for channel number encoding */
 	chan_nr = rsl_enc_chan_nr(rsl_chantype, subslot, timeslot);
 
-	gsm_fn2gsmtime(&l1_model_ms->state->downlink_time, fn);
-	virt_l1_sched_sync_time(l1_model_ms->state->downlink_time, 0);
+	gsm_fn2gsmtime(&l1_model_ms->state.downlink_time, fn);
+	virt_l1_sched_sync_time(l1_model_ms->state.downlink_time, 0);
 	virt_l1_sched_execute(fn);
 
 	DEBUGP(DVIRPHY, "Receiving gsmtap msg from virt um - "
@@ -191,8 +191,8 @@
 	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) {
+		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;
diff --git a/src/host/virt_phy/src/l1ctl_sap.c b/src/host/virt_phy/src/l1ctl_sap.c
index 0871f1f..8965ac1 100644
--- a/src/host/virt_phy/src/l1ctl_sap.c
+++ b/src/host/virt_phy/src/l1ctl_sap.c
@@ -44,10 +44,10 @@
 static void l1_model_tch_mode_set(uint8_t tch_mode)
 {
 	if (tch_mode == GSM48_CMODE_SPEECH_V1 || tch_mode == GSM48_CMODE_SPEECH_EFR)
-		l1_model_ms->state->tch_mode = tch_mode;
+		l1_model_ms->state.tch_mode = tch_mode;
 	else {
 		/* set default value if no proper mode was assigned by l23 */
-		l1_model_ms->state->tch_mode = GSM48_CMODE_SIGN;
+		l1_model_ms->state.tch_mode = GSM48_CMODE_SIGN;
 	}
 }
 
@@ -267,16 +267,16 @@
 	DEBUGP(DL1C, "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;
-	l1_model_ms->state->state = MS_STATE_DEDICATED;
+	l1_model_ms->state.dedicated.chan_type = rsl_chantype;
+	l1_model_ms->state.dedicated.tn = timeslot;
+	l1_model_ms->state.dedicated.subslot = subslot;
+	l1_model_ms->state.state = MS_STATE_DEDICATED;
 
 	/* TCH config */
 	if (rsl_chantype == RSL_CHAN_Bm_ACCHs || rsl_chantype == RSL_CHAN_Lm_ACCHs) {
-		l1_model_ms->state->tch_mode = est_req->tch_mode;
+		l1_model_ms->state.tch_mode = est_req->tch_mode;
 		l1_model_tch_mode_set(est_req->tch_mode);
-		l1_model_ms->state->audio_mode = est_req->audio_mode;
+		l1_model_ms->state.audio_mode = est_req->audio_mode;
 		/* TODO: configure audio hardware for encoding /
 		 * decoding / recording / playing voice */
 	}
@@ -332,8 +332,8 @@
 		return;
 	}
 
-	l1_model_ms->crypto_inf->algo = cr->algo;
-	memcpy(l1_model_ms->crypto_inf->key, cr->key, sizeof(uint8_t) * A5_KEY_LEN);
+	l1_model_ms->state.crypto_inf.algo = cr->algo;
+	memcpy(l1_model_ms->state.crypto_inf.key, cr->key, sizeof(uint8_t) * A5_KEY_LEN);
 }
 
 /**
@@ -350,11 +350,11 @@
 {
 	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;
-	l1_model_ms->state->state = MS_STATE_IDLE_CAMPING;
+	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;
+	l1_model_ms->state.state = MS_STATE_IDLE_CAMPING;
 
 	/* TODO: disable ciphering */
 	/* TODO: disable audio recording / playing */
@@ -402,12 +402,12 @@
 	switch (reset_req->type) {
 	case L1CTL_RES_T_FULL:
 		DEBUGP(DL1C, "Received and handled from l23 - L1CTL_RESET_REQ (type=FULL)\n");
-		l1_model_ms->state->state = MS_STATE_IDLE_SEARCHING;
+		l1_model_ms->state.state = MS_STATE_IDLE_SEARCHING;
 		virt_l1_sched_stop();
 		l1ctl_tx_reset(L1CTL_RESET_CONF, reset_req->type);
 		break;
 	case L1CTL_RES_T_SCHED:
-		virt_l1_sched_restart(l1_model_ms->state->downlink_time);
+		virt_l1_sched_restart(l1_model_ms->state.downlink_time);
 		DEBUGP(DL1C, "Received and handled from l23 - L1CTL_RESET_REQ (type=SCHED)\n");
 		l1ctl_tx_reset(L1CTL_RESET_CONF, reset_req->type);
 		break;
@@ -438,7 +438,7 @@
 
 	DEBUGP(DL1C, "Received and handled from l23 - L1CTL_CCCH_MODE_REQ\n");
 
-	l1_model_ms->state->serving_cell.ccch_mode = ccch_mode;
+	l1_model_ms->state.serving_cell.ccch_mode = ccch_mode;
 
 	/* check if more has to be done here */
 	l1ctl_tx_ccch_mode_conf(ccch_mode);
@@ -461,14 +461,14 @@
 	struct l1ctl_tch_mode_req *tch_mode_req = (struct l1ctl_tch_mode_req *) l1h->data;
 
 	l1_model_tch_mode_set(tch_mode_req->tch_mode);
-	l1_model_ms->state->audio_mode = tch_mode_req->audio_mode;
+	l1_model_ms->state.audio_mode = tch_mode_req->audio_mode;
 
 	DEBUGP(DL1C, "Received and handled from l23 - L1CTL_TCH_MODE_REQ (tch_mode=0x%02x audio_mode=0x%02x)\n",
 		tch_mode_req->tch_mode, tch_mode_req->audio_mode);
 
 	/* TODO: configure audio hardware for encoding / decoding / recording / playing voice */
 
-	l1ctl_tx_tch_mode_conf(l1_model_ms->state->tch_mode, l1_model_ms->state->audio_mode);
+	l1ctl_tx_tch_mode_conf(l1_model_ms->state.tch_mode, l1_model_ms->state.audio_mode);
 }
 
 /**
diff --git a/src/host/virt_phy/src/virt_l1_model.c b/src/host/virt_phy/src/virt_l1_model.c
index 65e8068..056c9eb 100644
--- a/src/host/virt_phy/src/virt_l1_model.c
+++ b/src/host/virt_phy/src/virt_l1_model.c
@@ -24,7 +24,6 @@
 struct l1_model_ms* l1_model_ms_init(void *ctx)
 {
 	struct l1_model_ms *model = talloc_zero(ctx, struct l1_model_ms);
-	model->state = talloc_zero(ctx, struct l1_state_ms);
 	return model;
 }
 
@@ -32,6 +31,5 @@
 {
 	virt_um_destroy(model->vui);
 	l1ctl_sock_destroy(model->lsi);
-	talloc_free(model->state);
 	talloc_free(model);
 }
diff --git a/src/host/virt_phy/src/virt_l1_sched_simple.c b/src/host/virt_phy/src/virt_l1_sched_simple.c
index 40bc57a..20481df 100644
--- a/src/host/virt_phy/src/virt_l1_sched_simple.c
+++ b/src/host/virt_phy/src/virt_l1_sched_simple.c
@@ -61,7 +61,7 @@
  */
 void virt_l1_sched_sync_time(struct gsm_time time, uint8_t hard_reset)
 {
-	l1_model_ms->state->current_time = time;
+	l1_model_ms->state.current_time = time;
 }
 
 /**
diff --git a/src/host/virt_phy/src/virt_prim_data.c b/src/host/virt_phy/src/virt_prim_data.c
index 8b65d6d..72c58b7 100644
--- a/src/host/virt_phy/src/virt_prim_data.c
+++ b/src/host/virt_phy/src/virt_prim_data.c
@@ -50,7 +50,7 @@
 static void virt_l1_sched_handler_cb(uint32_t fn, struct msgb * msg)
 {
 	gsmtapl1_tx_to_virt_um(fn, msg);
-	l1ctl_tx_data_conf(fn, 0, l1_model_ms->state->serving_cell.arfcn);
+	l1ctl_tx_data_conf(fn, 0, l1_model_ms->state.serving_cell.arfcn);
 }
 
 /**
@@ -70,7 +70,7 @@
 	struct l1ctl_info_ul *ul = (struct l1ctl_info_ul *)l1h->data;
 	struct l1ctl_data_ind *data_ind = (struct l1ctl_data_ind *)ul->payload;
 	uint8_t rsl_chantype, subslot, timeslot;
-	uint32_t fn_sched = sched_fn_ul(l1_model_ms->state->current_time,
+	uint32_t fn_sched = sched_fn_ul(l1_model_ms->state.current_time,
 	                                ul->chan_nr, ul->link_id);
 
 	rsl_dec_chan_nr(ul->chan_nr, &rsl_chantype, &subslot, &timeslot);
diff --git a/src/host/virt_phy/src/virt_prim_fbsb.c b/src/host/virt_phy/src/virt_prim_fbsb.c
index 4f6306e..7f99821 100644
--- a/src/host/virt_phy/src/virt_prim_fbsb.c
+++ b/src/host/virt_phy/src/virt_prim_fbsb.c
@@ -54,14 +54,15 @@
  */
 void l1ctl_rx_fbsb_req(struct msgb *msg)
 {
+	struct l1_state_ms *l1s = &l1_model_ms->state;
 	struct l1ctl_hdr *l1h = (struct l1ctl_hdr *) msg->data;
 	struct l1ctl_fbsb_req *sync_req = (struct l1ctl_fbsb_req *) l1h->data;
 
 	DEBUGP(DL1C, "Received and handled from l23 - L1CTL_FBSB_REQ (arfcn=%u, flags=0x%x)\n",
 	       ntohs(sync_req->band_arfcn), sync_req->flags);
 
-	l1_model_ms->state->state = MS_STATE_IDLE_SYNCING;
-	l1_model_ms->state->fbsb.arfcn = ntohs(sync_req->band_arfcn);
+	l1s->state = MS_STATE_IDLE_SYNCING;
+	l1s->fbsb.arfcn = ntohs(sync_req->band_arfcn);
 }
 
 /**
@@ -71,32 +72,33 @@
  */
 void prim_fbsb_sync(struct msgb *msg)
 {
+	struct l1_state_ms *l1s = &l1_model_ms->state;
 	struct gsmtap_hdr *gh = msgb_l1(msg);
 	uint32_t fn = ntohl(gh->frame_number); /* frame number of the rcv msg */
 	uint16_t arfcn = ntohs(gh->arfcn); /* arfcn of the received msg */
 
 	/* ignore messages from other arfcns as the one requested to sync to by l23 */
-	if (l1_model_ms->state->fbsb.arfcn != arfcn) {
+	if (l1s->fbsb.arfcn != arfcn) {
 		talloc_free(msg);
 		/* cancel sync if we did not receive a msg on dl from
 		 * the requested arfcn that we can sync to */
 		if (sync_count++ > 20) {
 			sync_count = 0;
-			l1_model_ms->state->state = MS_STATE_IDLE_SEARCHING;
-			l1ctl_tx_fbsb_conf(1, (l1_model_ms->state->fbsb.arfcn));
+			l1s->state = MS_STATE_IDLE_SEARCHING;
+			l1ctl_tx_fbsb_conf(1, (l1s->fbsb.arfcn));
 		}
 		return;
 	}
-	l1_model_ms->state->serving_cell.arfcn = arfcn;
-	l1_model_ms->state->state = MS_STATE_IDLE_CAMPING;
+	l1s->serving_cell.arfcn = arfcn;
+	l1s->state = MS_STATE_IDLE_CAMPING;
 	/* Not needed in virtual phy */
-	l1_model_ms->state->serving_cell.fn_offset = 0;
-	l1_model_ms->state->serving_cell.time_alignment = 0;
-	l1_model_ms->state->serving_cell.bsic = 0;
+	l1s->serving_cell.fn_offset = 0;
+	l1s->serving_cell.time_alignment = 0;
+	l1s->serving_cell.bsic = 0;
 	/* Update current gsm time each time we receive a message on the virt um */
-	gsm_fn2gsmtime(&l1_model_ms->state->downlink_time, fn);
+	gsm_fn2gsmtime(&l1s->downlink_time, fn);
 	/* Restart scheduler */
-	virt_l1_sched_restart(l1_model_ms->state->downlink_time);
+	virt_l1_sched_restart(l1s->downlink_time);
 	talloc_free(msg);
 	l1ctl_tx_fbsb_conf(0, arfcn);
 }
diff --git a/src/host/virt_phy/src/virt_prim_pm.c b/src/host/virt_phy/src/virt_prim_pm.c
index 9afee0c..6335c61 100644
--- a/src/host/virt_phy/src/virt_prim_pm.c
+++ b/src/host/virt_phy/src/virt_prim_pm.c
@@ -47,17 +47,17 @@
  */
 uint16_t prim_pm_set_sig_strength(uint16_t arfcn, int16_t sig_lev)
 {
-	if (l1_model_ms->state->pm.timeout_s > 0 || l1_model_ms->state->pm.timeout_us > 0) {
-		osmo_timer_schedule(&l1_model_ms->state->pm.meas.arfcn_sig_lev_timers[arfcn],
-				    l1_model_ms->state->pm.timeout_s,
-				    l1_model_ms->state->pm.timeout_us);
+	struct l1_state_ms *l1s = &l1_model_ms->state;
+
+	if (l1s->pm.timeout_s > 0 || l1s->pm.timeout_us > 0) {
+		osmo_timer_schedule(&l1s->pm.meas.arfcn_sig_lev_timers[arfcn],
+				    l1s->pm.timeout_s, l1s->pm.timeout_us);
 	}
-	l1_model_ms->state->pm.meas.arfcn_sig_lev_dbm[arfcn] = 
-				sig_lev - l1_model_ms->state->pm.meas.arfcn_sig_lev_red_dbm[arfcn];
+	l1s->pm.meas.arfcn_sig_lev_dbm[arfcn] = sig_lev - l1s->pm.meas.arfcn_sig_lev_red_dbm[arfcn];
 	DEBUGP(DL1C, "Power measurement set for arfcn %u. Set signal level to %d (== rxlev: %u).\n",
-		arfcn, l1_model_ms->state->pm.meas.arfcn_sig_lev_dbm[arfcn],
-		dbm2rxlev(l1_model_ms->state->pm.meas.arfcn_sig_lev_dbm[arfcn]));
-	return l1_model_ms->state->pm.meas.arfcn_sig_lev_dbm[arfcn];
+		arfcn, l1s->pm.meas.arfcn_sig_lev_dbm[arfcn],
+		dbm2rxlev(l1s->pm.meas.arfcn_sig_lev_dbm[arfcn]));
+	return l1s->pm.meas.arfcn_sig_lev_dbm[arfcn];
 }
 
 void prim_pm_timer_cb(void *data)
@@ -83,6 +83,7 @@
  */
 void l1ctl_rx_pm_req(struct msgb *msg)
 {
+	struct l1_state_ms *l1s = &l1_model_ms->state;
 	struct l1ctl_hdr *l1h = (struct l1ctl_hdr *) msg->data;
 	struct l1ctl_pm_req *pm_req = (struct l1ctl_pm_req *) l1h->data;
 	struct msgb *resp_msg = l1ctl_msgb_alloc(L1CTL_PM_CONF);
@@ -101,8 +102,8 @@
 		pm_conf->band_arfcn = htons(arfcn_next);
 		/* set min and max to the value calculated for that
 		 * arfcn (IGNORE UPLINKK AND  PCS AND OTHER FLAGS) */
-		pm_conf->pm[0] = dbm2rxlev(l1_model_ms->state->pm.meas.arfcn_sig_lev_dbm[arfcn_next & ARFCN_NO_FLAGS_MASK]);
-		pm_conf->pm[1] = dbm2rxlev(l1_model_ms->state->pm.meas.arfcn_sig_lev_dbm[arfcn_next & ARFCN_NO_FLAGS_MASK]);
+		pm_conf->pm[0] = dbm2rxlev(l1s->pm.meas.arfcn_sig_lev_dbm[arfcn_next & ARFCN_NO_FLAGS_MASK]);
+		pm_conf->pm[1] = dbm2rxlev(l1s->pm.meas.arfcn_sig_lev_dbm[arfcn_next & ARFCN_NO_FLAGS_MASK]);
 		if (arfcn_next == pm_req->range.band_arfcn_to) {
 			struct l1ctl_hdr *resp_l1h = msgb_l1(resp_msg);
 			resp_l1h->flags |= L1CTL_F_DONE;
@@ -125,13 +126,15 @@
  */
 void prim_pm_init(struct l1_model_ms *model)
 {
+	struct l1_state_ms *l1s = &model->state;
 	int i;
+
 	l1_model_ms = model;
 	/* init the signal level of all arfcns with the lowest value possible */
-	memset(model->state->pm.meas.arfcn_sig_lev_dbm, MIN_SIG_LEV_DBM, sizeof (int16_t) * 1024);
+	memset(l1s->pm.meas.arfcn_sig_lev_dbm, MIN_SIG_LEV_DBM, sizeof (int16_t) * 1024);
 	/* init timers */
 	for (i = 0; i < 1024; ++i) {
-		l1_model_ms->state->pm.meas.arfcn_sig_lev_timers[i].cb = prim_pm_timer_cb;
-		l1_model_ms->state->pm.meas.arfcn_sig_lev_timers[i].data = &l1_model_ms->state->pm.meas.arfcn_sig_lev_dbm[i];
+		l1s->pm.meas.arfcn_sig_lev_timers[i].cb = prim_pm_timer_cb;
+		l1s->pm.meas.arfcn_sig_lev_timers[i].data = &l1s->pm.meas.arfcn_sig_lev_dbm[i];
 	}
 }
diff --git a/src/host/virt_phy/src/virt_prim_rach.c b/src/host/virt_phy/src/virt_prim_rach.c
index 1642ac6..bff777d 100644
--- a/src/host/virt_phy/src/virt_prim_rach.c
+++ b/src/host/virt_phy/src/virt_prim_rach.c
@@ -62,7 +62,7 @@
 static void virt_l1_sched_handler_cb(uint32_t fn, struct msgb *msg)
 {
 	gsmtapl1_tx_to_virt_um(fn, msg);
-	l1ctl_tx_rach_conf(fn, l1_model_ms->state->serving_cell.arfcn);
+	l1ctl_tx_rach_conf(fn, l1_model_ms->state.serving_cell.arfcn);
 }
 
 /**
@@ -77,6 +77,7 @@
  */
 void l1ctl_rx_rach_req(struct msgb *msg)
 {
+	struct l1_state_ms *l1s = &l1_model_ms->state;
 	struct l1ctl_hdr *l1h = (struct l1ctl_hdr *) msg->data;
 	struct l1ctl_info_ul *ul = (struct l1ctl_info_ul *) l1h->data;
 	struct l1ctl_rach_req *rach_req = (struct l1ctl_rach_req *) ul->payload;
@@ -102,13 +103,13 @@
 	/* sched fn calculation if we have a combined ccch channel configuration */
 	if (rach_req->combined) {
 		/* add elapsed RACH slots to offset */
-		offset += t3_to_rach_comb[l1_model_ms->state->current_time.t3];
+		offset += t3_to_rach_comb[l1s->current_time.t3];
 		/* offset is the number of RACH slots in the future */
-		fn_sched = l1_model_ms->state->current_time.fn - l1_model_ms->state->current_time.t3;
+		fn_sched = l1s->current_time.fn - l1s->current_time.t3;
 		fn_sched += offset / 27 * 51;
 		fn_sched += rach_to_t3_comb[offset % 27];
 	} else
-		fn_sched = l1_model_ms->state->current_time.fn + offset;
+		fn_sched = l1s->current_time.fn + offset;
 
 	virt_l1_sched_schedule(msg, fn_sched, ts, &virt_l1_sched_handler_cb);
 }
diff --git a/src/host/virt_phy/src/virt_prim_traffic.c b/src/host/virt_phy/src/virt_prim_traffic.c
index 50e6857..acfd493 100644
--- a/src/host/virt_phy/src/virt_prim_traffic.c
+++ b/src/host/virt_phy/src/virt_prim_traffic.c
@@ -50,7 +50,7 @@
 static void virt_l1_sched_handler_cb(uint32_t fn, struct msgb * msg)
 {
 	gsmtapl1_tx_to_virt_um(fn, msg);
-	l1ctl_tx_traffic_conf(fn, 0, l1_model_ms->state->serving_cell.arfcn);
+	l1ctl_tx_traffic_conf(fn, 0, l1_model_ms->state.serving_cell.arfcn);
 }
 
 /**
@@ -69,7 +69,7 @@
 	struct l1ctl_info_ul *ul = (struct l1ctl_info_ul *) l1h->data;
 	struct l1ctl_traffic_req *tr = (struct l1ctl_traffic_req *) ul->payload;
 	uint8_t rsl_chantype, subslot, timeslot;
-	uint32_t fn_sched = sched_fn_ul(l1_model_ms->state->current_time, ul->chan_nr, ul->link_id);
+	uint32_t fn_sched = sched_fn_ul(l1_model_ms->state.current_time, ul->chan_nr, ul->link_id);
 
 	rsl_dec_chan_nr(ul->chan_nr, &rsl_chantype, &subslot, &timeslot);
 	DEBUGP(DL1C, "Received and handled from l23 - L1CTL_TRAFFIC_REQ\n");
diff --git a/src/host/virt_phy/src/virtphy.c b/src/host/virt_phy/src/virtphy.c
index e4f5fd2..43346ed 100644
--- a/src/host/virt_phy/src/virtphy.c
+++ b/src/host/virt_phy/src/virtphy.c
@@ -99,11 +99,11 @@
 
 	/* seconds */
 	char *buf = strtok(pm_timeout, ":");
-	model->state->pm.timeout_s = atoi(buf);
+	model->state.pm.timeout_s = atoi(buf);
 	/* microseconds */
 	buf = strtok(NULL, ":");
 	if (buf)
-		model->state->pm.timeout_us = atoi(buf);
+		model->state.pm.timeout_us = atoi(buf);
 }
 
 /**
@@ -128,7 +128,7 @@
 		red = atoi(colon + 1);
 
 		/* TODO: this may go wild if the token string is not properly formatted */
-		model->state->pm.meas.arfcn_sig_lev_red_dbm[arfcn] = red;
+		model->state.pm.meas.arfcn_sig_lev_red_dbm[arfcn] = red;
 	} while ((token = strtok(NULL, ":")));
 }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I94ca4dad1c6c668ce6307d5e5d728b1c1502af12
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list