Commit 287f47bf authored by Fang-WANG's avatar Fang-WANG

msg4

parent 52c556fd
......@@ -419,7 +419,7 @@ int create_gNB_tasks(uint32_t gnb_nb) {
}
if (AMF_MODE_ENABLED && (get_softmodem_params()->phy_test==0 && get_softmodem_params()->do_ra==0)) {
if (AMF_MODE_ENABLED && (get_softmodem_params()->phy_test==0 && get_softmodem_params()->do_ra==0 && get_softmodem_params()->sa_ra==0)) {
if (gnb_nb > 0) {
/*
if (itti_create_task (TASK_SCTP, sctp_eNB_task, NULL) < 0) {
......
......@@ -99,6 +99,7 @@ extern "C"
#define SPLIT73 softmodem_params.split73
#define TP_CONFIG softmodem_params.threadPoolConfig
#define PHY_TEST softmodem_params.phy_test
#define SA_RA softmodem_params.sa_ra
#define DO_RA softmodem_params.do_ra
#define WAIT_FOR_SYNC softmodem_params.wait_for_sync
#define SINGLE_THREAD_FLAG softmodem_params.single_thread_flag
......@@ -118,6 +119,7 @@ extern "C"
{"split73", CONFIG_HLP_SPLIT73, 0, strptr:(char **)&SPLIT73, defstrval:NULL, TYPE_STRING, sizeof(SPLIT73)},\
{"thread-pool", CONFIG_HLP_TPOOL, 0, strptr:(char **)&TP_CONFIG, defstrval:"n", TYPE_STRING, sizeof(TP_CONFIG)}, \
{"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&PHY_TEST, defintval:0, TYPE_INT, 0}, \
{"sa-ra", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&SA_RA, defintval:0, TYPE_INT, 0}, \
{"do-ra", CONFIG_HLP_DORA, PARAMFLAG_BOOL, iptr:&DO_RA, defintval:0, TYPE_INT, 0}, \
{"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&USIM_TEST, defintval:0, TYPE_UINT8, 0}, \
{"clock-source", CONFIG_HLP_CLK, 0, uptr:&CLOCK_SOURCE, defintval:0, TYPE_UINT, 0}, \
......@@ -212,6 +214,7 @@ typedef struct {
char split73[1024];
char threadPoolConfig[1024];
int phy_test;
int sa_ra;
int do_ra;
uint8_t usim_test;
int emulate_rf;
......
......@@ -665,8 +665,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
return((1 + dlsch->max_ldpc_iterations));
} else {
//#if UE_DEBUG_TRACE
LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for nr_slot_rx %d TBS %d mcs %d nb_rb %d harq_process->round %d\n",
phy_vars_ue->Mod_id,nr_slot_rx,harq_process->TBS,harq_process->mcs,harq_process->nb_rb, harq_process->round);
LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for SFN %d nr_slot_rx %d TBS %d mcs %d nb_rb %d harq_process->round %d\n",
phy_vars_ue->Mod_id,frame,nr_slot_rx,harq_process->TBS,harq_process->mcs,harq_process->nb_rb, harq_process->round);
//#endif
harq_process->status = SCH_IDLE;
......
......@@ -569,7 +569,7 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
gNB->uci_pdu_list[num_ucis].pdu_type = NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE;
gNB->uci_pdu_list[num_ucis].pdu_size = sizeof(nfapi_nr_uci_pucch_pdu_format_0_1_t);
nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu_format0 = &gNB->uci_pdu_list[num_ucis].pucch_pdu_format_0_1;
uci_pdu_format0->rnti = pucch_pdu->rnti;
nr_decode_pucch0(gNB,
slot_rx,
uci_pdu_format0,
......
......@@ -94,8 +94,6 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
dlsch0->rnti = dl_config->dl_config_list[i].dlsch_config_pdu.rnti;
dlsch0_harq = dlsch0->harq_processes[current_harq_pid];
LOG_D(PHY,"current_harq_pid = %d\n", current_harq_pid);
if (dlsch0_harq){
dlsch0_harq->BWPStart = dlsch_config_pdu->BWPStart;
......
......@@ -242,7 +242,7 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
//LOG_M("txdata.m","txs",ue->common_vars.txdata[0],1228800,1,1);
/* RACH */
if (get_softmodem_params()->do_ra==1) {
if ((get_softmodem_params()->do_ra==1) || (get_softmodem_params()->sa_ra==1)) {
if ((ue->UE_mode[gNB_id] > NOT_SYNCHED && ue->UE_mode[gNB_id] < PUSCH) && (ue->prach_vars[gNB_id]->prach_Config_enabled == 1)) {
nr_ue_prach_procedures(ue, proc, gNB_id, mode);
}
......@@ -800,19 +800,25 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_
else { // This is to adjust the llr offset in the case of skipping over a dmrs symbol (i.e. in case of no PDSCH REs in DMRS)
if (pdsch == RA_PDSCH) ue->pdsch_vars[proc->thread_id][eNB_id]->llr_offset[m]=ue->pdsch_vars[proc->thread_id][eNB_id]->llr_offset[m-1];
else if (pdsch == PDSCH) {
if (nr_rx_pdsch(ue,
proc,
pdsch,
eNB_id,
eNB_id_i,
frame_rx,
nr_slot_rx,
m,
first_symbol_flag,
dual_stream_UE,
i_mod,
dlsch0->current_harq_pid) < 0)
return -1;
if (dlsch0->harq_processes[harq_pid]->n_dmrs_cdm_groups == 2)
{
ue->pdsch_vars[proc->thread_id][eNB_id]->llr_offset[m]=ue->pdsch_vars[proc->thread_id][eNB_id]->llr_offset[m-1];
}
else {
if (nr_rx_pdsch(ue,
proc,
pdsch,
eNB_id,
eNB_id_i,
frame_rx,
nr_slot_rx,
m,
first_symbol_flag,
dual_stream_UE,
i_mod,
dlsch0->current_harq_pid) < 0)
return -1;
}
}
else AssertFatal(1==0,"not RA_PDSCH or PDSCH\n");
}
......
......@@ -553,12 +553,19 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
if (mac->RA_window_cnt >= 0 && mac->RA_RAPID_found == 1) {
// Reset RA_active flag: it disables Msg3 retransmission (8.3 of TS 38.213)
// TbD Msg3 Retransmissions to be scheduled by DCI 0_0
mac->RA_active = 0;
mac->RA_window_cnt = -1;
mac->ra_state = RA_SUCCEEDED;
mac->generate_nr_prach = 2;
if (get_softmodem_params()->sa_ra)
{
mac->ra_state = WAIT_CONTENTION_RESOLUTION;
}
else
{
// Reset RA_active flag: it disables Msg3 retransmission (8.3 of TS 38.213)
// TbD Msg3 Retransmissions to be scheduled by DCI 0_0
mac->RA_active = 0;
mac->ra_state = RA_SUCCEEDED;
mac->generate_nr_prach = 2;
}
mac->RA_window_cnt = -1;
LOG_I(MAC, "[MAC][UE %d][RAPROC]: RAR successfully received \n", mod_id);
} else if (mac->RA_window_cnt == 0 && !mac->RA_RAPID_found) {
......
......@@ -135,12 +135,22 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, 275); //NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275);
rel15->SubcarrierSpacing = initialDownlinkBWP->genericParameters.subcarrierSpacing;
rel15->dci_length_options[0] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15, rel15->dci_format_options[0], NR_RNTI_RA, rel15->BWPSize, bwp_id);
LOG_D(PHY, "pdcch params: rnti %d, bwp %d %d, len %d\n",rel15->rnti, rel15->BWPSize, rel15->BWPStart, rel15->dci_length_options[0]);
break;
case NR_RNTI_P:
break;
case NR_RNTI_CS:
break;
case NR_RNTI_TC:
// we use the initial DL BWP
sps = initialDownlinkBWP->genericParameters.cyclicPrefix == NULL ? 14 : 12;
monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
rel15->rnti = mac->t_crnti;
rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275);
rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, 275); //NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275);
rel15->SubcarrierSpacing = initialDownlinkBWP->genericParameters.subcarrierSpacing;
rel15->dci_length_options[0] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15, rel15->dci_format_options[0], NR_RNTI_TC, rel15->BWPSize, bwp_id);
LOG_D(PHY, "pdcch params: rnti %d, bwp %d %d (%d), len %d\n",rel15->rnti, rel15->BWPSize, rel15->BWPStart,initialDownlinkBWP->genericParameters.locationAndBandwidth, rel15->dci_length_options[0]);
break;
case NR_RNTI_SP_CSI:
break;
......@@ -222,7 +232,12 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
fill_dci_search_candidates(ss, rel15);
break;
case WAIT_CONTENTION_RESOLUTION:
LOG_D(MAC, "[DCI_CONFIG] frame %d %d Configure monitoring of PDCCH candidates in Type1-PDCCH common random access search space\n",frame,slot);
rel15->rnti = mac->t_crnti;
rel15->num_dci_options = 1; // just search the dci for msg4, should add the ul dci for retx for msg3 later.
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_TC, ss_id);
fill_dci_search_candidates(ss, rel15);
break;
default:
break;
......
......@@ -387,7 +387,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info;
if (add_ue == 1 && get_softmodem_params()->phy_test) {
const int UE_id = add_new_nr_ue(Mod_idP,rnti);
const int UE_id = add_new_nr_ue(Mod_idP,rnti,true);
UE_info->secondaryCellGroup[UE_id] = secondaryCellGroup;
compute_csi_bitlen (secondaryCellGroup, UE_info, UE_id);
struct NR_ServingCellConfig__downlinkBWP_ToAddModList *bwpList =
......
......@@ -412,7 +412,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
// This schedule RA procedure if not in phy_test mode
// Otherwise already consider 5G already connected
if (get_softmodem_params()->phy_test == 0) {
nr_schedule_RA(module_idP, frame, slot);
nr_schedule_RA(module_idP, frame, slot, num_slots_per_tdd);
}
// This schedules the DCI for Uplink and subsequently PUSCH
......@@ -427,7 +427,8 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
}
if (UE_info->active[UE_id])
//if (UE_info->active[UE_id])
if (UE_info->rnti[UE_id] > 0)
nr_schedule_pucch(module_idP, UE_id, nr_ulmix_slots, frame, slot);
stop_meas(&RC.nrmac[module_idP]->eNB_scheduler);
......
......@@ -375,60 +375,94 @@ uint8_t getN_PRB_DMRS(NR_BWP_Downlink_t *bwp, int numDmrsCdmGrpsNoData) {
void nr_simple_dlsch_preprocessor(module_id_t module_id,
frame_t frame,
sub_frame_t slot,
int num_slots_per_tdd) {
int num_slots_per_tdd,
int rnti_type,
int UE_id) {
NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info;
AssertFatal(UE_info->num_UEs <= 1,
"%s() cannot handle more than one UE, but found %d\n",
__func__,
UE_info->num_UEs);
if (UE_info->num_UEs == 0)
return;
const int UE_id = 0;
const int CC_id = 0;
rnti_t rnti;
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
/* Retrieve amount of data to send for this UE */
sched_ctrl->num_total_bytes = 0;
const int lcid = DL_SCH_LCID_DTCH;
const rnti_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;
if (sched_ctrl->num_total_bytes == 0
uint16_t Y = 0;
int m = 0;
int ss_type;
int cid;
rnti = UE_info->rnti[UE_id];
if (rnti_type == NR_RNTI_C)
{
/* Retrieve amount of data to send for this UE */
sched_ctrl->num_total_bytes = 0;
const int lcid = DL_SCH_LCID_DTCH;
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;
if (sched_ctrl->num_total_bytes == 0
&& !sched_ctrl->ta_apply) /* If TA should be applied, give at least one RB */
return;
LOG_D(MAC, "[%s][%d.%d], DTCH%d->DLSCH, RLC status %d bytes TA %d\n",
LOG_D(MAC, "[%s][%d.%d], DTCH%d->DLSCH, RLC status %d bytes TA %d\n",
__FUNCTION__,
frame,
slot,
lcid,
sched_ctrl->rlc_status[lcid].bytes_in_buffer,
sched_ctrl->ta_apply);
ss_type = 1; // UE_Specific
const int target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific;
sched_ctrl->search_space = get_searchspace(sched_ctrl->active_bwp, target_ss);
sched_ctrl->coreset = get_coreset(sched_ctrl->active_bwp, sched_ctrl->search_space, ss_type);
cid = sched_ctrl->coreset->controlResourceSetId;
Y = UE_info->Y[UE_id][cid][slot];
m = UE_info->num_pdcch_cand[UE_id][cid];
}
else if (rnti_type == NR_RNTI_TC)
{
gNB_MAC_INST *nr_mac = RC.nrmac[module_id];
NR_COMMON_channels_t *cc = &nr_mac->common_channels[CC_id];
NR_RA_t *ra = &cc->ra[0];
/*
rrc_sdu_length = mac_rrc_data_req(module_idP, CC_idP, frameP, CCCH,
UE_RNTI(module_idP,UE_id),1, // 1 transport block
&cc[CC_idP].CCCH_pdu.payload[0], 0); // not used in this case
*/
int rrc_sdu_length = 500;
sched_ctrl->num_total_bytes += rrc_sdu_length;
if (sched_ctrl->num_total_bytes == 0)
return;
LOG_D(MAC,
"[gNB %d][RAPROC] CC_id %d Frame %d, slot %d: UE_id %d, rrc_sdu_length %d\n",
module_id, CC_id, frame, slot, UE_id, rrc_sdu_length);
sched_ctrl->search_space = ra->ra_ss;
ss_type = 0; // Common
sched_ctrl->coreset = get_coreset(sched_ctrl->active_bwp, sched_ctrl->search_space, ss_type);
cid = sched_ctrl->coreset->controlResourceSetId;
rnti = ra->rnti;
}
else
{
return;
}
/* Find a free CCE */
const int target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific;
sched_ctrl->search_space = get_searchspace(sched_ctrl->active_bwp, target_ss);
uint8_t nr_of_candidates;
find_aggregation_candidates(&sched_ctrl->aggregation_level,
&nr_of_candidates,
sched_ctrl->search_space);
sched_ctrl->coreset = get_coreset(
sched_ctrl->active_bwp, sched_ctrl->search_space, 1 /* dedicated */);
int cid = sched_ctrl->coreset->controlResourceSetId;
const uint16_t Y = UE_info->Y[UE_id][cid][slot];
const int m = UE_info->num_pdcch_cand[UE_id][cid];
sched_ctrl->cce_index = allocate_nr_CCEs(RC.nrmac[module_id],
sched_ctrl->active_bwp,
sched_ctrl->coreset,
......@@ -436,6 +470,9 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id,
Y,
m,
nr_of_candidates);
LOG_D(PHY, "simple: frame %d %d, rnti %d, cce index %d, ss_type %d, ue is active %d\n", frame,
slot, rnti, sched_ctrl->cce_index, ss_type, UE_info->active[UE_id]);
if (sched_ctrl->cce_index < 0) {
LOG_E(MAC, "%s(): could not find CCE for UE %d\n", __func__, UE_id);
return;
......@@ -449,7 +486,8 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id,
slot,
num_slots_per_tdd,
&sched_ctrl->pucch_sched_idx,
&sched_ctrl->pucch_occ_idx);
&sched_ctrl->pucch_occ_idx,
ss_type);
AssertFatal(sched_ctrl->pucch_sched_idx >= 0, "no uplink slot for PUCCH found!\n");
......@@ -496,7 +534,7 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id,
// modulation scheme
sched_ctrl->mcsTableIdx = 0;
sched_ctrl->mcs = 9;
sched_ctrl->numDmrsCdmGrpsNoData = 1;
sched_ctrl->numDmrsCdmGrpsNoData = (ss_type == 1)? 1 : 2;
// Freq-demain allocation
while (rbStart < bwpSize && vrb_map[rbStart]) rbStart++;
......@@ -505,13 +543,22 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id,
getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData);
int nrOfSymbols = getNrOfSymbols(sched_ctrl->active_bwp,
sched_ctrl->time_domain_allocation);
uint8_t N_DMRS_SLOT = get_num_dmrs_symbols(sched_ctrl->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup,
uint8_t N_DMRS_SLOT = get_num_dmrs_symbols((ss_type == 1)? sched_ctrl->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup : NULL,
RC.nrmac[module_id]->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position ,
nrOfSymbols);
int rbSize = 0;
const int oh = 2 + (sched_ctrl->num_total_bytes >= 256)
+ 2 * (frame == (sched_ctrl->ta_frame + 10) % 1024);
int oh;
if (rnti_type == NR_RNTI_C)
{
oh = 2 + (sched_ctrl->num_total_bytes >= 256)
+ 2 * (frame == (sched_ctrl->ta_frame + 10) % 1024);
}
else
{ // NR_RNTI_TC, msg4
oh = 2 + (sched_ctrl->num_total_bytes >= 256)
+ 1 + 6; // UE Contention Resolution Identity CE
}
uint32_t TBS = 0;
do {
rbSize++;
......@@ -540,16 +587,20 @@ void nr_schedule_ue_spec(module_id_t module_id,
int num_slots_per_tdd) {
gNB_MAC_INST *gNB_mac = RC.nrmac[module_id];
/* PREPROCESSOR */
gNB_mac->pre_processor_dl(module_id, frame, slot, num_slots_per_tdd);
NR_UE_info_t *UE_info = &gNB_mac->UE_info;
const int CC_id = 0;
NR_UE_list_t *UE_list = &UE_info->list;
for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
if (!UE_info->active[UE_id])
continue;
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
/* PREPROCESSOR */
gNB_mac->pre_processor_dl(module_id, frame, slot, num_slots_per_tdd, NR_RNTI_C, UE_id);
/* update TA and set ta_apply every 10 frames.
* Possible improvement: take the periodicity from input file.
* If such UE is not scheduled now, it will be by the preprocessor later.
......@@ -620,7 +671,8 @@ void nr_schedule_ue_spec(module_id_t module_id,
nrOfSymbols,
current_harq_pid,
harq->ndi,
harq->round);
harq->round,
NR_RNTI_C);
NR_UE_ret_info_t *retInfo = &sched_ctrl->retInfo[current_harq_pid];
if (harq->round != 0) { /* retransmission */
......@@ -712,7 +764,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
header_length_total += header_length_last;
num_sdus++;
}
else if (get_softmodem_params()->phy_test || get_softmodem_params()->do_ra) {
else if (get_softmodem_params()->phy_test || get_softmodem_params()->do_ra || get_softmodem_params()->sa_ra) {
LOG_D(MAC, "Configuring DL_TX in %d.%d: random data\n", frame, slot);
// fill dlsch_buffer with random data
for (int i = 0; i < TBS; i++)
......
......@@ -334,7 +334,8 @@ void nr_preprocessor_phytest(module_id_t module_id,
slot,
num_slots_per_tdd,
&sched_ctrl->pucch_sched_idx,
&sched_ctrl->pucch_occ_idx);
&sched_ctrl->pucch_occ_idx,
1);
AssertFatal(sched_ctrl->pucch_sched_idx >= 0, "no uplink slot for PUCCH found!\n");
sched_ctrl->rbStart = rbStart;
......
......@@ -40,8 +40,10 @@ void nr_schedule_pucch(int Mod_idP,
frame_t frameP,
sub_frame_t slotP) {
NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info;
AssertFatal(UE_info->active[UE_id],"Cannot find UE_id %d is not active\n",UE_id);
//AssertFatal(UE_info->active[UE_id],"Cannot find UE_id %d is not active\n",UE_id);
if (UE_info->active[UE_id] <= 0)
LOG_D(MAC, "Cannot find UE_id %d is not active\n",UE_id);
for (int k=0; k<nr_ulmix_slots; k++) {
for (int l=0; l<2; l++) {
NR_sched_pucch *curr_pucch = &UE_info->UE_sched_ctrl[UE_id].sched_pucch[k][l];
......@@ -280,6 +282,8 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id,
const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01)
{
int UE_id = find_nr_UE_id(mod_id, uci_01->rnti);
LOG_D(MAC, "handle_nr_uci_pucch_0_1, ue id %d, rnti %d\n", UE_id, uci_01->rnti);
if (UE_id < 0) {
LOG_E(MAC, "%s(): unknown RNTI %04x in PUCCH UCI\n", __func__, uci_01->rnti);
return;
......@@ -314,6 +318,10 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id,
else
sched_ctrl->harq_processes[harq_idx].round++;
sched_ctrl->harq_processes[harq_idx].is_waiting = 0;
LOG_D(MAC, "%s(): RNTI %04x in PUCCH UCI, harq bit %d, idx %d, feedbanck slot %d, round %d, harq value %d, confidence %d\n", __func__, uci_01->rnti,
harq_bit, harq_idx, sched_ctrl->harq_processes[harq_idx].feedback_slot, sched_ctrl->harq_processes[harq_idx].round,
uci_01->harq->harq_list[harq_bit].harq_value,
uci_01->harq->harq_confidence_level);
harq_idx_s = harq_idx + 1;
// if the max harq rounds was reached
if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) {
......@@ -334,6 +342,10 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id,
sched_ctrl->harq_processes[harq_idx].round = 0;
}
sched_ctrl->harq_processes[harq_idx].is_waiting = 0;
LOG_D(MAC, "%s(): RNTI %04x in PUCCH UCI, harq bit %d, idx %d, feedbanck slot %d, round %d, harq value %d, confidence %d\n", __func__, uci_01->rnti,
harq_bit, harq_idx, sched_ctrl->harq_processes[harq_idx].feedback_slot, sched_ctrl->harq_processes[harq_idx].round,
uci_01->harq->harq_list[harq_bit].harq_value,
uci_01->harq->harq_confidence_level);
}
}
}
......@@ -380,6 +392,10 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id,
else
sched_ctrl->harq_processes[harq_idx].round++;
sched_ctrl->harq_processes[harq_idx].is_waiting = 0;
LOG_D(MAC, "%s(): RNTI %04x in PUCCH UCI, harq bit %d, idx %d, feedbanck slot %d, round %d, harq crc %d, acknack %d\n", __func__, uci_234->rnti,
harq_bit, harq_idx, sched_ctrl->harq_processes[harq_idx].feedback_slot, sched_ctrl->harq_processes[harq_idx].round,
uci_234->harq.harq_crc,
acknack);
harq_idx_s = harq_idx + 1;
// if the max harq rounds was reached
if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) {
......@@ -400,6 +416,10 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id,
sched_ctrl->harq_processes[harq_idx].round = 0;
}
sched_ctrl->harq_processes[harq_idx].is_waiting = 0;
LOG_D(MAC, "%s(): RNTI %04x in PUCCH UCI, harq bit %d, idx %d, feedbanck slot %d, round %d, harq crc %d, acknack %d\n", __func__, uci_234->rnti,
harq_bit, harq_idx, sched_ctrl->harq_processes[harq_idx].feedback_slot, sched_ctrl->harq_processes[harq_idx].round,
uci_234->harq.harq_crc,
acknack);
}
}
}
......@@ -414,7 +434,8 @@ void nr_acknack_scheduling(int Mod_idP,
sub_frame_t slotP,
int slots_per_tdd,
int *pucch_id,
int *pucch_occ) {
int *pucch_occ,
int isUEspec) {
NR_ServingCellConfigCommon_t *scc = RC.nrmac[Mod_idP]->common_channels->ServingCellConfigCommon;
NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info;
......@@ -440,7 +461,15 @@ void nr_acknack_scheduling(int Mod_idP,
max_acknacks=2;
// this is hardcoded for now as ue specific
NR_SearchSpace__searchSpaceType_PR ss_type = NR_SearchSpace__searchSpaceType_PR_ue_Specific;
NR_SearchSpace__searchSpaceType_PR ss_type;
if( isUEspec == 1)
{
ss_type = NR_SearchSpace__searchSpaceType_PR_ue_Specific;
}
else
{
ss_type = NR_SearchSpace__searchSpaceType_PR_common;
}
get_pdsch_to_harq_feedback(Mod_idP,UE_id,ss_type,pdsch_to_harq_feedback);
// for each possible ul or mixed slot
......
......@@ -395,7 +395,8 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
current_rnti);
continue;
}
const int UE_id = add_new_nr_ue(gnb_mod_idP, ra->rnti);
bool isActive = (get_softmodem_params()->sa_ra ? false:true);
const int UE_id = add_new_nr_ue(gnb_mod_idP, ra->rnti, isActive);
UE_info->secondaryCellGroup[UE_id] = ra->secondaryCellGroup;
compute_csi_bitlen(ra->secondaryCellGroup, UE_info, UE_id);
UE_info->UE_beam_index[UE_id] = ra->beam_id;
......@@ -420,13 +421,22 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
// re-initialize ta update variables afrer RA procedure completion
UE_info->UE_sched_ctrl[UE_id].ta_frame = frameP;
free(ra->preambles.preamble_list);
ra->state = RA_IDLE;
LOG_I(MAC,
"reset RA state information for RA-RNTI %04x/index %d\n",
ra->rnti,
i);
if (isActive) // NSA mode
{
free(ra->preambles.preamble_list);
ra->state = RA_IDLE;
LOG_I(MAC,
"reset RA state information for RA-RNTI %04x/index %d\n",
ra->rnti,
i);
}
else // SA mode
{
ra->state = Msg4;
ra->Msg4_frame = ( frameP +2 ) % 1024;
ra->Msg4_slot = 1;
LOG_I(MAC, "set RA state to Msg4 for RA-RNTI %04x, msg4 frame %d %d\n", ra->rnti, ra->Msg4_frame, ra->Msg4_slot);
}
return;
}
}
......
......@@ -84,7 +84,9 @@ void nr_schedule_ue_spec(module_id_t module_id,
void nr_simple_dlsch_preprocessor(module_id_t module_id,
frame_t frame,
sub_frame_t slot,
int num_slots_per_tdd);
int num_slots_per_tdd,
int rnti_type,
int UE_id);
void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP, uint8_t slots_per_frame);
......@@ -104,7 +106,7 @@ void nr_simple_ulsch_preprocessor(module_id_t module_id,
/////// Random Access MAC-PHY interface functions and primitives ///////
void nr_schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t slotP);
void nr_schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, int num_slots_per_tdd);
/* \brief Function to indicate a received preamble on PRACH. It initiates the RA procedure.
@param module_idP Instance ID of gNB
......@@ -178,7 +180,8 @@ void nr_fill_nfapi_dl_pdu(int Mod_id,
int NrOfSymbols,
int harq_pid,
int ndi,
int round);
int round,
int rnit_type);
void handle_nr_uci_pucch_0_1(module_id_t mod_id,
frame_t frame,
......@@ -221,7 +224,8 @@ void nr_acknack_scheduling(int Mod_idP,
sub_frame_t slotP,
int slots_per_tdd,
int *pucch_id,
int *pucch_occ);
int *pucch_occ,
int isUEspec);
int get_pucch_resource(NR_UE_info_t *UE_info,int UE_id,int k,int l);
......@@ -338,7 +342,7 @@ int find_nr_UE_id(module_id_t mod_idP, rnti_t rntiP);
int find_nr_RA_id(module_id_t mod_idP, int CC_idP, rnti_t rntiP);
int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP);
int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, bool isActive);
void mac_remove_nr_ue(module_id_t mod_id, rnti_t rnti);
......
......@@ -96,7 +96,7 @@ void mac_top_init_gNB(void)
// These should be out of here later
pdcp_layer_init();
if(IS_SOFTMODEM_NOS1 && !get_softmodem_params()->do_ra)
if(IS_SOFTMODEM_NOS1 && !get_softmodem_params()->do_ra && !get_softmodem_params()->sa_ra)
nr_DRB_preconfiguration(0x1234);
rrc_init_nr_global_param();
......@@ -117,6 +117,7 @@ void mac_top_init_gNB(void)
for (list_el = 0; list_el < MAX_MOBILES_PER_GNB; list_el++) {
UE_info->list.next[list_el] = -1;
UE_info->active[list_el] = false;
UE_info->rnti[list_el] = 0;
for (int list_harq = 0; list_harq < NR_MAX_NB_HARQ_PROCESSES; list_harq++) {
UE_info->UE_sched_ctrl[list_el].harq_processes[list_harq].round = 0;
UE_info->UE_sched_ctrl[list_el].harq_processes[list_harq].ndi = 0;
......
......@@ -476,7 +476,9 @@ typedef struct {
typedef void (*nr_pp_impl_dl)(module_id_t mod_id,
frame_t frame,
sub_frame_t slot,
int num_slots_per_tdd);
int num_slots_per_tdd,
int rnti_type,
int UE_id);
typedef void (*nr_pp_impl_ul)(module_id_t mod_id,
frame_t frame,
sub_frame_t slot,
......
......@@ -109,7 +109,7 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){
ret = nr_ue_scheduler(NULL, ul_info);
if (is_nr_UL_slot(mac->scc, ul_info->slot_tx) && get_softmodem_params()->do_ra)
if (is_nr_UL_slot(mac->scc, ul_info->slot_tx) && (get_softmodem_params()->do_ra || get_softmodem_params()->sa_ra))
nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->thread_id);
switch(ret){
......
......@@ -225,7 +225,7 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration
(NR_CellGroupConfig_t *)NULL
);
if (get_softmodem_params()->phy_test > 0 || get_softmodem_params()->do_ra > 0) {
if (get_softmodem_params()->phy_test > 0 || get_softmodem_params()->do_ra > 0 || get_softmodem_params()->sa_ra > 0) {
// This is for phytest only, emulate first X2 message if uecap.raw file is present
FILE *fd;
fd = fopen("uecap.raw","r");
......
......@@ -98,7 +98,7 @@ int generate_CG_Config(gNB_RRC_INST *rrc,
total_size = (enc_rval.encoded+7)>>3;
FILE *fd; // file to be generated for nr-ue
if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra > 0) {
if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra > 0 || get_softmodem_params()->sa_ra > 0) {
// This is for phytest only, emulate first X2 message if uecap.raw file is present
LOG_I(RRC,"Dumping NR_RRCReconfiguration message (%jd bytes)\n",(enc_rval.encoded+7)>>3);
for (int i=0; i<(enc_rval.encoded+7)>>3; i++) {
......@@ -123,7 +123,7 @@ int generate_CG_Config(gNB_RRC_INST *rrc,
if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra > 0) {
if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra > 0 || get_softmodem_params()->sa_ra > 0) {
LOG_I(RRC,"Dumping scg_RB_Config message (%jd bytes)\n",(enc_rval.encoded+7)>>3);
for (int i=0; i<(enc_rval.encoded+7)>>3; i++) {
......
......@@ -162,7 +162,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
NR_RRCReconfiguration_IEs_t *reconfig_ies=calloc(1,sizeof(NR_RRCReconfiguration_IEs_t));
ue_context_p->ue_context.reconfig->criticalExtensions.choice.rrcReconfiguration = reconfig_ies;
carrier->initial_csi_index[rrc->Nb_ue] = 0;
if (get_softmodem_params()->phy_test == 1 || get_softmodem_params()->do_ra == 1){
if (get_softmodem_params()->phy_test == 1 || get_softmodem_params()->do_ra == 1 || get_softmodem_params()->sa_ra == 1){
ue_context_p->ue_context.rb_config = calloc(1,sizeof(NR_RRCReconfiguration_t));
fill_default_rbconfig(ue_context_p->ue_context.rb_config);
}
......@@ -255,7 +255,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
1024);
X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).rrc_buffer_size = (enc_rval.encoded+7)>>3;
itti_send_msg_to_task(TASK_X2AP, ENB_MODULE_ID_TO_INSTANCE(0), msg); //Check right id instead of hardcoding
} else if (get_softmodem_params()->do_ra) {
} else if (get_softmodem_params()->do_ra || get_softmodem_params()->sa_ra) {
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, rrc->module_id, GNB_FLAG_YES, ue_context_p->ue_id_rnti, 0, 0,rrc->module_id);
}
......
......@@ -79,7 +79,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
secondaryCellGroup->cellGroupId = scg_id;
NR_RLC_BearerConfig_t *RLC_BearerConfig = calloc(1,sizeof(*RLC_BearerConfig));
nr_rlc_bearer_init(RLC_BearerConfig);
if (get_softmodem_params()->do_ra)
if ((get_softmodem_params()->do_ra) || (get_softmodem_params()->sa_ra))
nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_um_Bi_Directional);
else
nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_am);
......
......@@ -458,7 +458,7 @@ NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* rrc_config_path){
RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].CSI_ReportConfig_list, NR_maxNrofCSI_ReportConfigurations);
}
if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra==1) {
if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra || get_softmodem_params()->sa_ra ==1) {
// read in files for RRCReconfiguration and RBconfig
FILE *fd;
char filename[1024];
......
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