[PATCH 3/8] tbf: Move code that sets the tbf's ms_class to a central place

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/osmocom-net-gprs@lists.osmocom.org/.

Holger Freyther hfreyther at sysmocom.de
Wed Oct 16 14:23:43 UTC 2013


From: Holger Hans Peter Freyther <holger at moiji-mobile.com>

---
 src/tbf.cpp | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/tbf.cpp b/src/tbf.cpp
index d242b52..5161e92 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -29,6 +29,13 @@ extern "C" {
 #include <errno.h>
 #include <string.h>
 
+static inline void tbf_update_ms_class(struct gprs_rlcmac_tbf *tbf,
+					const uint8_t ms_class)
+{
+	if (!tbf->ms_class && ms_class)
+		tbf->ms_class = ms_class;
+}
+
 static struct gprs_rlcmac_tbf *tbf_lookup_dl(const uint32_t tlli, const char *imsi)
 {
 	/* TODO: look up by IMSI first, then tlli, then old_tlli */
@@ -52,8 +59,7 @@ static int tbf_append_data(struct gprs_rlcmac_tbf *tbf,
 		/* keep to flags */
 		tbf->state_flags &= GPRS_RLCMAC_FLAG_TO_MASK;
 		tbf->state_flags &= ~(1 << GPRS_RLCMAC_FLAG_CCCH);
-		if (!tbf->ms_class && ms_class)
-			tbf->ms_class = ms_class;
+		tbf_update_ms_class(tbf, ms_class);
 		tbf_update(tbf);
 		gprs_rlcmac_trigger_downlink_assignment(tbf, tbf, NULL);
 	} else {
@@ -84,9 +90,7 @@ static int tbf_append_data(struct gprs_rlcmac_tbf *tbf,
 		}
 		memcpy(msgb_put(llc_msg, len), data, len);
 		msgb_enqueue(&tbf->llc_queue, llc_msg);
-		/* set ms class for updating TBF */
-		if (!tbf->ms_class && ms_class)
-			tbf->ms_class = ms_class;
+		tbf_update_ms_class(tbf, ms_class);
 	}
 
 	return 0;
-- 
1.8.4.rc3





More information about the osmocom-net-gprs mailing list