| 683 | } |
| 684 | |
| 685 | static inline void |
| 686 | run_encoding(struct lcore_conf *lcore_conf) |
| 687 | { |
| 688 | uint16_t i; |
| 689 | uint16_t port_id, rx_queue_id; |
| 690 | uint16_t bbdev_id, enc_queue_id; |
| 691 | uint16_t nb_rx, nb_enq, nb_deq, nb_sent; |
| 692 | struct rte_mbuf *rx_pkts_burst[MAX_PKT_BURST]; |
| 693 | struct rte_mbuf *enc_out_pkts[MAX_PKT_BURST]; |
| 694 | struct rte_bbdev_enc_op *bbdev_ops_burst[MAX_PKT_BURST]; |
| 695 | struct lcore_statistics *lcore_stats; |
| 696 | struct rte_mempool *bbdev_op_pool, *enc_out_pool; |
| 697 | struct rte_ring *enc_to_dec_ring; |
| 698 | const int in_data_len = (def_op_enc.cb_params.k / 8) - CRC_24B_LEN; |
| 699 | |
| 700 | lcore_stats = lcore_conf->lcore_stats; |
| 701 | port_id = lcore_conf->port_id; |
| 702 | rx_queue_id = lcore_conf->rx_queue_id; |
| 703 | bbdev_id = lcore_conf->bbdev_id; |
| 704 | enc_queue_id = lcore_conf->enc_queue_id; |
| 705 | bbdev_op_pool = lcore_conf->bbdev_enc_op_pool; |
| 706 | enc_out_pool = lcore_conf->enc_out_pool; |
| 707 | enc_to_dec_ring = lcore_conf->enc_to_dec_ring; |
| 708 | |
| 709 | /* Read packet from RX queues*/ |
| 710 | nb_rx = rte_eth_rx_burst(port_id, rx_queue_id, rx_pkts_burst, |
| 711 | MAX_PKT_BURST); |
| 712 | if (!nb_rx) |
| 713 | return; |
| 714 | |
| 715 | if (unlikely(rte_mempool_get_bulk(enc_out_pool, (void **)enc_out_pkts, |
| 716 | nb_rx) != 0)) { |
| 717 | pktmbuf_free_bulk(rx_pkts_burst, nb_rx); |
| 718 | lcore_stats->rx_lost_packets += nb_rx; |
| 719 | return; |
| 720 | } |
| 721 | |
| 722 | if (unlikely(rte_bbdev_enc_op_alloc_bulk(bbdev_op_pool, bbdev_ops_burst, |
| 723 | nb_rx) != 0)) { |
| 724 | pktmbuf_free_bulk(enc_out_pkts, nb_rx); |
| 725 | pktmbuf_free_bulk(rx_pkts_burst, nb_rx); |
| 726 | lcore_stats->rx_lost_packets += nb_rx; |
| 727 | return; |
| 728 | } |
| 729 | |
| 730 | for (i = 0; i < nb_rx; i++) { |
| 731 | char *data; |
| 732 | const uint16_t pkt_data_len = |
| 733 | rte_pktmbuf_data_len(rx_pkts_burst[i]) - |
| 734 | sizeof(struct rte_ether_hdr); |
| 735 | /* save input mbuf pointer for later comparison */ |
| 736 | *mbuf_input(enc_out_pkts[i]) = rx_pkts_burst[i]; |
| 737 | |
| 738 | /* copy ethernet header */ |
| 739 | rte_pktmbuf_reset(enc_out_pkts[i]); |
| 740 | data = rte_pktmbuf_append(enc_out_pkts[i], |
| 741 | sizeof(struct rte_ether_hdr)); |
| 742 | if (data == NULL) { |
no test coverage detected