Code cleanup and documentation update

This commit is contained in:
Rahul Gottipati
2021-08-09 19:41:22 +05:30
parent 78f3bca19a
commit 09e32b2839
26 changed files with 135 additions and 161 deletions
+8 -14
View File
@@ -1473,7 +1473,7 @@ void vnf_handle_nr_slot_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf
{
if(vnf_p7->_public.nr_slot_indication)
{
(vnf_p7->_public.nr_slot_indication)(&ind); //gokul
(vnf_p7->_public.nr_slot_indication)(&ind);
}
}
@@ -1982,7 +1982,7 @@ void vnf_nr_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7
phy->zero_count,
phy->in_sync ? "IN_SYNC" : "OUT_OF_SYNC");*/
phy->sfn = new_sfn;
phy->sfn = new_sfn;
phy->slot = new_slot;
}
}
@@ -1998,7 +1998,7 @@ void vnf_nr_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7
phy->previous_t1 = ind.t1;
phy->previous_t2 = ind.t2;
}
}
}
void vnf_handle_timing_info(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
{
@@ -2034,9 +2034,7 @@ void vnf_handle_timing_info(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
void vnf_nr_handle_timing_info(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
{
uint8_t uplink_slots[6] = {7,8,9,17,18,19};
uint8_t is_uplink_slot = 0;
{
if (pRecvMsg == NULL || vnf_p7 == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "vnf_handle_timing_info: NULL parameters\n");
@@ -2055,20 +2053,16 @@ void vnf_nr_handle_timing_info(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
//int16_t vnf_pnf_sfnsf_delta = NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf) - NFAPI_SFNSF2DEC(ind.last_sfn_sf);
int16_t vnf_pnf_sfnslot_delta = NFAPI_SFNSLOT2DEC(vnf_p7->p7_connections[0].sfn,vnf_p7->p7_connections[0].slot) - NFAPI_SFNSLOT2DEC(ind.last_sfn,ind.last_slot);
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() PNF:SFN/SF:%d VNF:SFN/SF:%d deltaSFNSF:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind.last_sfn_sf), NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf), vnf_pnf_sfnsf_delta);
// Panos: Careful here!!! Modification of the original nfapi-code
//if (vnf_pnf_sfnsf_delta>1 || vnf_pnf_sfnsf_delta < -1)
//printf("VNF-PNF delta - %d", vnf_pnf_sfnslot_delta);
for (int i = 0; i < 6; i++){
if (vnf_p7->p7_connections[0].slot == uplink_slots[i])
is_uplink_slot = 1;
}
if ((vnf_pnf_sfnslot_delta>0 || vnf_pnf_sfnslot_delta < 0) && is_uplink_slot == 0)
if (vnf_pnf_sfnslot_delta>0 || vnf_pnf_sfnslot_delta < 0)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() LARGE SFN/SF DELTA between PNF and VNF delta:%d VNF:%d PNF:%d\n\n\n\n\n\n\n\n\n", __FUNCTION__, vnf_pnf_sfnslot_delta,NFAPI_SFNSLOT2DEC(vnf_p7->p7_connections[0].sfn,vnf_p7->p7_connections[0].slot),NFAPI_SFNSLOT2DEC(ind.last_sfn,ind.last_slot)) ;
// Panos: Careful here!!! Modification of the original nfapi-code
vnf_p7->p7_connections[0].sfn = ind.last_sfn;
vnf_p7->p7_connections[0].slot = ind.last_slot;
//printf("VNF SFN/slot modified");
// vnf_p7->p7_connections[0].sfn = ind.last_sfn;
// vnf_p7->p7_connections[0].slot = ind.last_slot;
}
}
}
+3 -7
View File
@@ -99,8 +99,7 @@ struct timespec timespec_sub(struct timespec lhs, struct timespec rhs)
int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config)
{
struct PHY_VARS_gNB_s *gNB = RC.gNB[0];
uint8_t temp_slot;
uint16_t vnf_frame; uint8_t vnf_slot;
uint8_t prev_slot = 0;
if(config == 0)
return -1;
@@ -174,7 +173,6 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config)
struct timespec slot_start;
// clock_gettime(CLOCK_MONOTONIC, &sf_start);
clock_gettime(CLOCK_MONOTONIC, &slot_start);
long millisecond = slot_start.tv_nsec / 1e6; //Check if we have to change
//long millisecond = slot_start.tv_nsec / 0.5e6;
// sf_start = timespec_add(sf_start, sf_duration);
slot_start = timespec_add(slot_start, slot_duration);
@@ -216,7 +214,7 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config)
pselect_timeout = timespec_sub(slot_start, pselect_start);
}
if(setup_time > 10 && temp_slot != gNB->UL_INFO.slot){
if(setup_time > 10 && prev_slot != gNB->UL_INFO.slot){
//Call the scheduler
pthread_mutex_lock(&gNB->UL_INFO_mutex);
@@ -224,7 +222,7 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config)
gNB->UL_INFO.CC_id = gNB->CC_id;
gNB->if_inst->NR_UL_indication(&gNB->UL_INFO);
pthread_mutex_unlock(&gNB->UL_INFO_mutex);
temp_slot = gNB->UL_INFO.slot;
prev_slot = gNB->UL_INFO.slot;
}
selectRetval = pselect(maxSock+1, &rfds, NULL, NULL, &pselect_timeout, NULL);
@@ -266,8 +264,6 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config)
curr->slot++;
}
//printf("Frame = %d, slot = %d in VNF main loop. \n",curr->sfn,curr->slot);
vnf_frame = curr->sfn;
vnf_slot = curr->slot;
//vnf_nr_sync(vnf_p7, curr);