Commit 6cbeab62 authored by Laurent THOMAS's avatar Laurent THOMAS Committed by Robert Schmidt

Remove function nr_fill_dl_indication()

Instead of this somewhat opaque function, fill the struct in place to
make it clearer what gets filled. This should make the code clearer in
general.
Co-authored-by: default avatarRobert Schmidt <robert.schmidt@openairinterface.org>
Signed-off-by: default avatarLaurent THOMAS <laurent.thomas@open-cells.com>
Signed-off-by: default avatarRobert Schmidt <robert.schmidt@openairinterface.org>
parent 31ffb21a
......@@ -547,8 +547,15 @@ static int UE_dl_preprocessing(PHY_VARS_NR_UE *UE,
if (proc->rx_slot_type == NR_DOWNLINK_SLOT || proc->rx_slot_type == NR_MIXED_SLOT) {
dl_slot = true;
if(UE->if_inst != NULL && UE->if_inst->dl_indication != NULL) {
nr_downlink_indication_t dl_indication;
nr_fill_dl_indication(&dl_indication, NULL, NULL, proc, UE, phy_data);
nr_downlink_indication_t dl_indication = (nr_downlink_indication_t){
.gNB_index = proc->gNB_id,
.module_id = UE->Mod_id,
.cc_id = UE->CC_id,
.hfn = proc->hfn_rx,
.frame = proc->frame_rx,
.slot = proc->nr_slot_rx,
.phy_data = phy_data,
};
UE->if_inst->dl_indication(&dl_indication);
}
......
......@@ -162,10 +162,15 @@ static void send_ssb_rsrp_meas(PHY_VARS_NR_UE *ue,
.sinr_dB = sinr_dB,
};
nr_downlink_indication_t dl_indication = {0};
fapi_nr_rx_indication_t rx_ind = {0};
nr_fill_dl_indication(&dl_indication, NULL, &rx_ind, proc, ue, NULL);
nr_fill_rx_indication(&rx_ind, FAPI_NR_MEAS_IND, ue, 0, 0, NULL, 1, proc, &l1_measurements, NULL);
nr_downlink_indication_t dl_indication = (nr_downlink_indication_t){.gNB_index = proc->gNB_id,
.module_id = ue->Mod_id,
.cc_id = ue->CC_id,
.hfn = proc->hfn_rx,
.frame = proc->frame_rx,
.slot = proc->nr_slot_rx,
.rx_ind = &rx_ind};
nr_fill_rx_indication(&rx_ind, FAPI_NR_MEAS_IND, ue, 0, 0, NULL, proc, &l1_measurements);
ue->if_inst->dl_indication(&dl_indication);
}
......
......@@ -1039,20 +1039,27 @@ void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue,
return;
fapi_nr_l1_measurements_t l1_measurements = {
.gNB_index = proc->gNB_id,
.meas_type = NFAPI_NR_CSI_MEAS,
.Nid_cell = frame_parms->Nid_cell,
.is_neighboring_cell = false,
.rsrp_dBm = rsrp_dBm,
.rank_indicator = rank_indicator,
.i1 = *i1,
.i2 = *i2,
.cqi = cqi,
.radiolink_monitoring = RLM_no_monitoring, // TODO do be activated in case of RLM based on CSI-RS
.gNB_index = proc->gNB_id,
.meas_type = NFAPI_NR_CSI_MEAS,
.Nid_cell = frame_parms->Nid_cell,
.is_neighboring_cell = false,
.rsrp_dBm = rsrp_dBm,
.rank_indicator = rank_indicator,
.i1 = *i1,
.i2 = *i2,
.cqi = cqi,
.radiolink_monitoring = RLM_no_monitoring, // TODO do be activated in case of RLM based on CSI-RS
};
nr_downlink_indication_t dl_indication;
fapi_nr_rx_indication_t rx_ind = {0};
nr_fill_dl_indication(&dl_indication, NULL, &rx_ind, proc, ue, NULL);
nr_fill_rx_indication(&rx_ind, FAPI_NR_MEAS_IND, ue, 0, 0, NULL, 1, proc, (void *)&l1_measurements, NULL);
nr_fill_rx_indication(&rx_ind, FAPI_NR_MEAS_IND, ue, 0, 0, NULL, proc, (void *)&l1_measurements);
nr_downlink_indication_t dl_indication = (nr_downlink_indication_t){
.gNB_index = proc->gNB_id,
.module_id = ue->Mod_id,
.cc_id = ue->CC_id,
.hfn = proc->hfn_rx,
.frame = proc->frame_rx,
.slot = proc->nr_slot_rx,
.rx_ind = &rx_ind,
};
ue->if_inst->dl_indication(&dl_indication);
}
......@@ -589,7 +589,6 @@ void nr_pdcch_dci_indication(const UE_nr_rxtx_proc_t *proc,
{
NR_UE_PDCCH_CONFIG *phy_pdcch_config = &phy_data->phy_pdcch_config;
nr_downlink_indication_t dl_indication;
fapi_nr_dci_indication_t dci_ind = {.SFN = proc->frame_rx, .slot = proc->nr_slot_rx};
for (int ss_idx = 0; ss_idx < phy_pdcch_config->nb_search_space; ss_idx++) {
......@@ -632,7 +631,14 @@ void nr_pdcch_dci_indication(const UE_nr_rxtx_proc_t *proc,
}
/* Send to MAC */
nr_fill_dl_indication(&dl_indication, &dci_ind, NULL, proc, ue, phy_data);
nr_downlink_indication_t dl_indication = (nr_downlink_indication_t){.gNB_index = proc->gNB_id,
.module_id = ue->Mod_id,
.cc_id = ue->CC_id,
.hfn = proc->hfn_rx,
.frame = proc->frame_rx,
.slot = proc->nr_slot_rx,
.phy_data = phy_data,
.dci_ind = &dci_ind};
ue->if_inst->dl_indication(&dl_indication);
phy_pdcch_config->nb_search_space = 0;
}
......@@ -452,23 +452,20 @@ nr_initial_sync_t nr_initial_sync(UE_nr_rxtx_proc_t *proc,
}
// In initial sync, we indicate PBCH to MAC after the scan is complete.
nr_downlink_indication_t dl_indication;
fapi_nr_rx_indication_t rx_ind = {0};
uint16_t number_pdus = 1;
nr_fill_dl_indication(&dl_indication, NULL, &rx_ind, proc, ue, NULL);
nr_fill_rx_indication(&rx_ind,
FAPI_NR_RX_PDU_TYPE_SSB,
ue,
0,
0,
NULL,
number_pdus,
proc,
res ? (void *)&res->pbchResult : NULL,
NULL);
if (ue->if_inst && ue->if_inst->dl_indication)
if (ue->if_inst && ue->if_inst->dl_indication) {
fapi_nr_rx_indication_t rx_ind = {0};
nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_SSB, ue, 0, 0, NULL, proc, res ? (void *)&res->pbchResult : NULL);
nr_downlink_indication_t dl_indication = (nr_downlink_indication_t){
.gNB_index = proc->gNB_id,
.module_id = ue->Mod_id,
.cc_id = ue->CC_id,
.hfn = proc->hfn_rx,
.frame = proc->frame_rx,
.slot = proc->nr_slot_rx,
.rx_ind = &rx_ind,
};
ue->if_inst->dl_indication(&dl_indication);
}
LOG_D(PHY, "nr_initial sync ue RB_DL %d\n", fp->N_RB_DL);
......
......@@ -398,16 +398,18 @@ int nr_pbch_decode(PHY_VARS_NR_UE *ue,
NR_POLAR_PBCH_AGGREGATION_LEVEL);
pbch_a_prime = tmp;
nr_downlink_indication_t dl_indication;
fapi_nr_rx_indication_t rx_ind = {0};
uint16_t number_pdus = 1;
if (decoderState) {
if (ue) { // decoding failed in synced state
nr_fill_dl_indication(&dl_indication, NULL, &rx_ind, proc, ue, NULL);
nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_SSB, ue, 0, 0, NULL, number_pdus, proc, NULL, NULL);
if (ue->if_inst && ue->if_inst->dl_indication)
ue->if_inst->dl_indication(&dl_indication);
if (ue && ue->if_inst && ue->if_inst->dl_indication) { // decoding failed in synced state
fapi_nr_rx_indication_t rx_ind = {0};
nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_SSB, ue, 0, 0, NULL, proc, NULL);
nr_downlink_indication_t dl_indication = (nr_downlink_indication_t){.gNB_index = proc->gNB_id,
.module_id = ue->Mod_id,
.cc_id = ue->CC_id,
.hfn = proc->hfn_rx,
.frame = proc->frame_rx,
.slot = proc->nr_slot_rx,
.rx_ind = &rx_ind};
ue->if_inst->dl_indication(&dl_indication);
}
return(decoderState);
}
......@@ -463,12 +465,19 @@ int nr_pbch_decode(PHY_VARS_NR_UE *ue,
#endif
if (ue) {
nr_fill_dl_indication(&dl_indication, NULL, &rx_ind, proc, ue, NULL);
nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_SSB, ue, 0, 0, NULL, number_pdus, proc, (void *)result, NULL);
if (ue->if_inst && ue->if_inst->dl_indication)
ue->if_inst->dl_indication(&dl_indication);
if (ue && ue->if_inst && ue->if_inst->dl_indication) {
fapi_nr_rx_indication_t rx_ind = {0};
nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_SSB, ue, 0, 0, NULL, proc, (void *)result);
nr_downlink_indication_t dl_indication = (nr_downlink_indication_t){
.gNB_index = proc->gNB_id,
.module_id = ue->Mod_id,
.cc_id = ue->CC_id,
.hfn = proc->hfn_rx,
.frame = proc->frame_rx,
.slot = proc->nr_slot_rx,
.rx_ind = &rx_ind,
};
ue->if_inst->dl_indication(&dl_indication);
}
TracyCZoneEnd(ctx);
......
......@@ -86,15 +86,6 @@ int is_pbch_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL
int is_ssb_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL_FRAME_PARMS *fp);
bool is_csi_rs_in_symbol(fapi_nr_dl_config_csirs_pdu_rel15_t csirs_config_pdu, int symbol);
/*! \brief This function prepares the dl indication to pass to the MAC
*/
void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind,
fapi_nr_dci_indication_t *dci_ind,
fapi_nr_rx_indication_t *rx_ind,
const UE_nr_rxtx_proc_t *proc,
PHY_VARS_NR_UE *ue,
void *phy_data);
/*@}*/
/*! \brief This function prepares the dl rx indication
......@@ -105,10 +96,8 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
int cw_idx,
int harq_pid,
NR_UE_DLSCH_t *dlsch,
uint16_t n_pdus,
const UE_nr_rxtx_proc_t *proc,
void *typeSpecific,
uint8_t *b);
void *typeSpecific);
void nr_pdcch_generate_llr(PHY_VARS_NR_UE *ue,
const UE_nr_rxtx_proc_t *proc,
......
......@@ -50,36 +50,6 @@ static const unsigned int gain_table[31] = {100, 112, 126, 141, 158, 178,
static void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, c16_t **txData);
void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind,
fapi_nr_dci_indication_t *dci_ind,
fapi_nr_rx_indication_t *rx_ind,
const UE_nr_rxtx_proc_t *proc,
PHY_VARS_NR_UE *ue,
void *phy_data)
{
memset((void*)dl_ind, 0, sizeof(nr_downlink_indication_t));
dl_ind->gNB_index = proc->gNB_id;
dl_ind->module_id = ue->Mod_id;
dl_ind->cc_id = ue->CC_id;
dl_ind->hfn = proc->hfn_rx;
dl_ind->frame = proc->frame_rx;
dl_ind->slot = proc->nr_slot_rx;
dl_ind->phy_data = phy_data;
if (dci_ind) {
dl_ind->rx_ind = NULL; //no data, only dci for now
dl_ind->dci_ind = dci_ind;
} else if (rx_ind) {
dl_ind->rx_ind = rx_ind; // hang on rx_ind instance
dl_ind->dci_ind = NULL;
}
}
static uint32_t get_ssb_arfcn(NR_DL_FRAME_PARMS *frame_parms)
{
uint32_t band_size_hz = frame_parms->N_RB_DL * 12 * frame_parms->subcarrier_spacing;
......@@ -94,16 +64,13 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
int cw_idx,
int harq_pid,
NR_UE_DLSCH_t *dlsch,
uint16_t n_pdus,
const UE_nr_rxtx_proc_t *proc,
void *typeSpecific,
uint8_t *b)
void *typeSpecific)
{
if (n_pdus > 1) {
LOG_E(PHY, "Multiple number of DL PDUs not supported yet...\n");
return;
}
fapi_nr_rx_indication_body_t *rx = rx_ind->rx_indication_body + n_pdus - 1;
AssertFatal(rx_ind->number_pdus < NFAPI_RX_IND_MAX_PDU - 1, "Exceeded rx_ind array size\n");
fapi_nr_rx_indication_body_t *rx = rx_ind->rx_indication_body + rx_ind->number_pdus;
rx_ind->number_pdus++;
rx->pdu_type = pdu_type;
switch (pdu_type){
case FAPI_NR_RX_PDU_TYPE_SIB:
case FAPI_NR_RX_PDU_TYPE_RAR:
......@@ -114,7 +81,7 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
rx->pdsch_pdu.harq_pid = harq_pid;
rx->pdsch_pdu.cw_idx = cw_idx;
rx->pdsch_pdu.ack_nack = dl_harq->decodeResult;
rx->pdsch_pdu.pdu = b;
rx->pdsch_pdu.pdu = (uint8_t *)typeSpecific;
rx->pdsch_pdu.pdu_length = dlsch->cw_info.TBS / 8;
if (dl_harq->decodeResult) {
int t = WS_C_RNTI;
......@@ -127,7 +94,7 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
ws_trace_t tmp = {.nr = true,
.direction = DIRECTION_DOWNLINK,
.type = ue->frame_parms.frame_type == FDD ? FDD_RADIO : TDD_RADIO,
.pdu_buffer = b,
.pdu_buffer = rx->pdsch_pdu.pdu,
.pdu_buffer_size = rx->pdsch_pdu.pdu_length,
.ueid = 0,
.rntiType = t,
......@@ -163,9 +130,6 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
default:
break;
}
rx->pdu_type = pdu_type;
rx_ind->number_pdus = n_pdus;
}
int get_tx_amp_prach(int power_dBm, int power_max_dBm, int N_RB_UL){
......@@ -703,9 +667,6 @@ static void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
int harq_pid = config->harq_process_nbr;
int frame_rx = proc->frame_rx;
int nr_slot_rx = proc->nr_slot_rx;
nr_downlink_indication_t dl_indication;
fapi_nr_rx_indication_t rx_ind = {0};
uint16_t number_pdus = 1;
LOG_D(PHY, "AbsSubframe %d.%d Start LDPC Decoder for CW%d [harq_pid %d]\n", frame_rx % 1024, nr_slot_rx, cw_idx, harq_pid);
......@@ -749,9 +710,6 @@ static void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
break;
}
nr_fill_dl_indication(&dl_indication, NULL, &rx_ind, proc, ue, NULL);
nr_fill_rx_indication(&rx_ind, ind_type, ue, cw_idx, harq_pid, dlsch, number_pdus, proc, NULL, dl_harq->b);
LOG_D(PHY, "DL PDU length in bits: %d, in bytes: %d \n", dlsch->cw_info.TBS, dlsch->cw_info.TBS / 8);
if (cpumeas(CPUMEAS_GETSTATE)) {
LOG_D(PHY,
......@@ -766,6 +724,17 @@ static void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
// send to mac
if (ue->if_inst && ue->if_inst->dl_indication) {
fapi_nr_rx_indication_t rx_ind = {0};
nr_fill_rx_indication(&rx_ind, ind_type, ue, cw_idx, harq_pid, dlsch, proc, dl_harq->b);
nr_downlink_indication_t dl_indication = (nr_downlink_indication_t){
.gNB_index = proc->gNB_id,
.module_id = ue->Mod_id,
.cc_id = ue->CC_id,
.hfn = proc->hfn_rx,
.frame = proc->frame_rx,
.slot = proc->nr_slot_rx,
.rx_ind = &rx_ind,
};
ue->if_inst->dl_indication(&dl_indication);
}
......
......@@ -72,24 +72,14 @@ void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {}
NR_IF_Module_t *NR_IF_Module_init(int Mod_id) { return (NULL); }
nfapi_mode_t nfapi_getmode(void) { return NFAPI_MODE_UNKNOWN; }
void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind,
fapi_nr_dci_indication_t *dci_ind,
fapi_nr_rx_indication_t *rx_ind,
const UE_nr_rxtx_proc_t *proc,
PHY_VARS_NR_UE *ue,
void *phy_data)
{
}
void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
uint8_t pdu_type,
PHY_VARS_NR_UE *ue,
int cw_idx,
int harq_pid,
NR_UE_DLSCH_t *dlsch,
uint16_t n_pdus,
const UE_nr_rxtx_proc_t *proc,
void *typeSpecific,
uint8_t *b)
void *typeSpecific)
{
}
......
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