From d8911ff19dddb8353c19d5f0392cf3582354400b Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 4 Mar 2025 18:04:12 +0100 Subject: [PATCH] use slot type for slots in NR --- nfapi/oai_integration/aerial/fapi_vnf_p7.c | 2 +- nfapi/oai_integration/nfapi_vnf.c | 2 +- openair1/SCHED_NR/fapi_nr_l1.c | 2 +- openair1/SIMULATION/NR_PHY/dlsim.c | 2 +- openair2/LAYER2/NR_MAC_UE/mac_proto.h | 5 +- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 28 +++++------ openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 6 +-- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 20 ++++---- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 8 +-- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 10 ++-- .../LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 6 +-- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 8 ++- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 26 +++------- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 24 ++++----- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 50 +++++++++---------- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 12 ++--- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 4 +- 17 files changed, 94 insertions(+), 121 deletions(-) diff --git a/nfapi/oai_integration/aerial/fapi_vnf_p7.c b/nfapi/oai_integration/aerial/fapi_vnf_p7.c index 45f3aa1a05..263df7bd8a 100644 --- a/nfapi/oai_integration/aerial/fapi_vnf_p7.c +++ b/nfapi/oai_integration/aerial/fapi_vnf_p7.c @@ -93,7 +93,7 @@ int aerial_phy_nr_uci_indication(nfapi_nr_uci_indication_t *ind) return 1; } -void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_t slot, NR_Sched_Rsp_t* sched_info); +void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, slot_t slot, NR_Sched_Rsp_t* sched_info); int oai_fapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req); int oai_fapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req); int oai_fapi_tx_data_req(nfapi_nr_tx_data_request_t* tx_data_req); diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index ff4dcfa393..e30c939c83 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -1079,7 +1079,7 @@ int phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_ NR_Sched_Rsp_t g_sched_resp; -void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_t slot, NR_Sched_Rsp_t* sched_info); +void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, slot_t slot, NR_Sched_Rsp_t* sched_info); int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req); int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req); int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t* tx_data_req); diff --git a/openair1/SCHED_NR/fapi_nr_l1.c b/openair1/SCHED_NR/fapi_nr_l1.c index 10512f3f66..80b38182a1 100644 --- a/openair1/SCHED_NR/fapi_nr_l1.c +++ b/openair1/SCHED_NR/fapi_nr_l1.c @@ -202,7 +202,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO) // copy data from L2 interface into L1 structures module_id_t Mod_id = Sched_INFO->module_id; frame_t frame = Sched_INFO->frame; - sub_frame_t slot = Sched_INFO->slot; + slot_t slot = Sched_INFO->slot; AssertFatal(RC.gNB != NULL, "RC.gNB is null\n"); AssertFatal(RC.gNB[Mod_id] != NULL, "RC.gNB[%d] is null\n", Mod_id); diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index d6227e7b7d..9014cd33ef 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -148,7 +148,7 @@ extern void fix_scd(NR_ServingCellConfig_t *scd);// forward declaration /* specific dlsim DL preprocessor: uses rbStart/rbSize/mcs/nrOfLayers from command line of dlsim */ int g_mcsIndex = -1, g_mcsTableIdx = 0, g_rbStart = -1, g_rbSize = -1, g_nrOfLayers = 1, g_pmi = 0; -void nr_dlsim_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t slot) +void nr_dlsim_preprocessor(module_id_t module_id, frame_t frame, slot_t slot) { NR_UE_info_t *UE_info = RC.nrmac[module_id]->UE_info.list[0]; AssertFatal(RC.nrmac[module_id]->UE_info.list[1]==NULL, "can have only a single UE\n"); diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index c2e8fd5885..b7bfa724aa 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -288,10 +288,7 @@ void configure_csi_resource_mapping(fapi_nr_dl_config_csirs_pdu_rel15_t *csirs_c @param @returns void */ -void nr_ue_msg3_scheduler(NR_UE_MAC_INST_t *mac, - frame_t current_frame, - sub_frame_t current_slot, - uint8_t Msg3_tda_id); +void nr_ue_msg3_scheduler(NR_UE_MAC_INST_t *mac, frame_t current_frame, slot_t current_slot, uint8_t Msg3_tda_id); void nr_ue_contention_resolution(NR_UE_MAC_INST_t *mac, int cc_id, frame_t frame, int slot, NR_PRACH_RESOURCES_t *prach_resources); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 846d344584..7abc3af8f2 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -60,7 +60,7 @@ AssertFatal(ret == 0, "Failure in mutex management ret=%d\n", a); \ } -static void nr_ue_prach_scheduler(NR_UE_MAC_INST_t *mac, frame_t frameP, sub_frame_t slotP); +static void nr_ue_prach_scheduler(NR_UE_MAC_INST_t *mac, frame_t frameP, slot_t slotP); static void schedule_ta_command(fapi_nr_dl_config_request_t *dl_config, NR_UE_MAC_INST_t *mac); static void schedule_ntn_config_command(fapi_nr_dl_config_request_t *dl_config, NR_UE_MAC_INST_t *mac); @@ -68,12 +68,12 @@ static void nr_ue_fill_phr(NR_UE_MAC_INST_t *mac, NR_SINGLE_ENTRY_PHR_MAC_CE *phr, float P_CMAX, float tx_power, - frame_t frameP, - sub_frame_t subframe); + frame_t frame, + slot_t slot); static uint8_t nr_ue_get_sdu(NR_UE_MAC_INST_t *mac, int cc_id, - frame_t frameP, - sub_frame_t subframe, + frame_t frame, + slot_t slot, uint8_t gNB_index, uint8_t *ulsch_buffer, const uint32_t buflen, @@ -2829,7 +2829,7 @@ void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot) // PRACH formats 9, 10, 11 are corresponding to dual PRACH format configurations A1/B1, A2/B2, A3/B3. // - todo: // - Partial configuration is actually already stored in (fapi_nr_prach_config_t) &mac->phy_config.config_req->prach_config -static void nr_ue_prach_scheduler(NR_UE_MAC_INST_t *mac, frame_t frameP, sub_frame_t slotP) +static void nr_ue_prach_scheduler(NR_UE_MAC_INST_t *mac, frame_t frameP, slot_t slotP) { RA_config_t *ra = &mac->ra; ra->RA_offset = 2; // to compensate the rx frame offset at the gNB @@ -3045,8 +3045,8 @@ typedef struct { static void nr_ue_get_sdu_mac_ce_pre(NR_UE_MAC_INST_t *mac, int CC_id, - frame_t frameP, - sub_frame_t subframe, + frame_t frame, + slot_t slot, uint8_t gNB_index, uint8_t *ulsch_buffer, uint32_t buflen, @@ -3086,7 +3086,7 @@ static void nr_ue_get_sdu_mac_ce_pre(NR_UE_MAC_INST_t *mac, if (buflen >= bsr_len + needed) { if (mac->scheduling_info.phr_info.phr_reporting) { mac_ce_p->phr_len = needed; - nr_ue_fill_phr(mac, &mac_ce_p->phr, P_CMAX, tx_power, frameP, subframe); + nr_ue_fill_phr(mac, &mac_ce_p->phr, P_CMAX, tx_power, frame, slot); } } } @@ -3638,8 +3638,8 @@ static void nr_ue_fill_phr(NR_UE_MAC_INST_t *mac, NR_SINGLE_ENTRY_PHR_MAC_CE *phr, float P_CMAX, float tx_power, - frame_t frameP, - sub_frame_t subframe) + frame_t frame, + slot_t slot) { nr_phr_info_t *phr_info = &mac->scheduling_info.phr_info; // Value mapping according to 38.133 10.1.18.1 @@ -3656,9 +3656,9 @@ static void nr_ue_fill_phr(NR_UE_MAC_INST_t *mac, } LOG_D(NR_MAC, - "PHR Reporting sfn.subframe %d.%d reason = %d, P_CMAX = %d (%5.2f dBm), headrom = %d (%d dB) tx_power = %5.2f dBm\n", - frameP, - subframe, + "PHR Reporting sfn.slot %d.%d reason = %d, P_CMAX = %d (%5.2f dBm), headrom = %d (%d dB) tx_power = %5.2f dBm\n", + frame, + slot, phr_info->phr_reporting, phr->PCMAX, P_CMAX, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index d3455ad8e8..909672d848 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -58,7 +58,7 @@ const uint8_t nr_rv_round_map[4] = {0, 2, 3, 1}; void clear_nr_nfapi_information(gNB_MAC_INST *gNB, int CC_idP, frame_t frameP, - sub_frame_t slotP, + slot_t slotP, nfapi_nr_dl_tti_request_t *DL_req, nfapi_nr_tx_data_request_t *TX_req, nfapi_nr_ul_dci_request_t *UL_dci_req) @@ -156,7 +156,7 @@ static void copy_ul_tti_req(nfapi_nr_ul_tti_request_t *to, nfapi_nr_ul_tti_reque to->groups_list[i] = from->groups_list[i]; } -void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_t slot, NR_Sched_Rsp_t *sched_info) +void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, slot_t slot, NR_Sched_Rsp_t *sched_info) { protocol_ctxt_t ctxt = {0}; PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, NOT_A_RNTI, frame, slot,module_idP); @@ -229,7 +229,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_ (schedule_nr_prach will assert if resources are not free). */ const int n_slots_ahead = slots_frame - cc->prach_len + get_NTN_Koffset(scc); const frame_t f = (frame + (slot + n_slots_ahead) / slots_frame) % 1024; - const sub_frame_t s = (slot + n_slots_ahead) % slots_frame; + const slot_t s = (slot + n_slots_ahead) % slots_frame; schedule_nr_prach(module_idP, f, s); } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 6e776b123a..0160fbd4a9 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -65,7 +65,7 @@ static const float ssb_per_rach_occasion[8] = {0.125, 0.25, 0.5, 1, 2, 4, 8}; static int16_t ssb_index_from_prach(module_id_t module_idP, frame_t frameP, - sub_frame_t slotP, + slot_t slotP, uint16_t preamble_index, uint8_t freq_index, uint8_t symbol) @@ -256,7 +256,7 @@ static void schedule_nr_MsgA_pusch(NR_UplinkConfigCommon_t *uplinkConfigCommon, gNB_MAC_INST *nr_mac, module_id_t module_idP, frame_t frameP, - sub_frame_t slotP, + slot_t slotP, nfapi_nr_prach_pdu_t *prach_pdu, uint16_t dmrs_TypeA_Position, NR_PhysCellId_t physCellId) @@ -357,7 +357,7 @@ static void schedule_nr_MsgA_pusch(NR_UplinkConfigCommon_t *uplinkConfigCommon, } static void fill_vrb(const frame_t frame, - const sub_frame_t slot, + const slot_t slot, int nb_rb, int beam_idx, int vrb_size, @@ -377,7 +377,7 @@ static void fill_vrb(const frame_t frame, } } -void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) +void schedule_nr_prach(module_id_t module_idP, frame_t frameP, slot_t slotP) { gNB_MAC_INST *gNB = RC.nrmac[module_idP]; /* already mutex protected: held in gNB_dlsch_ulsch_scheduler() */ @@ -827,7 +827,7 @@ static void start_ra_contention_resolution_timer(NR_RA_t *ra, const long ra_Cont static void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t frame, - sub_frame_t slot, + slot_t slot, NR_RA_t *ra, nfapi_nr_ul_dci_request_t *ul_dci_req) { @@ -1228,7 +1228,7 @@ static void fill_msg3_pusch_pdu(nfapi_nr_pusch_pdu_t *pusch_pdu, } } -static void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP, NR_RA_t *ra, uint8_t *RAR_pdu) +static void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, slot_t slotP, NR_RA_t *ra, uint8_t *RAR_pdu) { gNB_MAC_INST *mac = RC.nrmac[module_idP]; NR_COMMON_channels_t *cc = &mac->common_channels[CC_id]; @@ -1436,7 +1436,7 @@ static bool msg2_in_response_window(int rach_frame, static void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, - sub_frame_t slotP, + slot_t slotP, NR_RA_t *ra, nfapi_nr_dl_tti_request_t *DL_req, nfapi_nr_tx_data_request_t *TX_req) @@ -1994,7 +1994,7 @@ static void prepare_dl_pdus(gNB_MAC_INST *nr_mac, static void nr_generate_Msg4_MsgB(module_id_t module_idP, int CC_id, frame_t frameP, - sub_frame_t slotP, + slot_t slotP, NR_RA_t *ra, nfapi_nr_dl_tti_request_t *DL_req, nfapi_nr_tx_data_request_t *TX_req) @@ -2319,7 +2319,7 @@ static void nr_generate_Msg4_MsgB(module_id_t module_idP, } } -static void nr_check_Msg4_MsgB_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t slot, NR_RA_t *ra) +static void nr_check_Msg4_MsgB_Ack(module_id_t module_id, int CC_id, frame_t frame, slot_t slot, NR_RA_t *ra) { const char *ra_type_str = ra->ra_type == RA_2_STEP ? "MsgB" : "Msg4"; NR_UE_info_t *UE = find_nr_UE(&RC.nrmac[module_id]->UE_info, ra->rnti); @@ -2496,7 +2496,7 @@ static void nr_fill_rar(uint8_t Mod_idP, NR_RA_t *ra, uint8_t *dlsch_buffer, nfa void nr_schedule_RA(module_id_t module_idP, frame_t frameP, - sub_frame_t slotP, + slot_t slotP, nfapi_nr_ul_dci_request_t *ul_dci_req, nfapi_nr_dl_tti_request_t *DL_req, nfapi_nr_tx_data_request_t *TX_req) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 3987a04a54..491c3b6e61 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -46,7 +46,7 @@ #include "executables/softmodem-common.h" static void schedule_ssb(frame_t frame, - sub_frame_t slot, + slot_t slot, NR_ServingCellConfigCommon_t *scc, nfapi_nr_dl_tti_request_body_t *dl_req, int i_ssb, @@ -115,7 +115,7 @@ static int encode_mib(NR_BCCH_BCH_Message_t *mib, frame_t frame, uint8_t *buffer return encode_size; } -void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, nfapi_nr_dl_tti_request_t *DL_req) +void schedule_nr_mib(module_id_t module_idP, frame_t frameP, slot_t slotP, nfapi_nr_dl_tti_request_t *DL_req) { gNB_MAC_INST *gNB = RC.nrmac[module_idP]; /* already mutex protected: held in gNB_dlsch_ulsch_scheduler() */ @@ -658,7 +658,7 @@ static void nr_fill_nfapi_dl_SIB_pdu(int Mod_idP, void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, - sub_frame_t slotP, + slot_t slotP, nfapi_nr_dl_tti_request_t *DL_req, nfapi_nr_tx_data_request_t *TX_req) { @@ -785,7 +785,7 @@ struct NR_SchedulingInfo2_r17 *find_sib19_sched_info(const struct NR_SI_Scheduli void schedule_nr_sib19(module_id_t module_idP, frame_t frameP, - sub_frame_t slotP, + slot_t slotP, nfapi_nr_dl_tti_request_t *DL_req, nfapi_nr_tx_data_request_t *TX_req, int sib19_bcch_length, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index ad6ac974a7..ae50538968 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -322,7 +322,7 @@ int nr_write_ce_dlsch_pdu(module_id_t module_idP, return offset; } -static void nr_store_dlsch_buffer(module_id_t module_id, frame_t frame, sub_frame_t slot) +static void nr_store_dlsch_buffer(module_id_t module_id, frame_t frame, slot_t slot) { UE_iterator(RC.nrmac[module_id]->UE_info.list, UE) { NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; @@ -426,7 +426,7 @@ static dl_bwp_info_t get_bwp_start_size(gNB_MAC_INST *mac, NR_UE_info_t *UE) static bool allocate_dl_retransmission(module_id_t module_id, frame_t frame, - sub_frame_t slot, + slot_t slot, int *n_rb_sched, NR_UE_info_t *UE, int beam_idx, @@ -600,7 +600,7 @@ static int comparator(const void *p, const void *q) { static void pf_dl(module_id_t module_id, frame_t frame, - sub_frame_t slot, + slot_t slot, NR_UE_info_t **UE_list, int max_num_ue, int num_beams, @@ -870,7 +870,7 @@ static void pf_dl(module_id_t module_id, } } -static void nr_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t slot) +static void nr_dlsch_preprocessor(module_id_t module_id, frame_t frame, slot_t slot) { gNB_MAC_INST *mac = RC.nrmac[module_id]; NR_UEs_t *UE_info = &mac->UE_info; @@ -928,7 +928,7 @@ nr_pp_impl_dl nr_init_dlsch_preprocessor(int CC_id) { void nr_schedule_ue_spec(module_id_t module_id, frame_t frame, - sub_frame_t slot, + slot_t slot, nfapi_nr_dl_tti_request_t *DL_req, nfapi_nr_tx_data_request_t *TX_req) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 4ca121f824..36b9a5fd39 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -43,7 +43,7 @@ /* This function checks whether the given Dl/UL slot is set in the input bitmap (per period), which is a mask indicating in which slot to transmit (among those available in the TDD configuration) */ -static bool is_xlsch_in_slot(uint64_t bitmap, sub_frame_t slot) +static bool is_xlsch_in_slot(uint64_t bitmap, slot_t slot) { AssertFatal(slot < 64, "Unable to handle periods with length larger than 64 slots in phy-test mode\n"); return (bitmap >> slot) & 0x01; @@ -55,7 +55,7 @@ uint32_t target_dl_bw = 50; uint64_t dlsch_slot_bitmap = (1<<1); /* schedules whole bandwidth for first user, all the time */ -void nr_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_t slot) +void nr_preprocessor_phytest(module_id_t module_id, frame_t frame, slot_t slot) { gNB_MAC_INST *mac = RC.nrmac[module_id]; /* already mutex protected: held in gNB_dlsch_ulsch_scheduler() */ @@ -217,7 +217,7 @@ uint32_t target_ul_mcs = 9; uint32_t target_ul_bw = 50; uint32_t target_ul_Nl = 1; uint64_t ulsch_slot_bitmap = (1 << 8); -bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_t slot) +bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, slot_t slot) { gNB_MAC_INST *nr_mac = RC.nrmac[module_id]; /* already mutex protected: held in gNB_dlsch_ulsch_scheduler() */ diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index e8acad7902..d71145e250 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2777,7 +2777,7 @@ int get_pdsch_to_harq_feedback(NR_PUCCH_Config_t *pucch_Config, } } -void nr_csirs_scheduling(int Mod_idP, frame_t frame, sub_frame_t slot, nfapi_nr_dl_tti_request_t *DL_req) +void nr_csirs_scheduling(int Mod_idP, frame_t frame, slot_t slot, nfapi_nr_dl_tti_request_t *DL_req) { int CC_id = 0; NR_UEs_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; @@ -3038,7 +3038,7 @@ static void nr_mac_clean_cellgroup(NR_CellGroupConfig_t *cell_group) free_and_zero(cell_group->rlc_BearerToAddModList->list.array[i]->reestablishRLC); } -static void nr_mac_apply_cellgroup(gNB_MAC_INST *mac, NR_UE_info_t *UE, frame_t frame, sub_frame_t slot) +static void nr_mac_apply_cellgroup(gNB_MAC_INST *mac, NR_UE_info_t *UE, frame_t frame, slot_t slot) { LOG_D(NR_MAC, "%4d.%2d RNTI %04x: UE inactivity timer expired\n", frame, slot, UE->rnti); @@ -3141,9 +3141,7 @@ void nr_mac_release_ue(gNB_MAC_INST *mac, int rnti) mac_remove_nr_ue(mac, rnti); } -void nr_mac_update_timers(module_id_t module_id, - frame_t frame, - sub_frame_t slot) +void nr_mac_update_timers(module_id_t module_id, frame_t frame, slot_t slot) { gNB_MAC_INST *mac = RC.nrmac[module_id]; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index e541fdfc68..e4ca7612a0 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -33,11 +33,7 @@ #include "common/ran_context.h" #include "common/utils/nr/nr_common.h" #include "nfapi/oai_integration/vendor_ext.h" -static void nr_fill_nfapi_pucch(gNB_MAC_INST *nrmac, - frame_t frame, - sub_frame_t slot, - const NR_sched_pucch_t *pucch, - NR_UE_info_t* UE) +static void nr_fill_nfapi_pucch(gNB_MAC_INST *nrmac, frame_t frame, slot_t slot, const NR_sched_pucch_t *pucch, NR_UE_info_t* UE) { const int index = ul_buffer_index(pucch->frame, @@ -176,7 +172,7 @@ static int get_pucch_index(int frame, int slot, const frame_structure_t *fs, int return (frame_start + ul_period_start + ul_period_slot) % sched_pucch_size; } -void nr_schedule_pucch(gNB_MAC_INST *nrmac, frame_t frameP, sub_frame_t slotP) +void nr_schedule_pucch(gNB_MAC_INST *nrmac, frame_t frameP, slot_t slotP) { /* already mutex protected: held in gNB_dlsch_ulsch_scheduler() */ NR_SCHED_ENSURE_LOCKED(&nrmac->sched_lock); @@ -212,7 +208,7 @@ void nr_schedule_pucch(gNB_MAC_INST *nrmac, frame_t frameP, sub_frame_t slotP) } } -void nr_csi_meas_reporting(int Mod_idP,frame_t frame, sub_frame_t slot) +void nr_csi_meas_reporting(int Mod_idP,frame_t frame, slot_t slot) { const int CC_id = 0; gNB_MAC_INST *nrmac = RC.nrmac[Mod_idP]; @@ -721,7 +717,7 @@ static void extract_pucch_csi_report(NR_CSI_MeasConfig_t *csi_MeasConfig, } } -static NR_UE_harq_t *find_harq(frame_t frame, sub_frame_t slot, NR_UE_info_t * UE, int harq_round_max) +static NR_UE_harq_t *find_harq(frame_t frame, slot_t slot, NR_UE_info_t * UE, int harq_round_max) { /* In case of realtime problems: we can only identify a HARQ process by * timing. If the HARQ process's feedback_frame/feedback_slot is not the one we @@ -769,10 +765,7 @@ static NR_UE_harq_t *find_harq(frame_t frame, sub_frame_t slot, NR_UE_info_t * U return harq; } -void handle_nr_uci_pucch_0_1(module_id_t mod_id, - frame_t frame, - sub_frame_t slot, - const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01) +void handle_nr_uci_pucch_0_1(module_id_t mod_id, frame_t frame, slot_t slot, const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01) { gNB_MAC_INST *nrmac = RC.nrmac[mod_id]; int rssi_threshold = nrmac->pucch_rssi_threshold; @@ -827,10 +820,7 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id, NR_SCHED_UNLOCK(&nrmac->sched_lock); } -void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, - frame_t frame, - sub_frame_t slot, - const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234) +void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, frame_t frame, slot_t slot, const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234) { gNB_MAC_INST *nrmac = RC.nrmac[mod_id]; NR_SCHED_LOCK(&nrmac->sched_lock); @@ -1001,7 +991,7 @@ bool check_bits_vs_coderate_limit(NR_PUCCH_Config_t *pucch_Config, int O_uci, in int nr_acknack_scheduling(gNB_MAC_INST *mac, NR_UE_info_t *UE, frame_t frame, - sub_frame_t slot, + slot_t slot, int ue_beam, int r_pucch, int is_common) @@ -1138,7 +1128,7 @@ int nr_acknack_scheduling(gNB_MAC_INST *mac, } -void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t SFN, sub_frame_t slot) +void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t SFN, slot_t slot) { /* already mutex protected: held in gNB_dlsch_ulsch_scheduler() */ NR_SCHED_ENSURE_LOCKED(&nrmac->sched_lock); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index dcb7bb2cb1..f40c863bcb 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -266,7 +266,7 @@ static int nr_process_mac_pdu(instance_t module_idP, NR_UE_info_t *UE, uint8_t CC_id, frame_t frameP, - sub_frame_t slot, + slot_t slot, uint8_t *pduP, uint32_t pdu_len, const int8_t harq_pid) @@ -575,7 +575,7 @@ static void abort_nr_ul_harq(NR_UE_info_t *UE, int8_t harq_pid) static bool get_UE_waiting_CFRA_msg3(const gNB_MAC_INST *gNB_mac, const int CC_id, const frame_t frame, - const sub_frame_t slot, + const slot_t slot, rnti_t rnti) { bool UE_waiting_CFRA_msg3 = false; @@ -589,11 +589,7 @@ static bool get_UE_waiting_CFRA_msg3(const gNB_MAC_INST *gNB_mac, return UE_waiting_CFRA_msg3; } -void handle_nr_ul_harq(const int CC_idP, - module_id_t mod_id, - frame_t frame, - sub_frame_t slot, - const nfapi_nr_crc_t *crc_pdu) +void handle_nr_ul_harq(const int CC_idP, module_id_t mod_id, frame_t frame, slot_t slot, const nfapi_nr_crc_t *crc_pdu) { gNB_MAC_INST *nrmac = RC.nrmac[mod_id]; if (nrmac->radio_config.disable_harq) { @@ -696,7 +692,7 @@ static void handle_msg3_failed_rx(NR_RA_t *ra, int i, int harq_round_max) static void _nr_rx_sdu(const module_id_t gnb_mod_idP, const int CC_idP, const frame_t frameP, - const sub_frame_t slotP, + const slot_t slotP, const rnti_t rntiP, uint8_t *sduP, const uint32_t sdu_lenP, @@ -1006,7 +1002,7 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP, void nr_rx_sdu(const module_id_t gnb_mod_idP, const int CC_idP, const frame_t frameP, - const sub_frame_t slotP, + const slot_t slotP, const rnti_t rntiP, uint8_t *sduP, const uint32_t sdu_lenP, @@ -1352,7 +1348,7 @@ static int nr_srs_tpmi_estimation(const NR_PUSCH_Config_t *pusch_Config, void handle_nr_srs_measurements(const module_id_t module_id, const frame_t frame, - const sub_frame_t slot, + const slot_t slot, nfapi_nr_srs_indication_pdu_t *srs_ind) { gNB_MAC_INST *nrmac = RC.nrmac[module_id]; @@ -1524,7 +1520,7 @@ long get_K2(NR_PUSCH_TimeDomainResourceAllocationList_t *tdaList, static bool nr_UE_is_to_be_scheduled(const frame_structure_t *fs, NR_UE_info_t *UE, frame_t frame, - sub_frame_t slot, + slot_t slot, uint32_t ulsch_max_frame_inactivity) { const int n = fs->numb_slots_frame; @@ -1645,7 +1641,7 @@ static void nr_ue_max_mcs_min_rb(int mu, static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac, frame_t frame, - sub_frame_t slot, + slot_t slot, uint16_t *rballoc_mask, int *n_rb_sched, int dci_beam_idx, @@ -2198,7 +2194,7 @@ static void pf_ul(module_id_t module_id, } } -static bool nr_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t slot) +static bool nr_ulsch_preprocessor(module_id_t module_id, frame_t frame, slot_t slot) { gNB_MAC_INST *nr_mac = RC.nrmac[module_id]; // no UEs @@ -2266,7 +2262,7 @@ nr_pp_impl_ul nr_init_ulsch_preprocessor(int CC_id) return nr_ulsch_preprocessor; } -void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot, nfapi_nr_ul_dci_request_t *ul_dci_req) +void nr_schedule_ulsch(module_id_t module_id, frame_t frame, slot_t slot, nfapi_nr_ul_dci_request_t *ul_dci_req) { gNB_MAC_INST *nr_mac = RC.nrmac[module_id]; /* already mutex protected: held in gNB_dlsch_ulsch_scheduler() */ diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index a138d41b1a..f54f7fb5fd 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -70,23 +70,21 @@ int nr_transmission_action_indicator_stop(gNB_MAC_INST *mac, NR_UE_info_t *UE_in void clear_nr_nfapi_information(gNB_MAC_INST *gNB, int CC_idP, frame_t frameP, - sub_frame_t slotP, + slot_t slotP, nfapi_nr_dl_tti_request_t *DL_req, nfapi_nr_tx_data_request_t *TX_req, nfapi_nr_ul_dci_request_t *UL_dci_req); -void nr_mac_update_timers(module_id_t module_id, - frame_t frame, - sub_frame_t slot); +void nr_mac_update_timers(module_id_t module_id, frame_t frame, slot_t slot); -void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame_rxP, sub_frame_t slot_rxP, NR_Sched_Rsp_t *sched_info); +void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame_rxP, slot_t slot_rxP, NR_Sched_Rsp_t *sched_info); /* \brief main DL scheduler function. Calls a preprocessor to decide on * resource allocation, then "post-processes" resource allocation (nFAPI * messages, statistics, HARQ handling, CEs, ... */ void nr_schedule_ue_spec(module_id_t module_id, frame_t frame, - sub_frame_t slot, + slot_t slot, nfapi_nr_dl_tti_request_t *DL_req, nfapi_nr_tx_data_request_t *TX_req); @@ -95,13 +93,13 @@ nr_pp_impl_dl nr_init_dlsch_preprocessor(int CC_id); void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, - sub_frame_t slotP, + slot_t slotP, nfapi_nr_dl_tti_request_t *DL_req, nfapi_nr_tx_data_request_t *TX_req); void schedule_nr_sib19(module_id_t module_idP, frame_t frameP, - sub_frame_t slotP, + slot_t slotP, nfapi_nr_dl_tti_request_t *DL_req, nfapi_nr_tx_data_request_t *TX_req, int sib19_bcch_length, @@ -109,12 +107,12 @@ void schedule_nr_sib19(module_id_t module_idP, struct NR_SchedulingInfo2_r17* find_sib19_sched_info(const struct NR_SI_SchedulingInfo_v1700*); -void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, nfapi_nr_dl_tti_request_t *DL_req); +void schedule_nr_mib(module_id_t module_idP, frame_t frameP, slot_t slotP, nfapi_nr_dl_tti_request_t *DL_req); /* \brief main UL scheduler function. Calls a preprocessor to decide on * resource allocation, then "post-processes" resource allocation (nFAPI * messages, statistics, HARQ handling, ... */ -void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot, nfapi_nr_ul_dci_request_t *ul_dci_req); +void nr_schedule_ulsch(module_id_t module_id, frame_t frame, slot_t slot, nfapi_nr_ul_dci_request_t *ul_dci_req); /* \brief default UL preprocessor init routine, returns preprocessor to call */ nr_pp_impl_ul nr_init_ulsch_preprocessor(int CC_id); @@ -123,7 +121,7 @@ nr_pp_impl_ul nr_init_ulsch_preprocessor(int CC_id); void nr_schedule_RA(module_id_t module_idP, frame_t frameP, - sub_frame_t slotP, + slot_t slotP, nfapi_nr_ul_dci_request_t *ul_dci_req, nfapi_nr_dl_tti_request_t *DL_req, nfapi_nr_tx_data_request_t *TX_req); @@ -140,9 +138,9 @@ void nr_initiate_ra_proc(module_id_t module_idP, void nr_clear_ra_proc(NR_RA_t *ra); -int nr_allocate_CCEs(int module_idP, int CC_idP, frame_t frameP, sub_frame_t slotP, int test_only); +int nr_allocate_CCEs(int module_idP, int CC_idP, frame_t frameP, slot_t slotP, int test_only); -void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP); +void schedule_nr_prach(module_id_t module_idP, frame_t frameP, slot_t slotP); uint16_t nr_mac_compute_RIV(uint16_t N_RB_DL, uint16_t RBstart, uint16_t Lcrbs); @@ -150,18 +148,18 @@ uint16_t nr_mac_compute_RIV(uint16_t N_RB_DL, uint16_t RBstart, uint16_t Lcrbs); /* \brief preprocessor for phytest: schedules UE_id 0 with fixed MCS on all * freq resources */ -void nr_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_t slot); +void nr_preprocessor_phytest(module_id_t module_id, frame_t frame, slot_t slot); /* \brief UL preprocessor for phytest: schedules UE_id 0 with fixed MCS on a * fixed set of resources */ -bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_t slot); +bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, slot_t slot); void handle_nr_uci_pucch_0_1(module_id_t mod_id, frame_t frame, - sub_frame_t slot, + slot_t slot, const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01); void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, frame_t frame, - sub_frame_t slot, + slot_t slot, const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234); void config_uldci(const NR_UE_ServingCell_Info_t *sc_info, @@ -174,9 +172,7 @@ void config_uldci(const NR_UE_ServingCell_Info_t *sc_info, uint8_t ndi, NR_UE_UL_BWP_t *ul_bwp); -void nr_schedule_pucch(gNB_MAC_INST *nrmac, - frame_t frameP, - sub_frame_t slotP); +void nr_schedule_pucch(gNB_MAC_INST *nrmac, frame_t frameP, slot_t slotP); void nr_srs_ri_computation(const nfapi_nr_srs_normalized_channel_iq_matrix_t *nr_srs_normalized_channel_iq_matrix, const NR_UE_UL_BWP_t *current_BWP, @@ -186,14 +182,14 @@ int get_pucch_resourceid(NR_PUCCH_Config_t *pucch_Config, int O_uci, int pucch_r void nr_schedule_srs(int module_id, frame_t frame, int slot); -void nr_csirs_scheduling(int Mod_idP, frame_t frame, sub_frame_t slot, nfapi_nr_dl_tti_request_t *DL_req); +void nr_csirs_scheduling(int Mod_idP, frame_t frame, slot_t slot, nfapi_nr_dl_tti_request_t *DL_req); -void nr_csi_meas_reporting(int Mod_idP, frame_t frameP, sub_frame_t slotP); +void nr_csi_meas_reporting(int Mod_idP, frame_t frameP, slot_t slotP); int nr_acknack_scheduling(gNB_MAC_INST *mac, NR_UE_info_t *UE, frame_t frameP, - sub_frame_t slotP, + slot_t slotP, int beam_index, int r_pucch, int do_common); @@ -360,7 +356,7 @@ int binomial(int n, int k); void nr_rx_sdu(const module_id_t gnb_mod_idP, const int CC_idP, const frame_t frameP, - const sub_frame_t subframeP, + const slot_t subframeP, const rnti_t rntiP, uint8_t * sduP, const uint32_t sdu_lenP, @@ -380,7 +376,7 @@ void reset_ul_harq_list(NR_UE_sched_ctrl_t *sched_ctrl); void handle_nr_ul_harq(const int CC_idP, module_id_t mod_id, frame_t frame, - sub_frame_t slot, + slot_t slot, const nfapi_nr_crc_t *crc_pdu); uint8_t *allocate_transportBlock_buffer(byte_array_t *tb, uint32_t needed); @@ -388,7 +384,7 @@ void free_transportBlock_buffer(byte_array_t *tb); void handle_nr_srs_measurements(const module_id_t module_id, const frame_t frame, - const sub_frame_t slot, + const slot_t slot, nfapi_nr_srs_indication_pdu_t *srs_ind); void find_SSB_and_RO_available(gNB_MAC_INST *nrmac); @@ -451,7 +447,7 @@ int get_fapi_beamforming_index(gNB_MAC_INST *mac, int ssb_idx); NR_beam_alloc_t beam_allocation_procedure(NR_beam_info_t *beam_info, int frame, int slot, int beam_index, int slots_per_frame); void reset_beam_status(NR_beam_info_t *beam_info, int frame, int slot, int beam_index, int slots_per_frame, bool new_beam); void beam_selection_procedures(gNB_MAC_INST *mac, NR_UE_info_t *UE); -void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t frameP, sub_frame_t slotP); +void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t frameP, slot_t slotP); size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset_rsrp); diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 218831d8c3..8e49c6f941 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -213,7 +213,7 @@ typedef struct { /// Frame where Msg2 is to be sent frame_t Msg2_frame; /// Subframe where Msg3 is to be sent - sub_frame_t Msg3_slot; + slot_t Msg3_slot; /// Frame where Msg3 is to be sent frame_t Msg3_frame; /// Msg3 time domain allocation index @@ -623,7 +623,7 @@ typedef struct { /// For UL synchronization: store last UL scheduling grant frame_t last_ul_frame; - sub_frame_t last_ul_slot; + slot_t last_ul_slot; /// total amount of data awaiting for this UE uint32_t num_total_bytes; @@ -798,12 +798,8 @@ typedef struct { #define UE_iterator(BaSe, VaR) NR_UE_info_t ** VaR##pptr=BaSe, *VaR; while ((VaR=*(VaR##pptr++))) -typedef void (*nr_pp_impl_dl)(module_id_t mod_id, - frame_t frame, - sub_frame_t slot); -typedef bool (*nr_pp_impl_ul)(module_id_t mod_id, - frame_t frame, - sub_frame_t slot); +typedef void (*nr_pp_impl_dl)(module_id_t mod_id, frame_t frame, slot_t slot); +typedef bool (*nr_pp_impl_ul)(module_id_t mod_id, frame_t frame, slot_t slot); typedef struct f1_config_t { f1ap_setup_req_t *setup_req; diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index aac556575d..666b691951 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -99,7 +99,7 @@ static void handle_nr_uci(NR_UL_IND_t *UL_info) const module_id_t mod_id = UL_info->module_id; const frame_t frame = UL_info->uci_ind.sfn; - const sub_frame_t slot = UL_info->uci_ind.slot; + const slot_t slot = UL_info->uci_ind.slot; int num_ucis = UL_info->uci_ind.num_ucis; nfapi_nr_uci_t *uci_list = UL_info->uci_ind.uci_list; @@ -225,7 +225,7 @@ static void handle_nr_srs(NR_UL_IND_t *UL_info) const module_id_t module_id = UL_info->module_id; const frame_t frame = UL_info->srs_ind.sfn; - const sub_frame_t slot = UL_info->srs_ind.slot; + const slot_t slot = UL_info->srs_ind.slot; const int num_srs = UL_info->srs_ind.number_of_pdus; nfapi_nr_srs_indication_pdu_t *srs_list = UL_info->srs_ind.pdu_list;