Commit 8ab827d3 authored by Laurent THOMAS's avatar Laurent THOMAS

cleanup nr_band() function

parent 399dc97d
...@@ -42,7 +42,7 @@ const char *duplex_mode[]={"FDD","TDD"}; ...@@ -42,7 +42,7 @@ const char *duplex_mode[]={"FDD","TDD"};
// - N_OFFs for bands from 80 to 89 and band 95 is referred to UL // - N_OFFs for bands from 80 to 89 and band 95 is referred to UL
// - Frequencies are expressed in KHz // - Frequencies are expressed in KHz
// - col: NR_band ul_min ul_max dl_min dl_max step N_OFFs_DL deltaf_raster // - col: NR_band ul_min ul_max dl_min dl_max step N_OFFs_DL deltaf_raster
nr_bandentry_t nr_bandtable[] = { const nr_bandentry_t nr_bandtable[] = {
{1, 1920000, 1980000, 2110000, 2170000, 20, 422000, 100}, {1, 1920000, 1980000, 2110000, 2170000, 20, 422000, 100},
{2, 1850000, 1910000, 1930000, 1990000, 20, 386000, 100}, {2, 1850000, 1910000, 1930000, 1990000, 20, 386000, 100},
{3, 1710000, 1785000, 1805000, 1880000, 20, 361000, 100}, {3, 1710000, 1785000, 1805000, 1880000, 20, 361000, 100},
...@@ -117,7 +117,7 @@ uint16_t get_band(uint64_t downlink_frequency, int32_t delta_duplex) ...@@ -117,7 +117,7 @@ uint16_t get_band(uint64_t downlink_frequency, int32_t delta_duplex)
uint64_t center_freq_diff_khz = 999999999999999999; // 2^64 uint64_t center_freq_diff_khz = 999999999999999999; // 2^64
uint16_t current_band = 0; uint16_t current_band = 0;
for (int ind = 0; ind < nr_bandtable_size; ind++) { for (int ind = 0; ind < sizeofArray(nr_bandtable); ind++) {
if (dl_freq_khz < nr_bandtable[ind].dl_min || dl_freq_khz > nr_bandtable[ind].dl_max) if (dl_freq_khz < nr_bandtable[ind].dl_min || dl_freq_khz > nr_bandtable[ind].dl_max)
continue; continue;
...@@ -143,8 +143,6 @@ uint16_t get_band(uint64_t downlink_frequency, int32_t delta_duplex) ...@@ -143,8 +143,6 @@ uint16_t get_band(uint64_t downlink_frequency, int32_t delta_duplex)
return current_band; return current_band;
} }
const size_t nr_bandtable_size = sizeof(nr_bandtable) / sizeof(nr_bandentry_t);
int NRRIV2BW(int locationAndBandwidth,int N_RB) { int NRRIV2BW(int locationAndBandwidth,int N_RB) {
int tmp = locationAndBandwidth/N_RB; int tmp = locationAndBandwidth/N_RB;
int tmp2 = locationAndBandwidth%N_RB; int tmp2 = locationAndBandwidth%N_RB;
...@@ -459,31 +457,21 @@ uint16_t config_bandwidth(int mu, int nb_rb, int nr_band) ...@@ -459,31 +457,21 @@ uint16_t config_bandwidth(int mu, int nb_rb, int nr_band)
// Returns the corresponding row index of the NR table // Returns the corresponding row index of the NR table
int get_nr_table_idx(int nr_bandP, uint8_t scs_index) { int get_nr_table_idx(int nr_bandP, uint8_t scs_index) {
int i, j;
int scs_khz = 15 << scs_index; int scs_khz = 15 << scs_index;
int supplementary_bands[] = {29,75,76,80,81,82,83,84,86,89,95}; int supplementary_bands[] = {29,75,76,80,81,82,83,84,86,89,95};
size_t s = sizeof(supplementary_bands)/sizeof(supplementary_bands[0]);
for(j = 0; j < s; j++){ for(int j = 0; j < sizeofArray(supplementary_bands); j++){
if (nr_bandP == supplementary_bands[j]) if (nr_bandP == supplementary_bands[j])
AssertFatal(0 == 1, "Band %d is a supplementary band (%d). This is not supported yet.\n", nr_bandP, supplementary_bands[j]); AssertFatal(0 == 1, "Band %d is a supplementary band (%d). This is not supported yet.\n", nr_bandP, supplementary_bands[j]);
} }
AssertFatal(nr_bandP <= nr_bandtable[nr_bandtable_size-1].band, "NR band %d exceeds NR bands table maximum limit %d\n", nr_bandP, nr_bandtable[nr_bandtable_size-1].band); int i;
for (i = 0; i < nr_bandtable_size && nr_bandtable[i].band != nr_bandP; i++); for (i = 0; i < sizeofArray(nr_bandtable); i++) {
if ( nr_bandtable[i].band == nr_bandP && nr_bandtable[i].deltaf_raster == scs_khz )
// In frequency bands with two deltaFRaster, break;
// the higher deltaFRaster applies to channels using only the SCS that is equal to or larger than the higher deltaFRaster
// and SSB SCS is equal to the higher deltaFRaster.
while(((i+1)<nr_bandtable_size) &&
(nr_bandtable[i+1].band == nr_bandtable[i].band) &&
(nr_bandtable[i].deltaf_raster != scs_khz)) {
i++;
} }
AssertFatal(nr_bandtable[i].band == nr_bandP, "Found band table %d does not correspond to the input one %d\n",nr_bandtable[i].band,nr_bandP); AssertFatal(i < sizeofArray(nr_bandtable), "band is not existing: %d\n",nr_bandP);
LOG_D(PHY, "NR band table index %d (Band %d, dl_min %lu, ul_min %lu)\n", i, nr_bandtable[i].band, nr_bandtable[i].dl_min,nr_bandtable[i].ul_min); LOG_D(PHY, "NR band table index %d (Band %d, dl_min %lu, ul_min %lu)\n", i, nr_bandtable[i].band, nr_bandtable[i].dl_min,nr_bandtable[i].ul_min);
return i; return i;
......
...@@ -48,8 +48,7 @@ typedef struct nr_bandentry_s { ...@@ -48,8 +48,7 @@ typedef struct nr_bandentry_s {
uint8_t deltaf_raster; uint8_t deltaf_raster;
} nr_bandentry_t; } nr_bandentry_t;
extern const size_t nr_bandtable_size; extern const nr_bandentry_t nr_bandtable[];
extern nr_bandentry_t nr_bandtable[];
static inline int get_num_dmrs(uint16_t dmrs_mask ) { static inline int get_num_dmrs(uint16_t dmrs_mask ) {
int num_dmrs=0; int num_dmrs=0;
......
...@@ -115,34 +115,32 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, ...@@ -115,34 +115,32 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_DU_Served_Cells_List, true); F1AP_ProtocolIE_ID_id_gNB_DU_Served_Cells_List, true);
req->num_cells_available = ie->value.choice.GNB_DU_Served_Cells_List.list.count; req->num_cells_available = ie->value.choice.GNB_DU_Served_Cells_List.list.count;
LOG_D(F1AP, "req->num_cells_available %d \n", LOG_D(F1AP, "req->num_cells_available %d \n", req->num_cells_available);
req->num_cells_available);
int num_cells_available = req->num_cells_available;
for (i=0; i<num_cells_available; i++) { for (i=0; i<req->num_cells_available; i++) {
F1AP_GNB_DU_Served_Cells_Item_t *served_cells_item_p; F1AP_GNB_DU_Served_Cells_Item_t *served_cells_item_p;
served_cells_item_p = &(((F1AP_GNB_DU_Served_Cells_ItemIEs_t *) served_cells_item_p = &(((F1AP_GNB_DU_Served_Cells_ItemIEs_t *)
ie->value.choice.GNB_DU_Served_Cells_List.list.array[i])-> ie->value.choice.GNB_DU_Served_Cells_List.list.array[i])->
value.choice.GNB_DU_Served_Cells_Item); value.choice.GNB_DU_Served_Cells_Item);
F1AP_Served_Cell_Information_t *served_cell_information= &gnb_du_served_cells_item->served_Cell_Information;
/* tac */ /* tac */
if (served_cells_item_p->served_Cell_Information.fiveGS_TAC) { if (served_Cell_Information->fiveGS_TAC) {
OCTET_STRING_TO_INT16(served_cells_item_p->served_Cell_Information.fiveGS_TAC, req->cell[i].tac); OCTET_STRING_TO_INT16(served_Cell_Information->fiveGS_TAC, req->cell[i].tac);
LOG_D(F1AP, "req->tac[%d] %d \n", i, req->cell[i].tac); LOG_D(F1AP, "req->tac[%d] %d \n", i, req->cell[i].tac);
} }
/* - nRCGI */ /* - nRCGI */
TBCD_TO_MCC_MNC(&(served_cells_item_p->served_Cell_Information.nRCGI.pLMN_Identity), req->cell[i].mcc, TBCD_TO_MCC_MNC(&(served_Cell_Information->nRCGI.pLMN_Identity), req->cell[i].mcc,
req->cell[i].mnc,req->cell[i].mnc_digit_length); req->cell[i].mnc,req->cell[i].mnc_digit_length);
// NR cellID // NR cellID
BIT_STRING_TO_NR_CELL_IDENTITY(&served_cells_item_p->served_Cell_Information.nRCGI.nRCellIdentity, BIT_STRING_TO_NR_CELL_IDENTITY(&served_Cell_Information->nRCGI.nRCellIdentity,
req->cell[i].nr_cellid); req->cell[i].nr_cellid);
LOG_D(F1AP, "[SCTP %d] Received nRCGI: MCC %d, MNC %d, CELL_ID %llu\n", assoc_id, LOG_D(F1AP, "[SCTP %d] Received nRCGI: MCC %d, MNC %d, CELL_ID %llu\n", assoc_id,
req->cell[i].mcc, req->cell[i].mcc,
req->cell[i].mnc, req->cell[i].mnc,
(long long unsigned int)req->cell[i].nr_cellid); (long long unsigned int)req->cell[i].nr_cellid);
/* - nRPCI */ /* - nRPCI */
req->cell[i].nr_pci = served_cells_item_p->served_Cell_Information.nRPCI; req->cell[i].nr_pci = served_Cell_Information->nRPCI;
LOG_D(F1AP, "req->nr_pci[%d] %d \n", i, req->cell[i].nr_pci); LOG_D(F1AP, "req->nr_pci[%d] %d \n", i, req->cell[i].nr_pci);
// LTS: FIXME data model failure: we don't KNOW if we receive a 4G or a 5G cell // LTS: FIXME data model failure: we don't KNOW if we receive a 4G or a 5G cell
...@@ -152,6 +150,8 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, ...@@ -152,6 +150,8 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
else else
f1ap_req(true, instance)->cell_type=CELL_MACRO_ENB; f1ap_req(true, instance)->cell_type=CELL_MACRO_ENB;
LOG_I(F1AP, "Received Cell in %d context\n", f1ap_req(true, instance)->cell_type==CELL_MACRO_GNB); LOG_I(F1AP, "Received Cell in %d context\n", f1ap_req(true, instance)->cell_type==CELL_MACRO_GNB);
// System Information // System Information
/* mib */ /* mib */
...@@ -208,11 +208,14 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, ...@@ -208,11 +208,14 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
// uint16_t nr_sul_band[32]; // uint16_t nr_sul_band[32];
// } tdd; // } tdd;
// } nr_mode_info[F1AP_MAX_NB_CELLS]; // } nr_mode_info[F1AP_MAX_NB_CELLS];
// We copy and store in F1 task data, RRC will free "req" as it frees all itti received messages // We copy and store in F1 task data, RRC will free "req" as it frees all itti received messages
message_p = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_SETUP_REQ); message_p = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_SETUP_REQ);
memcpy(&F1AP_SETUP_REQ(message_p), req, sizeof(f1ap_setup_req_t) ); memcpy(&F1AP_SETUP_REQ(message_p), req, sizeof(f1ap_setup_req_t) );
if (num_cells_available > 0) { if (req->num_cells_available > 0) {
if (f1ap_req(true, instance)->cell_type == CELL_MACRO_GNB) { if (f1ap_req(true, instance)->cell_type == CELL_MACRO_GNB) {
itti_send_msg_to_task(TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(instance), message_p); itti_send_msg_to_task(TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(instance), message_p);
} else { } else {
......
...@@ -585,6 +585,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, ...@@ -585,6 +585,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance,
MCC_MNC_TO_PLMNID(cell->mcc, cell->mnc, cell->mnc_digit_length, &servedPLMN_item->pLMN_Identity); MCC_MNC_TO_PLMNID(cell->mcc, cell->mnc, cell->mnc_digit_length, &servedPLMN_item->pLMN_Identity);
// // /* - CHOICE NR-MODE-Info */ // // /* - CHOICE NR-MODE-Info */
F1AP_NR_Mode_Info_t *nR_Mode_Info=&served_cell_information->nR_Mode_Info; F1AP_NR_Mode_Info_t *nR_Mode_Info=&served_cell_information->nR_Mode_Info;
LOG_E(F1AP,"Here hardcoded values instead of values from configuration file\n");
if (f1ap_setup_req->fdd_flag) { if (f1ap_setup_req->fdd_flag) {
nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_fDD; nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_fDD;
......
...@@ -198,7 +198,6 @@ void *gNB_app_task(void *args_p) ...@@ -198,7 +198,6 @@ void *gNB_app_task(void *args_p)
RC.nrrrc = (gNB_RRC_INST **)malloc(RC.nb_nr_inst*sizeof(gNB_RRC_INST *)); RC.nrrrc = (gNB_RRC_INST **)malloc(RC.nb_nr_inst*sizeof(gNB_RRC_INST *));
LOG_I(PHY, "%s() RC.nb_nr_inst:%d RC.nrrrc:%p\n", __FUNCTION__, RC.nb_nr_inst, RC.nrrrc); LOG_I(PHY, "%s() RC.nb_nr_inst:%d RC.nrrrc:%p\n", __FUNCTION__, RC.nb_nr_inst, RC.nrrrc);
for (gnb_id = gnb_id_start; (gnb_id < gnb_id_end) ; gnb_id++) { for (gnb_id = gnb_id_start; (gnb_id < gnb_id_end) ; gnb_id++) {
RC.nrrrc[gnb_id] = (gNB_RRC_INST*)calloc(1,sizeof(gNB_RRC_INST)); RC.nrrrc[gnb_id] = (gNB_RRC_INST*)calloc(1,sizeof(gNB_RRC_INST));
LOG_I(PHY, "%s() Creating RRC instance RC.nrrrc[%d]:%p (%d of %d)\n", __FUNCTION__, gnb_id, RC.nrrrc[gnb_id], gnb_id+1, gnb_id_end); LOG_I(PHY, "%s() Creating RRC instance RC.nrrrc[%d]:%p (%d of %d)\n", __FUNCTION__, gnb_id, RC.nrrrc[gnb_id], gnb_id+1, gnb_id_end);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment