MCPcopy Create free account
hub / github.com/F-Stack/f-stack / transform_enc_out_dec_in

Function transform_enc_out_dec_in

dpdk/examples/bbdev_app/main.c:376–426  ·  view source on GitHub ↗

Encoder output to Decoder input adapter. The Decoder accepts only soft input * so each bit of the encoder output must be translated into one byte of LLR. If * Sub-block Deinterleaver is bypassed, which is the case, the padding bytes * must additionally be inserted at the end of each sub-block. */

Source from the content-addressed store, hash-verified

374 * must additionally be inserted at the end of each sub-block.
375 */
376static inline void
377transform_enc_out_dec_in(struct rte_mbuf **mbufs, uint8_t *temp_buf,
378 uint16_t num_pkts, uint16_t k)
379{
380 uint16_t i, l, j;
381 uint16_t start_bit_idx;
382 uint16_t out_idx;
383 uint16_t d = k + 4;
384 uint16_t kpi = RTE_ALIGN_CEIL(d, 32);
385 uint16_t nd = kpi - d;
386 uint16_t ncb = 3 * kpi;
387
388 for (i = 0; i < num_pkts; ++i) {
389 uint16_t pkt_data_len = rte_pktmbuf_data_len(mbufs[i]) -
390 sizeof(struct rte_ether_hdr);
391
392 /* Resize the packet if needed */
393 if (pkt_data_len < ncb) {
394 char *data = rte_pktmbuf_append(mbufs[i],
395 ncb - pkt_data_len);
396 if (data == NULL)
397 printf(
398 "Not enough space in decoder input packet");
399 }
400
401 /* Translate each bit into 1 LLR byte. */
402 start_bit_idx = 0;
403 out_idx = 0;
404 for (j = 0; j < 3; ++j) {
405 for (l = start_bit_idx; l < start_bit_idx + d; ++l) {
406 uint8_t *data = rte_pktmbuf_mtod_offset(
407 mbufs[i], uint8_t *,
408 sizeof(struct rte_ether_hdr) +
409 (l >> 3));
410 if (*data & (0x80 >> (l & 7)))
411 temp_buf[out_idx] = LLR_1_BIT;
412 else
413 temp_buf[out_idx] = LLR_0_BIT;
414 ++out_idx;
415 }
416 /* Padding bytes should be at the end of the sub-block.
417 */
418 memset(&temp_buf[out_idx], 0, nd);
419 out_idx += nd;
420 start_bit_idx += d;
421 }
422
423 rte_memcpy(rte_pktmbuf_mtod_offset(mbufs[i], uint8_t *,
424 sizeof(struct rte_ether_hdr)), temp_buf, ncb);
425 }
426}
427
428static inline void
429verify_data(struct rte_mbuf **mbufs, uint16_t num_pkts)

Callers 1

run_decodingFunction · 0.85

Calls 3

rte_pktmbuf_appendFunction · 0.85
memsetFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected