[PATCH] osmo-bts[master]: octphy: Allow passing low quality buffers to upper layers

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

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Thu Jun 29 10:29:09 UTC 2017


Review at  https://gerrit.osmocom.org/3078

octphy: Allow passing low quality buffers to upper layers

We want to always call l1if_tch_rx in order to avoid losing triggering
events on the upper layer.

With this change, the upper layer will increase correctly seq + ts for
RTP. It will then send an RTP packet with only the header and no payload, which is
not correct but at least we avoid drifting the RTP clock. Upcoming patch
in the series solves this issue.

Change-Id: I02bf4bca041fccf96fe2986480251f96248ce2d1
---
M src/osmo-bts-octphy/l1_if.c
M src/osmo-bts-octphy/l1_if.h
M src/osmo-bts-octphy/l1_tch.c
3 files changed, 20 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/78/3078/1

diff --git a/src/osmo-bts-octphy/l1_if.c b/src/osmo-bts-octphy/l1_if.c
index 8b31630..12a096b 100644
--- a/src/osmo-bts-octphy/l1_if.c
+++ b/src/osmo-bts-octphy/l1_if.c
@@ -1026,6 +1026,7 @@
 	uint8_t sapi = (uint8_t) data_ind->LchId.bySAPI;
 	uint8_t ts_num = (uint8_t) data_ind->LchId.byTimeslotNb;
 	uint8_t sc = (uint8_t) data_ind->LchId.bySubChannelNb;
+	bool low_quality = false; /* FIXME: check min_qual_norm! */
 
 	/* Need to combine two 16bit MSB and LSB to form 32bit FN */
 	fn = data_ind->Data.ulFrameNumber;
@@ -1050,8 +1051,6 @@
 	process_meas_res(trx, chan_nr, fn, data_ind->Data.ulDataLength,
 			 &data_ind->MeasurementInfo);
 
-	/* FIXME: check min_qual_norm! */
-
 	DEBUGP(DL1C, "Rx PH-DATA.ind %s: %s data_len:%d \n",
 	       get_value_string(octphy_l1sapi_names, sapi),
 	       osmo_hexdump(data_ind->Data.abyDataContent,
@@ -1062,10 +1061,18 @@
 	if (sapi == cOCTVC1_GSM_SAPI_ENUM_TCHF ||
 	    sapi == cOCTVC1_GSM_SAPI_ENUM_TCHH) {
 		/* TCH speech frame handling */
-		rc = l1if_tch_rx(trx, chan_nr, data_ind);
+		rc = l1if_tch_rx(trx, chan_nr, data_ind, low_quality);
 		return rc;
 	}
 
+	/* Discard frames with bad quality payload only after making sure we
+	 * signal upper layers for TCH frames, because it expects to always be
+	 * notified even if the content of the frame is not correct, otherwise
+	 * it losses events and the RTP clock drifts. */
+	if (low_quality && data_ind->Data.ulDataLength != 0) {
+		return 0;
+	}
+
 	/* get rssi, rssi is in q8 format */
 	rssi = (int8_t) (data_ind->MeasurementInfo.sRSSIDbm >> 8);
 	/* get data pointer and length */
diff --git a/src/osmo-bts-octphy/l1_if.h b/src/osmo-bts-octphy/l1_if.h
index 0960482..c1b2e0a 100644
--- a/src/osmo-bts-octphy/l1_if.h
+++ b/src/osmo-bts-octphy/l1_if.h
@@ -102,7 +102,7 @@
 
 int l1if_tch_rx(struct gsm_bts_trx *trx, uint8_t chan_nr,
 		tOCTVC1_GSM_MSG_TRX_LOGICAL_CHANNEL_DATA_INDICATION_EVT *
-		data_ind);
+		data_ind, bool low_quality);
 
 struct gsm_bts_trx *trx_by_l1h(struct octphy_hdl *fl1h, unsigned int trx_id);
 
diff --git a/src/osmo-bts-octphy/l1_tch.c b/src/osmo-bts-octphy/l1_tch.c
index 5693313..366df4f 100644
--- a/src/osmo-bts-octphy/l1_tch.c
+++ b/src/osmo-bts-octphy/l1_tch.c
@@ -183,7 +183,7 @@
 /* brief receive a traffic L1 primitive for a given lchan */
 int l1if_tch_rx(struct gsm_bts_trx *trx, uint8_t chan_nr,
 		tOCTVC1_GSM_MSG_TRX_LOGICAL_CHANNEL_DATA_INDICATION_EVT *
-		data_ind)
+		data_ind, bool low_quality)
 {
 	uint32_t payload_type = data_ind->Data.ulPayloadType;
 	uint8_t *payload = data_ind->Data.abyDataContent;
@@ -193,11 +193,15 @@
 	struct gsm_lchan *lchan =
 	    &trx->ts[L1SAP_CHAN2TS(chan_nr)].lchan[l1sap_chan2ss(chan_nr)];
 
-	if (data_ind->Data.ulDataLength < 1) {
-		LOGP(DL1C, LOGL_DEBUG, "chan_nr %d Rx Payload size 0\n",
-		     chan_nr);
-		return -EINVAL;
+	if (low_quality || data_ind->Data.ulDataLength < 1) {
+		LOGP(DL1C, LOGL_ERROR, "chan_nr %d Rx Payload size %u low_quality %d\n",
+			chan_nr, data_ind->Data.ulDataLength, low_quality);
+
+		/* Push empty payload to upper layers */
+		rmsg = msgb_alloc_headroom(256, 128, "L1C-to-RTP");
+		return add_l1sap_header(trx, rmsg, lchan, chan_nr, data_ind->Data.ulFrameNumber);
 	}
+
 	payload_len = data_ind->Data.ulDataLength;
 
 	switch (payload_type) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I02bf4bca041fccf96fe2986480251f96248ce2d1
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list