aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2016-11-03 13:39:00 +0100
committerMax <msuraev@sysmocom.de>2016-11-08 12:22:40 +0100
commit9f936344eab060d11e65660b18e1deef54d34723 (patch)
tree00a65d71ba4c7dc13afa0dcca3135f2727f4e2e6
parent57b5fb88191e8eec2ad8f555293f48d39933966e (diff)
DTX DL: tighten check for enabled operation
Introduce dtx_dl_amr_enabled() function which checks that DTX is enabled and FSM is allocated and use it for all corresponding checks. Change-Id: Ifa68b641265ed14f242765c85e40da2d1021a541
-rw-r--r--include/osmo-bts/msg_utils.h1
-rw-r--r--src/common/l1sap.c2
-rw-r--r--src/common/msg_utils.c9
-rw-r--r--src/osmo-bts-litecell15/l1_if.c2
-rw-r--r--src/osmo-bts-litecell15/tch.c6
-rw-r--r--src/osmo-bts-sysmo/l1_if.c2
-rw-r--r--src/osmo-bts-sysmo/tch.c6
7 files changed, 19 insertions, 9 deletions
diff --git a/include/osmo-bts/msg_utils.h b/include/osmo-bts/msg_utils.h
index 31bd1725..42955f17 100644
--- a/include/osmo-bts/msg_utils.h
+++ b/include/osmo-bts/msg_utils.h
@@ -26,6 +26,7 @@ enum {
};
void lchan_set_marker(bool t, struct gsm_lchan *lchan);
+bool dtx_dl_amr_enabled(const struct gsm_lchan *lchan);
void dtx_cache_payload(struct gsm_lchan *lchan, const uint8_t *l1_payload,
size_t length, uint32_t fn, int update);
int dtx_dl_amr_fsm_step(struct gsm_lchan *lchan, const uint8_t *rtp_pl,
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index ef248009..a7f84c53 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -610,7 +610,7 @@ static int l1sap_ph_rts_ind(struct gsm_bts_trx *trx,
memcpy(p, pp.oph.msg->data, GSM_MACBLOCK_LEN);
/* check if it is a RR CIPH MODE CMD. if yes, enable RX ciphering */
check_for_ciph_cmd(pp.oph.msg, lchan, chan_nr);
- if (dtxd_facch && lchan->tch.dtx.dl_amr_fsm)
+ if (dtxd_facch && dtx_dl_amr_enabled(lchan))
osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm,
E_FACCH,
(void *)lchan);
diff --git a/src/common/msg_utils.c b/src/common/msg_utils.c
index 851aacb2..edf71239 100644
--- a/src/common/msg_utils.c
+++ b/src/common/msg_utils.c
@@ -298,6 +298,15 @@ static inline bool dtx_sched_optional(struct gsm_lchan *lchan, uint32_t fn)
return false;
}
+bool dtx_dl_amr_enabled(const struct gsm_lchan *lchan)
+{
+ if (lchan->ts->trx->bts->dtxd &&
+ lchan->tch.dtx.dl_amr_fsm &&
+ lchan->tch_mode == GSM48_CMODE_SPEECH_AMR)
+ return true;
+ return false;
+}
+
/* repeat last SID if possible, returns SID length + 1 or 0 */
/*! \brief Repeat last SID if possible in case of DTX
* \param[in] lchan Logical channel on which we check scheduling
diff --git a/src/osmo-bts-litecell15/l1_if.c b/src/osmo-bts-litecell15/l1_if.c
index 0b1bad4d..9d57c2fb 100644
--- a/src/osmo-bts-litecell15/l1_if.c
+++ b/src/osmo-bts-litecell15/l1_if.c
@@ -409,7 +409,7 @@ static int ph_data_req(struct gsm_bts_trx *trx, struct msgb *msg,
if (use_cache)
memcpy(l1p->u.phDataReq.msgUnitParam.u8Buffer,
lchan->tch.dtx.facch, msgb_l2len(msg));
- else if (trx->bts->dtxd && lchan->tch.dtx.dl_amr_fsm &&
+ else if (dtx_dl_amr_enabled(lchan) &&
lchan->tch.dtx.dl_amr_fsm->state == ST_ONSET_F) {
if (sapi == GsmL1_Sapi_FacchF) {
sapi = GsmL1_Sapi_TchF;
diff --git a/src/osmo-bts-litecell15/tch.c b/src/osmo-bts-litecell15/tch.c
index 4337d680..74950738 100644
--- a/src/osmo-bts-litecell15/tch.c
+++ b/src/osmo-bts-litecell15/tch.c
@@ -275,7 +275,7 @@ int l1if_tch_encode(struct gsm_lchan *lchan, uint8_t *data, uint8_t *len,
l1_payload, marker, len, &ft);
if (rc < 0)
return rc;
- if (!lchan->ts->trx->bts->dtxd) {
+ if (!dtx_dl_amr_enabled(lchan)) {
*payload_type = GsmL1_TchPlType_Amr;
rtppayload_to_l1_amr(l1_payload + 2, rtp_pl, rtp_pl_len,
ft);
@@ -497,7 +497,7 @@ struct msgb *gen_empty_tch_msg(struct gsm_lchan *lchan, uint32_t fn)
case GSM48_CMODE_SPEECH_AMR:
if (lchan->type == GSM_LCHAN_TCH_H &&
lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F1 &&
- lchan->ts->trx->bts->dtxd) {
+ dtx_dl_amr_enabled(lchan)) {
*payload_type = GsmL1_TchPlType_Amr_SidFirstP2;
rc = dtx_dl_amr_fsm_step(lchan, NULL, 0, fn, l1_payload,
false, &(msu_param->u8Size),
@@ -524,7 +524,7 @@ struct msgb *gen_empty_tch_msg(struct gsm_lchan *lchan, uint32_t fn)
return NULL;
}
- if (lchan->ts->trx->bts->dtxd) {
+ if (dtx_dl_amr_enabled(lchan)) {
rc = repeat_last_sid(lchan, l1_payload, fn);
if (!rc) {
msgb_free(msg);
diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c
index 51bde8b5..d14eac4a 100644
--- a/src/osmo-bts-sysmo/l1_if.c
+++ b/src/osmo-bts-sysmo/l1_if.c
@@ -404,7 +404,7 @@ static int ph_data_req(struct gsm_bts_trx *trx, struct msgb *msg,
if (use_cache)
memcpy(l1p->u.phDataReq.msgUnitParam.u8Buffer,
lchan->tch.dtx.facch, msgb_l2len(msg));
- else if (trx->bts->dtxd && lchan->tch.dtx.dl_amr_fsm &&
+ else if (dtx_dl_amr_enabled(lchan) &&
lchan->tch.dtx.dl_amr_fsm->state == ST_ONSET_F) {
if (sapi == GsmL1_Sapi_FacchF) {
sapi = GsmL1_Sapi_TchF;
diff --git a/src/osmo-bts-sysmo/tch.c b/src/osmo-bts-sysmo/tch.c
index db5ca782..addb2ffb 100644
--- a/src/osmo-bts-sysmo/tch.c
+++ b/src/osmo-bts-sysmo/tch.c
@@ -373,7 +373,7 @@ int l1if_tch_encode(struct gsm_lchan *lchan, uint8_t *data, uint8_t *len,
l1_payload, marker, len, &ft);
if (rc < 0)
return rc;
- if (!lchan->ts->trx->bts->dtxd) {
+ if (!dtx_dl_amr_enabled(lchan)) {
*payload_type = GsmL1_TchPlType_Amr;
rtppayload_to_l1_amr(l1_payload + 2, rtp_pl, rtp_pl_len,
ft);
@@ -599,7 +599,7 @@ struct msgb *gen_empty_tch_msg(struct gsm_lchan *lchan, uint32_t fn)
case GSM48_CMODE_SPEECH_AMR:
if (lchan->type == GSM_LCHAN_TCH_H &&
lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F1 &&
- lchan->ts->trx->bts->dtxd) {
+ dtx_dl_amr_enabled(lchan)) {
*payload_type = GsmL1_TchPlType_Amr_SidFirstP2;
rc = dtx_dl_amr_fsm_step(lchan, NULL, 0, fn, l1_payload,
false, &(msu_param->u8Size),
@@ -626,7 +626,7 @@ struct msgb *gen_empty_tch_msg(struct gsm_lchan *lchan, uint32_t fn)
return NULL;
}
- if (lchan->ts->trx->bts->dtxd) {
+ if (dtx_dl_amr_enabled(lchan)) {
rc = repeat_last_sid(lchan, l1_payload, fn);
if (!rc) {
msgb_free(msg);