osmo-bts[master]: L1SAP: Increase resolution of reported burst timing

2018-02-27 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: If9b0f617845ba6c4aa47969f521734388197c9a7
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] osmo-bts[master]: L1SAP: Increase resolution of reported burst timing

2018-02-27 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: L1SAP: Increase resolution of reported burst timing
..


L1SAP: Increase resolution of reported burst timing

Before this patch we had:
* osmo-bts-trx internally using 1/256th bit/symbol period
* osmo-bts-sysmo internally using 1/4 bit/smbol period
* PCU interface using 1/4
* L1SAP interface using 1/4
* measurement processing code on top of L1SAP using 1/256

So for sysmo/lc15/octphy we are not loosing resolution, but for
osmo-bts-trx we're arbitrarily reducing the resolution via L1SAP
only then to compute with higher resolution again.

Let's change L1SAP to use 1/256 bits and hence not loose any resolution.
This requires a corresponding change in libosmocore for l1sap.h, which
is found in Change-Id Ibb58113c2819fe2d6d23ecbcfb8b3fce4055025d

Change-Id: If9b0f617845ba6c4aa47969f521734388197c9a7
---
M include/osmo-bts/scheduler_backend.h
M src/common/l1sap.c
M src/common/scheduler.c
M src/osmo-bts-litecell15/l1_if.c
M src/osmo-bts-octphy/l1_if.c
M src/osmo-bts-sysmo/l1_if.c
M src/osmo-bts-trx/l1_if.c
M src/osmo-bts-virtual/l1_if.c
8 files changed, 19 insertions(+), 19 deletions(-)

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



diff --git a/include/osmo-bts/scheduler_backend.h 
b/include/osmo-bts/scheduler_backend.h
index 5f11f9b..dbd9319 100644
--- a/include/osmo-bts/scheduler_backend.h
+++ b/include/osmo-bts/scheduler_backend.h
@@ -51,7 +51,7 @@
 int _sched_compose_ph_data_ind(struct l1sched_trx *l1t, uint8_t tn, uint32_t 
fn,
   enum trx_chan_type chan, uint8_t *l2,
   uint8_t l2_len, float rssi,
-  int16_t ta_offs_qbits, int16_t link_qual_cb,
+  int16_t ta_offs_256bits, int16_t link_qual_cb,
   uint16_t ber10k,
   enum osmo_ph_pres_info_type presence_info);
 
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index e095417..330b40a 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -512,8 +512,8 @@
}
 
DEBUGPFN(DL1P, info_meas_ind->fn,
-   "%s MPH_INFO meas ind, ta_offs_qbits=%d, ber10k=%d, 
inv_rssi=%u\n",
-   gsm_lchan_name(lchan), info_meas_ind->ta_offs_qbits,
+   "%s MPH_INFO meas ind, ta_offs_256bits=%d, ber10k=%d, 
inv_rssi=%u\n",
+   gsm_lchan_name(lchan), info_meas_ind->ta_offs_256bits,
info_meas_ind->ber10k, info_meas_ind->inv_rssi);
 
/* in the GPRS case we are not interested in measurement
@@ -522,13 +522,13 @@
return 0;
 
memset(, 0, sizeof(ulm));
-   ulm.ta_offs_256bits = info_meas_ind->ta_offs_qbits*(256/4);
+   ulm.ta_offs_256bits = info_meas_ind->ta_offs_256bits;
ulm.ber10k = info_meas_ind->ber10k;
ulm.inv_rssi = info_meas_ind->inv_rssi;
ulm.is_sub = info_meas_ind->is_sub;
 
/* we assume that symbol period is 1 bit: */
-   set_ms_to_data(lchan, info_meas_ind->ta_offs_qbits / 4, true);
+   set_ms_to_data(lchan, info_meas_ind->ta_offs_256bits / 256, true);
 
lchan_new_ul_meas(lchan, , info_meas_ind->fn);
 
@@ -1058,7 +1058,7 @@
pcu_tx_data_ind(>ts[tn], PCU_IF_SAPI_PTCCH, fn,
0 /* ARFCN */, L1SAP_FN2PTCCHBLOCK(fn),
data, len, rssi, data_ind->ber10k,
-   data_ind->ta_offs_qbits,
+   data_ind->ta_offs_256bits/64,
data_ind->lqual_cb);
} else {
/* drop incomplete UL block */
@@ -1067,7 +1067,7 @@
/* PDTCH / PACCH frame handling */
pcu_tx_data_ind(>ts[tn], PCU_IF_SAPI_PDTCH, fn, 0 
/* ARFCN */,
L1SAP_FN2MACBLOCK(fn), data, len, rssi, 
data_ind->ber10k,
-   data_ind->ta_offs_qbits, 
data_ind->lqual_cb);
+   data_ind->ta_offs_256bits/64, 
data_ind->lqual_cb);
}
return 0;
}
diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index edd99d2..8c9d30d 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -340,7 +340,7 @@
 int _sched_compose_ph_data_ind(struct l1sched_trx *l1t, uint8_t tn, uint32_t 
fn,
   enum trx_chan_type chan, uint8_t *l2,
   uint8_t l2_len, float rssi,
-  int16_t ta_offs_qbits, int16_t link_qual_cb,
+  int16_t ta_offs_256bits, int16_t link_qual_cb,
   uint16_t ber10k,
   enum osmo_ph_pres_info_type presence_info)
 {
@@ -359,7 

[PATCH] osmo-bts[master]: L1SAP: Increase resolution of reported burst timing

2018-02-27 Thread Harald Welte

Review at  https://gerrit.osmocom.org/6967

L1SAP: Increase resolution of reported burst timing

Before this patch we had:
* osmo-bts-trx internally using 1/256th bit/symbol period
* osmo-bts-sysmo internally using 1/4 bit/smbol period
* PCU interface using 1/4
* L1SAP interface using 1/4
* measurement processing code on top of L1SAP using 1/256

So for sysmo/lc15/octphy we are not loosing resolution, but for
osmo-bts-trx we're arbitrarily reducing the resolution via L1SAP
only then to compute with higher resolution again.

Let's change L1SAP to use 1/256 bits and hence not loose any resolution.
This requires a corresponding change in libosmocore for l1sap.h, which
is found in Change-Id Ibb58113c2819fe2d6d23ecbcfb8b3fce4055025d

Change-Id: If9b0f617845ba6c4aa47969f521734388197c9a7
---
M include/osmo-bts/scheduler_backend.h
M src/common/l1sap.c
M src/common/scheduler.c
M src/osmo-bts-litecell15/l1_if.c
M src/osmo-bts-octphy/l1_if.c
M src/osmo-bts-sysmo/l1_if.c
M src/osmo-bts-trx/l1_if.c
M src/osmo-bts-virtual/l1_if.c
8 files changed, 19 insertions(+), 19 deletions(-)


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

diff --git a/include/osmo-bts/scheduler_backend.h 
b/include/osmo-bts/scheduler_backend.h
index 5f11f9b..dbd9319 100644
--- a/include/osmo-bts/scheduler_backend.h
+++ b/include/osmo-bts/scheduler_backend.h
@@ -51,7 +51,7 @@
 int _sched_compose_ph_data_ind(struct l1sched_trx *l1t, uint8_t tn, uint32_t 
fn,
   enum trx_chan_type chan, uint8_t *l2,
   uint8_t l2_len, float rssi,
-  int16_t ta_offs_qbits, int16_t link_qual_cb,
+  int16_t ta_offs_256bits, int16_t link_qual_cb,
   uint16_t ber10k,
   enum osmo_ph_pres_info_type presence_info);
 
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index e095417..330b40a 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -512,8 +512,8 @@
}
 
DEBUGPFN(DL1P, info_meas_ind->fn,
-   "%s MPH_INFO meas ind, ta_offs_qbits=%d, ber10k=%d, 
inv_rssi=%u\n",
-   gsm_lchan_name(lchan), info_meas_ind->ta_offs_qbits,
+   "%s MPH_INFO meas ind, ta_offs_256bits=%d, ber10k=%d, 
inv_rssi=%u\n",
+   gsm_lchan_name(lchan), info_meas_ind->ta_offs_256bits,
info_meas_ind->ber10k, info_meas_ind->inv_rssi);
 
/* in the GPRS case we are not interested in measurement
@@ -522,13 +522,13 @@
return 0;
 
memset(, 0, sizeof(ulm));
-   ulm.ta_offs_256bits = info_meas_ind->ta_offs_qbits*(256/4);
+   ulm.ta_offs_256bits = info_meas_ind->ta_offs_256bits;
ulm.ber10k = info_meas_ind->ber10k;
ulm.inv_rssi = info_meas_ind->inv_rssi;
ulm.is_sub = info_meas_ind->is_sub;
 
/* we assume that symbol period is 1 bit: */
-   set_ms_to_data(lchan, info_meas_ind->ta_offs_qbits / 4, true);
+   set_ms_to_data(lchan, info_meas_ind->ta_offs_256bits / 256, true);
 
lchan_new_ul_meas(lchan, , info_meas_ind->fn);
 
@@ -1058,7 +1058,7 @@
pcu_tx_data_ind(>ts[tn], PCU_IF_SAPI_PTCCH, fn,
0 /* ARFCN */, L1SAP_FN2PTCCHBLOCK(fn),
data, len, rssi, data_ind->ber10k,
-   data_ind->ta_offs_qbits,
+   data_ind->ta_offs_256bits/64,
data_ind->lqual_cb);
} else {
/* drop incomplete UL block */
@@ -1067,7 +1067,7 @@
/* PDTCH / PACCH frame handling */
pcu_tx_data_ind(>ts[tn], PCU_IF_SAPI_PDTCH, fn, 0 
/* ARFCN */,
L1SAP_FN2MACBLOCK(fn), data, len, rssi, 
data_ind->ber10k,
-   data_ind->ta_offs_qbits, 
data_ind->lqual_cb);
+   data_ind->ta_offs_256bits/64, 
data_ind->lqual_cb);
}
return 0;
}
diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index edd99d2..8c9d30d 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -340,7 +340,7 @@
 int _sched_compose_ph_data_ind(struct l1sched_trx *l1t, uint8_t tn, uint32_t 
fn,
   enum trx_chan_type chan, uint8_t *l2,
   uint8_t l2_len, float rssi,
-  int16_t ta_offs_qbits, int16_t link_qual_cb,
+  int16_t ta_offs_256bits, int16_t link_qual_cb,
   uint16_t ber10k,
   enum osmo_ph_pres_info_type presence_info)
 {
@@ -359,7 +359,7 @@
l1sap->u.data.fn = fn;
l1sap->u.data.rssi = (int8_t) (rssi);
l1sap->u.data.ber10k = ber10k;
-   l1sap->u.data.ta_offs_qbits =