Commit 462ed761 authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/NR_UE_rework_rrc_mac_config' into integration_2023_w18b

parents 5cbd83c4 9421fcc8
...@@ -861,6 +861,7 @@ int main(int argc, char **argv) ...@@ -861,6 +861,7 @@ int main(int argc, char **argv)
nr_l2_init_ue(NULL); nr_l2_init_ue(NULL);
UE_mac = get_mac_inst(0); UE_mac = get_mac_inst(0);
ue_init_config_request(UE_mac, mu);
UE->if_inst = nr_ue_if_module_init(0); UE->if_inst = nr_ue_if_module_init(0);
UE->if_inst->scheduled_response = nr_ue_scheduled_response; UE->if_inst->scheduled_response = nr_ue_scheduled_response;
...@@ -888,7 +889,8 @@ int main(int argc, char **argv) ...@@ -888,7 +889,8 @@ int main(int argc, char **argv)
//Configure UE //Configure UE
NR_BCCH_BCH_Message_t *mib = get_new_MIB_NR(scc); NR_BCCH_BCH_Message_t *mib = get_new_MIB_NR(scc);
nr_rrc_mac_config_req_ue(0, 0, 0, mib->message.choice.mib, NULL, NULL, secondaryCellGroup); nr_rrc_mac_config_req_mib(0, 0, mib->message.choice.mib, false);
nr_rrc_mac_config_req_scg(0, 0, secondaryCellGroup);
nr_dcireq_t dcireq; nr_dcireq_t dcireq;
nr_scheduled_response_t scheduled_response; nr_scheduled_response_t scheduled_response;
......
...@@ -744,11 +744,8 @@ int main(int argc, char **argv) ...@@ -744,11 +744,8 @@ int main(int argc, char **argv)
UE_mac->if_module = nr_ue_if_module_init(0); UE_mac->if_module = nr_ue_if_module_init(0);
// nr_rrc_mac_config_req_ue(0,0,0,rrc.carrier.mib.message.choice.mib, NULL, NULL, secondaryCellGroup);
nr_ue_phy_config_request(&UE_mac->phy_config); nr_ue_phy_config_request(&UE_mac->phy_config);
unsigned char harq_pid = 0; unsigned char harq_pid = 0;
NR_gNB_ULSCH_t *ulsch_gNB = &gNB->ulsch[UE_id]; NR_gNB_ULSCH_t *ulsch_gNB = &gNB->ulsch[UE_id];
......
This diff is collapsed.
...@@ -399,7 +399,7 @@ typedef struct { ...@@ -399,7 +399,7 @@ typedef struct {
long physCellId; long physCellId;
//// MAC config //// MAC config
int first_sync_frame; int first_sync_frame;
bool sib1_decoded; bool get_sib1;
NR_DRX_Config_t *drx_Config; NR_DRX_Config_t *drx_Config;
NR_SchedulingRequestConfig_t *schedulingRequestConfig; NR_SchedulingRequestConfig_t *schedulingRequestConfig;
NR_BSR_Config_t *bsr_Config; NR_BSR_Config_t *bsr_Config;
......
...@@ -95,22 +95,22 @@ int nr_rrc_mac_config_req_ue_logicalChannelBearer(module_id_t module_id, ...@@ -95,22 +95,22 @@ int nr_rrc_mac_config_req_ue_logicalChannelBearer(module_id_t module_id,
long logicalChannelIdentity, long logicalChannelIdentity,
bool status); bool status);
/**\brief primitive from RRC layer to MAC layer for configuration L1/L2, now supported 4 rrc messages: MIB, cell_group_config for MAC/PHY, spcell_config(serving cell config) void nr_rrc_mac_config_req_scg(module_id_t module_id,
\param module_id module id int cc_idP,
\param cc_id component carrier id NR_CellGroupConfig_t *scell_group_config);
\param gNB_index gNB index
\param mibP pointer to RRC message MIB void nr_rrc_mac_config_req_mcg(module_id_t module_id,
\param sccP pointer to ServingCellConfigCommon structure, int cc_idP,
\param spcell_configP pointer to RRC message serving cell config*/ NR_CellGroupConfig_t *scell_group_config);
int nr_rrc_mac_config_req_ue(
module_id_t module_id, void nr_rrc_mac_config_req_mib(module_id_t module_id,
int cc_idP, int cc_idP,
uint8_t gNB_index, NR_MIB_t *mibP,
NR_MIB_t *mibP, bool sched_sib1);
NR_ServingCellConfigCommonSIB_t *sccP,
NR_CellGroupConfig_t *cell_group_config, void nr_rrc_mac_config_req_sib1(module_id_t module_id,
NR_CellGroupConfig_t *scell_group_config int cc_idP,
); NR_ServingCellConfigCommonSIB_t *scc);
/**\brief initialization NR UE MAC instance(s), total number of MAC instance based on NB_NR_UE_MAC_INST*/ /**\brief initialization NR UE MAC instance(s), total number of MAC instance based on NB_NR_UE_MAC_INST*/
NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst); NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst);
...@@ -425,6 +425,8 @@ void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pd ...@@ -425,6 +425,8 @@ void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pd
void build_ssb_to_ro_map(NR_UE_MAC_INST_t *mac); void build_ssb_to_ro_map(NR_UE_MAC_INST_t *mac);
void ue_init_config_request(NR_UE_MAC_INST_t *mac, int scs);
void configure_ss_coreset(NR_UE_MAC_INST_t *mac, void configure_ss_coreset(NR_UE_MAC_INST_t *mac,
NR_ServingCellConfig_t *scd, NR_ServingCellConfig_t *scd,
NR_BWP_Id_t dl_bwp_id); NR_BWP_Id_t dl_bwp_id);
...@@ -438,7 +440,7 @@ static uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, ...@@ -438,7 +440,7 @@ static uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
dci_pdu_rel15_t *dci_pdu_rel15, dci_pdu_rel15_t *dci_pdu_rel15,
int slot); int slot);
fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int slot); fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int slot, int fb_time);
fapi_nr_dl_config_request_t *get_dl_config_request(NR_UE_MAC_INST_t *mac, int slot); fapi_nr_dl_config_request_t *get_dl_config_request(NR_UE_MAC_INST_t *mac, int slot);
void fill_ul_config(fapi_nr_ul_config_request_t *ul_config, frame_t frame_tx, int slot_tx, uint8_t pdu_type); void fill_ul_config(fapi_nr_ul_config_request_t *ul_config, frame_t frame_tx, int slot_tx, uint8_t pdu_type);
......
...@@ -56,9 +56,17 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) { ...@@ -56,9 +56,17 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) {
for (int j = 0; j < NB_NR_UE_MAC_INST; j++) for (int j = 0; j < NB_NR_UE_MAC_INST; j++)
nr_ue_init_mac(j); nr_ue_init_mac(j);
int scs = get_softmodem_params()->sa ?
get_softmodem_params()->numerology :
rrc_inst ?
*rrc_inst->scell_group_config->spCellConfig->reconfigurationWithSync->spCellConfigCommon->ssbSubcarrierSpacing :
- 1;
if (scs > -1)
ue_init_config_request(nr_ue_mac_inst, scs);
if (rrc_inst && rrc_inst->scell_group_config) { if (rrc_inst && rrc_inst->scell_group_config) {
nr_rrc_mac_config_req_ue(0,0,0,NULL,NULL,NULL,rrc_inst->scell_group_config); nr_rrc_mac_config_req_scg(0, 0, rrc_inst->scell_group_config);
AssertFatal(rlc_module_init(0) == 0, "%s: Could not initialize RLC layer\n", __FUNCTION__); AssertFatal(rlc_module_init(0) == 0, "%s: Could not initialize RLC layer\n", __FUNCTION__);
if (IS_SOFTMODEM_NOS1){ if (IS_SOFTMODEM_NOS1){
// get default noS1 configuration // get default noS1 configuration
...@@ -78,24 +86,9 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) { ...@@ -78,24 +86,9 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) {
// free memory // free memory
free_nr_noS1_bearer_config(&rbconfig, &rlc_rbconfig); free_nr_noS1_bearer_config(&rbconfig, &rlc_rbconfig);
} }
// Allocate memory for ul_config_request in the mac instance. This is now a pointer and will
// point to a list of structures (one for each UL slot) to store PUSCH scheduling parameters
// received from UL DCI.
if (nr_ue_mac_inst->scc) {
NR_TDD_UL_DL_ConfigCommon_t *tdd = nr_ue_mac_inst->scc->tdd_UL_DL_ConfigurationCommon;
int num_slots_ul = tdd ? tdd->pattern1.nrofUplinkSlots : nr_slots_per_frame[*nr_ue_mac_inst->scc->ssbSubcarrierSpacing];
if (tdd && nr_ue_mac_inst->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols > 0) {
num_slots_ul++;
}
LOG_D(NR_MAC, "In %s: Initializing ul_config_request. num_slots_ul = %d\n", __FUNCTION__, num_slots_ul);
nr_ue_mac_inst->ul_config_request = (fapi_nr_ul_config_request_t *)calloc(num_slots_ul, sizeof(fapi_nr_ul_config_request_t));
for (int i=0; i<num_slots_ul; i++)
pthread_mutex_init(&(nr_ue_mac_inst->ul_config_request[i].mutex_ul_config), NULL);
}
} }
else { else {
LOG_I(MAC,"Running without CellGroupConfig\n"); LOG_I(MAC,"Running without CellGroupConfig\n");
nr_rrc_mac_config_req_ue(0,0,0,NULL,NULL,NULL,NULL);
if(get_softmodem_params()->sa == 1) { if(get_softmodem_params()->sa == 1) {
AssertFatal(rlc_module_init(0) == 0, "%s: Could not initialize RLC layer\n", __FUNCTION__); AssertFatal(rlc_module_init(0) == 0, "%s: Could not initialize RLC layer\n", __FUNCTION__);
} }
......
...@@ -220,9 +220,8 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t ...@@ -220,9 +220,8 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
rel15->rnti = SI_RNTI; // SI-RNTI - 3GPP TS 38.321 Table 7.1-1: RNTI values rel15->rnti = SI_RNTI; // SI-RNTI - 3GPP TS 38.321 Table 7.1-1: RNTI values
if(mac->frequency_range == FR1) rel15->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon;
rel15->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; if(mac->frequency_range == FR2)
else
rel15->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon + 2; rel15->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon + 2;
break; break;
case NR_RNTI_SFI: case NR_RNTI_SFI:
......
...@@ -156,7 +156,7 @@ void nr_ue_init_mac(module_id_t module_idP) ...@@ -156,7 +156,7 @@ void nr_ue_init_mac(module_id_t module_idP)
NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP); NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP);
nr_ue_mac_default_configs(mac); nr_ue_mac_default_configs(mac);
mac->first_sync_frame = -1; mac->first_sync_frame = -1;
mac->sib1_decoded = false; mac->get_sib1 = false;
mac->phy_config_request_sent = false; mac->phy_config_request_sent = false;
mac->state = UE_NOT_SYNC; mac->state = UE_NOT_SYNC;
} }
...@@ -176,6 +176,12 @@ void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac) ...@@ -176,6 +176,12 @@ void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac)
mac->scheduling_info.retxBSR_SF = MAC_UE_BSR_TIMER_NOT_RUNNING; mac->scheduling_info.retxBSR_SF = MAC_UE_BSR_TIMER_NOT_RUNNING;
mac->BSR_reporting_active = BSR_TRIGGER_NONE; mac->BSR_reporting_active = BSR_TRIGGER_NONE;
mac->first_sync_frame = -1;
mac->get_sib1 = false;
mac->phy_config_request_sent = false;
mac->state = UE_NOT_SYNC;
memset(&mac->ssb_measurements, 0, sizeof(mac->ssb_measurements));
for (int i = 0; i < NR_MAX_NUM_LCID; i++) { for (int i = 0; i < NR_MAX_NUM_LCID; i++) {
LOG_D(NR_MAC, "Applying default logical channel config for LCGID %d\n", i); LOG_D(NR_MAC, "Applying default logical channel config for LCGID %d\n", i);
mac->scheduling_info.Bj[i] = -1; mac->scheduling_info.Bj[i] = -1;
...@@ -313,7 +319,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id, ...@@ -313,7 +319,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
else else
ssb_sc_offset_norm = ssb_subcarrier_offset; ssb_sc_offset_norm = ssb_subcarrier_offset;
if (!mac->sib1_decoded) { if (mac->get_sib1) {
nr_ue_sib1_scheduler(module_id, nr_ue_sib1_scheduler(module_id,
cc_id, cc_id,
ssb_start_symbol, ssb_start_symbol,
...@@ -351,8 +357,6 @@ int8_t nr_ue_decode_BCCH_DL_SCH(module_id_t module_id, ...@@ -351,8 +357,6 @@ int8_t nr_ue_decode_BCCH_DL_SCH(module_id_t module_id,
uint32_t pdu_len) { uint32_t pdu_len) {
if(ack_nack) { if(ack_nack) {
LOG_D(NR_MAC, "Decoding NR-BCCH-DL-SCH-Message (SIB1 or SI)\n"); LOG_D(NR_MAC, "Decoding NR-BCCH-DL-SCH-Message (SIB1 or SI)\n");
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
mac->sib1_decoded = true;
nr_mac_rrc_data_ind_ue(module_id, cc_id, gNB_index, 0, 0, 0, NR_BCCH_DL_SCH, (uint8_t *) pduP, pdu_len); nr_mac_rrc_data_ind_ue(module_id, cc_id, gNB_index, 0, 0, 0, NR_BCCH_DL_SCH, (uint8_t *) pduP, pdu_len);
} }
else else
...@@ -503,7 +507,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr ...@@ -503,7 +507,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
if (ret != -1){ if (ret != -1){
// Get UL config request corresponding slot_tx // Get UL config request corresponding slot_tx
fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slot_tx); fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slot_tx, tda_info.k2);
if (!ul_config) { if (!ul_config) {
LOG_W(MAC, "In %s: ul_config request is NULL. Probably due to unexpected UL DCI in frame.slot %d.%d. Ignoring DCI!\n", __FUNCTION__, frame, slot); LOG_W(MAC, "In %s: ul_config request is NULL. Probably due to unexpected UL DCI in frame.slot %d.%d. Ignoring DCI!\n", __FUNCTION__, frame, slot);
...@@ -572,7 +576,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr ...@@ -572,7 +576,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
if (ret != -1){ if (ret != -1){
// Get UL config request corresponding slot_tx // Get UL config request corresponding slot_tx
fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slot_tx); fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slot_tx, tda_info.k2);
if (!ul_config) { if (!ul_config) {
LOG_W(MAC, "In %s: ul_config request is NULL. Probably due to unexpected UL DCI in frame.slot %d.%d. Ignoring DCI!\n", __FUNCTION__, frame, slot); LOG_W(MAC, "In %s: ul_config request is NULL. Probably due to unexpected UL DCI in frame.slot %d.%d. Ignoring DCI!\n", __FUNCTION__, frame, slot);
...@@ -662,7 +666,10 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr ...@@ -662,7 +666,10 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config = mac->type0_PDCCH_CSS_config; NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config = mac->type0_PDCCH_CSS_config;
mux_pattern = type0_PDCCH_CSS_config.type0_pdcch_ss_mux_pattern; mux_pattern = type0_PDCCH_CSS_config.type0_pdcch_ss_mux_pattern;
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH; dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH;
// in MIB SCS is signaled as 15or60 and 30or120
dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon;
if(mac->frequency_range == FR2)
dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon + 2;
if (pdsch_config) pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NULL; // For PDSCH with mapping type A, the UE shall assume dmrs-AdditionalPosition='pos2' if (pdsch_config) pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NULL; // For PDSCH with mapping type A, the UE shall assume dmrs-AdditionalPosition='pos2'
} else { } else {
dlsch_config_pdu_1_0->SubcarrierSpacing = current_DL_BWP->scs; dlsch_config_pdu_1_0->SubcarrierSpacing = current_DL_BWP->scs;
...@@ -4121,7 +4128,7 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, int pdu_id) ...@@ -4121,7 +4128,7 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, int pdu_id)
if (ret != -1){ if (ret != -1){
fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slot_tx); fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slot_tx, tda_info.k2);
uint16_t rnti = mac->crnti; uint16_t rnti = mac->crnti;
if (!ul_config) { if (!ul_config) {
......
...@@ -107,35 +107,19 @@ void fill_scheduled_response(nr_scheduled_response_t *scheduled_response, ...@@ -107,35 +107,19 @@ void fill_scheduled_response(nr_scheduled_response_t *scheduled_response,
* This function returns the UL config corresponding to a given UL slot * This function returns the UL config corresponding to a given UL slot
* from MAC instance . * from MAC instance .
*/ */
fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int slot) fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int slot, int fb_time)
{ {
NR_TDD_UL_DL_ConfigCommon_t *tdd_config = mac->scc==NULL ? mac->scc_SIB->tdd_UL_DL_ConfigurationCommon : mac->scc->tdd_UL_DL_ConfigurationCommon; NR_TDD_UL_DL_ConfigCommon_t *tdd_config = mac->scc==NULL ? mac->scc_SIB->tdd_UL_DL_ConfigurationCommon : mac->scc->tdd_UL_DL_ConfigurationCommon;
//Check if requested on the right slot //Check if requested on the right slot
AssertFatal(is_nr_UL_slot(tdd_config, slot, mac->frame_type) != 0, "%s called at wrong slot %d\n", __func__, slot); AssertFatal(is_nr_UL_slot(tdd_config, slot, mac->frame_type) != 0, "UL config_request called at wrong slot %d\n", slot);
// Calculate the index of the UL slot in mac->ul_config_request list. This is
// based on the TDD pattern (slot configuration period) and number of UL+mixed
// slots in the period. TS 38.213 Sec 11.1
int mu = mac->current_UL_BWP.scs; int mu = mac->current_UL_BWP.scs;
const int n = nr_slots_per_frame[mu]; const int n = nr_slots_per_frame[mu];
const int num_slots_per_tdd = tdd_config ? (n >> (7 - tdd_config->pattern1.dl_UL_TransmissionPeriodicity)) : n; AssertFatal(fb_time < n, "Cannot schedule to a slot more than 1 frame away, ul_config_request is not big enough\n");
const int num_slots_ul = tdd_config ? (tdd_config->pattern1.nrofUplinkSlots + (tdd_config->pattern1.nrofUplinkSymbols != 0)) : n; AssertFatal(mac->ul_config_request != NULL, "mac->ul_config_request not initialized, logic bug\n");
int index = slot % num_slots_ul; return &mac->ul_config_request[slot];
LOG_D(NR_MAC, "In %s slots per %s: %d, num_slots %d, index %d\n",
__FUNCTION__,
tdd_config ? "TDD" : "FDD",
num_slots_per_tdd,
num_slots_ul,
index);
if (mac->ul_config_request) return &mac->ul_config_request[index];
else {
LOG_E(NR_MAC, "mac->ul_config_request not set\n");
return NULL;
}
} }
/* /*
...@@ -144,37 +128,8 @@ fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int sl ...@@ -144,37 +128,8 @@ fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int sl
*/ */
fapi_nr_dl_config_request_t *get_dl_config_request(NR_UE_MAC_INST_t *mac, int slot) fapi_nr_dl_config_request_t *get_dl_config_request(NR_UE_MAC_INST_t *mac, int slot)
{ {
int index; AssertFatal(mac->dl_config_request != NULL, "mac->dl_config_request not initialized, logic bug\n");
if (!mac->scc && !mac->scc_SIB) return &mac->dl_config_request[slot];
index = 0;
else {
NR_TDD_UL_DL_ConfigCommon_t *tdd_config = mac->scc==NULL ? mac->scc_SIB->tdd_UL_DL_ConfigurationCommon : mac->scc->tdd_UL_DL_ConfigurationCommon;
//Check if requested on the right slot
AssertFatal(is_nr_DL_slot(tdd_config, slot) != 0, "%s called at wrong slot %d\n", __func__, slot);
// Calculate the index of the DL slot in mac->ul_config_request list. This is
// based on the TDD pattern (slot configuration period) and number of DL+mixed
// slots in the period. TS 38.213 Sec 11.1
int mu = mac->current_UL_BWP.scs;
const int n = nr_slots_per_frame[mu];
const int num_slots_per_tdd = tdd_config ? (n >> (7 - tdd_config->pattern1.dl_UL_TransmissionPeriodicity)) : n;
const int num_slots_dl = tdd_config ? (tdd_config->pattern1.nrofDownlinkSlots + (tdd_config->pattern1.nrofDownlinkSymbols != 0)) : n;
index = slot % num_slots_dl;
LOG_D(NR_MAC, "In %s slots per %s: %d, num_slots %d, index %d\n",
__FUNCTION__,
tdd_config ? "TDD" : "FDD",
num_slots_per_tdd,
num_slots_dl,
index);
}
if (mac->dl_config_request) return &mac->dl_config_request[index];
else {
LOG_E(NR_MAC, "mac->dl_config_request not set\n");
return NULL;
}
} }
void ul_layers_config(NR_UE_MAC_INST_t *mac, nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu, dci_pdu_rel15_t *dci, nr_dci_format_t dci_format) void ul_layers_config(NR_UE_MAC_INST_t *mac, nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu, dci_pdu_rel15_t *dci, nr_dci_format_t dci_format)
...@@ -928,7 +883,7 @@ void nr_ue_aperiodic_srs_scheduling(NR_UE_MAC_INST_t *mac, long resource_trigger ...@@ -928,7 +883,7 @@ void nr_ue_aperiodic_srs_scheduling(NR_UE_MAC_INST_t *mac, long resource_trigger
} }
int sched_frame = frame + (slot + slot_offset >= n_slots_frame) % 1024; int sched_frame = frame + (slot + slot_offset >= n_slots_frame) % 1024;
fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, sched_slot); fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, sched_slot, slot_offset);
fapi_nr_ul_config_srs_pdu *srs_config_pdu = &ul_config->ul_config_list[ul_config->number_pdus].srs_config_pdu; fapi_nr_ul_config_srs_pdu *srs_config_pdu = &ul_config->ul_config_list[ul_config->number_pdus].srs_config_pdu;
configure_srs_pdu(mac, srs_resource, srs_config_pdu, 0, 0); configure_srs_pdu(mac, srs_resource, srs_config_pdu, 0, 0);
fill_ul_config(ul_config, sched_frame, sched_slot, FAPI_NR_UL_CONFIG_TYPE_SRS); fill_ul_config(ul_config, sched_frame, sched_slot, FAPI_NR_UL_CONFIG_TYPE_SRS);
...@@ -981,7 +936,7 @@ bool nr_ue_periodic_srs_scheduling(module_id_t mod_id, frame_t frame, slot_t slo ...@@ -981,7 +936,7 @@ bool nr_ue_periodic_srs_scheduling(module_id_t mod_id, frame_t frame, slot_t slo
// Check if UE should transmit the SRS // Check if UE should transmit the SRS
if((frame*n_slots_frame+slot-offset)%period == 0) { if((frame*n_slots_frame+slot-offset)%period == 0) {
fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slot); fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slot, 0);
fapi_nr_ul_config_srs_pdu *srs_config_pdu = &ul_config->ul_config_list[ul_config->number_pdus].srs_config_pdu; fapi_nr_ul_config_srs_pdu *srs_config_pdu = &ul_config->ul_config_list[ul_config->number_pdus].srs_config_pdu;
configure_srs_pdu(mac, srs_resource, srs_config_pdu, period, offset); configure_srs_pdu(mac, srs_resource, srs_config_pdu, period, offset);
...@@ -1070,7 +1025,7 @@ void nr_ue_ul_scheduler(nr_uplink_indication_t *ul_info) ...@@ -1070,7 +1025,7 @@ void nr_ue_ul_scheduler(nr_uplink_indication_t *ul_info)
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
RA_config_t *ra = &mac->ra; RA_config_t *ra = &mac->ra;
fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slot_tx); fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slot_tx, 0);
if (!ul_config) if (!ul_config)
LOG_E(NR_MAC, "mac->ul_config is null!\n"); LOG_E(NR_MAC, "mac->ul_config is null!\n");
...@@ -2238,7 +2193,7 @@ void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, vo ...@@ -2238,7 +2193,7 @@ void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, vo
if (num_res > 1) if (num_res > 1)
multiplex_pucch_resource(mac, pucch, num_res); multiplex_pucch_resource(mac, pucch, num_res);
fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slotP); fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slotP, 0);
pthread_mutex_lock(&ul_config->mutex_ul_config); pthread_mutex_lock(&ul_config->mutex_ul_config);
for (int j = 0; j < num_res; j++) { for (int j = 0; j < num_res; j++) {
if (pucch[j].n_harq + pucch[j].n_sr + pucch[j].n_csi != 0) { if (pucch[j].n_harq + pucch[j].n_sr + pucch[j].n_csi != 0) {
...@@ -2503,7 +2458,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s ...@@ -2503,7 +2458,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
if(ra->ra_state != GENERATE_PREAMBLE) if(ra->ra_state != GENERATE_PREAMBLE)
return; return;
fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slotP); fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slotP, 0);
if (!ul_config) { if (!ul_config) {
LOG_E(NR_MAC, "mac->ul_config is null! \n"); LOG_E(NR_MAC, "mac->ul_config is null! \n");
return; return;
......
...@@ -1144,7 +1144,6 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info) ...@@ -1144,7 +1144,6 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info)
uint32_t ret_mask = 0x0; uint32_t ret_mask = 0x0;
module_id_t module_id = dl_info->module_id; module_id_t module_id = dl_info->module_id;
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
fapi_nr_dl_config_request_t *dl_config = get_dl_config_request(mac, dl_info->slot);
if ((!dl_info->dci_ind && !dl_info->rx_ind)) { if ((!dl_info->dci_ind && !dl_info->rx_ind)) {
// UL indication to schedule DCI reception // UL indication to schedule DCI reception
...@@ -1179,6 +1178,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info) ...@@ -1179,6 +1178,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info)
if (ret >= 0) { if (ret >= 0) {
AssertFatal( nr_ue_if_module_inst[module_id] != NULL, "IF module is NULL!\n" ); AssertFatal( nr_ue_if_module_inst[module_id] != NULL, "IF module is NULL!\n" );
AssertFatal( nr_ue_if_module_inst[module_id]->scheduled_response != NULL, "scheduled_response is NULL!\n" ); AssertFatal( nr_ue_if_module_inst[module_id]->scheduled_response != NULL, "scheduled_response is NULL!\n" );
fapi_nr_dl_config_request_t *dl_config = get_dl_config_request(mac, dl_info->slot);
fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, dl_info->module_id, dl_info->cc_id, dl_info->frame, dl_info->slot, dl_info->phy_data); fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, dl_info->module_id, dl_info->cc_id, dl_info->frame, dl_info->slot, dl_info->phy_data);
nr_ue_if_module_inst[module_id]->scheduled_response(&scheduled_response); nr_ue_if_module_inst[module_id]->scheduled_response(&scheduled_response);
} }
......
...@@ -285,6 +285,9 @@ int8_t nr_rrc_ue_process_rrcReconfiguration(const module_id_t module_id, NR_RRCR ...@@ -285,6 +285,9 @@ int8_t nr_rrc_ue_process_rrcReconfiguration(const module_id_t module_id, NR_RRCR
NR_UE_rrc_inst[module_id].cell_group_config = cellGroupConfig; NR_UE_rrc_inst[module_id].cell_group_config = cellGroupConfig;
nr_rrc_ue_process_scg_config(module_id,cellGroupConfig); nr_rrc_ue_process_scg_config(module_id,cellGroupConfig);
} }
if (get_softmodem_params()->nsa) {
nr_rrc_mac_config_req_scg(0, 0, cellGroupConfig);
}
} }
else else
nr_rrc_ue_decode_secondary_cellgroup_config(module_id, nr_rrc_ue_decode_secondary_cellgroup_config(module_id,
...@@ -312,7 +315,6 @@ int8_t nr_rrc_ue_process_rrcReconfiguration(const module_id_t module_id, NR_RRCR ...@@ -312,7 +315,6 @@ int8_t nr_rrc_ue_process_rrcReconfiguration(const module_id_t module_id, NR_RRCR
default: default:
break; break;
} }
//nr_rrc_mac_config_req_ue();
return 0; return 0;
} }
...@@ -340,10 +342,6 @@ int8_t nr_rrc_ue_process_scg_config(const module_id_t module_id, NR_CellGroupCon ...@@ -340,10 +342,6 @@ int8_t nr_rrc_ue_process_scg_config(const module_id_t module_id, NR_CellGroupCon
}else{ }else{
// maintain list // maintain list
if(cell_group_config->spCellConfig != NULL){ if(cell_group_config->spCellConfig != NULL){
if (get_softmodem_params()->nsa) {
nr_rrc_mac_config_req_ue(0, 0, 0, NULL, NULL, cell_group_config, NULL);
LOG_D(NR_RRC, "Filled scc now \n");
}
if(cell_group_config->spCellConfig->spCellConfigDedicated != NULL){ if(cell_group_config->spCellConfig->spCellConfigDedicated != NULL){
// process element of list to be add by RRC message // process element of list to be add by RRC message
if(cell_group_config->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList != NULL){ if(cell_group_config->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList != NULL){
...@@ -600,7 +598,10 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(const module_id_t module_id, const u ...@@ -600,7 +598,10 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(const module_id_t module_id, const u
NR_UE_rrc_inst[module_id].mib = bcch_message->message.choice.mib; NR_UE_rrc_inst[module_id].mib = bcch_message->message.choice.mib;
bcch_message->message.choice.mib = NULL; bcch_message->message.choice.mib = NULL;
nr_rrc_mac_config_req_ue(0, 0, 0, NR_UE_rrc_inst[module_id].mib, NULL, NULL, NULL); NR_SIB1_t *sib1 = NR_UE_rrc_inst[module_id].sib1[gNB_index];
// if no sib1 because not acquired yet or expired, get a new one
bool get_sib1 = sib1 == NULL;
nr_rrc_mac_config_req_mib(module_id, 0, NR_UE_rrc_inst[module_id].mib, get_sib1);
ret = 0; ret = 0;
} }
ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_Message, bcch_message); ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_Message, bcch_message);
...@@ -1210,8 +1211,8 @@ int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id, ...@@ -1210,8 +1211,8 @@ int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id,
} }
// take ServingCellConfigCommon and configure L1/L2 // take ServingCellConfigCommon and configure L1/L2
NR_UE_rrc_inst[module_id].servingCellConfigCommonSIB = sib1->servingCellConfigCommon; NR_UE_rrc_inst[module_id].servingCellConfigCommonSIB = sib1->servingCellConfigCommon;
nr_rrc_mac_config_req_ue(module_id,0,0,NULL,sib1->servingCellConfigCommon,NULL,NULL); nr_rrc_mac_config_req_sib1(module_id, 0, sib1->servingCellConfigCommon);
nr_rrc_ue_generate_ra_msg(module_id,gNB_index); nr_rrc_ue_generate_ra_msg(module_id, gNB_index);
} else { } else {
LOG_E(NR_RRC, "SIB1 not decoded\n"); LOG_E(NR_RRC, "SIB1 not decoded\n");
} }
...@@ -1256,12 +1257,9 @@ int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id, ...@@ -1256,12 +1257,9 @@ int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id,
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void void nr_rrc_ue_process_masterCellGroup(const protocol_ctxt_t *const ctxt_pP,
nr_rrc_ue_process_masterCellGroup( uint8_t gNB_index,
const protocol_ctxt_t *const ctxt_pP, OCTET_STRING_t *masterCellGroup)
uint8_t gNB_index,
OCTET_STRING_t *masterCellGroup
)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
NR_CellGroupConfig_t *cellGroupConfig=NULL; NR_CellGroupConfig_t *cellGroupConfig=NULL;
...@@ -1342,23 +1340,23 @@ nr_rrc_ue_process_masterCellGroup( ...@@ -1342,23 +1340,23 @@ nr_rrc_ue_process_masterCellGroup(
sizeof(struct NR_MAC_CellGroupConfig)); sizeof(struct NR_MAC_CellGroupConfig));
} }
if( cellGroupConfig->sCellToReleaseList != NULL){ if(cellGroupConfig->sCellToReleaseList != NULL) {
//TODO (perform SCell release as specified in 5.3.5.5.8) //TODO (perform SCell release as specified in 5.3.5.5.8)
} }
if( cellGroupConfig->spCellConfig != NULL){ if(cellGroupConfig->spCellConfig != NULL) {
if (NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config && if (NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config &&
NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->spCellConfig) { NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->spCellConfig) {
memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->spCellConfig,cellGroupConfig->spCellConfig, memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->spCellConfig,cellGroupConfig->spCellConfig,
sizeof(struct NR_SpCellConfig)); sizeof(struct NR_SpCellConfig));
} else { } else {
if (NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config) if (NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config)
NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->spCellConfig = cellGroupConfig->spCellConfig; NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->spCellConfig = cellGroupConfig->spCellConfig;
else else
NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config = cellGroupConfig; NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config = cellGroupConfig;
} }
LOG_D(RRC,"Sending CellGroupConfig to MAC\n"); LOG_D(RRC,"Sending CellGroupConfig to MAC\n");
nr_rrc_mac_config_req_ue(ctxt_pP->module_id,0,0,NULL,NULL,cellGroupConfig,NULL); nr_rrc_mac_config_req_mcg(ctxt_pP->module_id, 0, cellGroupConfig);
//TODO (configure the SpCell as specified in 5.3.5.5.7) //TODO (configure the SpCell as specified in 5.3.5.5.7)
} }
...@@ -2136,12 +2134,9 @@ nr_rrc_ue_establish_srb2( ...@@ -2136,12 +2134,9 @@ nr_rrc_ue_establish_srb2(
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static void static void rrc_ue_process_rrcReconfiguration(const protocol_ctxt_t *const ctxt_pP,
rrc_ue_process_rrcReconfiguration( NR_RRCReconfiguration_t *rrcReconfiguration,
const protocol_ctxt_t *const ctxt_pP, uint8_t gNB_index)
NR_RRCReconfiguration_t *rrcReconfiguration,
uint8_t gNB_index
)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
LOG_I(NR_RRC, "[UE %d] Frame %d: Receiving from SRB1 (DL-DCCH), Processing RRCReconfiguration (gNB %d)\n", LOG_I(NR_RRC, "[UE %d] Frame %d: Receiving from SRB1 (DL-DCCH), Processing RRCReconfiguration (gNB %d)\n",
......
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