[PATCH] osmo-pcu[master]: TBF: add N3101 counter

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

Max gerrit-no-reply at lists.osmocom.org
Tue Dec 5 11:34:34 UTC 2017


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

TBF: add N3101 counter

Properly reset the counter when receiving valid RLCMAC block and update
it when no data is received as per 3GPP TS 44.060 §8.1.1.1

Change-Id: I2f79c6153dc4073c9d293b2824979e6381576682
Fixes: OS#2407
---
M src/bts.cpp
M src/tbf.cpp
M src/tbf.h
3 files changed, 30 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/82/5182/1

diff --git a/src/bts.cpp b/src/bts.cpp
index 6f76d84..684ccc9 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -994,6 +994,10 @@
 			     ms->dl_tbf() ? ms->dl_tbf()->state_name() : "None");
 		return;
 	}
+
+	/* Reset N3101 counter: */
+	tbf->m_n3101 = 0;
+
 	tbf->update_ms(tlli, GPRS_RLCMAC_UL_TBF);
 
 	LOGP(DRLCMAC, LOGL_DEBUG, "RX: [PCU <- BTS] %s Packet Control Ack\n", tbf_name(tbf));
@@ -1186,6 +1190,9 @@
 		return;
 	}
 
+	/* Reset N3101 counter: */
+	tbf->m_n3101 = 0;
+
 	if (tbf->handle_ack_nack())
 		LOGP(DRLCMAC, LOGL_NOTICE, "Recovered downlink ack for %s\n", tbf_name(tbf));
 
@@ -1249,6 +1256,9 @@
 			"wrong TFI=%d, ignoring!\n", tfi);
 		return;
 	}
+
+	/* Reset N3101 counter: */
+	tbf->m_n3101 = 0;
 
 	if (tbf->handle_ack_nack())
 		LOGP(DRLCMAC, LOGL_NOTICE, "Recovered EGPRS downlink ack for %s\n", tbf_name(tbf));
@@ -1422,6 +1432,9 @@
 		LOGP(DRLCMAC, LOGL_ERROR,
 			"RX: [PCU <- BTS] %s FIXME: Packet resource request\n",
 			tbf_name(dl_tbf));
+
+		/* Reset N3101 counter: */
+		dl_tbf->m_n3101 = 0;
 	} else {
 		struct gprs_rlcmac_ul_tbf *ul_tbf;
 		int8_t tfi = request->ID.u.Global_TFI.u.UPLINK_TFI;
@@ -1433,6 +1446,9 @@
 		LOGP(DRLCMAC, LOGL_ERROR,
 			"RX: [PCU <- BTS] %s FIXME: Packet resource request\n",
 			tbf_name(ul_tbf));
+
+		/* Reset N3101 counter: */
+		ul_tbf->m_n3101 = 0;
 	}
 }
 
@@ -1585,6 +1601,9 @@
 		return 0;
 	}
 
+	/* Reset N3101 counter: */
+	tbf->m_n3101 = 0;
+
 	return tbf->rcv_data_block_acknowledged(&rlc_dec, data, meas);
 }
 
diff --git a/src/tbf.cpp b/src/tbf.cpp
index e7635f2..d1a686a 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -176,6 +176,7 @@
 	was_releasing(0),
 	upgrade_to_multislot(0),
 	bts(bts_),
+	m_n3101(0),
 	m_tfi(0),
 	m_created_ts(0),
 	m_ctrs(NULL),
@@ -740,6 +741,14 @@
 
 	poll_state = GPRS_RLCMAC_POLL_NONE;
 
+	m_n3101++;
+	if (m_n3101 == bts->bts_data()->n3101) {
+		LOGP(DRLCMAC, LOGL_NOTICE, " N3101 exceeded MAX (%u)\n", bts->bts_data()->n3101);
+		set_state(GPRS_RLCMAC_RELEASING);
+		start_t3169(bts->bts_data()->t3169, 0, "MAX N3101 reached", false);
+		return;
+	}
+
 	if (ul_tbf && ul_tbf->handle_ctrl_ack()) {
 		if (!ul_tbf->ctrl_ack_to_toggle()) {
 			LOGP(DRLCMAC, LOGL_NOTICE, "- Timeout for polling PACKET CONTROL ACK for PACKET UPLINK ACK\n");
diff --git a/src/tbf.h b/src/tbf.h
index 597a6d8..66c7c36 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -316,6 +316,8 @@
 	/* store the BTS this TBF belongs to */
 	BTS *bts;
 
+	uint8_t m_n3101; /* N3101 counter */
+
 	/*
 	 * private fields. We can't make it private as it is breaking the
 	 * llist macros.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2f79c6153dc4073c9d293b2824979e6381576682
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list