Commit 7c647d15 authored by Michele Paffetti's avatar Michele Paffetti

integration of LCID for NB-IoT (MAC/defs_nb_iot.h), complete the thread for...

integration of LCID for NB-IoT (MAC/defs_nb_iot.h), complete the thread for the phy_procedures_TX (Schedule_response) and other minor changes
parent d805f3a5
......@@ -160,6 +160,12 @@ typedef struct {
pthread_mutex_t mutex_rxtx;
/// scheduling parameters for RXn-TXnp4 thread
struct sched_param sched_param_rxtx;
/// for IF_Module
pthread_t pthread_l2;
pthread_cond_t cond_l2;
pthread_mutex_t mutex_l2;
int instance_cnt_l2;
} eNB_rxtx_proc_NB_t;
......@@ -289,6 +295,7 @@ typedef struct eNB_proc_NB_t_s {
te_params tep;
/// set of scheduling variables RXn-TXnp4 threads
eNB_rxtx_proc_NB_t proc_rxtx[2];
} eNB_proc_NB_t;
......@@ -307,7 +314,6 @@ typedef struct PHY_VARS_eNB_NB_s {
} PHY_VARS_eNB_NB;
#define debug_msg if (((mac_xface->frame%100) == 0) || (mac_xface->frame < 50)) msg
#include "PHY/INIT/defs.h"
......
......@@ -20,7 +20,7 @@ void NB_generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,Sched_
void NB_generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t * proc,Sched_Rsp_t *Sched_Rsp,const int UE_id);
/*Process all the scheduling result from MAC and also common signals.*/
void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,int do_meas);
void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_NB_t *proc,int do_meas);
#endif
......@@ -130,7 +130,7 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
//RX processing for ue-specific resources (i
uint32_t ret=0,i,j,k;
uint32_t harq_pid, harq_idx, round;
uint32_t harq_pid,round;
int sync_pos;
uint16_t rnti=0;
uint8_t access_mode;
......@@ -138,7 +138,6 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
const int subframe = proc->subframe_rx;
const int frame = proc->frame_rx;
int offset = eNB->CC_id;//(proc == &eNB->proc.proc_rxtx[0]) ? 0 : 1;
/*NB-IoT IF module Common setting*/
......@@ -569,13 +568,13 @@ void NB_generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,Sched_
}
extern int oai_exit;
/*
r_type, rn is only used in PMCH procedure so I remove it.
*/
void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc,
eNB_rxtx_proc_NB_t *proc,
int do_meas)
{
int frame = proc->frame_tx;
......@@ -585,8 +584,7 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
//DCI_PDU_NB *DCI_pdu;
//DCI_PDU_NB DCI_pdu_tmp;
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
// DCI_ALLOC_t *dci_alloc = (DCI_ALLOC_t *)NULL;
int oai_exit = 0;
// DCI_ALLOC_t *dci_alloc = (DCI_ALLOC_t *)NULL;
int8_t UE_id = 0;
uint8_t ul_subframe;
uint32_t ul_frame;
......@@ -625,10 +623,9 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
while(!oai_exit)
{
/*Not test yet , mutex_l2, cond_l2, instance_cnt_l2
//Not test yet , mutex_l2, cond_l2, instance_cnt_l2
if(wait_on_condition(&proc->mutex_l2,&proc->cond_l2,&proc->instance_cnt_l2,"eNB_L2_thread") < 0)
break;*/
break;
/*Take the structures from the shared structures*/
//Sched_Rsp = ;
......
......@@ -73,9 +73,7 @@ typedef struct {
/// Flag to indicate UE has been configured (ACK from RRCConnectionSetup received)
boolean_t configured;
/// MCS from last scheduling
//Modify uint8_t mcs[8];
/// TPC from last scheduling
//Delete uint8_t oldTPC[8];
uint8_t mcs[8];
// PHY interface infoerror
/// DCI format for DLSCH
uint16_t DLSCH_dci_fmt;
......@@ -86,17 +84,8 @@ typedef struct {
/// DCI buffer for DLSCH
/* rounded to 32 bits unit (actual value should be 8 due to the logic
* of the function generate_dci0) */
//Modifyuint8_t DLSCH_DCI[8][(((MAX_DCI_SIZE_BITS)+31)>>5)*4];
/// Number of Allocated RBs for DL after scheduling (prior to frequency allocation)
//Delete uint16_t nb_rb[8]; // num_max_harq
/// Number of Allocated RBs for UL after scheduling (prior to frequency allocation)
//Delete uint16_t nb_rb_ul[8]; // num_max_harq
/// Number of Allocated RBs by the ulsch preprocessor
//Delete uint8_t pre_allocated_nb_rb_ul;
/// index of Allocated RBs by the ulsch preprocessor
//Delete int8_t pre_allocated_rb_table_index_ul;
/// total allocated RBs
//Delete int8_t total_allocated_rbs;
// need to modify
uint8_t DLSCH_DCI[8][(((MAX_DCI_SIZE_BITS)+31)>>5)*4];
/// pre-assigned MCS by the ulsch preprocessorerror
uint8_t pre_assigned_mcs_ul;
/// assigned MCS by the ulsch scheduler
......@@ -104,20 +93,11 @@ typedef struct {
/// DCI buffer for ULSCH
/* rounded to 32 bits unit (actual value should be 8 due to the logic
* of the function generate_dci0) */
//Modify uint8_t ULSCH_DCI[8][(((MAX_DCI_SIZE_BITS)+31)>>5)*4];
/// DL DAI
//Delete uint8_t DAI;
/// UL DAI
//Delete uint8_t DAI_ul[10];
/// UL Scheduling Request Received
//Delete uint8_t ul_SR;
/// Resource Block indication for each sub-band in MU-MIMO
//Delete uint8_t rballoc_subband[8][50];
// need to modify
uint8_t ULSCH_DCI[8][(((MAX_DCI_SIZE_BITS)+31)>>5)*4];
// Logical channel info for link with RLC
/// Last received UE BSR info for each logical channel group id
uint8_t bsr_info[MAX_NUM_LCGID];
/// LCGID mapping
//Delete long lcgidmap[11];
/// phr information, received from DPR MAC control element
int8_t phr_info;
/// phr information, received from DPR MAC control element
......@@ -148,12 +128,6 @@ typedef struct {
uint32_t ul_buffer_info[MAX_NUM_LCGID];
/// UE tx power
int32_t ue_tx_power;
/// stores the frame where the last TPC was transmitted
//Delete uint32_t pusch_tpc_tx_frame;
//Delete uint32_t pusch_tpc_tx_subframe;
//Delete uint32_t pucch_tpc_tx_frame;
//Delete uint32_t pucch_tpc_tx_subframe;
//Delete eNB_UE_estimated_distances distance;
} UE_TEMPLATE_NB;
/*! \brief eNB statistics for the connected UEs*/
typedef struct {
......@@ -314,11 +288,6 @@ typedef struct {
UE_TEMPLATE_NB UE_template[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
/// DCI template and MAC connection for RA processes
int pCC_id[NUMBER_OF_UE_MAX];
/// Delete sorted downlink component carrier for the scheduler
/// Delete number of downlink active component carrier
/// Delete sorted uplink component carrier for the scheduler
/// Delete number of uplink active component carrier
/// Delete number of downlink active component carrier
/// eNB to UE statistics
eNB_UE_STATS_NB eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
/// scheduling control info
......@@ -333,21 +302,21 @@ typedef struct {
} UE_list_NB_t;
/*!\brief Values of BCCH0 logical channel for MIB*/
#define BCCH0 11 // MIB-NB
#define BCCH0_NB 11 // MIB-NB
/*!\brief Values of BCCH1 logical channel for SIBs */
#define BCCH1 12 // SI-SIB-NBs
#define BCCH1_NB 12 // SI-SIB-NBs
/*!\brief Values of PCCH logical channel */
//#define PCCH 13 // Paging XXX not used for the moment
#define PCCH_NB 13 // Paging XXX not used for the moment
/*!\brief Value of CCCH / SRB0 logical channel */
//#define CCCH 0 // srb0 ---> XXX exactly the same as in LTE (commented for compilation purposes)
#define CCCH_NB 0 // srb0 ---> XXX exactly the same as in LTE (commented for compilation purposes)
/*!\brief DCCH0 / SRB1bis logical channel */
#define DCCH0 3 // srb1bis
#define DCCH0_NB 3 // srb1bis
/*!\brief DCCH1 / SRB1 logical channel */
//#define DCCH1 1 // srb1 //XXX we redefine it for the SRB1
#define DCCH1_NB 1 // srb1 //XXX we redefine it for the SRB1
/*!\brief DTCH0 DRB0 logical channel */
#define DTCH0 4 // DRB0
#define DTCH0_NB 4 // DRB0
/*!\brief DTCH1 DRB1 logical channel */
#define DTCH1 5 // DRB1
#define DTCH1_NB 5 // DRB1
// DLSCH LCHAN ID all the same as NB-IoT
/*!\brief DCI PDU filled by MAC for the PHY */
/*
......
......@@ -224,7 +224,7 @@ void NB_rx_sdu(const module_id_t enb_mod_idP,
T_INT(rx_lcids[i]), T_INT(rx_lengths[i]), T_BUFFER(payload_ptr, rx_lengths[i]));
switch (rx_lcids[i]) {
case CCCH :
case CCCH_NB :
if (rx_lengths[i] > CCCH_PAYLOAD_SIZE_MAX) {
LOG_E(MAC, "[eNB %d/%d] frame %d received CCCH of size %d (too big, maximum allowed is %d), dropping packet\n",
enb_mod_idP, CC_idP, frameP, rx_lengths[i], CCCH_PAYLOAD_SIZE_MAX);
......@@ -289,8 +289,8 @@ void NB_rx_sdu(const module_id_t enb_mod_idP,
break ;
/*DCCH0 is for SRB1bis, DCCH1 is for SRB1*/
case DCCH0 :
case DCCH1 :
case DCCH0_NB :
case DCCH1_NB :
// if(eNB_mac_inst[module_idP][CC_idP].Dcch_lchan[UE_id].Active==1){
......@@ -304,7 +304,7 @@ void NB_rx_sdu(const module_id_t enb_mod_idP,
if (UE_id != -1) {
/*NO lcg in NB-IoT, anyway set to 0*/
/*NO lcg in NB-IoT, anyway set to 0*/
// adjust buffer occupancy of the correponding logical channel group
/*if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] >= rx_lengths[i])
UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] -= rx_lengths[i];
......@@ -314,19 +314,18 @@ void NB_rx_sdu(const module_id_t enb_mod_idP,
LOG_D(MAC,"[eNB %d] CC_id %d Frame %d : ULSCH -> UL-DCCH, received %d bytes form UE %d on LCID %d \n",
enb_mod_idP,CC_idP,frameP, rx_lengths[i], UE_id, rx_lcids[i]);
/*TODO*/
/*mac_rlc_data_ind(
NB_mac_rlc_data_ind(
enb_mod_idP,
rntiP,
enb_mod_idP,
frameP,
ENB_FLAG_YES,
MBMS_FLAG_NO,
rx_lcids[i],
(char *)payload_ptr,
rx_lengths[i],
1,
NULL);//(unsigned int*)crc_status);*/
UE_list->eNB_UE_stats[CC_idP][UE_id].num_pdu_rx[rx_lcids[i]]+=1;
UE_list->eNB_UE_stats[CC_idP][UE_id].num_bytes_rx[rx_lcids[i]]+=rx_lengths[i];
} /* UE_id != -1 */
......@@ -335,7 +334,7 @@ void NB_rx_sdu(const module_id_t enb_mod_idP,
break;
// all the DRBS
case DTCH0:
case DTCH0_NB:
default :
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
......@@ -359,13 +358,13 @@ void NB_rx_sdu(const module_id_t enb_mod_idP,
else
UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] = 0;*/
if ((rx_lengths[i] <SCH_PAYLOAD_SIZE_MAX) && (rx_lengths[i] > 0) ) { // MAX SIZE OF transport block
/*mac_rlc_data_ind(
NB_mac_rlc_data_ind(
enb_mod_idP,
rntiP,
enb_mod_idP,
frameP,
ENB_FLAG_YES,
MBMS_FLAG_NO,
rx_lcids[i],
(char *)payload_ptr,
rx_lengths[i],
......
......@@ -620,10 +620,11 @@ rlc_module_init (void)
rlc_rrc_data_ind = NULL;
rlc_rrc_data_conf = NULL;
//NB-IOT---------------------------------------------------------------
#ifdef NB_IOT
//MP: change variable maxDRB for NB-IoT --> see ifdef at the beginning
rlc_rrc_data_ind_NB = NULL;
//-------------------------------------------------------------------
#endif
rlc_coll_p = hashtable_create ((maxDRB + 2) * 16, NULL, rb_free_rlc_union);
AssertFatal(rlc_coll_p != NULL, "UNRECOVERABLE error, RLC hashtable_create failed");
......
......@@ -234,7 +234,7 @@ typedef struct rlc_union_s {
rlc_mode_t mode;
union {
rlc_am_entity_t am;
rlc_um_entity_t um;
rlc_um_entity_t um; //not allowed for NB-IoT
rlc_tm_entity_t tm;
} rlc;
} rlc_union_t;
......
......@@ -256,10 +256,11 @@ int NB_rrc_mac_config_req_eNB(
break;
}
PHY_config_req(config_INFO); //for trigger the NB_phy_config_mib_eNB()
//IF_Module->PHY_config_req(config_INFO);
if(if_inst->PHY_config_req)
if_inst->PHY_config_req(config_INFO); //for trigger the NB_phy_config_mib_eNB()
else
LOG_E(RRC, "NB_rrc_mac_config_req_eNB: PHY_config_req pointer function is NULL\n");
// mac_init_cell_params(Mod_idP,CC_idP); //TODO MP: to be defined in MAC/main.c (in the old implementation was inside the mac_top_init but raymond have separated
}
......@@ -471,7 +472,11 @@ int NB_rrc_mac_config_req_eNB(
/*RACH Config Common*/
//nothing defined in FAPI specs
PHY_config_req(config_INFO); //for trigger NB_phy_config_sib2_eNB ()
if(if_inst->PHY_config_req)
if_inst->PHY_config_req(config_INFO); //for trigger the NB_phy_config_sib2_eNB()
else
LOG_E(RRC, "NB_rrc_mac_config_req_eNB: PHY_config_req pointer function is NULL\n");
// NB_phy_config_sib2_eNB(
// Mod_idP,
......@@ -485,8 +490,8 @@ int NB_rrc_mac_config_req_eNB(
if (UE_id == -1) {
LOG_E(MAC,"%s:%d:%s: ERROR, UE_id == -1\n", __FILE__, __LINE__, __FUNCTION__);
} else {
//no logical channel group not defined for nb-iot --> no UL specific Parameter
//XXX: lcgidmap in MAC/defs.h most probably is not needed
//logical channel group not defined for nb-iot --> no UL specific Parameter
// or at least LCGID should be set to 0 for NB-IoT (See TS 36.321 ch 6.1.3.1) so no make sense to store this
}
}
......@@ -501,13 +506,17 @@ int NB_rrc_mac_config_req_eNB(
config_INFO->rnti = UE_RNTI(Mod_idP, UE_id);
config_INFO->phy_config_dedicated = physicalConfigDedicated;
PHY_config_req(config_INFO); // for trigger NB_phy_config_dedicated_eNB()
if(if_inst->PHY_config_req)
if_inst->PHY_config_req(config_INFO); //for trigger the NB_phy_config_dedicated_eNB()
else
LOG_E(RRC, "NB_rrc_mac_config_req_eNB: PHY_config_req pointer function is NULL\n");
// NB_phy_config_dedicated_eNB(
// Mod_idP,
// CC_idP,
// UE_RNTI(Mod_idP, UE_id),
// physicalConfigDedicated);
}
}
......@@ -1302,7 +1311,7 @@ boolean_t NB_rrc_pdcp_config_asn1_req (
if (srb2add_list_pP != NULL) {
if(LCID == DCCH0) //SRB1bis
if(LCID == DCCH0_NB) //SRB1bis
{
LOG_E(PDCP,"PDCP Configuration for SRB1bis not allowed\n");
return 0;
......@@ -2328,10 +2337,10 @@ rlc_op_status_t NB_rrc_rlc_config_asn1_req (
if (srb2add_listP != NULL) {
if(srb1bis_flag == SRB1BIS_FLAG_YES){
rb_id = DCCH0; //3
rb_id = DCCH0_NB; //3
}//srb1bis
else{
rb_id = DCCH1; //1
rb_id = DCCH1_NB; //1
}//srb1
lc_id = rb_id;
......@@ -2959,7 +2968,8 @@ void rrc_rlc_register_rrc_NB (rrc_data_ind_cb_NB_t NB_rrc_data_indP, rrc_data_co
}
/*--------------------------------------------RLC-PDCP--------------------------------------------------*/
//XXX to be integrated in the flow
//called by rlc_am_send_sdu and rlc_tm_send_sdu
//defined in rlc.c
//--------------------------------------------
void NB_rlc_data_ind (
......@@ -3709,7 +3719,7 @@ void NB_mac_rlc_data_ind (
const logical_chan_id_t channel_idP,
char *buffer_pP,
const tb_size_t tb_sizeP,
num_tb_t num_tbP,
num_tb_t num_tbP, //number of transport block
crc_t *crcs_pP)
{
//-----------------------------------------------------------------------------
......@@ -3783,7 +3793,7 @@ void NB_mac_rlc_data_ind (
NB_rlc_am_mac_data_indication(&ctxt, &rlc_union_p->rlc.am, data_ind);
break;
//XXX MP: no UM mode for NB_IoT
//MP: no UM mode for NB_IoT
case RLC_MODE_TM:
rlc_tm_mac_data_indication(&ctxt, &rlc_union_p->rlc.tm, data_ind);
......
......@@ -588,7 +588,7 @@ rrc_eNB_generate_RRCConnectionSetup_NB(
(RadioResourceConfigCommonSIB_NB_r13_t *) NULL,
(PhysicalConfigDedicated_NB_r13_t*) ue_context_pP->ue_context.physicalConfigDedicated_NB,
ue_context_pP->ue_context.mac_MainConfig_NB, //XXX most probably is not needed since is only at UE side
DCCH0, //LCID = 3 of SRB1bis
DCCH0_NB, //LCID = 3 of SRB1bis
SRB1bis_logicalChannelConfig
);
break;
......@@ -1225,7 +1225,7 @@ rrc_eNB_generate_SecurityModeCommand_NB(
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
size,
rrc_eNB_mui_NB,
DCCH0); //MP: SRB1bis
DCCH0_NB); //MP: SRB1bis
MSC_LOG_TX_MESSAGE(
MSC_RRC_ENB,
......@@ -1240,7 +1240,7 @@ rrc_eNB_generate_SecurityModeCommand_NB(
NB_rrc_data_req( //to PDCP
ctxt_pP,
DCCH0,//MP:through SRB1bis
DCCH0_NB,//MP:through SRB1bis
rrc_eNB_mui_NB++,
SDU_CONFIRM_NO,
size,
......@@ -1280,7 +1280,7 @@ rrc_eNB_generate_UECapabilityEnquiry_NB(
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
size,
rrc_eNB_mui_NB,
DCCH0);//through SRB1bis
DCCH0_NB);//through SRB1bis
MSC_LOG_TX_MESSAGE(
MSC_RRC_ENB,
......@@ -2123,14 +2123,14 @@ rrc_eNB_decode_ccch_NB(
// SRB1bis (LCID = 3 = DCCH0)
ue_context_p->ue_context.Srb1bis.Active = 1;
ue_context_p->ue_context.Srb1bis.Srb_info.Srb_id = DCCH0;
ue_context_p->ue_context.Srb1bis.Srb_info.Srb_id = DCCH0_NB;
//generate RRCConnectionSetup-NB
rrc_eNB_generate_RRCConnectionSetup_NB(ctxt_pP, ue_context_p, CC_id);
LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT"CALLING RLC CONFIG SRB1bis and SRB1 (rbid %d, rbid %d)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH0, DCCH1);
DCCH0_NB, DCCH1_NB);
MSC_LOG_TX_MESSAGE(
MSC_RRC_ENB,
......@@ -2439,7 +2439,7 @@ rrc_eNB_decode_dcch_NB(
PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
"(RRCConnectionSetupComplete-NB) ---> RRC_eNB\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH0,//SRB1bis
DCCH0_NB,//SRB1bis
sdu_sizeP);
if (ul_dcch_msg_NB->message.choice.c1.choice.rrcConnectionSetupComplete_r13.criticalExtensions.present ==
......@@ -2508,7 +2508,7 @@ rrc_eNB_decode_dcch_NB(
PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
"(securityModeComplete-NB) ---> RRC_eNB\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH0,//through SRB1bis
DCCH0_NB,//through SRB1bis
sdu_sizeP);
#ifdef XER_PRINT
xer_fprint(stdout, &asn_DEF_UL_DCCH_Message_NB, (void *)ul_dcch_msg_NB);
......@@ -2568,7 +2568,7 @@ rrc_eNB_decode_dcch_NB(
PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
"(securityModeFailure-NB) ---> RRC_eNB\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH0,
DCCH0_NB,
sdu_sizeP);
#ifdef XER_PRINT
......
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