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