Commit c7f083b1 authored by David Kim's avatar David Kim

Updated gNB part to handle CI test

parent bb21c02d
...@@ -426,7 +426,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int ...@@ -426,7 +426,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
# define LOG_W(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'W', __VA_ARGS__); while (0) # define LOG_W(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'W', __VA_ARGS__); while (0)
# define LOG_A(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'A', __VA_ARGS__); while (0) /* logs intended for analysis */ # define LOG_A(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'A', __VA_ARGS__); while (0) /* logs intended for analysis */
# define LOG_I(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'I', __VA_ARGS__); while (0) # define LOG_I(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'I', __VA_ARGS__); while (0)
# define LOG_D(COMPONENT, ...) do if (0) logMinimal(COMPONENT, 'D', __VA_ARGS__); while (0) # define LOG_D(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'D', __VA_ARGS__); while (0)
# define LOG_T(COMPONENT, ...) do if (0) logMinimal(COMPONENT, 'T', __VA_ARGS__); while (0) # define LOG_T(COMPONENT, ...) do if (0) logMinimal(COMPONENT, 'T', __VA_ARGS__); while (0)
# define LOG_M(FILE, VECTOR, DATA, LEN, DEC, FORMAT) ((void) 0) # define LOG_M(FILE, VECTOR, DATA, LEN, DEC, FORMAT) ((void) 0)
......
...@@ -560,7 +560,6 @@ void processSlotTX(void *arg) { ...@@ -560,7 +560,6 @@ void processSlotTX(void *arg) {
ul_indication.thread_id = proc->thread_id; ul_indication.thread_id = proc->thread_id;
ul_indication.ue_sched_mode = rxtxD->ue_sched_mode; ul_indication.ue_sched_mode = rxtxD->ue_sched_mode;
LOG_I(PHY,"We are here to call ul_indication\n");
UE->if_inst->ul_indication(&ul_indication); UE->if_inst->ul_indication(&ul_indication);
} }
...@@ -622,7 +621,6 @@ void processSlotRX(void *arg) { ...@@ -622,7 +621,6 @@ void processSlotRX(void *arg) {
} else { } else {
rxtxD->ue_sched_mode = SCHED_ALL; rxtxD->ue_sched_mode = SCHED_ALL;
LOG_I(PHY, "We are calling processSlotTX in processSlotRX \n");
processSlotTX(rxtxD); processSlotTX(rxtxD);
} }
...@@ -641,7 +639,6 @@ void processSlotRX(void *arg) { ...@@ -641,7 +639,6 @@ void processSlotRX(void *arg) {
} }
if (UE->UE_mode[gNB_id] > NOT_SYNCHED && UE->UE_mode[gNB_id] < PUSCH) { if (UE->UE_mode[gNB_id] > NOT_SYNCHED && UE->UE_mode[gNB_id] < PUSCH) {
LOG_I(PHY, "We are calling nr_ue_prach_procedures in processSlotRX\n");
nr_ue_prach_procedures(UE, proc, gNB_id); nr_ue_prach_procedures(UE, proc, gNB_id);
} }
LOG_D(PHY,"****** end TX-Chain for AbsSubframe %d.%d ******\n", proc->frame_tx, proc->nr_slot_tx); LOG_D(PHY,"****** end TX-Chain for AbsSubframe %d.%d ******\n", proc->frame_tx, proc->nr_slot_tx);
......
...@@ -612,8 +612,6 @@ int phy_sync_indication(struct nfapi_vnf_p7_config *config, uint8_t sync) { ...@@ -612,8 +612,6 @@ int phy_sync_indication(struct nfapi_vnf_p7_config *config, uint8_t sync) {
return(0); return(0);
} }
uint16_t pnf_frame;
uint16_t pnf_slot;
int phy_slot_indication(struct nfapi_vnf_p7_config *config, uint16_t phy_id, uint16_t sfn, uint16_t slot) { int phy_slot_indication(struct nfapi_vnf_p7_config *config, uint16_t phy_id, uint16_t sfn, uint16_t slot) {
static uint8_t first_time = 1; static uint8_t first_time = 1;
...@@ -626,8 +624,6 @@ int phy_slot_indication(struct nfapi_vnf_p7_config *config, uint16_t phy_id, uin ...@@ -626,8 +624,6 @@ int phy_slot_indication(struct nfapi_vnf_p7_config *config, uint16_t phy_id, uin
if (RC.gNB && RC.gNB[0]->configured) { if (RC.gNB && RC.gNB[0]->configured) {
// uint16_t sfn = NFAPI_SFNSF2SFN(sfn_sf); // uint16_t sfn = NFAPI_SFNSF2SFN(sfn_sf);
// uint16_t sf = NFAPI_SFNSF2SF(sfn_sf); // uint16_t sf = NFAPI_SFNSF2SF(sfn_sf);
pnf_frame = sfn;
pnf_slot = slot;
LOG_D(PHY,"[VNF] slot indication sfn:%d slot:%d\n", sfn, slot); LOG_D(PHY,"[VNF] slot indication sfn:%d slot:%d\n", sfn, slot);
wake_gNB_rxtx(RC.gNB[0], sfn, slot); // DONE: find NR equivalent wake_gNB_rxtx(RC.gNB[0], sfn, slot); // DONE: find NR equivalent
} else { } else {
......
...@@ -413,6 +413,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, ...@@ -413,6 +413,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
if (pucch_pdu->bit_len_harq==0) { if (pucch_pdu->bit_len_harq==0) {
uci_pdu->harq = NULL; uci_pdu->harq = NULL;
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
AssertFatal ( uci_pdu->sr != NULL, "Memory allocation failed when pucch_pdu->bit_len_harq == 0\n");
uci_pdu->sr->sr_confidence_level = no_conf ? 1 : 0; uci_pdu->sr->sr_confidence_level = no_conf ? 1 : 0;
uci_stats->pucch0_sr_trials++; uci_stats->pucch0_sr_trials++;
if (xrtmag_dBtimes10>(10*gNB->measurements.n0_power_tot_dB)) { if (xrtmag_dBtimes10>(10*gNB->measurements.n0_power_tot_dB)) {
...@@ -421,10 +422,13 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, ...@@ -421,10 +422,13 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
} else { } else {
uci_pdu->sr->sr_indication = 0; uci_pdu->sr->sr_indication = 0;
} }
LOG_I(PHY, "uci_01->harq->num_harq == 0\n");
} }
else if (pucch_pdu->bit_len_harq==1) { else if (pucch_pdu->bit_len_harq==1) {
uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq)); uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq));
AssertFatal ( uci_pdu->harq != NULL, "Memory allocation failed when pucch_pdu->bit_len_harq == 1\n");
uci_pdu->harq->num_harq = 1; uci_pdu->harq->num_harq = 1;
LOG_I(PHY, "uci_01->harq->num_harq %u with uci_pdu %p harq %p\n", uci_pdu->harq->num_harq, uci_pdu, uci_pdu->harq);
uci_pdu->harq->harq_confidence_level = no_conf ? 1 : 0; uci_pdu->harq->harq_confidence_level = no_conf ? 1 : 0;
uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1); uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1);
uci_pdu->harq->harq_list[0].harq_value = index&0x01; uci_pdu->harq->harq_list[0].harq_value = index&0x01;
...@@ -440,7 +444,9 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, ...@@ -440,7 +444,9 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
} }
else { else {
uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq)); uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq));
AssertFatal ( uci_pdu->harq != NULL, "Memory allocation failed when pucch_pdu->bit_len_harq > 1\n");
uci_pdu->harq->num_harq = 2; uci_pdu->harq->num_harq = 2;
LOG_I(PHY, "uci_01->harq->num_harq %u with uci_pdu %p harq %p\n", uci_pdu->harq->num_harq, uci_pdu, uci_pdu->harq);
uci_pdu->harq->harq_confidence_level = (no_conf) ? 1 : 0; uci_pdu->harq->harq_confidence_level = (no_conf) ? 1 : 0;
uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(2); uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(2);
uci_pdu->harq->harq_list[1].harq_value = index&0x01; uci_pdu->harq->harq_list[1].harq_value = index&0x01;
......
...@@ -221,11 +221,8 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ ...@@ -221,11 +221,8 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
k += kbar; k += kbar;
k *= 2; k *= 2;
LOG_I(PHY, "PRACH [UE %d] in slot %d, mu %d, fp->samples_per_subframe %d, prach_sequence_length %d, placing PRACH in position %d, msg1 frequency start %d (k1 %d), preamble_offset %d, first_nonzero_root_idx %d\n", Mod_id, LOG_I(PHY, "PRACH [UE %d] in slot %d, placing PRACH in position %d, msg1 frequency start %d (k1 %d), preamble_offset %d, first_nonzero_root_idx %d\n", Mod_id,
slot, slot,
mu,
fp->samples_per_subframe,
prach_sequence_length,
k, k,
n_ra_prb, n_ra_prb,
nrUE_config->prach_config.num_prach_fd_occasions_list[fd_occasion].k1, nrUE_config->prach_config.num_prach_fd_occasions_list[fd_occasion].k1,
......
...@@ -682,6 +682,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { ...@@ -682,6 +682,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
offset = pucch_pdu->start_symbol_index*gNB->frame_parms.ofdm_symbol_size + (gNB->frame_parms.first_carrier_offset+pucch_pdu->prb_start*12); offset = pucch_pdu->start_symbol_index*gNB->frame_parms.ofdm_symbol_size + (gNB->frame_parms.first_carrier_offset+pucch_pdu->prb_start*12);
power_rxF = signal_energy_nodc(&gNB->common_vars.rxdataF[0][offset],12); power_rxF = signal_energy_nodc(&gNB->common_vars.rxdataF[0][offset],12);
LOG_D(PHY,"frame %d, slot %d: PUCCH signal energy %d\n",frame_rx,slot_rx,power_rxF); LOG_D(PHY,"frame %d, slot %d: PUCCH signal energy %d\n",frame_rx,slot_rx,power_rxF);
LOG_D(PHY,"num_ucis = %d *expecting 0 since it is index in array also (case 0)\n",num_ucis);
nr_decode_pucch0(gNB, nr_decode_pucch0(gNB,
frame_rx, frame_rx,
...@@ -691,6 +692,11 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { ...@@ -691,6 +692,11 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
gNB->UL_INFO.uci_ind.num_ucis += 1; gNB->UL_INFO.uci_ind.num_ucis += 1;
pucch->active = 0; pucch->active = 0;
if (((uci_pdu_format0->pduBitmap >> 1) & 0x01)){
LOG_I(NR_PHY, "uci_01->harq->num_harq with uci_pdu %p\n", uci_pdu_format0);
LOG_I(NR_PHY, "uci_01->harq->num_harq with uci_pdu %p harq %p\n", uci_pdu_format0, uci_pdu_format0->harq);
LOG_I(NR_PHY, "uci_01->harq->num_harq %u\n", uci_pdu_format0->harq->num_harq);
}
break; break;
case 2: case 2:
num_ucis = gNB->UL_INFO.uci_ind.num_ucis; num_ucis = gNB->UL_INFO.uci_ind.num_ucis;
...@@ -700,6 +706,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { ...@@ -700,6 +706,7 @@ int 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_2_3_4_PDU_TYPE; gNB->uci_pdu_list[num_ucis].pdu_type = NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE;
gNB->uci_pdu_list[num_ucis].pdu_size = sizeof(nfapi_nr_uci_pucch_pdu_format_2_3_4_t); gNB->uci_pdu_list[num_ucis].pdu_size = sizeof(nfapi_nr_uci_pucch_pdu_format_2_3_4_t);
nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu_format2 = &gNB->uci_pdu_list[num_ucis].pucch_pdu_format_2_3_4; nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu_format2 = &gNB->uci_pdu_list[num_ucis].pucch_pdu_format_2_3_4;
LOG_D(PHY,"num_ucis = %d in case 1\n",num_ucis);
nr_decode_pucch2(gNB, nr_decode_pucch2(gNB,
slot_rx, slot_rx,
......
...@@ -2079,13 +2079,11 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t ...@@ -2079,13 +2079,11 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
prach_resources->init_msg1 = 1; prach_resources->init_msg1 = 1;
} else { } else {
nr_prach = nr_ue_get_rach(prach_resources, &ue->prach_vars[0]->prach_pdu, mod_id, ue->CC_id, frame_tx, gNB_id, nr_slot_tx); nr_prach = nr_ue_get_rach(prach_resources, &ue->prach_vars[0]->prach_pdu, mod_id, ue->CC_id, frame_tx, gNB_id, nr_slot_tx);
LOG_D(PHY, "In %s:[%d.%d] getting PRACH resources : %d\n", __FUNCTION__, frame_tx, nr_slot_tx,nr_prach); LOG_D(PHY, "In %s:[%d.%d] getting PRACH resources : %d\n", __FUNCTION__, frame_tx, nr_slot_tx,nr_prach);
} }
if (nr_prach > 0)
LOG_I(PHY, "In %s: We are here with nr_prach = %u (GENERATE_PREAMBLE: 1)\n", __FUNCTION__, nr_prach);
if (nr_prach == GENERATE_PREAMBLE) { if (nr_prach == GENERATE_PREAMBLE) {
if (ue->mac_enabled == 1) { if (ue->mac_enabled == 1) {
...@@ -2117,9 +2115,7 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t ...@@ -2117,9 +2115,7 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GENERATE_PRACH, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GENERATE_PRACH, VCD_FUNCTION_IN);
LOG_I(PHY, "In %s: We are here to call generate_nr_prach \n", __FUNCTION__);
prach_power = generate_nr_prach(ue, gNB_id, nr_slot_tx); prach_power = generate_nr_prach(ue, gNB_id, nr_slot_tx);
LOG_I(PHY, "In %s: We are here after calling generate_nr_prach \n", __FUNCTION__);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GENERATE_PRACH, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GENERATE_PRACH, VCD_FUNCTION_OUT);
...@@ -2132,10 +2128,8 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t ...@@ -2132,10 +2128,8 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
dB_fixed(prach_power), dB_fixed(prach_power),
ue->prach_vars[gNB_id]->amp); ue->prach_vars[gNB_id]->amp);
if (ue->mac_enabled == 1){ if (ue->mac_enabled == 1)
nr_Msg1_transmitted(mod_id, ue->CC_id, frame_tx, gNB_id); nr_Msg1_transmitted(mod_id, ue->CC_id, frame_tx, gNB_id);
LOG_I(PHY, "In %s: We are here after nr_Msg1_transmitted\n", __FUNCTION__);
}
} else if (nr_prach == WAIT_CONTENTION_RESOLUTION) { } else if (nr_prach == WAIT_CONTENTION_RESOLUTION) {
LOG_D(PHY, "In %s: [UE %d] RA waiting contention resolution\n", __FUNCTION__, mod_id); LOG_D(PHY, "In %s: [UE %d] RA waiting contention resolution\n", __FUNCTION__, mod_id);
......
...@@ -689,7 +689,7 @@ int nr_rrc_mac_config_req_ue( ...@@ -689,7 +689,7 @@ int nr_rrc_mac_config_req_ue(
} }
config_control_ue(mac); config_control_ue(mac);
if (get_softmodem_params()->nsa) { if (get_softmodem_params()->nsa) {
if (cell_group_config->spCellConfig->reconfigurationWithSync) { if (cell_group_config->spCellConfig && cell_group_config->spCellConfig->reconfigurationWithSync) {
if (cell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated) { if (cell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated) {
ra->rach_ConfigDedicated = cell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink; ra->rach_ConfigDedicated = cell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink;
} }
...@@ -707,6 +707,7 @@ int nr_rrc_mac_config_req_ue( ...@@ -707,6 +707,7 @@ int nr_rrc_mac_config_req_ue(
// Setup the SSB to Rach Occasions mapping according to the config // Setup the SSB to Rach Occasions mapping according to the config
build_ssb_to_ro_map(mac); build_ssb_to_ro_map(mac);
} }
/* /*
if(mac_cell_group_configP != NULL){ if(mac_cell_group_configP != NULL){
if(mac_cell_group_configP->drx_Config != NULL ){ if(mac_cell_group_configP->drx_Config != NULL ){
......
...@@ -550,7 +550,7 @@ int nr_ue_process_dci_indication_pdu(module_id_t module_id,int cc_id, int gNB_in ...@@ -550,7 +550,7 @@ int nr_ue_process_dci_indication_pdu(module_id_t module_id,int cc_id, int gNB_in
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
dci_pdu_rel15_t *def_dci_pdu_rel15 = &mac->def_dci_pdu_rel15[dci->dci_format]; dci_pdu_rel15_t *def_dci_pdu_rel15 = &mac->def_dci_pdu_rel15[dci->dci_format];
if ((dci->rnti != mac->crnti) && (dci->rnti != mac->ra.ra_rnti) && (dci->rnti != 0xFFFF)) { if ((dci->rnti != mac->crnti) && (dci->rnti != mac->ra.ra_rnti) && (get_softmodem_params()->nsa)) {
LOG_D(MAC,"We skip for the received dci indication rnti %4x != mac->crnti %4x frame slot %4d.%2d RA state %d\n", LOG_D(MAC,"We skip for the received dci indication rnti %4x != mac->crnti %4x frame slot %4d.%2d RA state %d\n",
dci->rnti, mac->crnti, frame, slot, mac->ra.ra_state); dci->rnti, mac->crnti, frame, slot, mac->ra.ra_state);
return 0; return 0;
...@@ -2444,7 +2444,7 @@ void nr_ue_send_sdu(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *u ...@@ -2444,7 +2444,7 @@ void nr_ue_send_sdu(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *u
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_SDU, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_SDU, VCD_FUNCTION_IN);
LOG_I(MAC, "In %s [%d.%d] Handling DLSCH PDU...\n", __FUNCTION__, dl_info->frame, dl_info->slot); LOG_D(MAC, "In %s [%d.%d] Handling DLSCH PDU...\n", __FUNCTION__, dl_info->frame, dl_info->slot);
// Processing MAC PDU // Processing MAC PDU
// it parses MAC CEs subheaders, MAC CEs, SDU subheaderds and SDUs // it parses MAC CEs subheaders, MAC CEs, SDU subheaderds and SDUs
...@@ -3422,7 +3422,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, ...@@ -3422,7 +3422,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
case DL_SCH_LCID_DCCH1: case DL_SCH_LCID_DCCH1:
// check if LCID is valid at current time. // check if LCID is valid at current time.
default: default:
{ if (get_softmodem_params()->nsa) {
// check if LCID is valid at current time. // check if LCID is valid at current time.
if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT)) if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT))
return; return;
...@@ -3472,6 +3472,50 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, ...@@ -3472,6 +3472,50 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
break; break;
} }
else
{
// check if LCID is valid at current time.
if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){
//mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8;
mac_subheader_len = 3;
mac_sdu_len = ((uint16_t)(((NR_MAC_SUBHEADER_LONG *) pduP)->L1 & 0x7f) << 8)
| ((uint16_t)((NR_MAC_SUBHEADER_LONG *) pduP)->L2 & 0xff);
} else {
mac_sdu_len = (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L;
mac_subheader_len = 2;
}
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.", (pduP + mac_subheader_len)[i]);
LOG_T(MAC, "\n");
#endif
if (rx_lcid < NB_RB_MAX && rx_lcid >= DL_SCH_LCID_DCCH) {
mac_rlc_data_ind(module_idP,
mac->crnti,
gNB_index,
frameP,
ENB_FLAG_NO,
MBMS_FLAG_NO,
rx_lcid,
(char *) (pduP + 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;
}
} }
pduP += ( mac_subheader_len + mac_ce_len + mac_sdu_len ); pduP += ( mac_subheader_len + mac_ce_len + mac_sdu_len );
pdu_len -= ( mac_subheader_len + mac_ce_len + mac_sdu_len ); pdu_len -= ( mac_subheader_len + mac_ce_len + mac_sdu_len );
...@@ -3651,7 +3695,7 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t ...@@ -3651,7 +3695,7 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t
if ((mac->crnti == ra->t_crnti) && (get_softmodem_params()->nsa)) if ((mac->crnti == ra->t_crnti) && (get_softmodem_params()->nsa))
{ {
LOG_I(MAC, "Discarding the received RAR.\n"); LOG_D(MAC, "Discarding the received RAR.\n");
return -1; return -1;
} }
while (1) { while (1) {
......
...@@ -1866,7 +1866,6 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s ...@@ -1866,7 +1866,6 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
else { else {
ul_config = &mac->ul_config_request[0]; ul_config = &mac->ul_config_request[0];
} }
LOG_I(NR_MAC, "We are here to check calling nr_ue_prach_scheduler\n");
fapi_nr_ul_config_prach_pdu *prach_config_pdu; fapi_nr_ul_config_prach_pdu *prach_config_pdu;
fapi_nr_config_request_t *cfg = &mac->phy_config.config_req; fapi_nr_config_request_t *cfg = &mac->phy_config.config_req;
...@@ -1897,8 +1896,6 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s ...@@ -1897,8 +1896,6 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
&prach_occasion_info_p); &prach_occasion_info_p);
if (is_nr_prach_slot && ra->ra_state == RA_UE_IDLE) { if (is_nr_prach_slot && ra->ra_state == RA_UE_IDLE) {
LOG_I(NR_MAC, "We are here to see is_nr_prach_slot = %d, ra->ra_state = %d (RA_UE_IDLE: 0)\n",
is_nr_prach_slot, ra->ra_state);
AssertFatal(NULL != prach_occasion_info_p,"PRACH Occasion Info not returned in a valid NR Prach Slot\n"); AssertFatal(NULL != prach_occasion_info_p,"PRACH Occasion Info not returned in a valid NR Prach Slot\n");
ra->generate_nr_prach = GENERATE_PREAMBLE; ra->generate_nr_prach = GENERATE_PREAMBLE;
...@@ -1906,8 +1903,6 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s ...@@ -1906,8 +1903,6 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
format = prach_occasion_info_p->format; format = prach_occasion_info_p->format;
format0 = format & 0xff; // single PRACH format format0 = format & 0xff; // single PRACH format
format1 = (format >> 8) & 0xff; // dual PRACH format format1 = (format >> 8) & 0xff; // dual PRACH format
LOG_I(NR_MAC,"We are here with format0 %u, format1 %u, %s %d\n",
format0, format1, __FUNCTION__, __LINE__);
AssertFatal(ul_config->number_pdus < sizeof(ul_config->ul_config_list) / sizeof(ul_config->ul_config_list[0]), AssertFatal(ul_config->number_pdus < sizeof(ul_config->ul_config_list) / sizeof(ul_config->ul_config_list[0]),
"Number of PDUS in ul_config = %d > ul_config_list num elements", ul_config->number_pdus); "Number of PDUS in ul_config = %d > ul_config_list num elements", ul_config->number_pdus);
...@@ -1932,7 +1927,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s ...@@ -1932,7 +1927,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
prach_config_pdu->restricted_set = prach_config->restricted_set_config; prach_config_pdu->restricted_set = prach_config->restricted_set_config;
prach_config_pdu->freq_msg1 = prach_config->num_prach_fd_occasions_list[prach_occasion_info_p->fdm].k1; prach_config_pdu->freq_msg1 = prach_config->num_prach_fd_occasions_list[prach_occasion_info_p->fdm].k1;
LOG_I(NR_MAC,"Selected RO Frame %u, Slot %u, Symbol %u, Fdm %u\n", frameP, prach_config_pdu->prach_slot, prach_config_pdu->prach_start_symbol, prach_config_pdu->num_ra); LOG_D(NR_MAC,"Selected RO Frame %u, Slot %u, Symbol %u, Fdm %u\n", frameP, prach_config_pdu->prach_slot, prach_config_pdu->prach_start_symbol, prach_config_pdu->num_ra);
// Search which SSB is mapped in the RO (among all the SSBs mapped to this RO) // Search which SSB is mapped in the RO (among all the SSBs mapped to this RO)
for (prach_config_pdu->ssb_nb_in_ro=0; prach_config_pdu->ssb_nb_in_ro<prach_occasion_info_p->nb_mapped_ssb; prach_config_pdu->ssb_nb_in_ro++) { for (prach_config_pdu->ssb_nb_in_ro=0; prach_config_pdu->ssb_nb_in_ro<prach_occasion_info_p->nb_mapped_ssb; prach_config_pdu->ssb_nb_in_ro++) {
...@@ -1940,8 +1935,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s ...@@ -1940,8 +1935,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
break; break;
} }
AssertFatal(prach_config_pdu->ssb_nb_in_ro<prach_occasion_info_p->nb_mapped_ssb, "%u not found in the mapped SSBs to the PRACH occasion", selected_gnb_ssb_idx); AssertFatal(prach_config_pdu->ssb_nb_in_ro<prach_occasion_info_p->nb_mapped_ssb, "%u not found in the mapped SSBs to the PRACH occasion", selected_gnb_ssb_idx);
LOG_I(NR_MAC,"We are here Before set prach_config_pdu->prach_format %x, %s %d\n",
prach_config_pdu->prach_format, __FUNCTION__, __LINE__);
if (format1 != 0xff) { if (format1 != 0xff) {
switch(format0) { // dual PRACH format switch(format0) { // dual PRACH format
case 0xa1: case 0xa1:
...@@ -1995,18 +1989,11 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s ...@@ -1995,18 +1989,11 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
AssertFatal(1 == 0, "Invalid PRACH format"); AssertFatal(1 == 0, "Invalid PRACH format");
} }
} // if format1 } // if format1
LOG_I(NR_MAC,"We are here After set prach_config_pdu->prach_format %x, %s %d\n",
prach_config_pdu->prach_format, __FUNCTION__, __LINE__);
fill_scheduled_response(&scheduled_response, NULL, ul_config, NULL, module_idP, 0 /*TBR fix*/, frameP, slotP, thread_id); fill_scheduled_response(&scheduled_response, NULL, ul_config, NULL, module_idP, 0 /*TBR fix*/, frameP, slotP, thread_id);
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL) if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL)
mac->if_module->scheduled_response(&scheduled_response); mac->if_module->scheduled_response(&scheduled_response);
} // is_nr_prach_slot } // is_nr_prach_slot
else
LOG_I(NR_MAC, "We are here to see is_nr_prach_slot = %d, ra->ra_state = %d (RA_UE_IDLE: 0)\n",
is_nr_prach_slot, ra->ra_state);
} // if is_nr_UL_slot } // if is_nr_UL_slot
else
LOG_I(NR_MAC, "We are here It is not is_nr_UL_slot\n");
} }
// This function schedules the reception of SIB1 after initial sync and before going to real time state // This function schedules the reception of SIB1 after initial sync and before going to real time state
......
...@@ -535,7 +535,9 @@ void nr_initiate_ra_proc(module_id_t module_idP, ...@@ -535,7 +535,9 @@ void nr_initiate_ra_proc(module_id_t module_idP,
if (ra->state == RA_IDLE) { if (ra->state == RA_IDLE) {
for(int j = 0; j < ra->preambles.num_preambles; j++) { for(int j = 0; j < ra->preambles.num_preambles; j++) {
//check if the preamble received correspond to one of the listed or configured preambles //check if the preamble received correspond to one of the listed or configured preambles
if (preamble_index == ra->preambles.preamble_list[j] && ra->rnti != 0) { if (preamble_index == ra->preambles.preamble_list[j]) {
if (ra->rnti == 0 && get_softmodem_params()->nsa)
continue;
pr_found=1; pr_found=1;
break; break;
} }
......
...@@ -1081,6 +1081,11 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id, ...@@ -1081,6 +1081,11 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id,
if (((uci_01->pduBitmap >> 1) & 0x01)) { if (((uci_01->pduBitmap >> 1) & 0x01)) {
// iterate over received harq bits // iterate over received harq bits
LOG_I(NR_MAC, "uci_01 %p \n", uci_01);
LOG_I(NR_MAC, "uci_01->harq %p \n", uci_01->harq);
LOG_I(NR_MAC, "uci_01->harq->num_harq %u \n", uci_01->harq->num_harq);
for (int harq_bit = 0; harq_bit < uci_01->harq->num_harq; harq_bit++) { for (int harq_bit = 0; harq_bit < uci_01->harq->num_harq; harq_bit++) {
const uint8_t harq_value = uci_01->harq->harq_list[harq_bit].harq_value; const uint8_t harq_value = uci_01->harq->harq_list[harq_bit].harq_value;
const uint8_t harq_confidence = uci_01->harq->harq_confidence_level; const uint8_t harq_confidence = uci_01->harq->harq_confidence_level;
...@@ -1094,7 +1099,10 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id, ...@@ -1094,7 +1099,10 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id,
remove_front_nr_list(&sched_ctrl->feedback_dl_harq); remove_front_nr_list(&sched_ctrl->feedback_dl_harq);
/* According to nfapi_nr_interface_scf.h, harq_value = 0 is a pass /* According to nfapi_nr_interface_scf.h, harq_value = 0 is a pass
(The check below was for harq_value == 1 in the develop branch) */ (The check below was for harq_value == 1 in the develop branch) */
handle_dl_harq(mod_id, UE_id, pid, harq_value == 0 && harq_confidence == 0); if (get_softmodem_params()->nsa)
handle_dl_harq(mod_id, UE_id, pid, harq_value == 0 && harq_confidence == 0);
else
handle_dl_harq(mod_id, UE_id, pid, harq_value == 1 && harq_confidence == 0);
if (harq_confidence == 1) UE_info->mac_stats[UE_id].pucch0_DTX++; if (harq_confidence == 1) UE_info->mac_stats[UE_id].pucch0_DTX++;
} }
} }
......
...@@ -63,18 +63,35 @@ extern uint16_t sl_ahead; ...@@ -63,18 +63,35 @@ extern uint16_t sl_ahead;
void handle_nr_rach(NR_UL_IND_t *UL_info) void handle_nr_rach(NR_UL_IND_t *UL_info)
{ {
if (gnb_rach_ind_queue.num_items ==0) if(NFAPI_MODE == NFAPI_MODE_PNF) {
return; if (UL_info->rach_ind.number_of_pdus>0) {
LOG_I(NR_MAC, "gnb_rach_ind_queue size = %zu\n", gnb_rach_ind_queue.num_items); LOG_D(PHY,"UL_info->UL_info->rach_ind.number_of_pdus:%d SFN/Slot:%d.%d \n", UL_info->rach_ind.number_of_pdus, UL_info->rach_ind.sfn,UL_info->rach_ind.slot);
nfapi_nr_rach_indication_t *rach_ind = get_queue(&gnb_rach_ind_queue); oai_nfapi_nr_rach_indication(&UL_info->rach_ind);
UL_info->rach_ind.number_of_pdus = 0;
}
return;
}
NR_UL_IND_t UL_INFO; NR_UL_IND_t UL_INFO;
UL_INFO.rach_ind = *rach_ind; nfapi_nr_rach_indication_t *rach_ind = NULL;
UL_INFO.frame = rach_ind->sfn; if (get_softmodem_params()->nsa)
UL_INFO.slot = rach_ind->slot; {
UL_INFO.module_id = UL_info->module_id; if (gnb_rach_ind_queue.num_items ==0)
UL_INFO.CC_id = UL_info->CC_id; return;
LOG_I(NR_MAC, "gnb_rach_ind_queue size = %zu\n", gnb_rach_ind_queue.num_items);
rach_ind = get_queue(&gnb_rach_ind_queue);
UL_INFO.rach_ind = *rach_ind;
UL_INFO.module_id = UL_info->module_id;
UL_INFO.CC_id = UL_info->CC_id;
}
else
{
UL_INFO.rach_ind = UL_info->rach_ind;
UL_INFO.module_id = UL_info->module_id;
UL_INFO.CC_id = UL_info->CC_id;
}
int frame_diff = UL_info->frame - rach_ind->sfn; int frame_diff = UL_info->frame - UL_INFO.rach_ind.sfn;
if (frame_diff < 0) if (frame_diff < 0)
{ {
frame_diff += 1024; frame_diff += 1024;
...@@ -101,28 +118,53 @@ void handle_nr_rach(NR_UL_IND_t *UL_info) ...@@ -101,28 +118,53 @@ void handle_nr_rach(NR_UL_IND_t *UL_info)
UL_INFO.rach_ind.pdu_list[i].preamble_list[0].timing_advance); UL_INFO.rach_ind.pdu_list[i].preamble_list[0].timing_advance);
} }
} }
if (rach_ind && rach_ind->number_of_pdus > 0) if (get_softmodem_params()->nsa)
{ {
for(int i = 0; i < rach_ind->number_of_pdus; i++) if (rach_ind && rach_ind->number_of_pdus > 0)
free(rach_ind->pdu_list[i].preamble_list); {
free(rach_ind->pdu_list); for(int i = 0; i < rach_ind->number_of_pdus; i++)
{
free(rach_ind->pdu_list[i].preamble_list);
rach_ind->pdu_list[i].preamble_list = NULL;
}
free(rach_ind->pdu_list);
rach_ind->pdu_list = NULL;
}
free(rach_ind);
rach_ind = NULL;
} }
free(rach_ind);
} }
void handle_nr_uci(NR_UL_IND_t *UL_info) void handle_nr_uci(NR_UL_IND_t *UL_info)
{ {
if (gnb_uci_ind_queue.num_items ==0) if(NFAPI_MODE == NFAPI_MODE_PNF) {
return; if (UL_info->uci_ind.num_ucis>0) {
LOG_I(NR_MAC, "gnb_uci_ind_queue size = %zu\n", gnb_uci_ind_queue.num_items); LOG_D(PHY,"PNF Sending UL_info->num_ucis:%d PDU_type: %d, SFN/SF:%d.%d \n", UL_info->uci_ind.num_ucis, UL_info->uci_ind.uci_list[0].pdu_type ,UL_info->frame, UL_info->slot);
nfapi_nr_uci_indication_t *uci_ind = get_queue(&gnb_uci_ind_queue); oai_nfapi_nr_uci_indication(&UL_info->uci_ind);
UL_info->uci_ind.num_ucis = 0;
}
return;
}
NR_UL_IND_t UL_INFO; NR_UL_IND_t UL_INFO;
UL_INFO.uci_ind = *uci_ind; nfapi_nr_uci_indication_t *uci_ind = NULL;
if (get_softmodem_params()->nsa)
{
if (gnb_uci_ind_queue.num_items ==0)
return;
LOG_I(NR_MAC, "gnb_uci_ind_queue size = %zu\n", gnb_uci_ind_queue.num_items);
uci_ind = get_queue(&gnb_uci_ind_queue);
UL_INFO.uci_ind = *uci_ind;
}
else
{
UL_INFO.uci_ind = UL_info->uci_ind;
}
const module_id_t mod_id = UL_info->module_id; const module_id_t mod_id = UL_info->module_id;
const frame_t frame = UL_INFO.uci_ind.sfn; const frame_t frame = UL_INFO.uci_ind.sfn;//TODO: Need to check to use UL_info->frame;
const sub_frame_t slot = UL_INFO.uci_ind.slot; const sub_frame_t slot = UL_INFO.uci_ind.slot;//TODO: Need to check to use UL_info->slot;
int num_ucis = UL_INFO.uci_ind.num_ucis; int num_ucis = UL_INFO.uci_ind.num_ucis;
nfapi_nr_uci_t *uci_list = UL_INFO.uci_ind.uci_list; nfapi_nr_uci_t *uci_list = UL_INFO.uci_ind.uci_list;
...@@ -149,23 +191,30 @@ void handle_nr_uci(NR_UL_IND_t *UL_info) ...@@ -149,23 +191,30 @@ void handle_nr_uci(NR_UL_IND_t *UL_info)
} }
} }
for (int i = 0; i < num_ucis; i++) { if (get_softmodem_params()->nsa)
switch (uci_list[i].pdu_type) { {
case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE: for (int i = 0; i < num_ucis; i++) {
free(uci_list[i].pucch_pdu_format_0_1.harq->harq_list); switch (uci_list[i].pdu_type) {
free(uci_list[i].pucch_pdu_format_0_1.harq); case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE:
break; free(uci_list[i].pucch_pdu_format_0_1.harq->harq_list);
free(uci_list[i].pucch_pdu_format_0_1.harq);
break;
case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE: case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE:
free(uci_list[i].pucch_pdu_format_2_3_4.harq.harq_payload); free(uci_list[i].pucch_pdu_format_2_3_4.harq.harq_payload);
free(uci_list[i].pucch_pdu_format_2_3_4.csi_part1.csi_part1_payload); free(uci_list[i].pucch_pdu_format_2_3_4.csi_part1.csi_part1_payload);
free(uci_list[i].pucch_pdu_format_2_3_4.csi_part2.csi_part2_payload); free(uci_list[i].pucch_pdu_format_2_3_4.csi_part2.csi_part2_payload);
break; break;
}
} }
if (uci_ind && num_ucis > 0)
free(uci_list);
free(uci_ind);
}
else
{
UL_info->uci_ind.num_ucis = 0;
} }
if (uci_ind && num_ucis > 0)
free(uci_list);
free(uci_ind);
} }
static bool crc_sfn_slot_matcher(void *wanted, void *candidate) static bool crc_sfn_slot_matcher(void *wanted, void *candidate)
...@@ -190,39 +239,70 @@ static bool crc_sfn_slot_matcher(void *wanted, void *candidate) ...@@ -190,39 +239,70 @@ static bool crc_sfn_slot_matcher(void *wanted, void *candidate)
void handle_nr_ulsch(NR_UL_IND_t *UL_info) void handle_nr_ulsch(NR_UL_IND_t *UL_info)
{ {
nfapi_nr_rx_data_indication_t *rx_ind = get_queue(&gnb_rx_ind_queue); if(NFAPI_MODE == NFAPI_MODE_PNF) {
if (!rx_ind) if (UL_info->crc_ind.number_crcs>0) {
{ LOG_D(PHY,"UL_info->UL_info->crc_ind.number_crcs:%d CRC_IND:SFN/Slot:%d.%d\n", UL_info->crc_ind.number_crcs, UL_info->crc_ind.sfn, UL_info->crc_ind.slot);
LOG_D(NR_PHY, "No rx data indication (empty gnb_rx_ind_queue)\n"); oai_nfapi_nr_crc_indication(&UL_info->crc_ind);
UL_info->crc_ind.number_crcs = 0;
}
if (UL_info->rx_ind.number_of_pdus>0) {
LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/Slot:%d.%d \n", UL_info->rx_ind.number_of_pdus, UL_info->rx_ind.sfn, UL_info->rx_ind.slot);
oai_nfapi_nr_rx_data_indication(&UL_info->rx_ind);
UL_info->rx_ind.number_of_pdus = 0;
}
return; return;
} }
int sfn_slot = NFAPI_SFNSLOT2HEX(rx_ind->sfn, rx_ind->slot);
NR_UL_IND_t UL_INFO;
nfapi_nr_crc_indication_t *crc_ind = unqueue_matching(&gnb_crc_ind_queue, nfapi_nr_rx_data_indication_t *rx_ind = NULL;
MAX_QUEUE_SIZE, nfapi_nr_crc_indication_t *crc_ind = NULL;
crc_sfn_slot_matcher, if (get_softmodem_params()->nsa)
&sfn_slot);
if (!crc_ind)
{ {
LOG_D(NR_PHY, "No crc indication with the same SFN SLOT of rx indication %u %u\n", rx_ind->sfn, rx_ind->slot); rx_ind = get_queue(&gnb_rx_ind_queue);
put_queue(&gnb_rx_ind_queue, rx_ind); if (!rx_ind)
return; {
LOG_D(NR_PHY, "No rx data indication (empty gnb_rx_ind_queue)\n");
return;
}
int sfn_slot = NFAPI_SFNSLOT2HEX(rx_ind->sfn, rx_ind->slot);
crc_ind = unqueue_matching(&gnb_crc_ind_queue,
MAX_QUEUE_SIZE,
crc_sfn_slot_matcher,
&sfn_slot);
if (!crc_ind)
{
LOG_D(NR_PHY, "No crc indication with the same SFN SLOT of rx indication %u %u\n", rx_ind->sfn, rx_ind->slot);
put_queue(&gnb_rx_ind_queue, rx_ind);
return;
}
UL_INFO.rx_ind = *rx_ind;
UL_INFO.crc_ind = *crc_ind;
UL_INFO.module_id = UL_info->module_id;
UL_INFO.CC_id = UL_info->CC_id;
}
else
{
UL_INFO.rx_ind = UL_info->rx_ind;
UL_INFO.crc_ind = UL_info->crc_ind;
UL_INFO.module_id = UL_info->module_id;
UL_INFO.CC_id = UL_info->CC_id;
} }
NR_UL_IND_t UL_INFO; UL_INFO.frame = UL_INFO.rx_ind.sfn;//TODO: Need to check to use UL_info->frame;
UL_INFO.rx_ind = *rx_ind; UL_INFO.slot = UL_INFO.rx_ind.slot;//TODO: Need to check to use UL_info->slot;
UL_INFO.crc_ind = *crc_ind;
UL_INFO.frame = rx_ind->sfn;
UL_INFO.slot = rx_ind->slot;
UL_INFO.module_id = UL_info->module_id; UL_INFO.module_id = UL_info->module_id;
UL_INFO.CC_id = UL_info->CC_id; UL_INFO.CC_id = UL_info->CC_id;
LOG_I(NR_MAC, " UL_info frame slot vs rx_ind frame slot vs crc_ind slot frame slot = %u %u vs %u %u vs %u %u\n", LOG_D(NR_MAC, " UL_info frame slot vs rx_ind frame slot vs crc_ind slot frame slot = %u %u vs %u %u vs %u %u\n",
UL_info->frame, UL_info->slot, UL_info->frame, UL_info->slot,
rx_ind->sfn, rx_ind->slot, UL_INFO.rx_ind.sfn, UL_INFO.rx_ind.slot,
crc_ind->sfn, crc_ind->slot UL_INFO.crc_ind.sfn, UL_INFO.crc_ind.slot
); );
if (rx_ind && UL_INFO.rx_ind.number_of_pdus > 0 && crc_ind && UL_INFO.crc_ind.number_crcs > 0) { if (UL_INFO.rx_ind.number_of_pdus > 0 && UL_INFO.crc_ind.number_crcs > 0) {
for (int i = 0; i < UL_INFO.rx_ind.number_of_pdus; i++) { for (int i = 0; i < UL_INFO.rx_ind.number_of_pdus; i++) {
int j; int j;
for (j = 0; j < UL_INFO.crc_ind.number_crcs; j++) { for (j = 0; j < UL_INFO.crc_ind.number_crcs; j++) {
...@@ -264,58 +344,68 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info) ...@@ -264,58 +344,68 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info)
handle_nr_ul_harq(UL_INFO.CC_id, UL_INFO.module_id, UL_INFO.frame, UL_INFO.slot, crc); handle_nr_ul_harq(UL_INFO.CC_id, UL_INFO.module_id, UL_INFO.frame, UL_INFO.slot, crc);
break; break;
} // for (j=0;j<UL_INFO.crc_ind.number_crcs;j++) } // for (j=0;j<UL_INFO.crc_ind.number_crcs;j++)
int last = UL_INFO.crc_ind.number_crcs - 1; if (get_softmodem_params()->nsa)
if (j < last)
{ {
crc_ind->crc_list[j] = crc_ind->crc_list[last]; int last = UL_INFO.crc_ind.number_crcs - 1;
UL_INFO.crc_ind.number_crcs--; if (j < last)
{
crc_ind->crc_list[j] = crc_ind->crc_list[last];
UL_INFO.crc_ind.number_crcs--;
}
else if (j == last)
{
UL_INFO.crc_ind.number_crcs--;
}
last = UL_INFO.rx_ind.number_of_pdus - 1;
if (i < last)
{
rx_ind->pdu_list[i] = rx_ind->pdu_list[last];
UL_INFO.rx_ind.number_of_pdus--;
i--;
}
else if (i == last)
{
UL_INFO.rx_ind.number_of_pdus--;
}
} }
else if (j == last) } // for (i=0;i<UL_INFO.rx_ind.number_of_pdus;i++)
if (get_softmodem_params()->nsa)
{
if (UL_INFO.crc_ind.number_crcs > 0)
{ {
UL_INFO.crc_ind.number_crcs--; crc_ind->number_crcs = UL_INFO.crc_ind.number_crcs;
requeue(&gnb_crc_ind_queue, crc_ind);
} }
last = UL_INFO.rx_ind.number_of_pdus - 1; if (UL_INFO.rx_ind.number_of_pdus > 0)
if (i < last)
{ {
rx_ind->pdu_list[i] = rx_ind->pdu_list[last]; rx_ind->number_of_pdus = UL_INFO.rx_ind.number_of_pdus;
UL_INFO.rx_ind.number_of_pdus--; requeue(&gnb_rx_ind_queue, rx_ind);
i--;
} }
else if (i == last)
if (UL_INFO.crc_ind.number_crcs == 0)
{ {
UL_INFO.rx_ind.number_of_pdus--; free(crc_ind->crc_list);
crc_ind->crc_list = NULL;
free(crc_ind);
crc_ind = NULL;
}
if (UL_INFO.rx_ind.number_of_pdus == 0)
{
free(rx_ind->pdu_list);
rx_ind->pdu_list = NULL;
free(rx_ind);
rx_ind = NULL;
} }
} // for (i=0;i<UL_INFO.rx_ind.number_of_pdus;i++)
if (UL_INFO.crc_ind.number_crcs > 0)
{
crc_ind->number_crcs = UL_INFO.crc_ind.number_crcs;
requeue(&gnb_crc_ind_queue, crc_ind);
}
if (UL_INFO.rx_ind.number_of_pdus > 0)
{
rx_ind->number_of_pdus = UL_INFO.rx_ind.number_of_pdus;
requeue(&gnb_rx_ind_queue, rx_ind);
}
if (UL_INFO.crc_ind.number_crcs == 0)
{
free(crc_ind->crc_list);
crc_ind->crc_list = NULL;
free(crc_ind);
crc_ind = NULL;
} }
if (UL_INFO.rx_ind.number_of_pdus == 0) else
{ {
free(rx_ind->pdu_list); UL_INFO.crc_ind.number_crcs = 0;
rx_ind->pdu_list = NULL; UL_INFO.rx_ind.number_of_pdus = 0;
free(rx_ind);
rx_ind = NULL;
} }
} else if ((rx_ind && UL_INFO.rx_ind.number_of_pdus != 0) } else if ((UL_INFO.rx_ind.number_of_pdus != 0)
|| (crc_ind && UL_INFO.crc_ind.number_crcs != 0)) { || (UL_INFO.crc_ind.number_crcs != 0)) {
LOG_E(NR_PHY, LOG_E(NR_PHY,
"hoping not to have mis-match between CRC ind and RX ind - " "hoping not to have mis-match between CRC ind and RX ind - "
"hopefully the missing message is coming shortly " "hopefully the missing message is coming shortly "
...@@ -343,6 +433,18 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) { ...@@ -343,6 +433,18 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) {
UL_info->frame,UL_info->slot, UL_info->frame,UL_info->slot,
module_id,CC_id, gnb_rach_ind_queue.num_items, module_id,CC_id, gnb_rach_ind_queue.num_items,
gnb_rx_ind_queue.num_items, gnb_crc_ind_queue.num_items); gnb_rx_ind_queue.num_items, gnb_crc_ind_queue.num_items);
/*
LOG_I(MAC, "uci_01->harq->num_harq %u with uci_pdu %p harq %p\n",
UL_info->uci_ind.uci_list->pucch_pdu_format_0_1.harq->num_harq,
&UL_info->uci_ind.uci_list->pucch_pdu_format_0_1,
UL_info->uci_ind.uci_list->pucch_pdu_format_0_1.harq);
*/
handle_nr_rach(UL_info);
handle_nr_uci(UL_info);
// clear UL DCI prior to handling ULSCH
mac->UL_dci_req[CC_id].numPdus = 0;
handle_nr_ulsch(UL_info);
if (NFAPI_MODE != NFAPI_MODE_PNF) { if (NFAPI_MODE != NFAPI_MODE_PNF) {
...@@ -356,14 +458,6 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) { ...@@ -356,14 +458,6 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) {
ifi->CC_mask |= (1<<CC_id); ifi->CC_mask |= (1<<CC_id);
handle_nr_rach(UL_info);
handle_nr_uci(UL_info);
// clear HI prior to handling ULSCH
mac->UL_dci_req[CC_id].numPdus = 0;
handle_nr_ulsch(UL_info);
if (ifi->CC_mask == ((1<<MAX_NUM_CCs)-1)) { if (ifi->CC_mask == ((1<<MAX_NUM_CCs)-1)) {
/* /*
eNB_dlsch_ulsch_scheduler(module_id, eNB_dlsch_ulsch_scheduler(module_id,
......
...@@ -827,7 +827,8 @@ int handle_dci(module_id_t module_id, int cc_id, unsigned int gNB_index, frame_t ...@@ -827,7 +827,8 @@ int handle_dci(module_id_t module_id, int cc_id, unsigned int gNB_index, frame_t
// Note: sdu should always be processed because data and timing advance updates are transmitted by the UE // Note: sdu should always be processed because data and timing advance updates are transmitted by the UE
int8_t handle_dlsch(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment, int pdu_id){ int8_t handle_dlsch(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment, int pdu_id){
dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.harq_pid = g_harq_pid; if (get_softmodem_params()->nsa)
dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.harq_pid = g_harq_pid;
update_harq_status(dl_info, pdu_id); update_harq_status(dl_info, pdu_id);
if(dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.ack_nack) if(dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.ack_nack)
...@@ -844,7 +845,6 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ ...@@ -844,7 +845,6 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){
if (ul_info->ue_sched_mode == ONLY_PUSCH) { if (ul_info->ue_sched_mode == ONLY_PUSCH) {
ret = nr_ue_scheduler(NULL, ul_info); ret = nr_ue_scheduler(NULL, ul_info);
LOG_I(NR_MAC, "In nr_ue_ul_indication: We are to return due to ul_info->ue_sched_mode == ONLY_PUSCH\n");
return 0; return 0;
} }
if (ul_info->ue_sched_mode == SCHED_ALL) { if (ul_info->ue_sched_mode == SCHED_ALL) {
...@@ -857,10 +857,7 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ ...@@ -857,10 +857,7 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){
NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon = mac->scc != NULL ? mac->scc->tdd_UL_DL_ConfigurationCommon : mac->scc_SIB->tdd_UL_DL_ConfigurationCommon; NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon = mac->scc != NULL ? mac->scc->tdd_UL_DL_ConfigurationCommon : mac->scc_SIB->tdd_UL_DL_ConfigurationCommon;
if (is_nr_UL_slot(tdd_UL_DL_ConfigurationCommon, ul_info->slot_tx, mac->frame_type) && !get_softmodem_params()->phy_test) if (is_nr_UL_slot(tdd_UL_DL_ConfigurationCommon, ul_info->slot_tx, mac->frame_type) && !get_softmodem_params()->phy_test)
{
LOG_I(NR_MAC, "In nr_ue_ul_indication: We are here to call nr_ue_prach_scheduler \n");
nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->thread_id); nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->thread_id);
}
if (is_nr_UL_slot(tdd_UL_DL_ConfigurationCommon, ul_info->slot_tx, mac->frame_type)) if (is_nr_UL_slot(tdd_UL_DL_ConfigurationCommon, ul_info->slot_tx, mac->frame_type))
nr_ue_pucch_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->thread_id); nr_ue_pucch_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->thread_id);
...@@ -905,11 +902,14 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_ ...@@ -905,11 +902,14 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
dl_info->slot, dl_info->slot,
dl_info->dci_ind->dci_list+i); dl_info->dci_ind->dci_list+i);
fapi_nr_dci_indication_pdu_t *dci_index = dl_info->dci_ind->dci_list+i; if (get_softmodem_params()->nsa)
dci_pdu_rel15_t *def_dci_pdu_rel15 = &mac->def_dci_pdu_rel15[dci_index->dci_format]; {
g_harq_pid = def_dci_pdu_rel15->harq_pid; fapi_nr_dci_indication_pdu_t *dci_index = dl_info->dci_ind->dci_list+i;
LOG_D(NR_MAC, "Setting harq_pid = %d and dci_index = %d (based on format)\n", g_harq_pid, dci_index->dci_format); dci_pdu_rel15_t *def_dci_pdu_rel15 = &mac->def_dci_pdu_rel15[dci_index->dci_format];
memset(def_dci_pdu_rel15, 0, sizeof(*def_dci_pdu_rel15)); g_harq_pid = def_dci_pdu_rel15->harq_pid;
LOG_D(NR_MAC, "Setting harq_pid = %d and dci_index = %d (based on format)\n", g_harq_pid, dci_index->dci_format);
memset(def_dci_pdu_rel15, 0, sizeof(*def_dci_pdu_rel15));
}
ret_mask |= (ret << FAPI_NR_DCI_IND); ret_mask |= (ret << FAPI_NR_DCI_IND);
if (ret >= 0) { if (ret >= 0) {
......
...@@ -148,7 +148,7 @@ typedef struct UE_RRC_INFO_NB_IoT_s { ...@@ -148,7 +148,7 @@ typedef struct UE_RRC_INFO_NB_IoT_s {
//Measurement Report not supported in NB-IoT //Measurement Report not supported in NB-IoT
#define PAYLOAD_SIZE_MAX 1024 #define PAYLOAD_SIZE_MAX 1024
#define RRC_BUF_SIZE 512 #define RRC_BUF_SIZE 8192
#define UNDEF_SECURITY_MODE 0xff #define UNDEF_SECURITY_MODE 0xff
#define NO_SECURITY_MODE 0x20 #define NO_SECURITY_MODE 0x20
......
...@@ -1034,6 +1034,7 @@ void fill_initial_SpCellConfig(rnti_t rnti, ...@@ -1034,6 +1034,7 @@ void fill_initial_SpCellConfig(rnti_t rnti,
NR_PUCCH_Resource_t *pucchres0=calloc(1,sizeof(*pucchres0)); NR_PUCCH_Resource_t *pucchres0=calloc(1,sizeof(*pucchres0));
pucchres0->pucch_ResourceId=0; pucchres0->pucch_ResourceId=0;
pucchres0->startingPRB=0;//(8+rnti) % curr_bwp; pucchres0->startingPRB=0;//(8+rnti) % curr_bwp;
//pucchres0->startingPRB = (8+rnti) % curr_bwp;
LOG_D(NR_RRC, "pucchres0->startPRB %ld rnti %d curr_bwp %d\n", pucchres0->startingPRB, rnti, curr_bwp); LOG_D(NR_RRC, "pucchres0->startPRB %ld rnti %d curr_bwp %d\n", pucchres0->startingPRB, rnti, curr_bwp);
pucchres0->intraSlotFrequencyHopping=NULL; pucchres0->intraSlotFrequencyHopping=NULL;
pucchres0->secondHopPRB=NULL; pucchres0->secondHopPRB=NULL;
......
...@@ -945,7 +945,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ...@@ -945,7 +945,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
long *delay[8]; long *delay[8];
for (int i=0;i<8;i++) { for (int i=0;i<8;i++) {
delay[i] = calloc(1,sizeof(*delay[i])); delay[i] = calloc(1,sizeof(*delay[i]));
*delay[i] = i + 6; *delay[i] = (i<6) ? (i+2) : 0;//TODO: Needs to check to use i + 6;
ASN_SEQUENCE_ADD(&pucch_Config->dl_DataToUL_ACK->list,delay[i]); ASN_SEQUENCE_ADD(&pucch_Config->dl_DataToUL_ACK->list,delay[i]);
} }
pucch_Config->spatialRelationInfoToAddModList = calloc(1,sizeof(*pucch_Config->spatialRelationInfoToAddModList)); pucch_Config->spatialRelationInfoToAddModList = calloc(1,sizeof(*pucch_Config->spatialRelationInfoToAddModList));
......
...@@ -248,17 +248,20 @@ int8_t nr_rrc_ue_process_rrcReconfiguration(const module_id_t module_id, NR_RRCR ...@@ -248,17 +248,20 @@ int8_t nr_rrc_ue_process_rrcReconfiguration(const module_id_t module_id, NR_RRCR
if(NR_UE_rrc_inst[module_id].radio_bearer_config == NULL){ if(NR_UE_rrc_inst[module_id].radio_bearer_config == NULL){
NR_UE_rrc_inst[module_id].radio_bearer_config = rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->radioBearerConfig; NR_UE_rrc_inst[module_id].radio_bearer_config = rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->radioBearerConfig;
}else{ }else{
protocol_ctxt_t ctxt; //protocol_ctxt_t ctxt;
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); //NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_id, ENB_FLAG_YES, mac->crnti, 0, 0, 0); //PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_id, ENB_FLAG_YES, mac->crnti, 0, 0, 0);
struct NR_RadioBearerConfig *RadioBearerConfig = rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->radioBearerConfig; struct NR_RadioBearerConfig *RadioBearerConfig = rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->radioBearerConfig;
xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void*)RadioBearerConfig); //xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void*)RadioBearerConfig);
LOG_D(NR_RRC, "Calling fill_default_rbconfig_ue at %d with: e_rab_id = %ld, drbID = %ld, cipher_algo = %ld, key = %ld \n", LOG_D(NR_RRC, "Calling fill_default_rbconfig_ue at %d with: e_rab_id = %ld, drbID = %ld, cipher_algo = %ld, key = %ld \n",
__LINE__, RadioBearerConfig->drb_ToAddModList->list.array[0]->cnAssociation->choice.eps_BearerIdentity, __LINE__, RadioBearerConfig->drb_ToAddModList->list.array[0]->cnAssociation->choice.eps_BearerIdentity,
RadioBearerConfig->drb_ToAddModList->list.array[0]->drb_Identity, RadioBearerConfig->drb_ToAddModList->list.array[0]->drb_Identity,
RadioBearerConfig->securityConfig->securityAlgorithmConfig->cipheringAlgorithm, RadioBearerConfig->securityConfig->securityAlgorithmConfig->cipheringAlgorithm,
*RadioBearerConfig->securityConfig->keyToUse); *RadioBearerConfig->securityConfig->keyToUse);
nr_rrc_ue_process_RadioBearerConfig(&ctxt, 0, RadioBearerConfig); //nr_rrc_ue_process_RadioBearerConfig(&ctxt, 0, RadioBearerConfig);
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void *) RadioBearerConfig);
}
} }
} }
if(rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->secondaryCellGroup != NULL){ if(rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->secondaryCellGroup != NULL){
...@@ -408,11 +411,9 @@ void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type, ...@@ -408,11 +411,9 @@ void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type,
SEQUENCE_free( &asn_DEF_NR_RadioBearerConfig, RadioBearerConfig, 1 ); SEQUENCE_free( &asn_DEF_NR_RadioBearerConfig, RadioBearerConfig, 1 );
return; return;
} }
#if 0
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void *) RadioBearerConfig); xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void *) RadioBearerConfig);
} }
#endif
#if 0 #if 0
protocol_ctxt_t ctxt; protocol_ctxt_t ctxt;
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
......
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