diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h
index 0cbae7ae2c79fa784ed078601fc71de313fad6b8..fa95d5a6fee9436755a6c42207cf1a598985742b 100644
--- a/common/utils/LOG/log.h
+++ b/common/utils/LOG/log.h
@@ -434,6 +434,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
 
 #    define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format, 0);} while(0)
 #    define LOG_VAR(A,B) A B
+#    define T_ACTIVE(a) (0) 
 #  endif /* T_TRACER */
 /* avoid warnings for variables only used in LOG macro's but set outside debug section */
 #define GCC_NOTUSED   __attribute__((unused))
diff --git a/common/utils/minimal_stub.c b/common/utils/minimal_stub.c
index 86454fe53f87dad750a11d7c0a1f07d67b5e5379..79e35bf7a6f8cef12bd29cb156711f5f67a884d6 100644
--- a/common/utils/minimal_stub.c
+++ b/common/utils/minimal_stub.c
@@ -1,4 +1,6 @@
+#ifndef T_TRACER
 int T_stdout;
+#endif
 
 void exit_function(const char *file, const char *function, const int line, const char *s) {
 }
diff --git a/executables/main-ocp.c b/executables/main-ocp.c
index 962b738e252e6b6c576b4a52a2488603655c8c8e..0712dfbf57c0945b3398a1f637edf76b0f0ecd7b 100644
--- a/executables/main-ocp.c
+++ b/executables/main-ocp.c
@@ -73,7 +73,6 @@ int sync_var=-1; //!< protected by mutex \ref sync_mutex.
 int config_sync_var=-1;
 volatile int oai_exit = 0;
 double cpuf;
-msc_interface_t msc_interface;
 THREAD_STRUCT thread_struct;
 
 uint16_t sf_ahead=4;
diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c
index 5ee3287955a15d7db3d29675b6249088fadefb34..f5e49b73b8bc85536c3bdaa087101f683f6310bc 100644
--- a/executables/nr-gnb.c
+++ b/executables/nr-gnb.c
@@ -379,6 +379,7 @@ void init_gNB_Tpool(int inst) {
     sprintf(ul_pool+2+s_offset,",-1");
     s_offset += 3;
   }
+  if (getenv("noThreads")) strcpy(ul_pool, "n");
   initTpool(ul_pool, gNB->threadPool, false);
   // ULSCH decoder result FIFO
   gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.c b/openair1/PHY/NR_TRANSPORT/nr_prach.c
index 638b0dff2c030c8b79ce07b6fa1bffa8202a81e1..bf944e27aa504c28c3261b37746a441a030609e5 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_prach.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_prach.c
@@ -858,28 +858,28 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
 
       memset(prachF, 0, sizeof(int16_t)*2*1024 );
       if (LOG_DUMPFLAG(PRACH)) {      
-	LOG_M("prach_rxF0.m","prach_rxF0",rxsigF[0],N_ZC,1,1);
-	LOG_M("prach_rxF1.m","prach_rxF1",rxsigF[1],6144,1,1);
+	       LOG_M("prach_rxF0.m","prach_rxF0",rxsigF[0],N_ZC,1,1);
+	       LOG_M("prach_rxF1.m","prach_rxF1",rxsigF[1],6144,1,1);
       }
    
       for (aa=0;aa<nb_rx; aa++) {
 	// Do componentwise product with Xu* on each antenna 
 
-	for (offset=0; offset<(N_ZC<<1); offset+=2) {
-	  prachF[offset]   = (int16_t)(((int32_t)Xu[offset]*rxsigF[aa][offset]   + (int32_t)Xu[offset+1]*rxsigF[aa][offset+1])>>15);
-	  prachF[offset+1] = (int16_t)(((int32_t)Xu[offset]*rxsigF[aa][offset+1] - (int32_t)Xu[offset+1]*rxsigF[aa][offset])>>15);
-	}
+	       for (offset=0; offset<(N_ZC<<1); offset+=2) {
+	          prachF[offset]   = (int16_t)(((int32_t)Xu[offset]*rxsigF[aa][offset]   + (int32_t)Xu[offset+1]*rxsigF[aa][offset+1])>>15);
+	          prachF[offset+1] = (int16_t)(((int32_t)Xu[offset]*rxsigF[aa][offset+1] - (int32_t)Xu[offset+1]*rxsigF[aa][offset])>>15);
+	       }
 	
-	// Now do IFFT of size 1024 (N_ZC=839) or 256 (N_ZC=139)
-	if (N_ZC == 839) {
-	  log2_ifft_size = 10;
-	  idft(IDFT_1024,prachF,prach_ifft_tmp,1);
-	  // compute energy and accumulate over receive antennas
-	  for (i=0;i<2048;i++)
-	    prach_ifft[i] += ((int32_t)prach_ifft_tmp[i<<1]*(int32_t)prach_ifft_tmp[i<<1] + (int32_t)prach_ifft_tmp[1+(i<<1)]*(int32_t)prach_ifft_tmp[1+(i<<1)])>>10;
-	} else {
-	  idft(IDFT_256,prachF,prach_ifft_tmp,1);
-	  log2_ifft_size = 8;
+	       // Now do IFFT of size 1024 (N_ZC=839) or 256 (N_ZC=139)
+	       if (N_ZC == 839) {
+	         log2_ifft_size = 10;
+	         idft(IDFT_1024,prachF,prach_ifft_tmp,1);
+	         // compute energy and accumulate over receive antennas
+	         for (i=0;i<2048;i++)
+	           prach_ifft[i] += ((int32_t)prach_ifft_tmp[i<<1]*(int32_t)prach_ifft_tmp[i<<1] + (int32_t)prach_ifft_tmp[1+(i<<1)]*(int32_t)prach_ifft_tmp[1+(i<<1)])/nb_rx;
+	       } else {
+	         idft(IDFT_256,prachF,prach_ifft_tmp,1);
+	         log2_ifft_size = 8;
 	  // compute energy and accumulate over receive antennas and repetitions for BR
 	  for (i=0;i<256;i++)
 	    prach_ifft[i] += ((int32_t)prach_ifft_tmp[i<<1]*(int32_t)prach_ifft_tmp[(i<<1)] + (int32_t)prach_ifft_tmp[1+(i<<1)]*(int32_t)prach_ifft_tmp[1+(i<<1)])/nb_rx;
@@ -887,7 +887,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
 
 	if (LOG_DUMPFLAG(PRACH)) {	
 	  if (aa==0) LOG_M("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1);
-          if (aa==1) LOG_M("prach_rxF_comp1.m","prach_rxF_comp1",prachF,1024,1,1);
+    if (aa==1) LOG_M("prach_rxF_comp1.m","prach_rxF_comp1",prachF,1024,1,1);
 	}
       }// antennas_rx
     } // new dft
@@ -900,10 +900,10 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
       lev = (int32_t)prach_ifft[(preamble_shift2+i)];
       levdB = dB_fixed_times10(lev);
       if (levdB>*max_preamble_energy) {
-	LOG_D(PHY,"preamble_index %d, delay %d en %d dB > %d dB\n",preamble_index,i,levdB,*max_preamble_energy);
-	*max_preamble_energy  = levdB;
-	*max_preamble_delay   = i; // Note: This has to be normalized to the 30.72 Ms/s sampling rate 
-	*max_preamble         = preamble_index;
+	      LOG_D(PHY,"preamble_index %d, delay %d en %d dB > %d dB\n",preamble_index,i,levdB,*max_preamble_energy);
+	      *max_preamble_energy  = levdB;
+	      *max_preamble_delay   = i; // Note: This has to be normalized to the 30.72 Ms/s sampling rate 
+	      *max_preamble         = preamble_index;
       }
     }
   }// preamble_index
diff --git a/openair1/PHY/TOOLS/calibration_test.c b/openair1/PHY/TOOLS/calibration_test.c
index 982ca9d254cb47caf105f82a5b2d864d4feaa95b..53baf83d41dbaab0834f88219300ce6fabfe4c43 100644
--- a/openair1/PHY/TOOLS/calibration_test.c
+++ b/openair1/PHY/TOOLS/calibration_test.c
@@ -10,12 +10,17 @@ unsigned int mmapped_dma=0;
 int      single_thread_flag;
 uint32_t timing_advance;
 int8_t threequarter_fs;
-int usrp_tx_thread;
 uint64_t downlink_frequency[MAX_NUM_CCs][4];
 int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
 int opp_enabled;
 static double snr_dB=20;
 THREAD_STRUCT thread_struct;
+uint32_t target_ul_mcs = 9;
+uint32_t target_dl_mcs = 9;
+uint64_t dlsch_slot_bitmap = (1<<1);
+uint64_t ulsch_slot_bitmap = (1<<8);
+uint32_t target_ul_bw = 50;
+uint32_t target_dl_bw = 50;
 #include <executables/nr-softmodem.h>
 
 int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_state) {return 0;}
@@ -302,6 +307,9 @@ int main(int argc, char **argv) {
 
   void ** samplesRx = (void **)malloc16(antennas* sizeof(struct complex16 *) );
   void ** samplesTx = (void **)malloc16(antennas* sizeof(struct complex16 *) );
+
+  int fd=open(getenv("rftestInputFile"),O_RDONLY);
+  AssertFatal(fd>=0,"%s",strerror(errno));
   
   for (int i=0; i<antennas; i++) {
     samplesRx[i] = (int32_t *)malloc16_clear( DFT*sizeof(struct complex16) );
@@ -313,14 +321,16 @@ int main(int argc, char **argv) {
   rfdevice.trx_start_func(&rfdevice);
   
   while(!oai_exit) {
+    for (int i=0; i<antennas; i++)
+      read(fd, samplesTx[i], DFT*sizeof(struct complex16));
     int readBlockSize = rfdevice.trx_read_func(&rfdevice,
 					       &timestamp,
-					       samplesTx,
+					       samplesRx,
 					       DFT,
 					       antennas);
     int txs = rfdevice.trx_write_func(&rfdevice,
 					    timestamp+TxAdvanceInDFTSize*DFT,
-					    samplesRx,
+					    samplesTx,
 					    DFT,
 					    antennas,
 					    0);
diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c
index 1014be0e448806d81bf702e1eb19921d6e1437f0..fad1d79dd3aa0943320d344e8327d4ad24569b2b 100644
--- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c
+++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c
@@ -356,7 +356,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
 }
 
 
-void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, uint8_t harq_pid, uint8_t crc_flag) {
+  void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, uint8_t harq_pid, uint8_t crc_flag) {
 
   pthread_mutex_lock(&gNB->UL_INFO_mutex);
 
@@ -675,9 +675,10 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
               dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot) + gNB->pusch_thres) {
              NR_gNB_SCH_STATS_t *stats=get_ulsch_stats(gNB,ulsch);
 
-             LOG_I(PHY, "PUSCH not detected in %d.%d (%d,%d,%d)\n",frame_rx,slot_rx,
+             LOG_D(PHY, "PUSCH not detected in %d.%d (%d,%d,%d)\n",frame_rx,slot_rx,
                    dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot),
                    dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot),gNB->pusch_thres);
+             gNB->pusch_vars[ULSCH_id]->ulsch_power_tot = gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot;
              nr_fill_indication(gNB,frame_rx, slot_rx, ULSCH_id, harq_pid, 1);
              gNB->pusch_vars[ULSCH_id]->DTX=1;
              if (stats) stats->DTX++;
diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c
index 64c18d969ce149d71f7d4546d8e80b0ae2eff1b5..6bdd2ff06ba018c0783b170dc1370bc78c90031e 100644
--- a/openair2/LAYER2/NR_MAC_gNB/config.c
+++ b/openair2/LAYER2/NR_MAC_gNB/config.c
@@ -54,6 +54,87 @@ extern RAN_CONTEXT_t RC;
 extern void mac_top_init_gNB(void);
 extern uint8_t nfapi_mode;
 
+void process_rlcBearerConfig(struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list, 
+                             struct NR_CellGroupConfig__rlc_BearerToReleaseList *rlc_bearer2release_list,
+                             NR_UE_sched_ctrl_t *sched_ctrl) {
+
+  if (rlc_bearer2add_list) 
+  // keep lcids
+    for (int i=0;i<rlc_bearer2add_list->list.count;i++) {
+      sched_ctrl->lcid_mask |= (1<<rlc_bearer2add_list->list.array[i]->logicalChannelIdentity);
+      LOG_I(NR_MAC,"Adding LCID %d (%s %d)\n",
+            (int)rlc_bearer2add_list->list.array[i]->logicalChannelIdentity,
+            rlc_bearer2add_list->list.array[i]->logicalChannelIdentity<4 ? "SRB" : "DRB",
+            (int)rlc_bearer2add_list->list.array[i]->logicalChannelIdentity);
+    }
+  if (rlc_bearer2release_list) 
+    for (int i=0;i<rlc_bearer2release_list->list.count;i++)
+      sched_ctrl->lcid_mask |= (1<<*rlc_bearer2release_list->list.array[i]);
+    
+}
+
+
+void process_drx_Config(NR_UE_sched_ctrl_t *sched_ctrl,NR_SetupRelease_DRX_Config_t *drx_Config) {
+ if (!drx_Config) return;
+ AssertFatal(drx_Config->present != NR_SetupRelease_DRX_Config_PR_NOTHING, "Cannot have NR_SetupRelease_DRX_Config_PR_NOTHING\n");
+
+ if (drx_Config->present == NR_SetupRelease_DRX_Config_PR_setup) {
+   LOG_I(NR_MAC,"Adding DRX config\n");
+ }
+ else {
+   LOG_I(NR_MAC,"Removing DRX config\n");
+ }
+}
+
+void process_schedulingRequestConfig(NR_UE_sched_ctrl_t *sched_ctrl,NR_SchedulingRequestConfig_t *schedulingRequestConfig) {
+ if (!schedulingRequestConfig) return;
+
+   LOG_I(NR_MAC,"Adding SchedulingRequestconfig\n");
+}
+
+void process_bsrConfig(NR_UE_sched_ctrl_t *sched_ctrl,NR_BSR_Config_t *bsr_Config) {
+  if (!bsr_Config) return;
+  LOG_I(NR_MAC,"Adding BSR config\n");
+}
+
+void process_tag_Config(NR_UE_sched_ctrl_t *sched_ctrl,NR_TAG_Config_t *tag_Config) {
+  if (!tag_Config) return;
+  LOG_I(NR_MAC,"Adding TAG config\n");
+}
+
+void process_phr_Config(NR_UE_sched_ctrl_t *sched_ctrl,NR_SetupRelease_PHR_Config_t *phr_Config) {
+   if (!phr_Config) return;
+   AssertFatal(phr_Config->present != NR_SetupRelease_PHR_Config_PR_NOTHING, "Cannot have NR_SetupRelease_PHR_Config_PR_NOTHING\n");
+
+   if (phr_Config->present == NR_SetupRelease_PHR_Config_PR_setup) {
+     LOG_I(NR_MAC,"Adding PHR config\n");
+   }
+   else {
+     LOG_I(NR_MAC,"Removing PHR config\n");
+   }
+}
+
+void process_CellGroup(NR_CellGroupConfig_t *CellGroup, NR_UE_sched_ctrl_t *sched_ctrl) {
+
+   AssertFatal(CellGroup, "CellGroup is null\n");
+   NR_MAC_CellGroupConfig_t   *mac_CellGroupConfig = CellGroup->mac_CellGroupConfig;
+   
+
+   if (mac_CellGroupConfig) {
+     process_drx_Config(sched_ctrl,mac_CellGroupConfig->drx_Config);
+     process_schedulingRequestConfig(sched_ctrl,mac_CellGroupConfig->schedulingRequestConfig);
+     process_bsrConfig(sched_ctrl,mac_CellGroupConfig->bsr_Config);
+     process_tag_Config(sched_ctrl,mac_CellGroupConfig->tag_Config);
+     process_phr_Config(sched_ctrl,mac_CellGroupConfig->phr_Config);
+   }
+   else {
+     // apply defaults
+
+   }
+
+   process_rlcBearerConfig(CellGroup->rlc_BearerToAddModList,CellGroup->rlc_BearerToReleaseList,sched_ctrl);
+
+}  
 void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts, int pusch_AntennaPorts, NR_ServingCellConfigCommon_t *scc) {
 
   nfapi_nr_config_request_scf_t *cfg = &RC.nrmac[Mod_idP]->config[0];
@@ -339,9 +420,9 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
                            int pdsch_AntennaPorts,
                            int pusch_AntennaPorts,
                            NR_ServingCellConfigCommon_t *scc,
-			   int add_ue,
-			   uint32_t rnti,
-			   NR_CellGroupConfig_t *CellGroup){
+	                         int add_ue,
+                           uint32_t rnti,
+	                         NR_CellGroupConfig_t *CellGroup) {
 
   if (scc != NULL ) {
     AssertFatal((scc->ssb_PositionsInBurst->present > 0) && (scc->ssb_PositionsInBurst->present < 4), "SSB Bitmap type %d is not valid\n",scc->ssb_PositionsInBurst->present);
@@ -384,7 +465,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
                   ssb_SubcarrierOffset,
                   pdsch_AntennaPorts,
                   pusch_AntennaPorts,
-		  scc);
+		              scc);
     LOG_E(NR_MAC, "%s() %s:%d RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req:%p\n", __FUNCTION__, __FILE__, __LINE__, RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req);
   
     // if in nFAPI mode 
@@ -409,12 +490,12 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
     if (get_softmodem_params()->sa > 0) {
       NR_COMMON_channels_t *cc = &RC.nrmac[Mod_idP]->common_channels[0];
       for (int n=0;n<NR_NB_RA_PROC_MAX;n++ ) {
-	cc->ra[n].cfra = false;
-	cc->ra[n].rnti = 0;
-	cc->ra[n].preambles.num_preambles = MAX_NUM_NR_PRACH_PREAMBLES;
-	cc->ra[n].preambles.preamble_list = (uint8_t *) malloc(MAX_NUM_NR_PRACH_PREAMBLES*sizeof(uint8_t));
-	for (int i = 0; i < MAX_NUM_NR_PRACH_PREAMBLES; i++)
-	  cc->ra[n].preambles.preamble_list[i] = i;
+	       cc->ra[n].cfra = false;
+	       cc->ra[n].rnti = 0;
+	       cc->ra[n].preambles.num_preambles = MAX_NUM_NR_PRACH_PREAMBLES;
+	       cc->ra[n].preambles.preamble_list = (uint8_t *) malloc(MAX_NUM_NR_PRACH_PREAMBLES*sizeof(uint8_t));
+	       for (int i = 0; i < MAX_NUM_NR_PRACH_PREAMBLES; i++)
+	          cc->ra[n].preambles.preamble_list[i] = i;
       }
     }
   }
@@ -425,6 +506,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
     if (add_ue == 1 && get_softmodem_params()->phy_test) {
       const int UE_id = add_new_nr_ue(Mod_idP, rnti, CellGroup);
       LOG_I(PHY,"Added new UE_id %d/%x with initial CellGroup\n",UE_id,rnti);
+      process_CellGroup(CellGroup,&UE_info->UE_sched_ctrl[UE_id]);
     } else if (add_ue == 1 && !get_softmodem_params()->phy_test) {
       const int CC_id = 0;
       NR_COMMON_channels_t *cc = &RC.nrmac[Mod_idP]->common_channels[CC_id];
@@ -440,7 +522,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
       NR_RA_t *ra = &cc->ra[ra_index];
       ra->CellGroup = CellGroup;
       if (CellGroup->spCellConfig && CellGroup->spCellConfig->reconfigurationWithSync &&
-	  CellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated!=NULL) {
+	        CellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated!=NULL) {
         if (CellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra != NULL) {
           ra->cfra = true;
           ra->rnti = rnti;
@@ -472,6 +554,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
       const int UE_id = find_nr_UE_id(Mod_idP,rnti);
       UE_info->CellGroup[UE_id] = CellGroup;
       LOG_I(NR_MAC,"Modified UE_id %d/%x with CellGroup\n",UE_id,rnti);
+      process_CellGroup(CellGroup,&UE_info->UE_sched_ctrl[UE_id]);
     }
   }
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT);
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
index a146c11f59796135ddda673677cc56423a6b1ad5..20f0bea3b24213f2bb2edc4a5eba5d1494294e6c 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
@@ -77,10 +77,12 @@ void dump_mac_stats(gNB_MAC_INST *gNB)
     stats->num_rsrp_meas = 0;
     stats->cumul_rsrp = 0 ;
     LOG_I(MAC, "UE %d: dlsch_total_bytes %d\n", UE_id, stats->dlsch_total_bytes);
-    LOG_I(MAC, "UE %d: ulsch_rounds %d/%d/%d/%d, ulsch_errors %d\n",
+    LOG_I(MAC, "UE %d: ulsch_rounds %d/%d/%d/%d, ulsch_DTX %d, ulsch_errors %d\n",
           UE_id,
           stats->ulsch_rounds[0], stats->ulsch_rounds[1],
-          stats->ulsch_rounds[2], stats->ulsch_rounds[3], stats->ulsch_errors);
+          stats->ulsch_rounds[2], stats->ulsch_rounds[3], 
+          stats->ulsch_DTX,
+          stats->ulsch_errors);
     LOG_I(MAC,
           "UE %d: ulsch_total_bytes_scheduled %d, ulsch_total_bytes_received %d\n",
           UE_id,
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c
index b84cb611e07e1586e5064e1454ab57fa97aedb8a..9d276201982e3ad09a27a58637425e57693f9d4e 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c
@@ -343,11 +343,11 @@ void nr_store_dlsch_buffer(module_id_t module_id,
     NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
 
     sched_ctrl->num_total_bytes = 0;
-    if (loop_dcch_dtch == DL_SCH_LCID_DCCH1) 
+    if ((sched_ctrl->lcid_mask&(1<<4)) > 0 && loop_dcch_dtch == DL_SCH_LCID_DCCH1) 
       loop_dcch_dtch = DL_SCH_LCID_DTCH;
-    else if (loop_dcch_dtch == DL_SCH_LCID_DTCH)
+    else if ((sched_ctrl->lcid_mask&(1<<1)) > 0 && loop_dcch_dtch == DL_SCH_LCID_DTCH)
       loop_dcch_dtch = DL_SCH_LCID_DCCH;
-    else if (loop_dcch_dtch == DL_SCH_LCID_DCCH)
+    else if ((sched_ctrl->lcid_mask&(1<<2)) > 0 && loop_dcch_dtch == DL_SCH_LCID_DCCH)
       loop_dcch_dtch = DL_SCH_LCID_DCCH1;
 
     const int lcid = loop_dcch_dtch;
@@ -374,11 +374,12 @@ void nr_store_dlsch_buffer(module_id_t module_id,
         && !sched_ctrl->ta_apply) /* If TA should be applied, give at least one RB */
       return;
 
-    LOG_I(NR_MAC,
-          "[%s][%d.%d], DTCH%d->DLSCH, RLC status %d bytes TA %d\n",
+    LOG_D(NR_MAC,
+          "[%s][%d.%d], %s%d->DLSCH, RLC status %d bytes TA %d\n",
           __func__,
           frame,
           slot,
+          lcid<4?"DCCH":"DTCH",
           lcid,
           sched_ctrl->rlc_status[lcid].bytes_in_buffer,
           sched_ctrl->ta_apply);
@@ -722,6 +723,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
   NR_list_t *UE_list = &UE_info->list;
   for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
     NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
+    if (sched_ctrl->ul_failure==1) continue;
     UE_info->mac_stats[UE_id].dlsch_current_bytes = 0;
 
     /* update TA and set ta_apply every 10 frames.
@@ -825,7 +827,8 @@ void nr_schedule_ue_spec(module_id_t module_id,
             startSymbolIndex,
             nrOfSymbols,
             sched_ctrl->mcs,
-            TBS,((double)TBS)*(1<<scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing)/1000,
+            TBS,
+            ((double)TBS)*(1<<scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing)/1000,
             current_harq_pid,
             harq->round,
             harq->ndi);
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
index 055f38d2136b1302ac65594156b38bd41048af6f..953422bb08b25f9de10cc0fb1989302d4cea402b 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
@@ -1722,6 +1722,7 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG
       compute_csi_bitlen (CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE_info, UE_id, mod_idP);
     NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
     memset(sched_ctrl, 0, sizeof(*sched_ctrl));
+    sched_ctrl->lcid_mask = 0;
     sched_ctrl->ta_frame = 0;
     sched_ctrl->ta_update = 31;
     sched_ctrl->ta_apply = false;
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c
index b94dcced6e0e9529d071cc12d22ad1ce63848554..ad6e90890cc4a888f26b1c5b5edc9e0f436ed55e 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c
@@ -126,6 +126,7 @@ void nr_schedule_pucch(int Mod_idP,
 
   for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
     NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
+    if (sched_ctrl->ul_failure==1) continue;
     const int n = sizeof(sched_ctrl->sched_pucch) / sizeof(*sched_ctrl->sched_pucch);
     for (int i = 0; i < n; i++) {
       NR_sched_pucch_t *curr_pucch = &UE_info->UE_sched_ctrl[UE_id].sched_pucch[i];
@@ -975,7 +976,7 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id,
     sched_ctrl->tpc1 = nr_get_tpc(RC.nrmac[mod_id]->pucch_target_snrx10,
                                   uci_01->ul_cqi,
                                   30);
-  LOG_I(NR_MAC,"pucch tpc %d\n",sched_ctrl->tpc1);
+  LOG_D(NR_MAC,"pucch tpc %d\n",sched_ctrl->tpc1);
   NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon;
   const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
   if (((uci_01->pduBitmap >> 1) & 0x01)) {
@@ -1149,7 +1150,7 @@ bool nr_acknack_scheduling(int mod_id,
     }
   }
 
-  LOG_I(MAC,"1. DL slot %d, UL_ACK %d\n",slot,pucch->ul_slot);
+  LOG_D(MAC,"1. DL slot %d, UL_ACK %d\n",slot,pucch->ul_slot);
   /* if the UE's next PUCCH occasion is after the possible UL slots (within the
    * same frame) or wrapped around to the next frame, then we assume there is
    * no possible PUCCH allocation anymore */
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
index 4f913a0c2da51d2faba2d9d9554866baeaf00fe2..1f0106124d19a067a685b48adef3ba23b18c8d8d 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
@@ -305,11 +305,11 @@ void nr_process_mac_pdu(
                   mac_subheader_len = 2;
                 }
 
-                LOG_I(NR_MAC, "[UE %d] Frame %d : ULSCH -> UL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, module_idP, mac_sdu_len);
-		int UE_id = find_nr_UE_id(module_idP, rnti);
-		RC.nrmac[module_idP]->UE_info.mac_stats[UE_id].lc_bytes_rx[rx_lcid] += mac_sdu_len;
+                LOG_I(NR_MAC, "[UE %d] Frame %d : ULSCH -> UL-%s %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid<4?"DCCH":"DTCH",rx_lcid, module_idP, mac_sdu_len);
+		            int UE_id = find_nr_UE_id(module_idP, rnti);
+		            RC.nrmac[module_idP]->UE_info.mac_stats[UE_id].lc_bytes_rx[rx_lcid] += mac_sdu_len;
                 #if defined(ENABLE_MAC_PAYLOAD_DEBUG)
-		    log_dump(NR_MAC, pdu_ptr + mac_subheader_len, 32, LOG_DUMP_CHAR, "\n");
+		                log_dump(NR_MAC, pdu_ptr + mac_subheader_len, 32, LOG_DUMP_CHAR, "\n");
 
                 #endif
 
@@ -507,7 +507,10 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
         if (UE_scheduling_control->sched_ul_bytes < 0)
           UE_scheduling_control->sched_ul_bytes = 0;
       }
-      if (ul_cqi < 128) UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt++; 
+      if (ul_cqi <= 128) {
+        UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt++;
+        UE_info->mac_stats[UE_id].ulsch_DTX++;
+      }
       if (UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt >= pusch_failure_thres) {
          LOG_I(NR_MAC,"Detected UL Failure on PUSCH, stopping scheduling\n");
          UE_info->UE_sched_ctrl[UE_id].ul_failure = 1;
@@ -771,7 +774,7 @@ void pf_ul(module_id_t module_id,
     sched_pusch->mcs = mcs;
     sched_pusch->R = nr_get_code_rate_ul(mcs, ps->mcs_table);
     sched_pusch->Qm = nr_get_Qm_ul(mcs, ps->mcs_table);
-    LOG_W(NR_MAC, "Fixme: work around a NULL pointer (set in function nr_save_pusch_fields that is actually called)\n");
+    LOG_D(NR_MAC, "Fixme: work around a NULL pointer (set in function nr_save_pusch_fields that is actually called)\n");
     if (ps->pusch_Config && (ps->pusch_Config->tp_pi2BPSK
         && ((ps->mcs_table == 3 && mcs < 2) || (ps->mcs_table == 4 && mcs < 6)))) {
       sched_pusch->R >>= 1;
@@ -1031,6 +1034,7 @@ void nr_schedule_ulsch(module_id_t module_id,
   const NR_list_t *UE_list = &UE_info->list;
   for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
     NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
+    if (sched_ctrl->ul_failure == 1) continue;
     UE_info->mac_stats[UE_id].ulsch_current_bytes = 0;
     /* dynamic PUSCH values (RB alloc, MCS, hence R, Qm, TBS) that change in
      * every TTI are pre-populated by the preprocessor and used below */
diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h
index 18698635dea8e545197ac1777eb25cc0084187f9..69a1ca7800e14f57a5fdc39caff1646970f5d01b 100644
--- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h
+++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h
@@ -52,9 +52,9 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
                            int pdsch_AntennaPorts,
                            int pusch_AntennaPorts,
                            NR_ServingCellConfigCommon_t *scc,
-			   int nsa_flag,
-			   uint32_t rnti,
-			   NR_CellGroupConfig_t *CellGroup
+		                  	   int nsa_flag,
+			                     uint32_t rnti,
+			                     NR_CellGroupConfig_t *CellGroup
                            );
 
 void clear_nr_nfapi_information(gNB_MAC_INST * gNB, 
diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
index 47864efb00c93d9660ca30b88a6adebaa94eeb09..4ed6467fce7738ece2d9f5e009cca562dfdd1d7d 100644
--- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
+++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
@@ -517,6 +517,7 @@ typedef struct {
   /// DL HARQ PID to use for this UE, or -1 for "any new"
   int8_t dl_harq_pid;
 
+  int lcid_mask;
   uint16_t ta_frame;
   int16_t ta_update;
   bool ta_apply;
@@ -562,6 +563,7 @@ typedef struct {
   int dlsch_current_bytes;
   int ulsch_rounds[8];
   int ulsch_errors;
+  int ulsch_DTX;
   int ulsch_total_bytes_scheduled;
   int ulsch_total_bytes_rx;
   int ulsch_current_bytes;
diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
index 121652062a7da2c18ebc0286629e41f3da8ddf36..b1805aea9ce6528e79e04cc0a31ecb30ff6facc6 100644
--- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
+++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
@@ -911,6 +911,7 @@ boolean_t nr_rrc_pdcp_config_asn1_req(
       //kUPenc != NULL ||
       pmch_InfoList_r9 != NULL /*||
       defaultDRB != NULL */) {
+    LOG_I(PDCP,"Releasing DRBs, oops\n");
     TODO;
   }
 
diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c
index 6b9ff4bdc412216eaccc49516c68aa464beebc72..f8cb75c74d49bca9d48b47e89894bedb1c3fe874 100644
--- a/openair2/RRC/NR/L2_nr_interface.c
+++ b/openair2/RRC/NR/L2_nr_interface.c
@@ -44,6 +44,7 @@
 #include "NR_BCCH-BCH-Message.h"
 #include "rrc_gNB_UE_context.h"
 #include <openair2/RRC/NR/MESSAGES/asn1_msg.h>
+#include <openair2/UTIL/OPT/opt.h>
 
 
 extern RAN_CONTEXT_t RC;
@@ -207,6 +208,7 @@ nr_rrc_data_req(
     message_p);
   LOG_I(NR_RRC,"send RRC_DCCH_DATA_REQ to PDCP\n");
 
+  //trace_NRpdu(DIRECTION_DOWNLINK, message_buffer, sdu_sizeP, 0, WS_M_RNTI, ctxt_pP->rnti, ctxt_pP->frame, ctxt_pP->subframe,0, 0); 
   /* Hack: only trigger PDCP if in CU, otherwise it is triggered by RU threads
    * Ideally, PDCP would not neet to be triggered like this but react to ITTI
    * messages automatically */
diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c
index 4ab831ae908d32a8e6c137a984be1da965dde06b..d2dc25decd74c4c6394f1c60b99689c56373b801 100755
--- a/openair2/RRC/NR/MESSAGES/asn1_msg.c
+++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c
@@ -1631,13 +1631,14 @@ uint16_t do_RRCReconfiguration(
     // *security_config->keyToUse = NR_SecurityConfig__keyToUse_master;
 
     ie = calloc(1, sizeof(NR_RRCReconfiguration_IEs_t));
-    ie->radioBearerConfig = calloc(1, sizeof(NR_RadioBearerConfig_t));
-    ie->radioBearerConfig->srb_ToAddModList  = SRB_configList;
-    ie->radioBearerConfig->drb_ToAddModList  = DRB_configList;
-    ie->radioBearerConfig->securityConfig    = security_config;
-    ie->radioBearerConfig->srb3_ToRelease    = NULL;
-    ie->radioBearerConfig->drb_ToReleaseList = DRB_releaseList;
-
+    if (SRB_configList || DRB_configList) {
+      ie->radioBearerConfig = calloc(1, sizeof(NR_RadioBearerConfig_t));
+      ie->radioBearerConfig->srb_ToAddModList  = SRB_configList;
+      ie->radioBearerConfig->drb_ToAddModList  = DRB_configList;
+      ie->radioBearerConfig->securityConfig    = security_config;
+      ie->radioBearerConfig->srb3_ToRelease    = NULL;
+      ie->radioBearerConfig->drb_ToReleaseList = DRB_releaseList;
+    }
     /******************** Secondary Cell Group ********************/
     // rrc_gNB_carrier_data_t *carrier = &(gnb_rrc_inst->carrier);
     // fill_default_secondaryCellGroup( carrier->servingcellconfigcommon,
diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c
index 5b53cff0f50d801613a81848ae55579e45898e88..b8361ae45f3c29b5205487929bec14206220e2c1 100755
--- a/openair2/RRC/NR/rrc_gNB.c
+++ b/openair2/RRC/NR/rrc_gNB.c
@@ -1003,7 +1003,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
     memset(sdap_config, 0, sizeof(NR_SDAP_Config_t));
     sdap_config->pdu_Session = ue_context_pP->ue_context.pdusession[i].param.pdusession_id;
     sdap_config->sdap_HeaderDL = NR_SDAP_Config__sdap_HeaderDL_absent;
-    sdap_config->sdap_HeaderUL = NR_SDAP_Config__sdap_HeaderUL_present;
+    sdap_config->sdap_HeaderUL = NR_SDAP_Config__sdap_HeaderUL_absent;
     sdap_config->defaultDRB = TRUE;
     sdap_config->mappedQoS_FlowsToAdd = calloc(1, sizeof(struct NR_SDAP_Config__mappedQoS_FlowsToAdd));
     memset(sdap_config->mappedQoS_FlowsToAdd, 0, sizeof(struct NR_SDAP_Config__mappedQoS_FlowsToAdd));
@@ -1281,6 +1281,7 @@ rrc_gNB_process_RRCReconfigurationComplete(
   NR_DRB_ToReleaseList_t             *DRB_Release_configList2 = ue_context_pP->ue_context.DRB_Release_configList2[xid];
   NR_DRB_Identity_t                  *drb_id_p      = NULL;
 //  uint8_t                             nr_DRB2LCHAN[8];
+  gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id];
 
   ue_context_pP->ue_context.ue_reestablishment_timer = 0;
 
@@ -1321,6 +1322,15 @@ rrc_gNB_process_RRCReconfigurationComplete(
                               ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList);
   /* Refresh SRBs/DRBs */
   if (!NODE_IS_CU(RC.nrrrc[ctxt_pP->module_id]->node_type)) {
+    rrc_mac_config_req_gNB(rrc->module_id,
+                           rrc->carrier.ssb_SubcarrierOffset,
+                           rrc->carrier.pdsch_AntennaPorts,
+                           rrc->carrier.pusch_AntennaPorts,
+                           NULL,
+                           0,
+                           ue_context_pP->ue_context.rnti,
+                           ue_context_pP->ue_context.masterCellGroup
+                           );
     LOG_I(NR_RRC,"Configuring RLC DRBs/SRBs for UE %x\n",ue_context_pP->ue_context.rnti);
     nr_rrc_rlc_config_asn1_req(ctxt_pP,
                           SRB_configList, // NULL,
diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c
index c996b7af20275656a292a5ad931aebe95a52f764..5595f87d1470349aa4d53bee8c3134a54fe5ab74 100644
--- a/openair2/RRC/NR/rrc_gNB_NGAP.c
+++ b/openair2/RRC/NR/rrc_gNB_NGAP.c
@@ -355,8 +355,8 @@ nr_rrc_pdcp_config_security(
     if (print_keys == 1 ) {
       print_keys =0;
       LOG_DUMPMSG(NR_RRC, DEBUG_SECURITY, ue_context_pP->ue_context.kgnb, 32,"\nKgNB:" );
-      LOG_DUMPMSG(NR_RRC, DEBUG_SECURITY, kRRCenc, 32,"\nKRRCenc:" );
-      LOG_DUMPMSG(NR_RRC, DEBUG_SECURITY, kRRCint, 32,"\nKRRCint:" );
+      LOG_DUMPMSG(NR_RRC, DEBUG_SECURITY, kRRCenc, 16,"\nKRRCenc:" );
+      LOG_DUMPMSG(NR_RRC, DEBUG_SECURITY, kRRCint, 16,"\nKRRCint:" );
     }
   }
 
diff --git a/openair2/UTIL/OPT/README.txt b/openair2/UTIL/OPT/README.txt
index 2ac68f83fdbf1057f414e88a7559e6eb0c7345db..13ec727fd5a5b41c3cc4f0d58e6e543db92e0422 100644
--- a/openair2/UTIL/OPT/README.txt
+++ b/openair2/UTIL/OPT/README.txt
@@ -1,13 +1,14 @@
 
-How to configure wireshark for dissecting LTE protocols:
+How to configure wireshark for dissecting LTE/NR protocols:
 - start the wireshark as a sudoers
   - goto analyze->enabled prototols
-  => enable mac_lte_udp and rlc_lte_udp
+  => enable mac_xxx_udp and rlc_xxx_udp (xxx is lte or nr)
   - goto edit/preferences and expand Protocols
   - select UDP and check "try heuristic sub-dissectors first"
-  - select MAC-LTE, and check all the options (checkboxes), and set the "which layer info to show in info column" to "MAC info"
-    - select RLC-LTE, and check all the options except the "May see RLC headers only", and
+  - select MAC-LTE (or MAC-NR), and check all the options (checkboxes), and set the "which layer info to show in info column" to "MAC info"
+  - select RLC-LTE (or NR), and check all the options except the "May see RLC headers only", and
     set the "call PDCP dissector for DRB PDUs" to "12-bit SN". Optionally you may select the sequence analysis for RLC AM/UM.
+  - select PDCP-LTE (or NR)
 
     How to use
     - start eNB or UE with option --opt.type wireshark
diff --git a/openair2/UTIL/OPT/opt.h b/openair2/UTIL/OPT/opt.h
index ab591d3a6572c7c114149baa78e8509ee97b9ab7..a3a790cf9789420063387b0031e2c73ebe0d2a29 100644
--- a/openair2/UTIL/OPT/opt.h
+++ b/openair2/UTIL/OPT/opt.h
@@ -60,6 +60,12 @@ typedef uint32_t guint32;
 typedef guint8   gboolean;
 
 #include "packet-mac-lte.h"
+#include "packet-rlc-lte.h"
+#include "packet-pdcp-lte.h"
+#include "packet-mac-nr.h"
+#include "packet-rlc-nr.h"
+#include "packet-pdcp-nr.h"
+
 #include "mac_pcap.h"
 
 /* OPT parameters definitions */
@@ -107,9 +113,10 @@ typedef enum radio_type_e {
 */
 
 extern int opt_enabled;
-#define trace_pdu(x...) if (opt_enabled) trace_pdu_implementation(x)
+#define trace_pdu(x...) if (opt_enabled) trace_pdu_implementation(0, x)
+#define trace_NRpdu(x...) if (opt_enabled) trace_pdu_implementation(1, x)
 
-void trace_pdu_implementation(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
+void trace_pdu_implementation(int nr, int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
                               int ueid, int rntiType, int rnti, uint16_t sysFrame, uint8_t subframe,
                               int oob_event, int oob_event_value);
 
diff --git a/openair2/UTIL/OPT/packet-mac-lte.h b/openair2/UTIL/OPT/packet-mac-lte.h
index 2d36e02df4d580af33f9fa5423dc984480f2d47f..33e987c4ab3992f4d5d0d98071dd4eaa1da586c9 100644
--- a/openair2/UTIL/OPT/packet-mac-lte.h
+++ b/openair2/UTIL/OPT/packet-mac-lte.h
@@ -15,7 +15,7 @@
  *
  * SPDX-License-Identifier: BSD-2-Clause
  */
- 
+
  /* 
  this is wireshark, commit: commit eda834b6e29c36e05a63a6056afa98390ff79357 
  Date:   Wed Aug 22 14:36:20 2018 +0200
@@ -114,6 +114,7 @@ typedef struct mac_lte_info
     /* Timing info */
     guint16         sysframeNumber;
     guint16         subframeNumber;
+    gboolean        sfnSfInfoPresent;
 
     /* Optional field. More interesting for TDD (FDD is always -4 subframeNumber) */
     gboolean        subframeNumberOfGrantPresent;
@@ -197,49 +198,27 @@ typedef struct mac_lte_info
     guint16            oob_rnti[MAX_SRs];
 } mac_lte_info;
 
+ /* 0 to 10 and 32 to 38 */
+#define MAC_LTE_DATA_LCID_COUNT_MAX 18
 
-typedef struct mac_lte_tap_info {
-    /* Info from context */
-    guint16  rnti;
-    guint16  ueid;
-    guint8   rntiType;
-    guint8   isPredefinedData;
-    gboolean crcStatusValid;
-    mac_lte_crc_status   crcStatus;
-    guint8   direction;
-
-    guint8   isPHYRetx;
-    guint16  ueInTTI;
-
-    nstime_t mac_lte_time;
 
-    /* Number of bytes (which part is used depends upon context settings) */
-    guint32  single_number_of_bytes;
-    guint32  bytes_for_lcid[11];
-    guint32  sdus_for_lcid[11];
-    guint8   number_of_rars;
-    guint8   number_of_paging_ids;
 
-    /* Number of padding bytes includes padding subheaders and trailing padding */
-    guint16  padding_bytes;
-    guint16  raw_length;
-} mac_lte_tap_info;
 
+/* Accessor function to check if a frame was considered to be ReTx */
 
-
-/*****************************************************************/
-/* UDP framing format                                            */
-/* -----------------------                                       */
-/* Several people have asked about dissecting MAC by framing     */
-/* PDUs over IP.  A suggested format over UDP has been created   */
-/* and implemented by this dissector, using the definitions      */
-/* below. A link to an example program showing you how to encode */
-/* these headers and send LTE MAC PDUs on a UDP socket is        */
-/* provided at https://wiki.wireshark.org/MAC-LTE                */
-/*                                                               */
-/* A heuristic dissector (enabled by a preference) will          */
-/* recognise a signature at the beginning of these frames.       */
-/*****************************************************************/
+/**********************************************************************/
+/* UDP framing format                                                 */
+/* -----------------------                                            */
+/* Several people have asked about dissecting MAC by framing          */
+/* PDUs over IP.  A suggested format over UDP has been created        */
+/* and implemented by this dissector, using the definitions           */
+/* below. A link to an example program showing you how to encode      */
+/* these headers and send LTE MAC PDUs on a UDP socket is             */
+/* provided at https://gitlab.com/wireshark/wireshark/-/wikis/MAC-LTE */
+/*                                                                    */
+/* A heuristic dissector (enabled by a preference) will               */
+/* recognise a signature at the beginning of these frames.            */
+/**********************************************************************/
 
 
 /* Signature.  Rather than try to define a port for this, or make the
@@ -317,66 +296,4 @@ typedef struct mac_lte_tap_info {
    continues until the end of the frame) */
 #define MAC_LTE_PAYLOAD_TAG 0x01
 
-
-/* Type to store parameters for configuring LCID->RLC channel settings for DRB */
-/* Some are optional, and may not be seen (e.g. on reestablishment) */
-typedef struct drb_mapping_t
-{
-    guint16    ueid;                /* Mandatory */
-    guint8     drbid;               /* Mandatory */
-    gboolean   lcid_present;
-    guint8     lcid;                /* Part of LogicalChannelConfig - optional */
-    gboolean   rlcMode_present;
-    guint8     rlcMode;             /* Part of RLC config - optional */
-    gboolean   rlc_ul_ext_li_field; /* Part of RLC config - optional */
-    gboolean   rlc_dl_ext_li_field; /* Part of RLC config - optional */
-    gboolean   rlc_ul_ext_am_sn;    /* Part of RLC config - optional */
-    gboolean   rlc_dl_ext_am_sn;    /* Part of RLC config - optional */
-    gboolean   um_sn_length_present;
-    guint8     um_sn_length;        /* Part of RLC config - optional */
-    gboolean   ul_priority_present;
-    guint8     ul_priority;         /* Part of LogicalChannelConfig - optional */
-    gboolean   pdcp_sn_size_present;
-    guint8     pdcp_sn_size;        /* Part of pdcp-Config - optional */
-} drb_mapping_t;
-
-
-
-/* Dedicated DRX config. Used to verify that a sensible config is given.
-   Also, beginning to configure MAC with this config and (optionally) show
-   DRX config and state (cycles/timers) attached to each UL/DL PDU! */
-typedef struct drx_config_t {
-    gboolean    configured;
-    guint32     frameNum;
-    guint32     previousFrameNum;
-
-    guint32     onDurationTimer;
-    guint32     inactivityTimer;
-    guint32     retransmissionTimer;
-    guint32     longCycle;
-    guint32     cycleOffset;
-    /* Optional Short cycle */
-    gboolean    shortCycleConfigured;
-    guint32     shortCycle;
-    guint32     shortCycleTimer;
-} drx_config_t;
-
-/* RRC can indicate whether simultaneous PUCCH/PUSCH is used */
-typedef enum {
-    SIMULT_PUCCH_PUSCH_PCELL = 0,
-    SIMULT_PUCCH_PUSCH_PSCELL
-} simult_pucch_pusch_cell_type;
-/*
- * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
- *
- * Local variables:
- * c-basic-offset: 4
- * tab-width: 8
- * indent-tabs-mode: nil
- * End:
- *
- * vi: set shiftwidth=4 tabstop=8 expandtab:
- * :indentSize=4:tabSize=8:noTabs=true:
- */
-
 #endif
diff --git a/openair2/UTIL/OPT/packet-mac-nr.h b/openair2/UTIL/OPT/packet-mac-nr.h
new file mode 100644
index 0000000000000000000000000000000000000000..8a1627a8efc1b4171ac7f2488a504f15769f4b11
--- /dev/null
+++ b/openair2/UTIL/OPT/packet-mac-nr.h
@@ -0,0 +1,142 @@
+/* packet-mac-nr.h
+ *
+ * Martin Mathieson
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+/* radioType */
+#define FDD_RADIO 1
+#define TDD_RADIO 2
+
+/* Direction */
+#define DIRECTION_UPLINK   0
+#define DIRECTION_DOWNLINK 1
+
+/* rntiType */
+#define WS_NO_RNTI     0
+#define WS_P_RNTI      1
+#define WS_RA_RNTI     2
+#define WS_C_RNTI      3
+#define WS_SI_RNTI     4
+#define WS_CS_RNTI     5
+
+/* Context info attached to each NR MAC frame */
+typedef struct mac_nr_info
+{
+    /* Needed for decode */
+    guint8          radioType;
+    guint8          direction;
+    guint8          rntiType;
+
+    /* Extra info to display */
+    guint16         rnti;
+    guint16         ueid;
+    guint8          harqid;
+
+    /* Will these be included in the ME PHR report? */
+    guint8          phr_type2_othercell;
+
+    /* Timing info */
+    gboolean        sfnSlotInfoPresent;
+    guint16         sysframeNumber;
+    guint16         slotNumber;
+
+    /* Length of DL PDU or UL grant size in bytes */
+    guint16         length;
+
+} mac_nr_info;
+
+
+/*****************************************************************/
+/* UDP framing format                                            */
+/* -----------------------                                       */
+/* Several people have asked about dissecting MAC by framing     */
+/* PDUs over IP.  A suggested format over UDP has been created   */
+/* and implemented by this dissector, using the definitions      */
+/* below.                                                        */
+/*                                                               */
+/* A heuristic dissector (enabled by a preference) will          */
+/* recognise a signature at the beginning of these frames.       */
+/*****************************************************************/
+
+
+/* Signature.  Rather than try to define a port for this, or make the
+   port number a preference, frames will start with this string (with no
+   terminating NULL */
+#define MAC_NR_START_STRING "mac-nr"
+
+/* Fixed fields.  This is followed by the following 3 mandatory fields:
+   - radioType (1 byte)
+   - direction (1 byte)
+   - rntiType (1 byte)
+   (where the allowed values are defined above */
+
+/* Optional fields. Attaching this info to frames will allow you
+   to show you display/filter/plot/add-custom-columns on these fields, so should
+   be added if available.
+   The format is to have the tag, followed by the value (there is no length field,
+   it's implicit from the tag) */
+
+#define MAC_NR_RNTI_TAG                0x02
+/* 2 bytes, network order */
+
+#define MAC_NR_UEID_TAG                0x03
+/* 2 bytes, network order */
+
+#define MAC_NR_FRAME_SUBFRAME_TAG      0x04
+/* 2 bytes, deprecated, do not use it */
+
+#define MAC_NR_PHR_TYPE2_OTHERCELL_TAG 0x05
+/* 1 byte, TRUE/FALSE */
+
+#define MAC_NR_HARQID                  0x06
+/* 1 byte */
+
+#define MAC_NR_FRAME_SLOT_TAG          0x07
+/* 4 bytes, network order, SFN is stored in the 2 first bytes and slot number in the 2 last bytes */
+
+/* MAC PDU. Following this tag comes the actual MAC PDU (there is no length, the PDU
+   continues until the end of the frame) */
+#define MAC_NR_PAYLOAD_TAG             0x01
+
+
+/* Type to store parameters for configuring LCID->RLC channel settings for DRB */
+/* Some are optional, and may not be seen (e.g. on reestablishment) */
+typedef struct nr_drb_mac_rlc_mapping_t
+{
+    gboolean   active;
+    guint16    ueid;                /* Mandatory */
+    guint8     drbid;               /* Mandatory */
+
+    gboolean   lcid_present;
+    guint8     lcid;                /* Part of LogicalChannelConfig - optional */
+    gboolean   rlcMode_present;
+    guint8     rlcMode;             /* Part of RLC config - optional */
+
+    guint8     tempDirection;       /* So know direction of next SN length... */
+
+    gboolean   rlcUlSnLength_present;
+    guint8     rlcUlSnLength;        /* Part of RLC config - optional */
+    gboolean   rlcDlSnLength_present;
+    guint8     rlcDlSnLength;        /* Part of RLC config - optional */
+} nr_drb_mac_rlc_mapping_t;
+
+
+
+/*
+ * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/openair2/UTIL/OPT/packet-pdcp-lte.h b/openair2/UTIL/OPT/packet-pdcp-lte.h
new file mode 100644
index 0000000000000000000000000000000000000000..19a371011b52beeda5139439f31985a738db8485
--- /dev/null
+++ b/openair2/UTIL/OPT/packet-pdcp-lte.h
@@ -0,0 +1,172 @@
+/* packet-pdcp-lte.h
+ *
+ * Martin Mathieson
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+
+
+/* Direction */
+#define DIRECTION_UPLINK   0
+#define DIRECTION_DOWNLINK 1
+
+enum pdcp_plane
+{
+    SIGNALING_PLANE = 1,
+    USER_PLANE = 2
+};
+
+typedef enum LogicalChannelType
+{
+    Channel_DCCH=1,
+    Channel_BCCH=2,
+    Channel_CCCH=3,
+    Channel_PCCH=4,
+    Channel_DCCH_NB=5,
+    Channel_BCCH_NB=6,
+    Channel_CCCH_NB=7,
+    Channel_PCCH_NB=8
+} LogicalChannelType;
+
+typedef enum
+{
+    BCH_TRANSPORT=1,
+    DLSCH_TRANSPORT=2
+} BCCHTransportType;
+
+#define PDCP_SN_LENGTH_5_BITS  5
+#define PDCP_SN_LENGTH_7_BITS  7
+#define PDCP_SN_LENGTH_12_BITS 12
+#define PDCP_SN_LENGTH_15_BITS 15
+#define PDCP_SN_LENGTH_18_BITS 18
+
+enum lte_security_integrity_algorithm_e { eia0, eia1, eia2, eia3 };
+enum lte_security_ciphering_algorithm_e { eea0, eea1, eea2, eea3 };
+
+typedef struct pdcp_lte_security_info_t
+{
+    guint32                                 configuration_frame;
+    gboolean                                seen_next_ul_pdu;  /* i.e. have we seen SecurityModeResponse */
+    enum lte_security_integrity_algorithm_e integrity;
+    enum lte_security_ciphering_algorithm_e ciphering;
+
+    /* Store previous settings so can revert if get SecurityModeFailure */
+    guint32                                 previous_configuration_frame;
+    enum lte_security_integrity_algorithm_e previous_integrity;
+    enum lte_security_ciphering_algorithm_e previous_ciphering;
+} pdcp_lte_security_info_t;
+
+
+/***********************************************************************/
+/* UDP framing format                                                  */
+/* -----------------------                                             */
+/* Several people have asked about dissecting PDCP by framing          */
+/* PDUs over IP.  A suggested format over UDP has been defined         */
+/* and implemented by this dissector, using the definitions            */
+/* below. A link to an example program showing you how to encode       */
+/* these headers and send LTE PDCP PDUs on a UDP socket is             */
+/* provided at https://gitlab.com/wireshark/wireshark/-/wikis/PDCP-LTE */
+/*                                                                     */
+/* A heuristic dissecter (enabled by a preference) will                */
+/* recognise a signature at the beginning of these frames.             */
+/* Until someone is using this format, suggestions for changes         */
+/* are welcome.                                                        */
+/***********************************************************************/
+
+
+/* Signature.  Rather than try to define a port for this, or make the
+   port number a preference, frames will start with this string (with no
+   terminating NULL */
+#define PDCP_LTE_START_STRING "pdcp-lte"
+
+/* Fixed fields.  This is followed by the following 3 mandatory fields:
+   - no_header_pdu (1 byte)
+   - plane (1 byte)
+   - rohc_compression ( byte)
+   (where the allowed values are defined above) */
+
+/* Conditional field. This field is mandatory in case of User Plane PDCP PDU.
+   The format is to have the tag, followed by the value (there is no length field,
+   it's implicit from the tag). The allowed values are defined above. */
+
+#define PDCP_LTE_SEQNUM_LENGTH_TAG          0x02
+/* 1 byte */
+
+/* Optional fields. Attaching this info to frames will allow you
+   to show you display/filter/plot/add-custom-columns on these fields, so should
+   be added if available.
+   The format is to have the tag, followed by the value (there is no length field,
+   it's implicit from the tag) */
+
+#define PDCP_LTE_DIRECTION_TAG              0x03
+/* 1 byte */
+
+#define PDCP_LTE_LOG_CHAN_TYPE_TAG          0x04
+/* 1 byte */
+
+#define PDCP_LTE_BCCH_TRANSPORT_TYPE_TAG    0x05
+/* 1 byte */
+
+#define PDCP_LTE_ROHC_IP_VERSION_TAG        0x06
+/* 2 bytes, network order */
+
+#define PDCP_LTE_ROHC_CID_INC_INFO_TAG      0x07
+/* 1 byte */
+
+#define PDCP_LTE_ROHC_LARGE_CID_PRES_TAG    0x08
+/* 1 byte */
+
+#define PDCP_LTE_ROHC_MODE_TAG              0x09
+/* 1 byte */
+
+#define PDCP_LTE_ROHC_RND_TAG               0x0A
+/* 1 byte */
+
+#define PDCP_LTE_ROHC_UDP_CHECKSUM_PRES_TAG 0x0B
+/* 1 byte */
+
+#define PDCP_LTE_ROHC_PROFILE_TAG           0x0C
+/* 2 bytes, network order */
+
+#define PDCP_LTE_CHANNEL_ID_TAG             0x0D
+/* 2 bytes, network order */
+
+#define PDCP_LTE_UEID_TAG                   0x0E
+/* 2 bytes, network order */
+
+/* PDCP PDU. Following this tag comes the actual PDCP PDU (there is no length, the PDU
+   continues until the end of the frame) */
+#define PDCP_LTE_PAYLOAD_TAG                0x01
+
+
+
+/* Called by RRC, or other configuration protocols */
+
+/* Function to configure ciphering & integrity algorithms */
+void set_pdcp_lte_security_algorithms(guint16 ueid, pdcp_lte_security_info_t *security_info);
+
+/* Function to indicate securityModeCommand did not complete */
+void set_pdcp_lte_security_algorithms_failed(guint16 ueid);
+
+
+/* Called by external dissectors */
+void set_pdcp_lte_rrc_ciphering_key(guint16 ueid, const char *key);
+void set_pdcp_lte_rrc_integrity_key(guint16 ueid, const char *key);
+void set_pdcp_lte_up_ciphering_key(guint16 ueid, const char *key);
+
+/*
+ * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/openair2/UTIL/OPT/packet-pdcp-nr.h b/openair2/UTIL/OPT/packet-pdcp-nr.h
new file mode 100644
index 0000000000000000000000000000000000000000..79f784c1c37dda4b700d323e40f64ac85fc2aca3
--- /dev/null
+++ b/openair2/UTIL/OPT/packet-pdcp-nr.h
@@ -0,0 +1,168 @@
+/* packet-pdcp-nr.h
+ *
+ * Martin Mathieson
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+
+/* Direction */
+#define PDCP_NR_DIRECTION_UPLINK   0
+#define PDCP_NR_DIRECTION_DOWNLINK 1
+
+enum pdcp_nr_plane
+{
+    NR_SIGNALING_PLANE = 1,
+    NR_USER_PLANE = 2
+};
+
+typedef enum NRBearerType
+{
+    Bearer_DCCH=1,
+    Bearer_BCCH_BCH=2,
+    Bearer_BCCH_DL_SCH=3,
+    Bearer_CCCH=4,
+    Bearer_PCCH=5,
+} NRBearerType;
+
+
+#define PDCP_NR_SN_LENGTH_12_BITS 12
+#define PDCP_NR_SN_LENGTH_18_BITS 18
+
+#define PDCP_NR_UL_SDAP_HEADER_PRESENT 0x01
+#define PDCP_NR_DL_SDAP_HEADER_PRESENT 0x02
+
+enum nr_security_integrity_algorithm_e { nia0, nia1, nia2, nia3 };
+enum nr_security_ciphering_algorithm_e { nea0, nea1, nea2, nea3, nea_disabled=999};
+
+typedef struct pdcp_nr_security_info_t
+{
+    guint32                                configuration_frame;
+    gboolean                               seen_next_ul_pdu;  /* i.e. have we seen SecurityModeResponse */
+    enum nr_security_integrity_algorithm_e integrity;
+    enum nr_security_ciphering_algorithm_e ciphering;
+
+    /* Store previous settings so can revert if get SecurityModeFailure */
+    guint32                                previous_configuration_frame;
+    enum nr_security_integrity_algorithm_e previous_integrity;
+    enum nr_security_ciphering_algorithm_e previous_ciphering;
+} pdcp_nr_security_info_t;
+
+
+/*****************************************************************/
+/* UDP framing format                                            */
+/* -----------------------                                       */
+/* Several people have asked about dissecting PDCP by framing    */
+/* PDUs over IP.  A suggested format over UDP has been defined   */
+/* and implemented by this dissector, using the definitions      */
+/* below.                                                        */
+/*                                                               */
+/* A heuristic dissector (enabled by a preference) will          */
+/* recognise a signature at the beginning of these frames.       */
+/* Until someone is using this format, suggestions for changes   */
+/* are welcome.                                                  */
+/*****************************************************************/
+
+
+/* Signature.  Rather than try to define a port for this, or make the
+   port number a preference, frames will start with this string (with no
+   terminating NULL */
+#define PDCP_NR_START_STRING "pdcp-nr"
+
+/* Fixed fields:
+   - plane (1 byte) */
+
+/* Conditional field. This field is mandatory in case of User Plane PDCP PDU.
+   The format is to have the tag, followed by the value (there is no length field,
+   it's implicit from the tag). The allowed values are defined above. */
+
+#define PDCP_NR_SEQNUM_LENGTH_TAG          0x02
+/* 1 byte */
+
+/* Optional fields. Attaching this info should be added if available.
+   The format is to have the tag, followed by the value (there is no length field,
+   it's implicit from the tag) */
+
+#define PDCP_NR_DIRECTION_TAG              0x03
+/* 1 byte */
+
+#define PDCP_NR_BEARER_TYPE_TAG            0x04
+/* 1 byte */
+
+#define PDCP_NR_BEARER_ID_TAG              0x05
+/* 1 byte */
+
+#define PDCP_NR_UEID_TAG                   0x06
+/* 2 bytes, network order */
+
+#define PDCP_NR_ROHC_COMPRESSION_TAG       0x07
+/* 0 byte */
+
+/* N.B. The following ROHC values only have significance if rohc_compression
+   is in use for the current channel */
+
+#define PDCP_NR_ROHC_IP_VERSION_TAG        0x08
+/* 1 byte */
+
+#define PDCP_NR_ROHC_CID_INC_INFO_TAG      0x09
+/* 0 byte */
+
+#define PDCP_NR_ROHC_LARGE_CID_PRES_TAG    0x0A
+/* 0 byte */
+
+#define PDCP_NR_ROHC_MODE_TAG              0x0B
+/* 1 byte */
+
+#define PDCP_NR_ROHC_RND_TAG               0x0C
+/* 0 byte */
+
+#define PDCP_NR_ROHC_UDP_CHECKSUM_PRES_TAG 0x0D
+/* 0 byte */
+
+#define PDCP_NR_ROHC_PROFILE_TAG           0x0E
+/* 2 bytes, network order */
+
+#define PDCP_NR_MACI_PRES_TAG              0x0F
+/* 0 byte */
+
+#define PDCP_NR_SDAP_HEADER_TAG            0x10
+/* 1 byte, bitmask with PDCP_NR_UL_SDAP_HEADER_PRESENT and/or PDCP_NR_DL_SDAP_HEADER_PRESENT */
+
+#define PDCP_NR_CIPHER_DISABLED_TAG        0x11
+/* 0 byte */
+
+/* PDCP PDU. Following this tag comes the actual PDCP PDU (there is no length, the PDU
+   continues until the end of the frame) */
+#define PDCP_NR_PAYLOAD_TAG                0x01
+
+
+/* Called by RRC, or other configuration protocols */
+
+/* Function to configure ciphering & integrity algorithms */
+void set_pdcp_nr_security_algorithms(guint16 ueid, pdcp_nr_security_info_t *security_info);
+
+/* Function to indicate securityModeCommand did not complete */
+void set_pdcp_nr_security_algorithms_failed(guint16 ueid);
+
+
+/* Called by external dissectors */
+void set_pdcp_nr_rrc_ciphering_key(guint16 ueid, const char *key);
+void set_pdcp_nr_rrc_integrity_key(guint16 ueid, const char *key);
+void set_pdcp_nr_up_ciphering_key(guint16 ueid, const char *key);
+void set_pdcp_nr_up_integrity_key(guint16 ueid, const char *key);
+
+/*
+ * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/openair2/UTIL/OPT/packet-rlc-lte.h b/openair2/UTIL/OPT/packet-rlc-lte.h
new file mode 100644
index 0000000000000000000000000000000000000000..e5b03d5f8ef3b603f31d2b07779371e2debb1134
--- /dev/null
+++ b/openair2/UTIL/OPT/packet-rlc-lte.h
@@ -0,0 +1,151 @@
+/* packet-rlc-lte.h
+ *
+ * Martin Mathieson
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef PACKET_RLC_LTE_H
+#define PACKET_RLC_LTE_H
+
+/* rlcMode */
+#define RLC_TM_MODE 1
+#define RLC_UM_MODE 2
+#define RLC_AM_MODE 4
+#define RLC_PREDEF  8
+
+/* direction */
+#define DIRECTION_UPLINK 0
+#define DIRECTION_DOWNLINK 1
+
+/* priority ? */
+
+/* channelType */
+#define CHANNEL_TYPE_CCCH 1
+#define CHANNEL_TYPE_BCCH_BCH 2
+#define CHANNEL_TYPE_PCCH 3
+#define CHANNEL_TYPE_SRB 4
+#define CHANNEL_TYPE_DRB 5
+#define CHANNEL_TYPE_BCCH_DL_SCH 6
+#define CHANNEL_TYPE_MCCH 7
+#define CHANNEL_TYPE_MTCH 8
+
+/* sequenceNumberLength */
+#define UM_SN_LENGTH_5_BITS 5
+#define UM_SN_LENGTH_10_BITS 10
+#define AM_SN_LENGTH_10_BITS 10
+#define AM_SN_LENGTH_16_BITS 16
+
+
+typedef enum rlc_lte_nb_mode {
+    rlc_no_nb_mode = 0,
+    rlc_nb_mode = 1
+} rlc_lte_nb_mode;
+
+
+/* Info attached to each LTE RLC frame */
+typedef struct rlc_lte_info
+{
+    guint8          rlcMode;
+    guint8          direction;
+    guint8          priority;
+    guint8          sequenceNumberLength;
+    guint16         ueid;
+    guint16         channelType;
+    guint16         channelId; /* for SRB: 1=SRB1, 2=SRB2, 3=SRB1bis; for DRB: DRB ID */
+    guint16         pduLength;
+    gboolean        extendedLiField;
+    rlc_lte_nb_mode nbMode;
+} rlc_lte_info;
+
+
+typedef struct rlc_lte_tap_info {
+    /* Info from context */
+    guint8          rlcMode;
+    guint8          direction;
+    guint8          priority;
+    guint16         ueid;
+    guint16         channelType;
+    guint16         channelId;
+    guint16         pduLength;
+    guint8          sequenceNumberLength;
+
+    nstime_t        rlc_lte_time;
+    guint8          loggedInMACFrame;
+    guint16         sequenceNumber;
+    guint8          isResegmented;
+    guint8          isControlPDU;
+    guint16         ACKNo;
+    #define MAX_NACKs 128
+    guint16         noOfNACKs;
+    guint16         NACKs[MAX_NACKs];
+
+    guint16         missingSNs;
+} rlc_lte_tap_info;
+
+
+/* Signature.  Rather than try to define a port for this, or make the
+   port number a preference, frames will start with this string (with no
+   terminating NULL */
+#define RLC_LTE_START_STRING "rlc-lte"
+
+/* Fixed field.  This is followed by the following 1 mandatory field:
+   - rlcMode (1 byte)
+   (where the allowed values are defined above */
+
+/* Conditional field. This field is mandatory in case of RLC Unacknowledged mode.
+   In case of RLC Acknowledged mode, the field is optional (assume 10 bits by default).
+   The format is to have the tag, followed by the value (there is no length field,
+   it's implicit from the tag). The allowed values are defined above. */
+
+#define RLC_LTE_SN_LENGTH_TAG    0x02
+/* 1 byte */
+
+/* Optional fields. Attaching this info to frames will allow you
+   to show you display/filter/plot/add-custom-columns on these fields, so should
+   be added if available.
+   The format is to have the tag, followed by the value (there is no length field,
+   it's implicit from the tag) */
+
+#define RLC_LTE_DIRECTION_TAG       0x03
+/* 1 byte */
+
+#define RLC_LTE_PRIORITY_TAG        0x04
+/* 1 byte */
+
+#define RLC_LTE_UEID_TAG            0x05
+/* 2 bytes, network order */
+
+#define RLC_LTE_CHANNEL_TYPE_TAG    0x06
+/* 2 bytes, network order */
+
+#define RLC_LTE_CHANNEL_ID_TAG      0x07
+/* 2 bytes, network order */
+
+#define RLC_LTE_EXT_LI_FIELD_TAG    0x08
+/* 0 byte, tag presence indicates that AM DRB PDU is using an extended LI field of 15 bits */
+
+#define RLC_LTE_NB_MODE_TAG         0x09
+/* 1 byte containing rlc_lte_nb_mode enum value */
+
+/* RLC PDU. Following this tag comes the actual RLC PDU (there is no length, the PDU
+   continues until the end of the frame) */
+#define RLC_LTE_PAYLOAD_TAG         0x01
+
+#endif
+
+/*
+ * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/openair2/UTIL/OPT/packet-rlc-nr.h b/openair2/UTIL/OPT/packet-rlc-nr.h
new file mode 100644
index 0000000000000000000000000000000000000000..290eba189899149a929801ac95a79f1f1c159ab5
--- /dev/null
+++ b/openair2/UTIL/OPT/packet-rlc-nr.h
@@ -0,0 +1,136 @@
+/* packet-rlc-nr.h
+ *
+ * Pascal Quantin
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef PACKET_RLC_NR_H
+#define PACKET_RLC_NR_H
+
+/* rlcMode */
+#define RLC_TM_MODE 1
+#define RLC_UM_MODE 2
+#define RLC_AM_MODE 4
+
+/* direction */
+#define DIRECTION_UPLINK 0
+#define DIRECTION_DOWNLINK 1
+
+/* bearerType */
+#define BEARER_TYPE_CCCH 1
+#define BEARER_TYPE_BCCH_BCH 2
+#define BEARER_TYPE_PCCH 3
+#define BEARER_TYPE_SRB 4
+#define BEARER_TYPE_DRB 5
+#define BEARER_TYPE_BCCH_DL_SCH 6
+
+/* sequenceNumberLength */
+#define TM_SN_LENGTH_0_BITS  0
+#define UM_SN_LENGTH_6_BITS  6
+#define UM_SN_LENGTH_12_BITS 12
+#define AM_SN_LENGTH_12_BITS 12
+#define AM_SN_LENGTH_18_BITS 18
+
+/* Info attached to each NR RLC frame */
+typedef struct rlc_nr_info
+{
+    guint8          rlcMode;
+    guint8          direction;
+    guint8          sequenceNumberLength;
+    guint8          bearerType;
+    guint8          bearerId;
+    guint16         ueid;
+    guint16         pduLength;
+} rlc_nr_info;
+
+typedef struct nr_drb_rlc_pdcp_mapping_t
+{
+    gboolean   active;
+    guint16    ueid;                /* Mandatory */
+    guint8     drbid;               /* Mandatory */
+
+    gboolean   pdcpUlSnLength_present;
+    guint8     pdcpUlSnLength;        /* Part of PDCP config - optional */
+    gboolean   pdcpDlSnLength_present;
+    guint8     pdcpDlSnLength;        /* Part of PDCP config - optional */
+    gboolean   pdcpUlSdap;
+    gboolean   pdcpDlSdap;
+    gboolean   pdcpIntegrityProtection;
+    gboolean   pdcpCipheringDisabled;
+
+} nr_drb_rlc_pdcp_mapping_t;
+
+/* TODO: could probably merge this struct with above */
+typedef struct pdcp_ue_parameters {
+    guint32   id;
+    guint8    pdcp_sn_bits_ul;
+    guint8    pdcp_sn_bits_dl;
+    gboolean  pdcp_sdap_ul;
+    gboolean  pdcp_sdap_dl;
+    gboolean  pdcp_integrity;
+    gboolean  pdcp_ciphering_disabled;
+} pdcp_bearer_parameters;
+
+/*****************************************************************/
+/* UDP framing format                                            */
+/* -----------------------                                       */
+/* Several people have asked about dissecting RLC by framing     */
+/* PDUs over IP. A suggested format over UDP has been defined    */
+/* and implemented by this dissector, using the definitions      */
+/* below.                                                        */
+/*                                                               */
+/* A heuristic dissector (enabled by a preference) will          */
+/* recognise a signature at the beginning of these frames.       */
+/*****************************************************************/
+
+
+/* Signature.  Rather than try to define a port for this, or make the
+   port number a preference, frames will start with this string (with no
+   terminating NULL */
+#define RLC_NR_START_STRING "rlc-nr"
+
+/* Fixed field. This is followed by the following 2 mandatory field:
+   - rlcMode (1 byte)
+   - sequenceNumberLength (1 byte)
+   (where the allowed values are defined above) */
+
+/* Optional fields. Attaching this info to frames will allow you
+   to show you display/filter/plot/add-custom-columns on these fields, so should
+   be added if available.
+   The format is to have the tag, followed by the value (there is no length field,
+   it's implicit from the tag) */
+
+#define RLC_NR_DIRECTION_TAG       0x02
+/* 1 byte */
+
+#define RLC_NR_UEID_TAG            0x03
+/* 2 bytes, network order */
+
+#define RLC_NR_BEARER_TYPE_TAG     0x04
+/* 1 byte */
+
+#define RLC_NR_BEARER_ID_TAG       0x05
+/* 1 byte */
+
+/* RLC PDU. Following this tag comes the actual RLC PDU (there is no length, the PDU
+   continues until the end of the frame) */
+#define RLC_NR_PAYLOAD_TAG         0x01
+
+#endif
+
+/*
+ * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/openair2/UTIL/OPT/packet-rohc.h b/openair2/UTIL/OPT/packet-rohc.h
new file mode 100644
index 0000000000000000000000000000000000000000..c6c807f6872d139768f916bd3f166e45933705ce
--- /dev/null
+++ b/openair2/UTIL/OPT/packet-rohc.h
@@ -0,0 +1,72 @@
+/* packet-rohc.h
+ * Routines for RObust Header Compression (ROHC) dissection.
+ *
+ * Copyright 2011, Anders Broman <anders.broman[at]ericsson.com>
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
+ * Ref:
+ * http://www.ietf.org/rfc/rfc3095.txt         RObust Header Compression (ROHC): Framework and four profiles: RTP, UDP, ESP, and uncompressed
+ * http://datatracker.ietf.org/doc/rfc4815/    RObust Header Compression (ROHC): Corrections and Clarifications to RFC 3095
+ * http://datatracker.ietf.org/doc/rfc5225/    RObust Header Compression Version 2 (ROHCv2): Profiles for RTP, UDP, IP, ESP and UDP-Lite
+ */
+
+#ifndef PACKET_ROHC_H
+#define PACKET_ROHC_H
+
+#define MAX_CID      15
+
+ /* ROHC Profiles */
+#define ROHC_PROFILE_UNCOMPRESSED   0
+#define ROHC_PROFILE_RTP            1
+#define ROHC_PROFILE_UDP            2
+#define ROHC_PROFILE_IP             4
+#define ROHC_PROFILE_UNKNOWN        0xFFFF
+
+enum rohc_mode
+{
+  MODE_NOT_SET = 0,
+  UNIDIRECTIONAL = 1,
+  OPTIMISTIC_BIDIRECTIONAL = 2,
+  RELIABLE_BIDIRECTIONAL = 3
+};
+
+enum rohc_d_mode
+{
+  NO_CONTEXT = 1,
+  STATIC_CONTEXT = 2,
+  FULL_CONTEXT = 3
+};
+typedef struct rohc_info
+{
+    gboolean           rohc_compression;
+    guint8             rohc_ip_version;
+    gboolean           cid_inclusion_info;
+    gboolean           large_cid_present;
+    enum rohc_mode     mode;
+    gboolean           rnd;
+    gboolean           udp_checksum_present;
+    guint16            profile;
+    proto_item         *last_created_item;
+} rohc_info;
+
+
+typedef struct rohc_context
+{
+    guint8             rohc_ip_version[MAX_CID+1];
+    gboolean           large_cid_present[MAX_CID+1];
+    enum rohc_mode     mode[MAX_CID+1];
+    enum rohc_d_mode   d_mode[MAX_CID+1];
+    gboolean           rnd[MAX_CID+1];
+    gboolean           udp_checkum_present[MAX_CID+1];
+    guint16            profile[MAX_CID+1];
+	gboolean           rohc_context_init[MAX_CID+1];
+	gint               ir_frame_number[MAX_CID+1];        /* The frame number of the last IR packet seen */
+
+} rohc_context;
+
+#endif /* PACKET_ROHC_H */
diff --git a/openair2/UTIL/OPT/probe.c b/openair2/UTIL/OPT/probe.c
index 3f416c92553d97bfa1cc3a6a09d12255ed804e76..2966c4672cfb4e77ea2678400341e677aea7a36d 100644
--- a/openair2/UTIL/OPT/probe.c
+++ b/openair2/UTIL/OPT/probe.c
@@ -128,12 +128,6 @@ typedef struct {
 
 opt_listener_t opt_listener;
 
-static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
-                      guint16 rnti, guint16 ueid, guint16 sysframeNumber,
-                      guint8 isPredefinedData, guint8 retx, guint8 crcStatus,
-                      guint8 oob_event, guint8 oob_event_value,
-                      uint8_t *pdu_buffer, unsigned int pdu_buffer_size);
-
 unsigned short checksum(unsigned short *ptr, int length) {
   int sum = 0;
   u_short answer = 0;
@@ -152,7 +146,7 @@ unsigned short checksum(unsigned short *ptr, int length) {
 }
 
 /* Write an individual PDU (PCAP packet header + mac-context + mac-pdu) */
-static int MAC_LTE_PCAP_WritePDU(const uint8_t *PDU,
+static int PCAP_WritePDU(const uint8_t *PDU,
                                  unsigned int length) {
   pcaprec_hdr_t packet_header;
   // IPv4 header
@@ -288,7 +282,7 @@ int opt_create_listener_socket(char *ip_address, uint16_t port) {
  */
 /* Add framing header to MAC PDU and send. */
 static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
-                      guint16 rnti, guint16 ueid, guint16 sfnSf,
+                      guint16 rnti, guint16 ueid, guint16 frame, guint16 subframe,
                       guint8 isPredefinedData, guint8 retx, guint8 crcStatus,
                       guint8 oob_event, guint8 oob_event_value,
                       uint8_t *pdu_buffer, unsigned int pdu_buffer_size) {
@@ -317,9 +311,9 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
   tmp16 = htons(ueid);
   memcpy(frameBuffer+frameOffset, &tmp16, 2);
   frameOffset += 2;
-  /* Subframe number */
+  /* Subframe number */ 
   frameBuffer[frameOffset++] = MAC_LTE_FRAME_SUBFRAME_TAG;
-  tmp16 = htons(sfnSf); // frame counter : this will give an expert info as wireshark expects SF and not F
+  tmp16 = htons((frame<<4)+subframe); // frame counter : this will give an expert info as wireshark expects SF and not F
   memcpy(frameBuffer+frameOffset, &tmp16, 2);
   frameOffset += 2;
   frameBuffer[frameOffset++] = MAC_LTE_CRC_STATUS_TAG;
@@ -400,7 +394,72 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
     bytesSent = sendto(g_socksd, frameBuffer, frameOffset, 0,
                        (const struct sockaddr *)&g_serv_addr, sizeof(g_serv_addr));
   else
-    bytesSent = MAC_LTE_PCAP_WritePDU(frameBuffer, frameOffset);
+    bytesSent = PCAP_WritePDU(frameBuffer, frameOffset);
+
+  if (bytesSent != frameOffset) {
+    LOG_W(OPT, "trace_pdu expected %d bytes, got %ld (errno=%d)\n",
+          frameOffset, bytesSent, errno);
+    //exit(1);
+  }
+}
+
+static void SendFrameNR(guint8 radioType, guint8 direction, guint8 rntiType,
+			guint16 rnti, guint16 ueid,  guint16 frame, guint16 subframe,
+			guint8 isPredefinedData, guint8 retx, guint8 crcStatus,
+			guint8 oob_event, guint8 oob_event_value,
+			uint8_t *pdu_buffer, unsigned int pdu_buffer_size) {
+  unsigned char frameBuffer[9000];
+  unsigned int frameOffset;
+  ssize_t bytesSent;
+  frameOffset = 0;
+  uint16_t tmp16;
+  memcpy(frameBuffer+frameOffset, MAC_NR_START_STRING,
+         strlen(MAC_NR_START_STRING));
+  frameOffset += strlen(MAC_NR_START_STRING);
+  /******************************************************************************/
+  /* Now write out fixed fields (the mandatory elements of struct mac_lte_info) */
+  frameBuffer[frameOffset++] = radioType;
+  frameBuffer[frameOffset++] = direction;
+  frameBuffer[frameOffset++] = rntiType;
+  /*************************************/
+  /* Now optional fields               */
+  /* RNTI */
+  frameBuffer[frameOffset++] = MAC_NR_RNTI_TAG;
+  tmp16 = htons(rnti);
+  memcpy(frameBuffer+frameOffset, &tmp16, 2);
+  frameOffset += 2;
+  /* UEId */
+  frameBuffer[frameOffset++] = MAC_NR_UEID_TAG;
+  tmp16 = htons(ueid);
+  memcpy(frameBuffer+frameOffset, &tmp16, 2);
+  frameOffset += 2;
+  /* Subframe number */
+  frameBuffer[frameOffset++] = MAC_NR_FRAME_SLOT_TAG;
+  tmp16 = htons(frame); // frame counter : this will give an expert info as wireshark expects SF and not F
+  memcpy(frameBuffer+frameOffset, &tmp16, 2);
+  frameOffset += 2;
+  tmp16 = htons(subframe); // frame counter : this will give an expert info as wireshark expects SF and not F
+  memcpy(frameBuffer+frameOffset, &tmp16, 2);
+  frameOffset += 2;
+  
+  /***************************************/
+  /* Now write the MAC PDU               */
+  frameBuffer[frameOffset++] = MAC_NR_PAYLOAD_TAG;
+
+  /* Append actual PDU  */
+  //memcpy(frameBuffer+frameOffset, g_PDUBuffer, g_PDUOffset);
+  //frameOffset += g_PDUOffset;
+  if (pdu_buffer != NULL) {
+    memcpy(frameBuffer+frameOffset, (void *)pdu_buffer, pdu_buffer_size);
+    frameOffset += pdu_buffer_size;
+  }
+
+  if ( opt_type ==  OPT_WIRESHARK )
+    /* Send out the data over the UDP socket */
+    bytesSent = sendto(g_socksd, frameBuffer, frameOffset, 0,
+                       (const struct sockaddr *)&g_serv_addr, sizeof(g_serv_addr));
+  else
+    bytesSent = PCAP_WritePDU(frameBuffer, frameOffset);
 
   if (bytesSent != frameOffset) {
     LOG_W(OPT, "trace_pdu expected %d bytes, got %ld (errno=%d)\n",
@@ -413,20 +472,23 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
 extern RAN_CONTEXT_t RC;
 #include <openair1/PHY/phy_extern_ue.h>
 /* Remote serveraddress (where Wireshark is running) */
-void trace_pdu_implementation(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
+void trace_pdu_implementation(int nr, int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
                               int ueid, int rntiType, int rnti, uint16_t sysFrameNumber, uint8_t subFrameNumber, int oob_event,
                               int oob_event_value) {
   int radioType=FDD_RADIO;
   LOG_D(OPT,"sending packet to wireshark: direction=%s, size: %d, ueid: %d, rnti: %x, frame/sf: %d.%d\n",
         direction?"DL":"UL", pdu_buffer_size, ueid, rnti, sysFrameNumber,subFrameNumber);
 
-  if (RC.eNB && RC.eNB[0][0]!=NULL)
-    radioType=RC.eNB[0][0]->frame_parms.frame_type== FDD ? FDD_RADIO:TDD_RADIO;
-  else if (PHY_vars_UE_g && PHY_vars_UE_g[0][0] != NULL)
-    radioType=PHY_vars_UE_g[0][0]->frame_parms.frame_type== FDD ? FDD_RADIO:TDD_RADIO;
-  else {
-    LOG_E(OPT,"not a eNB neither a UE!!! \n");
-    return;
+  if (nr) {
+    radioType=TDD_RADIO;
+  } else {
+    if (RC.eNB && RC.eNB[0][0]!=NULL) 
+      radioType=RC.eNB[0][0]->frame_parms.frame_type== FDD ? FDD_RADIO:TDD_RADIO;
+    else if (PHY_vars_UE_g && PHY_vars_UE_g[0][0] != NULL)
+      radioType=PHY_vars_UE_g[0][0]->frame_parms.frame_type== FDD ? FDD_RADIO:TDD_RADIO;
+    else {
+      LOG_E(OPT,"not a 4G eNB neither a 4G UE!!! \n");
+    }
   }
 
   switch (opt_type) {
@@ -448,9 +510,17 @@ void trace_pdu_implementation(int direction, uint8_t *pdu_buffer, unsigned int p
       break;
   }
 
+  if (nr)
+  SendFrameNR( radioType,
+             (direction == DIRECTION_DOWNLINK) ? DIRECTION_DOWNLINK : DIRECTION_UPLINK,
+	       rntiType, rnti, ueid, sysFrameNumber, subFrameNumber,
+             1, 0, 1,  //guint8 isPredefinedData, guint8 retx, guint8 crcStatus
+             oob_event,oob_event_value,
+             pdu_buffer, pdu_buffer_size);
+  else 
   SendFrame( radioType,
              (direction == DIRECTION_DOWNLINK) ? DIRECTION_DOWNLINK : DIRECTION_UPLINK,
-             rntiType, rnti, ueid, (sysFrameNumber<<4) + subFrameNumber,
+             rntiType, rnti, ueid, sysFrameNumber, subFrameNumber,
              1, 0, 1,  //guint8 isPredefinedData, guint8 retx, guint8 crcStatus
              oob_event,oob_event_value,
              pdu_buffer, pdu_buffer_size);
diff --git a/openair3/NGAP/ngap_common.h b/openair3/NGAP/ngap_common.h
index 6803adb0dda43fface7944d7d9ac93dd106df38f..283dd2bffa58ae41aca733b9a955053f04bb0bf1 100644
--- a/openair3/NGAP/ngap_common.h
+++ b/openair3/NGAP/ngap_common.h
@@ -142,7 +142,11 @@ extern int asn1_xer_print;
       } \
     } \
     if (ie == NULL ) { \
-      NGAP_ERROR("NGAP_FIND_PROTOCOLIE_BY_ID: %s %d: ie is NULL\n",__FILE__,__LINE__);\
+      if (mandatory) {\
+      NGAP_ERROR("NGAP_FIND_PROTOCOLIE_BY_ID: %s %d: ie is NULL (searching for ie: %ld)\n",__FILE__,__LINE__, IE_ID);\
+      abort();\
+      }\
+      else NGAP_INFO("NGAP_FIND_PROTOCOLIE_BY_ID: %s %d: ie is NULL (searching for ie: %ld)\n",__FILE__,__LINE__, IE_ID);\
     } \
   } while(0)
 /** \brief Function callback prototype.
diff --git a/openair3/NGAP/ngap_gNB_handlers.c b/openair3/NGAP/ngap_gNB_handlers.c
index 38b6bcac3e8cad3a0ffd1da0bcff5ccebcc5ad1b..401695473cfc044c16baa9912e977b16711f2a56 100644
--- a/openair3/NGAP/ngap_gNB_handlers.c
+++ b/openair3/NGAP/ngap_gNB_handlers.c
@@ -657,6 +657,7 @@ int ngap_gNB_handle_error_indication(uint32_t         assoc_id,
           case NGAP_CauseRadioNetwork_up_integrity_protection_not_possible:
             NGAP_WARN("Received NG Error indication NGAP_CauseRadioNetwork_up_integrity_protection_not_possible\n");
             break;
+
           case NGAP_CauseRadioNetwork_up_confidentiality_protection_not_possible:
             NGAP_WARN("Received NG Error indication NGAP_CauseRadioNetwork_up_confidentiality_protection_not_possible\n");
             break;
@@ -1069,13 +1070,14 @@ int ngap_gNB_handle_initial_context_request(uint32_t   assoc_id,
   
   //if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
     NGAP_AllowedNSSAI_Item_t *allow_nssai_item_p = NULL;
-  
-    NGAP_WARN("AllowedNSSAI.list.count %d\n", ie != NULL ? ie->value.choice.AllowedNSSAI.list.count : 2);
+
     //NGAP_DEBUG("AllowedNSSAI.list.count %d\n", ie->value.choice.AllowedNSSAI.list.count);
     //DevAssert(ie->value.choice.AllowedNSSAI.list.count > 0);
     //DevAssert(ie->value.choice.AllowedNSSAI.list.count <= NGAP_maxnoofAllowedS_NSSAIs);
 
     if (ie == NULL) {
+        NGAP_WARN("AllowedNSSAI not present, forging 2 NSSAI\n");
+
     	NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).nb_allowed_nssais = 2;
 
     	NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[0].sST = 01;
@@ -1092,7 +1094,7 @@ int ngap_gNB_handle_initial_context_request(uint32_t   assoc_id,
     	NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[1].sD[1] = 00;//22;
     	NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[1].sD[2] = 01;//33;
     } else {
-
+    NGAP_INFO("AllowedNSSAI.list.count %d\n", ie->value.choice.AllowedNSSAI.list.count);
     NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).nb_allowed_nssais = ie->value.choice.AllowedNSSAI.list.count;
     
     for(i = 0; i < ie->value.choice.AllowedNSSAI.list.count; i++) {
diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
index c830aeb18e358a0afb9881f18b03fa8720493e2a..351813e7c9c3b7a7de808d153f447a5969217ccc 100644
--- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
+++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
@@ -581,7 +581,6 @@ void *trx_usrp_write_thread(void * arg){
     VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_USRP_SEND_RETURN, ret );
     VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_THREAD, 0 );
 
-    if(0) break;
   }
 
   return NULL;
diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf
new file mode 100644
index 0000000000000000000000000000000000000000..9402e354fe8741bdbd02b303b77bb9a465fbf8a9
--- /dev/null
+++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf
@@ -0,0 +1,326 @@
+Active_gNBs = ( "gNB-Eurecom-5GNRBox");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+gNBs =
+(
+ {
+    ////////// Identification parameters:
+    gNB_ID    =  0xe00;
+
+    cell_type =  "CELL_MACRO_GNB";
+    gNB_name  =  "gNB-Eurecom-5GNRBox";
+
+    // Tracking area code, 0x0000 and 0xfffe are reserved values
+    tracking_area_code  =  1;
+    plmn_list = ({
+                  mcc = 450;
+                  mnc = 05;
+                  mnc_length = 2;
+                  snssaiList = (	
+                    {	     
+                      sst = 1;
+                      sd  = 0xd143a5; // 0 false, else true
+                    }
+                  );
+
+                  });
+ 
+    tr_s_preference     = "local_mac"
+
+    ////////// Physical parameters:
+
+    ssb_SubcarrierOffset                                      = 0;
+    pdsch_AntennaPorts                                        = 1;
+    pusch_AntennaPorts                                        = 1;
+
+     pdcch_ConfigSIB1 = (
+      {
+        controlResourceSetZero = 12;
+        searchSpaceZero = 0;
+      }
+      );
+
+    servingCellConfigCommon = (
+    {
+ #spCellConfigCommon
+
+      physCellId                                                    = 0;
+
+#  downlinkConfigCommon
+    #frequencyInfoDL
+      # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP)
+      absoluteFrequencySSB                                             = 641280;
+      dl_frequencyBand                                                 = 78;
+      # this is 3600 MHz
+      dl_absoluteFrequencyPointA                                       = 640008;
+      #scs-SpecificCarrierList
+        dl_offstToCarrier                                              = 0;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+        dl_subcarrierSpacing                                           = 1;
+        dl_carrierBandwidth                                            = 106;
+     #initialDownlinkBWP
+      #genericParameters
+        # this is RBstart=27,L=48 (275*(L-1))+RBstart
+        initialDLBWPlocationAndBandwidth                               = 12952; # 6366 12925 12956 28875 12952
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+        initialDLBWPsubcarrierSpacing                                   = 1;
+      #pdcch-ConfigCommon
+        initialDLBWPcontrolResourceSetZero                              = 12;
+        initialDLBWPsearchSpaceZero                                     = 0;
+      #pdsch-ConfigCommon
+        #pdschTimeDomainAllocationList (up to 16 entries)
+             initialDLBWPk0_0                    = 0;
+             #initialULBWPmappingType
+	         #0=typeA,1=typeB
+             initialDLBWPmappingType_0           = 0;
+             #this is SS=1,L=13
+             initialDLBWPstartSymbolAndLength_0  = 40;
+
+             initialDLBWPk0_1                    = 0;
+             initialDLBWPmappingType_1           = 0;
+             #this is SS=2,L=12
+             initialDLBWPstartSymbolAndLength_1  = 53;
+
+             initialDLBWPk0_2                    = 0;
+             initialDLBWPmappingType_2           = 0;
+             #this is SS=1,L=12
+             initialDLBWPstartSymbolAndLength_2  = 54;
+
+             initialDLBWPk0_3                    = 0;
+             initialDLBWPmappingType_3           = 0;
+             #this is SS=1,L=5
+             initialDLBWPstartSymbolAndLength_3  = 57;
+
+  #uplinkConfigCommon
+     #frequencyInfoUL
+      ul_frequencyBand                                              = 78;
+      #scs-SpecificCarrierList
+      ul_offstToCarrier                                             = 0;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+      ul_subcarrierSpacing                                          = 1;
+      ul_carrierBandwidth                                           = 106;
+      pMax                                                          = 20;
+     #initialUplinkBWP
+      #genericParameters
+        initialULBWPlocationAndBandwidth                            = 12952;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+        initialULBWPsubcarrierSpacing                               = 1;
+      #rach-ConfigCommon
+        #rach-ConfigGeneric
+          prach_ConfigurationIndex                                  = 98;
+#prach_msg1_FDM
+#0 = one, 1=two, 2=four, 3=eight
+          prach_msg1_FDM                                            = 0;
+          prach_msg1_FrequencyStart                                 = 0;
+          zeroCorrelationZoneConfig                                 = 13;
+          preambleReceivedTargetPower                               = -96;
+#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200)
+          preambleTransMax                                          = 6;
+#powerRampingStep
+# 0=dB0,1=dB2,2=dB4,3=dB6
+        powerRampingStep                                            = 1;
+#ra_ReponseWindow
+#1,2,4,8,10,20,40,80
+        ra_ResponseWindow                                           = 4;
+#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR
+#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen
+        ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR                = 4;
+#oneHalf (0..15) 4,8,12,16,...60,64
+        ssb_perRACH_OccasionAndCB_PreamblesPerSSB                   = 14;
+#ra_ContentionResolutionTimer
+#(0..7) 8,16,24,32,40,48,56,64
+        ra_ContentionResolutionTimer                                = 7;
+        rsrp_ThresholdSSB                                           = 19;
+#prach-RootSequenceIndex_PR
+#1 = 839, 2 = 139
+        prach_RootSequenceIndex_PR                                  = 2;
+        prach_RootSequenceIndex                                     = 1;
+        # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex
+        #
+        msg1_SubcarrierSpacing                                      = 1,
+# restrictedSetConfig
+# 0=unrestricted, 1=restricted type A, 2=restricted type B
+        restrictedSetConfig                                         = 0,
+
+      # pusch-ConfigCommon (up to 16 elements)
+        initialULBWPk2_0                      = 6;
+        initialULBWPmappingType_0             = 1
+        # this is SS=0 L=11
+        initialULBWPstartSymbolAndLength_0    = 55;
+
+        initialULBWPk2_1                      = 6;
+        initialULBWPmappingType_1             = 1;
+        # this is SS=0 L=12
+        initialULBWPstartSymbolAndLength_1    = 69;
+
+        initialULBWPk2_2                      = 7;
+        initialULBWPmappingType_2             = 1;
+        # this is SS=10 L=4
+        initialULBWPstartSymbolAndLength_2    = 52;
+
+        msg3_DeltaPreamble                                          = 1;
+        p0_NominalWithGrant                                         =-90;
+
+# pucch-ConfigCommon setup :
+# pucchGroupHopping
+# 0 = neither, 1= group hopping, 2=sequence hopping
+        pucchGroupHopping                                           = 0;
+        hoppingId                                                   = 40;
+        p0_nominal                                                  = -90;
+# ssb_PositionsInBurs_BitmapPR
+# 1=short, 2=medium, 3=long
+      ssb_PositionsInBurst_PR                                       = 2;
+      ssb_PositionsInBurst_Bitmap                                   = 1;
+
+# ssb_periodicityServingCell
+# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1
+      ssb_periodicityServingCell                                    = 2;
+
+# dmrs_TypeA_position
+# 0 = pos2, 1 = pos3
+      dmrs_TypeA_Position                                           = 0;
+
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+      subcarrierSpacing                                             = 1;
+
+
+  #tdd-UL-DL-ConfigurationCommon
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+      referenceSubcarrierSpacing                                    = 1;
+      # pattern1
+      # dl_UL_TransmissionPeriodicity
+      # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10
+      dl_UL_TransmissionPeriodicity                                 = 6;
+      nrofDownlinkSlots                                             = 7;
+      nrofDownlinkSymbols                                           = 6;
+      nrofUplinkSlots                                               = 2;
+      nrofUplinkSymbols                                             = 4;
+
+      ssPBCH_BlockPower                                             = -25;
+  }
+
+  );
+
+
+    # ------- SCTP definitions
+    SCTP :
+    {
+        # Number of streams to use in input/output
+        SCTP_INSTREAMS  = 2;
+        SCTP_OUTSTREAMS = 2;
+    };
+
+
+    ////////// MME parameters:
+    amf_ip_address      = ( { ipv4       = "192.168.5.233";
+                              ipv6       = "192:168:30::17";
+                              active     = "yes";
+                              preference = "ipv4";
+                            }
+                          );
+
+    ///X2
+    enable_x2 = "no";
+    t_reloc_prep      = 1000;      /* unit: millisecond */
+    tx2_reloc_overall = 2000;      /* unit: millisecond */
+    t_dc_prep         = 1000;      /* unit: millisecond */
+    t_dc_overall      = 2000;      /* unit: millisecond */
+    target_enb_x2_ip_address      = (
+                                     { ipv4       = "CI_FR1_CTL_ENB_IP_ADDR";
+                                       ipv6       = "192:168:30::17";
+                                       preference = "ipv4";
+                                     }
+                                    );
+
+    NETWORK_INTERFACES :
+    {
+        GNB_INTERFACE_NAME_FOR_NG_AMF            = "eth0";
+        GNB_IPV4_ADDRESS_FOR_NG_AMF              = "192.168.5.200/24";
+        GNB_INTERFACE_NAME_FOR_NGU               = "eth0";
+        GNB_IPV4_ADDRESS_FOR_NGU                 = "192.168.5.200/24";
+        GNB_PORT_FOR_S1U                         = 2152; # Spec 2152
+        GNB_IPV4_ADDRESS_FOR_X2C                 = "192.168.5.200/24";
+        GNB_PORT_FOR_X2C                         = 36422; # Spec 36422
+    };
+
+  }
+);
+
+MACRLCs = (
+	{
+	num_cc = 1;
+	tr_s_preference = "local_L1";
+	tr_n_preference = "local_RRC";
+        }
+);
+
+L1s = (
+    {
+	num_cc = 1;
+	tr_n_preference = "local_mac";
+	pusch_proc_threads = 8;
+    }
+);
+
+RUs = (
+    {
+       local_rf       = "yes"
+         nb_tx          = 1
+         nb_rx          = 1
+         att_tx         = 0
+         att_rx         = 0;
+         bands          = [7];
+         max_pdschReferenceSignalPower = -27;
+         max_rxgain                    = 114;
+         eNB_instances  = [0];
+         #beamforming 1x4 matrix:
+         bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000];
+         clock_src = "internal";
+    }
+);
+
+THREAD_STRUCT = (
+  {
+    #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
+    parallel_config    = "PARALLEL_SINGLE_THREAD";
+    #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
+    worker_config      = "WORKER_ENABLE";
+  }
+);
+
+rfsimulator :
+{
+    serveraddr = "server";
+    serverport = "4043";
+    options = (); #("saviq"); or/and "chanmod"
+    modelname = "AWGN";
+    IQfile = "/tmp/rfsimulator.iqs";
+};
+
+     log_config :
+     {
+       global_log_level                      ="info";
+       global_log_verbosity                  ="medium";
+       hw_log_level                          ="info";
+       hw_log_verbosity                      ="medium";
+       phy_log_level                         ="info";
+       phy_log_verbosity                     ="medium";
+       mac_log_level                         ="info";
+       mac_log_verbosity                     ="high";
+       rlc_log_level                         ="info";
+       rlc_log_verbosity                     ="medium";
+       pdcp_log_level                        ="info";
+       pdcp_log_verbosity                    ="medium";
+       rrc_log_level                         ="info";
+       rrc_log_verbosity                     ="medium";
+       ngap_log_level                         ="debug";
+       ngap_log_verbosity                     ="medium";
+    };
+