blob: 021f870d78d5a088b0036c5d71f8b5bf9c51ce80 [file] [log] [blame]
Holger Hans Peter Freytherbfdd5f22013-10-16 17:29:31 +02001/* AllocTest.cpp
2 *
3 * Copyright (C) 2013 by Holger Hans Peter Freyther
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
20#include "gprs_rlcmac.h"
21#include "gprs_debug.h"
22#include "tbf.h"
Holger Hans Peter Freyther34bd8bd2013-10-19 21:10:38 +020023#include "bts.h"
Holger Hans Peter Freytherbfdd5f22013-10-16 17:29:31 +020024
25#include <string.h>
26#include <stdio.h>
27
28extern "C" {
29#include <osmocom/core/application.h>
30#include <osmocom/core/msgb.h>
31#include <osmocom/core/talloc.h>
32#include <osmocom/core/utils.h>
33}
34
35/* globals used by the code */
36void *tall_pcu_ctx;
Holger Hans Peter Freytherbfdd5f22013-10-16 17:29:31 +020037int16_t spoof_mnc = 0, spoof_mcc = 0;
38
Daniel Willmann48aa0b02014-07-16 18:54:10 +020039static gprs_rlcmac_tbf *tbf_alloc(struct gprs_rlcmac_bts *bts,
Jacob Erlbecke2e004e2015-06-18 17:16:26 +020040 GprsMs *ms, gprs_rlcmac_tbf_direction dir,
Jacob Erlbeck5879c642015-07-10 10:41:36 +020041 uint8_t use_trx,
Daniel Willmann48aa0b02014-07-16 18:54:10 +020042 uint8_t ms_class, uint8_t single_slot)
43{
44 if (dir == GPRS_RLCMAC_UL_TBF)
Jacob Erlbeck5879c642015-07-10 10:41:36 +020045 return tbf_alloc_ul_tbf(bts, ms, use_trx, ms_class, single_slot);
Daniel Willmann48aa0b02014-07-16 18:54:10 +020046 else
Jacob Erlbeck5879c642015-07-10 10:41:36 +020047 return tbf_alloc_dl_tbf(bts, ms, use_trx, ms_class, single_slot);
Daniel Willmann48aa0b02014-07-16 18:54:10 +020048}
49
Jacob Erlbeck61205a72015-07-09 11:35:50 +020050static void check_tfi_usage(BTS *the_bts)
51{
52 int pdch_no;
53 struct gprs_rlcmac_bts *bts = the_bts->bts_data();
54
55 struct gprs_rlcmac_tbf *tfi_usage[8][8][2][32] = {{{{NULL}}}};
56 struct llist_head *tbf_lists[2] = {
57 &bts->ul_tbfs,
58 &bts->dl_tbfs
59 };
60
61 gprs_rlcmac_tbf *tbf;
62 struct llist_pods *lpods;
63 unsigned list_idx;
64 struct gprs_rlcmac_tbf **tbf_var;
65
66 for (list_idx = 0; list_idx < ARRAY_SIZE(tbf_lists); list_idx += 1)
67 {
68
69 llist_pods_for_each_entry(tbf, tbf_lists[list_idx], list, lpods) {
70 for (pdch_no = 0; pdch_no < 8; pdch_no += 1) {
71 struct gprs_rlcmac_pdch *pdch = tbf->pdch[pdch_no];
72 if (pdch == NULL)
73 continue;
74
75 tbf_var = &tfi_usage
76 [tbf->trx->trx_no]
77 [pdch_no]
78 [tbf->direction]
79 [tbf->tfi()];
80
81 OSMO_ASSERT(*tbf_var == NULL);
82 if (tbf->direction == GPRS_RLCMAC_DL_TBF) {
83 OSMO_ASSERT(pdch->dl_tbf_by_tfi(
84 tbf->tfi()) == tbf);
Jacob Erlbeck61205a72015-07-09 11:35:50 +020085 OSMO_ASSERT(the_bts->dl_tbf_by_tfi(
86 tbf->tfi(),
Jacob Erlbeck3a10dbd2015-07-10 19:52:37 +020087 tbf->trx->trx_no,
88 pdch_no) == tbf);
Jacob Erlbeck61205a72015-07-09 11:35:50 +020089 } else {
90 OSMO_ASSERT(pdch->ul_tbf_by_tfi(
91 tbf->tfi()) == tbf);
Jacob Erlbeck61205a72015-07-09 11:35:50 +020092 OSMO_ASSERT(the_bts->ul_tbf_by_tfi(
93 tbf->tfi(),
Jacob Erlbeck3a10dbd2015-07-10 19:52:37 +020094 tbf->trx->trx_no,
95 pdch_no) == tbf);
Jacob Erlbeck61205a72015-07-09 11:35:50 +020096 }
97 *tbf_var = tbf;
Jacob Erlbeck47a57f62015-07-08 12:53:16 +020098 OSMO_ASSERT(pdch->assigned_tfi(tbf->direction) &
99 (1 << tbf->tfi()));
Jacob Erlbeck61205a72015-07-09 11:35:50 +0200100 }
101 }
102 }
103}
104
Jacob Erlbeckfa464bb2015-06-29 12:45:11 +0200105static void test_alloc_a(gprs_rlcmac_tbf_direction dir,
106 uint8_t slots, const int count)
Holger Hans Peter Freytherbfdd5f22013-10-16 17:29:31 +0200107{
108 int tfi;
Jacob Erlbeckfa464bb2015-06-29 12:45:11 +0200109 int i;
Jacob Erlbeck61205a72015-07-09 11:35:50 +0200110 uint8_t used_trx, tmp_trx;
Holger Hans Peter Freyther34bd8bd2013-10-19 21:10:38 +0200111 BTS the_bts;
112 struct gprs_rlcmac_bts *bts;
Jacob Erlbecke0853cd2015-07-10 12:25:25 +0200113 struct gprs_rlcmac_tbf *tbfs[32*8+1] = { 0, };
Holger Hans Peter Freytherbfdd5f22013-10-16 17:29:31 +0200114
115 printf("Testing alloc_a direction(%d)\n", dir);
116
Holger Hans Peter Freyther34bd8bd2013-10-19 21:10:38 +0200117 bts = the_bts.bts_data();
118 bts->alloc_algorithm = alloc_algorithm_a;
Holger Hans Peter Freytherbfdd5f22013-10-16 17:29:31 +0200119
Holger Hans Peter Freyther34bd8bd2013-10-19 21:10:38 +0200120 struct gprs_rlcmac_trx *trx = &bts->trx[0];
Jacob Erlbeckfa464bb2015-06-29 12:45:11 +0200121 for (i = 0; i < 8; i += 1)
122 if (slots & (1 << i))
123 trx->pdch[i].enable();
124
125 OSMO_ASSERT(count >= 0 && count <= (int)ARRAY_SIZE(tbfs));
Holger Hans Peter Freytherbfdd5f22013-10-16 17:29:31 +0200126
127 /**
128 * Currently alloc_a will only allocate from the first
129 * PDCH and all possible usf's. We run out of usf's before
130 * we are out of tfi's. Observe this and make sure that at
131 * least this part is working okay.
132 */
Jacob Erlbecke0853cd2015-07-10 12:25:25 +0200133 for (i = 0; i < (int)ARRAY_SIZE(tbfs); ++i) {
Jacob Erlbeck5879c642015-07-10 10:41:36 +0200134 tbfs[i] = tbf_alloc(bts, NULL, dir, -1, 0, 0);
Jacob Erlbecke0853cd2015-07-10 12:25:25 +0200135 if (tbfs[i] == NULL)
136 break;
137
138 used_trx = tbfs[i]->trx->trx_no;
Jacob Erlbeck61205a72015-07-09 11:35:50 +0200139 tfi = the_bts.tfi_find_free(dir, &tmp_trx, used_trx);
140 OSMO_ASSERT(tbfs[i]->tfi() != tfi);
Holger Hans Peter Freytherbfdd5f22013-10-16 17:29:31 +0200141 }
142
Jacob Erlbecke0853cd2015-07-10 12:25:25 +0200143 check_tfi_usage(&the_bts);
Holger Hans Peter Freytherbfdd5f22013-10-16 17:29:31 +0200144
Jacob Erlbecke0853cd2015-07-10 12:25:25 +0200145 OSMO_ASSERT(i == count);
146
147 for (i = 0; i < count; ++i)
Holger Hans Peter Freytherbfdd5f22013-10-16 17:29:31 +0200148 if (tbfs[i])
149 tbf_free(tbfs[i]);
150
Jacob Erlbeck5879c642015-07-10 10:41:36 +0200151 tbfs[tfi] = tbf_alloc(bts, NULL, dir, -1, 0, 0);
Holger Hans Peter Freytherbfdd5f22013-10-16 17:29:31 +0200152 OSMO_ASSERT(tbfs[tfi]);
153 tbf_free(tbfs[tfi]);
154}
155
156static void test_alloc_a()
157{
Jacob Erlbeckfa464bb2015-06-29 12:45:11 +0200158 /* slots 2 - 3 */
Jacob Erlbecke0853cd2015-07-10 12:25:25 +0200159 test_alloc_a(GPRS_RLCMAC_DL_TBF, 0x0c, 32*2);
Jacob Erlbeckec478752015-06-19 16:35:38 +0200160 test_alloc_a(GPRS_RLCMAC_UL_TBF, 0x0c, 14);
Jacob Erlbeckfa464bb2015-06-29 12:45:11 +0200161
162 /* slots 1 - 5 */
Jacob Erlbecke0853cd2015-07-10 12:25:25 +0200163 test_alloc_a(GPRS_RLCMAC_DL_TBF, 0x1e, 32*4);
Jacob Erlbeckec478752015-06-19 16:35:38 +0200164 test_alloc_a(GPRS_RLCMAC_UL_TBF, 0x1e, 28);
Holger Hans Peter Freytherbfdd5f22013-10-16 17:29:31 +0200165}
166
Holger Hans Peter Freyther4af30532013-12-25 19:16:55 +0100167static void dump_assignment(struct gprs_rlcmac_tbf *tbf, const char *dir)
168{
Jacob Erlbeck1f332942015-05-04 08:21:17 +0200169 for (size_t i = 0; i < ARRAY_SIZE(tbf->pdch); ++i)
Holger Hans Peter Freyther4af30532013-12-25 19:16:55 +0100170 if (tbf->pdch[i])
171 printf("PDCH[%d] is used for %s\n", i, dir);
172 printf("PDCH[%d] is control_ts for %s\n", tbf->control_ts, dir);
173 printf("PDCH[%d] is first common for %s\n", tbf->first_common_ts, dir);
174}
175
Holger Hans Peter Freytherc7b998c2013-12-25 19:25:10 +0100176static void test_alloc_b(int ms_class)
Holger Hans Peter Freyther4af30532013-12-25 19:16:55 +0100177{
Holger Hans Peter Freytherc7b998c2013-12-25 19:25:10 +0100178 printf("Going to test multislot assignment MS_CLASS=%d\n", ms_class);
Holger Hans Peter Freyther4af30532013-12-25 19:16:55 +0100179 /*
180 * PDCH is on TS 6,7,8 and we start with a UL allocation and
181 * then follow two DL allocations (once single, once normal).
182 *
183 * Uplink assigned and still available..
184 */
185 {
186 BTS the_bts;
187 struct gprs_rlcmac_bts *bts;
188 struct gprs_rlcmac_trx *trx;
Jacob Erlbeck1f332942015-05-04 08:21:17 +0200189 uint8_t trx_no;
Holger Hans Peter Freyther4af30532013-12-25 19:16:55 +0100190
191 gprs_rlcmac_tbf *ul_tbf, *dl_tbf;
192
193 printf("Testing UL then DL assignment.\n");
194
195 bts = the_bts.bts_data();
196 bts->alloc_algorithm = alloc_algorithm_b;
197
198 trx = &bts->trx[0];
199 trx->pdch[5].enable();
200 trx->pdch[6].enable();
201 trx->pdch[7].enable();
202
Jacob Erlbeck5879c642015-07-10 10:41:36 +0200203 ul_tbf = tbf_alloc_ul_tbf(bts, NULL, -1, ms_class, 1);
Holger Hans Peter Freyther4af30532013-12-25 19:16:55 +0100204 OSMO_ASSERT(ul_tbf);
Jacob Erlbeck5879c642015-07-10 10:41:36 +0200205 OSMO_ASSERT(ul_tbf->ms());
206 OSMO_ASSERT(ul_tbf->ms()->current_trx());
207 trx_no = ul_tbf->ms()->current_trx()->trx_no;
Holger Hans Peter Freyther4af30532013-12-25 19:16:55 +0100208 dump_assignment(ul_tbf, "UL");
209
210 /* assume final ack has not been sent */
Jacob Erlbeck5879c642015-07-10 10:41:36 +0200211 dl_tbf = tbf_alloc_dl_tbf(bts, ul_tbf->ms(), trx_no, ms_class, 0);
Holger Hans Peter Freyther4af30532013-12-25 19:16:55 +0100212 OSMO_ASSERT(dl_tbf);
213 dump_assignment(dl_tbf, "DL");
214
Holger Hans Peter Freytherc7b998c2013-12-25 19:25:10 +0100215 OSMO_ASSERT(dl_tbf->first_common_ts == ul_tbf->first_common_ts);
216
Jacob Erlbeck61205a72015-07-09 11:35:50 +0200217 check_tfi_usage(&the_bts);
218
Holger Hans Peter Freyther4af30532013-12-25 19:16:55 +0100219 tbf_free(dl_tbf);
220 tbf_free(ul_tbf);
221 }
222
223 /**
224 * Test with the other order.. first DL and then UL
225 */
226 {
227 BTS the_bts;
228 struct gprs_rlcmac_bts *bts;
229 struct gprs_rlcmac_trx *trx;
Jacob Erlbeck1f332942015-05-04 08:21:17 +0200230 uint8_t trx_no;
Holger Hans Peter Freyther4af30532013-12-25 19:16:55 +0100231
Daniel Willmann351a5732014-08-07 12:57:44 +0200232 gprs_rlcmac_ul_tbf *ul_tbf;
233 gprs_rlcmac_dl_tbf *dl_tbf;
Holger Hans Peter Freyther4af30532013-12-25 19:16:55 +0100234
235 printf("Testing DL then UL assignment followed by update\n");
236
237 bts = the_bts.bts_data();
238 bts->alloc_algorithm = alloc_algorithm_b;
239
240 trx = &bts->trx[0];
241 trx->pdch[5].enable();
242 trx->pdch[6].enable();
243 trx->pdch[7].enable();
244
Jacob Erlbeck5879c642015-07-10 10:41:36 +0200245 dl_tbf = tbf_alloc_dl_tbf(bts, NULL, -1, ms_class, 1);
Jacob Erlbeck767193e2015-05-20 12:06:46 +0200246 dl_tbf->update_ms(0x23, GPRS_RLCMAC_DL_TBF);
Holger Hans Peter Freyther4af30532013-12-25 19:16:55 +0100247 OSMO_ASSERT(dl_tbf);
Jacob Erlbeck5879c642015-07-10 10:41:36 +0200248 OSMO_ASSERT(dl_tbf->ms());
249 OSMO_ASSERT(dl_tbf->ms()->current_trx());
250 trx_no = dl_tbf->ms()->current_trx()->trx_no;
Holger Hans Peter Freyther4af30532013-12-25 19:16:55 +0100251 dump_assignment(dl_tbf, "DL");
252
Jacob Erlbeck5879c642015-07-10 10:41:36 +0200253 ul_tbf = tbf_alloc_ul_tbf(bts, dl_tbf->ms(), trx_no, ms_class, 0);
Jacob Erlbeck767193e2015-05-20 12:06:46 +0200254 ul_tbf->update_ms(0x23, GPRS_RLCMAC_UL_TBF);
Daniel Willmann7e994e32014-08-07 15:49:21 +0200255 ul_tbf->m_contention_resolution_done = 1;
Holger Hans Peter Freyther4af30532013-12-25 19:16:55 +0100256 OSMO_ASSERT(ul_tbf);
257 dump_assignment(ul_tbf, "UL");
258
Holger Hans Peter Freytherc7b998c2013-12-25 19:25:10 +0100259 OSMO_ASSERT(dl_tbf->first_common_ts == ul_tbf->first_common_ts);
260
Holger Hans Peter Freyther4af30532013-12-25 19:16:55 +0100261 /* now update the dl_tbf */
262 dl_tbf->update();
263 dump_assignment(dl_tbf, "DL");
Holger Hans Peter Freytherc7b998c2013-12-25 19:25:10 +0100264 OSMO_ASSERT(dl_tbf->first_common_ts == ul_tbf->first_common_ts);
Holger Hans Peter Freyther4af30532013-12-25 19:16:55 +0100265
Jacob Erlbeck61205a72015-07-09 11:35:50 +0200266 check_tfi_usage(&the_bts);
267
Holger Hans Peter Freyther4af30532013-12-25 19:16:55 +0100268 tbf_free(dl_tbf);
269 tbf_free(ul_tbf);
270 }
271
272 /* Andreas osmocom-pcu example */
273 {
274 BTS the_bts;
275 struct gprs_rlcmac_bts *bts;
276 struct gprs_rlcmac_trx *trx;
277 int tfi;
Jacob Erlbeck1f332942015-05-04 08:21:17 +0200278 uint8_t trx_no;
Holger Hans Peter Freyther4af30532013-12-25 19:16:55 +0100279
280 gprs_rlcmac_tbf *ul_tbf, *dl_tbf;
281
282 printf("Testing jolly example\n");
283
284 bts = the_bts.bts_data();
285 bts->alloc_algorithm = alloc_algorithm_b;
286
287 trx = &bts->trx[0];
288 trx->pdch[1].enable();
289 trx->pdch[2].enable();
290 trx->pdch[3].enable();
291 trx->pdch[4].enable();
292
293 tfi = the_bts.tfi_find_free(GPRS_RLCMAC_UL_TBF, &trx_no, -1);
294 OSMO_ASSERT(tfi >= 0);
Jacob Erlbeck5879c642015-07-10 10:41:36 +0200295 ul_tbf = tbf_alloc_ul_tbf(bts, NULL, .1, ms_class, 0);
Holger Hans Peter Freyther4af30532013-12-25 19:16:55 +0100296 OSMO_ASSERT(ul_tbf);
Jacob Erlbeck5879c642015-07-10 10:41:36 +0200297 OSMO_ASSERT(ul_tbf->ms());
298 OSMO_ASSERT(ul_tbf->ms()->current_trx());
299 trx_no = ul_tbf->ms()->current_trx()->trx_no;
Holger Hans Peter Freyther4af30532013-12-25 19:16:55 +0100300 dump_assignment(ul_tbf, "UL");
301
302 /* assume final ack has not been sent */
Jacob Erlbeck5879c642015-07-10 10:41:36 +0200303 dl_tbf = tbf_alloc_dl_tbf(bts, ul_tbf->ms(), trx_no, ms_class, 0);
Holger Hans Peter Freyther4af30532013-12-25 19:16:55 +0100304 OSMO_ASSERT(dl_tbf);
305 dump_assignment(dl_tbf, "DL");
306
Holger Hans Peter Freytherc7b998c2013-12-25 19:25:10 +0100307 OSMO_ASSERT(dl_tbf->first_common_ts == ul_tbf->first_common_ts);
308
Jacob Erlbeck61205a72015-07-09 11:35:50 +0200309 check_tfi_usage(&the_bts);
310
Holger Hans Peter Freyther4af30532013-12-25 19:16:55 +0100311 tbf_free(dl_tbf);
312 tbf_free(ul_tbf);
313 }
314}
315
Holger Hans Peter Freytherf3eec042013-12-26 10:19:18 +0100316#define ENABLE_PDCH(ts_no, enable_flag, trx) \
317 if (enable_flag) \
318 trx->pdch[ts_no].enable();
319
320static void test_alloc_b(bool ts0, bool ts1, bool ts2, bool ts3, bool ts4, bool ts5, bool ts6, bool ts7, int ms_class)
321{
322 /* we can test the allocation failures differently */
323 if (!ts0 && !ts1 && !ts2 && !ts3 && !ts4 && !ts5 && !ts6 && !ts7)
324 return;
325
326 printf("Mass test: TS0(%c%c%c%c%c%c%c%c)TS7 MS_Class=%d\n",
327 ts0 ? 'O' : 'x',
328 ts1 ? 'O' : 'x',
329 ts2 ? 'O' : 'x',
330 ts3 ? 'O' : 'x',
331 ts4 ? 'O' : 'x',
332 ts5 ? 'O' : 'x',
333 ts6 ? 'O' : 'x',
334 ts7 ? 'O' : 'x', ms_class);
335 fflush(stdout);
336
337 {
338 BTS the_bts;
339 struct gprs_rlcmac_bts *bts;
340 struct gprs_rlcmac_trx *trx;
Jacob Erlbeck1f332942015-05-04 08:21:17 +0200341 uint8_t trx_no;
Holger Hans Peter Freytherf3eec042013-12-26 10:19:18 +0100342
343 gprs_rlcmac_tbf *ul_tbf, *dl_tbf;
344
345 bts = the_bts.bts_data();
346 bts->alloc_algorithm = alloc_algorithm_b;
347
348 trx = &bts->trx[0];
349 ENABLE_PDCH(0, ts0, trx);
350 ENABLE_PDCH(1, ts1, trx);
351 ENABLE_PDCH(2, ts2, trx);
352 ENABLE_PDCH(3, ts3, trx);
353 ENABLE_PDCH(4, ts4, trx);
354 ENABLE_PDCH(5, ts5, trx);
355 ENABLE_PDCH(6, ts6, trx);
356 ENABLE_PDCH(7, ts7, trx);
357
Jacob Erlbeck5879c642015-07-10 10:41:36 +0200358 ul_tbf = tbf_alloc_ul_tbf(bts, NULL, -1, ms_class, 1);
359 OSMO_ASSERT(ul_tbf->ms());
360 OSMO_ASSERT(ul_tbf->ms()->current_trx());
361 trx_no = ul_tbf->ms()->current_trx()->trx_no;
Holger Hans Peter Freytherf3eec042013-12-26 10:19:18 +0100362 OSMO_ASSERT(ul_tbf);
363
364 /* assume final ack has not been sent */
Jacob Erlbeck5879c642015-07-10 10:41:36 +0200365 dl_tbf = tbf_alloc_dl_tbf(bts, ul_tbf->ms(), trx_no, ms_class, 0);
Holger Hans Peter Freytherf3eec042013-12-26 10:19:18 +0100366 OSMO_ASSERT(dl_tbf);
367
368 /* verify that both are on the same ts */
369 OSMO_ASSERT(dl_tbf->first_common_ts == ul_tbf->first_common_ts);
370
Jacob Erlbeck61205a72015-07-09 11:35:50 +0200371 check_tfi_usage(&the_bts);
372
Holger Hans Peter Freytherf3eec042013-12-26 10:19:18 +0100373 tbf_free(dl_tbf);
374 tbf_free(ul_tbf);
375 }
376
377 /**
378 * Test with the other order.. first DL and then UL
379 */
380 {
381 BTS the_bts;
382 struct gprs_rlcmac_bts *bts;
383 struct gprs_rlcmac_trx *trx;
Jacob Erlbeck1f332942015-05-04 08:21:17 +0200384 uint8_t trx_no;
Holger Hans Peter Freytherf3eec042013-12-26 10:19:18 +0100385
Daniel Willmann351a5732014-08-07 12:57:44 +0200386 gprs_rlcmac_ul_tbf *ul_tbf;
387 gprs_rlcmac_dl_tbf *dl_tbf;
Holger Hans Peter Freytherf3eec042013-12-26 10:19:18 +0100388
389 bts = the_bts.bts_data();
390 bts->alloc_algorithm = alloc_algorithm_b;
391
392 trx = &bts->trx[0];
393 ENABLE_PDCH(0, ts0, trx);
394 ENABLE_PDCH(1, ts1, trx);
395 ENABLE_PDCH(2, ts2, trx);
396 ENABLE_PDCH(3, ts3, trx);
397 ENABLE_PDCH(4, ts4, trx);
398 ENABLE_PDCH(5, ts5, trx);
399 ENABLE_PDCH(6, ts6, trx);
400 ENABLE_PDCH(7, ts7, trx);
401
Jacob Erlbeck5879c642015-07-10 10:41:36 +0200402 dl_tbf = tbf_alloc_dl_tbf(bts, NULL, -1, ms_class, 1);
Holger Hans Peter Freytherf3eec042013-12-26 10:19:18 +0100403 OSMO_ASSERT(dl_tbf);
Jacob Erlbeck5879c642015-07-10 10:41:36 +0200404 OSMO_ASSERT(dl_tbf->ms());
405 OSMO_ASSERT(dl_tbf->ms()->current_trx());
406 trx_no = dl_tbf->ms()->current_trx()->trx_no;
Jacob Erlbeck767193e2015-05-20 12:06:46 +0200407 dl_tbf->update_ms(0x23, GPRS_RLCMAC_DL_TBF);
Holger Hans Peter Freytherf3eec042013-12-26 10:19:18 +0100408
Jacob Erlbeck5879c642015-07-10 10:41:36 +0200409 ul_tbf = tbf_alloc_ul_tbf(bts, dl_tbf->ms(), trx_no, ms_class, 0);
Holger Hans Peter Freytherf3eec042013-12-26 10:19:18 +0100410 OSMO_ASSERT(ul_tbf);
Jacob Erlbeck767193e2015-05-20 12:06:46 +0200411 ul_tbf->update_ms(0x23, GPRS_RLCMAC_UL_TBF);
Daniel Willmann7e994e32014-08-07 15:49:21 +0200412 ul_tbf->m_contention_resolution_done = 1;
Holger Hans Peter Freytherf3eec042013-12-26 10:19:18 +0100413
414 OSMO_ASSERT(dl_tbf->first_common_ts == ul_tbf->first_common_ts);
415
416 /* now update the dl_tbf */
417 dl_tbf->update();
418 OSMO_ASSERT(dl_tbf->first_common_ts == ul_tbf->first_common_ts);
419
Jacob Erlbeckbefc7602015-06-02 12:33:30 +0200420 OSMO_ASSERT(ul_tbf->ms_class() == ms_class);
421 OSMO_ASSERT(dl_tbf->ms_class() == ms_class);
422
Jacob Erlbeck61205a72015-07-09 11:35:50 +0200423 check_tfi_usage(&the_bts);
424
Holger Hans Peter Freytherf3eec042013-12-26 10:19:18 +0100425 tbf_free(dl_tbf);
426 tbf_free(ul_tbf);
427 }
428}
429
430static void test_all_alloc_b()
431{
432 /* it is a bit crazy... */
433 for (uint8_t ts0 = 0; ts0 < 2; ++ts0)
434 for (uint8_t ts1 = 0; ts1 < 2; ++ts1)
435 for (uint8_t ts2 = 0; ts2 < 2; ++ts2)
436 for (uint8_t ts3 = 0; ts3 < 2; ++ts3)
437 for (uint8_t ts4 = 0; ts4 < 2; ++ts4)
438 for (uint8_t ts5 = 0; ts5 < 2; ++ts5)
439 for (uint8_t ts6 = 0; ts6 < 2; ++ts6)
440 for (uint8_t ts7 = 0; ts7 < 2; ++ts7)
441 for (int ms_class = 0; ms_class < 30; ++ms_class)
442 test_alloc_b(ts0, ts1, ts2, ts3, ts4, ts5, ts6, ts7, ms_class);
443}
444
Holger Hans Peter Freytherc7b998c2013-12-25 19:25:10 +0100445static void test_alloc_b()
446{
447 for (int i = 0; i < 30; ++i)
448 test_alloc_b(i);
Holger Hans Peter Freytherf3eec042013-12-26 10:19:18 +0100449
450 test_all_alloc_b();
Holger Hans Peter Freytherc7b998c2013-12-25 19:25:10 +0100451}
452
Jacob Erlbecke5655642015-06-29 12:19:52 +0200453typedef int (*algo_t)(struct gprs_rlcmac_bts *bts,
454 struct GprsMs *ms,
Jacob Erlbeck5879c642015-07-10 10:41:36 +0200455 struct gprs_rlcmac_tbf *tbf, uint32_t cust, uint8_t single,
456 int use_trx);
Jacob Erlbecke5655642015-06-29 12:19:52 +0200457
458static char get_dir_char(uint8_t mask, uint8_t tx, uint8_t rx)
459{
460 return (mask & tx & rx) ? 'C' :
461 (mask & tx) ? 'U' :
462 (mask & rx) ? 'D' :
463 '.';
464}
465
466enum test_mode {
467 TEST_MODE_UL_ONLY,
468 TEST_MODE_DL_ONLY,
469 TEST_MODE_UL_AND_DL,
470 TEST_MODE_DL_AND_UL,
471 TEST_MODE_DL_AFTER_UL,
472 TEST_MODE_UL_AFTER_DL,
473};
474
475static GprsMs *alloc_tbfs(BTS *the_bts, GprsMs *ms, unsigned ms_class,
476 enum test_mode mode)
477{
478 struct gprs_rlcmac_bts *bts;
Jacob Erlbeck5879c642015-07-10 10:41:36 +0200479 uint8_t trx_no = -1;
Jacob Erlbecke5655642015-06-29 12:19:52 +0200480
481 bts = the_bts->bts_data();
482
483 gprs_rlcmac_tbf *tbf = NULL;
484
Jacob Erlbeck5879c642015-07-10 10:41:36 +0200485 if (ms && ms->current_trx())
486 trx_no = ms->current_trx()->trx_no;
487
Jacob Erlbeck69c9bfa2015-07-13 14:38:18 +0200488 GprsMs::Guard guard1(ms);
489
Jacob Erlbecke5655642015-06-29 12:19:52 +0200490 /* Allocate what is needed first */
491 switch (mode) {
492 case TEST_MODE_UL_ONLY:
493 case TEST_MODE_DL_AFTER_UL:
494 case TEST_MODE_UL_AND_DL:
Jacob Erlbeck69c9bfa2015-07-13 14:38:18 +0200495 if (ms && ms->ul_tbf())
496 tbf_free(ms->ul_tbf());
Jacob Erlbeck5879c642015-07-10 10:41:36 +0200497 tbf = tbf_alloc_ul_tbf(bts, ms, trx_no, ms_class, 0);
Jacob Erlbecke5655642015-06-29 12:19:52 +0200498 if (tbf == NULL)
499 return NULL;
500 break;
501 case TEST_MODE_DL_ONLY:
502 case TEST_MODE_UL_AFTER_DL:
503 case TEST_MODE_DL_AND_UL:
Jacob Erlbeck69c9bfa2015-07-13 14:38:18 +0200504 if (ms && ms->dl_tbf())
505 tbf_free(ms->dl_tbf());
Jacob Erlbeck5879c642015-07-10 10:41:36 +0200506 tbf = tbf_alloc_dl_tbf(bts, ms, trx_no, ms_class, 0);
Jacob Erlbecke5655642015-06-29 12:19:52 +0200507 if (tbf == NULL)
508 return NULL;
509 }
510
511 OSMO_ASSERT(tbf);
512 OSMO_ASSERT(tbf->ms());
513 OSMO_ASSERT(ms == NULL || ms == tbf->ms());
514 ms = tbf->ms();
515
Jacob Erlbeck69c9bfa2015-07-13 14:38:18 +0200516 GprsMs::Guard guard2(ms);
Jacob Erlbecke5655642015-06-29 12:19:52 +0200517
Jacob Erlbeck14376a72015-07-07 11:31:28 +0200518 /* Continue with what is needed next */
519 switch (mode) {
520 case TEST_MODE_UL_ONLY:
521 case TEST_MODE_DL_ONLY:
522 /* We are done */
523 break;
524
525 case TEST_MODE_DL_AFTER_UL:
526 case TEST_MODE_UL_AND_DL:
527 ms = alloc_tbfs(the_bts, ms, ms_class, TEST_MODE_DL_ONLY);
528 break;
529
530 case TEST_MODE_UL_AFTER_DL:
531 case TEST_MODE_DL_AND_UL:
532 ms = alloc_tbfs(the_bts, ms, ms_class, TEST_MODE_UL_ONLY);
533 break;
534 }
535
Jacob Erlbecke5655642015-06-29 12:19:52 +0200536 /* Optionally delete the TBF */
537 switch (mode) {
538 case TEST_MODE_DL_AFTER_UL:
539 case TEST_MODE_UL_AFTER_DL:
540 tbf_free(tbf);
541 break;
542
543 default:
544 break;
545 }
546
Jacob Erlbeck69c9bfa2015-07-13 14:38:18 +0200547 return guard2.is_idle() ? NULL : ms;
Jacob Erlbecke5655642015-06-29 12:19:52 +0200548}
549
Jacob Erlbeck69c9bfa2015-07-13 14:38:18 +0200550static unsigned alloc_many_tbfs(BTS *the_bts, unsigned min_class,
551 unsigned max_class, enum test_mode mode)
Jacob Erlbecke5655642015-06-29 12:19:52 +0200552{
Jacob Erlbecke5655642015-06-29 12:19:52 +0200553 unsigned counter;
554 unsigned ms_class = min_class;
555
Jacob Erlbecke5655642015-06-29 12:19:52 +0200556 for (counter = 0; 1; counter += 1) {
557 gprs_rlcmac_tbf *ul_tbf, *dl_tbf;
558 uint8_t ul_slots = 0;
559 uint8_t dl_slots = 0;
560 unsigned i;
561 int tfi = -1;
Jacob Erlbeck61205a72015-07-09 11:35:50 +0200562 int tfi2;
563 uint8_t trx2;
Jacob Erlbecke5655642015-06-29 12:19:52 +0200564 GprsMs *ms;
Jacob Erlbeck61205a72015-07-09 11:35:50 +0200565 enum gprs_rlcmac_tbf_direction dir;
Jacob Erlbeck69c9bfa2015-07-13 14:38:18 +0200566 uint32_t tlli = counter + 0xc0000000;
Jacob Erlbecke5655642015-06-29 12:19:52 +0200567
Jacob Erlbeck69c9bfa2015-07-13 14:38:18 +0200568 ms = the_bts->ms_by_tlli(tlli);
569
570 ms = alloc_tbfs(the_bts, ms, ms_class, mode);
Jacob Erlbecke5655642015-06-29 12:19:52 +0200571 if (!ms)
572 break;
573
Jacob Erlbeck69c9bfa2015-07-13 14:38:18 +0200574 ms->set_tlli(tlli);
575
Jacob Erlbecke5655642015-06-29 12:19:52 +0200576 ul_tbf = ms->ul_tbf();
577 dl_tbf = ms->dl_tbf();
578
579 if (ul_tbf) {
580 ul_slots = 1 << ul_tbf->first_common_ts;
581 tfi = ul_tbf->tfi();
Jacob Erlbeck61205a72015-07-09 11:35:50 +0200582 dir = GPRS_RLCMAC_UL_TBF;
Jacob Erlbecke5655642015-06-29 12:19:52 +0200583 } else if (dl_tbf) {
584 ul_slots = 1 << dl_tbf->first_common_ts;
585 tfi = dl_tbf->tfi();
Jacob Erlbeck61205a72015-07-09 11:35:50 +0200586 dir = GPRS_RLCMAC_DL_TBF;
Jacob Erlbecke5655642015-06-29 12:19:52 +0200587 }
588
589 for (i = 0; dl_tbf && i < ARRAY_SIZE(dl_tbf->pdch); i += 1)
590 if (dl_tbf->pdch[i])
591 dl_slots |= 1 << i;
592
593 printf(" TBF[%d] class %d reserves %c%c%c%c%c%c%c%c\n",
594 tfi, ms_class,
595 get_dir_char(0x01, ul_slots, dl_slots),
596 get_dir_char(0x02, ul_slots, dl_slots),
597 get_dir_char(0x04, ul_slots, dl_slots),
598 get_dir_char(0x08, ul_slots, dl_slots),
599 get_dir_char(0x10, ul_slots, dl_slots),
600 get_dir_char(0x20, ul_slots, dl_slots),
601 get_dir_char(0x40, ul_slots, dl_slots),
602 get_dir_char(0x80, ul_slots, dl_slots));
603
Jacob Erlbeck61205a72015-07-09 11:35:50 +0200604 if (tfi >= 0) {
605 OSMO_ASSERT(ms->current_trx());
Jacob Erlbeck69c9bfa2015-07-13 14:38:18 +0200606 tfi2 = the_bts->tfi_find_free(dir, &trx2,
Jacob Erlbeck61205a72015-07-09 11:35:50 +0200607 ms->current_trx()->trx_no);
608 OSMO_ASSERT(tfi != tfi2);
609 OSMO_ASSERT(trx2 == ms->current_trx()->trx_no);
610 }
611
Jacob Erlbecke5655642015-06-29 12:19:52 +0200612 ms_class += 1;
613 if (ms_class > max_class)
614 ms_class = min_class;
615 }
616
Jacob Erlbeck69c9bfa2015-07-13 14:38:18 +0200617 return counter;
618}
619
620static void test_successive_allocation(algo_t algo, unsigned min_class,
621 unsigned max_class, enum test_mode mode,
622 unsigned expect_num, const char *text)
623{
624 BTS the_bts;
625 struct gprs_rlcmac_bts *bts;
626 struct gprs_rlcmac_trx *trx;
627 unsigned counter;
628
629 printf("Going to test assignment with many TBF, %s\n", text);
630
631 bts = the_bts.bts_data();
632 bts->alloc_algorithm = algo;
633
634 trx = &bts->trx[0];
635 trx->pdch[3].enable();
636 trx->pdch[4].enable();
637 trx->pdch[5].enable();
638 trx->pdch[6].enable();
639 trx->pdch[7].enable();
640
641 counter = alloc_many_tbfs(&the_bts, min_class, max_class, mode);
642
Jacob Erlbecke5655642015-06-29 12:19:52 +0200643 printf(" Successfully allocated %d UL TBFs\n", counter);
Jacob Erlbeck88fb6132015-07-16 15:01:38 +0200644 if (counter != expect_num)
645 fprintf(stderr, " Expected %d TBFs for %s\n", expect_num, text);
646
Jacob Erlbeckec478752015-06-19 16:35:38 +0200647 OSMO_ASSERT(counter == expect_num);
Jacob Erlbecke0853cd2015-07-10 12:25:25 +0200648
649 check_tfi_usage(&the_bts);
Jacob Erlbecke5655642015-06-29 12:19:52 +0200650}
651
Jacob Erlbecka8c2aaf2015-07-13 14:50:08 +0200652static void test_many_connections(algo_t algo, unsigned expect_num,
653 const char *text)
654{
655 BTS the_bts;
656 struct gprs_rlcmac_bts *bts;
657 struct gprs_rlcmac_trx *trx;
658 int counter1, counter2 = -1;
659 unsigned i;
660 enum test_mode mode_seq[] = {
661 TEST_MODE_DL_AFTER_UL,
662 TEST_MODE_UL_ONLY,
663 TEST_MODE_DL_AFTER_UL,
664 TEST_MODE_DL_ONLY,
665 };
666
667 printf("Going to test assignment with many connections, %s\n", text);
668
669 bts = the_bts.bts_data();
670 bts->alloc_algorithm = algo;
671
672 trx = &bts->trx[0];
673 trx->pdch[3].enable();
674 trx->pdch[4].enable();
675 trx->pdch[5].enable();
676 trx->pdch[6].enable();
677 trx->pdch[7].enable();
678
679 for (i = 0; i < ARRAY_SIZE(mode_seq); i += 1) {
680 counter1 = alloc_many_tbfs(&the_bts, 1, 29, mode_seq[i]);
681 fprintf(stderr, " Allocated %d TBFs (previously %d)\n",
682 counter1, counter2);
683
684 check_tfi_usage(&the_bts);
685
686 /* This will stop earlier due to USF shortage */
687 if (mode_seq[i] == TEST_MODE_UL_ONLY)
688 continue;
689
Jacob Erlbeck88fb6132015-07-16 15:01:38 +0200690 if (counter2 >= 0) {
691 if (counter1 < counter2)
692 fprintf(stderr, " Expected %d >= %d in %s\n",
693 counter1, counter2, text);
Jacob Erlbecka8c2aaf2015-07-13 14:50:08 +0200694 OSMO_ASSERT(counter1 >= counter2);
Jacob Erlbeck88fb6132015-07-16 15:01:38 +0200695 }
Jacob Erlbecka8c2aaf2015-07-13 14:50:08 +0200696
697 counter2 = counter1;
698 }
699
700 printf(" Successfully allocated %d TBFs\n", counter1);
Jacob Erlbeck88fb6132015-07-16 15:01:38 +0200701 if (counter1 != (int)expect_num)
702 fprintf(stderr, " Expected %d TBFs for %s\n", expect_num, text);
Jacob Erlbecka8c2aaf2015-07-13 14:50:08 +0200703
704 OSMO_ASSERT(expect_num == (unsigned)counter1);
705}
706
Jacob Erlbecke5655642015-06-29 12:19:52 +0200707static void test_successive_allocation()
708{
709 test_successive_allocation(alloc_algorithm_a, 1, 1, TEST_MODE_UL_AND_DL,
Jacob Erlbecke0853cd2015-07-10 12:25:25 +0200710 35, "algorithm A (UL and DL)");
Jacob Erlbecke5655642015-06-29 12:19:52 +0200711 test_successive_allocation(alloc_algorithm_b, 10, 10, TEST_MODE_UL_AND_DL,
Jacob Erlbeck16c6ecc2015-06-30 13:40:18 +0200712 32, "algorithm B class 10 (UL and DL)");
Jacob Erlbecke5655642015-06-29 12:19:52 +0200713 test_successive_allocation(alloc_algorithm_b, 12, 12, TEST_MODE_UL_AND_DL,
Jacob Erlbeck16c6ecc2015-06-30 13:40:18 +0200714 32, "algorithm B class 12 (UL and DL)");
Jacob Erlbecke5655642015-06-29 12:19:52 +0200715 test_successive_allocation(alloc_algorithm_b, 1, 12, TEST_MODE_UL_AND_DL,
Jacob Erlbecked46afd2015-07-01 12:19:40 +0200716 32, "algorithm B class 1-12 (UL and DL)");
Jacob Erlbecke5655642015-06-29 12:19:52 +0200717 test_successive_allocation(alloc_algorithm_b, 1, 29, TEST_MODE_UL_AND_DL,
Jacob Erlbeck16c6ecc2015-06-30 13:40:18 +0200718 32, "algorithm B class 1-29 (UL and DL)");
Jacob Erlbeck400ec022015-07-14 13:31:48 +0200719 test_successive_allocation(alloc_algorithm_dynamic, 1, 29, TEST_MODE_UL_AND_DL,
720 35, "algorithm dynamic class 1-29 (UL and DL)");
Jacob Erlbecke5655642015-06-29 12:19:52 +0200721
722 test_successive_allocation(alloc_algorithm_a, 1, 1, TEST_MODE_DL_AND_UL,
Jacob Erlbecke0853cd2015-07-10 12:25:25 +0200723 35, "algorithm A (DL and UL)");
Jacob Erlbecke5655642015-06-29 12:19:52 +0200724 test_successive_allocation(alloc_algorithm_b, 10, 10, TEST_MODE_DL_AND_UL,
Jacob Erlbeck16c6ecc2015-06-30 13:40:18 +0200725 32, "algorithm B class 10 (DL and UL)");
Jacob Erlbeck400ec022015-07-14 13:31:48 +0200726 test_successive_allocation(alloc_algorithm_dynamic, 10, 10, TEST_MODE_DL_AND_UL,
727 32, "algorithm dynamic class 10 (DL and UL)");
Jacob Erlbecke5655642015-06-29 12:19:52 +0200728
729 test_successive_allocation(alloc_algorithm_a, 1, 1, TEST_MODE_DL_AFTER_UL,
Jacob Erlbecke0853cd2015-07-10 12:25:25 +0200730 160, "algorithm A (DL after UL)");
Jacob Erlbecke5655642015-06-29 12:19:52 +0200731 test_successive_allocation(alloc_algorithm_b, 10, 10, TEST_MODE_DL_AFTER_UL,
Jacob Erlbeckec478752015-06-19 16:35:38 +0200732 32, "algorithm B class 10 (DL after UL)");
Jacob Erlbeck400ec022015-07-14 13:31:48 +0200733 test_successive_allocation(alloc_algorithm_dynamic, 10, 10, TEST_MODE_DL_AFTER_UL,
734 63, "algorithm dynamic class 10 (DL after UL)");
Jacob Erlbecke5655642015-06-29 12:19:52 +0200735
736 test_successive_allocation(alloc_algorithm_a, 1, 1, TEST_MODE_UL_AFTER_DL,
Jacob Erlbecke0853cd2015-07-10 12:25:25 +0200737 35, "algorithm A (UL after DL)");
Jacob Erlbecke5655642015-06-29 12:19:52 +0200738 test_successive_allocation(alloc_algorithm_b, 10, 10, TEST_MODE_UL_AFTER_DL,
Jacob Erlbeck16c6ecc2015-06-30 13:40:18 +0200739 32, "algorithm B class 10 (UL after DL)");
Jacob Erlbeck400ec022015-07-14 13:31:48 +0200740 test_successive_allocation(alloc_algorithm_dynamic, 10, 10, TEST_MODE_UL_AFTER_DL,
741 35, "algorithm dynamic class 10 (UL after DL)");
Jacob Erlbecke5655642015-06-29 12:19:52 +0200742
743 test_successive_allocation(alloc_algorithm_a, 1, 1, TEST_MODE_UL_ONLY,
Jacob Erlbecke0853cd2015-07-10 12:25:25 +0200744 35, "algorithm A (UL only)");
Jacob Erlbecke5655642015-06-29 12:19:52 +0200745 test_successive_allocation(alloc_algorithm_b, 10, 10, TEST_MODE_UL_ONLY,
Jacob Erlbeck16c6ecc2015-06-30 13:40:18 +0200746 32, "algorithm B class 10 (UL only)");
Jacob Erlbeck400ec022015-07-14 13:31:48 +0200747 test_successive_allocation(alloc_algorithm_dynamic, 10, 10, TEST_MODE_UL_ONLY,
748 35, "algorithm dynamic class 10 (UL only)");
Jacob Erlbecke5655642015-06-29 12:19:52 +0200749
750 test_successive_allocation(alloc_algorithm_a, 1, 1, TEST_MODE_DL_ONLY,
Jacob Erlbecke0853cd2015-07-10 12:25:25 +0200751 160, "algorithm A (DL ONLY)");
Jacob Erlbecke5655642015-06-29 12:19:52 +0200752 test_successive_allocation(alloc_algorithm_b, 10, 10, TEST_MODE_DL_ONLY,
Jacob Erlbeckec478752015-06-19 16:35:38 +0200753 32, "algorithm B class 10 (DL ONLY)");
Jacob Erlbeck400ec022015-07-14 13:31:48 +0200754 test_successive_allocation(alloc_algorithm_dynamic, 10, 10, TEST_MODE_DL_ONLY,
755 101, "algorithm dynamic class 10 (DL ONLY)");
Jacob Erlbecke5655642015-06-29 12:19:52 +0200756}
757
Jacob Erlbecka8c2aaf2015-07-13 14:50:08 +0200758static void test_many_connections()
759{
760 test_many_connections(alloc_algorithm_a, 160, "algorithm A");
761 test_many_connections(alloc_algorithm_b, 32, "algorithm B");
Jacob Erlbeck400ec022015-07-14 13:31:48 +0200762 test_many_connections(alloc_algorithm_dynamic, 121, "algorithm dynamic");
Jacob Erlbecka8c2aaf2015-07-13 14:50:08 +0200763}
764
Holger Hans Peter Freytherbfdd5f22013-10-16 17:29:31 +0200765int main(int argc, char **argv)
766{
767 tall_pcu_ctx = talloc_named_const(NULL, 1, "moiji-mobile AllocTest context");
768 if (!tall_pcu_ctx)
769 abort();
770
771 msgb_set_talloc_ctx(tall_pcu_ctx);
772 osmo_init_logging(&gprs_log_info);
773 log_set_use_color(osmo_stderr_target, 0);
774 log_set_print_filename(osmo_stderr_target, 0);
Jacob Erlbeck9ec49e22015-06-29 13:00:20 +0200775 if (getenv("LOGL_DEBUG"))
776 log_set_log_level(osmo_stderr_target, LOGL_DEBUG);
Holger Hans Peter Freytherbfdd5f22013-10-16 17:29:31 +0200777
778 test_alloc_a();
Holger Hans Peter Freyther4af30532013-12-25 19:16:55 +0100779 test_alloc_b();
Jacob Erlbecke5655642015-06-29 12:19:52 +0200780 test_successive_allocation();
Jacob Erlbecka8c2aaf2015-07-13 14:50:08 +0200781 test_many_connections();
Holger Hans Peter Freytherbfdd5f22013-10-16 17:29:31 +0200782 return EXIT_SUCCESS;
783}
784
785/*
786 * stubs that should not be reached
787 */
788extern "C" {
789void l1if_pdch_req() { abort(); }
790void l1if_connect_pdch() { abort(); }
791void l1if_close_pdch() { abort(); }
792void l1if_open_pdch() { abort(); }
793}