Commit a4a5ef6b authored by masayuki.harada's avatar masayuki.harada

Add buffer check DCCH in DLSCH scheduling.

Change RRCSetup type from DCCH to CCCH.
Add comment
parent 37a6a53f
......@@ -514,7 +514,6 @@ int main( int argc, char **argv ) {
RC.nrrrc = (gNB_RRC_INST **)malloc(1*sizeof(gNB_RRC_INST *));
RC.nrrrc[0] = (gNB_RRC_INST*)malloc(sizeof(gNB_RRC_INST));
RC.nrrrc[0]->node_type = ngran_gNB;
//nr_rrc_ue_generate_RRCSetupRequest(ctxt_pP.module_id, 0); //TODO need to set ctxt_pP
if (create_tasks_nrue(1) < 0) {
printf("cannot create ITTI tasks\n");
......
......@@ -1353,6 +1353,7 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
#else
int off = 0;
#endif
// TODO this is temporary change to get message5 should revert.
double p_shift=0.00476190476190476;
short * IQ_temp = (short*)&gNB->pusch_vars[ulsch_id]->rxdataF_comp[0][rel15_ul->start_symbol_index * (off + rel15_ul->rb_size * NR_NB_SC_PER_RB)];
double ttt[2];
......
......@@ -1778,7 +1778,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
// MSG4 RRC Setup 38.331
// variable length
if((ra->ra_state == WAIT_CONTENTION_RESOLUTION)&&(get_softmodem_params()->sa==1)) {
LOG_I(MAC, "[UE %d][RAPROC] Frame %d : received Msg3\n",module_idP, frameP);
LOG_I(MAC, "[UE %d][RAPROC] Frame %d : received Msg4\n",module_idP, frameP);
if (ra->RA_active == 1){
nr_ra_succeeded(module_idP, frameP, slot);
......
......@@ -1155,6 +1155,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
// Bytes to be transmitted
uint8_t *buf = (uint8_t *) harq->tb;
uint16_t mac_pdu_length = 0;
//TODO Don't set MAC header in SA.
if (get_softmodem_params()->sa != 1) {
mac_pdu_length = nr_write_ce_dlsch_pdu(module_idP, nr_mac->sched_ctrlCommon, buf, 255, ra->cont_res_id);
}
......
......@@ -334,45 +334,82 @@ void nr_store_dlsch_buffer(module_id_t module_id,
sub_frame_t slot) {
NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info;
int lcid=0;
int num_dtch=1;
for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) {
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
sched_ctrl->num_total_bytes = 0;
loop_dcch_dtch = BOOL_NOT(loop_dcch_dtch);
const int lcid = loop_dcch_dtch?DL_SCH_LCID_DTCH:DL_SCH_LCID_DCCH;
// const int lcid = DL_SCH_LCID_DTCH;
const uint16_t rnti = UE_info->rnti[UE_id];
sched_ctrl->rlc_status[lcid] = mac_rlc_status_ind(module_id,
rnti,
module_id,
frame,
slot,
ENB_FLAG_YES,
MBMS_FLAG_NO,
lcid,
0,
0);
sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer;
LOG_I(MAC,
"%d.%d, LCID%d:->DLSCH, RLC status %d bytes. \n",
frame,
slot,
lcid,
sched_ctrl->num_total_bytes);
// Check DCCH status
// TODO check CCCH?
for(lcid=DL_SCH_LCID_DCCH;lcid<(DL_SCH_LCID_DCCH1+1);lcid++){
const uint16_t rnti = UE_info->rnti[UE_id];
sched_ctrl->rlc_status[lcid] = mac_rlc_status_ind(module_id,
rnti,
module_id,
frame,
slot,
ENB_FLAG_YES,
MBMS_FLAG_NO,
lcid,
0,
0);
sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer;
LOG_D(MAC,
"%d.%d, LCID%d:->DLSCH, RLC status %d bytes. \n",
frame,
slot,
lcid,
sched_ctrl->num_total_bytes);
if (sched_ctrl->num_total_bytes == 0
&& !sched_ctrl->ta_apply) /* If TA should be applied, give at least one RB */
return;
if (sched_ctrl->num_total_bytes == 0
&& !sched_ctrl->ta_apply) /* If TA should be applied, give at least one RB */
continue;
LOG_D(MAC,
"[%s][%d.%d], DTCH%d->DLSCH, RLC status %d bytes TA %d\n",
__func__,
LOG_I(MAC,
"[%s][%d.%d], DCCH%d->DLSCH, RLC status %d bytes TA %d\n",
__func__,
frame,
slot,
lcid,
sched_ctrl->rlc_status[lcid].bytes_in_buffer,
sched_ctrl->ta_apply);
}
// Check DTCH status
for(lcid=DL_SCH_LCID_DTCH;lcid<(DL_SCH_LCID_DTCH+num_dtch);lcid++){
const uint16_t rnti = UE_info->rnti[UE_id];
sched_ctrl->rlc_status[lcid] = mac_rlc_status_ind(module_id,
rnti,
module_id,
frame,
slot,
ENB_FLAG_YES,
MBMS_FLAG_NO,
lcid,
0,
0);
sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer;
LOG_D(MAC,
"%d.%d, LCID%d:->DLSCH, RLC status %d bytes. \n",
frame,
slot,
lcid,
sched_ctrl->rlc_status[lcid].bytes_in_buffer,
sched_ctrl->ta_apply);
sched_ctrl->num_total_bytes);
if (sched_ctrl->num_total_bytes == 0
&& !sched_ctrl->ta_apply) /* If TA should be applied, give at least one RB */
continue;
LOG_I(MAC,
"[%s][%d.%d], DTCH%d->DLSCH, RLC status %d bytes TA %d\n",
__func__,
frame,
slot,
lcid,
sched_ctrl->rlc_status[lcid].bytes_in_buffer,
sched_ctrl->ta_apply);
}
}
}
......
......@@ -668,6 +668,7 @@ void pf_ul(module_id_t module_id,
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
if(sched_ctrl->ra_state==1) continue;
int rbStart = NRRIV2PRBOFFSET(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
// TODO this is temporary change to get message5 should revert.
rbStart+=27;
const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
......@@ -738,7 +739,7 @@ void pf_ul(module_id_t module_id,
/* Calculate TBS from MCS */
NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch;
const int mcs = 4;
const int mcs = 4; // TODO This is temporary change to get message5 stable. should revert.
sched_pusch->mcs = mcs;
sched_pusch->R = nr_get_code_rate_ul(mcs, ps->mcs_table);
sched_pusch->Qm = nr_get_Qm_ul(mcs, ps->mcs_table);
......
......@@ -1040,7 +1040,7 @@ boolean_t nr_rrc_pdcp_config_asn1_req(
//kUPenc != NULL ||
pmch_InfoList_r9 != NULL /*||
defaultDRB != NULL */) {
//TODO;
TODO;
}
if (srb2add_list != NULL) {
......
......@@ -671,10 +671,12 @@ static void add_srb(int rnti, struct NR_SRB_ToAddMod *s, NR_RLC_BearerConfig_t *
logical_channel_group = *l->ul_SpecificParameters->logicalChannelGroup;
/* assume logical_channel_group is 1 in NSA */
/* assume logical_channel_group is 0 in SA */
/* TODO: accept other values? */
if (logical_channel_group != 1) {
if ((logical_channel_group != 0)&&(logical_channel_group != 1)) {
LOG_E(RLC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__);
//exit(1);
exit(1);
}
switch (r->present) {
......
......@@ -433,7 +433,7 @@ rrc_gNB_generate_RRCSetup(
}
// for rfsim, send RRCSetup messgae in SRB1
nr_rrc_data_req(ctxt_pP,
DCCH,
CCCH,
rrc_gNB_mui++,
SDU_CONFIRM_NO,
ue_p->Srb0.Tx_buffer.payload_size,
......@@ -488,7 +488,7 @@ rrc_gNB_generate_RRCSetup(
// ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0;
nr_rrc_data_req(ctxt_pP,
DCCH,
CCCH,
rrc_gNB_mui++,
SDU_CONFIRM_NO,
ue_p->Srb0.Tx_buffer.payload_size,
......
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