From cf22a2146e7e415b42599bf6627f294d1ef55a6d Mon Sep 17 00:00:00 2001 From: Guy De Souza Date: Wed, 23 Jan 2019 13:44:35 +0100 Subject: [PATCH] DCI configuration by PDCCHConfig --- .../nfapi/public_inc/nfapi_nr_interface.h | 35 +++- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 177 +++++++++++++++++- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 11 +- 3 files changed, 216 insertions(+), 7 deletions(-) diff --git a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h index 121a3eec72..b30b276284 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h @@ -13,6 +13,7 @@ #define NFAPI_NR_MAX_NB_CCE_AGGREGATION_LEVELS 5 +#define NFAPI_NR_MAX_NB_TCI_STATES_PDCCH 64 // Extension to the generic structures for single tlv values typedef struct { @@ -356,7 +357,8 @@ typedef enum { typedef enum { NFAPI_NR_CSET_CONFIG_MIB_SIB1=0, - NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG + NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG, // implicit assumption of coreset Id other than 0 + NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG_CSET_0 } nfapi_nr_coreset_config_type_e; typedef enum { @@ -364,6 +366,31 @@ typedef enum { NFAPI_NR_CSET_ALL_CONTIGUOUS_RBS } nfapi_nr_coreset_precoder_granularity_type_e; +typedef enum { + NFAPI_NR_QCL_TYPE_A=0, + NFAPI_NR_QCL_TYPE_B, + NFAPI_NR_QCL_TYPE_C, + NFAPI_NR_QCL_TYPE_D +} nfapi_nr_qcl_type_e; + +typedef enum { + NFAPI_NR_SS_PERIODICITY_SL1=1, + NFAPI_NR_SS_PERIODICITY_SL2=2, + NFAPI_NR_SS_PERIODICITY_SL4=4, + NFAPI_NR_SS_PERIODICITY_SL5=5, + NFAPI_NR_SS_PERIODICITY_SL8=8, + NFAPI_NR_SS_PERIODICITY_SL10=10, + NFAPI_NR_SS_PERIODICITY_SL16=16, + NFAPI_NR_SS_PERIODICITY_SL20=20, + NFAPI_NR_SS_PERIODICITY_SL40=40, + NFAPI_NR_SS_PERIODICITY_SL80=80, + NFAPI_NR_SS_PERIODICITY_SL160=160, + NFAPI_NR_SS_PERIODICITY_SL320=320, + NFAPI_NR_SS_PERIODICITY_SL640=640, + NFAPI_NR_SS_PERIODICITY_SL1280=1280, + NFAPI_NR_SS_PERIODICITY_SL2560=2560 +} nfapi_nr_search_space_monitoring_periodicity_e; + typedef enum { NFAPI_NR_PDSCH_TIME_DOMAIN_ALLOC_TYPE_DEFAULT_A=0, NFAPI_NR_PDSCH_TIME_DOMAIN_ALLOC_TYPE_DEFAULT_B, @@ -496,9 +523,9 @@ typedef struct{ uint8_t css_format_2_2; uint8_t css_format_2_3; uint8_t uss_dci_formats; - uint8_t srs_monitoring_periodicity; - uint8_t slot_monitoring_periodicity; - uint8_t slot_monitoring_offset; + uint16_t srs_monitoring_periodicity; + uint16_t slot_monitoring_periodicity; + uint16_t slot_monitoring_offset; uint16_t monitoring_symbols_in_slot; uint16_t number_of_candidates[NFAPI_NR_MAX_NB_CCE_AGGREGATION_LEVELS]; } nfapi_nr_search_space_t; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 6a390d4870..7057292fcd 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -110,7 +110,19 @@ uint8_t nr_ss_first_symb_idx_scs_240_120_set1_mux2[6] = {0,1,2,3,0,1}; // Mux pattern type 3 uint8_t nr_ss_first_symb_idx_scs_120_120_mux3[4] = {4,8,2,6}; +/// Search space max values indexed by scs +uint8_t nr_max_number_of_candidates_per_slot[4] = {44, 36, 22, 20}; +uint8_t nr_max_number_of_cces_per_slot[4] = {56, 56, 48, 32}; +static inline uint8_t get_max_candidates(uint8_t scs) { + AssertFatal(scs<4, "Invalid PDCCH subcarrier spacing %d\n", scs); + return (nr_max_number_of_candidates_per_slot[scs]); +} + +static inline uint8_t get_max_cces(uint8_t scs) { + AssertFatal(scs<4, "Invalid PDCCH subcarrier spacing %d\n", scs); + return (nr_max_number_of_cces_per_slot[scs]); +} int is_nr_UL_slot(NR_COMMON_channels_t * ccP, int slot){ @@ -332,11 +344,166 @@ void nr_configure_css_dci_initial(nfapi_nr_dl_config_pdcch_parameters_rel15_t* p } -void nr_configure_css_dci_from_pdcch_config(nfapi_nr_dl_config_pdcch_parameters_rel15_t* pdcch_params, +void nr_configure_dci_from_pdcch_config(nfapi_nr_dl_config_pdcch_parameters_rel15_t* pdcch_params, nfapi_nr_coreset_t* coreset, - nfapi_nr_search_space_t* search_space) { + nfapi_nr_search_space_t* search_space, + nfapi_nr_config_request_t cfg) { +/// coreset + //ControlResourceSetId + pdcch_params->config_type = (coreset->coreset_id==0)?NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG_CSET_0: NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG; + //frequencyDomainResources + uint8_t count=0, start=0, start_set=0; + uint64_t bitmap = coreset->frequency_domain_resources; + for (int i=0; i<64; i++) + if ((bitmap>>(63-i))&1) { + count++; + if (!start_set) + start = i; + start_set = 1; + } + pdcch_params->rb_offset = 6*start; + pdcch_params->n_rb = 6*count; + + //duration + pdcch_params->n_symb = coreset->duration; + + //cce-REG-MappingType + pdcch_params->cr_mapping_type = coreset->cce_reg_mapping_type; + if (pdcch_params->cr_mapping_type == NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED) { + pdcch_params->reg_bundle_size = coreset->reg_bundle_size; + pdcch_params->interleaver_size = coreset->interleaver_size; + pdcch_params->shift_index = coreset->shift_index; + } + + //precoderGranularity + pdcch_params->precoder_granularity = coreset->precoder_granularity; + + //TCI states + // PDCCH params does not yet include information about TCI and QCL (needed for DCI 1.1 and 0.1) + + //pdcch-DMRS-ScramblingID + pdcch_params->scrambling_id = coreset->dmrs_scrambling_id; + + +/// SearchSpace + + // first symbol and duration + //AssertFatal(pdcch_scs==kHz15, "PDCCH SCS above 15kHz not allowed if a symbol above 2 is monitored"); + for (int i=0; imonitoring_symbols_in_slot>>(15-i))&1) + pdcch_params->first_symbol=i; + +/* + //searchSpaceId + AssertFatal(search_space->search_space_id<40, "Search space index out of range %d\n", search_space->search_space_id); + + //controlResourceSetId + + //monitoringSlotPeriodicityAndOffset + + //duration + pdcch_params->nb_ss_sets_per_slot = search_space->duration; + + + //monitoringSymbolsWithinSlot + pdcch_params->first_symbol = search_space->monitoring_symbols_in_slot; + + //nrofCandidates + pdcch_params->aggregation_level = (uint8_t)number_of_candidates[NFAPI_NR_MAX_NB_CCE_AGGREGATION_LEVELS - 1]; + + //searchSpaceType + pdcch_params->search_space_type = search_space->search_space_type; + //Common_CSS + if (pdcch_params->search_space_type == NFAPI_NR_SEARCH_SPACE_TYPE_COMMON){ + switch(search_space->css_formats_0_0_and_1_0){ + case NFAPI_NR_RNTI_C: + pdcch_params->rnti_type = NFAPI_NR_RNTI_C; + break; + case NFAPI_NR_RNTI_CS: + pdcch_params->rnti_type = NFAPI_NR_RNTI_CS; + break; + case NFAPI_NR_RNTI_SP_CSI: + pdcch_params->rnti_type = NFAPI_NR_RNTI_SP_CSI; + break; + case NFAPI_NR_RNTI_RA: + pdcch_params->rnti_type = NFAPI_NR_RNTI_RA; + break; + case NFAPI_NR_RNTI_TC: + pdcch_params->rnti_type = NFAPI_NR_RNTI_TC; + break; + case NFAPI_NR_RNTI_P: + pdcch_params->rnti_type = NFAPI_NR_RNTI_P; + break; + case NFAPI_NR_RNTI_SI: + pdcch_params->rnti_type = NFAPI_NR_RNTI_SI; + break; + } + + switch (search_space->css_format_2_0){ + case NFAPI_NR_RNTI_SFI: + pdcch_params->rnti_type = NFAPI_NR_RNTI_SFI; + break; + } + + switch (search_space->css_format_2_1){ + case NFAPI_NR_RNTI_INT: + pdcch_params->rnti_type = NFAPI_NR_RNTI_INT; + break; + } + + switch (search_space->css_format_2_2){ + case NFAPI_NR_RNTI_TPC_PUSCH: + pdcch_params->rnti_type = NFAPI_NR_RNTI_TPC_PUSCH; + break; + case NFAPI_NR_RNTI_TPC_PUCCH: + pdcch_params->rnti_type = NFAPI_NR_RNTI_TPC_PUCCH; + break; + } + + switch (search_space->css_format_2_3){ + case NFAPI_NR_RNTI_TPC_SRS: + pdcch_params->rnti_type = NFAPI_NR_RNTI_TPC_SRS; + break; + } + } + + //Ue_Specific_USS + if (pdcch_params->search_space_type == NFAPI_NR_SEARCH_SPACE_TYPE_UE_SPECIFIC){ + switch (search_space->uss_dci_formats){ + case NFAPI_NR_RNTI_C: + pdcch_params->rnti_type = NFAPI_NR_RNTI_C; + break; + case NFAPI_NR_RNTI_CS: + pdcch_params->rnti_type = NFAPI_NR_RNTI_CS; + break; + case NFAPI_NR_RNTI_SP_CSI: + pdcch_params->rnti_type = NFAPI_NR_RNTI_SP_CSI; + break; + } + } +*/ +} + +int nr_is_dci_opportunity(nfapi_nr_search_space_t search_space, + nfapi_nr_coreset_t coreset, + uint16_t frame, + uint16_t slot, + nfapi_nr_config_request_t cfg) { + + AssertFatal(search_space.coreset_id==coreset.coreset_id, "Invalid association of coreset(%d) and search space(%d)\n", + search_space.search_space_id, coreset.coreset_id); + + uint8_t is_dci_opportunity=0; + uint16_t Ks=search_space.slot_monitoring_periodicity; + uint16_t Os=search_space.slot_monitoring_offset; + uint8_t Ts=search_space.duration; + + if (((frame*get_spf(&cfg) + slot - Os)%Ks)==Ts) + is_dci_opportunity=1; + + return is_dci_opportunity; } int get_dlscs(nfapi_nr_config_request_t *cfg) { @@ -363,3 +530,9 @@ int to_absslot(nfapi_nr_config_request_t *cfg,int frame,int slot) { return(get_spf(cfg)*frame) + slot; } + +int get_symbolsperslot(nfapi_nr_config_request_t *cfg) { + + return ((cfg->subframe_config.dl_cyclic_prefix_type.value==NFAPI_CP_EXTENDED)?12:14); + +} diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index ace4ded426..8750d2819a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -78,10 +78,17 @@ void nr_configure_css_dci_initial(nfapi_nr_dl_config_pdcch_parameters_rel15_t* p uint16_t nb_slots_per_frame, uint16_t N_RB); +int nr_is_dci_opportunity(nfapi_nr_search_space_t search_space, + nfapi_nr_coreset_t coreset, + uint16_t frame, + uint16_t slot, + nfapi_nr_config_request_t cfg); void nr_configure_css_dci_from_pdcch_config(nfapi_nr_dl_config_pdcch_parameters_rel15_t* pdcch_params, nfapi_nr_coreset_t* coreset, - nfapi_nr_search_space_t* search_space); + nfapi_nr_search_space_t* search_space, + nfapi_nr_config_request_t cfg, + uint8_t pdcch_scs); int get_dlscs(nfapi_nr_config_request_t *cfg); @@ -91,4 +98,6 @@ int get_spf(nfapi_nr_config_request_t *cfg); int to_absslot(nfapi_nr_config_request_t *cfg,int frame,int slot); +int get_symbolsperslot(nfapi_nr_config_request_t *cfg); + #endif /*__LAYER2_NR_MAC_PROTO_H__*/