aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-08-26 13:22:28 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-08-28 12:23:07 +0200
commitaf75ce8e15ec8584cbc96a0cd366a5df68b9dae8 (patch)
tree7ea2edb8781c6a92b068464144fe67ec4eda024a
parentbe4a08b58ae17b44d2c02421d8346a1ccb63a6b9 (diff)
l1: Use the FN of all data_ind/ra_ind DSP messages
Currently all of these messages are discarded if they are assumend to be caused by noise. But even in these cases, the FN and TN values which are added by the DSP are valid. So these can be used to update the current_frame value. The osmo-bts sets the fBFILevel of a physical channel to -200dB if it is used for PDTCH or PACCH which is the case for all PDCH. This way a data_ind or ra_ind message is already send at least once per block period (4 frames) per PDCH. These messages are passed to either handle_ph_data_ind or handle_ph_ra_ind even if they contain garbage data. The ra_ind messages are sometimes sent a few frames earlier than data_ind messages using the same frame. This commit adds calls to update the current_frame value based on all of these messages before they are discarded. The FN taken from ra_ind are passed with an increased max_delay (5) to compensate for early ra_ind messages. Sponsored-by: On-Waves ehf
-rw-r--r--src/bts.cpp6
-rw-r--r--src/bts.h2
-rw-r--r--src/pcu_l1_if.cpp11
-rw-r--r--src/pcu_l1_if.h11
-rw-r--r--src/sysmo_l1_if.c4
-rw-r--r--tests/tbf/TbfTest.cpp2
6 files changed, 27 insertions, 9 deletions
diff --git a/src/bts.cpp b/src/bts.cpp
index 456990a..cfb4385 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -153,7 +153,7 @@ void BTS::set_current_frame_number(int fn)
m_pollController.expireTimedout(m_cur_fn, max_delay);
}
-void BTS::set_current_block_frame_number(int fn)
+void BTS::set_current_block_frame_number(int fn, unsigned max_delay)
{
int delay = 0;
const int late_block_delay_thresh = 13;
@@ -184,7 +184,7 @@ void BTS::set_current_block_frame_number(int fn)
current_frame_number() == 0)
m_cur_fn = fn;
- m_pollController.expireTimedout(fn, 0);
+ m_pollController.expireTimedout(fn, max_delay);
}
int BTS::add_paging(uint8_t chan_needed, uint8_t *identity_lv)
@@ -1120,8 +1120,6 @@ int gprs_rlcmac_pdch::rcv_block(uint8_t *data, uint8_t len, uint32_t fn,
bitvec *block;
int rc = 0;
- bts()->set_current_block_frame_number(fn);
-
switch (payload) {
case GPRS_RLCMAC_DATA_BLOCK:
rc = rcv_data_block_acknowledged(data, len, meas);
diff --git a/src/bts.h b/src/bts.h
index ac85181..eee62a7 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -245,7 +245,7 @@ public:
/** TODO: change the number to unsigned */
void set_current_frame_number(int frame_number);
- void set_current_block_frame_number(int frame_number);
+ void set_current_block_frame_number(int frame_number, unsigned max_delay);
int current_frame_number() const;
/** add paging to paging queue(s) */
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 9d7d9c4..9d7dbee 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -180,6 +180,17 @@ void pcu_l1if_tx_pch(bitvec * block, int plen, const char *imsi)
pcu_tx_data_req(0, 0, PCU_IF_SAPI_PCH, 0, 0, 0, data, 23+3);
}
+extern "C" void pcu_rx_block_time(uint16_t arfcn, uint32_t fn, uint8_t ts_no)
+{
+ BTS::main_bts()->set_current_block_frame_number(fn, 0);
+}
+
+extern "C" void pcu_rx_ra_time(uint16_t arfcn, uint32_t fn, uint8_t ts_no)
+{
+ /* access bursts may arrive some bursts earlier */
+ BTS::main_bts()->set_current_block_frame_number(fn, 5);
+}
+
extern "C" int pcu_rx_data_ind_pdtch(uint8_t trx_no, uint8_t ts_no, uint8_t *data,
uint8_t len, uint32_t fn, struct pcu_l1_meas *meas)
{
diff --git a/src/pcu_l1_if.h b/src/pcu_l1_if.h
index 59b9cba..865c833 100644
--- a/src/pcu_l1_if.h
+++ b/src/pcu_l1_if.h
@@ -122,15 +122,18 @@ int pcu_sock_send(struct msgb *msg);
#endif
#ifdef __cplusplus
-extern "C"
+extern "C" {
#endif
int pcu_rx_rts_req_pdtch(uint8_t trx, uint8_t ts, uint16_t arfcn,
uint32_t fn, uint8_t block_nr);
-#ifdef __cplusplus
-extern "C"
-#endif
int pcu_rx_data_ind_pdtch(uint8_t trx, uint8_t ts, uint8_t *data,
uint8_t len, uint32_t fn, struct pcu_l1_meas *meas);
+void pcu_rx_block_time(uint16_t arfcn, uint32_t fn, uint8_t ts_no);
+void pcu_rx_ra_time(uint16_t arfcn, uint32_t fn, uint8_t ts_no);
+
+#ifdef __cplusplus
+}
+#endif
#endif // PCU_L1_IF_H
diff --git a/src/sysmo_l1_if.c b/src/sysmo_l1_if.c
index fc4b59b..8572786 100644
--- a/src/sysmo_l1_if.c
+++ b/src/sysmo_l1_if.c
@@ -190,6 +190,8 @@ static int handle_ph_data_ind(struct femtol1_hdl *fl1h,
osmo_hexdump(data_ind->msgUnitParam.u8Buffer,
data_ind->msgUnitParam.u8Size));
+ pcu_rx_block_time(data_ind->u16Arfcn, data_ind->u32Fn, data_ind->u8Tn);
+
/*
* TODO: Add proper bad frame handling here. This could be used
* to switch the used CS. Avoid a crash with the PCU right now
@@ -237,6 +239,8 @@ static int handle_ph_ra_ind(struct femtol1_hdl *fl1h, GsmL1_PhRaInd_t *ra_ind)
{
uint8_t acc_delay;
+ pcu_rx_ra_time(ra_ind->u16Arfcn, ra_ind->u32Fn, ra_ind->u8Tn);
+
if (ra_ind->measParam.fLinkQuality < MIN_QUAL_RACH)
return 0;
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp
index 5e1b0de..e83d1b5 100644
--- a/tests/tbf/TbfTest.cpp
+++ b/tests/tbf/TbfTest.cpp
@@ -586,6 +586,8 @@ static void send_ul_mac_block(BTS *the_bts, unsigned trx_no, unsigned ts_no,
OSMO_ASSERT(size_t(num_bytes) < sizeof(buf));
bitvec_free(rlc_block);
+ the_bts->set_current_block_frame_number(fn, 0);
+
pdch = &the_bts->bts_data()->trx[trx_no].pdch[ts_no];
pdch->rcv_block(&buf[0], num_bytes, fn, &meas);
}