+#else
+ RTE_SET_USED(q);
+ RTE_SET_USED(op);
+ RTE_SET_USED(c);
+ RTE_SET_USED(k);
+ RTE_SET_USED(kw);
+ RTE_SET_USED(m_in);
+ RTE_SET_USED(m_out_head);
+ RTE_SET_USED(m_out);
+ RTE_SET_USED(in_offset);
+ RTE_SET_USED(out_offset);
+ RTE_SET_USED(check_crc_24b);
+ RTE_SET_USED(crc24_overlap);
+ RTE_SET_USED(in_length);
+ RTE_SET_USED(q_stats);
+#endif
+}
+
+static inline void
+process_ldpc_dec_cb(struct turbo_sw_queue *q, struct rte_bbdev_dec_op *op,
+ uint8_t c, uint16_t out_length, uint16_t e,
+ struct rte_mbuf *m_in,
+ struct rte_mbuf *m_out_head, struct rte_mbuf *m_out,
+ struct rte_mbuf *m_harq_in,
+ struct rte_mbuf *m_harq_out_head, struct rte_mbuf *m_harq_out,
+ uint16_t in_offset, uint16_t out_offset,
+ uint16_t harq_in_offset, uint16_t harq_out_offset,
+ bool check_crc_24b,
+ uint16_t crc24_overlap, uint16_t in_length,
+ struct rte_bbdev_stats *q_stats)
+{
+#ifdef RTE_BBDEV_SDK_AVX512
+ RTE_SET_USED(in_length);
+ RTE_SET_USED(c);
+ uint8_t *in, *out, *harq_in, *harq_out, *adapter_input;
+ struct bblib_rate_dematching_5gnr_request derm_req;
+ struct bblib_rate_dematching_5gnr_response derm_resp;
+ struct bblib_ldpc_decoder_5gnr_request dec_req;
+ struct bblib_ldpc_decoder_5gnr_response dec_resp;
+ struct bblib_crc_request crc_req;
+ struct bblib_crc_response crc_resp;
+ struct rte_bbdev_op_ldpc_dec *dec = &op->ldpc_dec;
+ uint16_t K, parity_offset, sys_cols, outLenWithCrc;
+ int16_t deRmOutSize, numRows;
+
+ /* Compute some LDPC BG lengths */
+ outLenWithCrc = out_length + (crc24_overlap >> 3);
+ sys_cols = (dec->basegraph == 1) ? 22 : 10;
+ K = sys_cols * dec->z_c;
+ parity_offset = K - 2 * dec->z_c;
+
+#ifdef RTE_BBDEV_OFFLOAD_COST
+ uint64_t start_time = rte_rdtsc_precise();
+#else
+ RTE_SET_USED(q_stats);
+#endif
+
+ in = rte_pktmbuf_mtod_offset(m_in, uint8_t *, in_offset);
+
+ if (check_bit(dec->op_flags, RTE_BBDEV_LDPC_HQ_COMBINE_IN_ENABLE)) {
+ /**
+ * Single contiguous block from the first LLR of the
+ * circular buffer.
+ */
+ harq_in = NULL;
+ if (m_harq_in != NULL)
+ harq_in = rte_pktmbuf_mtod_offset(m_harq_in,
+ uint8_t *, harq_in_offset);
+ if (harq_in == NULL) {
+ op->status |= 1 << RTE_BBDEV_DATA_ERROR;
+ rte_bbdev_log(ERR, "No space in harq input mbuf");
+ return;
+ }
+ uint16_t harq_in_length = RTE_MIN(
+ dec->harq_combined_input.length,
+ (uint32_t) dec->n_cb);
+ memset(q->ag + harq_in_length, 0,
+ dec->n_cb - harq_in_length);
+ rte_memcpy(q->ag, harq_in, harq_in_length);
+ }
+
+ derm_req.p_in = (int8_t *) in;
+ derm_req.p_harq = q->ag; /* This doesn't include the filler bits */
+ derm_req.base_graph = dec->basegraph;
+ derm_req.zc = dec->z_c;
+ derm_req.ncb = dec->n_cb;
+ derm_req.e = e;
+ derm_req.k0 = 0; /* Actual output from SDK */
+ derm_req.isretx = check_bit(dec->op_flags,
+ RTE_BBDEV_LDPC_HQ_COMBINE_IN_ENABLE);
+ derm_req.rvid = dec->rv_index;
+ derm_req.modulation_order = dec->q_m;
+ derm_req.start_null_index = parity_offset - dec->n_filler;
+ derm_req.num_of_null = dec->n_filler;
+
+ bblib_rate_dematching_5gnr(&derm_req, &derm_resp);
+
+ /* Compute RM out size and number of rows */
+ deRmOutSize = RTE_MIN(
+ derm_req.k0 + derm_req.e -
+ ((derm_req.k0 < derm_req.start_null_index) ?
+ 0 : dec->n_filler),
+ dec->n_cb - dec->n_filler);
+ if (m_harq_in != NULL)
+ deRmOutSize = RTE_MAX(deRmOutSize,
+ RTE_MIN(dec->n_cb - dec->n_filler,
+ m_harq_in->data_len));
+ numRows = ((deRmOutSize + dec->n_filler + dec->z_c - 1) / dec->z_c)
+ - sys_cols + 2;
+ numRows = RTE_MAX(4, numRows);
+
+ /* get output data starting address */
+ out = (uint8_t *)mbuf_append(m_out_head, m_out, out_length);
+ if (out == NULL) {
+ op->status |= 1 << RTE_BBDEV_DATA_ERROR;
+ rte_bbdev_log(ERR,
+ "Too little space in LDPC decoder output mbuf");
+ return;
+ }
+
+ /* rte_bbdev_op_data.offset can be different than the offset
+ * of the appended bytes
+ */
+ out = rte_pktmbuf_mtod_offset(m_out, uint8_t *, out_offset);
+ adapter_input = q->enc_out;
+
+ dec_req.Zc = dec->z_c;
+ dec_req.baseGraph = dec->basegraph;
+ dec_req.nRows = numRows;
+ dec_req.numChannelLlrs = deRmOutSize;
+ dec_req.varNodes = derm_req.p_harq;
+ dec_req.numFillerBits = dec->n_filler;
+ dec_req.maxIterations = dec->iter_max;
+ dec_req.enableEarlyTermination = check_bit(dec->op_flags,
+ RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE);
+ dec_resp.varNodes = (int16_t *) q->adapter_output;
+ dec_resp.compactedMessageBytes = q->enc_out;
+
+ bblib_ldpc_decoder_5gnr(&dec_req, &dec_resp);
+
+ dec->iter_count = RTE_MAX(dec_resp.iterationAtTermination,
+ dec->iter_count);
+ if (!dec_resp.parityPassedAtTermination)
+ op->status |= 1 << RTE_BBDEV_SYNDROME_ERROR;
+
+ bblib_bit_reverse((int8_t *) q->enc_out, outLenWithCrc << 3);
+
+ if (check_bit(dec->op_flags, RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK) ||
+ check_bit(dec->op_flags,
+ RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK)) {
+ crc_req.data = adapter_input;
+ crc_req.len = K - dec->n_filler - 24;
+ crc_resp.check_passed = false;
+ crc_resp.data = adapter_input;
+ if (check_crc_24b)
+ bblib_lte_crc24b_check(&crc_req, &crc_resp);
+ else
+ bblib_lte_crc24a_check(&crc_req, &crc_resp);
+ if (!crc_resp.check_passed)
+ op->status |= 1 << RTE_BBDEV_CRC_ERROR;
+ }
+
+#ifdef RTE_BBDEV_OFFLOAD_COST
+ q_stats->acc_offload_cycles += rte_rdtsc_precise() - start_time;
+#endif
+ if (check_bit(dec->op_flags, RTE_BBDEV_LDPC_HQ_COMBINE_OUT_ENABLE)) {
+ harq_out = NULL;
+ if (m_harq_out != NULL) {
+ /* Initialize HARQ data length since we overwrite */
+ m_harq_out->data_len = 0;
+ /* Check there is enough space
+ * in the HARQ outbound buffer
+ */
+ harq_out = (uint8_t *)mbuf_append(m_harq_out_head,
+ m_harq_out, deRmOutSize);
+ }
+ if (harq_out == NULL) {
+ op->status |= 1 << RTE_BBDEV_DATA_ERROR;
+ rte_bbdev_log(ERR, "No space in HARQ output mbuf");
+ return;
+ }
+ /* get output data starting address and overwrite the data */
+ harq_out = rte_pktmbuf_mtod_offset(m_harq_out, uint8_t *,
+ harq_out_offset);
+ rte_memcpy(harq_out, derm_req.p_harq, deRmOutSize);
+ dec->harq_combined_output.length += deRmOutSize;
+ }
+
+ rte_memcpy(out, adapter_input, out_length);
+ dec->hard_output.length += out_length;
+#else
+ RTE_SET_USED(q);
+ RTE_SET_USED(op);
+ RTE_SET_USED(c);
+ RTE_SET_USED(out_length);
+ RTE_SET_USED(e);
+ RTE_SET_USED(m_in);
+ RTE_SET_USED(m_out_head);
+ RTE_SET_USED(m_out);
+ RTE_SET_USED(m_harq_in);
+ RTE_SET_USED(m_harq_out_head);
+ RTE_SET_USED(m_harq_out);
+ RTE_SET_USED(harq_in_offset);
+ RTE_SET_USED(harq_out_offset);
+ RTE_SET_USED(in_offset);
+ RTE_SET_USED(out_offset);
+ RTE_SET_USED(check_crc_24b);
+ RTE_SET_USED(crc24_overlap);
+ RTE_SET_USED(in_length);
+ RTE_SET_USED(q_stats);
+#endif