diff options
Diffstat (limited to 'src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c')
-rw-r--r-- | src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c | 85 |
1 files changed, 52 insertions, 33 deletions
diff --git a/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c b/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c index b7239326c..9fdbf434b 100644 --- a/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c +++ b/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c @@ -26,19 +26,24 @@ #include <osmocom/bsc/bts.h> #include <osmocom/gsm/bts_features.h> -struct msgb *nanobts_attr_bts_get(struct gsm_bts *bts) +/* 3GPP TS 52.021 section 8.6.1 Set BTS Attributes */ +struct msgb *nanobts_gen_set_bts_attr(struct gsm_bts *bts) { struct msgb *msgb; uint8_t buf[256]; int rlt; msgb = msgb_alloc(1024, "nanobts_attr_bts"); + if (!msgb) + return NULL; - memcpy(buf, "\x55\x5b\x61\x67\x6d\x73", 6); - msgb_tv_fixed_put(msgb, NM_ATT_INTERF_BOUND, 6, buf); - - /* interference avg. period in numbers of SACCH multifr */ - msgb_tv_put(msgb, NM_ATT_INTAVE_PARAM, 0x06); + /* Interference level Boundaries: 0 .. X5 (3GPP TS 52.021 sec 9.4.25) */ + msgb_tv_fixed_put(msgb, NM_ATT_INTERF_BOUND, + sizeof(bts->interf_meas_params_cfg.bounds_dbm), + &bts->interf_meas_params_cfg.bounds_dbm[0]); + /* Intave: Interference Averaging period (3GPP TS 52.021 sec 9.4.24) */ + msgb_tv_put(msgb, NM_ATT_INTAVE_PARAM, bts->interf_meas_params_cfg.avg_period); + /* Connection Failure Criterion (3GPP TS 52.021 sec 9.4.14) */ rlt = gsm_bts_get_radio_link_timeout(bts); if (rlt == -1) { /* Osmocom extension: Use infinite radio link timeout */ @@ -51,28 +56,30 @@ struct msgb *nanobts_attr_bts_get(struct gsm_bts *bts) } msgb_tl16v_put(msgb, NM_ATT_CONN_FAIL_CRIT, 2, buf); + /* T200 (3GPP TS 52.021 sec 9.4.53) */ memcpy(buf, "\x1e\x24\x24\xa8\x34\x21\xa8", 7); msgb_tv_fixed_put(msgb, NM_ATT_T200, 7, buf); + /* Max Timing Advance (3GPP TS 52.021 sec 9.4.31) */ msgb_tv_put(msgb, NM_ATT_MAX_TA, 0x3f); - /* seconds */ + /* Overload Period (3GPP TS 52.021 sec 9.4.39), seconds */ memcpy(buf, "\x00\x01\x0a", 3); msgb_tv_fixed_put(msgb, NM_ATT_OVERL_PERIOD, 3, buf); - /* percent */ + /* CCCH Load Threshold (3GPP TS 12.21 sec 9.4.12), percent */ msgb_tv_put(msgb, NM_ATT_CCCH_L_T, bts->ccch_load_ind_thresh); - /* seconds */ - msgb_tv_put(msgb, NM_ATT_CCCH_L_I_P, 1); + /* CCCH Load Indication Period (3GPP TS 12.21 sec 9.4.11), seconds */ + msgb_tv_put(msgb, NM_ATT_CCCH_L_I_P, bts->ccch_load_ind_period); - /* busy threshold in - dBm */ + /* RACH Busy Threshold (3GPP TS 12.21 sec 9.4.44), -dBm */ buf[0] = 90; /* -90 dBm as default "busy" threshold */ if (bts->rach_b_thresh != -1) buf[0] = bts->rach_b_thresh & 0xff; msgb_tv_put(msgb, NM_ATT_RACH_B_THRESH, buf[0]); - /* rach load averaging 1000 slots */ + /* RACH Load Averaging Slots (3GPP TS 12.21 sec 9.4.45), 1000 slots */ buf[0] = 0x03; buf[1] = 0xe8; if (bts->rach_ldavg_slots != -1) { @@ -81,16 +88,19 @@ struct msgb *nanobts_attr_bts_get(struct gsm_bts *bts) } msgb_tv_fixed_put(msgb, NM_ATT_LDAVG_SLOTS, 2, buf); - /* 10 milliseconds */ - msgb_tv_put(msgb, NM_ATT_BTS_AIR_TIMER, osmo_tdef_get(bts->network->T_defs, 3105, OSMO_TDEF_MS, -1)); + /* BTS Air Timer (3GPP TS 12.21 sec 9.4.10), 10 milliseconds */ + msgb_tv_put(msgb, NM_ATT_BTS_AIR_TIMER, osmo_tdef_get(bts->network->T_defs, 3105, OSMO_TDEF_MS, -1)/10); - /* 10 retransmissions of physical config */ - msgb_tv_put(msgb, NM_ATT_NY1, 10); + /* NY1 (3GPP TS 12.21 sec 9.4.37), number of retransmissions of physical config */ + gsm_bts_check_ny1(bts); + msgb_tv_put(msgb, NM_ATT_NY1, osmo_tdef_get(bts->network->T_defs, -3105, OSMO_TDEF_CUSTOM, -1)); + /* BCCH ARFCN (3GPP TS 12.21 sec 9.4.8) */ buf[0] = (bts->c0->arfcn >> 8) & 0x0f; buf[1] = bts->c0->arfcn & 0xff; msgb_tv_fixed_put(msgb, NM_ATT_BCCH_ARFCN, 2, buf); + /* BSIC (3GPP TS 12.21 sec 9.4.9) */ msgb_tv_put(msgb, NM_ATT_BSIC, bts->bsic); abis_nm_ipaccess_cgi(buf, bts); @@ -99,20 +109,23 @@ struct msgb *nanobts_attr_bts_get(struct gsm_bts *bts) return msgb; } -struct msgb *nanobts_attr_nse_get(struct gsm_bts *bts) +struct msgb *nanobts_gen_set_nse_attr(struct gsm_bts_sm *bts_sm) { struct msgb *msgb; uint8_t buf[256]; + struct gsm_bts *bts = gsm_bts_sm_get_bts(bts_sm); msgb = msgb_alloc(1024, "nanobts_attr_bts"); + if (!msgb) + return NULL; /* NSEI 925 */ - buf[0] = bts->gprs.nse.nsei >> 8; - buf[1] = bts->gprs.nse.nsei & 0xff; + buf[0] = bts_sm->gprs.nse.nsei >> 8; + buf[1] = bts_sm->gprs.nse.nsei & 0xff; msgb_tl16v_put(msgb, NM_ATT_IPACC_NSEI, 2, buf); /* all timers in seconds */ - OSMO_ASSERT(ARRAY_SIZE(bts->gprs.nse.timer) < sizeof(buf)); - memcpy(buf, bts->gprs.nse.timer, ARRAY_SIZE(bts->gprs.nse.timer)); + OSMO_ASSERT(ARRAY_SIZE(bts_sm->gprs.nse.timer) < sizeof(buf)); + memcpy(buf, bts_sm->gprs.nse.timer, ARRAY_SIZE(bts_sm->gprs.nse.timer)); msgb_tl16v_put(msgb, NM_ATT_IPACC_NS_CFG, 7, buf); /* all timers in seconds */ @@ -135,11 +148,13 @@ struct msgb *nanobts_attr_nse_get(struct gsm_bts *bts) return msgb; } -struct msgb *nanobts_attr_cell_get(struct gsm_bts *bts) +struct msgb *nanobts_gen_set_cell_attr(struct gsm_bts *bts) { struct msgb *msgb; uint8_t buf[256]; msgb = msgb_alloc(1024, "nanobts_attr_bts"); + if (!msgb) + return NULL; /* routing area code */ buf[0] = bts->gprs.rac; @@ -192,18 +207,20 @@ struct msgb *nanobts_attr_cell_get(struct gsm_bts *bts) return msgb; } -struct msgb *nanobts_attr_nscv_get(struct gsm_bts *bts) +struct msgb *nanobts_gen_set_nsvc_attr(struct gsm_gprs_nsvc *nsvc) { struct msgb *msgb; uint8_t buf[256]; msgb = msgb_alloc(1024, "nanobts_attr_bts"); + if (!msgb) + return NULL; /* 925 */ - buf[0] = bts->gprs.nsvc[0].nsvci >> 8; - buf[1] = bts->gprs.nsvc[0].nsvci & 0xff; + buf[0] = nsvc->nsvci >> 8; + buf[1] = nsvc->nsvci & 0xff; msgb_tl16v_put(msgb, NM_ATT_IPACC_NSVCI, 2, buf); - switch (bts->gprs.nsvc->remote.u.sa.sa_family) { + switch (nsvc->remote.u.sa.sa_family) { case AF_INET6: /* all fields are encoded in network byte order */ /* protocol family */ @@ -211,20 +228,20 @@ struct msgb *nanobts_attr_nscv_get(struct gsm_bts *bts) /* padding */ buf[1] = 0x00; /* local udp port */ - osmo_store16be(bts->gprs.nsvc[0].local_port, &buf[2]); + osmo_store16be(nsvc->local_port, &buf[2]); /* remote udp port */ - memcpy(&buf[4], &bts->gprs.nsvc[0].remote.u.sin6.sin6_port, sizeof(uint16_t)); + memcpy(&buf[4], &nsvc->remote.u.sin6.sin6_port, sizeof(uint16_t)); /* remote ip address */ - memcpy(&buf[6], &bts->gprs.nsvc[0].remote.u.sin6.sin6_addr, sizeof(struct in6_addr)); + memcpy(&buf[6], &nsvc->remote.u.sin6.sin6_addr, sizeof(struct in6_addr)); msgb_tl16v_put(msgb, NM_ATT_OSMO_NS_LINK_CFG, 6 + sizeof(struct in6_addr), buf); break; case AF_INET: /* remote udp port */ - memcpy(&buf[0], &bts->gprs.nsvc[0].remote.u.sin.sin_port, sizeof(uint16_t)); + memcpy(&buf[0], &nsvc->remote.u.sin.sin_port, sizeof(uint16_t)); /* remote ip address */ - memcpy(&buf[2], &bts->gprs.nsvc[0].remote.u.sin.sin_addr, sizeof(struct in_addr)); + memcpy(&buf[2], &nsvc->remote.u.sin.sin_addr, sizeof(struct in_addr)); /* local udp port */ - osmo_store16be(bts->gprs.nsvc[0].local_port, &buf[6]); + osmo_store16be(nsvc->local_port, &buf[6]); msgb_tl16v_put(msgb, NM_ATT_IPACC_NS_LINK_CFG, 8, buf); break; default: @@ -234,12 +251,14 @@ struct msgb *nanobts_attr_nscv_get(struct gsm_bts *bts) return msgb; } -struct msgb *nanobts_attr_radio_get(struct gsm_bts *bts, +struct msgb *nanobts_gen_set_radio_attr(struct gsm_bts *bts, struct gsm_bts_trx *trx) { struct msgb *msgb; uint8_t buf[256]; msgb = msgb_alloc(1024, "nanobts_attr_bts"); + if (!msgb) + return NULL; /* number of -2dB reduction steps / Pn */ msgb_tv_put(msgb, NM_ATT_RF_MAXPOWR_R, trx->max_power_red / 2); |