diff --git a/lib/include/srsran/phy/phch/cqi.h b/lib/include/srsran/phy/phch/cqi.h index 2bab78dfc..9a251f7b8 100644 --- a/lib/include/srsran/phy/phch/cqi.h +++ b/lib/include/srsran/phy/phch/cqi.h @@ -78,7 +78,7 @@ typedef struct SRSRAN_API { uint8_t wideband_cqi; // 4-bit width uint8_t subband_diff_cqi; // 2-bit width uint32_t position_subband; // L-bit width -} srsran_cqi_ue_subband_t; +} srsran_cqi_ue_diff_subband_t; /* Table 5.2.3.3.1-1: Fields for channel quality information feedback for wideband CQI reports (transmission mode 1, transmission mode 2, transmission mode 3, transmission mode 7 and @@ -100,12 +100,12 @@ typedef struct SRSRAN_API { typedef struct SRSRAN_API { uint8_t subband_cqi; // 4-bit width uint8_t subband_label; // 1- or 2-bit width -} srsran_cqi_format2_subband_t; +} srsran_cqi_ue_subband_t; typedef enum { SRSRAN_CQI_TYPE_WIDEBAND = 0, - SRSRAN_CQI_TYPE_SUBBAND, SRSRAN_CQI_TYPE_SUBBAND_UE, + SRSRAN_CQI_TYPE_SUBBAND_UE_DIFF, SRSRAN_CQI_TYPE_SUBBAND_HL } srsran_cqi_type_t; @@ -125,8 +125,8 @@ typedef struct SRSRAN_API { typedef struct { union { srsran_cqi_format2_wideband_t wideband; - srsran_cqi_format2_subband_t subband; srsran_cqi_ue_subband_t subband_ue; + srsran_cqi_ue_diff_subband_t subband_ue_diff; srsran_cqi_hl_subband_t subband_hl; }; bool data_crc; diff --git a/lib/src/phy/phch/cqi.c b/lib/src/phy/phch/cqi.c index d7ef51d34..9d407aae8 100644 --- a/lib/src/phy/phch/cqi.c +++ b/lib/src/phy/phch/cqi.c @@ -65,7 +65,7 @@ static int cqi_hl_subband_pack(srsran_cqi_cfg_t* cfg, srsran_cqi_hl_subband_t* m return bit_count; } -static int cqi_ue_subband_pack(srsran_cqi_cfg_t* cfg, srsran_cqi_ue_subband_t* msg, uint8_t* buff) +static int cqi_ue_subband_pack(srsran_cqi_cfg_t* cfg, srsran_cqi_ue_diff_subband_t* msg, uint8_t* buff) { uint8_t* body_ptr = buff; srsran_bit_unpack(msg->wideband_cqi, &body_ptr, 4); @@ -101,7 +101,7 @@ static int cqi_format2_wideband_pack(srsran_cqi_cfg_t* cfg, srsran_cqi_format2_w return (int)(body_ptr - buff); } -static int cqi_format2_subband_pack(srsran_cqi_cfg_t* cfg, srsran_cqi_format2_subband_t* msg, uint8_t* buff) +static int cqi_format2_subband_pack(srsran_cqi_cfg_t* cfg, srsran_cqi_ue_subband_t* msg, uint8_t* buff) { uint8_t* body_ptr = buff; srsran_bit_unpack(msg->subband_cqi, &body_ptr, 4); @@ -114,10 +114,10 @@ int srsran_cqi_value_pack(srsran_cqi_cfg_t* cfg, srsran_cqi_value_t* value, uint switch (cfg->type) { case SRSRAN_CQI_TYPE_WIDEBAND: return cqi_format2_wideband_pack(cfg, &value->wideband, buff); - case SRSRAN_CQI_TYPE_SUBBAND: - return cqi_format2_subband_pack(cfg, &value->subband, buff); case SRSRAN_CQI_TYPE_SUBBAND_UE: - return cqi_ue_subband_pack(cfg, &value->subband_ue, buff); + return cqi_format2_subband_pack(cfg, &value->subband_ue, buff); + case SRSRAN_CQI_TYPE_SUBBAND_UE_DIFF: + return cqi_ue_subband_pack(cfg, &value->subband_ue_diff, buff); case SRSRAN_CQI_TYPE_SUBBAND_HL: return cqi_hl_subband_pack(cfg, &value->subband_hl, buff); } @@ -163,7 +163,7 @@ int cqi_hl_subband_unpack(srsran_cqi_cfg_t* cfg, uint8_t* buff, srsran_cqi_hl_su return bit_count; } -int cqi_ue_subband_unpack(srsran_cqi_cfg_t* cfg, uint8_t* buff, srsran_cqi_ue_subband_t* msg) +int cqi_ue_subband_unpack(srsran_cqi_cfg_t* cfg, uint8_t* buff, srsran_cqi_ue_diff_subband_t* msg) { uint8_t* body_ptr = buff; msg->wideband_cqi = srsran_bit_pack(&body_ptr, 4); @@ -197,7 +197,7 @@ static int cqi_format2_wideband_unpack(srsran_cqi_cfg_t* cfg, uint8_t* buff, srs return 4; } -static int cqi_format2_subband_unpack(srsran_cqi_cfg_t* cfg, uint8_t* buff, srsran_cqi_format2_subband_t* msg) +static int cqi_format2_subband_unpack(srsran_cqi_cfg_t* cfg, uint8_t* buff, srsran_cqi_ue_subband_t* msg) { uint8_t* body_ptr = buff; msg->subband_cqi = srsran_bit_pack(&body_ptr, 4); @@ -210,10 +210,10 @@ int srsran_cqi_value_unpack(srsran_cqi_cfg_t* cfg, uint8_t buff[SRSRAN_CQI_MAX_B switch (cfg->type) { case SRSRAN_CQI_TYPE_WIDEBAND: return cqi_format2_wideband_unpack(cfg, buff, &value->wideband); - case SRSRAN_CQI_TYPE_SUBBAND: - return cqi_format2_subband_unpack(cfg, buff, &value->subband); case SRSRAN_CQI_TYPE_SUBBAND_UE: - return cqi_ue_subband_unpack(cfg, buff, &value->subband_ue); + return cqi_format2_subband_unpack(cfg, buff, &value->subband_ue); + case SRSRAN_CQI_TYPE_SUBBAND_UE_DIFF: + return cqi_ue_subband_unpack(cfg, buff, &value->subband_ue_diff); case SRSRAN_CQI_TYPE_SUBBAND_HL: return cqi_hl_subband_unpack(cfg, buff, &value->subband_hl); } @@ -242,7 +242,7 @@ cqi_format2_wideband_tostring(srsran_cqi_cfg_t* cfg, srsran_cqi_format2_wideband } static int -cqi_format2_subband_tostring(srsran_cqi_cfg_t* cfg, srsran_cqi_format2_subband_t* msg, char* buff, uint32_t buff_len) +cqi_format2_subband_tostring(srsran_cqi_cfg_t* cfg, srsran_cqi_ue_subband_t* msg, char* buff, uint32_t buff_len) { int n = 0; @@ -252,7 +252,8 @@ cqi_format2_subband_tostring(srsran_cqi_cfg_t* cfg, srsran_cqi_format2_subband_t return n; } -static int cqi_ue_subband_tostring(srsran_cqi_cfg_t* cfg, srsran_cqi_ue_subband_t* msg, char* buff, uint32_t buff_len) +static int +cqi_ue_subband_tostring(srsran_cqi_cfg_t* cfg, srsran_cqi_ue_diff_subband_t* msg, char* buff, uint32_t buff_len) { int n = 0; @@ -292,11 +293,11 @@ int srsran_cqi_value_tostring(srsran_cqi_cfg_t* cfg, srsran_cqi_value_t* value, case SRSRAN_CQI_TYPE_WIDEBAND: ret = cqi_format2_wideband_tostring(cfg, &value->wideband, buff, buff_len); break; - case SRSRAN_CQI_TYPE_SUBBAND: - ret = cqi_format2_subband_tostring(cfg, &value->subband, buff, buff_len); - break; case SRSRAN_CQI_TYPE_SUBBAND_UE: - ret = cqi_ue_subband_tostring(cfg, &value->subband_ue, buff, buff_len); + ret = cqi_format2_subband_tostring(cfg, &value->subband_ue, buff, buff_len); + break; + case SRSRAN_CQI_TYPE_SUBBAND_UE_DIFF: + ret = cqi_ue_subband_tostring(cfg, &value->subband_ue_diff, buff, buff_len); break; case SRSRAN_CQI_TYPE_SUBBAND_HL: ret = cqi_hl_subband_tostring(cfg, &value->subband_hl, buff, buff_len); @@ -339,10 +340,10 @@ int srsran_cqi_size(srsran_cqi_cfg_t* cfg) } } break; - case SRSRAN_CQI_TYPE_SUBBAND: + case SRSRAN_CQI_TYPE_SUBBAND_UE: size = 4 + ((cfg->subband_label_2_bits) ? 2 : 1); break; - case SRSRAN_CQI_TYPE_SUBBAND_UE: + case SRSRAN_CQI_TYPE_SUBBAND_UE_DIFF: size = 4 + 2 + cfg->L; break; case SRSRAN_CQI_TYPE_SUBBAND_HL: diff --git a/lib/src/phy/ue/ue_dl.c b/lib/src/phy/ue/ue_dl.c index 32a3b77aa..24ac0bb54 100644 --- a/lib/src/phy/ue/ue_dl.c +++ b/lib/src/phy/ue/ue_dl.c @@ -855,9 +855,11 @@ void srsran_ue_dl_gen_cqi_periodic(srsran_ue_dl_t* q, } else if (srsran_cqi_periodic_send(&cfg->cfg.cqi_report, tti, q->cell.frame_type)) { if (cfg->cfg.cqi_report.format_is_subband) { // TODO: Implement subband periodic reports - uci_data->cfg.cqi.type = SRSRAN_CQI_TYPE_SUBBAND; - uci_data->value.cqi.subband.subband_cqi = wideband_value; - uci_data->value.cqi.subband.subband_label = 0; + uci_data->cfg.cqi.type = SRSRAN_CQI_TYPE_SUBBAND_UE; + uci_data->value.cqi.subband_ue.subband_cqi = wideband_value; + uci_data->value.cqi.subband_ue.subband_label = tti / 100 % 2; + uci_data->cfg.cqi.L = srsran_cqi_hl_get_L(q->cell.nof_prb); + uci_data->cfg.cqi.subband_label_2_bits = uci_data->cfg.cqi.L > 1; } else { uci_data->cfg.cqi.type = SRSRAN_CQI_TYPE_WIDEBAND; uci_data->value.cqi.wideband.wideband_cqi = wideband_value; diff --git a/srsenb/src/phy/phy_ue_db.cc b/srsenb/src/phy/phy_ue_db.cc index 0932edb33..837924e76 100644 --- a/srsenb/src/phy/phy_ue_db.cc +++ b/srsenb/src/phy/phy_ue_db.cc @@ -668,14 +668,14 @@ int phy_ue_db::send_uci_data(uint32_t tti, case SRSRAN_CQI_TYPE_WIDEBAND: cqi_value = uci_value.cqi.wideband.wideband_cqi; break; - case SRSRAN_CQI_TYPE_SUBBAND: - cqi_value = uci_value.cqi.subband.subband_cqi; + case SRSRAN_CQI_TYPE_SUBBAND_UE: + cqi_value = uci_value.cqi.subband_ue.subband_cqi; break; case SRSRAN_CQI_TYPE_SUBBAND_HL: cqi_value = uci_value.cqi.subband_hl.wideband_cqi_cw0; break; - case SRSRAN_CQI_TYPE_SUBBAND_UE: - cqi_value = uci_value.cqi.subband_ue.wideband_cqi; + case SRSRAN_CQI_TYPE_SUBBAND_UE_DIFF: + cqi_value = uci_value.cqi.subband_ue_diff.wideband_cqi; break; } stack->cqi_info(tti, rnti, cqi_cc_idx, cqi_value);