[PATCH] osmocom-bb[master]: host/trxcon/scheduler: implement TX queue handling

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Feb 22 15:32:48 UTC 2018


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

host/trxcon/scheduler: implement TX queue handling

Change-Id: I2b7bae53901156524134c4904ea1179268d85601
---
M src/host/trxcon/sched_trx.c
M src/host/trxcon/sched_trx.h
2 files changed, 43 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/14/6714/1

diff --git a/src/host/trxcon/sched_trx.c b/src/host/trxcon/sched_trx.c
index 32e6a59..3c5e265 100644
--- a/src/host/trxcon/sched_trx.c
+++ b/src/host/trxcon/sched_trx.c
@@ -48,12 +48,44 @@
 static void sched_frame_clck_cb(struct trx_sched *sched)
 {
 	struct trx_instance *trx = (struct trx_instance *) sched->data;
+	const struct trx_frame *frame;
+	trx_lchan_tx_func *handler;
+	struct trx_ts_prim *prim;
+	enum trx_lchan_type chan;
+	uint8_t offset, bid;
+	struct trx_ts *ts;
+	uint32_t fn;
 
 	/* If we have no active timeslots, nothing to do */
 	if (llist_empty(&trx->ts_list))
 		return;
 
-	/* Do nothing for now */
+	/* For each allocated timeslot */
+	llist_for_each_entry(ts, &trx->ts_list, list) {
+		if (llist_empty(&ts->tx_prims))
+			continue;
+
+		/* Get frame from multiframe */
+		fn = sched->fn_counter_proc;
+		offset = fn % ts->mf_layout->period;
+		frame = ts->mf_layout->frames + offset;
+
+		/* Get required info from frame */
+		bid = frame->ul_bid;
+		chan = frame->ul_chan;
+		handler = trx_lchan_desc[chan].tx_fn;
+
+		/* Omit lchans without handler */
+		if (!handler)
+			continue;
+
+		/* Get a message from TX queue */
+		prim = llist_entry(ts->tx_prims.next, struct trx_ts_prim, list);
+
+		/* Poke lchan handler */
+		if (prim->chan == chan)
+			handler(trx, ts, fn, chan, bid, NULL);
+	}
 }
 
 int sched_trx_init(struct trx_instance *trx)
diff --git a/src/host/trxcon/sched_trx.h b/src/host/trxcon/sched_trx.h
index 41662e0..809a324 100644
--- a/src/host/trxcon/sched_trx.h
+++ b/src/host/trxcon/sched_trx.h
@@ -230,6 +230,16 @@
 	struct llist_head list;
 };
 
+/* Represents one TX primitive in the queue of trx_ts */
+struct trx_ts_prim {
+	/*! \brief Link to queue of TS */
+	struct llist_head list;
+	/*! \brief Logical channel type */
+	enum trx_lchan_type chan;
+	/*! \brief Payload */
+	uint8_t payload[0];
+};
+
 extern const struct trx_lchan_desc trx_lchan_desc[_TRX_CHAN_MAX];
 const struct trx_multiframe *sched_mframe_layout(
 	enum gsm_phys_chan_config config, int ts_num);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2b7bae53901156524134c4904ea1179268d85601
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list