| 873 | } |
| 874 | |
| 875 | static int |
| 876 | eth_rx_queue_setup(struct rte_eth_dev *dev, |
| 877 | uint16_t rx_queue_id, |
| 878 | uint16_t nb_rx_desc __rte_unused, |
| 879 | unsigned int socket_id __rte_unused, |
| 880 | const struct rte_eth_rxconf *rx_conf __rte_unused, |
| 881 | struct rte_mempool *mb_pool) |
| 882 | { |
| 883 | struct pmd_internals *internals = dev->data->dev_private; |
| 884 | struct pcap_rx_queue *pcap_q = &internals->rx_queue[rx_queue_id]; |
| 885 | |
| 886 | pcap_q->mb_pool = mb_pool; |
| 887 | pcap_q->port_id = dev->data->port_id; |
| 888 | pcap_q->queue_id = rx_queue_id; |
| 889 | dev->data->rx_queues[rx_queue_id] = pcap_q; |
| 890 | |
| 891 | if (internals->infinite_rx) { |
| 892 | struct pmd_process_private *pp; |
| 893 | char ring_name[RTE_RING_NAMESIZE]; |
| 894 | static uint32_t ring_number; |
| 895 | uint64_t pcap_pkt_count = 0; |
| 896 | struct rte_mbuf *bufs[1]; |
| 897 | pcap_t **pcap; |
| 898 | |
| 899 | pp = rte_eth_devices[pcap_q->port_id].process_private; |
| 900 | pcap = &pp->rx_pcap[pcap_q->queue_id]; |
| 901 | |
| 902 | if (unlikely(*pcap == NULL)) |
| 903 | return -ENOENT; |
| 904 | |
| 905 | pcap_pkt_count = count_packets_in_pcap(pcap, pcap_q); |
| 906 | |
| 907 | snprintf(ring_name, sizeof(ring_name), "PCAP_RING%" PRIu32, |
| 908 | ring_number); |
| 909 | |
| 910 | pcap_q->pkts = rte_ring_create(ring_name, |
| 911 | rte_align64pow2(pcap_pkt_count + 1), 0, |
| 912 | RING_F_SP_ENQ | RING_F_SC_DEQ); |
| 913 | ring_number++; |
| 914 | if (!pcap_q->pkts) |
| 915 | return -ENOENT; |
| 916 | |
| 917 | /* Fill ring with packets from PCAP file one by one. */ |
| 918 | while (eth_pcap_rx(pcap_q, bufs, 1)) { |
| 919 | /* Check for multiseg mbufs. */ |
| 920 | if (bufs[0]->nb_segs != 1) { |
| 921 | infinite_rx_ring_free(pcap_q->pkts); |
| 922 | PMD_LOG(ERR, |
| 923 | "Multiseg mbufs are not supported in infinite_rx mode."); |
| 924 | return -EINVAL; |
| 925 | } |
| 926 | |
| 927 | rte_ring_enqueue_bulk(pcap_q->pkts, |
| 928 | (void * const *)bufs, 1, NULL); |
| 929 | } |
| 930 | |
| 931 | if (rte_ring_count(pcap_q->pkts) < pcap_pkt_count) { |
| 932 | infinite_rx_ring_free(pcap_q->pkts); |
nothing calls this directly
no test coverage detected