From 7a5770947861d354e2e7e56a20ce70aa046b69c2 Mon Sep 17 00:00:00 2001
From: David Price <davpric2@cisco.com>
Date: Wed, 25 Oct 2017 14:45:37 +0100
Subject: [PATCH] Crashes around msg4 time, but understand that need to get the
 ACK for the UE UL of msg3 back to UE within 4ms

---
 nfapi/nfapi_pnf.c                         |  10 +-
 nfapi/nfapi_vnf.c                         |  18 +-
 open-nfapi.oai.patch                      | 542 ++++++++++++++++++----
 openair1/PHY/INIT/lte_init.c              |   5 +
 openair1/PHY/LTE_TRANSPORT/dci.c          |  18 +
 openair1/PHY/LTE_TRANSPORT/dci_tools.c    |   8 +-
 openair1/PHY/LTE_TRANSPORT/pbch.c         |   2 +-
 openair1/PHY/LTE_TRANSPORT/phich.c        |   2 +-
 openair1/SCHED/phy_procedures_lte_eNb.c   |  57 ++-
 openair2/ENB_APP/enb_config.c             |  13 +-
 openair2/LAYER2/MAC/config.c              |  47 +-
 openair2/LAYER2/MAC/eNB_scheduler_RA.c    | 102 ++--
 openair2/LAYER2/MAC/eNB_scheduler_bch.c   |   7 +-
 openair2/LAYER2/MAC/eNB_scheduler_dlsch.c |   3 +-
 openair2/LAYER2/MAC/eNB_scheduler_ulsch.c |   9 +-
 openair2/LAYER2/MAC/pre_processor.c       |   4 +-
 openair2/PHY_INTERFACE/IF_Module.c        |  54 +--
 openair2/PHY_INTERFACE/IF_Module.h        |   4 +-
 openair2/RRC/LITE/rrc_eNB.c               |   2 +-
 openair2/UTIL/LOG/vcd_signal_dumper.c     |  11 +
 openair2/UTIL/LOG/vcd_signal_dumper.h     |  10 +
 targets/RT/USER/lte-enb.c                 |  42 +-
 targets/RT/USER/lte-ru.c                  |  82 ----
 targets/RT/USER/lte-softmodem.c           |   9 +-
 targets/RT/USER/pnf.gtkw                  |   2 +
 25 files changed, 733 insertions(+), 330 deletions(-)

diff --git a/nfapi/nfapi_pnf.c b/nfapi/nfapi_pnf.c
index 4610382b67..d687562c29 100644
--- a/nfapi/nfapi_pnf.c
+++ b/nfapi/nfapi_pnf.c
@@ -1109,8 +1109,6 @@ int  pnf_phy_tx_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_tx_request_t* req)
   return 0;
 }
 
-extern void subtract_subframe(uint16_t *frameP, uint16_t *subframeP, int offset);
-
 int pnf_phy_ul_config_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request_t* req)
 {
   LOG_D(PHY,"[PNF] UL_CONFIG_REQ %s() sfn_sf:%d pdu:%d rach_prach_frequency_resources:%d srs_present:%u\n", 
@@ -1142,17 +1140,13 @@ int pnf_phy_ul_config_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request
     return -4;
   }
 
-  int sfn = NFAPI_SFNSF2SFN(req->sfn_sf);
-  int sf = NFAPI_SFNSF2SF(req->sfn_sf);
+  uint16_t sfn = NFAPI_SFNSF2SFN(req->sfn_sf);
+  uint16_t sf = NFAPI_SFNSF2SF(req->sfn_sf);
 
   struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
   eNB_rxtx_proc_t *proc = &eNB->proc.proc_rxtx[0];
   nfapi_ul_config_request_pdu_t* ul_config_pdu_list = req->ul_config_request_body.ul_config_pdu_list;
 
-  // subframe works off TX SFN/SF which is 4 ahead, need to put it back to RX SFN/SF
-  // probably could just use proc->frame_rx
-  subtract_subframe(&sfn, &sf, 4);
-
   for (int i=0;i<req->ul_config_request_body.number_of_pdus;i++)
   {
     NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() sfn/sf:%d PDU[%d] size:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), i, ul_config_pdu_list[i].pdu_size);
diff --git a/nfapi/nfapi_vnf.c b/nfapi/nfapi_vnf.c
index e3c03ad4b3..b361f62f6f 100644
--- a/nfapi/nfapi_vnf.c
+++ b/nfapi/nfapi_vnf.c
@@ -291,8 +291,6 @@ int vnf_unpack_vendor_extension_tlv(nfapi_tl_t* tl, uint8_t **ppReadPackedMessag
 void install_schedule_handlers(IF_Module_t *if_inst);
 extern int single_thread_flag;
 extern void init_eNB_afterRU(void);
-extern void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset);
-extern void subtract_subframe(uint16_t *frameP, uint16_t *subframeP, int offset);
 
 void oai_create_enb(void)
 {
@@ -327,10 +325,12 @@ void oai_create_enb(void)
     printf("%s() Waiting for eNB to become configured (by RRC/PHY) - need to wait otherwise NFAPI messages won't contain correct values\n", __FUNCTION__);
     usleep(50000);
   } while(eNB->configured != 1);
+  printf("%s() eNB is now configured\n", __FUNCTION__);
 }
 
 void oai_enb_init(void)
 {
+  printf("%s() About to call init_eNB_afterRU()\n", __FUNCTION__);
   init_eNB_afterRU();
 }
 
@@ -492,6 +492,8 @@ int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf)
 
   LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
 
+  //printf("%s(eNB:%p, sfn:%d, sf:%d)\n", __FUNCTION__, eNB, sfn, sf);
+
   //int i;
   struct timespec wait;
 
@@ -593,7 +595,7 @@ int phy_subframe_indication(struct nfapi_vnf_p7_config* config, uint16_t phy_id,
   static uint8_t first_time = 1;
   if (first_time)
   {
-    printf("[VNF] subframe indication %d\n", sfn_sf);
+    printf("[VNF] subframe indication %d\n", NFAPI_SFNSF2DEC(sfn_sf));
     first_time = 0;
   }
 
@@ -601,6 +603,8 @@ int phy_subframe_indication(struct nfapi_vnf_p7_config* config, uint16_t phy_id,
   //mac_subframe_ind(p7_vnf->mac, phy_id, sfn_sf);
 
 #if 1
+  //if (RC.eNB) printf("RC.eNB[0][0]->configured:%d\n", RC.eNB[0][0]->configured);
+
   if (RC.eNB && RC.eNB[0][0]->configured)
   {
     uint16_t sfn = NFAPI_SFNSF2SFN(sfn_sf);
@@ -630,9 +634,8 @@ int phy_rach_indication(struct nfapi_vnf_p7_config* config, nfapi_rach_indicatio
 
   pthread_mutex_lock(&eNB->UL_INFO_mutex);
 
-  eNB->UL_INFO.rach_ind.number_of_preambles                 = ind->rach_indication_body.number_of_preambles;
-  eNB->UL_INFO.rach_ind.preamble_list                       = eNB->preamble_list;
-  eNB->UL_INFO.rach_ind.tl.tag                              = NFAPI_RACH_INDICATION_BODY_TAG;
+  eNB->UL_INFO.rach_ind = *ind;
+  eNB->UL_INFO.rach_ind.rach_indication_body.preamble_list                       = eNB->preamble_list;
 
   for (int i=0;i<ind->rach_indication_body.number_of_preambles++;i++)
   {
@@ -702,13 +705,14 @@ int phy_crc_indication(struct nfapi_vnf_p7_config* config, nfapi_crc_indication_
 
   for (int i=0; i<ind->crc_indication_body.number_of_crcs; i++)
   {
+    memcpy(&dest_ind->crc_indication_body.crc_pdu_list[i], &ind->crc_indication_body.crc_pdu_list[i], sizeof(ind->crc_indication_body.crc_pdu_list[0]));
+
     LOG_D(MAC, "%s() PDU[%d] rnti:%04x UL_INFO:rnti:%04x\n", 
         __FUNCTION__,
         i, 
         ind->crc_indication_body.crc_pdu_list[i].rx_ue_information.rnti, 
         eNB->UL_INFO.crc_ind.crc_indication_body.crc_pdu_list[i].rx_ue_information.rnti);
 
-    memcpy(&dest_ind->crc_indication_body.crc_pdu_list[i], &ind->crc_indication_body.crc_pdu_list[i], sizeof(ind->crc_indication_body.crc_pdu_list[0]));
   }
 
   pthread_mutex_unlock(&eNB->UL_INFO_mutex);
diff --git a/open-nfapi.oai.patch b/open-nfapi.oai.patch
index 0a5ce1e3e0..1fefcdcab3 100644
--- a/open-nfapi.oai.patch
+++ b/open-nfapi.oai.patch
@@ -27,7 +27,7 @@ index 0e06963..3f017bc 100644
  
  	return 1;
 diff --git a/nfapi/src/nfapi_p7.c b/nfapi/src/nfapi_p7.c
-index a3b0141..76be11a 100644
+index a3b0141..4083a47 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
@@ -89,12 +89,12 @@ index a3b0141..76be11a 100644
 +          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;
 +        }
  }
@@ -140,7 +140,43 @@ index a3b0141..76be11a 100644
  }
  
  static uint8_t pack_rx_ue_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-@@ -2592,11 +2631,16 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
+@@ -1844,6 +1883,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 +1892,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)
+ 		{
++                  printf("NFAPI_RX_INDICATION_REL9_TAG\n");
+ 			offset += 4 + 2;
+ 		}
+ 	}
+@@ -2592,11 +2638,16 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
  		return -1;
  	}
  
@@ -157,7 +193,7 @@ index a3b0141..76be11a 100644
  			result = pack_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config);
  			break;
  
-@@ -2609,6 +2653,7 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
+@@ -2609,6 +2660,7 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
  			break;
  
  		case NFAPI_TX_REQUEST:
@@ -165,7 +201,15 @@ index a3b0141..76be11a 100644
  			result = pack_tx_request(pMessageHeader, &pWritePackedMessage, end, config);
  			break;
  
-@@ -4394,6 +4439,14 @@ static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *
+@@ -2621,6 +2673,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;
+ 
+@@ -4394,6 +4447,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;
@@ -245,10 +289,10 @@ index 74f29a0..7310fc0 100644
  	}
  
 diff --git a/pnf/src/pnf_p7.c b/pnf/src/pnf_p7.c
-index 0fd7828..263f93c 100644
+index 0fd7828..db08efb 100644
 --- a/pnf/src/pnf_p7.c
 +++ b/pnf/src/pnf_p7.c
-@@ -25,12 +25,13 @@
+@@ -25,12 +25,61 @@
  #include <unistd.h>
  #include <errno.h>
  #include <pthread.h>
@@ -259,11 +303,59 @@ index 0fd7828..263f93c 100644
  #define FAPI2_IP_DSCP	0
  
 -uint32_t get_current_time_hr()
++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 +65,14 @@ void pnf_p7_free(pnf_p7_t* pnf_p7, void* ptr)
+@@ -64,11 +113,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) 
  { 
@@ -279,7 +371,7 @@ index 0fd7828..263f93c 100644
  	if(pnf_p7->_public.codec_config.deallocate)
  	{
  		(pnf_p7->_public.codec_config.deallocate)(req->dl_config_request_body.dl_config_pdu_list);
-@@ -83,11 +87,14 @@ void deallocate_nfapi_dl_config_request(nfapi_dl_config_request_t* req, pnf_p7_t
+@@ -83,11 +135,14 @@ void deallocate_nfapi_dl_config_request(nfapi_dl_config_request_t* req, pnf_p7_t
  
  nfapi_ul_config_request_t* allocate_nfapi_ul_config_request(pnf_p7_t* pnf_p7) 
  { 
@@ -295,7 +387,7 @@ index 0fd7828..263f93c 100644
  	if(pnf_p7->_public.codec_config.deallocate)
  	{
  		(pnf_p7->_public.codec_config.deallocate)(req->ul_config_request_body.ul_config_pdu_list);
-@@ -107,6 +114,7 @@ nfapi_hi_dci0_request_t* allocate_nfapi_hi_dci0_request(pnf_p7_t* pnf_p7)
+@@ -107,6 +162,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) 
  { 
@@ -303,7 +395,7 @@ index 0fd7828..263f93c 100644
  	if(pnf_p7->_public.codec_config.deallocate)
  	{
  		(pnf_p7->_public.codec_config.deallocate)(req->hi_dci0_request_body.hi_dci0_pdu_list);
-@@ -127,6 +135,9 @@ nfapi_tx_request_t* allocate_nfapi_tx_request(pnf_p7_t* pnf_p7)
+@@ -127,6 +183,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;
@@ -313,7 +405,7 @@ index 0fd7828..263f93c 100644
  	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;
-@@ -307,11 +318,11 @@ void pnf_p7_rx_reassembly_queue_remove_old_msgs(pnf_p7_t* pnf_p7, pnf_p7_rx_reas
+@@ -307,11 +366,11 @@ void pnf_p7_rx_reassembly_queue_remove_old_msgs(pnf_p7_t* pnf_p7, pnf_p7_rx_reas
  }
  
  
@@ -327,10 +419,15 @@ index 0fd7828..263f93c 100644
  		return 0;
  	}
  	else
-@@ -482,29 +493,36 @@ void pnf_pack_and_send_timing_info(pnf_p7_t* pnf_p7)
+@@ -482,29 +541,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;
@@ -369,96 +466,165 @@ index 0fd7828..263f93c 100644
  		(pnf_p7->_public.lbt_dl_config_req)(&pnf_p7->_public, pnf_p7->_public.dummy_subframe.lbt_dl_config_req);
  	}
  }
-@@ -527,7 +545,7 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
+@@ -526,10 +597,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, 4);
++        uint32_t tx_sfn_sf_dec = NFAPI_SFNSF2DEC(sfn_sf_tx);
++
  	// If the subframe_buffer has been configured
-@@ -558,18 +576,38 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
+ 	if(pnf_p7->_public.subframe_buffer_size != 0)
+ 	{
+@@ -550,6 +625,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 +637,104 @@ 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]);
  
-+                //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() subframe_buffer->sfn_sf:%d sfn_sf:%d sfn_sf_dec:%d buffer_index:%u subframe_buffer->dl_config_req:%p\n", 
-+                    //__FUNCTION__, subframe_buffer->sfn_sf, sfn_sf, sfn_sf_dec, buffer_index, subframe_buffer->dl_config_req);
++		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)
+-		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->tx_req != 0)
-+			{
+-			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), subframe_buffer->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
+ 			}
+ 			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.tx_req->sfn_sf = sfn_sf;
+ 				{
+-					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->dl_config_req != 0)
+ 				}
+ 			}
+ 
+-			if(subframe_buffer->ul_config_req != 0)
++			if(tx_subframe_buffer->dl_config_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.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_dl_config_request(subframe_buffer->dl_config_req, pnf_p7);
+-				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
  			{
-@@ -586,7 +624,7 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
- 				if(pnf_p7->_public.ul_config_req)
- 					(pnf_p7->_public.ul_config_req)(&(pnf_p7->_public), subframe_buffer->ul_config_req);
- 
--				deallocate_nfapi_ul_config_request(subframe_buffer->ul_config_req, pnf_p7);
-+				//deallocate_nfapi_ul_config_request(subframe_buffer->ul_config_req, pnf_p7);
+ 				// 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);
+ 				}
  			}
- 			else
+ 
+-			if(subframe_buffer->hi_dci0_req != 0)
++			if(tx_subframe_buffer->hi_dci0_req != 0)
  			{
-@@ -603,7 +641,7 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
  				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), 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
  			{
-@@ -615,29 +653,12 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
+ 				//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);
++			if(tx_subframe_buffer->tx_req != 0)
++                          deallocate_nfapi_tx_request(tx_subframe_buffer->tx_req, pnf_p7);
++                        if(tx_subframe_buffer->hi_dci0_req != 0)
++                          deallocate_nfapi_hi_dci0_request(tx_subframe_buffer->hi_dci0_req, pnf_p7);
++                }
++                else 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);
--			}
--			else
--			{
--				// send dummy
++				//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);
--				}
--			}
--
- 			if(subframe_buffer->lbt_dl_config_req != 0)
- 			{
++					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 +743,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);
  
@@ -467,25 +633,49 @@ index 0fd7828..263f93c 100644
  			}
  			else
  			{
-@@ -650,6 +671,17 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
+@@ -650,14 +756,31 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
  
  			}
  
-+                        if(subframe_buffer->dl_config_req != 0)
-+                          deallocate_nfapi_dl_config_request(subframe_buffer->dl_config_req, pnf_p7);
++                        //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);
-+                        if(subframe_buffer->hi_dci0_req != 0)
-+                          deallocate_nfapi_hi_dci0_request(subframe_buffer->hi_dci0_req, pnf_p7);
-+			if(subframe_buffer->tx_req != 0)
-+                          deallocate_nfapi_tx_request(subframe_buffer->tx_req, pnf_p7);
++                        //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);
 +
  			memset(&(pnf_p7->subframe_buffer[buffer_index]), 0, sizeof(nfapi_pnf_p7_subframe_buffer_t));
  			pnf_p7->subframe_buffer[buffer_index].sfn_sf = -1;
  		}
-@@ -685,7 +717,7 @@ 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);
++                  //printf("NOT CALLING //send_dummy_subframe\n");
++
++			send_dummy_subframe(pnf_p7, sfn_sf_tx);
+ 		}
+ 
++                //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 +801,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)
  	{
  
@@ -494,7 +684,15 @@ index 0fd7828..263f93c 100644
  					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, 
-@@ -724,7 +756,7 @@ uint8_t is_p7_request_in_window(uint16_t sfnsf, const char* name, pnf_p7_t* phy)
+@@ -694,6 +818,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 +849,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
@@ -503,7 +701,7 @@ index 0fd7828..263f93c 100644
  			}
  			else
  			{
-@@ -736,7 +768,7 @@ uint8_t is_p7_request_in_window(uint16_t sfnsf, const char* name, pnf_p7_t* phy)
+@@ -736,7 +861,7 @@ uint8_t is_p7_request_in_window(uint16_t sfnsf, const char* name, pnf_p7_t* phy)
  		else
  		{
  			// too late
@@ -512,7 +710,7 @@ index 0fd7828..263f93c 100644
  		}
  
  	}
-@@ -751,8 +783,8 @@ uint8_t is_p7_request_in_window(uint16_t sfnsf, const char* name, pnf_p7_t* phy)
+@@ -751,8 +876,8 @@ uint8_t is_p7_request_in_window(uint16_t sfnsf, const char* name, pnf_p7_t* phy)
  		}
  		else
  		{
@@ -523,7 +721,7 @@ index 0fd7828..263f93c 100644
  		}
  
  	}
-@@ -785,15 +817,32 @@ void pnf_handle_dl_config_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_
+@@ -785,15 +910,32 @@ void pnf_handle_dl_config_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_
  			return;
  		}
  
@@ -551,7 +749,7 @@ index 0fd7828..263f93c 100644
 +                  uint32_t sfn_sf_dec = NFAPI_SFNSF2DEC(req->sfn_sf);
 +                  uint8_t buffer_index = sfn_sf_dec % pnf_p7->_public.subframe_buffer_size;
 +
-+                  //printf("%s() POPULATE DL_CONFIG_REQ sfn_sf:%d buffer_index:%d\n", __FUNCTION__, sfn_sf_dec, buffer_index);
++                  printf("%s() POPULATE DL_CONFIG_REQ sfn_sf:%d buffer_index:%d\n", __FUNCTION__, 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)
@@ -561,11 +759,14 @@ index 0fd7828..263f93c 100644
  				//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));
-@@ -994,6 +1043,13 @@ void pnf_handle_tx_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
+@@ -994,6 +1136,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;
  
-+//printf("%s() POPULATE TX_REQ sfn_sf:%d buffer_index:%d\n", __FUNCTION__, sfn_sf_dec, buffer_index);
++                        struct timespec t;
++                        clock_gettime(CLOCK_MONOTONIC, &t);
++
++                        printf("%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__,
@@ -575,7 +776,16 @@ index 0fd7828..263f93c 100644
  			if(pnf_p7->subframe_buffer[buffer_index].tx_req != 0)
  			{
  				//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] Freeing tx_req at index %d (%d/%d)", 
-@@ -1126,12 +1182,27 @@ uint32_t calculate_t2(uint32_t now_time_hr, uint16_t sfn_sf, uint32_t sf_start_t
+@@ -1010,6 +1162,8 @@ void pnf_handle_tx_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
+ 		}
+ 		else
+ 		{
++                  printf("%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 +1280,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;
  
@@ -604,7 +814,7 @@ index 0fd7828..263f93c 100644
  
  	uint32_t sf_time_us = get_sf_time(now_time_hr, sf_start_time_hr);
  
-@@ -1391,6 +1462,8 @@ void pnf_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_time)
+@@ -1391,6 +1560,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);
  
@@ -613,7 +823,7 @@ index 0fd7828..263f93c 100644
  			if(recvfrom_result > 0)
  			{
  				pnf_handle_p7_message(pnf_p7->rx_message_buffer, recvfrom_result, pnf_p7, now_hr_time);
-@@ -1417,7 +1490,10 @@ void pnf_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_time)
+@@ -1417,7 +1588,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
@@ -625,7 +835,7 @@ index 0fd7828..263f93c 100644
  	}
  	while(recvfrom_result > 0);
  }
-@@ -1512,7 +1588,7 @@ int pnf_p7_message_pump(pnf_p7_t* pnf_p7)
+@@ -1512,7 +1686,7 @@ int pnf_p7_message_pump(pnf_p7_t* pnf_p7)
  
  		selectRetval = select(pnf_p7->p7_sock+1, &rfds, NULL, NULL, &timeout);
  
@@ -634,6 +844,49 @@ index 0fd7828..263f93c 100644
  
  		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
@@ -715,7 +968,7 @@ index e559730..0aba0a2 100644
  	info->timing_info_period = 128;
  
 diff --git a/vnf/src/vnf_p7.c b/vnf/src/vnf_p7.c
-index 8630385..4947c40 100644
+index 8630385..70f97d6 100644
 --- a/vnf/src/vnf_p7.c
 +++ b/vnf/src/vnf_p7.c
 @@ -15,6 +15,8 @@
@@ -864,7 +1117,13 @@ index 8630385..4947c40 100644
  		}
  		else
  		{
-@@ -981,7 +997,6 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+@@ -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;
  
@@ -914,15 +1173,33 @@ index 8630385..4947c40 100644
  										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\n\n\n\n\n\n\n\n\n", __FUNCTION__);
++          }
++        }
+ }
+ 
+ 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..0f9c90d 100644
+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 original_pselect_timeout;
  	struct timespec pselect_timeout;
  	pselect_timeout.tv_sec = 0;
  	pselect_timeout.tv_nsec = 1000000; // ns in a 1 us
@@ -951,7 +1228,7 @@ index ab4f00c..0f9c90d 100644
  
  			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,8 +199,18 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
+@@ -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);
@@ -965,12 +1242,31 @@ index ab4f00c..0f9c90d 100644
 +#endif
  			}
  
-+original_pselect_timeout = pselect_timeout;
++//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);
  
-@@ -237,34 +250,91 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
+-			//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)
  			*/
  			
  
@@ -1068,6 +1364,14 @@ index ab4f00c..0f9c90d 100644
  				}
  				/*
  				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)
@@ -1122,8 +1426,68 @@ index ab4f00c..0f9c90d 100644
  	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/xml/pnf_phy_1_A.xml b/xml/pnf_phy_1_A.xml
-index da6cc26..02a6b14 100644
+index da6cc26..45f8f46 100644
 --- a/xml/pnf_phy_1_A.xml
 +++ b/xml/pnf_phy_1_A.xml
 @@ -26,7 +26,7 @@
@@ -1143,13 +1507,13 @@ index da6cc26..02a6b14 100644
 -					<tx_addr>127.0.0.1</tx_addr>
 -					<tx_port>7733</tx_port>
 +					<rx_port>5201</rx_port>
-+					<tx_addr>192.168.1.78</tx_addr>
++					<tx_addr>192.168.1.28</tx_addr>
 +					<tx_port>5200</tx_port>
  				</udp>
  			</data>
  		</phy>
 diff --git a/xml/vnf_A.xml b/xml/vnf_A.xml
-index e609c93..ec14b7b 100644
+index e609c93..3791239 100644
 --- a/xml/vnf_A.xml
 +++ b/xml/vnf_A.xml
 @@ -2,8 +2,8 @@
@@ -1159,7 +1523,7 @@ index e609c93..ec14b7b 100644
 -			<port>5200</port>
 -			<address>127.0.0.1</address>
 +			<port>5201</port>
-+			<address>192.168.1.78</address>
++			<address>192.168.1.28</address>
  			<timing_window>10</timing_window>
  			<periodic_timing_enabled>0</periodic_timing_enabled>
  			<periodic_timing_window>0</periodic_timing_window>
@@ -1168,7 +1532,7 @@ index e609c93..ec14b7b 100644
  				<udp>
  					<rx_port>8891</rx_port>
 -					<tx_addr>127.0.0.1</tx_addr>
-+					<tx_addr>192.168.1.78</tx_addr>
++					<tx_addr>192.168.1.28</tx_addr>
  					<tx_port>8892</tx_port>
  				</udp>
  			</data>
diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c
index cea18b08e3..080bc96c8a 100644
--- a/openair1/PHY/INIT/lte_init.c
+++ b/openair1/PHY/INIT/lte_init.c
@@ -107,6 +107,11 @@ void phy_config_request(PHY_Config_t *phy_config) {
   AssertFatal(RC.eNB[Mod_id][CC_id] != NULL, "PHY instance %d, CCid %d doesn't exist\n",Mod_id,CC_id);
 
 
+  if (RC.eNB[Mod_id][CC_id]->configured == 1)
+  {
+    LOG_E(PHY,"Already eNB already configured, do nothing\n");
+    return;
+  }
 
   RC.eNB[Mod_id][CC_id]->mac_enabled     = 1;
 
diff --git a/openair1/PHY/LTE_TRANSPORT/dci.c b/openair1/PHY/LTE_TRANSPORT/dci.c
index a832628646..45ca334d52 100755
--- a/openair1/PHY/LTE_TRANSPORT/dci.c
+++ b/openair1/PHY/LTE_TRANSPORT/dci.c
@@ -43,6 +43,7 @@
 #include "assertions.h" 
 #include "T.h"
 #include "UTIL/LOG/log.h"
+#include "UTIL/LOG/vcd_signal_dumper.h"
 
 //#define DEBUG_DCI_ENCODING 1
 //#define DEBUG_DCI_DECODING 1
@@ -2065,6 +2066,8 @@ void pdcch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
   uint8_t reset;
   uint32_t x1, x2, s=0;
 
+  //LOG_D(PHY, "%s(fp, subframe:%d, e, length:%d)\n", __FUNCTION__, subframe, length);
+
   reset = 1;
   // x1 is set in lte_gold_generic
 
@@ -2252,11 +2255,13 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
   }
 
 
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_PCFICH,1);
   generate_pcfich(num_pdcch_symbols,
                   amp,
                   frame_parms,
                   txdataF,
                   subframe);
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_PCFICH,0);
   wbar[0] = &wbar0[0];
   wbar[1] = &wbar1[0];
   y[0] = &yseq0[0];
@@ -2277,6 +2282,7 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
 
   e_ptr = e;
 
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DCI0,1);
 
   // generate DCIs in order of decreasing aggregation level, then common/ue spec
   // MAC is assumed to have ordered the UE spec DCI according to the RNTI-based randomization
@@ -2303,20 +2309,26 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
       }
     }
   }
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DCI0,0);
 
   // Scrambling
 #ifdef DEBUG_DCI_ENCODING
   printf("pdcch scrambling\n");
 #endif
+  //LOG_D(PHY, "num_pdcch_symbols:%d mi:%d nquad:%d\n", num_pdcch_symbols, mi, get_nquad(num_pdcch_symbols, frame_parms, mi));
+
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_SCRAMBLING,1);
   pdcch_scrambling(frame_parms,
                    subframe,
                    e,
                    8*get_nquad(num_pdcch_symbols, frame_parms, mi));
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_SCRAMBLING,0);
   //72*get_nCCE(num_pdcch_symbols,frame_parms,mi));
 
 
 
 
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_MODULATION,1);
   // Now do modulation
   if (frame_parms->nb_antenna_ports_eNB==1)
     gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15)>>15);
@@ -2329,6 +2341,7 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
   printf(" PDCCH Modulation, Msymb %d, Msymb2 %d,gain_lin_QPSK %d\n",Msymb,Msymb2,gain_lin_QPSK);
 #endif
 
+  //LOG_D(PHY,"%s() Msymb2:%d\n", __FUNCTION__, Msymb2);
 
   if (frame_parms->nb_antenna_ports_eNB==1) { //SISO
 
@@ -2375,16 +2388,20 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
 
     }
   }
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_MODULATION,0);
 
 
 #ifdef DEBUG_DCI_ENCODING
   printf(" PDCCH Interleaving\n");
 #endif
 
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_INTERLEAVING,1);
   //  printf("y %p (%p,%p), wbar %p (%p,%p)\n",y,y[0],y[1],wbar,wbar[0],wbar[1]);
   // This is the interleaving procedure defined in 36-211, first part of Section 6.8.5
   pdcch_interleaving(frame_parms,&y[0],&wbar[0],num_pdcch_symbols,mi);
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_INTERLEAVING,0);
 
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_TX,1);
   mprime=0;
   nsymb = (frame_parms->Ncp==0) ? 14:12;
   re_offset = frame_parms->first_carrier_offset;
@@ -2519,6 +2536,7 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
     if (re_offset == (frame_parms->ofdm_symbol_size))
       re_offset = 1;
   } // kprime loop
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_TX,0);
 
   return(num_pdcch_symbols);
 }
diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c
index c3dd49f3dc..69836209db 100644
--- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c
+++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c
@@ -2529,13 +2529,15 @@ void fill_ulsch(PHY_VARS_eNB *eNB,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame
   else  ulsch->harq_processes[harq_pid]->round++;
 
   ulsch->rnti = ulsch_pdu->ulsch_pdu_rel8.rnti;
-  LOG_D(PHY,"Filling ULSCH %x (UE_id %d) (new_ulsch %d) for Frame %d, Subframe %d : harq_pid %d, first_rb %d, nb_rb %d, rvidx %d, Qm %d, TBS %d, round %d \n",
+  LOG_D(PHY,"Filling ULSCH %x (UE_id %d) (new_ulsch %d) for Frame %d, Subframe %d : harq_pid %d, status %d, handled %d, first_rb %d, nb_rb %d, rvidx %d, Qm %d, TBS %d, round %d \n",
 	ulsch->rnti,
         UE_id,
         new_ulsch,
 	frame,
 	subframe,
 	harq_pid,
+	ulsch->harq_processes[harq_pid]->status,
+	ulsch->harq_processes[harq_pid]->handled,
 	ulsch->harq_processes[harq_pid]->first_rb,
 	ulsch->harq_processes[harq_pid]->nb_rb,
 	ulsch->harq_processes[harq_pid]->rvidx,
@@ -6396,7 +6398,7 @@ uint8_t pdcch_alloc2ul_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n)
   else
     ul_subframe = ((n+4)%10);
 
-  LOG_D(PHY, "subframe %d: PUSCH subframe = %d\n", n, ul_subframe);
+  //LOG_D(PHY, "subframe %d: PUSCH subframe = %d\n", n, ul_subframe);
   return ul_subframe;
 }
 
@@ -6437,7 +6439,7 @@ uint32_t pdcch_alloc2ul_frame(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, ui
   else
     ul_frame = (frame+(n>=6 ? 1 : 0));
 
-  LOG_D(PHY, "frame %d subframe %d: PUSCH frame = %d\n", frame, n, ul_frame);
+  //LOG_D(PHY, "frame %d subframe %d: PUSCH frame = %d\n", frame, n, ul_frame);
   return ul_frame % 1024;
 }
 
diff --git a/openair1/PHY/LTE_TRANSPORT/pbch.c b/openair1/PHY/LTE_TRANSPORT/pbch.c
index cef4545af3..d25cd7cc93 100644
--- a/openair1/PHY/LTE_TRANSPORT/pbch.c
+++ b/openair1/PHY/LTE_TRANSPORT/pbch.c
@@ -174,7 +174,7 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch,
   pbch_E  = (frame_parms->Ncp==NORMAL) ? 1920 : 1728; //RE/RB * #RB * bits/RB (QPSK)
   //  pbch_E_bytes = pbch_coded_bits>>3;
 
-  //LOG_D(PHY,"%s(eNB_pbch:%p txdataF:%p amp:%d frame_parms:%p pbch_pdu:%p frame_mod4:%d)\n", __FUNCTION__, eNB_pbch, txdataF, amp, frame_parms, pbch_pdu, frame_mod4==0);
+  LOG_D(PHY,"%s(eNB_pbch:%p txdataF:%p amp:%d frame_parms:%p pbch_pdu:%p frame_mod4:%d)\n", __FUNCTION__, eNB_pbch, txdataF, amp, frame_parms, pbch_pdu, frame_mod4==0);
 
   if (frame_mod4==0) {
     bzero(pbch_a,PBCH_A>>3);
diff --git a/openair1/PHY/LTE_TRANSPORT/phich.c b/openair1/PHY/LTE_TRANSPORT/phich.c
index 0f6270956c..fcd4895987 100644
--- a/openair1/PHY/LTE_TRANSPORT/phich.c
+++ b/openair1/PHY/LTE_TRANSPORT/phich.c
@@ -162,7 +162,7 @@ int phich_frame2_pusch_frame(LTE_DL_FRAME_PARMS *frame_parms, int frame, int sub
     pusch_frame = (frame);
   }
 
-  LOG_D(PHY, "frame %d subframe %d: PUSCH frame = %d\n", frame, subframe, pusch_frame);
+  //LOG_D(PHY, "frame %d subframe %d: PUSCH frame = %d\n", frame, subframe, pusch_frame);
   return pusch_frame % 1024;
 }
 
diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c
index a993665512..be5983d1bf 100644
--- a/openair1/SCHED/phy_procedures_lte_eNb.c
+++ b/openair1/SCHED/phy_procedures_lte_eNb.c
@@ -488,18 +488,23 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
     
   //LOG_D(PHY,"Before generate_dci_top num_pdcch_symbols:%d num_dci:%d dci_alloc:dci_length:%d\n", num_pdcch_symbols, num_dci, eNB->pdcch_vars[subframe&1].dci_alloc[0].dci_length);
 
-  generate_dci_top(num_pdcch_symbols,
-      num_dci,
-      &eNB->pdcch_vars[subframe&1].dci_alloc[0],
-      0,
-      AMP,
-      fp,
-      eNB->common_vars.txdataF,
-      subframe);
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,1);
+
+  if (nfapi_mode == 0 || nfapi_mode == 1) {
+    generate_dci_top(num_pdcch_symbols,
+        num_dci,
+        &eNB->pdcch_vars[subframe&1].dci_alloc[0],
+        0,
+        AMP,
+        fp,
+        eNB->common_vars.txdataF,
+        subframe);
+  }
 
 
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,0);
 
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,1);
   // Now scan UE specific DLSCH
   LTE_eNB_DLSCH_t *dlsch0,*dlsch1;
   for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++)
@@ -543,12 +548,15 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
         dlsch0->subframe_tx[subframe]=0;
       }
     }
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,0);
 
 
 
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_PHICH,0);
   generate_phich_top(eNB,
 		     proc,
 		     AMP);
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_PHICH,1);
 
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX+offset,0);
   if (do_meas==1) stop_meas(&eNB->phy_proc_tx);
@@ -570,14 +578,14 @@ void prach_procedures(PHY_VARS_eNB *eNB,
     subframe = eNB->proc.subframe_prach_br;
     frame = eNB->proc.frame_prach_br;
     pthread_mutex_lock(&eNB->UL_INFO_mutex);
-    eNB->UL_INFO.rach_ind_br.number_of_preambles=0;
+    eNB->UL_INFO.rach_ind_br.rach_indication_body.number_of_preambles=0;
     pthread_mutex_unlock(&eNB->UL_INFO_mutex);
   }
   else
 #endif
     {
       pthread_mutex_lock(&eNB->UL_INFO_mutex);
-      eNB->UL_INFO.rach_ind.number_of_preambles=0;
+      eNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles=0;
       pthread_mutex_unlock(&eNB->UL_INFO_mutex);
       subframe = eNB->proc.subframe_prach;
       frame = eNB->proc.frame_prach;
@@ -632,7 +640,7 @@ void prach_procedures(PHY_VARS_eNB *eNB,
       
     prach_mask = is_prach_subframe(&eNB->frame_parms,eNB->proc.frame_prach_br,eNB->proc.subframe_prach_br);
     
-    eNB->UL_INFO.rach_ind_br.preamble_list                              = eNB->preamble_list_br;
+    eNB->UL_INFO.rach_ind_br.rach_indication_body.preamble_list                              = eNB->preamble_list_br;
     int ind=0;
     int ce_level=0;
     /* Save for later, it doesn't work    
@@ -645,7 +653,7 @@ void prach_procedures(PHY_VARS_eNB *eNB,
     */ 
     if (eNB->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[0]==1){ 
       if (max_preamble_energy[0] > 350) {
-	eNB->UL_INFO.rach_ind_br.number_of_preambles++;
+	eNB->UL_INFO.rach_ind_br.rach_indication_body.number_of_preambles++;
 	
 	eNB->preamble_list_br[ind].preamble_rel8.timing_advance        = max_preamble_delay[ind];//
 	eNB->preamble_list_br[ind].preamble_rel8.preamble              = max_preamble[ind];
@@ -691,9 +699,11 @@ void prach_procedures(PHY_VARS_eNB *eNB,
 	    
 	    pthread_mutex_lock(&eNB->UL_INFO_mutex);
 	    
-	    eNB->UL_INFO.rach_ind.number_of_preambles                 = 1;
-	    eNB->UL_INFO.rach_ind.preamble_list                       = &eNB->preamble_list[0];
-	    eNB->UL_INFO.rach_ind.tl.tag                              = NFAPI_RACH_INDICATION_BODY_TAG;
+	    eNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles  = 1;
+	    eNB->UL_INFO.rach_ind.rach_indication_body.preamble_list        = &eNB->preamble_list[0];
+	    eNB->UL_INFO.rach_ind.rach_indication_body.tl.tag               = NFAPI_RACH_INDICATION_BODY_TAG;
+            eNB->UL_INFO.rach_ind.header.message_id                         = NFAPI_RACH_INDICATION;
+            eNB->UL_INFO.rach_ind.sfn_sf                                    = frame<<4 | subframe;
 	    
 	    eNB->preamble_list[0].preamble_rel8.tl.tag                = NFAPI_PREAMBLE_REL8_TAG;
 	    eNB->preamble_list[0].preamble_rel8.timing_advance        = max_preamble_delay[0];
@@ -705,21 +715,17 @@ void prach_procedures(PHY_VARS_eNB *eNB,
             // If NFAPI PNF then we need to send the message to the VNF
             if (nfapi_mode == 1)
             {
-              nfapi_rach_indication_t rach_ind;
-              rach_ind.header.message_id = NFAPI_RACH_INDICATION;
-              rach_ind.sfn_sf = frame<<4 | subframe;
-              rach_ind.rach_indication_body = eNB->UL_INFO.rach_ind;
-
               LOG_E(PHY,"\n\n\n\nDJP - this needs to be sent to VNF **********************************************\n\n\n\n");
               LOG_E(PHY,"Filling NFAPI indication for RACH : SFN_SF:%d TA %d, Preamble %d, rnti %x, rach_resource_type %d\n",
-                  NFAPI_SFNSF2DEC(rach_ind.sfn_sf),
+                  NFAPI_SFNSF2DEC(eNB->UL_INFO.rach_ind.sfn_sf),
                   eNB->preamble_list[0].preamble_rel8.timing_advance,
                   eNB->preamble_list[0].preamble_rel8.preamble,
                   eNB->preamble_list[0].preamble_rel8.rnti,
                   eNB->preamble_list[0].preamble_rel13.rach_resource_type);	    
 
+              oai_nfapi_rach_ind(&eNB->UL_INFO.rach_ind);
 
-              oai_nfapi_rach_ind(&rach_ind);
+              eNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles = 0;
             }
 
 	    pthread_mutex_unlock(&eNB->UL_INFO_mutex);
@@ -1315,8 +1321,9 @@ void pusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
   for (i=0; i<NUMBER_OF_UE_MAX; i++) {
     ulsch = eNB->ulsch[i];
     ulsch_harq = ulsch->harq_processes[harq_pid];
-    if (ulsch->rnti>0) LOG_D(PHY,"Frame %d, subframe %d: PUSCH procedures, harq_pid %d, UE %d/%x\n",
-			     frame,subframe,harq_pid,i,ulsch->rnti);
+    if (ulsch->rnti>0) LOG_D(PHY,"eNB->ulsch[%d]->harq_processes[harq_pid:%d] Frame %d, subframe %d: PUSCH procedures, harq_pid %d, UE %d/%x ulsch_harq[status:%d frame:%d subframe:%d handled:%d]\n",
+			     i, harq_pid, frame,subframe,harq_pid,i,ulsch->rnti,
+                             ulsch_harq->status, ulsch_harq->frame, ulsch_harq->subframe, ulsch_harq->handled);
     
     if ((ulsch) &&
         (ulsch->rnti>0) &&
@@ -1995,7 +2002,7 @@ void fill_crc_indication(PHY_VARS_eNB *eNB,int UE_id,int frame,int subframe,uint
 
   eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs++;
 
-  LOG_D(PHY, "%s() rnti:%04x crcs:%d\n", __FUNCTION__, pdu->rx_ue_information.rnti, eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs);
+  LOG_D(PHY, "%s() rnti:%04x crcs:%d crc_flag:%d\n", __FUNCTION__, pdu->rx_ue_information.rnti, eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs, crc_flag);
 
   pthread_mutex_unlock(&eNB->UL_INFO_mutex);
 }
diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c
index 6d85ff5330..8afc9b60d8 100644
--- a/openair2/ENB_APP/enb_config.c
+++ b/openair2/ENB_APP/enb_config.c
@@ -307,6 +307,9 @@ void RCconfig_L1(void) {
 
         configure_nfapi_pnf(RC.eNB[j][0]->eth_params_n.remote_addr, RC.eNB[j][0]->eth_params_n.remote_portc, RC.eNB[j][0]->eth_params_n.my_addr, RC.eNB[j][0]->eth_params_n.my_portd, RC.eNB[j][0]->eth_params_n     .remote_portd);
 
+        set_comp_log(PHY, LOG_DEBUG, LOG_FULL, 1);
+        printf("DJP - forcing PHY to DEBUG - should see similar line if it works\n");
+        LOG_E(PHY,"%s() DJP - forcing PHY to LOG_DEBUG for NFAPI PNF\n", __FUNCTION__);
       }
       else { // other midhaul
       }	
@@ -391,6 +394,14 @@ void RCconfig_macrlc() {
         printf("**************** vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc);
         configure_nfapi_vnf(RC.mac[j]->eth_params_s.my_addr, RC.mac[j]->eth_params_s.my_portc);
         printf("**************** RETURNED FROM configure_nfapi_vnf() vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc);
+
+        set_comp_log(MAC, LOG_DEBUG, LOG_FULL, 1);
+        set_comp_log(RRC, LOG_DEBUG, LOG_FULL, 1);
+        set_comp_log(PHY, LOG_DEBUG, LOG_FULL, 1);
+        printf("DJP - forcing MAC/RRC/PHY to DEBUG - should see similar line if it works\n");
+        LOG_D(MAC,"%s() DJP - forcing MAC to LOG_DEBUG for VNF\n", __FUNCTION__);
+        LOG_D(RRC,"%s() DJP - forcing RRC to LOG_DEBUG for VNF\n", __FUNCTION__);
+        LOG_I(PHY,"%s() DJP - forcing PHY to LOG_DEBUG for VNF\n", __FUNCTION__);
       
       } else { // other midhaul
 	AssertFatal(1==0,"MACRLC %d: %s unknown southbound midhaul\n",j,*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr));
@@ -474,7 +485,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
   int32_t     rach_powerRampingStep         = 0;
   int32_t     rach_preambleInitialReceivedTargetPower    = 0;
   int32_t     rach_preambleTransMax         = 0;
-  int32_t     rach_raResponseWindowSize     = 0;
+  int32_t     rach_raResponseWindowSize     = 10;
   int32_t     rach_macContentionResolutionTimer = 0;
   int32_t     rach_maxHARQ_Msg3Tx           = 0;
   int32_t     pcch_defaultPagingCycle       = 0;
diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c
index 6a6d4205b1..771afa2ecc 100644
--- a/openair2/LAYER2/MAC/config.c
+++ b/openair2/LAYER2/MAC/config.c
@@ -747,18 +747,21 @@ int rrc_mac_config_req_eNB(module_id_t                      Mod_idP,
 
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_IN);
 
-  
-  if (mib!=NULL) {
-    if (RC.mac == NULL) l2_init_eNB();
+  LOG_D(MAC, "RC.mac:%p mib:%p\n", RC.mac, mib);
+
+  if (RC.mac == NULL) {
+    l2_init_eNB();
 
     mac_top_init_eNB();
+  }
 
-    RC.mac[Mod_idP]->common_channels[CC_idP].mib             = mib;
-    RC.mac[Mod_idP]->common_channels[CC_idP].physCellId      = physCellId;
-    RC.mac[Mod_idP]->common_channels[CC_idP].p_eNB           = p_eNB;
-    RC.mac[Mod_idP]->common_channels[CC_idP].Ncp             = Ncp;
-    RC.mac[Mod_idP]->common_channels[CC_idP].eutra_band      = eutra_band;
-    RC.mac[Mod_idP]->common_channels[CC_idP].dl_CarrierFreq  = dl_CarrierFreq;
+  if (mib!=NULL) {
+      RC.mac[Mod_idP]->common_channels[CC_idP].mib             = mib;
+      RC.mac[Mod_idP]->common_channels[CC_idP].physCellId      = physCellId;
+      RC.mac[Mod_idP]->common_channels[CC_idP].p_eNB           = p_eNB;
+      RC.mac[Mod_idP]->common_channels[CC_idP].Ncp             = Ncp;
+      RC.mac[Mod_idP]->common_channels[CC_idP].eutra_band      = eutra_band;
+      RC.mac[Mod_idP]->common_channels[CC_idP].dl_CarrierFreq  = dl_CarrierFreq;
 
     LOG_I(MAC,
 	  "Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d,Nid_cell %d,p %d,DL freq %u,phich_config.resource %d, phich_config.duration %d)\n",
@@ -787,7 +790,6 @@ int rrc_mac_config_req_eNB(module_id_t                      Mod_idP,
 	       );
 
     mac_init_cell_params(Mod_idP,CC_idP);
-  }
   if (schedulingInfoList!=NULL)  {
     RC.mac[Mod_idP]->common_channels[CC_idP].tdd_Config         = tdd_Config;    
     RC.mac[Mod_idP]->common_channels[CC_idP].schedulingInfoList = schedulingInfoList;    
@@ -827,6 +829,7 @@ int rrc_mac_config_req_eNB(module_id_t                      Mod_idP,
 
 
   }
+  } // mib != NULL
 
 
   // SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters->logicalChannelGroup
@@ -926,23 +929,27 @@ int rrc_mac_config_req_eNB(module_id_t                      Mod_idP,
 
 #endif
 
-  while(RC.mac[Mod_idP]->if_inst->PHY_config_req == NULL) {
-    // DJP AssertFatal(RC.mac[Mod_idP]->if_inst->PHY_config_req != NULL,"if_inst->phy_config_request is null\n");
-    usleep(100 * 1000);
-    printf("Waiting for PHY_config_req\n");
-  }
-  PHY_Config_t phycfg;
-  phycfg.Mod_id = Mod_idP;
-  phycfg.CC_id  = CC_idP;
-  phycfg.cfg    = &RC.mac[Mod_idP]->config[CC_idP];
 
-  if (RC.mac[Mod_idP]->if_inst->PHY_config_req) RC.mac[Mod_idP]->if_inst->PHY_config_req(&phycfg); 
+  if (RC.mac[Mod_idP]->if_inst->PHY_config_req == NULL)
+  {
+    while(RC.mac[Mod_idP]->if_inst->PHY_config_req == NULL) {
+      // DJP AssertFatal(RC.mac[Mod_idP]->if_inst->PHY_config_req != NULL,"if_inst->phy_config_request is null\n");
+      usleep(100 * 1000);
+      printf("Waiting for PHY_config_req\n");
+    }
+    PHY_Config_t phycfg;
+    phycfg.Mod_id = Mod_idP;
+    phycfg.CC_id  = CC_idP;
+    phycfg.cfg    = &RC.mac[Mod_idP]->config[CC_idP];
 
+    if (RC.mac[Mod_idP]->if_inst->PHY_config_req) RC.mac[Mod_idP]->if_inst->PHY_config_req(&phycfg); 
+  }
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT);
 
   return(0);			   
 
 }
+
 int
 rrc_mac_config_req_ue(
   module_id_t                      Mod_idP,
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c
index 8d05c4aa8f..90afc49233 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c
@@ -62,6 +62,7 @@
 
 #include "T.h"
 
+extern uint8_t nfapi_mode;
 
 void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset)
 {
@@ -99,13 +100,13 @@ void add_msg3(module_id_t module_idP,int CC_id, RA_TEMPLATE *RA_template, frame_
   nfapi_ul_config_request_t      *ul_req;
   nfapi_ul_config_request_pdu_t  *ul_config_pdu;
   nfapi_ul_config_request_body_t *ul_req_body;
-  nfapi_hi_dci0_request_body_t   *hi_dci0_req;
+  nfapi_hi_dci0_request_t        *hi_dci0_req = &eNB->HI_DCI0_req[CC_id];
+  nfapi_hi_dci0_request_body_t   *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body;
   nfapi_hi_dci0_request_pdu_t    *hi_dci0_pdu;
 
   uint8_t rvseq[4] = {0,2,3,1};
 
 
-  hi_dci0_req   = &eNB->HI_DCI0_req[CC_id].hi_dci0_request_body;
   ul_req        = &eNB->UL_req_tmp[CC_id][RA_template->Msg3_subframe];
   ul_req_body   = &ul_req->ul_config_request_body;
   AssertFatal(RA_template->RA_active == TRUE,"RA is not active for RA %X\n",RA_template->rnti);
@@ -150,8 +151,7 @@ void add_msg3(module_id_t module_idP,int CC_id, RA_TEMPLATE *RA_template, frame_
     ul_req_body->number_of_pdus++;
     ul_req_body->tl.tag                                                            = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
 
-    // nFAPI on PNF is running at TX SFN/SF (so 4 ahead), so we need to add 4 to the SFN/SF so that the receive happens at the right time
-    ul_req->sfn_sf = sfnsf_add_subframe(RA_template->Msg3_frame, RA_template->Msg3_subframe, 4);
+    ul_req->sfn_sf = RA_template->Msg3_frame<<4|RA_template->Msg3_subframe; //sfnsf_add_subframe(RA_template->Msg3_frame, RA_template->Msg3_subframe, 0);
     ul_req->header.message_id = NFAPI_UL_CONFIG_REQUEST;
   } //  if (RA_template->rach_resource_type>0) {	 
   else
@@ -188,14 +188,15 @@ void add_msg3(module_id_t module_idP,int CC_id, RA_TEMPLATE *RA_template, frame_
       ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.size                                   = get_TBS_UL(10,RA_template->msg3_nb_rb);
       ul_req_body->number_of_pdus++;
       ul_req_body->tl.tag                                                            = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
-      ul_req->sfn_sf = sfnsf_add_subframe(RA_template->Msg3_frame, RA_template->Msg3_subframe, 4);
+      ul_req->sfn_sf = sfnsf_add_subframe(RA_template->Msg3_frame, RA_template->Msg3_subframe, 0);
       ul_req->header.message_id = NFAPI_UL_CONFIG_REQUEST;
       // save UL scheduling information for preprocessor
       for (j=0;j<RA_template->msg3_nb_rb;j++) cc->vrb_map_UL[RA_template->msg3_first_rb+j]=1;
       
+      LOG_D(MAC, "MSG3: UL_CONFIG SFN/SF:%d number_of_pdus:%d RA_template->msg3_round:%d\n", NFAPI_SFNSF2DEC(ul_req->sfn_sf), ul_req_body->number_of_pdus, RA_template->msg3_round);
       
       if (RA_template->msg3_round != 0) { // program HI too
-	hi_dci0_pdu                                                         = &hi_dci0_req->hi_dci0_pdu_list[hi_dci0_req->number_of_dci+hi_dci0_req->number_of_hi];
+	hi_dci0_pdu                                                         = &hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci+hi_dci0_req_body->number_of_hi];
 	memset((void*)hi_dci0_pdu,0,sizeof(nfapi_hi_dci0_request_pdu_t));
 	hi_dci0_pdu->pdu_type                                               = NFAPI_HI_DCI0_HI_PDU_TYPE; 
 	hi_dci0_pdu->pdu_size                                               = 2+sizeof(nfapi_hi_dci0_hi_pdu);
@@ -203,11 +204,13 @@ void add_msg3(module_id_t module_idP,int CC_id, RA_TEMPLATE *RA_template, frame_
 	hi_dci0_pdu->hi_pdu.hi_pdu_rel8.resource_block_start                = RA_template->msg3_first_rb; 
 	hi_dci0_pdu->hi_pdu.hi_pdu_rel8.cyclic_shift_2_for_drms             = 0;
 	hi_dci0_pdu->hi_pdu.hi_pdu_rel8.hi_value                            = 0;
-	hi_dci0_req->number_of_hi++;
+	hi_dci0_req_body->number_of_hi++;
+        hi_dci0_req_body->tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG;
 
-        eNB->HI_DCI0_req[CC_id].sfn_sf = sfnsf_add_subframe(RA_template->Msg3_frame, RA_template->Msg3_subframe, 4);
-        eNB->HI_DCI0_req[CC_id].hi_dci0_request_body.tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG;
-        eNB->HI_DCI0_req[CC_id].header.message_id = NFAPI_HI_DCI0_REQUEST;
+        hi_dci0_req->sfn_sf = sfnsf_add_subframe(RA_template->Msg3_frame, RA_template->Msg3_subframe, 4);
+        hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST;
+
+        LOG_D(MAC, "MSG3: HI_DCI0 SFN/SF:%d number_of_dci:%d number_of_hi:%d\n", NFAPI_SFNSF2DEC(hi_dci0_req->sfn_sf), hi_dci0_req_body->number_of_dci, hi_dci0_req_body->number_of_hi);
 
 	// save UL scheduling information for preprocessor
 	for (j=0;j<RA_template->msg3_nb_rb;j++) cc->vrb_map_UL[RA_template->msg3_first_rb+j]=1;
@@ -581,7 +584,8 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
   nfapi_ul_config_request_pdu_t   *ul_config_pdu;
   nfapi_tx_request_pdu_t          *TX_req;
   UE_list_t                       *UE_list=&eNB->UE_list;
-  nfapi_dl_config_request_body_t *dl_req;
+  nfapi_dl_config_request_t      *dl_req;
+  nfapi_dl_config_request_body_t *dl_req_body;
   nfapi_ul_config_request_body_t *ul_req_body;
   nfapi_ul_config_request_t      *ul_req;
   uint8_t                         lcid;
@@ -645,8 +649,9 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
 
   vrb_map       = cc[CC_idP].vrb_map;
   
-  dl_req        = &eNB->DL_req[CC_idP].dl_config_request_body;
-  dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; 
+  dl_req        = &eNB->DL_req[CC_idP];
+  dl_req_body   = &dl_req->dl_config_request_body;
+  dl_config_pdu = &dl_req_body->dl_config_pdu_list[dl_req_body->number_pdu]; 
   N_RB_DL       = to_prb(cc[CC_idP].mib->message.dl_Bandwidth);
 
   UE_id = find_UE_id(module_idP,RA_template->rnti);
@@ -752,11 +757,11 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
       dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.total_dci_length_including_padding            = 0; // this is not needed by OAI L1, but should be filled in
       dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_tx_antenna_ports                    = 1;
       RA_template->msg4_mpdcch_repetition_cnt++;
-      dl_req->number_pdu++;
-      dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+      dl_req_body->number_pdu++;
+      dl_req_body->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
       
-      eNB->DL_req[CC_idP].sfn_sf = (frameP<<4)+subframeP;
-      eNB->DL_req[CC_idP].header.message_id = NFAPI_DL_CONFIG_REQUEST;
+      dl_req->sfn_sf = (frameP<<4)+subframeP;
+      dl_req->header.message_id = NFAPI_DL_CONFIG_REQUEST;
 
     } //repetition_count==0 && SF condition met
     else if (RA_template->msg4_mpdcch_repetition_cnt>0) { // we're in a stream of repetitions
@@ -780,7 +785,7 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
 	      module_idP, CC_idP, frameP, subframeP,RA_template->rach_resource_type-1,RA_template->rnti);
 
 	AssertFatal(1==0,"Msg4 generation not finished for BL/CE UE\n");
-	dl_config_pdu                                                                  = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; 
+	dl_config_pdu                                                                  = &dl_req_body->dl_config_pdu_list[dl_req_body->number_pdu]; 
 	memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
 	dl_config_pdu->pdu_type                                                        = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE; 
 	dl_config_pdu->pdu_size                                                        = (uint8_t)(2+sizeof(nfapi_dl_config_dlsch_pdu));
@@ -816,12 +821,14 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
 	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type                    = 2;  // not SI message
 	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io            = (10*frameP)+subframeP;
 	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.drms_table_flag                       = 0;
-	dl_req->number_pdu++;
-        dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+	dl_req_body->number_pdu++;
+        dl_req_body->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
 
 	eNB->DL_req[CC_idP].sfn_sf = (frameP<<4)+subframeP;
 	eNB->DL_req[CC_idP].header.message_id = NFAPI_DL_CONFIG_REQUEST;
 	
+        LOG_D(MAC, "[eNB %d][RAPROC] CC_id %d DL_CONFIG frame:%d subframe:%d\n", module_idP,CC_idP,frameP,subframeP);
+
 	RA_template->generate_Msg4=0;
 	RA_template->wait_ack_Msg4=1;
 
@@ -856,7 +863,7 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
 	       &cc[CC_idP].CCCH_pdu.payload[0],
 	       rrc_sdu_length);
 	
-	// DL request
+	// Tx request
 	eNB->TX_req[CC_idP].sfn_sf                                            = (frameP<<4)+subframeP;
         eNB->TX_req[CC_idP].tx_request_body.tl.tag 			      = NFAPI_TX_REQUEST_BODY_TAG;
         eNB->TX_req[CC_idP].header.message_id 				      = NFAPI_TX_REQUEST;
@@ -891,11 +898,12 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
 
 	ul_req_body->tl.tag                                                                         = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
 
-	ul_req->sfn_sf  									    = sfnsf_add_subframe(RA_template->Msg3_frame, RA_template->Msg3_subframe, 4);	// this is for +4 frame, but nFAPI already running at +4 (because 4 is latency of Tx)
+	ul_req->sfn_sf  									    = sfnsf_add_subframe(RA_template->Msg3_frame, RA_template->Msg3_subframe, 4);
 	ul_req->header.message_id  								    = NFAPI_UL_CONFIG_REQUEST;
 
 	// Note need to keep sending this across reptitions!!!! Not really for PUCCH, to ask small-cell forum, we'll see for the other messages, maybe parameters change across repetitions and FAPI has to provide for that
 	if (cc[CC_idP].tdd_Config==NULL) { // FDD case
+          ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel8_fdd.tl.tag = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG;
 	  ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel8_fdd.n_pucch_1_0   = n1pucchan[RA_template->rach_resource_type-1];
 	  // NOTE: How to fill in the rest of the n_pucch_1_0 information 213 Section 10.1.2.1 in the general case
 	  // = N_ECCE_q + Delta_ARO + n1pucchan[ce_level]
@@ -973,7 +981,7 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
     LOG_D(MAC,"Frame %d, subframe %d: Msg4 DCI pdu_num %d (rnti %x,rnti_type %d,harq_pid %d, resource_block_coding (%p) %d\n",
 		  frameP,
 	      subframeP,
-          dl_req->number_pdu,
+          dl_req_body->number_pdu,
           dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti,
           dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type,
           dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process,
@@ -985,9 +993,12 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
 	if (!CCE_allocation_infeasible(module_idP,CC_idP,1,
 				       subframeP,dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
 				       RA_template->rnti)) {
-	  dl_req->number_dci++;
-	  dl_req->number_pdu++;
-          dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+	  dl_req_body->number_dci++;
+	  dl_req_body->number_pdu++;
+          dl_req_body->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+
+          dl_req->sfn_sf = frameP<<4|subframeP;
+          dl_req->header.message_id = NFAPI_DL_CONFIG_REQUEST;
 	  
 	  RA_template->generate_Msg4=0;
 	  RA_template->wait_ack_Msg4=1;
@@ -1035,7 +1046,7 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
 	  
 	  // DLSCH Config
 	  fill_nfapi_dlsch_config(eNB,
-				  dl_req,
+				  dl_req_body,
 				  RA_template->msg4_TBsize,
 				  eNB->pdu_index[CC_idP],
 				  RA_template->rnti,
@@ -1058,7 +1069,7 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
 				  (cc->p_eNB==1 ) ? 1 : 2,     // transmission mode
 				  1,                           // num_bf_prb_per_subband
 				  1);                          // num_bf_vector
-      LOG_D(MAC,"Filled DLSCH config, pdu number %d, non-dci pdu_index %d\n",dl_req->number_pdu,eNB->pdu_index[CC_idP]);
+          LOG_D(MAC,"Filled DLSCH config, pdu number %d, non-dci pdu_index %d\n",dl_req_body->number_pdu,eNB->pdu_index[CC_idP]);
 
 	  // DL request
 	  eNB->TX_req[CC_idP].sfn_sf = fill_nfapi_tx_req(&eNB->TX_req[CC_idP].tx_request_body,
@@ -1105,7 +1116,8 @@ void check_Msg4_retransmission(module_id_t module_idP,int CC_idP,frame_t frameP,
   int                             N_RB_DL;
   nfapi_dl_config_request_pdu_t   *dl_config_pdu;
   UE_list_t                       *UE_list=&eNB->UE_list;
-  nfapi_dl_config_request_body_t *dl_req;
+  nfapi_dl_config_request_t      *dl_req;
+  nfapi_dl_config_request_body_t *dl_req_body;
 
   int                             round;
   /*
@@ -1151,8 +1163,9 @@ void check_Msg4_retransmission(module_id_t module_idP,int CC_idP,frame_t frameP,
   round = UE_list->UE_sched_ctrl[UE_id].round[CC_idP][RA_template->harq_pid];
   vrb_map       = cc[CC_idP].vrb_map;
   
-  dl_req        = &eNB->DL_req[CC_idP].dl_config_request_body;
-  dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; 
+  dl_req        = &eNB->DL_req[CC_idP];
+  dl_req_body   = &dl_req->dl_config_request_body;
+  dl_config_pdu = &dl_req_body->dl_config_pdu_list[dl_req_body->number_pdu]; 
   N_RB_DL       = to_prb(cc[CC_idP].mib->message.dl_Bandwidth);
   
   LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Checking if Msg4 for harq_pid %d was acknowledged (round %d)\n",
@@ -1172,6 +1185,8 @@ void check_Msg4_retransmission(module_id_t module_idP,int CC_idP,frame_t frameP,
 	  //RA_template->wait_ack_Msg4++;
 	  // we have to schedule a retransmission
 	  
+          dl_req->sfn_sf = frameP<<4 | subframeP;
+
 	  first_rb=0;
 	  vrb_map[first_rb] = 1;
 	  vrb_map[first_rb+1] = 1;
@@ -1191,14 +1206,14 @@ void check_Msg4_retransmission(module_id_t module_idP,int CC_idP,frame_t frameP,
 			       0);                          // vrb_flag
 	  
 	  if (!CCE_allocation_infeasible(module_idP,CC_idP,1,subframeP,dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,RA_template->rnti)) {
-	    dl_req->number_dci++;
-	    dl_req->number_pdu++;
-            dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+	    dl_req_body->number_dci++;
+	    dl_req_body->number_pdu++;
+            dl_req_body->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
 	    
 	    LOG_D(MAC,"msg4 retransmission for rnti %x (round %d) fsf %d/%d\n", RA_template->rnti, round, frameP, subframeP);
 	    	  // DLSCH Config
 	    fill_nfapi_dlsch_config(eNB,
-				    dl_req,
+				    dl_req_body,
 				    RA_template->msg4_TBsize,
 				    -1                           /* retransmission, no pdu_index */,
 				    RA_template->rnti,
@@ -1341,6 +1356,9 @@ void initiate_ra_proc(module_id_t module_idP,
     if (RA_template[i].RA_active==FALSE &&
         RA_template[i].wait_ack_Msg4 == 0) {
       int loop = 0;
+      uint16_t msg2_frame = frameP;
+      uint16_t msg2_subframe = subframeP;
+      int offset;
       LOG_D(MAC,"Frame %d, Subframe %d: Activating RA process %d\n",frameP,subframeP,i);
       RA_template[i].RA_active          = TRUE;
       RA_template[i].generate_rar       = 1;
@@ -1353,8 +1371,18 @@ void initiate_ra_proc(module_id_t module_idP,
       RA_template[i].msg2_mpdcch_repetition_cnt = 0;		      
       RA_template[i].msg4_mpdcch_repetition_cnt = 0;		      
 #endif
-      RA_template[i].Msg2_frame         = frameP+((subframeP>5)?1:0);
-      RA_template[i].Msg2_subframe      = (subframeP+4)%10;
+
+      // DJP - this is because VNF is 2 subframes ahead of PNF and TX needs 4 subframes
+      if (nfapi_mode)
+        offset = 7;
+      else
+        offset = 4;
+
+      add_subframe(&msg2_frame, &msg2_subframe, offset);
+
+      RA_template[i].Msg2_frame         = msg2_frame;
+      RA_template[i].Msg2_subframe      = msg2_subframe;
+
       /* TODO: find better procedure to allocate RNTI */
       do {
         RA_template[i].rnti = taus();
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_bch.c b/openair2/LAYER2/MAC/eNB_scheduler_bch.c
index 47a56800e8..1ff08502ab 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_bch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_bch.c
@@ -561,7 +561,7 @@ void schedule_mib(module_id_t   module_idP,
       dl_config_request->header.message_id = NFAPI_DL_CONFIG_REQUEST;
       dl_config_request->sfn_sf = sfn_sf;
 
-      //LOG_E(MAC,"eNB->DL_req[0].number_pdu %d (%p) sfn_sf:%d\n", dl_req->number_pdu,&dl_req->number_pdu, NFAPI_SFNSF2DEC(dl_config_request->sfn_sf));
+      LOG_E(MAC,"eNB->DL_req[0].number_pdu %d (%p) sfn_sf:%d\n", dl_req->number_pdu,&dl_req->number_pdu, NFAPI_SFNSF2DEC(dl_config_request->sfn_sf));
       // DL request
 
       TX_req                                                                = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus]; 
@@ -575,8 +575,9 @@ void schedule_mib(module_id_t   module_idP,
       eNB->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
       eNB->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
 
-      if (frameP%100==0) LOG_D(MAC,"%s() TX_REQ: sfn_sf:%u pdus:%u pdu_length:%u pdu_index:%u segments:%u segment_length:%u\n", 
-          __FUNCTION__, eNB->TX_req[CC_id].sfn_sf, eNB->TX_req[CC_id].tx_request_body.number_of_pdus,
+      if (frameP%100==0){}
+      LOG_D(MAC,"%s() TX_REQ: sfn_sf:%u pdus:%u pdu_length:%u pdu_index:%u segments:%u segment_length:%u\n", 
+          __FUNCTION__, NFAPI_SFNSF2DEC(eNB->TX_req[CC_id].sfn_sf), eNB->TX_req[CC_id].tx_request_body.number_of_pdus,
           TX_req->pdu_length, TX_req->pdu_index, TX_req->num_segments, TX_req->segments[0].segment_length);
     }
   }
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
index 1a14181ab6..cbb0e6c353 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
@@ -786,6 +786,7 @@ schedule_ue_spec(
 				      );
 
 	      LOG_D(MAC,"Filled NFAPI configuration for DCI/DLSCH %d, retransmission round %d\n",eNB->pdu_index[CC_id],round);
+             
 
 	      program_dlsch_acknak(module_idP,CC_id,UE_id,frameP,subframeP,dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx);
 	      // No TX request for retransmission (check if null request for FAPI)
@@ -1306,7 +1307,7 @@ schedule_ue_spec(
 							  eNB->pdu_index[CC_id],
 							  eNB->UE_list.DLSCH_pdu[CC_id][0][(unsigned char)UE_id].payload[0]);
 	    
-	    LOG_D(MAC,"Filled NFAPI configuration for DCI/DLSCH/TXREQ %d, new SDU\n",eNB->pdu_index[CC_id]);
+            LOG_D(MAC,"SFN/SF:%d Filled NFAPI configuration for DCI/DLSCH/TXREQ %d, new SDU\n",NFAPI_SFNSF2DEC(eNB->TX_req[CC_id].sfn_sf), eNB->pdu_index[CC_id]);
 
 	    eNB->pdu_index[CC_id]++;
 	    program_dlsch_acknak(module_idP,CC_id,UE_id,frameP,subframeP,dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx);
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
index c74eabc098..e023939541 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
@@ -62,6 +62,10 @@
 
 extern void add_msg3(module_id_t module_idP,int CC_id, RA_TEMPLATE *RA_template, frame_t frameP, sub_frame_t subframeP);
 
+extern int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req);
+extern uint16_t sfnsf_add_subframe(uint16_t frameP, uint16_t subframeP, int offset);
+
+
 // This table holds the allowable PRB sizes for ULSCH transmissions
 uint8_t rb_table[34] = {1,2,3,4,5,6,8,9,10,12,15,16,18,20,24,25,27,30,32,36,40,45,48,50,54,60,64,72,75,80,81,90,96,100};
 
@@ -573,9 +577,12 @@ abort();
   hi_dci0_pdu->hi_pdu.hi_pdu_rel8.hi_value                            = 1; // DJP - wireshark shows this as a NAK who is right?
   hi_dci0_req_body->number_of_hi++;
   hi_dci0_req_body->tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG;
-  hi_dci0_req->sfn_sf = frameP<<4|subframeP;
+  hi_dci0_req->sfn_sf = sfnsf_add_subframe(frameP,subframeP, 4);
   hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST;
 
+  oai_nfapi_hi_dci0_req(hi_dci0_req);
+  hi_dci0_req_body->number_of_hi=0;
+
   /* NN--> FK: we could either check the payload, or use a phy helper to detect a false msg3 */
   if ((num_sdu == 0) && (num_ce==0)) {
     if (UE_id != -1)
diff --git a/openair2/LAYER2/MAC/pre_processor.c b/openair2/LAYER2/MAC/pre_processor.c
index 5337dcf657..0792b413d5 100644
--- a/openair2/LAYER2/MAC/pre_processor.c
+++ b/openair2/LAYER2/MAC/pre_processor.c
@@ -1101,11 +1101,11 @@ void ulsch_scheduler_pre_processor(module_id_t module_idP,
   UE_TEMPLATE        *UE_template               = 0;
   int                N_RB_DL;
   int                N_RB_UL;
-  LOG_D(MAC,"In ulsch_preprocessor: assign max mcs min rb\n");
+  //LOG_D(MAC,"In ulsch_preprocessor: assign max mcs min rb\n");
   // maximize MCS and then allocate required RB according to the buffer occupancy with the limit of max available UL RB
   assign_max_mcs_min_rb(module_idP,frameP, subframeP, first_rb);
 
-  LOG_D(MAC,"In ulsch_preprocessor: sort ue \n");
+  //LOG_D(MAC,"In ulsch_preprocessor: sort ue \n");
   // sort ues
   sort_ue_ul (module_idP,frameP, subframeP);
 
diff --git a/openair2/PHY_INTERFACE/IF_Module.c b/openair2/PHY_INTERFACE/IF_Module.c
index 12c7e08684..356e23a08d 100644
--- a/openair2/PHY_INTERFACE/IF_Module.c
+++ b/openair2/PHY_INTERFACE/IF_Module.c
@@ -19,18 +19,18 @@ extern uint8_t nfapi_mode;
 void handle_rach(UL_IND_t *UL_info) {
   int i;
 
-  if (UL_info->rach_ind.number_of_preambles>0) {
+  if (UL_info->rach_ind.rach_indication_body.number_of_preambles>0) {
 
-    AssertFatal(UL_info->rach_ind.number_of_preambles==1,"More than 1 preamble not supported\n");
-    UL_info->rach_ind.number_of_preambles=0;
-    LOG_E(MAC,"Frame %d, Subframe %d Calling initiate_ra_proc\n",UL_info->frame,UL_info->subframe);
+    AssertFatal(UL_info->rach_ind.rach_indication_body.number_of_preambles==1,"More than 1 preamble not supported\n");
+    UL_info->rach_ind.rach_indication_body.number_of_preambles=0;
+    LOG_E(MAC,"UL_info[Frame %d, Subframe %d] Calling initiate_ra_proc RACH:SFN/SF:%d\n",UL_info->frame,UL_info->subframe, NFAPI_SFNSF2DEC(UL_info->rach_ind.sfn_sf));
     initiate_ra_proc(UL_info->module_id,
 		     UL_info->CC_id,
-		     UL_info->frame,
-		     UL_info->subframe,
-		     UL_info->rach_ind.preamble_list[0].preamble_rel8.preamble,
-		     UL_info->rach_ind.preamble_list[0].preamble_rel8.timing_advance,
-		     UL_info->rach_ind.preamble_list[0].preamble_rel8.rnti
+		     NFAPI_SFNSF2SFN(UL_info->rach_ind.sfn_sf),
+		     NFAPI_SFNSF2SF(UL_info->rach_ind.sfn_sf),
+		     UL_info->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.preamble,
+		     UL_info->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.timing_advance,
+		     UL_info->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.rnti
 #ifdef Rel14
 		     ,0
 #endif
@@ -38,24 +38,24 @@ void handle_rach(UL_IND_t *UL_info) {
   }
 
 #ifdef Rel14
-  if (UL_info->rach_ind_br.number_of_preambles>0) {
+  if (UL_info->rach_ind_br.rach_indication_body.number_of_preambles>0) {
 
-    AssertFatal(UL_info->rach_ind_br.number_of_preambles<5,"More than 4 preambles not supported\n");
-    for (i=0;i<UL_info->rach_ind_br.number_of_preambles;i++) {
-      AssertFatal(UL_info->rach_ind_br.preamble_list[i].preamble_rel13.rach_resource_type>0,
+    AssertFatal(UL_info->rach_ind_br.rach_indication_body.number_of_preambles<5,"More than 4 preambles not supported\n");
+    for (i=0;i<UL_info->rach_ind_br.rach_indication_body.number_of_preambles;i++) {
+      AssertFatal(UL_info->rach_ind_br.rach_indication_body.preamble_list[i].preamble_rel13.rach_resource_type>0,
 		  "Got regular PRACH preamble, not BL/CE\n");
       LOG_D(MAC,"Frame %d, Subframe %d Calling initiate_ra_proc (CE_level %d)\n",UL_info->frame,UL_info->subframe,
-	    UL_info->rach_ind_br.preamble_list[i].preamble_rel13.rach_resource_type-1);
+	    UL_info->rach_ind_br.rach_indication_body.preamble_list[i].preamble_rel13.rach_resource_type-1);
       initiate_ra_proc(UL_info->module_id,
 		       UL_info->CC_id,
 		       UL_info->frame,
 		       UL_info->subframe,
-		       UL_info->rach_ind_br.preamble_list[i].preamble_rel8.preamble,
-		       UL_info->rach_ind_br.preamble_list[i].preamble_rel8.timing_advance,
-		       UL_info->rach_ind_br.preamble_list[i].preamble_rel8.rnti,
-		       UL_info->rach_ind_br.preamble_list[i].preamble_rel13.rach_resource_type);
+		       UL_info->rach_ind_br.rach_indication_body.preamble_list[i].preamble_rel8.preamble,
+		       UL_info->rach_ind_br.rach_indication_body.preamble_list[i].preamble_rel8.timing_advance,
+		       UL_info->rach_ind_br.rach_indication_body.preamble_list[i].preamble_rel8.rnti,
+		       UL_info->rach_ind_br.rach_indication_body.preamble_list[i].preamble_rel13.rach_resource_type);
     }
-    UL_info->rach_ind.number_of_preambles=0;
+    UL_info->rach_ind_br.rach_indication_body.number_of_preambles=0;
   }
 #endif
 }
@@ -151,7 +151,7 @@ void handle_ulsch(UL_IND_t *UL_info) {
   {
     if (UL_info->crc_ind.crc_indication_body.number_of_crcs>0)
     {
-      LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs);
+      LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf));
 
       oai_nfapi_crc_indication(&UL_info->crc_ind);
 
@@ -160,7 +160,7 @@ void handle_ulsch(UL_IND_t *UL_info) {
 
     if (UL_info->rx_ind.rx_indication_body.number_of_pdus>0)
     {
-      LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus);
+      LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf));
       oai_nfapi_rx_ind(&UL_info->rx_ind);
       UL_info->rx_ind.rx_indication_body.number_of_pdus = 0;
     }
@@ -178,8 +178,8 @@ void handle_ulsch(UL_IND_t *UL_info) {
             LOG_D(MAC,"Frame %d, Subframe %d Calling rx_sdu (CRC error) \n",UL_info->frame,UL_info->subframe);
             rx_sdu(UL_info->module_id,
                 UL_info->CC_id,
-                UL_info->frame,
-                UL_info->subframe,
+                NFAPI_SFNSF2SFN(UL_info->rx_ind.sfn_sf), //UL_info->frame,
+                NFAPI_SFNSF2SF(UL_info->rx_ind.sfn_sf), //UL_info->subframe,
                 UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti,
                 (uint8_t *)NULL,
                 UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.length,
@@ -190,8 +190,8 @@ void handle_ulsch(UL_IND_t *UL_info) {
             LOG_D(MAC,"Frame %d, Subframe %d Calling rx_sdu (CRC ok) \n",UL_info->frame,UL_info->subframe);
             rx_sdu(UL_info->module_id,
                 UL_info->CC_id,
-                UL_info->frame,
-                UL_info->subframe,
+                NFAPI_SFNSF2SFN(UL_info->rx_ind.sfn_sf), //UL_info->frame,
+                NFAPI_SFNSF2SF(UL_info->rx_ind.sfn_sf), //UL_info->subframe,
                 UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti,
                 UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].data,
                 UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.length,
@@ -285,7 +285,7 @@ static void dump_ul(UL_IND_t *u)
                                                v->ul_cqi_information.channel);
       }
 
-  A("XXXX     rach_ind %d\n", u->rach_ind.number_of_preambles);
+  A("XXXX     rach_ind %d\n", u->rach_ind.rach_indication_body.number_of_preambles);
 
   A("XXXX     rx_ind   %d\n", u->rx_ind.rx_indication_body.number_of_pdus);
       for (i = 0; i < u->rx_ind.rx_indication_body.number_of_pdus; i++) {
@@ -519,7 +519,7 @@ void UL_indication(UL_IND_t *UL_info)
   LOG_D(PHY,"frame %d, subframe %d, module_id %d, CC_id %d UL_info[rx_ind:%d number_of_harqs:%d number_of_crcs:%d number_of_cqis:%d number_of_preambles:%d]\n", 
       UL_info->frame,UL_info->subframe,
       module_id,CC_id,
-      UL_info->rx_ind.rx_indication_body.number_of_pdus, UL_info->harq_ind.harq_indication_body.number_of_harqs, UL_info->crc_ind.crc_indication_body.number_of_crcs, UL_info->cqi_ind.number_of_cqis, UL_info->rach_ind.number_of_preambles);
+      UL_info->rx_ind.rx_indication_body.number_of_pdus, UL_info->harq_ind.harq_indication_body.number_of_harqs, UL_info->crc_ind.crc_indication_body.number_of_crcs, UL_info->cqi_ind.number_of_cqis, UL_info->rach_ind.rach_indication_body.number_of_preambles);
 
   if (nfapi_mode != 1)
   {
diff --git a/openair2/PHY_INTERFACE/IF_Module.h b/openair2/PHY_INTERFACE/IF_Module.h
index 9ee42bef08..b300883052 100644
--- a/openair2/PHY_INTERFACE/IF_Module.h
+++ b/openair2/PHY_INTERFACE/IF_Module.h
@@ -73,11 +73,11 @@ typedef struct{
   nfapi_cqi_indication_body_t cqi_ind;
 
   /// RACH indication list
-  nfapi_rach_indication_body_t rach_ind;
+  nfapi_rach_indication_t rach_ind;
 
 #ifdef Rel14
   /// RACH indication list for BR UEs
-  nfapi_rach_indication_body_t rach_ind_br;
+  nfapi_rach_indication_t rach_ind_br;
 #endif
 
   /// SRS indication list
diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c
index d4fd70dca1..11dc5fc812 100644
--- a/openair2/RRC/LITE/rrc_eNB.c
+++ b/openair2/RRC/LITE/rrc_eNB.c
@@ -282,7 +282,7 @@ init_SI(
   }
 #endif
 
-  LOG_I(RRC, "About to call rrc_mac_config_req_eNB");
+  LOG_I(RRC, "About to call rrc_mac_config_req_eNB\n");
 
   rrc_mac_config_req_eNB(ctxt_pP->module_id, CC_id,
 			 RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId,
diff --git a/openair2/UTIL/LOG/vcd_signal_dumper.c b/openair2/UTIL/LOG/vcd_signal_dumper.c
index 665e5b4384..4d67570301 100644
--- a/openair2/UTIL/LOG/vcd_signal_dumper.c
+++ b/openair2/UTIL/LOG/vcd_signal_dumper.c
@@ -399,6 +399,17 @@ const char* eurecomFunctionsNames[] = {
 
   "compress_if",
   "decompress_if",
+
+  "nfapi_subframe",
+  "generate_pcfich",
+  "generate_dci0",
+  "generate_dlsch",
+  "generate_phich",
+  "pdcch_scrambling",
+  "pdcch_modulation",
+  "pdcch_interleaving",
+  "pdcch_tx",
+
 };
 
 struct vcd_module_s vcd_modules[] = {
diff --git a/openair2/UTIL/LOG/vcd_signal_dumper.h b/openair2/UTIL/LOG/vcd_signal_dumper.h
index d777236b34..e52dc8d12a 100644
--- a/openair2/UTIL/LOG/vcd_signal_dumper.h
+++ b/openair2/UTIL/LOG/vcd_signal_dumper.h
@@ -376,6 +376,16 @@ typedef enum {
   VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_COMPR_IF,
   VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_DECOMPR_IF,
 
+  VCD_SIGNAL_DUMPER_FUNCTIONS_NFAPI,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_PCFICH,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DCI0,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_PHICH,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_SCRAMBLING,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_MODULATION,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_INTERLEAVING,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_TX,
+
   VCD_SIGNAL_DUMPER_FUNCTIONS_END
 } vcd_signal_dump_functions;
 
diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c
index b07e1dd6a2..d2ac1b6dea 100644
--- a/targets/RT/USER/lte-enb.c
+++ b/targets/RT/USER/lte-enb.c
@@ -161,6 +161,27 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam
 
   // *******************************************************************
 
+  if (nfapi_mode == 1)
+  {
+    // I am a PNF and I need to let nFAPI know that we have a (sub)frame tick
+    uint16_t frame = proc->frame_rx;
+    uint16_t subframe = proc->subframe_rx;
+
+    //add_subframe(&frame, &subframe, 4);
+
+    //oai_subframe_ind(proc->frame_tx, proc->subframe_tx);
+    //LOG_D(PHY, "oai_subframe_ind(frame:%u, subframe:%d) - NOT CALLED ********\n", frame, subframe);
+    oai_subframe_ind(frame, subframe);
+
+    LOG_D(PHY, "UL_info[rx_ind:%d number_of_harqs:%d number_of_crcs:%d number_of_cqis:%d number_of_preambles:%d]\n", eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus, eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs, eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs, eNB->UL_INFO.cqi_ind.number_of_cqis, eNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles);
+  }
+
+  if (nfapi_mode == 1 && eNB->pdcch_vars[proc->subframe_tx&1].num_pdcch_symbols == 0)
+  {
+    LOG_E(PHY, "eNB->pdcch_vars[proc->subframe_tx&1].num_pdcch_symbols == 0");
+    return 0;
+  }
+
   // ****************************************
   // Common RX procedures subframe n
 
@@ -177,7 +198,7 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam
 #endif
   }
 
-  LOG_D(PHY, "RX_IND:SFN/SF:%d proc:SFN/SF:%d/%d [rx_ind:num_pdus:%d]\n", NFAPI_SFNSF2DEC(eNB->UL_INFO.rx_ind.sfn_sf), proc->frame_rx, proc->subframe_rx, eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus);
+  LOG_D(PHY, "RX_IND:SFN/SF:%d proc:SFN/SF:%d/%d [rx_ind:num_pdus:%d] TX:%d/%d eNB->pdcch_vars[subframe&1].num_pdcch_symbols:%d\n", NFAPI_SFNSF2DEC(eNB->UL_INFO.rx_ind.sfn_sf), proc->frame_rx, proc->subframe_rx, eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus, proc->frame_tx, proc->subframe_tx, eNB->pdcch_vars[proc->subframe_tx&1].num_pdcch_symbols);
 
   if (eNB->UL_INFO.rx_ind.sfn_sf == (proc->frame_rx<<4|proc->subframe_rx) && eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus>0)
   {
@@ -198,23 +219,10 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam
     }
   }
 
-  if (nfapi_mode == 1)
-  {
-    // I am a PNF and I need to let nFAPI know that we have a (sub)frame tick
-    uint16_t frame = proc->frame_rx;
-    uint16_t subframe = proc->subframe_rx;
-
-    add_subframe(&frame, &subframe, 4);
-
-    //oai_subframe_ind(proc->frame_tx, proc->subframe_tx);
-    //LOG_D(PHY, "oai_subframe_ind(frame:%u, subframe:%d) - NOT CALLED ********\n", frame, subframe);
-    oai_subframe_ind(frame, subframe);
-
-    LOG_D(PHY, "UL_info[rx_ind:%d number_of_harqs:%d number_of_crcs:%d number_of_cqis:%d number_of_preambles:%d]\n", eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus, eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs, eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs, eNB->UL_INFO.cqi_ind.number_of_cqis, eNB->UL_INFO.rach_ind.number_of_preambles);
-  }
-
   // UE-specific RX processing for subframe n
-  phy_procedures_eNB_uespec_RX(eNB, proc, no_relay );
+  if (nfapi_mode == 0 || nfapi_mode == 1) {
+    phy_procedures_eNB_uespec_RX(eNB, proc, no_relay );
+  }
 
   pthread_mutex_lock(&eNB->UL_INFO_mutex);
 
diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c
index a091abcb37..d6e4ce7536 100644
--- a/targets/RT/USER/lte-ru.c
+++ b/targets/RT/USER/lte-ru.c
@@ -130,7 +130,6 @@ int attach_rru(RU_t *ru);
 int connect_rau(RU_t *ru);
 
 extern uint8_t nfapi_mode;
-extern void oai_subframe_ind(uint16_t frame, uint16_t subframe);
 
 /*************************************************************/
 /* Functions to attach and configure RRU                     */
@@ -797,71 +796,10 @@ void tx_rf(RU_t *ru) {
     for (i=0; i<ru->nb_tx; i++)
     {
       txp[i] = (void*)&ru->common.txdata[i][proc->subframe_tx*fp->samples_per_tti]; 
-      if (0)
-      {
-        if (
-            (proc->frame_tx % 10 ==0 && proc->subframe_tx==0)  ||
-            (proc->frame_tx % 10 ==0 && proc->subframe_tx==5)
-           )
-        {
-          LOG_E(PHY,"%s() nb_tx:%d i:%d samples_per_tti:%u subframe_tx:%u txp[%d]:%p\n", __FUNCTION__, ru->nb_tx, i, fp->samples_per_tti, proc->subframe_tx, i,txp[i]);
-        }
-      }
     }
     
     int siglen=fp->samples_per_tti,flags=1;
     
-    if (0 &&
-    (
-        (proc->frame_tx % 300 ==0 && proc->subframe_tx==0)  ||
-        (proc->frame_tx % 300 ==0 && proc->subframe_tx==5)
-        )
-       )
-    {
-       uint32_t *tx0p = (uint32_t*)txp;
-
-      LOG_E(PHY,"%s() nb_tx:%d first_carrier_offset:%u samples_per_tti:%u subframe_tx:%u sf:%u(%u) txp:%2x %2x %2x %2x %2x %2x %2x %2x\n", 
-          __FUNCTION__, ru->nb_tx, fp->first_carrier_offset, fp->samples_per_tti, proc->subframe_tx,
-          SF_type, SF_type==SF_S,
-          tx0p[fp->first_carrier_offset],
-          tx0p[fp->first_carrier_offset+1],
-          tx0p[fp->first_carrier_offset+2],
-          tx0p[fp->first_carrier_offset+3],
-          tx0p[fp->first_carrier_offset+4],
-          tx0p[fp->first_carrier_offset+5],
-          tx0p[fp->first_carrier_offset+6],
-          tx0p[fp->first_carrier_offset+7]
-          );
-    }
-    if ( 0 &&
-        (
-         (proc->frame_tx % 300 ==0 && proc->subframe_tx==0)  ||
-         (proc->frame_tx % 300 ==0 && proc->subframe_tx==5)
-        )
-       )
-    {
-      int32_t *txpbuf = RC.ru[0]->common.txdata[0];
-
-      char *buf = malloc(fp->symbols_per_tti * 3 + 100);
-      char *pbuf = buf;
-
-      for (int i=0;i<10;i++)
-      {
-        buf[0]='\0';
-        pbuf = buf;
-
-        pbuf += sprintf(pbuf, "SF%d:", proc->subframe_tx);
-
-        for (int k=0;k<fp->symbols_per_tti;k++)
-        {
-          pbuf += sprintf(pbuf, "%2x ", txpbuf[k]);
-        }
-        LOG_E(PHY, "%s\n", buf);
-
-      }
-      free(buf);
-    }
-
     if (SF_type == SF_S) {
       siglen = fp->dl_symbols_in_S_subframe*(fp->ofdm_symbol_size+fp->nb_prefix_samples0);
       flags=3; // end of burst
@@ -1562,26 +1500,6 @@ static void* ru_thread( void* param ) {
         RC.eNB[0][0], ru->eNB_list[0],
         proc,&ru->proc);
 
-#if 0
-    // This needs to be here, because we need to be as close to the interrupt as possible, any later and you get jitter
-    // However, putting it here causes the PNF to go horribly wrong and get bad harq_pid!
-    //
-    if (nfapi_mode == 1)  // PNF
-    {
-      struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
-
-      //oai_subframe_ind(proc->frame_tx, proc->subframe_tx);
-      //LOG_D(PHY, "oai_subframe_ind(frame:%u, subframe:%d) NOT CALLED **************************************\n", frame, subframe);
-
-      //uint16_t frame = proc->frame_tx;
-      //uint16_t subframe = proc->subframe_tx;
-
-      //add_subframe(&frame, &subframe, 4);
-
-      //oai_subframe_ind(frame, subframe);
-      //LOG_D(PHY, "oai_subframe_ind(frame:%u, subframe:%d) UL_info[rx_ind:%d number_of_harqs:%d number_of_crcs:%d number_of_cqis:%d number_of_preambles:%d]\n", frame, subframe, eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus, eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs, eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs, eNB->UL_INFO.cqi_ind.number_of_cqis, eNB->UL_INFO.rach_ind.number_of_preambles);
-    }
-#endif
     if (nfapi_mode == 1) // PNF
     {
       // This is the earliest I think we can do this
diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c
index 0f2985280f..34e767434d 100644
--- a/targets/RT/USER/lte-softmodem.c
+++ b/targets/RT/USER/lte-softmodem.c
@@ -1196,6 +1196,7 @@ int main( int argc, char **argv )
     } 
   }
   
+#if 0
   // Will have parsed the config files by now
   
   printf("NFAPI MODE:%d\n", nfapi_mode);
@@ -1209,11 +1210,12 @@ int main( int argc, char **argv )
   else if (nfapi_mode == 2)  // VNF
   {
     set_comp_log(MAC, LOG_DEBUG, LOG_FULL, 1);
-    set_comp_log(RRC, LOG_INFO, LOG_FULL, 1);
+    set_comp_log(RRC, LOG_DEBUG, LOG_FULL, 1);
+    set_comp_log(PHY, LOG_DEBUG, LOG_FULL, 1);
     printf("DJP - forcing MAC to DEBUG - should see similar line if it works\n");
     LOG_E(PHY,"%s() DJP - forcing MAC to LOG_DEBUG for VNF\n", __FUNCTION__);
   }
-
+#endif
   
   
   printf("mlock\n");
@@ -1302,6 +1304,9 @@ int main( int argc, char **argv )
     case 2:
       nfapi_mode_str = "VNF";
       break;
+    default:
+      nfapi_mode_str = "<UNKNOWN NFAPI MODE>";
+      break;
   }
   printf("NFAPI MODE:%s\n", nfapi_mode_str);
 
diff --git a/targets/RT/USER/pnf.gtkw b/targets/RT/USER/pnf.gtkw
index 2444eb1075..97ac08dcab 100644
--- a/targets/RT/USER/pnf.gtkw
+++ b/targets/RT/USER/pnf.gtkw
@@ -47,6 +47,8 @@ functions.pdsch_thread
 functions.nfapi_subframe
 functions.generate_pcfich
 functions.generate_dci0
+functions.generate_dlsch
+functions.generate_phich
 functions.pdcch_scrambling
 functions.pdcch_modulation
 functions.pdcch_interleaving
-- 
2.26.2