fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/32303 )
Change subject: trxcon/l1sched: add l1sched_find_lchan_by_chan_nr() ......................................................................
trxcon/l1sched: add l1sched_find_lchan_by_chan_nr()
Change-Id: I9917a932c9a4aeb4b3ef7053bd58066b3aa41edb Related: OS#5500 --- M src/host/trxcon/include/osmocom/bb/l1sched/l1sched.h M src/host/trxcon/src/sched_trx.c 2 files changed, 34 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/03/32303/1
diff --git a/src/host/trxcon/include/osmocom/bb/l1sched/l1sched.h b/src/host/trxcon/include/osmocom/bb/l1sched/l1sched.h index 7f7e96d..4728f41 100644 --- a/src/host/trxcon/include/osmocom/bb/l1sched/l1sched.h +++ b/src/host/trxcon/include/osmocom/bb/l1sched/l1sched.h @@ -438,6 +438,8 @@ int l1sched_deactivate_lchan(struct l1sched_ts *ts, enum l1sched_lchan_type chan); struct l1sched_lchan_state *l1sched_find_lchan_by_type(struct l1sched_ts *ts, enum l1sched_lchan_type type); +struct l1sched_lchan_state *l1sched_find_lchan_by_chan_nr(struct l1sched_state *sched, + uint8_t chan_nr, uint8_t link_id);
/* Primitive management functions */ struct l1sched_ts_prim *l1sched_prim_push(struct l1sched_state *sched, diff --git a/src/host/trxcon/src/sched_trx.c b/src/host/trxcon/src/sched_trx.c index 49dadd2..c337661 100644 --- a/src/host/trxcon/src/sched_trx.c +++ b/src/host/trxcon/src/sched_trx.c @@ -425,6 +425,28 @@ return NULL; }
+struct l1sched_lchan_state *l1sched_find_lchan_by_chan_nr(struct l1sched_state *sched, + uint8_t chan_nr, uint8_t link_id) +{ + const struct l1sched_ts *ts = sched->ts[chan_nr & 0x07]; + const struct l1sched_lchan_desc *lchan_desc; + struct l1sched_lchan_state *lchan; + + if (ts == NULL) + return NULL; + + llist_for_each_entry(lchan, &ts->lchans, list) { + lchan_desc = &l1sched_lchan_desc[lchan->type]; + if (lchan_desc->chan_nr != (chan_nr & 0xf8)) + continue; + if (lchan_desc->link_id != link_id) + continue; + return lchan; + } + + return NULL; +} + int l1sched_set_lchans(struct l1sched_ts *ts, uint8_t chan_nr, int active, uint8_t tch_mode, uint8_t tsc) {