Commit 53e056e6 authored by francescomani's avatar francescomani

remove calls to LTE mac.h in NR

parent 41196bc9
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include "common/ran_context.h" #include "common/ran_context.h"
#include "openair2/PHY_INTERFACE/queue_t.h" #include "openair2/PHY_INTERFACE/queue_t.h"
#include "gnb_ind_vars.h" #include "gnb_ind_vars.h"
#include "LAYER2/MAC/mac.h"
#define TEST #define TEST
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
/* MAC */ /* MAC */
#include "LAYER2/NR_MAC_COMMON/nr_mac.h" #include "LAYER2/NR_MAC_COMMON/nr_mac.h"
#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h" #include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
#include "LAYER2/MAC/mac.h"
#include "NR_MAC_COMMON/nr_mac_extern.h" #include "NR_MAC_COMMON/nr_mac_extern.h"
#include "mac_defs_sl.h" #include "mac_defs_sl.h"
...@@ -181,7 +180,7 @@ typedef struct { ...@@ -181,7 +180,7 @@ typedef struct {
// after multiplexing buffer remain for each lcid // after multiplexing buffer remain for each lcid
int32_t LCID_buffer_remain; int32_t LCID_buffer_remain;
// buffer status for each lcid // buffer status for each lcid
uint8_t LCID_status; bool LCID_status;
// logical channel group id of this LCID // logical channel group id of this LCID
long LCGID; long LCGID;
// Bj bucket usage per lcid // Bj bucket usage per lcid
...@@ -442,6 +441,11 @@ typedef struct nr_lcordered_info_s { ...@@ -442,6 +441,11 @@ typedef struct nr_lcordered_info_s {
uint32_t bucket_size; uint32_t bucket_size;
} nr_lcordered_info_t; } nr_lcordered_info_t;
typedef struct {
uint8_t payload[CCCH_PAYLOAD_SIZE_MAX];
} __attribute__ ((__packed__)) NR_CCCH_PDU;
typedef struct { typedef struct {
NR_SearchSpace_t *otherSI_SS; NR_SearchSpace_t *otherSI_SS;
NR_SearchSpace_t *ra_SS; NR_SearchSpace_t *ra_SS;
......
...@@ -92,13 +92,13 @@ void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac) ...@@ -92,13 +92,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 // 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. // configured by the NW.
mac->scheduling_info.periodicBSR_SF = MAC_UE_BSR_TIMER_NOT_RUNNING; mac->scheduling_info.periodicBSR_SF = NR_MAC_UE_BSR_TIMER_NOT_RUNNING;
mac->scheduling_info.retxBSR_SF = MAC_UE_BSR_TIMER_NOT_RUNNING; mac->scheduling_info.retxBSR_SF = NR_MAC_UE_BSR_TIMER_NOT_RUNNING;
mac->BSR_reporting_active = BSR_TRIGGER_NONE; mac->BSR_reporting_active = NR_BSR_TRIGGER_NONE;
for (int i = 0; i < NR_MAX_NUM_LCID; i++) { for (int i = 0; i < NR_MAX_NUM_LCID; i++) {
LOG_D(NR_MAC, "Applying default logical channel config for LCGID %d\n", 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_status = false;
mac->scheduling_info.lc_sched_info[i].LCID_buffer_remain = 0; mac->scheduling_info.lc_sched_info[i].LCID_buffer_remain = 0;
mac->scheduling_info.lc_sched_info[i].Bj = 0; mac->scheduling_info.lc_sched_info[i].Bj = 0;
} }
......
...@@ -1128,12 +1128,12 @@ void nr_ue_ul_scheduler(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info) ...@@ -1128,12 +1128,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 // First check ReTxBSR Timer because it is always configured
// Decrement ReTxBSR Timer if it is running and not null // 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--; mac->scheduling_info.retxBSR_SF--;
} }
// Decrement Periodic Timer if it is running and not null // 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--; mac->scheduling_info.periodicBSR_SF--;
} }
...@@ -1175,7 +1175,7 @@ bool nr_update_bsr(NR_UE_MAC_INST_t *mac, frame_t frameP, slot_t slotP, uint8_t ...@@ -1175,7 +1175,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++) { for (int lcid = 1; lcid <= NR_MAX_NUM_LCID; lcid++) {
// Reset transmission status // Reset transmission status
lcid_bytes_in_buffer[lcid - 1] = 0; 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_status = false;
} }
for (int lcgid = 0; lcgid < NR_MAX_NUM_LCGID; lcgid++) { for (int lcgid = 0; lcgid < NR_MAX_NUM_LCGID; lcgid++) {
...@@ -1216,7 +1216,7 @@ bool nr_update_bsr(NR_UE_MAC_INST_t *mac, frame_t frameP, slot_t slotP, uint8_t ...@@ -1216,7 +1216,7 @@ bool nr_update_bsr(NR_UE_MAC_INST_t *mac, frame_t frameP, slot_t slotP, uint8_t
rlc_status.bytes_in_buffer, rlc_status.bytes_in_buffer,
frameP, frameP,
slotP); slotP);
mac->scheduling_info.lc_sched_info[lcid - 1].LCID_status = LCID_NOT_EMPTY; mac->scheduling_info.lc_sched_info[lcid - 1].LCID_status = true;
//Update BSR_bytes and position in lcid_reordered_array only if Group is defined //Update BSR_bytes and position in lcid_reordered_array only if Group is defined
if (lcgid < NR_MAX_NUM_LCGID) { if (lcgid < NR_MAX_NUM_LCGID) {
...@@ -2671,7 +2671,7 @@ static int nr_ue_get_sdu_mac_ce_pre(NR_UE_MAC_INST_t *mac, ...@@ -2671,7 +2671,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) //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); mac->scheduling_info.retxBSR_SF = nr_get_sf_retxBSRTimer(mac->scheduling_info.retxBSR_Timer);
} }
...@@ -2896,7 +2896,7 @@ static void nr_ue_get_sdu_mac_ce_post(NR_UE_MAC_INST_t *mac, ...@@ -2896,7 +2896,7 @@ static void nr_ue_get_sdu_mac_ce_post(NR_UE_MAC_INST_t *mac,
} }
// Reset BSR Trigger flags // Reset BSR Trigger flags
mac->BSR_reporting_active = BSR_TRIGGER_NONE; mac->BSR_reporting_active = NR_BSR_TRIGGER_NONE;
} }
} }
......
...@@ -625,7 +625,6 @@ void nr_initiate_ra_proc(module_id_t module_idP, ...@@ -625,7 +625,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); LOG_D(NR_MAC, "Frame %d, Slot %d: Activating RA process \n", frameP, slotP);
ra->state = Msg2;
ra->timing_offset = timing_offset; ra->timing_offset = timing_offset;
ra->preamble_slot = slotP; ra->preamble_slot = slotP;
...@@ -661,11 +660,12 @@ void nr_initiate_ra_proc(module_id_t module_idP, ...@@ -661,11 +660,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) && !((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)); && ra->rnti >= 0x1 && ra->rnti <= 0xffef));
if (loop == 100) { 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(); abort();
} }
} }
ra->state = Msg2;
ra->RA_rnti = ra_rnti; ra->RA_rnti = ra_rnti;
ra->preamble_index = preamble_index; ra->preamble_index = preamble_index;
ra->beam_id = cc->ssb_index[beam_index]; ra->beam_id = cc->ssb_index[beam_index];
......
...@@ -1966,18 +1966,17 @@ NR_UE_info_t *find_nr_UE(NR_UEs_t *UEs, rnti_t rntiP) ...@@ -1966,18 +1966,17 @@ NR_UE_info_t *find_nr_UE(NR_UEs_t *UEs, rnti_t rntiP)
return NULL; return NULL;
} }
int find_nr_RA_id(module_id_t mod_idP, int CC_idP, rnti_t rntiP) { int find_nr_RA_id(module_id_t mod_idP, int CC_idP, rnti_t rntiP)
//------------------------------------------------------------------------------ {
int RA_id; NR_RA_t *ra = &RC.nrmac[mod_idP]->common_channels[CC_idP].ra[0];
RA_t *ra = (RA_t *) &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", LOG_D(NR_MAC, "Checking RA_id %d for %x : state %d\n",
RA_id, RA_id,
rntiP, rntiP,
ra[RA_id].state); 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; return RA_id;
} }
...@@ -3047,7 +3046,7 @@ void prepare_initial_ul_rrc_message(gNB_MAC_INST *mac, NR_UE_info_t *UE) ...@@ -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); DevAssert(cellGroupConfig->rlc_BearerToAddModList->list.count == 1);
const NR_RLC_BearerConfig_t *bearer = cellGroupConfig->rlc_BearerToAddModList->list.array[0]; const NR_RLC_BearerConfig_t *bearer = cellGroupConfig->rlc_BearerToAddModList->list.array[0];
DevAssert(bearer->servedRadioBearer->choice.srb_Identity == 1); 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) void nr_mac_trigger_release_timer(NR_UE_sched_ctrl_t *sched_ctrl, NR_SubcarrierSpacing_t subcarrier_spacing)
......
...@@ -332,8 +332,10 @@ void ue_context_setup_request(const f1ap_ue_context_setup_t *req) ...@@ -332,8 +332,10 @@ void ue_context_setup_request(const f1ap_ue_context_setup_t *req)
new_CellGroup); new_CellGroup);
} }
if (req->rrc_container != NULL) if (req->rrc_container != NULL) {
nr_rlc_srb_recv_sdu(req->gNB_DU_ue_id, DCCH, req->rrc_container, req->rrc_container_length); 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; UE->capability = ue_cap;
if (ue_cap != NULL) { if (ue_cap != NULL) {
...@@ -424,8 +426,10 @@ void ue_context_modification_request(const f1ap_ue_context_modif_req_t *req) ...@@ -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); 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) if (req->rrc_container != NULL) {
nr_rlc_srb_recv_sdu(req->gNB_DU_ue_id, DCCH, req->rrc_container, req->rrc_container_length); 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) { if (req->ReconfigComplOutcome != RRCreconf_info_not_present && req->ReconfigComplOutcome != RRCreconf_success) {
LOG_E(NR_MAC, LOG_E(NR_MAC,
...@@ -498,9 +502,10 @@ void ue_context_modification_confirm(const f1ap_ue_context_modif_confirm_t *conf ...@@ -498,9 +502,10 @@ void ue_context_modification_confirm(const f1ap_ue_context_modif_confirm_t *conf
} }
NR_SCHED_UNLOCK(&mac->sched_lock); NR_SCHED_UNLOCK(&mac->sched_lock);
if (confirm->rrc_container_length > 0) if (confirm->rrc_container_length > 0) {
nr_rlc_srb_recv_sdu(confirm->gNB_DU_ue_id, DCCH, confirm->rrc_container, confirm->rrc_container_length); 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? */ /* nothing else to be done? */
} }
...@@ -589,7 +594,7 @@ void dl_rrc_message_transfer(const f1ap_dl_rrc_message_t *dl_rrc) ...@@ -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); 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 /* we expected a reconfiguration, and this is on DCCH. We assume this is
* the reconfiguration: nr_mac_prepare_cellgroup_update() already stored * the reconfiguration: nr_mac_prepare_cellgroup_update() already stored
* the CellGroupConfig. Below, we trigger a timer, and the CellGroupConfig * the CellGroupConfig. Below, we trigger a timer, and the CellGroupConfig
......
...@@ -85,8 +85,6 @@ ...@@ -85,8 +85,6 @@
/* MAC */ /* MAC */
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h" #include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h" #include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
#include "LAYER2/MAC/mac.h"
#include "NR_TAG.h"
#include <openair3/UICC/usim_interface.h> #include <openair3/UICC/usim_interface.h>
...@@ -251,14 +249,6 @@ typedef struct { ...@@ -251,14 +249,6 @@ typedef struct {
/// Outgoing BCCH pdu for PHY /// Outgoing BCCH pdu for PHY
uint8_t sib1_bcch_pdu[NR_MAX_SIB_LENGTH / 8]; uint8_t sib1_bcch_pdu[NR_MAX_SIB_LENGTH / 8];
int sib1_bcch_length; 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 /// Template for RA computations
NR_RA_t ra[NR_NB_RA_PROC_MAX]; NR_RA_t ra[NR_NB_RA_PROC_MAX];
/// VRB map for common channels /// VRB map for common channels
......
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
#include "nr_rrc_common.h" #include "nr_rrc_common.h"
#include "ds/byte_array.h" #include "ds/byte_array.h"
#include "common/ngran_types.h"
#include "common/platform_constants.h" #include "common/platform_constants.h"
#include "common/platform_types.h" #include "common/platform_types.h"
#include "mac_rrc_dl.h" #include "mac_rrc_dl.h"
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include "rrc_defs.h" #include "rrc_defs.h"
#include "rrc_proto.h" #include "rrc_proto.h"
#include "assertions.h" #include "assertions.h"
#include "MAC/mac.h"
#include "LAYER2/NR_MAC_COMMON/nr_mac.h" #include "LAYER2/NR_MAC_COMMON/nr_mac.h"
#include "openair2/LAYER2/NR_MAC_UE/mac_proto.h" #include "openair2/LAYER2/NR_MAC_UE/mac_proto.h"
...@@ -90,12 +89,8 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, ...@@ -90,12 +89,8 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
} }
break; break;
case CCCH:
AssertFatal(false, "use RLC instead\n");
break;
case NR_SBCCH_SL_BCH: 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); LOG_T(NR_RRC, "[UE %d] Received SL-MIB for NR_SBCCH_SL_BCH.\n", module_id);
MessageDef *message_p; MessageDef *message_p;
......
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