OAI UE: add shared RSRP Table 10.1.6.1-1 mapping helper and adopt it RRC UE
- Add to common/utils/nr/nr_common remove from NR_MAC_UE/nr_ue_procedures.c
- Adopt in asn1_msg.c for MeasurementReport: this solves the following assert:
Assertion (enc_rval.encoded > 0) failed!
In do_nrMeasurementReport_SA() /oai-ran/openair2/RRC/NR/MESSAGES/asn1_msg.c:898
ASN1 message encoding failed (MeasResultServMOList, 18446744073709551615)!
Motivation: unify RSRP-to-index mapping across layers and fix NR RRC MeasurementReport
encoding failures due to out-of-range values by reusing the validated mapping.
Note NR_RSRP-Range.c constraint:
{ APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */
This commit is contained in:
@@ -152,6 +152,17 @@ void reverse_bits_u8(uint8_t const* in, size_t sz, uint8_t* out)
|
||||
#endif
|
||||
}
|
||||
|
||||
/** @brief 3GPP TS 38.133 Table 10.1.6.1-1 mapping from dBm to RSRP index */
|
||||
uint8_t get_rsrp_index(int rsrp_dBm)
|
||||
{
|
||||
int index = rsrp_dBm + 157;
|
||||
if (rsrp_dBm > -44)
|
||||
index = 113;
|
||||
if (rsrp_dBm < -140)
|
||||
index = 16;
|
||||
return (uint8_t)index;
|
||||
}
|
||||
|
||||
// Reverse bits implementation based on http://graphics.stanford.edu/~seander/bithacks.html
|
||||
uint64_t reverse_bits(uint64_t in, int n_bits)
|
||||
{
|
||||
|
||||
@@ -186,6 +186,9 @@ typedef struct meas_s {
|
||||
val_init_t csi_rsrp_dBm;
|
||||
} meas_t;
|
||||
|
||||
/** @brief Returns NR RSRP index per 3GPP TS 38.133 Table 10.1.6.1-1 */
|
||||
uint8_t get_rsrp_index(int rsrp_dBm);
|
||||
|
||||
/**
|
||||
* @brief To start a timer
|
||||
* @param timer Timer to be started
|
||||
|
||||
@@ -2916,17 +2916,6 @@ static int compare_ssb_rsrp(const void *a, const void *b)
|
||||
return mb->ssb_rsrp_dBm - ma->ssb_rsrp_dBm;
|
||||
}
|
||||
|
||||
// returns index from RSRP
|
||||
// according to Table 10.1.6.1-1 in 38.133
|
||||
static uint8_t get_rsrp_index(int rsrp)
|
||||
{
|
||||
int index = rsrp + 157;
|
||||
if (rsrp > -44)
|
||||
index = 113;
|
||||
if (rsrp < -140)
|
||||
index = 16;
|
||||
return index;
|
||||
}
|
||||
|
||||
static csi_payload_t get_ssb_rsrp_payload(NR_UE_MAC_INST_t *mac,
|
||||
struct NR_CSI_ReportConfig *csi_reportconfig,
|
||||
|
||||
@@ -855,7 +855,7 @@ int do_nrMeasurementReport_SA(NR_MeasurementReport_t *measurementReport,
|
||||
long trigger_quantity,
|
||||
long rs_type,
|
||||
uint16_t Nid_cell,
|
||||
int rsrp_dBm,
|
||||
int rsrp_index,
|
||||
uint8_t *buffer,
|
||||
size_t buffer_size)
|
||||
{
|
||||
@@ -884,9 +884,9 @@ int do_nrMeasurementReport_SA(NR_MeasurementReport_t *measurementReport,
|
||||
struct NR_MeasQuantityResults *active_mq_res = CALLOC(1, sizeof(struct NR_MeasQuantityResults));
|
||||
|
||||
if (trigger_quantity == NR_MeasTriggerQuantityOffset_PR_rsrp) {
|
||||
active_mq_res->rsrp = CALLOC(1, sizeof(NR_RSRP_Range_t));
|
||||
|
||||
*active_mq_res->rsrp = rsrp_dBm + 157;
|
||||
asn1cCalloc(active_mq_res->rsrp, rsrp);
|
||||
// Assign precomputed RSRP index
|
||||
*rsrp = rsrp_index;
|
||||
if (rs_type == NR_NR_RS_Type_ssb)
|
||||
measResultServingCell->measResult.cellResults.resultsSSB_Cell = active_mq_res;
|
||||
else
|
||||
|
||||
@@ -130,7 +130,7 @@ int do_nrMeasurementReport_SA(NR_MeasurementReport_t *measurementReport,
|
||||
long trigger_quantity,
|
||||
long rs_type,
|
||||
uint16_t Nid_cell,
|
||||
int rsrp_dBm,
|
||||
int rsrp_index,
|
||||
uint8_t *buffer,
|
||||
size_t buffer_size);
|
||||
|
||||
|
||||
@@ -3242,12 +3242,13 @@ void rrc_ue_generate_measurementReport(rrcPerNB_t *rrc, instance_t ue_id)
|
||||
NR_MeasurementReport_t measurementReport = {0};
|
||||
l3_measurements_t *l3m = &rrc->l3_measurements;
|
||||
int rsrp_dBm = l3m->rs_type == NR_NR_RS_Type_ssb ? l3m->serving_cell.ss_rsrp_dBm.val : l3m->serving_cell.csi_rsrp_dBm.val;
|
||||
int rsrp_index = get_rsrp_index(rsrp_dBm);
|
||||
uint8_t size = do_nrMeasurementReport_SA(&measurementReport,
|
||||
l3m->trigger_to_measid,
|
||||
l3m->trigger_quantity,
|
||||
l3m->rs_type,
|
||||
l3m->serving_cell.Nid_cell,
|
||||
rsrp_dBm,
|
||||
rsrp_index,
|
||||
buffer,
|
||||
sizeof(buffer));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user