5751585dbaa96d3e2b4316bb6acd5160ea3518a1
[dpdk.git] / drivers / net / ark / ark_ethdev_rx.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2015-2018 Atomic Rules LLC
3  */
4
5 #include <unistd.h>
6
7 #include "ark_ethdev_rx.h"
8 #include "ark_global.h"
9 #include "ark_logs.h"
10 #include "ark_mpu.h"
11 #include "ark_udm.h"
12
13 #define ARK_RX_META_SIZE 32
14 #define ARK_RX_META_OFFSET (RTE_PKTMBUF_HEADROOM - ARK_RX_META_SIZE)
15 #define ARK_RX_MAX_NOCHAIN (RTE_MBUF_DEFAULT_DATAROOM)
16
17 /* Forward declarations */
18 struct ark_rx_queue;
19 struct ark_rx_meta;
20
21 static void dump_mbuf_data(struct rte_mbuf *mbuf, uint16_t lo, uint16_t hi);
22 static void ark_ethdev_rx_dump(const char *name, struct ark_rx_queue *queue);
23 static uint32_t eth_ark_rx_jumbo(struct ark_rx_queue *queue,
24                                  struct ark_rx_meta *meta,
25                                  struct rte_mbuf *mbuf0,
26                                  uint32_t cons_index);
27 static inline int eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue);
28 static int eth_ark_rx_seed_recovery(struct ark_rx_queue *queue,
29                                     uint32_t *pnb,
30                                     struct rte_mbuf **mbufs);
31
32 /* ************************************************************************* */
33 struct ark_rx_queue {
34         /* array of mbufs to populate */
35         struct rte_mbuf **reserve_q;
36         /* array of physical addresses of the mbuf data pointer */
37         /* This point is a virtual address */
38         rte_iova_t *paddress_q;
39         struct rte_mempool *mb_pool;
40
41         struct ark_udm_t *udm;
42         struct ark_mpu_t *mpu;
43
44         uint32_t queue_size;
45         uint32_t queue_mask;
46
47         uint32_t seed_index;            /* step 1 set with empty mbuf */
48         uint32_t cons_index;            /* step 3 consumed by driver */
49
50         /* The queue Id is used to identify the HW Q */
51         uint16_t phys_qid;
52
53         /* The queue Index is used within the dpdk device structures */
54         uint16_t queue_index;
55
56         uint32_t pad1;
57
58         /* separate cache line */
59         /* second cache line - fields only used in slow path */
60         MARKER cacheline1 __rte_cache_min_aligned;
61
62         volatile uint32_t prod_index;   /* step 2 filled by FPGA */
63 } __rte_cache_aligned;
64
65
66 /* ************************************************************************* */
67 static int
68 eth_ark_rx_hw_setup(struct rte_eth_dev *dev,
69                     struct ark_rx_queue *queue,
70                     uint16_t rx_queue_id __rte_unused, uint16_t rx_queue_idx)
71 {
72         rte_iova_t queue_base;
73         rte_iova_t phys_addr_q_base;
74         rte_iova_t phys_addr_prod_index;
75
76         queue_base = rte_malloc_virt2iova(queue);
77         phys_addr_prod_index = queue_base +
78                 offsetof(struct ark_rx_queue, prod_index);
79
80         phys_addr_q_base = rte_malloc_virt2iova(queue->paddress_q);
81
82         /* Verify HW */
83         if (ark_mpu_verify(queue->mpu, sizeof(rte_iova_t))) {
84                 PMD_DRV_LOG(ERR, "Illegal configuration rx queue\n");
85                 return -1;
86         }
87
88         /* Stop and Reset and configure MPU */
89         ark_mpu_configure(queue->mpu, phys_addr_q_base, queue->queue_size, 0);
90
91         ark_udm_write_addr(queue->udm, phys_addr_prod_index);
92
93         /* advance the valid pointer, but don't start until the queue starts */
94         ark_mpu_reset_stats(queue->mpu);
95
96         /* The seed is the producer index for the HW */
97         ark_mpu_set_producer(queue->mpu, queue->seed_index);
98         dev->data->rx_queue_state[rx_queue_idx] = RTE_ETH_QUEUE_STATE_STOPPED;
99
100         return 0;
101 }
102
103 static inline void
104 eth_ark_rx_update_cons_index(struct ark_rx_queue *queue, uint32_t cons_index)
105 {
106         queue->cons_index = cons_index;
107         eth_ark_rx_seed_mbufs(queue);
108         ark_mpu_set_producer(queue->mpu, queue->seed_index);
109 }
110
111 /* ************************************************************************* */
112 int
113 eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
114                            uint16_t queue_idx,
115                            uint16_t nb_desc,
116                            unsigned int socket_id,
117                            const struct rte_eth_rxconf *rx_conf,
118                            struct rte_mempool *mb_pool)
119 {
120         static int warning1;            /* = 0 */
121         struct ark_adapter *ark = (struct ark_adapter *)dev->data->dev_private;
122
123         struct ark_rx_queue *queue;
124         uint32_t i;
125         int status;
126
127         /* Future works: divide the Q's evenly with multi-ports */
128         int port = dev->data->port_id;
129         int qidx = port + queue_idx;
130
131         /* We may already be setup, free memory prior to re-allocation */
132         if (dev->data->rx_queues[queue_idx] != NULL) {
133                 eth_ark_dev_rx_queue_release(dev->data->rx_queues[queue_idx]);
134                 dev->data->rx_queues[queue_idx] = NULL;
135         }
136
137         if (rx_conf != NULL && warning1 == 0) {
138                 warning1 = 1;
139                 PMD_DRV_LOG(INFO,
140                             "Arkville ignores rte_eth_rxconf argument.\n");
141         }
142
143         if (RTE_PKTMBUF_HEADROOM < ARK_RX_META_SIZE) {
144                 PMD_DRV_LOG(ERR,
145                             "Error: DPDK Arkville requires head room > %d bytes (%s)\n",
146                             ARK_RX_META_SIZE, __func__);
147                 return -1;              /* ERROR CODE */
148         }
149
150         if (!rte_is_power_of_2(nb_desc)) {
151                 PMD_DRV_LOG(ERR,
152                             "DPDK Arkville configuration queue size must be power of two %u (%s)\n",
153                             nb_desc, __func__);
154                 return -1;              /* ERROR CODE */
155         }
156
157         /* Allocate queue struct */
158         queue = rte_zmalloc_socket("Ark_rxqueue",
159                                    sizeof(struct ark_rx_queue),
160                                    64,
161                                    socket_id);
162         if (queue == 0) {
163                 PMD_DRV_LOG(ERR, "Failed to allocate memory in %s\n", __func__);
164                 return -ENOMEM;
165         }
166
167         /* NOTE zmalloc is used, no need to 0 indexes, etc. */
168         queue->mb_pool = mb_pool;
169         queue->phys_qid = qidx;
170         queue->queue_index = queue_idx;
171         queue->queue_size = nb_desc;
172         queue->queue_mask = nb_desc - 1;
173
174         queue->reserve_q =
175                 rte_zmalloc_socket("Ark_rx_queue mbuf",
176                                    nb_desc * sizeof(struct rte_mbuf *),
177                                    64,
178                                    socket_id);
179         queue->paddress_q =
180                 rte_zmalloc_socket("Ark_rx_queue paddr",
181                                    nb_desc * sizeof(rte_iova_t),
182                                    64,
183                                    socket_id);
184
185         if (queue->reserve_q == 0 || queue->paddress_q == 0) {
186                 PMD_DRV_LOG(ERR,
187                             "Failed to allocate queue memory in %s\n",
188                             __func__);
189                 rte_free(queue->reserve_q);
190                 rte_free(queue->paddress_q);
191                 rte_free(queue);
192                 return -ENOMEM;
193         }
194
195         dev->data->rx_queues[queue_idx] = queue;
196         queue->udm = RTE_PTR_ADD(ark->udm.v, qidx * ARK_UDM_QOFFSET);
197         queue->mpu = RTE_PTR_ADD(ark->mpurx.v, qidx * ARK_MPU_QOFFSET);
198
199         /* populate mbuf reserve */
200         status = eth_ark_rx_seed_mbufs(queue);
201
202         if (queue->seed_index != nb_desc) {
203                 PMD_DRV_LOG(ERR, "ARK: Failed to allocate %u mbufs for RX queue %d\n",
204                             nb_desc, qidx);
205                 status = -1;
206         }
207         /* MPU Setup */
208         if (status == 0)
209                 status = eth_ark_rx_hw_setup(dev, queue, qidx, queue_idx);
210
211         if (unlikely(status != 0)) {
212                 struct rte_mbuf **mbuf;
213
214                 PMD_DRV_LOG(ERR, "Failed to initialize RX queue %d %s\n",
215                             qidx,
216                             __func__);
217                 /* Free the mbufs allocated */
218                 for (i = 0, mbuf = queue->reserve_q;
219                      i < queue->seed_index; ++i, mbuf++) {
220                         rte_pktmbuf_free(*mbuf);
221                 }
222                 rte_free(queue->reserve_q);
223                 rte_free(queue->paddress_q);
224                 rte_free(queue);
225                 return -1;              /* ERROR CODE */
226         }
227
228         return 0;
229 }
230
231 /* ************************************************************************* */
232 uint16_t
233 eth_ark_recv_pkts_noop(void *rx_queue __rte_unused,
234                        struct rte_mbuf **rx_pkts __rte_unused,
235                        uint16_t nb_pkts __rte_unused)
236 {
237         return 0;
238 }
239
240 /* ************************************************************************* */
241 uint16_t
242 eth_ark_recv_pkts(void *rx_queue,
243                   struct rte_mbuf **rx_pkts,
244                   uint16_t nb_pkts)
245 {
246         struct ark_rx_queue *queue;
247         register uint32_t cons_index, prod_index;
248         uint16_t nb;
249         struct rte_mbuf *mbuf;
250         struct ark_rx_meta *meta;
251
252         queue = (struct ark_rx_queue *)rx_queue;
253         if (unlikely(queue == 0))
254                 return 0;
255         if (unlikely(nb_pkts == 0))
256                 return 0;
257         prod_index = queue->prod_index;
258         cons_index = queue->cons_index;
259         nb = 0;
260
261         while (prod_index != cons_index) {
262                 mbuf = queue->reserve_q[cons_index & queue->queue_mask];
263                 /* prefetch mbuf */
264                 rte_mbuf_prefetch_part1(mbuf);
265                 rte_mbuf_prefetch_part2(mbuf);
266
267                 /* META DATA embedded in headroom */
268                 meta = RTE_PTR_ADD(mbuf->buf_addr, ARK_RX_META_OFFSET);
269
270                 mbuf->port = meta->port;
271                 mbuf->pkt_len = meta->pkt_len;
272                 mbuf->data_len = meta->pkt_len;
273                 mbuf->timestamp = meta->timestamp;
274                 mbuf->udata64 = meta->user_data;
275
276                 if (ARK_RX_DEBUG) {     /* debug sanity checks */
277                         if ((meta->pkt_len > (1024 * 16)) ||
278                             (meta->pkt_len == 0)) {
279                                 PMD_RX_LOG(DEBUG, "RX: Bad Meta Q: %u"
280                                            " cons: %" PRIU32
281                                            " prod: %" PRIU32
282                                            " seed_index %" PRIU32
283                                            "\n",
284                                            queue->phys_qid,
285                                            cons_index,
286                                            queue->prod_index,
287                                            queue->seed_index);
288
289
290                                 PMD_RX_LOG(DEBUG, "       :  UDM"
291                                            " prod: %" PRIU32
292                                            " len: %u\n",
293                                            queue->udm->rt_cfg.prod_idx,
294                                            meta->pkt_len);
295                                 ark_mpu_dump(queue->mpu,
296                                              "    ",
297                                              queue->phys_qid);
298                                 dump_mbuf_data(mbuf, 0, 256);
299                                 /* its FUBAR so fix it */
300                                 mbuf->pkt_len = 63;
301                                 meta->pkt_len = 63;
302                         }
303                         /* seqn is only set under debug */
304                         mbuf->seqn = cons_index;
305                 }
306
307                 if (unlikely(meta->pkt_len > ARK_RX_MAX_NOCHAIN))
308                         cons_index = eth_ark_rx_jumbo
309                                 (queue, meta, mbuf, cons_index + 1);
310                 else
311                         cons_index += 1;
312
313                 rx_pkts[nb] = mbuf;
314                 nb++;
315                 if (nb >= nb_pkts)
316                         break;
317         }
318
319         if (unlikely(nb != 0))
320                 /* report next free to FPGA */
321                 eth_ark_rx_update_cons_index(queue, cons_index);
322
323         return nb;
324 }
325
326 /* ************************************************************************* */
327 static uint32_t
328 eth_ark_rx_jumbo(struct ark_rx_queue *queue,
329                  struct ark_rx_meta *meta,
330                  struct rte_mbuf *mbuf0,
331                  uint32_t cons_index)
332 {
333         struct rte_mbuf *mbuf_prev;
334         struct rte_mbuf *mbuf;
335
336         uint16_t remaining;
337         uint16_t data_len;
338         uint16_t segments;
339
340         /* first buf populated by called */
341         mbuf_prev = mbuf0;
342         segments = 1;
343         data_len = RTE_MIN(meta->pkt_len, RTE_MBUF_DEFAULT_DATAROOM);
344         remaining = meta->pkt_len - data_len;
345         mbuf0->data_len = data_len;
346
347         /* HW guarantees that the data does not exceed prod_index! */
348         while (remaining != 0) {
349                 data_len = RTE_MIN(remaining,
350                                    RTE_MBUF_DEFAULT_DATAROOM +
351                                    RTE_PKTMBUF_HEADROOM);
352
353                 remaining -= data_len;
354                 segments += 1;
355
356                 mbuf = queue->reserve_q[cons_index & queue->queue_mask];
357                 mbuf_prev->next = mbuf;
358                 mbuf_prev = mbuf;
359                 mbuf->data_len = data_len;
360                 mbuf->data_off = 0;
361                 if (ARK_RX_DEBUG)
362                         mbuf->seqn = cons_index;        /* for debug only */
363
364                 cons_index += 1;
365         }
366
367         mbuf0->nb_segs = segments;
368         return cons_index;
369 }
370
371 /* Drain the internal queue allowing hw to clear out. */
372 static void
373 eth_ark_rx_queue_drain(struct ark_rx_queue *queue)
374 {
375         register uint32_t cons_index;
376         struct rte_mbuf *mbuf;
377
378         cons_index = queue->cons_index;
379
380         /* NOT performance optimized, since this is a one-shot call */
381         while ((cons_index ^ queue->prod_index) & queue->queue_mask) {
382                 mbuf = queue->reserve_q[cons_index & queue->queue_mask];
383                 rte_pktmbuf_free(mbuf);
384                 cons_index++;
385                 eth_ark_rx_update_cons_index(queue, cons_index);
386         }
387 }
388
389 uint32_t
390 eth_ark_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t queue_id)
391 {
392         struct ark_rx_queue *queue;
393
394         queue = dev->data->rx_queues[queue_id];
395         return (queue->prod_index - queue->cons_index); /* mod arith */
396 }
397
398 /* ************************************************************************* */
399 int
400 eth_ark_rx_start_queue(struct rte_eth_dev *dev, uint16_t queue_id)
401 {
402         struct ark_rx_queue *queue;
403
404         queue = dev->data->rx_queues[queue_id];
405         if (queue == 0)
406                 return -1;
407
408         dev->data->rx_queue_state[queue_id] = RTE_ETH_QUEUE_STATE_STARTED;
409
410         ark_mpu_set_producer(queue->mpu, queue->seed_index);
411         ark_mpu_start(queue->mpu);
412
413         ark_udm_queue_enable(queue->udm, 1);
414
415         return 0;
416 }
417
418 /* ************************************************************************* */
419
420 /* Queue can be restarted.   data remains
421  */
422 int
423 eth_ark_rx_stop_queue(struct rte_eth_dev *dev, uint16_t queue_id)
424 {
425         struct ark_rx_queue *queue;
426
427         queue = dev->data->rx_queues[queue_id];
428         if (queue == 0)
429                 return -1;
430
431         ark_udm_queue_enable(queue->udm, 0);
432
433         dev->data->rx_queue_state[queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
434
435         return 0;
436 }
437
438 /* ************************************************************************* */
439 static inline int
440 eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue)
441 {
442         uint32_t limit = queue->cons_index + queue->queue_size;
443         uint32_t seed_index = queue->seed_index;
444
445         uint32_t count = 0;
446         uint32_t seed_m = queue->seed_index & queue->queue_mask;
447
448         uint32_t nb = limit - seed_index;
449
450         /* Handle wrap around -- remainder is filled on the next call */
451         if (unlikely(seed_m + nb > queue->queue_size))
452                 nb = queue->queue_size - seed_m;
453
454         struct rte_mbuf **mbufs = &queue->reserve_q[seed_m];
455         int status = rte_pktmbuf_alloc_bulk(queue->mb_pool, mbufs, nb);
456
457         if (unlikely(status != 0)) {
458                 /* Try to recover from lack of mbufs in pool */
459                 status = eth_ark_rx_seed_recovery(queue, &nb, mbufs);
460                 if (unlikely(status != 0)) {
461                         return -1;
462                 }
463         }
464
465         if (ARK_RX_DEBUG) {             /* DEBUG */
466                 while (count != nb) {
467                         struct rte_mbuf *mbuf_init =
468                                 queue->reserve_q[seed_m + count];
469
470                         memset(mbuf_init->buf_addr, -1, 512);
471                         *((uint32_t *)mbuf_init->buf_addr) =
472                                 seed_index + count;
473                         *(uint16_t *)RTE_PTR_ADD(mbuf_init->buf_addr, 4) =
474                                 queue->phys_qid;
475                         count++;
476                 }
477                 count = 0;
478         } /* DEBUG */
479         queue->seed_index += nb;
480
481         /* Duff's device https://en.wikipedia.org/wiki/Duff's_device */
482         switch (nb % 4) {
483         case 0:
484                 while (count != nb) {
485                         queue->paddress_q[seed_m++] =
486                                 (*mbufs++)->buf_iova;
487                         count++;
488                 /* FALLTHROUGH */
489         case 3:
490                 queue->paddress_q[seed_m++] =
491                         (*mbufs++)->buf_iova;
492                 count++;
493                 /* FALLTHROUGH */
494         case 2:
495                 queue->paddress_q[seed_m++] =
496                         (*mbufs++)->buf_iova;
497                 count++;
498                 /* FALLTHROUGH */
499         case 1:
500                 queue->paddress_q[seed_m++] =
501                         (*mbufs++)->buf_iova;
502                 count++;
503                 /* FALLTHROUGH */
504
505                 } /* while (count != nb) */
506         } /* switch */
507
508         return 0;
509 }
510
511 int
512 eth_ark_rx_seed_recovery(struct ark_rx_queue *queue,
513                          uint32_t *pnb,
514                          struct rte_mbuf **mbufs)
515 {
516         int status = -1;
517
518         /* Ignore small allocation failures */
519         if (*pnb <= 64)
520                 return -1;
521
522         *pnb = 64U;
523         status = rte_pktmbuf_alloc_bulk(queue->mb_pool, mbufs, *pnb);
524         if (status != 0) {
525                 PMD_DRV_LOG(ERR,
526                             "ARK: Could not allocate %u mbufs from pool for RX queue %u;"
527                             " %u free buffers remaining in queue\n",
528                             *pnb, queue->queue_index,
529                             queue->seed_index - queue->cons_index);
530         }
531         return status;
532 }
533
534 void
535 eth_ark_rx_dump_queue(struct rte_eth_dev *dev, uint16_t queue_id,
536                       const char *msg)
537 {
538         struct ark_rx_queue *queue;
539
540         queue = dev->data->rx_queues[queue_id];
541
542         ark_ethdev_rx_dump(msg, queue);
543 }
544
545 /* ************************************************************************* */
546 /* Call on device closed no user API, queue is stopped */
547 void
548 eth_ark_dev_rx_queue_release(void *vqueue)
549 {
550         struct ark_rx_queue *queue;
551         uint32_t i;
552
553         queue = (struct ark_rx_queue *)vqueue;
554         if (queue == 0)
555                 return;
556
557         ark_udm_queue_enable(queue->udm, 0);
558         /* Stop the MPU since pointer are going away */
559         ark_mpu_stop(queue->mpu);
560
561         /* Need to clear out mbufs here, dropping packets along the way */
562         eth_ark_rx_queue_drain(queue);
563
564         for (i = 0; i < queue->queue_size; ++i)
565                 rte_pktmbuf_free(queue->reserve_q[i]);
566
567         rte_free(queue->reserve_q);
568         rte_free(queue->paddress_q);
569         rte_free(queue);
570 }
571
572 void
573 eth_rx_queue_stats_get(void *vqueue, struct rte_eth_stats *stats)
574 {
575         struct ark_rx_queue *queue;
576         struct ark_udm_t *udm;
577
578         queue = vqueue;
579         if (queue == 0)
580                 return;
581         udm = queue->udm;
582
583         uint64_t ibytes = ark_udm_bytes(udm);
584         uint64_t ipackets = ark_udm_packets(udm);
585         uint64_t idropped = ark_udm_dropped(queue->udm);
586
587         stats->q_ipackets[queue->queue_index] = ipackets;
588         stats->q_ibytes[queue->queue_index] = ibytes;
589         stats->q_errors[queue->queue_index] = idropped;
590         stats->ipackets += ipackets;
591         stats->ibytes += ibytes;
592         stats->imissed += idropped;
593 }
594
595 void
596 eth_rx_queue_stats_reset(void *vqueue)
597 {
598         struct ark_rx_queue *queue;
599
600         queue = vqueue;
601         if (queue == 0)
602                 return;
603
604         ark_mpu_reset_stats(queue->mpu);
605         ark_udm_queue_stats_reset(queue->udm);
606 }
607
608 void
609 eth_ark_udm_force_close(struct rte_eth_dev *dev)
610 {
611         struct ark_adapter *ark = (struct ark_adapter *)dev->data->dev_private;
612         struct ark_rx_queue *queue;
613         uint32_t index;
614         uint16_t i;
615
616         if (!ark_udm_is_flushed(ark->udm.v)) {
617                 /* restart the MPUs */
618                 PMD_DRV_LOG(ERR, "ARK: %s UDM not flushed\n", __func__);
619                 for (i = 0; i < dev->data->nb_rx_queues; i++) {
620                         queue = (struct ark_rx_queue *)dev->data->rx_queues[i];
621                         if (queue == 0)
622                                 continue;
623
624                         ark_mpu_start(queue->mpu);
625                         /* Add some buffers */
626                         index = 100000 + queue->seed_index;
627                         ark_mpu_set_producer(queue->mpu, index);
628                 }
629                 /* Wait to allow data to pass */
630                 usleep(100);
631
632                 PMD_DEBUG_LOG(DEBUG, "UDM forced flush attempt, stopped = %d\n",
633                                 ark_udm_is_flushed(ark->udm.v));
634         }
635         ark_udm_reset(ark->udm.v);
636 }
637
638 static void
639 ark_ethdev_rx_dump(const char *name, struct ark_rx_queue *queue)
640 {
641         if (queue == NULL)
642                 return;
643         PMD_DEBUG_LOG(DEBUG, "RX QUEUE %d -- %s", queue->phys_qid, name);
644         PMD_DEBUG_LOG(DEBUG, ARK_SU32 ARK_SU32 ARK_SU32 ARK_SU32 "\n",
645                         "queue_size", queue->queue_size,
646                         "seed_index", queue->seed_index,
647                         "prod_index", queue->prod_index,
648                         "cons_index", queue->cons_index);
649
650         ark_mpu_dump(queue->mpu, name, queue->phys_qid);
651         ark_mpu_dump_setup(queue->mpu, queue->phys_qid);
652         ark_udm_dump(queue->udm, name);
653         ark_udm_dump_setup(queue->udm, queue->phys_qid);
654 }
655
656 /* Only used in debug.
657  * This function is a raw memory dump of a portion of an mbuf's memory
658  * region.  The usual function, rte_pktmbuf_dump() only shows data
659  * with respect to the data_off field.  This function show data
660  * anywhere in the mbuf's buffer.  This is useful for examining
661  * data in the headroom or tailroom portion of an mbuf.
662  */
663 static void
664 dump_mbuf_data(struct rte_mbuf *mbuf, uint16_t lo, uint16_t hi)
665 {
666         uint16_t i, j;
667
668         PMD_DRV_LOG(INFO, " MBUF: %p len %d, off: %d, seq: %" PRIU32 "\n", mbuf,
669                 mbuf->pkt_len, mbuf->data_off, mbuf->seqn);
670         for (i = lo; i < hi; i += 16) {
671                 uint8_t *dp = RTE_PTR_ADD(mbuf->buf_addr, i);
672
673                 PMD_DRV_LOG(INFO, "  %6d:  ", i);
674                 for (j = 0; j < 16; j++)
675                         PMD_DRV_LOG(INFO, " %02x", dp[j]);
676
677                 PMD_DRV_LOG(INFO, "\n");
678         }
679 }