Support (optional) indication of NCH position in SI1 rest octets

This adds the vty commands and respective logic to allow the user to
specify the NCH (notification channel) position in the SI1 rests octets.

Change-Id: Iefde0af44a663f22462a54d68a58caa560eceb2f
Related: OS#5781
Requires: libosmocore.git I24a0095ac6eee0197f9d9ef9895c7795df6cdc49
This commit is contained in:
Harald Welte 2023-05-08 06:59:55 +02:00 committed by laforge
parent ff3540cb2c
commit 8798689f3b
4 changed files with 79 additions and 1 deletions

View File

@ -568,6 +568,11 @@ struct gsm_bts {
uint16_t scramble_list[MAX_EARFCN_LIST];
} data;
} si_common;
/* NCH (Notification Channel) related parameters */
struct {
uint8_t num_blocks; /* NCH number of CCCH blocks (0 = no NCH) */
uint8_t first_block; /* NCH first block number */
} nch;
bool early_classmark_allowed;
bool early_classmark_allowed_3g;
/* for testing only: Have an infinitely long radio link timeout */

View File

@ -1107,6 +1107,46 @@ DEFUN_USRATTR(cfg_bts_rach_nm_ldavg,
return CMD_SUCCESS;
}
DEFUN_USRATTR(cfg_bts_nch_position,
cfg_bts_nch_position_cmd,
X(BSC_VTY_ATTR_RESTART_ABIS_RSL_LINK),
"nch-position num-blocks <1-7> first-block <0-6>",
"NCH (Notification Channel) position within CCCH\n"
"Number of blocks reserved for NCH\n"
"Number of blocks reserved for NCH\n"
"First block reserved for NCH\n"
"First block reserved for NCH\n")
{
struct gsm_bts *bts = vty->index;
int num_blocks = atoi(argv[0]);
int first_block = atoi(argv[1]);
if (osmo_gsm48_si1ro_nch_pos_encode(num_blocks, first_block)) {
vty_out(vty, "num-blocks %u first-block %u is not permitted by 3GPP TS 44.010 Table 10.5.2.32.1b%s",
num_blocks, first_block, VTY_NEWLINE);
return CMD_WARNING;
}
bts->nch.num_blocks = num_blocks;
bts->nch.first_block = first_block;
return CMD_SUCCESS;
}
DEFUN_USRATTR(cfg_bts_no_nch_position,
cfg_bts_no_nch_position_cmd,
X(BSC_VTY_ATTR_RESTART_ABIS_RSL_LINK),
"no nch-position",
NO_STR "Disable NCH in this BTS\n")
{
struct gsm_bts *bts = vty->index;
bts->nch.num_blocks = 0;
bts->nch.first_block = 0;
return CMD_SUCCESS;
}
DEFUN_USRATTR(cfg_bts_cell_barred,
cfg_bts_cell_barred_cmd,
X(BSC_VTY_ATTR_RESTART_ABIS_RSL_LINK),
@ -4405,6 +4445,12 @@ static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
bts->si_common.chan_desc.bs_pa_mfrms + 2, VTY_NEWLINE);
vty_out(vty, " channel-description bs-ag-blks-res %u%s",
bts->si_common.chan_desc.bs_ag_blks_res, VTY_NEWLINE);
if (bts->nch.num_blocks) {
vty_out(vty, " nch-position num-blocks %u first-block %u%s",
bts->nch.num_blocks, bts->nch.first_block, VTY_NEWLINE);
} else {
vty_out(vty, " no nch-position%s", VTY_NEWLINE);
}
if (bts->ccch_load_ind_thresh != 10)
vty_out(vty, " ccch load-indication-threshold %u%s",
@ -4851,6 +4897,8 @@ int bts_vty_init(void)
install_element(BTS_NODE, &cfg_bts_interf_meas_level_bounds_cmd);
install_element(BTS_NODE, &cfg_bts_srvcc_fast_return_cmd);
install_element(BTS_NODE, &cfg_bts_immediate_assignment_cmd);
install_element(BTS_NODE, &cfg_bts_nch_position_cmd);
install_element(BTS_NODE, &cfg_bts_no_nch_position_cmd);
neighbor_ident_vty_init();
/* See also handover commands added on bts level from handover_vty.c */

View File

@ -393,6 +393,12 @@ static void bootstrap_bts(struct gsm_bts *bts)
bts->si_common.chan_desc.bs_ag_blks_res);
bts->si_common.chan_desc.bs_ag_blks_res = 2;
}
if (!(bts->nch.num_blocks == 1 && (bts->nch.first_block == 0 || bts->nch.first_block == 1)) &&
!(bts->nch.num_blocks == 2 && bts->nch.first_block == 0)) {
LOG_BTS(bts, DNM, LOGL_ERROR, "CCCH is combined with SDCCHs, but NCH position/size is "
"incompatible with that. Please fix your config!\n");
}
} else { /* Non-combined TS0/C0 configuration */
/* There can be additional CCCHs on even timeslot numbers */
n += (bts->c0->ts[2].pchan_from_config == GSM_PCHAN_CCCH);
@ -401,6 +407,13 @@ static void bootstrap_bts(struct gsm_bts *bts)
bts->si_common.chan_desc.ccch_conf = (n << 1);
}
if (bts->nch.first_block + bts->nch.num_blocks > bts->si_common.chan_desc.bs_ag_blks_res) {
LOG_BTS(bts, DNM, LOGL_ERROR, "Position/Number of NCH blocks (%u..%u) exceeds AGCH (%u)."
"Please fix your config!\n", bts->nch.first_block,
bts->nch.first_block + bts->nch.num_blocks - 1,
bts->si_common.chan_desc.bs_ag_blks_res);
}
bts_setup_ramp_init_bts(bts);
/* ACC ramping is initialized from vty/config */

View File

@ -771,7 +771,19 @@ static int generate_si1(enum osmo_sysinfo_type t, struct gsm_bts *bts)
* SI1 Rest Octets (10.5.2.32), contains NCH position and band
* indicator but that is not in the 04.08.
*/
rc = osmo_gsm48_rest_octets_si1_encode(si1->rest_octets, NULL, is_dcs_net(bts));
if (bts->nch.num_blocks) {
rc = osmo_gsm48_si1ro_nch_pos_encode(bts->nch.num_blocks, bts->nch.first_block);
if (rc < 0) {
LOGP(DRR, LOGL_ERROR, "Unable to encode NCH position (num_blocks=%u, first_block=%u)\n",
bts->nch.num_blocks, bts->nch.first_block);
rc = osmo_gsm48_rest_octets_si1_encode(si1->rest_octets, NULL, is_dcs_net(bts));
} else {
uint8_t nch_pos = rc;
rc = osmo_gsm48_rest_octets_si1_encode(si1->rest_octets, &nch_pos, is_dcs_net(bts));
}
} else {
rc = osmo_gsm48_rest_octets_si1_encode(si1->rest_octets, NULL, is_dcs_net(bts));
}
return sizeof(*si1) + rc;
}