Skip to content
Snippets Groups Projects
open-nfapi.oai.patch 895 KiB
Newer Older
1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000
 		
 		nfapi_rx_indication_pdu_t pdus[rx_ind.rx_indication_body.number_of_pdus];
 		memset(&pdus, 0, sizeof(pdus));
 		
+                strcpy((char*)rx_data, (char*)"123456789");
+
 		for(int i = 0; i < rx_ind.rx_indication_body.number_of_pdus;++i)
 		{
 		
@@ -1142,13 +1144,13 @@ int fapi_rx_ulsch_ind(fapi_t* fapi, fapi_rx_ulsch_ind_t* ind)
 			pdus[i].rx_ue_information.rnti = rand_range(1, 65535);
 			
 			pdus[i].rx_indication_rel8.tl.tag = NFAPI_RX_INDICATION_REL8_TAG;
-			pdus[i].rx_indication_rel8.length = rand_range(0, 1024);
-			pdus[i].rx_indication_rel8.offset = 1;
+			pdus[i].rx_indication_rel8.length = 10;//rand_range(0, 1024);
+			pdus[i].rx_indication_rel8.offset = 0;//djp - 1;
 			pdus[i].rx_indication_rel8.ul_cqi = rand_range(0, 255);
 			pdus[i].rx_indication_rel8.timing_advance = rand_range(0, 63);
 			
-			pdus[i].rx_indication_rel9.tl.tag = NFAPI_RX_INDICATION_REL9_TAG;
-			pdus[i].rx_indication_rel9.timing_advance_r9 = rand_range(0, 7690);
+			//pdus[i].rx_indication_rel9.tl.tag = NFAPI_RX_INDICATION_REL9_TAG;
+			//pdus[i].rx_indication_rel9.timing_advance_r9 = rand_range(0, 7690);
 			
 			pdus[i].data = &rx_data[0];
 		}
diff --git a/vnf/inc/vnf_p7.h b/vnf/inc/vnf_p7.h
index ab9a335..fc2ab4e 100644
--- a/vnf/inc/vnf_p7.h
+++ b/vnf/inc/vnf_p7.h
@@ -116,7 +116,8 @@ typedef struct {
 	
 } vnf_p7_t;
 
-uint32_t get_current_time_hr();
+uint32_t vnf_get_current_time_hr(void);
+
 uint16_t increment_sfn_sf(uint16_t sfn_sf);
 int vnf_sync(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* p7_info);
 int send_mac_subframe_indications(vnf_p7_t* config);
diff --git a/vnf/public_inc/nfapi_vnf_interface.h b/vnf/public_inc/nfapi_vnf_interface.h
index 6659e5d..4629013 100644
--- a/vnf/public_inc/nfapi_vnf_interface.h
+++ b/vnf/public_inc/nfapi_vnf_interface.h
@@ -450,7 +450,7 @@ typedef struct nfapi_vnf_config
 /*! Creates and initialise the vnf config structure before use
  * \return A pointer to a vnf config structure
  */
-nfapi_vnf_config_t* nfapi_vnf_config_create();
+nfapi_vnf_config_t* nfapi_vnf_config_create(void);
 
 /*! Delete an vnf config
  */
@@ -864,7 +864,7 @@ typedef struct nfapi_vnf_p7_config
 /*! Creates and initializes the nfapi_vnf_p7_config structure before use
  *  \return A pointer to an allocated vnf p7 configuration
  */
-nfapi_vnf_p7_config_t* nfapi_vnf_p7_config_create();
+nfapi_vnf_p7_config_t* nfapi_vnf_p7_config_create(void);
 
 /*! Cleanup and delete nfapi_vnf_p7_config structure
  *  \param config A pointer to an vnf p7 configuration structure
diff --git a/vnf/src/vnf.c b/vnf/src/vnf.c
index fea3cf7..6800ee2 100644
--- a/vnf/src/vnf.c
+++ b/vnf/src/vnf.c
@@ -82,11 +82,18 @@ void nfapi_vnf_pnf_list_add(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* no
 
 nfapi_vnf_pnf_info_t* nfapi_vnf_pnf_list_find(nfapi_vnf_config_t* config, int p5_idx)
 {
+	NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s : config->pnf_list:%p\n", __FUNCTION__, config->pnf_list);
+
 	nfapi_vnf_pnf_info_t* curr = config->pnf_list;
 	while(curr != 0)
 	{
 		if(curr->p5_idx == p5_idx)
+                {
+                  NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s : curr->p5_idx:%d p5_idx:%d\n", __FUNCTION__, curr->p5_idx, p5_idx);
 			return curr;
+                        }
+
+                NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s : curr->next:%p\n", __FUNCTION__, curr->next);
 
 		curr = curr->next;
 	}
diff --git a/vnf/src/vnf_interface.c b/vnf/src/vnf_interface.c
index e559730..0aba0a2 100644
--- a/vnf/src/vnf_interface.c
+++ b/vnf/src/vnf_interface.c
@@ -342,6 +342,7 @@ int nfapi_vnf_start(nfapi_vnf_config_t* config)
 				{
 					NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF connection (fd:%d) accepted from %s:%d \n", p5Sock,  inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
 					nfapi_vnf_pnf_info_t* pnf = (nfapi_vnf_pnf_info_t*)malloc(sizeof(nfapi_vnf_pnf_info_t));
+					NFAPI_TRACE(NFAPI_TRACE_INFO, "MALLOC nfapi_vnf_pnf_info_t for pnf_list pnf:%p\n", pnf);
 					memset(pnf, 0, sizeof(nfapi_vnf_pnf_info_t));
 					pnf->p5_sock = p5Sock;
 					pnf->p5_idx = p5_idx++;
@@ -663,7 +664,7 @@ int nfapi_vnf_allocate_phy(nfapi_vnf_config_t* config, int p5_idx, uint16_t* phy
 	info->p5_idx = p5_idx;
 	info->phy_id = vnf->next_phy_id++;
 
-	info->timing_window = 10;
+	info->timing_window = 30;       // This seems to override what gets set by the user - why???
 	info->timing_info_mode = 0x03;
 	info->timing_info_period = 128;
 
diff --git a/vnf/src/vnf_p7.c b/vnf/src/vnf_p7.c
index 8630385..1304176 100644
--- a/vnf/src/vnf_p7.c
+++ b/vnf/src/vnf_p7.c
@@ -15,6 +15,8 @@
  */
 
 
+#include <time.h>
+
 #include <sys/time.h>
 #include <stdlib.h>
 #include <string.h>
@@ -159,7 +161,7 @@ vnf_p7_rx_message_t* vnf_p7_rx_reassembly_queue_add_segment(vnf_p7_t* vnf_p7, vn
 		msg->sequence_number = sequence_number;
 		msg->num_segments_expected = m ? 255 : segment_number + 1;
 		msg->num_segments_received = 1;
-		msg->rx_hr_time = get_current_time_hr();
+		msg->rx_hr_time = vnf_get_current_time_hr();
 
 		msg->segments[segment_number].buffer = (uint8_t*)vnf_p7_malloc(vnf_p7, data_len);
 		memcpy(msg->segments[segment_number].buffer, data, data_len);
@@ -216,7 +218,7 @@ void vnf_p7_rx_reassembly_queue_remove_old_msgs(vnf_p7_t* vnf_p7, vnf_p7_rx_reas
 	vnf_p7_rx_message_t* iterator = queue->msg_queue;
 	vnf_p7_rx_message_t* previous = 0;
 
-	uint32_t rx_hr_time = get_current_time_hr();
+	uint32_t rx_hr_time = vnf_get_current_time_hr();
 
 	while(iterator != 0)
 	{
@@ -254,7 +256,7 @@ void vnf_p7_rx_reassembly_queue_remove_old_msgs(vnf_p7_t* vnf_p7, vnf_p7_rx_reas
 	}
 }
 
-uint32_t get_current_time_hr()
+uint32_t vnf_get_current_time_hr()
 {
 	struct timeval now;
 	(void)gettimeofday(&now, NULL);
@@ -297,7 +299,7 @@ struct timespec timespec_delta(struct timespec start, struct timespec end)
 	return temp;
 }
 
-uint32_t get_sf_time(uint32_t now_hr, uint32_t sf_start_hr)
+static uint32_t get_sf_time(uint32_t now_hr, uint32_t sf_start_hr)
 {
 	if(now_hr < sf_start_hr)
 	{
@@ -321,7 +323,7 @@ uint32_t get_sf_time(uint32_t now_hr, uint32_t sf_start_hr)
 
 uint32_t calculate_t1(uint16_t sfn_sf, uint32_t sf_start_time_hr)
 {
-	uint32_t now_time_hr = get_current_time_hr();
+	uint32_t now_time_hr = vnf_get_current_time_hr();
 
 	uint32_t sf_time_us = get_sf_time(now_time_hr, sf_start_time_hr);
 
@@ -344,7 +346,7 @@ uint32_t calculate_t4(uint32_t now_time_hr, uint16_t sfn_sf, uint32_t sf_start_t
 
 uint32_t calculate_transmit_timestamp(uint16_t sfn_sf, uint32_t sf_start_time_hr)
 {
-	uint32_t now_time_hr = get_current_time_hr();
+	uint32_t now_time_hr = vnf_get_current_time_hr();
 
 	uint32_t sf_time_us = get_sf_time(now_time_hr, sf_start_time_hr);
 
@@ -410,6 +412,8 @@ int vnf_p7_pack_and_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_p7_message_header_t* hea
 		
 		int len = nfapi_p7_message_pack(header, buffer, sizeof(buffer), &vnf_p7->_public.codec_config);
 		
+                //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() phy_id:%d nfapi_p7_message_pack()=len=%d vnf_p7->_public.segment_size:%u\n", __FUNCTION__, header->phy_id, len, vnf_p7->_public.segment_size);
+
 		if(len < 0) 
 		{
 			NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() failed to pack p7 message phy_id:%d\n", __FUNCTION__, header->phy_id);
@@ -429,6 +433,7 @@ int vnf_p7_pack_and_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_p7_message_header_t* hea
 			int segment = 0;
 			int offset = NFAPI_P7_HEADER_LENGTH;
 			uint8_t tx_buffer[vnf_p7->_public.segment_size];
+                        NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() MORE THAN ONE SEGMENT phy_id:%d nfapi_p7_message_pack()=len=%d vnf_p7->_public.segment_size:%u\n", __FUNCTION__, header->phy_id, len, vnf_p7->_public.segment_size);
 			for(segment = 0; segment < segment_count; ++segment)
 			{
 				uint8_t last = 0;
@@ -851,7 +856,7 @@ void vnf_handle_p7_vendor_extension(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vn
 
 void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
 {
-	uint32_t now_time_hr = get_current_time_hr();
+	uint32_t now_time_hr = vnf_get_current_time_hr();
 
 	if (pRecvMsg == NULL || vnf_p7  == NULL)
 	{
@@ -871,7 +876,7 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
 	nfapi_vnf_p7_connection_info_t* phy = vnf_p7_connection_info_list_find(vnf_p7, ind.header.phy_id);
 	uint32_t t4 = calculate_t4(now_time_hr, phy->sfn_sf, vnf_p7->sf_start_time_hr);
 
-	uint32_t tx_2_rx = t4 - ind.t1;
+	uint32_t tx_2_rx = t4>ind.t1 ? t4 - ind.t1 : t4 + NFAPI_MAX_SFNSFDEC - ind.t1 ;
 	uint32_t pnf_proc_time = ind.t3 - ind.t2;
 
 	// divide by 2 using shift operator
@@ -881,7 +886,7 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
 	{
 		phy->latency[phy->min_sync_cycle_count] = latency;
 
-		NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%d/%d) PNF to VNF !sync phy_id:%d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d\n",
+		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",
 				NFAPI_SFNSF2SFN(phy->sfn_sf), NFAPI_SFNSF2SF(phy->sfn_sf), ind.header.phy_id, ind.t1, ind.t2, ind.t3, t4, 
 				tx_2_rx, pnf_proc_time, latency);
 	}
@@ -923,15 +928,27 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
 
 		if(1)
 		{
-			NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%1d) PNF to VNF phy_id:%2d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d offset(us):%8d filtered(us):%8d wrap[t1:%u t2:%u]\n", 
-					NFAPI_SFNSF2SFN(phy->sfn_sf), NFAPI_SFNSF2SF(phy->sfn_sf), ind.header.phy_id,
+                  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", 
+					NFAPI_SFNSF2SFN(phy->sfn_sf), NFAPI_SFNSF2SF(phy->sfn_sf), 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->sf_offset, phy->sf_offset_filtered,
+					tx_2_rx, pnf_proc_time, latency, phy->average_latency, phy->sf_offset, phy->sf_offset_filtered,
 					(ind.t1<phy->previous_t1), (ind.t2<phy->previous_t2));
 		}
 
 	}
 
+        if (phy->filtered_adjust && (phy->sf_offset_filtered > 1e6 || phy->sf_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->sf_offset_filtered:%d\n", __FUNCTION__, phy->sf_offset_filtered);
+        }
+
 	if(phy->min_sync_cycle_count)
 		phy->min_sync_cycle_count--;
 
@@ -954,7 +971,6 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
 			phy->sf_offset = ind.t2 - (ind.t1 - phy->average_latency);
 
 			sfn_sf_dec += (phy->sf_offset / 1000);
-
 		}
 		else
 		{
@@ -976,12 +992,11 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
 		{
 			phy->adjustment = NFAPI_SFNSF2DEC(new_sfn_sf) - NFAPI_SFNSF2DEC(curr_sfn_sf);
 
-			//NFAPI_TRACE(NFAPI_TRACE_NOTE, "PNF to VNF phy_id:%d adjustment%d\n", ind.header.phy_id, phy->adjustment);
+			NFAPI_TRACE(NFAPI_TRACE_NOTE, "PNF to VNF phy_id:%d adjustment%d phy->previous_sf_offset_filtered:%d phy->previous_sf_offset_filtered:%d phy->sf_offset_trend:%d\n", ind.header.phy_id, phy->adjustment, phy->previous_sf_offset_filtered, phy->previous_sf_offset_filtered, phy->sf_offset_trend);
 
 			phy->previous_t1 = 0;
 			phy->previous_t2 = 0;
 
-
 			if(phy->previous_sf_offset_filtered > 0)
 			{
 				if( phy->sf_offset_filtered > phy->previous_sf_offset_filtered)
@@ -1083,9 +1098,14 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
 
 						if(phy->insync_minor_adjustment != 0)
 						{
-							NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d suframes (sf_offset_filtered:%d) %d %d %d\n", 
+							NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d subframes (sf_offset_filtered:%d) %d %d %d NEW:%d CURR:%d adjustment:%d\n", 
 										NFAPI_SFNSF2SFN(phy->sfn_sf), NFAPI_SFNSF2SF(phy->sfn_sf), ind.header.phy_id,
-										phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration, phy->sf_offset_filtered, insync_minor_adjustment_1, insync_minor_adjustment_2, phy->sf_offset_trend); 
+										phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration, 
+                                                                                phy->sf_offset_filtered, 
+                                                                                insync_minor_adjustment_1, insync_minor_adjustment_2, phy->sf_offset_trend,
+                                                                                NFAPI_SFNSF2DEC(new_sfn_sf),
+                                                                                NFAPI_SFNSF2DEC(curr_sfn_sf),
+                                                                                phy->adjustment); 
 						}
 					}
 				}
@@ -1121,10 +1141,13 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
 								// out of sync?
 							}
 							
-							NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d suframes (adjusment:%d sf_offset_filtered:%d) %d %d %d\n", 
+							NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d subframes (adjustment:%d sf_offset_filtered:%d) %d %d %d NEW:%d CURR:%d adj:%d\n", 
 										NFAPI_SFNSF2SFN(phy->sfn_sf), NFAPI_SFNSF2SF(phy->sfn_sf), ind.header.phy_id,
 										phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration, phy->adjustment, phy->sf_offset_filtered,
-										insync_minor_adjustment_1, insync_minor_adjustment_2, phy->sf_offset_trend); 
+										insync_minor_adjustment_1, insync_minor_adjustment_2, phy->sf_offset_trend,
+                                                                                NFAPI_SFNSF2DEC(new_sfn_sf),
+                                                                                NFAPI_SFNSF2DEC(curr_sfn_sf),
+                                                                                phy->adjustment); 
 							
 						}
 						else if(phy->adjustment < 0)
@@ -1151,7 +1174,7 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
 								// out of sync?
 							}
 
-							NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d suframes (adjusment:%d sf_offset_filtered:%d) %d %d %d\n", 
+							NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d subframes (adjustment:%d sf_offset_filtered:%d) %d %d %d\n", 
 										NFAPI_SFNSF2SFN(phy->sfn_sf), NFAPI_SFNSF2SF(phy->sfn_sf), ind.header.phy_id,
 										phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration, phy->adjustment, phy->sf_offset_filtered,
 										insync_minor_adjustment_1, insync_minor_adjustment_2, phy->sf_offset_trend); 
@@ -1219,7 +1242,16 @@ void vnf_handle_timing_info(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
 		return;
 	}
 
-	// todo : how to use this?
+        if (vnf_p7 && vnf_p7->p7_connections)
+        {
+          int16_t vnf_pnf_sfnsf_delta = NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf) - NFAPI_SFNSF2DEC(ind.last_sfn_sf);
+
+          //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);
+          if (vnf_pnf_sfnsf_delta>1 || vnf_pnf_sfnsf_delta < -1)
+          {
+            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_sfnsf_delta, NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf), NFAPI_SFNSF2DEC(ind.last_sfn_sf));
+          }
+        }
 }
 
 void vnf_dispatch_p7_message(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
diff --git a/vnf/src/vnf_p7_interface.c b/vnf/src/vnf_p7_interface.c
index ab4f00c..a35d8e3 100644
--- a/vnf/src/vnf_p7_interface.c
+++ b/vnf/src/vnf_p7_interface.c
@@ -142,6 +142,7 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
 	NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 bind succeeded...\n");
 
 
+	//struct timespec original_pselect_timeout;
 	struct timespec pselect_timeout;
 	pselect_timeout.tv_sec = 0;
 	pselect_timeout.tv_nsec = 1000000; // ns in a 1 us
@@ -157,13 +158,13 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
 
 	struct timespec sf_duration;
 	sf_duration.tv_sec = 0;
-	sf_duration.tv_nsec = 1000000; // ns in a 1 us
+	sf_duration.tv_nsec = 1e6; // We want 1ms pause
 
 	struct timespec sf_start;
 	clock_gettime(CLOCK_MONOTONIC, &sf_start);
 	long millisecond = sf_start.tv_nsec / 1e6;
 	sf_start = timespec_add(sf_start, sf_duration);
-	//NFAPI_TRACE(NFAPI_TRACE_INFO, "next subframe will start at %d.%d\n", sf_start.tv_sec, sf_start.tv_nsec);
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "next subframe will start at %d.%d\n", sf_start.tv_sec, sf_start.tv_nsec);
 
 	while(vnf_p7->terminate == 0)
 	{
@@ -181,6 +182,8 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
 
 		if((last_millisecond == -1) || (millisecond == last_millisecond) || (millisecond == (last_millisecond + 1) % 1000) )
 		{
+                  //NFAPI_TRACE(NFAPI_TRACE_INFO, "pselect_start:%d.%d sf_start:%d.%d\n", pselect_start.tv_sec, pselect_start.tv_nsec, sf_start.tv_sec, sf_start.tv_nsec);
+
 
 			if((pselect_start.tv_sec > sf_start.tv_sec) || 
 			   ((pselect_start.tv_sec == sf_start.tv_sec) && (pselect_start.tv_nsec > sf_start.tv_nsec)))
@@ -196,16 +199,26 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
 			{
 				// still time before the end of the subframe wait
 				pselect_timeout = timespec_sub(sf_start, pselect_start);
+
+#if 0
+                                NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() sf_start:%d.%ld pselect_start:%d.%ld pseclect_timeout:%d.%ld\n",
+                                    __FUNCTION__,
+                                    sf_start.tv_sec, sf_start.tv_nsec,
+                                    pselect_start.tv_sec, pselect_start.tv_nsec,
+                                    pselect_timeout.tv_sec, pselect_timeout.tv_nsec);
+#endif
 			}
 
+//original_pselect_timeout = pselect_timeout;
+
 			// detemine how long to sleep in ns before the start of the next 1ms
 			//pselect_timeout.tv_nsec = 1e6 - (pselect_start.tv_nsec % 1000000);
 
-			//uint8_t underun_possiable =0;
+			//uint8_t underrun_possible =0;
 			
 			// if we are not sleeping until the next milisecond due to the
 			// insycn minor adjment flag it so we don't consider it an error
-			//uint8_t underun_possiable =0;
+			//uint8_t underrun_possible =0;
 			/*
 			{
 				nfapi_vnf_p7_connection_info_t* phy = vnf_p7->p7_connections;
@@ -222,7 +235,7 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
 							pselect_timeout.tv_nsec = pselect_timeout.tv_nsec - (phy->insync_minor_adjustment * 1000);
 
 
-						//underun_possiable = 1;
+						//underrun_possible = 1;
 					}
 					else if(phy->insync_minor_adjustment < 0)
 					{
@@ -237,41 +250,98 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
 			*/
 			
 
+//long wraps = pselect_timeout.tv_nsec % 1e9;
+
+
 			selectRetval = pselect(maxSock+1, &rfds, NULL, NULL, &pselect_timeout, NULL);
 
 			clock_gettime(CLOCK_MONOTONIC, &pselect_stop);
 
+                        nfapi_vnf_p7_connection_info_t* phy = vnf_p7->p7_connections;
+
+if (selectRetval==-1 && errno == 22)
+{
+  NFAPI_TRACE(NFAPI_TRACE_ERROR, "INVAL: pselect_timeout:%d.%ld adj[dur:%d adj:%d], sf_dur:%d.%ld\n", 
+  pselect_timeout.tv_sec, pselect_timeout.tv_nsec, 
+  phy->insync_minor_adjustment_duration, phy->insync_minor_adjustment, 
+  sf_duration.tv_sec, sf_duration.tv_nsec);
+}
+#if 0
+                        if (selectRetval != 0 || phy->insync_minor_adjustment_duration != 0)
+                          NFAPI_TRACE(NFAPI_TRACE_NOTE, "pselect()=%d maxSock:%d vnf_p7->socket:%d pselect_timeout:%u.%u original_pselect_timeout:%u.%u\n", 
+                              selectRetval, maxSock, vnf_p7->socket, pselect_timeout.tv_sec, pselect_timeout.tv_nsec,
+                              original_pselect_timeout.tv_sec, original_pselect_timeout.tv_nsec);
+#endif
+
 			if(selectRetval == 0)
 			{
-				// calcualte the start of the next subframe
+				// calculate the start of the next subframe
 				sf_start = timespec_add(sf_start, sf_duration);
 				//NFAPI_TRACE(NFAPI_TRACE_INFO, "next subframe will start at %d.%d\n", sf_start.tv_sec, sf_start.tv_nsec);
 
-				nfapi_vnf_p7_connection_info_t* phy = vnf_p7->p7_connections;
 				if(phy && phy->in_sync && phy->insync_minor_adjustment != 0 && phy->insync_minor_adjustment_duration > 0)
 				{
-					NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] Subframe minor adjustment %dus\n", phy->insync_minor_adjustment);
+                                        long insync_minor_adjustment_ns = (phy->insync_minor_adjustment * 1000);
+
+                                        sf_start.tv_nsec -= insync_minor_adjustment_ns;
+
+#if 1
+                                        if (sf_start.tv_nsec > 1e9)
+                                        {
+                                          sf_start.tv_sec++;
+                                          sf_start.tv_nsec-=1e9;
+                                        }
+                                        else if (sf_start.tv_nsec < 0)
+                                        {
+                                          sf_start.tv_sec--;
+                                          sf_start.tv_nsec+=1e9;
+                                        }
+#else
+                                        //NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] BEFORE adjustment - Subframe minor adjustment %dus sf_start.tv_nsec:%d\n", phy->insync_minor_adjustment, sf_start.tv_nsec);
 					if(phy->insync_minor_adjustment > 0)
 					{
 						// decrease the subframe duration a little
-						sf_start.tv_nsec = sf_start.tv_nsec - (phy->insync_minor_adjustment * 1000);
+                                                if (sf_start.tv_nsec > insync_minor_adjustment_ns)
+                                                  sf_start.tv_nsec -= insync_minor_adjustment_ns;
+                                                else
+                                                {
+                                                  NFAPI_TRACE(NFAPI_TRACE_ERROR, "[VNF] Adjustment would make it negative sf:%d.%ld adjust:%ld\n\n\n", sf_start.tv_sec, sf_start.tv_nsec, insync_minor_adjustment_ns);
+                                                  sf_start.tv_sec--;
+                                                  sf_start.tv_nsec += 1e9 - insync_minor_adjustment_ns;
+                                                }
 					}
 					else if(phy->insync_minor_adjustment < 0)
 					{
 						// todo check we don't go below 0
 						// increase the subframe duration a little
-						sf_start.tv_nsec = sf_start.tv_nsec - (phy->insync_minor_adjustment * 1000);
+						sf_start.tv_nsec += insync_minor_adjustment_ns;
+
+                                                if (sf_start.tv_nsec < 0)
+                                                {
+                                                  NFAPI_TRACE(NFAPI_TRACE_ERROR, "[VNF] OVERFLOW %d.%ld\n\n\n\n", sf_start.tv_sec, sf_start.tv_nsec);
+                                                  sf_start.tv_sec++;
+                                                  sf_start.tv_nsec += 1e9;
+                                                }
 					}
+#endif
 
 					//phy->insync_minor_adjustment = 0;
-					phy->insync_minor_adjustment_duration--;
+                                        phy->insync_minor_adjustment_duration--;
+
+                                        NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] AFTER adjustment - Subframe minor adjustment %dus sf_start.tv_nsec:%d duration:%u\n", 
+                                            phy->insync_minor_adjustment, sf_start.tv_nsec, phy->insync_minor_adjustment_duration);
+
+                                        if (phy->insync_minor_adjustment_duration==0)
+                                        {
+                                          phy->insync_minor_adjustment = 0;
+                                        }
 				}
 				/*
 				long pselect_stop_millisecond = pselect_stop.tv_nsec / 1e6;
 				if(millisecond == pselect_stop_millisecond)
 				{
 					// we have woke up in the same subframe
-					if(underun_possiable == 0)
+					if(underrun_possible == 0)
 						NFAPI_TRACE(NFAPI_TRACE_WARN, "subframe pselect underrun %ld (%d.%d)\n", millisecond, pselect_stop.tv_sec, pselect_stop.tv_nsec);
 				}
 				else if(((millisecond + 1) % 1000) != pselect_stop_millisecond)
@@ -298,7 +368,7 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
 
 		if(selectRetval == 0)
 		{
-			vnf_p7->sf_start_time_hr = get_current_time_hr();
+			vnf_p7->sf_start_time_hr = vnf_get_current_time_hr();
 
 			// pselect timed out
 			nfapi_vnf_p7_connection_info_t* curr = vnf_p7->p7_connections;
@@ -326,14 +396,18 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
 		else
 		{
 			// pselect error
-			if(selectRetval == EINTR)
+			if(selectRetval == -1 && errno == EINTR)
 			{
 				// a sigal was received.
 			}
 			else
 			{
-				NFAPI_TRACE(NFAPI_TRACE_INFO, "P7 select failed result %d errno %d timeout:%d.%d\n", selectRetval, errno, pselect_timeout.tv_sec, pselect_timeout.tv_nsec);
+				NFAPI_TRACE(NFAPI_TRACE_INFO, "P7 select failed result %d errno %d timeout:%d.%d orginal:%d.%d last_ms:%ld ms:%ld\n", selectRetval, errno, pselect_timeout.tv_sec, pselect_timeout.tv_nsec, pselect_timeout.tv_sec, pselect_timeout.tv_nsec, last_millisecond, millisecond);
 				// should we exit now?
+                                if (selectRetval == -1 && errno == 22) // invalid argument??? not sure about timeout duration
+                                {
+                                  usleep(100000);
+                                }
 			}
 		}
 
@@ -360,10 +434,12 @@ int nfapi_vnf_p7_stop(nfapi_vnf_p7_config_t* config)
 
 int nfapi_vnf_p7_add_pnf(nfapi_vnf_p7_config_t* config, const char* pnf_p7_addr, int pnf_p7_port, int phy_id)
 {
-	NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(phy_id:%d pnf_addr:%s:%d)\n", __FUNCTION__, phy_id,  pnf_p7_addr, pnf_p7_port);
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(config:%p phy_id:%d pnf_addr:%s pnf_p7_port:%d)\n", __FUNCTION__, config, phy_id,  pnf_p7_addr, pnf_p7_port);
 
 	if(config == 0)
-		return -1;
+        {
+          return -1;
+        }
 
 	vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
 
@@ -411,6 +487,8 @@ int nfapi_vnf_p7_del_pnf(nfapi_vnf_p7_config_t* config, int phy_id)
 }
 int nfapi_vnf_p7_dl_config_req(nfapi_vnf_p7_config_t* config, nfapi_dl_config_request_t* req)
 {
+	//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(config:%p req:%p)\n", __FUNCTION__, config, req);
+
 	if(config == 0 || req == 0)
 		return -1;
 
diff --git a/vnf_sim/src/mac.cpp b/vnf_sim/src/mac.cpp
index aa97f72..fa6f487 100644
--- a/vnf_sim/src/mac.cpp
+++ b/vnf_sim/src/mac.cpp
@@ -743,7 +743,7 @@ extern "C"
 			{
 				cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.number_of_cc = 1;
 				cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size = rand_range(0, 3);
-				cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].dl_cqi_pmi_size = rand_range(0, 255);
+				cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].dl_cqi_pmi_size[0] = rand_range(0, 255);
 			}
 			
 			cqi_ri_information.cqi_ri_information_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL13_TAG;
diff --git a/vnf_sim/src/main.cpp b/vnf_sim/src/main.cpp
index b79ac40..5dc7161 100644
--- a/vnf_sim/src/main.cpp
+++ b/vnf_sim/src/main.cpp
@@ -428,6 +428,20 @@ void phy_deallocate_p7_vendor_ext(nfapi_p7_message_header_t* header)
 	free(header);
 }
 
+//static pthread_t vnf_start_pthread;
+static pthread_t vnf_p7_start_pthread;
+void* vnf_p7_start_thread(void *ptr)
+{
+  printf("%s()\n", __FUNCTION__);
+
+  //std::shared_ptr<nfapi_vnf_p7_config> config = std::shared_ptr<nfapi_vnf_p7_config>(ptr);
+  nfapi_vnf_p7_config_t *config = (nfapi_vnf_p7_config_t *)ptr;
+
+  nfapi_vnf_p7_start(config);
+
+  return 0;
+}
+
 void set_thread_priority(int priority)
 {
 	//printf("%s(priority:%d)\n", __FUNCTION__, priority);
@@ -458,6 +472,8 @@ void set_thread_priority(int priority)
 
 void* vnf_p7_thread_start(void* ptr)
 {
+  printf("%s()\n", __FUNCTION__);
+
 	set_thread_priority(79);
 
 	vnf_p7_info* p7_vnf = (vnf_p7_info*)ptr;
@@ -494,10 +510,10 @@ void* vnf_p7_thread_start(void* ptr)
 	p7_vnf->config->allocate_p7_vendor_ext = &phy_allocate_p7_vendor_ext;
 	p7_vnf->config->deallocate_p7_vendor_ext = &phy_deallocate_p7_vendor_ext;
 
-	nfapi_vnf_p7_start(p7_vnf->config.get());
+        printf("[VNF] Creating VNF NFAPI start thread %s\n", __FUNCTION__);
+        pthread_create(&vnf_p7_start_pthread, NULL, &vnf_p7_start_thread, p7_vnf->config.get());
 
 	return 0;
-
 }
 
 int pnf_connection_indication_cb(nfapi_vnf_config_t* config, int p5_idx)
diff --git a/wireshark/packet-nfapi.c b/wireshark/packet-nfapi.c
index da0edb0..7e0f23f 100755
--- a/wireshark/packet-nfapi.c
+++ b/wireshark/packet-nfapi.c
@@ -1,6069 +1,12284 @@
-/*
+/* packet-nfapi.c
+* Routines for Network Function Application Platform Interface (nFAPI) dissection
 * 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
+* Wireshark - Network traffic analyzer
+* By Gerald Combs <gerald@wireshark.org>
+* Copyright 1998 Gerald Combs
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
-* http://www.apache.org/licenses/LICENSE-2.0
+* References:
+* SCF082.09.04  http://scf.io/en/documents/082_-_nFAPI_and_FAPI_specifications.php
 *
-* 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 "config.h" 
-
-#include <windows.h>
-#include <stdio.h>
-#include <stdint.h>
-
-#include <epan/packet.h>
-#include <epan/exceptions.h>
-#include <epan/prefs.h>
-#include <epan/expert.h>
-#include <epan/reassemble.h>
-
+
+#include "config.h"
+
+#include <epan/packet.h>
+#include <epan/exceptions.h>
+#include <epan/expert.h>
+#include <epan/reassemble.h>
+#include <epan/wmem/wmem.h>
+
+#include <ptvcursor.h>
+
+void proto_register_nfapi(void);
+void proto_reg_handoff_nfapi(void);
+
 #define NFAPI_HEADER_LENGTH 8
-#define NFAPI_P7_HEADER_LENGTH 16
-
-typedef int(*Decode_operation)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset);
-
-static const value_string nfapi_error_vals[] = {
-	{ 0x0, "MSG_OK" },
-	{ 0x1, "MSG_INVALID_STATE" },
-	{ 0x2, "MSG_INVALID_CONFIG" },
-	{ 0x3, "SFN_OUT_OF_SYNC" },
-	{ 0x4, "MSG_SUBFRAME_ERR" },
-	{ 0x5, "MSG_BCH_MISSING" },
-	{ 0x6, "MSG_BCH_MISSING" },
-	{ 0x7, "MSG_HI_ERR" },
-	{ 0x8, "MSG_TX_ERR" },
-	{ 0, NULL },
-};
-
-static const value_string nfapi_p4_error_vals[] = {
-	{ 100, "MSG_OK" },
-	{ 101, "MSG_INVALID_STATE" },
-	{ 102, "MSG_INVALID_CONFIG" },
-	{ 103, "MSG_RAT_NOT_SUPPORTED" },
-	{ 200, "MSG_NMM_STOP_OK" },
-	{ 201, "MSG_NMM_STOP_IGNORED" },
-	{ 202, "MSG_NMM_STOP_INVALID_STATE" },
-	{ 300, "MSG_PROCEDURE_COMPLETE" },
-	{ 301, "MSG_PROCEDURE_STOPPED" },
-	{ 302, "MSG_PARTIAL_RESULTS" },
-	{ 303, "MSG_TIMEOUT" },
-	{ 0, NULL },
-};
-
-static const value_string nfapi_rat_type_vals[] = {
-	{ 0, "LTE" },
-	{ 1, "UTRAN" },
-	{ 2, "GERAN" },
-	{ 0, NULL },
-};
-
-typedef enum{
-	UN_ALIGNED_SYNCHRONIZATION = 0,
-	INTERNAL_PNF_FRAME_ALIGNMENT,
-	ABSOLUTE_TIME_ALIGNED_SYNCHRONIZATION
-} nfapi_sync_mode_e;
-
-static const value_string nfapi_sync_mode_vals[] = {
-	{ UN_ALIGNED_SYNCHRONIZATION, "UN-ALIGNED SYNCHRONIZATION" },
-	{ INTERNAL_PNF_FRAME_ALIGNMENT, "INTERNAL PNF FRAME ALIGNMENT" },
-	{ ABSOLUTE_TIME_ALIGNED_SYNCHRONIZATION, "ABSOLUTE TIME ALIGNED SYNCHRONIZATION" }
-};
-
-typedef enum {
-	NONE = 0,
-	GPS,
-	GLONASS,
-	BEIDOU
-} location_mode_e;
-
-static const value_string location_mode_vals[] = {
-	{ NONE, "NONE" },
-	{ GPS, "GPS" },
-	{ GLONASS, "GLONASS" },
-	{ BEIDOU, "BeiDou" },
-	{ 0, NULL }
-};
-
-static const value_string nfapi_uplink_rs_hopping_vals[] = {
-	{ 0, "RS_NO_HOPPING" },
-	{ 1, "RS_GROUP_HOPPING" },
-	{ 2, "RS_SEQUENCE_HOPPING" },
-	{ 0, NULL }
-};
-
-static const value_string nfapi_laa_carrier_type_vals[] = {
-	{ 0, "No multi carrier support" },
-	{ 1, "Mode A1" },
-	{ 2, "Mode A12" },
-	{ 3, "Mode B1" },
-	{ 4, "Mode B2" },
-	{ 0, NULL }
-};
-
-static const value_string nfapi_mutli_carrier_lbt_support_vals[] = {
-	{ 0, "Multi carrier Mode A1" },
-	{ 1, "Multi carrier Mode A2" },
-	{ 2, "Multi carrier Mode B1" },
-	{ 3, "Multi carrier Mode B2" },
-	{ 0, NULL }
-};
-
-static const value_string nfapi_lbt_dl_req_pdu_type[] = {
-	{ 0, "LBT_PDSCH_REQ PDU" },
-	{ 1, "LBT_DRS_REQ PDU" },
-	{ 0, NULL }
-};
-
-
-static const value_string nfapi_lbt_dl_ind_pdu_type[] = {
-	{ 0, "LBT_PDSCH_RSP PDU" },
-	{ 1, "LBT_DRS_RSP PDU" },
-
-	{ 0, NULL }
-};
-
-
-
-
-/* These are definitions where data 0 & 1 represent/provide a string name*/
-
-static const true_false_string true_false_strname = {
-	"TRUE",
-	"FALSE"
-};
-
-static const true_false_string  nfapi_csi_report_type_strname = {
-	"Periodic",
-	"Aperiodic",
-};
-
-static const true_false_string nfapi_control_type_string_name = {
-	"CQI/PMI",
-	"RI",
-};
-
-static const true_false_string transport_block_to_codeword_swap_flag = {
-	"NO_SWAPPING",
-	"SWAPPED"
-};
-
-static const true_false_string virtual_resource_block_assignment_flag = {
-	"LOCALIZED",
-	"DISTRIBUTED"
-};
-
-static const true_false_string ngap_string_name = {
-	"N-GAP 1",
-	"N-GAP 2"
-};
-
-static const true_false_string  nprb_strname = {
-	"= 2",
-	"= 3",
-};
-
-static const true_false_string cyclic_prefix_type_strname = {
-	"CP_NORMAL",
-	"CP_EXTENDED"
-};
-
-static const true_false_string support_strname = {
-	"No Support",
-	"Support"
-};
-
-static const true_false_string partial_sf_support_strname =
-{
-	"Start partial SF support",
-	"End partial SF support"
-};
-
-static const true_false_string phich_duration_strname = {
-	"PHICH_D_NORMAL",
-	"PHICH_D_EXTENDED"
-};
-
-static const true_false_string high_speed_flag_strname = {
-	"HS_UNRESTRICTED_SET",
-	"HS_RESTRICTED_SET"
-};
-
-static const true_false_string hopping_mode_strname = {
-	"HM_INTER_SF",
-	"HM_INTRA_INTER_SF"
-};
-
-static const true_false_string enabled_disabled_strname = {
-	"Enabled",
-	"Disabled"
-};
-
-static const true_false_string srs_simult_tx_strname = {
-	"No Simultaneous Transmission",
-	"Simultaneous Transmission"
-};
-
-static const true_false_string crc_flag_strname = {
-	"CRC_CORRECT",
-	"CRC_ERROR"
-};
-
-static const true_false_string hi_value_strname = {
-	"HI_NACK",
-	"HI_ACK"
-};
-
-static const true_false_string flag_tb2_strname = {
-	"HI_NOT_PRESENT",
-	"HI_PRESENT"
-};
-
-static const true_false_string nfapi_multi_carrier_tx_strname = {
-	"Mutual transmission (self-deferral support for current carrier)",
-	"Transmit on channel access win (no self-deferral)"
-};
-
-static const true_false_string nfapi_multi_carrier_freeze_strname = {
-	"Absence of other technology isnt guaranteed",
-	"Absence of other technology is guaranteed"
-};
-
-static const value_string nfapi_dl_config_pdu_type_vals[] = {
-	{ 0, "DL_CONFIG_DCI_DL_PDU" },
-	{ 1, "DL_CONFIG_BCH_PDU" },
-	{ 2, "DL_CONFIG_MCH_PDU" },
-	{ 3, "DL_CONFIG_DLSCH_PDU" },
-	{ 4, "DL_CONFIG_PCH_PDU" },
-	{ 5, "DL_CONFIG_PRS_PDU" },
-	{ 6, "DL_CONFIG_CSI_RS_PDU" },
-	{ 7, "DL_CONFIG_EPDCCH_DL_PDU" },
-	{ 8, "DL_CONFIG_EPDCCH_DL_PDU" },
-	{ 0, NULL }
-};
-
-static const value_string nfapi_duplex_mode_vals[] = {
-	{ 0, "TDD" },
-	{ 1, "FDD" },
-	{ 2, "HD-FDD" },
-	{ 0, NULL }
-};
-
-static const value_string modulation_vals[] = {
-	{ 2, "QPSK" },
-	{ 4, "16QAM" },
-	{ 6, "64QAM" },
-	{ 8, "256QAM" },
-	{ 0, NULL }
-};
-
-static const value_string pch_modulation_vals[] = {
-	{ 0, "QPSK" },
-	{ 0, NULL }
-};
-
-static const value_string ue_mode_vals[] = {
-	{ 0, "non LC/CE UE" },
-	{ 1, "LC/CE UE" },
-	{ 0, NULL }
-};
-
-static const value_string csi_rs_class_vals[] = {
-	{ 0, "not used" },
-	{ 1, "Class A" },
-	{ 1, "Class B" },
-	{ 0, NULL }
-};
-
-static const value_string csi_rs_cdm_type_vals[] = {
-	{ 0, "cdm 2" },
-	{ 1, "cdm 4" },
-	{ 0, NULL }
-};
-
-static const value_string antenna_ports_vals[] = {
-	{ 0, "1 antenna ports" },
-	{ 1, "2 antenna ports" },
-	{ 2, "4 antenna ports" },
-	{ 0, NULL }
-};
-
-static const value_string combs_vals[] = {
-	{ 0, "2 TC" },
-	{ 1, "4 TC" },
-	{ 0, NULL }
-};
-
-static const value_string resource_allocation_type_vals[] = {
-	{ 0, "type 0" },
-	{ 1, "type 1" },
-	{ 2, "type 2 1A/1B/1D" },
-	{ 3, "type 2 1C" },
-	{ 4, "type 2 6-1A" },
-	{ 5, "type UEModeB" },
-	{ 0, NULL }
-};
-
-static const value_string transmission_scheme_vals[] = {
-	{ 0, "SINGLE_ANTENNA_PORT_0" },
-	{ 1, "TX_DIVERSITY" },
-	{ 2, "LARGE_DELAY_CDD" },
-	{ 3, "CLOSED_LOOP_SPATIAL_MULTIPLEXING" },
-	{ 4, "MULTI_USER_MIMO" },
-	{ 5, "CLOSED_LOOP_RANK_1_PRECODING" },
-	{ 6, "SINGLE_ANTENNA_PORT_5" },
-	{ 7, "SINGLE_ANTENNA_PORT_7" },
-	{ 8, "SINGLE_ANTENNA_PORT_8" },
-	{ 9, "DUAL_LAYER_TX_PORT_7_AND_8" },
-	{ 10, "UP_TO_8_LAYER_TX" },
-	{ 11, "SINGLE_ANTENNA_PORT_11" },
-	{ 12, "SINGLE_ANTENNA_PORT_13" },
-	{ 13, "SINGLE_ANTENNA_PORT_11_13" },
-	{ 0, NULL }
-};
-
-static const value_string ul_transmission_scheme_vals[] = {