VNF clock dependency removed
This commit is contained in:
@@ -673,6 +673,7 @@ typedef struct {
|
||||
#define NFAPI_NR_SLOT_INDICATION_PERIOD_NUMEROLOGY_3 125 //us
|
||||
|
||||
typedef struct {
|
||||
nfapi_p7_message_header_t header;
|
||||
uint16_t sfn; //0->1023
|
||||
uint16_t slot;//0->319
|
||||
|
||||
|
||||
@@ -3355,6 +3355,20 @@ static uint8_t pack_nr_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_
|
||||
|
||||
//NR UPLINK indication function packing
|
||||
|
||||
//SLOT INDICATION
|
||||
|
||||
static uint8_t pack_nr_slot_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
|
||||
{
|
||||
nfapi_nr_slot_indication_scf_t *pNfapiMsg = (nfapi_nr_slot_indication_scf_t*)msg;
|
||||
|
||||
if (!(push16((uint16_t)pNfapiMsg->sfn , ppWritePackedMsg, end) &&
|
||||
push16((uint16_t)pNfapiMsg->slot , ppWritePackedMsg, end)
|
||||
))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
//RX DATA INDICATION
|
||||
|
||||
static uint8_t pack_nr_rx_data_indication_body(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
|
||||
@@ -3696,18 +3710,19 @@ int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packe
|
||||
// look for the specific message
|
||||
uint8_t result = 0;
|
||||
switch (pMessageHeader->message_id)
|
||||
{
|
||||
{
|
||||
case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST:
|
||||
result = pack_dl_tti_request(pMessageHeader, &pWritePackedMessage, end, config);
|
||||
//printf("result of pack dl_tti_req is %d. \n",result);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST:
|
||||
result = pack_ul_tti_request(pMessageHeader, &pWritePackedMessage, end, config);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST:
|
||||
result = pack_tx_data_request(pMessageHeader, &pWritePackedMessage, end, config);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST:
|
||||
result = pack_ul_dci_request(pMessageHeader, &pWritePackedMessage, end, config);
|
||||
break;
|
||||
@@ -3720,6 +3735,9 @@ int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packe
|
||||
result =pack_ue_release_response(pMessageHeader, &pWritePackedMessage, end, config);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION:
|
||||
result = pack_nr_slot_indication(pMessageHeader, &pWritePackedMessage, end, config);
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
|
||||
result = pack_nr_rx_data_indication(pMessageHeader, &pWritePackedMessage, end, config);
|
||||
break;
|
||||
@@ -6350,6 +6368,21 @@ static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *
|
||||
|
||||
//UNPACK NR UPLINK INDICATION FUNCTIONS
|
||||
|
||||
//SLOT INDICATION
|
||||
|
||||
static uint8_t unpack_nr_slot_indication(uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_nr_rx_data_indication_t *msg, nfapi_p7_codec_config_t* config)
|
||||
{
|
||||
nfapi_nr_slot_indication_scf_t *pNfapiMsg = (nfapi_nr_slot_indication_scf_t*)msg;
|
||||
|
||||
printf("\n");
|
||||
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) &&
|
||||
pull16(ppReadPackedMsg, &pNfapiMsg->slot , end)
|
||||
))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
//RX DATA INDICATION
|
||||
|
||||
static uint8_t unpack_nr_rx_data_indication_body(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
|
||||
@@ -8707,6 +8740,14 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *
|
||||
else
|
||||
return -1;
|
||||
break;
|
||||
case NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION:
|
||||
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION, unpackedBufLen)){
|
||||
nfapi_nr_slot_indication_scf_t* msg = (nfapi_nr_slot_indication_scf_t*) pMessageHeader;
|
||||
result = unpack_nr_slot_indication(&pReadPackedMessage, end, msg, config);
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
|
||||
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION, unpackedBufLen)){
|
||||
|
||||
@@ -940,11 +940,11 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
|
||||
|
||||
//We align the pnf_p7 sfn/slot with tx sfn/slot, and vnf is synced with pnf_p7 sfn/slot. This is so that the scheduler runs slot_ahead from rx thread.
|
||||
|
||||
pnf_p7->sfn = sfn_tx;
|
||||
pnf_p7->sfn = sfn_tx; //gokul
|
||||
pnf_p7->slot = slot_tx;
|
||||
|
||||
uint32_t slot_dec = NFAPI_SFNSLOT2DEC(sfn, slot);
|
||||
uint8_t buffer_index_rx = slot_dec % 20;
|
||||
uint32_t rx_slot_dec = NFAPI_SFNSLOT2DEC(sfn, slot);
|
||||
uint8_t buffer_index_rx = rx_slot_dec % 20;
|
||||
|
||||
uint32_t tx_slot_dec = NFAPI_SFNSLOT2DEC(sfn_tx,slot_tx);
|
||||
uint8_t buffer_index_tx = tx_slot_dec % 20;
|
||||
@@ -978,14 +978,14 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
|
||||
|
||||
nfapi_pnf_p7_slot_buffer_t* tx_slot_buffer = &(pnf_p7->slot_buffer[buffer_index_tx]);
|
||||
|
||||
if (0) NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() shift:%d slot_buffer->sfn_sf:%d tx_slot_buffer->sfn_slot:%d sfn_sf:%d subframe_buffer[buffer_index:%u dl_config_req:%p tx_req:%p] "
|
||||
"TX:sfn_sf:%d:tx_buffer_index:%d[dl_config_req:%p tx_req:%p]\n",
|
||||
__FUNCTION__,
|
||||
pnf_p7->slot_shift,
|
||||
NFAPI_SFNSLOT2DEC(rx_slot_buffer->sfn, rx_slot_buffer->slot),
|
||||
NFAPI_SFNSLOT2DEC(tx_slot_buffer->sfn, tx_slot_buffer->slot),
|
||||
slot_dec, buffer_index_rx, rx_slot_buffer->dl_tti_req, rx_slot_buffer->tx_data_req,
|
||||
tx_slot_dec, buffer_index_tx, tx_slot_buffer->dl_tti_req, tx_slot_buffer->tx_data_req);
|
||||
// if (0) NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() shift:%d slot_buffer->sfn_sf:%d tx_slot_buffer->sfn_slot:%d sfn_sf:%d subframe_buffer[buffer_index:%u dl_config_req:%p tx_req:%p] "
|
||||
// "TX:sfn_sf:%d:tx_buffer_index:%d[dl_config_req:%p tx_req:%p]\n",
|
||||
// __FUNCTION__,
|
||||
// pnf_p7->slot_shift,
|
||||
// NFAPI_SFNSLOT2DEC(rx_slot_buffer->sfn, rx_slot_buffer->slot),
|
||||
// NFAPI_SFNSLOT2DEC(tx_slot_buffer->sfn, tx_slot_buffer->slot),
|
||||
// slot_dec, buffer_index_rx, rx_slot_buffer->dl_tti_req, rx_slot_buffer->tx_data_req,
|
||||
// tx_slot_dec, buffer_index_tx, tx_slot_buffer->dl_tti_req, tx_slot_buffer->tx_data_req);
|
||||
//TODO: Change later if required
|
||||
|
||||
// todo : how to handle the messages we don't have, send dummies for
|
||||
@@ -1004,7 +1004,8 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
|
||||
|
||||
if(pnf_p7->_public.tx_data_req_fn)
|
||||
{
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "Calling tx_data_req_fn in SFN/slot %d.%d \n",sfn,slot);
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "Calling tx_data_req_fn in SFN/slot %d.%d \n",sfn,slot);
|
||||
LOG_D(PHY, "Process tx_data SFN/slot %d.%d buffer index: %d \n",sfn_tx,slot_tx,buffer_index_tx);
|
||||
(pnf_p7->_public.tx_data_req_fn)(&(pnf_p7->_public), tx_slot_buffer->tx_data_req);
|
||||
}
|
||||
}
|
||||
@@ -1045,6 +1046,7 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
|
||||
if(pnf_p7->_public.ul_dci_req_fn)
|
||||
{
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "Calling UL_dci_req_fn in SFN/slot %d.%d \n",sfn,slot);
|
||||
LOG_D(PHY, "Process ul_dci SFN/slot %d.%d buffer index: %d \n",sfn_tx,slot_tx,buffer_index_tx);
|
||||
(pnf_p7->_public.ul_dci_req_fn)(NULL, &(pnf_p7->_public), tx_slot_buffer->ul_dci_req);
|
||||
}
|
||||
}
|
||||
@@ -1098,6 +1100,7 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
|
||||
{
|
||||
pnf_p7->_public.dummy_slot.ul_tti_req->SFN = sfn;
|
||||
pnf_p7->_public.dummy_slot.ul_tti_req->Slot = slot;
|
||||
LOG_D(PHY, "Process ul_tti SFN/slot %d.%d buffer index: %d \n",sfn,slot,buffer_index_rx);
|
||||
(pnf_p7->_public.ul_tti_req_fn)(NULL, &(pnf_p7->_public), pnf_p7->_public.dummy_slot.ul_tti_req);
|
||||
}
|
||||
}
|
||||
@@ -1603,7 +1606,7 @@ void pnf_handle_dl_tti_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
|
||||
struct timespec t;
|
||||
clock_gettime(CLOCK_MONOTONIC, &t);
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() POPULATE DL_TTI_REQ SFN/slot: %d.%d buffer_index:%d\n", __FUNCTION__, req->SFN, req->Slot, buffer_index);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE DL_TTI_REQ current tx sfn/slot:%d.%d p7 msg sfn/slot: %d.%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, pnf_p7->sfn,pnf_p7->slot, req->SFN, req->Slot, buffer_index);
|
||||
|
||||
// if there is already an dl_tti_req make sure we free it.
|
||||
if(pnf_p7->slot_buffer[buffer_index].dl_tti_req != 0)
|
||||
@@ -1764,12 +1767,12 @@ void pnf_handle_ul_tti_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
|
||||
if(is_nr_p7_request_in_window(req->SFN,req->Slot, "ul_tti_request", pnf_p7))
|
||||
{
|
||||
uint32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(req->SFN,req->Slot);
|
||||
uint8_t buffer_index = sfn_slot_dec % 20;
|
||||
uint8_t buffer_index = (sfn_slot_dec % 20);
|
||||
|
||||
struct timespec t;
|
||||
clock_gettime(CLOCK_MONOTONIC, &t);
|
||||
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE UL_TTI_REQ sfn_slot:%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, sfn_slot_dec, buffer_index);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE UL_TTI_REQ current tx sfn/slot:%d.%d p7 msg sfn/slot: %d.%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, pnf_p7->sfn,pnf_p7->slot, req->SFN, req->Slot, buffer_index);
|
||||
|
||||
if(pnf_p7->slot_buffer[buffer_index].ul_tti_req != 0)
|
||||
{
|
||||
|
||||
@@ -258,6 +258,18 @@ int nfapi_pnf_ue_release_resp(nfapi_pnf_p7_config_t* config, nfapi_ue_release_re
|
||||
|
||||
//NR UPLINK INDICATION
|
||||
|
||||
int nfapi_pnf_p7_nr_slot_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_slot_indication_scf_t* ind)
|
||||
{
|
||||
if(config == NULL || ind == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pnf_p7_t* _this = (pnf_p7_t*)(config);
|
||||
return pnf_nr_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_nr_rx_data_indication_t));
|
||||
}
|
||||
|
||||
int nfapi_pnf_p7_nr_rx_data_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_rx_data_indication_t* ind)
|
||||
{
|
||||
if(config == NULL || ind == NULL)
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#define TIME2TIMEHR(_time) (((uint32_t)(_time.tv_sec) & 0xFFF) << 20 | ((uint32_t)(_time.tv_usec) & 0xFFFFF))
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint8_t* buffer;
|
||||
uint16_t length;
|
||||
|
||||
@@ -854,7 +854,7 @@ typedef struct nfapi_vnf_p7_config
|
||||
int (*nrach_indication)(struct nfapi_vnf_p7_config* config, nfapi_nrach_indication_t* ind);
|
||||
|
||||
//The NR indication functions below copy uplink information received at the VNF into the UL info struct
|
||||
|
||||
int (*nr_slot_indication)(nfapi_nr_slot_indication_scf_t* ind);
|
||||
int (*nr_crc_indication)(nfapi_nr_crc_indication_t* ind);
|
||||
int (*nr_rx_data_indication)(nfapi_nr_rx_data_indication_t* ind);
|
||||
int (*nr_uci_indication)(nfapi_nr_uci_indication_t* ind);
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "vnf_p7.h"
|
||||
|
||||
#define SYNC_CYCLE_COUNT 2
|
||||
@@ -1455,7 +1454,31 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
|
||||
}
|
||||
|
||||
//NR HANDLES FOR UPLINK MESSAGES
|
||||
void vnf_handle_nr_slot_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
|
||||
{
|
||||
// ensure it's valid
|
||||
if (pRecvMsg == NULL || vnf_p7 == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_nr_slot_indication_scf_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
|
||||
{
|
||||
if(vnf_p7->_public.nr_slot_indication)
|
||||
{
|
||||
(vnf_p7->_public.nr_slot_indication)(&ind); //gokul
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
void vnf_handle_nr_rx_data_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
|
||||
{
|
||||
// ensure it's valid
|
||||
@@ -2179,7 +2202,11 @@ void vnf_nr_dispatch_p7_message(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7
|
||||
case NFAPI_TIMING_INFO:
|
||||
vnf_nr_handle_timing_info(pRecvMsg, recvMsgLen, vnf_p7);
|
||||
break;
|
||||
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION:
|
||||
vnf_handle_nr_slot_indication(pRecvMsg, recvMsgLen, vnf_p7);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
|
||||
vnf_handle_nr_rx_data_indication(pRecvMsg, recvMsgLen, vnf_p7);
|
||||
break;
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include "vnf_p7.h"
|
||||
#include "nfapi_vnf.h"
|
||||
|
||||
#include "common/ran_context.h"
|
||||
|
||||
@@ -96,8 +97,10 @@ struct timespec timespec_sub(struct timespec lhs, struct timespec rhs)
|
||||
// monitor the p7 endpoints and the timing loop and
|
||||
// send indications to mac
|
||||
int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
||||
{
|
||||
uint16_t vnf_frame; uint8_t vnf_slot; uint16_t slot_scheduled;
|
||||
{
|
||||
struct PHY_VARS_gNB_s *gNB = RC.gNB[0];
|
||||
uint8_t temp_slot;
|
||||
uint16_t vnf_frame; uint8_t vnf_slot;
|
||||
if(config == 0)
|
||||
return -1;
|
||||
|
||||
@@ -150,8 +153,8 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
||||
|
||||
//struct timespec original_pselect_timeout;
|
||||
struct timespec pselect_timeout;
|
||||
pselect_timeout.tv_sec = 0;
|
||||
pselect_timeout.tv_nsec = 500000; // ns in a 0.5 ms
|
||||
pselect_timeout.tv_sec = 100;
|
||||
pselect_timeout.tv_nsec = 0; // ns in a 0.5 ms
|
||||
//pselect_timeout.tv_nsec = 500000;
|
||||
|
||||
struct timespec pselect_start;
|
||||
@@ -213,19 +216,15 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
||||
pselect_timeout = timespec_sub(slot_start, pselect_start);
|
||||
}
|
||||
|
||||
if(setup_time > 10 && slot_scheduled == 0){
|
||||
if(setup_time > 10 && temp_slot != gNB->UL_INFO.slot){
|
||||
|
||||
// Call the scheduler
|
||||
struct PHY_VARS_gNB_s *gNB = RC.gNB[0];
|
||||
//Call the scheduler
|
||||
pthread_mutex_lock(&gNB->UL_INFO_mutex);
|
||||
gNB->UL_INFO.frame = vnf_frame;
|
||||
gNB->UL_INFO.slot = vnf_slot;
|
||||
|
||||
gNB->UL_INFO.module_id = gNB->Mod_id;
|
||||
gNB->UL_INFO.CC_id = gNB->CC_id;
|
||||
gNB->if_inst->NR_UL_indication(&gNB->UL_INFO);
|
||||
pthread_mutex_unlock(&gNB->UL_INFO_mutex);
|
||||
slot_scheduled = 1;
|
||||
temp_slot = gNB->UL_INFO.slot;
|
||||
}
|
||||
|
||||
selectRetval = pselect(maxSock+1, &rfds, NULL, NULL, &pselect_timeout, NULL);
|
||||
@@ -277,7 +276,6 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
||||
curr = curr->next;
|
||||
}
|
||||
send_mac_slot_indications(vnf_p7);
|
||||
slot_scheduled = 0;
|
||||
|
||||
}
|
||||
else if(selectRetval > 0)
|
||||
|
||||
Reference in New Issue
Block a user