Commit 7e244b3d authored by Laurent THOMAS's avatar Laurent THOMAS

make return in ul_config case correct, replace asserts by LOG_E()and return error

parent 84ade524
...@@ -540,7 +540,12 @@ void processSlotTX(void *arg) { ...@@ -540,7 +540,12 @@ void processSlotTX(void *arg) {
PHY_VARS_NR_UE *UE = rxtxD->UE; PHY_VARS_NR_UE *UE = rxtxD->UE;
nr_phy_data_tx_t phy_data = {0}; nr_phy_data_tx_t phy_data = {0};
LOG_D(PHY,"%d.%d => slot type %d\n", proc->frame_tx, proc->nr_slot_tx, proc->tx_slot_type); LOG_D(PHY,
"SlotTx %d.%d => slot type %d, wait: %d \n",
proc->frame_tx,
proc->nr_slot_tx,
proc->tx_slot_type,
rxtxD->tx_wait_for_dlsch);
if (proc->tx_slot_type == NR_UPLINK_SLOT || proc->tx_slot_type == NR_MIXED_SLOT){ if (proc->tx_slot_type == NR_UPLINK_SLOT || proc->tx_slot_type == NR_MIXED_SLOT){
if (rxtxD->tx_wait_for_dlsch) if (rxtxD->tx_wait_for_dlsch)
LOG_D(PHY, "enter wait for tx, slot %d, nb events to wait %d; ", proc->nr_slot_tx, rxtxD->tx_wait_for_dlsch); LOG_D(PHY, "enter wait for tx, slot %d, nb events to wait %d; ", proc->nr_slot_tx, rxtxD->tx_wait_for_dlsch);
......
...@@ -372,9 +372,7 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -372,9 +372,7 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
} }
LOG_D(PHY, LOG_D(PHY,
"ULSCH Decoding, ulsch_id %d, harq_pid %d rnti %x TBS %d G %d mcs %d Nl %d nb_rb %d, Qm %d, Coderate %f RV %d round %d new " "ULSCH Decoding, harq_pid %d rnti %x TBS %d G %d mcs %d Nl %d nb_rb %d, Qm %d, Coderate %f RV %d round %d new RX %d\n",
"RX %d\n",
ULSCH_id,
harq_pid, harq_pid,
ulsch->rnti, ulsch->rnti,
A, A,
......
...@@ -1025,7 +1025,6 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_ ...@@ -1025,7 +1025,6 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_
time_stats_t meas = {0}; time_stats_t meas = {0};
start_meas(&meas); start_meas(&meas);
// do procedures for C-RNTI // do procedures for C-RNTI
int ret_pdsch = 0;
const uint32_t rxdataF_sz = ue->frame_parms.samples_per_slot_wCP; const uint32_t rxdataF_sz = ue->frame_parms.samples_per_slot_wCP;
__attribute__ ((aligned(32))) c16_t rxdataF[ue->frame_parms.nb_antennas_rx][rxdataF_sz]; __attribute__ ((aligned(32))) c16_t rxdataF[ue->frame_parms.nb_antennas_rx][rxdataF_sz];
...@@ -1081,11 +1080,8 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_ ...@@ -1081,11 +1080,8 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_
llr[i] = (int16_t *)malloc16_clear(rx_llr_buf_sz * sizeof(int16_t)); llr[i] = (int16_t *)malloc16_clear(rx_llr_buf_sz * sizeof(int16_t));
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_C, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_C, VCD_FUNCTION_IN);
ret_pdsch = nr_ue_pdsch_procedures(ue, // it returns -1 in case of internal failure, or 0 in case of normal result
proc, int ret_pdsch = nr_ue_pdsch_procedures(ue, proc, dlsch, llr, rxdataF);
dlsch,
llr,
rxdataF);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_C, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_C, VCD_FUNCTION_OUT);
...@@ -1103,6 +1099,7 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_ ...@@ -1103,6 +1099,7 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_
send_dl_done_to_tx_thread( send_dl_done_to_tx_thread(
ue->tx_resume_ind_fifo + (proc->nr_slot_rx + dlsch_config->k1_feedback) % ue->frame_parms.slots_per_frame, ue->tx_resume_ind_fifo + (proc->nr_slot_rx + dlsch_config->k1_feedback) % ue->frame_parms.slots_per_frame,
proc->nr_slot_rx); proc->nr_slot_rx);
LOG_W(NR_PHY, "nr_ue_pdsch_procedures failed in slot %d\n", proc->nr_slot_rx);
} }
stop_meas(&ue->dlsch_procedures_stat); stop_meas(&ue->dlsch_procedures_stat);
......
...@@ -382,7 +382,7 @@ int get_deltatf(uint16_t nb_of_prbs, ...@@ -382,7 +382,7 @@ int get_deltatf(uint16_t nb_of_prbs,
int N_sc_ctrl_RB, int N_sc_ctrl_RB,
int O_UCI); int O_UCI);
void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac, int nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac,
int slot, int slot,
uint16_t rnti, uint16_t rnti,
PUCCH_sched_t *pucch, PUCCH_sched_t *pucch,
...@@ -496,7 +496,13 @@ int16_t compute_nr_SSB_PL(NR_UE_MAC_INST_t *mac, short ssb_rsrp_dBm); ...@@ -496,7 +496,13 @@ int16_t compute_nr_SSB_PL(NR_UE_MAC_INST_t *mac, short ssb_rsrp_dBm);
// - in which ULSCH should be scheduled. K2 is configured in RRC configuration. // - in which ULSCH should be scheduled. K2 is configured in RRC configuration.
// PUSCH Msg3 scheduler: // PUSCH Msg3 scheduler:
// - scheduled by RAR UL grant according to 8.3 of TS 38.213 // - scheduled by RAR UL grant according to 8.3 of TS 38.213
int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac, uint8_t is_Msg3, frame_t current_frame, int current_slot, frame_t *frame_tx, int *slot_tx, long k2); int nr_ue_pusch_scheduler(const NR_UE_MAC_INST_t *mac,
const uint8_t is_Msg3,
const frame_t current_frame,
const int current_slot,
frame_t *frame_tx,
int *slot_tx,
const long k2);
int get_rnti_type(NR_UE_MAC_INST_t *mac, uint16_t rnti); int get_rnti_type(NR_UE_MAC_INST_t *mac, uint16_t rnti);
......
...@@ -102,7 +102,7 @@ random-access procedure ...@@ -102,7 +102,7 @@ random-access procedure
@param selected_rar_buffer the output buffer for storing the selected RAR header and RAR payload @param selected_rar_buffer the output buffer for storing the selected RAR header and RAR payload
@returns timing advance or 0xffff if preamble doesn't match @returns timing advance or 0xffff if preamble doesn't match
*/ */
static int nr_ue_process_rar(nr_downlink_indication_t *dl_info, int pdu_id); static void nr_ue_process_rar(nr_downlink_indication_t *dl_info, int pdu_id);
int get_pucch0_mcs(const int O_ACK, const int O_SR, const int ack_payload, const int sr_payload) int get_pucch0_mcs(const int O_ACK, const int O_SR, const int ack_payload, const int sr_payload)
{ {
...@@ -190,7 +190,7 @@ int get_rnti_type(NR_UE_MAC_INST_t *mac, uint16_t rnti) ...@@ -190,7 +190,7 @@ int get_rnti_type(NR_UE_MAC_INST_t *mac, uint16_t rnti)
} else if (rnti == 0xFFFF) { } else if (rnti == 0xFFFF) {
rnti_type = TYPE_SI_RNTI_; rnti_type = TYPE_SI_RNTI_;
} else { } else {
AssertFatal(1 == 0, "In %s: Not identified/handled rnti %d \n", __FUNCTION__, rnti); AssertFatal(1 == 0, "Not identified/handled rnti %d \n", rnti);
} }
LOG_D(MAC, "Returning rnti_type %s \n", rnti_types(rnti_type)); LOG_D(MAC, "Returning rnti_type %s \n", rnti_types(rnti_type));
...@@ -1279,7 +1279,7 @@ void set_harq_status(NR_UE_MAC_INST_t *mac, ...@@ -1279,7 +1279,7 @@ void set_harq_status(NR_UE_MAC_INST_t *mac,
harq_id, frame, slot, current_harq->ul_frame, current_harq->ul_slot, data_toul_fb); harq_id, frame, slot, current_harq->ul_frame, current_harq->ul_slot, data_toul_fb);
} }
void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac, int nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac,
int slot, int slot,
uint16_t rnti, uint16_t rnti,
PUCCH_sched_t *pucch, PUCCH_sched_t *pucch,
...@@ -1341,11 +1341,11 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac, ...@@ -1341,11 +1341,11 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac,
if (mac->harq_ACK_SpatialBundlingPUCCH || if (mac->harq_ACK_SpatialBundlingPUCCH ||
mac->pdsch_HARQ_ACK_Codebook != NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic) { mac->pdsch_HARQ_ACK_Codebook != NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic) {
LOG_E(MAC,"PUCCH Unsupported cell group configuration\n"); LOG_E(NR_MAC, "PUCCH Unsupported cell group configuration\n");
return; return -1;
} else if (sc_info->pdsch_CGB_Transmission) { } else if (sc_info->pdsch_CGB_Transmission) {
LOG_E(MAC,"PUCCH Unsupported code block group for serving cell config\n"); LOG_E(NR_MAC, "PUCCH Unsupported code block group for serving cell config\n");
return; return -1;
} }
NR_PUSCH_Config_t *pusch_Config = current_UL_BWP ? current_UL_BWP->pusch_Config : NULL; NR_PUSCH_Config_t *pusch_Config = current_UL_BWP ? current_UL_BWP->pusch_Config : NULL;
...@@ -1371,8 +1371,8 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac, ...@@ -1371,8 +1371,8 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac,
int n_uci = pucch->n_sr + pucch->n_harq + pucch->n_csi; int n_uci = pucch->n_sr + pucch->n_harq + pucch->n_csi;
if (n_uci > (sizeof(uint64_t) * 8)) { if (n_uci > (sizeof(uint64_t) * 8)) {
LOG_E(MAC,"PUCCH number of UCI bits exceeds payload size\n"); LOG_E(NR_MAC, "PUCCH number of UCI bits exceeds payload size\n");
return; return -1;
} }
switch(pucchres->format.present) { switch(pucchres->format.present) {
...@@ -1470,7 +1470,8 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac, ...@@ -1470,7 +1470,8 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac,
pucch_pdu->payload = (pucch->csi_part1_payload << (pucch->n_harq + pucch->n_sr)) | (pucch->sr_payload << pucch->n_harq) | pucch->ack_payload; pucch_pdu->payload = (pucch->csi_part1_payload << (pucch->n_harq + pucch->n_sr)) | (pucch->sr_payload << pucch->n_harq) | pucch->ack_payload;
break; break;
default : default :
AssertFatal(1==0,"Undefined PUCCH format \n"); LOG_E(NR_MAC, "Undefined PUCCH format \n");
return -1;
} }
pucch_pdu->pucch_tx_power = get_pucch_tx_power_ue(mac, pucch_pdu->pucch_tx_power = get_pucch_tx_power_ue(mac,
...@@ -1484,8 +1485,10 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac, ...@@ -1484,8 +1485,10 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac,
pucch_pdu->nr_of_symbols, pucch_pdu->nr_of_symbols,
subframe_number, subframe_number,
n_uci); n_uci);
} else } else {
AssertFatal(1 == 0, "problem with pucch configuration\n"); LOG_E(NR_MAC, "problem with pucch configuration\n");
return -1;
}
NR_PUCCH_ConfigCommon_t *pucch_ConfigCommon = current_UL_BWP->pucch_ConfigCommon; NR_PUCCH_ConfigCommon_t *pucch_ConfigCommon = current_UL_BWP->pucch_ConfigCommon;
...@@ -1511,8 +1514,10 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac, ...@@ -1511,8 +1514,10 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac,
pucch_pdu->sequence_hop_flag = 1; pucch_pdu->sequence_hop_flag = 1;
break; break;
default: default:
AssertFatal(1==0,"Group hopping flag undefined (0,1,2) \n"); LOG_E(NR_MAC, "Group hopping flag undefined (0,1,2) \n");
return -1;
} }
return 0;
} }
int16_t get_pucch_tx_power_ue(NR_UE_MAC_INST_t *mac, int16_t get_pucch_tx_power_ue(NR_UE_MAC_INST_t *mac,
...@@ -1696,7 +1701,7 @@ NR_PUCCH_Resource_t *find_pucch_resource_from_list(struct NR_PUCCH_Config__resou ...@@ -1696,7 +1701,7 @@ NR_PUCCH_Resource_t *find_pucch_resource_from_list(struct NR_PUCCH_Config__resou
return pucch_resource; return pucch_resource;
} }
bool check_mux_acknack_csi(NR_PUCCH_Resource_t *csi_res, NR_PUCCH_Config_t *pucch_Config) static bool check_mux_acknack_csi(NR_PUCCH_Resource_t *csi_res, NR_PUCCH_Config_t *pucch_Config)
{ {
bool ret; bool ret;
switch (csi_res->format.present) { switch (csi_res->format.present) {
...@@ -2823,7 +2828,7 @@ void nr_ue_send_sdu(nr_downlink_indication_t *dl_info, int pdu_id) ...@@ -2823,7 +2828,7 @@ void nr_ue_send_sdu(nr_downlink_indication_t *dl_info, int pdu_id)
nr_ue_process_mac_pdu(dl_info, pdu_id); nr_ue_process_mac_pdu(dl_info, pdu_id);
break; break;
case FAPI_NR_RX_PDU_TYPE_RAR: case FAPI_NR_RX_PDU_TYPE_RAR:
nr_ue_process_rar(dl_info, pdu_id); nr_ue_process_rar(dl_info, pdu_id);
break; break;
default: default:
break; break;
...@@ -3969,7 +3974,7 @@ int nr_write_ce_ulsch_pdu(uint8_t *mac_ce, ...@@ -3969,7 +3974,7 @@ int nr_write_ce_ulsch_pdu(uint8_t *mac_ce,
// - b buffer // - b buffer
// - ulsch power offset // - ulsch power offset
// - optimize: mu_pusch, j and table_6_1_2_1_1_2_time_dom_res_alloc_A are already defined in nr_ue_procedures // - optimize: mu_pusch, j and table_6_1_2_1_1_2_time_dom_res_alloc_A are already defined in nr_ue_procedures
static int nr_ue_process_rar(nr_downlink_indication_t *dl_info, int pdu_id) static void nr_ue_process_rar(nr_downlink_indication_t *dl_info, int pdu_id)
{ {
module_id_t mod_id = dl_info->module_id; module_id_t mod_id = dl_info->module_id;
frame_t frame = dl_info->frame; frame_t frame = dl_info->frame;
...@@ -3977,7 +3982,7 @@ static int nr_ue_process_rar(nr_downlink_indication_t *dl_info, int pdu_id) ...@@ -3977,7 +3982,7 @@ static int nr_ue_process_rar(nr_downlink_indication_t *dl_info, int pdu_id)
if(dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.ack_nack == 0) { if(dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.ack_nack == 0) {
LOG_W(NR_MAC,"[UE %d][RAPROC][%d.%d] CRC check failed on RAR (NAK)\n", mod_id, frame, slot); LOG_W(NR_MAC,"[UE %d][RAPROC][%d.%d] CRC check failed on RAR (NAK)\n", mod_id, frame, slot);
return 0; return;
} }
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
...@@ -4046,7 +4051,6 @@ static int nr_ue_process_rar(nr_downlink_indication_t *dl_info, int pdu_id) ...@@ -4046,7 +4051,6 @@ static int nr_ue_process_rar(nr_downlink_indication_t *dl_info, int pdu_id)
#endif #endif
if (ra->RA_RAPID_found) { if (ra->RA_RAPID_found) {
RAR_grant_t rar_grant; RAR_grant_t rar_grant;
unsigned char tpc_command; unsigned char tpc_command;
...@@ -4147,7 +4151,7 @@ static int nr_ue_process_rar(nr_downlink_indication_t *dl_info, int pdu_id) ...@@ -4147,7 +4151,7 @@ static int nr_ue_process_rar(nr_downlink_indication_t *dl_info, int pdu_id)
rar_grant.Msg3_t_alloc); rar_grant.Msg3_t_alloc);
if (tda_info.nrOfSymbols == 0) { if (tda_info.nrOfSymbols == 0) {
LOG_E(MAC, "Cannot schedule Msg3. Something wrong in TDA information\n"); LOG_E(MAC, "Cannot schedule Msg3. Something wrong in TDA information\n");
return -1; return;
} }
ret = nr_ue_pusch_scheduler(mac, is_Msg3, frame, slot, &frame_tx, &slot_tx, tda_info.k2); ret = nr_ue_pusch_scheduler(mac, is_Msg3, frame, slot, &frame_tx, &slot_tx, tda_info.k2);
...@@ -4158,7 +4162,6 @@ static int nr_ue_process_rar(nr_downlink_indication_t *dl_info, int pdu_id) ...@@ -4158,7 +4162,6 @@ static int nr_ue_process_rar(nr_downlink_indication_t *dl_info, int pdu_id)
if (!ul_config) { if (!ul_config) {
LOG_W(MAC, "In %s: ul_config request is NULL. Probably due to unexpected UL DCI in frame.slot %d.%d. Ignoring DCI!\n", __FUNCTION__, frame, slot); LOG_W(MAC, "In %s: ul_config request is NULL. Probably due to unexpected UL DCI in frame.slot %d.%d. Ignoring DCI!\n", __FUNCTION__, frame, slot);
return -1;
} }
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);
...@@ -4185,7 +4188,7 @@ static int nr_ue_process_rar(nr_downlink_indication_t *dl_info, int pdu_id) ...@@ -4185,7 +4188,7 @@ static int nr_ue_process_rar(nr_downlink_indication_t *dl_info, int pdu_id)
ra->t_crnti = 0; ra->t_crnti = 0;
} }
return ret; return;
} }
// Returns the pathloss in dB for the active UL BWP on the selected carrier based on the DL RS associated with the PRACH transmission // Returns the pathloss in dB for the active UL BWP on the selected carrier based on the DL RS associated with the PRACH transmission
......
...@@ -1420,7 +1420,13 @@ int nr_get_sf_retxBSRTimer(uint8_t sf_offset) { ...@@ -1420,7 +1420,13 @@ int nr_get_sf_retxBSRTimer(uint8_t sf_offset) {
// PUSCH Msg3 scheduler: // PUSCH Msg3 scheduler:
// - scheduled by RAR UL grant according to 8.3 of TS 38.213 // - scheduled by RAR UL grant according to 8.3 of TS 38.213
// Note: Msg3 tx in the uplink symbols of mixed slot // Note: Msg3 tx in the uplink symbols of mixed slot
int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac, uint8_t is_Msg3, frame_t current_frame, int current_slot, frame_t *frame_tx, int *slot_tx, long k2) int nr_ue_pusch_scheduler(const NR_UE_MAC_INST_t *mac,
const uint8_t is_Msg3,
const frame_t current_frame,
const int current_slot,
frame_t *frame_tx,
int *slot_tx,
const long k2)
{ {
AssertFatal(k2 > DURATION_RX_TO_TX, AssertFatal(k2 > DURATION_RX_TO_TX,
"Slot offset K2 (%ld) needs to be higher than DURATION_RX_TO_TX (%d). Please set min_rxtxtime at least to %d in gNB config file or gNBs.[0].min_rxtxtime=%d via command line.\n", "Slot offset K2 (%ld) needs to be higher than DURATION_RX_TO_TX (%d). Please set min_rxtxtime at least to %d in gNB config file or gNBs.[0].min_rxtxtime=%d via command line.\n",
...@@ -1430,7 +1436,7 @@ int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac, uint8_t is_Msg3, frame_t curren ...@@ -1430,7 +1436,7 @@ int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac, uint8_t is_Msg3, frame_t curren
DURATION_RX_TO_TX); DURATION_RX_TO_TX);
int delta = 0; int delta = 0;
NR_UE_UL_BWP_t *current_UL_BWP = mac->current_UL_BWP; const NR_UE_UL_BWP_t *current_UL_BWP = mac->current_UL_BWP;
// Get the numerology to calculate the Tx frame and slot // Get the numerology to calculate the Tx frame and slot
int mu = current_UL_BWP->scs; int mu = current_UL_BWP->scs;
......
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