Remove memory leaks in FAPI PUCCH 0-4 PDU handling
This commit is contained in:
@@ -909,21 +909,26 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id,
|
||||
handle_dl_harq(UE, pid, harq_value == 0 && harq_confidence == 0, RC.nrmac[mod_id]->dl_bler.harq_round_max);
|
||||
if (harq_confidence == 1) UE->mac_stats.pucch0_DTX++;
|
||||
}
|
||||
|
||||
// tpc (power control) only if we received AckNack
|
||||
if (uci_01->harq->harq_confidence_level==0)
|
||||
sched_ctrl->tpc1 = nr_get_tpc(RC.nrmac[mod_id]->pucch_target_snrx10, uci_01->ul_cqi, 30);
|
||||
else
|
||||
sched_ctrl->tpc1 = 3;
|
||||
sched_ctrl->pucch_snrx10 = uci_01->ul_cqi * 5 - 640;
|
||||
|
||||
free(uci_01->harq->harq_list);
|
||||
free(uci_01->harq);
|
||||
}
|
||||
|
||||
// check scheduling request result, confidence_level == 0 is good
|
||||
if (uci_01->pduBitmap & 0x1 && uci_01->sr->sr_indication && uci_01->sr->sr_confidence_level == 0 && uci_01->ul_cqi >= 148) {
|
||||
// SR detected with SNR >= 10dB
|
||||
sched_ctrl->SR |= true;
|
||||
LOG_D(NR_MAC, "SR UE %04x ul_cqi %d\n", uci_01->rnti, uci_01->ul_cqi);
|
||||
}
|
||||
|
||||
// tpc (power control) only if we received AckNack or positive SR. For a
|
||||
// negative SR, the UE won't have sent anything, and the SNR is not valid
|
||||
if (((uci_01->pduBitmap >> 1) & 0x1) ) {
|
||||
if ((uci_01->harq) && (uci_01->harq->harq_confidence_level==0)) sched_ctrl->tpc1 = nr_get_tpc(RC.nrmac[mod_id]->pucch_target_snrx10, uci_01->ul_cqi, 30);
|
||||
else sched_ctrl->tpc1 = 3;
|
||||
sched_ctrl->pucch_snrx10 = uci_01->ul_cqi * 5 - 640;
|
||||
if (uci_01->pduBitmap & 0x1) {
|
||||
if (uci_01->sr->sr_indication && uci_01->sr->sr_confidence_level == 0 && uci_01->ul_cqi >= 148) {
|
||||
// SR detected with SNR >= 10dB
|
||||
sched_ctrl->SR |= true;
|
||||
LOG_D(NR_MAC, "SR UE %04x ul_cqi %d\n", uci_01->rnti, uci_01->ul_cqi);
|
||||
}
|
||||
free(uci_01->sr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -950,6 +955,11 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id,
|
||||
// 30);
|
||||
//sched_ctrl->pucch_snrx10 = uci_234->ul_cqi * 5 - 640;
|
||||
|
||||
// TODO: handle SR
|
||||
if (uci_234->pduBitmap & 0x1) {
|
||||
free(uci_234->sr.sr_payload);
|
||||
}
|
||||
|
||||
if ((uci_234->pduBitmap >> 1) & 0x01) {
|
||||
// iterate over received harq bits
|
||||
for (int harq_bit = 0; harq_bit < uci_234->harq.harq_bit_len; harq_bit++) {
|
||||
@@ -962,15 +972,18 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id,
|
||||
remove_front_nr_list(&sched_ctrl->feedback_dl_harq);
|
||||
handle_dl_harq(UE, pid, uci_234->harq.harq_crc != 1 && acknack, RC.nrmac[mod_id]->dl_bler.harq_round_max);
|
||||
}
|
||||
free(uci_234->harq.harq_payload);
|
||||
}
|
||||
if ((uci_234->pduBitmap >> 2) & 0x01) {
|
||||
//API to parse the csi report and store it into sched_ctrl
|
||||
extract_pucch_csi_report(csi_MeasConfig, uci_234, frame, slot, UE, RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon);
|
||||
//TCI handling function
|
||||
tci_handling(UE,frame, slot);
|
||||
free(uci_234->csi_part1.csi_part1_payload);
|
||||
}
|
||||
if ((uci_234->pduBitmap >> 3) & 0x01) {
|
||||
//@TODO:Handle CSI Report 2
|
||||
// nothing to free (yet)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -265,23 +265,8 @@ static void free_unqueued_nfapi_indications(nfapi_nr_rach_indication_t *rach_ind
|
||||
}
|
||||
if (uci_ind && uci_ind->num_ucis > 0)
|
||||
{
|
||||
for (int i = 0; i < uci_ind->num_ucis; i++) {
|
||||
switch (uci_ind->uci_list[i].pdu_type) {
|
||||
case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE:
|
||||
if (uci_ind->uci_list[i].pucch_pdu_format_0_1.harq) {
|
||||
free_and_zero(uci_ind->uci_list[i].pucch_pdu_format_0_1.harq->harq_list);
|
||||
}
|
||||
free_and_zero(uci_ind->uci_list[i].pucch_pdu_format_0_1.harq);
|
||||
free_and_zero(uci_ind->uci_list[i].pucch_pdu_format_0_1.sr);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE:
|
||||
free_and_zero(uci_ind->uci_list[i].pucch_pdu_format_2_3_4.harq.harq_payload);
|
||||
free_and_zero(uci_ind->uci_list[i].pucch_pdu_format_2_3_4.csi_part1.csi_part1_payload);
|
||||
free_and_zero(uci_ind->uci_list[i].pucch_pdu_format_2_3_4.csi_part2.csi_part2_payload);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* PUCCH fields (HARQ, SR) are freed in handle_nr_uci_pucch_0_1() and
|
||||
* handle_nr_uci_pucch_2_3_4() */
|
||||
free_and_zero(uci_ind->uci_list);
|
||||
free_and_zero(uci_ind);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user