Commit 679a0084 authored by Jaroslava Fiedlerova's avatar Jaroslava Fiedlerova

Merge remote-tracking branch 'origin/fix-ue-scheduler-stack-copy' into integration_2024_w04

parents da5ce90d eac30839
...@@ -218,4 +218,10 @@ time_stats_t *register_meas(char *name); ...@@ -218,4 +218,10 @@ time_stats_t *register_meas(char *name);
void send_meas(time_stats_t *ts, int msgid); void send_meas(time_stats_t *ts, int msgid);
void end_meas(void); void end_meas(void);
#define timeIt(a) \
{ \
uint64_t deb = rdtsc_oai(); \
a; \
LOG_W(UTIL, #a ": %llu\n", (rdtsc_oai() - deb) / 3000); \
}
#endif #endif
...@@ -310,16 +310,13 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) ...@@ -310,16 +310,13 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
int CC_id = 0; int CC_id = 0;
uint8_t gNB_id = 0; uint8_t gNB_id = 0;
nr_uplink_indication_t ul_info;
int slots_per_frame = 20; //30 kHZ subcarrier spacing int slots_per_frame = 20; //30 kHZ subcarrier spacing
int slot_ahead = 2; // TODO: Make this dynamic int slot_ahead = 2; // TODO: Make this dynamic
ul_info.cc_id = CC_id; nr_uplink_indication_t ul_info = {.cc_id = CC_id,
ul_info.gNB_index = gNB_id; .gNB_index = gNB_id,
ul_info.module_id = mod_id; .module_id = mod_id,
ul_info.frame_rx = frame; .slot = (slot + slot_ahead) % slots_per_frame,
ul_info.slot_rx = slot; .frame = (slot + slot_ahead >= slots_per_frame) ? (frame + 1) % 1024 : frame};
ul_info.slot_tx = (slot + slot_ahead) % slots_per_frame;
ul_info.frame_tx = (ul_info.slot_rx + slot_ahead >= slots_per_frame) ? ul_info.frame_rx + 1 : ul_info.frame_rx;
if (pthread_mutex_lock(&mac->mutex_dl_info)) abort(); if (pthread_mutex_lock(&mac->mutex_dl_info)) abort();
...@@ -330,8 +327,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) ...@@ -330,8 +327,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
free_and_zero(ch_info); free_and_zero(ch_info);
} }
if (is_nr_DL_slot(mac->tdd_UL_DL_ConfigurationCommon, if (is_nr_DL_slot(mac->tdd_UL_DL_ConfigurationCommon, slot)) {
ul_info.slot_rx)) {
memset(&mac->dl_info, 0, sizeof(mac->dl_info)); memset(&mac->dl_info, 0, sizeof(mac->dl_info));
mac->dl_info.cc_id = CC_id; mac->dl_info.cc_id = CC_id;
mac->dl_info.gNB_index = gNB_id; mac->dl_info.gNB_index = gNB_id;
...@@ -345,9 +341,8 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) ...@@ -345,9 +341,8 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
if (pthread_mutex_unlock(&mac->mutex_dl_info)) abort(); if (pthread_mutex_unlock(&mac->mutex_dl_info)) abort();
if (is_nr_UL_slot(mac->tdd_UL_DL_ConfigurationCommon, if (is_nr_UL_slot(mac->tdd_UL_DL_ConfigurationCommon, ul_info.slot, mac->frame_type)) {
ul_info.slot_tx, mac->frame_type)) { LOG_D(NR_MAC, "Slot %d. calling nr_ue_ul_ind()\n", ul_info.slot);
LOG_D(NR_MAC, "Slot %d. calling nr_ue_ul_ind()\n", ul_info.slot_tx);
nr_ue_ul_scheduler(&ul_info); nr_ue_ul_scheduler(&ul_info);
} }
process_queued_nr_nfapi_msgs(mac, sfn_slot); process_queued_nr_nfapi_msgs(mac, sfn_slot);
...@@ -545,7 +540,12 @@ void processSlotTX(void *arg) { ...@@ -545,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);
...@@ -587,17 +587,12 @@ void processSlotTX(void *arg) { ...@@ -587,17 +587,12 @@ void processSlotTX(void *arg) {
// [TODO] mapping right after NR initial sync // [TODO] mapping right after NR initial sync
if(UE->if_inst != NULL && UE->if_inst->ul_indication != NULL) { if(UE->if_inst != NULL && UE->if_inst->ul_indication != NULL) {
start_meas(&UE->ue_ul_indication_stats); start_meas(&UE->ue_ul_indication_stats);
nr_uplink_indication_t ul_indication; nr_uplink_indication_t ul_indication = {.module_id = UE->Mod_id,
memset((void*)&ul_indication, 0, sizeof(ul_indication)); .gNB_index = proc->gNB_id,
.cc_id = UE->CC_id,
ul_indication.module_id = UE->Mod_id; .frame = proc->frame_tx,
ul_indication.gNB_index = proc->gNB_id; .slot = proc->nr_slot_tx,
ul_indication.cc_id = UE->CC_id; .phy_data = &phy_data};
ul_indication.frame_rx = proc->frame_rx;
ul_indication.slot_rx = proc->nr_slot_rx;
ul_indication.frame_tx = proc->frame_tx;
ul_indication.slot_tx = proc->nr_slot_tx;
ul_indication.phy_data = &phy_data;
UE->if_inst->ul_indication(&ul_indication); UE->if_inst->ul_indication(&ul_indication);
stop_meas(&UE->ue_ul_indication_stats); stop_meas(&UE->ue_ul_indication_stats);
......
...@@ -69,4 +69,5 @@ ...@@ -69,4 +69,5 @@
#define FAPI_NR_UL_CONFIG_TYPE_SRS 0x04 #define FAPI_NR_UL_CONFIG_TYPE_SRS 0x04
#define FAPI_NR_UL_CONFIG_TYPES 0x04 #define FAPI_NR_UL_CONFIG_TYPES 0x04
#define FAPI_NR_END 0xff
#endif #endif
...@@ -168,7 +168,6 @@ typedef struct { ...@@ -168,7 +168,6 @@ typedef struct {
typedef struct { typedef struct {
uint16_t pdu_length; uint16_t pdu_length;
uint16_t pdu_index;
uint8_t* pdu; uint8_t* pdu;
} fapi_nr_tx_request_body_t; } fapi_nr_tx_request_body_t;
...@@ -358,6 +357,7 @@ typedef struct ...@@ -358,6 +357,7 @@ typedef struct
nfapi_nr_ue_ul_beamforming_t beamforming; nfapi_nr_ue_ul_beamforming_t beamforming;
//OAI specific //OAI specific
int8_t absolute_delta_PUSCH; int8_t absolute_delta_PUSCH;
fapi_nr_tx_request_body_t tx_request_body;
} nfapi_nr_ue_pusch_pdu_t; } nfapi_nr_ue_pusch_pdu_t;
typedef struct { typedef struct {
...@@ -391,24 +391,25 @@ typedef struct { ...@@ -391,24 +391,25 @@ typedef struct {
} fapi_nr_ul_config_srs_pdu; } fapi_nr_ul_config_srs_pdu;
typedef struct { typedef struct {
uint8_t pdu_type; int pdu_type;
union { union {
fapi_nr_ul_config_prach_pdu prach_config_pdu; fapi_nr_ul_config_prach_pdu prach_config_pdu;
fapi_nr_ul_config_pucch_pdu pucch_config_pdu; fapi_nr_ul_config_pucch_pdu pucch_config_pdu;
nfapi_nr_ue_pusch_pdu_t pusch_config_pdu; nfapi_nr_ue_pusch_pdu_t pusch_config_pdu;
fapi_nr_ul_config_srs_pdu srs_config_pdu; fapi_nr_ul_config_srs_pdu srs_config_pdu;
}; };
pthread_mutex_t* lock;
int* privateNBpdus;
} fapi_nr_ul_config_request_pdu_t; } fapi_nr_ul_config_request_pdu_t;
typedef struct { typedef struct {
uint16_t sfn; int frame;
uint16_t slot; int slot;
uint8_t number_pdus; int number_pdus;
fapi_nr_ul_config_request_pdu_t ul_config_list[FAPI_NR_UL_CONFIG_LIST_NUM]; fapi_nr_ul_config_request_pdu_t ul_config_list[FAPI_NR_UL_CONFIG_LIST_NUM + 1]; // +1 to have space for iterator ending
pthread_mutex_t mutex_ul_config; pthread_mutex_t mutex_ul_config;
} fapi_nr_ul_config_request_t; } fapi_nr_ul_config_request_t;
typedef struct { typedef struct {
uint16_t rnti; uint16_t rnti;
uint16_t BWPSize; uint16_t BWPSize;
......
...@@ -268,8 +268,6 @@ typedef enum { ...@@ -268,8 +268,6 @@ typedef enum {
#endif #endif
typedef struct { typedef struct {
int nb_search_space; int nb_search_space;
uint16_t sfn;
uint16_t slot;
fapi_nr_dl_config_dci_dl_pdu_rel15_t pdcch_config[FAPI_NR_MAX_SS]; fapi_nr_dl_config_dci_dl_pdu_rel15_t pdcch_config[FAPI_NR_MAX_SS];
} NR_UE_PDCCH_CONFIG; } NR_UE_PDCCH_CONFIG;
...@@ -330,7 +328,7 @@ typedef struct UE_NR_SCAN_INFO_s { ...@@ -330,7 +328,7 @@ typedef struct UE_NR_SCAN_INFO_s {
} UE_NR_SCAN_INFO_t; } UE_NR_SCAN_INFO_t;
/// Top-level PHY Data Structure for UE /// Top-level PHY Data Structure for UE
typedef struct { typedef struct PHY_VARS_NR_UE_s {
/// \brief Module ID indicator for this instance /// \brief Module ID indicator for this instance
uint8_t Mod_id; uint8_t Mod_id;
/// \brief Component carrier ID for this PHY instance /// \brief Component carrier ID for this PHY instance
......
This diff is collapsed.
...@@ -51,6 +51,6 @@ int8_t nr_ue_phy_config_request(nr_phy_config_t *phy_config); ...@@ -51,6 +51,6 @@ int8_t nr_ue_phy_config_request(nr_phy_config_t *phy_config);
\param synch_request including target_Nid_cell*/ \param synch_request including target_Nid_cell*/
void nr_ue_synch_request(nr_synch_request_t *synch_request); void nr_ue_synch_request(nr_synch_request_t *synch_request);
void update_harq_status(module_id_t module_id, uint8_t harq_pid, uint8_t ack_nack); void update_harq_status(NR_UE_MAC_INST_t *mac, uint8_t harq_pid, uint8_t ack_nack);
#endif #endif
...@@ -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);
......
...@@ -874,24 +874,9 @@ int main(int argc, char **argv) ...@@ -874,24 +874,9 @@ int main(int argc, char **argv)
UE_mac->state = UE_CONNECTED; UE_mac->state = UE_CONNECTED;
UE_mac->ra.ra_state = RA_SUCCEEDED; UE_mac->ra.ra_state = RA_SUCCEEDED;
nr_dcireq_t dcireq;
nr_scheduled_response_t scheduled_response;
nr_phy_data_t phy_data = {0}; nr_phy_data_t phy_data = {0};
fapi_nr_dl_config_request_t dl_config = {.sfn = frame, .slot = slot};
memset((void*)&dcireq,0,sizeof(dcireq)); nr_scheduled_response_t scheduled_response = {.dl_config = &dl_config, .phy_data = &phy_data, .mac = UE_mac};
memset((void*)&scheduled_response,0,sizeof(scheduled_response));
dcireq.module_id = 0;
dcireq.gNB_index = 0;
dcireq.cc_id = 0;
scheduled_response.dl_config = &dcireq.dl_config_req;
scheduled_response.ul_config = &dcireq.ul_config_req;
scheduled_response.tx_request = NULL;
scheduled_response.module_id = 0;
scheduled_response.CC_id = 0;
scheduled_response.frame = frame;
scheduled_response.slot = slot;
scheduled_response.phy_data = &phy_data;
nr_ue_phy_config_request(&UE_mac->phy_config); nr_ue_phy_config_request(&UE_mac->phy_config);
//NR_COMMON_channels_t *cc = RC.nrmac[0]->common_channels; //NR_COMMON_channels_t *cc = RC.nrmac[0]->common_channels;
...@@ -976,9 +961,6 @@ int main(int argc, char **argv) ...@@ -976,9 +961,6 @@ int main(int argc, char **argv)
UE_proc.frame_rx = frame; UE_proc.frame_rx = frame;
UE_proc.nr_slot_rx = slot; UE_proc.nr_slot_rx = slot;
UE_proc.gNB_id = 0; UE_proc.gNB_id = 0;
dcireq.frame = frame;
dcireq.slot = slot;
NR_UE_DLSCH_t *dlsch0 = &phy_data.dlsch[0]; NR_UE_DLSCH_t *dlsch0 = &phy_data.dlsch[0];
...@@ -1114,8 +1096,9 @@ int main(int argc, char **argv) ...@@ -1114,8 +1096,9 @@ int main(int argc, char **argv)
// Apply MIMO Channel // Apply MIMO Channel
multipath_channel(gNB2UE, s_re, s_im, r_re, r_im, slot_length, 0, (n_trials == 1) ? 1 : 0); multipath_channel(gNB2UE, s_re, s_im, r_re, r_im, slot_length, 0, (n_trials == 1) ? 1 : 0);
add_noise(UE->common_vars.rxdata, (const double **) r_re, (const double **) r_im, sigma2, slot_length, slot_offset, ts, delay, pdu_bit_map, 0x1, frame_parms->nb_antennas_rx); add_noise(UE->common_vars.rxdata, (const double **) r_re, (const double **) r_im, sigma2, slot_length, slot_offset, ts, delay, pdu_bit_map, 0x1, frame_parms->nb_antennas_rx);
dl_config.sfn = frame;
nr_ue_dcireq(&dcireq); //to be replaced with function pointer later dl_config.slot = slot;
ue_dci_configuration(UE_mac, &dl_config, frame, slot);
nr_ue_scheduled_response(&scheduled_response); nr_ue_scheduled_response(&scheduled_response);
pbch_pdcch_processing(UE, pbch_pdcch_processing(UE,
......
...@@ -718,9 +718,7 @@ int main(int argc, char *argv[]) ...@@ -718,9 +718,7 @@ int main(int argc, char *argv[])
uint32_t errors_decoding = 0; uint32_t errors_decoding = 0;
nr_scheduled_response_t scheduled_response={0}; fapi_nr_ul_config_request_t ul_config = {0};
fapi_nr_ul_config_request_t ul_config={0};
fapi_nr_tx_request_t tx_req={0};
uint8_t ptrs_mcs1 = 2; uint8_t ptrs_mcs1 = 2;
uint8_t ptrs_mcs2 = 4; uint8_t ptrs_mcs2 = 4;
...@@ -1073,24 +1071,7 @@ int main(int argc, char *argv[]) ...@@ -1073,24 +1071,7 @@ int main(int argc, char *argv[])
nr_schedule_response(Sched_INFO); nr_schedule_response(Sched_INFO);
// --------- setting parameters for UE -------- // --------- setting parameters for UE --------
nr_scheduled_response_t scheduled_response = {.ul_config = &ul_config, .phy_data = (void *)&phy_data};
scheduled_response.module_id = 0;
scheduled_response.CC_id = 0;
scheduled_response.frame = frame;
scheduled_response.slot = slot;
scheduled_response.dl_config = NULL;
scheduled_response.ul_config = &ul_config;
scheduled_response.tx_request = &tx_req;
scheduled_response.phy_data = (void *)&phy_data;
// Config UL TX PDU
tx_req.slot = slot;
tx_req.sfn = frame;
tx_req.number_of_pdus = 1; //do_SRS == 1 ? 2 : 1;
tx_req.tx_request_body[0].pdu_length = TBS / 8;
tx_req.tx_request_body[0].pdu_index = 0;
tx_req.tx_request_body[0].pdu = &ulsch_input_buffer[0];
ul_config.slot = slot; ul_config.slot = slot;
ul_config.number_pdus = do_SRS == 1 ? 2 : 1; ul_config.number_pdus = do_SRS == 1 ? 2 : 1;
...@@ -1098,6 +1079,9 @@ int main(int argc, char *argv[]) ...@@ -1098,6 +1079,9 @@ int main(int argc, char *argv[])
fapi_nr_ul_config_request_pdu_t *ul_config0 = &ul_config.ul_config_list[0]; fapi_nr_ul_config_request_pdu_t *ul_config0 = &ul_config.ul_config_list[0];
ul_config0->pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH; ul_config0->pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH;
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu = &ul_config0->pusch_config_pdu; nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu = &ul_config0->pusch_config_pdu;
// Config UL TX PDU
pusch_config_pdu->tx_request_body.pdu = ulsch_input_buffer;
pusch_config_pdu->tx_request_body.pdu_length = TBS / 8;
pusch_config_pdu->rnti = n_rnti; pusch_config_pdu->rnti = n_rnti;
pusch_config_pdu->pdu_bit_map = pdu_bit_map; pusch_config_pdu->pdu_bit_map = pdu_bit_map;
pusch_config_pdu->qam_mod_order = mod_order; pusch_config_pdu->qam_mod_order = mod_order;
......
...@@ -450,7 +450,7 @@ typedef struct { ...@@ -450,7 +450,7 @@ typedef struct {
} NR_BWP_PDCCH_t; } NR_BWP_PDCCH_t;
/*!\brief Top level UE MAC structure */ /*!\brief Top level UE MAC structure */
typedef struct { typedef struct NR_UE_MAC_INST_s {
module_id_t ue_id; module_id_t ue_id;
NR_UE_L2_STATE_t state; NR_UE_L2_STATE_t state;
int servCellIndex; int servCellIndex;
......
...@@ -215,26 +215,6 @@ void release_mac_configuration(NR_UE_MAC_INST_t *mac); ...@@ -215,26 +215,6 @@ void release_mac_configuration(NR_UE_MAC_INST_t *mac);
void nr_ue_ul_scheduler(nr_uplink_indication_t *ul_info); void nr_ue_ul_scheduler(nr_uplink_indication_t *ul_info);
void nr_ue_dl_scheduler(nr_downlink_indication_t *dl_info); void nr_ue_dl_scheduler(nr_downlink_indication_t *dl_info);
/**\brief fill nr_scheduled_response struct instance
@param nr_scheduled_response_t * pointer to scheduled_response instance to fill
@param fapi_nr_dl_config_request_t* pointer to dl_config,
@param fapi_nr_ul_config_request_t* pointer to ul_config,
@param fapi_nr_tx_request_t* pointer to tx_request;
@param module_id_t mod_id module ID
@param int cc_id CC ID
@param frame_t frame frame number
@param int slot reference number
@param void *phy_pata pointer to a PHY specific structure to be filled in the scheduler response (can be null) */
void fill_scheduled_response(nr_scheduled_response_t *scheduled_response,
fapi_nr_dl_config_request_t *dl_config,
fapi_nr_ul_config_request_t *ul_config,
fapi_nr_tx_request_t *tx_request,
module_id_t mod_id,
int cc_id,
frame_t frame,
int slot,
void *phy_data);
/*! \fn int8_t nr_ue_get_SR(module_id_t module_idP, frame_t frameP, slot_t slotP); /*! \fn int8_t nr_ue_get_SR(module_id_t module_idP, frame_t frameP, slot_t slotP);
\brief Called by PHY to get sdu for PUSCH transmission. It performs the following operations: Checks BSR for DCCH, DCCH1 and \brief Called by PHY to get sdu for PUSCH transmission. It performs the following operations: Checks BSR for DCCH, DCCH1 and
DTCH corresponding to previous values computed either in SR or BSR procedures. It gets rlc status indications on DCCH,DCCH1 and DTCH corresponding to previous values computed either in SR or BSR procedures. It gets rlc status indications on DCCH,DCCH1 and
...@@ -402,7 +382,7 @@ int get_deltatf(uint16_t nb_of_prbs, ...@@ -402,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,
...@@ -503,10 +483,13 @@ void build_ssb_to_ro_map(NR_UE_MAC_INST_t *mac); ...@@ -503,10 +483,13 @@ void build_ssb_to_ro_map(NR_UE_MAC_INST_t *mac);
void ue_init_config_request(NR_UE_MAC_INST_t *mac, int scs); void ue_init_config_request(NR_UE_MAC_INST_t *mac, int scs);
fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int slot, int fb_time);
fapi_nr_dl_config_request_t *get_dl_config_request(NR_UE_MAC_INST_t *mac, int slot); fapi_nr_dl_config_request_t *get_dl_config_request(NR_UE_MAC_INST_t *mac, int slot);
void fill_ul_config(fapi_nr_ul_config_request_t *ul_config, frame_t frame_tx, int slot_tx, uint8_t pdu_type); fapi_nr_ul_config_request_pdu_t *lockGet_ul_config(NR_UE_MAC_INST_t *mac, frame_t frame_tx, int slot_tx, uint8_t pdu_type);
void remove_ul_config_last_item(fapi_nr_ul_config_request_pdu_t *pdu);
fapi_nr_ul_config_request_pdu_t *fapiLockIterator(fapi_nr_ul_config_request_t *ul_config, frame_t frame_tx, int slot_tx);
void release_ul_config(fapi_nr_ul_config_request_pdu_t *pdu, bool clearIt);
int16_t compute_nr_SSB_PL(NR_UE_MAC_INST_t *mac, short ssb_rsrp_dBm); int16_t compute_nr_SSB_PL(NR_UE_MAC_INST_t *mac, short ssb_rsrp_dBm);
...@@ -516,7 +499,13 @@ int16_t compute_nr_SSB_PL(NR_UE_MAC_INST_t *mac, short ssb_rsrp_dBm); ...@@ -516,7 +499,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);
......
...@@ -949,19 +949,12 @@ void prepare_msg4_feedback(NR_UE_MAC_INST_t *mac, int pid, int ack_nack) ...@@ -949,19 +949,12 @@ void prepare_msg4_feedback(NR_UE_MAC_INST_t *mac, int pid, int ack_nack)
NR_UE_HARQ_STATUS_t *current_harq = &mac->dl_harq_info[pid]; NR_UE_HARQ_STATUS_t *current_harq = &mac->dl_harq_info[pid];
int sched_slot = current_harq->ul_slot; int sched_slot = current_harq->ul_slot;
int sched_frame = current_harq->ul_frame; int sched_frame = current_harq->ul_frame;
fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, sched_slot, 0);
pthread_mutex_lock(&ul_config->mutex_ul_config);
mac->nr_ue_emul_l1.num_harqs = 1; mac->nr_ue_emul_l1.num_harqs = 1;
AssertFatal(ul_config->number_pdus < FAPI_NR_UL_CONFIG_LIST_NUM, PUCCH_sched_t pucch = {.n_CCE = current_harq->n_CCE,
"ul_config->number_pdus %d out of bounds\n", .N_CCE = current_harq->N_CCE,
ul_config->number_pdus); .delta_pucch = current_harq->delta_pucch,
fapi_nr_ul_config_pucch_pdu *pucch_pdu = &ul_config->ul_config_list[ul_config->number_pdus].pucch_config_pdu; .ack_payload = ack_nack,
PUCCH_sched_t pucch = {0}; .n_harq = 1};
pucch.n_CCE = current_harq->n_CCE;
pucch.N_CCE = current_harq->N_CCE;
pucch.delta_pucch = current_harq->delta_pucch;
pucch.ack_payload = ack_nack;
pucch.n_harq = 1;
current_harq->active = false; current_harq->active = false;
current_harq->ack_received = false; current_harq->ack_received = false;
if (get_softmodem_params()->emulate_l1) { if (get_softmodem_params()->emulate_l1) {
...@@ -969,11 +962,11 @@ void prepare_msg4_feedback(NR_UE_MAC_INST_t *mac, int pid, int ack_nack) ...@@ -969,11 +962,11 @@ void prepare_msg4_feedback(NR_UE_MAC_INST_t *mac, int pid, int ack_nack)
mac->nr_ue_emul_l1.harq[pid].active_dl_harq_sfn = sched_frame; mac->nr_ue_emul_l1.harq[pid].active_dl_harq_sfn = sched_frame;
mac->nr_ue_emul_l1.harq[pid].active_dl_harq_slot = sched_slot; mac->nr_ue_emul_l1.harq[pid].active_dl_harq_slot = sched_slot;
} }
nr_ue_configure_pucch(mac, fapi_nr_ul_config_request_pdu_t *pdu = lockGet_ul_config(mac, sched_frame, sched_slot, FAPI_NR_UL_CONFIG_TYPE_PUCCH);
sched_slot, if (!pdu)
mac->ra.t_crnti, return;
&pucch, int ret = nr_ue_configure_pucch(mac, sched_slot, mac->ra.t_crnti, &pucch, &pdu->pucch_config_pdu);
pucch_pdu); if (ret != 0)
fill_ul_config(ul_config, sched_frame, sched_slot, FAPI_NR_UL_CONFIG_TYPE_PUCCH); remove_ul_config_last_item(pdu);
pthread_mutex_unlock(&ul_config->mutex_ul_config); release_ul_config(pdu, false);
} }
This diff is collapsed.
This diff is collapsed.
...@@ -58,22 +58,6 @@ typedef struct { ...@@ -58,22 +58,6 @@ typedef struct {
/// slot /// slot
int slot; int slot;
fapi_nr_dl_config_request_t dl_config_req;
fapi_nr_ul_config_request_t ul_config_req;
} nr_dcireq_t;
typedef struct {
/// module id
module_id_t module_id;
/// gNB index
uint32_t gNB_index;
/// component carrier id
int cc_id;
/// frame
frame_t frame;
/// slot
int slot;
/// NR UE FAPI-like P7 message, direction: L1 to L2 /// NR UE FAPI-like P7 message, direction: L1 to L2
/// data reception indication structure /// data reception indication structure
fapi_nr_rx_indication_t *rx_ind; fapi_nr_rx_indication_t *rx_ind;
...@@ -95,14 +79,10 @@ typedef struct { ...@@ -95,14 +79,10 @@ typedef struct {
uint32_t gNB_index; uint32_t gNB_index;
/// component carrier id /// component carrier id
int cc_id; int cc_id;
/// frame
frame_t frame_rx;
/// slot rx
uint32_t slot_rx;
/// frame tx /// frame tx
frame_t frame_tx; frame_t frame;
/// slot tx /// slot tx
uint32_t slot_tx; uint32_t slot;
/// dci reception indication structure /// dci reception indication structure
fapi_nr_dci_indication_t *dci_ind; fapi_nr_dci_indication_t *dci_ind;
...@@ -142,17 +122,13 @@ typedef struct { ...@@ -142,17 +122,13 @@ typedef struct {
// Downlink subframe P7 // Downlink subframe P7
struct PHY_VARS_NR_UE_s;
struct NR_UE_MAC_INST_s;
typedef struct { typedef struct {
/// module id /// module id
module_id_t module_id; module_id_t module_id;
/// component carrier id /// component carrier id
int CC_id; int CC_id;
/// frame
frame_t frame;
/// slot
int slot;
/// NR UE FAPI-like P7 message, direction: L2 to L1 /// NR UE FAPI-like P7 message, direction: L2 to L1
/// downlink transmission configuration request structure /// downlink transmission configuration request structure
fapi_nr_dl_config_request_t *dl_config; fapi_nr_dl_config_request_t *dl_config;
...@@ -166,12 +142,10 @@ typedef struct { ...@@ -166,12 +142,10 @@ typedef struct {
// Sidelink TX configuration request // Sidelink TX configuration request
sl_nr_tx_config_request_t *sl_tx_config; sl_nr_tx_config_request_t *sl_tx_config;
/// data transmission request structure
fapi_nr_tx_request_t *tx_request;
/// PHY data structure initially passed on to L2 via the nr_downlink_indication_t and /// PHY data structure initially passed on to L2 via the nr_downlink_indication_t and
/// returned to L1 via nr_scheduled_response_t /// returned to L1 via nr_scheduled_response_t
void *phy_data; void *phy_data;
struct NR_UE_MAC_INST_s *mac;
} nr_scheduled_response_t; } nr_scheduled_response_t;
typedef struct { typedef struct {
...@@ -322,46 +296,11 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request, ...@@ -322,46 +296,11 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request,
bool sfn_slot_matcher(void *wanted, void *candidate); bool sfn_slot_matcher(void *wanted, void *candidate);
/**\brief done free of memory allocation by module_id and release to pointer pool.
\param module_id module id*/
int nr_ue_if_module_kill(uint32_t module_id);
/**\brief interface between L1/L2, indicating the downlink related information, like dci_ind and rx_req /**\brief interface between L1/L2, indicating the downlink related information, like dci_ind and rx_req
\param dl_info including dci_ind and rx_request messages*/ \param dl_info including dci_ind and rx_request messages*/
int nr_ue_dl_indication(nr_downlink_indication_t *dl_info); int nr_ue_dl_indication(nr_downlink_indication_t *dl_info);
int nr_ue_ul_indication(nr_uplink_indication_t *ul_info); int nr_ue_ul_indication(nr_uplink_indication_t *ul_info);
int nr_ue_dcireq(nr_dcireq_t *dcireq);
// TODO check
/**\brief handle BCCH-BCH message from dl_indication
\param phy_data PHY structure to be filled in by the callee in the FAPI call (L1 caller -> indication to L2 -> FAPI call to L1 callee)
\param pduP pointer to bch pdu
\param additional_bits corresponding to 38.212 ch.7
\param ssb_index SSB index within 0 - (L_ssb-1) corresponding to 38.331 ch.13 parameter i
\param ssb_length corresponding to L1 parameter L_ssb
\param cell_id cell id */
int handle_bcch_bch(module_id_t module_id,
int cc_id,
unsigned int gNB_index,
void *phy_data,
uint8_t *pduP,
unsigned int additional_bits,
uint32_t ssb_index,
uint32_t ssb_length,
uint16_t ssb_start_subcarrier,
uint16_t cell_id);
// TODO check
/**\brief handle BCCH-DL-SCH message from dl_indication
\param pdu_len length(bytes) of pdu
\param pduP pointer to pdu*/
int handle_bcch_dlsch(module_id_t module_id, int cc_id, unsigned int gNB_index, uint8_t ack_nack, uint8_t *pduP, uint32_t pdu_len);
int handle_dci(module_id_t module_id, int cc_id, unsigned int gNB_index, frame_t frame, int slot, fapi_nr_dci_indication_pdu_t *dci);
#endif #endif
...@@ -72,8 +72,7 @@ typedef struct { ...@@ -72,8 +72,7 @@ typedef struct {
extern nr_bler_struct nr_bler_data[NR_NUM_MCS]; extern nr_bler_struct nr_bler_data[NR_NUM_MCS];
extern nr_bler_struct nr_mimo_bler_data[NR_NUM_MCS]; extern nr_bler_struct nr_mimo_bler_data[NR_NUM_MCS];
void read_channel_param(const nfapi_nr_dl_tti_pdsch_pdu_rel15_t * pdu, int sf, int index); void read_channel_param(const nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdu, int sf, int index);
void save_pdsch_pdu_for_crnti(nfapi_nr_dl_tti_request_t *dl_tti_request);
float get_bler_val(uint8_t mcs, int sinr); float get_bler_val(uint8_t mcs, int sinr);
bool should_drop_transport_block(int slot, uint16_t rnti); bool should_drop_transport_block(int slot, uint16_t rnti);
bool is_channel_modeling(void); bool is_channel_modeling(void);
......
...@@ -566,7 +566,7 @@ static int nr_decode_SI(NR_UE_RRC_SI_INFO *SI_info, NR_SystemInformation_t *si) ...@@ -566,7 +566,7 @@ static int nr_decode_SI(NR_UE_RRC_SI_INFO *SI_info, NR_SystemInformation_t *si)
return 0; return 0;
} }
void nr_rrc_ue_generate_ra_msg(NR_UE_RRC_INST_t *rrc, RA_trigger_t trigger, int rnti) static void nr_rrc_ue_generate_ra_msg(NR_UE_RRC_INST_t *rrc, RA_trigger_t trigger, rnti_t rnti)
{ {
switch (trigger) { switch (trigger) {
case INITIAL_ACCESS_FROM_RRC_IDLE: case INITIAL_ACCESS_FROM_RRC_IDLE:
......
...@@ -48,7 +48,6 @@ ...@@ -48,7 +48,6 @@
#include "intertask_interface.h" #include "intertask_interface.h"
#include "openair2/RRC/NAS/nas_config.h" #include "openair2/RRC/NAS/nas_config.h"
#include <openair3/NAS/COMMON/NR_NAS_defs.h> #include <openair3/NAS/COMMON/NR_NAS_defs.h>
#include <openair1/PHY/phy_extern_nr_ue.h>
#include <openair1/SIMULATION/ETH_TRANSPORT/proto.h> #include <openair1/SIMULATION/ETH_TRANSPORT/proto.h>
#include "openair2/SDAP/nr_sdap/nr_sdap.h" #include "openair2/SDAP/nr_sdap/nr_sdap.h"
#include "openair3/SECU/nas_stream_eia2.h" #include "openair3/SECU/nas_stream_eia2.h"
......
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