Change in osmo-trx[master]: Introduce rate counters to detect issues in received Dl bursts from TRXD

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
Thu Jul 9 14:52:30 UTC 2020


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-trx/+/19205 )


Change subject: Introduce rate counters to detect issues in received Dl bursts from TRXD
......................................................................

Introduce rate counters to detect issues in received Dl bursts from TRXD

This ones together with rate counters already available in lower layers
allows to understand better the source of the problem with stalled tx
bursts.

Change-Id: Ia34f7e7d780ad1e12f24638a07f05fe91f2afea5
---
M CommonLibs/osmo_signal.h
M CommonLibs/trx_rate_ctr.cpp
M CommonLibs/trx_rate_ctr.h
M Transceiver52M/Transceiver.cpp
M Transceiver52M/Transceiver.h
5 files changed, 68 insertions(+), 9 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/05/19205/1

diff --git a/CommonLibs/osmo_signal.h b/CommonLibs/osmo_signal.h
index de17b1d..5cd90c6 100644
--- a/CommonLibs/osmo_signal.h
+++ b/CommonLibs/osmo_signal.h
@@ -61,4 +61,7 @@
 struct trx_counters {
 	size_t chan;
 	unsigned int tx_stale_bursts; /* Amount of Tx bursts dropped to to arriving too late from TRXD */
+	unsigned int tx_trxd_fn_repeated;
+	unsigned int tx_trxd_fn_outoforder;
+	unsigned int tx_trxd_fn_skipped;
 };
diff --git a/CommonLibs/trx_rate_ctr.cpp b/CommonLibs/trx_rate_ctr.cpp
index 76aff7d..c74602a 100644
--- a/CommonLibs/trx_rate_ctr.cpp
+++ b/CommonLibs/trx_rate_ctr.cpp
@@ -103,6 +103,9 @@
 	{ TRX_CTR_DEV_TX_DROP_EV,	"tx_drop_events" },
 	{ TRX_CTR_DEV_TX_DROP_SMPL,	"tx_drop_samples" },
 	{ TRX_CTR_TRX_TX_STALE_BURSTS,	"tx_stale_bursts" },
+	{ TRX_CTR_TRX_TRXD_FN_REPEATED,	"tx_trxd_fn_repeated" },
+	{ TRX_CTR_TRX_TRXD_FN_OUTOFORDER, "tx_trxd_fn_outoforder" },
+	{ TRX_CTR_TRX_TRXD_FN_SKIPPED,	"tx_trxd_fn_skipped" },
 	{ 0, NULL }
 };
 
@@ -114,6 +117,9 @@
 	[TRX_CTR_DEV_TX_DROP_EV]		= { "device:tx_drop_events",	"Number of times Tx samples were dropped by HW" },
 	[TRX_CTR_DEV_TX_DROP_SMPL]		= { "device:tx_drop_samples",	"Number of Tx samples dropped by HW" },
 	[TRX_CTR_TRX_TX_STALE_BURSTS]		= { "trx:tx_stale_bursts",	"Number of Tx burts dropped by TRX due to arriving too late" },
+	[TRX_CTR_TRX_TRXD_FN_REPEATED]		= { "trx:tx_trxd_fn_repeated",	"Number of Tx burts received from TRXD with repeated FN" },
+	[TRX_CTR_TRX_TRXD_FN_OUTOFORDER]	= { "trx:tx_trxd_fn_outoforder","Number of Tx burts received from TRXD with a past FN" },
+	[TRX_CTR_TRX_TRXD_FN_SKIPPED]		= { "trx:tx_trxd_fn_skipped",	"Number of Tx burts potentially skipped due to FN jumps" },
 };
 
 static const struct rate_ctr_group_desc trx_chan_ctr_group_desc = {
@@ -166,6 +172,12 @@
 		LOGCHAN(chan, DMAIN, INFO) << "rate_ctr update";
 		ctr = &rate_ctrs[chan]->ctr[TRX_CTR_TRX_TX_STALE_BURSTS];
 		rate_ctr_add(ctr, trx_ctrs_pending[chan].tx_stale_bursts - ctr->current);
+		ctr = &rate_ctrs[chan]->ctr[TRX_CTR_TRX_TRXD_FN_REPEATED];
+		rate_ctr_add(ctr, trx_ctrs_pending[chan].tx_trxd_fn_repeated - ctr->current);
+		ctr = &rate_ctrs[chan]->ctr[TRX_CTR_TRX_TRXD_FN_OUTOFORDER];
+		rate_ctr_add(ctr, trx_ctrs_pending[chan].tx_trxd_fn_outoforder - ctr->current);
+		ctr = &rate_ctrs[chan]->ctr[TRX_CTR_TRX_TRXD_FN_SKIPPED];
+		rate_ctr_add(ctr, trx_ctrs_pending[chan].tx_trxd_fn_skipped - ctr->current);
 		/* Mark as done */
 		trx_ctrs_pending[chan].chan = PENDING_CHAN_NONE;
 	}
diff --git a/CommonLibs/trx_rate_ctr.h b/CommonLibs/trx_rate_ctr.h
index 588ac2f..cef3c21 100644
--- a/CommonLibs/trx_rate_ctr.h
+++ b/CommonLibs/trx_rate_ctr.h
@@ -11,6 +11,9 @@
 	TRX_CTR_DEV_TX_DROP_EV,
 	TRX_CTR_DEV_TX_DROP_SMPL,
 	TRX_CTR_TRX_TX_STALE_BURSTS,
+	TRX_CTR_TRX_TRXD_FN_REPEATED,
+	TRX_CTR_TRX_TRXD_FN_OUTOFORDER,
+	TRX_CTR_TRX_TRXD_FN_SKIPPED,
 };
 
 struct ctr_threshold {
diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index 2ae5eda..01714db 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -52,6 +52,14 @@
 /* Number of running values use in noise average */
 #define NOISE_CNT			20
 
+
+static void dispatch_trx_rate_ctr_change(TransceiverState *state, unsigned int chan) {
+        thread_enable_cancel(false);
+        state->ctrs.chan = chan;
+        osmo_signal_dispatch(SS_DEVICE, S_TRX_COUNTER_CHANGE, &state->ctrs);
+        thread_enable_cancel(true);
+}
+
 TransceiverState::TransceiverState()
   : mRetrans(false), mNoiseLev(0.0), mNoises(NOISE_CNT), mPower(0.0)
 {
@@ -437,12 +445,8 @@
       delete burst;
     }
 
-    if (stale_bursts_changed) {
-      thread_enable_cancel(false);
-      state->ctrs.chan = i;
-      osmo_signal_dispatch(SS_DEVICE, S_TRX_COUNTER_CHANGE, &state->ctrs);
-      thread_enable_cancel(true);
-    }
+    if (stale_bursts_changed)
+      dispatch_trx_rate_ctr_change(state, i);
 
     TN = nowTime.TN();
     modFN = nowTime.FN() % state->fillerModulus[TN];
@@ -461,7 +465,7 @@
       }
 
       delete burst;
-    }
+    } //else { rate_counter() }
   }
 
   mRadioInterface->driveTransmitRadio(bursts, zeros);
@@ -1001,6 +1005,7 @@
   struct trxd_hdr_v01_dl *dl;
   char buffer[sizeof(*dl) + EDGE_BURST_NBITS];
   uint32_t fn;
+  uint8_t tn;
 
   // check data socket
   msgLen = read(mDataSockets[chan], buffer, sizeof(buffer));
@@ -1029,6 +1034,7 @@
 
   /* Convert TDMA FN to the host endianness */
   fn = osmo_load32be(&dl->common.fn);
+  tn = dl->common.tn;
 
   /* Make sure we support the received header format */
   switch (dl->common.version) {
@@ -1044,14 +1050,45 @@
   LOGCHAN(chan, DTRXDDL, DEBUG) << "Rx TRXD message (hdr_ver=" << unsigned(dl->common.version)
     << "): fn=" << fn << ", tn=" << unsigned(dl->common.tn) << ", burst_len=" << burstLen;
 
+  TransceiverState *state = &mStates[chan];
+  GSM::Time currTime = GSM::Time(fn, tn);
+
+  /* Verify proper FN order in DL stream */
+  if (state->first_dl_fn_rcv[tn]) {
+    int32_t delta = GSM::FNDelta(currTime.FN(), state->last_dl_time_rcv[tn].FN());
+    if (delta == 1) {
+        /* usual expected scenario, continue code flow */
+    } else if (delta == 0) {
+      LOGCHAN(chan, DTRXDDL, NOTICE) << "Rx TRXD msg with repeated FN " << currTime;
+      state->ctrs.tx_trxd_fn_repeated++;
+      dispatch_trx_rate_ctr_change(state, chan);
+      return true;
+    } else if (delta < 0) {
+      LOGCHAN(chan, DTRXDDL, NOTICE) << "Rx TRXD msg with previous FN " << currTime
+                                     << " vs last " << state->last_dl_time_rcv[tn];
+       state->ctrs.tx_trxd_fn_outoforder++;
+       dispatch_trx_rate_ctr_change(state, chan);
+       /* Allow adding radio vector below, since it gets sorted in the queue */
+    } else { /* some FN was lost in the middle */
+      LOGCHAN(chan, DTRXDDL, NOTICE) << "Rx TRXD msg with future FN " << currTime
+                                     << " vs last " << state->last_dl_time_rcv[tn]
+                                     << ", " << delta - 1 << " FN lost";
+      state->ctrs.tx_trxd_fn_skipped += delta - 1;
+      dispatch_trx_rate_ctr_change(state, chan);
+    }
+    if (delta > 0)
+      state->last_dl_time_rcv[tn] = currTime;
+  } else { /* Initial check, simply store state */
+    state->first_dl_fn_rcv[tn] = true;
+    state->last_dl_time_rcv[tn] = currTime;
+  }
+
   BitVector newBurst(burstLen);
   BitVector::iterator itr = newBurst.begin();
   uint8_t *bufferItr = dl->soft_bits;
   while (itr < newBurst.end())
     *itr++ = *bufferItr++;
 
-  GSM::Time currTime = GSM::Time(fn, dl->common.tn);
-
   addRadioVector(chan, newBurst, dl->tx_att, currTime);
 
   return true;
diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h
index 7ce5fa2..52748c1 100644
--- a/Transceiver52M/Transceiver.h
+++ b/Transceiver52M/Transceiver.h
@@ -86,6 +86,10 @@
 
   /* counters */
   struct trx_counters ctrs;
+
+  /* Used to keep track of lost and out of order frames */
+  bool first_dl_fn_rcv[8];
+  GSM::Time last_dl_time_rcv[8];
 };
 
 /** The Transceiver class, responsible for physical layer of basestation */

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

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: Ia34f7e7d780ad1e12f24638a07f05fe91f2afea5
Gerrit-Change-Number: 19205
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200709/5249e5ad/attachment.htm>


More information about the gerrit-log mailing list