aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason DSouza <jason.dsouza@octasic.com>2016-04-11 16:26:57 +0200
committerHarald Welte <laforge@gnumonks.org>2016-06-14 10:18:43 +0000
commit45e97ac59aca2766977cc3d041abd6a201615516 (patch)
tree6a952b7800c3cb6d4909eebc967aa3497bf2b13c /src
parent3a1f1b8e91638fe2286e9e9253fe3ea6808f9f8a (diff)
Close TRX session before opening new one
This fixes the unstable behavior (BTS loosing subscribers after some time) in case previous run of osmo-bts was interrupted (with ctrl+c for example). Change-Id: Ie2119b0b566d01f0e70b38c8a149fecb47def38d
Diffstat (limited to 'src')
-rw-r--r--src/osmo-bts-octphy/l1_oml.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/src/osmo-bts-octphy/l1_oml.c b/src/osmo-bts-octphy/l1_oml.c
index 18bd8c00..401201a7 100644
--- a/src/osmo-bts-octphy/l1_oml.c
+++ b/src/osmo-bts-octphy/l1_oml.c
@@ -1097,6 +1097,23 @@ static int enable_events_compl_cb(struct octphy_hdl *fl1, struct msgb *resp, voi
return 0;
}
+static int disable_events_compl_cb(struct octphy_hdl *fl1, struct msgb *resp, void *data)
+{
+ tOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_RSP *mser =
+ (tOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_RSP *) resp->l2h;
+
+ /* in a completion call-back, we take msgb ownership and must
+ * release it before returning */
+
+ mOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_RSP_SWAP(mser);
+
+ LOGP(DL1C, LOGL_INFO, "Rx DISABLE-EVT-REC.resp\n");
+
+ msgb_free(resp);
+
+ return 0;
+}
+
int l1if_enable_events(struct gsm_bts_trx *trx)
{
struct phy_instance *pinst = trx_phy_instance(trx);
@@ -1116,7 +1133,29 @@ int l1if_enable_events(struct gsm_bts_trx *trx)
LOGP(DL1C, LOGL_INFO, "Tx ENABLE-EVT-REC.req\n");
- return l1if_req_compl(fl1h, msg, enable_events_compl_cb, 0);
+ return l1if_req_compl(fl1h, msg, disable_events_compl_cb, 0);
+}
+
+int l1if_disable_events(struct gsm_bts_trx *trx)
+{
+ struct phy_instance *pinst = trx_phy_instance(trx);
+ struct octphy_hdl *fl1h = pinst->phy_link->u.octphy.hdl;
+ struct msgb *msg = l1p_msgb_alloc();
+ tOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_CMD *mse;
+
+ mse = (tOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_CMD *)
+ msgb_put(msg, sizeof(*mse));
+ mOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_CMD_DEF(mse);
+
+ l1if_fill_msg_hdr(&mse->Header, msg, fl1h, cOCTVC1_MSG_TYPE_COMMAND,
+ cOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_CID);
+ mse->ulEvtActiveFlag = cOCT_FALSE;
+
+ mOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_CMD_SWAP(mse);
+
+ LOGP(DL1C, LOGL_INFO, "Tx DISABLE-EVT-REC.req\n");
+
+ return l1if_req_compl(fl1h, msg, disable_events_compl_cb, 0);
}
#define talloc_replace(dst, ctx, src) \
@@ -1483,6 +1522,9 @@ int bts_model_trx_deact_rf(struct gsm_bts_trx *trx)
int bts_model_trx_close(struct gsm_bts_trx *trx)
{
+ /* disable events */
+ l1if_disable_events(trx);
+
/* FIXME: close only one TRX */
return trx_close(trx);
}