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