aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Sperling <ssperling@sysmocom.de>2018-02-06 20:30:34 +0100
committerStefan Sperling <ssperling@sysmocom.de>2018-02-06 20:30:34 +0100
commit44714b9e2916db4f1cfc3dab1d2976dfcf71a7b3 (patch)
treed8a77814fd6c7fe7c4f6ddd0883b1c4eeff42273
parent8dc7a3c597cb1769c3a9d6cd86e6f4744c5960d8 (diff)
do not conflict with the 'rach access-control-class' vty command
-rw-r--r--src/libbsc/acc_ramp.c77
-rw-r--r--src/libbsc/bsc_vty.c6
-rw-r--r--src/libbsc/system_information.c21
3 files changed, 69 insertions, 35 deletions
diff --git a/src/libbsc/acc_ramp.c b/src/libbsc/acc_ramp.c
index 27103bcda..20f7dcf50 100644
--- a/src/libbsc/acc_ramp.c
+++ b/src/libbsc/acc_ramp.c
@@ -25,28 +25,50 @@
#include <osmocom/bsc/acc_ramp.h>
#include <osmocom/bsc/gsm_data.h>
-static void deny_all_accs(struct acc_ramp *acc_ramp)
+static bool bts_allows_acc(struct gsm_bts *bts, unsigned int acc)
{
- LOGP(DRLL, LOGL_DEBUG, "(bts=%d) ACC RAMP: denying all Access Control Classes 0-9\n", acc_ramp->bts->nr);
- acc_ramp->barred_t2 = 0x03; /* ACC8, ACC9 barred */
- acc_ramp->barred_t3 = 0xff; /* ACC0 - ACC7 barred */
+ assert(acc >= 0 && acc <= 9);
+ if (acc == 8 || acc == 9)
+ return (bts->si_common.rach_control.t2 & (1 << (acc - 8))) == 0;
+ return (bts->si_common.rach_control.t3 & (1 << (acc))) == 0;
}
-static void allow_all_accs(struct acc_ramp *acc_ramp)
+static void allow_acc(struct acc_ramp *acc_ramp, unsigned int acc)
{
- LOGP(DRLL, LOGL_DEBUG, "(bts=%d) ACC RAMP: allowing all Access Control Classes 0-9\n", acc_ramp->bts->nr);
- acc_ramp->barred_t2 = 0x00; /* ACC8, ACC9 allowed */
- acc_ramp->barred_t3 = 0x00; /* ACC0 - ACC7 allowed */
+ assert(acc >= 0 && acc <= 9);
+ LOGP(DRLL, LOGL_DEBUG, "(bts=%d) ACC RAMP: allowing Access Control Class %u\n", acc_ramp->bts->nr, acc);
+ if (acc == 8 || acc == 9)
+ acc_ramp->barred_t2 &= ~(1 << (acc - 8));
+ else
+ acc_ramp->barred_t3 &= ~(1 << acc);
}
-static void allow_one_acc(struct acc_ramp *acc_ramp, unsigned int acc)
+static void barr_acc(struct acc_ramp *acc_ramp, unsigned int acc)
{
- LOGP(DRLL, LOGL_DEBUG, "(bts=%d) ACC RAMP: allowing Access Control Class %u\n", acc_ramp->bts->nr, acc);
assert(acc >= 0 && acc <= 9);
+ LOGP(DRLL, LOGL_DEBUG, "(bts=%d) ACC RAMP: barring Access Control Class %u\n", acc_ramp->bts->nr, acc);
if (acc == 8 || acc == 9)
- acc_ramp->barred_t2 &= ~(1 << (acc - 8));
+ acc_ramp->barred_t2 |= (1 << (acc - 8));
else
- acc_ramp->barred_t3 &= ~(1 << acc);
+ acc_ramp->barred_t3 |= (1 << acc);
+}
+
+static void barr_all_allowed_accs(struct acc_ramp *acc_ramp)
+{
+ unsigned int acc;
+ for (acc = 0; acc < 10; acc++) {
+ if (bts_allows_acc(acc_ramp->bts, acc))
+ barr_acc(acc_ramp, acc);
+ }
+}
+
+static void allow_all_allowed_accs(struct acc_ramp *acc_ramp)
+{
+ unsigned int acc;
+ for (acc = 0; acc < 10; acc++) {
+ if (bts_allows_acc(acc_ramp->bts, acc))
+ allow_acc(acc_ramp, acc);
+ }
}
static unsigned int get_next_step_interval(struct acc_ramp *acc_ramp)
@@ -73,16 +95,6 @@ static unsigned int get_next_step_interval(struct acc_ramp *acc_ramp)
return acc_ramp->step_interval_sec;
}
-static void update_bts_rach_control(struct acc_ramp *acc_ramp)
-{
- struct gsm_bts *bts = acc_ramp->bts;
-
- /* Update RACH control parameters of this BTS. */
- bts->si_common.rach_control.t2 &= ~0x03;
- bts->si_common.rach_control.t2 |= acc_ramp_get_barred_t2(acc_ramp);
- bts->si_common.rach_control.t3 = acc_ramp_get_barred_t3(acc_ramp);
-}
-
static void send_bts_system_info(struct gsm_bts *bts)
{
struct gsm_bts_trx *trx;
@@ -99,7 +111,7 @@ static void do_ramping_step(void *data)
/* Shortcut in case we only do one ramping step. */
if (acc_ramp->step_size == ACC_RAMP_STEP_SIZE_MAX) {
- allow_all_accs(acc_ramp);
+ allow_all_allowed_accs(acc_ramp);
return;
}
@@ -107,13 +119,17 @@ static void do_ramping_step(void *data)
for (i = 0; i < acc_ramp->step_size; i++) {
int idx = ffs(acc_ramp->barred_t3);
if (idx > 0) {
+ unsigned int acc = idx - 1;
/* one of ACC0-ACC7 is still bared */
- allow_one_acc(acc_ramp, idx - 1);
+ if (bts_allows_acc(acc_ramp->bts, acc))
+ allow_acc(acc_ramp, acc);
} else {
idx = ffs(acc_ramp->barred_t2);
if (idx == 1 || idx == 2) {
+ unsigned int acc = idx - 1 + 8;
/* ACC8 or ACC9 is still barred */
- allow_one_acc(acc_ramp, idx - 1 + 8);
+ if (bts_allows_acc(acc_ramp->bts, acc))
+ allow_acc(acc_ramp, acc);
} else {
/* all ACCs are now allowed */
break;
@@ -121,8 +137,6 @@ static void do_ramping_step(void *data)
}
}
-
- update_bts_rach_control(acc_ramp);
send_bts_system_info(acc_ramp->bts);
/* If we have not allowed all ACCs yet, schedule another ramping step. */
@@ -140,10 +154,9 @@ void acc_ramp_init(struct acc_ramp *acc_ramp, struct gsm_bts *bts)
osmo_timer_setup(&acc_ramp->step_timer, do_ramping_step, acc_ramp);
if (bts->acc_ramping_enabled)
- deny_all_accs(acc_ramp);
+ barr_all_allowed_accs(acc_ramp);
else
- allow_all_accs(acc_ramp);
- update_bts_rach_control(acc_ramp);
+ allow_all_allowed_accs(acc_ramp);
}
int acc_ramp_set_step_size(struct acc_ramp *acc_ramp, enum acc_ramp_step_size step_size)
@@ -175,8 +188,8 @@ void acc_ramp_start(struct acc_ramp *acc_ramp)
/* Abort any previously running ramping process. */
acc_ramp_abort(acc_ramp);
- /* Set all ACCs to denied and start ramping up. */
- deny_all_accs(acc_ramp);
+ /* Set all availble ACCs to barred and start ramping up. */
+ barr_all_allowed_accs(acc_ramp);
do_ramping_step(acc_ramp);
}
diff --git a/src/libbsc/bsc_vty.c b/src/libbsc/bsc_vty.c
index edf3e4e5b..141102138 100644
--- a/src/libbsc/bsc_vty.c
+++ b/src/libbsc/bsc_vty.c
@@ -298,6 +298,7 @@ static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
VTY_NEWLINE);
if (bts->pcu_sock_path)
vty_out(vty, "PCU Socket Path: %s%s", bts->pcu_sock_path, VTY_NEWLINE);
+ vty_out(vty, "Access Control Class ramping: %senabled%s", bts->acc_ramping_enabled ? "" : "not ", VTY_NEWLINE);
if (is_ipaccess_bts(bts))
vty_out(vty, " Unit ID: %u/%u/0, OML Stream ID 0x%02x%s",
bts->ip_access.site_id, bts->ip_access.bts_id,
@@ -799,7 +800,6 @@ static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
}
if (bts->pcu_sock_path)
vty_out(vty, " pcu-socket %s%s", bts->pcu_sock_path, VTY_NEWLINE);
-
vty_out(vty, " acc-ramping %s%s", bts->acc_ramping_enabled ? "enabled" : "disabled", VTY_NEWLINE);
ho_vty_write(vty, " ", bts->ho);
@@ -3112,8 +3112,8 @@ DEFUN(cfg_bts_acc_ramping,
cfg_bts_acc_ramping_cmd,
"acc-ramping enabled (0|1)",
"Enable or disable Access Control Class ramping\n"
- "Disable Access Control Class ramping\n"
- "Enable Access Control Class ramping\n")
+ "Enable or disable Access Control Class ramping\n"
+ "Disable Access Control Class ramping\n" "Enable Access Control Class ramping\n")
{
struct gsm_bts *bts = vty->index;
bool was_enabled = bts->acc_ramping_enabled;
diff --git a/src/libbsc/system_information.c b/src/libbsc/system_information.c
index a04959d87..6169d409e 100644
--- a/src/libbsc/system_information.c
+++ b/src/libbsc/system_information.c
@@ -39,6 +39,7 @@
#include <osmocom/bsc/rest_octets.h>
#include <osmocom/bsc/arfcn_range_encode.h>
#include <osmocom/bsc/gsm_04_08_utils.h>
+#include <osmocom/bsc/acc_ramp.h>
/*
* DCS1800 and PCS1900 have overlapping ARFCNs. We would need to set the
@@ -675,6 +676,10 @@ static int generate_si1(enum osmo_sysinfo_type t, struct gsm_bts *bts)
list_arfcn(si1->cell_channel_description, 0xce, "Serving cell:");
si1->rach_control = bts->si_common.rach_control;
+ if (bts->acc_ramping_enabled) {
+ si1->rach_control.t2 |= acc_ramp_get_barred_t2(&bts->acc_ramp);
+ si1->rach_control.t3 |= acc_ramp_get_barred_t3(&bts->acc_ramp);
+ }
/*
* SI1 Rest Octets (10.5.2.32), contains NCH position and band
@@ -705,6 +710,10 @@ static int generate_si2(enum osmo_sysinfo_type t, struct gsm_bts *bts)
si2->ncc_permitted = bts->si_common.ncc_permitted;
si2->rach_control = bts->si_common.rach_control;
+ if (bts->acc_ramping_enabled) {
+ si2->rach_control.t2 |= acc_ramp_get_barred_t2(&bts->acc_ramp);
+ si2->rach_control.t3 |= acc_ramp_get_barred_t3(&bts->acc_ramp);
+ }
return sizeof(*si2);
}
@@ -738,6 +747,10 @@ static int generate_si2bis(enum osmo_sysinfo_type t, struct gsm_bts *bts)
bts->si_valid &= ~(1 << SYSINFO_TYPE_2bis);
si2b->rach_control = bts->si_common.rach_control;
+ if (bts->acc_ramping_enabled) {
+ si2b->rach_control.t2 |= acc_ramp_get_barred_t2(&bts->acc_ramp);
+ si2b->rach_control.t3 |= acc_ramp_get_barred_t3(&bts->acc_ramp);
+ }
/* SI2bis Rest Octets as per 3GPP TS 44.018 ยง10.5.2.33 */
rc = rest_octets_si2bis(si2b->rest_octets);
@@ -860,6 +873,10 @@ static int generate_si3(enum osmo_sysinfo_type t, struct gsm_bts *bts)
si3->cell_options = bts->si_common.cell_options;
si3->cell_sel_par = bts->si_common.cell_sel_par;
si3->rach_control = bts->si_common.rach_control;
+ if (bts->acc_ramping_enabled) {
+ si3->rach_control.t2 |= acc_ramp_get_barred_t2(&bts->acc_ramp);
+ si3->rach_control.t3 |= acc_ramp_get_barred_t3(&bts->acc_ramp);
+ }
/* allow/disallow DTXu */
gsm48_set_dtx(&si3->cell_options, bts->dtxu, bts->dtxu, true);
@@ -910,6 +927,10 @@ static int generate_si4(enum osmo_sysinfo_type t, struct gsm_bts *bts)
bts->location_area_code);
si4->cell_sel_par = bts->si_common.cell_sel_par;
si4->rach_control = bts->si_common.rach_control;
+ if (bts->acc_ramping_enabled) {
+ si4->rach_control.t2 |= acc_ramp_get_barred_t2(&bts->acc_ramp);
+ si4->rach_control.t3 |= acc_ramp_get_barred_t3(&bts->acc_ramp);
+ }
/* Optional: CBCH Channel Description + CBCH Mobile Allocation */
cbch_lchan = gsm_bts_get_cbch(bts);