[MERGED] osmo-bts[master]: cosmetic: dyn TS: clarify rsl_tx_rf_rel_ack() with a switch

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun May 6 16:08:19 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: cosmetic: dyn TS: clarify rsl_tx_rf_rel_ack() with a switch
......................................................................


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
---
M src/common/rsl.c
1 file changed, 41 insertions(+), 9 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/common/rsl.c b/src/common/rsl.c
index 9adb89a..d46a5f5 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -618,16 +618,48 @@
 {
 	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;

-- 
To view, visit https://gerrit.osmocom.org/8035
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8a9953b011a4516972aae468754494f57ebc0a3f
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list