fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/18833 )


Change subject: osmo-bts-trx: store pointer to gsm_lchan in l1sched_chan_state
......................................................................

osmo-bts-trx: store pointer to gsm_lchan in l1sched_chan_state

This change simplifies access to generic logical channel state
(struct gsm_lchan) from osmo-bts-trx specific state (struct
l1sched_chan_state), so there is no need to look it up using
get_lchan_by_chan_nr() on receipt of each Uplink burst.

Change-Id: Ic4378020f980845b962f71b9e4b7faea738bc174
---
M include/osmo-bts/scheduler.h
M src/common/scheduler.c
M src/osmo-bts-trx/sched_lchan_tchf.c
M src/osmo-bts-trx/sched_lchan_tchh.c
4 files changed, 12 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/33/18833/1

diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h
index a7bc6c7..f5f346e 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -71,6 +71,11 @@

 /* States each channel on a multiframe */
 struct l1sched_chan_state {
+       /* Pointer to the associated logical channel state from gsm_data_shared.
+        * Initialized during channel activation, thus may be NULL for inactive
+        * or auto-active channels. Always check before dereferencing! */
+       struct gsm_lchan        *lchan;
+
        /* scheduler */
        bool                    active;         /* Channel is active */
        ubit_t                  *dl_bursts;     /* burst buffer for TX */
diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index ed6c623..b79c83d 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -1000,6 +1000,11 @@
                        else
                                chan_state->ho_rach_detect = 0;
                        chan_state->active = active;
+
+                       if (active) {
+                               chan_state->lchan = 
get_lchan_by_chan_nr(l1t->trx, chan_nr);
+                               OSMO_ASSERT(chan_state->lchan != NULL);
+                       }
                }
        }

diff --git a/src/osmo-bts-trx/sched_lchan_tchf.c 
b/src/osmo-bts-trx/sched_lchan_tchf.c
index 80115a9..d289620 100644
--- a/src/osmo-bts-trx/sched_lchan_tchf.c
+++ b/src/osmo-bts-trx/sched_lchan_tchf.c
@@ -50,6 +50,7 @@
 {
        struct l1sched_ts *l1ts = l1sched_trx_get_ts(l1t, bi->tn);
        struct l1sched_chan_state *chan_state = &l1ts->chan_state[chan];
+       struct gsm_lchan *lchan = chan_state->lchan;
        sbit_t *burst, **bursts_p = &chan_state->ul_bursts;
        uint8_t *mask = &chan_state->ul_mask;
        uint8_t rsl_cmode = chan_state->rsl_cmode;
@@ -59,8 +60,6 @@
        int n_errors = 0;
        int n_bits_total = 0;
        bool bfi_flag = false;
-       struct gsm_lchan *lchan =
-               get_lchan_by_chan_nr(l1t->trx, trx_chan_desc[chan].chan_nr | 
bi->tn);
        unsigned int fn_begin;
        uint16_t ber10k;
        uint8_t is_sub = 0;
diff --git a/src/osmo-bts-trx/sched_lchan_tchh.c 
b/src/osmo-bts-trx/sched_lchan_tchh.c
index 8adaec3..0281342 100644
--- a/src/osmo-bts-trx/sched_lchan_tchh.c
+++ b/src/osmo-bts-trx/sched_lchan_tchh.c
@@ -50,6 +50,7 @@
 {
        struct l1sched_ts *l1ts = l1sched_trx_get_ts(l1t, bi->tn);
        struct l1sched_chan_state *chan_state = &l1ts->chan_state[chan];
+       struct gsm_lchan *lchan = chan_state->lchan;
        sbit_t *burst, **bursts_p = &chan_state->ul_bursts;
        uint8_t *mask = &chan_state->ul_mask;
        uint8_t rsl_cmode = chan_state->rsl_cmode;
@@ -59,8 +60,6 @@
        int n_errors = 0;
        int n_bits_total = 0;
        bool bfi_flag = false;
-       struct gsm_lchan *lchan =
-               get_lchan_by_chan_nr(l1t->trx, trx_chan_desc[chan].chan_nr | 
bi->tn);
        /* Note on FN-10: If we are at FN 10, we decoded an even aligned
         * TCH/FACCH frame, because our burst buffer carries 6 bursts.
         * Even FN ending at: 10,11,19,20,2,3

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ic4378020f980845b962f71b9e4b7faea738bc174
Gerrit-Change-Number: 18833
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanits...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to