Commit d9dfd732 authored by francescomani's avatar francescomani

store common searchspaces (for RA, SI, P)

parent e678676a
......@@ -447,11 +447,48 @@ void config_control_ue(NR_UE_MAC_INST_t *mac)
configure_ss_coreset(mac, scd, dl_bwp_id);
}
NR_SearchSpace_t *get_common_search_space(struct NR_PDCCH_ConfigCommon__commonSearchSpaceList *commonSearchSpaceList,
NR_UE_MAC_INST_t *mac,
NR_SearchSpaceId_t ss_id)
{
if (ss_id == 0)
return mac->search_space_zero;
NR_SearchSpace_t *css = NULL;
for (int i = 0; i < commonSearchSpaceList->list.count; i++) {
if (commonSearchSpaceList->list.array[i]->searchSpaceId == ss_id) {
css = commonSearchSpaceList->list.array[i];
break;
}
}
AssertFatal(css, "Couldn't find CSS with Id %ld\n", ss_id);
return css;
}
void configure_common_ss(NR_UE_MAC_INST_t *mac,
NR_PDCCH_ConfigCommon_t *pdcch_ConfigCommon)
{
if (pdcch_ConfigCommon) {
mac->otherSI_SS = pdcch_ConfigCommon->searchSpaceOtherSystemInformation ?
get_common_search_space(pdcch_ConfigCommon->commonSearchSpaceList, mac,
*pdcch_ConfigCommon->searchSpaceOtherSystemInformation) :
NULL;
mac->ra_SS = pdcch_ConfigCommon->ra_SearchSpace ?
get_common_search_space(pdcch_ConfigCommon->commonSearchSpaceList, mac,
*pdcch_ConfigCommon->ra_SearchSpace) :
NULL;
mac->paging_SS = pdcch_ConfigCommon->pagingSearchSpace ?
get_common_search_space(pdcch_ConfigCommon->commonSearchSpaceList, mac,
*pdcch_ConfigCommon->pagingSearchSpace) :
NULL;
}
}
void configure_ss_coreset(NR_UE_MAC_INST_t *mac,
NR_ServingCellConfig_t *scd,
NR_BWP_Id_t dl_bwp_id) {
NR_BWP_Id_t dl_bwp_id)
{
NR_BWP_DownlinkCommon_t *bwp_Common = get_bwp_downlink_common(mac, dl_bwp_id);
AssertFatal(bwp_Common != NULL, "bwp_Common is null\n");
......@@ -564,6 +601,8 @@ void configure_current_BWP(NR_UE_MAC_INST_t *mac,
UL_BWP->pucch_ConfigCommon = bwp_ulcommon->pucch_ConfigCommon->choice.setup;
if (bwp_ulcommon->rach_ConfigCommon)
UL_BWP->rach_ConfigCommon = bwp_ulcommon->rach_ConfigCommon->choice.setup;
if (bwp_dlcommon->pdcch_ConfigCommon)
configure_common_ss(mac, bwp_dlcommon->pdcch_ConfigCommon->choice.setup);
}
if(cell_group_config) {
......@@ -609,11 +648,15 @@ void configure_current_BWP(NR_UE_MAC_INST_t *mac,
dl_genericParameters = bwp_downlink->bwp_Common->genericParameters;
DL_BWP->pdsch_Config = bwp_downlink->bwp_Dedicated->pdsch_Config->choice.setup;
DL_BWP->tdaList_Common = bwp_downlink->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
if (bwp_downlink->bwp_Common->pdcch_ConfigCommon)
configure_common_ss(mac, bwp_downlink->bwp_Common->pdcch_ConfigCommon->choice.setup);
}
else {
dl_genericParameters = bwp_dlcommon->genericParameters;
DL_BWP->pdsch_Config = spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup;
DL_BWP->tdaList_Common = bwp_dlcommon->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
if (bwp_dlcommon->pdcch_ConfigCommon)
configure_common_ss(mac, bwp_dlcommon->pdcch_ConfigCommon->choice.setup);
}
UL_BWP->msg3_DeltaPreamble = bwp_ulcommon->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble;
......
......@@ -325,9 +325,6 @@ typedef struct {
/// BeamfailurerecoveryConfig
NR_BeamFailureRecoveryConfig_t RA_BeamFailureRecoveryConfig;
/// RA SearchSpace
NR_SearchSpace_t *ss;
NR_PRACH_RESOURCES_t prach_resources;
} RA_config_t;
......@@ -414,6 +411,9 @@ typedef struct {
NR_ControlResourceSet_t *coreset[MAX_NUM_BWP_UE][FAPI_NR_MAX_CORESET_PER_BWP];
NR_SearchSpace_t *SSpace[MAX_NUM_BWP_UE][FAPI_NR_MAX_SS];
NR_SearchSpace_t *otherSI_SS;
NR_SearchSpace_t *ra_SS;
NR_SearchSpace_t *paging_SS;
bool phy_config_request_sent;
frame_type_t frame_type;
......
......@@ -85,22 +85,6 @@ void init_RA(module_id_t mod_id,
prach_resources->POWER_OFFSET_2STEP_RA = 0;
prach_resources->RA_SCALING_FACTOR_BI = 1;
NR_BWP_Id_t dl_bwp_id = mac->current_DL_BWP.bwp_id;
NR_BWP_DownlinkCommon_t *bwp_Common = get_bwp_downlink_common(mac, dl_bwp_id);
AssertFatal(bwp_Common != NULL, "bwp_Common is null\n");
NR_SetupRelease_PDCCH_ConfigCommon_t *pdcch_ConfigCommon = bwp_Common->pdcch_ConfigCommon;
NR_SearchSpaceId_t *ss_id = pdcch_ConfigCommon->choice.setup->ra_SearchSpace;
struct NR_PDCCH_ConfigCommon__commonSearchSpaceList *commonSearchSpaceList = pdcch_ConfigCommon->choice.setup->commonSearchSpaceList;
AssertFatal(ss_id, "Didn't find ra-SearchSpace\n");
AssertFatal(commonSearchSpaceList->list.count > 0, "common SearchSpace list has 0 elements\n");
// Common searchspace list
for (int i = 0; i < commonSearchSpaceList->list.count; i++) {
NR_SearchSpace_t *ss = commonSearchSpaceList->list.array[i];
if (ss->searchSpaceId == *ss_id)
ra->ss = ss;
}
if (rach_ConfigDedicated) {
if (rach_ConfigDedicated->cfra){
LOG_I(MAC, "Initialization of 2-step contention-free random access procedure\n");
......
......@@ -101,9 +101,10 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
NR_ControlResourceSet_t *coreset;
if(ss_id>=0) {
if (rnti_type == NR_RNTI_TC || rnti_type == NR_RNTI_RA) {
ss = mac->ra.ss;
AssertFatal(mac->ra.ss->searchSpaceId == ss_id,"Search Space id %d does not correspond to the one in ra->ss %ld for RA procedures\n",
ss_id,mac->ra.ss->searchSpaceId);
ss = mac->ra_SS;
AssertFatal(mac->ra_SS->searchSpaceId == ss_id,
"Search Space id %d does not correspond to the one in ra_ss %ld for RA procedures\n",
ss_id, mac->ra_SS->searchSpaceId);
}
else
ss = mac->SSpace[dl_bwp_id][ss_id-1];
......
......@@ -4119,7 +4119,7 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, int pdu_id)
// Schedule Msg3
NR_UE_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP;
NR_tda_info_t tda_info = get_ul_tda_info(current_UL_BWP, *ra->ss->controlResourceSetId, ra->ss->searchSpaceType->present, NR_RNTI_RA, rar_grant.Msg3_t_alloc);
NR_tda_info_t tda_info = get_ul_tda_info(current_UL_BWP, *mac->ra_SS->controlResourceSetId, mac->ra_SS->searchSpaceType->present, NR_RNTI_RA, rar_grant.Msg3_t_alloc);
if (tda_info.nrOfSymbols == 0) {
LOG_E(MAC, "Cannot schedule Msg3. Something wrong in TDA information\n");
return -1;
......
......@@ -983,8 +983,8 @@ void nr_ue_dl_scheduler(nr_downlink_indication_t *dl_info)
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
if (mac->ra.ra_state == WAIT_CONTENTION_RESOLUTION)
rel15->dci_format_options[1] = NR_UL_DCI_FORMAT_0_0; // msg3 retransmission
config_dci_pdu(mac, rel15, dl_config, mac->ra.ra_state == WAIT_RAR ? NR_RNTI_RA : NR_RNTI_TC , mac->ra.ss->searchSpaceId);
fill_dci_search_candidates(mac->ra.ss, rel15, -1 , -1);
config_dci_pdu(mac, rel15, dl_config, mac->ra.ra_state == WAIT_RAR ? NR_RNTI_RA : NR_RNTI_TC , mac->ra_SS->searchSpaceId);
fill_dci_search_candidates(mac->ra_SS, rel15, -1 , -1);
dl_config->number_pdus = 1;
LOG_D(MAC,"mac->cg %p: Calling fill_scheduled_response rnti %x, type0_pdcch, num_pdus %d\n",mac->cg,rel15->rnti,dl_config->number_pdus);
fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot, dl_info->phy_data);
......
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