From 5ea89e2085a107f153724435792cc4773fb7359d Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Fri, 13 Nov 2020 01:13:20 +0100 Subject: handover test: fix dyn ts: set pchan_is on act / rel Change-Id: I3284b4565ad2c3b124442f4373243da1518206ce --- tests/handover/handover_test.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c index 8a6af9732..7f9e5dc31 100644 --- a/tests/handover/handover_test.c +++ b/tests/handover/handover_test.c @@ -315,6 +315,14 @@ struct gsm_lchan *create_lchan(struct gsm_bts *bts, int full_rate, const char *c /* serious hack into osmo_fsm */ lchan->fi->state = LCHAN_ST_ESTABLISHED; lchan->ts->fi->state = TS_ST_IN_USE; + + if (lchan->ts->pchan_on_init == GSM_PCHAN_TCH_F_TCH_H_PDCH) + lchan->ts->pchan_is = full_rate ? GSM_PCHAN_TCH_F : GSM_PCHAN_TCH_H; + if (lchan->ts->pchan_on_init == GSM_PCHAN_TCH_F_PDCH) { + OSMO_ASSERT(full_rate); + lchan->ts->pchan_is = GSM_PCHAN_TCH_F; + } + LOG_LCHAN(lchan, LOGL_DEBUG, "activated by handover_test.c\n"); create_conn(lchan); @@ -488,6 +496,7 @@ int __wrap_abis_rsl_sendmsg(struct msgb *msg) struct e1inp_sign_link *sign_link = msg->dst; int rc; struct gsm_lchan *lchan = rsl_lchan_lookup(sign_link->trx, dh->chan_nr, &rc); + struct gsm_lchan *other_lchan; if (rc) { printf("rsl_lchan_lookup() failed\n"); @@ -504,6 +513,30 @@ int __wrap_abis_rsl_sendmsg(struct msgb *msg) rc = parse_chan_rel(lchan, dh->data); if (rc == 0) send_chan_act_ack(chan_req_lchan, 0); + + /* send dyn TS back to PDCH if unused */ + switch (chan_req_lchan->ts->pchan_on_init) { + case GSM_PCHAN_TCH_F_TCH_H_PDCH: + case GSM_PCHAN_TCH_F_PDCH: + switch (chan_req_lchan->ts->pchan_is) { + case GSM_PCHAN_TCH_H: + other_lchan = &chan_req_lchan->ts->lchan[ + (chan_req_lchan == &chan_req_lchan->ts->lchan[0])? + 1 : 0]; + if (lchan_state_is(other_lchan, LCHAN_ST_ESTABLISHED)) + break; + /* else fall thru */ + case GSM_PCHAN_TCH_F: + chan_req_lchan->ts->pchan_is = GSM_PCHAN_PDCH; + break; + default: + break; + } + break; + default: + break; + } + break; case RSL_MT_DATA_REQ: rc = parse_ho_command(lchan, msg->l3h, msgb_l3len(msg)); -- cgit v1.2.3