2020-06-05 17:56:29 +00:00
|
|
|
/*
|
|
|
|
* (C) 2013 by Andreas Eversberg <jolly@eversberg.eu>
|
|
|
|
* (C) 2015-2017 by Harald Welte <laforge@gnumonks.org>
|
[VAMOS] osmo-bts-trx: move {chan,bid} to trx_{dl,ul}_burst_{req,ind}
Historically the logical channel handlers like rx_data_fn() used to accept
quite a lot of arguments. With the introduction of additional measurement
parameters it has become clear that we need to group the arguments into
structures. This is why both 'trx_{dl,ul}_burst_{req,ind}' structures
were introduced.
However, both channel type and burst ID were kept untouched, so until
now we had them being passed between the scheduler functions here and
there. This change is a logical conclusion of the original change
mentioned above.
As a part of this change, the new LOGL1SB() macro is introduced. It
does accept a pointer to 'trx_{dl,ul}_burst_{req,ind}' and expands the
context information for the old LOGL1S() macro.
Change-Id: Ic5a02b074662b3e429bf18e05a982f3f3e7b7444
2021-05-07 14:20:58 +00:00
|
|
|
* Contributions by sysmocom - s.f.m.c. GmbH
|
2020-06-05 17:56:29 +00:00
|
|
|
*
|
|
|
|
* All Rights Reserved
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
#include <osmocom/core/bits.h>
|
|
|
|
#include <osmocom/core/msgb.h>
|
|
|
|
#include <osmocom/core/utils.h>
|
|
|
|
|
|
|
|
#include <osmocom/gsm/gsm0502.h>
|
|
|
|
|
|
|
|
#include <osmocom/codec/codec.h>
|
|
|
|
#include <osmocom/codec/ecu.h>
|
|
|
|
|
|
|
|
#include <osmocom/coding/gsm0503_coding.h>
|
|
|
|
#include <osmocom/coding/gsm0503_amr_dtx.h>
|
|
|
|
|
|
|
|
#include <osmo-bts/bts.h>
|
|
|
|
#include <osmo-bts/l1sap.h>
|
|
|
|
#include <osmo-bts/logging.h>
|
|
|
|
#include <osmo-bts/scheduler.h>
|
|
|
|
#include <osmo-bts/scheduler_backend.h>
|
|
|
|
#include <osmo-bts/msg_utils.h>
|
|
|
|
|
|
|
|
#include <sched_utils.h>
|
2022-04-11 16:59:58 +00:00
|
|
|
#include <amr_loop.h>
|
2020-06-05 17:56:29 +00:00
|
|
|
|
2022-04-08 15:54:09 +00:00
|
|
|
/* 3GPP TS 45.009, table 3.2.1.3-{2,4}: AMR on Uplink TCH/H.
|
|
|
|
*
|
|
|
|
* +---+---+---+---+---+---+
|
|
|
|
* | a | b | c | d | e | f | Burst 'a' received first
|
|
|
|
* +---+---+---+---+---+---+
|
|
|
|
* ^^^^^^^^^^^^^^^^^^^^^^^ FACCH frame (bursts 'a' .. 'f')
|
|
|
|
* ^^^^^^^^^^^^^^^ Speech frame (bursts 'a' .. 'd')
|
|
|
|
*
|
|
|
|
* TDMA frame number of burst 'f' is always used as the table index. */
|
2022-04-08 15:35:52 +00:00
|
|
|
static const uint8_t sched_tchh_ul_amr_cmi_map[26] = {
|
2022-04-08 15:54:09 +00:00
|
|
|
[10] = 1, /* TCH/H(0): a=0 / d=6 / f=10 */
|
|
|
|
[19] = 1, /* TCH/H(0): a=8 / d=15 / f=19 */
|
|
|
|
[2] = 1, /* TCH/H(0): a=17 / d=23 / f=2 */
|
2022-04-08 15:35:52 +00:00
|
|
|
|
2022-04-08 15:54:09 +00:00
|
|
|
[11] = 1, /* TCH/H(1): a=1 / d=7 / f=11 */
|
|
|
|
[20] = 1, /* TCH/H(1): a=9 / d=16 / f=20 */
|
|
|
|
[3] = 1, /* TCH/H(1): a=18 / d=24 / f=3 */
|
2022-04-08 15:35:52 +00:00
|
|
|
};
|
|
|
|
|
2022-04-10 16:02:40 +00:00
|
|
|
/* 3GPP TS 45.002, table 1 in clause 7: Mapping tables.
|
|
|
|
* TDMA frame number of burst 'f' is always used as the table index. */
|
|
|
|
static const uint8_t sched_tchh_ul_facch_map[26] = {
|
|
|
|
[10] = 1, /* FACCH/H(0): B0(0,2,4,6,8,10) */
|
|
|
|
[11] = 1, /* FACCH/H(1): B0(1,3,5,7,9,11) */
|
|
|
|
[19] = 1, /* FACCH/H(0): B1(8,10,13,15,17,19) */
|
|
|
|
[20] = 1, /* FACCH/H(1): B1(9,11,14,16,18,20) */
|
|
|
|
[2] = 1, /* FACCH/H(0): B2(17,19,21,23,0,2) */
|
|
|
|
[3] = 1, /* FACCH/H(1): B2(18,20,22,24,1,3) */
|
|
|
|
};
|
|
|
|
|
2020-06-05 17:56:29 +00:00
|
|
|
/*! \brief a single TCH/H burst was received by the PHY, process it */
|
[VAMOS] Re-organize osmo-bts-trx specific structures
Together with the 'generic' structures which used to be shared between
osmo-bsc and osmo-bts some time ago, we also have the following
osmo-bts-trx specific structures (in hierarchical order):
- struct l1sched_trx (struct gsm_bts_trx),
- struct l1sched_ts (struct gsm_bts_trx_ts),
- struct l1sched_chan_state (struct gsm_lchan).
These structures are not integrated into the tree of the generic
structures, but maintained in a _separate tree_ instead. Until
recently, only the 'l1sched_trx' had a pointer to generic
'gsm_bts_trx', so in order to find the corresponding 'gsm_lchan' for
'l1sched_chan_state' one would need to traverse all the way up to
'l1sched_trx' and then tracerse another three backwards.
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ l1sched_trx --------------------> gsm_bts_trx (0..255)
| |
--+ l1sched_trx_ts --+ gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
I find this architecture a bit over-complicated, especially given
that 'l1sched_trx' is kind of a dummy node containing nothing else
than a pointer to 'gsm_bts_trx' and the list of 'l1sched_trx_ts'.
In this path I slightly change the architecture as follows:
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ gsm_bts_trx (0..255)
|
--+ l1sched_trx_ts <----------------> gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
Note that unfortunately we cannot 1:1 map 'l1sched_chan_state' to
'gsm_lchan' (like we do for 'l1sched_trx_ts' and 'gsm_bts_trx_ts')
because there is no direct mapping. The former is a higl-level
representation of a logical channel, while the later represents
one specific logical channel type like FCCH, SDCCH/0 or SACCH/0.
osmo-bts-virtual re-uses the osmo-bts-trx hierarchy, so it's also
affected by this change.
Change-Id: I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-05-07 13:47:57 +00:00
|
|
|
int rx_tchh_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi)
|
2020-06-05 17:56:29 +00:00
|
|
|
{
|
[VAMOS] osmo-bts-trx: move {chan,bid} to trx_{dl,ul}_burst_{req,ind}
Historically the logical channel handlers like rx_data_fn() used to accept
quite a lot of arguments. With the introduction of additional measurement
parameters it has become clear that we need to group the arguments into
structures. This is why both 'trx_{dl,ul}_burst_{req,ind}' structures
were introduced.
However, both channel type and burst ID were kept untouched, so until
now we had them being passed between the scheduler functions here and
there. This change is a logical conclusion of the original change
mentioned above.
As a part of this change, the new LOGL1SB() macro is introduced. It
does accept a pointer to 'trx_{dl,ul}_burst_{req,ind}' and expands the
context information for the old LOGL1S() macro.
Change-Id: Ic5a02b074662b3e429bf18e05a982f3f3e7b7444
2021-05-07 14:20:58 +00:00
|
|
|
struct l1sched_chan_state *chan_state = &l1ts->chan_state[bi->chan];
|
2020-06-15 13:19:08 +00:00
|
|
|
struct gsm_lchan *lchan = chan_state->lchan;
|
2020-06-05 17:56:29 +00:00
|
|
|
sbit_t *burst, **bursts_p = &chan_state->ul_bursts;
|
|
|
|
uint8_t *mask = &chan_state->ul_mask;
|
|
|
|
uint8_t rsl_cmode = chan_state->rsl_cmode;
|
|
|
|
uint8_t tch_mode = chan_state->tch_mode;
|
|
|
|
uint8_t tch_data[128]; /* just to be safe */
|
2022-04-20 14:09:29 +00:00
|
|
|
int rc = 0; /* initialize to make gcc happy */
|
|
|
|
int amr = 0;
|
2020-06-05 17:56:29 +00:00
|
|
|
int n_errors = 0;
|
|
|
|
int n_bits_total = 0;
|
|
|
|
bool bfi_flag = false;
|
osmo-bts-trx: rx_tchh_fn(): use proper meas averaging mode
Compared to TCH/F, TCH/H is a bit special in a way that:
* speech frames are interleaved over 4 consecutive bursts,
* while FACCH frames are interleaved over 6 consecutive bursts.
This is why in rx_tchh_fn() we allocate a buffer large enough to
store up to 6 bursts. Let's say we have that buffer filled up
completely with all 6 bursts (from 'a' to 'f'). Now attempting
to decode them may yield either a speech frame or a FACCH frame:
+---+---+---+---+---+---+
| a | b | c | d | e | f | Burst 'a' received first, 'f' last
+---+---+---+---+---+---+
^^^^^^^^^^^^^^^ Speech frame (bursts 'a' .. 'd')
^^^^^^^^^^^^^^^^^^^^^^^ FACCH frame (bursts 'a' .. 'f')
For FACCH we use measurement averaging mode SCHED_MEAS_AVG_M_S6N6,
so that 6 last samples are averaged - so far so good. For speech
we use SCHED_MEAS_AVG_M_S4N4, so that 4 last samples corresponding
to bursts 'c', 'd', 'e', 'f' are averaged - this is wrong.
We actually need to average the *first* 4 samples corresponding to
bursts 'a', 'b', 'c', 'd' in the case of speech. Let's add and use
a new averaging mode SCHED_MEAS_AVG_M_S6N4 for that.
Change-Id: Iea6f4e5471550f4c2b57aaebeac83c80e879489d
2022-03-17 15:46:46 +00:00
|
|
|
enum sched_meas_avg_mode meas_avg_mode = SCHED_MEAS_AVG_M_S6N4;
|
2020-06-22 22:44:48 +00:00
|
|
|
struct l1sched_meas_set meas_avg;
|
2020-06-05 17:56:29 +00:00
|
|
|
unsigned int fn_begin;
|
2022-03-18 00:57:01 +00:00
|
|
|
uint16_t ber10k = 0;
|
2020-06-05 17:56:29 +00:00
|
|
|
uint8_t is_sub = 0;
|
|
|
|
uint8_t ft;
|
2021-08-26 11:55:27 +00:00
|
|
|
bool fn_is_cmi;
|
2020-06-05 17:56:29 +00:00
|
|
|
|
|
|
|
/* If handover RACH detection is turned on, treat this burst as an Access Burst.
|
|
|
|
* Handle NOPE.ind as usually to ensure proper Uplink measurement reporting. */
|
|
|
|
if (chan_state->ho_rach_detect == 1 && ~bi->flags & TRX_BI_F_NOPE_IND)
|
[VAMOS] Re-organize osmo-bts-trx specific structures
Together with the 'generic' structures which used to be shared between
osmo-bsc and osmo-bts some time ago, we also have the following
osmo-bts-trx specific structures (in hierarchical order):
- struct l1sched_trx (struct gsm_bts_trx),
- struct l1sched_ts (struct gsm_bts_trx_ts),
- struct l1sched_chan_state (struct gsm_lchan).
These structures are not integrated into the tree of the generic
structures, but maintained in a _separate tree_ instead. Until
recently, only the 'l1sched_trx' had a pointer to generic
'gsm_bts_trx', so in order to find the corresponding 'gsm_lchan' for
'l1sched_chan_state' one would need to traverse all the way up to
'l1sched_trx' and then tracerse another three backwards.
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ l1sched_trx --------------------> gsm_bts_trx (0..255)
| |
--+ l1sched_trx_ts --+ gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
I find this architecture a bit over-complicated, especially given
that 'l1sched_trx' is kind of a dummy node containing nothing else
than a pointer to 'gsm_bts_trx' and the list of 'l1sched_trx_ts'.
In this path I slightly change the architecture as follows:
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ gsm_bts_trx (0..255)
|
--+ l1sched_trx_ts <----------------> gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
Note that unfortunately we cannot 1:1 map 'l1sched_chan_state' to
'gsm_lchan' (like we do for 'l1sched_trx_ts' and 'gsm_bts_trx_ts')
because there is no direct mapping. The former is a higl-level
representation of a logical channel, while the later represents
one specific logical channel type like FCCH, SDCCH/0 or SACCH/0.
osmo-bts-virtual re-uses the osmo-bts-trx hierarchy, so it's also
affected by this change.
Change-Id: I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-05-07 13:47:57 +00:00
|
|
|
return rx_rach_fn(l1ts, bi);
|
2020-06-05 17:56:29 +00:00
|
|
|
|
[VAMOS] Re-organize osmo-bts-trx specific structures
Together with the 'generic' structures which used to be shared between
osmo-bsc and osmo-bts some time ago, we also have the following
osmo-bts-trx specific structures (in hierarchical order):
- struct l1sched_trx (struct gsm_bts_trx),
- struct l1sched_ts (struct gsm_bts_trx_ts),
- struct l1sched_chan_state (struct gsm_lchan).
These structures are not integrated into the tree of the generic
structures, but maintained in a _separate tree_ instead. Until
recently, only the 'l1sched_trx' had a pointer to generic
'gsm_bts_trx', so in order to find the corresponding 'gsm_lchan' for
'l1sched_chan_state' one would need to traverse all the way up to
'l1sched_trx' and then tracerse another three backwards.
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ l1sched_trx --------------------> gsm_bts_trx (0..255)
| |
--+ l1sched_trx_ts --+ gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
I find this architecture a bit over-complicated, especially given
that 'l1sched_trx' is kind of a dummy node containing nothing else
than a pointer to 'gsm_bts_trx' and the list of 'l1sched_trx_ts'.
In this path I slightly change the architecture as follows:
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ gsm_bts_trx (0..255)
|
--+ l1sched_trx_ts <----------------> gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
Note that unfortunately we cannot 1:1 map 'l1sched_chan_state' to
'gsm_lchan' (like we do for 'l1sched_trx_ts' and 'gsm_bts_trx_ts')
because there is no direct mapping. The former is a higl-level
representation of a logical channel, while the later represents
one specific logical channel type like FCCH, SDCCH/0 or SACCH/0.
osmo-bts-virtual re-uses the osmo-bts-trx hierarchy, so it's also
affected by this change.
Change-Id: I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-05-07 13:47:57 +00:00
|
|
|
LOGL1SB(DL1P, LOGL_DEBUG, l1ts, bi, "Received TCH/H, bid=%u\n", bi->bid);
|
2020-06-05 17:56:29 +00:00
|
|
|
|
|
|
|
/* allocate burst memory, if not already */
|
|
|
|
if (!*bursts_p) {
|
2021-12-12 15:53:40 +00:00
|
|
|
*bursts_p = talloc_zero_size(l1ts, 696);
|
2020-06-05 17:56:29 +00:00
|
|
|
if (!*bursts_p)
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
2022-03-19 16:21:29 +00:00
|
|
|
/* shift the buffer by 2 bursts leftwards */
|
[VAMOS] osmo-bts-trx: move {chan,bid} to trx_{dl,ul}_burst_{req,ind}
Historically the logical channel handlers like rx_data_fn() used to accept
quite a lot of arguments. With the introduction of additional measurement
parameters it has become clear that we need to group the arguments into
structures. This is why both 'trx_{dl,ul}_burst_{req,ind}' structures
were introduced.
However, both channel type and burst ID were kept untouched, so until
now we had them being passed between the scheduler functions here and
there. This change is a logical conclusion of the original change
mentioned above.
As a part of this change, the new LOGL1SB() macro is introduced. It
does accept a pointer to 'trx_{dl,ul}_burst_{req,ind}' and expands the
context information for the old LOGL1S() macro.
Change-Id: Ic5a02b074662b3e429bf18e05a982f3f3e7b7444
2021-05-07 14:20:58 +00:00
|
|
|
if (bi->bid == 0) {
|
2022-03-19 16:21:29 +00:00
|
|
|
memcpy(*bursts_p, *bursts_p + 232, 232);
|
|
|
|
memcpy(*bursts_p + 232, *bursts_p + 464, 232);
|
2020-06-05 17:56:29 +00:00
|
|
|
memset(*bursts_p + 464, 0, 232);
|
2022-03-17 13:40:02 +00:00
|
|
|
*mask = *mask << 2;
|
2020-06-05 17:56:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* update mask */
|
[VAMOS] osmo-bts-trx: move {chan,bid} to trx_{dl,ul}_burst_{req,ind}
Historically the logical channel handlers like rx_data_fn() used to accept
quite a lot of arguments. With the introduction of additional measurement
parameters it has become clear that we need to group the arguments into
structures. This is why both 'trx_{dl,ul}_burst_{req,ind}' structures
were introduced.
However, both channel type and burst ID were kept untouched, so until
now we had them being passed between the scheduler functions here and
there. This change is a logical conclusion of the original change
mentioned above.
As a part of this change, the new LOGL1SB() macro is introduced. It
does accept a pointer to 'trx_{dl,ul}_burst_{req,ind}' and expands the
context information for the old LOGL1S() macro.
Change-Id: Ic5a02b074662b3e429bf18e05a982f3f3e7b7444
2021-05-07 14:20:58 +00:00
|
|
|
*mask |= (1 << bi->bid);
|
2020-06-05 17:56:29 +00:00
|
|
|
|
2020-06-22 22:44:48 +00:00
|
|
|
/* store measurements */
|
|
|
|
trx_sched_meas_push(chan_state, bi);
|
|
|
|
|
2020-06-05 17:56:29 +00:00
|
|
|
/* copy burst to end of buffer of 6 bursts */
|
[VAMOS] osmo-bts-trx: move {chan,bid} to trx_{dl,ul}_burst_{req,ind}
Historically the logical channel handlers like rx_data_fn() used to accept
quite a lot of arguments. With the introduction of additional measurement
parameters it has become clear that we need to group the arguments into
structures. This is why both 'trx_{dl,ul}_burst_{req,ind}' structures
were introduced.
However, both channel type and burst ID were kept untouched, so until
now we had them being passed between the scheduler functions here and
there. This change is a logical conclusion of the original change
mentioned above.
As a part of this change, the new LOGL1SB() macro is introduced. It
does accept a pointer to 'trx_{dl,ul}_burst_{req,ind}' and expands the
context information for the old LOGL1S() macro.
Change-Id: Ic5a02b074662b3e429bf18e05a982f3f3e7b7444
2021-05-07 14:20:58 +00:00
|
|
|
burst = *bursts_p + bi->bid * 116 + 464;
|
2020-06-05 17:56:29 +00:00
|
|
|
if (bi->burst_len > 0) {
|
|
|
|
memcpy(burst, bi->burst + 3, 58);
|
|
|
|
memcpy(burst + 58, bi->burst + 87, 58);
|
|
|
|
} else
|
|
|
|
memset(burst, 0, 116);
|
|
|
|
|
|
|
|
/* wait until complete set of bursts */
|
[VAMOS] osmo-bts-trx: move {chan,bid} to trx_{dl,ul}_burst_{req,ind}
Historically the logical channel handlers like rx_data_fn() used to accept
quite a lot of arguments. With the introduction of additional measurement
parameters it has become clear that we need to group the arguments into
structures. This is why both 'trx_{dl,ul}_burst_{req,ind}' structures
were introduced.
However, both channel type and burst ID were kept untouched, so until
now we had them being passed between the scheduler functions here and
there. This change is a logical conclusion of the original change
mentioned above.
As a part of this change, the new LOGL1SB() macro is introduced. It
does accept a pointer to 'trx_{dl,ul}_burst_{req,ind}' and expands the
context information for the old LOGL1S() macro.
Change-Id: Ic5a02b074662b3e429bf18e05a982f3f3e7b7444
2021-05-07 14:20:58 +00:00
|
|
|
if (bi->bid != 1)
|
2020-06-05 17:56:29 +00:00
|
|
|
return 0;
|
|
|
|
|
2022-03-17 13:40:02 +00:00
|
|
|
/* fill up the burst buffer so that we have 6 bursts in there */
|
|
|
|
if (OSMO_UNLIKELY((*mask & 0x3f) != 0x3f)) {
|
|
|
|
LOGL1SB(DL1P, LOGL_DEBUG, l1ts, bi,
|
|
|
|
"UL burst buffer is not filled up: mask=0x%02x != 0x3f\n",
|
|
|
|
*mask);
|
|
|
|
return 0; /* TODO: send BFI */
|
2020-06-05 17:56:29 +00:00
|
|
|
}
|
|
|
|
|
2020-10-30 09:44:55 +00:00
|
|
|
/* skip decoding of the last 4 bursts of FACCH/H */
|
2020-06-05 17:56:29 +00:00
|
|
|
if (chan_state->ul_ongoing_facch) {
|
|
|
|
chan_state->ul_ongoing_facch = 0;
|
2020-10-30 09:44:55 +00:00
|
|
|
/* we have already sent the first BFI when a FACCH/H frame
|
|
|
|
* was decoded (see below), now send the second one. */
|
2022-03-18 12:30:49 +00:00
|
|
|
trx_sched_meas_avg(chan_state, &meas_avg, meas_avg_mode);
|
2022-03-20 00:22:14 +00:00
|
|
|
/* meas_avg.fn now contains TDMA frame number of the first burst */
|
|
|
|
fn_begin = meas_avg.fn;
|
2020-06-05 17:56:29 +00:00
|
|
|
goto bfi;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* decode
|
|
|
|
* also shift buffer by 4 bursts for interleaving */
|
2022-04-07 10:59:45 +00:00
|
|
|
switch (tch_mode) {
|
|
|
|
case GSM48_CMODE_SIGN:
|
2022-04-07 17:04:12 +00:00
|
|
|
meas_avg_mode = SCHED_MEAS_AVG_M_S6N6;
|
|
|
|
/* fall-through */
|
2020-06-05 17:56:29 +00:00
|
|
|
case GSM48_CMODE_SPEECH_V1: /* HR or signalling */
|
|
|
|
rc = gsm0503_tch_hr_decode(tch_data, *bursts_p,
|
2022-04-10 16:02:40 +00:00
|
|
|
!sched_tchh_ul_facch_map[bi->fn % 26],
|
|
|
|
&n_errors, &n_bits_total);
|
2022-03-10 11:31:33 +00:00
|
|
|
if (rc == (GSM_HR_BYTES + 1)) { /* only for valid *speech* frames */
|
|
|
|
/* gsm0503_tch_hr_decode() prepends a ToC octet (see RFC5993), skip it */
|
2022-03-16 10:04:50 +00:00
|
|
|
bool is_sid = osmo_hr_check_sid(&tch_data[1], GSM_HR_BYTES);
|
|
|
|
if (is_sid) /* Mark SID frames as such: F = 0, FT = 010 */
|
|
|
|
tch_data[0] = (0x02 << 4);
|
|
|
|
lchan_set_marker(is_sid, lchan); /* DTXu */
|
2022-03-10 11:31:33 +00:00
|
|
|
}
|
2020-06-05 17:56:29 +00:00
|
|
|
break;
|
|
|
|
case GSM48_CMODE_SPEECH_AMR: /* AMR */
|
|
|
|
/* the first FN 0,8,17 or 1,9,18 defines that CMI is included
|
|
|
|
* in frame, the first FN 4,13,21 or 5,14,22 defines that CMR
|
|
|
|
* is included in frame.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* See comment in function rx_tchf_fn() */
|
|
|
|
switch (chan_state->amr_last_dtx) {
|
|
|
|
case AHS_ONSET:
|
|
|
|
case AHS_SID_FIRST_INH:
|
|
|
|
case AHS_SID_UPDATE_INH:
|
|
|
|
lchan_set_marker(false, lchan);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2022-03-17 14:51:35 +00:00
|
|
|
fn_is_cmi = sched_tchh_ul_amr_cmi_map[bi->fn % 26];
|
2021-08-26 11:55:27 +00:00
|
|
|
|
2020-06-05 17:56:29 +00:00
|
|
|
/* See comment in function rx_tchf_fn() */
|
|
|
|
amr = 2;
|
|
|
|
rc = gsm0503_tch_ahs_decode_dtx(tch_data + amr, *bursts_p,
|
2022-04-10 16:02:40 +00:00
|
|
|
!sched_tchh_ul_facch_map[bi->fn % 26],
|
|
|
|
!fn_is_cmi, chan_state->codec,
|
|
|
|
chan_state->codecs, &chan_state->ul_ft,
|
|
|
|
&chan_state->ul_cmr, &n_errors, &n_bits_total,
|
|
|
|
&chan_state->amr_last_dtx);
|
2020-06-05 17:56:29 +00:00
|
|
|
|
|
|
|
/* Tag all frames that are not regular AMR voice frames
|
|
|
|
as SUB-Frames */
|
|
|
|
if (chan_state->amr_last_dtx != AMR_OTHER) {
|
[VAMOS] Re-organize osmo-bts-trx specific structures
Together with the 'generic' structures which used to be shared between
osmo-bsc and osmo-bts some time ago, we also have the following
osmo-bts-trx specific structures (in hierarchical order):
- struct l1sched_trx (struct gsm_bts_trx),
- struct l1sched_ts (struct gsm_bts_trx_ts),
- struct l1sched_chan_state (struct gsm_lchan).
These structures are not integrated into the tree of the generic
structures, but maintained in a _separate tree_ instead. Until
recently, only the 'l1sched_trx' had a pointer to generic
'gsm_bts_trx', so in order to find the corresponding 'gsm_lchan' for
'l1sched_chan_state' one would need to traverse all the way up to
'l1sched_trx' and then tracerse another three backwards.
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ l1sched_trx --------------------> gsm_bts_trx (0..255)
| |
--+ l1sched_trx_ts --+ gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
I find this architecture a bit over-complicated, especially given
that 'l1sched_trx' is kind of a dummy node containing nothing else
than a pointer to 'gsm_bts_trx' and the list of 'l1sched_trx_ts'.
In this path I slightly change the architecture as follows:
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ gsm_bts_trx (0..255)
|
--+ l1sched_trx_ts <----------------> gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
Note that unfortunately we cannot 1:1 map 'l1sched_chan_state' to
'gsm_lchan' (like we do for 'l1sched_trx_ts' and 'gsm_bts_trx_ts')
because there is no direct mapping. The former is a higl-level
representation of a logical channel, while the later represents
one specific logical channel type like FCCH, SDCCH/0 or SACCH/0.
osmo-bts-virtual re-uses the osmo-bts-trx hierarchy, so it's also
affected by this change.
Change-Id: I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-05-07 13:47:57 +00:00
|
|
|
LOGL1SB(DL1P, LOGL_DEBUG, l1ts, bi, "Received AMR SID frame: %s\n",
|
[VAMOS] osmo-bts-trx: move {chan,bid} to trx_{dl,ul}_burst_{req,ind}
Historically the logical channel handlers like rx_data_fn() used to accept
quite a lot of arguments. With the introduction of additional measurement
parameters it has become clear that we need to group the arguments into
structures. This is why both 'trx_{dl,ul}_burst_{req,ind}' structures
were introduced.
However, both channel type and burst ID were kept untouched, so until
now we had them being passed between the scheduler functions here and
there. This change is a logical conclusion of the original change
mentioned above.
As a part of this change, the new LOGL1SB() macro is introduced. It
does accept a pointer to 'trx_{dl,ul}_burst_{req,ind}' and expands the
context information for the old LOGL1S() macro.
Change-Id: Ic5a02b074662b3e429bf18e05a982f3f3e7b7444
2021-05-07 14:20:58 +00:00
|
|
|
gsm0503_amr_dtx_frame_name(chan_state->amr_last_dtx));
|
2020-06-05 17:56:29 +00:00
|
|
|
is_sub = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* See comment in function rx_tchf_fn() */
|
|
|
|
switch (chan_state->amr_last_dtx) {
|
|
|
|
case AHS_SID_FIRST_P1:
|
|
|
|
case AHS_SID_FIRST_P2:
|
|
|
|
case AHS_SID_UPDATE:
|
|
|
|
case AHS_SID_UPDATE_CN:
|
|
|
|
lchan_set_marker(true, lchan);
|
|
|
|
lchan->rtp_tx_marker = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-06-22 23:11:20 +00:00
|
|
|
switch (chan_state->amr_last_dtx) {
|
|
|
|
case AHS_SID_FIRST_P1:
|
|
|
|
case AHS_SID_FIRST_P2:
|
|
|
|
case AHS_SID_UPDATE:
|
|
|
|
case AHS_SID_UPDATE_CN:
|
|
|
|
case AHS_SID_FIRST_INH:
|
|
|
|
case AHS_SID_UPDATE_INH:
|
2022-03-17 15:36:36 +00:00
|
|
|
meas_avg_mode = SCHED_MEAS_AVG_M_S6N2;
|
2020-06-22 23:11:20 +00:00
|
|
|
break;
|
|
|
|
case AHS_ONSET:
|
2022-03-17 15:36:36 +00:00
|
|
|
meas_avg_mode = SCHED_MEAS_AVG_M_S4N2;
|
2020-06-22 23:11:20 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-06-05 17:56:29 +00:00
|
|
|
/* only good speech frames get rtp header */
|
|
|
|
if (rc != GSM_MACBLOCK_LEN && rc >= 4) {
|
|
|
|
if (chan_state->amr_last_dtx == AMR_OTHER) {
|
2021-08-26 12:35:50 +00:00
|
|
|
ft = chan_state->codec[chan_state->ul_ft];
|
2020-06-05 17:56:29 +00:00
|
|
|
} else {
|
|
|
|
/* SID frames will always get Frame Type Index 8 (AMR_SID) */
|
|
|
|
ft = AMR_SID;
|
|
|
|
}
|
|
|
|
rc = osmo_amr_rtp_enc(tch_data,
|
|
|
|
chan_state->codec[chan_state->ul_cmr],
|
|
|
|
ft, AMR_GOOD);
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
default:
|
[VAMOS] Re-organize osmo-bts-trx specific structures
Together with the 'generic' structures which used to be shared between
osmo-bsc and osmo-bts some time ago, we also have the following
osmo-bts-trx specific structures (in hierarchical order):
- struct l1sched_trx (struct gsm_bts_trx),
- struct l1sched_ts (struct gsm_bts_trx_ts),
- struct l1sched_chan_state (struct gsm_lchan).
These structures are not integrated into the tree of the generic
structures, but maintained in a _separate tree_ instead. Until
recently, only the 'l1sched_trx' had a pointer to generic
'gsm_bts_trx', so in order to find the corresponding 'gsm_lchan' for
'l1sched_chan_state' one would need to traverse all the way up to
'l1sched_trx' and then tracerse another three backwards.
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ l1sched_trx --------------------> gsm_bts_trx (0..255)
| |
--+ l1sched_trx_ts --+ gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
I find this architecture a bit over-complicated, especially given
that 'l1sched_trx' is kind of a dummy node containing nothing else
than a pointer to 'gsm_bts_trx' and the list of 'l1sched_trx_ts'.
In this path I slightly change the architecture as follows:
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ gsm_bts_trx (0..255)
|
--+ l1sched_trx_ts <----------------> gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
Note that unfortunately we cannot 1:1 map 'l1sched_chan_state' to
'gsm_lchan' (like we do for 'l1sched_trx_ts' and 'gsm_bts_trx_ts')
because there is no direct mapping. The former is a higl-level
representation of a logical channel, while the later represents
one specific logical channel type like FCCH, SDCCH/0 or SACCH/0.
osmo-bts-virtual re-uses the osmo-bts-trx hierarchy, so it's also
affected by this change.
Change-Id: I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-05-07 13:47:57 +00:00
|
|
|
LOGL1SB(DL1P, LOGL_ERROR, l1ts, bi,
|
2020-06-05 17:56:29 +00:00
|
|
|
"TCH mode %u invalid, please fix!\n",
|
|
|
|
tch_mode);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
2022-03-19 16:21:29 +00:00
|
|
|
|
2020-06-05 17:56:29 +00:00
|
|
|
ber10k = compute_ber10k(n_bits_total, n_errors);
|
|
|
|
|
2020-06-22 22:44:48 +00:00
|
|
|
/* average measurements of the last N (depends on mode) bursts */
|
|
|
|
trx_sched_meas_avg(chan_state, &meas_avg, meas_avg_mode);
|
2022-03-20 00:22:14 +00:00
|
|
|
/* meas_avg.fn now contains TDMA frame number of the first burst */
|
|
|
|
fn_begin = meas_avg.fn;
|
2020-06-05 17:56:29 +00:00
|
|
|
|
2022-04-12 13:12:41 +00:00
|
|
|
if (tch_mode == GSM48_CMODE_SPEECH_AMR)
|
|
|
|
trx_loop_amr_input(chan_state, &meas_avg);
|
|
|
|
|
2020-06-05 17:56:29 +00:00
|
|
|
/* Check if the frame is bad */
|
|
|
|
if (rc < 0) {
|
[VAMOS] Re-organize osmo-bts-trx specific structures
Together with the 'generic' structures which used to be shared between
osmo-bsc and osmo-bts some time ago, we also have the following
osmo-bts-trx specific structures (in hierarchical order):
- struct l1sched_trx (struct gsm_bts_trx),
- struct l1sched_ts (struct gsm_bts_trx_ts),
- struct l1sched_chan_state (struct gsm_lchan).
These structures are not integrated into the tree of the generic
structures, but maintained in a _separate tree_ instead. Until
recently, only the 'l1sched_trx' had a pointer to generic
'gsm_bts_trx', so in order to find the corresponding 'gsm_lchan' for
'l1sched_chan_state' one would need to traverse all the way up to
'l1sched_trx' and then tracerse another three backwards.
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ l1sched_trx --------------------> gsm_bts_trx (0..255)
| |
--+ l1sched_trx_ts --+ gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
I find this architecture a bit over-complicated, especially given
that 'l1sched_trx' is kind of a dummy node containing nothing else
than a pointer to 'gsm_bts_trx' and the list of 'l1sched_trx_ts'.
In this path I slightly change the architecture as follows:
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ gsm_bts_trx (0..255)
|
--+ l1sched_trx_ts <----------------> gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
Note that unfortunately we cannot 1:1 map 'l1sched_chan_state' to
'gsm_lchan' (like we do for 'l1sched_trx_ts' and 'gsm_bts_trx_ts')
because there is no direct mapping. The former is a higl-level
representation of a logical channel, while the later represents
one specific logical channel type like FCCH, SDCCH/0 or SACCH/0.
osmo-bts-virtual re-uses the osmo-bts-trx hierarchy, so it's also
affected by this change.
Change-Id: I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-05-07 13:47:57 +00:00
|
|
|
LOGL1SB(DL1P, LOGL_NOTICE, l1ts, bi, "Received bad data (%u/%u)\n",
|
2020-06-05 17:56:29 +00:00
|
|
|
bi->fn % l1ts->mf_period, l1ts->mf_period);
|
|
|
|
bfi_flag = true;
|
|
|
|
} else if (rc < 4) {
|
[VAMOS] Re-organize osmo-bts-trx specific structures
Together with the 'generic' structures which used to be shared between
osmo-bsc and osmo-bts some time ago, we also have the following
osmo-bts-trx specific structures (in hierarchical order):
- struct l1sched_trx (struct gsm_bts_trx),
- struct l1sched_ts (struct gsm_bts_trx_ts),
- struct l1sched_chan_state (struct gsm_lchan).
These structures are not integrated into the tree of the generic
structures, but maintained in a _separate tree_ instead. Until
recently, only the 'l1sched_trx' had a pointer to generic
'gsm_bts_trx', so in order to find the corresponding 'gsm_lchan' for
'l1sched_chan_state' one would need to traverse all the way up to
'l1sched_trx' and then tracerse another three backwards.
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ l1sched_trx --------------------> gsm_bts_trx (0..255)
| |
--+ l1sched_trx_ts --+ gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
I find this architecture a bit over-complicated, especially given
that 'l1sched_trx' is kind of a dummy node containing nothing else
than a pointer to 'gsm_bts_trx' and the list of 'l1sched_trx_ts'.
In this path I slightly change the architecture as follows:
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ gsm_bts_trx (0..255)
|
--+ l1sched_trx_ts <----------------> gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
Note that unfortunately we cannot 1:1 map 'l1sched_chan_state' to
'gsm_lchan' (like we do for 'l1sched_trx_ts' and 'gsm_bts_trx_ts')
because there is no direct mapping. The former is a higl-level
representation of a logical channel, while the later represents
one specific logical channel type like FCCH, SDCCH/0 or SACCH/0.
osmo-bts-virtual re-uses the osmo-bts-trx hierarchy, so it's also
affected by this change.
Change-Id: I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-05-07 13:47:57 +00:00
|
|
|
LOGL1SB(DL1P, LOGL_NOTICE, l1ts, bi,
|
2020-06-05 17:56:29 +00:00
|
|
|
"Received bad data (%u/%u) with invalid codec mode %d\n",
|
|
|
|
bi->fn % l1ts->mf_period, l1ts->mf_period, rc);
|
|
|
|
bfi_flag = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rc != GSM_MACBLOCK_LEN && lchan->ecu_state)
|
|
|
|
osmo_ecu_frame_in(lchan->ecu_state, bfi_flag, tch_data, rc);
|
|
|
|
|
|
|
|
if (bfi_flag)
|
|
|
|
goto bfi;
|
|
|
|
|
|
|
|
/* FACCH */
|
|
|
|
if (rc == GSM_MACBLOCK_LEN) {
|
|
|
|
chan_state->ul_ongoing_facch = 1;
|
2022-04-07 17:04:12 +00:00
|
|
|
/* In order to provide an even stream of measurement reports in *speech*
|
|
|
|
* mode, here we intentionally invalidate RSSI for FACCH, so that this
|
|
|
|
* report gets dropped in process_l1sap_meas_data(). The averaged results
|
|
|
|
* will be sent with the first (see below) and second (see above) BFIs. */
|
[VAMOS] Re-organize osmo-bts-trx specific structures
Together with the 'generic' structures which used to be shared between
osmo-bsc and osmo-bts some time ago, we also have the following
osmo-bts-trx specific structures (in hierarchical order):
- struct l1sched_trx (struct gsm_bts_trx),
- struct l1sched_ts (struct gsm_bts_trx_ts),
- struct l1sched_chan_state (struct gsm_lchan).
These structures are not integrated into the tree of the generic
structures, but maintained in a _separate tree_ instead. Until
recently, only the 'l1sched_trx' had a pointer to generic
'gsm_bts_trx', so in order to find the corresponding 'gsm_lchan' for
'l1sched_chan_state' one would need to traverse all the way up to
'l1sched_trx' and then tracerse another three backwards.
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ l1sched_trx --------------------> gsm_bts_trx (0..255)
| |
--+ l1sched_trx_ts --+ gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
I find this architecture a bit over-complicated, especially given
that 'l1sched_trx' is kind of a dummy node containing nothing else
than a pointer to 'gsm_bts_trx' and the list of 'l1sched_trx_ts'.
In this path I slightly change the architecture as follows:
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ gsm_bts_trx (0..255)
|
--+ l1sched_trx_ts <----------------> gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
Note that unfortunately we cannot 1:1 map 'l1sched_chan_state' to
'gsm_lchan' (like we do for 'l1sched_trx_ts' and 'gsm_bts_trx_ts')
because there is no direct mapping. The former is a higl-level
representation of a logical channel, while the later represents
one specific logical channel type like FCCH, SDCCH/0 or SACCH/0.
osmo-bts-virtual re-uses the osmo-bts-trx hierarchy, so it's also
affected by this change.
Change-Id: I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-05-07 13:47:57 +00:00
|
|
|
_sched_compose_ph_data_ind(l1ts, fn_begin, bi->chan,
|
2020-06-05 17:56:29 +00:00
|
|
|
tch_data + amr, GSM_MACBLOCK_LEN,
|
2022-04-07 17:04:12 +00:00
|
|
|
tch_mode == GSM48_CMODE_SIGN ? meas_avg.rssi : 0,
|
2022-03-18 12:30:49 +00:00
|
|
|
meas_avg.toa256, meas_avg.ci_cb, ber10k,
|
2020-06-22 22:44:48 +00:00
|
|
|
PRES_INFO_UNKNOWN);
|
2022-03-18 00:57:01 +00:00
|
|
|
ber10k = 0;
|
2020-06-05 17:56:29 +00:00
|
|
|
bfi:
|
2020-10-30 09:44:55 +00:00
|
|
|
/* A FACCH/H frame replaces two speech frames, so we need to send two BFIs.
|
|
|
|
* One is sent here, another will be sent two bursts later (see above). */
|
2020-06-05 17:56:29 +00:00
|
|
|
if (rsl_cmode == RSL_CMOD_SPD_SPEECH) {
|
|
|
|
/* indicate bad frame */
|
|
|
|
if (lchan->tch.dtx.ul_sid) {
|
|
|
|
/* DTXu: pause in progress. Push empty payload to upper layers */
|
|
|
|
rc = 0;
|
|
|
|
goto compose_l1sap;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If there is an ECU active on this channel, use its output */
|
|
|
|
if (lchan->ecu_state) {
|
|
|
|
rc = osmo_ecu_frame_out(lchan->ecu_state, tch_data);
|
|
|
|
if (rc >= 0) /* Otherwise we send a BFI */
|
|
|
|
goto compose_l1sap;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (tch_mode) {
|
|
|
|
case GSM48_CMODE_SPEECH_V1: /* HR */
|
|
|
|
tch_data[0] = 0x70; /* F = 0, FT = 111 */
|
|
|
|
memset(tch_data + 1, 0, 14);
|
|
|
|
rc = 15;
|
|
|
|
break;
|
|
|
|
case GSM48_CMODE_SPEECH_AMR: /* AMR */
|
|
|
|
rc = osmo_amr_rtp_enc(tch_data,
|
2021-08-31 14:15:47 +00:00
|
|
|
chan_state->codec[chan_state->ul_cmr],
|
|
|
|
chan_state->codec[chan_state->ul_ft],
|
2020-06-05 17:56:29 +00:00
|
|
|
AMR_BAD);
|
|
|
|
if (rc < 2) {
|
[VAMOS] Re-organize osmo-bts-trx specific structures
Together with the 'generic' structures which used to be shared between
osmo-bsc and osmo-bts some time ago, we also have the following
osmo-bts-trx specific structures (in hierarchical order):
- struct l1sched_trx (struct gsm_bts_trx),
- struct l1sched_ts (struct gsm_bts_trx_ts),
- struct l1sched_chan_state (struct gsm_lchan).
These structures are not integrated into the tree of the generic
structures, but maintained in a _separate tree_ instead. Until
recently, only the 'l1sched_trx' had a pointer to generic
'gsm_bts_trx', so in order to find the corresponding 'gsm_lchan' for
'l1sched_chan_state' one would need to traverse all the way up to
'l1sched_trx' and then tracerse another three backwards.
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ l1sched_trx --------------------> gsm_bts_trx (0..255)
| |
--+ l1sched_trx_ts --+ gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
I find this architecture a bit over-complicated, especially given
that 'l1sched_trx' is kind of a dummy node containing nothing else
than a pointer to 'gsm_bts_trx' and the list of 'l1sched_trx_ts'.
In this path I slightly change the architecture as follows:
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ gsm_bts_trx (0..255)
|
--+ l1sched_trx_ts <----------------> gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
Note that unfortunately we cannot 1:1 map 'l1sched_chan_state' to
'gsm_lchan' (like we do for 'l1sched_trx_ts' and 'gsm_bts_trx_ts')
because there is no direct mapping. The former is a higl-level
representation of a logical channel, while the later represents
one specific logical channel type like FCCH, SDCCH/0 or SACCH/0.
osmo-bts-virtual re-uses the osmo-bts-trx hierarchy, so it's also
affected by this change.
Change-Id: I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-05-07 13:47:57 +00:00
|
|
|
LOGL1SB(DL1P, LOGL_ERROR, l1ts, bi,
|
2020-06-05 17:56:29 +00:00
|
|
|
"Failed to encode AMR_BAD frame (rc=%d), "
|
|
|
|
"not sending BFI\n", rc);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
memset(tch_data + 2, 0, rc - 2);
|
|
|
|
break;
|
|
|
|
default:
|
[VAMOS] Re-organize osmo-bts-trx specific structures
Together with the 'generic' structures which used to be shared between
osmo-bsc and osmo-bts some time ago, we also have the following
osmo-bts-trx specific structures (in hierarchical order):
- struct l1sched_trx (struct gsm_bts_trx),
- struct l1sched_ts (struct gsm_bts_trx_ts),
- struct l1sched_chan_state (struct gsm_lchan).
These structures are not integrated into the tree of the generic
structures, but maintained in a _separate tree_ instead. Until
recently, only the 'l1sched_trx' had a pointer to generic
'gsm_bts_trx', so in order to find the corresponding 'gsm_lchan' for
'l1sched_chan_state' one would need to traverse all the way up to
'l1sched_trx' and then tracerse another three backwards.
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ l1sched_trx --------------------> gsm_bts_trx (0..255)
| |
--+ l1sched_trx_ts --+ gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
I find this architecture a bit over-complicated, especially given
that 'l1sched_trx' is kind of a dummy node containing nothing else
than a pointer to 'gsm_bts_trx' and the list of 'l1sched_trx_ts'.
In this path I slightly change the architecture as follows:
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ gsm_bts_trx (0..255)
|
--+ l1sched_trx_ts <----------------> gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
Note that unfortunately we cannot 1:1 map 'l1sched_chan_state' to
'gsm_lchan' (like we do for 'l1sched_trx_ts' and 'gsm_bts_trx_ts')
because there is no direct mapping. The former is a higl-level
representation of a logical channel, while the later represents
one specific logical channel type like FCCH, SDCCH/0 or SACCH/0.
osmo-bts-virtual re-uses the osmo-bts-trx hierarchy, so it's also
affected by this change.
Change-Id: I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-05-07 13:47:57 +00:00
|
|
|
LOGL1SB(DL1P, LOGL_ERROR, l1ts, bi,
|
2020-06-05 17:56:29 +00:00
|
|
|
"TCH mode %u invalid, please fix!\n", tch_mode);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rsl_cmode != RSL_CMOD_SPD_SPEECH)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
compose_l1sap:
|
|
|
|
/* TCH or BFI */
|
[VAMOS] Re-organize osmo-bts-trx specific structures
Together with the 'generic' structures which used to be shared between
osmo-bsc and osmo-bts some time ago, we also have the following
osmo-bts-trx specific structures (in hierarchical order):
- struct l1sched_trx (struct gsm_bts_trx),
- struct l1sched_ts (struct gsm_bts_trx_ts),
- struct l1sched_chan_state (struct gsm_lchan).
These structures are not integrated into the tree of the generic
structures, but maintained in a _separate tree_ instead. Until
recently, only the 'l1sched_trx' had a pointer to generic
'gsm_bts_trx', so in order to find the corresponding 'gsm_lchan' for
'l1sched_chan_state' one would need to traverse all the way up to
'l1sched_trx' and then tracerse another three backwards.
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ l1sched_trx --------------------> gsm_bts_trx (0..255)
| |
--+ l1sched_trx_ts --+ gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
I find this architecture a bit over-complicated, especially given
that 'l1sched_trx' is kind of a dummy node containing nothing else
than a pointer to 'gsm_bts_trx' and the list of 'l1sched_trx_ts'.
In this path I slightly change the architecture as follows:
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ gsm_bts_trx (0..255)
|
--+ l1sched_trx_ts <----------------> gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
Note that unfortunately we cannot 1:1 map 'l1sched_chan_state' to
'gsm_lchan' (like we do for 'l1sched_trx_ts' and 'gsm_bts_trx_ts')
because there is no direct mapping. The former is a higl-level
representation of a logical channel, while the later represents
one specific logical channel type like FCCH, SDCCH/0 or SACCH/0.
osmo-bts-virtual re-uses the osmo-bts-trx hierarchy, so it's also
affected by this change.
Change-Id: I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-05-07 13:47:57 +00:00
|
|
|
return _sched_compose_tch_ind(l1ts, fn_begin, bi->chan, tch_data, rc,
|
2022-03-17 23:56:04 +00:00
|
|
|
meas_avg.toa256, ber10k, meas_avg.rssi,
|
|
|
|
meas_avg.ci_cb, is_sub);
|
2020-06-05 17:56:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* common section for generation of TCH bursts (TCH/H and TCH/F).
|
|
|
|
* FIXME: this function is over-complicated, refactor / get rid of it. */
|
[VAMOS] Re-organize osmo-bts-trx specific structures
Together with the 'generic' structures which used to be shared between
osmo-bsc and osmo-bts some time ago, we also have the following
osmo-bts-trx specific structures (in hierarchical order):
- struct l1sched_trx (struct gsm_bts_trx),
- struct l1sched_ts (struct gsm_bts_trx_ts),
- struct l1sched_chan_state (struct gsm_lchan).
These structures are not integrated into the tree of the generic
structures, but maintained in a _separate tree_ instead. Until
recently, only the 'l1sched_trx' had a pointer to generic
'gsm_bts_trx', so in order to find the corresponding 'gsm_lchan' for
'l1sched_chan_state' one would need to traverse all the way up to
'l1sched_trx' and then tracerse another three backwards.
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ l1sched_trx --------------------> gsm_bts_trx (0..255)
| |
--+ l1sched_trx_ts --+ gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
I find this architecture a bit over-complicated, especially given
that 'l1sched_trx' is kind of a dummy node containing nothing else
than a pointer to 'gsm_bts_trx' and the list of 'l1sched_trx_ts'.
In this path I slightly change the architecture as follows:
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ gsm_bts_trx (0..255)
|
--+ l1sched_trx_ts <----------------> gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
Note that unfortunately we cannot 1:1 map 'l1sched_chan_state' to
'gsm_lchan' (like we do for 'l1sched_trx_ts' and 'gsm_bts_trx_ts')
because there is no direct mapping. The former is a higl-level
representation of a logical channel, while the later represents
one specific logical channel type like FCCH, SDCCH/0 or SACCH/0.
osmo-bts-virtual re-uses the osmo-bts-trx hierarchy, so it's also
affected by this change.
Change-Id: I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-05-07 13:47:57 +00:00
|
|
|
extern void tx_tch_common(struct l1sched_ts *l1ts,
|
[VAMOS] osmo-bts-trx: move {chan,bid} to trx_{dl,ul}_burst_{req,ind}
Historically the logical channel handlers like rx_data_fn() used to accept
quite a lot of arguments. With the introduction of additional measurement
parameters it has become clear that we need to group the arguments into
structures. This is why both 'trx_{dl,ul}_burst_{req,ind}' structures
were introduced.
However, both channel type and burst ID were kept untouched, so until
now we had them being passed between the scheduler functions here and
there. This change is a logical conclusion of the original change
mentioned above.
As a part of this change, the new LOGL1SB() macro is introduced. It
does accept a pointer to 'trx_{dl,ul}_burst_{req,ind}' and expands the
context information for the old LOGL1S() macro.
Change-Id: Ic5a02b074662b3e429bf18e05a982f3f3e7b7444
2021-05-07 14:20:58 +00:00
|
|
|
const struct trx_dl_burst_req *br,
|
2020-06-05 17:56:29 +00:00
|
|
|
struct msgb **_msg_tch, struct msgb **_msg_facch);
|
|
|
|
|
|
|
|
/* obtain a to-be-transmitted TCH/H (Half Traffic Channel) burst */
|
[VAMOS] Re-organize osmo-bts-trx specific structures
Together with the 'generic' structures which used to be shared between
osmo-bsc and osmo-bts some time ago, we also have the following
osmo-bts-trx specific structures (in hierarchical order):
- struct l1sched_trx (struct gsm_bts_trx),
- struct l1sched_ts (struct gsm_bts_trx_ts),
- struct l1sched_chan_state (struct gsm_lchan).
These structures are not integrated into the tree of the generic
structures, but maintained in a _separate tree_ instead. Until
recently, only the 'l1sched_trx' had a pointer to generic
'gsm_bts_trx', so in order to find the corresponding 'gsm_lchan' for
'l1sched_chan_state' one would need to traverse all the way up to
'l1sched_trx' and then tracerse another three backwards.
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ l1sched_trx --------------------> gsm_bts_trx (0..255)
| |
--+ l1sched_trx_ts --+ gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
I find this architecture a bit over-complicated, especially given
that 'l1sched_trx' is kind of a dummy node containing nothing else
than a pointer to 'gsm_bts_trx' and the list of 'l1sched_trx_ts'.
In this path I slightly change the architecture as follows:
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ gsm_bts_trx (0..255)
|
--+ l1sched_trx_ts <----------------> gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
Note that unfortunately we cannot 1:1 map 'l1sched_chan_state' to
'gsm_lchan' (like we do for 'l1sched_trx_ts' and 'gsm_bts_trx_ts')
because there is no direct mapping. The former is a higl-level
representation of a logical channel, while the later represents
one specific logical channel type like FCCH, SDCCH/0 or SACCH/0.
osmo-bts-virtual re-uses the osmo-bts-trx hierarchy, so it's also
affected by this change.
Change-Id: I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-05-07 13:47:57 +00:00
|
|
|
int tx_tchh_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br)
|
2020-06-05 17:56:29 +00:00
|
|
|
{
|
|
|
|
struct msgb *msg_tch = NULL, *msg_facch = NULL;
|
[VAMOS] osmo-bts-trx: move {chan,bid} to trx_{dl,ul}_burst_{req,ind}
Historically the logical channel handlers like rx_data_fn() used to accept
quite a lot of arguments. With the introduction of additional measurement
parameters it has become clear that we need to group the arguments into
structures. This is why both 'trx_{dl,ul}_burst_{req,ind}' structures
were introduced.
However, both channel type and burst ID were kept untouched, so until
now we had them being passed between the scheduler functions here and
there. This change is a logical conclusion of the original change
mentioned above.
As a part of this change, the new LOGL1SB() macro is introduced. It
does accept a pointer to 'trx_{dl,ul}_burst_{req,ind}' and expands the
context information for the old LOGL1S() macro.
Change-Id: Ic5a02b074662b3e429bf18e05a982f3f3e7b7444
2021-05-07 14:20:58 +00:00
|
|
|
struct l1sched_chan_state *chan_state = &l1ts->chan_state[br->chan];
|
2020-06-05 17:56:29 +00:00
|
|
|
uint8_t tch_mode = chan_state->tch_mode;
|
|
|
|
ubit_t *burst, **bursts_p = &chan_state->dl_bursts;
|
|
|
|
|
|
|
|
/* send burst, if we already got a frame */
|
[VAMOS] osmo-bts-trx: move {chan,bid} to trx_{dl,ul}_burst_{req,ind}
Historically the logical channel handlers like rx_data_fn() used to accept
quite a lot of arguments. With the introduction of additional measurement
parameters it has become clear that we need to group the arguments into
structures. This is why both 'trx_{dl,ul}_burst_{req,ind}' structures
were introduced.
However, both channel type and burst ID were kept untouched, so until
now we had them being passed between the scheduler functions here and
there. This change is a logical conclusion of the original change
mentioned above.
As a part of this change, the new LOGL1SB() macro is introduced. It
does accept a pointer to 'trx_{dl,ul}_burst_{req,ind}' and expands the
context information for the old LOGL1S() macro.
Change-Id: Ic5a02b074662b3e429bf18e05a982f3f3e7b7444
2021-05-07 14:20:58 +00:00
|
|
|
if (br->bid > 0) {
|
2020-06-05 17:56:29 +00:00
|
|
|
if (!*bursts_p)
|
2021-09-24 16:31:53 +00:00
|
|
|
return -ENODEV;
|
2020-06-05 17:56:29 +00:00
|
|
|
goto send_burst;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get TCH and/or FACCH */
|
[VAMOS] Re-organize osmo-bts-trx specific structures
Together with the 'generic' structures which used to be shared between
osmo-bsc and osmo-bts some time ago, we also have the following
osmo-bts-trx specific structures (in hierarchical order):
- struct l1sched_trx (struct gsm_bts_trx),
- struct l1sched_ts (struct gsm_bts_trx_ts),
- struct l1sched_chan_state (struct gsm_lchan).
These structures are not integrated into the tree of the generic
structures, but maintained in a _separate tree_ instead. Until
recently, only the 'l1sched_trx' had a pointer to generic
'gsm_bts_trx', so in order to find the corresponding 'gsm_lchan' for
'l1sched_chan_state' one would need to traverse all the way up to
'l1sched_trx' and then tracerse another three backwards.
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ l1sched_trx --------------------> gsm_bts_trx (0..255)
| |
--+ l1sched_trx_ts --+ gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
I find this architecture a bit over-complicated, especially given
that 'l1sched_trx' is kind of a dummy node containing nothing else
than a pointer to 'gsm_bts_trx' and the list of 'l1sched_trx_ts'.
In this path I slightly change the architecture as follows:
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ gsm_bts_trx (0..255)
|
--+ l1sched_trx_ts <----------------> gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
Note that unfortunately we cannot 1:1 map 'l1sched_chan_state' to
'gsm_lchan' (like we do for 'l1sched_trx_ts' and 'gsm_bts_trx_ts')
because there is no direct mapping. The former is a higl-level
representation of a logical channel, while the later represents
one specific logical channel type like FCCH, SDCCH/0 or SACCH/0.
osmo-bts-virtual re-uses the osmo-bts-trx hierarchy, so it's also
affected by this change.
Change-Id: I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-05-07 13:47:57 +00:00
|
|
|
tx_tch_common(l1ts, br, &msg_tch, &msg_facch);
|
2020-06-05 17:56:29 +00:00
|
|
|
|
|
|
|
/* BURST BYPASS */
|
|
|
|
|
|
|
|
/* allocate burst memory, if not already,
|
|
|
|
* otherwise shift buffer by 2 bursts for interleaving */
|
|
|
|
if (!*bursts_p) {
|
2021-12-12 15:53:40 +00:00
|
|
|
*bursts_p = talloc_zero_size(l1ts, 696);
|
2020-06-05 17:56:29 +00:00
|
|
|
if (!*bursts_p)
|
2020-06-13 14:45:33 +00:00
|
|
|
return -ENOMEM;
|
2020-06-05 17:56:29 +00:00
|
|
|
} else {
|
|
|
|
memcpy(*bursts_p, *bursts_p + 232, 232);
|
|
|
|
if (chan_state->dl_ongoing_facch) {
|
|
|
|
memcpy(*bursts_p + 232, *bursts_p + 464, 232);
|
|
|
|
memset(*bursts_p + 464, 0, 232);
|
|
|
|
} else {
|
|
|
|
memset(*bursts_p + 232, 0, 232);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-04 18:06:46 +00:00
|
|
|
/* no message at all, send a dummy L2 frame on FACCH */
|
2020-06-05 17:56:29 +00:00
|
|
|
if (!msg_tch && !msg_facch && !chan_state->dl_ongoing_facch) {
|
2021-07-04 18:06:46 +00:00
|
|
|
static const uint8_t dummy[GSM_MACBLOCK_LEN] = {
|
|
|
|
0x03, 0x03, 0x01, /* TODO: use randomized padding */
|
|
|
|
0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b,
|
|
|
|
0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b,
|
|
|
|
};
|
|
|
|
|
[VAMOS] Re-organize osmo-bts-trx specific structures
Together with the 'generic' structures which used to be shared between
osmo-bsc and osmo-bts some time ago, we also have the following
osmo-bts-trx specific structures (in hierarchical order):
- struct l1sched_trx (struct gsm_bts_trx),
- struct l1sched_ts (struct gsm_bts_trx_ts),
- struct l1sched_chan_state (struct gsm_lchan).
These structures are not integrated into the tree of the generic
structures, but maintained in a _separate tree_ instead. Until
recently, only the 'l1sched_trx' had a pointer to generic
'gsm_bts_trx', so in order to find the corresponding 'gsm_lchan' for
'l1sched_chan_state' one would need to traverse all the way up to
'l1sched_trx' and then tracerse another three backwards.
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ l1sched_trx --------------------> gsm_bts_trx (0..255)
| |
--+ l1sched_trx_ts --+ gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
I find this architecture a bit over-complicated, especially given
that 'l1sched_trx' is kind of a dummy node containing nothing else
than a pointer to 'gsm_bts_trx' and the list of 'l1sched_trx_ts'.
In this path I slightly change the architecture as follows:
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ gsm_bts_trx (0..255)
|
--+ l1sched_trx_ts <----------------> gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
Note that unfortunately we cannot 1:1 map 'l1sched_chan_state' to
'gsm_lchan' (like we do for 'l1sched_trx_ts' and 'gsm_bts_trx_ts')
because there is no direct mapping. The former is a higl-level
representation of a logical channel, while the later represents
one specific logical channel type like FCCH, SDCCH/0 or SACCH/0.
osmo-bts-virtual re-uses the osmo-bts-trx hierarchy, so it's also
affected by this change.
Change-Id: I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-05-07 13:47:57 +00:00
|
|
|
LOGL1SB(DL1P, LOGL_INFO, l1ts, br, "No TCH or FACCH prim for transmit.\n");
|
2021-07-04 18:06:46 +00:00
|
|
|
gsm0503_tch_hr_encode(*bursts_p, dummy, sizeof(dummy));
|
2020-06-05 17:56:29 +00:00
|
|
|
goto send_burst;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* encode bursts (prioritize FACCH) */
|
|
|
|
if (msg_facch) {
|
|
|
|
gsm0503_tch_hr_encode(*bursts_p, msg_facch->l2h, msgb_l2len(msg_facch));
|
|
|
|
chan_state->dl_ongoing_facch = 1; /* first of two TCH frames */
|
2021-08-29 13:32:51 +00:00
|
|
|
chan_state->dl_facch_bursts = 6;
|
2020-06-05 17:56:29 +00:00
|
|
|
} else if (chan_state->dl_ongoing_facch) /* second of two TCH frames */
|
|
|
|
chan_state->dl_ongoing_facch = 0; /* we are done with FACCH */
|
|
|
|
else if (tch_mode == GSM48_CMODE_SPEECH_AMR)
|
|
|
|
/* the first FN 4,13,21 or 5,14,22 defines that CMI is included
|
|
|
|
* in frame, the first FN 0,8,17 or 1,9,18 defines that CMR is
|
|
|
|
* included in frame. */
|
|
|
|
gsm0503_tch_ahs_encode(*bursts_p, msg_tch->l2h + 2,
|
2021-08-26 11:55:27 +00:00
|
|
|
msgb_l2len(msg_tch) - 2, !dl_amr_fn_is_cmi(br->fn),
|
2020-06-05 17:56:29 +00:00
|
|
|
chan_state->codec, chan_state->codecs,
|
|
|
|
chan_state->dl_ft,
|
|
|
|
chan_state->dl_cmr);
|
|
|
|
else
|
|
|
|
gsm0503_tch_hr_encode(*bursts_p, msg_tch->l2h, msgb_l2len(msg_tch));
|
|
|
|
|
|
|
|
/* free message */
|
|
|
|
if (msg_tch)
|
|
|
|
msgb_free(msg_tch);
|
|
|
|
if (msg_facch)
|
|
|
|
msgb_free(msg_facch);
|
|
|
|
|
|
|
|
send_burst:
|
|
|
|
/* compose burst */
|
[VAMOS] osmo-bts-trx: move {chan,bid} to trx_{dl,ul}_burst_{req,ind}
Historically the logical channel handlers like rx_data_fn() used to accept
quite a lot of arguments. With the introduction of additional measurement
parameters it has become clear that we need to group the arguments into
structures. This is why both 'trx_{dl,ul}_burst_{req,ind}' structures
were introduced.
However, both channel type and burst ID were kept untouched, so until
now we had them being passed between the scheduler functions here and
there. This change is a logical conclusion of the original change
mentioned above.
As a part of this change, the new LOGL1SB() macro is introduced. It
does accept a pointer to 'trx_{dl,ul}_burst_{req,ind}' and expands the
context information for the old LOGL1S() macro.
Change-Id: Ic5a02b074662b3e429bf18e05a982f3f3e7b7444
2021-05-07 14:20:58 +00:00
|
|
|
burst = *bursts_p + br->bid * 116;
|
2020-06-13 14:45:33 +00:00
|
|
|
memcpy(br->burst + 3, burst, 58);
|
2021-05-22 01:33:13 +00:00
|
|
|
memcpy(br->burst + 61, TRX_GMSK_NB_TSC(br), 26);
|
2020-06-13 14:45:33 +00:00
|
|
|
memcpy(br->burst + 87, burst + 58, 58);
|
2020-06-05 17:56:29 +00:00
|
|
|
|
2020-06-13 14:45:33 +00:00
|
|
|
br->burst_len = GSM_BURST_LEN;
|
2020-06-05 17:56:29 +00:00
|
|
|
|
2021-08-29 13:32:51 +00:00
|
|
|
if (chan_state->dl_facch_bursts > 0) {
|
|
|
|
chan_state->dl_facch_bursts--;
|
|
|
|
br->flags |= TRX_BR_F_FACCH;
|
|
|
|
}
|
|
|
|
|
[VAMOS] Re-organize osmo-bts-trx specific structures
Together with the 'generic' structures which used to be shared between
osmo-bsc and osmo-bts some time ago, we also have the following
osmo-bts-trx specific structures (in hierarchical order):
- struct l1sched_trx (struct gsm_bts_trx),
- struct l1sched_ts (struct gsm_bts_trx_ts),
- struct l1sched_chan_state (struct gsm_lchan).
These structures are not integrated into the tree of the generic
structures, but maintained in a _separate tree_ instead. Until
recently, only the 'l1sched_trx' had a pointer to generic
'gsm_bts_trx', so in order to find the corresponding 'gsm_lchan' for
'l1sched_chan_state' one would need to traverse all the way up to
'l1sched_trx' and then tracerse another three backwards.
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ l1sched_trx --------------------> gsm_bts_trx (0..255)
| |
--+ l1sched_trx_ts --+ gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
I find this architecture a bit over-complicated, especially given
that 'l1sched_trx' is kind of a dummy node containing nothing else
than a pointer to 'gsm_bts_trx' and the list of 'l1sched_trx_ts'.
In this path I slightly change the architecture as follows:
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ gsm_bts_trx (0..255)
|
--+ l1sched_trx_ts <----------------> gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
Note that unfortunately we cannot 1:1 map 'l1sched_chan_state' to
'gsm_lchan' (like we do for 'l1sched_trx_ts' and 'gsm_bts_trx_ts')
because there is no direct mapping. The former is a higl-level
representation of a logical channel, while the later represents
one specific logical channel type like FCCH, SDCCH/0 or SACCH/0.
osmo-bts-virtual re-uses the osmo-bts-trx hierarchy, so it's also
affected by this change.
Change-Id: I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-05-07 13:47:57 +00:00
|
|
|
LOGL1SB(DL1P, LOGL_DEBUG, l1ts, br, "Transmitting burst=%u.\n", br->bid);
|
2020-06-05 17:56:29 +00:00
|
|
|
|
2020-06-13 14:45:33 +00:00
|
|
|
return 0;
|
2020-06-05 17:56:29 +00:00
|
|
|
}
|