This commit is contained in:
Mahesh
2021-05-31 02:13:19 +05:30
parent 99a6001643
commit cf0659abe9
39 changed files with 9565 additions and 11921 deletions
+76 -76
View File
@@ -1,76 +1,76 @@
/*
* Copyright 2017 Cisco Systems, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdio.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
#include <pthread.h>
#include <syslog.h>
#include <debug.h>
#define MAX_MSG_LENGTH 2096
#define TRACE_HEADER_LENGTH 44
void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...);
// initialize the trace function to 0
void (*nfapi_trace_g)(nfapi_trace_level_t level, const char* format, ...) = &nfapi_trace_dbg;
nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_INFO;
//nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_WARN;
void nfapi_set_trace_level(nfapi_trace_level_t new_level)
{
nfapi_trace_level_g = new_level;
}
void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...)
{
char trace_buff[MAX_MSG_LENGTH + TRACE_HEADER_LENGTH];
uint32_t num_chars;
va_list p_args;
struct timeval tv;
pthread_t tid = pthread_self();
(void)gettimeofday(&tv, NULL);
num_chars = (uint32_t)snprintf(trace_buff, TRACE_HEADER_LENGTH, "%04u.%06u: 0x%02x: %10u: ", ((uint32_t)tv.tv_sec) & 0x1FFF, (uint32_t)tv.tv_usec, (uint32_t)level, (uint32_t)tid);
if (num_chars > TRACE_HEADER_LENGTH)
{
printf("trace_dbg: Error, num_chars is too large: %u", num_chars);
return;
}
va_start(p_args, format);
if ((num_chars = (uint32_t)vsnprintf(&trace_buff[num_chars], MAX_MSG_LENGTH, format, p_args)))
{
if (level <= NFAPI_TRACE_WARN)
{
printf("%s", trace_buff);
}
printf("%s", trace_buff);
}
va_end(p_args);
}
/*
* Copyright 2017 Cisco Systems, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdio.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
#include <pthread.h>
#include <syslog.h>
#include <debug.h>
#define MAX_MSG_LENGTH 2096
#define TRACE_HEADER_LENGTH 44
void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...);
// initialize the trace function to 0
void (*nfapi_trace_g)(nfapi_trace_level_t level, const char* format, ...) = &nfapi_trace_dbg;
nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_INFO;
//nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_WARN;
void nfapi_set_trace_level(nfapi_trace_level_t new_level)
{
nfapi_trace_level_g = new_level;
}
void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...)
{
char trace_buff[MAX_MSG_LENGTH + TRACE_HEADER_LENGTH];
uint32_t num_chars;
va_list p_args;
struct timeval tv;
pthread_t tid = pthread_self();
(void)gettimeofday(&tv, NULL);
num_chars = (uint32_t)snprintf(trace_buff, TRACE_HEADER_LENGTH, "%04u.%06u: 0x%02x: %10u: ", ((uint32_t)tv.tv_sec) & 0x1FFF, (uint32_t)tv.tv_usec, (uint32_t)level, (uint32_t)tid);
if (num_chars > TRACE_HEADER_LENGTH)
{
printf("trace_dbg: Error, num_chars is too large: %d", num_chars);
return;
}
va_start(p_args, format);
if ((num_chars = (uint32_t)vsnprintf(&trace_buff[num_chars], MAX_MSG_LENGTH, format, p_args)))
{
if (level <= NFAPI_TRACE_WARN)
{
printf("%s", trace_buff);
}
printf("%s", trace_buff);
}
va_end(p_args);
}
@@ -972,7 +972,7 @@ typedef struct
typedef struct
{
int ss_pbch_power;//SSB Block Power Value: TBD (-60..50 dBm)
uint32_t ss_pbch_power;//SSB Block Power Value: TBD (-60..50 dBm)
uint8_t bch_payload;//Defines option selected for generation of BCH payload, see Table 3-13 (v0.0.011 Value: 0: MAC generates the full PBCH payload 1: PHY generates the timing PBCH bits 2: PHY generates the full PBCH payload
uint8_t scs_common;//subcarrierSpacing for common, used for initial access and broadcast message. [38.211 sec 4.2] Value:0->3
@@ -1058,6 +1058,12 @@ typedef struct {
fapi_nr_tdd_table_t tdd_table;
fapi_nr_prach_config_t prach_config;
fapi_nr_dl_bwp_common_config_t dl_bwp_common;
fapi_nr_dl_bwp_dedicated_config_t dl_bwp_dedicated;
fapi_nr_ul_bwp_common_config_t ul_bwp_common;
fapi_nr_ul_bwp_dedicated_config_t ul_bwp_dedicated;
} fapi_nr_config_request_t;
#endif
@@ -1474,7 +1474,7 @@ typedef enum {
//section 3.4.7 rx_data_indication
//table 3-61
///table 3-61
typedef struct
{
@@ -1492,10 +1492,11 @@ typedef struct
typedef struct
{
nfapi_p7_message_header_t header;
uint16_t sfn;
uint16_t slot;
uint16_t number_of_pdus;
nfapi_nr_rx_data_pdu_t* pdu_list;
nfapi_nr_rx_data_pdu_t *pdu_list;
} nfapi_nr_rx_data_indication_t;
@@ -1518,6 +1519,7 @@ typedef struct
typedef struct
{
nfapi_p7_message_header_t header;
uint16_t sfn;
uint16_t slot;
uint16_t number_crcs;
@@ -1655,6 +1657,7 @@ typedef struct
typedef struct
{
nfapi_p7_message_header_t header;
uint16_t sfn;
uint16_t slot;
uint16_t num_ucis;
@@ -1691,6 +1694,7 @@ typedef struct
typedef struct
{
nfapi_p7_message_header_t header;
uint16_t sfn;
uint16_t slot;
uint8_t number_of_pdus;
@@ -1723,6 +1727,7 @@ typedef struct{
typedef struct
{
nfapi_p7_message_header_t header;
uint16_t sfn;
uint16_t slot;
uint8_t number_of_pdus;
File diff suppressed because it is too large Load Diff
@@ -27,6 +27,7 @@ extern "C" {
#include <openair2/PHY_INTERFACE/IF_Module.h>
#include "nfapi_nr_interface.h"
#include "nfapi_nr_interface_scf.h"
#include <sys/types.h>
#include "openair1/PHY/defs_gNB.h"
+20 -7
View File
@@ -937,7 +937,7 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
pnf_p7->slot_start_time_hr = pnf_get_current_time_hr();
pnf_p7->sfn = sfn;
pnf_p7->slot = slot;
pnf_p7->slot = slot;
@@ -1559,6 +1559,9 @@ uint8_t is_nr_p7_request_in_window(uint16_t sfn,uint16_t slot, const char* name,
// }
// }
struct timespec curr_time;
clock_gettime(CLOCK_MONOTONIC, &curr_time);
printf("PNF SFN:%d, PNF slot:%d, VNF SFN:%d, VNF slot:%d, Curr time;%d.%d. \n",phy->sfn,phy->slot,sfn,slot,curr_time.tv_sec,curr_time.tv_nsec);
if(current_sfn_slot_dec <= recv_sfn_slot_dec + timing_window){
in_window = 1;
NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is in window %d\n", current_sfn_slot_dec, name, recv_sfn_slot_dec);
@@ -1571,8 +1574,8 @@ uint8_t is_nr_p7_request_in_window(uint16_t sfn,uint16_t slot, const char* name,
else
{
NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is out of window %d (delta:%d) [max:%d]\n", current_sfn_slot_dec, name, recv_sfn_slot_dec, (current_sfn_slot_dec - recv_sfn_slot_dec), timing_window);
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is out of window [max:%d]\n", current_sfn_slot_dec, name, recv_sfn_slot_dec, (current_sfn_slot_dec - recv_sfn_slot_dec), timing_window);
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is out of window %d (delta:%d) [max:%d]\n", current_sfn_slot_dec, name, recv_sfn_slot_dec, (current_sfn_slot_dec - recv_sfn_slot_dec), timing_window);
}//Need to add more cases
@@ -3202,6 +3205,8 @@ int pnf_p7_message_pump(pnf_p7_t* pnf_p7)
int pnf_nr_p7_message_pump(pnf_p7_t* pnf_p7)
{
uint16_t pnf_frame = 0;
uint8_t pnf_slot = 0;
// initialize the mutex lock
if(pthread_mutex_init(&(pnf_p7->mutex), NULL) != 0)
{
@@ -3284,8 +3289,8 @@ int pnf_nr_p7_message_pump(pnf_p7_t* pnf_p7)
FD_SET(pnf_p7->p7_sock, &rfds);
struct timeval timeout;
timeout.tv_sec = 1;
timeout.tv_usec = 0;
timeout.tv_sec = 0;
timeout.tv_usec = 500;
selectRetval = select(pnf_p7->p7_sock+1, &rfds, NULL, NULL, &timeout);
@@ -3297,7 +3302,15 @@ int pnf_nr_p7_message_pump(pnf_p7_t* pnf_p7)
if(selectRetval == 0)
{
// timeout
continue;
//continue;
if (pnf_slot == 19)
pnf_frame = (pnf_frame + 1) % 1024;
pnf_slot = (pnf_slot + 1) % 20;
pnf_p7->sfn = pnf_frame;
pnf_p7->slot = pnf_slot;
struct timespec curr_time;
clock_gettime(CLOCK_MONOTONIC, &curr_time);
//printf("SFN=%d, slot=%d, Curr_time=%d.%d \n",pnf_p7->sfn,pnf_p7->slot,curr_time.tv_sec,curr_time.tv_nsec);
}
else if (selectRetval == -1 && (errno == EINTR))
{
@@ -3315,7 +3328,7 @@ int pnf_nr_p7_message_pump(pnf_p7_t* pnf_p7)
if(FD_ISSET(pnf_p7->p7_sock, &rfds))
{
pnf_nr_nfapi_p7_read_dispatch_message(pnf_p7, now_hr_time);
pnf_nr_nfapi_p7_read_dispatch_message(pnf_p7, now_hr_time);
}
}
NFAPI_TRACE(NFAPI_TRACE_ERROR, "PNF_P7 Terminating..\n");
+62 -10
View File
@@ -175,17 +175,7 @@ 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)
@@ -265,3 +255,65 @@ int nfapi_pnf_ue_release_resp(nfapi_pnf_p7_config_t* config, nfapi_ue_release_re
return pnf_p7_pack_and_send_p7_message(_this, &(resp->header), sizeof(nfapi_ue_release_response_t));
}
//NR UPLINK INDICATION
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)
{
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_crc_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_crc_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_nr_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_nr_crc_indication_t));
}
int nfapi_pnf_p7_nr_srs_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_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_nr_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_nr_srs_indication_t));
}
int nfapi_pnf_p7_nr_uci_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_uci_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_nr_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_nr_uci_indication_t));
}
int nfapi_pnf_p7_nr_rach_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_rach_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_nr_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_nr_rach_indication_t));
}
+2 -2
View File
@@ -278,7 +278,7 @@ void *fapi_thread_start(void *ptr) {
if(instance->tick == 1000) {
if(instance->tx_byte_count > 0) {
printf("[FAPI] Tx rate %u bytes/sec\n", instance->tx_byte_count);
printf("[FAPI] Tx rate %d bytes/sec\n", instance->tx_byte_count);
instance->tx_byte_count = 0;
}
@@ -319,7 +319,7 @@ void *fapi_thread_start(void *ptr) {
millisec = now_ts.tv_nsec / 1e6;
if(last_millisec != -1 && ((last_millisec + 1 ) % 1000) != millisec) {
printf("*** missing millisec %u %u\n", last_millisec, millisec);
printf("*** missing millisec %d %d\n", last_millisec, millisec);
catchup = millisec - last_millisec - 1;
}
+2
View File
@@ -24,6 +24,8 @@
#define TIMEHR_USEC(_time_hr) ((uint32_t)(_time_hr) & 0xFFFFF)
#define TIME2TIMEHR(_time) (((uint32_t)(_time.tv_sec) & 0xFFF) << 20 | ((uint32_t)(_time.tv_usec) & 0xFFFFF))
typedef struct {
uint8_t* buffer;
uint16_t length;
+425 -339
View File
@@ -461,6 +461,7 @@ int vnf_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* p7_info, u
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() sendto_result %d %d\n", __FUNCTION__, sendto_result, errno);
}
return 0;
}
@@ -676,6 +677,7 @@ int vnf_nr_build_send_dl_node_sync(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_inf
//dl_node_sync.t1 = calculate_t1(p7_info->sfn_sf, vnf_p7->sf_start_time_hr);
dl_node_sync.t1 = calculate_nr_t1(p7_info->sfn,p7_info->slot, vnf_p7->slot_start_time_hr);
dl_node_sync.delta_sfn_slot = 0;
return vnf_nr_p7_pack_and_send_p7_msg(vnf_p7, &dl_node_sync.header);
}
@@ -1451,8 +1453,102 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
phy->previous_t1 = ind.t1;
phy->previous_t2 = ind.t2;
}
}
//NR HANDLES FOR UPLINK MESSAGES
void vnf_handle_nr_rx_data_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_rx_data_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__);
}
}
}
void vnf_handle_nr_crc_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_crc_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__);
}
}
}
void vnf_handle_nr_srs_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_srs_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__);
}
}
}
void vnf_handle_nr_uci_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_uci_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__);
}
}
}
void vnf_handle_nr_rach_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_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__);
}
}
}
void vnf_nr_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
@@ -1485,358 +1581,368 @@ void vnf_nr_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7
// divide by 2 using shift operator
uint32_t latency = (tx_2_rx - pnf_proc_time) >> 1;
if(!(phy->filtered_adjust))
if(phy->in_sync == 0)
{
phy->latency[phy->min_sync_cycle_count] = latency;
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%d) PNF to VNF !sync phy_id:%d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d\n",
// phy->sfn, phy->slot, ind.header.phy_id, ind.t1, ind.t2, ind.t3, t4,
// tx_2_rx, pnf_proc_time, latency);
}
else
{
phy->latency[phy->min_sync_cycle_count] = latency;
//if(phy->min_sync_cycle_count != SYNC_CYCLE_COUNT)
{
if (ind.t2 < phy->previous_t2 && ind.t1 > phy->previous_t1)
{
// Only t2 wrap has occurred!!!
phy->slot_offset = (NFAPI_MAX_SFNSLOTDEC + ind.t2) - ind.t1 - latency;
}
else if (ind.t2 > phy->previous_t2 && ind.t1 < phy->previous_t1)
{
// Only t1 wrap has occurred
phy->slot_offset = ind.t2 - ( ind.t1 + NFAPI_MAX_SFNSLOTDEC) - latency;
}
else
{
// Either no wrap or both have wrapped
phy->slot_offset = ind.t2 - ind.t1 - latency;
}
if (phy->slot_offset_filtered == 0)
{
phy->slot_offset_filtered = phy->slot_offset;
}
else
{
int32_t oldFilteredValueShifted = phy->slot_offset_filtered << 5;
int32_t newOffsetShifted = phy->slot_offset << 5;
// 1/8 of new and 7/8 of old
phy->slot_offset_filtered = ((newOffsetShifted >> 3) + ((oldFilteredValueShifted * 7) >> 3)) >> 5;
}
}
if(1)
{
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%1d) %d.%d PNF to VNF phy_id:%2d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d(avg:%4d) offset(us):%8d filtered(us):%8d wrap[t1:%u t2:%u]\n",
// phy->sfn, phy->slot, ts.tv_sec, ts.tv_nsec, ind.header.phy_id,
// ind.t1, ind.t2, ind.t3, t4,
// tx_2_rx, pnf_proc_time, latency, phy->average_latency, phy->slot_offset, phy->slot_offset_filtered,
// (ind.t1<phy->previous_t1), (ind.t2<phy->previous_t2));
}
NFAPI_TRACE(NFAPI_TRACE_NOTE, "VNF P7 In Sync with phy (phy_id:%d)\n", phy->phy_id);
if(vnf_p7->_public.sync_indication)
(vnf_p7->_public.sync_indication)(&(vnf_p7->_public), 1);
}
if (phy->filtered_adjust && (phy->slot_offset_filtered > 1e6 || phy->slot_offset_filtered < -1e6))
{
phy->filtered_adjust = 0;
phy->zero_count=0;
phy->min_sync_cycle_count = 2;
phy->in_sync = 0;
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s - ADJUST TOO BAD - go out of filtered phy->slot_offset_filtered:%d\n", __FUNCTION__, phy->slot_offset_filtered);
}
phy->in_sync = 1;
if(phy->min_sync_cycle_count)
phy->min_sync_cycle_count--;
// if(!(phy->filtered_adjust))
// {
// phy->latency[phy->min_sync_cycle_count] = latency;
if(phy->min_sync_cycle_count == 0)
{
uint32_t curr_sfn = phy->sfn;
uint32_t curr_slot = phy->slot;
int32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(phy->sfn,phy->slot);
// //NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%d) PNF to VNF !sync phy_id:%d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d\n",
// // phy->sfn, phy->slot, ind.header.phy_id, ind.t1, ind.t2, ind.t3, t4,
// // tx_2_rx, pnf_proc_time, latency);
// }
// else
// {
// phy->latency[phy->min_sync_cycle_count] = latency;
if(!phy->filtered_adjust)
{
int i = 0;
//phy->average_latency = 0;
for(i = 0; i < SYNC_CYCLE_COUNT; ++i)
{
phy->average_latency += phy->latency[i];
// //if(phy->min_sync_cycle_count != SYNC_CYCLE_COUNT)
// {
// if (ind.t2 < phy->previous_t2 && ind.t1 > phy->previous_t1)
// {
// // Only t2 wrap has occurred!!!
// phy->slot_offset = (NFAPI_MAX_SFNSLOTDEC + ind.t2) - ind.t1 - latency;
// }
// else if (ind.t2 > phy->previous_t2 && ind.t1 < phy->previous_t1)
// {
// // Only t1 wrap has occurred
// phy->slot_offset = ind.t2 - ( ind.t1 + NFAPI_MAX_SFNSLOTDEC) - latency;
// }
// else
// {
// // Either no wrap or both have wrapped
// phy->slot_offset = ind.t2 - ind.t1 - latency;
// }
}
phy->average_latency /= SYNC_CYCLE_COUNT;
// if (phy->slot_offset_filtered == 0)
// {
// phy->slot_offset_filtered = phy->slot_offset;
// }
// else
// {
// int32_t oldFilteredValueShifted = phy->slot_offset_filtered << 5;
// int32_t newOffsetShifted = phy->slot_offset << 5;
phy->slot_offset = ind.t2 - (ind.t1 - phy->average_latency);
// // 1/8 of new and 7/8 of old
// phy->slot_offset_filtered = ((newOffsetShifted >> 3) + ((oldFilteredValueShifted * 7) >> 3)) >> 5;
// }
// }
sfn_slot_dec += (phy->slot_offset / 500);
// if(1)
// {
// struct timespec ts;
// clock_gettime(CLOCK_MONOTONIC, &ts);
// //NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%1d) %d.%d PNF to VNF phy_id:%2d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d(avg:%4d) offset(us):%8d filtered(us):%8d wrap[t1:%u t2:%u]\n",
// // phy->sfn, phy->slot, ts.tv_sec, ts.tv_nsec, ind.header.phy_id,
// // ind.t1, ind.t2, ind.t3, t4,
// // tx_2_rx, pnf_proc_time, latency, phy->average_latency, phy->slot_offset, phy->slot_offset_filtered,
// // (ind.t1<phy->previous_t1), (ind.t2<phy->previous_t2));
// }
// }
// if (phy->filtered_adjust && (phy->slot_offset_filtered > 1e6 || phy->slot_offset_filtered < -1e6))
// {
// phy->filtered_adjust = 0;
// phy->zero_count=0;
// phy->min_sync_cycle_count = 2;
// phy->in_sync = 0;
// NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s - ADJUST TOO BAD - go out of filtered phy->slot_offset_filtered:%d\n", __FUNCTION__, phy->slot_offset_filtered);
// }
// if(phy->min_sync_cycle_count)
// phy->min_sync_cycle_count--;
// if(phy->min_sync_cycle_count == 0)
// {
// uint32_t curr_sfn = phy->sfn;
// uint32_t curr_slot = phy->slot;
// int32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(phy->sfn,phy->slot);
// if(!phy->filtered_adjust)
// {
// int i = 0;
// //phy->average_latency = 0;
// for(i = 0; i < SYNC_CYCLE_COUNT; ++i)
// {
// phy->average_latency += phy->latency[i];
// }
// phy->average_latency /= SYNC_CYCLE_COUNT;
// phy->slot_offset = ind.t2 - (ind.t1 - phy->average_latency);
// sfn_slot_dec += (phy->slot_offset / 500);
NFAPI_TRACE(NFAPI_TRACE_NOTE, "PNF to VNF slot offset:%d sfn :%d slot:%d \n",phy->slot_offset,NFAPI_SFNSLOTDEC2SFN(sfn_slot_dec),NFAPI_SFNSLOTDEC2SLOT(sfn_slot_dec) );
// //NFAPI_TRACE(NFAPI_TRACE_NOTE, "PNF to VNF slot offset:%d sfn :%d slot:%d \n",phy->slot_offset,NFAPI_SFNSLOTDEC2SFN(sfn_slot_dec),NFAPI_SFNSLOTDEC2SLOT(sfn_slot_dec) );
}
else
{
sfn_slot_dec += ((phy->slot_offset_filtered + 250) / 500); //Round up to go from microsecond to slot
// }
// else
// {
// sfn_slot_dec += ((phy->slot_offset_filtered + 250) / 500); //Round up to go from microsecond to slot
}
// }
if(sfn_slot_dec < 0)
{
sfn_slot_dec += NFAPI_MAX_SFNSLOTDEC;
}
else if( sfn_slot_dec >= NFAPI_MAX_SFNSLOTDEC)
{
sfn_slot_dec -= NFAPI_MAX_SFNSLOTDEC;
}
// if(sfn_slot_dec < 0)
// {
// sfn_slot_dec += NFAPI_MAX_SFNSLOTDEC;
// }
// else if( sfn_slot_dec >= NFAPI_MAX_SFNSLOTDEC)
// {
// sfn_slot_dec -= NFAPI_MAX_SFNSLOTDEC;
// }
uint16_t new_sfn = NFAPI_SFNSLOTDEC2SFN(sfn_slot_dec);
uint16_t new_slot = NFAPI_SFNSLOTDEC2SLOT(sfn_slot_dec);
// uint16_t new_sfn = NFAPI_SFNSLOTDEC2SFN(sfn_slot_dec);
// uint16_t new_slot = NFAPI_SFNSLOTDEC2SLOT(sfn_slot_dec);
{
phy->adjustment = NFAPI_SFNSLOT2DEC(new_sfn, new_slot) - NFAPI_SFNSLOT2DEC(curr_sfn, curr_slot);
// {
// phy->adjustment = NFAPI_SFNSLOT2DEC(new_sfn, new_slot) - NFAPI_SFNSLOT2DEC(curr_sfn, curr_slot);
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "PNF to VNF phy_id:%d adjustment%d phy->previous_slot_offset_filtered:%d phy->previous_slot_offset_filtered:%d phy->slot_offset_trend:%d\n", ind.header.phy_id, phy->adjustment, phy->previous_slot_offset_filtered, phy->previous_slot_offset_filtered, phy->slot_offset_trend);
// //NFAPI_TRACE(NFAPI_TRACE_NOTE, "PNF to VNF phy_id:%d adjustment%d phy->previous_slot_offset_filtered:%d phy->previous_slot_offset_filtered:%d phy->slot_offset_trend:%d\n", ind.header.phy_id, phy->adjustment, phy->previous_slot_offset_filtered, phy->previous_slot_offset_filtered, phy->slot_offset_trend);
phy->previous_t1 = 0;
phy->previous_t2 = 0;
// phy->previous_t1 = 0;
// phy->previous_t2 = 0;
if(phy->previous_slot_offset_filtered > 0)
{
if( phy->slot_offset_filtered > phy->previous_slot_offset_filtered)
{
// pnf is getting futher ahead of vnf
//phy->sf_offset_trend = phy->sf_offset_filtered - phy->previous_sf_offset_filtered;
phy->slot_offset_trend = (phy->slot_offset_filtered + phy->previous_slot_offset_filtered)/2;
}
else
{
// pnf is getting back in sync
}
}
else if(phy->previous_slot_offset_filtered < 0)
{
if(phy->slot_offset_filtered < phy->previous_slot_offset_filtered)
{
// vnf is getting future ahead of pnf
//phy->sf_offset_trend = -(phy->sf_offset_filtered - phy->previous_sf_offset_filtered);
phy->slot_offset_trend = (-(phy->slot_offset_filtered + phy->previous_slot_offset_filtered)) /2;
}
else
{
// vnf is getting back in sync
}
}
// if(phy->previous_slot_offset_filtered > 0)
// {
// if( phy->slot_offset_filtered > phy->previous_slot_offset_filtered)
// {
// // pnf is getting futher ahead of vnf
// //phy->sf_offset_trend = phy->sf_offset_filtered - phy->previous_sf_offset_filtered;
// phy->slot_offset_trend = (phy->slot_offset_filtered + phy->previous_slot_offset_filtered)/2;
// }
// else
// {
// // pnf is getting back in sync
// }
// }
// else if(phy->previous_slot_offset_filtered < 0)
// {
// if(phy->slot_offset_filtered < phy->previous_slot_offset_filtered)
// {
// // vnf is getting future ahead of pnf
// //phy->sf_offset_trend = -(phy->sf_offset_filtered - phy->previous_sf_offset_filtered);
// phy->slot_offset_trend = (-(phy->slot_offset_filtered + phy->previous_slot_offset_filtered)) /2;
// }
// else
// {
// // vnf is getting back in sync
// }
// }
int insync_minor_adjustment_1 = phy->slot_offset_trend / 6;
int insync_minor_adjustment_2 = phy->slot_offset_trend / 2;
// int insync_minor_adjustment_1 = phy->slot_offset_trend / 6;
// int insync_minor_adjustment_2 = phy->slot_offset_trend / 2;
if(insync_minor_adjustment_1 == 0)
insync_minor_adjustment_1 = 2;
// if(insync_minor_adjustment_1 == 0)
// insync_minor_adjustment_1 = 2;
if(insync_minor_adjustment_2 == 0)
insync_minor_adjustment_2 = 10;
// if(insync_minor_adjustment_2 == 0)
// insync_minor_adjustment_2 = 10;
if(!phy->filtered_adjust)
{
if(phy->adjustment < 10)
{
phy->zero_count++;
// if(!phy->filtered_adjust)
// {
// if(phy->adjustment < 10)
// {
// phy->zero_count++;
if(phy->zero_count >= 10)
{
phy->filtered_adjust = 1;
phy->zero_count = 0;
// if(phy->zero_count >= 10)
// {
// phy->filtered_adjust = 1;
// phy->zero_count = 0;
NFAPI_TRACE(NFAPI_TRACE_NOTE, "***** Adjusting VNF SFN/SF switching to filtered mode\n");
}
}
else
{
phy->zero_count = 0;
}
}
else
{
// Fine level of adjustment
if (phy->adjustment == 0)
{
if (phy->zero_count >= 10)
{
if(phy->in_sync == 0)
{
NFAPI_TRACE(NFAPI_TRACE_NOTE, "VNF P7 In Sync with phy (phy_id:%d)\n", phy->phy_id);
// NFAPI_TRACE(NFAPI_TRACE_NOTE, "***** Adjusting VNF SFN/SF switching to filtered mode\n");
// }
// }
// else
// {
// phy->zero_count = 0;
// }
// }
// else
// {
// // Fine level of adjustment
// if (phy->adjustment == 0)
// {
// if (phy->zero_count >= 10)
// {
// if(phy->in_sync == 0)
// {
// NFAPI_TRACE(NFAPI_TRACE_NOTE, "VNF P7 In Sync with phy (phy_id:%d)\n", phy->phy_id);
if(vnf_p7->_public.sync_indication)
(vnf_p7->_public.sync_indication)(&(vnf_p7->_public), 1);
}
// if(vnf_p7->_public.sync_indication)
// (vnf_p7->_public.sync_indication)(&(vnf_p7->_public), 1);
// }
phy->in_sync = 1;
}
else
{
phy->zero_count++;
}
// phy->in_sync = 1;
// }
// else
// {
// phy->zero_count++;
// }
if(phy->in_sync)
{
// in sync
if(phy->slot_offset_filtered > 250)
{
// VNF is slow
phy->insync_minor_adjustment = insync_minor_adjustment_1; //25;
phy->insync_minor_adjustment_duration = ((phy->slot_offset_filtered) / insync_minor_adjustment_1);
}
else if(phy->slot_offset_filtered < -250)
{
// VNF is fast
phy->insync_minor_adjustment = -(insync_minor_adjustment_1); //25;
phy->insync_minor_adjustment_duration = (((phy->slot_offset_filtered) / -(insync_minor_adjustment_1)));
}
else
{
phy->insync_minor_adjustment = 0;
}
// if(phy->in_sync)
// {
// // in sync
// if(phy->slot_offset_filtered > 250)
// {
// // VNF is slow
// phy->insync_minor_adjustment = insync_minor_adjustment_1; //25;
// phy->insync_minor_adjustment_duration = ((phy->slot_offset_filtered) / insync_minor_adjustment_1);
// }
// else if(phy->slot_offset_filtered < -250)
// {
// // VNF is fast
// phy->insync_minor_adjustment = -(insync_minor_adjustment_1); //25;
// phy->insync_minor_adjustment_duration = (((phy->slot_offset_filtered) / -(insync_minor_adjustment_1)));
// }
// else
// {
// phy->insync_minor_adjustment = 0;
// }
if(phy->insync_minor_adjustment != 0)
{
// NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d slots (slot_offset_filtered:%d) %d %d %d NEW:%d CURR:%d adjustment:%d\n",
// phy->sfn, phy->slot, ind.header.phy_id,
// phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration,
// phy->slot_offset_filtered,
// insync_minor_adjustment_1, insync_minor_adjustment_2, phy->slot_offset_trend,
// NFAPI_SFNSLOT2DEC(new_sfn, new_slot),
// NFAPI_SFNSLOT2DEC(curr_sfn, curr_slot),
// phy->adjustment);
}
}
}
else
{
if (phy->in_sync)
{
if(phy->adjustment == 0)
{
}
else if(phy->adjustment > 0)
{
// VNF is slow
//if(phy->adjustment == 1)
{
//
if(phy->slot_offset_filtered > 250)
{
// VNF is slow
phy->insync_minor_adjustment = insync_minor_adjustment_2;
phy->insync_minor_adjustment_duration = 2 * ((phy->slot_offset_filtered - 250) / insync_minor_adjustment_2);
}
else if(phy->slot_offset_filtered < -250)
{
// VNF is fast
phy->insync_minor_adjustment = -(insync_minor_adjustment_2);
phy->insync_minor_adjustment_duration = 2 * ((phy->slot_offset_filtered + 250) / -(insync_minor_adjustment_2));
}
// if(phy->insync_minor_adjustment != 0)
// {
// // NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d slots (slot_offset_filtered:%d) %d %d %d NEW:%d CURR:%d adjustment:%d\n",
// // phy->sfn, phy->slot, ind.header.phy_id,
// // phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration,
// // phy->slot_offset_filtered,
// // insync_minor_adjustment_1, insync_minor_adjustment_2, phy->slot_offset_trend,
// // NFAPI_SFNSLOT2DEC(new_sfn, new_slot),
// // NFAPI_SFNSLOT2DEC(curr_sfn, curr_slot),
// // phy->adjustment);
// }
// }
// }
// else
// {
// if (phy->in_sync)
// {
// if(phy->adjustment == 0)
// {
// }
// else if(phy->adjustment > 0)
// {
// // VNF is slow
// //if(phy->adjustment == 1)
// {
// //
// if(phy->slot_offset_filtered > 250)
// {
// // VNF is slow
// phy->insync_minor_adjustment = insync_minor_adjustment_2;
// phy->insync_minor_adjustment_duration = 2 * ((phy->slot_offset_filtered - 250) / insync_minor_adjustment_2);
// }
// else if(phy->slot_offset_filtered < -250)
// {
// // VNF is fast
// phy->insync_minor_adjustment = -(insync_minor_adjustment_2);
// phy->insync_minor_adjustment_duration = 2 * ((phy->slot_offset_filtered + 250) / -(insync_minor_adjustment_2));
// }
}
//else
{
// out of sync?
}
// }
// //else
// {
// // out of sync?
// }
// NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d slots (adjustment:%d slot_offset_filtered:%d) %d %d %d NEW:%d CURR:%d adj:%d\n",
// phy->sfn, phy->slot, ind.header.phy_id,
// phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration, phy->adjustment, phy->slot_offset_filtered,
// insync_minor_adjustment_1, insync_minor_adjustment_2, phy->slot_offset_trend,
// NFAPI_SFNSLOT2DEC(new_sfn, new_slot),
// NFAPI_SFNSLOT2DEC(curr_sfn, curr_slot),
// phy->adjustment);
// // NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d slots (adjustment:%d slot_offset_filtered:%d) %d %d %d NEW:%d CURR:%d adj:%d\n",
// // phy->sfn, phy->slot, ind.header.phy_id,
// // phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration, phy->adjustment, phy->slot_offset_filtered,
// // insync_minor_adjustment_1, insync_minor_adjustment_2, phy->slot_offset_trend,
// // NFAPI_SFNSLOT2DEC(new_sfn, new_slot),
// // NFAPI_SFNSLOT2DEC(curr_sfn, curr_slot),
// // phy->adjustment);
}
else if(phy->adjustment < 0)
{
// VNF is fast
//if(phy->adjustment == -1)
{
//
if(phy->slot_offset_filtered > 250)
{
// VNF is slow
phy->insync_minor_adjustment = insync_minor_adjustment_2;
phy->insync_minor_adjustment_duration = 2 * ((phy->slot_offset_filtered - 250) / insync_minor_adjustment_2);
}
else if(phy->slot_offset_filtered < -250)
{
// VNF is fast
phy->insync_minor_adjustment = -(insync_minor_adjustment_2);
phy->insync_minor_adjustment_duration = 2 * ((phy->slot_offset_filtered + 250) / -(insync_minor_adjustment_2));
}
}
//else
{
// out of sync?
}
// }
// else if(phy->adjustment < 0)
// {
// // VNF is fast
// //if(phy->adjustment == -1)
// {
// //
// if(phy->slot_offset_filtered > 250)
// {
// // VNF is slow
// phy->insync_minor_adjustment = insync_minor_adjustment_2;
// phy->insync_minor_adjustment_duration = 2 * ((phy->slot_offset_filtered - 250) / insync_minor_adjustment_2);
// }
// else if(phy->slot_offset_filtered < -250)
// {
// // VNF is fast
// phy->insync_minor_adjustment = -(insync_minor_adjustment_2);
// phy->insync_minor_adjustment_duration = 2 * ((phy->slot_offset_filtered + 250) / -(insync_minor_adjustment_2));
// }
// }
// //else
// {
// // out of sync?
// }
// NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d slots (adjustment:%d slot_offset_filtered:%d) %d %d %d\n",
// phy->sfn, phy->slot, ind.header.phy_id,
// phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration, phy->adjustment, phy->slot_offset_filtered,
// insync_minor_adjustment_1, insync_minor_adjustment_2, phy->slot_offset_trend);
}
// // NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d slots (adjustment:%d slot_offset_filtered:%d) %d %d %d\n",
// // phy->sfn, phy->slot, ind.header.phy_id,
// // phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration, phy->adjustment, phy->slot_offset_filtered,
// // insync_minor_adjustment_1, insync_minor_adjustment_2, phy->slot_offset_trend);
// }
/*
if (phy->adjustment > 10 || phy->adjustment < -10)
{
phy->zero_count++; // Add one to the getting out of sync counter
}
else
{
phy->zero_count = 0; // Small error - zero the out of sync counter
}
// /*
// if (phy->adjustment > 10 || phy->adjustment < -10)
// {
// phy->zero_count++; // Add one to the getting out of sync counter
// }
// else
// {
// phy->zero_count = 0; // Small error - zero the out of sync counter
// }
if (phy->zero_count >= 10) // If we have had 10 consecutive large errors - drop out of sync
{
NFAPI_TRACE(NFAPI_TRACE_NOTE, "we have fallen out of sync...\n");
//pP7SockInfo->syncAchieved = 0;
}
*/
}
}
}
// if (phy->zero_count >= 10) // If we have had 10 consecutive large errors - drop out of sync
// {
// NFAPI_TRACE(NFAPI_TRACE_NOTE, "we have fallen out of sync...\n");
// //pP7SockInfo->syncAchieved = 0;
// }
// */
// }
// }
// }
if(phy->in_sync == 0)
{
/*NFAPI_TRACE(NFAPI_TRACE_NOTE, "***** Adjusting VNF phy_id:%d SFN/SF (%s) from %d to %d (%d) mode:%s zeroCount:%u sync:%s\n",
ind.header.phy_id, (phy->in_sync ? "via sfn" : "now"),
NFAPI_SFNSF2DEC(curr_sfn_sf), NFAPI_SFNSF2DEC(new_sfn_sf), phy->adjustment,
phy->filtered_adjust ? "FILTERED" : "ABSOLUTE",
phy->zero_count,
phy->in_sync ? "IN_SYNC" : "OUT_OF_SYNC");*/
// if(phy->in_sync == 0)
// {
// /*NFAPI_TRACE(NFAPI_TRACE_NOTE, "***** Adjusting VNF phy_id:%d SFN/SF (%s) from %d to %d (%d) mode:%s zeroCount:%u sync:%s\n",
// ind.header.phy_id, (phy->in_sync ? "via sfn" : "now"),
// NFAPI_SFNSF2DEC(curr_sfn_sf), NFAPI_SFNSF2DEC(new_sfn_sf), phy->adjustment,
// phy->filtered_adjust ? "FILTERED" : "ABSOLUTE",
// phy->zero_count,
// phy->in_sync ? "IN_SYNC" : "OUT_OF_SYNC");*/
phy->sfn = new_sfn;
phy->slot = new_slot;
}
}
// phy->sfn = new_sfn;
// phy->slot = new_slot;
// }
// }
// reset for next cycle
phy->previous_slot_offset_filtered = phy->slot_offset_filtered;
phy->min_sync_cycle_count = 2;
phy->slot_offset_filtered = 0;
phy->slot_offset = 0;
}
else
{
phy->previous_t1 = ind.t1;
phy->previous_t2 = ind.t2;
}
}
// // reset for next cycle
// phy->previous_slot_offset_filtered = phy->slot_offset_filtered;
// phy->min_sync_cycle_count = 2;
// phy->slot_offset_filtered = 0;
// phy->slot_offset = 0;
// }
// else
// {
// phy->previous_t1 = ind.t1;
// phy->previous_t2 = ind.t2;
// }
}
void vnf_handle_timing_info(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
{
@@ -2035,46 +2141,26 @@ void vnf_nr_dispatch_p7_message(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7
vnf_nr_handle_timing_info(pRecvMsg, recvMsgLen, vnf_p7);
break;
case NFAPI_HARQ_INDICATION:
vnf_handle_harq_indication(pRecvMsg, recvMsgLen, vnf_p7);
case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
vnf_handle_nr_rx_data_indication(pRecvMsg, recvMsgLen, vnf_p7);
break;
case NFAPI_CRC_INDICATION:
vnf_handle_crc_indication(pRecvMsg, recvMsgLen, vnf_p7);
case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION:
vnf_handle_nr_crc_indication(pRecvMsg, recvMsgLen, vnf_p7);
break;
case NFAPI_RX_ULSCH_INDICATION:
vnf_handle_rx_ulsch_indication(pRecvMsg, recvMsgLen, vnf_p7);
case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION:
vnf_handle_nr_uci_indication(pRecvMsg, recvMsgLen, vnf_p7);
break;
case NFAPI_RACH_INDICATION:
vnf_handle_rach_indication(pRecvMsg, recvMsgLen, vnf_p7);
case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION:
vnf_handle_nr_rach_indication(pRecvMsg, recvMsgLen, vnf_p7);
break;
case NFAPI_SRS_INDICATION:
vnf_handle_srs_indication(pRecvMsg, recvMsgLen, vnf_p7);
case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION:
vnf_handle_nr_srs_indication(pRecvMsg, recvMsgLen, vnf_p7);
break;
case NFAPI_RX_SR_INDICATION:
vnf_handle_rx_sr_indication(pRecvMsg, recvMsgLen, vnf_p7);
break;
case NFAPI_RX_CQI_INDICATION:
vnf_handle_rx_cqi_indication(pRecvMsg, recvMsgLen, vnf_p7);
break;
case NFAPI_LBT_DL_INDICATION:
vnf_handle_lbt_dl_indication(pRecvMsg, recvMsgLen, vnf_p7);
break;
case NFAPI_NB_HARQ_INDICATION:
vnf_handle_nb_harq_indication(pRecvMsg, recvMsgLen, vnf_p7);
break;
case NFAPI_NRACH_INDICATION:
vnf_handle_nrach_indication(pRecvMsg, recvMsgLen, vnf_p7);
break;
case NFAPI_UE_RELEASE_RESPONSE:
vnf_handle_ue_release_resp(pRecvMsg, recvMsgLen, vnf_p7);
break;
@@ -430,18 +430,6 @@ struct timespec current_time;
}
send_mac_slot_indications(vnf_p7);
// // Call the scheduler
// struct PHY_VARS_gNB_s *gNB = RC.gNB[0];
// 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);
}
else if(selectRetval > 0)
{