From 95279a95cedd07b2ed09665d4f022b4aba4e89a6 Mon Sep 17 00:00:00 2001
From: Sakthivel Velumani <sakthi92@gmail.com>
Date: Mon, 12 Oct 2020 18:07:24 +0200
Subject: [PATCH] Hotfix for DL DCI issue in UE Created two dci_pdu's to hold
 dci configuration for UL and DL DCI. This wasn't a problem before as only one
 DCI was scheduled.

---
 openair1/SIMULATION/NR_PHY/dlsim.c                  | 2 +-
 openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c
index 0aaff7afed..2c0641ba2d 100644
--- a/openair1/SIMULATION/NR_PHY/dlsim.c
+++ b/openair1/SIMULATION/NR_PHY/dlsim.c
@@ -1038,7 +1038,7 @@ int main(int argc, char **argv)
     }
 
     //if ((float)n_errors/(float)n_trials <= target_error_rate) {
-    if (effRate >= (eff_tp_check*TBS)) {
+    if (effRate > (eff_tp_check*TBS)) {
       printf("PDSCH test OK\n");
       break;
     }
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 33aed06aec..12333ba9f1 100644
--- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c
+++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c
@@ -69,7 +69,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
   uint16_t monitoringSymbolsWithinSlot = 0;
   uint8_t bwp_id = 1, coreset_id = 1;
   int sps = 0;
-  def_dci_pdu_rel15 = calloc(1,sizeof(dci_pdu_rel15_t));
+  def_dci_pdu_rel15 = calloc(1,2*sizeof(dci_pdu_rel15_t));
   AssertFatal(mac->scc != NULL, "scc is null\n");
   NR_ServingCellConfigCommon_t *scc = mac->scc;
   NR_BWP_DownlinkCommon_t *bwp_Common = mac->DLbwp[bwp_id - 1]->bwp_Common;
@@ -121,7 +121,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
     rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, 275);
     rel15->SubcarrierSpacing = bwp_Common->genericParameters.subcarrierSpacing;
     for (int i = 0; i < rel15->num_dci_options; i++) {
-      rel15->dci_length_options[i] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15, rel15->dci_format_options[i], NR_RNTI_C, rel15->BWPSize, bwp_id);
+      rel15->dci_length_options[i] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15+i, rel15->dci_format_options[i], NR_RNTI_C, rel15->BWPSize, bwp_id);
     }
     break;
     case NR_RNTI_RA:
-- 
2.26.2