Code cleanup and documentation update
This commit is contained in:
@@ -1475,7 +1475,7 @@ typedef enum {
|
||||
|
||||
//section 3.4.7 rx_data_indication
|
||||
|
||||
///table 3-61
|
||||
//table 3-61
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
@@ -3636,16 +3636,13 @@ static uint8_t pack_nr_uci_indication_body(void* tlv, uint8_t **ppWritePackedMsg
|
||||
printf("Unhandled NFAPI_NR_UCI_PUSCH_PDU_TYPE \n");
|
||||
break;
|
||||
|
||||
case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE: {
|
||||
nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu = &value->pucch_pdu_format_0_1;
|
||||
case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE:
|
||||
pack_nr_uci_pucch_0_1(&value->pucch_pdu_format_0_1, ppWritePackedMsg, end);
|
||||
break;
|
||||
}
|
||||
case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE: {
|
||||
nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu = &value->pucch_pdu_format_2_3_4;
|
||||
pack_nr_uci_pucch_2_3_4(uci_pdu, ppWritePackedMsg, end);
|
||||
|
||||
case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE:
|
||||
pack_nr_uci_pucch_2_3_4(&value->pucch_pdu_format_2_3_4, ppWritePackedMsg, end);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -6556,7 +6553,7 @@ return 1;
|
||||
static uint8_t unpack_nr_uci_pucch_0_1(nfapi_nr_uci_pucch_pdu_format_0_1_t* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
|
||||
nfapi_nr_uci_pucch_pdu_format_0_1_t* value = (nfapi_nr_uci_pucch_pdu_format_0_1_t*)tlv;
|
||||
|
||||
uint8_t *ptr = *ppReadPackedMsg;
|
||||
// uint8_t *ptr = *ppReadPackedMsg;
|
||||
// printf("\n Read P7 message uci_0_1 indication unpack: ");
|
||||
// while(ptr < end){
|
||||
// printf(" %d ", *ptr);
|
||||
|
||||
@@ -158,5 +158,7 @@ pnf_p7_rx_message_t* pnf_p7_rx_reassembly_queue_add_segment(pnf_p7_t* pnf_p7, pn
|
||||
void pnf_p7_rx_reassembly_queue_remove_msg(pnf_p7_t* pnf_p7, pnf_p7_rx_reassembly_queue_t* queue, pnf_p7_rx_message_t* msg);
|
||||
void pnf_p7_rx_reassembly_queue_remove_old_msgs(pnf_p7_t* pnf_p7, pnf_p7_rx_reassembly_queue_t* queue, uint32_t rx_hr_time, uint32_t delta);
|
||||
|
||||
int pnf_nr_p7_pack_and_send_p7_message(pnf_p7_t* pnf_p7, nfapi_p7_message_header_t* header, uint32_t msg_len);
|
||||
|
||||
#endif /* _PNF_P7_H_ */
|
||||
|
||||
|
||||
@@ -940,7 +940,7 @@ 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; //gokul
|
||||
pnf_p7->sfn = sfn_tx;
|
||||
pnf_p7->slot = slot_tx;
|
||||
|
||||
uint32_t rx_slot_dec = NFAPI_SFNSLOT2DEC(sfn, slot);
|
||||
@@ -1142,7 +1142,7 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
|
||||
else
|
||||
{
|
||||
pnf_p7->timing_info_ms_counter++;
|
||||
} //gokul
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1772,7 +1772,7 @@ void pnf_handle_ul_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() %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);
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -175,7 +175,17 @@ int nfapi_pnf_p7_rach_ind(nfapi_pnf_p7_config_t* config, nfapi_rach_indication_t
|
||||
pnf_p7_t* _this = (pnf_p7_t*)(config);
|
||||
return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_rach_indication_t));
|
||||
}
|
||||
int nfapi_pnf_p7_srs_ind(nfapi_pnf_p7_config_t* config, nfapi_srs_indication_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_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_srs_indication_t));
|
||||
}
|
||||
int nfapi_pnf_p7_sr_ind(nfapi_pnf_p7_config_t* config, nfapi_sr_indication_t* ind)
|
||||
{
|
||||
if(config == NULL || ind == NULL)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user