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. */
| 374 | * must additionally be inserted at the end of each sub-block. |
| 375 | */ |
| 376 | static inline void |
| 377 | transform_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 | |
| 428 | static inline void |
| 429 | verify_data(struct rte_mbuf **mbufs, uint16_t num_pkts) |
no test coverage detected