[PATCH] osmo-bts[master]: trx/scheduler: Use integer math for TOA (Timing of Arrival)
Hello Vadim Yanitskiy, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6955 to look at the new patch set (#3). trx/scheduler: Use integer math for TOA (Timing of Arrival) There's no need to express TOA as a float: * We receive it as signed 16bit integer in units 1/256 symbol periods * We pass it to L1SAP as signed integer in 1/4 symbol periods So turn it into an int16_t with 1/256 symbol period accuracy throughout the code to avoid both float arithmetic as well as loosing any precision. Change-Id: Idce4178e0b1f7e940ebc22b3e2f340fcd544d4ec --- M include/osmo-bts/scheduler.h M include/osmo-bts/scheduler_backend.h M src/common/scheduler.c M src/osmo-bts-trx/l1_if.c M src/osmo-bts-trx/l1_if.h M src/osmo-bts-trx/loops.c M src/osmo-bts-trx/loops.h M src/osmo-bts-trx/scheduler_trx.c M src/osmo-bts-trx/trx_if.c M src/osmo-bts-virtual/scheduler_virtbts.c 10 files changed, 74 insertions(+), 71 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/55/6955/3 diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h index 4d34315..98f38d3 100644 --- a/include/osmo-bts/scheduler.h +++ b/include/osmo-bts/scheduler.h @@ -75,7 +75,7 @@ uint8_t rssi_num; /* number of RSSI values */ float rssi_sum; /* sum of RSSI values */ uint8_t toa_num;/* number of TOA values */ - float toa_sum;/* sum of TOA values */ + int32_t toa256_sum; /* sum of TOA values (1/256 symbol) */ /* loss detection */ uint8_t lost; /* (SACCH) loss detection */ @@ -113,7 +113,7 @@ int rssi_count; /* received RSSI values */ int rssi_valid_count; /* number of stored value */ int rssi_got_burst; /* any burst received so far */ - float toa_sum;/* sum of TOA values */ + int32_t toa256_sum; /* sum of TOA values (1/256 symbol) */ int toa_num;/* number of TOA value */ } meas; @@ -165,7 +165,7 @@ /*! \brief handle an UL burst received by PHY */ int trx_sched_ul_burst(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, -sbit_t *bits, uint16_t nbits, int8_t rssi, float toa); +sbit_t *bits, uint16_t nbits, int8_t rssi, int16_t toa); /*! \brief set multiframe scheduler to given physical channel config */ int trx_sched_set_pchan(struct l1sched_trx *l1t, uint8_t tn, diff --git a/include/osmo-bts/scheduler_backend.h b/include/osmo-bts/scheduler_backend.h index 5e077ef..5f11f9b 100644 --- a/include/osmo-bts/scheduler_backend.h +++ b/include/osmo-bts/scheduler_backend.h @@ -16,7 +16,7 @@ typedef int trx_sched_ul_func(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits, - int8_t rssi, float toa); + int8_t rssi, int16_t toa256); struct trx_chan_desc { /*! \brief Is this on a PDCH (PS) ? */ @@ -74,19 +74,19 @@ enum trx_chan_type chan, uint8_t bid, uint16_t *nbits); int rx_rach_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits, - int8_t rssi, float toa); + int8_t rssi, int16_t toa256); int rx_data_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits, - int8_t rssi, float toa); + int8_t rssi, int16_t toa256); int rx_pdtch_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits, - int8_t rssi, float toa); + int8_t rssi, int16_t toa256); int rx_tchf_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits, - int8_t rssi, float toa); + int8_t rssi, int16_t toa256); int rx_tchh_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits, - int8_t rssi, float toa); + int8_t rssi, int16_t toa256); const ubit_t *_sched_dl_burst(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, uint16_t *nbits); diff --git a/src/common/scheduler.c b/src/common/scheduler.c index e6cf541..edd99d2 100644 --- a/src/common/scheduler.c +++ b/src/common/scheduler.c @@ -846,7 +846,7 @@ /* process uplink burst */ int trx_sched_ul_burst(struct l1sched_trx *l1t, uint8_t tn, uint32_t current_fn, - sbit_t *bits, uint16_t nbits, int8_t rssi, float toa) + sbit_t *bits, uint16_t nbits, int8_t rssi, int16_t toa256) { struct l1sched_ts *l1ts =
[PATCH] osmo-bts[master]: trx/scheduler: Use integer math for TOA (Timing of Arrival)
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6955 to look at the new patch set (#2). trx/scheduler: Use integer math for TOA (Timing of Arrival) There's no need to express TOA as a float: * We receive it as signed 16bit integer in units 1/256 symbol periods * We pass it to L1SAP as signed integer in 1/4 symbol periods So turn it into an int16_t with 1/256 symbol period accuracy throughout the code to avoid both float arithmetic as well as loosing any precision. Change-Id: Idce4178e0b1f7e940ebc22b3e2f340fcd544d4ec --- M include/osmo-bts/scheduler.h M include/osmo-bts/scheduler_backend.h M src/common/scheduler.c M src/osmo-bts-trx/l1_if.c M src/osmo-bts-trx/l1_if.h M src/osmo-bts-trx/loops.c M src/osmo-bts-trx/loops.h M src/osmo-bts-trx/scheduler_trx.c M src/osmo-bts-trx/trx_if.c M src/osmo-bts-virtual/scheduler_virtbts.c 10 files changed, 73 insertions(+), 70 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/55/6955/2 diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h index 4d34315..98f38d3 100644 --- a/include/osmo-bts/scheduler.h +++ b/include/osmo-bts/scheduler.h @@ -75,7 +75,7 @@ uint8_t rssi_num; /* number of RSSI values */ float rssi_sum; /* sum of RSSI values */ uint8_t toa_num;/* number of TOA values */ - float toa_sum;/* sum of TOA values */ + int32_t toa256_sum; /* sum of TOA values (1/256 symbol) */ /* loss detection */ uint8_t lost; /* (SACCH) loss detection */ @@ -113,7 +113,7 @@ int rssi_count; /* received RSSI values */ int rssi_valid_count; /* number of stored value */ int rssi_got_burst; /* any burst received so far */ - float toa_sum;/* sum of TOA values */ + int32_t toa256_sum; /* sum of TOA values (1/256 symbol) */ int toa_num;/* number of TOA value */ } meas; @@ -165,7 +165,7 @@ /*! \brief handle an UL burst received by PHY */ int trx_sched_ul_burst(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, -sbit_t *bits, uint16_t nbits, int8_t rssi, float toa); +sbit_t *bits, uint16_t nbits, int8_t rssi, int16_t toa); /*! \brief set multiframe scheduler to given physical channel config */ int trx_sched_set_pchan(struct l1sched_trx *l1t, uint8_t tn, diff --git a/include/osmo-bts/scheduler_backend.h b/include/osmo-bts/scheduler_backend.h index 5e077ef..5f11f9b 100644 --- a/include/osmo-bts/scheduler_backend.h +++ b/include/osmo-bts/scheduler_backend.h @@ -16,7 +16,7 @@ typedef int trx_sched_ul_func(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits, - int8_t rssi, float toa); + int8_t rssi, int16_t toa256); struct trx_chan_desc { /*! \brief Is this on a PDCH (PS) ? */ @@ -74,19 +74,19 @@ enum trx_chan_type chan, uint8_t bid, uint16_t *nbits); int rx_rach_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits, - int8_t rssi, float toa); + int8_t rssi, int16_t toa256); int rx_data_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits, - int8_t rssi, float toa); + int8_t rssi, int16_t toa256); int rx_pdtch_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits, - int8_t rssi, float toa); + int8_t rssi, int16_t toa256); int rx_tchf_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits, - int8_t rssi, float toa); + int8_t rssi, int16_t toa256); int rx_tchh_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits, - int8_t rssi, float toa); + int8_t rssi, int16_t toa256); const ubit_t *_sched_dl_burst(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, uint16_t *nbits); diff --git a/src/common/scheduler.c b/src/common/scheduler.c index e6cf541..edd99d2 100644 --- a/src/common/scheduler.c +++ b/src/common/scheduler.c @@ -846,7 +846,7 @@ /* process uplink burst */ int trx_sched_ul_burst(struct l1sched_trx *l1t, uint8_t tn, uint32_t current_fn, - sbit_t *bits, uint16_t nbits, int8_t rssi, float toa) + sbit_t *bits, uint16_t nbits, int8_t rssi, int16_t toa256) { struct l1sched_ts *l1ts =
[PATCH] osmo-bts[master]: trx/scheduler: Use integer math for TOA (Timing of Arrival)
Review at https://gerrit.osmocom.org/6955 trx/scheduler: Use integer math for TOA (Timing of Arrival) There's no need to express TOA as a float: * We receive it as signed 16bit integer in units 1/256 symbol periods * We pass it to L1SAP as signed integer in 1/4 symbol periods So turn it into an int16_t with 1/256 symbol period accuracy throughout the code to avoid both float arithmetic as well as loosing any precision. Change-Id: Idce4178e0b1f7e940ebc22b3e2f340fcd544d4ec --- M include/osmo-bts/scheduler.h M include/osmo-bts/scheduler_backend.h M src/common/scheduler.c M src/osmo-bts-trx/l1_if.c M src/osmo-bts-trx/l1_if.h M src/osmo-bts-trx/loops.c M src/osmo-bts-trx/loops.h M src/osmo-bts-trx/scheduler_trx.c M src/osmo-bts-trx/trx_if.c M src/osmo-bts-virtual/scheduler_virtbts.c 10 files changed, 73 insertions(+), 70 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/55/6955/1 diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h index 4d34315..98f38d3 100644 --- a/include/osmo-bts/scheduler.h +++ b/include/osmo-bts/scheduler.h @@ -75,7 +75,7 @@ uint8_t rssi_num; /* number of RSSI values */ float rssi_sum; /* sum of RSSI values */ uint8_t toa_num;/* number of TOA values */ - float toa_sum;/* sum of TOA values */ + int32_t toa256_sum; /* sum of TOA values (1/256 symbol) */ /* loss detection */ uint8_t lost; /* (SACCH) loss detection */ @@ -113,7 +113,7 @@ int rssi_count; /* received RSSI values */ int rssi_valid_count; /* number of stored value */ int rssi_got_burst; /* any burst received so far */ - float toa_sum;/* sum of TOA values */ + int32_t toa256_sum; /* sum of TOA values (1/256 symbol) */ int toa_num;/* number of TOA value */ } meas; @@ -165,7 +165,7 @@ /*! \brief handle an UL burst received by PHY */ int trx_sched_ul_burst(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, -sbit_t *bits, uint16_t nbits, int8_t rssi, float toa); +sbit_t *bits, uint16_t nbits, int8_t rssi, int16_t toa); /*! \brief set multiframe scheduler to given physical channel config */ int trx_sched_set_pchan(struct l1sched_trx *l1t, uint8_t tn, diff --git a/include/osmo-bts/scheduler_backend.h b/include/osmo-bts/scheduler_backend.h index 5e077ef..5f11f9b 100644 --- a/include/osmo-bts/scheduler_backend.h +++ b/include/osmo-bts/scheduler_backend.h @@ -16,7 +16,7 @@ typedef int trx_sched_ul_func(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits, - int8_t rssi, float toa); + int8_t rssi, int16_t toa256); struct trx_chan_desc { /*! \brief Is this on a PDCH (PS) ? */ @@ -74,19 +74,19 @@ enum trx_chan_type chan, uint8_t bid, uint16_t *nbits); int rx_rach_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits, - int8_t rssi, float toa); + int8_t rssi, int16_t toa256); int rx_data_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits, - int8_t rssi, float toa); + int8_t rssi, int16_t toa256); int rx_pdtch_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits, - int8_t rssi, float toa); + int8_t rssi, int16_t toa256); int rx_tchf_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits, - int8_t rssi, float toa); + int8_t rssi, int16_t toa256); int rx_tchh_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits, - int8_t rssi, float toa); + int8_t rssi, int16_t toa256); const ubit_t *_sched_dl_burst(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, uint16_t *nbits); diff --git a/src/common/scheduler.c b/src/common/scheduler.c index e6cf541..edd99d2 100644 --- a/src/common/scheduler.c +++ b/src/common/scheduler.c @@ -846,7 +846,7 @@ /* process uplink burst */ int trx_sched_ul_burst(struct l1sched_trx *l1t, uint8_t tn, uint32_t current_fn, - sbit_t *bits, uint16_t nbits, int8_t rssi, float toa) + sbit_t *bits, uint16_t nbits, int8_t rssi, int16_t toa256) { struct l1sched_ts *l1ts = l1sched_trx_get_ts(l1t, tn); struct l1sched_chan_state *l1cs; @@ -907,7 +907,7 @@