Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 1 | /* pcu_l1_if.cpp |
| 2 | * |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 3 | * Copyright (C) 2012 Andreas Eversberg <jolly@eversberg.eu> |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 4 | * |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License |
| 7 | * as published by the Free Software Foundation; either version 2 |
| 8 | * of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 | */ |
| 19 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 20 | #include <stdio.h> |
| 21 | #include <unistd.h> |
| 22 | #include <stdlib.h> |
Andreas Eversberg | 0aed654 | 2012-06-23 10:33:16 +0200 | [diff] [blame] | 23 | #include <string.h> |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 24 | #include <errno.h> |
| 25 | #include <assert.h> |
Andreas Eversberg | 0aed654 | 2012-06-23 10:33:16 +0200 | [diff] [blame] | 26 | #include <sys/socket.h> |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 27 | #include <sys/un.h> |
Andreas Eversberg | 81a12be | 2013-03-16 16:16:41 +0100 | [diff] [blame^] | 28 | #include <arpa/inet.h> |
Andreas Eversberg | 0aed654 | 2012-06-23 10:33:16 +0200 | [diff] [blame] | 29 | extern "C" { |
| 30 | #include <osmocom/core/talloc.h> |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 31 | #include <osmocom/core/select.h> |
| 32 | #include <osmocom/core/msgb.h> |
Andreas Eversberg | 0aed654 | 2012-06-23 10:33:16 +0200 | [diff] [blame] | 33 | } |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 34 | |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 35 | #include <gprs_rlcmac.h> |
| 36 | #include <pcu_l1_if.h> |
| 37 | #include <gprs_debug.h> |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 38 | #include <gprs_bssgp_pcu.h> |
| 39 | #include <pcuif_proto.h> |
Andreas Eversberg | 0aed654 | 2012-06-23 10:33:16 +0200 | [diff] [blame] | 40 | |
Andreas Eversberg | a23c7ee | 2012-12-18 10:47:28 +0100 | [diff] [blame] | 41 | // FIXME: move this, when changed from c++ to c. |
| 42 | extern "C" { |
| 43 | void *l1if_open_pdch(void *priv, uint32_t hlayer1); |
Andreas Eversberg | a23c7ee | 2012-12-18 10:47:28 +0100 | [diff] [blame] | 44 | int l1if_connect_pdch(void *obj, uint8_t ts); |
| 45 | int l1if_pdch_req(void *obj, uint8_t ts, int is_ptcch, uint32_t fn, |
| 46 | uint16_t arfcn, uint8_t block_nr, uint8_t *data, uint8_t len); |
| 47 | } |
| 48 | |
Andreas Eversberg | e266bd4 | 2012-07-13 14:00:21 +0200 | [diff] [blame] | 49 | extern void *tall_pcu_ctx; |
| 50 | |
Ivan Kluchnikov | 4277f0c | 2012-04-12 14:24:35 +0400 | [diff] [blame] | 51 | // Variable for storage current FN. |
| 52 | int frame_number; |
| 53 | |
| 54 | int get_current_fn() |
| 55 | { |
| 56 | return frame_number; |
| 57 | } |
| 58 | |
| 59 | void set_current_fn(int fn) |
| 60 | { |
| 61 | frame_number = fn; |
| 62 | } |
Ivan Kluchnikov | e3a0596 | 2012-03-18 15:48:51 +0400 | [diff] [blame] | 63 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 64 | /* |
| 65 | * PCU messages |
| 66 | */ |
Ivan Kluchnikov | e3a0596 | 2012-03-18 15:48:51 +0400 | [diff] [blame] | 67 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 68 | struct msgb *pcu_msgb_alloc(uint8_t msg_type, uint8_t bts_nr) |
| 69 | { |
| 70 | struct msgb *msg; |
| 71 | struct gsm_pcu_if *pcu_prim; |
| 72 | |
| 73 | msg = msgb_alloc(sizeof(struct gsm_pcu_if), "pcu_sock_tx"); |
| 74 | if (!msg) |
| 75 | return NULL; |
| 76 | msgb_put(msg, sizeof(struct gsm_pcu_if)); |
| 77 | pcu_prim = (struct gsm_pcu_if *) msg->data; |
| 78 | pcu_prim->msg_type = msg_type; |
| 79 | pcu_prim->bts_nr = bts_nr; |
Ivan Kluchnikov | e3a0596 | 2012-03-18 15:48:51 +0400 | [diff] [blame] | 80 | |
| 81 | return msg; |
| 82 | } |
| 83 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 84 | static int pcu_tx_act_req(uint8_t trx, uint8_t ts, uint8_t activate) |
Ivan Kluchnikov | 4277f0c | 2012-04-12 14:24:35 +0400 | [diff] [blame] | 85 | { |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 86 | struct msgb *msg; |
| 87 | struct gsm_pcu_if *pcu_prim; |
| 88 | struct gsm_pcu_if_act_req *act_req; |
| 89 | |
| 90 | LOGP(DL1IF, LOGL_INFO, "Sending %s request: trx=%d ts=%d\n", |
| 91 | (activate) ? "activate" : "deactivate", trx, ts); |
| 92 | |
| 93 | msg = pcu_msgb_alloc(PCU_IF_MSG_ACT_REQ, 0); |
| 94 | if (!msg) |
| 95 | return -ENOMEM; |
| 96 | pcu_prim = (struct gsm_pcu_if *) msg->data; |
| 97 | act_req = &pcu_prim->u.act_req; |
| 98 | act_req->activate = activate; |
| 99 | act_req->trx_nr = trx; |
| 100 | act_req->ts_nr = ts; |
| 101 | |
| 102 | return pcu_sock_send(msg); |
| 103 | } |
| 104 | |
| 105 | static int pcu_tx_data_req(uint8_t trx, uint8_t ts, uint8_t sapi, |
| 106 | uint16_t arfcn, uint32_t fn, uint8_t block_nr, uint8_t *data, |
| 107 | uint8_t len) |
| 108 | { |
| 109 | struct msgb *msg; |
| 110 | struct gsm_pcu_if *pcu_prim; |
| 111 | struct gsm_pcu_if_data *data_req; |
| 112 | |
| 113 | LOGP(DL1IF, LOGL_DEBUG, "Sending data request: trx=%d ts=%d sapi=%d " |
| 114 | "arfcn=%d fn=%d block=%d data=%s\n", trx, ts, sapi, arfcn, fn, |
| 115 | block_nr, osmo_hexdump(data, len)); |
| 116 | |
| 117 | msg = pcu_msgb_alloc(PCU_IF_MSG_DATA_REQ, 0); |
| 118 | if (!msg) |
| 119 | return -ENOMEM; |
| 120 | pcu_prim = (struct gsm_pcu_if *) msg->data; |
| 121 | data_req = &pcu_prim->u.data_req; |
| 122 | |
| 123 | data_req->sapi = sapi; |
| 124 | data_req->fn = fn; |
| 125 | data_req->arfcn = arfcn; |
| 126 | data_req->trx_nr = trx; |
| 127 | data_req->ts_nr = ts; |
| 128 | data_req->block_nr = block_nr; |
| 129 | memcpy(data_req->data, data, len); |
| 130 | data_req->len = len; |
| 131 | |
| 132 | return pcu_sock_send(msg); |
| 133 | } |
| 134 | |
| 135 | void pcu_l1if_tx_pdtch(msgb *msg, uint8_t trx, uint8_t ts, uint16_t arfcn, |
| 136 | uint32_t fn, uint8_t block_nr) |
| 137 | { |
Andreas Eversberg | a23c7ee | 2012-12-18 10:47:28 +0100 | [diff] [blame] | 138 | #ifdef ENABLE_SYSMODSP |
| 139 | struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts; |
| 140 | |
| 141 | if (bts->trx[trx].fl1h) |
| 142 | l1if_pdch_req(bts->trx[trx].fl1h, ts, 0, fn, arfcn, block_nr, |
| 143 | msg->data, msg->len); |
| 144 | else |
| 145 | #endif |
| 146 | pcu_tx_data_req(trx, ts, PCU_IF_SAPI_PDTCH, arfcn, fn, block_nr, |
| 147 | msg->data, msg->len); |
Andreas Eversberg | 0aed654 | 2012-06-23 10:33:16 +0200 | [diff] [blame] | 148 | msgb_free(msg); |
Ivan Kluchnikov | 4277f0c | 2012-04-12 14:24:35 +0400 | [diff] [blame] | 149 | } |
| 150 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 151 | void pcu_l1if_tx_ptcch(msgb *msg, uint8_t trx, uint8_t ts, uint16_t arfcn, |
| 152 | uint32_t fn, uint8_t block_nr) |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 153 | { |
Andreas Eversberg | a23c7ee | 2012-12-18 10:47:28 +0100 | [diff] [blame] | 154 | #ifdef ENABLE_SYSMODSP |
| 155 | struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts; |
| 156 | |
| 157 | if (bts->trx[trx].fl1h) |
| 158 | l1if_pdch_req(bts->trx[trx].fl1h, ts, 1, fn, arfcn, block_nr, |
| 159 | msg->data, msg->len); |
| 160 | else |
| 161 | #endif |
| 162 | pcu_tx_data_req(trx, ts, PCU_IF_SAPI_PTCCH, arfcn, fn, block_nr, |
| 163 | msg->data, msg->len); |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 164 | msgb_free(msg); |
| 165 | } |
| 166 | |
Andreas Eversberg | 7b04501 | 2012-07-05 07:38:49 +0200 | [diff] [blame] | 167 | void pcu_l1if_tx_agch(bitvec * block, int plen) |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 168 | { |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 169 | uint8_t data[23]; /* prefix PLEN */ |
Ivan Kluchnikov | e3a0596 | 2012-03-18 15:48:51 +0400 | [diff] [blame] | 170 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 171 | /* FIXME: why does OpenBTS has no PLEN and no fill in message? */ |
| 172 | bitvec_pack(block, data + 1); |
| 173 | data[0] = (plen << 2) | 0x01; |
| 174 | pcu_tx_data_req(0, 0, PCU_IF_SAPI_AGCH, 0, 0, 0, data, 23); |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 175 | } |
| 176 | |
Andreas Eversberg | e13fa2d | 2012-07-09 17:10:44 +0200 | [diff] [blame] | 177 | void pcu_l1if_tx_pch(bitvec * block, int plen, char *imsi) |
Ivan Kluchnikov | c7e7f68 | 2012-06-29 22:53:15 +0400 | [diff] [blame] | 178 | { |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 179 | uint8_t data[23+3]; /* prefix PLEN */ |
| 180 | |
| 181 | /* paging group */ |
| 182 | if (!imsi || strlen(imsi) < 3) |
| 183 | return; |
| 184 | imsi += strlen(imsi) - 3; |
| 185 | data[0] = imsi[0]; |
| 186 | data[1] = imsi[1]; |
| 187 | data[2] = imsi[2]; |
| 188 | |
| 189 | bitvec_pack(block, data + 3+1); |
| 190 | data[3] = (plen << 2) | 0x01; |
| 191 | pcu_tx_data_req(0, 0, PCU_IF_SAPI_PCH, 0, 0, 0, data, 23+3); |
Ivan Kluchnikov | c7e7f68 | 2012-06-29 22:53:15 +0400 | [diff] [blame] | 192 | } |
| 193 | |
Andreas Eversberg | a23c7ee | 2012-12-18 10:47:28 +0100 | [diff] [blame] | 194 | // FIXME: remove this, when changed from c++ to c. |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 195 | static void pcu_l1if_tx_bcch(uint8_t *data, int len) |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 196 | { |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 197 | pcu_tx_data_req(0, 0, PCU_IF_SAPI_BCCH, 0, 0, 0, data, len); |
Ivan Kluchnikov | e3a0596 | 2012-03-18 15:48:51 +0400 | [diff] [blame] | 198 | } |
| 199 | |
Andreas Eversberg | a23c7ee | 2012-12-18 10:47:28 +0100 | [diff] [blame] | 200 | extern "C" int pcu_rx_data_ind_pdtch(uint8_t trx, uint8_t ts, uint8_t *data, |
Andreas Eversberg | 570b44b | 2013-03-16 16:15:01 +0100 | [diff] [blame] | 201 | uint8_t len, uint32_t fn, int8_t rssi) |
Andreas Eversberg | a23c7ee | 2012-12-18 10:47:28 +0100 | [diff] [blame] | 202 | { |
Andreas Eversberg | 570b44b | 2013-03-16 16:15:01 +0100 | [diff] [blame] | 203 | return gprs_rlcmac_rcv_block(trx, ts, data, len, fn, rssi); |
Andreas Eversberg | a23c7ee | 2012-12-18 10:47:28 +0100 | [diff] [blame] | 204 | } |
| 205 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 206 | static int pcu_rx_data_ind(struct gsm_pcu_if_data *data_ind) |
Ivan Kluchnikov | e3a0596 | 2012-03-18 15:48:51 +0400 | [diff] [blame] | 207 | { |
| 208 | int rc = 0; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 209 | |
| 210 | LOGP(DL1IF, LOGL_DEBUG, "Data indication received: sapi=%d arfcn=%d " |
| 211 | "block=%d data=%s\n", data_ind->sapi, |
| 212 | data_ind->arfcn, data_ind->block_nr, |
| 213 | osmo_hexdump(data_ind->data, data_ind->len)); |
| 214 | |
Ivan Kluchnikov | e3a0596 | 2012-03-18 15:48:51 +0400 | [diff] [blame] | 215 | switch (data_ind->sapi) { |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 216 | case PCU_IF_SAPI_PDTCH: |
Andreas Eversberg | a23c7ee | 2012-12-18 10:47:28 +0100 | [diff] [blame] | 217 | rc = pcu_rx_data_ind_pdtch(data_ind->trx_nr, data_ind->ts_nr, |
Andreas Eversberg | 570b44b | 2013-03-16 16:15:01 +0100 | [diff] [blame] | 218 | data_ind->data, data_ind->len, data_ind->fn, |
| 219 | data_ind->rssi); |
Ivan Kluchnikov | e3a0596 | 2012-03-18 15:48:51 +0400 | [diff] [blame] | 220 | break; |
| 221 | default: |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 222 | LOGP(DL1IF, LOGL_ERROR, "Received PCU data indication with " |
| 223 | "unsupported sapi %d\n", data_ind->sapi); |
| 224 | rc = -EINVAL; |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 225 | } |
Ivan Kluchnikov | e3a0596 | 2012-03-18 15:48:51 +0400 | [diff] [blame] | 226 | |
| 227 | return rc; |
| 228 | } |
| 229 | |
Andreas Eversberg | a9be154 | 2012-09-27 09:23:24 +0200 | [diff] [blame] | 230 | static int pcu_rx_data_cnf(struct gsm_pcu_if_data *data_cnf) |
| 231 | { |
| 232 | int rc = 0; |
| 233 | |
| 234 | LOGP(DL1IF, LOGL_DEBUG, "Data confirm received: sapi=%d fn=%d\n", |
| 235 | data_cnf->sapi, data_cnf->fn); |
| 236 | |
| 237 | switch (data_cnf->sapi) { |
| 238 | case PCU_IF_SAPI_PCH: |
Andreas Eversberg | 8c3680d | 2012-10-08 12:30:56 +0200 | [diff] [blame] | 239 | if (data_cnf->data[2] == 0x3f) |
| 240 | rc = gprs_rlcmac_imm_ass_cnf(data_cnf->data, |
| 241 | data_cnf->fn); |
Andreas Eversberg | a9be154 | 2012-09-27 09:23:24 +0200 | [diff] [blame] | 242 | break; |
| 243 | default: |
| 244 | LOGP(DL1IF, LOGL_ERROR, "Received PCU data confirm with " |
| 245 | "unsupported sapi %d\n", data_cnf->sapi); |
| 246 | rc = -EINVAL; |
| 247 | } |
| 248 | |
| 249 | return rc; |
| 250 | } |
| 251 | |
Andreas Eversberg | a23c7ee | 2012-12-18 10:47:28 +0100 | [diff] [blame] | 252 | // FIXME: remove this, when changed from c++ to c. |
| 253 | extern "C" int pcu_rx_rts_req_pdtch(uint8_t trx, uint8_t ts, uint16_t arfcn, |
| 254 | uint32_t fn, uint8_t block_nr) |
| 255 | { |
| 256 | return gprs_rlcmac_rcv_rts_block(trx, ts, arfcn, fn, block_nr); |
| 257 | } |
| 258 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 259 | static int pcu_rx_rts_req(struct gsm_pcu_if_rts_req *rts_req) |
Ivan Kluchnikov | 5310d45 | 2012-04-17 22:00:31 +0400 | [diff] [blame] | 260 | { |
| 261 | int rc = 0; |
Ivan Kluchnikov | 5310d45 | 2012-04-17 22:00:31 +0400 | [diff] [blame] | 262 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 263 | LOGP(DL1IF, LOGL_DEBUG, "RTS request received: trx=%d ts=%d sapi=%d " |
| 264 | "arfcn=%d fn=%d block=%d\n", rts_req->trx_nr, rts_req->ts_nr, |
| 265 | rts_req->sapi, rts_req->arfcn, rts_req->fn, rts_req->block_nr); |
Ivan Kluchnikov | e3a0596 | 2012-03-18 15:48:51 +0400 | [diff] [blame] | 266 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 267 | switch (rts_req->sapi) { |
| 268 | case PCU_IF_SAPI_PDTCH: |
Andreas Eversberg | a23c7ee | 2012-12-18 10:47:28 +0100 | [diff] [blame] | 269 | pcu_rx_rts_req_pdtch(rts_req->trx_nr, rts_req->ts_nr, |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 270 | rts_req->arfcn, rts_req->fn, rts_req->block_nr); |
Ivan Kluchnikov | e3a0596 | 2012-03-18 15:48:51 +0400 | [diff] [blame] | 271 | break; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 272 | case PCU_IF_SAPI_PTCCH: |
| 273 | /* FIXME */ |
| 274 | { |
| 275 | struct msgb *msg = msgb_alloc(23, "l1_prim"); |
| 276 | memset(msgb_put(msg, 23), 0x2b, 23); |
| 277 | pcu_l1if_tx_ptcch(msg, rts_req->trx_nr, rts_req->ts_nr, |
| 278 | rts_req->arfcn, rts_req->fn, rts_req->block_nr); |
| 279 | } |
Ivan Kluchnikov | e3a0596 | 2012-03-18 15:48:51 +0400 | [diff] [blame] | 280 | break; |
| 281 | default: |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 282 | LOGP(DL1IF, LOGL_ERROR, "Received PCU RTS request with " |
| 283 | "unsupported sapi %d\n", rts_req->sapi); |
| 284 | rc = -EINVAL; |
| 285 | } |
| 286 | |
| 287 | return rc; |
| 288 | } |
| 289 | |
| 290 | static int pcu_rx_rach_ind(struct gsm_pcu_if_rach_ind *rach_ind) |
| 291 | { |
| 292 | int rc = 0; |
| 293 | |
| 294 | LOGP(DL1IF, LOGL_INFO, "RACH request received: sapi=%d " |
| 295 | "qta=%d, ra=%d, fn=%d\n", rach_ind->sapi, rach_ind->qta, |
| 296 | rach_ind->ra, rach_ind->fn); |
| 297 | |
| 298 | switch (rach_ind->sapi) { |
| 299 | case PCU_IF_SAPI_RACH: |
| 300 | rc = gprs_rlcmac_rcv_rach(rach_ind->ra, rach_ind->fn, |
| 301 | rach_ind->qta); |
Ivan Kluchnikov | e3a0596 | 2012-03-18 15:48:51 +0400 | [diff] [blame] | 302 | break; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 303 | default: |
| 304 | LOGP(DL1IF, LOGL_ERROR, "Received PCU rach request with " |
| 305 | "unsupported sapi %d\n", rach_ind->sapi); |
| 306 | rc = -EINVAL; |
Ivan Kluchnikov | e3a0596 | 2012-03-18 15:48:51 +0400 | [diff] [blame] | 307 | } |
| 308 | |
Ivan Kluchnikov | e3a0596 | 2012-03-18 15:48:51 +0400 | [diff] [blame] | 309 | return rc; |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 310 | } |
Andreas Eversberg | 0aed654 | 2012-06-23 10:33:16 +0200 | [diff] [blame] | 311 | |
Andreas Eversberg | 07e97cf | 2012-08-07 16:00:56 +0200 | [diff] [blame] | 312 | int flush_pdch(struct gprs_rlcmac_pdch *pdch, uint8_t trx, uint8_t ts) |
Andreas Eversberg | 2b91464 | 2012-07-19 13:06:26 +0200 | [diff] [blame] | 313 | { |
| 314 | uint8_t tfi; |
| 315 | struct gprs_rlcmac_tbf *tbf; |
| 316 | struct gprs_rlcmac_paging *pag; |
Andreas Eversberg | 07e97cf | 2012-08-07 16:00:56 +0200 | [diff] [blame] | 317 | struct gprs_rlcmac_sba *sba, *sba2; |
Andreas Eversberg | 2b91464 | 2012-07-19 13:06:26 +0200 | [diff] [blame] | 318 | |
| 319 | /* kick all TBF on slot */ |
| 320 | for (tfi = 0; tfi < 32; tfi++) { |
| 321 | tbf = pdch->ul_tbf[tfi]; |
| 322 | if (tbf) |
| 323 | tbf_free(tbf); |
| 324 | tbf = pdch->dl_tbf[tfi]; |
| 325 | if (tbf) |
| 326 | tbf_free(tbf); |
| 327 | } |
| 328 | /* flush all pending paging messages */ |
| 329 | while ((pag = gprs_rlcmac_dequeue_paging(pdch))) |
| 330 | talloc_free(pag); |
| 331 | |
Andreas Eversberg | 07e97cf | 2012-08-07 16:00:56 +0200 | [diff] [blame] | 332 | llist_for_each_entry_safe(sba, sba2, &gprs_rlcmac_sbas, list) { |
| 333 | if (sba->trx == trx && sba->ts == ts) { |
| 334 | llist_del(&sba->list); |
| 335 | talloc_free(sba); |
| 336 | } |
| 337 | } |
| 338 | |
Andreas Eversberg | 2b91464 | 2012-07-19 13:06:26 +0200 | [diff] [blame] | 339 | return 0; |
| 340 | } |
| 341 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 342 | static int pcu_rx_info_ind(struct gsm_pcu_if_info_ind *info_ind) |
Andreas Eversberg | 0aed654 | 2012-06-23 10:33:16 +0200 | [diff] [blame] | 343 | { |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 344 | struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts; |
Andreas Eversberg | 2b91464 | 2012-07-19 13:06:26 +0200 | [diff] [blame] | 345 | struct gprs_rlcmac_pdch *pdch; |
Andreas Eversberg | 81a12be | 2013-03-16 16:16:41 +0100 | [diff] [blame^] | 346 | struct in_addr ia; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 347 | int rc = 0; |
Andreas Eversberg | 2b91464 | 2012-07-19 13:06:26 +0200 | [diff] [blame] | 348 | int trx, ts; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 349 | int i; |
Andreas Eversberg | 0aed654 | 2012-06-23 10:33:16 +0200 | [diff] [blame] | 350 | |
Andreas Eversberg | 8389fd0 | 2012-07-18 10:06:48 +0200 | [diff] [blame] | 351 | if (info_ind->version != PCU_IF_VERSION) { |
| 352 | fprintf(stderr, "PCU interface version number of BTS (%d) is " |
| 353 | "different (%d).\nPlease re-compile!\n", |
| 354 | info_ind->version, PCU_IF_VERSION); |
| 355 | exit(-1); |
| 356 | } |
| 357 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 358 | LOGP(DL1IF, LOGL_DEBUG, "Info indication received:\n"); |
Andreas Eversberg | 0aed654 | 2012-06-23 10:33:16 +0200 | [diff] [blame] | 359 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 360 | if (!(info_ind->flags & PCU_IF_FLAG_ACTIVE)) { |
| 361 | LOGP(DL1IF, LOGL_NOTICE, "BTS not available\n"); |
| 362 | bssgp_failed: |
| 363 | /* free all TBF */ |
| 364 | for (trx = 0; trx < 8; trx++) { |
| 365 | bts->trx[trx].arfcn = info_ind->trx[trx].arfcn; |
Andreas Eversberg | 3b7461c | 2012-07-20 11:19:59 +0200 | [diff] [blame] | 366 | for (ts = 0; ts < 8; ts++) { |
| 367 | if (bts->trx[trx].pdch[ts].enable) |
Andreas Eversberg | 07e97cf | 2012-08-07 16:00:56 +0200 | [diff] [blame] | 368 | flush_pdch(&bts->trx[trx].pdch[ts], |
| 369 | trx, ts); |
Andreas Eversberg | 3b7461c | 2012-07-20 11:19:59 +0200 | [diff] [blame] | 370 | } |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 371 | } |
| 372 | gprs_bssgp_destroy(); |
| 373 | return 0; |
Andreas Eversberg | 0aed654 | 2012-06-23 10:33:16 +0200 | [diff] [blame] | 374 | } |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 375 | LOGP(DL1IF, LOGL_INFO, "BTS available\n"); |
Andreas Eversberg | 514491d | 2012-09-23 06:42:07 +0200 | [diff] [blame] | 376 | LOGP(DL1IF, LOGL_DEBUG, " mcc=%x\n", info_ind->mcc); |
| 377 | LOGP(DL1IF, LOGL_DEBUG, " mnc=%x\n", info_ind->mnc); |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 378 | LOGP(DL1IF, LOGL_DEBUG, " lac=%d\n", info_ind->lac); |
| 379 | LOGP(DL1IF, LOGL_DEBUG, " rac=%d\n", info_ind->rac); |
Andreas Eversberg | 514491d | 2012-09-23 06:42:07 +0200 | [diff] [blame] | 380 | LOGP(DL1IF, LOGL_DEBUG, " cell_id=%d\n", ntohs(info_ind->cell_id)); |
Andreas Eversberg | a23c7ee | 2012-12-18 10:47:28 +0100 | [diff] [blame] | 381 | LOGP(DL1IF, LOGL_DEBUG, " bsic=%d\n", info_ind->bsic); |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 382 | LOGP(DL1IF, LOGL_DEBUG, " nsei=%d\n", info_ind->nsei); |
| 383 | LOGP(DL1IF, LOGL_DEBUG, " nse_timer=%d %d %d %d %d %d %d\n", |
| 384 | info_ind->nse_timer[0], info_ind->nse_timer[1], |
| 385 | info_ind->nse_timer[2], info_ind->nse_timer[3], |
| 386 | info_ind->nse_timer[4], info_ind->nse_timer[5], |
| 387 | info_ind->nse_timer[6]); |
| 388 | LOGP(DL1IF, LOGL_DEBUG, " cell_timer=%d %d %d %d %d %d %d %d %d %d " |
| 389 | "%d\n", |
| 390 | info_ind->cell_timer[0], info_ind->cell_timer[1], |
| 391 | info_ind->cell_timer[2], info_ind->cell_timer[3], |
| 392 | info_ind->cell_timer[4], info_ind->cell_timer[5], |
| 393 | info_ind->cell_timer[6], info_ind->cell_timer[7], |
| 394 | info_ind->cell_timer[8], info_ind->cell_timer[9], |
| 395 | info_ind->cell_timer[10]); |
| 396 | LOGP(DL1IF, LOGL_DEBUG, " repeat_time=%d\n", info_ind->repeat_time); |
| 397 | LOGP(DL1IF, LOGL_DEBUG, " repeat_count=%d\n", info_ind->repeat_count); |
| 398 | LOGP(DL1IF, LOGL_DEBUG, " bvci=%d\n", info_ind->bvci); |
| 399 | LOGP(DL1IF, LOGL_DEBUG, " t3142=%d\n", info_ind->t3142); |
| 400 | LOGP(DL1IF, LOGL_DEBUG, " t3169=%d\n", info_ind->t3169); |
| 401 | LOGP(DL1IF, LOGL_DEBUG, " t3191=%d\n", info_ind->t3191); |
| 402 | LOGP(DL1IF, LOGL_DEBUG, " t3193=%d (ms)\n", info_ind->t3193_10ms * 10); |
| 403 | LOGP(DL1IF, LOGL_DEBUG, " t3195=%d\n", info_ind->t3195); |
| 404 | LOGP(DL1IF, LOGL_DEBUG, " n3101=%d\n", info_ind->n3101); |
| 405 | LOGP(DL1IF, LOGL_DEBUG, " n3103=%d\n", info_ind->n3103); |
| 406 | LOGP(DL1IF, LOGL_DEBUG, " n3105=%d\n", info_ind->n3105); |
| 407 | LOGP(DL1IF, LOGL_DEBUG, " cv_countdown=%d\n", info_ind->cv_countdown); |
| 408 | LOGP(DL1IF, LOGL_DEBUG, " dl_tbf_ext=%d\n", info_ind->dl_tbf_ext); |
| 409 | LOGP(DL1IF, LOGL_DEBUG, " ul_tbf_ext=%d\n", info_ind->ul_tbf_ext); |
Andreas Eversberg | a23c7ee | 2012-12-18 10:47:28 +0100 | [diff] [blame] | 410 | bts->bsic = info_ind->bsic; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 411 | for (i = 0; i < 4; i++) { |
| 412 | if ((info_ind->flags & (PCU_IF_FLAG_CS1 << i))) |
| 413 | LOGP(DL1IF, LOGL_DEBUG, " Use CS%d\n", i+1); |
| 414 | } |
| 415 | for (i = 0; i < 9; i++) { |
| 416 | if ((info_ind->flags & (PCU_IF_FLAG_MCS1 << i))) |
| 417 | LOGP(DL1IF, LOGL_DEBUG, " Use MCS%d\n", i+1); |
| 418 | } |
| 419 | LOGP(DL1IF, LOGL_DEBUG, " initial_cs=%d\n", info_ind->initial_cs); |
| 420 | LOGP(DL1IF, LOGL_DEBUG, " initial_mcs=%d\n", info_ind->initial_mcs); |
| 421 | LOGP(DL1IF, LOGL_DEBUG, " nsvci=%d\n", info_ind->nsvci[0]); |
| 422 | LOGP(DL1IF, LOGL_DEBUG, " local_port=%d\n", info_ind->local_port[0]); |
| 423 | LOGP(DL1IF, LOGL_DEBUG, " remote_port=%d\n", info_ind->remote_port[0]); |
Andreas Eversberg | 81a12be | 2013-03-16 16:16:41 +0100 | [diff] [blame^] | 424 | ia.s_addr = htonl(info_ind->remote_ip[0]); |
| 425 | LOGP(DL1IF, LOGL_DEBUG, " remote_ip=%s\n", inet_ntoa(ia)); |
Andreas Eversberg | 0aed654 | 2012-06-23 10:33:16 +0200 | [diff] [blame] | 426 | |
Harald Welte | 30a73d8 | 2013-03-10 08:54:30 +0000 | [diff] [blame] | 427 | rc = gprs_bssgp_create(info_ind->local_port[0], |
| 428 | info_ind->remote_ip[0], info_ind->remote_port[0], |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 429 | info_ind->nsei, info_ind->nsvci[0], info_ind->bvci, |
| 430 | info_ind->mcc, info_ind->mnc, info_ind->lac, info_ind->rac, |
| 431 | info_ind->cell_id); |
| 432 | if (rc < 0) { |
| 433 | LOGP(DL1IF, LOGL_NOTICE, "SGSN not available\n"); |
| 434 | goto bssgp_failed; |
| 435 | } |
| 436 | |
| 437 | bts->cs1 = !!(info_ind->flags & PCU_IF_FLAG_CS1); |
| 438 | bts->cs2 = !!(info_ind->flags & PCU_IF_FLAG_CS2); |
| 439 | bts->cs3 = !!(info_ind->flags & PCU_IF_FLAG_CS3); |
| 440 | bts->cs4 = !!(info_ind->flags & PCU_IF_FLAG_CS4); |
| 441 | if (!bts->cs1 && !bts->cs2 && !bts->cs3 && !bts->cs4) |
| 442 | bts->cs1 = 1; |
| 443 | if (info_ind->t3142) { /* if timer values are set */ |
| 444 | bts->t3142 = info_ind->t3142; |
| 445 | bts->t3169 = info_ind->t3169; |
| 446 | bts->t3191 = info_ind->t3191; |
| 447 | bts->t3193_msec = info_ind->t3193_10ms * 10; |
| 448 | bts->t3195 = info_ind->t3195; |
| 449 | bts->n3101 = info_ind->n3101; |
| 450 | bts->n3103 = info_ind->n3103; |
| 451 | bts->n3105 = info_ind->n3105; |
| 452 | } |
Andreas Eversberg | 8b761a3 | 2012-07-20 21:50:31 +0200 | [diff] [blame] | 453 | if (!bts->force_cs) { |
| 454 | if (info_ind->initial_cs < 1 || info_ind->initial_cs > 4) |
Andreas Eversberg | 499ff41 | 2012-10-03 14:21:36 +0200 | [diff] [blame] | 455 | bts->initial_cs_dl = 1; |
Andreas Eversberg | 8b761a3 | 2012-07-20 21:50:31 +0200 | [diff] [blame] | 456 | else |
Andreas Eversberg | 499ff41 | 2012-10-03 14:21:36 +0200 | [diff] [blame] | 457 | bts->initial_cs_dl = info_ind->initial_cs; |
| 458 | bts->initial_cs_ul = bts->initial_cs_dl; |
Andreas Eversberg | 8b761a3 | 2012-07-20 21:50:31 +0200 | [diff] [blame] | 459 | } |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 460 | |
| 461 | for (trx = 0; trx < 8; trx++) { |
| 462 | bts->trx[trx].arfcn = info_ind->trx[trx].arfcn; |
Andreas Eversberg | a23c7ee | 2012-12-18 10:47:28 +0100 | [diff] [blame] | 463 | if ((info_ind->flags & PCU_IF_FLAG_SYSMO) |
| 464 | && info_ind->trx[trx].hlayer1) { |
| 465 | #ifdef ENABLE_SYSMODSP |
| 466 | LOGP(DL1IF, LOGL_DEBUG, " TRX %d hlayer1=%x\n", trx, |
| 467 | info_ind->trx[trx].hlayer1); |
| 468 | if (!bts->trx[trx].fl1h) |
| 469 | bts->trx[trx].fl1h = l1if_open_pdch( |
| 470 | (void *)trx, |
| 471 | info_ind->trx[trx].hlayer1); |
| 472 | if (!bts->trx[trx].fl1h) { |
| 473 | LOGP(DL1IF, LOGL_FATAL, "Failed to open direct " |
| 474 | "DSP access for PDCH.\n"); |
| 475 | exit(0); |
| 476 | } |
| 477 | #else |
| 478 | LOGP(DL1IF, LOGL_FATAL, "Compiled without direct DSP " |
| 479 | "access for PDCH, but enabled at " |
| 480 | "BTS. Please deactivate it!\n"); |
| 481 | exit(0); |
| 482 | #endif |
Andreas Eversberg | a23c7ee | 2012-12-18 10:47:28 +0100 | [diff] [blame] | 483 | } |
| 484 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 485 | for (ts = 0; ts < 8; ts++) { |
Andreas Eversberg | 2b91464 | 2012-07-19 13:06:26 +0200 | [diff] [blame] | 486 | pdch = &bts->trx[trx].pdch[ts]; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 487 | if ((info_ind->trx[trx].pdch_mask & (1 << ts))) { |
| 488 | /* FIXME: activate dynamically at RLCMAC */ |
Andreas Eversberg | 3b7461c | 2012-07-20 11:19:59 +0200 | [diff] [blame] | 489 | if (!pdch->enable) { |
Andreas Eversberg | a23c7ee | 2012-12-18 10:47:28 +0100 | [diff] [blame] | 490 | #ifdef ENABLE_SYSMODSP |
| 491 | if ((info_ind->flags & |
| 492 | PCU_IF_FLAG_SYSMO)) |
| 493 | l1if_connect_pdch( |
| 494 | bts->trx[trx].fl1h, ts); |
| 495 | #endif |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 496 | pcu_tx_act_req(trx, ts, 1); |
Andreas Eversberg | 3b7461c | 2012-07-20 11:19:59 +0200 | [diff] [blame] | 497 | INIT_LLIST_HEAD(&pdch->paging_list); |
| 498 | pdch->enable = 1; |
| 499 | } |
Andreas Eversberg | 2b91464 | 2012-07-19 13:06:26 +0200 | [diff] [blame] | 500 | pdch->tsc = info_ind->trx[trx].tsc[ts]; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 501 | LOGP(DL1IF, LOGL_INFO, "PDCH: trx=%d ts=%d\n", |
| 502 | trx, ts); |
| 503 | } else { |
Andreas Eversberg | 3b7461c | 2012-07-20 11:19:59 +0200 | [diff] [blame] | 504 | if (pdch->enable) { |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 505 | pcu_tx_act_req(trx, ts, 0); |
Andreas Eversberg | 3b7461c | 2012-07-20 11:19:59 +0200 | [diff] [blame] | 506 | pdch->enable = 0; |
Andreas Eversberg | 07e97cf | 2012-08-07 16:00:56 +0200 | [diff] [blame] | 507 | flush_pdch(pdch, trx, ts); |
Andreas Eversberg | 3b7461c | 2012-07-20 11:19:59 +0200 | [diff] [blame] | 508 | } |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 509 | } |
| 510 | } |
| 511 | } |
| 512 | |
Andreas Eversberg | 0aed654 | 2012-06-23 10:33:16 +0200 | [diff] [blame] | 513 | return rc; |
| 514 | } |
| 515 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 516 | static int pcu_rx_time_ind(struct gsm_pcu_if_time_ind *time_ind) |
Andreas Eversberg | 0aed654 | 2012-06-23 10:33:16 +0200 | [diff] [blame] | 517 | { |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 518 | struct gprs_rlcmac_tbf *tbf; |
| 519 | uint32_t elapsed; |
| 520 | uint8_t fn13 = time_ind->fn % 13; |
Andreas Eversberg | 0aed654 | 2012-06-23 10:33:16 +0200 | [diff] [blame] | 521 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 522 | /* omit frame numbers not starting at a MAC block */ |
| 523 | if (fn13 != 0 && fn13 != 4 && fn13 != 8) |
| 524 | return 0; |
Andreas Eversberg | a23c7ee | 2012-12-18 10:47:28 +0100 | [diff] [blame] | 525 | #warning uncomment |
| 526 | // LOGP(DL1IF, LOGL_DEBUG, "Time indication received: %d\n", |
| 527 | // time_ind->fn % 52); |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 528 | |
| 529 | set_current_fn(time_ind->fn); |
| 530 | |
| 531 | /* check for poll timeout */ |
Andreas Eversberg | b0c7ea7 | 2012-07-13 14:46:03 +0200 | [diff] [blame] | 532 | llist_for_each_entry(tbf, &gprs_rlcmac_ul_tbfs, list) { |
| 533 | if (tbf->poll_state == GPRS_RLCMAC_POLL_SCHED) { |
| 534 | elapsed = (frame_number - tbf->poll_fn) % 2715648; |
| 535 | if (elapsed >= 20 && elapsed < 200) |
| 536 | gprs_rlcmac_poll_timeout(tbf); |
| 537 | } |
| 538 | } |
| 539 | llist_for_each_entry(tbf, &gprs_rlcmac_dl_tbfs, list) { |
| 540 | if (tbf->poll_state == GPRS_RLCMAC_POLL_SCHED) { |
| 541 | elapsed = (frame_number - tbf->poll_fn) % 2715648; |
| 542 | if (elapsed >= 20 && elapsed < 200) |
| 543 | gprs_rlcmac_poll_timeout(tbf); |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 544 | } |
Andreas Eversberg | 0aed654 | 2012-06-23 10:33:16 +0200 | [diff] [blame] | 545 | } |
| 546 | |
| 547 | return 0; |
| 548 | } |
| 549 | |
Andreas Eversberg | 2b91464 | 2012-07-19 13:06:26 +0200 | [diff] [blame] | 550 | static int pcu_rx_pag_req(struct gsm_pcu_if_pag_req *pag_req) |
| 551 | { |
| 552 | LOGP(DL1IF, LOGL_DEBUG, "Paging request received: chan_needed=%d " |
| 553 | "length=%d\n", pag_req->chan_needed, pag_req->identity_lv[0]); |
| 554 | |
| 555 | return gprs_rlcmac_add_paging(pag_req->chan_needed, |
| 556 | pag_req->identity_lv); |
| 557 | } |
| 558 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 559 | int pcu_rx(uint8_t msg_type, struct gsm_pcu_if *pcu_prim) |
Andreas Eversberg | 0aed654 | 2012-06-23 10:33:16 +0200 | [diff] [blame] | 560 | { |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 561 | int rc = 0; |
Andreas Eversberg | 0aed654 | 2012-06-23 10:33:16 +0200 | [diff] [blame] | 562 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 563 | switch (msg_type) { |
| 564 | case PCU_IF_MSG_DATA_IND: |
| 565 | rc = pcu_rx_data_ind(&pcu_prim->u.data_ind); |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 566 | break; |
Andreas Eversberg | a9be154 | 2012-09-27 09:23:24 +0200 | [diff] [blame] | 567 | case PCU_IF_MSG_DATA_CNF: |
| 568 | rc = pcu_rx_data_cnf(&pcu_prim->u.data_cnf); |
| 569 | break; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 570 | case PCU_IF_MSG_RTS_REQ: |
| 571 | rc = pcu_rx_rts_req(&pcu_prim->u.rts_req); |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 572 | break; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 573 | case PCU_IF_MSG_RACH_IND: |
| 574 | rc = pcu_rx_rach_ind(&pcu_prim->u.rach_ind); |
| 575 | break; |
| 576 | case PCU_IF_MSG_INFO_IND: |
| 577 | rc = pcu_rx_info_ind(&pcu_prim->u.info_ind); |
| 578 | break; |
| 579 | case PCU_IF_MSG_TIME_IND: |
| 580 | rc = pcu_rx_time_ind(&pcu_prim->u.time_ind); |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 581 | break; |
Andreas Eversberg | 2b91464 | 2012-07-19 13:06:26 +0200 | [diff] [blame] | 582 | case PCU_IF_MSG_PAG_REQ: |
| 583 | rc = pcu_rx_pag_req(&pcu_prim->u.pag_req); |
| 584 | break; |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 585 | default: |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 586 | LOGP(DL1IF, LOGL_ERROR, "Received unknwon PCU msg type %d\n", |
| 587 | msg_type); |
| 588 | rc = -EINVAL; |
Andreas Eversberg | 0aed654 | 2012-06-23 10:33:16 +0200 | [diff] [blame] | 589 | } |
| 590 | |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 591 | return rc; |
Andreas Eversberg | 0aed654 | 2012-06-23 10:33:16 +0200 | [diff] [blame] | 592 | } |