Change in osmo-pcu[master]: Get rid of tbf_dl:abort()

pespin gerrit-no-reply at lists.osmocom.org
Mon Jul 26 16:50:09 UTC 2021


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


Change subject: Get rid of tbf_dl:abort()
......................................................................

Get rid of tbf_dl:abort()

Having that code in a seaprate function is confusing and adds code
complexity since it looks like an entry point to start feeing a TBF, but
it simply some (not yet really useful) set of instructions to be called
one 1 code path in tbf_free.
Let's move it there, this way it becomes clear tbf_free() is THE place
to be (if you want to get rid of a TBF).

Change-Id: I30febf4d21a0bfab37524c07598bbb0dd32f7f65
---
M src/tbf.cpp
M src/tbf_dl.cpp
M src/tbf_dl.h
3 files changed, 15 insertions(+), 29 deletions(-)



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

diff --git a/src/tbf.cpp b/src/tbf.cpp
index f022b0c..8c3bd35 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -275,10 +275,23 @@
 			bts_do_rate_ctr_inc(tbf->bts, CTR_TBF_UL_ABORTED);
 	} else {
 		gprs_rlcmac_dl_tbf *dl_tbf = as_dl_tbf(tbf);
+		gprs_rlc_dl_window *win = static_cast<gprs_rlc_dl_window *>(dl_tbf->window());
+
 		bts_do_rate_ctr_inc(tbf->bts, CTR_TBF_DL_FREED);
-		if (tbf->state_is(TBF_ST_FLOW))
+		if (tbf->state_is(TBF_ST_FLOW)) {
 			bts_do_rate_ctr_inc(tbf->bts, CTR_TBF_DL_ABORTED);
-		dl_tbf->abort();
+			/* range V(A)..V(S)-1 */
+			uint16_t  lost = win->count_unacked();
+			/* report all outstanding packets as lost */
+			gprs_rlcmac_received_lost(dl_tbf, 0, lost);
+			/* TODO: Reschedule all LLC frames starting with the one that is
+			 * (partly) encoded in chunk 1 of block V(A). (optional) */
+		}
+		/* This state change looks unneeded and can probably be dropped at some point: */
+		tbf_fsm_state_chg(dl_tbf->state_fsm.fi, TBF_ST_RELEASING);
+		/* reset rlc states */
+		win->reset();
+		osmo_fsm_inst_dispatch(dl_tbf->state_fsm.fi, TBF_EV_ASSIGN_DEL_CCCH, NULL);
 	}
 
 	LOGPTBF(tbf, LOGL_INFO, "free\n");
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 2850fff..425bd63 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -1261,32 +1261,6 @@
 	return 0;
 }
 
-int gprs_rlcmac_dl_tbf::abort()
-{
-	uint16_t lost;
-
-	if (state_is(TBF_ST_FLOW)) {
-		/* range V(A)..V(S)-1 */
-		lost = m_window.count_unacked();
-
-		/* report all outstanding packets as lost */
-		gprs_rlcmac_received_lost(this, 0, lost);
-
-		/* TODO: Reschedule all LLC frames starting with the one that is
-		 * (partly) encoded in chunk 1 of block V(A). (optional) */
-	}
-
-	/* This state change looks unneeded and can probably be dropped at some point: */
-	tbf_fsm_state_chg(this->state_fsm.fi, TBF_ST_RELEASING);
-
-	/* reset rlc states */
-	m_window.reset();
-
-	osmo_fsm_inst_dispatch(this->state_fsm.fi, TBF_EV_ASSIGN_DEL_CCCH, NULL);
-
-	return 0;
-}
-
 int gprs_rlcmac_dl_tbf::rcvd_dl_ack(bool final_ack, unsigned first_bsn,
 	struct bitvec *rbb)
 {
diff --git a/src/tbf_dl.h b/src/tbf_dl.h
index 6fddeb5..b8fecde 100644
--- a/src/tbf_dl.h
+++ b/src/tbf_dl.h
@@ -61,7 +61,6 @@
 	int frames_since_last_drain(unsigned fn) const;
 	bool keep_open(unsigned fn) const;
 	int release();
-	int abort();
 	uint16_t window_size() const;
 	void set_window_size();
 	void update_coding_scheme_counter_dl(enum CodingScheme cs);

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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I30febf4d21a0bfab37524c07598bbb0dd32f7f65
Gerrit-Change-Number: 25054
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/20210726/4216379d/attachment.htm>


More information about the gerrit-log mailing list