From ca262ffa733b68c9a6ad59b93d5003233654630b Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Sat, 5 May 2018 20:06:40 +0200 Subject: cosmetic: dyn TS: clarify rsl_tx_rf_rel_ack() with a switch Use a switch statement and ample comments to clarify what is done and why. Cosmetically prepares for Ic06c8f0fe82ae8a06afa5defd93a685010687965. Related: OS#3235 Change-Id: I8a9953b011a4516972aae468754494f57ebc0a3f --- src/common/rsl.c | 50 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 9 deletions(-) (limited to 'src/common/rsl.c') diff --git a/src/common/rsl.c b/src/common/rsl.c index 9adb89a0..d46a5f50 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -618,16 +618,48 @@ int rsl_tx_rf_rel_ack(struct gsm_lchan *lchan) { struct msgb *msg; uint8_t chan_nr = gsm_lchan2chan_nr(lchan); + bool send_rel_ack; - /* - * Normally, PDCH deactivation via PCU does not ack back to the BSC. - * But for GSM_PCHAN_TCH_F_TCH_H_PDCH, send a non-standard rel ack for - * LCHAN_REL_ACT_PCU, since the rel req came from RSL initially. - */ - if (lchan->rel_act_kind != LCHAN_REL_ACT_RSL - && !(lchan->ts->pchan == GSM_PCHAN_TCH_F_TCH_H_PDCH - && lchan->ts->dyn.pchan_is == GSM_PCHAN_PDCH - && lchan->rel_act_kind == LCHAN_REL_ACT_PCU)) { + switch (lchan->rel_act_kind) { + case LCHAN_REL_ACT_RSL: + send_rel_ack = true; + break; + + case LCHAN_REL_ACT_PCU: + switch (lchan->ts->pchan) { + case GSM_PCHAN_TCH_F_TCH_H_PDCH: + if (lchan->ts->dyn.pchan_is != GSM_PCHAN_PDCH) { + LOGP(DRSL, LOGL_ERROR, + "%s (ss=%d) PDCH release: not in PDCH mode\n", + gsm_ts_and_pchan_name(lchan->ts), lchan->nr); + /* well, what to do about it ... carry on and hope it's fine. */ + } + /* Continue to ack the release below. (This is a non-standard rel ack invented + * specifically for GSM_PCHAN_TCH_F_TCH_H_PDCH). */ + send_rel_ack = true; + break; + case GSM_PCHAN_TCH_F_PDCH: + /* GSM_PCHAN_TCH_F_PDCH, does not require a rel ack. The caller + * l1sap_info_rel_cnf() will continue with bts_model_ts_disconnect(). */ + send_rel_ack = false; + break; + default: + LOGP(DRSL, LOGL_ERROR, "%s PCU rel ack for unexpected lchan kind\n", + gsm_lchan_name(lchan)); + /* Release certainly was not requested by the BSC via RSL, so don't ack. */ + send_rel_ack = false; + break; + } + break; + + default: + /* A rel that was not requested by the BSC via RSL, hence not sending a rel ack to the + * BSC. */ + send_rel_ack = false; + break; + } + + if (!send_rel_ack) { LOGP(DRSL, LOGL_NOTICE, "%s not sending REL ACK\n", gsm_lchan_name(lchan)); return 0; -- cgit v1.2.3