[PATCH] osmo-pcu[master]: Move gsmtap and accounting into separate function

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
Thu Aug 31 13:44:14 UTC 2017


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

Move gsmtap and accounting into separate function

Change-Id: I3609da1850244f25bd4611c9d25795ca379d6325
---
M src/gprs_rlcmac_sched.cpp
1 file changed, 31 insertions(+), 13 deletions(-)


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

diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp
index 42f0308..e059ae1 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -307,6 +307,34 @@
 	return msg;
 }
 
+static inline void tap_n_acc(const struct msgb *msg, const struct gprs_rlcmac_bts *bts, uint8_t trx, uint8_t ts,
+			     uint32_t fn, enum pcu_gsmtap_category cat)
+{
+	if (!msg)
+		return;
+
+	switch(cat) {
+	case PCU_GSMTAP_C_DL_CTRL:
+		bts->bts->rlc_sent_control();
+		bts->bts->send_gsmtap(PCU_GSMTAP_C_DL_CTRL, false, trx, ts, GSMTAP_CHANNEL_PACCH, fn, msg->data,
+				      msg->len);
+		break;
+	case PCU_GSMTAP_C_DL_DATA_GPRS:
+		bts->bts->rlc_sent();
+		/* FIXME: distinguish between GPRS and EGPRS */
+		bts->bts->send_gsmtap(PCU_GSMTAP_C_DL_DATA_GPRS, false, trx, ts, GSMTAP_CHANNEL_PDTCH, fn, msg->data,
+				      msg->len);
+		break;
+	case PCU_GSMTAP_C_DL_DUMMY:
+		bts->bts->rlc_sent_dummy();
+		bts->bts->send_gsmtap(PCU_GSMTAP_C_DL_DUMMY, false, trx, ts, GSMTAP_CHANNEL_PACCH, fn, msg->data,
+				      msg->len);
+		break;
+	default:
+		break;
+	}
+}
+
 int gprs_rlcmac_rcv_rts_block(struct gprs_rlcmac_bts *bts,
 	uint8_t trx, uint8_t ts,
         uint32_t fn, uint8_t block_nr)
@@ -356,29 +384,19 @@
 	/* Prio 1: select control message */
 	msg = sched_select_ctrl_msg(trx, ts, fn, block_nr, pdch, ul_ass_tbf,
 		dl_ass_tbf, ul_ack_tbf);
-	if (msg) {
-		bts->bts->rlc_sent_control();
-		bts->bts->send_gsmtap(PCU_GSMTAP_C_DL_CTRL, false, trx, ts, GSMTAP_CHANNEL_PACCH, fn, msg->data, msg->len);
-	}
+	tap_n_acc(msg, bts, trx, ts, fn, PCU_GSMTAP_C_DL_CTRL);
 
 	/* Prio 2: select data message for downlink */
 	if (!msg) {
 		msg = sched_select_downlink(bts, trx, ts, fn, block_nr, pdch);
-		if (msg) {
-			bts->bts->rlc_sent();
-			/* FIXME: distinguish between GPRS and EGPRS */
-			bts->bts->send_gsmtap(PCU_GSMTAP_C_DL_DATA_GPRS, false, trx, ts, GSMTAP_CHANNEL_PDTCH, fn, msg->data, msg->len);
-		}
+		tap_n_acc(msg, bts, trx, ts, fn, PCU_GSMTAP_C_DL_DATA_GPRS);
 	}
 
 	/* Prio 3: send dummy contol message */
 	if (!msg) {
 		/* increase counter */
 		msg = sched_dummy();
-		if (msg) {
-			bts->bts->rlc_sent_dummy();
-			bts->bts->send_gsmtap(PCU_GSMTAP_C_DL_DUMMY, false, trx, ts, GSMTAP_CHANNEL_PACCH, fn, msg->data, msg->len);
-		}
+		tap_n_acc(msg, bts, trx, ts, fn, PCU_GSMTAP_C_DL_DUMMY);
 	}
 
 	if (!msg)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3609da1850244f25bd4611c9d25795ca379d6325
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