rework BWP configuration via file

This commit is contained in:
francescomani
2025-09-04 18:43:12 +02:00
parent 9ab0715a5a
commit 3ea02249d6
16 changed files with 156 additions and 409 deletions
@@ -146,18 +146,8 @@ gNBs =
); );
servingCellConfigDedicated = ({ first_active_bwp = 1;
dl_bwp-Id_1 = 1; bwp_list = ({ scs = 1; bwpStart = 0; bwpSize = 106;});
dl_bwp1_locationAndBandwidth = 28875; # RBstart=0, L=106 (275*(L-1))+RBstart
dl_bwp1_subcarrierSpacing = 1;
firstActiveDownlinkBWP-Id = 1;
defaultDownlinkBWP-Id = 1;
ul_bwp-Id_1 = 1;
ul_bwp1_locationAndBandwidth = 28875; # RBstart=0, L=106 (275*(L-1))+RBstart
ul_bwp1_subcarrierSpacing = 1;
firstActiveUplinkBWP-Id = 1;
});
# ------- SCTP definitions # ------- SCTP definitions
SCTP : SCTP :
@@ -145,64 +145,10 @@ gNBs =
); );
# Dedicated Serving Cell Configuration first_active_bwp = 1;
servingCellConfigDedicated = ({ bwp_list = ({ scs = 1; bwpStart = 0; bwpSize = 106;},
# BWP-Downlink { scs = 1; bwpStart = 0; bwpSize = 51;},
# BWP 1 Configuration { scs = 1; bwpStart = 0; bwpSize = 24;});
dl_bwp-Id_1 = 1;
dl_bwp1_locationAndBandwidth = 28875; // RBstart=0, L=106 (40 MHz BW)
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
dl_bwp1_subcarrierSpacing = 1;
# BWP 2 Configuration
dl_bwp-Id_2 = 2;
dl_bwp2_locationAndBandwidth = 13750; // RBstart=0, L=51 (20 MHz BW)
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
dl_bwp2_subcarrierSpacing = 1;
# BWP 3 Configuration
dl_bwp-Id_3 = 3;
dl_bwp3_locationAndBandwidth = 6325; // RBstart=0, L=24 (10 MHz BW)
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
dl_bwp3_subcarrierSpacing = 1;
firstActiveDownlinkBWP-Id = 1; #BWP-Id
defaultDownlinkBWP-Id = 1; #BWP-Id
# bwp-InactivityTimer ENUMERATED {ms2, ms3, ms4, ms5, ms6, ms8, ms10, ms20, ms30,
# ms40,ms50, ms60, ms80,ms100, ms200,ms300, ms500,
# ms750, ms1280, ms1920, ms2560, spare10, spare9, spare8,
# spare7, spare6, spare5, spare4, spare3, spare2, spare1 }
# UplinkConfig
# BWP-Uplink
# BWP 1 Configuration
ul_bwp-Id_1 = 1;
ul_bwp1_locationAndBandwidth = 28875; // RBstart=0, L=106 (40 MHz BW)
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
ul_bwp1_subcarrierSpacing = 1;
# BWP 2 Configuration
ul_bwp-Id_2 = 2;
ul_bwp2_locationAndBandwidth = 13750; // RBstart=0, L=51 (20 MHz BW)
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
ul_bwp2_subcarrierSpacing = 1;
# BWP 3 Configuration
ul_bwp-Id_3 = 3;
ul_bwp3_locationAndBandwidth = 6325; // RBstart=0, L=24 (10 MHz BW)
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
ul_bwp3_subcarrierSpacing = 1;
firstActiveUplinkBWP-Id = 1; #BWP-Id
}
);
# ------- SCTP definitions # ------- SCTP definitions
+10 -17
View File
@@ -17,35 +17,28 @@ A UE can be configured with a set of 4 BWPs in uplink (UL) and downlink (DL) dir
A maximum of 4 dedicated BWPs can be configured for a UE. A maximum of 4 dedicated BWPs can be configured for a UE.
To configure multiple BWPs, add the following parameters to the gNB configuration file under "servingCellConfigDedicated": To configure multiple BWPs, add the following parameters in the physical parameters section:
## Setup of the Configuration files ## ## Setup of the Configuration files ##
In the configuration file you have the option to select the 1st active BWP, the RIV and SCS of each BWP in the following way (example with 3 additional BWPs):
``` ```
firstActiveDownlinkBWP-Id = 1; #BWP-Id first_active_bwp = 1;
defaultDownlinkBWP-Id = 1; #BWP-Id bwp_list = ({ scs = 1; bwpStart = 0; bwpSize = 106;},
firstActiveUplinkBWP-Id = 1; #BWP-Id { scs = 1; bwpStart = 0; bwpSize = 51;},
{ scs = 1; bwpStart = 0; bwpSize = 24;});
``` ```
Each dedicated BWP must have: This example configures 3 additional BWPs, with IDs from 1 to 3. Find these parameters in this configuration file: "ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.neighbour.conf"
```
# BWP 1 Configuration
dl_bwp-Id_1 = 1;
dl_bwp1_locationAndBandwidth = 28875; // RBstart=0, L=106 (40 MHz BW)
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
dl_bwp1_subcarrierSpacing = 1;
```
Find these parameters in this configuration file: "targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf"
# Testing gNB and UE in RF simulator # Testing gNB and UE in RF simulator
## gNB command: ## gNB command:
``` ```
sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6 --rfsim sudo ./nr-softmodem -O ../../../ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.neighbour.conf --rfsim --rfsimulator.serveraddr server
``` ```
## UE command: ## UE command:
``` ```
sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --uicc0.imsi 208990000000001 --rfsimulator.serveraddr 127.0.0.1 sudo ./nr-uesoftmodem -C 3319680000 -r 106 --numerology 1 --ssb 516 --band 78 --rfsim --rfsimulator.serveraddr 127.0.0.1
``` ```
+2 -7
View File
@@ -743,7 +743,7 @@ printf("%d\n", slot);
RC.nb_nr_mac_CC = (int*)malloc(RC.nb_nr_macrlc_inst*sizeof(int)); RC.nb_nr_mac_CC = (int*)malloc(RC.nb_nr_macrlc_inst*sizeof(int));
for (i = 0; i < RC.nb_nr_macrlc_inst; i++) for (i = 0; i < RC.nb_nr_macrlc_inst; i++)
RC.nb_nr_mac_CC[i] = 1; RC.nb_nr_mac_CC[i] = 1;
mac_top_init_gNB(ngran_gNB, scc, NULL, &conf, &rlc_config); mac_top_init_gNB(ngran_gNB, scc, &conf, &rlc_config);
gNB_mac = RC.nrmac[0]; gNB_mac = RC.nrmac[0];
nr_mac_config_scc(RC.nrmac[0], scc, &conf); nr_mac_config_scc(RC.nrmac[0], scc, &conf);
@@ -791,11 +791,6 @@ printf("%d\n", slot);
NR_ServingCellConfigCommon_t *scc = secondaryCellGroup->spCellConfig->reconfigurationWithSync->spCellConfigCommon; NR_ServingCellConfigCommon_t *scc = secondaryCellGroup->spCellConfig->reconfigurationWithSync->spCellConfigCommon;
*/ */
NR_ServingCellConfig_t *scd = calloc(1,sizeof(*scd));
prepare_scd(scd);
/* removes unnecessary BWPs, if any */
fix_scd(scd);
gNB->ap_N1 = pdsch_AntennaPorts.N1; gNB->ap_N1 = pdsch_AntennaPorts.N1;
gNB->ap_N2 = pdsch_AntennaPorts.N2; gNB->ap_N2 = pdsch_AntennaPorts.N2;
gNB->ap_XP = pdsch_AntennaPorts.XP; gNB->ap_XP = pdsch_AntennaPorts.XP;
@@ -806,7 +801,7 @@ printf("%d\n", slot);
prepare_sim_uecap(UE_Capability_nr, scc, mu, N_RB_DL, g_mcsTableIdx, 0); prepare_sim_uecap(UE_Capability_nr, scc, mu, N_RB_DL, g_mcsTableIdx, 0);
rnti_t rnti = 0x1234; rnti_t rnti = 0x1234;
int uid = 0; int uid = 0;
NR_CellGroupConfig_t *secondaryCellGroup = get_default_secondaryCellGroup(scc, scd, UE_Capability_nr, 0, 1, &conf, uid); NR_CellGroupConfig_t *secondaryCellGroup = get_default_secondaryCellGroup(scc, UE_Capability_nr, 0, 1, &conf, uid);
secondaryCellGroup->spCellConfig->reconfigurationWithSync = get_reconfiguration_with_sync(rnti, uid, scc); secondaryCellGroup->spCellConfig->reconfigurationWithSync = get_reconfiguration_with_sync(rnti, uid, scc);
/* -U option modify DMRS */ /* -U option modify DMRS */
+2 -7
View File
@@ -698,19 +698,14 @@ int main(int argc, char *argv[])
RC.nb_nr_mac_CC = (int*)malloc(RC.nb_nr_macrlc_inst*sizeof(int)); RC.nb_nr_mac_CC = (int*)malloc(RC.nb_nr_macrlc_inst*sizeof(int));
for (i = 0; i < RC.nb_nr_macrlc_inst; i++) for (i = 0; i < RC.nb_nr_macrlc_inst; i++)
RC.nb_nr_mac_CC[i] = 1; RC.nb_nr_mac_CC[i] = 1;
mac_top_init_gNB(ngran_gNB, scc, NULL /* scd will be updated further below */, &conf, &rlc_config); mac_top_init_gNB(ngran_gNB, scc, &conf, &rlc_config);
nr_mac_config_scc(RC.nrmac[0], scc, &conf); nr_mac_config_scc(RC.nrmac[0], scc, &conf);
NR_ServingCellConfig_t *scd = calloc(1,sizeof(NR_ServingCellConfig_t));
prepare_scd(scd);
/* removes unnecessary BWPs, if any */
fix_scd(scd);
NR_UE_NR_Capability_t* UE_Capability_nr = CALLOC(1,sizeof(NR_UE_NR_Capability_t)); NR_UE_NR_Capability_t* UE_Capability_nr = CALLOC(1,sizeof(NR_UE_NR_Capability_t));
prepare_sim_uecap(UE_Capability_nr, scc, mu, N_RB_UL, 0, mcs_table); prepare_sim_uecap(UE_Capability_nr, scc, mu, N_RB_UL, 0, mcs_table);
rnti_t rnti = 0x1234; rnti_t rnti = 0x1234;
int uid = 0; int uid = 0;
NR_CellGroupConfig_t *secondaryCellGroup = get_default_secondaryCellGroup(scc, scd, UE_Capability_nr, 0, 1, &conf, uid); NR_CellGroupConfig_t *secondaryCellGroup = get_default_secondaryCellGroup(scc, UE_Capability_nr, 0, 1, &conf, uid);
secondaryCellGroup->spCellConfig->reconfigurationWithSync = get_reconfiguration_with_sync(rnti, uid, scc); secondaryCellGroup->spCellConfig->reconfigurationWithSync = get_reconfiguration_with_sync(rnti, uid, scc);
NR_BCCH_BCH_Message_t *mib = get_new_MIB_NR(scc); NR_BCCH_BCH_Message_t *mib = get_new_MIB_NR(scc);
-64
View File
@@ -136,37 +136,6 @@
#define GNB_CONFIG_STRING_TA_COMMONDRIFT "ta-CommonDrift-r17" #define GNB_CONFIG_STRING_TA_COMMONDRIFT "ta-CommonDrift-r17"
#define CARRIERBANDWIDTH_OKVALUES {11,18,24,25,31,32,38,51,52,65,66,78,79,93,106,107,121,132,133,135,160,162,189,216,217,245,264,270,273} #define CARRIERBANDWIDTH_OKVALUES {11,18,24,25,31,32,38,51,52,65,66,78,79,93,106,107,121,132,133,135,160,162,189,216,217,245,264,270,273}
/* Serving Cell Config Dedicated */
#define GNB_CONFIG_STRING_SERVINGCELLCONFIGDEDICATED "servingCellConfigDedicated"
#define GNB_CONFIG_STRING_DLBWP1_ID "dl_bwp-Id_1"
#define GNB_CONFIG_STRING_DLBWP2_ID "dl_bwp-Id_2"
#define GNB_CONFIG_STRING_DLBWP3_ID "dl_bwp-Id_3"
#define GNB_CONFIG_STRING_DLBWP4_ID "dl_bwp-Id_4"
#define GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_DLBWP1 "dl_bwp1_locationAndBandwidth"
#define GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_DLBWP2 "dl_bwp2_locationAndBandwidth"
#define GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_DLBWP3 "dl_bwp3_locationAndBandwidth"
#define GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_DLBWP4 "dl_bwp4_locationAndBandwidth"
#define GNB_CONFIG_STRING_SCS_DLBWP1 "dl_bwp1_subcarrierSpacing"
#define GNB_CONFIG_STRING_SCS_DLBWP2 "dl_bwp2_subcarrierSpacing"
#define GNB_CONFIG_STRING_SCS_DLBWP3 "dl_bwp3_subcarrierSpacing"
#define GNB_CONFIG_STRING_SCS_DLBWP4 "dl_bwp4_subcarrierSpacing"
#define GNB_CONFIG_STRING_FIRSTACTIVEDLBWP_ID "firstActiveDownlinkBWP-Id"
#define GNB_CONFIG_STRING_DEFAULTDLBWP_ID "defaultDownlinkBWP-Id"
#define GNB_CONFIG_STRING_ULBWP1_ID "ul_bwp-Id_1"
#define GNB_CONFIG_STRING_ULBWP2_ID "ul_bwp-Id_2"
#define GNB_CONFIG_STRING_ULBWP3_ID "ul_bwp-Id_3"
#define GNB_CONFIG_STRING_ULBWP4_ID "ul_bwp-Id_4"
#define GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_ULBWP1 "ul_bwp1_locationAndBandwidth"
#define GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_ULBWP2 "ul_bwp2_locationAndBandwidth"
#define GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_ULBWP3 "ul_bwp3_locationAndBandwidth"
#define GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_ULBWP4 "ul_bwp4_locationAndBandwidth"
#define GNB_CONFIG_STRING_SCS_ULBWP1 "ul_bwp1_subcarrierSpacing"
#define GNB_CONFIG_STRING_SCS_ULBWP2 "ul_bwp2_subcarrierSpacing"
#define GNB_CONFIG_STRING_SCS_ULBWP3 "ul_bwp3_subcarrierSpacing"
#define GNB_CONFIG_STRING_SCS_ULBWP4 "ul_bwp4_subcarrierSpacing"
#define GNB_CONFIG_STRING_FIRSTACTIVEULBWP_ID "firstActiveUplinkBWP-Id"
/*--------------------------------------------------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------------------------------------------------*/
/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
@@ -256,39 +225,6 @@
{GNB_CONFIG_STRING_NROFUPLINKSLOTS2,NULL, 0,.i64ptr=&pattern2.nrofUplinkSlots,.defint64val=-1,TYPE_INT64,0},\ {GNB_CONFIG_STRING_NROFUPLINKSLOTS2,NULL, 0,.i64ptr=&pattern2.nrofUplinkSlots,.defint64val=-1,TYPE_INT64,0},\
{GNB_CONFIG_STRING_NROFUPLINKSYMBOLS2,NULL, 0,.i64ptr=&pattern2.nrofUplinkSymbols,.defint64val=-1,TYPE_INT64,0}} {GNB_CONFIG_STRING_NROFUPLINKSYMBOLS2,NULL, 0,.i64ptr=&pattern2.nrofUplinkSymbols,.defint64val=-1,TYPE_INT64,0}}
/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* Serving Cell Config Dedicated configuration parameters */
/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define SCDPARAMS_DESC(scd) { \
{GNB_CONFIG_STRING_FIRSTACTIVEDLBWP_ID,NULL,0,.i64ptr=scd->firstActiveDownlinkBWP_Id,.defint64val=1,TYPE_INT64,0}, \
{GNB_CONFIG_STRING_FIRSTACTIVEULBWP_ID,NULL,0,.i64ptr=scd->uplinkConfig->firstActiveUplinkBWP_Id,.defint64val=1,TYPE_INT64,0}, \
{GNB_CONFIG_STRING_DLBWP1_ID,NULL,0,.i64ptr=&scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Id,.defint64val=1,TYPE_INT64,0}, \
{GNB_CONFIG_STRING_DLBWP2_ID,NULL,0,.i64ptr=&scd->downlinkBWP_ToAddModList->list.array[1]->bwp_Id,.defint64val=2,TYPE_INT64,0}, \
{GNB_CONFIG_STRING_DLBWP3_ID,NULL,0,.i64ptr=&scd->downlinkBWP_ToAddModList->list.array[2]->bwp_Id,.defint64val=3,TYPE_INT64,0}, \
{GNB_CONFIG_STRING_DLBWP4_ID,NULL,0,.i64ptr=&scd->downlinkBWP_ToAddModList->list.array[3]->bwp_Id,.defint64val=4,TYPE_INT64,0}, \
{GNB_CONFIG_STRING_SCS_DLBWP1,NULL,0,.i64ptr=&scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Common->genericParameters.subcarrierSpacing,.defint64val=1,TYPE_INT64,0}, \
{GNB_CONFIG_STRING_SCS_DLBWP2,NULL,0,.i64ptr=&scd->downlinkBWP_ToAddModList->list.array[1]->bwp_Common->genericParameters.subcarrierSpacing,.defint64val=1,TYPE_INT64,0}, \
{GNB_CONFIG_STRING_SCS_DLBWP3,NULL,0,.i64ptr=&scd->downlinkBWP_ToAddModList->list.array[2]->bwp_Common->genericParameters.subcarrierSpacing,.defint64val=1,TYPE_INT64,0}, \
{GNB_CONFIG_STRING_SCS_DLBWP4,NULL,0,.i64ptr=&scd->downlinkBWP_ToAddModList->list.array[3]->bwp_Common->genericParameters.subcarrierSpacing,.defint64val=1,TYPE_INT64,0}, \
{GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_DLBWP1,NULL,0,.i64ptr=&scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Common->genericParameters.locationAndBandwidth,.defint64val=0,TYPE_INT64,0}, \
{GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_DLBWP2,NULL,0,.i64ptr=&scd->downlinkBWP_ToAddModList->list.array[1]->bwp_Common->genericParameters.locationAndBandwidth,.defint64val=0,TYPE_INT64,0}, \
{GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_DLBWP3,NULL,0,.i64ptr=&scd->downlinkBWP_ToAddModList->list.array[2]->bwp_Common->genericParameters.locationAndBandwidth,.defint64val=0,TYPE_INT64,0}, \
{GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_DLBWP4,NULL,0,.i64ptr=&scd->downlinkBWP_ToAddModList->list.array[3]->bwp_Common->genericParameters.locationAndBandwidth,.defint64val=0,TYPE_INT64,0}, \
{GNB_CONFIG_STRING_ULBWP1_ID,NULL,0,.i64ptr=&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Id,.defint64val=1,TYPE_INT64,0}, \
{GNB_CONFIG_STRING_ULBWP2_ID,NULL,0,.i64ptr=&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[1]->bwp_Id,.defint64val=2,TYPE_INT64,0}, \
{GNB_CONFIG_STRING_ULBWP3_ID,NULL,0,.i64ptr=&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[2]->bwp_Id,.defint64val=3,TYPE_INT64,0}, \
{GNB_CONFIG_STRING_ULBWP4_ID,NULL,0,.i64ptr=&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[3]->bwp_Id,.defint64val=4,TYPE_INT64,0}, \
{GNB_CONFIG_STRING_SCS_ULBWP1,NULL,0,.i64ptr=&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Common->genericParameters.subcarrierSpacing,.defint64val=1,TYPE_INT64,0}, \
{GNB_CONFIG_STRING_SCS_ULBWP2,NULL,0,.i64ptr=&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[1]->bwp_Common->genericParameters.subcarrierSpacing,.defint64val=1,TYPE_INT64,0}, \
{GNB_CONFIG_STRING_SCS_ULBWP3,NULL,0,.i64ptr=&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[2]->bwp_Common->genericParameters.subcarrierSpacing,.defint64val=1,TYPE_INT64,0}, \
{GNB_CONFIG_STRING_SCS_ULBWP4,NULL,0,.i64ptr=&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[3]->bwp_Common->genericParameters.subcarrierSpacing,.defint64val=1,TYPE_INT64,0}, \
{GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_ULBWP1,NULL,0,.i64ptr=&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Common->genericParameters.locationAndBandwidth,.defint64val=0,TYPE_INT64,0}, \
{GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_ULBWP2,NULL,0,.i64ptr=&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[1]->bwp_Common->genericParameters.locationAndBandwidth,.defint64val=0,TYPE_INT64,0}, \
{GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_ULBWP3,NULL,0,.i64ptr=&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[2]->bwp_Common->genericParameters.locationAndBandwidth,.defint64val=0,TYPE_INT64,0}, \
{GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_ULBWP4,NULL,0,.i64ptr=&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[3]->bwp_Common->genericParameters.locationAndBandwidth,.defint64val=0,TYPE_INT64,0}, \
{GNB_CONFIG_STRING_DEFAULTDLBWP_ID,NULL,0,.i64ptr=scd->defaultDownlinkBWP_Id,.defint64val=0,TYPE_INT64,0}}
/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* Serving Cell Config Common configuration parameters to apply in RA 2-Step */ /* Serving Cell Config Common configuration parameters to apply in RA 2-Step */
+33 -95
View File
@@ -661,79 +661,6 @@ void fix_scc(NR_ServingCellConfigCommon_t *scc, uint64_t ssbmap)
} }
} }
/* Function to allocate dedicated serving cell config strutures */
void prepare_scd(NR_ServingCellConfig_t *scd) {
// Allocate downlink structures
scd->downlinkBWP_ToAddModList = calloc_or_fail(1, sizeof(*scd->downlinkBWP_ToAddModList));
scd->uplinkConfig = calloc_or_fail(1, sizeof(*scd->uplinkConfig));
scd->uplinkConfig->uplinkBWP_ToAddModList = calloc_or_fail(1, sizeof(*scd->uplinkConfig->uplinkBWP_ToAddModList));
scd->bwp_InactivityTimer = calloc_or_fail(1, sizeof(*scd->bwp_InactivityTimer));
scd->uplinkConfig->firstActiveUplinkBWP_Id = calloc_or_fail(1, sizeof(*scd->uplinkConfig->firstActiveUplinkBWP_Id));
scd->firstActiveDownlinkBWP_Id = calloc_or_fail(1, sizeof(*scd->firstActiveDownlinkBWP_Id));
*scd->firstActiveDownlinkBWP_Id = 1;
*scd->uplinkConfig->firstActiveUplinkBWP_Id = 1;
scd->defaultDownlinkBWP_Id = calloc_or_fail(1, sizeof(*scd->defaultDownlinkBWP_Id));
*scd->defaultDownlinkBWP_Id = 0;
for (int j = 0; j < NR_MAX_NUM_BWP; j++) {
// Downlink bandwidth part
NR_BWP_Downlink_t *bwp = calloc_or_fail(1, sizeof(*bwp));
bwp->bwp_Id = j+1;
// Allocate downlink dedicated bandwidth part and PDSCH structures
bwp->bwp_Common = calloc_or_fail(1, sizeof(*bwp->bwp_Common));
bwp->bwp_Common->pdcch_ConfigCommon = calloc_or_fail(1, sizeof(*bwp->bwp_Common->pdcch_ConfigCommon));
bwp->bwp_Common->pdsch_ConfigCommon = calloc_or_fail(1, sizeof(*bwp->bwp_Common->pdsch_ConfigCommon));
bwp->bwp_Dedicated = calloc_or_fail(1, sizeof(*bwp->bwp_Dedicated));
asn1cSeqAdd(&scd->downlinkBWP_ToAddModList->list,bwp);
// UL bandwidth part
NR_BWP_Uplink_t *ubwp = calloc_or_fail(1, sizeof(*ubwp));
ubwp->bwp_Id = j+1;
ubwp->bwp_Common = calloc_or_fail(1, sizeof(*ubwp->bwp_Common));
ubwp->bwp_Dedicated = calloc_or_fail(1, sizeof(*ubwp->bwp_Dedicated));
asn1cSeqAdd(&scd->uplinkConfig->uplinkBWP_ToAddModList->list,ubwp);
}
}
/* This function checks dedicated serving cell configuration and performs fixes as needed */
void fix_scd(NR_ServingCellConfig_t *scd) {
// Remove unused BWPs
int b = 0;
while (b<scd->downlinkBWP_ToAddModList->list.count) {
if (scd->downlinkBWP_ToAddModList->list.array[b]->bwp_Common->genericParameters.locationAndBandwidth == 0) {
ASN_STRUCT_FREE(asn_DEF_NR_BWP_Downlink, scd->downlinkBWP_ToAddModList->list.array[b]);
asn_sequence_del(&scd->downlinkBWP_ToAddModList->list,b,1);
} else {
b++;
}
}
b = 0;
while (b<scd->uplinkConfig->uplinkBWP_ToAddModList->list.count) {
if (scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[b]->bwp_Common->genericParameters.locationAndBandwidth == 0) {
ASN_STRUCT_FREE(asn_DEF_NR_BWP_Uplink, scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[b]);
asn_sequence_del(&scd->uplinkConfig->uplinkBWP_ToAddModList->list,b,1);
} else {
b++;
}
}
if (scd->downlinkBWP_ToAddModList->list.count == 0) {
free(scd->downlinkBWP_ToAddModList->list.array);
free(scd->downlinkBWP_ToAddModList);
scd->downlinkBWP_ToAddModList = NULL;
}
if (scd->uplinkConfig->uplinkBWP_ToAddModList->list.count == 0) {
free(scd->uplinkConfig->uplinkBWP_ToAddModList->list.array);
free(scd->uplinkConfig->uplinkBWP_ToAddModList);
scd->uplinkConfig->uplinkBWP_ToAddModList = NULL;
}
}
static void verify_gnb_param_notset(paramdef_t *params, int paramidx, const char *paramname) static void verify_gnb_param_notset(paramdef_t *params, int paramidx, const char *paramname)
{ {
char aprefix[MAX_OPTNAME_SIZE * 2 + 8]; char aprefix[MAX_OPTNAME_SIZE * 2 + 8];
@@ -1107,24 +1034,6 @@ static NR_ServingCellConfigCommon_t *get_scc_config(configmodule_interface_t *cf
return scc; return scc;
} }
static NR_ServingCellConfig_t *get_scd_config(configmodule_interface_t *cfg)
{
NR_ServingCellConfig_t *scd = calloc(1, sizeof(*scd));
prepare_scd(scd);
char aprefix[MAX_OPTNAME_SIZE * 2 + 8];
snprintf(aprefix, sizeof(aprefix), "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0);
GET_PARAMS_LIST(SCDsParamList, SCDsParams, SCDPARAMS_DESC(scd), GNB_CONFIG_STRING_SERVINGCELLCONFIGDEDICATED, aprefix);
if (SCDsParamList.numelt > 0) {
snprintf(aprefix, sizeof(aprefix), "%s.[%i].%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0, GNB_CONFIG_STRING_SERVINGCELLCONFIGDEDICATED, 0);
GET_PARAMS(SCDsParams, SCDPARAMS_DESC(scd), aprefix);
}
fix_scd(scd);
return scd;
}
static int read_du_cell_info(configmodule_interface_t *cfg, static int read_du_cell_info(configmodule_interface_t *cfg,
bool separate_du, bool separate_du,
uint32_t *gnb_id, uint32_t *gnb_id,
@@ -1445,6 +1354,31 @@ void config_pdcp(configmodule_interface_t *cfg, nr_pdcp_configuration_t *pdcp_co
pdcp_config->drb.discard_timer = config_get_processedint(cfg, &pdcp_params[CONFIG_NR_PDCP_DRB_DISCARD_TIMER_IDX]); pdcp_config->drb.discard_timer = config_get_processedint(cfg, &pdcp_params[CONFIG_NR_PDCP_DRB_DISCARD_TIMER_IDX]);
} }
static void get_bwp_config(nr_mac_config_t *configuration)
{
char path[MAX_OPTNAME_SIZE * 2 + 8];
snprintf(path, sizeof(path), "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0);
GET_PARAMS_LIST(BWPParamList, BWPParams, GNBBWPPARAMS_DESC, GNB_CONFIG_STRING_BWP_LIST, path, BWPPARAMS_CHECK);
configuration->num_additional_bwps = BWPParamList.numelt;
AssertFatal(configuration->num_additional_bwps >= 0 && configuration->num_additional_bwps <= 4,
"Invalid number of additional BWPs %d\n",
configuration->num_additional_bwps);
for (int i = 0; i < configuration->num_additional_bwps; i++) {
configuration->bwp_config[i].id = i + 1;
int bwp_start = *BWPParamList.paramarray[i][GNB_BWP_START_IDX].iptr;
int bwp_size = *BWPParamList.paramarray[i][GNB_BWP_SIZE_IDX].iptr;
configuration->bwp_config[i].location_and_bw = PRBalloc_to_locationandbandwidth(bwp_size, bwp_start);
configuration->bwp_config[i].scs = *BWPParamList.paramarray[i][GNB_BWP_SCS_IDX].iptr;
LOG_I(GNB_APP,
"BWP %d, start PRB %d size %d locationandbandwidth %d, scs %d\n",
configuration->bwp_config[i].id,
bwp_start,
bwp_size,
configuration->bwp_config[i].location_and_bw,
configuration->bwp_config[i].scs);
}
}
void RCconfig_nr_macrlc(configmodule_interface_t *cfg) void RCconfig_nr_macrlc(configmodule_interface_t *cfg)
{ {
int j = 0; int j = 0;
@@ -1470,6 +1404,12 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg)
config.pdsch_AntennaPorts.XP, config.pdsch_AntennaPorts.XP,
config.pusch_AntennaPorts); config.pusch_AntennaPorts);
// BWP
get_bwp_config(&config);
AssertFatal(config.num_additional_bwps <= 4, "Impossible to configure more than 4 additional BWPs\n");
config.first_active_bwp = *GNBParamList.paramarray[0][GNB_1ST_ACTIVE_BWP_IDX].iptr;
AssertFatal(config.first_active_bwp <= config.num_additional_bwps, "1st active BWP does not belog to the configured BWPs\n");
// RU // RU
GET_PARAMS_LIST(RUParamList, RUParams, RUPARAMS_DESC, CONFIG_STRING_RU_LIST, NULL); GET_PARAMS_LIST(RUParamList, RUParams, RUPARAMS_DESC, CONFIG_STRING_RU_LIST, NULL);
int num_tx = 0; int num_tx = 0;
@@ -1478,8 +1418,7 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg)
num_tx += *(RUParamList.paramarray[i][RU_NB_TX_IDX].uptr); num_tx += *(RUParamList.paramarray[i][RU_NB_TX_IDX].uptr);
AssertFatal(num_tx >= config.pdsch_AntennaPorts.XP * config.pdsch_AntennaPorts.N1 * config.pdsch_AntennaPorts.N2, AssertFatal(num_tx >= config.pdsch_AntennaPorts.XP * config.pdsch_AntennaPorts.N1 * config.pdsch_AntennaPorts.N2,
"Number of logical antenna ports (set in config file with pdsch_AntennaPorts) cannot be larger than physical antennas (nb_tx)\n"); "Number of logical antenna ports (set in config file with pdsch_AntennaPorts) cannot be larger than physical antennas (nb_tx)\n");
} } else {
else {
// TODO temporary solution for 3rd party RU or nFAPI, in which case we don't have RU section present in the config file // TODO temporary solution for 3rd party RU or nFAPI, in which case we don't have RU section present in the config file
num_tx = config.pdsch_AntennaPorts.XP * config.pdsch_AntennaPorts.N1 * config.pdsch_AntennaPorts.N2; num_tx = config.pdsch_AntennaPorts.XP * config.pdsch_AntennaPorts.N1 * config.pdsch_AntennaPorts.N2;
LOG_E(GNB_APP, "RU information not present in config file. Assuming physical antenna ports equal to logical antenna ports %d\n", num_tx); LOG_E(GNB_APP, "RU information not present in config file. Assuming physical antenna ports equal to logical antenna ports %d\n", num_tx);
@@ -1569,7 +1508,6 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg)
NR_ServingCellConfigCommon_t *scc = get_scc_config(cfg, config.minRXTXTIME, config.do_SRS); NR_ServingCellConfigCommon_t *scc = get_scc_config(cfg, config.minRXTXTIME, config.do_SRS);
//xer_fprint(stdout, &asn_DEF_NR_ServingCellConfigCommon, scc); //xer_fprint(stdout, &asn_DEF_NR_ServingCellConfigCommon, scc);
NR_ServingCellConfig_t *scd = get_scd_config(cfg);
if (MacRLC_ParamList.numelt > 0) { if (MacRLC_ParamList.numelt > 0) {
/* NR RLC config is needed by mac_top_init_gNB() */ /* NR RLC config is needed by mac_top_init_gNB() */
@@ -1577,7 +1515,7 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg)
config_rlc(cfg, &default_rlc_config); config_rlc(cfg, &default_rlc_config);
ngran_node_t node_type = get_node_type(); ngran_node_t node_type = get_node_type();
mac_top_init_gNB(node_type, scc, scd, &config, &default_rlc_config); mac_top_init_gNB(node_type, scc, &config, &default_rlc_config);
RC.nb_nr_mac_CC = (int *)malloc(RC.nb_nr_macrlc_inst * sizeof(int)); RC.nb_nr_mac_CC = (int *)malloc(RC.nb_nr_macrlc_inst * sizeof(int));
for (j = 0; j < RC.nb_nr_macrlc_inst; j++) { for (j = 0; j < RC.nb_nr_macrlc_inst; j++) {
+28
View File
@@ -138,6 +138,7 @@ typedef enum {
#define GNB_CONFIG_STRING_CU_SIB_LIST "cu_sibs" #define GNB_CONFIG_STRING_CU_SIB_LIST "cu_sibs"
#define GNB_CONFIG_STRING_DU_SIB_LIST "du_sibs" #define GNB_CONFIG_STRING_DU_SIB_LIST "du_sibs"
#define GNB_CONFIG_STRING_DOSINR "do_SINR" #define GNB_CONFIG_STRING_DOSINR "do_SINR"
#define GNB_CONFIG_STRING_1ST_ACTIVE_BWP "first_active_bwp"
#define GNB_CONFIG_HLP_STRING_ENABLE_SDAP "enable the SDAP layer\n" #define GNB_CONFIG_HLP_STRING_ENABLE_SDAP "enable the SDAP layer\n"
#define GNB_CONFIG_HLP_FORCE256QAMOFF "suppress activation of 256 QAM despite UE support" #define GNB_CONFIG_HLP_FORCE256QAMOFF "suppress activation of 256 QAM despite UE support"
@@ -153,6 +154,7 @@ typedef enum {
#define GNB_CONFIG_HLP_DU_SIBS "List of DU generated SIBs to be transmitted" #define GNB_CONFIG_HLP_DU_SIBS "List of DU generated SIBs to be transmitted"
#define GNB_CONFIG_HLP_DOSINR "Enable CSI feedback using SINR measurements on SSB" #define GNB_CONFIG_HLP_DOSINR "Enable CSI feedback using SINR measurements on SSB"
/*-----------------------------------------------------------------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------------------------------------------------------------*/
/* cell configuration parameters */ /* cell configuration parameters */
/* optname helpstr paramflags XXXptr defXXXval type numelt */ /* optname helpstr paramflags XXXptr defXXXval type numelt */
@@ -199,6 +201,7 @@ typedef enum {
{GNB_CONFIG_STRING_CU_SIB_LIST, GNB_CONFIG_HLP_CU_SIBS, 0, .iptr=NULL, .defintarrayval=0, TYPE_INTARRAY, 0}, \ {GNB_CONFIG_STRING_CU_SIB_LIST, GNB_CONFIG_HLP_CU_SIBS, 0, .iptr=NULL, .defintarrayval=0, TYPE_INTARRAY, 0}, \
{GNB_CONFIG_STRING_DU_SIB_LIST, GNB_CONFIG_HLP_DU_SIBS, 0, .iptr=NULL, .defintarrayval=0, TYPE_INTARRAY, 0}, \ {GNB_CONFIG_STRING_DU_SIB_LIST, GNB_CONFIG_HLP_DU_SIBS, 0, .iptr=NULL, .defintarrayval=0, TYPE_INTARRAY, 0}, \
{GNB_CONFIG_STRING_DOSINR, GNB_CONFIG_HLP_DOSINR, 0, .iptr=NULL, .defintval=0, TYPE_INT, 0}, \ {GNB_CONFIG_STRING_DOSINR, GNB_CONFIG_HLP_DOSINR, 0, .iptr=NULL, .defintval=0, TYPE_INT, 0}, \
{GNB_CONFIG_STRING_1ST_ACTIVE_BWP, NULL, 0, .iptr=NULL, .defintval=0, TYPE_INT, 0}, \
} }
// clang-format on // clang-format on
@@ -242,6 +245,7 @@ typedef enum {
#define GNB_CU_SIBS_IDX 36 #define GNB_CU_SIBS_IDX 36
#define GNB_DU_SIBS_IDX 37 #define GNB_DU_SIBS_IDX 37
#define GNB_DO_SINR_IDX 38 #define GNB_DO_SINR_IDX 38
#define GNB_1ST_ACTIVE_BWP_IDX 39
#define TRACKING_AREA_CODE_OKRANGE {0x0001,0xFFFD} #define TRACKING_AREA_CODE_OKRANGE {0x0001,0xFFFD}
#define NUM_DL_HARQ_OKVALUES {2,4,6,8,10,12,16,32} #define NUM_DL_HARQ_OKVALUES {2,4,6,8,10,12,16,32}
@@ -287,9 +291,33 @@ typedef enum {
{ .s5 = { NULL } }, \ { .s5 = { NULL } }, \
{ .s5 = { NULL } }, \ { .s5 = { NULL } }, \
{ .s5 = { NULL } }, \ { .s5 = { NULL } }, \
{ .s5 = { NULL } }, \
} }
/*-------------------------------------------------------------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------------------------------------------------------------*/
#define GNB_CONFIG_STRING_BWP_LIST "bwp_list"
#define GNB_CONFIG_STRING_BWP_SCS "scs"
#define GNB_CONFIG_STRING_BWP_START "bwpStart"
#define GNB_CONFIG_STRING_BWP_SIZE "bwpSize"
#define GNB_BWP_SCS_IDX 0
#define GNB_BWP_START_IDX 1
#define GNB_BWP_SIZE_IDX 2
#define GNBBWPPARAMS_DESC { \
{GNB_CONFIG_STRING_BWP_SCS, NULL, 0, .iptr=NULL, .defintarrayval=0, TYPE_INT, 0}, \
{GNB_CONFIG_STRING_BWP_START, NULL, 0, .iptr=NULL, .defintarrayval=0, TYPE_INT, 0}, \
{GNB_CONFIG_STRING_BWP_SIZE, NULL, 0, .iptr=NULL, .defintarrayval=0, TYPE_INT, 0}, \
}
#define BWPPARAMS_CHECK { \
{ .s5 = { NULL } }, \
{ .s5 = { NULL } }, \
{ .s5 = { NULL } }, \
}
/*-------------------------------------------------------------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------------------------------------------------------------*/
/* Neighbour Cell Configurations*/ /* Neighbour Cell Configurations*/
@@ -3744,8 +3744,7 @@ bool prepare_initial_ul_rrc_message(gNB_MAC_INST *mac, NR_UE_info_t *UE)
int CC_id = 0; int CC_id = 0;
int srb_id = 1; int srb_id = 1;
const NR_ServingCellConfigCommon_t *scc = mac->common_channels[CC_id].ServingCellConfigCommon; const NR_ServingCellConfigCommon_t *scc = mac->common_channels[CC_id].ServingCellConfigCommon;
const NR_ServingCellConfig_t *sccd = UE->is_redcap ? NULL : mac->common_channels[CC_id].pre_ServingCellConfig; NR_CellGroupConfig_t *cellGroupConfig = get_initial_cellGroupConfig(UE->uid, scc, &mac->radio_config, &mac->rlc_config);
NR_CellGroupConfig_t *cellGroupConfig = get_initial_cellGroupConfig(UE->uid, scc, sccd, &mac->radio_config, &mac->rlc_config);
ASN_STRUCT_FREE(asn_DEF_NR_CellGroupConfig, UE->CellGroup); ASN_STRUCT_FREE(asn_DEF_NR_CellGroupConfig, UE->CellGroup);
UE->CellGroup = cellGroupConfig; UE->CellGroup = cellGroupConfig;
-1
View File
@@ -52,7 +52,6 @@ void delete_nr_ue_data(NR_UE_info_t *UE, NR_COMMON_channels_t *ccPtr, uid_alloca
void mac_top_init_gNB(ngran_node_t node_type, void mac_top_init_gNB(ngran_node_t node_type,
NR_ServingCellConfigCommon_t *scc, NR_ServingCellConfigCommon_t *scc,
NR_ServingCellConfig_t *scd,
const nr_mac_config_t *conf, const nr_mac_config_t *conf,
const nr_rlc_configuration_t *default_rlc_config); const nr_rlc_configuration_t *default_rlc_config);
void mac_top_destroy_gNB(gNB_MAC_INST *mac); void mac_top_destroy_gNB(gNB_MAC_INST *mac);
@@ -569,14 +569,13 @@ static NR_UE_info_t *create_new_UE(gNB_MAC_INST *mac, uint32_t cu_id, const NR_C
NR_CellGroupConfig_t *cellGroupConfig = NULL; NR_CellGroupConfig_t *cellGroupConfig = NULL;
NR_COMMON_channels_t *cc = &mac->common_channels[CC_id]; NR_COMMON_channels_t *cc = &mac->common_channels[CC_id];
const NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; const NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
const NR_ServingCellConfig_t *sccd = cc->pre_ServingCellConfig;
const nr_mac_config_t *configuration = &mac->radio_config; const nr_mac_config_t *configuration = &mac->radio_config;
if (is_SA) { if (is_SA) {
cellGroupConfig = get_initial_cellGroupConfig(UE->uid, scc, sccd, &mac->radio_config, &mac->rlc_config); cellGroupConfig = get_initial_cellGroupConfig(UE->uid, scc, &mac->radio_config, &mac->rlc_config);
cellGroupConfig->spCellConfig->reconfigurationWithSync = get_reconfiguration_with_sync(UE->rnti, UE->uid, scc); cellGroupConfig->spCellConfig->reconfigurationWithSync = get_reconfiguration_with_sync(UE->rnti, UE->uid, scc);
} else { } else {
NR_UE_NR_Capability_t *cap = get_ue_nr_cap_from_cg_config_info(cgci); NR_UE_NR_Capability_t *cap = get_ue_nr_cap_from_cg_config_info(cgci);
cellGroupConfig = get_default_secondaryCellGroup(scc, sccd, cap, 1, 1, configuration, UE->uid); cellGroupConfig = get_default_secondaryCellGroup(scc, cap, 1, 1, configuration, UE->uid);
cellGroupConfig->spCellConfig->reconfigurationWithSync = get_reconfiguration_with_sync(UE->rnti, UE->uid, scc); cellGroupConfig->spCellConfig->reconfigurationWithSync = get_reconfiguration_with_sync(UE->rnti, UE->uid, scc);
// TODO: in NSA we assign capabilities here, otherwise outside => not logic // TODO: in NSA we assign capabilities here, otherwise outside => not logic
UE->capability = cap; UE->capability = cap;
-4
View File
@@ -240,7 +240,6 @@ static void mac_rrc_init(gNB_MAC_INST *mac, ngran_node_t node_type)
void mac_top_init_gNB(ngran_node_t node_type, void mac_top_init_gNB(ngran_node_t node_type,
NR_ServingCellConfigCommon_t *scc, NR_ServingCellConfigCommon_t *scc,
NR_ServingCellConfig_t *scd,
const nr_mac_config_t *config, const nr_mac_config_t *config,
const nr_rlc_configuration_t *default_rlc_config) const nr_rlc_configuration_t *default_rlc_config)
{ {
@@ -275,8 +274,6 @@ void mac_top_init_gNB(ngran_node_t node_type,
RC.nrmac[i]->radio_config = *config; RC.nrmac[i]->radio_config = *config;
RC.nrmac[i]->rlc_config = *default_rlc_config; RC.nrmac[i]->rlc_config = *default_rlc_config;
RC.nrmac[i]->common_channels[0].pre_ServingCellConfig = scd;
RC.nrmac[i]->first_MIB = true; RC.nrmac[i]->first_MIB = true;
RC.nrmac[i]->num_scheduled_prach_rx = 0; RC.nrmac[i]->num_scheduled_prach_rx = 0;
RC.nrmac[i]->common_channels[0].mib = get_new_MIB_NR(scc); RC.nrmac[i]->common_channels[0].mib = get_new_MIB_NR(scc);
@@ -330,7 +327,6 @@ void mac_top_destroy_gNB(gNB_MAC_INST *mac)
NR_COMMON_channels_t *cc = &mac->common_channels[0]; NR_COMMON_channels_t *cc = &mac->common_channels[0];
ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_Message, cc->mib); ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_Message, cc->mib);
ASN_STRUCT_FREE(asn_DEF_NR_BCCH_DL_SCH_Message, cc->sib1); ASN_STRUCT_FREE(asn_DEF_NR_BCCH_DL_SCH_Message, cc->sib1);
ASN_STRUCT_FREE(asn_DEF_NR_ServingCellConfig, cc->pre_ServingCellConfig);
ASN_STRUCT_FREE(asn_DEF_NR_ServingCellConfigCommon, cc->ServingCellConfigCommon); ASN_STRUCT_FREE(asn_DEF_NR_ServingCellConfigCommon, cc->ServingCellConfigCommon);
NR_UEs_t *UE_info = &mac->UE_info; NR_UEs_t *UE_info = &mac->UE_info;
for (int i = 0; i < sizeofArray(UE_info->connected_ue_list); ++i) for (int i = 0; i < sizeofArray(UE_info->connected_ue_list); ++i)
+10 -2
View File
@@ -173,6 +173,12 @@ int ul_MaxPorts_0;
int ul_Power_0; int ul_Power_0;
} nr_ptrs_config_t; } nr_ptrs_config_t;
typedef struct {
int id;
int scs;
int location_and_bw;
} nr_bwp_config_t;
typedef struct nr_mac_config_t { typedef struct nr_mac_config_t {
int sib1_tda; int sib1_tda;
nr_pdsch_AntennaPorts_t pdsch_AntennaPorts; nr_pdsch_AntennaPorts_t pdsch_AntennaPorts;
@@ -190,6 +196,10 @@ typedef struct nr_mac_config_t {
nr_mac_timers_t timer_config; nr_mac_timers_t timer_config;
int num_dlharq; int num_dlharq;
int num_ulharq; int num_ulharq;
// BWP information
int num_additional_bwps;
int first_active_bwp;
nr_bwp_config_t bwp_config[4];
/// beamforming weight matrix size /// beamforming weight matrix size
int nb_bfw[2]; int nb_bfw[2];
int32_t *bw_list; int32_t *bw_list;
@@ -282,8 +292,6 @@ typedef struct {
NR_BCCH_DL_SCH_Message_t *sib1; NR_BCCH_DL_SCH_Message_t *sib1;
seq_arr_t *du_SIBs; seq_arr_t *du_SIBs;
NR_ServingCellConfigCommon_t *ServingCellConfigCommon; NR_ServingCellConfigCommon_t *ServingCellConfigCommon;
/// pre-configured ServingCellConfig that is default for every UE
NR_ServingCellConfig_t *pre_ServingCellConfig;
/// Outgoing MIB PDU for PHY /// Outgoing MIB PDU for PHY
uint8_t MIB_pdu[3]; uint8_t MIB_pdu[3];
/// Outgoing BCCH pdu for PHY /// Outgoing BCCH pdu for PHY
+56 -124
View File
@@ -210,20 +210,6 @@ static NR_SetupRelease_PDSCH_ConfigCommon_t *clone_pdsch_configcommon(const NR_S
return clone; return clone;
} }
static NR_PUSCH_Config_t *clone_pusch_config(const NR_PUSCH_Config_t *pc)
{
if (pc == NULL)
return NULL;
uint8_t buf[1024];
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_PUSCH_Config, NULL, pc, buf, sizeof(buf));
AssertFatal(enc_rval.encoded > 0 && enc_rval.encoded < sizeof(buf), "could not clone NR_PUSCH_Config: problem while encoding\n");
NR_PUSCH_Config_t *clone = NULL;
asn_dec_rval_t dec_rval = uper_decode(NULL, &asn_DEF_NR_PUSCH_Config, (void **)&clone, buf, enc_rval.encoded, 0, 0);
AssertFatal(dec_rval.code == RC_OK && dec_rval.consumed == enc_rval.encoded, "could not clone NR_PUSCH_Config: problem while decoding\n");
return clone;
}
static int get_nb_pucch2_per_slot(const NR_ServingCellConfigCommon_t *scc, int bwp_size) static int get_nb_pucch2_per_slot(const NR_ServingCellConfigCommon_t *scc, int bwp_size)
{ {
const NR_TDD_UL_DL_Pattern_t *tdd = scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL; const NR_TDD_UL_DL_Pattern_t *tdd = scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL;
@@ -1492,16 +1478,14 @@ static NR_PTRS_UplinkConfig_t *config_ulptrs(const nr_ptrs_config_t *ptrs)
return ulptrs; return ulptrs;
} }
static NR_SetupRelease_PUSCH_Config_t *config_pusch(NR_PUSCH_Config_t *pusch_Config, static NR_SetupRelease_PUSCH_Config_t *config_pusch(const bool use_deltaMCS,
const bool use_deltaMCS,
const NR_ServingCellConfigCommon_t *scc, const NR_ServingCellConfigCommon_t *scc,
const NR_UE_NR_Capability_t *uecap, const NR_UE_NR_Capability_t *uecap,
const nr_ptrs_config_t *ptrs) const nr_ptrs_config_t *ptrs)
{ {
NR_SetupRelease_PUSCH_Config_t *setup_puschconfig = calloc(1, sizeof(*setup_puschconfig)); NR_SetupRelease_PUSCH_Config_t *setup_puschconfig = calloc(1, sizeof(*setup_puschconfig));
setup_puschconfig->present = NR_SetupRelease_PUSCH_Config_PR_setup; setup_puschconfig->present = NR_SetupRelease_PUSCH_Config_PR_setup;
if (!pusch_Config) NR_PUSCH_Config_t *pusch_Config = calloc(1, sizeof(*pusch_Config));
pusch_Config = calloc(1, sizeof(*pusch_Config));
setup_puschconfig->choice.setup = pusch_Config; setup_puschconfig->choice.setup = pusch_Config;
pusch_Config->dataScramblingIdentityPUSCH = NULL; pusch_Config->dataScramblingIdentityPUSCH = NULL;
@@ -1683,23 +1667,20 @@ static NR_SetupRelease_PDSCH_Config_t *config_pdsch(uint64_t ssb_bitmap, int bwp
static void config_downlinkBWP(NR_BWP_Downlink_t *bwp, static void config_downlinkBWP(NR_BWP_Downlink_t *bwp,
const NR_ServingCellConfigCommon_t *scc, const NR_ServingCellConfigCommon_t *scc,
const NR_ServingCellConfig_t *servingcellconfigdedicated,
const NR_UE_NR_Capability_t *uecap, const NR_UE_NR_Capability_t *uecap,
int dl_antenna_ports, int dl_antenna_ports,
bool force_256qam_off, bool force_256qam_off,
int bwp_loop, int bwp_loop,
bool is_SA, bool is_SA,
nr_ptrs_config_t *ptrs, const nr_mac_config_t *configuration)
const int num_agg_level_candidates[NUM_PDCCH_AGG_LEVELS])
{ {
bwp->bwp_Common = calloc(1,sizeof(*bwp->bwp_Common)); bwp->bwp_Common = calloc(1,sizeof(*bwp->bwp_Common));
if(configuration->num_additional_bwps > 0) {
if(servingcellconfigdedicated->downlinkBWP_ToAddModList && const nr_bwp_config_t *bwp_config = &configuration->bwp_config[bwp_loop];
bwp_loop < servingcellconfigdedicated->downlinkBWP_ToAddModList->list.count) { bwp->bwp_Id = bwp_config->id;
bwp->bwp_Id = servingcellconfigdedicated->downlinkBWP_ToAddModList->list.array[bwp_loop]->bwp_Id; bwp->bwp_Common->genericParameters.locationAndBandwidth = bwp_config->location_and_bw;
bwp->bwp_Common->genericParameters.locationAndBandwidth = servingcellconfigdedicated->downlinkBWP_ToAddModList->list.array[bwp_loop]->bwp_Common->genericParameters.locationAndBandwidth; bwp->bwp_Common->genericParameters.subcarrierSpacing = bwp_config->scs;
bwp->bwp_Common->genericParameters.subcarrierSpacing = servingcellconfigdedicated->downlinkBWP_ToAddModList->list.array[bwp_loop]->bwp_Common->genericParameters.subcarrierSpacing; bwp->bwp_Common->genericParameters.cyclicPrefix = NULL;
bwp->bwp_Common->genericParameters.cyclicPrefix = servingcellconfigdedicated->downlinkBWP_ToAddModList->list.array[bwp_loop]->bwp_Common->genericParameters.cyclicPrefix;
} else { } else {
bwp->bwp_Id=bwp_loop+1; bwp->bwp_Id=bwp_loop+1;
bwp->bwp_Common->genericParameters.locationAndBandwidth = PRBalloc_to_locationandbandwidth(scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,0); bwp->bwp_Common->genericParameters.locationAndBandwidth = PRBalloc_to_locationandbandwidth(scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,0);
@@ -1727,7 +1708,7 @@ static void config_downlinkBWP(NR_BWP_Downlink_t *bwp,
NR_SearchSpace_t *ss = NULL; NR_SearchSpace_t *ss = NULL;
if (!is_SA) { if (!is_SA) {
int num_cces = get_coreset_num_cces(coreset->frequencyDomainResources.buf, coreset->duration); int num_cces = get_coreset_num_cces(coreset->frequencyDomainResources.buf, coreset->duration);
verify_agg_levels(num_cces, num_agg_level_candidates, coreset->controlResourceSetId, agg_level_candidates); verify_agg_levels(num_cces, configuration->num_agg_level_candidates, coreset->controlResourceSetId, agg_level_candidates);
ss = rrc_searchspace_config(true, searchspaceid, coreset->controlResourceSetId, agg_level_candidates); ss = rrc_searchspace_config(true, searchspaceid, coreset->controlResourceSetId, agg_level_candidates);
} else { } else {
agg_level_candidates[PDCCH_AGG_LEVEL1] = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; agg_level_candidates[PDCCH_AGG_LEVEL1] = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0;
@@ -1773,7 +1754,7 @@ static void config_downlinkBWP(NR_BWP_Downlink_t *bwp,
asn1cSeqAdd(&bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list, coreset2); asn1cSeqAdd(&bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list, coreset2);
int rrc_num_agg_level_candidates[NUM_PDCCH_AGG_LEVELS]; int rrc_num_agg_level_candidates[NUM_PDCCH_AGG_LEVELS];
int num_cces = get_coreset_num_cces(coreset2->frequencyDomainResources.buf, coreset2->duration); int num_cces = get_coreset_num_cces(coreset2->frequencyDomainResources.buf, coreset2->duration);
verify_agg_levels(num_cces, num_agg_level_candidates, coreset2->controlResourceSetId, rrc_num_agg_level_candidates); verify_agg_levels(num_cces, configuration->num_agg_level_candidates, coreset2->controlResourceSetId, rrc_num_agg_level_candidates);
searchspaceid = 10 + bwp->bwp_Id; searchspaceid = 10 + bwp->bwp_Id;
NR_SearchSpace_t *ss2 = rrc_searchspace_config(true, searchspaceid, is_SA ? 0 : coreset2->controlResourceSetId, agg_level_candidates); NR_SearchSpace_t *ss2 = rrc_searchspace_config(true, searchspaceid, is_SA ? 0 : coreset2->controlResourceSetId, agg_level_candidates);
@@ -1785,7 +1766,7 @@ static void config_downlinkBWP(NR_BWP_Downlink_t *bwp,
asn1cSeqAdd(&bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list, ss3); asn1cSeqAdd(&bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list, ss3);
bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToReleaseList = NULL; bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToReleaseList = NULL;
bwp->bwp_Dedicated->pdsch_Config = config_pdsch(ssb_bitmap, bwp->bwp_Id, dl_antenna_ports, ptrs); bwp->bwp_Dedicated->pdsch_Config = config_pdsch(ssb_bitmap, bwp->bwp_Id, dl_antenna_ports, configuration->ptrs);
set_dl_mcs_table(bwp->bwp_Common->genericParameters.subcarrierSpacing, set_dl_mcs_table(bwp->bwp_Common->genericParameters.subcarrierSpacing,
force_256qam_off ? NULL : uecap, force_256qam_off ? NULL : uecap,
@@ -1797,18 +1778,17 @@ static void config_uplinkBWP(NR_BWP_Uplink_t *ubwp,
long bwp_loop, long bwp_loop,
bool is_SA, bool is_SA,
int uid, int uid,
int maxMIMO_Layers,
const nr_mac_config_t *configuration, const nr_mac_config_t *configuration,
const NR_ServingCellConfig_t *servingcellconfigdedicated,
const NR_ServingCellConfigCommon_t *scc, const NR_ServingCellConfigCommon_t *scc,
const NR_UE_NR_Capability_t *uecap) const NR_UE_NR_Capability_t *uecap)
{ {
ubwp->bwp_Common = calloc(1,sizeof(*ubwp->bwp_Common)); ubwp->bwp_Common = calloc(1, sizeof(*ubwp->bwp_Common));
if(servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList && if(configuration->num_additional_bwps > 0) {
bwp_loop < servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count) { ubwp->bwp_Id = configuration->bwp_config[bwp_loop].id;
ubwp->bwp_Id = servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_loop]->bwp_Id; ubwp->bwp_Common->genericParameters.locationAndBandwidth = configuration->bwp_config[bwp_loop].location_and_bw;
ubwp->bwp_Common->genericParameters.locationAndBandwidth = servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_loop]->bwp_Common->genericParameters.locationAndBandwidth; ubwp->bwp_Common->genericParameters.subcarrierSpacing = configuration->bwp_config[bwp_loop].scs;
ubwp->bwp_Common->genericParameters.subcarrierSpacing = servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_loop]->bwp_Common->genericParameters.subcarrierSpacing; ubwp->bwp_Common->genericParameters.cyclicPrefix = NULL;
ubwp->bwp_Common->genericParameters.cyclicPrefix = servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_loop]->bwp_Common->genericParameters.cyclicPrefix;
} else { } else {
ubwp->bwp_Id=bwp_loop+1; ubwp->bwp_Id=bwp_loop+1;
ubwp->bwp_Common->genericParameters.locationAndBandwidth = PRBalloc_to_locationandbandwidth(scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,0); ubwp->bwp_Common->genericParameters.locationAndBandwidth = PRBalloc_to_locationandbandwidth(scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,0);
@@ -1847,25 +1827,11 @@ static void config_uplinkBWP(NR_BWP_Uplink_t *ubwp,
scheduling_request_config(scc, pucch_Config, ubwp->bwp_Common->genericParameters.subcarrierSpacing); scheduling_request_config(scc, pucch_Config, ubwp->bwp_Common->genericParameters.subcarrierSpacing);
set_dl_DataToUL_ACK(pucch_Config, configuration->minRXTXTIME, ubwp->bwp_Common->genericParameters.subcarrierSpacing); set_dl_DataToUL_ACK(pucch_Config, configuration->minRXTXTIME, ubwp->bwp_Common->genericParameters.subcarrierSpacing);
NR_PUSCH_Config_t *pusch_Config = NULL; ubwp->bwp_Dedicated->pusch_Config = config_pusch(configuration->use_deltaMCS,
if(servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList &&
bwp_loop < servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count) {
pusch_Config = clone_pusch_config(servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_loop]
->bwp_Dedicated->pusch_Config->choice.setup);
}
ubwp->bwp_Dedicated->pusch_Config = config_pusch(pusch_Config,
configuration->use_deltaMCS,
scc, scc,
configuration->force_UL256qam_off ? NULL : uecap, configuration->force_UL256qam_off ? NULL : uecap,
configuration->ptrs); configuration->ptrs);
long maxMIMO_Layers = servingcellconfigdedicated &&
servingcellconfigdedicated->uplinkConfig
&& servingcellconfigdedicated->uplinkConfig->pusch_ServingCellConfig
&& servingcellconfigdedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1
&& servingcellconfigdedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers ?
*servingcellconfigdedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers : 1;
ubwp->bwp_Dedicated->srs_Config = get_config_srs(scc, ubwp->bwp_Dedicated->srs_Config = get_config_srs(scc,
NULL, NULL,
curr_bwp, curr_bwp,
@@ -3241,7 +3207,6 @@ static void fill_harq_IEs(NR_ServingCellConfig_t *scc, int num_dlharq, int num_u
static NR_SpCellConfig_t *get_initial_SpCellConfig(int uid, static NR_SpCellConfig_t *get_initial_SpCellConfig(int uid,
const NR_ServingCellConfigCommon_t *scc, const NR_ServingCellConfigCommon_t *scc,
const NR_ServingCellConfig_t *servingcellconfigdedicated,
const nr_mac_config_t *configuration) const nr_mac_config_t *configuration)
{ {
const int pdsch_AntennaPorts = const int pdsch_AntennaPorts =
@@ -3272,7 +3237,7 @@ static NR_SpCellConfig_t *get_initial_SpCellConfig(int uid,
config_pucch_resset1(pucch_Config, uid, num_pucch2, NULL); config_pucch_resset1(pucch_Config, uid, num_pucch2, NULL);
set_pucch_power_config(pucch_Config, configuration->do_CSIRS); set_pucch_power_config(pucch_Config, configuration->do_CSIRS);
initialUplinkBWP->pusch_Config = config_pusch(NULL, configuration->use_deltaMCS, scc, NULL, configuration->ptrs); initialUplinkBWP->pusch_Config = config_pusch(configuration->use_deltaMCS, scc, NULL, configuration->ptrs);
long maxMIMO_Layers = uplinkConfig && uplinkConfig->pusch_ServingCellConfig long maxMIMO_Layers = uplinkConfig && uplinkConfig->pusch_ServingCellConfig
&& uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1 && uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1
@@ -3353,12 +3318,7 @@ static NR_SpCellConfig_t *get_initial_SpCellConfig(int uid,
} }
// Downlink BWPs // Downlink BWPs
int n_dl_bwp = 0; int n_dl_bwp = configuration->num_additional_bwps;
if (servingcellconfigdedicated && servingcellconfigdedicated->downlinkBWP_ToAddModList
&& servingcellconfigdedicated->downlinkBWP_ToAddModList->list.count > 0) {
n_dl_bwp = servingcellconfigdedicated->downlinkBWP_ToAddModList->list.count;
}
int default_dl_bwp = 0;
int first_active_dl_bwp = 0; int first_active_dl_bwp = 0;
if (n_dl_bwp > 0) { if (n_dl_bwp > 0) {
configDedicated->downlinkBWP_ToAddModList = calloc(1, sizeof(*configDedicated->downlinkBWP_ToAddModList)); configDedicated->downlinkBWP_ToAddModList = calloc(1, sizeof(*configDedicated->downlinkBWP_ToAddModList));
@@ -3366,41 +3326,29 @@ static NR_SpCellConfig_t *get_initial_SpCellConfig(int uid,
NR_BWP_Downlink_t *bwp = calloc(1, sizeof(*bwp)); NR_BWP_Downlink_t *bwp = calloc(1, sizeof(*bwp));
config_downlinkBWP(bwp, config_downlinkBWP(bwp,
scc, scc,
servingcellconfigdedicated,
NULL, NULL,
0, 0,
false, false,
bwp_loop, bwp_loop,
true, true,
configuration->ptrs, configuration);
configuration->num_agg_level_candidates);
asn1cSeqAdd(&configDedicated->downlinkBWP_ToAddModList->list, bwp); asn1cSeqAdd(&configDedicated->downlinkBWP_ToAddModList->list, bwp);
} }
const NR_BWP_Id_t *firstActiveDownlinkBWP_Id = servingcellconfigdedicated->firstActiveDownlinkBWP_Id; first_active_dl_bwp = configuration->first_active_bwp;
first_active_dl_bwp = firstActiveDownlinkBWP_Id ? *firstActiveDownlinkBWP_Id : 1;
const NR_BWP_Id_t *defaultDownlinkBWP_Id = servingcellconfigdedicated->defaultDownlinkBWP_Id;
default_dl_bwp = defaultDownlinkBWP_Id ? *defaultDownlinkBWP_Id : 1;
} }
asn1cCallocOne(configDedicated->firstActiveDownlinkBWP_Id, first_active_dl_bwp); asn1cCallocOne(configDedicated->firstActiveDownlinkBWP_Id, first_active_dl_bwp);
asn1cCallocOne(configDedicated->defaultDownlinkBWP_Id, default_dl_bwp);
// Uplink BWPs // Uplink BWPs
int n_ul_bwp = 0; int n_ul_bwp = configuration->num_additional_bwps;
if (servingcellconfigdedicated && servingcellconfigdedicated->uplinkConfig
&& servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList
&& servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count > 0) {
n_ul_bwp = servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count;
}
int first_active_ul_bwp = 0; int first_active_ul_bwp = 0;
if (n_ul_bwp > 0) { if (n_ul_bwp > 0) {
uplinkConfig->uplinkBWP_ToAddModList = calloc(1, sizeof(*uplinkConfig->uplinkBWP_ToAddModList)); uplinkConfig->uplinkBWP_ToAddModList = calloc(1, sizeof(*uplinkConfig->uplinkBWP_ToAddModList));
for (int bwp_loop = 0; bwp_loop < n_ul_bwp; bwp_loop++) { for (int bwp_loop = 0; bwp_loop < n_ul_bwp; bwp_loop++) {
NR_BWP_Uplink_t *ubwp = calloc(1, sizeof(*ubwp)); NR_BWP_Uplink_t *ubwp = calloc(1, sizeof(*ubwp));
config_uplinkBWP(ubwp, bwp_loop, true, uid, configuration, servingcellconfigdedicated, scc, NULL); config_uplinkBWP(ubwp, bwp_loop, true, uid, maxMIMO_Layers, configuration, scc, NULL);
asn1cSeqAdd(&uplinkConfig->uplinkBWP_ToAddModList->list, ubwp); asn1cSeqAdd(&uplinkConfig->uplinkBWP_ToAddModList->list, ubwp);
} }
const NR_BWP_Id_t *firstActiveUplinkBWP_Id = servingcellconfigdedicated->uplinkConfig->firstActiveUplinkBWP_Id; first_active_ul_bwp = configuration->first_active_bwp;
first_active_ul_bwp = firstActiveUplinkBWP_Id ? *firstActiveUplinkBWP_Id : 1;
} }
asn1cCallocOne(uplinkConfig->firstActiveUplinkBWP_Id, first_active_ul_bwp); asn1cCallocOne(uplinkConfig->firstActiveUplinkBWP_Id, first_active_ul_bwp);
@@ -3647,7 +3595,7 @@ NR_RLC_BearerConfig_t *get_DRB_RLC_BearerConfig(long lcChannelId,
return rlc_BearerConfig; return rlc_BearerConfig;
} }
static bool verify_radio_configuration(int uid, const NR_ServingCellConfigCommon_t *scc, const NR_ServingCellConfig_t *scd) static bool verify_radio_configuration(int uid, const NR_ServingCellConfigCommon_t *scc, const nr_mac_config_t *configuration)
{ {
frame_structure_t *fs = &RC.nrmac[0]->frame_structure; frame_structure_t *fs = &RC.nrmac[0]->frame_structure;
int srs_offset = get_ul_slot_offset(fs, uid, false); int srs_offset = get_ul_slot_offset(fs, uid, false);
@@ -3657,8 +3605,7 @@ static bool verify_radio_configuration(int uid, const NR_ServingCellConfigCommon
return false; return false;
} }
/* for RedCap, scd is NULL */ int n_dl_bwp = 1 + configuration->num_additional_bwps; // initial + additional bwps
int n_dl_bwp = scd && scd->downlinkBWP_ToAddModList ? scd->downlinkBWP_ToAddModList->list.count : 1;
int csi_offset = fs->numb_slots_period * n_dl_bwp; int csi_offset = fs->numb_slots_period * n_dl_bwp;
// see set_csirs_periodicity // see set_csirs_periodicity
if (csi_offset / 320 >= get_full_dl_slots_per_period(fs)) { if (csi_offset / 320 >= get_full_dl_slots_per_period(fs)) {
@@ -3692,14 +3639,13 @@ static bool verify_radio_configuration(int uid, const NR_ServingCellConfigCommon
NR_CellGroupConfig_t *get_initial_cellGroupConfig(int uid, NR_CellGroupConfig_t *get_initial_cellGroupConfig(int uid,
const NR_ServingCellConfigCommon_t *scc, const NR_ServingCellConfigCommon_t *scc,
const NR_ServingCellConfig_t *servingcellconfigdedicated,
const nr_mac_config_t *configuration, const nr_mac_config_t *configuration,
const nr_rlc_configuration_t *default_rlc_config) const nr_rlc_configuration_t *default_rlc_config)
{ {
if (!verify_radio_configuration(uid, scc, servingcellconfigdedicated)) if (!verify_radio_configuration(uid, scc, configuration))
return NULL; return NULL;
NR_SpCellConfig_t *spCellConfig = get_initial_SpCellConfig(uid, scc, servingcellconfigdedicated, configuration); NR_SpCellConfig_t *spCellConfig = get_initial_SpCellConfig(uid, scc, configuration);
NR_CellGroupConfig_t *cellGroupConfig = calloc(1, sizeof(*cellGroupConfig)); NR_CellGroupConfig_t *cellGroupConfig = calloc(1, sizeof(*cellGroupConfig));
cellGroupConfig->cellGroupId = 0; cellGroupConfig->cellGroupId = 0;
@@ -3793,7 +3739,6 @@ void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig,
calloc(1, sizeof(*uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1)); calloc(1, sizeof(*uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1));
asn1cCallocOne(uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers, maxMIMO_Layers); asn1cCallocOne(uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers, maxMIMO_Layers);
// UL and SRS configuration // UL and SRS configuration
if (configuration->do_SRS && uplinkConfig && uplinkConfig->initialUplinkBWP) { if (configuration->do_SRS && uplinkConfig && uplinkConfig->initialUplinkBWP) {
ASN_STRUCT_FREE(asn_DEF_NR_SetupRelease_SRS_Config, uplinkConfig->initialUplinkBWP->srs_Config); ASN_STRUCT_FREE(asn_DEF_NR_SetupRelease_SRS_Config, uplinkConfig->initialUplinkBWP->srs_Config);
@@ -3892,7 +3837,6 @@ static NR_ServingCellConfigCommon_t *clone_ServingCellConfigCommon(const NR_Serv
} }
NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigCommon_t *servingcellconfigcommon,
const NR_ServingCellConfig_t *servingcellconfigdedicated,
const NR_UE_NR_Capability_t *uecap, const NR_UE_NR_Capability_t *uecap,
int scg_id, int scg_id,
int servCellIndex, int servCellIndex,
@@ -3904,7 +3848,6 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC
const int do_csirs = configuration->do_CSIRS; const int do_csirs = configuration->do_CSIRS;
AssertFatal(servingcellconfigcommon, "servingcellconfigcommon is null\n"); AssertFatal(servingcellconfigcommon, "servingcellconfigcommon is null\n");
AssertFatal(servingcellconfigdedicated, "servingcellconfigdedicated is null\n");
if (uecap == NULL) if (uecap == NULL)
LOG_E(RRC, "No UE Capabilities available when programming default CellGroup in NSA\n"); LOG_E(RRC, "No UE Capabilities available when programming default CellGroup in NSA\n");
@@ -3959,13 +3902,7 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC
ulConfig->initialUplinkBWP = initialUplinkBWP; ulConfig->initialUplinkBWP = initialUplinkBWP;
initialUplinkBWP->pucch_Config = NULL; initialUplinkBWP->pucch_Config = NULL;
NR_PUSCH_Config_t *pusch_Config = NULL; initialUplinkBWP->pusch_Config = config_pusch(configuration->use_deltaMCS,
if (servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList) {
pusch_Config = clone_pusch_config(
servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup);
}
initialUplinkBWP->pusch_Config = config_pusch(pusch_Config,
configuration->use_deltaMCS,
servingcellconfigcommon, servingcellconfigcommon,
uecap, uecap,
configuration->ptrs); configuration->ptrs);
@@ -3984,50 +3921,45 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC
// Downlink BWPs // Downlink BWPs
int n_dl_bwp = 1; int n_dl_bwp = 1;
if (servingcellconfigdedicated->downlinkBWP_ToAddModList) { int firstActiveDownlinkBWP_Id = 1;
n_dl_bwp = servingcellconfigdedicated->downlinkBWP_ToAddModList->list.count; if (configuration->num_additional_bwps > 0) {
n_dl_bwp = configuration->num_additional_bwps;
firstActiveDownlinkBWP_Id = configuration->first_active_bwp;
} }
if (n_dl_bwp > 0) { configDedicated->downlinkBWP_ToAddModList = calloc(1, sizeof(*configDedicated->downlinkBWP_ToAddModList));
configDedicated->downlinkBWP_ToAddModList = calloc(1, sizeof(*configDedicated->downlinkBWP_ToAddModList)); for (int bwp_loop = 0; bwp_loop < n_dl_bwp; bwp_loop++) {
for (int bwp_loop = 0; bwp_loop < n_dl_bwp; bwp_loop++) { NR_BWP_Downlink_t *bwp = calloc(1, sizeof(*bwp));
NR_BWP_Downlink_t *bwp = calloc(1, sizeof(*bwp)); config_downlinkBWP(bwp,
config_downlinkBWP(bwp, servingcellconfigcommon,
servingcellconfigcommon, uecap,
servingcellconfigdedicated, dl_antenna_ports,
uecap, configuration->force_256qam_off,
dl_antenna_ports, bwp_loop,
configuration->force_256qam_off, false,
bwp_loop, configuration);
false, asn1cSeqAdd(&configDedicated->downlinkBWP_ToAddModList->list, bwp);
configuration->ptrs,
configuration->num_agg_level_candidates);
asn1cSeqAdd(&configDedicated->downlinkBWP_ToAddModList->list, bwp);
}
configDedicated->firstActiveDownlinkBWP_Id = calloc(1, sizeof(*configDedicated->firstActiveDownlinkBWP_Id)); configDedicated->firstActiveDownlinkBWP_Id = calloc(1, sizeof(*configDedicated->firstActiveDownlinkBWP_Id));
*configDedicated->firstActiveDownlinkBWP_Id = *configDedicated->firstActiveDownlinkBWP_Id = firstActiveDownlinkBWP_Id;
servingcellconfigdedicated->firstActiveDownlinkBWP_Id ? *servingcellconfigdedicated->firstActiveDownlinkBWP_Id : 1;
configDedicated->defaultDownlinkBWP_Id = calloc(1, sizeof(*configDedicated->defaultDownlinkBWP_Id)); configDedicated->defaultDownlinkBWP_Id = calloc(1, sizeof(*configDedicated->defaultDownlinkBWP_Id));
*configDedicated->defaultDownlinkBWP_Id = *configDedicated->defaultDownlinkBWP_Id = 1;
servingcellconfigdedicated->defaultDownlinkBWP_Id ? *servingcellconfigdedicated->defaultDownlinkBWP_Id : 1;
} }
// Uplink BWPs // Uplink BWPs
int n_ul_bwp = 1; int n_ul_bwp = 1;
if (servingcellconfigdedicated->uplinkConfig && servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList) { int firstActiveUplinkBWP_Id = 1;
n_ul_bwp = servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count; if (configuration->num_additional_bwps > 0) {
n_ul_bwp = configuration->num_additional_bwps;
firstActiveUplinkBWP_Id = configuration->first_active_bwp;
} }
if (n_ul_bwp > 0) { if (n_ul_bwp > 0) {
ulConfig->uplinkBWP_ToAddModList = calloc(1, sizeof(*ulConfig->uplinkBWP_ToAddModList)); ulConfig->uplinkBWP_ToAddModList = calloc(1, sizeof(*ulConfig->uplinkBWP_ToAddModList));
for (int bwp_loop = 0; bwp_loop < n_ul_bwp; bwp_loop++) { for (int bwp_loop = 0; bwp_loop < n_ul_bwp; bwp_loop++) {
NR_BWP_Uplink_t *ubwp = calloc(1, sizeof(*ubwp)); NR_BWP_Uplink_t *ubwp = calloc(1, sizeof(*ubwp));
config_uplinkBWP(ubwp, bwp_loop, false, uid, configuration, servingcellconfigdedicated, servingcellconfigcommon, uecap); config_uplinkBWP(ubwp, bwp_loop, false, uid, maxMIMO_Layers, configuration, servingcellconfigcommon, uecap);
asn1cSeqAdd(&ulConfig->uplinkBWP_ToAddModList->list, ubwp); asn1cSeqAdd(&ulConfig->uplinkBWP_ToAddModList->list, ubwp);
} }
ulConfig->firstActiveUplinkBWP_Id = calloc(1, sizeof(*ulConfig->firstActiveUplinkBWP_Id)); ulConfig->firstActiveUplinkBWP_Id = calloc(1, sizeof(*ulConfig->firstActiveUplinkBWP_Id));
*ulConfig->firstActiveUplinkBWP_Id = *ulConfig->firstActiveUplinkBWP_Id = firstActiveUplinkBWP_Id;
servingcellconfigdedicated->uplinkConfig->firstActiveUplinkBWP_Id
? *servingcellconfigdedicated->uplinkConfig->firstActiveUplinkBWP_Id
: 1;
} }
configDedicated->bwp_InactivityTimer = NULL; configDedicated->bwp_InactivityTimer = NULL;
@@ -89,7 +89,6 @@ NR_SIB19_r17_t *get_SIB19_NR(const NR_ServingCellConfigCommon_t *scc);
NR_CellGroupConfig_t *get_initial_cellGroupConfig(int uid, NR_CellGroupConfig_t *get_initial_cellGroupConfig(int uid,
const NR_ServingCellConfigCommon_t *scc, const NR_ServingCellConfigCommon_t *scc,
const NR_ServingCellConfig_t *servingcellconfigdedicated,
const nr_mac_config_t *configuration, const nr_mac_config_t *configuration,
const nr_rlc_configuration_t *default_rlc_config); const nr_rlc_configuration_t *default_rlc_config);
void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig,
@@ -105,7 +104,6 @@ NR_CellGroupConfig_t *decode_cellGroupConfig(const uint8_t *buffer, int max_buff
* configuration, but it will also overwrite the ServingCellConfig passed in * configuration, but it will also overwrite the ServingCellConfig passed in
* parameter servingcellconfigdedicated! */ * parameter servingcellconfigdedicated! */
NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigCommon_t *servingcellconfigcommon,
const NR_ServingCellConfig_t *servingcellconfigdedicated,
const NR_UE_NR_Capability_t *uecap, const NR_UE_NR_Capability_t *uecap,
int scg_id, int scg_id,
int servCellIndex, int servCellIndex,
@@ -19,6 +19,12 @@ gNBs:
# Physical parameters: # Physical parameters:
do_CSIRS: 1 do_CSIRS: 1
do_SRS: 1 do_SRS: 1
first_active_bwp: 1;
bwp_list:
-
scs: 1
bwpStart: 0
bwpSize: 106
#uess_agg_levels: [0,1,1,1,1] #uess_agg_levels: [0,1,1,1,1]
servingCellConfigCommon: servingCellConfigCommon:
#spCellConfigCommon #spCellConfigCommon
@@ -132,17 +138,6 @@ gNBs:
ssPBCH_BlockPower: -25 ssPBCH_BlockPower: -25
servingCellConfigDedicated:
- dl_bwp-Id_1: 1
dl_bwp1_locationAndBandwidth: 28875
dl_bwp1_subcarrierSpacing: 1
firstActiveDownlinkBWP-Id: 1
defaultDownlinkBWP-Id: 1
ul_bwp-Id_1: 1
ul_bwp1_locationAndBandwidth: 28875
ul_bwp1_subcarrierSpacing: 1
firstActiveUplinkBWP-Id: 1
RedCap: RedCap:
cellBarredRedCap1Rx_r17: 1 cellBarredRedCap1Rx_r17: 1
cellBarredRedCap2Rx_r17: 1 cellBarredRedCap2Rx_r17: 1