Change in osmo-pcu[master]: pcuif: Submit data_req with len=0 as idle frames

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

pespin gerrit-no-reply at lists.osmocom.org
Wed Oct 20 13:35:10 UTC 2021


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/25535 )

Change subject: pcuif: Submit data_req with len=0 as idle frames
......................................................................

pcuif: Submit data_req with len=0 as idle frames

This way PCU always answers DATA.ind and the BTS can still clearly
identify idle frames. It also simplifies testing and verification of
correct behavior.

Related: SYS#4919
Change-Id: Ife718eeed2af011479c03099ea109518f04567bc
---
M src/gprs_rlcmac_sched.cpp
M src/pcu_l1_if.cpp
2 files changed, 40 insertions(+), 21 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp
index cdbf70d..8867d43 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -412,7 +412,7 @@
 	uint8_t usf;
 	struct msgb *msg = NULL;
 	uint32_t poll_fn;
-	enum pcu_gsmtap_category gsmtap_cat;
+	enum pcu_gsmtap_category gsmtap_cat = PCU_GSMTAP_C_DL_DUMMY; /* init: make gcc happy */
 	bool tx_is_egprs = false;
 	bool require_gprs_only;
 	enum mcs_kind req_mcs_kind; /* Restrict CS/MCS if DL Data block is to be sent */
@@ -487,9 +487,9 @@
 	}
 	/* Prio 3: send dummy control message if need to poll or USF */
 	else {
-		/* If there's no TBF attached to this PDCH, we can early skip
-		 * since there's nothing to transmit nor to poll/USF. This way
-		 * we help BTS energy saving (on TRX!=C0) by sending nothing
+		/* If there's no TBF attached to this PDCH, we can submit an empty
+		 * data_req since there's nothing to transmit nor to poll/USF. This
+		 * way we help BTS energy saving (on TRX!=C0) by sending nothing
 		 * instead of a dummy block. The early return is done here and
 		 * not at the start of the function because the condition below
 		 * (num_tbfs==0) may not be enough, because temporary dummy TBFs
@@ -505,13 +505,11 @@
 		 * TRX0, since BTS is not preparing dummy bursts on idle TS for us */
 		skip_idle = skip_idle && trx != 0;
 #endif
-		if (skip_idle)
-			return 0;
-		if ((msg = sched_dummy())) {
+		if (!skip_idle && (msg = sched_dummy())) {
 			/* increase counter */
 			gsmtap_cat = PCU_GSMTAP_C_DL_DUMMY;
 		} else {
-			return -ENOMEM;
+			msg = NULL; /* submit empty frame */
 		}
 	}
 
@@ -521,21 +519,23 @@
 		pdch->fn_without_cs14 = 0;
 	}
 
-	/* msg is now available */
-	bts_do_rate_ctr_add(bts, CTR_RLC_DL_BYTES, msgb_length(msg));
-
-	/* set USF */
-	OSMO_ASSERT(msgb_length(msg) > 0);
-	usf = usf_tbf ? usf_tbf->m_usf[ts] : USF_UNUSED;
-	msg->data[0] = (msg->data[0] & 0xf8) | usf;
-
 	/* Used to measure the leak rate, count all blocks */
 	gprs_bssgp_update_frames_sent();
 
-	/* Send to GSMTAP */
-	tap_n_acc(msg, bts, trx, ts, fn, gsmtap_cat);
+	if (msg) {
+		/* msg is now available */
+		bts_do_rate_ctr_add(bts, CTR_RLC_DL_BYTES, msgb_length(msg));
 
-	/* send PDTCH/PACCH to L1 */
+		/* set USF */
+		OSMO_ASSERT(msgb_length(msg) > 0);
+		usf = usf_tbf ? usf_tbf->m_usf[ts] : USF_UNUSED;
+		msg->data[0] = (msg->data[0] & 0xf8) | usf;
+
+		/* Send to GSMTAP */
+		tap_n_acc(msg, bts, trx, ts, fn, gsmtap_cat);
+	}
+
+	/* send PDTCH/PACCH to L1. msg=NULL accepted too (idle block) */
 	pcu_l1if_tx_pdtch(msg, bts, trx, ts, bts->trx[trx].arfcn, fn, block_nr);
 
 	return 0;
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 1600da0..8d9defc 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -212,7 +212,8 @@
 	data_req->trx_nr = trx;
 	data_req->ts_nr = ts;
 	data_req->block_nr = block_nr;
-	memcpy(data_req->data, data, len);
+	if (len)
+		memcpy(data_req->data, data, len);
 	data_req->len = len;
 
 	return pcu_sock_send(msg);
@@ -223,12 +224,20 @@
 {
 #ifdef ENABLE_DIRECT_PHY
 	if (bts->trx[trx].fl1h) {
+		if (!msg) /* Simply skip sending idle frames to L1 */
+			return;
 		l1if_pdch_req(bts->trx[trx].fl1h, ts, 0, fn, arfcn, block_nr,
 			msg->data, msg->len);
 		msgb_free(msg);
 		return;
 	}
 #endif
+	if (!msg) {
+		pcu_tx_data_req(bts, trx, ts, PCU_IF_SAPI_PDTCH, arfcn, fn, block_nr,
+				NULL, 0);
+		return;
+	}
+
 	pcu_tx_data_req(bts, trx, ts, PCU_IF_SAPI_PDTCH, arfcn, fn, block_nr,
 			msg->data, msg->len);
 	msgb_free(msg);
@@ -243,10 +252,17 @@
 		gsmtap_send(the_pcu->gsmtap, arfcn, ts, GSMTAP_CHANNEL_PTCCH, 0, fn, 0, 0, data, data_len);
 #ifdef ENABLE_DIRECT_PHY
 	if (bts->trx[trx].fl1h) {
+		if (!data_len) /* Simply skip sending idle frames to L1 */
+			return;
 		l1if_pdch_req(bts->trx[trx].fl1h, ts, 1, fn, arfcn, block_nr, data, data_len);
 		return;
 	}
 #endif
+	if (!data_len) {
+		pcu_tx_data_req(bts, trx, ts, PCU_IF_SAPI_PTCCH, arfcn, fn, block_nr, NULL, 0);
+		return;
+	}
+
 	pcu_tx_data_req(bts, trx, ts, PCU_IF_SAPI_PTCCH, arfcn, fn, block_nr, data, data_len);
 }
 
@@ -544,8 +560,11 @@
 		 * TRX0, since BTS is not preparing dummy bursts on idle TS for us: */
 		skip_idle = skip_idle && trx != 0;
 #endif
-	if (skip_idle)
+	if (skip_idle) {
+		pcu_l1if_tx_ptcch(bts, trx, ts, bts->trx[trx].arfcn, fn, block_nr,
+				  NULL, 0);
 		return 0;
+	}
 
 	pcu_l1if_tx_ptcch(bts, trx, ts, bts->trx[trx].arfcn, fn, block_nr,
 			  pdch->ptcch_msg, GSM_MACBLOCK_LEN);

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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Ife718eeed2af011479c03099ea109518f04567bc
Gerrit-Change-Number: 25535
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Assignee: 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: 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/20211020/f58bbced/attachment.htm>


More information about the gerrit-log mailing list