| 83 | } |
| 84 | |
| 85 | static int |
| 86 | reader_pkt_rx(void *port, struct rte_swx_pkt *pkt) |
| 87 | { |
| 88 | struct reader *p = port; |
| 89 | struct rte_mbuf *m; |
| 90 | |
| 91 | if (p->pos == p->n_pkts) { |
| 92 | int n_pkts; |
| 93 | |
| 94 | n_pkts = rte_eth_rx_burst(p->params.port_id, |
| 95 | p->params.queue_id, |
| 96 | p->pkts, |
| 97 | p->params.burst_size); |
| 98 | if (!n_pkts) { |
| 99 | p->stats.n_empty++; |
| 100 | return 0; |
| 101 | } |
| 102 | |
| 103 | TRACE("[Ethdev RX port %u queue %u] %d packets in\n", |
| 104 | (uint32_t)p->params.port_id, |
| 105 | (uint32_t)p->params.queue_id, |
| 106 | n_pkts); |
| 107 | |
| 108 | p->n_pkts = n_pkts; |
| 109 | p->pos = 0; |
| 110 | } |
| 111 | |
| 112 | m = p->pkts[p->pos++]; |
| 113 | pkt->handle = m; |
| 114 | pkt->pkt = m->buf_addr; |
| 115 | pkt->offset = m->data_off; |
| 116 | pkt->length = m->pkt_len; |
| 117 | |
| 118 | TRACE("[Ethdev RX port %u queue %u] Pkt %d (%u bytes at offset %u)\n", |
| 119 | (uint32_t)p->params.port_id, |
| 120 | (uint32_t)p->params.queue_id, |
| 121 | p->pos - 1, |
| 122 | pkt->length, |
| 123 | pkt->offset); |
| 124 | if (TRACE_LEVEL) |
| 125 | rte_hexdump(stdout, |
| 126 | NULL, |
| 127 | &((uint8_t *)m->buf_addr)[m->data_off], |
| 128 | m->data_len); |
| 129 | |
| 130 | p->stats.n_pkts++; |
| 131 | p->stats.n_bytes += pkt->length; |
| 132 | |
| 133 | return 1; |
| 134 | } |
| 135 | |
| 136 | static void |
| 137 | reader_free(void *port) |
nothing calls this directly
no test coverage detected