Skip to content
Snippets Groups Projects
open-nfapi.oai.patch 895 KiB
Newer Older
diff --git a/common/public_inc/debug.h b/common/public_inc/debug.h
index 05e9870..14f97a1 100644
--- a/common/public_inc/debug.h
+++ b/common/public_inc/debug.h
@@ -39,7 +39,8 @@ extern nfapi_trace_fn_t nfapi_trace_g;
 extern nfapi_trace_level_t nfapi_trace_level_g;
 
 /*! NFAPI trace macro */
-#define NFAPI_TRACE(level, format, ...) { if(nfapi_trace_g && ((nfapi_trace_level_t)level <= nfapi_trace_level_g)) (*nfapi_trace_g)(level, format, ##__VA_ARGS__); }
+//#define NFAPI_TRACE(level, format, ...) { if(nfapi_trace_g && ((nfapi_trace_level_t)level <= nfapi_trace_level_g)) (*nfapi_trace_g)(level, format, ##__VA_ARGS__); }
+#define NFAPI_TRACE(level, format, ...) { if (nfapi_trace_g) (*nfapi_trace_g)(level, format, ##__VA_ARGS__); }
 
 /*! Function to change the trace level 
  * \param new_level The modified trace level
diff --git a/nfapi/public_inc/nfapi_interface.h b/nfapi/public_inc/nfapi_interface.h
index 2d58c2a..f665d11 100644
--- a/nfapi/public_inc/nfapi_interface.h
+++ b/nfapi/public_inc/nfapi_interface.h
@@ -1772,7 +1772,7 @@ typedef struct {
 	uint8_t number_of_cc;
 	struct {
 		uint8_t ri_size;
-		uint8_t dl_cqi_pmi_size;
+		uint8_t dl_cqi_pmi_size[8];
 	} cc[NFAPI_MAX_CC];
 } nfapi_ul_config_aperiodic_cqi_pmi_ri_report_t;
 
diff --git a/nfapi/src/nfapi.c b/nfapi/src/nfapi.c
index 0e06963..3f017bc 100644
--- a/nfapi/src/nfapi.c
+++ b/nfapi/src/nfapi.c
@@ -823,6 +823,10 @@ uint8_t pack_tlv(uint16_t tag, void *tlv, uint8_t **ppWritePackedMsg, uint8_t *e
 		{
 			NFAPI_TRACE(NFAPI_TRACE_WARN, "Warning pack_tlv tag 0x%x does not match expected 0x%x\n", tl->tag, tag);
 		}
+                else
+                {
+			//NFAPI_TRACE(NFAPI_TRACE_ERROR, "Warning pack_tlv tag 0x%x ZERO does not match expected 0x%x\n", tl->tag, tag);
+                }
 	}
 
 	return 1;
diff --git a/nfapi/src/nfapi_p7.c b/nfapi/src/nfapi_p7.c
index a3b0141..69ff860 100644
--- a/nfapi/src/nfapi_p7.c
+++ b/nfapi/src/nfapi_p7.c
@@ -111,6 +111,8 @@ static uint8_t pack_dl_config_dci_dl_pdu_rel8_value(void* tlv, uint8_t **ppWrite
 {
 	nfapi_dl_config_dci_dl_pdu_rel8_t* value = (nfapi_dl_config_dci_dl_pdu_rel8_t*)tlv;
 	
+        //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() dci_format:%u\n", __FUNCTION__, value->dci_format);
+
 	return ( push8(value->dci_format, ppWritePackedMsg, end) &&
 			 push8(value->cce_idx, ppWritePackedMsg, end) &&
 			 push8(value->aggregation_level, ppWritePackedMsg, end) &&
@@ -234,6 +236,8 @@ static uint8_t pack_dl_config_bch_pdu_rel8_value(void* tlv, uint8_t **ppWritePac
 {
 	nfapi_dl_config_bch_pdu_rel8_t* value = (nfapi_dl_config_bch_pdu_rel8_t*)tlv;
 	
+        //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s()\n", __FUNCTION__);
+
 	return( push16(value->length, ppWritePackedMsg, end) &&
 			push16(value->pdu_index, ppWritePackedMsg, end) &&
 			push16(value->transmission_power, ppWritePackedMsg, end));
@@ -545,6 +549,8 @@ static uint8_t pack_dl_config_request_body_value(void* tlv, uint8_t **ppWritePac
 {
 	nfapi_dl_config_request_body_t* value = (nfapi_dl_config_request_body_t*)tlv;
 
+        //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() dci:%u pdu:%u pdsch:%u rnti:%u pcfich:%u\n", __FUNCTION__, value->number_dci, value->number_pdu, value->number_pdsch_rnti, value->transmission_power_pcfich);
+
 	if(!(push8(value->number_pdcch_ofdm_symbols, ppWritePackedMsg, end) &&
 		 push8(value->number_dci, ppWritePackedMsg, end) &&
 		 push16(value->number_pdu, ppWritePackedMsg, end) &&
@@ -574,6 +580,8 @@ static uint8_t pack_dl_config_request_body_value(void* tlv, uint8_t **ppWritePac
 		{
 			case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE:
 				{
+                                  //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE\n", __FUNCTION__);
+
 					if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel8_value) &&
 					pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL9_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel9_value) &&
 					pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL10_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel10_value) &&
@@ -587,6 +595,8 @@ static uint8_t pack_dl_config_request_body_value(void* tlv, uint8_t **ppWritePac
 				break;
 			case NFAPI_DL_CONFIG_BCH_PDU_TYPE:
 				{
+                                  //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_DL_CONFIG_BCH_PDU_TYPE\n", __FUNCTION__);
+
 					if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG, &pdu->bch_pdu.bch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_bch_pdu_rel8_value)))
 						return 0;
 				}
@@ -684,10 +694,21 @@ static uint8_t pack_dl_config_request(void *msg, uint8_t **ppWritePackedMsg, uin
 {
 	nfapi_dl_config_request_t *pNfapiMsg = (nfapi_dl_config_request_t*)msg;
 	
-	return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
-			 pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value) &&
-			 pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+	//return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+			 //pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value) &&
+			 //pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+        { 
+          uint8_t x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end);
+          uint8_t y = pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value);
+          uint8_t z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
 
+          if (!x || !y || !z)
+          {
+            NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_DL_CONFIG_REQUEST x:%u y:%u z:%u \n", __FUNCTION__,x,y,z);
+          }
+
+          return x && y && z;
+        }
 }
 
 static uint8_t pack_ul_config_request_ulsch_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t * end)
@@ -796,9 +817,10 @@ static uint8_t pack_ul_config_request_cqi_ri_rel9_value(void *tlv, uint8_t **ppW
 					if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].ri_size, ppWritePackedMsg, end) == 0)
 						return 0;
 
-					if(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].ri_size > 0)
+                                        uint8_t j;
+                                        for(j = 0; j < 8; ++j)
 					{
-						if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].dl_cqi_pmi_size, ppWritePackedMsg, end) == 0)
+                                              if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].dl_cqi_pmi_size[j], ppWritePackedMsg, end) == 0)
 							return 0;
 					}
 				}
@@ -1518,7 +1540,21 @@ static uint8_t pack_tx_request_body_value(void* tlv, uint8_t **ppWritePackedMsg,
 		for(j = 0; j < pdu->num_segments; ++j)
 		{
 			// Use -1 as it is unbounded 
-			if(pusharray8(pdu->segments[j].segment_data, (uint32_t)(-1), pdu->segments[j].segment_length, ppWritePackedMsg, end) == 0)
+			// DJP - does not handle -1
+                        // DJP - if(pusharray8(pdu->segments[j].segment_data, (uint32_t)(-1), pdu->segments[j].segment_length, ppWritePackedMsg, end) == 0)
+			int push_ret = pusharray8(pdu->segments[j].segment_data, 65535, pdu->segments[j].segment_length, ppWritePackedMsg, end);
+                        
+                        if (0 && pdu->segments[j].segment_length == 3)
+                        {
+                          NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__, 
+                          pdu->segments[j].segment_data[0], 
+                          pdu->segments[j].segment_data[1], 
+                          pdu->segments[j].segment_data[2]
+                          );
+                        }
+                        //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() segment_data:%p segment_length:%u pusharray8()=%d\n", __FUNCTION__, pdu->segments[j].segment_data, pdu->segments[j].segment_length, push_ret);
+
+                        if (push_ret == 0)
 			{
 				return 0;
 			}
@@ -1532,9 +1568,13 @@ static uint8_t pack_tx_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *e
 {
 	nfapi_tx_request_t *pNfapiMsg = (nfapi_tx_request_t*)msg;
 	
-	return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
-			 pack_tlv(NFAPI_TX_REQUEST_BODY_TAG, &pNfapiMsg->tx_request_body, ppWritePackedMsg, end, &pack_tx_request_body_value) &&
-			 pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+	int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end);
+        int y = pack_tlv(NFAPI_TX_REQUEST_BODY_TAG, &pNfapiMsg->tx_request_body, ppWritePackedMsg, end, &pack_tx_request_body_value);
+        int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
+
+        //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() x:%d y:%d z:%d\n", __FUNCTION__, x, y, z);
+
+        return x && y && z;
 }
 
 static uint8_t pack_rx_ue_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
@@ -1844,6 +1884,8 @@ static uint8_t pack_rx_ulsch_indication_body_value(void *tlv, uint8_t **ppWriteP
 {
 	nfapi_rx_indication_body_t* value = (nfapi_rx_indication_body_t*)tlv;
 
+        //printf("RX ULSCH BODY\n");
+
 	if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0)
 		return 0;
 
@@ -1851,21 +1893,26 @@ static uint8_t pack_rx_ulsch_indication_body_value(void *tlv, uint8_t **ppWriteP
 	uint16_t i = 0;
 	uint16_t offset = 2; // taking into account the number_of_pdus
 	uint16_t total_number_of_pdus = value->number_of_pdus;
+        //printf("ULSCH:pdus:%d\n", total_number_of_pdus);
+
 	for(i = 0; i < total_number_of_pdus; ++i)
 	{
 		nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]);
 		if(pdu->rx_ue_information.tl.tag == NFAPI_RX_UE_INFORMATION_TAG)
 		{
+                  //printf("NFAPI_RX_UE_INFORMATION_TAG\n");
 			offset += 4 + 6; 
 		}
 				
 		if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
 		{
+                  //printf("NFAPI_RX_INDICATION_REL8_TAG\n");
 			offset += 4 + 7;
 		}
 
 		if(pdu->rx_indication_rel9.tl.tag == NFAPI_RX_INDICATION_REL9_TAG)
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 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 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200
 		{
+                  //printf("NFAPI_RX_INDICATION_REL9_TAG\n");
 			offset += 4 + 2;
 		}
 	}
@@ -2592,11 +2639,16 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
 		return -1;
 	}
 
+        if (pMessageHeader->message_id != NFAPI_TIMING_INFO)
+        {
+          //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() message_id:0x%04x phy_id:%u m_segment_sequence:%u timestamp:%u\n", __FUNCTION__, pMessageHeader->message_id, pMessageHeader->phy_id, pMessageHeader->m_segment_sequence, pMessageHeader->transmit_timestamp);
+        }
 	// look for the specific message
 	uint8_t result = 0;
 	switch (pMessageHeader->message_id)
 	{
 		case NFAPI_DL_CONFIG_REQUEST:
+                  //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_DL_CONFIG_REQUEST\n", __FUNCTION__);
 			result = pack_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config);
 			break;
 
@@ -2609,6 +2661,7 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
 			break;
 
 		case NFAPI_TX_REQUEST:
+                        //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_TX_REQUEST\n", __FUNCTION__);
 			result = pack_tx_request(pMessageHeader, &pWritePackedMessage, end, config);
 			break;
 
@@ -2621,6 +2674,7 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
 			break;
 
 		case NFAPI_RX_ULSCH_INDICATION:
+                        //printf("RX ULSCH\n");
 			result = pack_rx_ulsch_indication(pMessageHeader, &pWritePackedMessage, end, config);
 			break;
 
@@ -3482,9 +3536,10 @@ static uint8_t unpack_ul_config_cqi_ri_info_rel9_value(void *tlv, uint8_t **ppRe
 					if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].ri_size, end) == 0)
 						return 0;
 
-					if(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].ri_size > 0)
+                                        uint8_t j;
+                                        for(j = 0; j < 8; ++j)
 					{
-						if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].dl_cqi_pmi_size, end) == 0)
+						if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].dl_cqi_pmi_size[j], end) == 0)
 							return 0;
 					}
 				}
@@ -4394,6 +4449,14 @@ static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *
 					{
 						if(!pullarray8(ppReadPackedMsg, pdu->segments[0].segment_data, pdu->segments[0].segment_length, pdu->segments[0].segment_length, end))
 							return 0;
+                                                if (0 && pdu->segments[0].segment_length == 3)
+                                                {
+                                                  NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__, 
+                                                      pdu->segments[0].segment_data[0], 
+                                                      pdu->segments[0].segment_data[1], 
+                                                      pdu->segments[0].segment_data[2]
+                                                      );
+                                                }
 					}
 					else
 					{
diff --git a/pnf/public_inc/nfapi_pnf_interface.h b/pnf/public_inc/nfapi_pnf_interface.h
index f93624d..b25caf2 100644
--- a/pnf/public_inc/nfapi_pnf_interface.h
+++ b/pnf/public_inc/nfapi_pnf_interface.h
@@ -319,10 +319,10 @@ typedef struct nfapi_pnf_config
  *  0 will be returned if it fails.
  * 
  * \code
- * nfapi_pnf_config_t* config = nfapi_pnf_config_create();
+ * nfapi_pnf_config_t* config = nfapi_pnf_config_create(void);
  * \endcode
  */
-nfapi_pnf_config_t* nfapi_pnf_config_create();
+nfapi_pnf_config_t* nfapi_pnf_config_create(void);
 
 /*! Delete a pnf configuration 
  * \param config A pointer to a pnf configuraiton
@@ -681,7 +681,7 @@ typedef struct nfapi_pnf_p7_config
 /*! Create and initialise a nfapi_pnf_p7_config structure
  * \return A pointer to a PNF P7 config structure
  */
-nfapi_pnf_p7_config_t* nfapi_pnf_p7_config_create();
+nfapi_pnf_p7_config_t* nfapi_pnf_p7_config_create(void);
 
 /*! Delete an nfapi_pnf_p7_config structure
  * \param config 
diff --git a/pnf/src/pnf.c b/pnf/src/pnf.c
index d6cf364..d0a7fa6 100644
--- a/pnf/src/pnf.c
+++ b/pnf/src/pnf.c
@@ -412,10 +412,10 @@ void pnf_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
 	{
 		nfapi_start_request_t req;
 	
-		NFAPI_TRACE(NFAPI_TRACE_INFO, "START.request received\n");
-	
 		nfapi_pnf_config_t* config = &(pnf->_public);
 	
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() START.request received state:%d\n", __FUNCTION__, config->state);
+	
 		// unpack the message
 		if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
 		{
diff --git a/pnf/src/pnf_interface.c b/pnf/src/pnf_interface.c
index 74f29a0..7310fc0 100644
--- a/pnf/src/pnf_interface.c
+++ b/pnf/src/pnf_interface.c
@@ -76,6 +76,7 @@ int nfapi_pnf_start(nfapi_pnf_config_t* config)
 
 		sleep(1);
 	}
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() terminate=1 - EXITTING............\n", __FUNCTION__);
 
 	return 0;
 }
@@ -227,7 +228,7 @@ int nfapi_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_start_response_t* res
 	}
 	else
 	{
-		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: unknow phy id %d\n", __FUNCTION__, resp->header.phy_id);
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: unknown phy id %d\n", __FUNCTION__, resp->header.phy_id);
 		return -1;
 	}
 
diff --git a/pnf/src/pnf_p7.c b/pnf/src/pnf_p7.c
index 0fd7828..02b828d 100644
--- a/pnf/src/pnf_p7.c
+++ b/pnf/src/pnf_p7.c
@@ -25,12 +25,64 @@
 #include <unistd.h>
 #include <errno.h>
 #include <pthread.h>
+#include <stdio.h>
 
 #include "pnf_p7.h"
 
 #define FAPI2_IP_DSCP	0
 
-uint32_t get_current_time_hr()
+extern uint16_t sf_ahead;
+//uint16_t sf_ahead=4;
+
+void add_sf(uint16_t *frameP, uint16_t *subframeP, int offset)
+{
+    *frameP    = *frameP + ((*subframeP + offset) / 10);
+
+    *subframeP = ((*subframeP + offset) % 10);
+}
+
+void subtract_sf(uint16_t *frameP, uint16_t *subframeP, int offset)
+{
+  if (*subframeP < offset)
+  {
+    *frameP = (*frameP+1024-1)%1024;
+  }
+  *subframeP = (*subframeP+10-offset)%10;
+}
+
+uint16_t sfnsf_add_sf(uint16_t sfnsf, int offset)
+{
+  uint16_t new_sfnsf;
+  uint16_t sfn = NFAPI_SFNSF2SFN(sfnsf);
+  uint16_t sf  = NFAPI_SFNSF2SF(sfnsf);
+
+  //printf("%s() sfn:%u sf:%u\n", __FUNCTION__, sfn, sf);
+  add_sf(&sfn, &sf, offset);
+
+  new_sfnsf = sfn<<4|sf;
+
+  //printf("%s() sfn:%u sf:%u offset:%d sfnsf:%d(DEC:%d) new:%d(DEC:%d)\n", __FUNCTION__, sfn, sf, offset, sfnsf, NFAPI_SFNSF2DEC(sfnsf), new_sfnsf, NFAPI_SFNSF2DEC(new_sfnsf));
+
+  return new_sfnsf;
+}
+
+uint16_t sfnsf_subtract_sf(uint16_t sfnsf, int offset)
+{
+  uint16_t new_sfnsf;
+  uint16_t sfn = NFAPI_SFNSF2SFN(sfnsf);
+  uint16_t sf  = NFAPI_SFNSF2SF(sfnsf);
+
+  //printf("%s() sfn:%u sf:%u\n", __FUNCTION__, sfn, sf);
+  subtract_sf(&sfn, &sf, offset);
+
+  new_sfnsf = sfn<<4|sf;
+
+  //printf("%s() offset:%d sfnsf:%d(DEC:%d) new:%d(DEC:%d)\n", __FUNCTION__, offset, sfnsf, NFAPI_SFNSF2DEC(sfnsf), new_sfnsf, NFAPI_SFNSF2DEC(new_sfnsf));
+
+  return new_sfnsf;
+}
+
+uint32_t pnf_get_current_time_hr(void)
 {
 	struct timeval now;
 	(void)gettimeofday(&now, NULL);
@@ -64,11 +116,14 @@ void pnf_p7_free(pnf_p7_t* pnf_p7, void* ptr)
 // todo : for now these just malloc/free need to move to a memory cache
 nfapi_dl_config_request_t* allocate_nfapi_dl_config_request(pnf_p7_t* pnf_p7) 
 { 
-	return pnf_p7_malloc(pnf_p7, sizeof(nfapi_dl_config_request_t));
+	void *ptr= pnf_p7_malloc(pnf_p7, sizeof(nfapi_dl_config_request_t));
+        //printf("%s() ptr:%p\n", __FUNCTION__, ptr);
+        return ptr;
 }
 
 void deallocate_nfapi_dl_config_request(nfapi_dl_config_request_t* req, pnf_p7_t* pnf_p7) 
 { 
+  //printf("%s() SFN/SF:%d %s req:%p pdu_list:%p\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), pnf_p7->_public.codec_config.deallocate ? "DEALLOCATE" : "FREE", req, req->dl_config_request_body.dl_config_pdu_list);
 	if(pnf_p7->_public.codec_config.deallocate)
 	{
 		(pnf_p7->_public.codec_config.deallocate)(req->dl_config_request_body.dl_config_pdu_list);
@@ -77,17 +132,21 @@ void deallocate_nfapi_dl_config_request(nfapi_dl_config_request_t* req, pnf_p7_t
 	{
 		free(req->dl_config_request_body.dl_config_pdu_list);
 	}
+        req->dl_config_request_body.dl_config_pdu_list=0;
 
 	pnf_p7_free(pnf_p7, req);
 }
 
 nfapi_ul_config_request_t* allocate_nfapi_ul_config_request(pnf_p7_t* pnf_p7) 
 { 
-	return pnf_p7_malloc(pnf_p7, sizeof(nfapi_ul_config_request_t));
+	void *ptr= pnf_p7_malloc(pnf_p7, sizeof(nfapi_ul_config_request_t));
+        //printf("%s() ptr:%p\n", __FUNCTION__, ptr);
+        return ptr;
 }
 
 void deallocate_nfapi_ul_config_request(nfapi_ul_config_request_t* req, pnf_p7_t* pnf_p7) 
 { 
+  //printf("%s() SFN/SF:%d %s req:%p pdu_list:%p\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), pnf_p7->_public.codec_config.deallocate ? "DEALLOCATE" : "FREE", req, req->ul_config_request_body.ul_config_pdu_list);
 	if(pnf_p7->_public.codec_config.deallocate)
 	{
 		(pnf_p7->_public.codec_config.deallocate)(req->ul_config_request_body.ul_config_pdu_list);
@@ -96,6 +155,7 @@ void deallocate_nfapi_ul_config_request(nfapi_ul_config_request_t* req, pnf_p7_t
 	{
 		free(req->ul_config_request_body.ul_config_pdu_list);
 	}
+        req->ul_config_request_body.ul_config_pdu_list=0;
 
 	pnf_p7_free(pnf_p7, req);
 }
@@ -107,6 +167,7 @@ nfapi_hi_dci0_request_t* allocate_nfapi_hi_dci0_request(pnf_p7_t* pnf_p7)
 
 void deallocate_nfapi_hi_dci0_request(nfapi_hi_dci0_request_t* req, pnf_p7_t* pnf_p7) 
 { 
+  //printf("%s() SFN/SF:%d %s req:%p pdu_list:%p\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), pnf_p7->_public.codec_config.deallocate ? "DEALLOCATE" : "FREE", req, req->hi_dci0_request_body.hi_dci0_pdu_list);
 	if(pnf_p7->_public.codec_config.deallocate)
 	{
 		(pnf_p7->_public.codec_config.deallocate)(req->hi_dci0_request_body.hi_dci0_pdu_list);
@@ -115,6 +176,7 @@ void deallocate_nfapi_hi_dci0_request(nfapi_hi_dci0_request_t* req, pnf_p7_t* pn
 	{
 		free(req->hi_dci0_request_body.hi_dci0_pdu_list);
 	}
+        req->hi_dci0_request_body.hi_dci0_pdu_list=0;
 
 	pnf_p7_free(pnf_p7, req);
 }
@@ -127,6 +189,9 @@ nfapi_tx_request_t* allocate_nfapi_tx_request(pnf_p7_t* pnf_p7)
 void deallocate_nfapi_tx_request(nfapi_tx_request_t* req, pnf_p7_t* pnf_p7) 
 { 
 	int i = 0;
+
+  //printf("%s() SFN/SF:%d %s req:%p pdu[0]:data:%p\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), pnf_p7->_public.codec_config.deallocate ? "DEALLOCATE" : "FREE", req, req->tx_request_body.tx_pdu_list[i].segments[0].segment_data);
+
 	for(i = 0; i < req->tx_request_body.number_of_pdus; ++i)
 	{
 		void* data = req->tx_request_body.tx_pdu_list[i].segments[0].segment_data;
@@ -139,6 +204,7 @@ void deallocate_nfapi_tx_request(nfapi_tx_request_t* req, pnf_p7_t* pnf_p7)
 		{
 			free(data);
 		}
+                data=0;
 	}
 
 
@@ -150,6 +216,7 @@ void deallocate_nfapi_tx_request(nfapi_tx_request_t* req, pnf_p7_t* pnf_p7)
 	{
 		free(req->tx_request_body.tx_pdu_list);
 	}
+        req->tx_request_body.tx_pdu_list=0;
 
 	pnf_p7_free(pnf_p7, req);
 }
@@ -169,6 +236,7 @@ void deallocate_nfapi_lbt_dl_config_request(nfapi_lbt_dl_config_request_t* req,
 	{
 		free(req->lbt_dl_config_request_body.lbt_dl_config_req_pdu_list);
 	}
+        req->lbt_dl_config_request_body.lbt_dl_config_req_pdu_list=0;
 
 	pnf_p7_free(pnf_p7, req);
 }
@@ -307,11 +375,11 @@ void pnf_p7_rx_reassembly_queue_remove_old_msgs(pnf_p7_t* pnf_p7, pnf_p7_rx_reas
 }
 
 
-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)
 	{
-		NFAPI_TRACE(NFAPI_TRACE_INFO, "now is earlier that start of subframe\n");
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "now is earlier than start of subframe now_hr:%u sf_start_hr:%u\n", now_hr, sf_start_hr);
 		return 0;
 	}
 	else
@@ -482,29 +550,41 @@ void pnf_pack_and_send_timing_info(pnf_p7_t* pnf_p7)
 
 void send_dummy_subframe(pnf_p7_t* pnf_p7, uint16_t sfn_sf)
 {
+  struct timespec t;
+  clock_gettime( CLOCK_MONOTONIC, &t);
+
+  //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(sfn_sf:%d) t:%ld.%09ld\n", __FUNCTION__, NFAPI_SFNSF2DEC(sfn_sf), t.tv_sec, t.tv_nsec);
+
+	if(pnf_p7->_public.tx_req && pnf_p7->_public.dummy_subframe.tx_req)
+	{
+		pnf_p7->_public.dummy_subframe.tx_req->sfn_sf = sfn_sf;
+		//NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy tx_req - enter\n");
+		(pnf_p7->_public.tx_req)(&pnf_p7->_public, pnf_p7->_public.dummy_subframe.tx_req);
+		//NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy tx_req - exit\n");
+	}
 	if(pnf_p7->_public.dl_config_req && pnf_p7->_public.dummy_subframe.dl_config_req)
 	{
 		pnf_p7->_public.dummy_subframe.dl_config_req->sfn_sf = sfn_sf;
+		//NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy dl_config_req - enter\n");
 		(pnf_p7->_public.dl_config_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.dl_config_req);
+		//NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy dl_config_req - exit\n");
 	}
 	if(pnf_p7->_public.ul_config_req && pnf_p7->_public.dummy_subframe.ul_config_req)
 	{
 		pnf_p7->_public.dummy_subframe.ul_config_req->sfn_sf = sfn_sf;
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy ul_config_req - enter\n");
 		(pnf_p7->_public.ul_config_req)(&pnf_p7->_public, pnf_p7->_public.dummy_subframe.ul_config_req);
 	}
 	if(pnf_p7->_public.hi_dci0_req && pnf_p7->_public.dummy_subframe.hi_dci0_req)
 	{
 		pnf_p7->_public.dummy_subframe.hi_dci0_req->sfn_sf = sfn_sf;
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy hi_dci0 - enter\n");
 		(pnf_p7->_public.hi_dci0_req)(&pnf_p7->_public, pnf_p7->_public.dummy_subframe.hi_dci0_req);
 	}
-	if(pnf_p7->_public.tx_req && pnf_p7->_public.dummy_subframe.tx_req)
-	{
-		pnf_p7->_public.dummy_subframe.tx_req->sfn_sf = sfn_sf;
-		(pnf_p7->_public.tx_req)(&pnf_p7->_public, pnf_p7->_public.dummy_subframe.tx_req);
-	}
 	if(pnf_p7->_public.lbt_dl_config_req && pnf_p7->_public.dummy_subframe.lbt_dl_config_req)
 	{
 		pnf_p7->_public.dummy_subframe.lbt_dl_config_req->sfn_sf = sfn_sf;
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy lbt - enter\n");
 		(pnf_p7->_public.lbt_dl_config_req)(&pnf_p7->_public, pnf_p7->_public.dummy_subframe.lbt_dl_config_req);
 	}
 }
@@ -526,10 +606,14 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
 		return -1;
 	}
 
+#if 1
 	// save the curren time and sfn_sf
-	pnf_p7->sf_start_time_hr = get_current_time_hr();
+	pnf_p7->sf_start_time_hr = pnf_get_current_time_hr();
 	pnf_p7->sfn_sf = sfn_sf;
 
+        uint32_t sfn_sf_tx = sfnsf_add_sf(sfn_sf, sf_ahead);
+        uint32_t tx_sfn_sf_dec = NFAPI_SFNSF2DEC(sfn_sf_tx);
+
 	// If the subframe_buffer has been configured
 	if(pnf_p7->_public.subframe_buffer_size != 0)
 	{
@@ -550,6 +634,10 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
 			NFAPI_TRACE(NFAPI_TRACE_INFO, "Applying shift %d to sfn/sf (%d -> %d)\n", pnf_p7->sfn_sf_shift, NFAPI_SFNSF2DEC(sfn_sf), shifted_sfn_sf);
 			sfn_sf = shifted_sfn_sf;
 
+                        //
+                        // DJP - why does the shift not apply to pnf_p7->sfn_sf???
+                        //
+
 			pnf_p7->sfn_sf_shift = 0;
 		}
 
@@ -558,77 +646,119 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
 
 		nfapi_pnf_p7_subframe_buffer_t* subframe_buffer = &(pnf_p7->subframe_buffer[buffer_index]);
 
+		uint8_t tx_buffer_index = tx_sfn_sf_dec % pnf_p7->_public.subframe_buffer_size;
+		nfapi_pnf_p7_subframe_buffer_t* tx_subframe_buffer = &(pnf_p7->subframe_buffer[tx_buffer_index]);
+
+                //printf("sfn_sf_dec:%d tx_sfn_sf_dec:%d\n", sfn_sf_dec, tx_sfn_sf_dec);
+
+                if (0) NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() shift:%d subframe_buffer->sfn_sf:%d tx_subframe_buffer->sfn_sf:%d sfn_sf:%d subframe_buffer[buffer_index:%u dl_config_req:%p tx_req:%p] "
+                    "TX:sfn_sf:%d:tx_buffer_index:%d[dl_config_req:%p tx_req:%p]\n", 
+                    __FUNCTION__, 
+                    pnf_p7->sfn_sf_shift, 
+                    NFAPI_SFNSF2DEC(subframe_buffer->sfn_sf), 
+                    NFAPI_SFNSF2DEC(tx_subframe_buffer->sfn_sf), 
+                       sfn_sf_dec,    buffer_index,    subframe_buffer->dl_config_req,    subframe_buffer->tx_req, 
+                    tx_sfn_sf_dec, tx_buffer_index, tx_subframe_buffer->dl_config_req, tx_subframe_buffer->tx_req);
+
 		// if the subframe buffer sfn sf is set then we have atlease 1 message
 		// from the vnf. 
 		// todo : how to handle the messages we don't have, send dummies for
 		// now
-		if(subframe_buffer->sfn_sf == sfn_sf)
+
+                //printf("tx_subframe_buffer->sfn_sf:%d sfn_sf_tx:%d\n", tx_subframe_buffer->sfn_sf, sfn_sf_tx);
+                //printf("subframe_buffer->sfn_sf:%d sfn_sf:%d\n", subframe_buffer->sfn_sf, sfn_sf);
+		if(tx_subframe_buffer->sfn_sf == sfn_sf_tx)
 		{
-			if(subframe_buffer->dl_config_req != 0)
+			if(tx_subframe_buffer->tx_req != 0)
 			{
-				if(pnf_p7->_public.dl_config_req)
-					(pnf_p7->_public.dl_config_req)(&(pnf_p7->_public), subframe_buffer->dl_config_req);
+				if(pnf_p7->_public.tx_req)
+					(pnf_p7->_public.tx_req)(&(pnf_p7->_public), tx_subframe_buffer->tx_req);
 
-				deallocate_nfapi_dl_config_request(subframe_buffer->dl_config_req, pnf_p7);
+				//deallocate_nfapi_tx_request(subframe_buffer->tx_req, pnf_p7);
 			}
 			else
 			{
 				// send dummy
-				if(pnf_p7->_public.dl_config_req && pnf_p7->_public.dummy_subframe.dl_config_req)
+				if(pnf_p7->_public.tx_req && pnf_p7->_public.dummy_subframe.tx_req)
 				{
-					pnf_p7->_public.dummy_subframe.dl_config_req->sfn_sf = sfn_sf;
-					(pnf_p7->_public.dl_config_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.dl_config_req);
+					pnf_p7->_public.dummy_subframe.tx_req->sfn_sf = sfn_sf_tx;
+					(pnf_p7->_public.tx_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.tx_req);
 				}
 			}
 
-			if(subframe_buffer->ul_config_req != 0)
+			if(tx_subframe_buffer->dl_config_req != 0)
 			{
-				if(pnf_p7->_public.ul_config_req)
-					(pnf_p7->_public.ul_config_req)(&(pnf_p7->_public), subframe_buffer->ul_config_req);
+				if(pnf_p7->_public.dl_config_req)
+					(pnf_p7->_public.dl_config_req)(&(pnf_p7->_public), tx_subframe_buffer->dl_config_req);
 
-				deallocate_nfapi_ul_config_request(subframe_buffer->ul_config_req, pnf_p7);
+				//deallocate_nfapi_dl_config_request(subframe_buffer->dl_config_req, pnf_p7);
 			}
 			else
 			{
 				// send dummy
-				if(pnf_p7->_public.ul_config_req && pnf_p7->_public.dummy_subframe.ul_config_req)
+				if(pnf_p7->_public.dl_config_req && pnf_p7->_public.dummy_subframe.dl_config_req)
 				{
-					pnf_p7->_public.dummy_subframe.ul_config_req->sfn_sf = sfn_sf;
-					(pnf_p7->_public.ul_config_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.ul_config_req);
+					pnf_p7->_public.dummy_subframe.dl_config_req->sfn_sf = sfn_sf_tx;
+					(pnf_p7->_public.dl_config_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.dl_config_req);
 				}
 			}
 
-			if(subframe_buffer->hi_dci0_req != 0)
+			if(tx_subframe_buffer->hi_dci0_req != 0)
 			{
 				if(pnf_p7->_public.hi_dci0_req)
-					(pnf_p7->_public.hi_dci0_req)(&(pnf_p7->_public), subframe_buffer->hi_dci0_req);
+					(pnf_p7->_public.hi_dci0_req)(&(pnf_p7->_public), tx_subframe_buffer->hi_dci0_req);
 
-				deallocate_nfapi_hi_dci0_request(subframe_buffer->hi_dci0_req, pnf_p7);
+				//deallocate_nfapi_hi_dci0_request(subframe_buffer->hi_dci0_req, pnf_p7);
 			}
 			else
 			{
 				//send dummy
 				if(pnf_p7->_public.hi_dci0_req && pnf_p7->_public.dummy_subframe.hi_dci0_req)
 				{
-					pnf_p7->_public.dummy_subframe.hi_dci0_req->sfn_sf = sfn_sf;
+					pnf_p7->_public.dummy_subframe.hi_dci0_req->sfn_sf = sfn_sf_tx;
 					(pnf_p7->_public.hi_dci0_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.hi_dci0_req);
 				}
 			}
 
-			if(subframe_buffer->tx_req != 0)
+                        if(tx_subframe_buffer->dl_config_req != 0)
+                        {
+                          deallocate_nfapi_dl_config_request(tx_subframe_buffer->dl_config_req, pnf_p7);
+                          tx_subframe_buffer->dl_config_req = 0;
+                        }
+			if(tx_subframe_buffer->tx_req != 0)
+                        {
+                          deallocate_nfapi_tx_request(tx_subframe_buffer->tx_req, pnf_p7);
+                          tx_subframe_buffer->tx_req = 0;
+                        }
+                        if(tx_subframe_buffer->hi_dci0_req != 0)
+                        {
+                          deallocate_nfapi_hi_dci0_request(tx_subframe_buffer->hi_dci0_req, pnf_p7);
+                          tx_subframe_buffer->hi_dci0_req = 0;
+                        }
+                }
+		else
+		{
+                  // If we ever need to "send" a dummy ul_config this won't work!!!
+                  send_dummy_subframe(pnf_p7, sfn_sf_tx);
+		}
+
+                if(subframe_buffer->sfn_sf == sfn_sf)
+		{
+
+			if(subframe_buffer->ul_config_req != 0)
 			{
-				if(pnf_p7->_public.tx_req)
-					(pnf_p7->_public.tx_req)(&(pnf_p7->_public), subframe_buffer->tx_req);
+				if(pnf_p7->_public.ul_config_req)
+					(pnf_p7->_public.ul_config_req)(&(pnf_p7->_public), subframe_buffer->ul_config_req);
 
-				deallocate_nfapi_tx_request(subframe_buffer->tx_req, pnf_p7);
+				//deallocate_nfapi_ul_config_request(subframe_buffer->ul_config_req, pnf_p7);
 			}
 			else
 			{
 				// send dummy
-				if(pnf_p7->_public.tx_req && pnf_p7->_public.dummy_subframe.tx_req)
+				if(pnf_p7->_public.ul_config_req && pnf_p7->_public.dummy_subframe.ul_config_req)
 				{
-					pnf_p7->_public.dummy_subframe.tx_req->sfn_sf = sfn_sf;
-					(pnf_p7->_public.tx_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.tx_req);
+					pnf_p7->_public.dummy_subframe.ul_config_req->sfn_sf = sfn_sf;
+					(pnf_p7->_public.ul_config_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.ul_config_req);
 				}
 			}
 
@@ -637,7 +767,7 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
 				if(pnf_p7->_public.lbt_dl_config_req)
 					(pnf_p7->_public.lbt_dl_config_req)(&(pnf_p7->_public), subframe_buffer->lbt_dl_config_req);
 
-				deallocate_nfapi_lbt_dl_config_request(subframe_buffer->lbt_dl_config_req, pnf_p7);
+				//deallocate_nfapi_lbt_dl_config_request(subframe_buffer->lbt_dl_config_req, pnf_p7);
 			}
 			else
 			{
@@ -650,14 +780,35 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
 
 			}
 
-			memset(&(pnf_p7->subframe_buffer[buffer_index]), 0, sizeof(nfapi_pnf_p7_subframe_buffer_t));
-			pnf_p7->subframe_buffer[buffer_index].sfn_sf = -1;
-		}
-		else
-		{
-			send_dummy_subframe(pnf_p7, sfn_sf);
+                        //if(subframe_buffer->dl_config_req != 0)
+                          //deallocate_nfapi_dl_config_request(subframe_buffer->dl_config_req, pnf_p7);
+			//if(subframe_buffer->tx_req != 0)
+                          //deallocate_nfapi_tx_request(subframe_buffer->tx_req, pnf_p7);
+                        if(subframe_buffer->ul_config_req != 0)
+                        {
+                          deallocate_nfapi_ul_config_request(subframe_buffer->ul_config_req, pnf_p7);
+                          subframe_buffer->ul_config_req = 0;
+
+                        }
+                        //if(subframe_buffer->hi_dci0_req != 0)
+                          //deallocate_nfapi_hi_dci0_request(subframe_buffer->hi_dci0_req, pnf_p7);
+			if(subframe_buffer->lbt_dl_config_req != 0)
+                        {
+                          deallocate_nfapi_lbt_dl_config_request(subframe_buffer->lbt_dl_config_req, pnf_p7);
+                          subframe_buffer->lbt_dl_config_req = 0;
+                        }
+                } // sfn_sf match
+
+                if (subframe_buffer->dl_config_req == 0 && subframe_buffer->tx_req == 0 && subframe_buffer->ul_config_req == 0 && subframe_buffer->lbt_dl_config_req == 0)
+                {
+                  memset(&(pnf_p7->subframe_buffer[buffer_index]), 0, sizeof(nfapi_pnf_p7_subframe_buffer_t));
+                  pnf_p7->subframe_buffer[buffer_index].sfn_sf = -1;
 		}
 
+                //printf("pnf_p7->_public.timing_info_mode_periodic:%d pnf_p7->timing_info_period_counter:%d pnf_p7->_public.timing_info_period:%d\n", pnf_p7->_public.timing_info_mode_periodic, pnf_p7->timing_info_period_counter, pnf_p7->_public.timing_info_period);
+                //printf("pnf_p7->_public.timing_info_mode_aperiodic:%d pnf_p7->timing_info_aperiodic_send:%d\n", pnf_p7->_public.timing_info_mode_aperiodic, pnf_p7->timing_info_aperiodic_send);
+                //printf("pnf_p7->timing_info_ms_counter:%d\n", pnf_p7->timing_info_ms_counter);
+
 		// send the periodic timing info if configured
 		if(pnf_p7->_public.timing_info_mode_periodic && (pnf_p7->timing_info_period_counter++) == pnf_p7->_public.timing_info_period)
 		{
@@ -678,14 +829,15 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
 	}
 	else
 	{
-		send_dummy_subframe(pnf_p7, sfn_sf);
+		//send_dummy_subframe(pnf_p7, sfn_sf_tx);
 	}
 
 
+        //printf("pnf_p7->tick:%d\n", pnf_p7->tick);
 	if(pnf_p7->tick == 1000)
 	{
 
-		NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF P7:%d] DL:(%d/%d) UL:(%d/%d) HI:(%d/%d) TX:(%d/%d)\n", pnf_p7->_public.phy_id,
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF P7:%d] (ONTIME/LATE) DL:(%d/%d) UL:(%d/%d) HI:(%d/%d) TX:(%d/%d)\n", pnf_p7->_public.phy_id,
 					pnf_p7->stats.dl_conf_ontime, pnf_p7->stats.dl_conf_late, 
 					pnf_p7->stats.ul_conf_ontime, pnf_p7->stats.ul_conf_late, 
 					pnf_p7->stats.hi_dci0_ontime, pnf_p7->stats.hi_dci0_late, 
@@ -694,6 +846,7 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
 		memset(&pnf_p7->stats, 0, sizeof(pnf_p7->stats));
 	}
 	pnf_p7->tick++;
+#endif
 
 	if(pthread_mutex_unlock(&(pnf_p7->mutex)) != 0)
 	{
@@ -724,7 +877,7 @@ uint8_t is_p7_request_in_window(uint16_t sfnsf, const char* name, pnf_p7_t* phy)
 			if(recv_sfn_sf_dec > ((current_sfn_sf_dec + timing_window) % NFAPI_MAX_SFNSFDEC))
 			{
 				// out of window
-				//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is late %d (with wrap)\n", current_sfn_sf_dec, name, recv_sfn_sf_dec);
+				NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is late %d (with wrap)\n", current_sfn_sf_dec, name, recv_sfn_sf_dec);
 			}
 			else
 			{
@@ -736,7 +889,7 @@ uint8_t is_p7_request_in_window(uint16_t sfnsf, const char* name, pnf_p7_t* phy)
 		else
 		{
 			// too late
-			//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is in late %d (%d)\n", current_sfn_sf_dec, name, recv_sfn_sf_dec, (current_sfn_sf_dec - recv_sfn_sf_dec));
+			NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is in late %d (delta:%d)\n", current_sfn_sf_dec, name, recv_sfn_sf_dec, (current_sfn_sf_dec - recv_sfn_sf_dec));
 		}
 
 	}
@@ -751,8 +904,8 @@ uint8_t is_p7_request_in_window(uint16_t sfnsf, const char* name, pnf_p7_t* phy)
 		}
 		else
 		{
-			// to far in the future
-			//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is out of window %d (%d) [%d]\n", current_sfn_sf_dec, name, recv_sfn_sf_dec,  (recv_sfn_sf_dec - current_sfn_sf_dec), timing_window);
+			// too far in the future
+			NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is out of window %d (delta:%d) [max:%d]\n", current_sfn_sf_dec, name, recv_sfn_sf_dec,  (recv_sfn_sf_dec - current_sfn_sf_dec), timing_window);
 		}
 
 	}
@@ -785,15 +938,35 @@ void pnf_handle_dl_config_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_
 			return;
 		}
 
-		if(is_p7_request_in_window(req->sfn_sf, "dl_config_request", pnf_p7))
-		{
-			uint32_t sfn_sf_dec = NFAPI_SFNSF2DEC(req->sfn_sf);
-			uint8_t buffer_index = sfn_sf_dec % pnf_p7->_public.subframe_buffer_size;
+                if (
+                    0 && 
+                    (NFAPI_SFNSF2DEC(req->sfn_sf) % 100 ==0 ||
+                     NFAPI_SFNSF2DEC(req->sfn_sf) % 105 ==0 
+                    )
+                )
+                  NFAPI_TRACE(NFAPI_TRACE_INFO, "DL_CONFIG.req sfn_sf:%d pdcch:%u dci:%u pdu:%u pdsch_rnti:%u pcfich:%u\n", 
+                      NFAPI_SFNSF2DEC(req->sfn_sf),
+                      req->dl_config_request_body.number_pdcch_ofdm_symbols,
+                      req->dl_config_request_body.number_dci,
+                      req->dl_config_request_body.number_pdu,
+                      req->dl_config_request_body.number_pdsch_rnti,
+                      req->dl_config_request_body.transmission_power_pcfich
+                      );
+
+                if(is_p7_request_in_window(req->sfn_sf, "dl_config_request", pnf_p7))
+                {
+                  uint32_t sfn_sf_dec = NFAPI_SFNSF2DEC(req->sfn_sf);
+                  uint8_t buffer_index = sfn_sf_dec % pnf_p7->_public.subframe_buffer_size;
+
+                        struct timespec t;
+                        clock_gettime(CLOCK_MONOTONIC, &t);
+
+                  NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE DL_CONFIG_REQ sfn_sf:%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, sfn_sf_dec, buffer_index);
 
 			// if there is already an dl_config_req make sure we free it.
 			if(pnf_p7->subframe_buffer[buffer_index].dl_config_req != 0)
 			{
-				NFAPI_TRACE(NFAPI_TRACE_NOTE, "HERE HERE HERE\n");
+				NFAPI_TRACE(NFAPI_TRACE_NOTE, "%s() is_p7_request_in_window()=TRUE buffer_index occupied - free it first sfn_sf:%d buffer_index:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), buffer_index);
 				//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] Freeing dl_config_req at index %d (%d/%d)", 
 				//			pMyPhyInfo->sfnSf, bufferIdx,
 				//			SFNSF2SFN(dreq->sfn_sf), SFNSF2SF(dreq->sfn_sf));
@@ -860,6 +1033,11 @@ void pnf_handle_ul_config_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_
 			uint32_t sfn_sf_dec = NFAPI_SFNSF2DEC(req->sfn_sf);
 			uint8_t buffer_index = sfn_sf_dec % pnf_p7->_public.subframe_buffer_size;
 
+                        struct timespec t;
+                        clock_gettime(CLOCK_MONOTONIC, &t);
+
+                        NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE UL_CONFIG_REQ sfn_sf:%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, sfn_sf_dec, buffer_index);
+
 			if(pnf_p7->subframe_buffer[buffer_index].ul_config_req != 0)
 			{
 				//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] Freeing ul_config_req at index %d (%d/%d)", 
@@ -876,7 +1054,7 @@ void pnf_handle_ul_config_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_
 		}
 		else
 		{
-			//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] NOT storing ul_config_req SFN/SF %d/%d\n", pMyPhyInfo->sfnSf, SFNSF2SFN(req->sfn_sf), SFNSF2SF(req->sfn_sf));
+			NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] NOT storing ul_config_req OUTSIDE OF TRANSMIT BUFFER WINDOW SFN/SF %d\n", NFAPI_SFNSF2DEC(pnf_p7->sfn_sf), NFAPI_SFNSF2DEC(req->sfn_sf));
 			deallocate_nfapi_ul_config_request(req, pnf_p7);
 
 			if(pnf_p7->_public.timing_info_mode_aperiodic)
@@ -994,6 +1172,16 @@ void pnf_handle_tx_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
 			uint32_t sfn_sf_dec = NFAPI_SFNSF2DEC(req->sfn_sf);
 			uint8_t buffer_index = sfn_sf_dec % pnf_p7->_public.subframe_buffer_size;
 
+                        struct timespec t;
+                        clock_gettime(CLOCK_MONOTONIC, &t);
+
+                        NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE TX_REQ sfn_sf:%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, sfn_sf_dec, buffer_index);
+
+                        if (0 && NFAPI_SFNSF2DEC(req->sfn_sf)%100==0) NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() TX_REQ.req sfn_sf:%d pdus:%d - TX_REQ is within window\n",
+                            __FUNCTION__,
+                            NFAPI_SFNSF2DEC(req->sfn_sf),
+                            req->tx_request_body.number_of_pdus);
+
 			if(pnf_p7->subframe_buffer[buffer_index].tx_req != 0)
 			{
 				//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] Freeing tx_req at index %d (%d/%d)", 
@@ -1010,6 +1198,8 @@ void pnf_handle_tx_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
 		}
 		else
 		{
+                  NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() TX_REQUEST Request is outside of window REQ:SFN_SF:%d CURR:SFN_SF:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), NFAPI_SFNSF2DEC(pnf_p7->sfn_sf));
+
 			deallocate_nfapi_tx_request(req, pnf_p7);
 
 			if(pnf_p7->_public.timing_info_mode_aperiodic)
@@ -1126,12 +1316,27 @@ uint32_t calculate_t2(uint32_t now_time_hr, uint16_t sfn_sf, uint32_t sf_start_t
 	uint32_t sf_time_us = get_sf_time(now_time_hr, sf_start_time_hr);
 	uint32_t t2 = (NFAPI_SFNSF2DEC(sfn_sf) * 1000) + sf_time_us;
 
+        if (0)
+        {
+          static uint32_t prev_t2 = 0;
+
+          NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s(now_time_hr:%u sfn_sf:%d sf_start_time_Hr:%u) sf_time_us:%u t2:%u prev_t2:%u diff:%u\n",
+              __FUNCTION__,
+              now_time_hr, NFAPI_SFNSF2DEC(sfn_sf), sf_start_time_hr,
+              sf_time_us,
+              t2,
+              prev_t2,
+              t2-prev_t2);
+
+          prev_t2 = t2;
+        }
+
 	return t2;
 }
 
 uint32_t calculate_t3(uint16_t sfn_sf, uint32_t sf_start_time_hr)
 {
-	uint32_t now_time_hr = get_current_time_hr();
+	uint32_t now_time_hr = pnf_get_current_time_hr();
 
 	uint32_t sf_time_us = get_sf_time(now_time_hr, sf_start_time_hr);
 
@@ -1391,6 +1596,8 @@ void pnf_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_time)
 			// read the segment
 			recvfrom_result = recvfrom(pnf_p7->p7_sock, pnf_p7->rx_message_buffer, header.message_length, MSG_DONTWAIT, (struct sockaddr*)&remote_addr, &remote_addr_size);
 
+		now_hr_time = pnf_get_current_time_hr(); //DJP - moved to here - get closer timestamp???
+
 			if(recvfrom_result > 0)
 			{
 				pnf_handle_p7_message(pnf_p7->rx_message_buffer, recvfrom_result, pnf_p7, now_hr_time);
@@ -1417,7 +1624,10 @@ void pnf_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_time)
 
 		// need to update the time as we would only use the value from the
 		// select
-		now_hr_time = get_current_time_hr();
+#if 0
+// DJP - why do this here and not on return from recv???
+		now_hr_time = pnf_get_current_time_hr();
+#endif
 	}
 	while(recvfrom_result > 0);
 }
@@ -1512,7 +1722,7 @@ int pnf_p7_message_pump(pnf_p7_t* pnf_p7)
 
 		selectRetval = select(pnf_p7->p7_sock+1, &rfds, NULL, NULL, &timeout);
 
-		uint32_t now_hr_time = get_current_time_hr();
+		uint32_t now_hr_time = pnf_get_current_time_hr();
 
 		if(selectRetval == 0)
 		{	
diff --git a/pnf_sim/src/main.cpp b/pnf_sim/src/main.cpp
index 38767d8..e2622cf 100644
--- a/pnf_sim/src/main.cpp
+++ b/pnf_sim/src/main.cpp
@@ -1124,16 +1124,18 @@ int fapi_rx_ulsch_ind(fapi_t* fapi, fapi_rx_ulsch_ind_t* ind)
 	rx_ind.header.phy_id = data->p7_config->phy_id;
 	rx_ind.sfn_sf = ind->sfn_sf;
 	
-	if(((pnf_info*)(data->config->user_data))->wireshark_test_mode)
+	if(1)//((pnf_info*)(data->config->user_data))->wireshark_test_mode)
 	{
 		rx_ind.rx_indication_body.tl.tag = NFAPI_RX_INDICATION_BODY_TAG;
-		rx_ind.rx_indication_body.number_of_pdus = 8;
+		rx_ind.rx_indication_body.number_of_pdus = 1;
 		
 		uint8_t rx_data[1024];
 		
 		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[] = {
-	{ 0, "SINGLE_ANTENNA_PORT_10" },
-	{ 1, "CLOSED_LOOP_SPATIAL_MULTIPLEXING" },
-};
-
-static const value_string dci_format_vals[] = {
-	{ 0, "1" },
-	{ 1, "1A" },
-	{ 2, "1B" },
-	{ 3, "1C" },
-	{ 4, "1D" },
-	{ 5, "2" },
-	{ 6, "2A" },
-	{ 7, "2B" },
-	{ 8, "2C" },
-	{ 9, "2D" },
-	{ 0, NULL }
-};
-
-static const value_string pa_vals[] = {
-	{ 0, "-6dB" },
-	{ 1, "-4.77dB" },
-	{ 2, "-3dB" },
-	{ 3, "-1.77dB" },
-	{ 4, "0dB" },
-	{ 5, "1dB" },
-	{ 6, "2dB" },
-	{ 7, "3dB" },
-	{ 0, NULL }
-};
-
-static const value_string transmission_mode_vals[] = {
-	{ 1, "Mode 1" },
-	{ 2, "Mode 2" },
-	{ 3, "Mode 3" },
-	{ 4, "Mode 4" },
-	{ 5, "Mode 5" },
-	{ 6, "Mode 6" },
-	{ 7, "Mode 7" },
-	{ 8, "Mode 8" },
-	{ 9, "Mode 9" },
-	{ 10, "Mode 10" },
-	{ 0, NULL }
-};
-
-static const value_string nfapi_ul_config_pdu_type_vals[] = {
-	{ 0, "ULSCH" },
-	{ 1, "ULSCH_CQI_RI" },
-	{ 2, "ULSCH_HARQ" },
-	{ 3, "ULSCH_CQI_HARQ_RI" },
-	{ 4, "UCI_CQI" },
-	{ 5, "UCI_SR" },
-	{ 6, "UCI_HARQ" },
-	{ 7, "UCI_SR_HARQ" },
-	{ 8, "UCI_CQI_HARQ" },
-	{ 9, "UCI_CQI_SR" },
-	{ 10, "UCI_CQI_SR_HARQ" },
-	{ 11, "SRS" },
-	{ 12, "HARQ_BUFFER" },
-	{ 13, "ULSCH_UCI_CSI" },
-	{ 14, "ULSCH_UCI_HARQ" },
-	{ 15, "ULSCH_CSI_UCI_HARQ" },
-	{ 0, NULL }
-};
-
-typedef enum {
-	NFAPI_ACK_NACK_MODE_BUNDLING = 0,
-	NFAPI_ACK_NACK_MODE_MULTIPLEXING,
-	NFAPI_ACK_NACK_MODE_FORMAT_1B_WITH_CHAN_SEL,
-	NFAPI_ACK_NACK_MODE_FORMAT_3,
-} nfapi_ack_nack_mode_e;
-
-static const value_string nfapi_ack_nack_mode_vals[] = {
-	{ NFAPI_ACK_NACK_MODE_BUNDLING, "Bundling" },
-	{ NFAPI_ACK_NACK_MODE_MULTIPLEXING, "Multiplexing" },
-	{ NFAPI_ACK_NACK_MODE_FORMAT_1B_WITH_CHAN_SEL, "Format 1b with channel selection" },
-	{ NFAPI_ACK_NACK_MODE_FORMAT_3, "Format 3" },
-	{ 0, NULL }
-};
-
-typedef enum {
-	NFAPI_ANTENNA_PORT1 = 0,
-	NFAPI_ANTENNA_PORT2,
-	NFAPI_ANTENNA_PORT4,
-} nfapi_ack_nack_mode_e;
-
-static const value_string nfapi_antenna_port_vals[] = {
-	{ NFAPI_ANTENNA_PORT1, "1 " },
-	{ NFAPI_ANTENNA_PORT2, "2 " },
-	{ NFAPI_ANTENNA_PORT4, "4 " },
-	{ 0, NULL }
-};
-
-typedef enum{
-	PHICH_R_ONE_SIXTH = 0,
-	PHICH_R_HALF,
-	PHICH_R_ONE,
-	PHICH_R_TWO
-} nfapi_phich_resource_e;
-
-static const value_string nfapi_phich_resource_vals[] = {
-	{ PHICH_R_ONE_SIXTH, "PHICH_R_ONE_SIXTH " },
-	{ PHICH_R_HALF, "PHICH_R_HALF" },
-	{ PHICH_R_ONE, "PHICH_R_ONE" },
-	{ PHICH_R_TWO, "PHICH_R_TWO" },
-	{ 0, NULL }
-};
-
-static const value_string local_distributed_vals[] = {
-	{ 0, "localized" },
-	{ 1, "distributed" },
-	{ 0, NULL }
-};
-
-static const value_string transport_block_to_codeword_swap_flag_vals[] = {
-	{ 0, "no swapping" },
-	{ 1, "swapped" },
-	{ 0, NULL }
-};
-
-static const value_string ngap_vals[] = {
-	{ 0, "Ngap1" },
-	{ 1, "Ngap2" },
-	{ 0, NULL }
-};
-
-static const value_string true_false_vals[] = {
-	{ 0, "false" },
-	{ 1, "true" },
-	{ 0, NULL }
-};
-
-static const value_string exhustive_search_vals[] = {
-	{ 0, "non-exhaustive search" },
-	{ 1, "exhaustive search" },
-	{ 0, NULL }
-};
-
-static const value_string not_used_enabled_vals[] = {
-	{ 0, "not used" },
-	{ 1, "enabled" },
-	{ 0, NULL }
-};
-
-static const value_string hopping_vals[] = {
-	{ 0, "no hopping" },
-	{ 1, "hopping enabled" },
-	{ 0, NULL }
-};
-
-
-static const value_string rnti_type_vals[] = {
-	{ 1, "C-RNTI" },
-	{ 2, "RA-RNTI, P-RNTI, SI-RNTI, SC-RNTI, G-RNTI" },
-	{ 3, "SPS-CRNTI" },
-	{ 0, NULL }
-};
-
-static const value_string primary_cells_type_vals[] = {
-	{ 1, "TDD" },
-	{ 2, "FDD" },
-	{ 3, "HD_FDD" },
-	{ 0, NULL }
-};
-
-static const value_string ul_rssi_supported_vals[] = {
-	{ 0, "Uplink RSSI not supported" },
-	{ 1, "Uplink RSSI supported" },
-	{ 0, NULL}
-};
-
-
-typedef enum
-{
-	NMM_NONE = 0,
-	NMM_ONLY,
-	NMM_IN_CONFIGURED_STATE,
-	NMM_IN_RUNNING_STATE,
-	NMM_IN_CONFIGURED_AND_RUNNING_STATE
-} nmm_modes_supported_e;
-
-static const value_string nmm_modes_supported_vals[] =
-{
-	{ NMM_NONE, "NONE" },
-	{ NMM_ONLY, "NMM_ONLY" },
-	{ NMM_IN_CONFIGURED_STATE, "NMM_IN_CONFIGURED_STATE" },
-	{ NMM_IN_RUNNING_STATE, "NMM_IN_RUNNING_STATE" },
-	{ NMM_IN_CONFIGURED_AND_RUNNING_STATE, "NMM_IN_CONFIGURED_AND_RUNNING_STAT" },
-	{ 0, NULL }
-};
-
-
-
-
-
-static int proto_nfapi = -1;
-
-/* These are for the subtrees */
-static gint ett_nfapi_message_tree = -1;
-static gint ett_nfapi_p4_p5_message_header = -1;
-static gint ett_nfapi_p7_message_header = -1;
Loading
Loading full blame...