From 0c287d9f516b8be8beb339bc16dfede25774cf5f Mon Sep 17 00:00:00 2001
From: matzakos <panagiotis.matzakos@eurecom.fr>
Date: Tue, 19 May 2020 15:23:12 +0200
Subject: [PATCH] Adaptation at DLSCH scheduling function to support EPC mode

---
 openair2/LAYER2/NR_MAC_COMMON/nr_mac.h             |  4 ++--
 openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c         |  2 +-
 openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 10 ++++------
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h
index 99035446123..e1c8e6fac0f 100644
--- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h
+++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h
@@ -262,8 +262,8 @@ typedef struct {
 #define UL_SCH_LCID_CCCH                           0x00
 #define UL_SCH_LCID_SRB1                           0x01
 #define UL_SCH_LCID_SRB2                           0x02
-#define UL_SCH_LCID_SRB3                           0x03
-#define UL_SCH_LCID_DTCH                           0x04
+#define UL_SCH_LCID_DTCH                           0x03
+#define UL_SCH_LCID_SRB3                           0x04
 #define UL_SCH_LCID_CCCH_MSG3                      0x21
 #define UL_SCH_LCID_RECOMMENDED_BITRATE_QUERY      0x35
 #define UL_SCH_LCID_MULTI_ENTRY_PHR_4_OCT          0x36
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
index 4751fb1237c..3cf9c486b1f 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
@@ -482,7 +482,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
 
   } //is_nr_DL_slot
 
-  if (is_nr_UL_slot(cc->ServingCellConfigCommon,slot_rxP)) { 
+  if (is_nr_UL_slot(cc->ServingCellConfigCommon,slot_rxP)) {
 
     if (get_softmodem_params()->phy_test == 0) {
       schedule_nr_prach(module_idP, (frame_rxP+1)&1023, slot_rxP);
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c
index 9255d633f85..8b4275b7635 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c
@@ -539,8 +539,6 @@ void nr_schedule_uss_dlsch_phytest(module_id_t   module_idP,
                                    NR_sched_pucch *pucch_sched,
                                    nfapi_nr_dl_tti_pdsch_pdu_rel15_t *dlsch_config){
 
-  LOG_I(MAC, "In nr_schedule_uss_dlsch_phytest frame %d slot %d\n",frameP,slotP);
-
   int post_padding = 0, ta_len = 0, header_length_total = 0, sdu_length_total = 0, num_sdus = 0;
   int lcid, offset, i, header_length_last, TBS_bytes;
   int UE_id = 0, CC_id = 0;
@@ -577,9 +575,9 @@ void nr_schedule_uss_dlsch_phytest(module_id_t   module_idP,
   if (TBS_bytes == 0)
    return;
  
-  //The --NOS1 use case currently schedules DLSCH transmissions only when there is IP traffic arriving
-  //through the LTE stack
-  if (IS_SOFTMODEM_NOS1){
+  //Corresponding to noS1 and EPC_MODE_ENABLED use cases where DLSCH transmissions are scheduled only when there is IP traffic
+  //at the upper layers
+  if (IS_SOFTMODEM_NOS1 || get_softmodem_params()->phy_test == 0){
 
     for (lcid = NB_RB_MAX - 1; lcid >= DTCH; lcid--) {
 
@@ -635,7 +633,7 @@ void nr_schedule_uss_dlsch_phytest(module_id_t   module_idP,
       }
     }
 
-  } //if (IS_SOFTMODEM_NOS1)
+  } //if (IS_SOFTMODEM_NOS1 || get_softmodem_params()->phy_test)
   else {
 
     //When the --NOS1 option is not enabled, DLSCH transmissions with random data
-- 
GitLab