Commit 45f74cf7 authored by francescomani's avatar francescomani Committed by Laurent THOMAS

MR2477 remove calls to LTE mac.h in NR

parent 76a55fb6
......@@ -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
......
......@@ -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"
/* RRC */
......@@ -179,8 +178,8 @@ typedef enum {
typedef struct {
// after multiplexing buffer remain for each lcid
int32_t LCID_buffer_remain;
// buffer status for each lcid
uint8_t LCID_status;
// buffer status for each lcid (false: empty, true: not empty)
bool LCID_status;
// Bj bucket usage per lcid
int32_t Bj;
// Bucket size per lcid
......@@ -438,6 +437,11 @@ typedef struct nr_lcordered_info_s {
NR_LogicalChannelConfig_t *logicalChannelConfig_ordered;
} nr_lcordered_info_t;
typedef struct {
uint8_t payload[CCCH_PAYLOAD_SIZE_MAX];
} __attribute__ ((__packed__)) NR_CCCH_PDU;
typedef struct {
NR_SearchSpace_t *otherSI_SS;
NR_SearchSpace_t *ra_SS;
......@@ -482,7 +486,7 @@ typedef struct NR_UE_MAC_INST_s {
/* PDUs */
/// Outgoing CCCH pdu for PHY
CCCH_PDU CCCH_pdu;
NR_CCCH_PDU CCCH_pdu;
/* Random Access */
/// CRNTI
......
......@@ -95,16 +95,16 @@ 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].Bj = -1;
mac->scheduling_info.lc_sched_info[i].bucket_size = -1;
mac->scheduling_info.lc_sched_info[i].LCGID = 0; // defaults to 0 irrespective of SRB or DRB
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;
for (int k = 0; k < NR_MAX_HARQ_PROCESSES; k++)
mac->UL_ndi[k] = -1; // initialize to invalid value
......
......@@ -1118,12 +1118,12 @@ void nr_ue_ul_scheduler(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--;
}
......@@ -1167,7 +1167,7 @@ bool nr_update_bsr(module_id_t module_idP, 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_status = false;
}
for (int lcgid = 0; lcgid < NR_MAX_NUM_LCGID; lcgid++) {
......@@ -1202,7 +1202,7 @@ bool nr_update_bsr(module_id_t module_idP, frame_t frameP, slot_t slotP, uint8_t
if (rlc_status.bytes_in_buffer > 0) {
LOG_D(NR_MAC,"[UE %d] PDCCH Tick : LCID%d LCGID%d has data to transmit =%d bytes at frame %d slot %d\n",
module_idP, lcid,lcgid,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_status = true;
//Update BSR_bytes and position in lcid_reordered_array only if Group is defined
if (lcgid < NR_MAX_NUM_LCGID) {
......@@ -2659,7 +2659,7 @@ int nr_ue_get_sdu_mac_ce_pre(module_id_t module_idP,
}
//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);
}
......@@ -2886,7 +2886,7 @@ void nr_ue_get_sdu_mac_ce_post(module_id_t module_idP,
}
// 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,
}
}
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;
......@@ -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)
&& 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];
......
......@@ -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;
}
......@@ -3048,7 +3047,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)
......
......@@ -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) {
......@@ -427,8 +429,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,
......@@ -501,9 +505,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? */
}
......@@ -592,7 +597,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
......
......@@ -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 <openair3/UICC/usim_interface.h>
......@@ -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
......
......@@ -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"
......
......@@ -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,11 +88,6 @@ 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;
default:
break;
}
......
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