From 54a12870ec34020b293d67e4e46477f2ca0678ff Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Wed, 7 Jul 2021 16:59:56 +0200 Subject: [PATCH] SRSUE: avoid negative SR transmission in NR --- lib/include/srsran/phy/phch/uci_cfg_nr.h | 12 ++++++------ lib/src/phy/phch/ra_ul_nr.c | 2 +- lib/src/phy/phch/uci_nr.c | 11 ++++++++++- srsue/hdr/phy/nr/state.h | 10 +++++----- srsue/src/phy/nr/cc_worker.cc | 2 +- 5 files changed, 23 insertions(+), 14 deletions(-) diff --git a/lib/include/srsran/phy/phch/uci_cfg_nr.h b/lib/include/srsran/phy/phch/uci_cfg_nr.h index cb1e104ca..ca5b63274 100644 --- a/lib/include/srsran/phy/phch/uci_cfg_nr.h +++ b/lib/include/srsran/phy/phch/uci_cfg_nr.h @@ -35,12 +35,11 @@ * @brief Uplink Control Information bits configuration for PUCCH transmission */ typedef struct { - uint16_t rnti; ///< RNTI - uint32_t resource_id; ///< PUCCH resource indicator field in the DCI format 1_0 or DCI format 1_1 - uint32_t n_cce_0; ///< index of a first CCE for the PDCCH reception - uint32_t N_cce; ///< number of CCEs in a CORESET of a PDCCH reception with DCI format 1_0 or 1_1 - uint32_t sr_resource_id; ///< Scheduling request resource identifier, only valid if positive SR - bool sr_positive_present; ///< Set to true if there is at least one positive SR + uint16_t rnti; ///< RNTI + uint32_t resource_id; ///< PUCCH resource indicator field in the DCI format 1_0 or DCI format 1_1 + uint32_t n_cce_0; ///< index of a first CCE for the PDCCH reception + uint32_t N_cce; ///< number of CCEs in a CORESET of a PDCCH reception with DCI format 1_0 or 1_1 + uint32_t sr_resource_id; ///< Scheduling request resource identifier, only valid if positive SR } srsran_uci_nr_pucch_cfg_t; /** @@ -70,6 +69,7 @@ typedef struct SRSRAN_API { /// Common Parameters srsran_harq_ack_cfg_t ack; ///< HARQ-ACK configuration uint32_t o_sr; ///< Number of SR bits + bool sr_positive_present; ///< Set to true if there is at least one positive SR srsran_csi_report_cfg_t csi[SRSRAN_CSI_MAX_NOF_REPORT]; ///< CSI report configuration uint32_t nof_csi; ///< Number of CSI reports union { diff --git a/lib/src/phy/phch/ra_ul_nr.c b/lib/src/phy/phch/ra_ul_nr.c index ce4e722bd..1f6a03332 100644 --- a/lib/src/phy/phch/ra_ul_nr.c +++ b/lib/src/phy/phch/ra_ul_nr.c @@ -530,7 +530,7 @@ int srsran_ra_ul_nr_pucch_resource(const srsran_pucch_nr_hl_cfg_t* pucch_cfg, // - At least one positive SR // - up to 2 HARQ-ACK // - No CSI report - if (uci_cfg->pucch.sr_positive_present > 0 && uci_cfg->ack.count <= SRSRAN_PUCCH_NR_FORMAT1_MAX_NOF_BITS && + if (uci_cfg->sr_positive_present > 0 && uci_cfg->ack.count <= SRSRAN_PUCCH_NR_FORMAT1_MAX_NOF_BITS && uci_cfg->nof_csi == 0) { uint32_t sr_resource_id = uci_cfg->pucch.sr_resource_id; if (sr_resource_id >= SRSRAN_PUCCH_MAX_NOF_SR_RESOURCES) { diff --git a/lib/src/phy/phch/uci_nr.c b/lib/src/phy/phch/uci_nr.c index 14e169441..88412ac5a 100644 --- a/lib/src/phy/phch/uci_nr.c +++ b/lib/src/phy/phch/uci_nr.c @@ -980,7 +980,16 @@ uint32_t srsran_uci_nr_total_bits(const srsran_uci_cfg_nr_t* uci_cfg) return 0; } - return uci_cfg->ack.count + uci_cfg->o_sr + srsran_csi_part1_nof_bits(uci_cfg->csi, uci_cfg->nof_csi); + uint32_t o_csi = srsran_csi_part1_nof_bits(uci_cfg->csi, uci_cfg->nof_csi); + + // According to 38.213 9.2.4 UE procedure for reporting SR + // The UE transmits a PUCCH in the PUCCH resource for the corresponding SR configuration only when the UE transmits a + // positive SR + if (uci_cfg->ack.count == 0 && o_csi == 0 && !uci_cfg->sr_positive_present) { + return 0; + } + + return uci_cfg->ack.count + uci_cfg->o_sr + o_csi; } uint32_t srsran_uci_nr_info(const srsran_uci_data_nr_t* uci_data, char* str, uint32_t str_len) diff --git a/srsue/hdr/phy/nr/state.h b/srsue/hdr/phy/nr/state.h index fef7d2986..fed29376a 100644 --- a/srsue/hdr/phy/nr/state.h +++ b/srsue/hdr/phy/nr/state.h @@ -316,7 +316,7 @@ public: } // Initialise counters - uint32_t sr_count_all = (uint32_t)n; + uint32_t sr_count_all = (uint32_t)n; // Number of opportunities in this TTI uint32_t sr_count_positive = 0; // Iterate all opportunities and check if there is a pending SR @@ -333,10 +333,10 @@ public: } // Configure SR fields in UCI data - uci_data.cfg.pucch.sr_resource_id = sr_resource_id[0]; - uci_data.cfg.o_sr = srsran_ra_ul_nr_nof_sr_bits(sr_count_all); - uci_data.cfg.pucch.sr_positive_present = sr_count_positive > 0; - uci_data.value.sr = sr_count_positive; + uci_data.cfg.pucch.sr_resource_id = sr_resource_id[0]; + uci_data.cfg.o_sr = srsran_ra_ul_nr_nof_sr_bits(sr_count_all); + uci_data.cfg.sr_positive_present = sr_count_positive > 0; + uci_data.value.sr = sr_count_positive; } void get_periodic_csi(const uint32_t& tti, srsran_uci_data_nr_t& uci_data) diff --git a/srsue/src/phy/nr/cc_worker.cc b/srsue/src/phy/nr/cc_worker.cc index e9c4cbde2..6f69a5e2b 100644 --- a/srsue/src/phy/nr/cc_worker.cc +++ b/srsue/src/phy/nr/cc_worker.cc @@ -538,7 +538,7 @@ bool cc_worker::work_ul() } // Add SR to UCI data only if there is no UL grant! - if (!has_ul_ack) { + if (not has_pusch_grant) { phy.get_pending_sr(ul_slot_cfg.idx, uci_data); }