From dd63e5239cdbbe1a611985ed3cd12060fd5b9bde Mon Sep 17 00:00:00 2001
From: Raymond Knopp <raymond.knopp@eurecom.fr>
Date: Fri, 8 Feb 2019 15:14:39 +0100
Subject: [PATCH] minor change for CI with L2 emulator (NFAPI)

---
 openair1/SCHED/fapi_l1.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/openair1/SCHED/fapi_l1.c b/openair1/SCHED/fapi_l1.c
index 0140e63746e..a057b243b98 100644
--- a/openair1/SCHED/fapi_l1.c
+++ b/openair1/SCHED/fapi_l1.c
@@ -55,6 +55,8 @@ void handle_nfapi_dci_dl_pdu(PHY_VARS_eNB *eNB,
   LTE_eNB_PDCCH *pdcch_vars       = &eNB->pdcch_vars[idx];
   nfapi_dl_config_dci_dl_pdu *pdu = &dl_config_pdu->dci_dl_pdu;
 
+  if (nfapi_mode==2) return;
+
   LOG_D(PHY,"Frame %d, Subframe %d: DCI processing - populating pdcch_vars->dci_alloc[%d] proc:subframe_tx:%d idx:%d pdcch_vars->num_dci:%d\n",frame,subframe, pdcch_vars->num_dci, proc->subframe_tx, idx, pdcch_vars->num_dci);
 
   // copy dci configuration into eNB structure
@@ -73,6 +75,8 @@ void handle_nfapi_mpdcch_pdu(PHY_VARS_eNB *eNB,
   LTE_eNB_MPDCCH *mpdcch_vars     = &eNB->mpdcch_vars[idx];
   nfapi_dl_config_mpdcch_pdu *pdu = &dl_config_pdu->mpdcch_pdu;
 
+  if (nfapi_mode==2) return;
+
   LOG_D(PHY,"Frame %d, Subframe %d: MDCI processing\n",proc->frame_tx,proc->subframe_tx);
 
   // copy dci configuration into eNB structure
@@ -87,6 +91,8 @@ void handle_nfapi_hi_dci0_dci_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rx
   int idx                         = subframe&1;
   LTE_eNB_PDCCH *pdcch_vars       = &eNB->pdcch_vars[idx];
 
+  if (nfapi_mode==2) return;
+
   //LOG_D(PHY,"%s() SFN/SF:%04d%d Before num_dci:%d\n", __FUNCTION__,frame,subframe,pdcch_vars->num_dci);
 
   // copy dci configuration in to eNB structure
@@ -100,6 +106,8 @@ void handle_nfapi_hi_dci0_mpdcch_dci_pdu(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,
 {
   int idx                         = proc->subframe_tx&1;
   LTE_eNB_MPDCCH *pdcch_vars      = &eNB->mpdcch_vars[idx];
+  if (nfapi_mode==2) return;
+
   // copy dci configuration in to eNB structure
   fill_mpdcch_dci0(eNB,proc,&pdcch_vars->mdci_alloc[pdcch_vars->num_dci], &hi_dci0_config_pdu->mpdcch_dci_pdu);
 }
@@ -110,6 +118,8 @@ void handle_nfapi_hi_dci0_hi_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxt
 {
   LTE_eNB_PHICH *phich = &eNB->phich_vars[subframe&1];
 
+  if (nfapi_mode==2) return;
+
   // copy dci configuration in to eNB structure
   LOG_D(PHY,"Received HI PDU with value %d (rbstart %d,cshift %d)\n",
         hi_dci0_config_pdu->hi_pdu.hi_pdu_rel8.hi_value,
@@ -130,6 +140,8 @@ void handle_nfapi_bch_pdu(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,
 {
   nfapi_dl_config_bch_pdu_rel8_t *rel8 = &dl_config_pdu->bch_pdu.bch_pdu_rel8;
 
+  if (nfapi_mode==2) return;
+
   AssertFatal(rel8->length == 3, "BCH PDU has length %d != 3\n",rel8->length);
 
   //LOG_D(PHY,"bch_pdu: %x,%x,%x\n",sdu[0],sdu[1],sdu[2]);
@@ -168,6 +180,8 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_pro
   int UE_id;
   int harq_pid;
 
+  if (nfapi_mode==2) return;
+
   UE_id = find_dlsch(rel8->rnti,eNB,SEARCH_EXIST_OR_FREE);
   if( (UE_id<0) || (UE_id>=NUMBER_OF_UE_MAX) ){
     LOG_E(PHY,"illegal UE_id found!!! rnti %04x UE_id %d\n",rel8->rnti,UE_id);
@@ -420,6 +434,8 @@ void handle_ulsch_harq_pdu(
   LTE_eNB_ULSCH_t *ulsch=eNB->ulsch[UE_id];
   LTE_UL_eNB_HARQ_t *ulsch_harq;
 
+  if (nfapi_mode==2) return;
+
   int harq_pid = rel8->harq_process_number;
   ulsch_harq = ulsch->harq_processes[harq_pid];
   ulsch_harq->frame                      = frame;
@@ -443,6 +459,8 @@ void handle_ulsch_cqi_ri_pdu(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_request
   int harq_pid = ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.harq_process_number;
   LTE_UL_eNB_HARQ_t *ulsch_harq = ulsch->harq_processes[harq_pid];
 
+  if (nfapi_mode==2) return;
+
   ulsch_harq->frame                       = frame;
   ulsch_harq->subframe                    = subframe;
   ulsch_harq->O_RI                        = rel9->aperiodic_cqi_pmi_ri_report.cc[0].ri_size;
@@ -464,6 +482,8 @@ void handle_ulsch_cqi_harq_ri_pdu(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_re
   LTE_UL_eNB_HARQ_t *ulsch_harq = ulsch->harq_processes[harq_pid];
   nfapi_ul_config_ulsch_harq_information *harq_information = &ul_config_pdu->ulsch_cqi_harq_ri_pdu.harq_information;
 
+  if (nfapi_mode==2) return;
+
   ulsch_harq->frame                       = frame;
   ulsch_harq->subframe                    = subframe;
   ulsch_harq->O_RI                        = rel9->aperiodic_cqi_pmi_ri_report.cc[0].ri_size;
@@ -479,6 +499,9 @@ void handle_ulsch_cqi_harq_ri_pdu(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_re
 
 void handle_uci_harq_information(PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci,nfapi_ul_config_harq_information *harq_information)
 {
+
+  if (nfapi_mode==2) return;
+
   if (eNB->frame_parms.frame_type == FDD) {
     uci->num_pucch_resources = harq_information->harq_information_rel9_fdd.number_of_pucch_resources;
 
@@ -577,6 +600,8 @@ void handle_uci_sr_pdu(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_request_pdu_t
 {
   LTE_eNB_UCI *uci = &eNB->uci_vars[UE_id];
 
+  if (nfapi_mode==2) return;
+
   uci->frame               = frame;
   uci->subframe            = subframe;
   uci->rnti                = ul_config_pdu->uci_sr_pdu.ue_information.ue_information_rel8.rnti;
@@ -600,6 +625,8 @@ void handle_uci_sr_harq_pdu(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_request_
 {
   LTE_eNB_UCI *uci = &eNB->uci_vars[UE_id];
 
+  if (nfapi_mode==2) return;
+
   uci->frame               = frame;
   uci->subframe            = subframe;
   uci->rnti                = ul_config_pdu->uci_sr_harq_pdu.ue_information.ue_information_rel8.rnti;
@@ -621,6 +648,8 @@ void handle_uci_harq_pdu(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_request_pdu
 {
   LTE_eNB_UCI *uci = &eNB->uci_vars[UE_id];
 
+  if (nfapi_mode==2) return;
+
   LOG_D(PHY,"Frame %d, Subframe %d: Programming UCI_HARQ process (type %d)\n",frame,subframe,HARQ);
   uci->frame             = frame;
   uci->subframe          = subframe;
@@ -642,6 +671,8 @@ void handle_srs_pdu(PHY_VARS_eNB *eNB,nfapi_ul_config_request_pdu_t *ul_config_p
 {
   int i;
 
+  if (nfapi_mode==2) return;
+
   for (i=0;i<NUMBER_OF_UE_MAX;i++) {
 
     if (eNB->soundingrs_ul_config_dedicated[i].active==1) continue;
@@ -668,6 +699,8 @@ void handle_nfapi_ul_pdu(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,
   nfapi_ul_config_ulsch_pdu_rel8_t *rel8 = &ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8;
   int16_t UE_id;
 
+  if (nfapi_mode==2) return;
+
   // check if we have received a dci for this ue and ulsch descriptor is configured
 
   if (ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_ULSCH_PDU_TYPE) {
-- 
GitLab