| 196 | } |
| 197 | |
| 198 | static int |
| 199 | eth_pcap_rx_jumbo(struct rte_mempool *mb_pool, struct rte_mbuf *mbuf, |
| 200 | const u_char *data, uint16_t data_len) |
| 201 | { |
| 202 | /* Copy the first segment. */ |
| 203 | uint16_t len = rte_pktmbuf_tailroom(mbuf); |
| 204 | struct rte_mbuf *m = mbuf; |
| 205 | |
| 206 | rte_memcpy(rte_pktmbuf_append(mbuf, len), data, len); |
| 207 | data_len -= len; |
| 208 | data += len; |
| 209 | |
| 210 | while (data_len > 0) { |
| 211 | /* Allocate next mbuf and point to that. */ |
| 212 | m->next = rte_pktmbuf_alloc(mb_pool); |
| 213 | |
| 214 | if (unlikely(!m->next)) |
| 215 | return -1; |
| 216 | |
| 217 | m = m->next; |
| 218 | |
| 219 | /* Headroom is not needed in chained mbufs. */ |
| 220 | rte_pktmbuf_prepend(m, rte_pktmbuf_headroom(m)); |
| 221 | m->pkt_len = 0; |
| 222 | m->data_len = 0; |
| 223 | |
| 224 | /* Copy next segment. */ |
| 225 | len = RTE_MIN(rte_pktmbuf_tailroom(m), data_len); |
| 226 | rte_memcpy(rte_pktmbuf_append(m, len), data, len); |
| 227 | |
| 228 | mbuf->nb_segs++; |
| 229 | data_len -= len; |
| 230 | data += len; |
| 231 | } |
| 232 | |
| 233 | return mbuf->nb_segs; |
| 234 | } |
| 235 | |
| 236 | static uint16_t |
| 237 | eth_pcap_rx_infinite(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) |
no test coverage detected