Commit 03b37ae1 authored by francescomani's avatar francescomani

improvements in FAPI interface for measurements

parent 0f54eb8f
...@@ -61,12 +61,16 @@ typedef enum { ...@@ -61,12 +61,16 @@ typedef enum {
NFAPI_NR_FORMAT_0_1_AND_1_1, NFAPI_NR_FORMAT_0_1_AND_1_1,
} nfapi_nr_dci_formats_e; } nfapi_nr_dci_formats_e;
typedef enum {
NFAPI_NR_CSI_MEAS,
NFAPI_NR_SS_MEAS
} nfapi_nr_meas_type_e;
typedef struct { typedef struct {
uint32_t gNB_index; uint32_t gNB_index;
uint16_t Nid_cell; uint16_t Nid_cell;
uint8_t meas_type; // (0) SS, (1) CSI nfapi_nr_meas_type_e meas_type;
uint8_t is_neighboring_cell; // (0) false, (1) true bool is_neighboring_cell;
uint8_t rsrp_dBm; uint8_t rsrp_dBm;
uint8_t rank_indicator; uint8_t rank_indicator;
uint8_t i1; uint8_t i1;
......
...@@ -237,9 +237,9 @@ void nr_ue_ssb_rsrp_measurements(PHY_VARS_NR_UE *ue, ...@@ -237,9 +237,9 @@ void nr_ue_ssb_rsrp_measurements(PHY_VARS_NR_UE *ue,
// Send SS measurements to MAC // Send SS measurements to MAC
fapi_nr_l1_measurements_t l1_measurements; fapi_nr_l1_measurements_t l1_measurements;
l1_measurements.gNB_index = proc->gNB_id; l1_measurements.gNB_index = proc->gNB_id;
l1_measurements.meas_type = 0; l1_measurements.meas_type = NFAPI_NR_SS_MEAS;
l1_measurements.Nid_cell = ue->frame_parms.Nid_cell; l1_measurements.Nid_cell = ue->frame_parms.Nid_cell;
l1_measurements.is_neighboring_cell = 0; l1_measurements.is_neighboring_cell = false;
if (ue->measurements.ssb_rsrp_dBm[ssb_index] < -140) { if (ue->measurements.ssb_rsrp_dBm[ssb_index] < -140) {
l1_measurements.rsrp_dBm = 16; l1_measurements.rsrp_dBm = 16;
} else if (ue->measurements.ssb_rsrp_dBm[ssb_index] > -44) { } else if (ue->measurements.ssb_rsrp_dBm[ssb_index] > -44) {
...@@ -424,9 +424,9 @@ void *nr_ue_meas_neighboring_cell(void *param) ...@@ -424,9 +424,9 @@ void *nr_ue_meas_neighboring_cell(void *param)
// Send SS measurements to MAC // Send SS measurements to MAC
fapi_nr_l1_measurements_t l1_measurements; fapi_nr_l1_measurements_t l1_measurements;
l1_measurements.gNB_index = proc->gNB_id; l1_measurements.gNB_index = proc->gNB_id;
l1_measurements.meas_type = 0; l1_measurements.meas_type = NFAPI_NR_SS_MEAS;
l1_measurements.Nid_cell = nr_neighboring_cell->Nid_cell; l1_measurements.Nid_cell = nr_neighboring_cell->Nid_cell;
l1_measurements.is_neighboring_cell = 1; l1_measurements.is_neighboring_cell = true;
if (neighboring_cell_info->ssb_rsrp_dBm < -140) { if (neighboring_cell_info->ssb_rsrp_dBm < -140) {
l1_measurements.rsrp_dBm = 16; l1_measurements.rsrp_dBm = 16;
} else if (neighboring_cell_info->ssb_rsrp_dBm > -44) { } else if (neighboring_cell_info->ssb_rsrp_dBm > -44) {
......
...@@ -1024,9 +1024,9 @@ void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue, ...@@ -1024,9 +1024,9 @@ void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue,
// Send CSI measurements to MAC // Send CSI measurements to MAC
fapi_nr_l1_measurements_t l1_measurements; fapi_nr_l1_measurements_t l1_measurements;
l1_measurements.gNB_index = gNB_id; l1_measurements.gNB_index = gNB_id;
l1_measurements.meas_type = 1; l1_measurements.meas_type = NFAPI_NR_CSI_MEAS;
l1_measurements.Nid_cell = frame_parms->Nid_cell; l1_measurements.Nid_cell = frame_parms->Nid_cell;
l1_measurements.is_neighboring_cell = 0; l1_measurements.is_neighboring_cell = false;
if (rsrp_dBm < -140) { if (rsrp_dBm < -140) {
l1_measurements.rsrp_dBm = 16; l1_measurements.rsrp_dBm = 16;
} else if (rsrp_dBm > -44) { } else if (rsrp_dBm > -44) {
......
...@@ -140,8 +140,8 @@ typedef struct NRRrcMacMeasDataInd_s { ...@@ -140,8 +140,8 @@ typedef struct NRRrcMacMeasDataInd_s {
uint8_t gnb_index; uint8_t gnb_index;
uint8_t rsrp_dBm; uint8_t rsrp_dBm;
uint16_t Nid_cell; uint16_t Nid_cell;
uint8_t meas_type; // (0) SS, (1) CSI bool is_csi_meas;
uint8_t is_neighboring_cell; // (0) false, (1) true bool is_neighboring_cell;
} NRRrcMacMeasDataInd; } NRRrcMacMeasDataInd;
typedef struct RrcMacBcchMbmsDataReq_s { typedef struct RrcMacBcchMbmsDataReq_s {
......
...@@ -1278,10 +1278,11 @@ int8_t nr_ue_process_l1_measurements(NR_UE_MAC_INST_t *mac, frame_t frame, int s ...@@ -1278,10 +1278,11 @@ int8_t nr_ue_process_l1_measurements(NR_UE_MAC_INST_t *mac, frame_t frame, int s
{ {
LOG_D(NR_MAC, "(%d.%d) Received CSI-RS measurements\n", frame, slot); LOG_D(NR_MAC, "(%d.%d) Received CSI-RS measurements\n", frame, slot);
memcpy(&mac->l1_measurements, l1_measurements, sizeof(*l1_measurements)); memcpy(&mac->l1_measurements, l1_measurements, sizeof(*l1_measurements));
bool csi_meas = l1_measurements->meas_type == NFAPI_NR_CSI_MEAS;
nr_mac_rrc_meas_ind_ue(mac->ue_id, nr_mac_rrc_meas_ind_ue(mac->ue_id,
l1_measurements->gNB_index, l1_measurements->gNB_index,
l1_measurements->Nid_cell, l1_measurements->Nid_cell,
l1_measurements->meas_type, csi_meas,
l1_measurements->is_neighboring_cell, l1_measurements->is_neighboring_cell,
l1_measurements->rsrp_dBm); l1_measurements->rsrp_dBm);
return 0; return 0;
......
...@@ -38,12 +38,12 @@ ...@@ -38,12 +38,12 @@
typedef uint32_t channel_t; typedef uint32_t channel_t;
int8_t nr_mac_rrc_meas_ind_ue(module_id_t module_id, uint32_t gNB_index, uint16_t Nid_cell, uint8_t meas_type, uint8_t is_neighboring_cell, uint8_t rsrp_dBm) int8_t nr_mac_rrc_meas_ind_ue(module_id_t module_id, uint32_t gNB_index, uint16_t Nid_cell, bool csi_meas, bool is_neighboring_cell, uint8_t rsrp_dBm)
{ {
MessageDef *message_p = itti_alloc_new_message(TASK_MAC_UE, 0, NR_RRC_MAC_MEAS_DATA_IND); MessageDef *message_p = itti_alloc_new_message(TASK_MAC_UE, 0, NR_RRC_MAC_MEAS_DATA_IND);
NR_RRC_MAC_MEAS_DATA_IND(message_p).gnb_index = gNB_index; NR_RRC_MAC_MEAS_DATA_IND(message_p).gnb_index = gNB_index;
NR_RRC_MAC_MEAS_DATA_IND(message_p).Nid_cell = Nid_cell; NR_RRC_MAC_MEAS_DATA_IND(message_p).Nid_cell = Nid_cell;
NR_RRC_MAC_MEAS_DATA_IND(message_p).meas_type = meas_type; NR_RRC_MAC_MEAS_DATA_IND(message_p).is_csi_meas = csi_meas;
NR_RRC_MAC_MEAS_DATA_IND(message_p).is_neighboring_cell = is_neighboring_cell; NR_RRC_MAC_MEAS_DATA_IND(message_p).is_neighboring_cell = is_neighboring_cell;
NR_RRC_MAC_MEAS_DATA_IND(message_p).rsrp_dBm = rsrp_dBm; NR_RRC_MAC_MEAS_DATA_IND(message_p).rsrp_dBm = rsrp_dBm;
itti_send_msg_to_task(TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE(module_id), message_p); itti_send_msg_to_task(TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE(module_id), message_p);
......
...@@ -1701,21 +1701,21 @@ static int nr_rrc_ue_decode_dcch(NR_UE_RRC_INST_t *rrc, ...@@ -1701,21 +1701,21 @@ static int nr_rrc_ue_decode_dcch(NR_UE_RRC_INST_t *rrc,
return 0; return 0;
} }
void nr_ue_meas_filtering(NR_UE_RRC_INST_t *rrc, uint8_t is_neighboring_cell, uint16_t Nid_cell, uint8_t meas_type, int rsrp_dBm) void nr_ue_meas_filtering(NR_UE_RRC_INST_t *rrc, bool is_neighboring_cell, uint16_t Nid_cell, bool csi_meas, int rsrp_dBm)
{ {
l3_measurements_t *l3_measurements = &rrc->l3_measurements; l3_measurements_t *l3_measurements = &rrc->l3_measurements;
meas_t *meas_cell = NULL; meas_t *meas_cell = NULL;
if (is_neighboring_cell == 0) { if (is_neighboring_cell) {
meas_cell = &l3_measurements->active_cell;
} else {
meas_cell = &l3_measurements->neighboring_cell[0]; meas_cell = &l3_measurements->neighboring_cell[0];
} else {
meas_cell = &l3_measurements->active_cell;
} }
meas_cell->Nid_cell = Nid_cell; meas_cell->Nid_cell = Nid_cell;
double a = l3_measurements->filter_coeff_rsrp; double a = l3_measurements->filter_coeff_rsrp;
if (meas_type == 0) { if (!csi_meas) {
if (meas_cell->ss_rsrp_dBm_initialized == true) { if (meas_cell->ss_rsrp_dBm_initialized == true) {
meas_cell->ss_rsrp_dBm = (1.0 - a) * meas_cell->ss_rsrp_dBm + a * rsrp_dBm; meas_cell->ss_rsrp_dBm = (1.0 - a) * meas_cell->ss_rsrp_dBm + a * rsrp_dBm;
} else { } else {
...@@ -1894,15 +1894,15 @@ void *rrc_nrue(void *notUsed) ...@@ -1894,15 +1894,15 @@ void *rrc_nrue(void *notUsed)
case NR_RRC_MAC_MEAS_DATA_IND: case NR_RRC_MAC_MEAS_DATA_IND:
LOG_D(NR_RRC, "[%s][Nid_cell %i] Received %s measurements: RSRP = %i (dBm)\n", LOG_D(NR_RRC, "[%s][Nid_cell %i] Received %s measurements: RSRP = %i (dBm)\n",
NR_RRC_MAC_MEAS_DATA_IND(msg_p).is_neighboring_cell == 0 ? "Active cell" : "Neighboring cell", NR_RRC_MAC_MEAS_DATA_IND(msg_p).is_neighboring_cell? "Neighboring cell" : "Active cell",
NR_RRC_MAC_MEAS_DATA_IND(msg_p).Nid_cell, NR_RRC_MAC_MEAS_DATA_IND(msg_p).Nid_cell,
NR_RRC_MAC_MEAS_DATA_IND(msg_p).meas_type == 0 ? "SS" : "CSI", NR_RRC_MAC_MEAS_DATA_IND(msg_p).is_csi_meas ? "CSI meas" : "SSB meas",
NR_RRC_MAC_MEAS_DATA_IND(msg_p).rsrp_dBm - 157); NR_RRC_MAC_MEAS_DATA_IND(msg_p).rsrp_dBm - 157);
nr_ue_meas_filtering(rrc, nr_ue_meas_filtering(rrc,
NR_RRC_MAC_MEAS_DATA_IND(msg_p).is_neighboring_cell, NR_RRC_MAC_MEAS_DATA_IND(msg_p).is_neighboring_cell,
NR_RRC_MAC_MEAS_DATA_IND(msg_p).Nid_cell, NR_RRC_MAC_MEAS_DATA_IND(msg_p).Nid_cell,
NR_RRC_MAC_MEAS_DATA_IND(msg_p).meas_type, NR_RRC_MAC_MEAS_DATA_IND(msg_p).is_csi_meas,
NR_RRC_MAC_MEAS_DATA_IND(msg_p).rsrp_dBm - 157); NR_RRC_MAC_MEAS_DATA_IND(msg_p).rsrp_dBm - 157);
nr_ue_ckeck_meas_report(rrc, NR_RRC_MAC_MEAS_DATA_IND(msg_p).gnb_index); nr_ue_ckeck_meas_report(rrc, NR_RRC_MAC_MEAS_DATA_IND(msg_p).gnb_index);
......
...@@ -64,10 +64,10 @@ void nr_rrc_cellgroup_configuration(NR_UE_RRC_INST_t *rrc, NR_CellGroupConfig_t ...@@ -64,10 +64,10 @@ void nr_rrc_cellgroup_configuration(NR_UE_RRC_INST_t *rrc, NR_CellGroupConfig_t
\param module_id module id \param module_id module id
\param gNB_index gNB index \param gNB_index gNB index
\param Nid_cell Nid_cell \param Nid_cell Nid_cell
\param meas_type (0) SS, (1) CSI \param meas_type
\param is_neighboring_cell (0) false, (1) true \param is_neighboring_cell (0) false, (1) true
\param rsrp_dBm reference signal received power*/ \param rsrp_dBm reference signal received power*/
int8_t nr_mac_rrc_meas_ind_ue(module_id_t module_id, uint32_t gNB_index, uint16_t Nid_cell, uint8_t meas_type, uint8_t is_neighboring_cell, uint8_t rsrp_dBm); int8_t nr_mac_rrc_meas_ind_ue(module_id_t module_id, uint32_t gNB_index, uint16_t Nid_cell, bool csi_meas, bool is_neighboring_cell, uint8_t rsrp_dBm);
/**\brief interface between MAC and RRC thru SRB0 (RLC TM/no PDCP) /**\brief interface between MAC and RRC thru SRB0 (RLC TM/no PDCP)
\param module_id module id \param module_id 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