Change in osmo-bts[master]: scheduler: remove pending Tx prims on lchan deactivation

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

laforge gerrit-no-reply at lists.osmocom.org
Mon Oct 19 15:04:24 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/20700 )

Change subject: scheduler: remove pending Tx prims on lchan deactivation
......................................................................

scheduler: remove pending Tx prims on lchan deactivation

Sometimes the following messages appear in the logging output:

  TCH/F: Prim has wrong chan_nr=0xc5 link_id=00, expecting chan_nr=0x0d link_id=00
  TCH/F: Prim has wrong chan_nr=0xc2 link_id=00, expecting chan_nr=0x0a link_id=00

when a dynamic timeslot is switched from PDCH to TCH/F (or to TCH/H).

This means that the transmit queue of a timeslot still contains
PDCH frames, that were not properly cleaned on PDCH deactivation.

Let's finally do this in trx_sched_set_lchan().

Change-Id: Ic6560c660c658f36b84e7efa2f1d93e3a870962b
Related: SYS#5108, OS#4804
---
M src/common/scheduler.c
1 file changed, 34 insertions(+), 0 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index 5bf1c5b..b61330d 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -968,6 +968,37 @@
 	return 0;
 }
 
+/* Remove all matching (by chan_nr & link_id) primitives from the given queue */
+static void trx_sched_queue_filter(struct llist_head *q, uint8_t chan_nr, uint8_t link_id)
+{
+	struct msgb *msg, *_msg;
+
+	llist_for_each_entry_safe(msg, _msg, q, list) {
+		struct osmo_phsap_prim *l1sap = msgb_l1sap_prim(msg);
+		switch (l1sap->oph.primitive) {
+		case PRIM_PH_DATA:
+			if (l1sap->u.data.chan_nr != chan_nr)
+				continue;
+			if (l1sap->u.data.link_id != link_id)
+				continue;
+			break;
+		case PRIM_TCH:
+			if (l1sap->u.tch.chan_nr != chan_nr)
+				continue;
+			if (link_id != 0x00)
+				continue;
+			break;
+		default:
+			/* Shall not happen */
+			OSMO_ASSERT(0);
+		}
+
+		/* Unlink and free() */
+		llist_del(&msg->list);
+		talloc_free(msg);
+	}
+}
+
 /* setting all logical channels given attributes to active/inactive */
 int trx_sched_set_lchan(struct l1sched_trx *l1t, uint8_t chan_nr, uint8_t link_id, bool active)
 {
@@ -1011,6 +1042,9 @@
 			OSMO_ASSERT(chan_state->lchan != NULL);
 		} else {
 			chan_state->ho_rach_detect = 0;
+
+			/* Remove pending Tx prims belonging to this lchan */
+			trx_sched_queue_filter(&l1ts->dl_prims, chan_nr, link_id);
 		}
 
 		chan_state->active = active;

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ic6560c660c658f36b84e7efa2f1d93e3a870962b
Gerrit-Change-Number: 20700
Gerrit-PatchSet: 4
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201019/c90f9a6d/attachment.htm>


More information about the gerrit-log mailing list