aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-01-23 13:39:15 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-01-23 13:39:15 +0100
commit135dcd950c756a912404867ddb37352bfa55d6d0 (patch)
treee5cc766bc9c27100fbb1278e623341bfffa8273b
parentf3e295a24f15e924a89b37ad5a29602973b2a6c9 (diff)
wip.. forward the ta..zecke/channel-ho-wip
-rw-r--r--include/osmo-bts/handover.h2
-rw-r--r--src/common/handover.c11
-rw-r--r--src/osmo-bts-sysmo/l1_if.c30
3 files changed, 30 insertions, 13 deletions
diff --git a/include/osmo-bts/handover.h b/include/osmo-bts/handover.h
index 9a2c33d..cf92801 100644
--- a/include/osmo-bts/handover.h
+++ b/include/osmo-bts/handover.h
@@ -7,7 +7,7 @@ enum {
HANDOVER_WAIT_FRAME,
};
-void handover_rach(struct gsm_lchan *lchan, uint8_t ra);
+void handover_rach(struct gsm_lchan *lchan, uint8_t ra, uint8_t acc_delay);
void handover_frame(struct gsm_lchan *lchan);
void reset_handover(struct gsm_lchan *lchan);
diff --git a/src/common/handover.c b/src/common/handover.c
index f20f05e..35c60bb 100644
--- a/src/common/handover.c
+++ b/src/common/handover.c
@@ -92,7 +92,7 @@ static void ho_t3105_cb(void *data)
}
/* received random access on dedicated channel */
-void handover_rach(struct gsm_lchan *lchan, uint8_t ra)
+void handover_rach(struct gsm_lchan *lchan, uint8_t ra, uint8_t acc_delay)
{
struct gsm_bts *bts = lchan->ts->trx->bts;
struct gsm_bts_role_bts *btsb = bts->role;
@@ -106,8 +106,11 @@ void handover_rach(struct gsm_lchan *lchan, uint8_t ra)
}
LOGP(DHO, LOGL_NOTICE,
- "%s RACH on dedicated channel received\n",
- gsm_lchan_name(lchan));
+ "%s RACH on dedicated channel received with TA=%u\n",
+ gsm_lchan_name(lchan), acc_delay);
+
+ /* Set timing advance */
+ lchan->rqd_ta = acc_delay;
/* Stop handover detection, wait for valid frame */
lchan->ho.active = HANDOVER_WAIT_FRAME;
@@ -120,7 +123,7 @@ void handover_rach(struct gsm_lchan *lchan, uint8_t ra)
}
/* Send HANDover DETect to BSC */
- rsl_tx_hando_det(lchan, NULL);
+ rsl_tx_hando_det(lchan, &lchan->rqd_ta);
/* Send PHYS INFO */
lchan->ho.phys_info_count = 1;
diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c
index 73e9855..1738836 100644
--- a/src/osmo-bts-sysmo/l1_if.c
+++ b/src/osmo-bts-sysmo/l1_if.c
@@ -816,9 +816,27 @@ static int handle_ph_data_ind(struct femtol1_hdl *fl1, GsmL1_PhDataInd_t *data_i
return rc;
}
-static int handle_handover(struct gsm_lchan *lchan, GsmL1_PhRaInd_t *ra_ind)
+static int check_acc_delay(GsmL1_PhRaInd_t *ra_ind, struct gsm_bts_role_bts *btsb,
+ uint8_t *acc_delay)
{
- handover_rach(lchan, ra_ind->msgUnitParam.u8Buffer[0]);
+ if (ra_ind->measParam.i16BurstTiming < 0)
+ *acc_delay = 0;
+ else
+ *acc_delay = ra_ind->measParam.i16BurstTiming >> 2;
+ return *acc_delay <= btsb->max_ta;
+}
+
+static int handle_handover(struct gsm_lchan *lchan, struct gsm_bts_role_bts *btsb,
+ GsmL1_PhRaInd_t *ra_ind)
+{
+ uint8_t acc_delay;
+ if (!check_acc_delay(ra_ind, btsb, &acc_delay)) {
+ LOGP(DHO, LOGL_INFO, "%s ignoring RACH request %u > max_ta(%u)\n",
+ gsm_lchan_name(lchan), acc_delay, btsb->max_ta);
+ return 0;
+ }
+
+ handover_rach(lchan, ra_ind->msgUnitParam.u8Buffer[0], acc_delay);
return 0;
}
@@ -845,7 +863,7 @@ static int handle_ph_ra_ind(struct femtol1_hdl *fl1, GsmL1_PhRaInd_t *ra_ind)
*/
lchan = l1if_hLayer_to_lchan(trx, ra_ind->hLayer2);
if (lchan && lchan->ho.active == HANDOVER_ENABLED)
- return handle_handover(lchan, ra_ind);
+ return handle_handover(lchan, btsb, ra_ind);
/* increment number of RACH slots with valid RACH burst */
if (trx == bts->c0)
@@ -861,11 +879,7 @@ static int handle_ph_ra_ind(struct femtol1_hdl *fl1, GsmL1_PhRaInd_t *ra_ind)
}
/* check for under/overflow / sign */
- if (ra_ind->measParam.i16BurstTiming < 0)
- acc_delay = 0;
- else
- acc_delay = ra_ind->measParam.i16BurstTiming >> 2;
- if (acc_delay > btsb->max_ta) {
+ if (!check_acc_delay(ra_ind, btsb, &acc_delay)) {
LOGP(DL1C, LOGL_INFO, "ignoring RACH request %u > max_ta(%u)\n",
acc_delay, btsb->max_ta);
return 0;