2010-03-03 13:22:04 +00:00
|
|
|
/* Layer1 control code, talking L1CTL protocol with L1 on the phone */
|
|
|
|
|
|
|
|
/* (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org>
|
2010-03-02 17:47:01 +00:00
|
|
|
* (C) 2010 by Harald Welte <laforge@gnumonks.org>
|
2010-02-18 15:46:36 +00:00
|
|
|
*
|
|
|
|
* All Rights Reserved
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdint.h>
|
2010-03-02 17:47:01 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <errno.h>
|
2010-03-21 04:57:28 +00:00
|
|
|
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
|
2010-07-25 22:12:48 +00:00
|
|
|
#include <l1ctl_proto.h>
|
2010-02-18 15:46:36 +00:00
|
|
|
|
2011-04-26 00:55:30 +00:00
|
|
|
#include <osmocom/core/signal.h>
|
|
|
|
#include <osmocom/core/logging.h>
|
|
|
|
#include <osmocom/core/timer.h>
|
|
|
|
#include <osmocom/core/msgb.h>
|
|
|
|
#include <osmocom/gsm/tlv.h>
|
|
|
|
#include <osmocom/gsm/gsm_utils.h>
|
|
|
|
#include <osmocom/core/gsmtap_util.h>
|
2013-01-12 07:59:05 +00:00
|
|
|
#include <osmocom/core/gsmtap.h>
|
2011-04-26 00:55:30 +00:00
|
|
|
#include <osmocom/gsm/protocol/gsm_04_08.h>
|
|
|
|
#include <osmocom/gsm/protocol/gsm_08_58.h>
|
|
|
|
#include <osmocom/gsm/rsl.h>
|
2010-03-02 17:47:01 +00:00
|
|
|
|
2010-07-27 18:44:46 +00:00
|
|
|
#include <osmocom/bb/common/l1ctl.h>
|
|
|
|
#include <osmocom/bb/common/osmocom_data.h>
|
|
|
|
#include <osmocom/bb/common/l1l2_interface.h>
|
2011-09-19 17:49:22 +00:00
|
|
|
#include <osmocom/gsm/lapdm.h>
|
2010-07-27 18:44:46 +00:00
|
|
|
#include <osmocom/bb/common/logging.h>
|
2010-02-18 15:46:36 +00:00
|
|
|
|
2011-05-22 10:36:55 +00:00
|
|
|
extern struct gsmtap_inst *gsmtap_inst;
|
|
|
|
|
2019-12-20 15:26:25 +00:00
|
|
|
#define CB_FCCH -1
|
|
|
|
#define CB_SCH -2
|
|
|
|
#define CB_BCCH -3
|
|
|
|
#define CB_IDLE -4
|
|
|
|
|
|
|
|
/* according to TS 05.02 Clause 7 Table 3 of 9 an Figure 8a */
|
|
|
|
static const int ccch_block_table[51] = {
|
|
|
|
CB_FCCH, CB_SCH,/* 0..1 */
|
|
|
|
CB_BCCH, CB_BCCH, CB_BCCH, CB_BCCH, /* 2..5: BCCH */
|
|
|
|
0, 0, 0, 0, /* 6..9: B0 */
|
|
|
|
CB_FCCH, CB_SCH,/* 10..11 */
|
|
|
|
1, 1, 1, 1, /* 12..15: B1 */
|
|
|
|
2, 2, 2, 2, /* 16..19: B2 */
|
|
|
|
CB_FCCH, CB_SCH,/* 20..21 */
|
|
|
|
3, 3, 3, 3, /* 22..25: B3 */
|
|
|
|
4, 4, 4, 4, /* 26..29: B4 */
|
|
|
|
CB_FCCH, CB_SCH,/* 30..31 */
|
|
|
|
5, 5, 5, 5, /* 32..35: B5 */
|
|
|
|
6, 6, 6, 6, /* 36..39: B6 */
|
|
|
|
CB_FCCH, CB_SCH,/* 40..41 */
|
|
|
|
7, 7, 7, 7, /* 42..45: B7 */
|
|
|
|
8, 8, 8, 8, /* 46..49: B8 */
|
|
|
|
-4 /* 50: Idle */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* determine the CCCH block number based on the frame number */
|
|
|
|
static unsigned int fn2ccch_block(uint32_t fn)
|
|
|
|
{
|
|
|
|
int rc = ccch_block_table[fn%51];
|
|
|
|
/* if FN is negative, we were called for something that's not CCCH! */
|
|
|
|
OSMO_ASSERT(rc >= 0);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint8_t chantype_rsl2gsmtap_ext(uint8_t rsl_chantype, uint8_t link_id, uint32_t fn, uint8_t num_agch)
|
|
|
|
{
|
|
|
|
uint8_t ret = chantype_rsl2gsmtap(rsl_chantype, link_id);
|
|
|
|
if (ret != GSMTAP_CHANNEL_PCH)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
if (fn2ccch_block(fn) >= num_agch)
|
|
|
|
return GSMTAP_CHANNEL_PCH;
|
|
|
|
return GSMTAP_CHANNEL_AGCH;
|
|
|
|
}
|
|
|
|
|
2019-12-20 15:45:21 +00:00
|
|
|
static const uint8_t fill_frame[GSM_MACBLOCK_LEN] = {
|
|
|
|
0x03, 0x03, 0x01, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B,
|
|
|
|
0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B,
|
|
|
|
0x2B, 0x2B, 0x2B
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Paging Request 1 with "no identity" content, i.e. empty/dummy paging */
|
|
|
|
static const uint8_t paging_fill[GSM_MACBLOCK_LEN] = {
|
|
|
|
0x15, 0x06, 0x21, 0x00, 0x01, 0xf0, 0x2b, 0x2b, 0x2b, 0x2b,
|
|
|
|
0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b,
|
|
|
|
0x2b, 0x2b, 0x2b };
|
|
|
|
|
|
|
|
static bool is_fill_frame(uint8_t chan_type, const uint8_t *data)
|
|
|
|
{
|
|
|
|
switch (chan_type) {
|
|
|
|
case GSMTAP_CHANNEL_AGCH:
|
|
|
|
if (!memcmp(data, fill_frame, GSM_MACBLOCK_LEN))
|
|
|
|
return true;
|
|
|
|
break;
|
|
|
|
case GSMTAP_CHANNEL_PCH:
|
|
|
|
if (!memcmp(data, paging_fill, GSM_MACBLOCK_LEN))
|
|
|
|
return true;
|
|
|
|
break;
|
|
|
|
/* don't use 'default' case here as the above only conditionally return true */
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-02-18 15:46:36 +00:00
|
|
|
static struct msgb *osmo_l1_alloc(uint8_t msg_type)
|
|
|
|
{
|
2010-03-21 04:57:28 +00:00
|
|
|
struct l1ctl_hdr *l1h;
|
2010-02-18 15:46:36 +00:00
|
|
|
struct msgb *msg = msgb_alloc_headroom(256, 4, "osmo_l1");
|
|
|
|
|
|
|
|
if (!msg) {
|
2010-03-27 00:56:05 +00:00
|
|
|
LOGP(DL1C, LOGL_ERROR, "Failed to allocate memory.\n");
|
2010-02-18 15:46:36 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-03-21 04:57:28 +00:00
|
|
|
msg->l1h = msgb_put(msg, sizeof(*l1h));
|
|
|
|
l1h = (struct l1ctl_hdr *) msg->l1h;
|
|
|
|
l1h->msg_type = msg_type;
|
2019-12-20 15:46:10 +00:00
|
|
|
|
2010-02-18 15:46:36 +00:00
|
|
|
return msg;
|
|
|
|
}
|
|
|
|
|
2010-04-25 15:31:35 +00:00
|
|
|
static int osmo_make_band_arfcn(struct osmocom_ms *ms, uint16_t arfcn)
|
2010-02-18 15:46:36 +00:00
|
|
|
{
|
|
|
|
/* TODO: Include the band */
|
2010-04-25 15:31:35 +00:00
|
|
|
return arfcn;
|
2010-02-18 15:46:36 +00:00
|
|
|
}
|
|
|
|
|
2010-06-20 17:10:21 +00:00
|
|
|
static int rx_l1_fbsb_conf(struct osmocom_ms *ms, struct msgb *msg)
|
2010-02-18 15:46:36 +00:00
|
|
|
{
|
2010-03-02 17:47:01 +00:00
|
|
|
struct l1ctl_info_dl *dl;
|
2010-06-20 17:10:21 +00:00
|
|
|
struct l1ctl_fbsb_conf *sb;
|
2010-03-07 19:42:17 +00:00
|
|
|
struct gsm_time tm;
|
2010-09-26 10:35:46 +00:00
|
|
|
struct osmobb_fbsb_res fr;
|
2010-02-18 15:46:36 +00:00
|
|
|
|
2018-10-03 00:14:16 +00:00
|
|
|
if (msgb_l1len(msg) < (sizeof(*dl) + sizeof(*sb))) {
|
|
|
|
LOGP(DL1C, LOGL_ERROR, "FBSB RESP: MSG too short (len=%u), "
|
|
|
|
"missing UL info header and/or payload\n", msgb_l1len(msg));
|
2010-02-18 15:46:36 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2010-03-02 17:47:01 +00:00
|
|
|
dl = (struct l1ctl_info_dl *) msg->l1h;
|
2010-06-20 17:10:21 +00:00
|
|
|
sb = (struct l1ctl_fbsb_conf *) dl->payload;
|
2010-05-19 19:41:24 +00:00
|
|
|
|
2010-09-26 22:02:32 +00:00
|
|
|
LOGP(DL1C, LOGL_INFO, "snr=%04x, arfcn=%u result=%u\n", dl->snr,
|
|
|
|
ntohs(dl->band_arfcn), sb->result);
|
2010-05-20 21:26:42 +00:00
|
|
|
|
|
|
|
if (sb->result != 0) {
|
|
|
|
LOGP(DL1C, LOGL_ERROR, "FBSB RESP: result=%u\n", sb->result);
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
fr.ms = ms;
|
|
|
|
fr.band_arfcn = ntohs(dl->band_arfcn);
|
|
|
|
osmo_signal_dispatch(SS_L1CTL, S_L1CTL_FBSB_ERR, &fr);
|
2010-05-20 21:26:42 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2010-02-18 15:46:36 +00:00
|
|
|
|
2010-03-07 19:42:17 +00:00
|
|
|
gsm_fn2gsmtime(&tm, ntohl(dl->frame_nr));
|
2010-03-27 00:56:05 +00:00
|
|
|
DEBUGP(DL1C, "SCH: SNR: %u TDMA: (%.4u/%.2u/%.2u) bsic: %d\n",
|
2010-03-07 19:42:17 +00:00
|
|
|
dl->snr, tm.t1, tm.t2, tm.t3, sb->bsic);
|
2010-09-26 10:35:46 +00:00
|
|
|
fr.ms = ms;
|
|
|
|
fr.snr = dl->snr;
|
|
|
|
fr.bsic = sb->bsic;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
fr.band_arfcn = ntohs(dl->band_arfcn);
|
2011-05-15 12:23:10 +00:00
|
|
|
osmo_signal_dispatch(SS_L1CTL, S_L1CTL_FBSB_RESP, &fr);
|
2010-03-01 10:08:38 +00:00
|
|
|
|
2010-02-18 15:46:36 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-06-24 18:42:33 +00:00
|
|
|
static int rx_l1_rach_conf(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
2011-06-23 21:55:20 +00:00
|
|
|
struct lapdm_entity *le = &ms->lapdm_channel.lapdm_dcch;
|
|
|
|
struct osmo_phsap_prim pp;
|
2010-06-24 18:42:33 +00:00
|
|
|
struct l1ctl_info_dl *dl;
|
|
|
|
|
2018-10-03 00:14:16 +00:00
|
|
|
if (msgb_l1len(msg) < sizeof(*dl)) {
|
|
|
|
LOGP(DL1C, LOGL_ERROR, "RACH CONF MSG too short "
|
|
|
|
"(len=%u), missing DL info header\n", msgb_l1len(msg));
|
2010-07-13 14:12:54 +00:00
|
|
|
msgb_free(msg);
|
2010-06-24 18:42:33 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
dl = (struct l1ctl_info_dl *) msg->l1h;
|
2014-08-21 03:30:22 +00:00
|
|
|
msg->l2h = msg->l3h = dl->payload;
|
2010-06-24 18:42:33 +00:00
|
|
|
|
2011-06-23 21:55:20 +00:00
|
|
|
osmo_prim_init(&pp.oph, SAP_GSM_PH, PRIM_PH_RACH,
|
|
|
|
PRIM_OP_CONFIRM, msg);
|
|
|
|
pp.u.rach_ind.fn = ntohl(dl->frame_nr);
|
2010-06-24 18:42:33 +00:00
|
|
|
|
2011-06-23 21:55:20 +00:00
|
|
|
return lapdm_phsap_up(&pp.oph, le);
|
2010-06-24 18:42:33 +00:00
|
|
|
}
|
|
|
|
|
2010-03-03 13:22:04 +00:00
|
|
|
/* Receive L1CTL_DATA_IND (Data Indication from L1) */
|
2010-03-02 17:47:01 +00:00
|
|
|
static int rx_ph_data_ind(struct osmocom_ms *ms, struct msgb *msg)
|
2010-02-18 15:46:36 +00:00
|
|
|
{
|
2011-06-23 21:55:20 +00:00
|
|
|
struct osmo_phsap_prim pp;
|
2011-06-22 21:01:18 +00:00
|
|
|
struct l1ctl_info_dl *dl;
|
2010-03-02 17:47:01 +00:00
|
|
|
struct l1ctl_data_ind *ccch;
|
|
|
|
struct lapdm_entity *le;
|
2010-07-16 10:52:38 +00:00
|
|
|
struct rx_meas_stat *meas = &ms->meas;
|
2010-03-04 14:41:11 +00:00
|
|
|
uint8_t chan_type, chan_ts, chan_ss;
|
|
|
|
uint8_t gsmtap_chan_type;
|
2020-02-28 13:22:44 +00:00
|
|
|
uint8_t bs_ag_blks_res;
|
2010-03-07 19:42:17 +00:00
|
|
|
struct gsm_time tm;
|
2010-02-18 15:46:36 +00:00
|
|
|
|
2018-10-03 00:14:16 +00:00
|
|
|
if (msgb_l1len(msg) < sizeof(*dl)) {
|
|
|
|
LOGP(DL1C, LOGL_ERROR, "DATA IND MSG too short (len=%u), "
|
|
|
|
"missing UL info header\n", msgb_l1len(msg));
|
2010-05-22 10:46:20 +00:00
|
|
|
msgb_free(msg);
|
2010-02-18 15:46:36 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2010-03-02 17:47:01 +00:00
|
|
|
dl = (struct l1ctl_info_dl *) msg->l1h;
|
2010-03-21 04:57:28 +00:00
|
|
|
msg->l2h = dl->payload;
|
2010-03-02 17:47:01 +00:00
|
|
|
ccch = (struct l1ctl_data_ind *) msg->l2h;
|
2010-03-04 14:41:11 +00:00
|
|
|
|
2010-03-07 19:42:17 +00:00
|
|
|
gsm_fn2gsmtime(&tm, ntohl(dl->frame_nr));
|
2010-03-04 14:41:11 +00:00
|
|
|
rsl_dec_chan_nr(dl->chan_nr, &chan_type, &chan_ss, &chan_ts);
|
2010-08-01 10:13:26 +00:00
|
|
|
DEBUGP(DL1C, "%s (%.4u/%.2u/%.2u) %d dBm: %s\n",
|
2010-07-25 11:34:53 +00:00
|
|
|
rsl_chan_nr_str(dl->chan_nr), tm.t1, tm.t2, tm.t3,
|
2010-08-01 10:13:26 +00:00
|
|
|
(int)dl->rx_level-110,
|
2011-05-15 12:23:17 +00:00
|
|
|
osmo_hexdump(ccch->data, sizeof(ccch->data)));
|
2010-02-18 15:46:36 +00:00
|
|
|
|
2010-08-14 17:10:26 +00:00
|
|
|
meas->last_fn = ntohl(dl->frame_nr);
|
2010-07-16 10:52:38 +00:00
|
|
|
meas->frames++;
|
2010-08-14 17:10:26 +00:00
|
|
|
meas->snr += dl->snr;
|
2010-07-16 10:52:38 +00:00
|
|
|
meas->berr += dl->num_biterr;
|
|
|
|
meas->rxlev += dl->rx_level;
|
|
|
|
|
2010-10-12 08:26:48 +00:00
|
|
|
/* counting loss criteria */
|
|
|
|
if (!(dl->link_id & 0x40)) {
|
|
|
|
switch (chan_type) {
|
|
|
|
case RSL_CHAN_PCH_AGCH:
|
2013-01-08 08:12:15 +00:00
|
|
|
/* only look at one CCCH frame in each 51 multiframe.
|
|
|
|
* FIXME: implement DRX
|
|
|
|
* - select correct paging block that is for us.
|
|
|
|
* - initialize ds_fail according to BS_PA_MFRMS.
|
|
|
|
*/
|
2018-10-26 22:54:15 +00:00
|
|
|
if ((meas->last_fn % 51) != 6)
|
2013-01-08 08:12:15 +00:00
|
|
|
break;
|
2010-10-12 08:26:48 +00:00
|
|
|
if (!meas->ds_fail)
|
|
|
|
break;
|
|
|
|
if (dl->fire_crc >= 2)
|
|
|
|
meas->dsc -= 4;
|
|
|
|
else
|
|
|
|
meas->dsc += 1;
|
|
|
|
if (meas->dsc > meas->ds_fail)
|
|
|
|
meas->dsc = meas->ds_fail;
|
|
|
|
if (meas->dsc < meas->ds_fail)
|
2018-09-21 14:19:46 +00:00
|
|
|
LOGP(DL1C, LOGL_INFO, "LOSS counter for CCCH %d\n", meas->dsc);
|
2010-10-12 08:26:48 +00:00
|
|
|
if (meas->dsc > 0)
|
|
|
|
break;
|
|
|
|
meas->ds_fail = 0;
|
2011-05-15 12:23:10 +00:00
|
|
|
osmo_signal_dispatch(SS_L1CTL, S_L1CTL_LOSS_IND, ms);
|
2010-10-12 08:26:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch (chan_type) {
|
|
|
|
case RSL_CHAN_Bm_ACCHs:
|
|
|
|
case RSL_CHAN_Lm_ACCHs:
|
|
|
|
case RSL_CHAN_SDCCH4_ACCH:
|
|
|
|
case RSL_CHAN_SDCCH8_ACCH:
|
|
|
|
if (!meas->rl_fail)
|
|
|
|
break;
|
|
|
|
if (dl->fire_crc >= 2)
|
|
|
|
meas->s -= 1;
|
|
|
|
else
|
|
|
|
meas->s += 2;
|
|
|
|
if (meas->s > meas->rl_fail)
|
|
|
|
meas->s = meas->rl_fail;
|
|
|
|
if (meas->s < meas->rl_fail)
|
2018-09-21 14:19:46 +00:00
|
|
|
LOGP(DL1C, LOGL_NOTICE, "LOSS counter for ACCH %d\n", meas->s);
|
2010-10-12 08:26:48 +00:00
|
|
|
if (meas->s > 0)
|
|
|
|
break;
|
|
|
|
meas->rl_fail = 0;
|
2011-05-15 12:23:10 +00:00
|
|
|
osmo_signal_dispatch(SS_L1CTL, S_L1CTL_LOSS_IND, ms);
|
2010-10-12 08:26:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dl->fire_crc >= 2) {
|
2010-05-29 11:06:10 +00:00
|
|
|
LOGP(DL1C, LOGL_NOTICE, "Dropping frame with %u bit errors\n",
|
|
|
|
dl->num_biterr);
|
2011-01-27 16:33:04 +00:00
|
|
|
msgb_free(msg);
|
2010-05-29 11:06:10 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-02-28 13:22:44 +00:00
|
|
|
/* May not be initialized in some applications (e.g. ccch_scan) */
|
|
|
|
if (ms->cellsel.si != NULL)
|
|
|
|
bs_ag_blks_res = ms->cellsel.si->bs_ag_blks_res;
|
|
|
|
else /* fall-back to 1 (this is what OsmoBTS does) */
|
|
|
|
bs_ag_blks_res = 1;
|
|
|
|
|
|
|
|
gsmtap_chan_type = chantype_rsl2gsmtap_ext(chan_type, dl->link_id, tm.fn, bs_ag_blks_res);
|
2019-12-20 15:45:21 +00:00
|
|
|
/* don't log fill frames via GSMTAP; they serve no purpose other than
|
|
|
|
* to clog up your logs */
|
|
|
|
if (!is_fill_frame(gsmtap_chan_type, ccch->data)) {
|
|
|
|
/* send CCCH data via GSMTAP */
|
|
|
|
gsmtap_send(gsmtap_inst, ntohs(dl->band_arfcn), chan_ts,
|
|
|
|
gsmtap_chan_type, chan_ss, tm.fn, dl->rx_level-110,
|
|
|
|
dl->snr, ccch->data, sizeof(ccch->data));
|
|
|
|
}
|
2010-03-02 17:47:01 +00:00
|
|
|
|
2020-03-17 11:25:01 +00:00
|
|
|
/* Do not pass PDCH and CBCH frames to LAPDm */
|
|
|
|
switch (chan_type) {
|
|
|
|
case RSL_CHAN_OSMO_PDCH:
|
|
|
|
case RSL_CHAN_OSMO_CBCH4:
|
|
|
|
case RSL_CHAN_OSMO_CBCH8:
|
|
|
|
/* TODO: pass directly to l23 application */
|
|
|
|
msgb_free(msg);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-03-02 17:47:01 +00:00
|
|
|
/* determine LAPDm entity based on SACCH or not */
|
|
|
|
if (dl->link_id & 0x40)
|
2011-05-22 18:10:34 +00:00
|
|
|
le = &ms->lapdm_channel.lapdm_acch;
|
2010-03-02 17:47:01 +00:00
|
|
|
else
|
2011-05-22 18:10:34 +00:00
|
|
|
le = &ms->lapdm_channel.lapdm_dcch;
|
2010-03-02 17:47:01 +00:00
|
|
|
|
2011-06-23 21:55:20 +00:00
|
|
|
osmo_prim_init(&pp.oph, SAP_GSM_PH, PRIM_PH_DATA,
|
2011-06-24 13:26:59 +00:00
|
|
|
PRIM_OP_INDICATION, msg);
|
2011-06-23 21:55:20 +00:00
|
|
|
pp.u.data.chan_nr = dl->chan_nr;
|
|
|
|
pp.u.data.link_id = dl->link_id;
|
2010-03-02 17:47:01 +00:00
|
|
|
|
2011-06-23 21:55:20 +00:00
|
|
|
/* send it up into LAPDm */
|
|
|
|
return lapdm_phsap_up(&pp.oph, le);
|
2010-02-18 15:46:36 +00:00
|
|
|
}
|
|
|
|
|
2010-06-26 11:12:25 +00:00
|
|
|
/* Receive L1CTL_DATA_CONF (Data Confirm from L1) */
|
|
|
|
static int rx_ph_data_conf(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
2011-06-23 21:55:20 +00:00
|
|
|
struct osmo_phsap_prim pp;
|
|
|
|
struct l1ctl_info_dl *dl = (struct l1ctl_info_dl *) msg->l1h;
|
2010-06-26 11:12:25 +00:00
|
|
|
struct lapdm_entity *le;
|
|
|
|
|
2018-10-03 00:14:16 +00:00
|
|
|
if (msgb_l1len(msg) < sizeof(*dl)) {
|
|
|
|
LOGP(DL1C, LOGL_ERROR, "DATA CONF MSG too short (len=%u), "
|
|
|
|
"missing UL info header\n", msgb_l1len(msg));
|
|
|
|
msgb_free(msg);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2011-06-23 21:55:20 +00:00
|
|
|
osmo_prim_init(&pp.oph, SAP_GSM_PH, PRIM_PH_RTS,
|
|
|
|
PRIM_OP_INDICATION, msg);
|
2010-06-26 11:12:25 +00:00
|
|
|
|
|
|
|
/* determine LAPDm entity based on SACCH or not */
|
|
|
|
if (dl->link_id & 0x40)
|
2011-05-22 18:10:34 +00:00
|
|
|
le = &ms->lapdm_channel.lapdm_acch;
|
2010-06-26 11:12:25 +00:00
|
|
|
else
|
2011-05-22 18:10:34 +00:00
|
|
|
le = &ms->lapdm_channel.lapdm_dcch;
|
2010-06-26 11:12:25 +00:00
|
|
|
|
|
|
|
/* send it up into LAPDm */
|
2011-06-23 21:55:20 +00:00
|
|
|
return lapdm_phsap_up(&pp.oph, le);
|
2010-06-26 11:12:25 +00:00
|
|
|
}
|
|
|
|
|
2010-03-03 13:22:04 +00:00
|
|
|
/* Transmit L1CTL_DATA_REQ */
|
2010-07-25 22:26:11 +00:00
|
|
|
int l1ctl_tx_data_req(struct osmocom_ms *ms, struct msgb *msg,
|
|
|
|
uint8_t chan_nr, uint8_t link_id)
|
2010-03-02 17:47:01 +00:00
|
|
|
{
|
2010-03-21 04:57:28 +00:00
|
|
|
struct l1ctl_hdr *l1h;
|
2010-03-02 17:47:01 +00:00
|
|
|
struct l1ctl_info_ul *l1i_ul;
|
2010-03-04 14:41:11 +00:00
|
|
|
uint8_t chan_type, chan_ts, chan_ss;
|
|
|
|
uint8_t gsmtap_chan_type;
|
2010-03-02 17:47:01 +00:00
|
|
|
|
2011-05-15 12:23:17 +00:00
|
|
|
DEBUGP(DL1C, "(%s)\n", osmo_hexdump(msg->l2h, msgb_l2len(msg)));
|
2010-03-03 13:00:50 +00:00
|
|
|
|
2018-10-03 00:14:16 +00:00
|
|
|
if (msgb_l2len(msg) != 23) {
|
|
|
|
LOGP(DL1C, LOGL_ERROR, "Wrong message length (len=%u), "
|
|
|
|
"DATA REQ ignored, please fix!\n", msgb_l2len(msg));
|
2010-03-03 13:00:50 +00:00
|
|
|
msgb_free(msg);
|
|
|
|
return -EINVAL;
|
2018-10-03 00:14:16 +00:00
|
|
|
}
|
2010-03-03 13:00:50 +00:00
|
|
|
|
2010-03-04 14:41:11 +00:00
|
|
|
/* send copy via GSMTAP */
|
|
|
|
rsl_dec_chan_nr(chan_nr, &chan_type, &chan_ss, &chan_ts);
|
|
|
|
gsmtap_chan_type = chantype_rsl2gsmtap(chan_type, link_id);
|
2019-12-19 17:17:01 +00:00
|
|
|
gsmtap_send(gsmtap_inst, ms->rrlayer.cd_now.arfcn | GSMTAP_ARFCN_F_UPLINK,
|
|
|
|
chan_ts, gsmtap_chan_type, chan_ss, 0, 127, 255,
|
|
|
|
msg->l2h, msgb_l2len(msg));
|
2010-03-04 14:41:11 +00:00
|
|
|
|
2010-03-02 17:47:01 +00:00
|
|
|
/* prepend uplink info header */
|
2010-03-21 04:57:28 +00:00
|
|
|
l1i_ul = (struct l1ctl_info_ul *) msgb_push(msg, sizeof(*l1i_ul));
|
2010-03-02 17:47:01 +00:00
|
|
|
|
|
|
|
l1i_ul->chan_nr = chan_nr;
|
|
|
|
l1i_ul->link_id = link_id;
|
|
|
|
|
2010-03-21 04:57:28 +00:00
|
|
|
/* prepend l1 header */
|
|
|
|
msg->l1h = msgb_push(msg, sizeof(*l1h));
|
|
|
|
l1h = (struct l1ctl_hdr *) msg->l1h;
|
|
|
|
l1h->msg_type = L1CTL_DATA_REQ;
|
|
|
|
|
2010-03-02 17:47:01 +00:00
|
|
|
return osmo_send_l1(ms, msg);
|
|
|
|
}
|
|
|
|
|
2010-05-19 19:41:24 +00:00
|
|
|
/* Transmit FBSB_REQ */
|
|
|
|
int l1ctl_tx_fbsb_req(struct osmocom_ms *ms, uint16_t arfcn,
|
2010-06-20 20:40:03 +00:00
|
|
|
uint8_t flags, uint16_t timeout, uint8_t sync_info_idx,
|
2012-11-20 09:13:44 +00:00
|
|
|
uint8_t ccch_mode, uint8_t rxlev_exp)
|
2010-03-27 10:40:21 +00:00
|
|
|
{
|
|
|
|
struct msgb *msg;
|
2010-05-19 19:41:24 +00:00
|
|
|
struct l1ctl_fbsb_req *req;
|
2010-03-27 10:40:21 +00:00
|
|
|
|
2010-09-26 22:02:32 +00:00
|
|
|
LOGP(DL1C, LOGL_INFO, "Sync Req\n");
|
2010-07-13 14:12:54 +00:00
|
|
|
|
2010-05-19 19:41:24 +00:00
|
|
|
msg = osmo_l1_alloc(L1CTL_FBSB_REQ);
|
2010-03-27 10:40:21 +00:00
|
|
|
if (!msg)
|
|
|
|
return -1;
|
|
|
|
|
2010-05-19 19:41:24 +00:00
|
|
|
req = (struct l1ctl_fbsb_req *) msgb_put(msg, sizeof(*req));
|
|
|
|
req->band_arfcn = htons(osmo_make_band_arfcn(ms, arfcn));
|
|
|
|
req->timeout = htons(timeout);
|
|
|
|
/* Threshold when to consider FB_MODE1: 4kHz - 1kHz */
|
2010-10-05 15:42:29 +00:00
|
|
|
req->freq_err_thresh1 = htons(11000 - 1000);
|
2010-05-19 19:41:24 +00:00
|
|
|
/* Threshold when to consider SCH: 1kHz - 200Hz */
|
|
|
|
req->freq_err_thresh2 = htons(1000 - 200);
|
|
|
|
/* not used yet! */
|
|
|
|
req->num_freqerr_avg = 3;
|
|
|
|
req->flags = flags;
|
|
|
|
req->sync_info_idx = sync_info_idx;
|
2010-06-20 20:40:03 +00:00
|
|
|
req->ccch_mode = ccch_mode;
|
2012-11-20 09:13:44 +00:00
|
|
|
req->rxlev_exp = rxlev_exp;
|
2010-06-20 20:40:03 +00:00
|
|
|
|
|
|
|
return osmo_send_l1(ms, msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Transmit L1CTL_CCCH_MODE_REQ */
|
|
|
|
int l1ctl_tx_ccch_mode_req(struct osmocom_ms *ms, uint8_t ccch_mode)
|
|
|
|
{
|
|
|
|
struct msgb *msg;
|
|
|
|
struct l1ctl_ccch_mode_req *req;
|
|
|
|
|
2010-09-26 22:02:32 +00:00
|
|
|
LOGP(DL1C, LOGL_INFO, "CCCH Mode Req\n");
|
2010-07-13 14:12:54 +00:00
|
|
|
|
2010-06-20 20:40:03 +00:00
|
|
|
msg = osmo_l1_alloc(L1CTL_CCCH_MODE_REQ);
|
|
|
|
if (!msg)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
req = (struct l1ctl_ccch_mode_req *) msgb_put(msg, sizeof(*req));
|
|
|
|
req->ccch_mode = ccch_mode;
|
2010-03-27 10:40:21 +00:00
|
|
|
|
|
|
|
return osmo_send_l1(ms, msg);
|
|
|
|
}
|
|
|
|
|
2010-09-26 17:06:06 +00:00
|
|
|
/* Transmit L1CTL_TCH_MODE_REQ */
|
2011-07-28 18:54:42 +00:00
|
|
|
int l1ctl_tx_tch_mode_req(struct osmocom_ms *ms, uint8_t tch_mode,
|
2020-07-30 11:28:46 +00:00
|
|
|
uint8_t audio_mode, uint8_t tch_loop_mode)
|
2010-09-26 17:06:06 +00:00
|
|
|
{
|
|
|
|
struct msgb *msg;
|
|
|
|
struct l1ctl_tch_mode_req *req;
|
|
|
|
|
2010-09-26 22:02:32 +00:00
|
|
|
LOGP(DL1C, LOGL_INFO, "TCH Mode Req\n");
|
2010-09-26 17:06:06 +00:00
|
|
|
|
|
|
|
msg = osmo_l1_alloc(L1CTL_TCH_MODE_REQ);
|
|
|
|
if (!msg)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
req = (struct l1ctl_tch_mode_req *) msgb_put(msg, sizeof(*req));
|
|
|
|
req->tch_mode = tch_mode;
|
2011-07-28 18:54:42 +00:00
|
|
|
req->audio_mode = audio_mode;
|
2020-07-30 11:28:46 +00:00
|
|
|
req->tch_loop_mode = tch_loop_mode;
|
2010-09-26 17:06:06 +00:00
|
|
|
|
|
|
|
return osmo_send_l1(ms, msg);
|
|
|
|
}
|
|
|
|
|
2010-07-13 14:12:54 +00:00
|
|
|
/* Transmit L1CTL_PARAM_REQ */
|
2018-09-06 17:36:35 +00:00
|
|
|
int l1ctl_tx_param_req(struct osmocom_ms *ms, int8_t ta, uint8_t tx_power)
|
2010-07-13 14:12:54 +00:00
|
|
|
{
|
|
|
|
struct msgb *msg;
|
|
|
|
struct l1ctl_info_ul *ul;
|
|
|
|
struct l1ctl_par_req *req;
|
|
|
|
|
|
|
|
msg = osmo_l1_alloc(L1CTL_PARAM_REQ);
|
|
|
|
if (!msg)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
DEBUGP(DL1C, "PARAM Req. ta=%d, tx_power=%d\n", ta, tx_power);
|
|
|
|
ul = (struct l1ctl_info_ul *) msgb_put(msg, sizeof(*ul));
|
|
|
|
req = (struct l1ctl_par_req *) msgb_put(msg, sizeof(*req));
|
|
|
|
req->tx_power = tx_power;
|
|
|
|
req->ta = ta;
|
|
|
|
|
|
|
|
return osmo_send_l1(ms, msg);
|
|
|
|
}
|
|
|
|
|
2010-09-11 12:10:31 +00:00
|
|
|
/* Transmit L1CTL_CRYPTO_REQ */
|
2017-12-16 10:52:31 +00:00
|
|
|
int l1ctl_tx_crypto_req(struct osmocom_ms *ms, uint8_t chan_nr,
|
|
|
|
uint8_t algo, uint8_t *key, uint8_t len)
|
2010-09-11 12:10:31 +00:00
|
|
|
{
|
|
|
|
struct msgb *msg;
|
|
|
|
struct l1ctl_info_ul *ul;
|
|
|
|
struct l1ctl_crypto_req *req;
|
|
|
|
|
|
|
|
msg = osmo_l1_alloc(L1CTL_CRYPTO_REQ);
|
|
|
|
if (!msg)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
DEBUGP(DL1C, "CRYPTO Req. algo=%d, len=%d\n", algo, len);
|
|
|
|
ul = (struct l1ctl_info_ul *) msgb_put(msg, sizeof(*ul));
|
|
|
|
req = (struct l1ctl_crypto_req *) msgb_put(msg, sizeof(*req) + len);
|
2017-12-16 10:52:31 +00:00
|
|
|
|
|
|
|
ul->chan_nr = chan_nr;
|
|
|
|
req->key_len = len;
|
2010-09-11 12:10:31 +00:00
|
|
|
req->algo = algo;
|
2017-12-16 10:52:31 +00:00
|
|
|
|
2010-09-11 12:10:31 +00:00
|
|
|
if (len)
|
|
|
|
memcpy(req->key, key, len);
|
|
|
|
|
|
|
|
return osmo_send_l1(ms, msg);
|
|
|
|
}
|
|
|
|
|
2010-03-03 13:22:04 +00:00
|
|
|
/* Transmit L1CTL_RACH_REQ */
|
2010-10-30 15:30:59 +00:00
|
|
|
int l1ctl_tx_rach_req(struct osmocom_ms *ms, uint8_t ra, uint16_t offset,
|
|
|
|
uint8_t combined)
|
2010-03-01 10:08:38 +00:00
|
|
|
{
|
|
|
|
struct msgb *msg;
|
2010-03-21 04:57:28 +00:00
|
|
|
struct l1ctl_info_ul *ul;
|
2010-03-02 17:47:01 +00:00
|
|
|
struct l1ctl_rach_req *req;
|
2010-03-01 10:08:38 +00:00
|
|
|
|
2010-03-02 17:47:01 +00:00
|
|
|
msg = osmo_l1_alloc(L1CTL_RACH_REQ);
|
2010-03-01 10:08:38 +00:00
|
|
|
if (!msg)
|
|
|
|
return -1;
|
|
|
|
|
2010-10-30 15:30:59 +00:00
|
|
|
DEBUGP(DL1C, "RACH Req. offset=%d combined=%d\n", offset, combined);
|
2010-03-21 04:57:28 +00:00
|
|
|
ul = (struct l1ctl_info_ul *) msgb_put(msg, sizeof(*ul));
|
2010-03-02 17:47:01 +00:00
|
|
|
req = (struct l1ctl_rach_req *) msgb_put(msg, sizeof(*req));
|
2010-07-13 14:12:54 +00:00
|
|
|
req->ra = ra;
|
2010-10-30 15:30:59 +00:00
|
|
|
req->offset = htons(offset);
|
|
|
|
req->combined = combined;
|
2010-03-01 10:08:38 +00:00
|
|
|
|
|
|
|
return osmo_send_l1(ms, msg);
|
|
|
|
}
|
|
|
|
|
2010-03-03 13:22:04 +00:00
|
|
|
/* Transmit L1CTL_DM_EST_REQ */
|
2010-07-25 22:26:11 +00:00
|
|
|
int l1ctl_tx_dm_est_req_h0(struct osmocom_ms *ms, uint16_t band_arfcn,
|
2011-07-28 18:54:42 +00:00
|
|
|
uint8_t chan_nr, uint8_t tsc, uint8_t tch_mode,
|
|
|
|
uint8_t audio_mode)
|
2010-03-02 17:47:01 +00:00
|
|
|
{
|
|
|
|
struct msgb *msg;
|
|
|
|
struct l1ctl_info_ul *ul;
|
|
|
|
struct l1ctl_dm_est_req *req;
|
|
|
|
|
|
|
|
msg = osmo_l1_alloc(L1CTL_DM_EST_REQ);
|
|
|
|
if (!msg)
|
|
|
|
return -1;
|
|
|
|
|
2010-09-26 22:02:32 +00:00
|
|
|
LOGP(DL1C, LOGL_INFO, "Tx Dedic.Mode Est Req (arfcn=%u, "
|
|
|
|
"chan_nr=0x%02x)\n", band_arfcn, chan_nr);
|
2010-06-21 19:59:43 +00:00
|
|
|
|
2010-03-21 04:57:28 +00:00
|
|
|
ul = (struct l1ctl_info_ul *) msgb_put(msg, sizeof(*ul));
|
2010-03-02 17:47:01 +00:00
|
|
|
ul->chan_nr = chan_nr;
|
|
|
|
ul->link_id = 0;
|
2010-06-21 19:59:43 +00:00
|
|
|
|
2010-03-02 17:47:01 +00:00
|
|
|
req = (struct l1ctl_dm_est_req *) msgb_put(msg, sizeof(*req));
|
2010-06-24 16:56:36 +00:00
|
|
|
req->tsc = tsc;
|
2010-06-21 19:59:43 +00:00
|
|
|
req->h = 0;
|
|
|
|
req->h0.band_arfcn = htons(band_arfcn);
|
2010-09-26 20:55:02 +00:00
|
|
|
req->tch_mode = tch_mode;
|
2011-07-28 18:54:42 +00:00
|
|
|
req->audio_mode = audio_mode;
|
2010-03-02 17:47:01 +00:00
|
|
|
|
|
|
|
return osmo_send_l1(ms, msg);
|
|
|
|
}
|
2010-02-18 15:46:36 +00:00
|
|
|
|
2010-07-25 22:26:11 +00:00
|
|
|
int l1ctl_tx_dm_est_req_h1(struct osmocom_ms *ms, uint8_t maio, uint8_t hsn,
|
|
|
|
uint16_t *ma, uint8_t ma_len,
|
2011-07-28 18:54:42 +00:00
|
|
|
uint8_t chan_nr, uint8_t tsc, uint8_t tch_mode,
|
|
|
|
uint8_t audio_mode)
|
2010-06-28 13:33:14 +00:00
|
|
|
{
|
|
|
|
struct msgb *msg;
|
|
|
|
struct l1ctl_info_ul *ul;
|
|
|
|
struct l1ctl_dm_est_req *req;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
msg = osmo_l1_alloc(L1CTL_DM_EST_REQ);
|
|
|
|
if (!msg)
|
|
|
|
return -1;
|
|
|
|
|
2010-09-26 22:02:32 +00:00
|
|
|
LOGP(DL1C, LOGL_INFO, "Tx Dedic.Mode Est Req (maio=%u, hsn=%u, "
|
2010-06-28 13:33:14 +00:00
|
|
|
"chan_nr=0x%02x)\n", maio, hsn, chan_nr);
|
|
|
|
|
|
|
|
ul = (struct l1ctl_info_ul *) msgb_put(msg, sizeof(*ul));
|
|
|
|
ul->chan_nr = chan_nr;
|
|
|
|
ul->link_id = 0;
|
|
|
|
|
|
|
|
req = (struct l1ctl_dm_est_req *) msgb_put(msg, sizeof(*req));
|
|
|
|
req->tsc = tsc;
|
|
|
|
req->h = 1;
|
|
|
|
req->h1.maio = maio;
|
|
|
|
req->h1.hsn = hsn;
|
2010-08-21 15:06:46 +00:00
|
|
|
req->h1.n = ma_len;
|
|
|
|
for (i = 0; i < ma_len; i++)
|
|
|
|
req->h1.ma[i] = htons(ma[i]);
|
2010-09-26 20:55:02 +00:00
|
|
|
req->tch_mode = tch_mode;
|
2011-07-28 18:54:42 +00:00
|
|
|
req->audio_mode = audio_mode;
|
2010-08-21 15:06:46 +00:00
|
|
|
|
|
|
|
return osmo_send_l1(ms, msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Transmit L1CTL_DM_FREQ_REQ */
|
|
|
|
int l1ctl_tx_dm_freq_req_h0(struct osmocom_ms *ms, uint16_t band_arfcn,
|
|
|
|
uint8_t tsc, uint16_t fn)
|
|
|
|
{
|
|
|
|
struct msgb *msg;
|
|
|
|
struct l1ctl_info_ul *ul;
|
|
|
|
struct l1ctl_dm_freq_req *req;
|
|
|
|
|
|
|
|
msg = osmo_l1_alloc(L1CTL_DM_FREQ_REQ);
|
|
|
|
if (!msg)
|
|
|
|
return -1;
|
|
|
|
|
2010-09-26 22:02:32 +00:00
|
|
|
LOGP(DL1C, LOGL_INFO, "Tx Dedic.Mode Freq Req (arfcn=%u, fn=%d)\n",
|
2010-08-21 15:06:46 +00:00
|
|
|
band_arfcn, fn);
|
|
|
|
|
|
|
|
ul = (struct l1ctl_info_ul *) msgb_put(msg, sizeof(*ul));
|
|
|
|
ul->chan_nr = 0;
|
|
|
|
ul->link_id = 0;
|
|
|
|
|
|
|
|
req = (struct l1ctl_dm_freq_req *) msgb_put(msg, sizeof(*req));
|
|
|
|
req->fn = htons(fn);
|
|
|
|
req->tsc = tsc;
|
|
|
|
req->h = 0;
|
|
|
|
req->h0.band_arfcn = htons(band_arfcn);
|
|
|
|
|
|
|
|
return osmo_send_l1(ms, msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
int l1ctl_tx_dm_freq_req_h1(struct osmocom_ms *ms, uint8_t maio, uint8_t hsn,
|
|
|
|
uint16_t *ma, uint8_t ma_len,
|
|
|
|
uint8_t tsc, uint16_t fn)
|
|
|
|
{
|
|
|
|
struct msgb *msg;
|
|
|
|
struct l1ctl_info_ul *ul;
|
|
|
|
struct l1ctl_dm_freq_req *req;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
msg = osmo_l1_alloc(L1CTL_DM_FREQ_REQ);
|
|
|
|
if (!msg)
|
|
|
|
return -1;
|
|
|
|
|
2010-09-26 22:02:32 +00:00
|
|
|
LOGP(DL1C, LOGL_INFO, "Tx Dedic.Mode Freq Req (maio=%u, hsn=%u, "
|
2010-08-21 15:06:46 +00:00
|
|
|
"fn=%d)\n", maio, hsn, fn);
|
|
|
|
|
|
|
|
ul = (struct l1ctl_info_ul *) msgb_put(msg, sizeof(*ul));
|
|
|
|
ul->chan_nr = 0;
|
|
|
|
ul->link_id = 0;
|
|
|
|
|
|
|
|
req = (struct l1ctl_dm_freq_req *) msgb_put(msg, sizeof(*req));
|
|
|
|
req->fn = htons(fn);
|
|
|
|
req->tsc = tsc;
|
|
|
|
req->h = 1;
|
|
|
|
req->h1.maio = maio;
|
|
|
|
req->h1.hsn = hsn;
|
2010-06-28 13:33:14 +00:00
|
|
|
req->h1.n = ma_len;
|
|
|
|
for (i = 0; i < ma_len; i++)
|
|
|
|
req->h1.ma[i] = htons(ma[i]);
|
|
|
|
|
|
|
|
return osmo_send_l1(ms, msg);
|
|
|
|
}
|
|
|
|
|
2010-06-26 09:35:27 +00:00
|
|
|
/* Transmit L1CTL_DM_REL_REQ */
|
2010-07-25 22:26:11 +00:00
|
|
|
int l1ctl_tx_dm_rel_req(struct osmocom_ms *ms)
|
2010-06-26 09:35:27 +00:00
|
|
|
{
|
|
|
|
struct msgb *msg;
|
|
|
|
struct l1ctl_info_ul *ul;
|
|
|
|
|
|
|
|
msg = osmo_l1_alloc(L1CTL_DM_REL_REQ);
|
|
|
|
if (!msg)
|
|
|
|
return -1;
|
|
|
|
|
2010-09-26 22:02:32 +00:00
|
|
|
LOGP(DL1C, LOGL_INFO, "Tx Dedic.Mode Rel Req\n");
|
2010-06-26 09:35:27 +00:00
|
|
|
|
|
|
|
ul = (struct l1ctl_info_ul *) msgb_put(msg, sizeof(*ul));
|
|
|
|
|
|
|
|
return osmo_send_l1(ms, msg);
|
|
|
|
}
|
|
|
|
|
2010-03-27 04:32:10 +00:00
|
|
|
int l1ctl_tx_echo_req(struct osmocom_ms *ms, unsigned int len)
|
|
|
|
{
|
|
|
|
struct msgb *msg;
|
|
|
|
uint8_t *data;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
msg = osmo_l1_alloc(L1CTL_ECHO_REQ);
|
|
|
|
if (!msg)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
data = msgb_put(msg, len);
|
|
|
|
for (i = 0; i < len; i++)
|
|
|
|
data[i] = i % 8;
|
|
|
|
|
|
|
|
return osmo_send_l1(ms, msg);
|
|
|
|
}
|
|
|
|
|
2010-09-18 19:15:15 +00:00
|
|
|
int l1ctl_tx_sim_req(struct osmocom_ms *ms, uint8_t *data, uint16_t length)
|
|
|
|
{
|
|
|
|
struct msgb *msg;
|
|
|
|
uint8_t *dat;
|
|
|
|
|
|
|
|
msg = osmo_l1_alloc(L1CTL_SIM_REQ);
|
|
|
|
if (!msg)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
dat = msgb_put(msg, length);
|
|
|
|
memcpy(dat, data, length);
|
|
|
|
|
|
|
|
return osmo_send_l1(ms, msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* just forward the SIM response to the SIM handler */
|
|
|
|
static int rx_l1_sim_conf(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
2018-10-02 23:04:59 +00:00
|
|
|
uint16_t len = msgb_l2len(msg);
|
|
|
|
uint8_t *data = msg->data;
|
2013-01-12 07:59:05 +00:00
|
|
|
|
2011-05-15 12:23:17 +00:00
|
|
|
LOGP(DL1C, LOGL_INFO, "SIM %s\n", osmo_hexdump(data, len));
|
2010-09-18 19:15:15 +00:00
|
|
|
|
|
|
|
sim_apdu_resp(ms, msg);
|
2019-12-20 15:46:10 +00:00
|
|
|
|
2010-09-18 19:15:15 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-03-27 10:40:21 +00:00
|
|
|
/* Transmit L1CTL_PM_REQ */
|
|
|
|
int l1ctl_tx_pm_req_range(struct osmocom_ms *ms, uint16_t arfcn_from,
|
|
|
|
uint16_t arfcn_to)
|
2010-03-27 04:32:10 +00:00
|
|
|
{
|
|
|
|
struct msgb *msg;
|
2010-03-27 10:40:21 +00:00
|
|
|
struct l1ctl_pm_req *pm;
|
2010-03-27 04:32:10 +00:00
|
|
|
|
2010-03-27 10:40:21 +00:00
|
|
|
msg = osmo_l1_alloc(L1CTL_PM_REQ);
|
2010-03-27 04:32:10 +00:00
|
|
|
if (!msg)
|
|
|
|
return -1;
|
|
|
|
|
2010-09-26 22:02:32 +00:00
|
|
|
LOGP(DL1C, LOGL_INFO, "Tx PM Req (%u-%u)\n", arfcn_from, arfcn_to);
|
2010-03-27 10:40:21 +00:00
|
|
|
pm = (struct l1ctl_pm_req *) msgb_put(msg, sizeof(*pm));
|
|
|
|
pm->type = 1;
|
|
|
|
pm->range.band_arfcn_from = htons(arfcn_from);
|
|
|
|
pm->range.band_arfcn_to = htons(arfcn_to);
|
2010-03-27 04:32:10 +00:00
|
|
|
|
|
|
|
return osmo_send_l1(ms, msg);
|
|
|
|
}
|
|
|
|
|
2010-06-26 11:12:25 +00:00
|
|
|
/* Transmit L1CTL_RESET_REQ */
|
|
|
|
int l1ctl_tx_reset_req(struct osmocom_ms *ms, uint8_t type)
|
|
|
|
{
|
|
|
|
struct msgb *msg;
|
|
|
|
struct l1ctl_reset *res;
|
|
|
|
|
|
|
|
msg = osmo_l1_alloc(L1CTL_RESET_REQ);
|
|
|
|
if (!msg)
|
|
|
|
return -1;
|
|
|
|
|
2010-09-26 22:02:32 +00:00
|
|
|
LOGP(DL1C, LOGL_INFO, "Tx Reset Req (%u)\n", type);
|
2010-06-26 11:12:25 +00:00
|
|
|
res = (struct l1ctl_reset *) msgb_put(msg, sizeof(*res));
|
|
|
|
res->type = type;
|
|
|
|
|
|
|
|
return osmo_send_l1(ms, msg);
|
|
|
|
}
|
|
|
|
|
2010-06-20 16:21:01 +00:00
|
|
|
/* Receive L1CTL_RESET_IND */
|
2010-03-27 10:40:21 +00:00
|
|
|
static int rx_l1_reset(struct osmocom_ms *ms)
|
|
|
|
{
|
2010-09-26 22:02:32 +00:00
|
|
|
LOGP(DL1C, LOGL_INFO, "Layer1 Reset indication\n");
|
2011-05-15 12:23:10 +00:00
|
|
|
osmo_signal_dispatch(SS_L1CTL, S_L1CTL_RESET, ms);
|
2010-05-22 10:46:20 +00:00
|
|
|
|
|
|
|
return 0;
|
2010-03-27 10:40:21 +00:00
|
|
|
}
|
|
|
|
|
2010-06-20 17:10:21 +00:00
|
|
|
/* Receive L1CTL_PM_CONF */
|
|
|
|
static int rx_l1_pm_conf(struct osmocom_ms *ms, struct msgb *msg)
|
2010-03-27 10:40:21 +00:00
|
|
|
{
|
2010-06-20 17:10:21 +00:00
|
|
|
struct l1ctl_pm_conf *pmr;
|
2010-03-27 10:40:21 +00:00
|
|
|
|
2018-10-03 00:14:16 +00:00
|
|
|
if (msgb_l1len(msg) < sizeof(*pmr)) {
|
|
|
|
LOGP(DL1C, LOGL_ERROR, "PM CONF MSG too short (len=%u), "
|
|
|
|
"missing measurement results\n", msgb_l1len(msg));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2010-06-20 17:10:21 +00:00
|
|
|
for (pmr = (struct l1ctl_pm_conf *) msg->l1h;
|
2010-03-27 10:40:21 +00:00
|
|
|
(uint8_t *) pmr < msg->tail; pmr++) {
|
2010-04-05 13:28:59 +00:00
|
|
|
struct osmobb_meas_res mr;
|
2010-03-27 10:40:21 +00:00
|
|
|
DEBUGP(DL1C, "PM MEAS: ARFCN: %4u RxLev: %3d %3d\n",
|
|
|
|
ntohs(pmr->band_arfcn), pmr->pm[0], pmr->pm[1]);
|
2010-04-05 13:28:59 +00:00
|
|
|
mr.band_arfcn = ntohs(pmr->band_arfcn);
|
2010-07-22 16:14:40 +00:00
|
|
|
mr.rx_lev = pmr->pm[0];
|
2010-04-05 13:28:59 +00:00
|
|
|
mr.ms = ms;
|
2011-05-15 12:23:10 +00:00
|
|
|
osmo_signal_dispatch(SS_L1CTL, S_L1CTL_PM_RES, &mr);
|
2010-03-27 10:40:21 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2010-03-27 04:32:10 +00:00
|
|
|
|
2010-09-26 17:06:06 +00:00
|
|
|
/* Receive L1CTL_CCCH_MODE_CONF */
|
2010-06-28 13:33:14 +00:00
|
|
|
static int rx_l1_ccch_mode_conf(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct osmobb_ccch_mode_conf mc;
|
|
|
|
struct l1ctl_ccch_mode_conf *conf;
|
|
|
|
|
2018-10-03 00:14:16 +00:00
|
|
|
if (msgb_l1len(msg) < sizeof(*conf)) {
|
|
|
|
LOGP(DL1C, LOGL_ERROR, "CCCH MODE CONF: MSG too short "
|
|
|
|
"(len=%u), missing CCCH mode info\n", msgb_l1len(msg));
|
2010-06-28 13:33:14 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
conf = (struct l1ctl_ccch_mode_conf *) msg->l1h;
|
|
|
|
|
2010-09-26 22:02:32 +00:00
|
|
|
LOGP(DL1C, LOGL_INFO, "CCCH MODE CONF: mode=%u\n", conf->ccch_mode);
|
2010-06-28 13:33:14 +00:00
|
|
|
|
|
|
|
mc.ccch_mode = conf->ccch_mode;
|
|
|
|
mc.ms = ms;
|
2011-05-15 12:23:10 +00:00
|
|
|
osmo_signal_dispatch(SS_L1CTL, S_L1CTL_CCCH_MODE_CONF, &mc);
|
2010-06-28 13:33:14 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-09-26 17:06:06 +00:00
|
|
|
/* Receive L1CTL_TCH_MODE_CONF */
|
|
|
|
static int rx_l1_tch_mode_conf(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct osmobb_tch_mode_conf mc;
|
|
|
|
struct l1ctl_tch_mode_conf *conf;
|
|
|
|
|
2018-10-03 00:14:16 +00:00
|
|
|
if (msgb_l1len(msg) < sizeof(*conf)) {
|
|
|
|
LOGP(DL1C, LOGL_ERROR, "TCH MODE CONF: MSG too short "
|
|
|
|
"(len=%u), missing TCH mode info\n", msgb_l1len(msg));
|
2010-09-26 17:06:06 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
conf = (struct l1ctl_tch_mode_conf *) msg->l1h;
|
|
|
|
|
2010-09-26 22:02:32 +00:00
|
|
|
LOGP(DL1C, LOGL_INFO, "TCH MODE CONF: mode=%u\n", conf->tch_mode);
|
2010-09-26 17:06:06 +00:00
|
|
|
|
|
|
|
mc.tch_mode = conf->tch_mode;
|
2011-07-28 18:54:42 +00:00
|
|
|
mc.audio_mode = conf->audio_mode;
|
2010-09-26 17:06:06 +00:00
|
|
|
mc.ms = ms;
|
2011-05-15 12:23:10 +00:00
|
|
|
osmo_signal_dispatch(SS_L1CTL, S_L1CTL_TCH_MODE_CONF, &mc);
|
2010-09-26 17:06:06 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-07-28 18:54:42 +00:00
|
|
|
/* Receive L1CTL_TRAFFIC_IND (Traffic Indication from L1) */
|
|
|
|
static int rx_l1_traffic_ind(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct l1ctl_info_dl *dl;
|
|
|
|
struct l1ctl_traffic_ind *ti;
|
2018-05-11 19:04:53 +00:00
|
|
|
size_t frame_len;
|
|
|
|
uint8_t *frame;
|
2011-07-28 18:54:42 +00:00
|
|
|
|
2018-10-03 00:14:16 +00:00
|
|
|
if (msgb_l1len(msg) < sizeof(*dl)) {
|
|
|
|
LOGP(DL1C, LOGL_ERROR, "TRAFFIC IND MSG too short "
|
|
|
|
"(len=%u), missing DL info header\n", msgb_l1len(msg));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2011-07-28 18:54:42 +00:00
|
|
|
/* Header handling */
|
|
|
|
dl = (struct l1ctl_info_dl *) msg->l1h;
|
2018-05-11 19:04:53 +00:00
|
|
|
ti = (struct l1ctl_traffic_ind *) dl->payload;
|
|
|
|
frame = (uint8_t *) ti->data;
|
|
|
|
|
2011-07-28 18:54:42 +00:00
|
|
|
msg->l2h = dl->payload;
|
2018-05-11 19:04:53 +00:00
|
|
|
msg->l3h = frame;
|
|
|
|
|
|
|
|
/* Calculate the frame length */
|
|
|
|
frame_len = msgb_l3len(msg);
|
2011-07-28 18:54:42 +00:00
|
|
|
|
2018-05-11 19:04:53 +00:00
|
|
|
DEBUGP(DL1C, "TRAFFIC IND len=%zu (%s)\n", frame_len,
|
|
|
|
osmo_hexdump(frame, frame_len));
|
2011-07-28 18:54:42 +00:00
|
|
|
|
|
|
|
/* distribute or drop */
|
2018-10-02 23:04:59 +00:00
|
|
|
if (ms->l1_entity.l1_traffic_ind)
|
2011-07-28 18:54:42 +00:00
|
|
|
return ms->l1_entity.l1_traffic_ind(ms, msg);
|
|
|
|
|
|
|
|
msgb_free(msg);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Transmit L1CTL_TRAFFIC_REQ (Traffic Request to L1) */
|
|
|
|
int l1ctl_tx_traffic_req(struct osmocom_ms *ms, struct msgb *msg,
|
|
|
|
uint8_t chan_nr, uint8_t link_id)
|
|
|
|
{
|
|
|
|
struct l1ctl_hdr *l1h;
|
|
|
|
struct l1ctl_info_ul *l1i_ul;
|
|
|
|
struct l1ctl_traffic_req *tr;
|
2018-05-11 19:04:53 +00:00
|
|
|
size_t frame_len;
|
|
|
|
uint8_t *frame;
|
2011-07-28 18:54:42 +00:00
|
|
|
|
|
|
|
/* Header handling */
|
|
|
|
tr = (struct l1ctl_traffic_req *) msg->l2h;
|
2018-05-11 19:04:53 +00:00
|
|
|
frame = (uint8_t *) tr->data;
|
|
|
|
msg->l3h = frame;
|
2011-07-28 18:54:42 +00:00
|
|
|
|
2018-05-11 19:04:53 +00:00
|
|
|
/* Calculate the frame length */
|
|
|
|
frame_len = msgb_l3len(msg);
|
2011-07-28 18:54:42 +00:00
|
|
|
|
2018-05-11 19:04:53 +00:00
|
|
|
DEBUGP(DL1C, "TRAFFIC REQ len=%zu (%s)\n", frame_len,
|
|
|
|
osmo_hexdump(frame, frame_len));
|
2011-07-28 18:54:42 +00:00
|
|
|
|
2018-05-11 19:04:53 +00:00
|
|
|
// printf("TX %s\n", osmo_hexdump(frame, frame_len));
|
2011-07-28 18:54:42 +00:00
|
|
|
|
|
|
|
/* prepend uplink info header */
|
|
|
|
l1i_ul = (struct l1ctl_info_ul *) msgb_push(msg, sizeof(*l1i_ul));
|
|
|
|
|
|
|
|
l1i_ul->chan_nr = chan_nr;
|
|
|
|
l1i_ul->link_id = link_id;
|
|
|
|
|
|
|
|
/* prepend l1 header */
|
|
|
|
msg->l1h = msgb_push(msg, sizeof(*l1h));
|
|
|
|
l1h = (struct l1ctl_hdr *) msg->l1h;
|
|
|
|
l1h->msg_type = L1CTL_TRAFFIC_REQ;
|
|
|
|
|
|
|
|
return osmo_send_l1(ms, msg);
|
|
|
|
}
|
|
|
|
|
2011-07-17 07:36:49 +00:00
|
|
|
/* Transmit L1CTL_NEIGH_PM_REQ */
|
|
|
|
int l1ctl_tx_neigh_pm_req(struct osmocom_ms *ms, int num, uint16_t *arfcn)
|
|
|
|
{
|
|
|
|
struct msgb *msg;
|
|
|
|
struct l1ctl_neigh_pm_req *pm_req;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
msg = osmo_l1_alloc(L1CTL_NEIGH_PM_REQ);
|
|
|
|
if (!msg)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
LOGP(DL1C, LOGL_INFO, "Tx NEIGH PM Req (num %u)\n", num);
|
|
|
|
pm_req = (struct l1ctl_neigh_pm_req *) msgb_put(msg, sizeof(*pm_req));
|
|
|
|
pm_req->n = num;
|
2012-03-29 07:20:07 +00:00
|
|
|
for (i = 0; i < num; i++) {
|
2011-07-17 07:36:49 +00:00
|
|
|
pm_req->band_arfcn[i] = htons(*arfcn++);
|
2012-03-29 07:20:07 +00:00
|
|
|
pm_req->tn[i] = 0;
|
|
|
|
}
|
2011-07-17 07:36:49 +00:00
|
|
|
|
|
|
|
return osmo_send_l1(ms, msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Receive L1CTL_NEIGH_PM_IND */
|
|
|
|
static int rx_l1_neigh_pm_ind(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct l1ctl_neigh_pm_ind *pm_ind;
|
|
|
|
|
2018-10-03 00:14:16 +00:00
|
|
|
if (msgb_l1len(msg) < sizeof(*pm_ind)) {
|
|
|
|
LOGP(DL1C, LOGL_ERROR, "NEIGH PH IND MSG too short "
|
|
|
|
"(len=%u), missing measurement results\n", msgb_l1len(msg));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2011-07-17 07:36:49 +00:00
|
|
|
for (pm_ind = (struct l1ctl_neigh_pm_ind *) msg->l1h;
|
|
|
|
(uint8_t *) pm_ind < msg->tail; pm_ind++) {
|
|
|
|
struct osmobb_neigh_pm_ind mi;
|
|
|
|
DEBUGP(DL1C, "NEIGH_PM IND: ARFCN: %4u RxLev: %3d %3d\n",
|
|
|
|
ntohs(pm_ind->band_arfcn), pm_ind->pm[0],
|
|
|
|
pm_ind->pm[1]);
|
|
|
|
mi.band_arfcn = ntohs(pm_ind->band_arfcn);
|
|
|
|
mi.rx_lev = pm_ind->pm[0];
|
|
|
|
mi.ms = ms;
|
|
|
|
osmo_signal_dispatch(SS_L1CTL, S_L1CTL_NEIGH_PM_IND, &mi);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-03-03 13:22:04 +00:00
|
|
|
/* Receive incoming data from L1 using L1CTL format */
|
|
|
|
int l1ctl_recv(struct osmocom_ms *ms, struct msgb *msg)
|
2010-02-18 15:46:36 +00:00
|
|
|
{
|
|
|
|
int rc = 0;
|
2018-10-02 23:27:22 +00:00
|
|
|
struct l1ctl_hdr *hdr;
|
2010-02-18 15:46:36 +00:00
|
|
|
|
2018-10-02 23:22:16 +00:00
|
|
|
/* Make sure a message has L1CTL header (pointed by msg->l1h) */
|
2018-10-02 23:27:22 +00:00
|
|
|
if (msgb_l1len(msg) < sizeof(*hdr)) {
|
2018-10-02 23:22:16 +00:00
|
|
|
LOGP(DL1C, LOGL_ERROR, "Short L1CTL message, "
|
|
|
|
"missing the header (len=%u)\n", msgb_l1len(msg));
|
2010-05-22 10:46:20 +00:00
|
|
|
msgb_free(msg);
|
2010-02-18 15:46:36 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2018-10-02 23:04:59 +00:00
|
|
|
/* Pull the L1CTL header from the msgb */
|
2018-10-02 23:27:22 +00:00
|
|
|
hdr = (struct l1ctl_hdr *) msg->l1h;
|
2018-10-02 23:04:59 +00:00
|
|
|
msgb_pull(msg, sizeof(struct l1ctl_hdr));
|
2010-03-21 04:57:28 +00:00
|
|
|
|
|
|
|
/* move the l1 header pointer to point _BEHIND_ l1ctl_hdr,
|
|
|
|
as the l1ctl header is of no interest to subsequent code */
|
2018-10-02 23:27:22 +00:00
|
|
|
msg->l1h = hdr->data;
|
2010-02-18 15:46:36 +00:00
|
|
|
|
2018-10-02 23:27:22 +00:00
|
|
|
switch (hdr->msg_type) {
|
2010-06-20 17:10:21 +00:00
|
|
|
case L1CTL_FBSB_CONF:
|
|
|
|
rc = rx_l1_fbsb_conf(ms, msg);
|
2010-05-22 10:46:20 +00:00
|
|
|
msgb_free(msg);
|
2010-02-18 15:46:36 +00:00
|
|
|
break;
|
2010-03-02 17:47:01 +00:00
|
|
|
case L1CTL_DATA_IND:
|
|
|
|
rc = rx_ph_data_ind(ms, msg);
|
2010-02-18 15:46:36 +00:00
|
|
|
break;
|
2010-06-26 11:12:25 +00:00
|
|
|
case L1CTL_DATA_CONF:
|
|
|
|
rc = rx_ph_data_conf(ms, msg);
|
|
|
|
break;
|
2010-06-20 16:21:01 +00:00
|
|
|
case L1CTL_RESET_IND:
|
2010-06-26 11:12:25 +00:00
|
|
|
case L1CTL_RESET_CONF:
|
2010-03-02 17:47:01 +00:00
|
|
|
rc = rx_l1_reset(ms);
|
2010-05-22 10:46:20 +00:00
|
|
|
msgb_free(msg);
|
2010-02-18 15:46:36 +00:00
|
|
|
break;
|
2010-06-20 17:10:21 +00:00
|
|
|
case L1CTL_PM_CONF:
|
|
|
|
rc = rx_l1_pm_conf(ms, msg);
|
2018-10-02 23:27:22 +00:00
|
|
|
if (hdr->flags & L1CTL_F_DONE)
|
2011-05-15 12:23:10 +00:00
|
|
|
osmo_signal_dispatch(SS_L1CTL, S_L1CTL_PM_DONE, ms);
|
2010-11-13 18:23:57 +00:00
|
|
|
msgb_free(msg);
|
2010-03-27 10:40:21 +00:00
|
|
|
break;
|
2010-06-20 17:42:49 +00:00
|
|
|
case L1CTL_RACH_CONF:
|
2010-06-24 18:42:33 +00:00
|
|
|
rc = rx_l1_rach_conf(ms, msg);
|
2010-06-20 17:42:49 +00:00
|
|
|
break;
|
2010-06-28 13:33:14 +00:00
|
|
|
case L1CTL_CCCH_MODE_CONF:
|
|
|
|
rc = rx_l1_ccch_mode_conf(ms, msg);
|
|
|
|
msgb_free(msg);
|
|
|
|
break;
|
2010-09-26 17:06:06 +00:00
|
|
|
case L1CTL_TCH_MODE_CONF:
|
|
|
|
rc = rx_l1_tch_mode_conf(ms, msg);
|
|
|
|
msgb_free(msg);
|
|
|
|
break;
|
2010-09-18 19:15:15 +00:00
|
|
|
case L1CTL_SIM_CONF:
|
|
|
|
rc = rx_l1_sim_conf(ms, msg);
|
|
|
|
break;
|
2011-07-17 07:36:49 +00:00
|
|
|
case L1CTL_NEIGH_PM_IND:
|
|
|
|
rc = rx_l1_neigh_pm_ind(ms, msg);
|
|
|
|
msgb_free(msg);
|
|
|
|
break;
|
2011-07-28 18:54:42 +00:00
|
|
|
case L1CTL_TRAFFIC_IND:
|
|
|
|
rc = rx_l1_traffic_ind(ms, msg);
|
|
|
|
break;
|
|
|
|
case L1CTL_TRAFFIC_CONF:
|
|
|
|
msgb_free(msg);
|
|
|
|
break;
|
2010-02-18 15:46:36 +00:00
|
|
|
default:
|
2018-10-02 23:27:22 +00:00
|
|
|
LOGP(DL1C, LOGL_ERROR, "Unknown MSG: %u\n", hdr->msg_type);
|
2010-05-22 10:46:20 +00:00
|
|
|
msgb_free(msg);
|
2010-02-18 15:46:36 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|