diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index 71bda06800..c01637c558 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -46,6 +46,7 @@ #include "common/ran_context.h" #include "openair2/PHY_INTERFACE/queue_t.h" #include "gnb_ind_vars.h" +#include "LAYER2/MAC/mac.h" #define TEST diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h index a39376ae25..dbdc437af8 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h @@ -59,7 +59,7 @@ // Definitions for MAC control and data #define NR_BCCH_DL_SCH 3 // SI #define NR_BCCH_BCH 5 // MIB -#define CCCH_PAYLOAD_SIZE_MAX 512 +#define NR_CCCH_PAYLOAD_SIZE_MAX 512 #define RAR_PAYLOAD_SIZE_MAX 128 #define MAX_CSI_REPORTCONFIG 48 diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 1b786af544..e98cd687be 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -45,7 +45,6 @@ /* MAC */ #include "LAYER2/NR_MAC_COMMON/nr_mac.h" #include "LAYER2/NR_MAC_COMMON/nr_mac_common.h" -#include "LAYER2/MAC/mac.h" #include "NR_MAC_COMMON/nr_mac_extern.h" #include "mac_defs_sl.h" @@ -181,7 +180,7 @@ typedef struct { // after multiplexing buffer remain for each lcid int32_t LCID_buffer_remain; // buffer status for each lcid - uint8_t LCID_status; + bool LCID_buffer_with_data; // logical channel group id of this LCID long LCGID; // Bj bucket usage per lcid @@ -445,6 +444,11 @@ typedef struct nr_lcordered_info_s { uint32_t bucket_size; } nr_lcordered_info_t; + +typedef struct { + uint8_t payload[NR_CCCH_PAYLOAD_SIZE_MAX]; +} __attribute__ ((__packed__)) NR_CCCH_PDU; + typedef struct { NR_SearchSpace_t *otherSI_SS; NR_SearchSpace_t *ra_SS; diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index f2f625b79c..c7e43e50f8 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -95,13 +95,13 @@ void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac) // set init value 0xFFFF, make sure periodic timer and retx time counters are NOT active, after bsr transmission set the value // configured by the NW. - mac->scheduling_info.periodicBSR_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->scheduling_info.periodicBSR_SF = NR_MAC_UE_BSR_TIMER_NOT_RUNNING; + mac->scheduling_info.retxBSR_SF = NR_MAC_UE_BSR_TIMER_NOT_RUNNING; + mac->BSR_reporting_active = NR_BSR_TRIGGER_NONE; for (int i = 0; i < NR_MAX_NUM_LCID; i++) { LOG_D(NR_MAC, "Applying default logical channel config for LCGID %d\n", i); - mac->scheduling_info.lc_sched_info[i].LCID_status = LCID_EMPTY; + mac->scheduling_info.lc_sched_info[i].LCID_buffer_with_data = false; mac->scheduling_info.lc_sched_info[i].LCID_buffer_remain = 0; mac->scheduling_info.lc_sched_info[i].Bj = 0; } diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index dc5da31ca9..02b4d38453 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -1147,12 +1147,12 @@ void nr_ue_ul_scheduler(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info) // First check ReTxBSR Timer because it is always configured // Decrement ReTxBSR Timer if it is running and not null - if ((mac->scheduling_info.retxBSR_SF != MAC_UE_BSR_TIMER_NOT_RUNNING) && (mac->scheduling_info.retxBSR_SF != 0)) { + if ((mac->scheduling_info.retxBSR_SF != NR_MAC_UE_BSR_TIMER_NOT_RUNNING) && (mac->scheduling_info.retxBSR_SF != 0)) { mac->scheduling_info.retxBSR_SF--; } // Decrement Periodic Timer if it is running and not null - if ((mac->scheduling_info.periodicBSR_SF != MAC_UE_BSR_TIMER_NOT_RUNNING) && (mac->scheduling_info.periodicBSR_SF != 0)) { + if ((mac->scheduling_info.periodicBSR_SF != NR_MAC_UE_BSR_TIMER_NOT_RUNNING) && (mac->scheduling_info.periodicBSR_SF != 0)) { mac->scheduling_info.periodicBSR_SF--; } @@ -1194,7 +1194,7 @@ bool nr_update_bsr(NR_UE_MAC_INST_t *mac, frame_t frameP, slot_t slotP, uint8_t for (int lcid = 1; lcid <= NR_MAX_NUM_LCID; lcid++) { // Reset transmission status lcid_bytes_in_buffer[lcid - 1] = 0; - mac->scheduling_info.lc_sched_info[lcid - 1].LCID_status = LCID_EMPTY; + mac->scheduling_info.lc_sched_info[lcid - 1].LCID_buffer_with_data = false; } for (int lcgid = 0; lcgid < NR_MAX_NUM_LCGID; lcgid++) { @@ -1235,7 +1235,7 @@ bool nr_update_bsr(NR_UE_MAC_INST_t *mac, frame_t frameP, slot_t slotP, uint8_t rlc_status.bytes_in_buffer, frameP, slotP); - mac->scheduling_info.lc_sched_info[lcid - 1].LCID_status = LCID_NOT_EMPTY; + mac->scheduling_info.lc_sched_info[lcid - 1].LCID_buffer_with_data = true; //Update BSR_bytes and position in lcid_reordered_array only if Group is defined if (lcgid < NR_MAX_NUM_LCGID) { @@ -2693,7 +2693,7 @@ static int nr_ue_get_sdu_mac_ce_pre(NR_UE_MAC_INST_t *mac, } //Restart ReTxBSR Timer at new grant indication (38.321) - if (mac->scheduling_info.retxBSR_SF != MAC_UE_BSR_TIMER_NOT_RUNNING) { + if (mac->scheduling_info.retxBSR_SF != NR_MAC_UE_BSR_TIMER_NOT_RUNNING) { mac->scheduling_info.retxBSR_SF = nr_get_sf_retxBSRTimer(mac->scheduling_info.retxBSR_Timer); } @@ -2918,7 +2918,7 @@ static void nr_ue_get_sdu_mac_ce_post(NR_UE_MAC_INST_t *mac, } // Reset BSR Trigger flags - mac->BSR_reporting_active = BSR_TRIGGER_NONE; + mac->BSR_reporting_active = NR_BSR_TRIGGER_NONE; } } @@ -3242,7 +3242,7 @@ uint8_t nr_ue_get_sdu(NR_UE_MAC_INST_t *mac, // skip the logical channel if no data in the buffer initially or the data in the buffer was zero because it was written in to // MAC PDU - if (!sched_info->lc_sched_info[lcid - 1].LCID_status || !lcids_data_status[lcid - 1]) { + if (!sched_info->lc_sched_info[lcid - 1].LCID_buffer_with_data || !lcids_data_status[lcid - 1]) { lcids_data_status[lcid - 1] = false; continue; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 161598ec2d..326ba5fce4 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -617,7 +617,6 @@ void nr_initiate_ra_proc(module_id_t module_idP, } } LOG_D(NR_MAC, "Frame %d, Slot %d: Activating RA process \n", frameP, slotP); - ra->state = Msg2; ra->timing_offset = timing_offset; ra->preamble_slot = slotP; @@ -653,11 +652,12 @@ void nr_initiate_ra_proc(module_id_t module_idP, && !((find_nr_UE(&nr_mac->UE_info, ra->rnti) == NULL) && (find_nr_RA_id(module_idP, CC_id, ra->rnti) == -1) && ra->rnti >= 0x1 && ra->rnti <= 0xffef)); if (loop == 100) { - LOG_E(NR_MAC, "%s:%d:%s: [RAPROC] initialisation random access aborted\n", __FILE__, __LINE__, __FUNCTION__); + LOG_E(NR_MAC, "[RAPROC] initialisation random access aborted\n"); abort(); } } + ra->state = Msg2; ra->RA_rnti = ra_rnti; ra->preamble_index = preamble_index; ra->beam_id = cc->ssb_index[beam_index]; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 9199327501..d5116385e3 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1966,18 +1966,17 @@ NR_UE_info_t *find_nr_UE(NR_UEs_t *UEs, rnti_t rntiP) return NULL; } -int find_nr_RA_id(module_id_t mod_idP, int CC_idP, rnti_t rntiP) { -//------------------------------------------------------------------------------ - int RA_id; - RA_t *ra = (RA_t *) &RC.nrmac[mod_idP]->common_channels[CC_idP].ra[0]; +int find_nr_RA_id(module_id_t mod_idP, int CC_idP, rnti_t rntiP) +{ + NR_RA_t *ra = &RC.nrmac[mod_idP]->common_channels[CC_idP].ra[0]; - for (RA_id = 0; RA_id < NB_RA_PROC_MAX; RA_id++) { + for (int RA_id = 0; RA_id < NR_NB_RA_PROC_MAX; RA_id++) { LOG_D(NR_MAC, "Checking RA_id %d for %x : state %d\n", RA_id, rntiP, ra[RA_id].state); - if (ra[RA_id].state != IDLE && ra[RA_id].rnti == rntiP) + if (ra[RA_id].state != RA_IDLE && ra[RA_id].rnti == rntiP) return RA_id; } @@ -3047,7 +3046,7 @@ void prepare_initial_ul_rrc_message(gNB_MAC_INST *mac, NR_UE_info_t *UE) DevAssert(cellGroupConfig->rlc_BearerToAddModList->list.count == 1); const NR_RLC_BearerConfig_t *bearer = cellGroupConfig->rlc_BearerToAddModList->list.array[0]; DevAssert(bearer->servedRadioBearer->choice.srb_Identity == 1); - nr_rlc_add_srb(UE->rnti, DCCH, bearer); + nr_rlc_add_srb(UE->rnti, bearer->servedRadioBearer->choice.srb_Identity, bearer); } void nr_mac_trigger_release_timer(NR_UE_sched_ctrl_t *sched_ctrl, NR_SubcarrierSpacing_t subcarrier_spacing) diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c index 13aa2a3546..04f2c2fdc9 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c @@ -332,8 +332,10 @@ void ue_context_setup_request(const f1ap_ue_context_setup_t *req) new_CellGroup); } - if (req->rrc_container != NULL) - nr_rlc_srb_recv_sdu(req->gNB_DU_ue_id, DCCH, req->rrc_container, req->rrc_container_length); + if (req->rrc_container != NULL) { + logical_chan_id_t id = 1; + nr_rlc_srb_recv_sdu(req->gNB_DU_ue_id, id, req->rrc_container, req->rrc_container_length); + } UE->capability = ue_cap; if (ue_cap != NULL) { @@ -424,8 +426,10 @@ void ue_context_modification_request(const f1ap_ue_context_modif_req_t *req) handle_ue_context_drbs_release(req->gNB_DU_ue_id, req->drbs_to_be_released_length, req->drbs_to_be_released, new_CellGroup); } - if (req->rrc_container != NULL) - nr_rlc_srb_recv_sdu(req->gNB_DU_ue_id, DCCH, req->rrc_container, req->rrc_container_length); + if (req->rrc_container != NULL) { + logical_chan_id_t id = 1; + nr_rlc_srb_recv_sdu(req->gNB_DU_ue_id, id, req->rrc_container, req->rrc_container_length); + } if (req->ReconfigComplOutcome != RRCreconf_info_not_present && req->ReconfigComplOutcome != RRCreconf_success) { LOG_E(NR_MAC, @@ -498,9 +502,10 @@ void ue_context_modification_confirm(const f1ap_ue_context_modif_confirm_t *conf } NR_SCHED_UNLOCK(&mac->sched_lock); - if (confirm->rrc_container_length > 0) - nr_rlc_srb_recv_sdu(confirm->gNB_DU_ue_id, DCCH, confirm->rrc_container, confirm->rrc_container_length); - + if (confirm->rrc_container_length > 0) { + logical_chan_id_t id = 1; + nr_rlc_srb_recv_sdu(confirm->gNB_DU_ue_id, id, confirm->rrc_container, confirm->rrc_container_length); + } /* nothing else to be done? */ } @@ -589,7 +594,7 @@ void dl_rrc_message_transfer(const f1ap_dl_rrc_message_t *dl_rrc) du_add_f1_ue_data(dl_rrc->gNB_DU_ue_id, &new_ue_data); } - if (UE->expect_reconfiguration && dl_rrc->srb_id == DCCH) { + if (UE->expect_reconfiguration && dl_rrc->srb_id == 1) { /* we expected a reconfiguration, and this is on DCCH. We assume this is * the reconfiguration: nr_mac_prepare_cellgroup_update() already stored * the CellGroupConfig. Below, we trigger a timer, and the CellGroupConfig diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 4724eac162..9028dbc797 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -85,8 +85,6 @@ /* MAC */ #include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h" #include "LAYER2/NR_MAC_COMMON/nr_mac_common.h" -#include "LAYER2/MAC/mac.h" -#include "NR_TAG.h" #include @@ -251,14 +249,6 @@ typedef struct { /// Outgoing BCCH pdu for PHY uint8_t sib1_bcch_pdu[NR_MAX_SIB_LENGTH / 8]; int sib1_bcch_length; - /// Outgoing BCCH DCI allocation - uint32_t BCCH_alloc_pdu; - /// Outgoing CCCH pdu for PHY - CCCH_PDU CCCH_pdu; - /// Outgoing PCCH DCI allocation - uint32_t PCCH_alloc_pdu; - /// Outgoing PCCH pdu for PHY - PCCH_PDU PCCH_pdu; /// Template for RA computations NR_RA_t ra[NR_NB_RA_PROC_MAX]; /// VRB map for common channels diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index 4dc17fd493..b92150e65b 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -40,7 +40,6 @@ #include "nr_rrc_common.h" #include "ds/byte_array.h" -#include "common/ngran_types.h" #include "common/platform_constants.h" #include "common/platform_types.h" #include "mac_rrc_dl.h" diff --git a/openair2/RRC/NR_UE/L2_interface_ue.c b/openair2/RRC/NR_UE/L2_interface_ue.c index 0b61f3fc82..b3eac63e4c 100644 --- a/openair2/RRC/NR_UE/L2_interface_ue.c +++ b/openair2/RRC/NR_UE/L2_interface_ue.c @@ -33,7 +33,6 @@ #include "rrc_defs.h" #include "rrc_proto.h" #include "assertions.h" -#include "MAC/mac.h" #include "LAYER2/NR_MAC_COMMON/nr_mac.h" #include "openair2/LAYER2/NR_MAC_UE/mac_proto.h" @@ -89,13 +88,9 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, itti_send_msg_to_task(TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE(module_id), message_p); } break; - - case CCCH: - AssertFatal(false, "use RLC instead\n"); - break; - + case NR_SBCCH_SL_BCH: - if (pdu_len>0) { + if (pdu_len > 0) { LOG_T(NR_RRC, "[UE %d] Received SL-MIB for NR_SBCCH_SL_BCH.\n", module_id); MessageDef *message_p;