Added an RX_IND handle in the gNB/VNF
Also updated the NR nFAPI for properly packing and unpacking the ra_indication. Lastly, added the functionality for calling the callback RX_ind functions in the VNF. The RX_IND PDU is recevied as NULL in the gNB so need to investigate how to properly pack and unpack the *pdu in the RX_ind.
This commit is contained in:
@@ -875,6 +875,23 @@ int phy_rx_indication(struct nfapi_vnf_p7_config *config, nfapi_rx_indication_t
|
||||
//mac_rx_ind(p7_vnf->mac, ind);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int phy_nr_rx_indication(struct nfapi_vnf_p7_config *config, nfapi_nr_rx_data_indication_t *ind) {
|
||||
|
||||
LOG_I(MAC, "Melissa in %s() NFAPI SFN/SF: %d/%d number_of_pdus :%u, and pdu %p\n",
|
||||
__FUNCTION__,ind->sfn, ind->slot, ind->number_of_pdus, ind->pdu_list[0].pdu);
|
||||
|
||||
if(NFAPI_MODE == NFAPI_MODE_VNF)
|
||||
{
|
||||
UL_INFO.rx_ind = *ind;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_E(NR_MAC, "NFAPI_MODE = %d not NFAPI_MODE_VNF(2)\n", nfapi_getmode());
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int phy_srs_indication(struct nfapi_vnf_p7_config *config, nfapi_srs_indication_t *ind) {
|
||||
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
|
||||
//mac_srs_ind(p7_vnf->mac, ind);
|
||||
@@ -1162,7 +1179,7 @@ void *vnf_nr_p7_thread_start(void *ptr) {
|
||||
p7_vnf->config->slot_indication = &phy_slot_indication;
|
||||
p7_vnf->config->harq_indication = &phy_harq_indication;
|
||||
p7_vnf->config->crc_indication = &phy_crc_indication;
|
||||
p7_vnf->config->rx_indication = &phy_rx_indication;
|
||||
p7_vnf->config->nr_rx_indication = &phy_nr_rx_indication;
|
||||
p7_vnf->config->nr_rach_indication = &phy_nr_rach_indication;
|
||||
p7_vnf->config->srs_indication = &phy_srs_indication;
|
||||
p7_vnf->config->sr_indication = &phy_sr_indication;
|
||||
|
||||
@@ -3387,7 +3387,6 @@ static uint8_t pack_nr_rx_data_indication_body(void* tlv, uint8_t **ppWritePacke
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static uint8_t pack_nr_rx_data_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
|
||||
{
|
||||
nfapi_nr_rx_data_indication_t *pNfapiMsg = (nfapi_nr_rx_data_indication_t*)msg;
|
||||
@@ -3398,9 +3397,9 @@ static uint8_t pack_nr_rx_data_indication(void *msg, uint8_t **ppWritePackedMsg,
|
||||
))
|
||||
return 0;
|
||||
|
||||
for(int i=0; i<pNfapiMsg->number_of_pdus;i++)
|
||||
for(int i = 0; i < pNfapiMsg->number_of_pdus; i++)
|
||||
{
|
||||
if(!pack_nr_rx_data_indication_body(pNfapiMsg->pdu_list,ppWritePackedMsg,end))
|
||||
if(!pack_nr_rx_data_indication_body(&(pNfapiMsg->pdu_list[i]), ppWritePackedMsg, end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -6384,26 +6383,21 @@ static uint8_t unpack_nr_rx_data_indication_body(void* tlv, uint8_t **ppReadPack
|
||||
|
||||
|
||||
static uint8_t unpack_nr_rx_data_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
|
||||
{
|
||||
// uint8_t *ptr = *ppReadPackedMsg;
|
||||
// printf("\n Read P7 message rx data indication unpack: ");
|
||||
// while(ptr < end){
|
||||
// printf(" %d ", *ptr);
|
||||
// ptr++;
|
||||
// }
|
||||
// printf("\n");
|
||||
{
|
||||
nfapi_nr_rx_data_indication_t *pNfapiMsg = (nfapi_nr_rx_data_indication_t*)msg;
|
||||
|
||||
printf("\n");
|
||||
|
||||
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) &&
|
||||
pull16(ppReadPackedMsg, &pNfapiMsg->slot , end) &&
|
||||
pull16(ppReadPackedMsg, &pNfapiMsg->number_of_pdus, end)
|
||||
))
|
||||
return 0;
|
||||
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++)
|
||||
for(int i=0; i < pNfapiMsg->number_of_pdus; i++)
|
||||
{
|
||||
if(!unpack_nr_rx_data_indication_body(&pNfapiMsg->pdu_list, ppReadPackedMsg, end))
|
||||
if(!unpack_nr_rx_data_indication_body(&pNfapiMsg->pdu_list[i], ppReadPackedMsg, end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -746,6 +746,20 @@ typedef struct nfapi_vnf_p7_config
|
||||
*/
|
||||
int (*rx_indication)(struct nfapi_vnf_p7_config* config, nfapi_rx_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_rx_indication)(struct nfapi_vnf_p7_config* config, nfapi_nr_rx_data_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 RACH.indication This will
|
||||
|
||||
@@ -1478,7 +1478,14 @@ void vnf_handle_nr_rx_data_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t*
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s: Handling RX Indication\n", __FUNCTION__);
|
||||
if(vnf_p7->_public.nr_rx_indication)
|
||||
{
|
||||
(vnf_p7->_public.nr_rx_indication)(&vnf_p7->_public, &ind);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,8 +54,9 @@ extern uint16_t sf_ahead;
|
||||
extern uint16_t sl_ahead;
|
||||
extern NR_UL_IND_t UL_INFO;
|
||||
|
||||
void handle_nr_rach(NR_UL_IND_t *UL_info) {
|
||||
|
||||
void handle_nr_rach(NR_UL_IND_t *UL_info)
|
||||
{
|
||||
// Melissa: TODO come back and differentiate between global UL_info and passed in arg
|
||||
if (UL_INFO.rach_ind.number_of_pdus>0) {
|
||||
LOG_I(MAC,"UL_INFO[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n",
|
||||
UL_INFO.frame,UL_INFO.slot, UL_INFO.rach_ind.sfn,UL_INFO.rach_ind.slot);
|
||||
@@ -122,7 +123,7 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info)
|
||||
// find crc_indication j corresponding rx_indication i
|
||||
const nfapi_nr_rx_data_pdu_t *rx = &UL_info->rx_ind.pdu_list[i];
|
||||
const nfapi_nr_crc_t *crc = &UL_info->crc_ind.crc_list[j];
|
||||
LOG_D(PHY,
|
||||
LOG_I(PHY,
|
||||
"UL_info->crc_ind.pdu_list[%d].rnti:%04x "
|
||||
"UL_info->rx_ind.pdu_list[%d].rnti:%04x\n",
|
||||
j,
|
||||
@@ -171,6 +172,22 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info)
|
||||
UL_info->crc_ind.number_crcs,
|
||||
UL_info->rx_ind.sfn,
|
||||
UL_info->rx_ind.slot);
|
||||
} else if (UL_INFO.rx_ind.number_of_pdus > 0) {
|
||||
|
||||
for (int i = 0; i < UL_INFO.rx_ind.number_of_pdus; i++)
|
||||
{
|
||||
nr_rx_sdu(UL_INFO.module_id,
|
||||
UL_INFO.CC_id,
|
||||
UL_INFO.frame,
|
||||
UL_INFO.slot,
|
||||
UL_INFO.rx_ind.pdu_list[i].rnti,
|
||||
UL_INFO.rx_ind.pdu_list[i].pdu,
|
||||
UL_INFO.rx_ind.pdu_list[i].pdu_length,
|
||||
UL_INFO.rx_ind.pdu_list[i].timing_advance,
|
||||
UL_INFO.rx_ind.pdu_list[i].ul_cqi,
|
||||
UL_INFO.rx_ind.pdu_list[i].rssi);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user