From a8816dd9c76627ea2f99f7405e4f44b008f1401a Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sat, 21 Nov 2009 19:41:06 +0100 Subject: [talloc] Provide a copy of strnlen on OSX The implementation is taken from a blogspot and I don't think it is copyrightable... --- openbsc/src/talloc.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'openbsc') diff --git a/openbsc/src/talloc.c b/openbsc/src/talloc.c index bd5e1b0e0..d8213238e 100644 --- a/openbsc/src/talloc.c +++ b/openbsc/src/talloc.c @@ -105,6 +105,15 @@ #endif #endif +#ifdef __APPLE__ +/* taken from http://insanecoding.blogspot.com/2007/03/methods-for-safe-string-handling.html */ +size_t strnlen(const char *s, size_t n) +{ + const char *p = (const char *)memchr(s, 0, n); + return(p ? p-s : n); +} +#endif + /* this null_context is only used if talloc_enable_leak_report() or talloc_enable_leak_report_full() is called, otherwise it remains NULL -- cgit v1.2.3 From d61654cf544e5aa1bec50724589bb76d31471709 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sat, 21 Nov 2009 20:20:43 +0100 Subject: [chan] Alloc SDCCH for certain reserved types Follow notes: 2.) Allocate a SDCCH for type "LMU" 2a.)Allocate a SDCCH for the three reserved types 2b.)Pick LCHAN type none to "ignore" the request --- openbsc/include/openbsc/gsm_04_08.h | 3 +++ openbsc/src/gsm_04_08_utils.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) (limited to 'openbsc') diff --git a/openbsc/include/openbsc/gsm_04_08.h b/openbsc/include/openbsc/gsm_04_08.h index 40a76549e..b7c8a2662 100644 --- a/openbsc/include/openbsc/gsm_04_08.h +++ b/openbsc/include/openbsc/gsm_04_08.h @@ -656,6 +656,9 @@ enum chreq_type { CHREQ_T_PAG_R_ANY_NECI1, CHREQ_T_PAG_R_TCH_F, CHREQ_T_PAG_R_TCH_FH, + CHREQ_T_LMU, + CHREQ_T_RESERVED_SDCCH, + CHREQ_T_RESERVED_IGNORE, }; /* Chapter 11.3 */ diff --git a/openbsc/src/gsm_04_08_utils.c b/openbsc/src/gsm_04_08_utils.c index b2fbdc2c3..ad038fba6 100644 --- a/openbsc/src/gsm_04_08_utils.c +++ b/openbsc/src/gsm_04_08_utils.c @@ -258,6 +258,11 @@ static const struct chreq chreq_type_neci1[] = { { 0x80, 0xe0, CHREQ_T_PAG_R_ANY_NECI1 }, { 0x20, 0xf0, CHREQ_T_PAG_R_TCH_F }, { 0x30, 0xf0, CHREQ_T_PAG_R_TCH_FH }, + { 0x67, 0xff, CHREQ_T_LMU }, + { 0x60, 0xf9, CHREQ_T_RESERVED_SDCCH }, + { 0x61, 0xfb, CHREQ_T_RESERVED_SDCCH }, + { 0x63, 0xff, CHREQ_T_RESERVED_SDCCH }, + { 0x7f, 0xff, CHREQ_T_RESERVED_IGNORE }, }; /* If SYSTEM INFORMATION TYPE 4 NECI bit == 0 */ @@ -270,6 +275,11 @@ static const struct chreq chreq_type_neci0[] = { { 0x80, 0xe0, CHREQ_T_PAG_R_ANY_NECI0 }, { 0x20, 0xf0, CHREQ_T_PAG_R_TCH_F }, { 0x30, 0xf0, CHREQ_T_PAG_R_TCH_FH }, + { 0x67, 0xff, CHREQ_T_LMU }, + { 0x60, 0xf9, CHREQ_T_RESERVED_SDCCH }, + { 0x61, 0xfb, CHREQ_T_RESERVED_SDCCH }, + { 0x63, 0xff, CHREQ_T_RESERVED_SDCCH }, + { 0x7f, 0xff, CHREQ_T_RESERVED_IGNORE }, }; static const enum gsm_chan_t ctype_by_chreq[] = { @@ -286,6 +296,9 @@ static const enum gsm_chan_t ctype_by_chreq[] = { [CHREQ_T_PAG_R_ANY_NECI0] = GSM_LCHAN_SDCCH, [CHREQ_T_PAG_R_TCH_F] = GSM_LCHAN_TCH_F, [CHREQ_T_PAG_R_TCH_FH] = GSM_LCHAN_TCH_F, + [CHREQ_T_LMU] = GSM_LCHAN_SDCCH, + [CHREQ_T_RESERVED_SDCCH] = GSM_LCHAN_SDCCH, + [CHREQ_T_RESERVED_IGNORE] = GSM_LCHAN_UNKNOWN, }; static const enum gsm_chreq_reason_t reason_by_chreq[] = { @@ -302,6 +315,9 @@ static const enum gsm_chreq_reason_t reason_by_chreq[] = { [CHREQ_T_PAG_R_ANY_NECI0] = GSM_CHREQ_REASON_PAG, [CHREQ_T_PAG_R_TCH_F] = GSM_CHREQ_REASON_PAG, [CHREQ_T_PAG_R_TCH_FH] = GSM_CHREQ_REASON_PAG, + [CHREQ_T_LMU] = GSM_CHREQ_REASON_OTHER, + [CHREQ_T_RESERVED_SDCCH] = GSM_CHREQ_REASON_OTHER, + [CHREQ_T_RESERVED_IGNORE] = GSM_CHREQ_REASON_OTHER, }; enum gsm_chan_t get_ctype_by_chreq(struct gsm_bts *bts, u_int8_t ra, int neci) -- cgit v1.2.3 From c4d88ad9718a6cd4bd4bdfd57251bdd325d4db2f Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sat, 21 Nov 2009 21:18:38 +0100 Subject: [network] Make T3101 configurable and use it in abis_rsl --- openbsc/include/openbsc/gsm_data.h | 3 +++ openbsc/src/abis_rsl.c | 2 +- openbsc/src/openbsc.cfg.1-1 | 1 + openbsc/src/openbsc.cfg.1-2 | 1 + openbsc/src/openbsc.cfg.2-2 | 1 + openbsc/src/openbsc.cfg.nanobts | 1 + openbsc/src/vty_interface.c | 23 +++++++++++++++++++++++ 7 files changed, 31 insertions(+), 1 deletion(-) (limited to 'openbsc') diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index 0ac8674fd..0c400fdde 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -422,6 +422,9 @@ struct gsm_network { unsigned int num_bts; struct llist_head bts_list; + + /* timer values */ + int T3101; }; #define SMS_HDR_SIZE 128 diff --git a/openbsc/src/abis_rsl.c b/openbsc/src/abis_rsl.c index 0dee79b17..692536c50 100644 --- a/openbsc/src/abis_rsl.c +++ b/openbsc/src/abis_rsl.c @@ -1186,7 +1186,7 @@ static int rsl_rx_chan_rqd(struct msgb *msg) /* Start timer T3101 to wait for GSM48_MT_RR_PAG_RESP */ lchan->T3101.cb = t3101_expired; lchan->T3101.data = lchan; - bsc_schedule_timer(&lchan->T3101, 10, 0); + bsc_schedule_timer(&lchan->T3101, bts->network->T3101, 0); /* send IMMEDIATE ASSIGN CMD on RSL to BTS (to send on CCCH to MS) */ ret = rsl_imm_assign_cmd(bts, sizeof(ia), (u_int8_t *) &ia); diff --git a/openbsc/src/openbsc.cfg.1-1 b/openbsc/src/openbsc.cfg.1-1 index a8331ddbd..bad6df72d 100644 --- a/openbsc/src/openbsc.cfg.1-1 +++ b/openbsc/src/openbsc.cfg.1-1 @@ -11,6 +11,7 @@ network mobile network code 1 short name OpenBSC long name OpenBSC + timer t3101 10 bts 0 type bs11 band GSM900 diff --git a/openbsc/src/openbsc.cfg.1-2 b/openbsc/src/openbsc.cfg.1-2 index 10aa7b48b..b4c956d16 100644 --- a/openbsc/src/openbsc.cfg.1-2 +++ b/openbsc/src/openbsc.cfg.1-2 @@ -11,6 +11,7 @@ network mobile network code 1 short name OpenBSC long name OpenBSC + timer t3101 10 bts 0 type bs11 band GSM900 diff --git a/openbsc/src/openbsc.cfg.2-2 b/openbsc/src/openbsc.cfg.2-2 index 0dd9d9b5d..e123a448b 100644 --- a/openbsc/src/openbsc.cfg.2-2 +++ b/openbsc/src/openbsc.cfg.2-2 @@ -11,6 +11,7 @@ network mobile network code 1 short name OpenBSC long name OpenBSC + timer t3101 10 bts 0 type bs11 band GSM900 diff --git a/openbsc/src/openbsc.cfg.nanobts b/openbsc/src/openbsc.cfg.nanobts index a12794ffd..7f9846803 100644 --- a/openbsc/src/openbsc.cfg.nanobts +++ b/openbsc/src/openbsc.cfg.nanobts @@ -11,6 +11,7 @@ network mobile network code 1 short name OpenBSC long name OpenBSC + timer t3101 10 bts 0 type nanobts ip.access unit_id 1801 0 diff --git a/openbsc/src/vty_interface.c b/openbsc/src/vty_interface.c index 5712ca1c7..e6513513b 100644 --- a/openbsc/src/vty_interface.c +++ b/openbsc/src/vty_interface.c @@ -275,6 +275,7 @@ static int config_write_net(struct vty *vty) vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE); vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE); vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE); + vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE); return CMD_SUCCESS; } @@ -801,6 +802,27 @@ DEFUN(cfg_net_neci, return CMD_SUCCESS; } +#define DECLARE_TIMER(number) \ + DEFUN(cfg_net_T##number, \ + cfg_net_T##number##_cmd, \ + "timer t" #number " <0-65535>", \ + "Set the T" #number " value.") \ +{ \ + int value = atoi(argv[0]); \ + \ + if (value < 0 || value > 65535) { \ + vty_out(vty, "Timer value %s out of range.%s", \ + argv[0], VTY_NEWLINE); \ + return CMD_WARNING; \ + } \ + \ + gsmnet->T##number = value; \ + return CMD_SUCCESS; \ +} + +DECLARE_TIMER(3101) + + /* per-BTS configuration */ DEFUN(cfg_bts, cfg_bts_cmd, @@ -1241,6 +1263,7 @@ int bsc_vty_init(struct gsm_network *net) install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd); install_element(GSMNET_NODE, &cfg_net_encryption_cmd); install_element(GSMNET_NODE, &cfg_net_neci_cmd); + install_element(GSMNET_NODE, &cfg_net_T3101_cmd); install_element(GSMNET_NODE, &cfg_bts_cmd); install_node(&bts_node, config_write_bts); -- cgit v1.2.3 From 23975e718fd456ff8be7effbb915903f1bc173be Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sat, 21 Nov 2009 21:42:26 +0100 Subject: [network] Add config option for the remaining network timers There are all set to 0 and not used within the code yet but should be used in the future. --- openbsc/include/openbsc/gsm_data.h | 10 ++++++++++ openbsc/src/vty_interface.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) (limited to 'openbsc') diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index 0c400fdde..18e115c1e 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -425,6 +425,16 @@ struct gsm_network { /* timer values */ int T3101; + int T3103; + int T3105; + int T3107; + int T3109; + int T3111; + int T3113; + int T3115; + int T3117; + int T3119; + int T3141; }; #define SMS_HDR_SIZE 128 diff --git a/openbsc/src/vty_interface.c b/openbsc/src/vty_interface.c index e6513513b..f8bba2c44 100644 --- a/openbsc/src/vty_interface.c +++ b/openbsc/src/vty_interface.c @@ -276,6 +276,16 @@ static int config_write_net(struct vty *vty) vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE); vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE); vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE); + vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE); + vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE); + vty_out(vty, " timer t3107 %u%s", gsmnet->T3107, VTY_NEWLINE); + vty_out(vty, " timer t3109 %u%s", gsmnet->T3109, VTY_NEWLINE); + vty_out(vty, " timer t3111 %u%s", gsmnet->T3111, VTY_NEWLINE); + vty_out(vty, " timer t3113 %u%s", gsmnet->T3113, VTY_NEWLINE); + vty_out(vty, " timer t3115 %u%s", gsmnet->T3115, VTY_NEWLINE); + vty_out(vty, " timer t3117 %u%s", gsmnet->T3117, VTY_NEWLINE); + vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE); + vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE); return CMD_SUCCESS; } @@ -821,6 +831,16 @@ DEFUN(cfg_net_neci, } DECLARE_TIMER(3101) +DECLARE_TIMER(3103) +DECLARE_TIMER(3105) +DECLARE_TIMER(3107) +DECLARE_TIMER(3109) +DECLARE_TIMER(3111) +DECLARE_TIMER(3113) +DECLARE_TIMER(3115) +DECLARE_TIMER(3117) +DECLARE_TIMER(3119) +DECLARE_TIMER(3141) /* per-BTS configuration */ @@ -1264,6 +1284,16 @@ int bsc_vty_init(struct gsm_network *net) install_element(GSMNET_NODE, &cfg_net_encryption_cmd); install_element(GSMNET_NODE, &cfg_net_neci_cmd); install_element(GSMNET_NODE, &cfg_net_T3101_cmd); + install_element(GSMNET_NODE, &cfg_net_T3103_cmd); + install_element(GSMNET_NODE, &cfg_net_T3105_cmd); + install_element(GSMNET_NODE, &cfg_net_T3107_cmd); + install_element(GSMNET_NODE, &cfg_net_T3109_cmd); + install_element(GSMNET_NODE, &cfg_net_T3111_cmd); + install_element(GSMNET_NODE, &cfg_net_T3113_cmd); + install_element(GSMNET_NODE, &cfg_net_T3115_cmd); + install_element(GSMNET_NODE, &cfg_net_T3117_cmd); + install_element(GSMNET_NODE, &cfg_net_T3119_cmd); + install_element(GSMNET_NODE, &cfg_net_T3141_cmd); install_element(GSMNET_NODE, &cfg_bts_cmd); install_node(&bts_node, config_write_bts); -- cgit v1.2.3 From 4642d4917f0ced8ddf47d7f58a7d9e2ae2d23d24 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sat, 21 Nov 2009 21:48:53 +0100 Subject: [network] Make use of T3113 for paging Add it to the configuration files and make use of it in the the paging.c. --- openbsc/include/openbsc/gsm_data.h | 1 - openbsc/src/openbsc.cfg.1-1 | 1 + openbsc/src/openbsc.cfg.1-2 | 1 + openbsc/src/openbsc.cfg.2-2 | 1 + openbsc/src/openbsc.cfg.nanobts | 1 + openbsc/src/paging.c | 2 +- 6 files changed, 5 insertions(+), 2 deletions(-) (limited to 'openbsc') diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index 18e115c1e..86a872b86 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -286,7 +286,6 @@ struct gsm_paging_request { gsm_cbfn *cbfn; void *cbfn_param; }; -#define T3113_VALUE 60, 0 /* * This keeps track of the paging status of one BTS. It diff --git a/openbsc/src/openbsc.cfg.1-1 b/openbsc/src/openbsc.cfg.1-1 index bad6df72d..d312843b0 100644 --- a/openbsc/src/openbsc.cfg.1-1 +++ b/openbsc/src/openbsc.cfg.1-1 @@ -12,6 +12,7 @@ network short name OpenBSC long name OpenBSC timer t3101 10 + timer t3113 60 bts 0 type bs11 band GSM900 diff --git a/openbsc/src/openbsc.cfg.1-2 b/openbsc/src/openbsc.cfg.1-2 index b4c956d16..84d50c75c 100644 --- a/openbsc/src/openbsc.cfg.1-2 +++ b/openbsc/src/openbsc.cfg.1-2 @@ -12,6 +12,7 @@ network short name OpenBSC long name OpenBSC timer t3101 10 + timer t3113 60 bts 0 type bs11 band GSM900 diff --git a/openbsc/src/openbsc.cfg.2-2 b/openbsc/src/openbsc.cfg.2-2 index e123a448b..c1468a647 100644 --- a/openbsc/src/openbsc.cfg.2-2 +++ b/openbsc/src/openbsc.cfg.2-2 @@ -12,6 +12,7 @@ network short name OpenBSC long name OpenBSC timer t3101 10 + timer t3113 60 bts 0 type bs11 band GSM900 diff --git a/openbsc/src/openbsc.cfg.nanobts b/openbsc/src/openbsc.cfg.nanobts index 7f9846803..a1ceaec79 100644 --- a/openbsc/src/openbsc.cfg.nanobts +++ b/openbsc/src/openbsc.cfg.nanobts @@ -12,6 +12,7 @@ network short name OpenBSC long name OpenBSC timer t3101 10 + timer t3113 60 bts 0 type nanobts ip.access unit_id 1801 0 diff --git a/openbsc/src/paging.c b/openbsc/src/paging.c index 69902e8b1..fe6ea52d1 100644 --- a/openbsc/src/paging.c +++ b/openbsc/src/paging.c @@ -239,7 +239,7 @@ static int _paging_request(struct gsm_bts *bts, struct gsm_subscriber *subscr, req->cbfn_param = data; req->T3113.cb = paging_T3113_expired; req->T3113.data = req; - bsc_schedule_timer(&req->T3113, T3113_VALUE); + bsc_schedule_timer(&req->T3113, bts->network->T3113, 0); llist_add_tail(&req->entry, &bts_entry->pending_requests); if (!bsc_timer_pending(&bts_entry->work_timer)) -- cgit v1.2.3 From fdd0ddf7e9eb6a8a7de8021678287b3d1677a070 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sun, 22 Nov 2009 18:01:42 +0100 Subject: [sms] Fix compile warning by including gsm_data.h In file included from sms_test.c:27: ../../include/openbsc/gsm_utils.h:33: warning: `enum gsm_band' declared inside parameter list ../../include/openbsc/gsm_utils.h:33: warning: its scope is only this definition or declaration, which is probably not what you want ../../include/openbsc/gsm_utils.h:34: warning: `enum gsm_band' declared inside parameter list --- openbsc/tests/sms/sms_test.c | 1 + 1 file changed, 1 insertion(+) (limited to 'openbsc') diff --git a/openbsc/tests/sms/sms_test.c b/openbsc/tests/sms/sms_test.c index fa0963644..2ce2cc6c4 100644 --- a/openbsc/tests/sms/sms_test.c +++ b/openbsc/tests/sms/sms_test.c @@ -24,6 +24,7 @@ #include #include #include +#include #include int main(int argc, char** argv) -- cgit v1.2.3 From 1ce10f3854ae110f6eb73383f44de3191934804b Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 19 Nov 2009 19:18:29 +0100 Subject: [bsc_init] Activate the RC and the RSL link from the Software Activated Callback On cold start the RSL link will not be brought up. Wait for the Software to be Activated before starting the RSL link. This is working reliable on the BTS I have tested with. This is a partial revert of 8406ec2437fcc28906b2085e305d79ae73accc2a and was discussed on the mailinglist. --- openbsc/src/bsc_init.c | 49 ++++++++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 27 deletions(-) (limited to 'openbsc') diff --git a/openbsc/src/bsc_init.c b/openbsc/src/bsc_init.c index d11cde578..66d560601 100644 --- a/openbsc/src/bsc_init.c +++ b/openbsc/src/bsc_init.c @@ -391,38 +391,11 @@ int nm_state_event(enum nm_evt evt, u_int8_t obj_class, void *obj, break; case NM_OC_RADIO_CARRIER: trx = obj; - if (new_state->operational == 1 && - new_state->availability == NM_AVSTATE_OFF_LINE) { - /* Patch ARFCN into radio attribute */ - nanobts_attr_radio[5] &= 0xf0; - nanobts_attr_radio[5] |= trx->arfcn >> 8; - nanobts_attr_radio[6] = trx->arfcn & 0xff; - abis_nm_set_radio_attr(trx, nanobts_attr_radio, - sizeof(nanobts_attr_radio)); - abis_nm_chg_adm_state(trx->bts, obj_class, - trx->bts->bts_nr, trx->nr, 0xff, - NM_STATE_UNLOCKED); - abis_nm_opstart(trx->bts, obj_class, trx->bts->bts_nr, - trx->nr, 0xff); - } if (new_state->operational == 1 && new_state->availability == NM_AVSTATE_OK) abis_nm_opstart(trx->bts, obj_class, trx->bts->bts_nr, trx->nr, 0xff); break; - case NM_OC_BASEB_TRANSC: - trx = container_of(obj, struct gsm_bts_trx, bb_transc); - if (new_state->operational == 1 && - new_state->availability == NM_AVSTATE_DEPENDENCY) { - abis_nm_chg_adm_state(trx->bts, obj_class, - trx->bts->bts_nr, trx->nr, 0xff, - NM_STATE_UNLOCKED); - abis_nm_opstart(trx->bts, obj_class, - trx->bts->bts_nr, trx->nr, 0xff); - /* TRX software is active, tell it to initiate RSL Link */ - abis_nm_ipaccess_rsl_connect(trx, 0, 3003, trx->rsl_tei); - } - break; default: break; } @@ -438,6 +411,28 @@ static int sw_activ_rep(struct msgb *mb) switch (foh->obj_class) { + case NM_OC_BASEB_TRANSC: + abis_nm_chg_adm_state(trx->bts, foh->obj_class, + trx->bts->bts_nr, trx->nr, 0xff, + NM_STATE_UNLOCKED); + abis_nm_opstart(trx->bts, foh->obj_class, + trx->bts->bts_nr, trx->nr, 0xff); + /* TRX software is active, tell it to initiate RSL Link */ + abis_nm_ipaccess_rsl_connect(trx, 0, 3003, trx->rsl_tei); + break; + case NM_OC_RADIO_CARRIER: + /* Patch ARFCN into radio attribute */ + nanobts_attr_radio[5] &= 0xf0; + nanobts_attr_radio[5] |= trx->arfcn >> 8; + nanobts_attr_radio[6] = trx->arfcn & 0xff; + abis_nm_set_radio_attr(trx, nanobts_attr_radio, + sizeof(nanobts_attr_radio)); + abis_nm_chg_adm_state(trx->bts, foh->obj_class, + trx->bts->bts_nr, trx->nr, 0xff, + NM_STATE_UNLOCKED); + abis_nm_opstart(trx->bts, foh->obj_class, trx->bts->bts_nr, + trx->nr, 0xff); + break; } return 0; } -- cgit v1.2.3 From 2d501ea26a219176b1c556449e45ebd90d4accfb Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Wed, 11 Nov 2009 11:54:24 +0100 Subject: [vty] Add option to disable RF on a given TRX. - Make sure that on runtime the Radio Carrier can be locked and unlocked. The vty code calls into the Abis NM to lock/unlock the channel and the state is stored there. - Make sure that on start the Radio Carries remains offline and we are not starting it. On start the radio carrier is either locked or unlocked. This means the RSL will not connect until the RF is unlocked. It will connect then. To see RSL bringup failures one needs to parse the RSL nack message. - When the TRX is locked on startup the RSL link will only be established after it will be unlocked. --- openbsc/include/openbsc/gsm_data.h | 5 +++++ openbsc/src/abis_nm.c | 13 +++++++++++++ openbsc/src/bsc_init.c | 16 ++++++++++++++-- openbsc/src/gsm_data.c | 1 + openbsc/src/vty_interface.c | 12 ++++++++++++ 5 files changed, 45 insertions(+), 2 deletions(-) (limited to 'openbsc') diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index 86a872b86..638b03506 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -257,6 +257,9 @@ struct gsm_bts_trx { } bs11; }; struct gsm_bts_trx_ts ts[TRX_NR_TS]; + + /* NM state */ + int rf_locked; }; enum gsm_bts_type { @@ -518,4 +521,6 @@ static inline int is_siemens_bts(struct gsm_bts *bts) enum gsm_auth_policy gsm_auth_policy_parse(const char *arg); const char *gsm_auth_policy_name(enum gsm_auth_policy policy); +void gsm_trx_lock_rf(struct gsm_bts_trx *trx, int locked); + #endif diff --git a/openbsc/src/abis_nm.c b/openbsc/src/abis_nm.c index 4d4cec0a3..b1fe97ddf 100755 --- a/openbsc/src/abis_nm.c +++ b/openbsc/src/abis_nm.c @@ -2699,6 +2699,19 @@ int abis_nm_ipaccess_set_attr(struct gsm_bts *bts, u_int8_t obj_class, attr, attr_len); } +void gsm_trx_lock_rf(struct gsm_bts_trx *trx, int locked) +{ + int new_state = locked ? NM_STATE_LOCKED : NM_STATE_UNLOCKED; + + trx->rf_locked = locked; + if (!trx->bts || !trx->bts->oml_link) + return; + + abis_nm_chg_adm_state(trx->bts, NM_OC_RADIO_CARRIER, + trx->bts->bts_nr, trx->nr, 0xff, + new_state); +} + static const char *ipacc_testres_names[] = { [NM_IPACC_TESTRES_SUCCESS] = "SUCCESS", [NM_IPACC_TESTRES_TIMEOUT] = "TIMEOUT", diff --git a/openbsc/src/bsc_init.c b/openbsc/src/bsc_init.c index 66d560601..153e024e4 100644 --- a/openbsc/src/bsc_init.c +++ b/openbsc/src/bsc_init.c @@ -420,7 +420,18 @@ static int sw_activ_rep(struct msgb *mb) /* TRX software is active, tell it to initiate RSL Link */ abis_nm_ipaccess_rsl_connect(trx, 0, 3003, trx->rsl_tei); break; - case NM_OC_RADIO_CARRIER: + case NM_OC_RADIO_CARRIER: { + /* + * Locking the radio carrier will make it go + * offline again and we would come here. The + * framework should determine that there was + * no change and avoid recursion. + * + * This code is here to make sure that on start + * a TRX remains locked. + */ + int rc_state = trx->rf_locked ? + NM_STATE_LOCKED : NM_STATE_UNLOCKED; /* Patch ARFCN into radio attribute */ nanobts_attr_radio[5] &= 0xf0; nanobts_attr_radio[5] |= trx->arfcn >> 8; @@ -429,10 +440,11 @@ static int sw_activ_rep(struct msgb *mb) sizeof(nanobts_attr_radio)); abis_nm_chg_adm_state(trx->bts, foh->obj_class, trx->bts->bts_nr, trx->nr, 0xff, - NM_STATE_UNLOCKED); + rc_state); abis_nm_opstart(trx->bts, foh->obj_class, trx->bts->bts_nr, trx->nr, 0xff); break; + } } return 0; } diff --git a/openbsc/src/gsm_data.c b/openbsc/src/gsm_data.c index 69a9096ca..8212346ec 100644 --- a/openbsc/src/gsm_data.c +++ b/openbsc/src/gsm_data.c @@ -27,6 +27,7 @@ #include #include +#include void *tall_bsc_ctx; diff --git a/openbsc/src/vty_interface.c b/openbsc/src/vty_interface.c index f8bba2c44..066dfd5a9 100644 --- a/openbsc/src/vty_interface.c +++ b/openbsc/src/vty_interface.c @@ -1200,6 +1200,17 @@ DEFUN(cfg_trx_rsl_e1_tei, return CMD_SUCCESS; } +DEFUN(cfg_trx_rf_locked, + cfg_trx_rf_locked_cmd, + "rf_locked (0|1)", + "Turn off RF of the TRX.\n") +{ + int locked = atoi(argv[0]); + struct gsm_bts_trx *trx = vty->index; + + gsm_trx_lock_rf(trx, locked); + return CMD_SUCCESS; +} /* per TS configuration */ DEFUN(cfg_ts, @@ -1321,6 +1332,7 @@ int bsc_vty_init(struct gsm_network *net) install_element(TRX_NODE, &cfg_trx_max_power_red_cmd); install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd); install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd); + install_element(TRX_NODE, &cfg_trx_rf_locked_cmd); install_element(TRX_NODE, &cfg_ts_cmd); install_node(&ts_node, dummy_config_write); -- cgit v1.2.3