Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ nfapi_nr_interface_scf
*.log
*.out
CMakeUserPresets.json

# clangd LSP files
.clangd
.cache/
compile_commands.json
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ Please refer to the steps described on our website: [How to contribute to OAI](h

By contributing to OpenAirInterface, you agree that your contributions will be
licensed under the license described in the file [`LICENSE`](./LICENSE) in the
root directory of this source tree.
root directory of this source tree.
13 changes: 9 additions & 4 deletions cmake_targets/build_oai
Original file line number Diff line number Diff line change
Expand Up @@ -184,25 +184,25 @@ function main() {
"Release")
CMAKE_BUILD_TYPE="Release"
echo_info "Will Compile without gdb symbols and with compiler optimization"
CMAKE_CMD="$CMAKE_CMD -DCMAKE_BUILD_TYPE=Release"
CMAKE_CMD="$CMAKE_CMD -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
shift
;;
"RelWithDebInfo")
CMAKE_BUILD_TYPE="RelWithDebInfo"
echo_info "Will Compile with gdb symbols"
CMAKE_CMD="$CMAKE_CMD -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_EXPORT_COMPILE_COMMANDS=1"
CMAKE_CMD="$CMAKE_CMD -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
shift
;;
"MinSizeRel")
CMAKE_BUILD_TYPE="MinSizeRel"
echo_info "Will Compile for minimal exec size"
CMAKE_CMD="$CMAKE_CMD -DCMAKE_BUILD_TYPE=MinSizeRel"
CMAKE_CMD="$CMAKE_CMD -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
shift
;;
"Debug" | *)
CMAKE_BUILD_TYPE="Debug"
echo_info "Will Compile with gdb symbols and disable compiler optimization"
CMAKE_CMD="$CMAKE_CMD -DCMAKE_BUILD_TYPE=Debug"
CMAKE_CMD="$CMAKE_CMD -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
if [ "$2" == "Debug" ] ; then
shift
fi
Expand Down Expand Up @@ -459,6 +459,11 @@ function main() {
mkdir -p $DIR/$BUILD_DIR/build
cd $DIR/$BUILD_DIR/build

# Ensure compile_commands.json is always generated for IDE support
if [[ ! "$CMAKE_CMD" =~ "-DCMAKE_EXPORT_COMPILE_COMMANDS" ]]; then
CMAKE_CMD="$CMAKE_CMD -DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
fi

# for historical reasons we build in a subdirectory cmake_targets/XYZ/build,
# e.g., cmake_targets/ran_build/build, hence the ../../..
CMAKE_CMD="$CMAKE_CMD ../../.."
Expand Down
3 changes: 2 additions & 1 deletion common/utils/telnetsrv/telnetsrv_o1.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,8 @@ static int set_bwconfig(char *buf, int debug, telnet_printfunc_t prnt)
mac->common_channels[0].mib = get_new_MIB_NR(scc);

const f1ap_served_cell_info_t *info = &mac->f1_config.setup_req->cell[0].info;
nr_mac_configure_sib1(mac, &info->plmn, info->nr_cellid, *info->tac);
// Pass PLMN list from F1AP cell info (includes num_plmn and plmn_list)
nr_mac_configure_sib1(mac, &info->plmn, info->nr_cellid, *info->tac, info->num_plmn, info->plmn_list);

prnt("OK\n");
return 0;
Expand Down
6 changes: 6 additions & 0 deletions openair2/COMMON/f1ap_messages_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
#define F1AP_MAX_NO_OF_INDIVIDUAL_CONNECTIONS_TO_RESET 65536
/* 9.3.1.42 of 3GPP TS 38.473 - gNB-CU System Information */
#define F1AP_MAX_NO_SIB_TYPES 32
/* Maximum number of PLMNs that can be served by a cell */
#define F1AP_MAX_NB_PLMNS 6

typedef struct f1ap_net_config_t {
char *CU_f1_ip_address;
Expand Down Expand Up @@ -138,6 +140,10 @@ typedef struct f1ap_served_cell_info_t {
uint16_t num_ssi;
nssai_t nssai[MAX_NUM_SLICES];

// PLMN list
uint16_t num_plmn;
plmn_id_t plmn_list[F1AP_MAX_NB_PLMNS];

f1ap_mode_t mode;
union {
f1ap_fdd_info_t fdd;
Expand Down
14 changes: 12 additions & 2 deletions openair2/GNB_APP/gnb_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ static uint8_t set_plmn_config(plmn_id_t *p, uint8_t idx)
plmn->mcc = *PLMNParamList.paramarray[l][GNB_MOBILE_COUNTRY_CODE_IDX].uptr;
plmn->mnc = *PLMNParamList.paramarray[l][GNB_MOBILE_NETWORK_CODE_IDX].uptr;
plmn->mnc_digit_length = *PLMNParamList.paramarray[l][GNB_MNC_DIGIT_LENGTH].u8ptr;

LOG_I(GNB_APP, "[cyhtest:set_plmn_config] set_plmn_config PLMN[%d]: mcc=%d, mnc=%d, mnc_digit_length=%d\n", l, plmn->mcc, plmn->mnc, plmn->mnc_digit_length);

AssertFatal((plmn->mnc_digit_length == 2) || (plmn->mnc_digit_length == 3), "BAD MNC DIGIT LENGTH %d", plmn->mnc_digit_length);
}
return num_plmn;
Expand Down Expand Up @@ -1081,7 +1084,14 @@ static int read_du_cell_info(configmodule_interface_t *cfg,

// PLMN
plmn_id_t p[PLMN_LIST_MAX_SIZE] = {0};
set_plmn_config(p, 0);
uint8_t num_plmn = set_plmn_config(p, 0);

// Copy PLMN list to info structure
info->num_plmn = num_plmn;
for (int i = 0; i < num_plmn; i++) {
info->plmn_list[i] = p[i];
}

info->plmn = p[0];
info->nr_cellid = (uint64_t) * (GNBParamList.paramarray[0][GNB_NRCELLID_IDX].u64ptr);

Expand Down Expand Up @@ -1673,7 +1683,7 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg)
cc->du_SIBs = fill_du_sibs(GNBParamList.paramarray[0]);

if (IS_SA_MODE(get_softmodem_params()))
nr_mac_configure_sib1(RC.nrmac[0], &info.plmn, info.nr_cellid, *info.tac);
nr_mac_configure_sib1(RC.nrmac[0], &info.plmn, info.nr_cellid, *info.tac, info.num_plmn, info.plmn_list);

// read F1 Setup information from config and generated MIB/SIB1
// and store it at MAC for sending later
Expand Down
29 changes: 27 additions & 2 deletions openair2/LAYER2/NR_MAC_gNB/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -1105,13 +1105,38 @@ void prepare_du_configuration_update(gNB_MAC_INST *mac,
mac->mac_rrc.gnb_du_configuration_update(&update);
}

void nr_mac_configure_sib1(gNB_MAC_INST *nrmac, const plmn_id_t *plmn, uint64_t cellID, int tac)
void nr_mac_configure_sib1(gNB_MAC_INST *nrmac, const plmn_id_t *plmn, uint64_t cellID, int tac, int num_plmn, const plmn_id_t *plmn_list)
{
AssertFatal(IS_SA_MODE(get_softmodem_params()), "error: SIB1 only applicable for SA\n");

NR_COMMON_channels_t *cc = &nrmac->common_channels[0];
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
NR_BCCH_DL_SCH_Message_t *sib1 = get_SIB1_NR(scc, plmn, cellID, tac, &nrmac->radio_config);
NR_BCCH_DL_SCH_Message_t *sib1 = get_SIB1_NR(scc, plmn, cellID, tac, &nrmac->radio_config, num_plmn, plmn_list);

// Access SIB1 content through the message structure
if (sib1 && sib1->message.choice.c1 &&
sib1->message.choice.c1->present == NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1) {
NR_SIB1_t *sib1_content = sib1->message.choice.c1->choice.systemInformationBlockType1;
LOG_I(NR_MAC, "[cyhtest] after get_SIB1_NR: plmn_IdentityInfoList.list.count=%d\n",
sib1_content->cellAccessRelatedInfo.plmn_IdentityInfoList.list.count);
for (int i = 0; i < sib1_content->cellAccessRelatedInfo.plmn_IdentityInfoList.list.count; i++) {
NR_PLMN_IdentityInfo_t *plmn_info = sib1_content->cellAccessRelatedInfo.plmn_IdentityInfoList.list.array[i];
LOG_I(NR_MAC, "[cyhtest] after get_SIB1_NR: plmn_IdentityInfoList.list.array[%d]->plmn_IdentityList.list.count=%d\n",
i, plmn_info->plmn_IdentityList.list.count);
for (int j = 0; j < plmn_info->plmn_IdentityList.list.count; j++) {
NR_PLMN_Identity_t *plmn_id = plmn_info->plmn_IdentityList.list.array[j];
LOG_I(NR_MAC, "[cyhtest] after get_SIB1_NR: plmn_IdentityList.list.array[%d][%d] mcc=%02lx%02lx%02lx mnc=%02lx%02lx%02lx\n",
i, j,
plmn_id->mcc ? *plmn_id->mcc->list.array[0] : 0,
plmn_id->mcc ? *plmn_id->mcc->list.array[1] : 0,
plmn_id->mcc ? *plmn_id->mcc->list.array[2] : 0,
*plmn_id->mnc.list.array[0],
*plmn_id->mnc.list.array[1],
plmn_id->mnc.list.count > 2 ? *plmn_id->mnc.list.array[2] : 0);
}
}
}

cc->sib1 = sib1;
cc->sib1_bcch_length = encode_SIB_NR(sib1, cc->sib1_bcch_pdu, sizeof(cc->sib1_bcch_pdu));
AssertFatal(cc->sib1_bcch_length > 0, "could not encode SIB1\n");
Expand Down
2 changes: 1 addition & 1 deletion openair2/LAYER2/NR_MAC_gNB/mac_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void mac_top_destroy_gNB(gNB_MAC_INST *mac);
void nr_mac_send_f1_setup_req(void);

void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, const nr_mac_config_t *mac_config);
void nr_mac_configure_sib1(gNB_MAC_INST *nrmac, const plmn_id_t *plmn, uint64_t cellID, int tac);
void nr_mac_configure_sib1(gNB_MAC_INST *nrmac, const plmn_id_t *plmn, uint64_t cellID, int tac, int num_plmn, const plmn_id_t *plmn_list);
bool nr_mac_configure_other_sib(gNB_MAC_INST *nrmac, int num_cu_sib, const f1ap_sib_msg_t cu_sib[num_cu_sib]);
bool nr_mac_add_test_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup);
void nr_mac_prepare_ra_ue(gNB_MAC_INST *nrmac, NR_UE_info_t *UE);
Expand Down
40 changes: 34 additions & 6 deletions openair2/LAYER2/NR_MAC_gNB/nr_radio_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -2712,7 +2712,9 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const NR_ServingCellConfigCommon_t *scc,
const plmn_id_t *plmn,
uint64_t cellID,
int tac,
const nr_mac_config_t *mac_config)
const nr_mac_config_t *mac_config,
int num_plmn,
const plmn_id_t *plmn_list)
{
AssertFatal(cellID < (1l << 36), "cellID must fit within 36 bits, but is %lu\n", cellID);

Expand All @@ -2736,21 +2738,22 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const NR_ServingCellConfigCommon_t *scc,
sib1->cellSelectionInfo->q_RxLevMin = -65;

// cellAccessRelatedInfo
// TODO : Add support for more than one PLMN
int num_plmn = 1; // int num_plmn = configuration->num_plmn;
// Support multiple PLMNs
LOG_I(NR_RRC, "[cyhtest] get_SIB1_NR: Creating SIB1 with %d PLMN(s)\n", num_plmn);
asn1cSequenceAdd(sib1->cellAccessRelatedInfo.plmn_IdentityInfoList.list, struct NR_PLMN_IdentityInfo, nr_plmn_info);
for (int i = 0; i < num_plmn; ++i) {
asn1cSequenceAdd(nr_plmn_info->plmn_IdentityList.list, struct NR_PLMN_Identity, nr_plmn);
asn1cCalloc(nr_plmn->mcc, mcc);
int confMcc = plmn->mcc;
int confMcc = plmn_list[i].mcc;
LOG_I(NR_RRC, "[cyhtest] get_SIB1_NR: Adding PLMN[%d]: %d.%d\n", i, plmn_list[i].mcc, plmn_list[i].mnc);
asn1cSequenceAdd(mcc->list, NR_MCC_MNC_Digit_t, mcc0);
*mcc0 = (confMcc / 100) % 10;
asn1cSequenceAdd(mcc->list, NR_MCC_MNC_Digit_t, mcc1);
*mcc1 = (confMcc / 10) % 10;
asn1cSequenceAdd(mcc->list, NR_MCC_MNC_Digit_t, mcc2);
*mcc2 = confMcc % 10;
int mnc = plmn->mnc;
if (plmn->mnc_digit_length == 3) {
int mnc = plmn_list[i].mnc;
if (plmn_list[i].mnc_digit_length == 3) {
asn1cSequenceAdd(nr_plmn->mnc.list, NR_MCC_MNC_Digit_t, mnc0);
*mnc0 = (mnc / 100) % 10;
}
Expand Down Expand Up @@ -3020,6 +3023,31 @@ void free_SIB1_NR(NR_BCCH_DL_SCH_Message_t *sib1)

int encode_SIB_NR(NR_BCCH_DL_SCH_Message_t *sib, uint8_t *buffer, int max_buffer_size)
{
// Print PLMN Identity List from SIB1
if (sib && sib->message.choice.c1 && sib->message.choice.c1->present == NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1) {
NR_SIB1_t *sib1 = sib->message.choice.c1->choice.systemInformationBlockType1;
if (sib1 && sib1->cellAccessRelatedInfo.plmn_IdentityInfoList.list.array) {
LOG_I(NR_MAC, "[cyhtest] encode_SIB_NR: SIB1 plmn_IdentityInfoList has %d PLMN(s)\n",
sib1->cellAccessRelatedInfo.plmn_IdentityInfoList.list.count);
for (int i = 0; i < sib1->cellAccessRelatedInfo.plmn_IdentityInfoList.list.count; i++) {
NR_PLMN_IdentityInfo_t *plmn_info = sib1->cellAccessRelatedInfo.plmn_IdentityInfoList.list.array[i];
LOG_I(NR_MAC, "[cyhtest] encode_SIB_NR: plmn_IdentityInfoList.list.array[%d]->plmn_IdentityList.list.count=%d\n",
i, plmn_info->plmn_IdentityList.list.count);
for (int j = 0; j < plmn_info->plmn_IdentityList.list.count; j++) {
NR_PLMN_Identity_t *plmn_id = plmn_info->plmn_IdentityList.list.array[j];
LOG_I(NR_MAC, "[cyhtest] encode_SIB_NR: plmn_IdentityList.list.array[%d][%d] mcc=%02lx%02lx%02lx mnc=%02lx%02lx%02lx\n",
i, j,
plmn_id->mcc ? *plmn_id->mcc->list.array[0] : 0,
plmn_id->mcc ? *plmn_id->mcc->list.array[1] : 0,
plmn_id->mcc ? *plmn_id->mcc->list.array[2] : 0,
*plmn_id->mnc.list.array[0],
*plmn_id->mnc.list.array[1],
plmn_id->mnc.list.count > 2 ? *plmn_id->mnc.list.array[2] : 0);
}
}
}
}

AssertFatal(max_buffer_size <= NR_MAX_SIB_LENGTH / 8,
"Maximum buffer size too large: 3GPP TS 38.331 section 5.2.1 - The physical layer imposes a limit to the "
"maximum size a SIB can take. The maximum SIB1 or SI message size is 2976 bits.\n");
Expand Down
4 changes: 3 additions & 1 deletion openair2/LAYER2/NR_MAC_gNB/nr_radio_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const NR_ServingCellConfigCommon_t *scc,
const plmn_id_t *plmn,
uint64_t cellID,
int tac,
const nr_mac_config_t *mac_config);
const nr_mac_config_t *mac_config,
int num_plmn,
const plmn_id_t *plmn_list);
void update_SIB1_NR_SI(NR_BCCH_DL_SCH_Message_t *sib1, int num_sibs, int sibs[num_sibs]);
int encode_sysinfo_ie(NR_SystemInformation_IEs_t *sysInfo, uint8_t *buf, int len);
void free_SIB1_NR(NR_BCCH_DL_SCH_Message_t *sib1);
Expand Down
28 changes: 15 additions & 13 deletions openair2/RRC/NR/rrc_gNB_du.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ RB_GENERATE/*_STATIC*/(rrc_du_tree, nr_rrc_du_container_t, entries, du_compare);
static bool rrc_gNB_plmn_matches(const gNB_RRC_INST *rrc, const f1ap_served_cell_info_t *info)
{
const gNB_RrcConfigurationReq *conf = &rrc->configuration;

return conf->num_plmn == 1 // F1 supports only one
&& conf->plmn[0].mcc == info->plmn.mcc && conf->plmn[0].mnc == info->plmn.mnc;
}
Expand Down Expand Up @@ -311,19 +312,20 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req, sctp_assoc_t assoc_id)
return;
}
f1ap_served_cell_info_t *cell_info = &req->cell[0].info;
if (!rrc_gNB_plmn_matches(rrc, cell_info)) {
LOG_E(NR_RRC,
"PLMN mismatch: CU %03d.%0*d, DU %03d%0*d\n",
rrc->configuration.plmn[0].mcc,
rrc->configuration.plmn[0].mnc_digit_length,
rrc->configuration.plmn[0].mnc,
cell_info->plmn.mcc,
cell_info->plmn.mnc_digit_length,
cell_info->plmn.mnc);
fail.cause = F1AP_CauseRadioNetwork_plmn_not_served_by_the_gNB_CU;
rrc->mac_rrc.f1_setup_failure(assoc_id, &fail);
return;
}
// I have to comment this single PLMN match between CU and DU to enable multiple PLMNs broadcasting
// if (!rrc_gNB_plmn_matches(rrc, cell_info)) {
// LOG_E(NR_RRC,
// "PLMN mismatch: CU %03d.%0*d, DU %03d%0*d\n",
// rrc->configuration.plmn[0].mcc,
// rrc->configuration.plmn[0].mnc_digit_length,
// rrc->configuration.plmn[0].mnc,
// cell_info->plmn.mcc,
// cell_info->plmn.mnc_digit_length,
// cell_info->plmn.mnc);
// fail.cause = F1AP_CauseRadioNetwork_plmn_not_served_by_the_gNB_CU;
// rrc->mac_rrc.f1_setup_failure(assoc_id, &fail);
// return;
// }
nr_rrc_du_container_t *it = NULL;
RB_FOREACH(it, rrc_du_tree, &rrc->dus) {
if (it->setup_req->gNB_DU_id == req->gNB_DU_id) {
Expand Down
Loading