+static int
+eth_pcap_rx_jumbo(struct rte_mempool *mb_pool,
+ struct rte_mbuf *mbuf,
+ const u_char *data,
+ uint16_t data_len)
+{
+ struct rte_mbuf *m = mbuf;
+
+ /* Copy the first segment. */
+ uint16_t len = rte_pktmbuf_tailroom(mbuf);
+
+ rte_memcpy(rte_pktmbuf_append(mbuf, len), data, len);
+ data_len -= len;
+ data += len;
+
+ while (data_len > 0) {
+ /* Allocate next mbuf and point to that. */
+ m->next = rte_pktmbuf_alloc(mb_pool);
+
+ if (unlikely(!m->next))
+ return -1;
+
+ m = m->next;
+
+ /* Headroom is not needed in chained mbufs. */
+ rte_pktmbuf_prepend(m, rte_pktmbuf_headroom(m));
+ m->pkt_len = 0;
+ m->data_len = 0;
+
+ /* Copy next segment. */
+ len = RTE_MIN(rte_pktmbuf_tailroom(m), data_len);
+ rte_memcpy(rte_pktmbuf_append(m, len), data, len);
+
+ mbuf->nb_segs++;
+ data_len -= len;
+ data += len;
+ }
+
+ return mbuf->nb_segs;
+}
+
+/* Copy data from mbuf chain to a buffer suitable for writing to a PCAP file. */
+static void
+eth_pcap_gather_data(unsigned char *data, struct rte_mbuf *mbuf)
+{
+ uint16_t data_len = 0;
+
+ while (mbuf) {
+ rte_memcpy(data + data_len, rte_pktmbuf_mtod(mbuf, void *),
+ mbuf->data_len);
+
+ data_len += mbuf->data_len;
+ mbuf = mbuf->next;
+ }
+}