fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/31850 )
Change subject: virt_phy: avoid confusion between RSSI (dBm) and RxLev (0..63) ......................................................................
virt_phy: avoid confusion between RSSI (dBm) and RxLev (0..63)
Change-Id: I4f2982cd8fa1b7a47f983c9cd11bf0180f7878ec Related: OS#5500 --- M src/host/virt_phy/include/osmocom/bb/virtphy/l1ctl_sap.h M src/host/virt_phy/src/gsmtapl1_if.c M src/host/virt_phy/src/virt_prim_data.c M src/host/virt_phy/src/virt_prim_traffic.c 4 files changed, 22 insertions(+), 12 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/50/31850/1
diff --git a/src/host/virt_phy/include/osmocom/bb/virtphy/l1ctl_sap.h b/src/host/virt_phy/include/osmocom/bb/virtphy/l1ctl_sap.h index 662efb6..002bf5d 100644 --- a/src/host/virt_phy/include/osmocom/bb/virtphy/l1ctl_sap.h +++ b/src/host/virt_phy/include/osmocom/bb/virtphy/l1ctl_sap.h @@ -64,12 +64,12 @@ void l1ctl_tx_data_conf(struct l1_model_ms *, uint32_t fn, uint16_t snr, uint16_t arfcn); void l1ctl_tx_data_ind(struct l1_model_ms *, struct msgb *msg, uint16_t arfcn, uint8_t link_id, uint8_t chan_nr, uint32_t fn, uint8_t snr, - uint8_t signal_dbm, uint8_t num_biterr, + uint8_t rxlev, uint8_t num_biterr, uint8_t fire_crc); void l1ctl_tx_traffic_conf(struct l1_model_ms *, uint32_t fn, uint16_t snr, uint16_t arfcn); void l1ctl_tx_traffic_ind(struct l1_model_ms *, struct msgb *msg, uint16_t arfcn, uint8_t link_id, uint8_t chan_nr, uint32_t fn, uint8_t snr, - uint8_t signal_dbm, uint8_t num_biterr, + uint8_t rxlev, uint8_t num_biterr, uint8_t fire_crc); void l1ctl_tx_pm_conf(struct l1_model_ms *, struct l1ctl_pm_req *pm_req); void l1ctl_tx_fbsb_conf(struct l1_model_ms *, uint8_t res, uint16_t arfcn); diff --git a/src/host/virt_phy/src/gsmtapl1_if.c b/src/host/virt_phy/src/gsmtapl1_if.c index 719d370..f5c49af 100644 --- a/src/host/virt_phy/src/gsmtapl1_if.c +++ b/src/host/virt_phy/src/gsmtapl1_if.c @@ -84,7 +84,7 @@ struct gsmtap_hdr *gh; struct msgb *outmsg; /* msg to send with gsmtap header prepended */ uint16_t arfcn; - uint8_t signal_dbm = 63; /* signal strength */ + uint8_t signal_dbm = rxlev2dbm(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) */ uint8_t data_len = msgb_l2len(msg); /* length of data */ @@ -242,7 +242,7 @@ uint8_t snr_db) { struct l1_model_ms *ms = lsc->priv; - uint8_t signal_dbm = dbm2rxlev(prim_pm_set_sig_strength(ms, arfcn & GSMTAP_ARFCN_MASK, MAX_SIG_LEV_DBM)); /* Power measurement with each received massage */ + uint8_t rxlev = dbm2rxlev(prim_pm_set_sig_strength(ms, arfcn & GSMTAP_ARFCN_MASK, MAX_SIG_LEV_DBM)); uint8_t usf;
gsm_fn2gsmtime(&ms->state.downlink_time, fn); @@ -281,7 +281,7 @@ * the timeslot and subslot is fitting */ if (ms->state.dedicated.tn == timeslot && ms->state.dedicated.subslot == subslot) { - l1ctl_tx_data_ind(ms, msg, arfcn, link_id, chan_nr, fn, snr_db, signal_dbm, 0, 0); + l1ctl_tx_data_ind(ms, msg, arfcn, link_id, chan_nr, fn, snr_db, rxlev, 0, 0); } break; case GSMTAP_CHANNEL_VOICE_F: @@ -291,7 +291,7 @@ if (ms->state.dedicated.tn == timeslot && ms->state.dedicated.subslot == subslot) { l1ctl_tx_traffic_ind(ms, msg, arfcn, link_id, chan_nr, fn, - snr_db, signal_dbm, 0, 0); + snr_db, rxlev, 0, 0); } break; case GSMTAP_CHANNEL_CBCH51: @@ -305,7 +305,7 @@ case GSMTAP_CHANNEL_CBCH52: /* save to just forward here, as upper layer ignores messages that * do not fit the current state (e.g. gsm48_rr.c:2159) */ - l1ctl_tx_data_ind(ms, msg, arfcn, link_id, chan_nr, fn, snr_db, signal_dbm, 0, 0); + l1ctl_tx_data_ind(ms, msg, arfcn, link_id, chan_nr, fn, snr_db, rxlev, 0, 0); break; case GSMTAP_CHANNEL_RACH: LOGPMS(DVIRPHY, LOGL_NOTICE, ms, "Ignoring unexpected RACH in downlink ?!?\n"); @@ -313,7 +313,7 @@ case GSMTAP_CHANNEL_PACCH: case GSMTAP_CHANNEL_PDCH: if (gprs_dl_block_matches_ms(ms, msg, timeslot)) - l1ctl_tx_data_ind(ms, msg, arfcn, link_id, chan_nr, fn, snr_db, signal_dbm, 0, 0); + l1ctl_tx_data_ind(ms, msg, arfcn, link_id, chan_nr, fn, snr_db, rxlev, 0, 0); usf = get_usf_from_block(msg); ms_ul_tbf_may_transmit(ms, arfcn, timeslot, fn, usf); break; diff --git a/src/host/virt_phy/src/virt_prim_data.c b/src/host/virt_phy/src/virt_prim_data.c index 74050b8..3ad2c83 100644 --- a/src/host/virt_phy/src/virt_prim_data.c +++ b/src/host/virt_phy/src/virt_prim_data.c @@ -78,7 +78,7 @@
void l1ctl_tx_data_ind(struct l1_model_ms *ms, struct msgb *msg, uint16_t arfcn, uint8_t link_id, uint8_t chan_nr, uint32_t fn, uint8_t snr, - uint8_t signal_dbm, uint8_t num_biterr, uint8_t fire_crc) + uint8_t rxlev, uint8_t num_biterr, uint8_t fire_crc) { struct msgb *l1ctl_msg = NULL; struct l1ctl_data_ind * l1di; @@ -94,7 +94,7 @@ l1dl->chan_nr = chan_nr; l1dl->frame_nr = htonl(fn); l1dl->snr = snr; - l1dl->rx_level = signal_dbm; + l1dl->rx_level = rxlev; l1dl->num_biterr = 0; /* no biterrors */ l1dl->fire_crc = 0;
diff --git a/src/host/virt_phy/src/virt_prim_traffic.c b/src/host/virt_phy/src/virt_prim_traffic.c index 3468931..778d67a 100644 --- a/src/host/virt_phy/src/virt_prim_traffic.c +++ b/src/host/virt_phy/src/virt_prim_traffic.c @@ -75,7 +75,7 @@ }
void l1ctl_tx_traffic_ind(struct l1_model_ms *ms, struct msgb *msg, uint16_t arfcn, uint8_t link_id, - uint8_t chan_nr, uint32_t fn, uint8_t snr, uint8_t signal_dbm, + uint8_t chan_nr, uint32_t fn, uint8_t snr, uint8_t rxlev, uint8_t num_biterr, uint8_t fire_crc) { struct msgb *l1ctl_msg = NULL; @@ -95,7 +95,7 @@ l1dl->chan_nr = chan_nr; l1dl->frame_nr = htonl(fn); l1dl->snr = snr; - l1dl->rx_level = signal_dbm; + l1dl->rx_level = rxlev; l1dl->num_biterr = 0; /* no biterrors */ l1dl->fire_crc = 0;