Commit 21539231 authored by francescomani's avatar francescomani

reworking dci configuration

parent 4183e584
...@@ -287,150 +287,121 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, ...@@ -287,150 +287,121 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac,
dl_config->number_pdus += 1; dl_config->number_pdus += 1;
} }
void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl_config, frame_t frame, int slot) {
RA_config_t *ra = &mac->ra; void get_monitoring_period_offset(NR_SearchSpace_t *ss, int *period, int *offset)
uint8_t bwp_id = mac->current_DL_BWP.bwp_id; {
switch(ss->monitoringSlotPeriodicityAndOffset->present) {
NR_ServingCellConfig_t *scd = mac->cg->spCellConfig->spCellConfigDedicated; case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1:
NR_BWP_DownlinkDedicated_t *bwpd = bwp_id > 0 ? scd->downlinkBWP_ToAddModList->list.array[bwp_id - 1]->bwp_Dedicated: *period = 1;
scd->initialDownlinkBWP; *offset = 0;
NR_BWP_DownlinkCommon_t *bwp_Common = get_bwp_downlink_common(mac, bwp_id); break;
case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2:
LOG_D(NR_MAC, "[DCI_CONFIG] ra_rnti %p (%x) crnti %p (%x) t_crnti %p (%x)\n", &ra->ra_rnti, ra->ra_rnti, &mac->crnti, mac->crnti, &ra->t_crnti, ra->t_crnti); *period = 2;
*offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl2;
// loop over all available SS for bwp_id break;
if (bwpd) { case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl4:
for (int ss_id = 0; ss_id < FAPI_NR_MAX_SS; ss_id++){ *period = 4;
*offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl4;
if(mac->BWP_searchspaces[ss_id]==NULL) { break;
continue; case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl5:
} *period = 5;
*offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl5;
LOG_D(NR_MAC, "[DCI_CONFIG] ss_id %d\n",ss_id); break;
NR_SearchSpace_t *ss = mac->BWP_searchspaces[ss_id]; case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl8:
NR_SetupRelease_PDCCH_ConfigCommon_t *pdcch_ConfigCommon = bwp_Common->pdcch_ConfigCommon; *period = 8;
struct NR_PhysicalCellGroupConfig *phy_cgc = mac->cg->physicalCellGroupConfig; *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl8;
switch (ss->searchSpaceType->present){ break;
case NR_SearchSpace__searchSpaceType_PR_common: case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl10:
// this is for CSSs, we use BWP common and pdcch_ConfigCommon *period = 10;
*offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl10;
if (ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0){ break;
// check available SS IDs case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl16:
if (pdcch_ConfigCommon->choice.setup->ra_SearchSpace){ *period = 16;
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->ra_SearchSpace){ *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl16;
switch(ra->ra_state){ break;
case WAIT_RAR: case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl20:
LOG_D(NR_MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type1-PDCCH common random access search space (RA-Msg2)\n"); *period = 20;
if (get_softmodem_params()->sa) { *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl20;
config_dci_pdu(mac, dl_config, NR_RNTI_RA, slot, mac->ra_SS); break;
} else { case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl40:
config_dci_pdu(mac, dl_config, NR_RNTI_RA, slot, ss); *period = 40;
} *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl40;
break; break;
case WAIT_CONTENTION_RESOLUTION: case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl80:
LOG_D(NR_MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type1-PDCCH common random access search space (RA-Msg4)\n"); *period = 80;
config_dci_pdu(mac, dl_config, NR_RNTI_TC, slot, mac->ra_SS); *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl80;
break; break;
default: case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl160:
break; *period = 160;
} *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl160;
} break;
} case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl320:
if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){ *period = 320;
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){ *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl320;
// Configure monitoring of PDCCH candidates in Type0-PDCCH common search space on the MCG break;
//LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet..."); case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl640:
} *period = 640;
} *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl640;
if (pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation){ break;
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation){ case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1280:
// Configure monitoring of PDCCH candidates in Type0-PDCCH common search space on the MCG *period = 1280;
//LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet..."); *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl1280;
} break;
} case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2560:
if (pdcch_ConfigCommon->choice.setup->pagingSearchSpace){ *period = 2560;
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->pagingSearchSpace){ *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl2560;
// Configure monitoring of PDCCH candidates in Type2-PDCCH common search space on the MCG break;
//LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet..."); default:
} AssertFatal(1==0,"Invalid monitoring slot periodicity value\n");
} break;
if (phy_cgc){ }
if (phy_cgc->cs_RNTI){ }
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by CS-RNTI...\n");
LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...\n");
}
if (phy_cgc->ext1){
if (phy_cgc->ext1->mcs_C_RNTI){
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by MCS-C-RNTI...\n");
LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...\n");
}
}
}
} // end DCI 00 and 01
// DCI 2_0
if (ss->searchSpaceType->choice.common->dci_Format2_0){
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_0 with CRC scrambled by SFI-RNTI \n");
LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet...\n");
}
// DCI 2_1
if (ss->searchSpaceType->choice.common->dci_Format2_1){
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_1 with CRC scrambled by INT-RNTI \n");
LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet...\n");
}
// DCI 2_2
if (ss->searchSpaceType->choice.common->dci_Format2_2){
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_2 with CRC scrambled by TPC-RNTI \n");
LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet...\n");
}
// DCI 2_3
if (ss->searchSpaceType->choice.common->dci_Format2_3){
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_3 with CRC scrambled by TPC-SRS-RNTI \n");
LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet...\n");
}
break; bool is_ss_monitor_occasion(int frame, int slot, int slots_per_frame, NR_SearchSpace_t *ss)
case NR_SearchSpace__searchSpaceType_PR_ue_Specific: {
// this is an USS int duration = ss->duration ? *ss->duration : 1;
if (ss->searchSpaceType->choice.ue_Specific && bool monitor = false;
ss->searchSpaceType->choice.ue_Specific->dci_Formats == NR_SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_1_And_1_1 && int period, offset;
mac->state == UE_CONNECTED && get_monitoring_period_offset(ss, &period, &offset);
mac->crnti > 0) { // The UE monitors PDCCH candidates for search space set ss for 'duration' consecutive slots
// Monitors DCI 01 and 11 scrambled with C-RNTI, or CS-RNTI(s), or SP-CSI-RNTI for (int i = 0; i < duration; i++) {
LOG_D(NR_MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in the user specific search space\n"); if (((frame * slots_per_frame + slot - offset - i) % period) == 0) {
config_dci_pdu(mac, dl_config, NR_RNTI_C, slot, ss); monitor = true;
break;
}
}
return monitor;
}
//#ifdef DEBUG_DCI void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl_config, frame_t frame, int slot)
LOG_D(NR_MAC, "[DCI_CONFIG] ss %d ue_Specific %p searchSpaceType->present %d dci_Formats %d\n", {
ss_id, NR_UE_DL_BWP_t *current_DL_BWP = &mac->current_DL_BWP;
ss->searchSpaceType->choice.ue_Specific, int slots_per_frame = nr_slots_per_frame[current_DL_BWP->scs];
(int)ss->searchSpaceType->present, if (mac->state == UE_PERFORMING_RA &&
(int)ss->searchSpaceType->choice.ue_Specific->dci_Formats); mac->ra.ra_state >= WAIT_RAR) {
//#endif // if RA is ongoing use RA search space
} if (is_ss_monitor_occasion(frame, slot, slots_per_frame, mac->ra_SS)) {
if (phy_cgc){ int rnti_type = mac->ra.ra_state == WAIT_RAR ? NR_RNTI_RA : NR_RNTI_TC;
if (phy_cgc->cs_RNTI){ config_dci_pdu(mac, dl_config, rnti_type, slot, mac->ra_SS);
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by CS-RNTI...\n"); }
LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...");
}
if (phy_cgc->sp_CSI_RNTI){
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by SP-CSI-RNTI...\n");
LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...");
}
if (phy_cgc->ext1 &&
phy_cgc->ext1->mcs_C_RNTI){
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by MCS-C-RNTI...\n");
LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...");
}
}
break;
default:
AssertFatal(1 == 0, "[DCI_CONFIG] Unrecognized search space type...");
break;
} // switch searchspace
} // for ss_id
} }
else { else if (mac->state == UE_CONNECTED) {
LOG_E(MAC,"Cannot handle DCI without dedicated BWP\n"); bool found = false;
for (int i = 0; i < FAPI_NR_MAX_SS; i++) {
if (mac->BWP_searchspaces[i] != NULL) {
found = true;
NR_SearchSpace_t *ss = mac->BWP_searchspaces[i];
if (is_ss_monitor_occasion(frame, slot, slots_per_frame, ss))
config_dci_pdu(mac, dl_config, NR_RNTI_C, slot, ss);
}
}
if (!found && mac->ra_SS) {
// If the UE has not been provided a Type3-PDCCH CSS set or a USS set and
// the UE has received a C-RNTI and has been provided a Type1-PDCCH CSS set,
// the UE monitors PDCCH candidates for DCI format 0_0 and DCI format 1_0
// with CRC scrambled by the C-RNTI in the Type1-PDCCH CSS set
if (is_ss_monitor_occasion(frame, slot, slots_per_frame, mac->ra_SS))
config_dci_pdu(mac, dl_config, NR_RNTI_C, slot, mac->ra_SS);
}
} }
} }
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