From dbbc621905e40c6b8e8024e1e1e537e2708c2860 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Fri, 10 Sep 2021 13:53:26 +0200 Subject: [PATCH] phy_common: fix PRB lookup for NR cells --- srsenb/hdr/phy/phy_common.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/srsenb/hdr/phy/phy_common.h b/srsenb/hdr/phy/phy_common.h index f5fe18c3a..1bc0b7a66 100644 --- a/srsenb/hdr/phy/phy_common.h +++ b/srsenb/hdr/phy/phy_common.h @@ -69,13 +69,20 @@ public: { uint32_t ret = 0; + if (cc_idx >= get_nof_carriers()) { + // invalid CC index + return ret; + } + if (cc_idx < cell_list_lte.size()) { ret = cell_list_lte[cc_idx].cell.nof_prb; - } else if (cc_idx == 1 && !cell_list_nr.empty()) { - // for basic NSA config return width of first NR carrier - ret = cell_list_nr[0].carrier.nof_prb; + } else if (cc_idx >= cell_list_lte.size()) { + // offset CC index by all LTE carriers + cc_idx -= cell_list_lte.size(); + if (cc_idx < cell_list_nr.size()) { + ret = cell_list_nr[cc_idx].carrier.nof_prb; + } } - return ret; }; uint32_t get_nof_ports(uint32_t cc_idx)