From ad859ddf5ec17f2c664503a080473ae607ca2caa Mon Sep 17 00:00:00 2001
From: Xu Bo <xubo1@cn.fujitsu.com>
Date: Thu, 16 Nov 2017 12:11:21 +0900
Subject: [PATCH] modify for ue expansion

---
 openair1/PHY/impl_defs_lte.h          | 3 ++-
 openair2/COMMON/rrc_messages_types.h  | 2 ++
 openair2/LAYER2/MAC/pre_processor.c   | 8 ++++----
 openair2/RRC/LITE/MESSAGES/asn1_msg.c | 2 +-
 4 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/openair1/PHY/impl_defs_lte.h b/openair1/PHY/impl_defs_lte.h
index d61c4c774d..c3a8a84169 100644
--- a/openair1/PHY/impl_defs_lte.h
+++ b/openair1/PHY/impl_defs_lte.h
@@ -635,8 +635,9 @@ typedef struct {
   uint16_t phich_reg[MAX_NUM_PHICH_GROUPS][3];
 
   struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[MAX_MBSFN_AREA];
-
+#ifdef UE_EXPANSION
   uint32_t ue_multiple_max;
+#endif
 } LTE_DL_FRAME_PARMS;
 
 typedef enum {
diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h
index eb1bb67849..20e638bf2a 100644
--- a/openair2/COMMON/rrc_messages_types.h
+++ b/openair2/COMMON/rrc_messages_types.h
@@ -166,7 +166,9 @@ typedef struct RrcConfigurationReq_s {
   long                    ue_TimersAndConstants_n310[MAX_NUM_CCs];
   long                    ue_TimersAndConstants_n311[MAX_NUM_CCs];
   long                    ue_TransmissionMode[MAX_NUM_CCs];
+#ifdef UE_EXPANSION
   long                    ue_multiple_max[MAX_NUM_CCs];
+#endif
 } RrcConfigurationReq;
 
 // UE: NAS -> RRC messages
diff --git a/openair2/LAYER2/MAC/pre_processor.c b/openair2/LAYER2/MAC/pre_processor.c
index fecf8b111c..622d961816 100644
--- a/openair2/LAYER2/MAC/pre_processor.c
+++ b/openair2/LAYER2/MAC/pre_processor.c
@@ -2029,7 +2029,7 @@ void ulsch_scheduler_pre_ue_select(
   UE_list_t *UE_list= &eNB->UE_list;
 
 
-  uint8_t                        aggregation = 4;
+  uint8_t                        aggregation = 2;
   int                            format_flag;
   nfapi_hi_dci0_request_body_t   *HI_DCI0_req;
   nfapi_hi_dci0_request_pdu_t    *hi_dci0_pdu;
@@ -2137,7 +2137,7 @@ void ulsch_scheduler_pre_ue_select(
 
       hi_dci0_pdu   = &HI_DCI0_req->hi_dci0_pdu_list[HI_DCI0_req->number_of_dci+HI_DCI0_req->number_of_hi];
       format_flag = 2;
-      rnti = UE_RNTI(module_idP,UE_id);
+      rnti = UE_RNTI(module_idP,first_ue_id[CC_id][temp]);
       if (CCE_allocation_infeasible(module_idP,CC_id,format_flag,subframeP,aggregation,rnti) == 1) {
     	  cc_id_flag[CC_id] = 1;
           break;
@@ -2220,7 +2220,7 @@ void ulsch_scheduler_pre_ue_select(
 
   for ( CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++ ) {
     HI_DCI0_req   = &eNB->HI_DCI0_req[CC_id].hi_dci0_request_body;
-    for ( int temp = 0; temp < ue_first_num[CC_id]; temp++ ) {
+    for ( int temp = 0; temp < ul_inactivity_num[CC_id]; temp++ ) {
       if ( (ulsch_ue_select[CC_id].ue_num >= ulsch_ue_max_num[CC_id]) || (cc_id_flag[CC_id] == 1) ) {
         HI_DCI0_req   = &eNB->HI_DCI0_req[CC_id].hi_dci0_request_body;
         cc_id_flag[CC_id] = 1;
@@ -2229,7 +2229,7 @@ void ulsch_scheduler_pre_ue_select(
 
       hi_dci0_pdu   = &HI_DCI0_req->hi_dci0_pdu_list[HI_DCI0_req->number_of_dci+HI_DCI0_req->number_of_hi];
       format_flag = 2;
-      rnti = UE_RNTI(module_idP,UE_id);
+      rnti = UE_RNTI(module_idP,ul_inactivity_id[CC_id][temp]);
       if (CCE_allocation_infeasible(module_idP,CC_id,format_flag,subframeP,aggregation,rnti) == 1) {
           cc_id_flag[CC_id] = 1;
           return;
diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.c b/openair2/RRC/LITE/MESSAGES/asn1_msg.c
index 21f1a2f526..0d208d30cc 100644
--- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c
+++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.c
@@ -230,7 +230,7 @@ uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich
 
   AssertFatal(phich_Resource <= PHICH_Config__phich_Resource_two,"Illegal phich_Resource\n");
   mib->message.phich_Config.phich_Resource = phich_Resource;
-  AssertFatal(phich_Resource <= PHICH_Config__phich_Duration_extended,"Illegal phich_Duration\n");
+  AssertFatal(phich_duration <= PHICH_Config__phich_Duration_extended,"Illegal phich_Duration\n");
   mib->message.phich_Config.phich_Duration = phich_duration;
   LOG_I(RRC,"[MIB] systemBandwidth %x, phich_duration %x, phich_resource %x,sfn %x\n",
          (uint32_t)mib->message.dl_Bandwidth,
-- 
GitLab