Change in osmo-bts[master]: gsm_lchan2chan_nr(): separate RSL specific variant of this API

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/.

fixeria gerrit-no-reply at lists.osmocom.org
Mon Sep 27 15:53:37 UTC 2021


fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/25580 )

Change subject: gsm_lchan2chan_nr(): separate RSL specific variant of this API
......................................................................

gsm_lchan2chan_nr(): separate RSL specific variant of this API

The ip.access style dynamic timeslots are a bit special in a way that
on the A-bis/RSL we always use the Channel Number value of TCH/F,
even in PDCH mode.  This is why gsm_lchan2chan_nr() would always
return values corresponding to TCH/F for TCH/F_PDCH.

This behavior is only acceptable in the context of RSL messages, while
other parts of the code base may not work properly due to this trick.
A good example is the scheduler in osmo-bts-trx, where we have to
patch Channel Number value to make channel activation work.

  DPCU INFO pcu_sock.c:853 Activate request received: TRX=0 TS=5
  DL1C INFO l1sap.c:2043 (bts=0,trx=0,ts=5,ss=0) Activating channel TCH/F on TS5
  DL1C NOTICE scheduler.c:1097 (bts=0,trx=0,ts=5,ss=0) Activating PDTCH
  DL1C NOTICE scheduler.c:1097 (bts=0,trx=0,ts=5,ss=0) Activating PTCCH

In the code branch responsible for channel deactivation, we somehow
forgot to add the same workaround, so deactivation does not work:

  DL1C INFO l1sap.c:2076 (bts=0,trx=0,ts=5,ss=0) Deactivating channel TCH/F on TS5
  DTRX INFO trx_if.c:255 phy0.0: Enqueuing TRX control command 'CMD NOHANDOVER 5 0'
  DRSL NOTICE rsl.c:1286 (bts=0,trx=0,ts=5,ss=0) (bts=0,trx=0,ts=5,ss=0) not sending REL ACK

Because of that, TCH/F_PDCH timeslots actually remain active after
deactivation, so the scheduler keeps producing L1SAP DATA.ind.

  DL1P NOTICE l1sap.c:126 (bts=0,trx=0,ts=5,ss=0) assuming active lchan, but state is NONE
  DL1P ERROR l1sap.c:732 1583426/1194/00/29/14 No lchan for DATA MEAS IND (chan_nr=PDCH on TS5)
  DPCU NOTICE pcu_sock.c:973 PCU socket not connected, dropping message
  DL1P NOTICE l1sap.c:126 (bts=0,trx=0,ts=5,ss=0) assuming active lchan, but state is NONE
  DPCU NOTICE pcu_sock.c:973 PCU socket not connected, dropping message
  DL1P NOTICE l1sap.c:126 (bts=0,trx=0,ts=5,ss=0) assuming active lchan, but state is NONE
  DL1P ERROR l1sap.c:732 1583430/1194/04/33/18 No lchan for DATA MEAS IND (chan_nr=PDCH on TS5)
  DPCU NOTICE pcu_sock.c:973 PCU socket not connected, dropping message
  DL1P NOTICE l1sap.c:126 (bts=0,trx=0,ts=5,ss=0) assuming active lchan, but state is NONE
  DPCU NOTICE pcu_sock.c:973 PCU socket not connected, dropping message

Instead of patching Channel Number in various places, let's rather
make the RSL specific behavior configurable by having two variants
of gsm_lchan2chan_nr().

Change-Id: I01680140c7201bf5284b278bceaea8ae01c122b2
Fixes: OS#5238
---
M include/osmo-bts/gsm_data.h
M src/common/gsm_data.c
M src/common/rsl.c
3 files changed, 37 insertions(+), 21 deletions(-)

Approvals:
  Jenkins Builder: Verified
  osmith: Looks good to me, but someone else must approve
  fixeria: Looks good to me, approved
  laforge: Looks good to me, but someone else must approve



diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h
index 9fe68d6..19689e5 100644
--- a/include/osmo-bts/gsm_data.h
+++ b/include/osmo-bts/gsm_data.h
@@ -568,6 +568,7 @@
 }
 
 uint8_t gsm_lchan2chan_nr(const struct gsm_lchan *lchan);
+uint8_t gsm_lchan2chan_nr_rsl(const struct gsm_lchan *lchan);
 uint8_t gsm_lchan_as_pchan2chan_nr(const struct gsm_lchan *lchan,
 				   enum gsm_phys_chan_config as_pchan);
 
diff --git a/src/common/gsm_data.c b/src/common/gsm_data.c
index ee6e693..1525328 100644
--- a/src/common/gsm_data.c
+++ b/src/common/gsm_data.c
@@ -243,7 +243,7 @@
 	return chan_nr;
 }
 
-uint8_t gsm_lchan2chan_nr(const struct gsm_lchan *lchan)
+static uint8_t _gsm_lchan2chan_nr(const struct gsm_lchan *lchan, bool rsl)
 {
 	uint8_t chan_nr;
 
@@ -254,9 +254,14 @@
 		chan_nr = gsm_lchan_as_pchan2chan_nr(lchan, lchan->ts->dyn.pchan_is);
 		break;
 	case GSM_PCHAN_TCH_F_PDCH:
-		/* For ip.access style dyn TS, we always want to use the chan_nr as if it was TCH/F.
+		/* For ip.access style dyn TS, on RSL we want to use the chan_nr as if it was TCH/F.
 		 * We're using custom PDCH ACT and DEACT messages that use the usual chan_nr values. */
-		chan_nr = gsm_lchan_as_pchan2chan_nr(lchan, GSM_PCHAN_TCH_F);
+		if (rsl)
+			chan_nr = gsm_lchan_as_pchan2chan_nr(lchan, GSM_PCHAN_TCH_F);
+		else if (~lchan->ts->flags & TS_F_PDCH_ACTIVE)
+			chan_nr = gsm_lchan_as_pchan2chan_nr(lchan, GSM_PCHAN_TCH_F);
+		else
+			chan_nr = gsm_lchan_as_pchan2chan_nr(lchan, GSM_PCHAN_PDCH);
 		break;
 	default:
 		chan_nr = gsm_pchan2chan_nr(lchan->ts->pchan, lchan->ts->nr, lchan->nr);
@@ -271,6 +276,16 @@
 	return chan_nr;
 }
 
+uint8_t gsm_lchan2chan_nr(const struct gsm_lchan *lchan)
+{
+	return _gsm_lchan2chan_nr(lchan, false);
+}
+
+uint8_t gsm_lchan2chan_nr_rsl(const struct gsm_lchan *lchan)
+{
+	return _gsm_lchan2chan_nr(lchan, true);
+}
+
 uint8_t gsm_lchan_as_pchan2chan_nr(const struct gsm_lchan *lchan,
 				   enum gsm_phys_chan_config as_pchan)
 {
diff --git a/src/common/rsl.c b/src/common/rsl.c
index 368590c..742270d 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -461,7 +461,7 @@
 			if (band < 0)
 				continue;
 
-			msgb_v_put(nmsg, gsm_lchan2chan_nr(lchan));
+			msgb_v_put(nmsg, gsm_lchan2chan_nr_rsl(lchan));
 			msgb_v_put(nmsg, (band & 0x07) << 5);
 		}
 	}
@@ -1225,7 +1225,7 @@
 /* 8.4.19 sending RF CHANnel RELease ACKnowledge */
 int rsl_tx_rf_rel_ack(struct gsm_lchan *lchan)
 {
-	uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
+	uint8_t chan_nr = gsm_lchan2chan_nr_rsl(lchan);
 	bool send_rel_ack;
 
 	switch (lchan->rel_act_kind) {
@@ -1314,7 +1314,7 @@
 {
 	struct gsm_time *gtime = get_time(lchan->ts->trx->bts);
 	struct msgb *msg;
-	uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
+	uint8_t chan_nr = gsm_lchan2chan_nr_rsl(lchan);
 	uint8_t ie[2];
 
 	LOGP(DRSL, LOGL_NOTICE, "%s (ss=%d) %s Tx CHAN ACT ACK\n",
@@ -1340,7 +1340,7 @@
 int rsl_tx_hando_det(struct gsm_lchan *lchan, uint8_t *ho_delay)
 {
 	struct msgb *msg;
-	uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
+	uint8_t chan_nr = gsm_lchan2chan_nr_rsl(lchan);
 
 	LOGPLCHAN(lchan, DRSL, LOGL_INFO, "Sending HANDOver DETect\n");
 
@@ -1382,7 +1382,7 @@
 	return abis_bts_rsl_sendmsg(msg);
 }
 static int rsl_tx_chan_act_nack(struct gsm_lchan *lchan, uint8_t cause) {
-	return _rsl_tx_chan_act_nack(lchan->ts->trx, gsm_lchan2chan_nr(lchan), cause, lchan);
+	return _rsl_tx_chan_act_nack(lchan->ts->trx, gsm_lchan2chan_nr_rsl(lchan), cause, lchan);
 }
 
 /* Send an RSL Channel Activation Ack if cause is zero, a Nack otherwise. */
@@ -1403,7 +1403,7 @@
 int rsl_tx_conn_fail(const struct gsm_lchan *lchan, uint8_t cause)
 {
 	struct msgb *msg;
-	uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
+	uint8_t chan_nr = gsm_lchan2chan_nr_rsl(lchan);
 
 	LOGPLCHAN(lchan, DRSL, LOGL_NOTICE, "Sending Connection Failure: cause = 0x%02x\n", cause);
 
@@ -2011,7 +2011,7 @@
 		}
 	}
 
-	rsl_rll_push_l3(fake_msg, RSL_MT_DATA_IND, gsm_lchan2chan_nr(lchan),
+	rsl_rll_push_l3(fake_msg, RSL_MT_DATA_IND, gsm_lchan2chan_nr_rsl(lchan),
 			link_id, 1);
 
 	fake_msg->lchan = lchan;
@@ -2146,7 +2146,7 @@
 }
 static int rsl_tx_mode_modif_nack(struct gsm_lchan *lchan, uint8_t cause)
 {
-	return _rsl_tx_mode_modif_nack(lchan->ts->trx, gsm_lchan2chan_nr(lchan), cause, lchan);
+	return _rsl_tx_mode_modif_nack(lchan->ts->trx, gsm_lchan2chan_nr_rsl(lchan), cause, lchan);
 }
 
 
@@ -2154,7 +2154,7 @@
 static int rsl_tx_mode_modif_ack(struct gsm_lchan *lchan)
 {
 	struct msgb *msg;
-	uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
+	uint8_t chan_nr = gsm_lchan2chan_nr_rsl(lchan);
 
 	LOGPLCHAN(lchan, DRSL, LOGL_INFO, "Tx MODE MODIF ACK\n");
 
@@ -2432,7 +2432,7 @@
 		return -ENOMEM;
 
 	/* 9.3.1 Channel Number */
-	rsl_cch_push_hdr(msg, RSL_MT_CBCH_LOAD_IND, gsm_lchan2chan_nr(lchan));
+	rsl_cch_push_hdr(msg, RSL_MT_CBCH_LOAD_IND, gsm_lchan2chan_nr_rsl(lchan));
 
 	/* 9.3.43 CBCH Load Information */
 	load_info = ((overflow & 1) << 7) | (amount & 0x0F);
@@ -2494,7 +2494,7 @@
 	msgb_tv16_put(nmsg, RSL_IE_IPAC_CONN_ID, htons(lchan->abis_ip.conn_id));
 	rsl_add_rtp_stats(lchan, nmsg);
 	msgb_tlv_put(nmsg, RSL_IE_CAUSE, 1, &cause);
-	rsl_ipa_push_hdr(nmsg, RSL_MT_IPAC_DLCX_IND, gsm_lchan2chan_nr(lchan));
+	rsl_ipa_push_hdr(nmsg, RSL_MT_IPAC_DLCX_IND, gsm_lchan2chan_nr_rsl(lchan));
 
 	nmsg->trx = lchan->ts->trx;
 
@@ -2506,7 +2506,7 @@
 				  uint8_t orig_msgt)
 {
 	struct msgb *msg;
-	uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
+	uint8_t chan_nr = gsm_lchan2chan_nr_rsl(lchan);
 	const char *name;
 	struct in_addr ia;
 
@@ -2554,7 +2554,7 @@
 static int rsl_tx_ipac_dlcx_ack(struct gsm_lchan *lchan, int inc_conn_id)
 {
 	struct msgb *msg;
-	uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
+	uint8_t chan_nr = gsm_lchan2chan_nr_rsl(lchan);
 
 	LOGPLCHAN(lchan, DRSL, LOGL_INFO, "RSL Tx IPAC_DLCX_ACK\n");
 
@@ -2577,7 +2577,7 @@
 				 uint8_t cause)
 {
 	struct msgb *msg;
-	uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
+	uint8_t chan_nr = gsm_lchan2chan_nr_rsl(lchan);
 
 	LOGPLCHAN(lchan, DRSL, LOGL_INFO, "RSL Tx IPAC_DLCX_NACK\n");
 
@@ -2603,7 +2603,7 @@
 			     int inc_ipport, uint8_t orig_msgtype)
 {
 	struct msgb *msg;
-	uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
+	uint8_t chan_nr = gsm_lchan2chan_nr_rsl(lchan);
 
 	/* FIXME: allocate new msgb and copy old over */
 	LOGPLCHAN(lchan, DRSL, LOGL_NOTICE, "RSL Tx IPAC_BIND_NACK\n");
@@ -2918,7 +2918,7 @@
 static int rsl_tx_dyn_pdch_ack(struct gsm_lchan *lchan, bool pdch_act)
 {
 	struct gsm_time *gtime = get_time(lchan->ts->trx->bts);
-	uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
+	uint8_t chan_nr = gsm_lchan2chan_nr_rsl(lchan);
 	struct msgb *msg;
 	uint8_t ie[2];
 
@@ -2947,7 +2947,7 @@
 				uint8_t cause)
 {
 	struct msgb *msg;
-	uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
+	uint8_t chan_nr = gsm_lchan2chan_nr_rsl(lchan);
 
 	LOGPLCHAN(lchan, DRSL, LOGL_NOTICE, "Tx PDCH %s NACK (cause = 0x%02x)\n",
 		  pdch_act ? "ACT" : "DEACT", cause);
@@ -3512,7 +3512,7 @@
 {
 	struct msgb *msg;
 	uint8_t meas_res[16];
-	uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
+	uint8_t chan_nr = gsm_lchan2chan_nr_rsl(lchan);
 	int res_valid = lchan->meas.flags & LC_UL_M_F_RES_VALID;
 	struct gsm_bts *bts = lchan->ts->trx->bts;
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/25580
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I01680140c7201bf5284b278bceaea8ae01c122b2
Gerrit-Change-Number: 25580
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210927/2bb801e8/attachment.htm>


More information about the gerrit-log mailing list