From 84d92ac820fcc03a7819a3444c08c1c1c680553a Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 7 Feb 2024 08:49:04 +0100 Subject: [PATCH] Prevent memory leak, use stack for slot indications --- nfapi/oai_integration/nfapi_pnf.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/nfapi/oai_integration/nfapi_pnf.c b/nfapi/oai_integration/nfapi_pnf.c index 430a559cb8..9d50b45bbf 100644 --- a/nfapi/oai_integration/nfapi_pnf.c +++ b/nfapi/oai_integration/nfapi_pnf.c @@ -2428,19 +2428,19 @@ void oai_subframe_ind(uint16_t sfn, uint16_t sf) { } } -void handle_nr_slot_ind(uint16_t sfn, uint16_t slot) { - +void handle_nr_slot_ind(uint16_t sfn, uint16_t slot) +{ //send VNF slot indication, which is aligned with TX thread, so that it can call the scheduler - nfapi_nr_slot_indication_scf_t *ind; - ind = (nfapi_nr_slot_indication_scf_t *) malloc(sizeof(nfapi_nr_slot_indication_scf_t)); - int slot_ahead = 6; + //we give four additional slots (2ms) which should be enough time for the VNF to + //answer + int slot_ahead = 4; uint32_t sfn_slot_tx = sfnslot_add_slot(sfn, slot, slot_ahead); uint16_t sfn_tx = NFAPI_SFNSLOT2SFN(sfn_slot_tx); uint8_t slot_tx = NFAPI_SFNSLOT2SLOT(sfn_slot_tx); - ind->sfn = sfn_tx; - ind->slot = slot_tx; - oai_nfapi_nr_slot_indication(ind); + NFAPI_TRACE(NFAPI_TRACE_DEBUG, "send slot indication for sfn/slot:%4d.%2d current:%4d.%2d\n", sfn_tx, slot_tx, sfn, slot); + nfapi_nr_slot_indication_scf_t ind = { .sfn = sfn_tx, .slot = slot_tx }; + oai_nfapi_nr_slot_indication(&ind); //copy data from appropriate p7 slot buffers into channel structures for PHY processing nfapi_pnf_p7_slot_ind(p7_config_g, p7_config_g->phy_id, sfn, slot);