nr-ip-ul-nos1: Merge with develop
This commit is contained in:
@@ -897,10 +897,12 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
} // end for loop on UE_id
|
||||
|
||||
#if (!defined(PRE_SCD_THREAD))
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, NOT_A_RNTI, frameP, subframeP, module_idP);
|
||||
pdcp_run(&ctxt);
|
||||
pdcp_mbms_run(&ctxt);
|
||||
rrc_rx_tx(&ctxt, CC_id);
|
||||
if (!NODE_IS_DU(RC.rrc[module_idP]->node_type)) {
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, NOT_A_RNTI, frameP, subframeP, module_idP);
|
||||
pdcp_run(&ctxt);
|
||||
pdcp_mbms_run(&ctxt);
|
||||
rrc_rx_tx(&ctxt, CC_id);
|
||||
}
|
||||
#endif
|
||||
|
||||
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||
@@ -988,6 +990,8 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
if (flexran_agent_get_mac_xface(module_idP) && subframeP == 9) {
|
||||
flexran_agent_slice_update(module_idP);
|
||||
}
|
||||
if (flexran_agent_get_mac_xface(module_idP))
|
||||
flexran_agent_get_mac_xface(module_idP)->flexran_agent_notify_tick(module_idP);
|
||||
|
||||
stop_meas(&(eNB->eNB_scheduler));
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER, VCD_FUNCTION_OUT);
|
||||
|
||||
@@ -48,11 +48,11 @@
|
||||
#include "pdcp.h"
|
||||
#include "assertions.h"
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
#include "intertask_interface.h"
|
||||
#endif
|
||||
|
||||
#include "SIMULATION/TOOLS/sim.h" // for taus
|
||||
//#if defined(ENABLE_ITTI)
|
||||
//#include "intertask_interface.h"
|
||||
//#endif
|
||||
//
|
||||
#include "SIMULATION/TOOLS/sim.h" // for taus
|
||||
|
||||
#define ENABLE_MAC_PAYLOAD_DEBUG
|
||||
#define DEBUG_eNB_SCHEDULER 1
|
||||
@@ -60,37 +60,38 @@
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
|
||||
int8_t get_mbsfn_sf_alloction(module_id_t module_idP, uint8_t CC_id, uint8_t mbsfn_sync_area) {
|
||||
// currently there is one-to-one mapping between sf allocation pattern and sync area
|
||||
if (mbsfn_sync_area >= MAX_MBSFN_AREA) {
|
||||
LOG_W(MAC,
|
||||
"[eNB %d] CC_id %d MBSFN synchronization area %d out of range\n ",
|
||||
module_idP, CC_id, mbsfn_sync_area);
|
||||
return -1;
|
||||
} else if (RC.mac[module_idP]->
|
||||
common_channels[CC_id].mbsfn_SubframeConfig[mbsfn_sync_area]
|
||||
!= NULL) {
|
||||
return mbsfn_sync_area;
|
||||
} else {
|
||||
LOG_W(MAC,
|
||||
"[eNB %d] CC_id %d MBSFN Subframe Config pattern %d not found \n ",
|
||||
module_idP, CC_id, mbsfn_sync_area);
|
||||
return -1;
|
||||
}
|
||||
int8_t
|
||||
get_mbsfn_sf_alloction(module_id_t module_idP, uint8_t CC_id,
|
||||
uint8_t mbsfn_sync_area)
|
||||
{
|
||||
// currently there is one-to-one mapping between sf allocation pattern and sync area
|
||||
if (mbsfn_sync_area > MAX_MBSFN_AREA) {
|
||||
LOG_W(MAC,
|
||||
"[eNB %d] CC_id %d MBSFN synchronization area %d out of range\n ",
|
||||
module_idP, CC_id, mbsfn_sync_area);
|
||||
return -1;
|
||||
} else if (RC.mac[module_idP]->
|
||||
common_channels[CC_id].mbsfn_SubframeConfig[mbsfn_sync_area]
|
||||
!= NULL) {
|
||||
return mbsfn_sync_area;
|
||||
} else {
|
||||
LOG_W(MAC,
|
||||
"[eNB %d] CC_id %d MBSFN Subframe Config pattern %d not found \n ",
|
||||
module_idP, CC_id, mbsfn_sync_area);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t bytes_in_buffer=0;
|
||||
static uint8_t msi_pmch_stop=0;
|
||||
static uint32_t msi_pmch_stop=0;
|
||||
//static uint8_t msi_active=0;
|
||||
//static uint8_t msi_pmch_stop2=0;
|
||||
uint16_t mbms_rab_id = 2047;
|
||||
static uint8_t msi_sfs=0;
|
||||
static uint32_t msi_sfs=0;
|
||||
|
||||
|
||||
//MSI_ELEMENT * ptr =NULL;
|
||||
|
||||
|
||||
int
|
||||
schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
|
||||
sub_frame_t subframeP)
|
||||
@@ -121,8 +122,9 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
|
||||
int mcch_mcs = -1;
|
||||
uint16_t TBS, j = -1, padding = 0, post_padding = 0;
|
||||
mac_rlc_status_resp_t rlc_status;
|
||||
//mac_rlc_status_resp_t rlc_status2;
|
||||
int num_mtch;
|
||||
int msi_length, i, k;
|
||||
int msi_length=0, i, k;
|
||||
//uint8_t l =0;
|
||||
unsigned char sdu_lcids[11], num_sdus = 0, offset = 0;
|
||||
uint16_t sdu_lengths[11], sdu_length_total = 0;
|
||||
@@ -511,9 +513,11 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
|
||||
// 2nd: Create MSI, get MCCH from RRC and MTCHs from RLC
|
||||
|
||||
// there is MSI (MCH Scheduling Info)
|
||||
uint16_t msi_control_element[29], *msi_ptr;
|
||||
char *buffer_pointer=NULL;
|
||||
if (msi_flag == 1) {
|
||||
// Create MSI here
|
||||
uint16_t msi_control_element[29], *msi_ptr;
|
||||
//uint16_t msi_control_element[29], *msi_ptr;
|
||||
|
||||
msi_ptr = &msi_control_element[0];
|
||||
//((MSI_ELEMENT *) msi_ptr)->lcid = MCCH_LCHANID; //MCCH
|
||||
@@ -543,9 +547,11 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
|
||||
msi_pmch_stop = msi_sfs-1;
|
||||
else
|
||||
msi_pmch_stop = msi_sfs;
|
||||
|
||||
msi_pmch_stop = msi_sfs;
|
||||
|
||||
if( msi_pmch_stop > cc->pmch_Config[0]->sf_AllocEnd_r9)
|
||||
LOG_W(MAC,"e-MBMS Buffer Overflow\n");
|
||||
//if( msi_pmch_stop > cc->pmch_Config[0]->sf_AllocEnd_r9)
|
||||
//LOG_W(MAC,"e-MBMS Buffer Overflow\n");
|
||||
|
||||
if(msi_pmch_stop>=num_sf_alloc /*&& msi_pmch_stop <=cc->pmch_Config[0]->sf_AllocEnd_r9*/) {
|
||||
((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0; // last subframeP of this mtch (only one mtch now) & stop_sf limited to 256
|
||||
@@ -584,6 +590,8 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
|
||||
memcpy((char *) &mch_buffer[sdu_length_total],
|
||||
msi_control_element, msi_length);
|
||||
|
||||
buffer_pointer = (char *) &mch_buffer[sdu_length_total];
|
||||
|
||||
sdu_lcids[num_sdus] = MCH_SCHDL_INFO;
|
||||
sdu_lengths[num_sdus] = msi_length;
|
||||
sdu_length_total += sdu_lengths[num_sdus];
|
||||
@@ -594,12 +602,26 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
|
||||
}
|
||||
// there is MCCH
|
||||
if (mcch_flag == 1) {
|
||||
|
||||
//LOG_E(MAC,
|
||||
//"[eNB %d] CC_id %d Frame %d Subframe %d: Schedule MCCH MESSAGE COUNTING (mod %d)\n",module_idP, CC_id, frameP, subframeP,frameP%2==0);
|
||||
if(1/*frameP%2==0*/){
|
||||
LOG_D(MAC,
|
||||
"[eNB %d] CC_id %d Frame %d Subframe %d: Schedule MCCH MESSAGE (area %d, sfAlloc %d)\n",
|
||||
module_idP, CC_id, frameP, subframeP, i, j);
|
||||
|
||||
mcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MCCH, 0xFFFC, 1, &cc->MCCH_pdu.payload[0],
|
||||
mcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MCCH, 0xFFFC, 1, &cc->MCCH_pdu.payload[0],
|
||||
i); // this is the mbsfn sync area index
|
||||
}
|
||||
else{
|
||||
LOG_E(MAC,
|
||||
"[eNB %d] CC_id %d Frame %d Subframe %d: Schedule MCCH MESSAGE COUNTING (area %d, sfAlloc %d)\n",
|
||||
module_idP, CC_id, frameP, subframeP, i, j);
|
||||
|
||||
//
|
||||
// mcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MCCH_COUNTING, 0xFFFC, 1, &cc->MCCH_pdu.payload[0],
|
||||
// i); // this is the mbsfn sync area index
|
||||
}
|
||||
|
||||
mcch_sdu_length+=1; //RLC ?
|
||||
|
||||
@@ -629,6 +651,15 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
|
||||
sdu_lcids[num_sdus] = MCCH_LCHANID;
|
||||
sdu_lengths[num_sdus] = mcch_sdu_length;
|
||||
|
||||
// LOG_W(MAC,"MCCH RLC %x:",(unsigned char)mch_buffer[sdu_length_total]);
|
||||
// for (int kk = 7; kk >= 0; kk--)
|
||||
// {
|
||||
// printf("%d",(((unsigned char)mch_buffer[sdu_length_total]) >> kk) & 1 ? '1' : '0');
|
||||
// }
|
||||
// printf("\n");
|
||||
//mch_buffer[sdu_length_total] = (unsigned char)0;
|
||||
|
||||
|
||||
if (sdu_lengths[num_sdus] > 128) {
|
||||
header_len_mcch = 3;
|
||||
}
|
||||
@@ -641,6 +672,7 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TBS =
|
||||
get_TBS_DL(/*cc->pmch_Config[0]->dataMCS_r9*/cc->MCH_pdu.mcs, to_prb(cc->mib->message.dl_Bandwidth));
|
||||
// do not let mcch and mtch multiplexing when relaying is active
|
||||
@@ -686,7 +718,7 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
|
||||
mbms_rab_id = cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9;
|
||||
|
||||
rlc_status =
|
||||
mac_rlc_status_ind(module_idP, 0, frameP, subframeP,
|
||||
mac_rlc_status_ind(module_idP, 0/*0xfffd*/, frameP, subframeP,
|
||||
module_idP, ENB_FLAG_YES, MBMS_FLAG_YES,
|
||||
cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9,
|
||||
//MTCH,
|
||||
@@ -697,36 +729,77 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
|
||||
bytes_in_buffer = rlc_status.bytes_in_buffer;
|
||||
|
||||
|
||||
msi_sfs = rlc_status.bytes_in_buffer/TBS+(rlc_status.bytes_in_buffer%TBS?1:0);
|
||||
if( !(mcch_flag==1 || msi_flag==1) )
|
||||
msi_sfs = rlc_status.bytes_in_buffer/(TBS- header_len_mcch - header_len_msi -sdu_length_total - header_len_mtch)+(rlc_status.bytes_in_buffer%(TBS- header_len_mcch - header_len_msi -sdu_length_total - header_len_mtch)?1:0);
|
||||
//uint16_t msi_control_element[29], *msi_ptr;
|
||||
//
|
||||
//
|
||||
uint16_t TBS_MTCH =
|
||||
get_TBS_DL(cc->pmch_Config[0]->dataMCS_r9, to_prb(cc->mib->message.dl_Bandwidth));
|
||||
if(msi_flag==1 && buffer_pointer!=NULL){
|
||||
msi_ptr = &msi_control_element[0];
|
||||
|
||||
//memcpy(buffer_pointer,
|
||||
// msi_control_element, msi_length);
|
||||
|
||||
// msi_pmch_stop = rlc_status.bytes_in_buffer/TBS+(rlc_status.bytes_in_buffer%TBS?1:0);
|
||||
msi_pmch_stop = (rlc_status.bytes_in_buffer - header_len_mcch - header_len_msi -sdu_length_total - header_len_mtch)/(TBS_MTCH/*- header_len_mcch - header_len_msi -sdu_length_total*/ - header_len_mtch)+((rlc_status.bytes_in_buffer-TBS-header_len_mcch - header_len_msi -sdu_length_total)%(TBS_MTCH/*- header_len_mcch - header_len_msi -sdu_length_total*/ - header_len_mtch)?0:0);
|
||||
|
||||
if( msi_pmch_stop > cc->pmch_Config[0]->sf_AllocEnd_r9)
|
||||
LOG_E(MAC,"e-MBMS Buffer Overflow\n");
|
||||
if(msi_pmch_stop>=num_sf_alloc /*&& msi_pmch_stop <=cc->pmch_Config[0]->sf_AllocEnd_r9*/) {
|
||||
((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0; // last subframeP of this mtch (only one mtch now) & stop_sf limited to 256
|
||||
//((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = msi_pmch_stop;
|
||||
((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = (msi_pmch_stop <=cc->pmch_Config[0]->sf_AllocEnd_r9 ? msi_pmch_stop: cc->pmch_Config[0]->sf_AllocEnd_r9);
|
||||
msi_pmch_stop = (msi_pmch_stop <=cc->pmch_Config[0]->sf_AllocEnd_r9 ? msi_pmch_stop: cc->pmch_Config[0]->sf_AllocEnd_r9);
|
||||
}else{
|
||||
((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0x7; // last subframeP of this mtch (only one mtch now)
|
||||
((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = 0xFF;
|
||||
msi_pmch_stop=0;
|
||||
}
|
||||
LOG_I(MAC,"frameP %d, subframeP %d rlc_status.bytes_in_buffer %d stop_sf_LSB %d\n",frameP,subframeP,rlc_status.bytes_in_buffer,((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB);
|
||||
//LOG_W(MAC,"frameP %d, subframeP %d rlc_status.bytes_in_buffer %d stop_sf_LSB %d msi_calc:%d remainder %d\n",frameP,subframeP,rlc_status.bytes_in_buffer,((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB,rlc_status.bytes_in_buffer/(TBS_MTCH/*- header_len_mcch - header_len_msi -sdu_length_total*/ - header_len_mtch)+((rlc_status.bytes_in_buffer-TBS-header_len_mcch - header_len_msi -sdu_length_total)%(TBS_MTCH/*- header_len_mcch - header_len_msi -sdu_length_total*/ - header_len_mtch)?0:0),((rlc_status.bytes_in_buffer-TBS-header_len_mcch - header_len_msi -sdu_length_total)%(TBS_MTCH/*- header_len_mcch - header_len_msi -sdu_length_total*/ - header_len_mtch)?0:0));
|
||||
|
||||
memcpy(buffer_pointer,
|
||||
msi_control_element, msi_length);
|
||||
|
||||
}
|
||||
|
||||
LOG_D(MAC,
|
||||
"e-MBMS log channel %u frameP %d, subframeP %d, rlc_status.bytes_in_buffer is %d TBS %d pmch_stop %d msi_sfs %d\n",
|
||||
MTCH, frameP, subframeP, rlc_status.bytes_in_buffer,TBS,msi_pmch_stop,msi_sfs);
|
||||
"e-MBMS log channel %u frameP %d, subframeP %d, rlc_status.bytes_in_buffer is %d TBS_MTCH %d pmch_stop %d msi_sfs %d\n",
|
||||
MTCH, frameP, subframeP, rlc_status.bytes_in_buffer,TBS_MTCH,msi_pmch_stop,msi_sfs);
|
||||
|
||||
if (rlc_status.bytes_in_buffer > 0 || msi_pmch_stop > 0 /*msi_pmch_stop>=num_sf_alloc*/ ) {
|
||||
if ((rlc_status.bytes_in_buffer > 0 && msi_pmch_stop > 0) && ((msi_flag!=1 || mcch_flag!=1)) /*|| (rlc_status.bytes_in_buffer > 0 && (msi_flag==1 || mcch_flag==1))*//*|| msi_sfs > cc->pmch_Config[0]->sf_AllocEnd_r9 */ /*msi_pmch_stop>=num_sf_alloc*/ ) {
|
||||
//if(rlc_status.bytes_in_buffer > 0){
|
||||
LOG_I(MAC,
|
||||
LOG_D(MAC,
|
||||
"[eNB %d][MBMS USER-PLANE], CC_id %d, Frame %d, MTCH->MCH, Requesting %d bytes from RLC (header len mtch %d) rlc_status.bytes_in_buffer %d\n",
|
||||
module_idP, CC_id, frameP,
|
||||
TBS - header_len_mcch - header_len_msi -
|
||||
sdu_length_total - header_len_mtch, header_len_mtch, rlc_status.bytes_in_buffer);
|
||||
|
||||
sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, 0, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_YES,cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9, 0, //not used
|
||||
sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, 0/*0xfffd*/, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_YES,cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9, 0, //not used
|
||||
(char *)
|
||||
&mch_buffer[sdu_length_total]
|
||||
,0,
|
||||
0
|
||||
);
|
||||
|
||||
// LOG_I(MAC,"RLC %x:",(unsigned char)mch_buffer[sdu_length_total]);
|
||||
// for (int kk = 7; kk >= 0; kk--)
|
||||
// {
|
||||
// printf("%d",(((unsigned char)mch_buffer[sdu_length_total]) >> kk) & 1 ? '1' : '0');
|
||||
// }
|
||||
// printf("\n");
|
||||
|
||||
//sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP,frameP, MBMS_FLAG_NO, MTCH+(MAX_NUM_RB*(MAX_MOBILES_PER_ENB+1)), (char*)&mch_buffer[sdu_length_total]);
|
||||
LOG_I(MAC,
|
||||
LOG_D(MAC,
|
||||
"[eNB %d][MBMS USER-PLANE] CC_id %d Got %d bytes for MTCH %d msi_pmch_stop %d msi_sfs %d sdu_lengths[num_sdus] %d\n",
|
||||
module_idP, CC_id, sdu_lengths[num_sdus], MTCH,msi_pmch_stop,msi_sfs, sdu_lengths[num_sdus]);
|
||||
cc->mtch_active = 1;
|
||||
sdu_lcids[num_sdus] = cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9/*MTCH*/;
|
||||
sdu_length_total += sdu_lengths[num_sdus];
|
||||
|
||||
if (msi_pmch_stop != 0)
|
||||
if (msi_pmch_stop != 0 && msi_flag !=1)
|
||||
msi_pmch_stop--;
|
||||
|
||||
|
||||
@@ -833,14 +906,14 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
|
||||
}
|
||||
|
||||
/* Tracing of PDU is done on UE side */
|
||||
if (opt_enabled == 1) {
|
||||
trace_pdu(DIRECTION_DOWNLINK, (uint8_t *) cc->MCH_pdu.payload, TBS, module_idP, WS_M_RNTI , 0xffff, // M_RNTI = 6 in wirehsark
|
||||
//if (opt_enabled == 1) {
|
||||
trace_pdu(DIRECTION_DOWNLINK, (uint8_t *) cc->MCH_pdu.payload, TBS, module_idP, WS_M_RNTI , 0xfffd, // M_RNTI = 6 in wirehsark
|
||||
RC.mac[module_idP]->frame,
|
||||
RC.mac[module_idP]->subframe, 0, 0);
|
||||
LOG_D(OPT,
|
||||
"[eNB %d][MCH] CC_id %d Frame %d : MAC PDU with size %d\n",
|
||||
module_idP, CC_id, frameP, TBS);
|
||||
}
|
||||
//}
|
||||
|
||||
eNB_MAC_INST *eNB = RC.mac[module_idP];
|
||||
dl_req = &eNB->DL_req[CC_id].dl_config_request_body;
|
||||
@@ -1370,7 +1443,7 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
|
||||
header_len_msi = 3;
|
||||
}
|
||||
|
||||
LOG_D(MAC,
|
||||
LOG_W(MAC,
|
||||
"[eNB %d] CC_id %d Frame %d : MSI->MCH, length of MSI is %d bytes TBS %d, bytes in buffer %d stop_sf_LSB %d msi_sfs %d cc->pmch_Config[0]->sf_AllocEnd_r9 %ld\n",
|
||||
module_idP, CC_id, frameP, msi_length,TBS, bytes_in_buffer,msi_pmch_stop,msi_sfs,cc->pmch_Config[0]->sf_AllocEnd_r9);
|
||||
|
||||
@@ -1485,7 +1558,7 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
|
||||
mbms_rab_id = cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9;
|
||||
|
||||
rlc_status =
|
||||
mac_rlc_status_ind(module_idP, 0, frameP, subframeP,
|
||||
mac_rlc_status_ind(module_idP, 0/*0xfffd*/, frameP, subframeP,
|
||||
module_idP, ENB_FLAG_YES, MBMS_FLAG_YES,
|
||||
cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9,
|
||||
//MTCH,
|
||||
@@ -1510,7 +1583,7 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
|
||||
TBS - header_len_mcch - header_len_msi -
|
||||
sdu_length_total - header_len_mtch, header_len_mtch, rlc_status.bytes_in_buffer);
|
||||
|
||||
sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, 0, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_YES,cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9, 0, //not used
|
||||
sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, 0/*0xfffd*/, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_YES,cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9, 0, //not used
|
||||
(char *)
|
||||
&mch_buffer[sdu_length_total]
|
||||
,0,
|
||||
@@ -1632,14 +1705,14 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
|
||||
}
|
||||
|
||||
/* Tracing of PDU is done on UE side */
|
||||
if (opt_enabled == 1) {
|
||||
//if (opt_enabled == 1) {
|
||||
trace_pdu(DIRECTION_DOWNLINK, (uint8_t *) cc->MCH_pdu.payload, TBS, module_idP, WS_M_RNTI , 0xffff, // M_RNTI = 6 in wirehsark
|
||||
RC.mac[module_idP]->frame,
|
||||
RC.mac[module_idP]->subframe, 0, 0);
|
||||
LOG_D(OPT,
|
||||
"[eNB %d][MCH] CC_id %d Frame %d : MAC PDU with size %d\n",
|
||||
module_idP, CC_id, frameP, TBS);
|
||||
}
|
||||
//}
|
||||
|
||||
/*
|
||||
for (j=0;j<sdu_length_total;j++)
|
||||
@@ -1669,12 +1742,12 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
MCH_PDU *get_mch_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
sub_frame_t subframeP) {
|
||||
// RC.mac[module_idP]->MCH_pdu.mcs=0;
|
||||
//LOG_D(MAC," MCH_pdu.mcs is %d\n", RC.mac[module_idP]->MCH_pdu.mcs);
|
||||
//#warning "MCH pdu should take the CC_id index"
|
||||
return (&RC.mac[module_idP]->common_channels[CC_id].MCH_pdu);
|
||||
sub_frame_t subframeP)
|
||||
{
|
||||
// RC.mac[module_idP]->MCH_pdu.mcs=0;
|
||||
//LOG_D(MAC," MCH_pdu.mcs is %d\n", RC.mac[module_idP]->MCH_pdu.mcs);
|
||||
//#warning "MCH pdu should take the CC_id index"
|
||||
return (&RC.mac[module_idP]->common_channels[CC_id].MCH_pdu);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
|
||||
//#include "PHY/defs_common.h"
|
||||
#include "mac.h"
|
||||
|
||||
#include "RRC/LTE/rrc_defs.h"
|
||||
|
||||
extern const uint32_t BSR_TABLE[BSR_TABLE_SIZE];
|
||||
@@ -51,13 +50,9 @@ extern const uint8_t cqi2fmt2x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE];
|
||||
extern UE_RRC_INST *UE_rrc_inst;
|
||||
extern UE_MAC_INST *UE_mac_inst;
|
||||
|
||||
|
||||
extern eNB_ULSCH_INFO eNB_ulsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES_PER_ENB]; // eNBxUE = 8x8
|
||||
extern eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES_PER_ENB]; // eNBxUE = 8x8
|
||||
|
||||
|
||||
|
||||
|
||||
extern unsigned char NB_INST;
|
||||
extern unsigned char NB_eNB_INST;
|
||||
extern uint16_t NB_UE_INST;
|
||||
@@ -65,7 +60,6 @@ extern uint16_t NB_THREAD_INST;
|
||||
extern unsigned char NB_RN_INST;
|
||||
extern unsigned short NODE_ID[1];
|
||||
|
||||
|
||||
extern int cqi_to_mcs[16];
|
||||
|
||||
extern uint32_t RRC_CONNECTION_FLAG;
|
||||
|
||||
@@ -746,6 +746,9 @@ ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
|
||||
LOG_D(MAC, "[UE %d] parse_mch_header, found %d sdus\n", module_idP,
|
||||
num_sdu);
|
||||
|
||||
if(sdu[0]==0 && sdu[1]==0)
|
||||
num_sdu=0;
|
||||
|
||||
for (i = 0; i < num_sdu; i++) {
|
||||
if (rx_lcids[i] == MCH_SCHDL_INFO) {
|
||||
if (rx_lengths[i] & 0x01) {
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file extern.h
|
||||
* \brief NR mac externs
|
||||
* \author G. Casati
|
||||
* \date 2019
|
||||
* \version 1.0
|
||||
* \email guido.casati@iis.fraunhofer.de
|
||||
* @ingroup _mac
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __NR_MAC_EXTERN_H__
|
||||
#define __NR_MAC_EXTERN_H__
|
||||
|
||||
//#include "PHY/defs_common.h"
|
||||
#include "nr_mac.h"
|
||||
#include "RRC/LTE/rrc_defs.h"
|
||||
#include "common/ran_context.h"
|
||||
|
||||
/* extern const uint32_t BSR_TABLE[BSR_TABLE_SIZE];
|
||||
extern const uint32_t Extended_BSR_TABLE[BSR_TABLE_SIZE];
|
||||
extern const uint8_t cqi2fmt0_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE];
|
||||
extern const uint8_t cqi2fmt1x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE];
|
||||
extern const uint8_t cqi2fmt2x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE];
|
||||
extern UE_RRC_INST *UE_rrc_inst;
|
||||
extern eNB_ULSCH_INFO eNB_ulsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES_PER_ENB]; // eNBxUE = 8x8
|
||||
extern eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES_PER_ENB]; // eNBxUE = 8x8
|
||||
extern int cqi_to_mcs[16];
|
||||
extern uint32_t RRC_CONNECTION_FLAG;
|
||||
extern uint8_t rb_table[34];
|
||||
extern mac_rlc_am_muilist_t rlc_am_mui;
|
||||
extern SCHEDULER_MODES global_scheduler_mode;
|
||||
extern unsigned char NB_UE_INST;*/
|
||||
|
||||
extern unsigned char NB_INST;
|
||||
extern unsigned char NB_eNB_INST;
|
||||
extern unsigned char NB_RN_INST;
|
||||
extern unsigned short NODE_ID[1];
|
||||
|
||||
/* Scheduler */
|
||||
extern RAN_CONTEXT_t RC;
|
||||
extern uint8_t nfapi_mode;
|
||||
|
||||
/*#if defined(PRE_SCD_THREAD)
|
||||
extern uint16_t pre_nb_rbs_required[2][MAX_NUM_CCs][NUMBER_OF_UE_MAX];
|
||||
extern uint8_t dlsch_ue_select_tbl_in_use;
|
||||
extern uint8_t new_dlsch_ue_select_tbl_in_use;
|
||||
extern boolean_t pre_scd_activeUE[NUMBER_OF_UE_MAX];
|
||||
extern eNB_UE_STATS pre_scd_eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
|
||||
#endif*/
|
||||
|
||||
#endif //DEF_H
|
||||
@@ -37,10 +37,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define NR_BCCH_DL_SCH 3 // SI
|
||||
|
||||
#define NR_BCCH_BCH 5 // MIB
|
||||
|
||||
/*!\brief UE layer 2 status */
|
||||
typedef enum {
|
||||
UE_CONNECTION_OK = 0,
|
||||
@@ -49,4 +45,4 @@ typedef enum {
|
||||
UE_PHY_HO_PRACH
|
||||
} NR_UE_L2_STATE_t;
|
||||
|
||||
#endif /*__LAYER2_MAC_DEFS_H__ */
|
||||
#endif /*__LAYER2_NR_UE_MAC_DEFS_H__ */
|
||||
|
||||
@@ -30,6 +30,10 @@
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include "mac_defs.h"
|
||||
|
||||
//extern NR_UE_MAC_INST_t *UE_mac_inst;
|
||||
|
||||
// Type0-PDCCH search space
|
||||
extern const int32_t table_38213_13_1_c2[16];
|
||||
extern const int32_t table_38213_13_1_c3[16];
|
||||
|
||||
@@ -125,17 +125,31 @@ uint32_t get_ssb_slot(uint32_t ssb_index);
|
||||
uint32_t mr_ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, uint8_t eNB_id, uint16_t rnti, sub_frame_t subframe);
|
||||
|
||||
|
||||
|
||||
/* \brief Get payload (MAC PDU) from UE PHY
|
||||
@param module_idP Instance id of UE in machine
|
||||
@param CC_id Component Carrier index
|
||||
@param frameP Current Rx frame
|
||||
@param ttiP Current Rx tti subframe
|
||||
@param pdu Pointer to the MAC PDU
|
||||
@param pdu_len Length of the MAC PDU
|
||||
@param eNB_id Index of eNB that UE is attached to
|
||||
@returns void
|
||||
*/
|
||||
void nr_ue_send_sdu(module_id_t module_idP,uint8_t CC_id, frame_t frameP, uint8_t ttiP,
|
||||
uint8_t * pdu, uint16_t pdu_len, uint8_t gNB_index, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment);
|
||||
|
||||
void nr_ue_process_mac_pdu(
|
||||
module_id_t module_idP,
|
||||
uint8_t CC_id,
|
||||
frame_t frameP,
|
||||
uint8_t *pduP,
|
||||
uint16_t mac_pdu_len,
|
||||
uint8_t eNB_index);
|
||||
uint16_t mac_pdu_len,
|
||||
uint8_t eNB_index,
|
||||
NR_UL_TIME_ALIGNMENT_t *ul_time_alignment);
|
||||
|
||||
int8_t nr_ue_process_dlsch(module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_nr_dci_indication_t *dci_ind, void *pduP, uint32_t pdu_len);
|
||||
|
||||
void nr_ue_send_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP, sub_frame_t subframeP, uint8_t * sdu, uint16_t sdu_len, uint8_t eNB_index);
|
||||
|
||||
uint8_t nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
sub_frame_t subframe, uint8_t eNB_index,
|
||||
uint8_t *ulsch_buffer, uint16_t buflen, uint8_t *access_mode);
|
||||
|
||||
@@ -32,7 +32,14 @@
|
||||
|
||||
//#include "defs.h"
|
||||
#include "mac_proto.h"
|
||||
#include "executables/nr-softmodem.h"
|
||||
#include "../../ARCH/COMMON/common_lib.h"
|
||||
//#undef MALLOC
|
||||
#include "assertions.h"
|
||||
#include "PHY/types.h"
|
||||
#include "PHY/defs_UE.h"
|
||||
#include "openair2/LAYER2/RLC/rlc.h"
|
||||
#include "openair2/LAYER2/PDCP_v10.1.0/pdcp.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
|
||||
static NR_UE_MAC_INST_t *nr_ue_mac_inst;
|
||||
|
||||
|
||||
@@ -21,25 +21,41 @@
|
||||
|
||||
/* \file ue_procedures.c
|
||||
* \brief procedures related to UE
|
||||
* \author R. Knopp, K.H. HSU
|
||||
* \author R. Knopp, K.H. HSU, G. Casati
|
||||
* \date 2018
|
||||
* \version 0.1
|
||||
* \company Eurecom / NTUST
|
||||
* \email: knopp@eurecom.fr, kai-hsiang.hsu@eurecom.fr
|
||||
* \email: knopp@eurecom.fr, kai-hsiang.hsu@eurecom.fr, guido.casati@iis.fraunhofer.de
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
|
||||
/* MAC related headers */
|
||||
#include "mac_proto.h"
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac.h"
|
||||
#include "mac_extern.h"
|
||||
//#include "LAYER2/MAC/mac_vars.h" // TODO Note that mac_vars.h is not NR specific and this should be updated
|
||||
// also, the use of the same should be updated in nr-softmodem and nr-uesoftmodem
|
||||
|
||||
/* PHY UE related headers*/
|
||||
#include "SCHED_NR_UE/defs.h"
|
||||
|
||||
#include "RRC/NR_UE/rrc_proto.h"
|
||||
#include "assertions.h"
|
||||
#include "PHY/defs_nr_UE.h"
|
||||
|
||||
/*Openair Packet Tracer */
|
||||
#include "UTIL/OPT/opt.h"
|
||||
#include "OCG.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
/* log utils */
|
||||
#include "common/utils/LOG/log.h"
|
||||
//#include "openair2/LAYER2/MAC/mac.h"
|
||||
//#include "openair2/LAYER2/RLC/rlc.h"
|
||||
#include "SIMULATION/TOOLS/sim.h" // for taus
|
||||
#include "openair2/LAYER2/NR_MAC_COMMON/nr_mac.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
@@ -2031,20 +2047,85 @@ int8_t nr_ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, uint8_t e
|
||||
return 0;
|
||||
}
|
||||
|
||||
void nr_ue_send_sdu(module_id_t module_idP,
|
||||
uint8_t CC_id,
|
||||
frame_t frameP,
|
||||
uint8_t ttiP,
|
||||
uint8_t * pdu, uint16_t pdu_len, uint8_t gNB_index,
|
||||
NR_UL_TIME_ALIGNMENT_t *ul_time_alignment){
|
||||
|
||||
LOG_D(MAC, "Handling PDU frame %d slot %d\n", frameP, ttiP);
|
||||
|
||||
uint8_t * pduP = pdu;
|
||||
NR_UE_MAC_INST_t *UE_mac_inst = get_mac_inst(module_idP);
|
||||
|
||||
/*
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(&UE_mac_inst[module_idP].rx_dlsch_sdu);
|
||||
#endif
|
||||
*/
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_SDU, VCD_FUNCTION_IN);
|
||||
|
||||
//LOG_D(MAC,"sdu: %x.%x.%x\n",sdu[0],sdu[1],sdu[2]);
|
||||
|
||||
if (opt_enabled) {
|
||||
trace_pdu(DIRECTION_DOWNLINK, pduP, pdu_len, module_idP, WS_C_RNTI,
|
||||
(int)(UE_mac_inst[module_idP].cs_RNTI), frameP, ttiP, 0, 0); //subframeP
|
||||
LOG_D(OPT, "[UE %d][DLSCH] Frame %d trace pdu for rnti %p with size %d\n",
|
||||
module_idP, frameP, UE_mac_inst[module_idP].cs_RNTI, pdu_len);
|
||||
}
|
||||
|
||||
/*
|
||||
#ifdef DEBUG_HEADER_PARSING
|
||||
LOG_D(MAC, "[UE %d] ue_send_sdu : Frame %d gNB_index %d : num_ce %d num_sdu %d\n",
|
||||
module_idP, frameP, gNB_index, num_ce, num_sdu);
|
||||
#endif
|
||||
*/
|
||||
|
||||
/*
|
||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||
LOG_T(MAC, "[UE %d] First 32 bytes of DLSCH : \n", module_idP);
|
||||
for (i = 0; i < 32; i++) {
|
||||
LOG_T(MAC, "%x.", sdu[i]);
|
||||
}
|
||||
LOG_T(MAC, "\n");
|
||||
#endif
|
||||
*/
|
||||
|
||||
// Processing MAC PDU
|
||||
// it parses MAC CEs subheaders, MAC CEs, SDU subheaderds and SDUs
|
||||
if (pduP != NULL)
|
||||
nr_ue_process_mac_pdu(module_idP, CC_id, frameP, pduP, pdu_len, gNB_index, ul_time_alignment);
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_SDU, VCD_FUNCTION_OUT);
|
||||
|
||||
/*
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(&UE_mac_inst[module_idP].rx_dlsch_sdu);
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
void nr_ue_process_mac_pdu(
|
||||
module_id_t module_idP,
|
||||
uint8_t CC_id,
|
||||
frame_t frameP,
|
||||
uint8_t *pduP,
|
||||
uint16_t mac_pdu_len,
|
||||
uint8_t eNB_index){
|
||||
uint16_t mac_pdu_len,
|
||||
uint8_t gNB_index,
|
||||
NR_UL_TIME_ALIGNMENT_t *ul_time_alignment){
|
||||
|
||||
uint8_t *pdu_ptr = pduP;
|
||||
uint16_t pdu_len = mac_pdu_len;
|
||||
// This function is adapting code from the old
|
||||
// parse_header(...) and ue_send_sdu(...) functions of OAI LTE
|
||||
|
||||
uint16_t mac_ce_len;
|
||||
uint16_t mac_subheader_len;
|
||||
uint16_t mac_sdu_len;
|
||||
uint8_t *pdu_ptr = pduP, rx_lcid, done = 0;
|
||||
int pdu_len = mac_pdu_len;
|
||||
uint16_t mac_ce_len, mac_subheader_len, mac_sdu_len;
|
||||
|
||||
//NR_UE_MAC_INST_t *UE_mac_inst = get_mac_inst(module_idP);
|
||||
//uint8_t scs = UE_mac_inst->mib->subCarrierSpacingCommon;
|
||||
//uint16_t bwp_ul_NB_RB = UE_mac_inst->initial_bwp_ul.N_RB;
|
||||
|
||||
// For both DL/UL-SCH
|
||||
// Except:
|
||||
@@ -2070,15 +2151,19 @@ void nr_ue_process_mac_pdu(
|
||||
// L: The Length field indicates the length of the corresponding MAC SDU or variable-sized MAC CE in bytes. There is one L field per MAC subheader except for subheaders corresponding to fixed-sized MAC CEs and padding. The size of the L field is indicated by the F field;
|
||||
// F: lenght of L is 0:8 or 1:16 bits wide
|
||||
// R: Reserved bit, set to zero.
|
||||
|
||||
uint8_t done = 0;
|
||||
|
||||
while (!done || pdu_len <= 0){
|
||||
mac_ce_len = 0x0000;
|
||||
mac_subheader_len = 0x0001; // default to fixed-length subheader = 1-oct
|
||||
mac_sdu_len = 0x0000;
|
||||
switch(((NR_MAC_SUBHEADER_FIXED *)pdu_ptr)->LCID){
|
||||
while (!done && pdu_len > 0){
|
||||
mac_ce_len = 0;
|
||||
mac_subheader_len = 1; // default to fixed-length subheader = 1-oct
|
||||
mac_sdu_len = 0;
|
||||
rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pdu_ptr)->LCID;
|
||||
|
||||
switch(rx_lcid){
|
||||
// MAC CE
|
||||
|
||||
/*#ifdef DEBUG_HEADER_PARSING
|
||||
LOG_D(MAC, "[UE] LCID %d, PDU length %d\n", ((NR_MAC_SUBHEADER_FIXED *)pdu_ptr)->LCID, pdu_len);
|
||||
#endif*/
|
||||
case DL_SCH_LCID_CCCH:
|
||||
// MSG4 RRC Connection Setup 38.331
|
||||
// varialbe length
|
||||
@@ -2088,8 +2173,11 @@ void nr_ue_process_mac_pdu(
|
||||
mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
|
||||
mac_subheader_len = 3;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case DL_SCH_LCID_TCI_STATE_ACT_UE_SPEC_PDSCH:
|
||||
|
||||
// 38.321 Ch6.1.3.14
|
||||
// varialbe length
|
||||
mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L;
|
||||
@@ -2175,10 +2263,27 @@ void nr_ue_process_mac_pdu(
|
||||
case DL_SCH_LCID_TA_COMMAND:
|
||||
// 38.321 Ch6.1.3.4
|
||||
mac_ce_len = 1;
|
||||
|
||||
/*uint8_t ta_command = ((NR_MAC_CE_TA *)pdu_ptr)[1].TA_COMMAND;
|
||||
uint8_t tag_id = ((NR_MAC_CE_TA *)pdu_ptr)[1].TAGID;*/
|
||||
|
||||
ul_time_alignment->apply_ta = 1;
|
||||
ul_time_alignment->ta_command = ((NR_MAC_CE_TA *)pdu_ptr)[1].TA_COMMAND;
|
||||
ul_time_alignment->tag_id = ((NR_MAC_CE_TA *)pdu_ptr)[1].TAGID;
|
||||
|
||||
/*
|
||||
#ifdef DEBUG_HEADER_PARSING
|
||||
LOG_D(MAC, "[UE] CE %d : UE Timing Advance : %d\n", i, pdu_ptr[1]);
|
||||
#endif
|
||||
*/
|
||||
|
||||
LOG_D(MAC, "Received TA_COMMAND %u TAGID %u CC_id %d\n", ul_time_alignment->ta_command, ul_time_alignment->tag_id, CC_id);
|
||||
|
||||
break;
|
||||
case DL_SCH_LCID_CON_RES_ID:
|
||||
// 38.321 Ch6.1.3.3
|
||||
mac_ce_len = 6;
|
||||
|
||||
break;
|
||||
case DL_SCH_LCID_PADDING:
|
||||
done = 1;
|
||||
@@ -2186,22 +2291,57 @@ void nr_ue_process_mac_pdu(
|
||||
break;
|
||||
|
||||
// MAC SDU
|
||||
|
||||
case DL_SCH_LCID_DCCH:
|
||||
// check if LCID is valid at current time.
|
||||
case UL_SCH_LCID_SRB2:
|
||||
// check if LCID is valid at current time.
|
||||
case UL_SCH_LCID_SRB3:
|
||||
|
||||
case DL_SCH_LCID_DCCH1:
|
||||
// check if LCID is valid at current time.
|
||||
|
||||
default:
|
||||
// check if LCID is valid at current time.
|
||||
mac_sdu_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L;
|
||||
mac_subheader_len = 2;
|
||||
if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){
|
||||
mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
|
||||
//mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
|
||||
mac_subheader_len = 3;
|
||||
mac_sdu_len = ((uint16_t)(((NR_MAC_SUBHEADER_LONG *) pdu_ptr)->L1 & 0x7f) << 8)
|
||||
| ((uint16_t)((NR_MAC_SUBHEADER_LONG *) pdu_ptr)->L2 & 0xff);
|
||||
|
||||
} else {
|
||||
mac_sdu_len = (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L;
|
||||
mac_subheader_len = 2;
|
||||
}
|
||||
// DRB LCID by RRC
|
||||
break;
|
||||
|
||||
LOG_D(MAC, "[UE %d] Frame %d : DLSCH -> DL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, gNB_index, mac_sdu_len);
|
||||
|
||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||
LOG_T(MAC, "[UE %d] First 32 bytes of DLSCH : \n", module_idP);
|
||||
|
||||
for (i = 0; i < 32; i++)
|
||||
LOG_T(MAC, "%x.", (pdu_ptr + mac_subheader_len)[i]);
|
||||
|
||||
LOG_T(MAC, "\n");
|
||||
#endif
|
||||
|
||||
if (IS_SOFTMODEM_NOS1){
|
||||
if (rx_lcid < NB_RB_MAX && rx_lcid >= DL_SCH_LCID_DTCH) {
|
||||
|
||||
mac_rlc_data_ind(module_idP,
|
||||
0x1234,
|
||||
gNB_index,
|
||||
frameP,
|
||||
ENB_FLAG_NO,
|
||||
MBMS_FLAG_NO,
|
||||
rx_lcid,
|
||||
(char *) (pdu_ptr + mac_subheader_len),
|
||||
mac_sdu_len,
|
||||
1,
|
||||
NULL);
|
||||
} else {
|
||||
LOG_E(MAC, "[UE %d] Frame %d : unknown LCID %d (gNB %d)\n", module_idP, frameP, rx_lcid, gNB_index);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
pdu_ptr += ( mac_subheader_len + mac_ce_len + mac_sdu_len );
|
||||
pdu_len -= ( mac_subheader_len + mac_ce_len + mac_sdu_len );
|
||||
@@ -2212,114 +2352,6 @@ void nr_ue_process_mac_pdu(
|
||||
//---------------------------------------------------------------------------------
|
||||
|
||||
|
||||
unsigned char *nr_parse_header(unsigned char *mac_header,
|
||||
unsigned char *num_ce,
|
||||
unsigned char *num_sdu,
|
||||
unsigned char *rx_ces,
|
||||
unsigned char *rx_lcids,
|
||||
unsigned short *rx_lengths,
|
||||
unsigned short tb_length)
|
||||
{
|
||||
|
||||
unsigned char not_done = 1, num_ces = 0, num_cont_res =
|
||||
0, num_padding = 0, num_sdus = 0, lcid, num_sdu_cnt;
|
||||
unsigned char *mac_header_ptr = mac_header;
|
||||
unsigned short length, ce_len = 0;
|
||||
|
||||
while (not_done == 1) {
|
||||
|
||||
if (((SCH_SUBHEADER_FIXED *) mac_header_ptr)->E == 0) {
|
||||
// printf("E=0\n");
|
||||
not_done = 0;
|
||||
}
|
||||
|
||||
lcid = ((SCH_SUBHEADER_FIXED *) mac_header_ptr)->LCID;
|
||||
|
||||
if (lcid < UE_CONT_RES) {
|
||||
//printf("[MAC][UE] header %x.%x.%x\n",mac_header_ptr[0],mac_header_ptr[1],mac_header_ptr[2]);
|
||||
if (not_done == 0) { // last MAC SDU, length is implicit
|
||||
mac_header_ptr++;
|
||||
length =
|
||||
tb_length - (mac_header_ptr - mac_header) - ce_len;
|
||||
|
||||
for (num_sdu_cnt = 0; num_sdu_cnt < num_sdus;
|
||||
num_sdu_cnt++) {
|
||||
length -= rx_lengths[num_sdu_cnt];
|
||||
}
|
||||
} else {
|
||||
if (((SCH_SUBHEADER_LONG *) mac_header_ptr)->F == 1) {
|
||||
length =
|
||||
((((SCH_SUBHEADER_LONG *) mac_header_ptr)->
|
||||
L_MSB & 0x7f)
|
||||
<< 8) | (((SCH_SUBHEADER_LONG *) mac_header_ptr)->
|
||||
L_LSB & 0xff);
|
||||
mac_header_ptr += 3;
|
||||
#ifdef DEBUG_HEADER_PARSING
|
||||
LOG_D(MAC, "[UE] parse long sdu, size %x \n", length);
|
||||
#endif
|
||||
|
||||
} else { //if (((SCH_SUBHEADER_SHORT *)mac_header_ptr)->F == 0) {
|
||||
length = ((SCH_SUBHEADER_SHORT *) mac_header_ptr)->L;
|
||||
mac_header_ptr += 2;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_HEADER_PARSING
|
||||
LOG_D(MAC, "[UE] sdu %d lcid %d length %d (offset now %ld)\n",
|
||||
num_sdus, lcid, length, mac_header_ptr - mac_header);
|
||||
#endif
|
||||
rx_lcids[num_sdus] = lcid;
|
||||
rx_lengths[num_sdus] = length;
|
||||
num_sdus++;
|
||||
} else { // This is a control element subheader
|
||||
if (lcid == SHORT_PADDING) {
|
||||
num_padding++;
|
||||
mac_header_ptr++;
|
||||
} else {
|
||||
rx_ces[num_ces] = lcid;
|
||||
num_ces++;
|
||||
mac_header_ptr++;
|
||||
|
||||
if (lcid == TIMING_ADV_CMD) {
|
||||
ce_len++;
|
||||
} else if (lcid == UE_CONT_RES) {
|
||||
|
||||
// FNA: check MAC Header is one of thoses defined in Annex B of 36.321
|
||||
// Check there is only 1 Contention Resolution
|
||||
if (num_cont_res) {
|
||||
LOG_W(MAC,
|
||||
"[UE] Msg4 Wrong received format: More than 1 Contention Resolution\n");
|
||||
// exit parsing
|
||||
return NULL;
|
||||
|
||||
}
|
||||
// UE_CONT_RES shall never be the last subheader unless this is the only MAC subheader
|
||||
if ((not_done == 0)
|
||||
&& ((num_sdus) || (num_ces > 1) || (num_padding))) {
|
||||
LOG_W(MAC,
|
||||
"[UE] Msg4 Wrong received format: Contention Resolution after num_ces=%d num_sdus=%d num_padding=%d\n",
|
||||
num_ces, num_sdus, num_padding);
|
||||
// exit parsing
|
||||
return NULL;
|
||||
}
|
||||
num_cont_res++;
|
||||
ce_len += 6;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_HEADER_PARSING
|
||||
LOG_D(MAC, "[UE] ce %d lcid %d (offset now %ld)\n", num_ces,
|
||||
lcid, mac_header_ptr - mac_header);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
*num_ce = num_ces;
|
||||
*num_sdu = num_sdus;
|
||||
|
||||
return (mac_header_ptr);
|
||||
}
|
||||
|
||||
uint16_t
|
||||
nr_generate_ulsch_pdu(uint8_t *mac_pdu,
|
||||
uint8_t *sdus_payload,
|
||||
@@ -2382,103 +2414,6 @@ nr_generate_ulsch_pdu(uint8_t *mac_pdu,
|
||||
}
|
||||
|
||||
|
||||
/* LTE based function to be substituted once NR version is ready */
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
nr_ue_send_sdu(module_id_t module_idP,
|
||||
uint8_t CC_id,
|
||||
frame_t frameP,
|
||||
sub_frame_t subframeP,
|
||||
uint8_t * sdu, uint16_t sdu_len, uint8_t eNB_index)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
|
||||
unsigned char rx_ces[MAX_NUM_CE], num_ce, num_sdu, i, *payload_ptr;
|
||||
unsigned char rx_lcids[NB_RB_MAX];
|
||||
unsigned short rx_lengths[NB_RB_MAX];
|
||||
|
||||
|
||||
//LOG_D(MAC,"sdu: %x.%x.%x\n",sdu[0],sdu[1],sdu[2]);
|
||||
|
||||
|
||||
payload_ptr =
|
||||
nr_parse_header(sdu, &num_ce, &num_sdu, rx_ces, rx_lcids, rx_lengths,
|
||||
sdu_len);
|
||||
|
||||
#ifdef DEBUG_HEADER_PARSING
|
||||
LOG_D(MAC,
|
||||
"[UE %d] ue_send_sdu : Frame %d eNB_index %d : num_ce %d num_sdu %d\n",
|
||||
module_idP, frameP, eNB_index, num_ce, num_sdu);
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||
LOG_T(MAC, "[UE %d] First 32 bytes of DLSCH : \n", module_idP);
|
||||
|
||||
for (i = 0; i < 32; i++) {
|
||||
LOG_T(MAC, "%x.", sdu[i]);
|
||||
}
|
||||
|
||||
LOG_T(MAC, "\n");
|
||||
#endif
|
||||
|
||||
if (payload_ptr != NULL) {
|
||||
|
||||
for (i = 0; i < num_ce; i++) {
|
||||
// printf("ce %d : %d\n",i,rx_ces[i]);
|
||||
switch (rx_ces[i]) {
|
||||
case UE_CONT_RES:
|
||||
|
||||
break;
|
||||
|
||||
case TIMING_ADV_CMD:
|
||||
|
||||
break;
|
||||
|
||||
case DRX_CMD:
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < num_sdu; i++) {
|
||||
#ifdef DEBUG_HEADER_PARSING
|
||||
LOG_I(MAC, "[UE] SDU %d : LCID %d, length %d\n", i,
|
||||
rx_lcids[i], rx_lengths[i]);
|
||||
#endif
|
||||
if ((rx_lcids[i] < NB_RB_MAX) && (rx_lcids[i] > DCCH1)) {
|
||||
|
||||
LOG_D(MAC,
|
||||
"[UE %d] Frame %d : DLSCH -> DL-DTCH%d (eNB %d, %d bytes)\n",
|
||||
module_idP, frameP, rx_lcids[i], eNB_index,
|
||||
rx_lengths[i]);
|
||||
|
||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||
LOG_I(MAC, "Printing MAC PDU contents at slot: %d \n", subframeP);
|
||||
int j;
|
||||
for (j = 0; j < 20; j++) //rx_lengths[i]
|
||||
LOG_I(MAC, "%x.", (unsigned char) payload_ptr[j]);
|
||||
LOG_I(MAC, "\n");
|
||||
#endif
|
||||
mac_rlc_data_ind(module_idP,
|
||||
4660, //UE_mac_inst[module_idP].crnti //hardcode value corresponding to the one from the eNB
|
||||
eNB_index,
|
||||
frameP,
|
||||
ENB_FLAG_NO,
|
||||
MBMS_FLAG_NO,
|
||||
rx_lcids[i],
|
||||
(char *) payload_ptr, rx_lengths[i], 1,
|
||||
NULL);
|
||||
} else {
|
||||
LOG_E(MAC, "[UE %d] Frame %d : unknown LCID %d (eNB %d)\n",
|
||||
module_idP, frameP, rx_lcids[i], eNB_index);
|
||||
}
|
||||
payload_ptr += rx_lengths[i];
|
||||
}
|
||||
} // end if (payload_ptr != NULL)
|
||||
|
||||
}
|
||||
|
||||
|
||||
uint8_t
|
||||
nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
sub_frame_t subframe, uint8_t eNB_index,
|
||||
@@ -2524,7 +2459,7 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
buflen_remain =
|
||||
buflen - (total_rlc_pdu_header_len + sdu_length_total + MAX_RLC_SDU_SUBHEADER_SIZE);
|
||||
LOG_D(MAC,
|
||||
"[UE %d] Frame %d : Before while loop UL-DXCH -> ULSCH, RLC %d has %d bytes to "
|
||||
"[UE %d] Frame %d : UL-DXCH -> ULSCH, RLC %d has %d bytes to "
|
||||
"send (Transport Block size %d SDU Length Total %d , mac header len %d, buflen_remain %d )\n", //BSR byte before Tx=%d
|
||||
module_idP, frameP, lcid, lcid_buffer_occupancy_new,
|
||||
buflen, sdu_length_total,
|
||||
@@ -2575,12 +2510,6 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
lcid);
|
||||
buflen_remain =
|
||||
buflen - (total_rlc_pdu_header_len + sdu_length_total + MAX_RLC_SDU_SUBHEADER_SIZE);
|
||||
LOG_D(MAC,
|
||||
"[UE %d] Frame %d : UL-DXCH -> ULSCH, RLC %d has %d bytes to "
|
||||
"send (Transport Block size %d SDU Length Total %d , mac header len %d, buflen_remain %d )\n", //BSR byte before Tx=%d
|
||||
module_idP, frameP, lcid, lcid_buffer_occupancy_new,
|
||||
buflen, sdu_length_total,
|
||||
total_rlc_pdu_header_len, buflen_remain);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,9 +33,10 @@
|
||||
#include "assertions.h"
|
||||
|
||||
#include "LAYER2/MAC/mac.h"
|
||||
#include "LAYER2/MAC/mac_extern.h"
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
|
||||
#include "LAYER2/MAC/mac_proto.h"
|
||||
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "UTIL/OPT/opt.h"
|
||||
@@ -64,10 +65,6 @@
|
||||
#define ENABLE_MAC_PAYLOAD_DEBUG
|
||||
#define DEBUG_eNB_SCHEDULER 1
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
extern int phy_test;
|
||||
extern uint8_t nfapi_mode;
|
||||
|
||||
uint16_t nr_pdcch_order_table[6] = { 31, 31, 511, 2047, 2047, 8191 };
|
||||
|
||||
void clear_nr_nfapi_information(gNB_MAC_INST * gNB,
|
||||
@@ -302,12 +299,12 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
|
||||
protocol_ctxt_t ctxt;
|
||||
|
||||
int CC_id, i = -1;
|
||||
UE_list_t *UE_list = &RC.nrmac[module_idP]->UE_list;
|
||||
rnti_t rnti;
|
||||
|
||||
NR_COMMON_channels_t *cc = RC.nrmac[module_idP]->common_channels;
|
||||
//nfapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config = NULL;
|
||||
int CC_id, i = -1, UE_id = 0;
|
||||
gNB_MAC_INST *gNB = RC.nrmac[module_idP];
|
||||
UE_list_t *UE_list = &gNB->UE_list;
|
||||
rnti_t rnti;
|
||||
UE_sched_ctrl_t *ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
|
||||
NR_COMMON_channels_t *cc = gNB->common_channels;
|
||||
|
||||
start_meas(&RC.nrmac[module_idP]->eNB_scheduler);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_IN);
|
||||
@@ -375,12 +372,28 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
|
||||
// Phytest scheduling
|
||||
|
||||
if (slot_rxP==NR_UPLINK_SLOT){
|
||||
// TODO once RACH is available, start ta_timer when UE is connected
|
||||
if (ue_sched_ctl->ta_timer) ue_sched_ctl->ta_timer--;
|
||||
|
||||
if (ue_sched_ctl->ta_timer == 0) {
|
||||
gNB->ta_command = ue_sched_ctl->ta_update;
|
||||
/* if time is up, then set the timer to not send it for 5 frames
|
||||
// regardless of the TA value */
|
||||
ue_sched_ctl->ta_timer = 100;
|
||||
/* reset ta_update */
|
||||
ue_sched_ctl->ta_update = 31;
|
||||
/* MAC CE flag indicating TA length */
|
||||
gNB->ta_len = 2;
|
||||
}
|
||||
|
||||
if (slot_rxP == NR_UPLINK_SLOT){
|
||||
nr_schedule_uss_ulsch_phytest(&RC.nrmac[module_idP]->UL_tti_req[0], frame_rxP, slot_rxP);
|
||||
}
|
||||
|
||||
if (slot_txP==NR_DOWNLINK_SLOT){
|
||||
if (slot_txP == NR_DOWNLINK_SLOT){
|
||||
nr_schedule_uss_dlsch_phytest(module_idP, frame_txP, slot_txP,NULL);
|
||||
// resetting ta flag
|
||||
gNB->ta_len = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "assertions.h"
|
||||
#include "LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
|
||||
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
#include "LAYER2/MAC/mac_extern.h"
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "UTIL/OPT/opt.h"
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file gNB_scheduler_dlsch.c
|
||||
* \brief procedures related to gNB for the DLSCH transport channel
|
||||
* \author Guido Casati
|
||||
* \date 2019
|
||||
* \email: guido.casati@iis.fraunhofe.de
|
||||
* \version 1.0
|
||||
* @ingroup _mac
|
||||
|
||||
*/
|
||||
|
||||
/*PHY*/
|
||||
#include "PHY/CODING/coding_defs.h"
|
||||
#include "PHY/defs_nr_common.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
|
||||
/*MAC*/
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac.h"
|
||||
#include "LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
|
||||
#include "LAYER2/MAC/mac.h"
|
||||
|
||||
/*NFAPI*/
|
||||
#include "nfapi_nr_interface.h"
|
||||
/*TAG*/
|
||||
#include "NR_TAG-Id.h"
|
||||
|
||||
|
||||
int nr_generate_dlsch_pdu(module_id_t module_idP,
|
||||
unsigned char *sdus_payload,
|
||||
unsigned char *mac_pdu,
|
||||
unsigned char num_sdus,
|
||||
unsigned short *sdu_lengths,
|
||||
unsigned char *sdu_lcids,
|
||||
unsigned char drx_cmd,
|
||||
unsigned char *ue_cont_res_id,
|
||||
unsigned short post_padding){
|
||||
|
||||
gNB_MAC_INST *gNB = RC.nrmac[module_idP];
|
||||
|
||||
NR_MAC_SUBHEADER_FIXED *mac_pdu_ptr = (NR_MAC_SUBHEADER_FIXED *) mac_pdu;
|
||||
unsigned char * dlsch_buffer_ptr = sdus_payload;
|
||||
uint8_t last_size = 0;
|
||||
int offset = 0, mac_ce_size, i, timing_advance_cmd, tag_id = 0;
|
||||
|
||||
// MAC CEs
|
||||
uint8_t mac_header_control_elements[16], *ce_ptr;
|
||||
ce_ptr = &mac_header_control_elements[0];
|
||||
|
||||
// 1) Compute MAC CE and related subheaders
|
||||
|
||||
// DRX command subheader (MAC CE size 0)
|
||||
if (drx_cmd != 255) {
|
||||
mac_pdu_ptr->R = 0;
|
||||
mac_pdu_ptr->LCID = DL_SCH_LCID_DRX;
|
||||
//last_size = 1;
|
||||
mac_pdu_ptr++;
|
||||
}
|
||||
|
||||
// Timing Advance subheader
|
||||
/* This was done only when timing_advance_cmd != 31
|
||||
// now TA is always send when ta_timer resets regardless of its value
|
||||
// this is done to avoid issues with the timeAlignmentTimer which is
|
||||
// supposed to monitor if the UE received TA or not */
|
||||
if (gNB->ta_len){
|
||||
mac_pdu_ptr->R = 0;
|
||||
mac_pdu_ptr->LCID = DL_SCH_LCID_TA_COMMAND;
|
||||
//last_size = 1;
|
||||
mac_pdu_ptr++;
|
||||
|
||||
// TA MAC CE (1 octet)
|
||||
timing_advance_cmd = gNB->ta_command;
|
||||
AssertFatal(timing_advance_cmd < 64,"timing_advance_cmd %d > 63\n", timing_advance_cmd);
|
||||
((NR_MAC_CE_TA *) ce_ptr)->TA_COMMAND = timing_advance_cmd; //(timing_advance_cmd+31)&0x3f;
|
||||
if (gNB->tag->tag_Id != 0){
|
||||
tag_id = gNB->tag->tag_Id;
|
||||
((NR_MAC_CE_TA *) ce_ptr)->TAGID = tag_id;
|
||||
}
|
||||
|
||||
LOG_D(MAC, "NR MAC CE timing advance command = %d (%d) TAG ID = %d\n", timing_advance_cmd, ((NR_MAC_CE_TA *) ce_ptr)->TA_COMMAND, tag_id);
|
||||
mac_ce_size = sizeof(NR_MAC_CE_TA);
|
||||
|
||||
// Copying bytes for MAC CEs to the mac pdu pointer
|
||||
memcpy((void *) mac_pdu_ptr, (void *) ce_ptr, mac_ce_size);
|
||||
ce_ptr += mac_ce_size;
|
||||
mac_pdu_ptr += (unsigned char) mac_ce_size;
|
||||
}
|
||||
|
||||
|
||||
// Contention resolution fixed subheader and MAC CE
|
||||
if (ue_cont_res_id) {
|
||||
mac_pdu_ptr->R = 0;
|
||||
mac_pdu_ptr->LCID = DL_SCH_LCID_CON_RES_ID;
|
||||
mac_pdu_ptr++;
|
||||
//last_size = 1;
|
||||
|
||||
// contention resolution identity MAC ce has a fixed 48 bit size
|
||||
// this contains the UL CCCH SDU. If UL CCCH SDU is longer than 48 bits,
|
||||
// it contains the first 48 bits of the UL CCCH SDU
|
||||
LOG_T(MAC, "[gNB ][RAPROC] Generate contention resolution msg: %x.%x.%x.%x.%x.%x\n",
|
||||
ue_cont_res_id[0], ue_cont_res_id[1], ue_cont_res_id[2],
|
||||
ue_cont_res_id[3], ue_cont_res_id[4], ue_cont_res_id[5]);
|
||||
|
||||
// Copying bytes (6 octects) to CEs pointer
|
||||
mac_ce_size = 6;
|
||||
memcpy(ce_ptr, ue_cont_res_id, mac_ce_size);
|
||||
|
||||
// Copying bytes for MAC CEs to mac pdu pointer
|
||||
memcpy((void *) mac_pdu_ptr, (void *) ce_ptr, mac_ce_size);
|
||||
ce_ptr += mac_ce_size;
|
||||
mac_pdu_ptr += (unsigned char) mac_ce_size;
|
||||
}
|
||||
|
||||
|
||||
// 2) Generation of DLSCH MAC SDU subheaders
|
||||
for (i = 0; i < num_sdus; i++) {
|
||||
LOG_D(MAC, "[gNB] Generate DLSCH header num sdu %d len sdu %d\n", num_sdus, sdu_lengths[i]);
|
||||
|
||||
if (sdu_lengths[i] < 128) {
|
||||
((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->R = 0;
|
||||
((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->F = 0;
|
||||
((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->LCID = sdu_lcids[i];
|
||||
((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->L = (unsigned char) sdu_lengths[i];
|
||||
last_size = 2;
|
||||
} else {
|
||||
((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->R = 0;
|
||||
((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->F = 1;
|
||||
((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->LCID = sdu_lcids[i];
|
||||
((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->L1 = ((unsigned short) sdu_lengths[i] >> 8) & 0x7f;
|
||||
((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->L2 = (unsigned short) sdu_lengths[i] & 0xff;
|
||||
last_size = 3;
|
||||
}
|
||||
|
||||
mac_pdu_ptr += last_size;
|
||||
|
||||
// 3) cycle through SDUs, compute each relevant and place dlsch_buffer in
|
||||
memcpy((void *) mac_pdu_ptr, (void *) dlsch_buffer_ptr, sdu_lengths[i]);
|
||||
dlsch_buffer_ptr+= sdu_lengths[i];
|
||||
mac_pdu_ptr += sdu_lengths[i];
|
||||
}
|
||||
|
||||
// 4) Compute final offset for padding
|
||||
if (post_padding > 0) {
|
||||
((NR_MAC_SUBHEADER_FIXED *) mac_pdu_ptr)->R = 0;
|
||||
((NR_MAC_SUBHEADER_FIXED *) mac_pdu_ptr)->LCID = DL_SCH_LCID_PADDING;
|
||||
mac_pdu_ptr++;
|
||||
|
||||
} else {
|
||||
// no MAC subPDU with padding
|
||||
}
|
||||
|
||||
// compute final offset
|
||||
offset = ((unsigned char *) mac_pdu_ptr - mac_pdu);
|
||||
|
||||
//printf("Offset %d \n", ((unsigned char *) mac_pdu_ptr - mac_pdu));
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
/* functionalities of this function have been moved to nr_schedule_uss_dlsch_phytest */
|
||||
void nr_schedule_ue_spec(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){
|
||||
}
|
||||
@@ -21,9 +21,9 @@
|
||||
|
||||
/*! \file gNB_scheduler_phytest.c
|
||||
* \brief gNB scheduling procedures in phy_test mode
|
||||
* \author Guy De Souza
|
||||
* \author Guy De Souza, G. Casati
|
||||
* \date 07/2018
|
||||
* \email: desouza@eurecom.fr
|
||||
* \email: desouza@eurecom.fr, guido.casati@iis.fraunhofer.de
|
||||
* \version 1.0
|
||||
* @ingroup _mac
|
||||
*/
|
||||
@@ -35,9 +35,12 @@
|
||||
#include "PHY/NR_TRANSPORT/nr_dci.h"
|
||||
#include "executables/nr-softmodem.h"
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
extern RAN_CONTEXT_t RC;
|
||||
//#define ENABLE_MAC_PAYLOAD_DEBUG 1
|
||||
|
||||
uint8_t mac_pdu[MAX_NR_DLSCH_PAYLOAD_BYTES];
|
||||
|
||||
/*Scheduling of DLSCH with associated DCI in common search space
|
||||
* current version has only a DCI for type 1 PDCCH for C_RNTI*/
|
||||
void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
|
||||
@@ -155,16 +158,13 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
|
||||
}
|
||||
}
|
||||
|
||||
int configure_fapi_dl_Tx(nfapi_nr_dl_config_request_body_t *dl_req,
|
||||
nfapi_tx_request_pdu_t *TX_req,
|
||||
nfapi_nr_config_request_t *cfg,
|
||||
nfapi_nr_coreset_t *coreset,
|
||||
nfapi_nr_search_space_t *search_space,
|
||||
int16_t pdu_index,
|
||||
nfapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config) {
|
||||
int configure_fapi_dl_pdu(nfapi_nr_dl_config_request_body_t *dl_req,
|
||||
nfapi_nr_config_request_t *cfg,
|
||||
nfapi_nr_coreset_t *coreset,
|
||||
nfapi_nr_search_space_t *search_space,
|
||||
nfapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config){
|
||||
nfapi_nr_dl_config_request_pdu_t *dl_config_dci_pdu;
|
||||
nfapi_nr_dl_config_request_pdu_t *dl_config_dlsch_pdu;
|
||||
int TBS;
|
||||
uint16_t rnti = 0x1234;
|
||||
int dl_carrier_bandwidth = cfg->rf_config.dl_carrier_bandwidth.value;
|
||||
dl_config_dci_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
|
||||
@@ -241,9 +241,20 @@ int configure_fapi_dl_Tx(nfapi_nr_dl_config_request_body_t *dl_req,
|
||||
params_rel15->rb_offset,
|
||||
params_rel15->first_symbol,
|
||||
params_rel15->search_space_type);
|
||||
|
||||
nr_get_tbs_dl(&dl_config_dlsch_pdu->dlsch_pdu, dl_config_dci_pdu->dci_dl_pdu, *cfg);
|
||||
TBS = dl_config_dlsch_pdu->dlsch_pdu.dlsch_pdu_rel15.transport_block_size;
|
||||
LOG_D(MAC, "DLSCH PDU: start PRB %d n_PRB %d start symbol %d nb_symbols %d nb_layers %d nb_codewords %d mcs %d TBS: %d\n",
|
||||
|
||||
return dl_config_dlsch_pdu->dlsch_pdu.dlsch_pdu_rel15.transport_block_size/8;
|
||||
}
|
||||
|
||||
void configure_fapi_dl_Tx(nfapi_nr_dl_config_request_body_t *dl_req,
|
||||
nfapi_tx_request_pdu_t *tx_req,
|
||||
int tbs_bytes,
|
||||
int16_t pdu_index){
|
||||
nfapi_nr_dl_config_request_pdu_t *dl_config_dlsch_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu + 1];
|
||||
nfapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_pdu_rel15 = &dl_config_dlsch_pdu->dlsch_pdu.dlsch_pdu_rel15;
|
||||
|
||||
LOG_D(MAC, "DLSCH PDU: start PRB %d n_PRB %d start symbol %d nb_symbols %d nb_layers %d nb_codewords %d mcs %d TBS (bytes): %d\n",
|
||||
dlsch_pdu_rel15->start_prb,
|
||||
dlsch_pdu_rel15->n_prb,
|
||||
dlsch_pdu_rel15->start_symbol,
|
||||
@@ -251,80 +262,62 @@ int configure_fapi_dl_Tx(nfapi_nr_dl_config_request_body_t *dl_req,
|
||||
dlsch_pdu_rel15->nb_layers,
|
||||
dlsch_pdu_rel15->nb_codewords,
|
||||
dlsch_pdu_rel15->mcs_idx,
|
||||
TBS);
|
||||
tbs_bytes);
|
||||
|
||||
dl_req->number_dci++;
|
||||
dl_req->number_pdsch_rnti++;
|
||||
dl_req->number_pdu+=2;
|
||||
TX_req->pdu_length = dlsch_pdu_rel15->transport_block_size/8;
|
||||
TX_req->pdu_index = pdu_index++;
|
||||
TX_req->num_segments = 1;
|
||||
return TBS/8; //Return TBS in bytes
|
||||
|
||||
tx_req->pdu_length = tbs_bytes;
|
||||
tx_req->pdu_index = pdu_index++;
|
||||
tx_req->num_segments = 1;
|
||||
//tx_req->segments[0].segment_length = 8;
|
||||
tx_req->segments[0].segment_length = tbs_bytes + 2;
|
||||
tx_req->segments[0].segment_data = mac_pdu;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
|
||||
frame_t frameP,
|
||||
sub_frame_t slotP,
|
||||
nfapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config) {
|
||||
LOG_D(MAC, "In nr_schedule_uss_dlsch_phytest \n");
|
||||
uint8_t CC_id;
|
||||
gNB_MAC_INST *nr_mac = RC.nrmac[module_idP];
|
||||
//NR_COMMON_channels_t *cc = nr_mac->common_channels;
|
||||
nfapi_nr_dl_config_request_body_t *dl_req;
|
||||
nfapi_tx_request_pdu_t *TX_req;
|
||||
uint16_t rnti = 0x1234;
|
||||
nfapi_nr_config_request_t *cfg = &nr_mac->config[0];
|
||||
uint16_t sfn_sf = frameP << 7 | slotP;
|
||||
// everything here is hard-coded to 30 kHz
|
||||
//int scs = get_dlscs(cfg);
|
||||
//int slots_per_frame = get_spf(cfg);
|
||||
int TBS;
|
||||
int TBS_bytes;
|
||||
int lcid;
|
||||
int ta_len = 0;
|
||||
int header_length_total=0;
|
||||
int header_length_last;
|
||||
int sdu_length_total = 0;
|
||||
mac_rlc_status_resp_t rlc_status;
|
||||
uint16_t sdu_lengths[NB_RB_MAX];
|
||||
int num_sdus = 0;
|
||||
unsigned char dlsch_buffer[MAX_DLSCH_PAYLOAD_BYTES];
|
||||
int offset;
|
||||
int UE_id = 0;
|
||||
unsigned char sdu_lcids[NB_RB_MAX];
|
||||
int padding = 0, post_padding = 0;
|
||||
UE_list_t *UE_list = &nr_mac->UE_list;
|
||||
DLSCH_PDU DLSCH_pdu;
|
||||
//DLSCH_PDU *DLSCH_pdu = (DLSCH_PDU*) malloc(sizeof(DLSCH_PDU));
|
||||
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
LOG_D(MAC, "Scheduling UE specific search space DCI type 1 for CC_id %d\n",CC_id);
|
||||
dl_req = &nr_mac->DL_req[CC_id].dl_config_request_body;
|
||||
TX_req = &nr_mac->TX_req[CC_id].tx_request_body.tx_pdu_list[nr_mac->TX_req[CC_id].tx_request_body.number_of_pdus];
|
||||
gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP];
|
||||
nfapi_nr_dl_config_request_body_t *dl_req;
|
||||
nfapi_tx_request_pdu_t *tx_req;
|
||||
mac_rlc_status_resp_t rlc_status;
|
||||
nfapi_nr_config_request_t *cfg = &gNB_mac->config[0];
|
||||
|
||||
unsigned char sdu_lcids[NB_RB_MAX] = {0};
|
||||
uint16_t sdu_lengths[NB_RB_MAX] = {0};
|
||||
|
||||
int post_padding = 0, ta_len = 0, header_length_total = 0, sdu_length_total = 0, num_sdus = 0;
|
||||
int CC_id, lcid, offset, i, header_length_last, TBS_bytes;
|
||||
|
||||
int UE_id = 0;
|
||||
uint16_t rnti = 0x1234;
|
||||
uint16_t sfn_sf = frameP << 7 | slotP;
|
||||
|
||||
uint8_t mac_sdus[MAX_NR_DLSCH_PAYLOAD_BYTES];
|
||||
|
||||
for (CC_id = 0; CC_id < RC.nb_nr_mac_CC[module_idP]; CC_id++) {
|
||||
|
||||
LOG_D(MAC, "Scheduling UE specific search space DCI type 1 for UE_id %d CC_id %d frame %d slot %d\n", UE_id, CC_id, frameP, slotP);
|
||||
|
||||
dl_req = &gNB_mac->DL_req[CC_id].dl_config_request_body;
|
||||
tx_req = &gNB_mac->TX_req[CC_id].tx_request_body.tx_pdu_list[gNB_mac->TX_req[CC_id].tx_request_body.number_of_pdus];
|
||||
ta_len = gNB_mac->ta_len;
|
||||
|
||||
TBS_bytes = configure_fapi_dl_pdu(dl_req, cfg, &gNB_mac->coreset[CC_id][1], &gNB_mac->search_space[CC_id][1], dlsch_config);
|
||||
|
||||
//The --NOS1 use case currently schedules DLSCH transmissions only when there is IP traffic arriving
|
||||
//through the LTE stack
|
||||
if (IS_SOFTMODEM_NOS1) {
|
||||
memset(&DLSCH_pdu, 0, sizeof(DLSCH_pdu));
|
||||
int ta_update = 31;
|
||||
ta_len = 0;
|
||||
// Hardcode it for now
|
||||
TBS = 6784/8; //TBS in bytes
|
||||
//nr_get_tbs_dl(&dl_config_dlsch_pdu->dlsch_pdu, dl_config_dci_pdu->dci_dl_pdu, *cfg);
|
||||
//TBS = dl_config_dlsch_pdu->dlsch_pdu.dlsch_pdu_rel15.transport_block_size;
|
||||
if (IS_SOFTMODEM_NOS1){
|
||||
|
||||
for (lcid = NB_RB_MAX - 1; lcid >= DTCH; lcid--) {
|
||||
// TODO: check if the lcid is active
|
||||
LOG_D(MAC, "[eNB %d], Frame %d, DTCH%d->DLSCH, Checking RLC status (tbs %d, len %d)\n",
|
||||
module_idP, frameP, lcid, TBS,
|
||||
TBS - ta_len - header_length_total - sdu_length_total - 3);
|
||||
LOG_D(MAC, "[gNB %d], Frame %d, DTCH%d->DLSCH, Checking RLC status (TBS %d bytes, len %d)\n",
|
||||
module_idP, frameP, lcid, TBS_bytes, TBS_bytes - ta_len - header_length_total - sdu_length_total - 3);
|
||||
|
||||
if (TBS - ta_len - header_length_total - sdu_length_total - 3 > 0) {
|
||||
if (TBS_bytes - ta_len - header_length_total - sdu_length_total - 3 > 0) {
|
||||
rlc_status = mac_rlc_status_ind(module_idP,
|
||||
rnti,
|
||||
module_idP,
|
||||
@@ -333,132 +326,121 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
|
||||
ENB_FLAG_YES,
|
||||
MBMS_FLAG_NO,
|
||||
lcid,
|
||||
TBS - ta_len - header_length_total - sdu_length_total - 3,
|
||||
TBS_bytes - ta_len - header_length_total - sdu_length_total - 3,
|
||||
0,
|
||||
0);
|
||||
|
||||
if (rlc_status.bytes_in_buffer > 0) {
|
||||
LOG_D(MAC,
|
||||
"[eNB %d][USER-PLANE DEFAULT DRB] Frame %d : DTCH->DLSCH, Requesting %d bytes from RLC (lcid %d total hdr len %d), TBS: %d \n \n",
|
||||
module_idP, frameP,
|
||||
TBS - ta_len - header_length_total - sdu_length_total - 3,
|
||||
lcid,
|
||||
header_length_total,
|
||||
TBS);
|
||||
LOG_D(MAC, "[gNB %d][USER-PLANE DEFAULT DRB] Frame %d : DTCH->DLSCH, Requesting %d bytes from RLC (lcid %d total hdr len %d), TBS_bytes: %d \n \n",
|
||||
module_idP, frameP, TBS_bytes - ta_len - header_length_total - sdu_length_total - 3,
|
||||
lcid, header_length_total, TBS_bytes);
|
||||
|
||||
sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP,
|
||||
rnti,
|
||||
module_idP,
|
||||
frameP,
|
||||
ENB_FLAG_YES,
|
||||
MBMS_FLAG_NO,
|
||||
lcid,
|
||||
TBS,
|
||||
(char *)&dlsch_buffer[sdu_length_total],
|
||||
0,
|
||||
0);
|
||||
LOG_D(MAC,
|
||||
"[eNB %d][USER-PLANE DEFAULT DRB] Got %d bytes for DTCH %d \n",
|
||||
module_idP, sdu_lengths[num_sdus], lcid);
|
||||
rnti,
|
||||
module_idP,
|
||||
frameP,
|
||||
ENB_FLAG_YES,
|
||||
MBMS_FLAG_NO,
|
||||
lcid,
|
||||
TBS_bytes,
|
||||
(char *)&mac_sdus[sdu_length_total],
|
||||
0,
|
||||
0);
|
||||
|
||||
LOG_D(MAC, "[gNB %d][USER-PLANE DEFAULT DRB] Got %d bytes for DTCH %d \n", module_idP, sdu_lengths[num_sdus], lcid);
|
||||
|
||||
sdu_lcids[num_sdus] = lcid;
|
||||
sdu_length_total += sdu_lengths[num_sdus];
|
||||
UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid]++;
|
||||
UE_list->eNB_UE_stats[CC_id][UE_id].lcid_sdu[num_sdus] = lcid;
|
||||
UE_list->eNB_UE_stats[CC_id][UE_id].sdu_length_tx[lcid] = sdu_lengths[num_sdus];
|
||||
UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[lcid] += sdu_lengths[num_sdus];
|
||||
header_length_last = 1 + 1 + (sdu_lengths[num_sdus] >= 128);
|
||||
header_length_total += header_length_last;
|
||||
|
||||
num_sdus++;
|
||||
UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer = 0;
|
||||
|
||||
//ue_sched_ctl->uplane_inactivity_timer = 0;
|
||||
}
|
||||
} else {
|
||||
// no TBS left
|
||||
break;
|
||||
} else { // no TBS_bytes left
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// last header does not have length field
|
||||
if (header_length_total) {
|
||||
header_length_total -= header_length_last;
|
||||
header_length_total++;
|
||||
}
|
||||
|
||||
if (ta_len + sdu_length_total + header_length_total > 0) {
|
||||
if (TBS - header_length_total - sdu_length_total - ta_len <= 2) {
|
||||
padding = TBS - header_length_total - sdu_length_total - ta_len;
|
||||
post_padding = 0;
|
||||
} else {
|
||||
padding = 0;
|
||||
post_padding = 1;
|
||||
}
|
||||
|
||||
offset = generate_dlsch_header((unsigned char *)nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0], //DLSCH_pdu.payload[0],
|
||||
num_sdus, //num_sdus
|
||||
sdu_lengths, //
|
||||
sdu_lcids, 255, // no drx
|
||||
ta_update, // timing advance
|
||||
NULL, // contention res id
|
||||
padding, post_padding);
|
||||
LOG_D(MAC, "Offset bits: %d \n", offset);
|
||||
// Probably there should be other actions done before that
|
||||
// cycle through SDUs and place in dlsch_buffer
|
||||
//memcpy(&UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset], dlsch_buffer, sdu_length_total);
|
||||
memcpy(&nr_mac->UE_list.DLSCH_pdu[CC_id][0][UE_id].payload[0][offset], dlsch_buffer, sdu_length_total);
|
||||
|
||||
// fill remainder of DLSCH with 0
|
||||
for (int j = 0; j < (TBS - sdu_length_total - offset); j++) {
|
||||
//UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset + sdu_length_total + j] = 0;
|
||||
nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0][offset + sdu_length_total + j] = 0;
|
||||
}
|
||||
|
||||
TBS_bytes = configure_fapi_dl_Tx(dl_req, TX_req, cfg, &nr_mac->coreset[CC_id][1], &nr_mac->search_space[CC_id][1], nr_mac->pdu_index[CC_id], dlsch_config);
|
||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||
LOG_I(MAC, "Printing first 10 payload bytes at the gNB side, Frame: %d, slot: %d, , TBS size: %d \n \n", frameP, slotP, TBS_bytes);
|
||||
|
||||
for(int i = 0; i < 10; i++) { // TBS_bytes dlsch_pdu_rel15->transport_block_size/8 6784/8
|
||||
LOG_I(MAC, "%x. ", ((uint8_t *)nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0])[i]);
|
||||
}
|
||||
|
||||
#endif
|
||||
//TX_req->segments[0].segment_length = 8;
|
||||
TX_req->segments[0].segment_length = TBS_bytes +2;
|
||||
TX_req->segments[0].segment_data = nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0];
|
||||
nr_mac->TX_req[CC_id].tx_request_body.number_of_pdus++;
|
||||
nr_mac->TX_req[CC_id].sfn_sf = sfn_sf;
|
||||
nr_mac->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
|
||||
nr_mac->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
|
||||
} //if (ta_len + sdu_length_total + header_length_total > 0)
|
||||
} //if (IS_SOFTMODEM_NOS1)
|
||||
//When the --NOS1 option is not enabled, DLSCH transmissions with random data
|
||||
//occur every time that the current function is called (dlsch phytest mode)
|
||||
else {
|
||||
TBS_bytes = configure_fapi_dl_Tx(dl_req, TX_req, cfg, &nr_mac->coreset[CC_id][1], &nr_mac->search_space[CC_id][1], nr_mac->pdu_index[CC_id], dlsch_config);
|
||||
//When the --NOS1 option is not enabled, DLSCH transmissions with random data
|
||||
//occur every time that the current function is called (dlsch phytest mode)
|
||||
|
||||
for(int i = 0; i < TBS_bytes; i++) { //
|
||||
((uint8_t *)nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0])[i] = (unsigned char) rand();
|
||||
//LOG_I(MAC, "%x. ", ((uint8_t *)nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0])[i]);
|
||||
// fill dlsch_buffer with random data
|
||||
for (i = 0; i < TBS_bytes; i++){
|
||||
mac_sdus[i] = (unsigned char) rand(); //i&0xFF;
|
||||
}
|
||||
|
||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||
//Sending SDUs with size 1
|
||||
//Initialize elements of sdu_lcids and sdu_lengths
|
||||
sdu_lcids[0] = 0x05; // DRB
|
||||
sdu_lengths[0] = TBS_bytes - ta_len - 3;
|
||||
header_length_total += 2 + (sdu_lengths[0] >= 128);
|
||||
sdu_length_total += sdu_lengths[0];
|
||||
num_sdus +=1;
|
||||
} // else IS_SOFTMODEM_NOS1
|
||||
|
||||
if (frameP%100 == 0) {
|
||||
LOG_I(MAC, "Printing first 10 payload bytes at the gNB side, Frame: %d, slot: %d, TBS size: %d \n", frameP, slotP, TBS_bytes);
|
||||
// there is at least one SDU or TA command
|
||||
// if (num_sdus > 0 ){
|
||||
if (ta_len + sdu_length_total + header_length_total > 0) {
|
||||
|
||||
for(int i = 0; i < 10; i++) {
|
||||
LOG_I(MAC, "%x. ", ((uint8_t *)nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0])[i]);
|
||||
// Check if there is data from RLC or CE
|
||||
if (TBS_bytes >= 2 + header_length_total + sdu_length_total + ta_len) {
|
||||
// we have to consider padding
|
||||
// padding param currently not in use
|
||||
//padding = TBS_bytes - header_length_total - sdu_length_total - ta_len - 1;
|
||||
post_padding = 1;
|
||||
} else {
|
||||
//padding = 0;
|
||||
post_padding = 0;
|
||||
}
|
||||
|
||||
offset = nr_generate_dlsch_pdu(module_idP,
|
||||
(unsigned char *) mac_sdus,
|
||||
(unsigned char *) mac_pdu,
|
||||
num_sdus, //num_sdus
|
||||
sdu_lengths,
|
||||
sdu_lcids,
|
||||
255, // no drx
|
||||
NULL, // contention res id
|
||||
post_padding);
|
||||
|
||||
// Padding: fill remainder of DLSCH with 0
|
||||
if (post_padding > 0){
|
||||
for (int j = 0; j < (TBS_bytes - offset); j++)
|
||||
mac_pdu[offset + j] = 0;
|
||||
}
|
||||
|
||||
configure_fapi_dl_Tx(dl_req, tx_req, TBS_bytes, gNB_mac->pdu_index[CC_id]);
|
||||
|
||||
gNB_mac->TX_req[CC_id].tx_request_body.number_of_pdus++;
|
||||
gNB_mac->TX_req[CC_id].sfn_sf = sfn_sf;
|
||||
gNB_mac->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
|
||||
gNB_mac->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
|
||||
|
||||
if(IS_SOFTMODEM_NOS1){
|
||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||
LOG_I(MAC, "Printing first 10 payload bytes at the gNB side, Frame: %d, slot: %d, TBS size: %d \n \n", frameP, slotP, TBS_bytes);
|
||||
for(int i = 0; i < 10; i++) { // TBS_bytes dlsch_pdu_rel15->transport_block_size/8 6784/8
|
||||
LOG_I(MAC, "%x. ", mac_payload[i]);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||
if (frameP%100 == 0){
|
||||
LOG_I(MAC, "Printing first 10 payload bytes at the gNB side, Frame: %d, slot: %d, TBS size: %d \n", frameP, slotP, TBS_bytes);
|
||||
for(int i = 0; i < 10; i++) {
|
||||
LOG_I(MAC, "%x. ", mac_payload[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
//TX_req->segments[0].segment_length = 8;
|
||||
TX_req->segments[0].segment_length = TBS_bytes +2;
|
||||
TX_req->segments[0].segment_data = nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0];
|
||||
nr_mac->TX_req[CC_id].tx_request_body.number_of_pdus++;
|
||||
nr_mac->TX_req[CC_id].sfn_sf = sfn_sf;
|
||||
nr_mac->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
|
||||
nr_mac->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
|
||||
|
||||
}
|
||||
} //for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++)
|
||||
else { // There is no data from RLC or MAC header, so don't schedule
|
||||
}
|
||||
} // CC_id loop
|
||||
}
|
||||
|
||||
|
||||
@@ -744,7 +726,7 @@ void nr_process_mac_pdu(
|
||||
}
|
||||
}
|
||||
|
||||
void nr_rx_sdu(module_id_t module_idP,
|
||||
/*void nr_rx_sdu(module_id_t module_idP,
|
||||
uint8_t CC_id,
|
||||
frame_t frameP,
|
||||
uint8_t ttiP,
|
||||
@@ -777,195 +759,5 @@ void nr_rx_sdu(module_id_t module_idP,
|
||||
nr_process_mac_pdu(module_idP, CC_id, frameP, pduP, pdu_len);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* LTE based function to be substituted once NR version is ready */
|
||||
/*void
|
||||
nr_rx_sdu(const module_id_t enb_mod_idP,
|
||||
const int CC_idP,
|
||||
const frame_t frameP,
|
||||
const sub_frame_t subframeP,
|
||||
const rnti_t rntiP,
|
||||
uint8_t *sduP,
|
||||
const uint16_t sdu_lenP,
|
||||
const uint16_t timing_advance,
|
||||
const uint8_t ul_cqi)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
int current_rnti = 0;
|
||||
int UE_id = -1;
|
||||
int RA_id = 0;
|
||||
int old_rnti = -1;
|
||||
int old_UE_id = -1;
|
||||
int crnti_rx = 0;
|
||||
//int harq_pid = 0;
|
||||
int first_rb = 0;
|
||||
unsigned char num_ce = 0;
|
||||
unsigned char num_sdu = 0;
|
||||
unsigned char *payload_ptr = NULL;
|
||||
unsigned char rx_ces[MAX_NUM_CE];
|
||||
unsigned char rx_lcids[NB_RB_MAX];
|
||||
unsigned short rx_lengths[NB_RB_MAX];
|
||||
uint8_t lcgid = 0;
|
||||
int lcgid_updated[4] = {0, 0, 0, 0};
|
||||
//eNB_MAC_INST *mac = NULL;
|
||||
UE_list_t *UE_list = NULL;
|
||||
rrc_eNB_ue_context_t *ue_contextP = NULL;
|
||||
UE_sched_ctrl_t *UE_scheduling_control = NULL;
|
||||
UE_TEMPLATE *UE_template_ptr = NULL;
|
||||
// Init
|
||||
current_rnti = rntiP;
|
||||
UE_id = 0; //find_UE_id(enb_mod_idP, current_rnti);
|
||||
//mac = RC.mac[enb_mod_idP];
|
||||
//harq_pid = subframe2harqpid(&mac->common_channels[CC_idP], frameP, subframeP);
|
||||
//UE_list = &mac->UE_list;
|
||||
memset(rx_ces, 0, MAX_NUM_CE * sizeof(unsigned char));
|
||||
memset(rx_lcids, 0, NB_RB_MAX * sizeof(unsigned char));
|
||||
memset(rx_lengths, 0, NB_RB_MAX * sizeof(unsigned short));
|
||||
//start_meas(&mac->rx_ulsch_sdu);
|
||||
|
||||
payload_ptr = parse_ulsch_header(sduP, &num_ce, &num_sdu, rx_ces, rx_lcids, rx_lengths, sdu_lenP);
|
||||
|
||||
if (payload_ptr == NULL) {
|
||||
LOG_E(MAC,"[eNB %d] CC_id %d ulsch header unknown lcid(rnti %x, UE_id %d)\n",
|
||||
enb_mod_idP,
|
||||
CC_idP,
|
||||
current_rnti,
|
||||
UE_id);
|
||||
return;
|
||||
}
|
||||
|
||||
// Control element
|
||||
for (int i = 0; i < num_ce; i++) {
|
||||
|
||||
switch (rx_ces[i]) { // implement and process PHR + CRNTI + BSR
|
||||
case POWER_HEADROOM:
|
||||
|
||||
break;
|
||||
|
||||
case CRNTI:
|
||||
break;
|
||||
|
||||
case TRUNCATED_BSR:
|
||||
case SHORT_BSR:
|
||||
|
||||
break;
|
||||
|
||||
case LONG_BSR:
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_E(MAC, "[eNB %d] CC_id %d Received unknown MAC header (0x%02x)\n",
|
||||
enb_mod_idP,
|
||||
CC_idP,
|
||||
rx_ces[i]);
|
||||
break;
|
||||
} // end switch on control element
|
||||
} // end for loop on control element
|
||||
|
||||
for (int i = 0; i < num_sdu; i++) {
|
||||
LOG_D(MAC, "SDU Number %d MAC Subheader SDU_LCID %d, length %d\n",
|
||||
i,
|
||||
rx_lcids[i],
|
||||
rx_lengths[i]);
|
||||
T(T_ENB_MAC_UE_UL_SDU,
|
||||
T_INT(enb_mod_idP),
|
||||
T_INT(CC_idP),
|
||||
T_INT(current_rnti),
|
||||
T_INT(frameP),
|
||||
T_INT(subframeP),
|
||||
T_INT(rx_lcids[i]),
|
||||
T_INT(rx_lengths[i]));
|
||||
T(T_ENB_MAC_UE_UL_SDU_WITH_DATA,
|
||||
T_INT(enb_mod_idP),
|
||||
T_INT(CC_idP),
|
||||
T_INT(current_rnti),
|
||||
T_INT(frameP),
|
||||
T_INT(subframeP),
|
||||
T_INT(rx_lcids[i]),
|
||||
T_INT(rx_lengths[i]),
|
||||
T_BUFFER(payload_ptr, rx_lengths[i]));
|
||||
|
||||
switch (rx_lcids[i]) {
|
||||
case CCCH:
|
||||
|
||||
break;
|
||||
|
||||
case DCCH:
|
||||
case DCCH1:
|
||||
|
||||
break;
|
||||
|
||||
// all the DRBS
|
||||
case DTCH:
|
||||
default:
|
||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||
LOG_T(MAC, "offset: %d\n",
|
||||
(unsigned char) ((unsigned char *) payload_ptr - sduP));
|
||||
|
||||
for (int j = 0; j < 32; j++) {
|
||||
LOG_T(MAC, "%x ", payload_ptr[j]);
|
||||
}
|
||||
|
||||
LOG_T(MAC, "\n");
|
||||
#endif
|
||||
|
||||
if (rx_lcids[i] < NB_RB_MAX) {
|
||||
LOG_D(MAC, "[eNB %d] CC_id %d Frame %d : ULSCH -> UL-DTCH, received %d bytes from UE %d for lcid %d\n",
|
||||
enb_mod_idP,
|
||||
CC_idP,
|
||||
frameP,
|
||||
rx_lengths[i],
|
||||
UE_id,
|
||||
rx_lcids[i]);
|
||||
|
||||
if (UE_id != -1) {
|
||||
// Adjust buffer occupancy of the correponding logical channel group
|
||||
LOG_D(MAC, "[eNB %d] CC_id %d Frame %d : ULSCH -> UL-DTCH, received %d bytes from UE %d for lcid %d \n",
|
||||
enb_mod_idP,
|
||||
CC_idP,
|
||||
frameP,
|
||||
rx_lengths[i],
|
||||
UE_id,
|
||||
rx_lcids[i]);
|
||||
|
||||
|
||||
if ((rx_lengths[i] < SCH_PAYLOAD_SIZE_MAX) && (rx_lengths[i] > 0)) { // MAX SIZE OF transport block
|
||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||
LOG_I(MAC, "Printing UL MAC payload after removing the header: \n");
|
||||
for (int j = 0; j < rx_lengths[i] ; j++) {
|
||||
printf("%02x ",(unsigned char) *(payload_ptr+j));
|
||||
}
|
||||
pritnf("\n");
|
||||
#endif
|
||||
mac_rlc_data_ind(enb_mod_idP, current_rnti, enb_mod_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, rx_lcids[i], (char *) payload_ptr+1, rx_lengths[i], 1, NULL);
|
||||
} else { // rx_length[i] Max size
|
||||
//UE_list->eNB_UE_stats[CC_idP][UE_id].num_errors_rx += 1;
|
||||
LOG_E(MAC, "[eNB %d] CC_id %d Frame %d : Max size of transport block reached LCID %d from UE %d. Size of received payload: %d \n",
|
||||
enb_mod_idP,
|
||||
CC_idP,
|
||||
frameP,
|
||||
rx_lcids[i],
|
||||
UE_id,
|
||||
rx_lengths[i]);
|
||||
}
|
||||
} else { // end if (UE_id != -1)
|
||||
LOG_E(MAC,"[eNB %d] CC_id %d Frame %d : received unsupported or unknown LCID %d from UE %d ",
|
||||
enb_mod_idP,
|
||||
CC_idP,
|
||||
frameP,
|
||||
rx_lcids[i],
|
||||
UE_id);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
payload_ptr += rx_lengths[i];
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
#include "LAYER2/MAC/mac.h"
|
||||
#include "LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
|
||||
#include "LAYER2/MAC/mac_extern.h"
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
|
||||
|
||||
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
@@ -464,3 +464,21 @@ int get_symbolsperslot(nfapi_nr_config_request_t *cfg) {
|
||||
|
||||
}
|
||||
|
||||
int find_nrUE_id(module_id_t mod_idP, rnti_t rntiP) {
|
||||
|
||||
int UE_id;
|
||||
UE_list_t *UE_list = &RC.nrmac[mod_idP]->UE_list;
|
||||
|
||||
for (UE_id = 0; UE_id < MAX_MOBILES_PER_GNB; UE_id++) {
|
||||
if (UE_list->active[UE_id] == TRUE) {
|
||||
if (UE_list->UE_template[nrUE_PCCID(mod_idP, UE_id)][UE_id].rnti == rntiP) {
|
||||
return UE_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int nrUE_PCCID(module_id_t mod_idP, int ue_idP) {
|
||||
return (RC.nrmac[mod_idP]->UE_list.pCC_id[ue_idP]);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file gNB_scheduler_ulsch.c
|
||||
* \brief gNB procedures for the ULSCH transport channel
|
||||
* \author Navid Nikaein and Raymond Knopp, Guido Casati
|
||||
* \date 2019
|
||||
* \email: guido.casati@iis.fraunhofer.de
|
||||
* \version 1.0
|
||||
* @ingroup _mac
|
||||
*/
|
||||
|
||||
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
|
||||
|
||||
/*
|
||||
* When data are received on PHY and transmitted to MAC
|
||||
*/
|
||||
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 rnti_t rntiP,
|
||||
uint8_t *sduP,
|
||||
const uint16_t sdu_lenP,
|
||||
const uint16_t timing_advance,
|
||||
const uint8_t ul_cqi){
|
||||
int current_rnti = 0, UE_id = -1, harq_pid = 0;
|
||||
gNB_MAC_INST *gNB_mac = NULL;
|
||||
UE_list_t *UE_list = NULL;
|
||||
UE_sched_ctrl_t *UE_scheduling_control = NULL;
|
||||
|
||||
current_rnti = rntiP;
|
||||
UE_id = find_nrUE_id(gnb_mod_idP, current_rnti);
|
||||
gNB_mac = RC.nrmac[gnb_mod_idP];
|
||||
UE_list = &gNB_mac->UE_list;
|
||||
|
||||
UE_id = 0;
|
||||
|
||||
if (UE_id != -1) {
|
||||
UE_scheduling_control = &(UE_list->UE_sched_ctrl[UE_id]);
|
||||
|
||||
LOG_D(MAC, "[eNB %d][PUSCH %d] CC_id %d %d.%d Received ULSCH sdu round %d from PHY (rnti %x, UE_id %d) ul_cqi %d\n",
|
||||
gnb_mod_idP,
|
||||
harq_pid,
|
||||
CC_idP,
|
||||
frameP,
|
||||
subframeP,
|
||||
UE_scheduling_control->round_UL[CC_idP][harq_pid],
|
||||
current_rnti,
|
||||
UE_id,
|
||||
ul_cqi);
|
||||
|
||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||
LOG_I(MAC, "Printing received UL MAC payload at gNB side: %d \n");
|
||||
for (int i = 0; i < sdu_lenP ; i++) {
|
||||
//harq_process_ul_ue->a[i] = (unsigned char) rand();
|
||||
//printf("a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]);
|
||||
printf("%02x ",(unsigned char)sduP[i]);
|
||||
}
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
if (sduP != NULL){
|
||||
UE_scheduling_control->ta_update = timing_advance;
|
||||
LOG_D(MAC, "Received PDU at MAC gNB \n");
|
||||
nr_process_mac_pdu(gnb_mod_idP, CC_idP, frameP, sduP, sdu_lenP);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
#include "nr_mac_gNB.h"
|
||||
#include "PHY/defs_gNB.h"
|
||||
#include "NR_TAG-Id.h"
|
||||
|
||||
void set_cset_offset(uint16_t);
|
||||
|
||||
@@ -70,20 +71,35 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
frame_t frame_txP, sub_frame_t slot_txP,
|
||||
frame_t frame_rxP, sub_frame_t slot_rxP);
|
||||
|
||||
int nr_generate_dlsch_pdu(module_id_t Mod_idP,
|
||||
unsigned char *sdus_payload,
|
||||
unsigned char *mac_pdu,
|
||||
unsigned char num_sdus,
|
||||
unsigned short *sdu_lengths,
|
||||
unsigned char *sdu_lcids,
|
||||
unsigned char drx_cmd,
|
||||
unsigned char *ue_cont_res_id,
|
||||
unsigned short post_padding);
|
||||
|
||||
void nr_schedule_ue_spec(module_id_t module_idP, frame_t frameP, sub_frame_t slotP);
|
||||
|
||||
void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP);
|
||||
|
||||
void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
|
||||
frame_t frameP,
|
||||
sub_frame_t subframeP);
|
||||
|
||||
int configure_fapi_dl_Tx(nfapi_nr_dl_config_request_body_t *dl_req,
|
||||
nfapi_tx_request_pdu_t *TX_req,
|
||||
nfapi_nr_config_request_t *cfg,
|
||||
nfapi_nr_coreset_t* coreset,
|
||||
nfapi_nr_search_space_t* search_space,
|
||||
int16_t pdu_index,
|
||||
int configure_fapi_dl_pdu(nfapi_nr_dl_config_request_body_t *dl_req,
|
||||
nfapi_nr_config_request_t *cfg,
|
||||
nfapi_nr_coreset_t* coreset,
|
||||
nfapi_nr_search_space_t* search_space,
|
||||
nfapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config);
|
||||
|
||||
void configure_fapi_dl_Tx(nfapi_nr_dl_config_request_body_t *dl_req,
|
||||
nfapi_tx_request_pdu_t *tx_req,
|
||||
int tbs_bytes,
|
||||
int16_t pdu_index);
|
||||
|
||||
void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
|
||||
frame_t frameP,
|
||||
sub_frame_t slotP,
|
||||
@@ -135,6 +151,10 @@ uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint32_t bw);
|
||||
|
||||
int32_t get_nr_uldl_offset(int nr_bandP);
|
||||
|
||||
int find_nrUE_id(module_id_t mod_idP, rnti_t rntiP);
|
||||
|
||||
int nrUE_PCCID(module_id_t mod_idP, int ue_idP);
|
||||
|
||||
void config_nr_mib(int Mod_idP,
|
||||
int CC_idP,
|
||||
int p_gNBP,
|
||||
@@ -145,15 +165,6 @@ void config_nr_mib(int Mod_idP,
|
||||
int cellBarred,
|
||||
int intraFreqReselection);
|
||||
|
||||
void nr_rx_sdu(module_id_t module_idP,
|
||||
uint8_t CC_id,
|
||||
frame_t frameP,
|
||||
uint8_t ttiP,
|
||||
const rnti_t rntiP,
|
||||
uint8_t * pdu,
|
||||
uint16_t pdu_len,
|
||||
const uint16_t timing_advance,
|
||||
const uint8_t ul_cqi);
|
||||
|
||||
void nr_process_mac_pdu(
|
||||
module_id_t module_idP,
|
||||
@@ -162,4 +173,22 @@ void nr_process_mac_pdu(
|
||||
uint8_t *pduP,
|
||||
uint16_t mac_pdu_len);
|
||||
|
||||
/* \brief Function to indicate a received SDU on ULSCH.
|
||||
@param Mod_id Instance ID of gNB
|
||||
@param CC_id Component carrier index
|
||||
@param rnti RNTI of UE transmitting the SDU
|
||||
@param sdu Pointer to received SDU
|
||||
@param sdu_len Length of SDU
|
||||
@param timing_advance timing advance adjustment after this pdu
|
||||
@param ul_cqi Uplink CQI estimate after this pdu (SNR quantized to 8 bits, -64 ... 63.5 dB in .5dB steps)
|
||||
*/
|
||||
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 rnti_t rntiP,
|
||||
uint8_t * sduP,
|
||||
const uint16_t sdu_lenP,
|
||||
const uint16_t timing_advance, const uint8_t ul_cqi);
|
||||
|
||||
#endif /*__LAYER2_NR_MAC_PROTO_H__*/
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include "mac_proto.h"
|
||||
#include "LAYER2/MAC/mac_extern.h" //temporary
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
|
||||
#include "assertions.h"
|
||||
|
||||
#include "LAYER2/PDCP_v10.1.0/pdcp.h"
|
||||
@@ -40,7 +40,7 @@
|
||||
//#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
|
||||
|
||||
#include "common/ran_context.h"
|
||||
#include "executables/nr-softmodem.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
@@ -106,6 +106,9 @@ void mac_top_init_gNB(void)
|
||||
|
||||
RC.nrmac[i]->Mod_id = i;
|
||||
|
||||
RC.nrmac[i]->tag = (NR_TAG_t*)malloc(sizeof(NR_TAG_t));
|
||||
memset((void*)RC.nrmac[i]->tag,0,sizeof(NR_TAG_t));
|
||||
|
||||
|
||||
for (j = 0; j < MAX_NUM_CCs; j++) {
|
||||
RC.nrmac[i]->DL_req[j].dl_config_request_body.dl_config_pdu_list = RC.nrmac[i]->dl_config_pdu_list[j];
|
||||
|
||||
@@ -55,12 +55,14 @@
|
||||
#include "common/ran_context.h"
|
||||
#include "LAYER2/MAC/mac.h"
|
||||
#include "LAYER2/MAC/mac_proto.h"
|
||||
#include "LAYER2/MAC/mac_extern.h"
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
|
||||
#include "PHY/defs_gNB.h"
|
||||
#include "PHY/TOOLS/time_meas.h"
|
||||
#include "targets/ARCH/COMMON/common_lib.h"
|
||||
|
||||
|
||||
#include "NR_TAG.h"
|
||||
|
||||
/*! \brief gNB common channels */
|
||||
typedef struct {
|
||||
int physCellId;
|
||||
@@ -107,10 +109,16 @@ typedef struct gNB_MAC_INST_s {
|
||||
/// frame counter
|
||||
frame_t frame;
|
||||
/// slot counter
|
||||
int slot;
|
||||
int slot;
|
||||
/// timing advance group
|
||||
NR_TAG_t *tag;
|
||||
/// Pointer to IF module instance for PHY
|
||||
NR_IF_Module_t *if_inst;
|
||||
/// Common cell resources
|
||||
/// TA command
|
||||
int ta_command;
|
||||
/// MAC CE flag indicating TA length
|
||||
int ta_len;
|
||||
/// Common cell resources
|
||||
NR_COMMON_channels_t common_channels[NFAPI_CC_MAX];
|
||||
/// current PDU index (BCH,DLSCH)
|
||||
uint16_t pdu_index[NFAPI_CC_MAX];
|
||||
@@ -136,6 +144,7 @@ typedef struct gNB_MAC_INST_s {
|
||||
/// NFAPI search space structure
|
||||
nfapi_nr_search_space_t search_space[NFAPI_CC_MAX][NFAPI_NR_MAX_NB_SEARCH_SPACES];
|
||||
|
||||
/// this is an LTE structure and needs to be urgenly updated
|
||||
UE_list_t UE_list;
|
||||
|
||||
/// UL handle
|
||||
|
||||
@@ -530,7 +530,7 @@ rb_found:
|
||||
#endif
|
||||
}
|
||||
|
||||
static void add_srb(int rnti, struct LTE_SRB_ToAddMod *s)
|
||||
__attribute__ ((unused)) static void add_srb(int rnti, struct LTE_SRB_ToAddMod *s)
|
||||
{
|
||||
nr_rlc_entity_t *nr_rlc_am;
|
||||
nr_rlc_ue_t *ue;
|
||||
@@ -798,7 +798,7 @@ static void add_drb_um(int rnti, struct LTE_DRB_ToAddMod *s)
|
||||
nr_rlc_manager_unlock(nr_rlc_ue_manager);
|
||||
}
|
||||
|
||||
static void add_drb(int rnti, struct LTE_DRB_ToAddMod *s)
|
||||
__attribute__ ((unused)) static void add_drb(int rnti, struct LTE_DRB_ToAddMod *s)
|
||||
{
|
||||
switch (s->rlc_Config->present) {
|
||||
case LTE_RLC_Config_PR_am:
|
||||
|
||||
Reference in New Issue
Block a user