Creating UL_ind RACH handle function in VNF

Also fixed a few bugs in nr-nFAPI:
- Push16->push8 fix in packing of RACH
- Allocating memory for pdu_list and preamble_list in unpack
- Properly indexing through both lists during unpack
- Created new nr_rach handling function
This commit is contained in:
Melissa Elkadi
2021-06-02 16:33:12 -07:00
parent f768b90f59
commit 6299d4515e
9 changed files with 130 additions and 63 deletions
+26 -18
View File
@@ -3522,7 +3522,7 @@ static uint8_t pack_nr_rach_indication(void *msg, uint8_t **ppWritePackedMsg, ui
if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
push16(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end)
push8(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end)
))
return 0;
@@ -6502,9 +6502,11 @@ return 1;
//NR RACH
static uint8_t unpack_nr_rach_indication_body(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
static uint8_t unpack_nr_rach_indication_body(nfapi_nr_prach_indication_pdu_t* value,
uint8_t **ppReadPackedMsg,
uint8_t *end,
nfapi_p7_codec_config_t* config)
{
nfapi_nr_prach_indication_pdu_t* value = (nfapi_nr_prach_indication_pdu_t*)tlv;
if(!(pull16(ppReadPackedMsg, &value->phy_cell_id, end) &&
pull8(ppReadPackedMsg, &value->symbol_index, end) &&
@@ -6515,14 +6517,18 @@ static uint8_t unpack_nr_rach_indication_body(void* tlv, uint8_t **ppReadPackedM
pull8(ppReadPackedMsg, &value->num_preamble, end)
))
return 0;
for(int i = 0; i < value->num_preamble; i++)
{
if(!(pull8(ppReadPackedMsg, &value->preamble_list->preamble_index, end) &&
pull16(ppReadPackedMsg, &value->preamble_list->timing_advance, end) &&
pull32(ppReadPackedMsg, &value->preamble_list->preamble_pwr, end)
))
return 0;
}
if (value->num_preamble > 0) {
value->preamble_list = nfapi_p7_allocate(sizeof(*value->preamble_list) * value->num_preamble, config);
for(int i = 0; i < value->num_preamble; i++)
{
if(!(pull8(ppReadPackedMsg, &value->preamble_list[i].preamble_index, end) &&
pull16(ppReadPackedMsg, &value->preamble_list[i].timing_advance, end) &&
pull32(ppReadPackedMsg, &value->preamble_list[i].preamble_pwr, end)
))
return 0;
}
}
return 1;
}
@@ -6533,15 +6539,17 @@ static uint8_t unpack_nr_rach_indication(uint8_t **ppReadPackedMsg, uint8_t *end
pull16(ppReadPackedMsg, &pNfapiMsg->slot , end) &&
pull8(ppReadPackedMsg, &pNfapiMsg->number_of_pdus, end)
))
return 0;
for(int i=0; i< pNfapiMsg->number_of_pdus;i++)
{
if(!unpack_nr_rach_indication_body(&pNfapiMsg->pdu_list,ppReadPackedMsg,end))
return 0;
}
return 1;
if (pNfapiMsg->number_of_pdus > 0) {
pNfapiMsg->pdu_list = nfapi_p7_allocate(sizeof(*pNfapiMsg->pdu_list) * pNfapiMsg->number_of_pdus, config);
for(int i = 0; i < pNfapiMsg->number_of_pdus; i++)
{
if(!unpack_nr_rach_indication_body(&pNfapiMsg->pdu_list[i], ppReadPackedMsg, end, config))
return 0;
}
}
return 1;
}
//NR UCI
@@ -760,6 +760,20 @@ typedef struct nfapi_vnf_p7_config
*/
int (*rach_indication)(struct nfapi_vnf_p7_config* config, nfapi_rach_indication_t* ind);
/*! A callback for the RACH.indication
* \param config A pointer to the vnf p7 configuration
* \param ind A data structure for the decoded nrRACH.indication This will
* have been allocated on the stack.
* \return not currently used.
*
* The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point
*/
int (*nr_rach_indication)(struct nfapi_vnf_p7_config* config, nfapi_nr_rach_indication_t* ind);
/*! A callback for the SRS.indication
* \param config A pointer to the vnf p7 configuration
* \param ind A data structure for the decoded SRS.indication This will
+10 -2
View File
@@ -1547,14 +1547,22 @@ void vnf_handle_nr_rach_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf
}
else
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "Melissa %s: HANDLING RACH IND\n", __FUNCTION__);
nfapi_nr_rach_indication_t ind;
if(nfapi_nr_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(ind), &vnf_p7->_public.codec_config) < 0)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
}
else
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s: Handling RACH Indication\n", __FUNCTION__);
if(vnf_p7->_public.nr_rach_indication)
{
(vnf_p7->_public.nr_rach_indication)(&vnf_p7->_public, &ind);
}
}
//vnf_p7_codec_free(vnf_p7, ind.nr_rach_indication_body.preamble_list); Melissa do we need to do this?
//vnf_p7_codec_free(vnf_p7, ind.vendor_extension);
}
}