From 000142c3e3a8de1c7e6e8e81d71934f1f7229fb9 Mon Sep 17 00:00:00 2001
From: Abhijith <abhijitha@iisc.ac.in>
Date: Thu, 29 Jul 2021 16:00:23 +0530
Subject: [PATCH] Cosmetic changes

---
 openair1/SCHED_NR_UE/pucch_uci_ue_nr.c             |  8 ++++----
 openair2/LAYER2/NR_MAC_UE/config_ue.c              |  7 ++-----
 .../LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c     |  4 ++--
 openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c       | 14 +++++++-------
 openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c        | 14 +++++++-------
 .../LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c   |  7 ++++---
 openair2/NR_PHY_INTERFACE/NR_IF_Module.c           |  1 -
 7 files changed, 26 insertions(+), 29 deletions(-)

diff --git a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c
index 45c0ec2df00..8a62802f358 100644
--- a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c
+++ b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c
@@ -420,7 +420,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
   NR_UE_MAC_INST_t *mac = get_mac_inst(0);
   NR_PUCCH_Resource_t *pucch_resource = NULL;
   uint16_t crnti = mac->crnti;
-  NR_BWP_Id_t bwp_id = mac->UL_BWP_Id;//SA uses initial BWP
+  NR_BWP_Id_t bwp_id = mac->UL_BWP_Id;
 
   /* update current context */
 
@@ -991,7 +991,7 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id,  UE_nr_rxtx_proc_t
   int N_m_c_rx = 0;
   int V_DAI_m_DL = 0;
   NR_UE_MAC_INST_t *mac = get_mac_inst(0);
-  NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id; //SA uses initial BWP
+  NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id; 
 
 
   if (mac->DLbwp[dl_bwp_id] &&
@@ -1183,7 +1183,7 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, NR_UE_MAC_INST_t *mac, uint8
   pucch_format_nr_t format_pucch;
   int ready_pucch_resource_id = FALSE; /* in the case that it is already given */
   NR_PUCCH_Resource_t *pucch_resource = NULL;
-  NR_BWP_Id_t bwp_id = mac->UL_BWP_Id;//SA uses initial BWP
+  NR_BWP_Id_t bwp_id = mac->UL_BWP_Id;
 
   /* ini values to unset */
   *initial_pucch_id = NB_INITIAL_PUCCH_RESOURCE;
@@ -1378,7 +1378,7 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, NR_UE_MAC_INST_t *mac, uint8
 int find_pucch_resource_set(NR_UE_MAC_INST_t *mac, uint8_t gNB_id, int uci_size)
 {
   int pucch_resource_set_id = 0;
-  NR_BWP_Id_t bwp_id = mac->DL_BWP_Id; //SA uses initial BWP
+  NR_BWP_Id_t bwp_id = mac->DL_BWP_Id;
 
   //long *pucch_max_pl_bits = NULL;
 
diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c
index 059a25aca1d..5f9dae6e6ad 100755
--- a/openair2/LAYER2/NR_MAC_UE/config_ue.c
+++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c
@@ -601,8 +601,8 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){
   AssertFatal(scd->downlinkBWP_ToAddModList->list.count <= 4, "downlinkBWP_ToAddModList->list->count is %d\n", scd->downlinkBWP_ToAddModList->list.count);
 
   config_bwp_ue(mac, NULL, NULL);
-  NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id ; //Changed
-  NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id ;//Changed
+  NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id;
+  NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id;
   AssertFatal(dl_bwp_id != 0, "DL_BWP_Id is 0!");
   AssertFatal(ul_bwp_id != 0, "UL_BWP_Id is 0!");
 
@@ -644,10 +644,7 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){
     mac->DLbwp[num_BWP] = scd->downlinkBWP_ToAddModList->list.array[num_BWP-1];
     mac->ULbwp[num_BWP] = uplinkBWP_ToAddModList->list.array[num_BWP-1];
   }
-  
   mac->coreset[dl_bwp_id][coreset_id - 1] = controlResourceSetToAddModList->list.array[0];
-
-  
   
   AssertFatal(mac->ULbwp[ul_bwp_id]->bwp_Dedicated != NULL, "UL bwp_Dedicated is null\n");
 
diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c
index ff34ca93f0e..edc22c69721 100644
--- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c
+++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c
@@ -73,7 +73,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
 
   AssertFatal(mac->scc == NULL || mac->scc_SIB == NULL, "both scc and scc_SIB cannot be non-null\n");
 
-  NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id ; //Changed
+  NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id;
   NR_ServingCellConfigCommon_t *scc = mac->scc;
   NR_ServingCellConfigCommonSIB_t *scc_SIB = mac->scc_SIB;
   NR_BWP_DownlinkCommon_t *bwp_Common=NULL;
@@ -244,7 +244,7 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
   RA_config_t *ra = &mac->ra;
   int ss_id;
 
-  NR_BWP_Id_t bwp_id = (mac->cg) ? mac->DL_BWP_Id : 0; //Changed
+  NR_BWP_Id_t bwp_id = (mac->cg) ? mac->DL_BWP_Id : 0;
   uint8_t coreset_id = (mac->cg) ? 1 : 0;
   //NR_ServingCellConfig_t *scd = mac->scg->spCellConfig->spCellConfigDedicated;
   NR_BWP_Downlink_t *bwp = (mac->cg) ? mac->DLbwp[bwp_id] : NULL;
diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
index eb702c57c98..f490a819cb1 100644
--- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
+++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
@@ -280,8 +280,8 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
   uint8_t sliv_S=0;
   uint8_t sliv_L=0;
   uint8_t mu_pusch = 1;
-  NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id; //SA uses initial BWP
-  NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id;//SA uses initial BWP
+  NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id; 
+  NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id;
 
   // definition table j Table 6.1.2.1.1-4
   uint8_t j = (mu_pusch==3)?3:(mu_pusch==2)?2:1;
@@ -459,8 +459,8 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
   RA_config_t *ra = &mac->ra;
   fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request;
   uint8_t is_Msg3 = 0;
-  NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id; //SA uses initial BWP
-  NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id;//SA uses initial BWP
+  NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id; 
+  NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id;
 
   uint16_t n_RB_DLBWP;
   if (mac->DLbwp[dl_bwp_id]) n_RB_DLBWP = NRRIV2BW(mac->DLbwp[dl_bwp_id]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
@@ -1169,7 +1169,7 @@ void nr_ue_send_sdu(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *u
 int get_n_rb(NR_UE_MAC_INST_t *mac, int rnti_type){
 
   int N_RB = 0, start_RB;
-  NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id; //SA uses initial BWP
+  NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id;
   switch(rnti_type) {
     case NR_RNTI_RA:
     case NR_RNTI_TC:
@@ -1206,8 +1206,8 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
   int fsize = 0;
 
   int rnti_type = get_rnti_type(mac, rnti);
-  NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id; //SA uses initial BWP
-  NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id; //SA uses initial BWP
+  NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id; 
+  NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id; 
 
   int N_RB_UL = 0;
   if(mac->scc_SIB) {
diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
index df2a1ba838b..bf192a5c6b3 100644
--- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
+++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
@@ -95,7 +95,7 @@ void fill_scheduled_response(nr_scheduled_response_t *scheduled_response,
 long get_k2(NR_UE_MAC_INST_t *mac, uint8_t time_domain_ind) {
   long k2 = -1;
 
-  NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id;//SA uses initial BWP
+  NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id;
   // Get K2 from RRC configuration
   NR_PUSCH_Config_t *pusch_config=mac->ULbwp[ul_bwp_id] ? mac->ULbwp[ul_bwp_id]->bwp_Dedicated->pusch_Config->choice.setup : NULL;
   NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = NULL;
@@ -136,7 +136,7 @@ long get_k2(NR_UE_MAC_INST_t *mac, uint8_t time_domain_ind) {
  */
 fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int slot)
 {
-  NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id;//SA uses initial BWP
+  NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id;
   NR_TDD_UL_DL_ConfigCommon_t *tdd_config = mac->scc==NULL ? mac->scc_SIB->tdd_UL_DL_ConfigurationCommon : mac->scc->tdd_UL_DL_ConfigurationCommon;
 
   //Check if request to access ul_config is for a UL slot
@@ -167,7 +167,7 @@ fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int sl
 void ul_layers_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu, dci_pdu_rel15_t *dci) {
 
   NR_ServingCellConfigCommon_t *scc = mac->scc;
-  NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id;//SA uses initial BWP
+  NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id;
   NR_PUSCH_Config_t *pusch_Config = mac->ULbwp[ul_bwp_id]->bwp_Dedicated->pusch_Config->choice.setup;
 
   long	transformPrecoder;
@@ -306,7 +306,7 @@ void ul_ports_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_conf
 
   /* ANTENNA_PORTS */
   uint8_t rank = 0; // We need to initialize rank FIXME!!!
-  NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id;//SA uses initial BWP
+  NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id;
   NR_ServingCellConfigCommon_t *scc = mac->scc;
   NR_PUSCH_Config_t *pusch_Config = mac->ULbwp[ul_bwp_id]->bwp_Dedicated->pusch_Config->choice.setup;
 
@@ -513,7 +513,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
   int                N_PRB_oh  = 0;
 
   int rnti_type = get_rnti_type(mac, rnti);
-  NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id;//SA uses initial BWP
+  NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id;
 
   // Common configuration
   pusch_config_pdu->dmrs_config_type = pusch_dmrs_type1;
@@ -668,7 +668,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
 
       config_bwp_ue(mac, &dci->bwp_indicator.val, dci_format);
 
-      ul_bwp_id = mac->UL_BWP_Id;//SA uses initial BWP
+      ul_bwp_id = mac->UL_BWP_Id;
 
       target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific;
       ul_layers_config(mac, pusch_config_pdu, dci);
@@ -1121,7 +1121,7 @@ int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac,
                           uint8_t tda_id){
 
   int delta = 0;
-  NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id;//SA uses initial BWP
+  NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id;
   NR_BWP_Uplink_t *ubwp = mac->ULbwp[ul_bwp_id];
 
   // Get the numerology to calculate the Tx frame and slot
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
index 7f9fcaec12b..832ee27283f 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
@@ -60,7 +60,6 @@
 #define DEBUG_gNB_SCHEDULER 1
 
 #include "common/ran_context.h"
-#include "executables/softmodem-common.h"
 
 extern RAN_CONTEXT_t RC;
 
@@ -1861,7 +1860,9 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG
     if (bwpList) AssertFatal(bwpList->list.count <= 4,
 			     "downlinkBWP_ToAddModList has %d BWP!\n",
 			     bwpList->list.count);
-    const int bwp_id =  (get_softmodem_params()->sa ) ? 1 : *servingCellConfig->firstActiveDownlinkBWP_Id; // TODO
+           
+    const int bwp_id = servingCellConfig ? *servingCellConfig->firstActiveDownlinkBWP_Id : 1; // TODO
+
     sched_ctrl->active_bwp = bwpList ? bwpList->list.array[bwp_id - 1] : NULL;
     const int target_ss = sched_ctrl->active_bwp ? NR_SearchSpace__searchSpaceType_PR_ue_Specific : NR_SearchSpace__searchSpaceType_PR_common;
     sched_ctrl->search_space = get_searchspace(scc, sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Dedicated : NULL, target_ss);
@@ -1996,7 +1997,7 @@ void get_pdsch_to_harq_feedback(int Mod_idP,
 
   NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info;
   NR_CellGroupConfig_t *CellGroup = UE_info->CellGroup[UE_id];
-  NR_BWP_Id_t bwp_id; //Changed
+  NR_BWP_Id_t bwp_id;
   if (CellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id)
     bwp_id = *CellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id;
   else
diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c
index 982edf2f9de..fa76fd00bca 100644
--- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c
+++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c
@@ -105,7 +105,6 @@ void handle_nr_uci(NR_UL_IND_t *UL_info)
   }
 
   UL_info->uci_ind.num_ucis = 0;
-
 }
 
 void handle_nr_ulsch(NR_UL_IND_t *UL_info)
-- 
GitLab