From aa9cd6394ab16e07471463773872e061d8f8c0b7 Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Tue, 19 Dec 2023 16:01:38 +0100 Subject: [PATCH] T2: Enable LDPC encoding offload for all MCS - Rate matching performed by card - Due to rate matching on card, small TBs are encoded correctly, so the limitation of encoding small TBs in CPU can be lifted (all TBs encoded on T2), see a later commits --- .../nrLDPC_decoder/nrLDPC_decoder_offload.c | 14 ++++++------- openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c | 21 ++++--------------- 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_offload.c b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_offload.c index 1f2163ca5e..eac85186f7 100644 --- a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_offload.c +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_offload.c @@ -568,14 +568,14 @@ static void set_ldpc_enc_op(struct rte_bbdev_enc_op **ops, { // struct rte_bbdev_op_ldpc_enc *ldpc_enc = &ref_op->ldpc_enc; for (int i = 0; i < n; ++i) { - ops[i]->ldpc_enc.cb_params.e = 3 * p_offloadParams->E; // Fix mee: what is the correct size for "e" ??? + ops[i]->ldpc_enc.cb_params.e = p_offloadParams->E; ops[i]->ldpc_enc.basegraph = p_offloadParams->BG; ops[i]->ldpc_enc.z_c = p_offloadParams->Z; ops[i]->ldpc_enc.q_m = p_offloadParams->Qm; ops[i]->ldpc_enc.n_filler = p_offloadParams->F; ops[i]->ldpc_enc.n_cb = p_offloadParams->n_cb; ops[i]->ldpc_enc.rv_index = p_offloadParams->rv; - ops[i]->ldpc_enc.op_flags = RTE_BBDEV_LDPC_INTERLEAVER_BYPASS; // RTE_BBDEV_LDPC_RATE_MATCH; + ops[i]->ldpc_enc.op_flags = RTE_BBDEV_LDPC_INTERLEAVER_BYPASS | RTE_BBDEV_LDPC_RATE_MATCH; ops[i]->ldpc_enc.code_block_mode = 1; ops[i]->ldpc_enc.output = outputs[start_idx + i]; ops[i]->ldpc_enc.input = inputs[start_idx + i]; @@ -613,7 +613,7 @@ static int retrieve_ldpc_enc_op(struct rte_bbdev_enc_op **ops, const uint16_t n, for (i = 0; i < n; ++i) { output = &ops[i]->ldpc_enc.output; m = output->data; - uint16_t data_len = min((384 * 68) / 8, rte_pktmbuf_data_len(m)); // fix me + uint16_t data_len = min((LDPC_MAX_CB_SIZE) / 8, rte_pktmbuf_data_len(m)); // fix me data = m->buf_addr; for (int byte = 0; byte < data_len; byte++) for (int bit = 0; bit < 8; bit++) @@ -1103,10 +1103,10 @@ int32_t LDPCencoder(unsigned char **input, unsigned char **output, encoder_imple .n_cb = (BG == 1) ? (66 * Zc) : (50 * Zc), .BG = BG, .Z = Zc, - .rv = 0, //impp->rv, - .F = 0, //impp->F, + .rv = impp->rv, + .F = impp->F, .Qm = impp->Qm, - .Kr = impp->Kr}; + .Kr = (impp->K - impp->F + 7)/8}; struct rte_bbdev_info info; rte_bbdev_info_get(ad->dev_id, &info); int socket_id = GET_SOCKET(info.socket_id); @@ -1126,7 +1126,7 @@ int32_t LDPCencoder(unsigned char **input, unsigned char **output, encoder_imple for (enum op_data_type type = DATA_INPUT; type < 3; type += 2) { int ret = init_op_data_objs(*queue_ops[type], *input, - (offloadParams.Kr + 7) / 8, + offloadParams.Kr, m_head[type], mbuf_pools[type], 1, diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c index 04a320be24..730aee9377 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c @@ -363,7 +363,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, impp.tparity = tparity; impp.toutput = toutput; impp.harq = harq; - if (gNB->ldpc_offload_flag && *rel15->mcsIndex > 2) { + if (gNB->ldpc_offload_flag) { impp.Qm = rel15->qamModOrder[0]; impp.rv = rel15->rvIndex[0]; int nb_re_dmrs = @@ -375,25 +375,12 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, harq->unav_res, rel15->qamModOrder[0], rel15->nrOfLayers); - uint8_t tmp[68 * 384] __attribute__((aligned(32))); - uint8_t *d = tmp; + uint8_t tmp[BBDEV_LDPC_MAX_E] __attribute__((aligned(32))); + uint8_t *e = tmp; int r_offset = 0; for (int r = 0; r < impp.n_segments; r++) { impp.E = nr_get_E(impp.G, impp.n_segments, impp.Qm, rel15->nrOfLayers, r); - impp.Kr = impp.K; - ldpc_interface_offload.LDPCencoder(&harq->c[r], &d, &impp); - uint8_t e[impp.E]; - bzero(e, impp.E); - nr_rate_matching_ldpc(rel15->maintenance_parms_v3.tbSizeLbrmBytes, - impp.BG, - impp.Zc, - tmp, - e, - impp.n_segments, - impp.F, - impp.K - impp.F - 2 * impp.Zc, - impp.rv, - impp.E); + ldpc_interface_offload.LDPCencoder(&harq->c[r], &e, &impp); nr_interleaving_ldpc(impp.E, impp.Qm, e, impp.output + r_offset); r_offset += impp.E; }