blob: eb0e3e190f7cf53323b287b3f3d76fdb9da29039 [file] [log] [blame]
Harald Welte9a311ec2011-02-12 12:33:06 +01001/* Ericsson RBS 2xxx GSM O&M (OM2000) messages on the A-bis interface
2 * implemented based on protocol trace analysis, no formal documentation */
3
4/* (C) 2010-2011 by Harald Welte <laforge@gnumonks.org>
5 *
6 * All Rights Reserved
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Affero General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
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 Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23
24#include <errno.h>
25#include <unistd.h>
26#include <stdio.h>
27#include <stdlib.h>
28#include <time.h>
29#include <stdint.h>
30
31#include <arpa/inet.h>
32
33#include <osmocore/msgb.h>
34#include <osmocore/tlv.h>
35#include <osmocore/talloc.h>
36#include <osmocore/utils.h>
37
38#include <openbsc/gsm_data.h>
39#include <openbsc/debug.h>
40#include <openbsc/abis_nm.h>
Harald Welte73541072011-02-12 13:44:14 +010041#include <openbsc/abis_om2000.h>
Harald Welte9a311ec2011-02-12 12:33:06 +010042#include <openbsc/signal.h>
Harald Welted88a3872011-02-14 15:26:13 +010043#include <openbsc/e1_input.h>
Harald Welte9a311ec2011-02-12 12:33:06 +010044
45#define OM_ALLOC_SIZE 1024
46#define OM_HEADROOM_SIZE 128
47
48/* use following functions from abis_nm.c:
49 * om2k_msgb_alloc()
Harald Weltebc867d92011-02-12 13:09:38 +010050 * abis_om2k_sendmsg()
Harald Welte9a311ec2011-02-12 12:33:06 +010051 */
52
Harald Welte9a311ec2011-02-12 12:33:06 +010053struct abis_om2k_hdr {
54 struct abis_om_hdr om;
55 uint16_t msg_type;
56 struct abis_om2k_mo mo;
57 uint8_t data[0];
58} __attribute__ ((packed));
59
60enum abis_om2k_msgtype {
61 OM2K_MSGT_ABORT_SP_CMD = 0x0000,
62 OM2K_MSGT_ABORT_SP_COMPL = 0x0002,
63 OM2K_MSGT_ALARM_REP_ACK = 0x0004,
64 OM2K_MSGT_ALARM_REP_NACK = 0x0005,
65 OM2K_MSGT_ALARM_REP = 0x0006,
66 OM2K_MSGT_ALARM_STATUS_REQ = 0x0008,
67 OM2K_MSGT_ALARM_STATUS_REQ_ACK = 0x000a,
68 OM2K_MSGT_ALARM_STATUS_REQ_REJ = 0x000b,
69 OM2K_MSGT_ALARM_STATUS_RES_ACK = 0x000c,
70 OM2K_MSGT_ALARM_STATUS_RES_NACK = 0x000d,
71 OM2K_MSGT_ALARM_STATUS_RES = 0x000e,
72 OM2K_MSGT_CAL_TIME_RESP = 0x0010,
73 OM2K_MSGT_CAL_TIME_REJ = 0x0011,
74 OM2K_MSGT_CAL_TIME_REQ = 0x0012,
75
Harald Weltefdb71942011-02-14 15:31:43 +010076 OM2K_MSGT_CON_CONF_REQ = 0x0014,
77 OM2K_MSGT_CON_CONF_REQ_ACK = 0x0016,
78 OM2K_MSGT_CON_CONF_REQ_REJ = 0x0017,
79 OM2K_MSGT_CON_CONF_RES_ACK = 0x0018,
80 OM2K_MSGT_CON_CONF_RES_NACK = 0x0019,
81 OM2K_MSGT_CON_CONF_RES = 0x001a,
82
Harald Welte9a311ec2011-02-12 12:33:06 +010083 OM2K_MSGT_CONNECT_CMD = 0x001c,
84 OM2K_MSGT_CONNECT_COMPL = 0x001e,
85 OM2K_MSGT_CONNECT_REJ = 0x001f,
86
Harald Welte0741ffe2011-02-12 18:48:53 +010087 OM2K_MSGT_DISABLE_REQ = 0x0028,
88 OM2K_MSGT_DISABLE_REQ_ACK = 0x002a,
89 OM2K_MSGT_DISABLE_REQ_REJ = 0x002b,
90 OM2K_MSGT_DISABLE_RES_ACK = 0x002c,
91 OM2K_MSGT_DISABLE_RES_NACK = 0x002d,
92 OM2K_MSGT_DISABLE_RES = 0x002e,
Harald Welte6fec79d2011-02-12 14:57:17 +010093 OM2K_MSGT_DISCONNECT_CMD = 0x0030,
94 OM2K_MSGT_DISCONNECT_COMPL = 0x0032,
95 OM2K_MSGT_DISCONNECT_REJ = 0x0033,
Harald Welte0741ffe2011-02-12 18:48:53 +010096 OM2K_MSGT_ENABLE_REQ = 0x0034,
97 OM2K_MSGT_ENABLE_REQ_ACK = 0x0036,
98 OM2K_MSGT_ENABLE_REQ_REJ = 0x0037,
99 OM2K_MSGT_ENABLE_RES_ACK = 0x0038,
100 OM2K_MSGT_ENABLE_RES_NACK = 0x0039,
101 OM2K_MSGT_ENABLE_RES = 0x003a,
Harald Welte6fec79d2011-02-12 14:57:17 +0100102
Harald Welte9a311ec2011-02-12 12:33:06 +0100103 OM2K_MSGT_FAULT_REP_ACK = 0x0040,
104 OM2K_MSGT_FAULT_REP_NACK = 0x0041,
105 OM2K_MSGT_FAULT_REP = 0x0042,
106
107 OM2K_MSGT_IS_CONF_REQ = 0x0060,
108 OM2K_MSGT_IS_CONF_REQ_ACK = 0x0062,
109 OM2K_MSGT_IS_CONF_REQ_REJ = 0x0063,
110 OM2K_MSGT_IS_CONF_RES_ACK = 0x0064,
111 OM2K_MSGT_IS_CONF_RES_NACK = 0x0065,
112 OM2K_MSGT_IS_CONF_RES = 0x0066,
113
114 OM2K_MSGT_OP_INFO = 0x0074,
115 OM2K_MSGT_OP_INFO_ACK = 0x0076,
116 OM2K_MSGT_OP_INFO_REJ = 0x0077,
117 OM2K_MSGT_RESET_CMD = 0x0078,
118 OM2K_MSGT_RESET_COMPL = 0x007a,
119 OM2K_MSGT_RESET_REJ = 0x007b,
Harald Weltea0ce3492011-03-05 14:13:14 +0100120 OM2K_MSGT_RX_CONF_REQ = 0x007c,
121 OM2K_MSGT_RX_CONF_REQ_ACK = 0x007e,
122 OM2K_MSGT_RX_CONF_REQ_REJ = 0x007f,
123 OM2K_MSGT_RX_CONF_RES_ACK = 0x0080,
124 OM2K_MSGT_RX_CONF_RES_NACK = 0x0081,
125 OM2K_MSGT_RX_CONF_RES = 0x0082,
Harald Welte9a311ec2011-02-12 12:33:06 +0100126 OM2K_MSGT_START_REQ = 0x0084,
127 OM2K_MSGT_START_REQ_ACK = 0x0086,
128 OM2K_MSGT_START_REQ_REJ = 0x0087,
129 OM2K_MSGT_START_RES_ACK = 0x0088,
130 OM2K_MSGT_START_RES_NACK = 0x0089,
131 OM2K_MSGT_START_RES = 0x008a,
Harald Weltee1d5eca2011-02-12 14:42:59 +0100132 OM2K_MSGT_STATUS_REQ = 0x008c,
133 OM2K_MSGT_STATUS_RESP = 0x008e,
134 OM2K_MSGT_STATUS_REJ = 0x008f,
Harald Welte9a311ec2011-02-12 12:33:06 +0100135
Harald Welte8024d8f2011-02-12 15:07:30 +0100136 OM2K_MSGT_TEST_REQ = 0x0094,
137 OM2K_MSGT_TEST_REQ_ACK = 0x0096,
138 OM2K_MSGT_TEST_REQ_REJ = 0x0097,
139 OM2K_MSGT_TEST_RES_ACK = 0x0098,
140 OM2K_MSGT_TEST_RES_NACK = 0x0099,
141 OM2K_MSGT_TEST_RES = 0x009a,
142
Harald Weltef9cf9612011-03-05 14:36:47 +0100143 OM2K_MSGT_TF_CONF_REQ = 0x00a0,
144 OM2K_MSGT_TF_CONF_REQ_ACK = 0x00a2,
145 OM2K_MSGT_TF_CONF_REQ_REJ = 0x00a3,
146 OM2K_MSGT_TF_CONF_RES_ACK = 0x00a4,
147 OM2K_MSGT_TF_CONF_RES_NACK = 0x00a5,
148 OM2K_MSGT_TF_CONF_RES = 0x00a6,
Harald Weltea0ce3492011-03-05 14:13:14 +0100149 OM2K_MSGT_TS_CONF_REQ = 0x00a8,
150 OM2K_MSGT_TS_CONF_REQ_ACK = 0x00aa,
151 OM2K_MSGT_TS_CONF_REQ_REJ = 0x00ab,
152 OM2K_MSGT_TS_CONF_RES_ACK = 0x00ac,
153 OM2K_MSGT_TS_CONF_RES_NACK = 0x00ad,
154 OM2K_MSGT_TS_CONF_RES = 0x00ae,
155 OM2K_MSGT_TX_CONF_REQ = 0x00b0,
156 OM2K_MSGT_TX_CONF_REQ_ACK = 0x00b2,
157 OM2K_MSGT_TX_CONF_REQ_REJ = 0x00b3,
158 OM2K_MSGT_TX_CONF_RES_ACK = 0x00b4,
159 OM2K_MSGT_TX_CONF_RES_NACK = 0x00b5,
160 OM2K_MSGT_TX_CONF_RES = 0x00b6,
161
Harald Welte9a311ec2011-02-12 12:33:06 +0100162 OM2K_MSGT_NEGOT_REQ_ACK = 0x0104,
163 OM2K_MSGT_NEGOT_REQ_NACK = 0x0105,
164 OM2K_MSGT_NEGOT_REQ = 0x0106,
165};
166
167enum abis_om2k_dei {
Harald Weltea0ce3492011-03-05 14:13:14 +0100168 OM2K_DEI_BCC = 0x06,
Harald Welte1164dce2011-03-05 19:21:26 +0100169 OM2K_DEI_BS_AG_BKS_RES = 0x07,
Harald Weltea0ce3492011-03-05 14:13:14 +0100170 OM2K_DEI_BSIC = 0x09,
Harald Welte1164dce2011-03-05 19:21:26 +0100171 OM2K_DEI_BA_PA_MFRMS = 0x0a,
172 OM2K_DEI_CBCH_INDICATOR = 0x0b,
173 OM2K_DEI_CCCH_OPTIONS = 0x0c,
Harald Welte9a311ec2011-02-12 12:33:06 +0100174 OM2K_DEI_CAL_TIME = 0x0d,
Harald Weltea0ce3492011-03-05 14:13:14 +0100175 OM2K_DEI_COMBINATION = 0x0f,
Harald Weltefdb71942011-02-14 15:31:43 +0100176 OM2K_DEI_CON_CONN_LIST = 0x10,
Harald Welte1164dce2011-03-05 19:21:26 +0100177 OM2K_DEI_DRX_DEV_MAX = 0x12,
Harald Welte8bcb1a02011-02-12 20:23:40 +0100178 OM2K_DEI_END_LIST_NR = 0x13,
Harald Weltea0ce3492011-03-05 14:13:14 +0100179 OM2K_DEI_FILLING_MARKER = 0x1c,
180 OM2K_DEI_FN_OFFSET = 0x1d,
181 OM2K_DEI_FREQ_LIST = 0x1e,
182 OM2K_DEI_FREQ_SPEC_RX = 0x1f,
183 OM2K_DEI_FREQ_SPEC_TX = 0x20,
184 OM2K_DEI_HSN = 0x21,
Harald Welte1164dce2011-03-05 19:21:26 +0100185 OM2K_DEI_ICM_INDICATOR = 0x22,
Harald Welte8bcb1a02011-02-12 20:23:40 +0100186 OM2K_DEI_IS_CONN_LIST = 0x27,
187 OM2K_DEI_LIST_NR = 0x28,
Harald Weltea0ce3492011-03-05 14:13:14 +0100188 OM2K_DEI_MAIO = 0x2b,
Harald Welte1164dce2011-03-05 19:21:26 +0100189 OM2K_DEI_NY1 = 0x2d,
Harald Welte9a311ec2011-02-12 12:33:06 +0100190 OM2K_DEI_OP_INFO = 0x2e,
Harald Weltea0ce3492011-03-05 14:13:14 +0100191 OM2K_DEI_POWER = 0x2f,
Harald Weltee6e83832011-03-05 17:52:09 +0100192 OM2K_DEI_REASON_CODE = 0x32,
Harald Weltea0ce3492011-03-05 14:13:14 +0100193 OM2K_DEI_RX_DIVERSITY = 0x33,
Harald Weltee6e83832011-03-05 17:52:09 +0100194 OM2K_DEI_RESULT_CODE = 0x35,
Harald Welte1164dce2011-03-05 19:21:26 +0100195 OM2K_DEI_T3105 = 0x38,
Harald Weltef9cf9612011-03-05 14:36:47 +0100196 OM2K_DEI_TF_MODE = 0x3a,
Harald Weltea0ce3492011-03-05 14:13:14 +0100197 OM2K_DEI_TS_NR = 0x3c,
Harald Welte1164dce2011-03-05 19:21:26 +0100198 OM2K_DEI_TSC = 0x3d,
Harald Weltea0ce3492011-03-05 14:13:14 +0100199 OM2K_DEI_EXT_RANGE = 0x47,
Harald Welte1164dce2011-03-05 19:21:26 +0100200 OM2K_DEI_LSC = 0x79,
201 OM2K_DEI_LSC_FILT_TIME = 0x7a,
202 OM2K_DEI_CALL_SUPV_TIME = 0x7b,
203 OM2K_DEI_TTA = 0x87,
Harald Welte73541072011-02-12 13:44:14 +0100204 OM2K_DEI_NEGOT_REC1 = 0x90,
205 OM2K_DEI_NEGOT_REC2 = 0x91,
Harald Welte1164dce2011-03-05 19:21:26 +0100206 OM2K_DEI_ENCR_ALG = 0x92,
207 OM2K_DEI_INTERF_REJ_COMB = 0x94,
Harald Weltef9cf9612011-03-05 14:36:47 +0100208 OM2K_DEI_FS_OFFSET = 0x98,
Harald Welte9a311ec2011-02-12 12:33:06 +0100209};
210
Harald Weltee6e83832011-03-05 17:52:09 +0100211const struct tlv_definition om2k_att_tlvdef = {
212 .def = {
213 [OM2K_DEI_BCC] = { TLV_TYPE_TV },
Harald Welte1164dce2011-03-05 19:21:26 +0100214 [OM2K_DEI_BS_AG_BKS_RES] = { TLV_TYPE_TV },
Harald Weltee6e83832011-03-05 17:52:09 +0100215 [OM2K_DEI_BSIC] = { TLV_TYPE_TV },
Harald Welte1164dce2011-03-05 19:21:26 +0100216 [OM2K_DEI_BA_PA_MFRMS] = { TLV_TYPE_TV },
217 [OM2K_DEI_CBCH_INDICATOR] = { TLV_TYPE_TV },
218 [OM2K_DEI_CCCH_OPTIONS] = { TLV_TYPE_TV },
Harald Weltee6e83832011-03-05 17:52:09 +0100219 [OM2K_DEI_CAL_TIME] = { TLV_TYPE_FIXED, 6 },
220 [OM2K_DEI_COMBINATION] = { TLV_TYPE_TV },
221 [OM2K_DEI_CON_CONN_LIST] = { TLV_TYPE_TLV },
Harald Welte1164dce2011-03-05 19:21:26 +0100222 [OM2K_DEI_DRX_DEV_MAX] = { TLV_TYPE_TV },
Harald Weltee6e83832011-03-05 17:52:09 +0100223 [OM2K_DEI_END_LIST_NR] = { TLV_TYPE_TV },
224 [OM2K_DEI_FILLING_MARKER] = { TLV_TYPE_TV },
225 [OM2K_DEI_FN_OFFSET] = { TLV_TYPE_FIXED, 2 },
226 [OM2K_DEI_FREQ_LIST] = { TLV_TYPE_TLV },
227 [OM2K_DEI_FREQ_SPEC_RX] = { TLV_TYPE_FIXED, 2 },
228 [OM2K_DEI_FREQ_SPEC_TX] = { TLV_TYPE_FIXED, 2 },
229 [OM2K_DEI_HSN] = { TLV_TYPE_TV },
Harald Welte1164dce2011-03-05 19:21:26 +0100230 [OM2K_DEI_ICM_INDICATOR] = { TLV_TYPE_TV },
Harald Weltee6e83832011-03-05 17:52:09 +0100231 [OM2K_DEI_IS_CONN_LIST] = { TLV_TYPE_TLV },
232 [OM2K_DEI_LIST_NR] = { TLV_TYPE_TV },
233 [OM2K_DEI_MAIO] = { TLV_TYPE_TV },
Harald Welte1164dce2011-03-05 19:21:26 +0100234 [OM2K_DEI_NY1] = { TLV_TYPE_TV },
Harald Weltee6e83832011-03-05 17:52:09 +0100235 [OM2K_DEI_OP_INFO] = { TLV_TYPE_TV },
236 [OM2K_DEI_POWER] = { TLV_TYPE_TV },
237 [OM2K_DEI_REASON_CODE] = { TLV_TYPE_TV },
238 [OM2K_DEI_RX_DIVERSITY] = { TLV_TYPE_TV },
239 [OM2K_DEI_RESULT_CODE] = { TLV_TYPE_TV },
Harald Welte1164dce2011-03-05 19:21:26 +0100240 [OM2K_DEI_T3105] = { TLV_TYPE_TV },
Harald Weltee6e83832011-03-05 17:52:09 +0100241 [OM2K_DEI_TF_MODE] = { TLV_TYPE_TV },
242 [OM2K_DEI_TS_NR] = { TLV_TYPE_TV },
Harald Welte1164dce2011-03-05 19:21:26 +0100243 [OM2K_DEI_TSC] = { TLV_TYPE_TV },
Harald Weltee6e83832011-03-05 17:52:09 +0100244 [OM2K_DEI_EXT_RANGE] = { TLV_TYPE_TV },
Harald Welte1164dce2011-03-05 19:21:26 +0100245 [OM2K_DEI_LSC] = { TLV_TYPE_TV },
246 [OM2K_DEI_LSC_FILT_TIME] = { TLV_TYPE_TV },
247 [OM2K_DEI_CALL_SUPV_TIME] = { TLV_TYPE_TV },
248 [OM2K_DEI_TTA] = { TLV_TYPE_TV },
Harald Weltee6e83832011-03-05 17:52:09 +0100249 [OM2K_DEI_NEGOT_REC1] = { TLV_TYPE_TLV },
250 [OM2K_DEI_NEGOT_REC2] = { TLV_TYPE_TLV },
Harald Welte1164dce2011-03-05 19:21:26 +0100251 [OM2K_DEI_ENCR_ALG] = { TLV_TYPE_TV },
252 [OM2K_DEI_INTERF_REJ_COMB] = { TLV_TYPE_TV },
Harald Weltee6e83832011-03-05 17:52:09 +0100253 [OM2K_DEI_FS_OFFSET] = { TLV_TYPE_FIXED, 5 },
254 },
255};
256
Harald Welte9a311ec2011-02-12 12:33:06 +0100257static const struct value_string om2k_msgcode_vals[] = {
258 { 0x0000, "Abort SP Command" },
259 { 0x0002, "Abort SP Complete" },
260 { 0x0004, "Alarm Report ACK" },
261 { 0x0005, "Alarm Report NACK" },
262 { 0x0006, "Alarm Report" },
263 { 0x0008, "Alarm Status Request" },
264 { 0x000a, "Alarm Status Request Accept" },
265 { 0x000b, "Alarm Status Request Reject" },
266 { 0x000c, "Alarm Status Result ACK" },
267 { 0x000d, "Alarm Status Result NACK" },
268 { 0x000e, "Alarm Status Result" },
269 { 0x0010, "Calendar Time Response" },
270 { 0x0011, "Calendar Time Reject" },
271 { 0x0012, "Calendar Time Request" },
272 { 0x0014, "CON Configuration Request" },
273 { 0x0016, "CON Configuration Request Accept" },
274 { 0x0017, "CON Configuration Request Reject" },
275 { 0x0018, "CON Configuration Result ACK" },
276 { 0x0019, "CON Configuration Result NACK" },
277 { 0x001a, "CON Configuration Result" },
278 { 0x001c, "Connect Command" },
279 { 0x001e, "Connect Complete" },
Harald Welte3ede7232011-03-05 17:58:13 +0100280 { 0x001f, "Connect Reject" },
Harald Welte9a311ec2011-02-12 12:33:06 +0100281 { 0x0028, "Disable Request" },
282 { 0x002a, "Disable Request Accept" },
283 { 0x002b, "Disable Request Reject" },
284 { 0x002c, "Disable Result ACK" },
285 { 0x002d, "Disable Result NACK" },
286 { 0x002e, "Disable Result" },
287 { 0x0030, "Disconnect Command" },
288 { 0x0032, "Disconnect Complete" },
289 { 0x0033, "Disconnect Reject" },
290 { 0x0034, "Enable Request" },
291 { 0x0036, "Enable Request Accept" },
292 { 0x0037, "Enable Request Reject" },
293 { 0x0038, "Enable Result ACK" },
294 { 0x0039, "Enable Result NACK" },
295 { 0x003a, "Enable Result" },
296 { 0x003c, "Escape Downlink Normal" },
297 { 0x003d, "Escape Downlink NACK" },
298 { 0x003e, "Escape Uplink Normal" },
299 { 0x003f, "Escape Uplink NACK" },
300 { 0x0040, "Fault Report ACK" },
301 { 0x0041, "Fault Report NACK" },
302 { 0x0042, "Fault Report" },
303 { 0x0044, "File Package End Command" },
304 { 0x0046, "File Package End Result" },
305 { 0x0047, "File Package End Reject" },
306 { 0x0048, "File Relation Request" },
307 { 0x004a, "File Relation Response" },
308 { 0x004b, "File Relation Request Reject" },
309 { 0x004c, "File Segment Transfer" },
310 { 0x004e, "File Segment Transfer Complete" },
311 { 0x004f, "File Segment Transfer Reject" },
312 { 0x0050, "HW Information Request" },
313 { 0x0052, "HW Information Request Accept" },
314 { 0x0053, "HW Information Request Reject" },
315 { 0x0054, "HW Information Result ACK" },
316 { 0x0055, "HW Information Result NACK" },
317 { 0x0056, "HW Information Result" },
318 { 0x0060, "IS Configuration Request" },
319 { 0x0062, "IS Configuration Request Accept" },
320 { 0x0063, "IS Configuration Request Reject" },
321 { 0x0064, "IS Configuration Result ACK" },
322 { 0x0065, "IS Configuration Result NACK" },
323 { 0x0066, "IS Configuration Result" },
324 { 0x0068, "Load Data End" },
325 { 0x006a, "Load Data End Result" },
326 { 0x006b, "Load Data End Reject" },
327 { 0x006c, "Load Data Init" },
328 { 0x006e, "Load Data Init Accept" },
329 { 0x006f, "Load Data Init Reject" },
330 { 0x0070, "Loop Control Command" },
331 { 0x0072, "Loop Control Complete" },
332 { 0x0073, "Loop Control Reject" },
333 { 0x0074, "Operational Information" },
334 { 0x0076, "Operational Information Accept" },
335 { 0x0077, "Operational Information Reject" },
336 { 0x0078, "Reset Command" },
337 { 0x007a, "Reset Complete" },
338 { 0x007b, "Reset Reject" },
339 { 0x007c, "RX Configuration Request" },
340 { 0x007e, "RX Configuration Request Accept" },
341 { 0x007f, "RX Configuration Request Reject" },
342 { 0x0080, "RX Configuration Result ACK" },
343 { 0x0081, "RX Configuration Result NACK" },
344 { 0x0082, "RX Configuration Result" },
345 { 0x0084, "Start Request" },
346 { 0x0086, "Start Request Accept" },
347 { 0x0087, "Start Request Reject" },
348 { 0x0088, "Start Result ACK" },
349 { 0x0089, "Start Result NACK" },
350 { 0x008a, "Start Result" },
351 { 0x008c, "Status Request" },
352 { 0x008e, "Status Response" },
353 { 0x008f, "Status Reject" },
354 { 0x0094, "Test Request" },
355 { 0x0096, "Test Request Accept" },
356 { 0x0097, "Test Request Reject" },
357 { 0x0098, "Test Result ACK" },
358 { 0x0099, "Test Result NACK" },
359 { 0x009a, "Test Result" },
360 { 0x00a0, "TF Configuration Request" },
361 { 0x00a2, "TF Configuration Request Accept" },
362 { 0x00a3, "TF Configuration Request Reject" },
363 { 0x00a4, "TF Configuration Result ACK" },
364 { 0x00a5, "TF Configuration Result NACK" },
365 { 0x00a6, "TF Configuration Result" },
366 { 0x00a8, "TS Configuration Request" },
367 { 0x00aa, "TS Configuration Request Accept" },
368 { 0x00ab, "TS Configuration Request Reject" },
369 { 0x00ac, "TS Configuration Result ACK" },
370 { 0x00ad, "TS Configuration Result NACK" },
371 { 0x00ae, "TS Configuration Result" },
372 { 0x00b0, "TX Configuration Request" },
373 { 0x00b2, "TX Configuration Request Accept" },
374 { 0x00b3, "TX Configuration Request Reject" },
375 { 0x00b4, "TX Configuration Result ACK" },
376 { 0x00b5, "TX Configuration Result NACK" },
377 { 0x00b6, "TX Configuration Result" },
378 { 0x00bc, "DIP Alarm Report ACK" },
379 { 0x00bd, "DIP Alarm Report NACK" },
380 { 0x00be, "DIP Alarm Report" },
381 { 0x00c0, "DIP Alarm Status Request" },
382 { 0x00c2, "DIP Alarm Status Response" },
383 { 0x00c3, "DIP Alarm Status Reject" },
384 { 0x00c4, "DIP Quality Report I ACK" },
385 { 0x00c5, "DIP Quality Report I NACK" },
386 { 0x00c6, "DIP Quality Report I" },
387 { 0x00c8, "DIP Quality Report II ACK" },
388 { 0x00c9, "DIP Quality Report II NACK" },
389 { 0x00ca, "DIP Quality Report II" },
390 { 0x00dc, "DP Configuration Request" },
391 { 0x00de, "DP Configuration Request Accept" },
392 { 0x00df, "DP Configuration Request Reject" },
393 { 0x00e0, "DP Configuration Result ACK" },
394 { 0x00e1, "DP Configuration Result NACK" },
395 { 0x00e2, "DP Configuration Result" },
396 { 0x00e4, "Capabilities HW Info Report ACK" },
397 { 0x00e5, "Capabilities HW Info Report NACK" },
398 { 0x00e6, "Capabilities HW Info Report" },
399 { 0x00e8, "Capabilities Request" },
400 { 0x00ea, "Capabilities Request Accept" },
401 { 0x00eb, "Capabilities Request Reject" },
402 { 0x00ec, "Capabilities Result ACK" },
403 { 0x00ed, "Capabilities Result NACK" },
404 { 0x00ee, "Capabilities Result" },
405 { 0x00f0, "FM Configuration Request" },
406 { 0x00f2, "FM Configuration Request Accept" },
407 { 0x00f3, "FM Configuration Request Reject" },
408 { 0x00f4, "FM Configuration Result ACK" },
409 { 0x00f5, "FM Configuration Result NACK" },
410 { 0x00f6, "FM Configuration Result" },
411 { 0x00f8, "FM Report Request" },
412 { 0x00fa, "FM Report Response" },
413 { 0x00fb, "FM Report Reject" },
414 { 0x00fc, "FM Start Command" },
415 { 0x00fe, "FM Start Complete" },
416 { 0x00ff, "FM Start Reject" },
417 { 0x0100, "FM Stop Command" },
418 { 0x0102, "FM Stop Complete" },
419 { 0x0103, "FM Stop Reject" },
420 { 0x0104, "Negotiation Request ACK" },
421 { 0x0105, "Negotiation Request NACK" },
422 { 0x0106, "Negotiation Request" },
423 { 0x0108, "BTS Initiated Request ACK" },
424 { 0x0109, "BTS Initiated Request NACK" },
425 { 0x010a, "BTS Initiated Request" },
426 { 0x010c, "Radio Channels Release Command" },
427 { 0x010e, "Radio Channels Release Complete" },
428 { 0x010f, "Radio Channels Release Reject" },
429 { 0x0118, "Feature Control Command" },
430 { 0x011a, "Feature Control Complete" },
431 { 0x011b, "Feature Control Reject" },
432
433 { 0, NULL }
434};
435
436/* TS 12.21 Section 9.4: Attributes */
437static const struct value_string om2k_attr_vals[] = {
438 { 0x00, "Accordance indication" },
439 { 0x01, "Alarm Id" },
440 { 0x02, "Alarm Data" },
441 { 0x03, "Alarm Severity" },
442 { 0x04, "Alarm Status" },
443 { 0x05, "Alarm Status Type" },
444 { 0x06, "BCC" },
445 { 0x07, "BS_AG_BKS_RES" },
446 { 0x09, "BSIC" },
447 { 0x0a, "BA_PA_MFRMS" },
448 { 0x0b, "CBCH Indicator" },
449 { 0x0c, "CCCH Options" },
450 { 0x0d, "Calendar Time" },
451 { 0x0f, "Channel Combination" },
452 { 0x10, "CON Connection List" },
453 { 0x11, "Data End Indication" },
454 { 0x12, "DRX_DEV_MAX" },
455 { 0x13, "End List Number" },
456 { 0x14, "External Condition Map Class 1" },
457 { 0x15, "External Condition Map Class 2" },
458 { 0x16, "File Relation Indication" },
459 { 0x17, "File Revision" },
460 { 0x18, "File Segment Data" },
461 { 0x19, "File Segment Length" },
462 { 0x1a, "File Segment Sequence Number" },
463 { 0x1b, "File Size" },
464 { 0x1c, "Filling Marker" },
465 { 0x1d, "FN Offset" },
466 { 0x1e, "Frequency List" },
467 { 0x1f, "Frequency Specifier RX" },
468 { 0x20, "Frequency Specifier TX" },
469 { 0x21, "HSN" },
470 { 0x22, "ICM Indicator" },
471 { 0x23, "Internal Fault Map Class 1A" },
472 { 0x24, "Internal Fault Map Class 1B" },
473 { 0x25, "Internal Fault Map Class 2A" },
474 { 0x26, "Internal Fault Map Class 2A Extension" },
475 { 0x27, "IS Connection List" },
476 { 0x28, "List Number" },
477 { 0x29, "File Package State Indication" },
478 { 0x2a, "Local Access State" },
479 { 0x2b, "MAIO" },
480 { 0x2c, "MO State" },
481 { 0x2d, "Ny1" },
482 { 0x2e, "Operational Information" },
483 { 0x2f, "Power" },
484 { 0x30, "RU Position Data" },
485 { 0x31, "Protocol Error" },
486 { 0x32, "Reason Code" },
487 { 0x33, "Receiver Diversity" },
488 { 0x34, "Replacement Unit Map" },
489 { 0x35, "Result Code" },
490 { 0x36, "RU Revision Data" },
491 { 0x38, "T3105" },
492 { 0x39, "Test Loop Setting" },
493 { 0x3a, "TF Mode" },
494 { 0x3b, "TF Compensation Value" },
495 { 0x3c, "Time Slot Number" },
496 { 0x3d, "TSC" },
497 { 0x3e, "RU Logical Id" },
498 { 0x3f, "RU Serial Number Data" },
499 { 0x40, "BTS Version" },
500 { 0x41, "OML IWD Version" },
501 { 0x42, "RWL IWD Version" },
502 { 0x43, "OML Function Map 1" },
503 { 0x44, "OML Function Map 2" },
504 { 0x45, "RSL Function Map 1" },
505 { 0x46, "RSL Function Map 2" },
506 { 0x47, "Extended Range Indicator" },
507 { 0x48, "Request Indicators" },
508 { 0x49, "DIP Alarm Condition Map" },
509 { 0x4a, "ES Incoming" },
510 { 0x4b, "ES Outgoing" },
511 { 0x4e, "SES Incoming" },
512 { 0x4f, "SES Outgoing" },
513 { 0x50, "Replacement Unit Map Extension" },
514 { 0x52, "UAS Incoming" },
515 { 0x53, "UAS Outgoing" },
516 { 0x58, "DF Incoming" },
517 { 0x5a, "DF Outgoing" },
518 { 0x5c, "SF" },
519 { 0x60, "S Bits Setting" },
520 { 0x61, "CRC-4 Use Option" },
521 { 0x62, "T Parameter" },
522 { 0x63, "N Parameter" },
523 { 0x64, "N1 Parameter" },
524 { 0x65, "N3 Parameter" },
525 { 0x66, "N4 Parameter" },
526 { 0x67, "P Parameter" },
527 { 0x68, "Q Parameter" },
528 { 0x69, "BI_Q1" },
529 { 0x6a, "BI_Q2" },
530 { 0x74, "ICM Boundary Parameters" },
531 { 0x77, "AFT" },
532 { 0x78, "AFT RAI" },
533 { 0x79, "Link Supervision Control" },
534 { 0x7a, "Link Supervision Filtering Time" },
535 { 0x7b, "Call Supervision Time" },
536 { 0x7c, "Interval Length UAS Incoming" },
537 { 0x7d, "Interval Length UAS Outgoing" },
538 { 0x7e, "ICM Channel Rate" },
539 { 0x7f, "Attribute Identifier" },
540 { 0x80, "FM Frequency List" },
541 { 0x81, "FM Frequency Report" },
542 { 0x82, "FM Percentile" },
543 { 0x83, "FM Clear Indication" },
544 { 0x84, "HW Info Signature" },
545 { 0x85, "MO Record" },
546 { 0x86, "TF Synchronisation Source" },
547 { 0x87, "TTA" },
548 { 0x88, "End Segment Number" },
549 { 0x89, "Segment Number" },
550 { 0x8a, "Capabilities Signature" },
551 { 0x8c, "File Relation List" },
552 { 0x90, "Negotiation Record I" },
553 { 0x91, "Negotiation Record II" },
554 { 0x92, "Encryption Algorithm" },
555 { 0x94, "Interference Rejection Combining" },
556 { 0x95, "Dedication Information" },
557 { 0x97, "Feature Code" },
558 { 0x98, "FS Offset" },
559 { 0x99, "ESB Timeslot" },
560 { 0x9a, "Master TG Instance" },
561 { 0x9b, "Master TX Chain Delay" },
562 { 0x9c, "External Condition Class 2 Extension" },
563 { 0x9d, "TSs MO State" },
564 { 0, NULL }
565};
566
Harald Weltee1d5eca2011-02-12 14:42:59 +0100567const struct value_string om2k_mo_class_short_vals[] = {
Harald Welte9a311ec2011-02-12 12:33:06 +0100568 { 0x01, "TRXC" },
569 { 0x03, "TS" },
570 { 0x04, "TF" },
571 { 0x05, "IS" },
572 { 0x06, "CON" },
573 { 0x07, "DP" },
574 { 0x0a, "CF" },
575 { 0x0b, "TX" },
576 { 0x0c, "RX" },
577 { 0, NULL }
578};
579
580static struct msgb *om2k_msgb_alloc(void)
581{
582 return msgb_alloc_headroom(OM_ALLOC_SIZE, OM_HEADROOM_SIZE,
583 "OM2000");
584}
585
Harald Weltee6e83832011-03-05 17:52:09 +0100586static int abis_om2k_tlv_parse(struct tlv_parsed *tp, const u_int8_t *buf, int len)
587{
588 return tlv_parse(tp, &om2k_att_tlvdef, buf, len, 0, 0);
589}
590
Harald Welted88a3872011-02-14 15:26:13 +0100591static char *om2k_mo_name(const struct abis_om2k_mo *mo)
592{
593 static char mo_buf[64];
594
595 memset(mo_buf, 0, sizeof(mo_buf));
596 snprintf(mo_buf, sizeof(mo_buf), "%s/%02x/%02x/%02x",
597 get_value_string(om2k_mo_class_short_vals, mo->class),
598 mo->bts, mo->assoc_so, mo->inst);
599 return mo_buf;
600}
601
Harald Weltebc867d92011-02-12 13:09:38 +0100602static int abis_om2k_sendmsg(struct gsm_bts *bts, struct msgb *msg)
603{
Harald Welted88a3872011-02-14 15:26:13 +0100604 struct abis_om2k_hdr *o2h;
605 int to_trx_oml;
Harald Weltebc867d92011-02-12 13:09:38 +0100606
Harald Welted88a3872011-02-14 15:26:13 +0100607 msg->l2h = msg->data;
608 o2h = (struct abis_om2k_hdr *) msg->l2h;
609
Harald Welte1164dce2011-03-05 19:21:26 +0100610 /* Compute the length in the OML header */
611 o2h->om.length = 6 + msgb_l2len(msg)-sizeof(*o2h);
612
Harald Welted88a3872011-02-14 15:26:13 +0100613 switch (o2h->mo.class) {
614 case OM2K_MO_CLS_TRXC:
615 case OM2K_MO_CLS_TX:
616 case OM2K_MO_CLS_RX:
617 case OM2K_MO_CLS_TS:
618 /* Route through per-TRX OML Link to the appropriate TRX */
619 to_trx_oml = 1;
620 msg->trx = gsm_bts_trx_by_nr(bts, o2h->mo.inst);
621 if (!msg->trx) {
622 LOGP(DNM, LOGL_ERROR, "MO=%s Tx Dropping msg to "
623 "non-existing TRX\n", om2k_mo_name(&o2h->mo));
624 return -ENODEV;
625 }
626 break;
627 default:
628 /* Route through the IXU/DXU OML Link */
629 msg->trx = bts->c0;
630 to_trx_oml = 0;
631 break;
632 }
633
634 return _abis_nm_sendmsg(msg, to_trx_oml);
Harald Weltebc867d92011-02-12 13:09:38 +0100635}
636
Harald Welte9a311ec2011-02-12 12:33:06 +0100637static void fill_om2k_hdr(struct abis_om2k_hdr *o2h, const struct abis_om2k_mo *mo,
Harald Welte1164dce2011-03-05 19:21:26 +0100638 uint16_t msg_type)
Harald Welte9a311ec2011-02-12 12:33:06 +0100639{
640 o2h->om.mdisc = ABIS_OM_MDISC_FOM;
641 o2h->om.placement = ABIS_OM_PLACEMENT_ONLY;
642 o2h->om.sequence = 0;
Harald Welte1164dce2011-03-05 19:21:26 +0100643 /* We fill o2h->om.length later during om2k_sendmsg() */
Harald Welte9a311ec2011-02-12 12:33:06 +0100644 o2h->msg_type = htons(msg_type);
645 memcpy(&o2h->mo, mo, sizeof(o2h->mo));
646}
647
Harald Welte73541072011-02-12 13:44:14 +0100648const struct abis_om2k_mo om2k_mo_cf = { OM2K_MO_CLS_CF, 0, 0xFF, 0 };
Harald Welte8bcb1a02011-02-12 20:23:40 +0100649const struct abis_om2k_mo om2k_mo_is = { OM2K_MO_CLS_IS, 0, 0xFF, 0 };
Harald Weltefdb71942011-02-14 15:31:43 +0100650const struct abis_om2k_mo om2k_mo_con = { OM2K_MO_CLS_CON, 0, 0xFF, 0 };
Harald Weltef9cf9612011-03-05 14:36:47 +0100651const struct abis_om2k_mo om2k_mo_tf = { OM2K_MO_CLS_TF, 0, 0xFF, 0 };
Harald Welte9a311ec2011-02-12 12:33:06 +0100652
653static int abis_om2k_cal_time_resp(struct gsm_bts *bts)
654{
655 struct msgb *msg = om2k_msgb_alloc();
656 struct abis_om2k_hdr *o2k;
657 time_t tm_t;
658 struct tm *tm;
659
660 o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k));
Harald Welte1164dce2011-03-05 19:21:26 +0100661 fill_om2k_hdr(o2k, &om2k_mo_cf, OM2K_MSGT_CAL_TIME_RESP);
Harald Welte9a311ec2011-02-12 12:33:06 +0100662
663 tm_t = time(NULL);
664 tm = localtime(&tm_t);
665
666 msgb_put_u8(msg, OM2K_DEI_CAL_TIME);
667 msgb_put_u8(msg, tm->tm_year % 100);
668 msgb_put_u8(msg, tm->tm_mon + 1);
669 msgb_put_u8(msg, tm->tm_mday);
670 msgb_put_u8(msg, tm->tm_hour);
671 msgb_put_u8(msg, tm->tm_min);
672 msgb_put_u8(msg, tm->tm_sec);
673
Harald Weltebc867d92011-02-12 13:09:38 +0100674 return abis_om2k_sendmsg(bts, msg);
Harald Welte9a311ec2011-02-12 12:33:06 +0100675}
676
Harald Welte6fec79d2011-02-12 14:57:17 +0100677static int abis_om2k_tx_simple(struct gsm_bts *bts, const struct abis_om2k_mo *mo,
Harald Welte9a311ec2011-02-12 12:33:06 +0100678 uint8_t msg_type)
679{
680 struct msgb *msg = om2k_msgb_alloc();
681 struct abis_om2k_hdr *o2k;
682
683 o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k));
Harald Welte1164dce2011-03-05 19:21:26 +0100684 fill_om2k_hdr(o2k, mo, msg_type);
Harald Welte9a311ec2011-02-12 12:33:06 +0100685
Harald Welte73541072011-02-12 13:44:14 +0100686 DEBUGP(DNM, "Tx MO=%s %s\n", om2k_mo_name(mo),
687 get_value_string(om2k_msgcode_vals, msg_type));
688
Harald Weltebc867d92011-02-12 13:09:38 +0100689 return abis_om2k_sendmsg(bts, msg);
Harald Welte9a311ec2011-02-12 12:33:06 +0100690}
691
Harald Welte6fec79d2011-02-12 14:57:17 +0100692int abis_om2k_tx_reset_cmd(struct gsm_bts *bts, const struct abis_om2k_mo *mo)
Harald Welte73541072011-02-12 13:44:14 +0100693{
694 return abis_om2k_tx_simple(bts, mo, OM2K_MSGT_RESET_CMD);
695}
696
Harald Welte6fec79d2011-02-12 14:57:17 +0100697int abis_om2k_tx_start_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo)
Harald Welte73541072011-02-12 13:44:14 +0100698{
699 return abis_om2k_tx_simple(bts, mo, OM2K_MSGT_START_REQ);
700}
701
Harald Welte6fec79d2011-02-12 14:57:17 +0100702int abis_om2k_tx_status_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo)
Harald Weltee1d5eca2011-02-12 14:42:59 +0100703{
704 return abis_om2k_tx_simple(bts, mo, OM2K_MSGT_STATUS_REQ);
705}
706
Harald Welte6fec79d2011-02-12 14:57:17 +0100707int abis_om2k_tx_connect_cmd(struct gsm_bts *bts, const struct abis_om2k_mo *mo)
708{
709 return abis_om2k_tx_simple(bts, mo, OM2K_MSGT_CONNECT_CMD);
710}
711
712int abis_om2k_tx_disconnect_cmd(struct gsm_bts *bts, const struct abis_om2k_mo *mo)
713{
714 return abis_om2k_tx_simple(bts, mo, OM2K_MSGT_DISCONNECT_CMD);
715}
716
Harald Welte8024d8f2011-02-12 15:07:30 +0100717int abis_om2k_tx_test_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo)
718{
719 return abis_om2k_tx_simple(bts, mo, OM2K_MSGT_TEST_REQ);
720}
721
Harald Welte0741ffe2011-02-12 18:48:53 +0100722int abis_om2k_tx_enable_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo)
723{
724 return abis_om2k_tx_simple(bts, mo, OM2K_MSGT_ENABLE_REQ);
725}
726
727int abis_om2k_tx_disable_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo)
728{
729 return abis_om2k_tx_simple(bts, mo, OM2K_MSGT_DISABLE_REQ);
730}
731
Harald Welte6fec79d2011-02-12 14:57:17 +0100732int abis_om2k_tx_op_info(struct gsm_bts *bts, const struct abis_om2k_mo *mo,
733 uint8_t operational)
Harald Welte9a311ec2011-02-12 12:33:06 +0100734{
735 struct msgb *msg = om2k_msgb_alloc();
736 struct abis_om2k_hdr *o2k;
737
738 o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k));
Harald Welte1164dce2011-03-05 19:21:26 +0100739 fill_om2k_hdr(o2k, mo, OM2K_MSGT_OP_INFO);
Harald Welte9a311ec2011-02-12 12:33:06 +0100740
741 msgb_tv_put(msg, OM2K_DEI_OP_INFO, operational);
742
Harald Welte73541072011-02-12 13:44:14 +0100743 DEBUGP(DNM, "Tx MO=%s %s\n", om2k_mo_name(mo),
744 get_value_string(om2k_msgcode_vals, OM2K_MSGT_OP_INFO));
745
Harald Weltebc867d92011-02-12 13:09:38 +0100746 return abis_om2k_sendmsg(bts, msg);
Harald Welte9a311ec2011-02-12 12:33:06 +0100747}
748
Harald Welte8bcb1a02011-02-12 20:23:40 +0100749int abis_om2k_tx_is_conf_req(struct gsm_bts *bts, struct om2k_is_conn_grp *cg,
750 unsigned int num_cg )
751{
752 struct msgb *msg = om2k_msgb_alloc();
753 struct abis_om2k_hdr *o2k;
754
755 o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k));
Harald Welte1164dce2011-03-05 19:21:26 +0100756 fill_om2k_hdr(o2k, &om2k_mo_is, OM2K_MSGT_IS_CONF_REQ);
Harald Welte8bcb1a02011-02-12 20:23:40 +0100757
758 msgb_tv_put(msg, OM2K_DEI_LIST_NR, 1);
759 msgb_tv_put(msg, OM2K_DEI_END_LIST_NR, 1);
760
761 msgb_tlv_put(msg, OM2K_DEI_IS_CONN_LIST,
762 num_cg * sizeof(*cg), (uint8_t *)cg);
763
764 return abis_om2k_sendmsg(bts, msg);
765}
766
Harald Weltefdb71942011-02-14 15:31:43 +0100767int abis_om2k_tx_con_conf_req(struct gsm_bts *bts, uint8_t *data,
768 unsigned int len)
769{
770 struct msgb *msg = om2k_msgb_alloc();
771 struct abis_om2k_hdr *o2k;
772
773 o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k));
Harald Welte1164dce2011-03-05 19:21:26 +0100774 fill_om2k_hdr(o2k, &om2k_mo_con, OM2K_MSGT_CON_CONF_REQ);
Harald Weltefdb71942011-02-14 15:31:43 +0100775
776 msgb_tv_put(msg, OM2K_DEI_LIST_NR, 1);
777 msgb_tv_put(msg, OM2K_DEI_END_LIST_NR, 1);
778
779 msgb_tlv_put(msg, OM2K_DEI_CON_CONN_LIST, len, data);
780
781 return abis_om2k_sendmsg(bts, msg);
782}
783
Harald Weltea0ce3492011-03-05 14:13:14 +0100784static void om2k_trx_to_mo(struct abis_om2k_mo *mo,
785 const struct gsm_bts_trx *trx,
786 enum abis_om2k_mo_cls cls)
787{
788 mo->class = cls;
789 mo->bts = 0;
790 mo->inst = trx->nr;
Harald Welte53492c82011-03-05 16:21:01 +0100791 mo->assoc_so = 255;
Harald Weltea0ce3492011-03-05 14:13:14 +0100792}
793
794static void om2k_ts_to_mo(struct abis_om2k_mo *mo,
795 const struct gsm_bts_trx_ts *ts)
796{
797 mo->class = OM2K_MO_CLS_TS;
798 mo->bts = 0;
799 mo->inst = ts->nr;
800 mo->assoc_so = ts->trx->nr;
801}
802
803/* Configure a Receiver MO */
804int abis_om2k_tx_rx_conf_req(struct gsm_bts_trx *trx)
805{
806 struct msgb *msg = om2k_msgb_alloc();
807 struct abis_om2k_hdr *o2k;
808 struct abis_om2k_mo mo;
809
810 om2k_trx_to_mo(&mo, trx, OM2K_MO_CLS_RX);
811
812 o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k));
Harald Welte1164dce2011-03-05 19:21:26 +0100813 fill_om2k_hdr(o2k, &mo, OM2K_MSGT_RX_CONF_REQ);
Harald Weltea0ce3492011-03-05 14:13:14 +0100814
815 msgb_tv16_put(msg, OM2K_DEI_FREQ_SPEC_RX, trx->arfcn);
816 msgb_tv_put(msg, OM2K_DEI_RX_DIVERSITY, 0x03); /* A+B */
817
818 return abis_om2k_sendmsg(trx->bts, msg);
819}
820
821/* Configure a Transmitter MO */
822int abis_om2k_tx_tx_conf_req(struct gsm_bts_trx *trx)
823{
824 struct msgb *msg = om2k_msgb_alloc();
825 struct abis_om2k_hdr *o2k;
826 struct abis_om2k_mo mo;
827
828 om2k_trx_to_mo(&mo, trx, OM2K_MO_CLS_TX);
829
830 o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k));
Harald Welte1164dce2011-03-05 19:21:26 +0100831 fill_om2k_hdr(o2k, &mo, OM2K_MSGT_TX_CONF_REQ);
Harald Weltea0ce3492011-03-05 14:13:14 +0100832
833 msgb_tv16_put(msg, OM2K_DEI_FREQ_SPEC_TX, trx->arfcn);
834 msgb_tv_put(msg, OM2K_DEI_POWER, trx->nominal_power-trx->max_power_red);
835 msgb_tv_put(msg, OM2K_DEI_FILLING_MARKER, 0); /* Filling enabled */
836 msgb_tv_put(msg, OM2K_DEI_BCC, trx->bts->bsic & 0x7);
837 /* Dedication Information is optional */
838
839 return abis_om2k_sendmsg(trx->bts, msg);
840}
841
Harald Weltef9cf9612011-03-05 14:36:47 +0100842enum abis_om2k_tf_mode {
843 OM2K_TF_MODE_MASTER = 0x00,
844 OM2K_TF_MODE_STANDALONE = 0x01,
845 OM2K_TF_MODE_SLAVE = 0x02,
846 OM2K_TF_MODE_UNDEFINED = 0xff,
847};
848
849static const uint8_t fs_offset_undef[5] = { 0xff, 0xff, 0xff, 0xff, 0xff };
850
851int abis_om2k_tx_tf_conf_req(struct gsm_bts *bts)
852{
853 struct msgb *msg = om2k_msgb_alloc();
854 struct abis_om2k_hdr *o2k;
855
856 o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k));
Harald Welte1164dce2011-03-05 19:21:26 +0100857 fill_om2k_hdr(o2k, &om2k_mo_tf, OM2K_MSGT_TF_CONF_REQ);
Harald Weltef9cf9612011-03-05 14:36:47 +0100858
859 msgb_tv_put(msg, OM2K_DEI_TF_MODE, OM2K_TF_MODE_STANDALONE);
860 msgb_tv_fixed_put(msg, OM2K_DEI_FS_OFFSET,
861 sizeof(fs_offset_undef), fs_offset_undef);
862
863 return abis_om2k_sendmsg(bts, msg);
864}
865
Harald Weltea0ce3492011-03-05 14:13:14 +0100866static uint8_t pchan2comb(enum gsm_phys_chan_config pchan)
867{
868 switch (pchan) {
869 case GSM_PCHAN_CCCH:
870 return 4;
871 case GSM_PCHAN_CCCH_SDCCH4:
872 return 5;
873 case GSM_PCHAN_SDCCH8_SACCH8C:
874 return 3;
875 case GSM_PCHAN_TCH_F:
876 case GSM_PCHAN_TCH_H:
877 case GSM_PCHAN_PDCH:
878 case GSM_PCHAN_TCH_F_PDCH:
879 return 8;
880 default:
881 return 0;
882 }
883}
884
Harald Welte5748c202011-03-05 17:30:07 +0100885static int put_freq_list(uint8_t *buf, uint16_t arfcn)
886{
887 buf[0] = 0x00; /* TX/RX address */
888 buf[1] = (arfcn >> 8);
889 buf[2] = (arfcn & 0xff);
890
891 return 3;
892}
893
Harald Weltea0ce3492011-03-05 14:13:14 +0100894/* Compute a frequency list in OM2000 fomrmat */
895static int om2k_gen_freq_list(uint8_t *list, struct gsm_bts_trx_ts *ts)
896{
897 uint8_t *cur = list;
Harald Weltee6e83832011-03-05 17:52:09 +0100898 int len;
Harald Weltea0ce3492011-03-05 14:13:14 +0100899
900 if (ts->hopping.enabled) {
901 unsigned int i;
902 for (i = 0; i < ts->hopping.arfcns.data_len*8; i++) {
Harald Welte5748c202011-03-05 17:30:07 +0100903 if (bitvec_get_bit_pos(&ts->hopping.arfcns, i))
904 cur += put_freq_list(cur, i);
Harald Weltea0ce3492011-03-05 14:13:14 +0100905 }
Harald Welte5748c202011-03-05 17:30:07 +0100906 } else
907 cur += put_freq_list(cur, ts->trx->arfcn);
908
Harald Weltee6e83832011-03-05 17:52:09 +0100909 len = cur - list;
910
911 return len;
Harald Weltea0ce3492011-03-05 14:13:14 +0100912}
913
914int abis_om2k_tx_ts_conf_req(struct gsm_bts_trx_ts *ts)
915{
916 struct msgb *msg = om2k_msgb_alloc();
917 struct abis_om2k_hdr *o2k;
918 struct abis_om2k_mo mo;
919 uint8_t freq_list[64*3]; /* BA max size: 64 ARFCN */
920 int freq_list_len;
921
922 om2k_ts_to_mo(&mo, ts);
923
Harald Welte5748c202011-03-05 17:30:07 +0100924 memset(freq_list, 0, sizeof(freq_list));
Harald Weltea0ce3492011-03-05 14:13:14 +0100925 freq_list_len = om2k_gen_freq_list(freq_list, ts);
926 if (freq_list_len < 0)
927 return freq_list_len;
928
929 o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k));
Harald Welte1164dce2011-03-05 19:21:26 +0100930 fill_om2k_hdr(o2k, &mo, OM2K_MSGT_TS_CONF_REQ);
Harald Weltea0ce3492011-03-05 14:13:14 +0100931
932 msgb_tv_put(msg, OM2K_DEI_COMBINATION, pchan2comb(ts->pchan));
933 msgb_tv_put(msg, OM2K_DEI_TS_NR, ts->nr);
934 msgb_tlv_put(msg, OM2K_DEI_FREQ_LIST, freq_list_len, freq_list);
935 msgb_tv_put(msg, OM2K_DEI_HSN, ts->hopping.hsn);
936 msgb_tv_put(msg, OM2K_DEI_MAIO, ts->hopping.maio);
937 msgb_tv_put(msg, OM2K_DEI_BSIC, ts->trx->bts->bsic);
938 msgb_tv_put(msg, OM2K_DEI_RX_DIVERSITY, 0x03); /* A+B */
939 msgb_tv16_put(msg, OM2K_DEI_FN_OFFSET, 0);
940 msgb_tv_put(msg, OM2K_DEI_EXT_RANGE, 0); /* Off */
941 /* Optional: Interference Rejection Combining */
Harald Welte1164dce2011-03-05 19:21:26 +0100942 msgb_tv_put(msg, OM2K_DEI_INTERF_REJ_COMB, 0x00);
943 switch (ts->pchan) {
944 case GSM_PCHAN_CCCH:
945 case GSM_PCHAN_CCCH_SDCCH4:
946 msgb_tv_put(msg, OM2K_DEI_BA_PA_MFRMS, 0x06);
947 msgb_tv_put(msg, OM2K_DEI_BS_AG_BKS_RES, 0x01);
948 msgb_tv_put(msg, OM2K_DEI_DRX_DEV_MAX, 0x05);
949 /* Repeat Paging/IMM.ASS: True, Allow Paging Type 3: Yes, Page for 5 seconds (default) */
950 msgb_tv_put(msg, OM2K_DEI_CCCH_OPTIONS, 0x01);
951 break;
952 case GSM_PCHAN_SDCCH8_SACCH8C:
953 msgb_tv_put(msg, OM2K_DEI_T3105, 0x04);
954 msgb_tv_put(msg, OM2K_DEI_NY1, 35);
955 msgb_tv_put(msg, OM2K_DEI_CBCH_INDICATOR, 0);
956 msgb_tv_put(msg, OM2K_DEI_TSC, ts->trx->bts->tsc);
957 /* Disable RF RESOURCE INDICATION on idle channels */
958 msgb_tv_put(msg, OM2K_DEI_ICM_INDICATOR, 0);
959 break;
960 default:
961 msgb_tv_put(msg, OM2K_DEI_T3105, 0x04);
962 msgb_tv_put(msg, OM2K_DEI_NY1, 35);
963 msgb_tv_put(msg, OM2K_DEI_CBCH_INDICATOR, 0);
964 msgb_tv_put(msg, OM2K_DEI_TSC, ts->trx->bts->tsc);
965 /* Disable RF RESOURCE INDICATION on idle channels */
966 msgb_tv_put(msg, OM2K_DEI_ICM_INDICATOR, 0);
967 msgb_tv_put(msg, OM2K_DEI_TTA, 10); /* Timer for Time Alignment */
968 msgb_tv_put(msg, OM2K_DEI_LSC, 1); /* enabled */
969 msgb_tv_put(msg, OM2K_DEI_LSC_FILT_TIME, 160); /* units of 100ms */
970 msgb_tv_put(msg, OM2K_DEI_CALL_SUPV_TIME, 8);
971 msgb_tv_put(msg, OM2K_DEI_ENCR_ALG, 0x00);
972 /* FIXME: do we need 9e/9f/a0? */
973 break;
974 }
Harald Weltea0ce3492011-03-05 14:13:14 +0100975
976 return abis_om2k_sendmsg(ts->trx->bts, msg);
977}
Harald Weltefdb71942011-02-14 15:31:43 +0100978
Harald Welte6fec79d2011-02-12 14:57:17 +0100979static int abis_om2k_tx_negot_req_ack(struct gsm_bts *bts, const struct abis_om2k_mo *mo,
Harald Welte73541072011-02-12 13:44:14 +0100980 uint8_t *data, unsigned int len)
981{
982 struct msgb *msg = om2k_msgb_alloc();
983 struct abis_om2k_hdr *o2k;
984
985 o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k));
Harald Welte1164dce2011-03-05 19:21:26 +0100986 fill_om2k_hdr(o2k, mo, OM2K_MSGT_NEGOT_REQ_ACK);
Harald Welte73541072011-02-12 13:44:14 +0100987
988 msgb_tlv_put(msg, OM2K_DEI_NEGOT_REC2, len, data);
989
990 DEBUGP(DNM, "Tx MO=%s %s\n", om2k_mo_name(mo),
991 get_value_string(om2k_msgcode_vals, OM2K_MSGT_NEGOT_REQ_ACK));
992
993 return abis_om2k_sendmsg(bts, msg);
994}
Harald Welte9a311ec2011-02-12 12:33:06 +0100995
Harald Welte563d3162011-02-12 18:11:16 +0100996struct iwd_version {
997 uint8_t gen_char[3+1];
998 uint8_t rev_char[3+1];
999};
1000
1001struct iwd_type {
1002 uint8_t num_vers;
1003 struct iwd_version v[8];
1004};
1005
Harald Welte9a311ec2011-02-12 12:33:06 +01001006static int om2k_rx_negot_req(struct msgb *msg)
1007{
1008 struct abis_om2k_hdr *o2h = msgb_l2(msg);
Harald Welte563d3162011-02-12 18:11:16 +01001009 struct iwd_type iwd_types[16];
1010 uint8_t num_iwd_types = o2h->data[2];
1011 uint8_t *cur = o2h->data+3;
1012 unsigned int i, v;
Harald Welte9a311ec2011-02-12 12:33:06 +01001013
Harald Welte563d3162011-02-12 18:11:16 +01001014 uint8_t out_buf[1024];
1015 uint8_t *out_cur = out_buf+1;
1016 uint8_t out_num_types = 0;
1017
1018 memset(iwd_types, 0, sizeof(iwd_types));
1019
1020 /* Parse the RBS-supported IWD versions into iwd_types array */
1021 for (i = 0; i < num_iwd_types; i++) {
1022 uint8_t num_versions = *cur++;
1023 uint8_t iwd_type = *cur++;
1024
1025 iwd_types[iwd_type].num_vers = num_versions;
1026
1027 for (v = 0; v < num_versions; v++) {
1028 struct iwd_version *iwd_v = &iwd_types[iwd_type].v[v];
1029
1030 memcpy(iwd_v->gen_char, cur, 3);
Harald Welte56ee6b82011-02-12 18:13:37 +01001031 cur += 3;
1032 memcpy(iwd_v->rev_char, cur, 3);
1033 cur += 3;
1034
Harald Welte563d3162011-02-12 18:11:16 +01001035 DEBUGP(DNM, "\tIWD Type %u Gen %s Rev %s\n", iwd_type,
1036 iwd_v->gen_char, iwd_v->rev_char);
1037 }
1038 }
1039
1040 /* Select the last version for each IWD type */
1041 for (i = 0; i < ARRAY_SIZE(iwd_types); i++) {
1042 struct iwd_type *type = &iwd_types[i];
1043 struct iwd_version *last_v;
1044
1045 if (type->num_vers == 0)
1046 continue;
1047
1048 out_num_types++;
1049
1050 last_v = &type->v[type->num_vers-1];
1051
1052 *out_cur++ = i;
1053 memcpy(out_cur, last_v->gen_char, 3);
1054 out_cur += 3;
1055 memcpy(out_cur, last_v->rev_char, 3);
1056 out_cur += 3;
1057 }
1058
1059 out_buf[0] = out_num_types;
1060
1061 return abis_om2k_tx_negot_req_ack(msg->trx->bts, &o2h->mo, out_buf, out_cur - out_buf);
Harald Welte9a311ec2011-02-12 12:33:06 +01001062}
1063
1064static int om2k_rx_start_res(struct msgb *msg)
1065{
1066 struct abis_om2k_hdr *o2h = msgb_l2(msg);
1067 int rc;
1068
1069 rc = abis_om2k_tx_simple(msg->trx->bts, &o2h->mo, OM2K_MSGT_START_RES_ACK);
1070 rc = abis_om2k_tx_op_info(msg->trx->bts, &o2h->mo, 1);
1071
1072 return rc;
1073}
1074
Harald Welte0741ffe2011-02-12 18:48:53 +01001075static int om2k_rx_op_info_ack(struct msgb *msg)
Harald Welte9a311ec2011-02-12 12:33:06 +01001076{
1077 struct abis_om2k_hdr *o2h = msgb_l2(msg);
Harald Welte9a311ec2011-02-12 12:33:06 +01001078
Harald Welte0741ffe2011-02-12 18:48:53 +01001079 /* FIXME: update Operational state in our structures */
Harald Welte9a311ec2011-02-12 12:33:06 +01001080
Harald Welte0741ffe2011-02-12 18:48:53 +01001081 return 0;
Harald Welte9a311ec2011-02-12 12:33:06 +01001082}
1083
Harald Weltee6e83832011-03-05 17:52:09 +01001084const struct value_string om2k_result_strings[] = {
1085 { 0x02, "Wrong state or out of sequence" },
1086 { 0x03, "File error" },
1087 { 0x04, "Fault, unspecified" },
1088 { 0x05, "Tuning fault" },
1089 { 0x06, "Protocol error" },
1090 { 0x07, "MO not connected" },
1091 { 0x08, "Parameter error" },
1092 { 0x09, "Optional function not supported" },
1093 { 0x0a, "Local access state LOCALLY DISCONNECTED" },
1094 { 0, NULL }
1095};
1096
1097static int om2k_rx_nack(struct msgb *msg)
1098{
1099 struct abis_om2k_hdr *o2h = msgb_l2(msg);
1100 uint16_t msg_type = ntohs(o2h->msg_type);
1101 struct tlv_parsed tp;
1102
1103 LOGP(DNM, LOGL_ERROR, "Rx MO=%s %s", om2k_mo_name(&o2h->mo),
1104 get_value_string(om2k_msgcode_vals, msg_type));
1105
1106 abis_om2k_tlv_parse(&tp, o2h->data, o2h->om.length - 6);
1107 if (TLVP_PRESENT(&tp, OM2K_DEI_REASON_CODE))
1108 LOGPC(DNM, LOGL_ERROR, ", Reason 0x%02x",
1109 *TLVP_VAL(&tp, OM2K_DEI_REASON_CODE));
1110
1111 if (TLVP_PRESENT(&tp, OM2K_DEI_RESULT_CODE))
1112 LOGPC(DNM, LOGL_ERROR, ", Result %s",
1113 get_value_string(om2k_result_strings,
1114 *TLVP_VAL(&tp, OM2K_DEI_RESULT_CODE)));
1115 LOGPC(DNM, LOGL_ERROR, "\n");
1116
1117 return 0;
1118}
1119
Harald Welte9a311ec2011-02-12 12:33:06 +01001120int abis_om2k_rcvmsg(struct msgb *msg)
1121{
1122 struct gsm_bts *bts = msg->trx->bts;
1123 struct abis_om2k_hdr *o2h = msgb_l2(msg);
1124 struct abis_om_hdr *oh = &o2h->om;
Harald Weltebc867d92011-02-12 13:09:38 +01001125 uint16_t msg_type = ntohs(o2h->msg_type);
Harald Welte9a311ec2011-02-12 12:33:06 +01001126 int rc = 0;
1127
1128 /* Various consistency checks */
1129 if (oh->placement != ABIS_OM_PLACEMENT_ONLY) {
1130 LOGP(DNM, LOGL_ERROR, "ABIS OML placement 0x%x not supported\n",
1131 oh->placement);
1132 if (oh->placement != ABIS_OM_PLACEMENT_FIRST)
1133 return -EINVAL;
1134 }
1135 if (oh->sequence != 0) {
1136 LOGP(DNM, LOGL_ERROR, "ABIS OML sequence 0x%x != 0x00\n",
1137 oh->sequence);
1138 return -EINVAL;
1139 }
1140
1141 msg->l3h = (unsigned char *)o2h + sizeof(*o2h);
1142
1143 if (oh->mdisc != ABIS_OM_MDISC_FOM) {
1144 LOGP(DNM, LOGL_ERROR, "unknown ABIS OM2000 message discriminator 0x%x\n",
1145 oh->mdisc);
1146 return -EINVAL;
1147 }
1148
Harald Welte73541072011-02-12 13:44:14 +01001149 DEBUGP(DNM, "Rx MO=%s %s (%s)\n", om2k_mo_name(&o2h->mo),
Harald Weltebc867d92011-02-12 13:09:38 +01001150 get_value_string(om2k_msgcode_vals, msg_type),
Harald Welte9a311ec2011-02-12 12:33:06 +01001151 hexdump(msg->l2h, msgb_l2len(msg)));
1152
Harald Weltebc867d92011-02-12 13:09:38 +01001153 switch (msg_type) {
Harald Welte9a311ec2011-02-12 12:33:06 +01001154 case OM2K_MSGT_CAL_TIME_REQ:
1155 rc = abis_om2k_cal_time_resp(bts);
1156 break;
1157 case OM2K_MSGT_FAULT_REP:
Harald Welte9a311ec2011-02-12 12:33:06 +01001158 rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_FAULT_REP_ACK);
1159 break;
1160 case OM2K_MSGT_NEGOT_REQ:
1161 rc = om2k_rx_negot_req(msg);
1162 break;
1163 case OM2K_MSGT_START_RES:
1164 rc = om2k_rx_start_res(msg);
1165 break;
Harald Welte0741ffe2011-02-12 18:48:53 +01001166 case OM2K_MSGT_OP_INFO_ACK:
1167 rc = om2k_rx_op_info_ack(msg);
Harald Welte9a311ec2011-02-12 12:33:06 +01001168 break;
1169 case OM2K_MSGT_IS_CONF_RES:
1170 rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_IS_CONF_RES_ACK);
1171 break;
Harald Weltefdb71942011-02-14 15:31:43 +01001172 case OM2K_MSGT_CON_CONF_RES:
1173 rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_CON_CONF_RES_ACK);
1174 break;
Harald Weltea0ce3492011-03-05 14:13:14 +01001175 case OM2K_MSGT_TX_CONF_RES:
1176 rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_TX_CONF_RES_ACK);
1177 break;
1178 case OM2K_MSGT_RX_CONF_RES:
1179 rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_RX_CONF_RES_ACK);
1180 break;
1181 case OM2K_MSGT_TS_CONF_RES:
1182 rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_TS_CONF_RES_ACK);
1183 break;
Harald Weltef9cf9612011-03-05 14:36:47 +01001184 case OM2K_MSGT_TF_CONF_RES:
1185 rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_TF_CONF_RES_ACK);
1186 break;
Harald Welte9a311ec2011-02-12 12:33:06 +01001187 case OM2K_MSGT_CONNECT_COMPL:
1188 rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_RESET_CMD);
1189 break;
1190 case OM2K_MSGT_RESET_COMPL:
1191 rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_START_REQ);
1192 break;
Harald Welteb3d70fd2011-02-13 12:43:44 +01001193 case OM2K_MSGT_ENABLE_RES:
1194 rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_ENABLE_RES_ACK);
1195 break;
Harald Weltefdb71942011-02-14 15:31:43 +01001196 case OM2K_MSGT_DISABLE_RES:
1197 rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_DISABLE_RES_ACK);
1198 break;
1199 case OM2K_MSGT_TEST_RES:
1200 rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_TEST_RES_ACK);
Harald Welte9a311ec2011-02-12 12:33:06 +01001201 break;
Harald Welte0741ffe2011-02-12 18:48:53 +01001202 case OM2K_MSGT_STATUS_RESP:
1203 break;
Harald Weltefdb71942011-02-14 15:31:43 +01001204 case OM2K_MSGT_START_REQ_ACK:
1205 case OM2K_MSGT_CON_CONF_REQ_ACK:
1206 case OM2K_MSGT_IS_CONF_REQ_ACK:
Harald Weltea0ce3492011-03-05 14:13:14 +01001207 case OM2K_MSGT_TX_CONF_REQ_ACK:
1208 case OM2K_MSGT_RX_CONF_REQ_ACK:
1209 case OM2K_MSGT_TS_CONF_REQ_ACK:
Harald Weltef9cf9612011-03-05 14:36:47 +01001210 case OM2K_MSGT_TF_CONF_REQ_ACK:
Harald Weltefdb71942011-02-14 15:31:43 +01001211 case OM2K_MSGT_ENABLE_REQ_ACK:
1212 case OM2K_MSGT_ALARM_STATUS_REQ_ACK:
1213 case OM2K_MSGT_DISABLE_REQ_ACK:
1214 break;
Harald Weltee6e83832011-03-05 17:52:09 +01001215 case OM2K_MSGT_START_REQ_REJ:
Harald Welte3ede7232011-03-05 17:58:13 +01001216 case OM2K_MSGT_CONNECT_REJ:
Harald Welteaff63bc2011-03-05 19:42:16 +01001217 case OM2K_MSGT_OP_INFO_REJ:
Harald Welte3ede7232011-03-05 17:58:13 +01001218 case OM2K_MSGT_DISCONNECT_REJ:
Harald Welteaff63bc2011-03-05 19:42:16 +01001219 case OM2K_MSGT_TEST_REQ_REJ:
Harald Weltee6e83832011-03-05 17:52:09 +01001220 case OM2K_MSGT_CON_CONF_REQ_REJ:
1221 case OM2K_MSGT_IS_CONF_REQ_REJ:
1222 case OM2K_MSGT_TX_CONF_REQ_REJ:
1223 case OM2K_MSGT_RX_CONF_REQ_REJ:
1224 case OM2K_MSGT_TS_CONF_REQ_REJ:
1225 case OM2K_MSGT_TF_CONF_REQ_REJ:
1226 case OM2K_MSGT_ENABLE_REQ_REJ:
1227 case OM2K_MSGT_ALARM_STATUS_REQ_REJ:
1228 case OM2K_MSGT_DISABLE_REQ_REJ:
1229 rc = om2k_rx_nack(msg);
1230 break;
Harald Welte9a311ec2011-02-12 12:33:06 +01001231 default:
Harald Welte0741ffe2011-02-12 18:48:53 +01001232 LOGP(DNM, LOGL_NOTICE, "Rx unhandled OM2000 msg %s\n",
Harald Weltebc867d92011-02-12 13:09:38 +01001233 get_value_string(om2k_msgcode_vals, msg_type));
Harald Welte9a311ec2011-02-12 12:33:06 +01001234 }
1235
1236 msgb_free(msg);
1237 return rc;
1238}