Commit 282ee771 authored by chenyi's avatar chenyi Committed by Robert Schmidt

Handle ul_dci.request more efficiently

Same as parent commit.
Co-authored-by: default avatarhsum <ming-hong.hsu@eurecom.fr>
Co-authored-by: default avatarchenyi <Yi-Quan.Chen@eurecom.fr>
Co-authored-by: default avatarRúben Soares Silva <rsilva@allbesmart.pt>
parent 10beee4f
......@@ -576,7 +576,7 @@ typedef struct
//TODO: Change P7 structs to NR
nfapi_nr_dl_tti_request_t* dl_tti_req;//nfapi_dl_config_request_t* dl_config_req;
nfapi_nr_ul_tti_request_t* ul_tti_req;//nfapi_ul_config_request_t* ul_config_req;
nfapi_nr_ul_dci_request_t* ul_dci_req;//nfapi_hi_dci0_request_t* hi_dci0_req;
nfapi_nr_ul_dci_request_t ul_dci_req;
nfapi_nr_tx_data_request_t tx_data_req;
//TODO: check these two later
......
......@@ -232,31 +232,11 @@ void deallocate_nfapi_ul_config_request(nfapi_ul_config_request_t* req, pnf_p7_t
pnf_p7_free(pnf_p7, req);
}
nfapi_nr_ul_dci_request_t* allocate_nfapi_ul_dci_request(pnf_p7_t* pnf_p7)
{
return pnf_p7_malloc(pnf_p7, sizeof(nfapi_nr_ul_dci_request_t));
}
nfapi_hi_dci0_request_t* allocate_nfapi_hi_dci0_request(pnf_p7_t* pnf_p7)
{
return pnf_p7_malloc(pnf_p7, sizeof(nfapi_hi_dci0_request_t));
}
void deallocate_nfapi_ul_dci_request(nfapi_nr_ul_dci_request_t* req, pnf_p7_t* pnf_p7)
{
//printf("%s() SFN/SF:%d %s req:%p pdu_list:%p\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), pnf_p7->_public.codec_config.deallocate ? "DEALLOCATE" : "FREE", req, req->hi_dci0_request_body.hi_dci0_pdu_list);
// if(pnf_p7->_public.codec_config.deallocate)
// {
// (pnf_p7->_public.codec_config.deallocate)(req->ul_dci_pdu_list);
// }
// else
// {
// free(req->ul_dci_pdu_list);
// }
pnf_p7_free(pnf_p7, req);
}
void deallocate_nfapi_hi_dci0_request(nfapi_hi_dci0_request_t* req, pnf_p7_t* pnf_p7)
{
//printf("%s() SFN/SF:%d %s req:%p pdu_list:%p\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), pnf_p7->_public.codec_config.deallocate ? "DEALLOCATE" : "FREE", req, req->hi_dci0_request_body.hi_dci0_pdu_list);
......@@ -919,12 +899,12 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
}
if(tx_slot_buffer->ul_dci_req!= 0 && tx_slot_buffer->ul_dci_req->SFN == sfn_tx && tx_slot_buffer->ul_dci_req->Slot == slot_tx)
if(tx_slot_buffer->ul_dci_req.numPdus > 0 && tx_slot_buffer->ul_dci_req.SFN == sfn_tx && tx_slot_buffer->ul_dci_req.Slot == slot_tx)
{
DevAssert(pnf_p7->_public.ul_dci_req_fn != NULL);
LOG_D(PHY, "Process ul_dci SFN/slot %d.%d buffer index: %d \n",sfn_tx,slot_tx,buffer_index_tx);
// pnf_phy_ul_dci_req()
(pnf_p7->_public.ul_dci_req_fn)(NULL, &(pnf_p7->_public), tx_slot_buffer->ul_dci_req);
(pnf_p7->_public.ul_dci_req_fn)(NULL, &(pnf_p7->_public), &tx_slot_buffer->ul_dci_req);
tx_slot_buffer->ul_dci_req.SFN = -1;
tx_slot_buffer->ul_dci_req.Slot = -1;
}
//deallocate slot buffers after passing down the PDUs to PHY processing
......@@ -936,13 +916,6 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
LOG_D(PHY,"SFN/slot %d.%d Buffer index : %d freed \n",sfn_tx,slot_tx,buffer_index_tx);
}
if(tx_slot_buffer->ul_dci_req != 0)
{
deallocate_nfapi_ul_dci_request(tx_slot_buffer->ul_dci_req, pnf_p7);
tx_slot_buffer->ul_dci_req = 0;
}
//checking in the rx slot buffers to see if a p7 msg is present.
if(rx_slot_buffer->ul_tti_req != 0)
......@@ -1687,77 +1660,50 @@ void pnf_handle_ul_config_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_
}
}
void pnf_handle_ul_dci_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
{
//NFAPI_TRACE(NFAPI_TRACE_INFO, "HI_DCI0.req Received\n");
nfapi_nr_ul_dci_request_t* req = allocate_nfapi_ul_dci_request(pnf_p7);
if(req == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to allocate nfapi_ul_dci_request structure\n");
return;
}
int unpack_result = nfapi_nr_p7_message_unpack(pRecvMsg, recvMsgLen, req, sizeof(nfapi_nr_ul_dci_request_t), &pnf_p7->_public.codec_config);
if(unpack_result == 0)
{
if(pthread_mutex_lock(&(pnf_p7->mutex)) != 0)
{
uint16_t frame, slot;
if (peek_nr_nfapi_p7_sfn_slot(pRecvMsg, recvMsgLen, &frame, &slot)) {
if (pthread_mutex_lock(&(pnf_p7->mutex)) != 0) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to lock mutex\n");
return;
}
if(is_nr_p7_request_in_window(req->SFN,req->Slot,"ul_dci_request", pnf_p7))
{
uint32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(req->SFN,req->Slot);
if (check_nr_nfapi_p7_slot_type(frame, slot, "UL_DCI.request", NR_DOWNLINK_SLOT)
&& is_nr_p7_request_in_window(frame, slot, "ul_dci_request", pnf_p7)) {
uint32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(frame, slot);
uint8_t buffer_index = sfn_slot_dec % 20;
if(pnf_p7->slot_buffer[buffer_index].ul_dci_req!= 0)
{
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] Freeing hi_dci0_req at index %d (%d/%d)",
// pMyPhyInfo->sfnSf, bufferIdx,
// SFNSF2SFN(dreq->sfn_sf), SFNSF2SF(dreq->sfn_sf));
deallocate_nfapi_ul_dci_request(pnf_p7->slot_buffer[buffer_index].ul_dci_req, pnf_p7);
}
pnf_p7->slot_buffer[buffer_index].sfn = req->SFN;
pnf_p7->slot_buffer[buffer_index].ul_dci_req = req;
pnf_p7->slot_buffer[buffer_index].sfn = frame;
pnf_p7->slot_buffer[buffer_index].slot = slot;
nfapi_nr_ul_dci_request_t *req = &pnf_p7->slot_buffer[buffer_index].ul_dci_req;
pnf_p7->stats.ul_dci_ontime++;
}
else
{
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] NOT storing hi_dci0_req SFN/SF %d/%d\n", pMyPhyInfo->sfnSf, SFNSF2SFN(req->sfn_sf), SFNSF2SF(req->sfn_sf));
deallocate_nfapi_ul_dci_request(req, pnf_p7);
NFAPI_TRACE(NFAPI_TRACE_DEBUG,
"POPULATE UL_DCI.request current tx sfn/slot:%d.%d p7 msg sfn/slot: %d.%d buffer_index:%d\n",
pnf_p7->sfn,
pnf_p7->slot,
frame,
slot,
buffer_index);
if(pnf_p7->_public.timing_info_mode_aperiodic)
{
if (nfapi_nr_p7_message_unpack(pRecvMsg, recvMsgLen, req, sizeof(*req), &pnf_p7->_public.codec_config) != 0)
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to unpack request\n");
} else {
if (pnf_p7->_public.timing_info_mode_aperiodic) {
pnf_p7->timing_info_aperiodic_send = 1;
}
pnf_p7->stats.ul_dci_late++;
}
if(pthread_mutex_unlock(&(pnf_p7->mutex)) != 0)
{
if (pthread_mutex_unlock(&(pnf_p7->mutex)) != 0) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to unlock mutex\n");
return;
}
}
else
{
} else {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Failed to unpack UL DCI req\n");
deallocate_nfapi_ul_dci_request(req, pnf_p7);
}
}
void pnf_handle_hi_dci0_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
{
......
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