1 /* Layer1 control code, talking L1CTL protocol with L1 on the phone */
3 /* (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org>
4 * (C) 2010 by Harald Welte <laforge@gnumonks.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 #include <arpa/inet.h>
31 #include <l1ctl_proto.h>
33 #include <osmocom/core/signal.h>
34 #include <osmocom/core/logging.h>
35 #include <osmocom/core/timer.h>
36 #include <osmocom/core/msgb.h>
37 #include <osmocom/gsm/tlv.h>
38 #include <osmocom/gsm/gsm_utils.h>
39 #include <osmocom/core/gsmtap_util.h>
40 #include <osmocom/gsm/protocol/gsm_04_08.h>
41 #include <osmocom/gsm/protocol/gsm_08_58.h>
42 #include <osmocom/gsm/rsl.h>
44 #include <osmocom/bb/common/l1ctl.h>
45 #include <osmocom/bb/common/osmocom_data.h>
46 #include <osmocom/bb/common/l1l2_interface.h>
47 #include <osmocom/bb/common/lapdm.h>
48 #include <osmocom/bb/common/logging.h>
50 static struct msgb *osmo_l1_alloc(uint8_t msg_type)
52 struct l1ctl_hdr *l1h;
53 struct msgb *msg = msgb_alloc_headroom(256, 4, "osmo_l1");
56 LOGP(DL1C, LOGL_ERROR, "Failed to allocate memory.\n");
60 msg->l1h = msgb_put(msg, sizeof(*l1h));
61 l1h = (struct l1ctl_hdr *) msg->l1h;
62 l1h->msg_type = msg_type;
68 static int osmo_make_band_arfcn(struct osmocom_ms *ms, uint16_t arfcn)
70 /* TODO: Include the band */
74 static int rx_l1_fbsb_conf(struct osmocom_ms *ms, struct msgb *msg)
76 struct l1ctl_info_dl *dl;
77 struct l1ctl_fbsb_conf *sb;
79 struct osmobb_fbsb_res fr;
81 if (msgb_l3len(msg) < sizeof(*dl) + sizeof(*sb)) {
82 LOGP(DL1C, LOGL_ERROR, "FBSB RESP: MSG too short %u\n",
87 dl = (struct l1ctl_info_dl *) msg->l1h;
88 sb = (struct l1ctl_fbsb_conf *) dl->payload;
90 LOGP(DL1C, LOGL_INFO, "snr=%04x, arfcn=%u result=%u\n", dl->snr,
91 ntohs(dl->band_arfcn), sb->result);
93 if (sb->result != 0) {
94 LOGP(DL1C, LOGL_ERROR, "FBSB RESP: result=%u\n", sb->result);
95 osmo_signal_dispatch(SS_L1CTL, S_L1CTL_FBSB_ERR, ms);
99 gsm_fn2gsmtime(&tm, ntohl(dl->frame_nr));
100 DEBUGP(DL1C, "SCH: SNR: %u TDMA: (%.4u/%.2u/%.2u) bsic: %d\n",
101 dl->snr, tm.t1, tm.t2, tm.t3, sb->bsic);
105 osmo_signal_dispatch(SS_L1CTL, S_L1CTL_FBSB_RESP, &fr);
110 static int rx_l1_rach_conf(struct osmocom_ms *ms, struct msgb *msg)
112 struct l1ctl_info_dl *dl;
114 if (msgb_l2len(msg) < sizeof(*dl)) {
115 LOGP(DL1C, LOGL_ERROR, "RACH CONF: MSG too short %u\n",
121 dl = (struct l1ctl_info_dl *) msg->l1h;
123 l2_ph_chan_conf(msg, ms, dl);
128 /* Receive L1CTL_DATA_IND (Data Indication from L1) */
129 static int rx_ph_data_ind(struct osmocom_ms *ms, struct msgb *msg)
131 struct l1ctl_info_dl *dl, dl_cpy;
132 struct l1ctl_data_ind *ccch;
133 struct lapdm_entity *le;
134 struct rx_meas_stat *meas = &ms->meas;
135 uint8_t chan_type, chan_ts, chan_ss;
136 uint8_t gsmtap_chan_type;
139 if (msgb_l3len(msg) < sizeof(*ccch)) {
140 LOGP(DL1C, LOGL_ERROR, "MSG too short Data Ind: %u\n",
146 dl = (struct l1ctl_info_dl *) msg->l1h;
147 msg->l2h = dl->payload;
148 ccch = (struct l1ctl_data_ind *) msg->l2h;
150 gsm_fn2gsmtime(&tm, ntohl(dl->frame_nr));
151 rsl_dec_chan_nr(dl->chan_nr, &chan_type, &chan_ss, &chan_ts);
152 DEBUGP(DL1C, "%s (%.4u/%.2u/%.2u) %d dBm: %s\n",
153 rsl_chan_nr_str(dl->chan_nr), tm.t1, tm.t2, tm.t3,
154 (int)dl->rx_level-110,
155 hexdump(ccch->data, sizeof(ccch->data)));
157 meas->last_fn = ntohl(dl->frame_nr);
159 meas->snr += dl->snr;
160 meas->berr += dl->num_biterr;
161 meas->rxlev += dl->rx_level;
163 /* counting loss criteria */
164 if (!(dl->link_id & 0x40)) {
166 case RSL_CHAN_PCH_AGCH:
169 if (dl->fire_crc >= 2)
173 if (meas->dsc > meas->ds_fail)
174 meas->dsc = meas->ds_fail;
175 if (meas->dsc < meas->ds_fail)
176 printf("LOSS counter for CCCH %d\n", meas->dsc);
180 osmo_signal_dispatch(SS_L1CTL, S_L1CTL_LOSS_IND, ms);
185 case RSL_CHAN_Bm_ACCHs:
186 case RSL_CHAN_Lm_ACCHs:
187 case RSL_CHAN_SDCCH4_ACCH:
188 case RSL_CHAN_SDCCH8_ACCH:
191 if (dl->fire_crc >= 2)
195 if (meas->s > meas->rl_fail)
196 meas->s = meas->rl_fail;
197 if (meas->s < meas->rl_fail)
198 printf("LOSS counter for ACCH %d\n", meas->s);
202 osmo_signal_dispatch(SS_L1CTL, S_L1CTL_LOSS_IND, ms);
207 if (dl->fire_crc >= 2) {
208 printf("Dropping frame with %u bit errors\n", dl->num_biterr);
209 LOGP(DL1C, LOGL_NOTICE, "Dropping frame with %u bit errors\n",
215 /* send CCCH data via GSMTAP */
216 gsmtap_chan_type = chantype_rsl2gsmtap(chan_type, dl->link_id);
217 gsmtap_sendmsg(ntohs(dl->band_arfcn), chan_ts, gsmtap_chan_type, chan_ss,
218 tm.fn, dl->rx_level-110, dl->snr, ccch->data,
221 /* determine LAPDm entity based on SACCH or not */
222 if (dl->link_id & 0x40)
223 le = &ms->l2_entity.lapdm_acch;
225 le = &ms->l2_entity.lapdm_dcch;
226 /* make local stack copy of l1ctl_info_dl, as LAPDm will
227 * overwrite skb hdr */
228 memcpy(&dl_cpy, dl, sizeof(dl_cpy));
230 /* pull the L1 header from the msgb */
231 msgb_pull(msg, msg->l2h - (msg->l1h-sizeof(struct l1ctl_hdr)));
234 /* send it up into LAPDm */
235 l2_ph_data_ind(msg, le, &dl_cpy);
240 /* Receive L1CTL_DATA_CONF (Data Confirm from L1) */
241 static int rx_ph_data_conf(struct osmocom_ms *ms, struct msgb *msg)
243 struct l1ctl_info_dl *dl;
244 struct lapdm_entity *le;
246 dl = (struct l1ctl_info_dl *) msg->l1h;
248 /* determine LAPDm entity based on SACCH or not */
249 if (dl->link_id & 0x40)
250 le = &ms->l2_entity.lapdm_acch;
252 le = &ms->l2_entity.lapdm_dcch;
254 /* send it up into LAPDm */
255 l2_ph_data_conf(msg, le);
260 /* Transmit L1CTL_DATA_REQ */
261 int l1ctl_tx_data_req(struct osmocom_ms *ms, struct msgb *msg,
262 uint8_t chan_nr, uint8_t link_id)
264 struct l1ctl_hdr *l1h;
265 struct l1ctl_info_ul *l1i_ul;
266 uint8_t chan_type, chan_ts, chan_ss;
267 uint8_t gsmtap_chan_type;
269 DEBUGP(DL1C, "(%s)\n", hexdump(msg->l2h, msgb_l2len(msg)));
271 if (msgb_l2len(msg) > 23) {
272 LOGP(DL1C, LOGL_ERROR, "L1 cannot handle message length "
273 "> 23 (%u)\n", msgb_l2len(msg));
276 } else if (msgb_l2len(msg) < 23)
277 LOGP(DL1C, LOGL_ERROR, "L1 message length < 23 (%u) "
278 "doesn't seem right!\n", msgb_l2len(msg));
280 /* send copy via GSMTAP */
281 rsl_dec_chan_nr(chan_nr, &chan_type, &chan_ss, &chan_ts);
282 gsmtap_chan_type = chantype_rsl2gsmtap(chan_type, link_id);
283 gsmtap_sendmsg(0|0x4000, chan_ts, gsmtap_chan_type, chan_ss,
284 0, 127, 255, msg->l2h, msgb_l2len(msg));
286 /* prepend uplink info header */
287 l1i_ul = (struct l1ctl_info_ul *) msgb_push(msg, sizeof(*l1i_ul));
289 l1i_ul->chan_nr = chan_nr;
290 l1i_ul->link_id = link_id;
292 /* prepend l1 header */
293 msg->l1h = msgb_push(msg, sizeof(*l1h));
294 l1h = (struct l1ctl_hdr *) msg->l1h;
295 l1h->msg_type = L1CTL_DATA_REQ;
297 return osmo_send_l1(ms, msg);
300 /* Transmit FBSB_REQ */
301 int l1ctl_tx_fbsb_req(struct osmocom_ms *ms, uint16_t arfcn,
302 uint8_t flags, uint16_t timeout, uint8_t sync_info_idx,
306 struct l1ctl_fbsb_req *req;
308 LOGP(DL1C, LOGL_INFO, "Sync Req\n");
310 msg = osmo_l1_alloc(L1CTL_FBSB_REQ);
314 req = (struct l1ctl_fbsb_req *) msgb_put(msg, sizeof(*req));
315 req->band_arfcn = htons(osmo_make_band_arfcn(ms, arfcn));
316 req->timeout = htons(timeout);
317 /* Threshold when to consider FB_MODE1: 4kHz - 1kHz */
318 req->freq_err_thresh1 = htons(11000 - 1000);
319 /* Threshold when to consider SCH: 1kHz - 200Hz */
320 req->freq_err_thresh2 = htons(1000 - 200);
322 req->num_freqerr_avg = 3;
324 req->sync_info_idx = sync_info_idx;
325 req->ccch_mode = ccch_mode;
327 return osmo_send_l1(ms, msg);
330 /* Transmit L1CTL_CCCH_MODE_REQ */
331 int l1ctl_tx_ccch_mode_req(struct osmocom_ms *ms, uint8_t ccch_mode)
334 struct l1ctl_ccch_mode_req *req;
336 LOGP(DL1C, LOGL_INFO, "CCCH Mode Req\n");
338 msg = osmo_l1_alloc(L1CTL_CCCH_MODE_REQ);
342 req = (struct l1ctl_ccch_mode_req *) msgb_put(msg, sizeof(*req));
343 req->ccch_mode = ccch_mode;
345 return osmo_send_l1(ms, msg);
348 /* Transmit L1CTL_TCH_MODE_REQ */
349 int l1ctl_tx_tch_mode_req(struct osmocom_ms *ms, uint8_t tch_mode)
352 struct l1ctl_tch_mode_req *req;
354 LOGP(DL1C, LOGL_INFO, "TCH Mode Req\n");
356 msg = osmo_l1_alloc(L1CTL_TCH_MODE_REQ);
360 req = (struct l1ctl_tch_mode_req *) msgb_put(msg, sizeof(*req));
361 req->tch_mode = tch_mode;
363 return osmo_send_l1(ms, msg);
366 /* Transmit L1CTL_PARAM_REQ */
367 int l1ctl_tx_param_req(struct osmocom_ms *ms, uint8_t ta, uint8_t tx_power)
370 struct l1ctl_info_ul *ul;
371 struct l1ctl_par_req *req;
373 msg = osmo_l1_alloc(L1CTL_PARAM_REQ);
377 DEBUGP(DL1C, "PARAM Req. ta=%d, tx_power=%d\n", ta, tx_power);
378 ul = (struct l1ctl_info_ul *) msgb_put(msg, sizeof(*ul));
379 req = (struct l1ctl_par_req *) msgb_put(msg, sizeof(*req));
380 req->tx_power = tx_power;
383 return osmo_send_l1(ms, msg);
386 /* Transmit L1CTL_CRYPTO_REQ */
387 int l1ctl_tx_crypto_req(struct osmocom_ms *ms, uint8_t algo, uint8_t *key,
391 struct l1ctl_info_ul *ul;
392 struct l1ctl_crypto_req *req;
394 msg = osmo_l1_alloc(L1CTL_CRYPTO_REQ);
398 DEBUGP(DL1C, "CRYPTO Req. algo=%d, len=%d\n", algo, len);
399 ul = (struct l1ctl_info_ul *) msgb_put(msg, sizeof(*ul));
400 req = (struct l1ctl_crypto_req *) msgb_put(msg, sizeof(*req) + len);
403 memcpy(req->key, key, len);
405 return osmo_send_l1(ms, msg);
408 /* Transmit L1CTL_RACH_REQ */
409 int l1ctl_tx_rach_req(struct osmocom_ms *ms, uint8_t ra, uint16_t offset,
413 struct l1ctl_info_ul *ul;
414 struct l1ctl_rach_req *req;
416 msg = osmo_l1_alloc(L1CTL_RACH_REQ);
420 DEBUGP(DL1C, "RACH Req. offset=%d combined=%d\n", offset, combined);
421 ul = (struct l1ctl_info_ul *) msgb_put(msg, sizeof(*ul));
422 req = (struct l1ctl_rach_req *) msgb_put(msg, sizeof(*req));
424 req->offset = htons(offset);
425 req->combined = combined;
427 return osmo_send_l1(ms, msg);
430 /* Transmit L1CTL_DM_EST_REQ */
431 int l1ctl_tx_dm_est_req_h0(struct osmocom_ms *ms, uint16_t band_arfcn,
432 uint8_t chan_nr, uint8_t tsc, uint8_t tch_mode)
435 struct l1ctl_info_ul *ul;
436 struct l1ctl_dm_est_req *req;
438 msg = osmo_l1_alloc(L1CTL_DM_EST_REQ);
442 LOGP(DL1C, LOGL_INFO, "Tx Dedic.Mode Est Req (arfcn=%u, "
443 "chan_nr=0x%02x)\n", band_arfcn, chan_nr);
445 ul = (struct l1ctl_info_ul *) msgb_put(msg, sizeof(*ul));
446 ul->chan_nr = chan_nr;
449 req = (struct l1ctl_dm_est_req *) msgb_put(msg, sizeof(*req));
452 req->h0.band_arfcn = htons(band_arfcn);
453 req->tch_mode = tch_mode;
455 return osmo_send_l1(ms, msg);
458 int l1ctl_tx_dm_est_req_h1(struct osmocom_ms *ms, uint8_t maio, uint8_t hsn,
459 uint16_t *ma, uint8_t ma_len,
460 uint8_t chan_nr, uint8_t tsc, uint8_t tch_mode)
463 struct l1ctl_info_ul *ul;
464 struct l1ctl_dm_est_req *req;
467 msg = osmo_l1_alloc(L1CTL_DM_EST_REQ);
471 LOGP(DL1C, LOGL_INFO, "Tx Dedic.Mode Est Req (maio=%u, hsn=%u, "
472 "chan_nr=0x%02x)\n", maio, hsn, chan_nr);
474 ul = (struct l1ctl_info_ul *) msgb_put(msg, sizeof(*ul));
475 ul->chan_nr = chan_nr;
478 req = (struct l1ctl_dm_est_req *) msgb_put(msg, sizeof(*req));
484 for (i = 0; i < ma_len; i++)
485 req->h1.ma[i] = htons(ma[i]);
486 req->tch_mode = tch_mode;
488 return osmo_send_l1(ms, msg);
491 /* Transmit L1CTL_DM_FREQ_REQ */
492 int l1ctl_tx_dm_freq_req_h0(struct osmocom_ms *ms, uint16_t band_arfcn,
493 uint8_t tsc, uint16_t fn)
496 struct l1ctl_info_ul *ul;
497 struct l1ctl_dm_freq_req *req;
499 msg = osmo_l1_alloc(L1CTL_DM_FREQ_REQ);
503 LOGP(DL1C, LOGL_INFO, "Tx Dedic.Mode Freq Req (arfcn=%u, fn=%d)\n",
506 ul = (struct l1ctl_info_ul *) msgb_put(msg, sizeof(*ul));
510 req = (struct l1ctl_dm_freq_req *) msgb_put(msg, sizeof(*req));
514 req->h0.band_arfcn = htons(band_arfcn);
516 return osmo_send_l1(ms, msg);
519 int l1ctl_tx_dm_freq_req_h1(struct osmocom_ms *ms, uint8_t maio, uint8_t hsn,
520 uint16_t *ma, uint8_t ma_len,
521 uint8_t tsc, uint16_t fn)
524 struct l1ctl_info_ul *ul;
525 struct l1ctl_dm_freq_req *req;
528 msg = osmo_l1_alloc(L1CTL_DM_FREQ_REQ);
532 LOGP(DL1C, LOGL_INFO, "Tx Dedic.Mode Freq Req (maio=%u, hsn=%u, "
533 "fn=%d)\n", maio, hsn, fn);
535 ul = (struct l1ctl_info_ul *) msgb_put(msg, sizeof(*ul));
539 req = (struct l1ctl_dm_freq_req *) msgb_put(msg, sizeof(*req));
546 for (i = 0; i < ma_len; i++)
547 req->h1.ma[i] = htons(ma[i]);
549 return osmo_send_l1(ms, msg);
552 /* Transmit L1CTL_DM_REL_REQ */
553 int l1ctl_tx_dm_rel_req(struct osmocom_ms *ms)
556 struct l1ctl_info_ul *ul;
558 msg = osmo_l1_alloc(L1CTL_DM_REL_REQ);
562 LOGP(DL1C, LOGL_INFO, "Tx Dedic.Mode Rel Req\n");
564 ul = (struct l1ctl_info_ul *) msgb_put(msg, sizeof(*ul));
566 return osmo_send_l1(ms, msg);
569 int l1ctl_tx_echo_req(struct osmocom_ms *ms, unsigned int len)
575 msg = osmo_l1_alloc(L1CTL_ECHO_REQ);
579 data = msgb_put(msg, len);
580 for (i = 0; i < len; i++)
583 return osmo_send_l1(ms, msg);
586 int l1ctl_tx_sim_req(struct osmocom_ms *ms, uint8_t *data, uint16_t length)
591 msg = osmo_l1_alloc(L1CTL_SIM_REQ);
595 dat = msgb_put(msg, length);
596 memcpy(dat, data, length);
598 return osmo_send_l1(ms, msg);
601 /* just forward the SIM response to the SIM handler */
602 static int rx_l1_sim_conf(struct osmocom_ms *ms, struct msgb *msg)
604 uint16_t len = msg->len - sizeof(struct l1ctl_hdr);
605 uint8_t *data = msg->data + sizeof(struct l1ctl_hdr);
607 LOGP(DL1C, LOGL_INFO, "SIM %s\n", hexdump(data, len));
609 /* pull the L1 header from the msgb */
610 msgb_pull(msg, sizeof(struct l1ctl_hdr));
613 sim_apdu_resp(ms, msg);
618 /* Transmit L1CTL_PM_REQ */
619 int l1ctl_tx_pm_req_range(struct osmocom_ms *ms, uint16_t arfcn_from,
623 struct l1ctl_pm_req *pm;
625 msg = osmo_l1_alloc(L1CTL_PM_REQ);
629 LOGP(DL1C, LOGL_INFO, "Tx PM Req (%u-%u)\n", arfcn_from, arfcn_to);
630 pm = (struct l1ctl_pm_req *) msgb_put(msg, sizeof(*pm));
632 pm->range.band_arfcn_from = htons(arfcn_from);
633 pm->range.band_arfcn_to = htons(arfcn_to);
635 return osmo_send_l1(ms, msg);
638 /* Transmit L1CTL_RESET_REQ */
639 int l1ctl_tx_reset_req(struct osmocom_ms *ms, uint8_t type)
642 struct l1ctl_reset *res;
644 msg = osmo_l1_alloc(L1CTL_RESET_REQ);
648 LOGP(DL1C, LOGL_INFO, "Tx Reset Req (%u)\n", type);
649 res = (struct l1ctl_reset *) msgb_put(msg, sizeof(*res));
652 return osmo_send_l1(ms, msg);
655 /* Receive L1CTL_RESET_IND */
656 static int rx_l1_reset(struct osmocom_ms *ms)
658 LOGP(DL1C, LOGL_INFO, "Layer1 Reset indication\n");
659 osmo_signal_dispatch(SS_L1CTL, S_L1CTL_RESET, ms);
664 /* Receive L1CTL_PM_CONF */
665 static int rx_l1_pm_conf(struct osmocom_ms *ms, struct msgb *msg)
667 struct l1ctl_pm_conf *pmr;
669 for (pmr = (struct l1ctl_pm_conf *) msg->l1h;
670 (uint8_t *) pmr < msg->tail; pmr++) {
671 struct osmobb_meas_res mr;
672 DEBUGP(DL1C, "PM MEAS: ARFCN: %4u RxLev: %3d %3d\n",
673 ntohs(pmr->band_arfcn), pmr->pm[0], pmr->pm[1]);
674 mr.band_arfcn = ntohs(pmr->band_arfcn);
675 mr.rx_lev = pmr->pm[0];
677 osmo_signal_dispatch(SS_L1CTL, S_L1CTL_PM_RES, &mr);
682 /* Receive L1CTL_CCCH_MODE_CONF */
683 static int rx_l1_ccch_mode_conf(struct osmocom_ms *ms, struct msgb *msg)
685 struct osmobb_ccch_mode_conf mc;
686 struct l1ctl_ccch_mode_conf *conf;
688 if (msgb_l3len(msg) < sizeof(*conf)) {
689 LOGP(DL1C, LOGL_ERROR, "CCCH MODE CONF: MSG too short %u\n",
694 conf = (struct l1ctl_ccch_mode_conf *) msg->l1h;
696 LOGP(DL1C, LOGL_INFO, "CCCH MODE CONF: mode=%u\n", conf->ccch_mode);
698 mc.ccch_mode = conf->ccch_mode;
700 osmo_signal_dispatch(SS_L1CTL, S_L1CTL_CCCH_MODE_CONF, &mc);
705 /* Receive L1CTL_TCH_MODE_CONF */
706 static int rx_l1_tch_mode_conf(struct osmocom_ms *ms, struct msgb *msg)
708 struct osmobb_tch_mode_conf mc;
709 struct l1ctl_tch_mode_conf *conf;
711 if (msgb_l3len(msg) < sizeof(*conf)) {
712 LOGP(DL1C, LOGL_ERROR, "TCH MODE CONF: MSG too short %u\n",
717 conf = (struct l1ctl_tch_mode_conf *) msg->l1h;
719 LOGP(DL1C, LOGL_INFO, "TCH MODE CONF: mode=%u\n", conf->tch_mode);
721 mc.tch_mode = conf->tch_mode;
723 osmo_signal_dispatch(SS_L1CTL, S_L1CTL_TCH_MODE_CONF, &mc);
728 /* Receive incoming data from L1 using L1CTL format */
729 int l1ctl_recv(struct osmocom_ms *ms, struct msgb *msg)
732 struct l1ctl_hdr *l1h;
733 struct l1ctl_info_dl *dl;
735 if (msgb_l2len(msg) < sizeof(*dl)) {
736 LOGP(DL1C, LOGL_ERROR, "Short Layer2 message: %u\n",
742 l1h = (struct l1ctl_hdr *) msg->l1h;
744 /* move the l1 header pointer to point _BEHIND_ l1ctl_hdr,
745 as the l1ctl header is of no interest to subsequent code */
746 msg->l1h = l1h->data;
748 switch (l1h->msg_type) {
749 case L1CTL_FBSB_CONF:
750 rc = rx_l1_fbsb_conf(ms, msg);
754 rc = rx_ph_data_ind(ms, msg);
756 case L1CTL_DATA_CONF:
757 rc = rx_ph_data_conf(ms, msg);
759 case L1CTL_RESET_IND:
760 case L1CTL_RESET_CONF:
761 rc = rx_l1_reset(ms);
765 rc = rx_l1_pm_conf(ms, msg);
766 if (l1h->flags & L1CTL_F_DONE)
767 osmo_signal_dispatch(SS_L1CTL, S_L1CTL_PM_DONE, ms);
770 case L1CTL_RACH_CONF:
771 rc = rx_l1_rach_conf(ms, msg);
773 case L1CTL_CCCH_MODE_CONF:
774 rc = rx_l1_ccch_mode_conf(ms, msg);
777 case L1CTL_TCH_MODE_CONF:
778 rc = rx_l1_tch_mode_conf(ms, msg);
782 rc = rx_l1_sim_conf(ms, msg);
785 LOGP(DL1C, LOGL_ERROR, "Unknown MSG: %u\n", l1h->msg_type);