From f3c3c52fcd6c30c077e1847d16b77fed1c8aa76f Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Tue, 10 Mar 2020 11:55:37 +0000 Subject: [PATCH] added ue_cc_idx to dci allocation --- lib/include/srslte/interfaces/sched_interface.h | 4 ++-- lib/include/srslte/phy/phch/dci.h | 2 ++ srsenb/src/stack/mac/scheduler_ue.cc | 3 +++ srsenb/test/mac/scheduler_test_common.cc | 15 ++++++++++++++- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/include/srslte/interfaces/sched_interface.h b/lib/include/srslte/interfaces/sched_interface.h index 704042443..ff6704416 100644 --- a/lib/include/srslte/interfaces/sched_interface.h +++ b/lib/include/srslte/interfaces/sched_interface.h @@ -163,14 +163,14 @@ public: uint32_t current_sf_allocation_num; } dl_pdu_mch_t; - typedef struct { + struct dl_sched_data_t { srslte_dci_dl_t dci; uint32_t tbs[SRSLTE_MAX_TB]; bool mac_ce_ta; bool mac_ce_rnti; uint32_t nof_pdu_elems[SRSLTE_MAX_TB]; dl_sched_pdu_t pdu[SRSLTE_MAX_TB][MAX_RLC_PDU_LIST]; - } dl_sched_data_t; + }; typedef struct { bool needs_pdcch; diff --git a/lib/include/srslte/phy/phch/dci.h b/lib/include/srslte/phy/phch/dci.h index fd8175219..ba977b97d 100644 --- a/lib/include/srslte/phy/phch/dci.h +++ b/lib/include/srslte/phy/phch/dci.h @@ -82,6 +82,7 @@ typedef struct SRSLTE_API { uint16_t rnti; srslte_dci_format_t format; srslte_dci_location_t location; + uint32_t ue_cc_idx; // Resource Allocation srslte_ra_type_t alloc_type; @@ -132,6 +133,7 @@ typedef struct SRSLTE_API { uint16_t rnti; srslte_dci_format_t format; srslte_dci_location_t location; + uint32_t ue_cc_idx; srslte_ra_type2_t type2_alloc; /* 36.213 Table 8.4-2: SRSLTE_RA_PUSCH_HOP_HALF is 0 for < 10 Mhz and 10 for > 10 Mhz. diff --git a/srsenb/src/stack/mac/scheduler_ue.cc b/srsenb/src/stack/mac/scheduler_ue.cc index b55c7170a..1811ca849 100644 --- a/srsenb/src/stack/mac/scheduler_ue.cc +++ b/srsenb/src/stack/mac/scheduler_ue.cc @@ -463,6 +463,7 @@ int sched_ue::generate_format1(uint32_t pid, if (tbs > 0) { dci->rnti = rnti; dci->pid = h->get_id(); + dci->ue_cc_idx = cc_idx; dci->tb[0].mcs_idx = (uint32_t)mcs; dci->tb[0].rv = sched_utils::get_rvidx(h->nof_retx(0)); dci->tb[0].ndi = h->get_ndi(0); @@ -588,6 +589,7 @@ int sched_ue::generate_format2a_unlocked(uint32_t pid, /* Fill common fields */ dci->format = SRSLTE_DCI_FORMAT2A; dci->rnti = rnti; + dci->ue_cc_idx = cc_idx; dci->pid = h->get_id(); dci->tpc_pucch = (uint8_t)next_tpc_pucch; next_tpc_pucch = 1; @@ -669,6 +671,7 @@ int sched_ue::generate_format0(sched_interface::ul_sched_data_t* data, if (tbs > 0) { dci->rnti = rnti; dci->format = SRSLTE_DCI_FORMAT0; + dci->ue_cc_idx = cc_idx; dci->type2_alloc.riv = srslte_ra_type2_to_riv(alloc.L, alloc.RB_start, cell.nof_prb); dci->tb.rv = sched_utils::get_rvidx(h->nof_retx(0)); if (!is_newtx && h->is_adaptive_retx()) { diff --git a/srsenb/test/mac/scheduler_test_common.cc b/srsenb/test/mac/scheduler_test_common.cc index 4cfb22f4e..ff648a0ac 100644 --- a/srsenb/test/mac/scheduler_test_common.cc +++ b/srsenb/test/mac/scheduler_test_common.cc @@ -552,7 +552,20 @@ int user_state_sched_tester::test_scell_activation(uint32_t CONDERROR(dl_result.data[i].dci.rnti == rnti, "Allocated user in inactive carrier\n"); } for (uint32_t i = 0; i < ul_result.nof_dci_elems; ++i) { - CONDERROR(ul_result.pusch[i].dci.rnti == rnti, "Allocated user in inactive carrier\n"); + CONDERROR(ul_result.pusch[i].needs_pdcch and ul_result.pusch[i].dci.rnti == rnti, + "Allocated user in inactive carrier\n"); + } + } else { + uint32_t ue_cc_idx = std::distance(userinfo.user_cfg.supported_cc_list.begin(), it); + for (uint32_t i = 0; i < dl_result.nof_data_elems; ++i) { + if (dl_result.data[i].dci.rnti == rnti) { + CONDERROR(dl_result.data[i].dci.ue_cc_idx != ue_cc_idx, "User cell index was incorrectly set\n"); + } + } + for (uint32_t i = 0; i < ul_result.nof_dci_elems; ++i) { + if (ul_result.pusch[i].needs_pdcch and ul_result.pusch[i].dci.rnti == rnti) { + CONDERROR(ul_result.pusch[i].dci.ue_cc_idx != ue_cc_idx, "The user cell index was incorrectly set\n"); + } } } }