From eed9405e40d1547c0292e026a9d9d4736664b354 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Tue, 17 Nov 2020 17:02:14 +0100 Subject: [PATCH] Moved NR MAX MIMO layers to carrier --- .../srslte/phy/ch_estimation/dmrs_pdsch.h | 8 ++++---- lib/include/srslte/phy/common/phy_common_nr.h | 4 ++++ lib/include/srslte/phy/enb/enb_dl_nr.h | 3 +-- lib/include/srslte/phy/phch/pdsch_nr.h | 3 +-- lib/include/srslte/phy/phch/sch_cfg_nr.h | 5 +---- lib/include/srslte/phy/ue/ue_dl_nr.h | 10 ++++++++-- .../phy/ch_estimation/test/dmrs_pdsch_test.c | 3 ++- lib/src/phy/enb/enb_dl_nr.c | 4 ++-- lib/src/phy/phch/pdsch_nr.c | 8 +++----- lib/src/phy/phch/sch_nr.c | 2 +- lib/src/phy/phch/test/dlsch_nr_test.c | 10 +++++----- lib/src/phy/phch/test/pdsch_nr_test.c | 17 +++++++++-------- lib/src/phy/ue/ue_dl_nr.c | 4 ++-- lib/test/phy/phy_dl_nr_test.c | 18 ++++++++++-------- srsue/hdr/phy/lte/worker_pool.h | 6 +++--- 15 files changed, 56 insertions(+), 49 deletions(-) diff --git a/lib/include/srslte/phy/ch_estimation/dmrs_pdsch.h b/lib/include/srslte/phy/ch_estimation/dmrs_pdsch.h index cb31c1e5e..04221dfa9 100644 --- a/lib/include/srslte/phy/ch_estimation/dmrs_pdsch.h +++ b/lib/include/srslte/phy/ch_estimation/dmrs_pdsch.h @@ -13,15 +13,15 @@ #ifndef SRSLTE_DMRS_PDSCH_H #define SRSLTE_DMRS_PDSCH_H -#ifdef __cplusplus -extern "C" { -#endif - #include "srslte/phy/common/phy_common_nr.h" #include "srslte/phy/phch/pdsch_cfg_nr.h" #include "srslte/srslte.h" #include +#ifdef __cplusplus +extern "C" { +#endif + #define SRSLTE_DMRS_PDSCH_MAX_SYMBOLS 4 /** diff --git a/lib/include/srslte/phy/common/phy_common_nr.h b/lib/include/srslte/phy/common/phy_common_nr.h index 8b3af9889..813db9b12 100644 --- a/lib/include/srslte/phy/common/phy_common_nr.h +++ b/lib/include/srslte/phy/common/phy_common_nr.h @@ -171,6 +171,10 @@ typedef struct SRSLTE_API { uint32_t numerology; uint32_t nof_prb; uint32_t start; + uint32_t max_mimo_layers; ///< @brief DL: Indicates the maximum number of MIMO layers to be used for PDSCH in all BWPs + ///< of this serving cell. (see TS 38.212 [17], clause 5.4.2.1). UL: Indicates the maximum + ///< MIMO layer to be used for PUSCH in all BWPs of the normal UL of this serving cell (see + ///< TS 38.212 [17], clause 5.4.2.1) } srslte_carrier_nr_t; /** diff --git a/lib/include/srslte/phy/enb/enb_dl_nr.h b/lib/include/srslte/phy/enb/enb_dl_nr.h index 899bed5bc..0f822164b 100644 --- a/lib/include/srslte/phy/enb/enb_dl_nr.h +++ b/lib/include/srslte/phy/enb/enb_dl_nr.h @@ -37,8 +37,7 @@ typedef struct SRSLTE_API { SRSLTE_API int srslte_enb_dl_nr_init(srslte_enb_dl_nr_t* q, cf_t* output[SRSLTE_MAX_PORTS], const srslte_enb_dl_nr_args_t* args); -SRSLTE_API int -srslte_enb_dl_nr_set_carrier(srslte_enb_dl_nr_t* q, const srslte_carrier_nr_t* carrier, const srslte_sch_cfg_t* common); +SRSLTE_API int srslte_enb_dl_nr_set_carrier(srslte_enb_dl_nr_t* q, const srslte_carrier_nr_t* carrier); SRSLTE_API void srslte_enb_dl_nr_free(srslte_enb_dl_nr_t* q); diff --git a/lib/include/srslte/phy/phch/pdsch_nr.h b/lib/include/srslte/phy/phch/pdsch_nr.h index 0f35a2ede..f1f3494a3 100644 --- a/lib/include/srslte/phy/phch/pdsch_nr.h +++ b/lib/include/srslte/phy/phch/pdsch_nr.h @@ -67,8 +67,7 @@ SRSLTE_API int srslte_pdsch_nr_init_ue(srslte_pdsch_nr_t* q, const srslte_pdsch_ SRSLTE_API void srslte_pdsch_nr_free(srslte_pdsch_nr_t* q); -SRSLTE_API int -srslte_pdsch_nr_set_carrier(srslte_pdsch_nr_t* q, const srslte_carrier_nr_t* carrier, const srslte_sch_cfg_t* sch_cfg); +SRSLTE_API int srslte_pdsch_nr_set_carrier(srslte_pdsch_nr_t* q, const srslte_carrier_nr_t* carrier); SRSLTE_API int srslte_pdsch_nr_encode(srslte_pdsch_nr_t* q, const srslte_pdsch_cfg_nr_t* cfg, diff --git a/lib/include/srslte/phy/phch/sch_cfg_nr.h b/lib/include/srslte/phy/phch/sch_cfg_nr.h index 4dd131856..4d93dd78f 100644 --- a/lib/include/srslte/phy/phch/sch_cfg_nr.h +++ b/lib/include/srslte/phy/phch/sch_cfg_nr.h @@ -18,10 +18,7 @@ typedef struct SRSLTE_API { srslte_mcs_table_t mcs_table; ///< @brief Indicates the MCS table the UE shall use for PDSCH and/or PUSCH without ///< transform precoding - uint32_t max_mimo_layers; ///< @brief DL: Indicates the maximum number of MIMO layers to be used for PDSCH in all BWPs - ///< of this serving cell. (see TS 38.212 [17], clause 5.4.2.1). UL: Indicates the maximum - ///< MIMO layer to be used for PUSCH in all BWPs of the normal UL of this serving cell (see - ///< TS 38.212 [17], clause 5.4.2.1) + srslte_xoverhead_t xoverhead; ///< Accounts for overhead from CSI-RS, CORESET, etc. If the field is absent, the UE ///< applies value xOh0 (see TS 38.214 [19], clause 5.1.3.2). } srslte_sch_cfg_t; diff --git a/lib/include/srslte/phy/ue/ue_dl_nr.h b/lib/include/srslte/phy/ue/ue_dl_nr.h index 8c56e8694..a887372cf 100644 --- a/lib/include/srslte/phy/ue/ue_dl_nr.h +++ b/lib/include/srslte/phy/ue/ue_dl_nr.h @@ -17,6 +17,10 @@ #include "srslte/phy/dft/ofdm.h" #include "srslte/phy/phch/pdsch_nr.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef struct SRSLTE_API { srslte_pdsch_args_t pdsch; uint32_t nof_rx_antennas; @@ -38,8 +42,7 @@ typedef struct SRSLTE_API { SRSLTE_API int srslte_ue_dl_nr_init(srslte_ue_dl_nr_t* q, cf_t* input[SRSLTE_MAX_PORTS], const srslte_ue_dl_nr_args_t* args); -SRSLTE_API int -srslte_ue_dl_nr_set_carrier(srslte_ue_dl_nr_t* q, const srslte_carrier_nr_t* carrier, const srslte_sch_cfg_t* common); +SRSLTE_API int srslte_ue_dl_nr_set_carrier(srslte_ue_dl_nr_t* q, const srslte_carrier_nr_t* carrier); SRSLTE_API void srslte_ue_dl_nr_free(srslte_ue_dl_nr_t* q); @@ -50,5 +53,8 @@ SRSLTE_API int srslte_ue_dl_nr_pdsch_get(srslte_ue_dl_nr_t* q, const srslte_pdsch_cfg_nr_t* cfg, const srslte_pdsch_grant_nr_t* grant, srslte_pdsch_res_nr_t* res); +#ifdef __cplusplus +} +#endif #endif // SRSLTE_UE_DL_NR_H diff --git a/lib/src/phy/ch_estimation/test/dmrs_pdsch_test.c b/lib/src/phy/ch_estimation/test/dmrs_pdsch_test.c index 8cdd620f3..c035838f2 100644 --- a/lib/src/phy/ch_estimation/test/dmrs_pdsch_test.c +++ b/lib/src/phy/ch_estimation/test/dmrs_pdsch_test.c @@ -24,7 +24,8 @@ static srslte_carrier_nr_t carrier = { 0, // cell_id 0, // numerology 50, // nof_prb - 0 // start + 0, // start + 1 // max_mimo_layers }; typedef struct { diff --git a/lib/src/phy/enb/enb_dl_nr.c b/lib/src/phy/enb/enb_dl_nr.c index 6fe87e878..5558cceaa 100644 --- a/lib/src/phy/enb/enb_dl_nr.c +++ b/lib/src/phy/enb/enb_dl_nr.c @@ -94,9 +94,9 @@ void srslte_enb_dl_nr_free(srslte_enb_dl_nr_t* q) memset(q, 0, sizeof(srslte_enb_dl_nr_t)); } -int srslte_enb_dl_nr_set_carrier(srslte_enb_dl_nr_t* q, const srslte_carrier_nr_t* carrier, const srslte_sch_cfg_t* sch) +int srslte_enb_dl_nr_set_carrier(srslte_enb_dl_nr_t* q, const srslte_carrier_nr_t* carrier) { - if (srslte_pdsch_nr_set_carrier(&q->pdsch, carrier, sch) < SRSLTE_SUCCESS) { + if (srslte_pdsch_nr_set_carrier(&q->pdsch, carrier) < SRSLTE_SUCCESS) { return SRSLTE_ERROR; } diff --git a/lib/src/phy/phch/pdsch_nr.c b/lib/src/phy/phch/pdsch_nr.c index aa1b6cd67..f60769311 100644 --- a/lib/src/phy/phch/pdsch_nr.c +++ b/lib/src/phy/phch/pdsch_nr.c @@ -72,16 +72,14 @@ int srslte_pdsch_nr_init_ue(srslte_pdsch_nr_t* q, const srslte_pdsch_args_t* arg return SRSLTE_SUCCESS; } -int srslte_pdsch_nr_set_carrier(srslte_pdsch_nr_t* q, - const srslte_carrier_nr_t* carrier, - const srslte_sch_cfg_t* sch_cfg) +int srslte_pdsch_nr_set_carrier(srslte_pdsch_nr_t* q, const srslte_carrier_nr_t* carrier) { // Set carrier q->carrier = *carrier; // Reallocate symbols if necessary - if (q->max_layers < sch_cfg->max_mimo_layers || q->max_prb < carrier->nof_prb) { - q->max_layers = sch_cfg->max_mimo_layers; + if (q->max_layers < carrier->max_mimo_layers || q->max_prb < carrier->nof_prb) { + q->max_layers = carrier->max_mimo_layers; q->max_prb = carrier->nof_prb; // Free current allocations diff --git a/lib/src/phy/phch/sch_nr.c b/lib/src/phy/phch/sch_nr.c index c496fff0e..f3d7a5945 100644 --- a/lib/src/phy/phch/sch_nr.c +++ b/lib/src/phy/phch/sch_nr.c @@ -112,7 +112,7 @@ int srslte_dlsch_nr_fill_cfg(srslte_sch_nr_t* q, uint32_t N_re_lbrm = 156 * sch_nr_n_prb_lbrm(q->carrier.nof_prb); double R_lbrm = 948.0 / 1024.0; uint32_t Qm_lbrm = (sch_cfg->mcs_table == srslte_mcs_table_256qam) ? 8 : 6; - uint32_t TBS_LRBM = srslte_ra_nr_tbs(N_re_lbrm, 1.0, R_lbrm, Qm_lbrm, sch_cfg->max_mimo_layers); + uint32_t TBS_LRBM = srslte_ra_nr_tbs(N_re_lbrm, 1.0, R_lbrm, Qm_lbrm, q->carrier.max_mimo_layers); cfg->Nref = ceil(TBS_LRBM / (cbsegm.C * 2.0 / 3.0)); // Calculate number of code blocks after applying CBGTI... not implemented, activate all CB diff --git a/lib/src/phy/phch/test/dlsch_nr_test.c b/lib/src/phy/phch/test/dlsch_nr_test.c index 64b10fb74..10985956f 100644 --- a/lib/src/phy/phch/test/dlsch_nr_test.c +++ b/lib/src/phy/phch/test/dlsch_nr_test.c @@ -22,7 +22,8 @@ static srslte_carrier_nr_t carrier = { 0, // cell_id 0, // numerology SRSLTE_MAX_PRB_NR, // nof_prb - 0 // start + 0, // start + 1 // max_mimo_layers }; static uint32_t n_prb = 0; // Set to 0 for steering @@ -37,7 +38,7 @@ void usage(char* prog) printf("\t-m MCS PRB, set to >28 for steering [Default %d]\n", mcs); printf("\t-T Provide MCS table (64qam, 256qam, 64qamLowSE) [Default %s]\n", srslte_mcs_table_to_str(pdsch_cfg.sch_cfg.mcs_table)); - printf("\t-L Provide number of layers [Default %d]\n", pdsch_cfg.sch_cfg.max_mimo_layers); + printf("\t-L Provide number of layers [Default %d]\n", carrier.max_mimo_layers); printf("\t-v [set srslte_verbose to debug, default none]\n"); } @@ -56,7 +57,7 @@ int parse_args(int argc, char** argv) pdsch_cfg.sch_cfg.mcs_table = srslte_mcs_table_from_str(argv[optind]); break; case 'L': - pdsch_cfg.sch_cfg.max_mimo_layers = (uint32_t)strtol(argv[optind], NULL, 10); + carrier.max_mimo_layers = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': srslte_verbose++; @@ -84,7 +85,6 @@ int main(int argc, char** argv) // Set default PDSCH configuration pdsch_cfg.sch_cfg.mcs_table = srslte_mcs_table_64qam; - pdsch_cfg.sch_cfg.max_mimo_layers = 1; if (parse_args(argc, argv) < SRSLTE_SUCCESS) { goto clean_exit; @@ -137,7 +137,7 @@ int main(int argc, char** argv) ERROR("Error loading default grant\n"); goto clean_exit; } - pdsch_grant.nof_layers = pdsch_cfg.sch_cfg.max_mimo_layers; + pdsch_grant.nof_layers = carrier.max_mimo_layers; pdsch_grant.dci_format = srslte_dci_format_nr_1_0; uint32_t n_prb_start = 1; diff --git a/lib/src/phy/phch/test/pdsch_nr_test.c b/lib/src/phy/phch/test/pdsch_nr_test.c index c03ebf32c..fd7be5589 100644 --- a/lib/src/phy/phch/test/pdsch_nr_test.c +++ b/lib/src/phy/phch/test/pdsch_nr_test.c @@ -22,7 +22,8 @@ static srslte_carrier_nr_t carrier = { 0, // cell_id 0, // numerology SRSLTE_MAX_PRB_NR, // nof_prb - 0 // start + 0, // start + 1 // max_mimo_layers }; static uint32_t n_prb = 0; // Set to 0 for steering @@ -37,7 +38,7 @@ void usage(char* prog) printf("\t-m MCS PRB, set to >28 for steering [Default %d]\n", mcs); printf("\t-T Provide MCS table (64qam, 256qam, 64qamLowSE) [Default %s]\n", srslte_mcs_table_to_str(pdsch_cfg.sch_cfg.mcs_table)); - printf("\t-L Provide number of layers [Default %d]\n", pdsch_cfg.sch_cfg.max_mimo_layers); + printf("\t-L Provide number of layers [Default %d]\n", carrier.max_mimo_layers); printf("\t-v [set srslte_verbose to debug, default none]\n"); } @@ -56,7 +57,7 @@ int parse_args(int argc, char** argv) pdsch_cfg.sch_cfg.mcs_table = srslte_mcs_table_from_str(argv[optind]); break; case 'L': - pdsch_cfg.sch_cfg.max_mimo_layers = (uint32_t)strtol(argv[optind], NULL, 10); + carrier.max_mimo_layers = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': srslte_verbose++; @@ -85,7 +86,7 @@ int main(int argc, char** argv) // Set default PDSCH configuration pdsch_cfg.sch_cfg.mcs_table = srslte_mcs_table_64qam; - pdsch_cfg.sch_cfg.max_mimo_layers = 1; + if (parse_args(argc, argv) < SRSLTE_SUCCESS) { goto clean_exit; } @@ -104,17 +105,17 @@ int main(int argc, char** argv) goto clean_exit; } - if (srslte_pdsch_nr_set_carrier(&pdsch_tx, &carrier, &pdsch_cfg.sch_cfg)) { + if (srslte_pdsch_nr_set_carrier(&pdsch_tx, &carrier)) { ERROR("Error setting SCH NR carrier\n"); goto clean_exit; } - if (srslte_pdsch_nr_set_carrier(&pdsch_rx, &carrier, &pdsch_cfg.sch_cfg)) { + if (srslte_pdsch_nr_set_carrier(&pdsch_rx, &carrier)) { ERROR("Error setting SCH NR carrier\n"); goto clean_exit; } - for (uint32_t i = 0; i < pdsch_cfg.sch_cfg.max_mimo_layers; i++) { + for (uint32_t i = 0; i < carrier.max_mimo_layers; i++) { sf_symbols[i] = srslte_vec_cf_malloc(SRSLTE_SLOT_LEN_RE_NR(carrier.nof_prb)); if (sf_symbols[i] == NULL) { ERROR("Error malloc\n"); @@ -154,7 +155,7 @@ int main(int argc, char** argv) ERROR("Error loading default grant\n"); goto clean_exit; } - pdsch_grant.nof_layers = pdsch_cfg.sch_cfg.max_mimo_layers; + pdsch_grant.nof_layers = carrier.max_mimo_layers; pdsch_grant.dci_format = srslte_dci_format_nr_1_0; uint32_t n_prb_start = 1; diff --git a/lib/src/phy/ue/ue_dl_nr.c b/lib/src/phy/ue/ue_dl_nr.c index a91b6ef38..7965a69c8 100644 --- a/lib/src/phy/ue/ue_dl_nr.c +++ b/lib/src/phy/ue/ue_dl_nr.c @@ -100,9 +100,9 @@ void srslte_ue_dl_nr_free(srslte_ue_dl_nr_t* q) memset(q, 0, sizeof(srslte_ue_dl_nr_t)); } -int srslte_ue_dl_nr_set_carrier(srslte_ue_dl_nr_t* q, const srslte_carrier_nr_t* carrier, const srslte_sch_cfg_t* sch) +int srslte_ue_dl_nr_set_carrier(srslte_ue_dl_nr_t* q, const srslte_carrier_nr_t* carrier) { - if (srslte_pdsch_nr_set_carrier(&q->pdsch, carrier, sch) < SRSLTE_SUCCESS) { + if (srslte_pdsch_nr_set_carrier(&q->pdsch, carrier) < SRSLTE_SUCCESS) { return SRSLTE_ERROR; } diff --git a/lib/test/phy/phy_dl_nr_test.c b/lib/test/phy/phy_dl_nr_test.c index 6b38d59d3..f36dff7fb 100644 --- a/lib/test/phy/phy_dl_nr_test.c +++ b/lib/test/phy/phy_dl_nr_test.c @@ -23,7 +23,9 @@ static srslte_carrier_nr_t carrier = { 0, // cell_id 0, // numerology 100, // nof_prb - 0 // start + 0, // start + 1 // max_mimo_layers + }; static uint32_t n_prb = 0; // Set to 0 for steering @@ -38,7 +40,7 @@ void usage(char* prog) printf("\t-m MCS PRB, set to >28 for steering [Default %d]\n", mcs); printf("\t-T Provide MCS table (64qam, 256qam, 64qamLowSE) [Default %s]\n", srslte_mcs_table_to_str(pdsch_cfg.sch_cfg.mcs_table)); - printf("\t-L Provide number of layers [Default %d]\n", pdsch_cfg.sch_cfg.max_mimo_layers); + printf("\t-L Provide number of layers [Default %d]\n", carrier.max_mimo_layers); printf("\t-v [set srslte_verbose to debug, default none]\n"); } @@ -57,7 +59,7 @@ int parse_args(int argc, char** argv) pdsch_cfg.sch_cfg.mcs_table = srslte_mcs_table_from_str(argv[optind]); break; case 'L': - pdsch_cfg.sch_cfg.max_mimo_layers = (uint32_t)strtol(argv[optind], NULL, 10); + carrier.max_mimo_layers = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': srslte_verbose++; @@ -100,8 +102,8 @@ int main(int argc, char** argv) enb_dl_args.pdsch.sch.disable_simd = true; // Set default PDSCH configuration - pdsch_cfg.sch_cfg.mcs_table = srslte_mcs_table_64qam; - pdsch_cfg.sch_cfg.max_mimo_layers = 1; + pdsch_cfg.sch_cfg.mcs_table = srslte_mcs_table_64qam; + if (parse_args(argc, argv) < SRSLTE_SUCCESS) { goto clean_exit; } @@ -120,12 +122,12 @@ int main(int argc, char** argv) goto clean_exit; } - if (srslte_ue_dl_nr_set_carrier(&ue_dl, &carrier, &pdsch_cfg.sch_cfg)) { + if (srslte_ue_dl_nr_set_carrier(&ue_dl, &carrier)) { ERROR("Error setting SCH NR carrier\n"); goto clean_exit; } - if (srslte_enb_dl_nr_set_carrier(&enb_dl, &carrier, &pdsch_cfg.sch_cfg)) { + if (srslte_enb_dl_nr_set_carrier(&enb_dl, &carrier)) { ERROR("Error setting SCH NR carrier\n"); goto clean_exit; } @@ -162,7 +164,7 @@ int main(int argc, char** argv) ERROR("Error loading default grant\n"); goto clean_exit; } - pdsch_grant.nof_layers = pdsch_cfg.sch_cfg.max_mimo_layers; + pdsch_grant.nof_layers = carrier.max_mimo_layers; pdsch_grant.dci_format = srslte_dci_format_nr_1_0; uint32_t n_prb_start = 1; diff --git a/srsue/hdr/phy/lte/worker_pool.h b/srsue/hdr/phy/lte/worker_pool.h index 0a3a4adec..02865c3ad 100644 --- a/srsue/hdr/phy/lte/worker_pool.h +++ b/srsue/hdr/phy/lte/worker_pool.h @@ -19,8 +19,8 @@ * */ -#ifndef SRSLTE_WORKER_POOL_H -#define SRSLTE_WORKER_POOL_H +#ifndef SRSUE_LTE_WORKER_POOL_H +#define SRSUE_LTE_WORKER_POOL_H #include "sf_worker.h" #include "srslte/common/thread_pool.h" @@ -51,4 +51,4 @@ public: } // namespace lte } // namespace srsue -#endif // SRSLTE_WORKER_POOL_H +#endif // SRSUE_LTE_WORKER_POOL_H