2 * Copyright (c) 2017-2018 Cavium, Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
31 #ifndef __ECORE_CHAIN_H__
32 #define __ECORE_CHAIN_H__
34 #include "common_hsi.h"
35 #include "ecore_utils.h"
39 /* Each Page contains a next pointer at its end */
40 ECORE_CHAIN_MODE_NEXT_PTR,
42 /* Chain is a single page (next ptr) is unrequired */
43 ECORE_CHAIN_MODE_SINGLE,
45 /* Page pointers are located in a side list */
49 enum ecore_chain_use_mode
51 ECORE_CHAIN_USE_TO_PRODUCE, /* Chain starts empty */
52 ECORE_CHAIN_USE_TO_CONSUME, /* Chain starts full */
53 ECORE_CHAIN_USE_TO_CONSUME_PRODUCE, /* Chain starts empty */
56 enum ecore_chain_cnt_type {
57 /* The chain's size/prod/cons are kept in 16-bit variables */
58 ECORE_CHAIN_CNT_TYPE_U16,
60 /* The chain's size/prod/cons are kept in 32-bit variables */
61 ECORE_CHAIN_CNT_TYPE_U32,
64 struct ecore_chain_next
66 struct regpair next_phys;
70 struct ecore_chain_pbl_u16 {
75 struct ecore_chain_pbl_u32 {
80 struct ecore_chain_ext_pbl
82 dma_addr_t p_pbl_phys;
86 struct ecore_chain_u16 {
87 /* Cyclic index of next element to produce/consme */
92 struct ecore_chain_u32 {
93 /* Cyclic index of next element to produce/consme */
100 /* fastpath portion of the chain - required for commands such
101 * as produce / consume.
103 /* Point to next element to produce/consume */
107 /* Fastpath portions of the PBL [if exists] */
110 /* Table for keeping the virtual addresses of the chain pages,
111 * respectively to the physical addresses in the pbl table.
113 void **pp_virt_addr_tbl;
116 struct ecore_chain_pbl_u16 pbl_u16;
117 struct ecore_chain_pbl_u32 pbl_u32;
122 struct ecore_chain_u16 chain16;
123 struct ecore_chain_u32 chain32;
126 /* Capacity counts only usable elements */
130 /* A u8 would suffice for mode, but it would save as a lot of headaches
131 * on castings & defaults.
133 enum ecore_chain_mode mode;
135 /* Elements information for fast calculations */
137 u16 elem_per_page_mask;
145 /* Slowpath of the chain - required for initialization and destruction,
146 * but isn't involved in regular functionality.
149 /* Base address of a pre-allocated buffer for pbl */
151 dma_addr_t p_phys_table;
155 /* Address of first page of the chain - the address is required
156 * for fastpath operation [consume/produce] but only for the the SINGLE
157 * flavour which isn't considered fastpath [== SPQ].
160 dma_addr_t p_phys_addr;
162 /* Total number of elements [for entire chain] */
167 /* TBD - do we really need this? Couldn't find usage for it */
173 #define ECORE_CHAIN_PBL_ENTRY_SIZE (8)
174 #define ECORE_CHAIN_PAGE_SIZE (0x1000)
175 #define ELEMS_PER_PAGE(elem_size) (ECORE_CHAIN_PAGE_SIZE/(elem_size))
177 #define UNUSABLE_ELEMS_PER_PAGE(elem_size, mode) \
178 ((mode == ECORE_CHAIN_MODE_NEXT_PTR) ? \
179 (u8)(1 + ((sizeof(struct ecore_chain_next)-1) / \
182 #define USABLE_ELEMS_PER_PAGE(elem_size, mode) \
183 ((u32) (ELEMS_PER_PAGE(elem_size) - \
184 UNUSABLE_ELEMS_PER_PAGE(elem_size, mode)))
186 #define ECORE_CHAIN_PAGE_CNT(elem_cnt, elem_size, mode) \
187 DIV_ROUND_UP(elem_cnt, USABLE_ELEMS_PER_PAGE(elem_size, mode))
189 #define is_chain_u16(p) ((p)->cnt_type == ECORE_CHAIN_CNT_TYPE_U16)
190 #define is_chain_u32(p) ((p)->cnt_type == ECORE_CHAIN_CNT_TYPE_U32)
193 static OSAL_INLINE u16 ecore_chain_get_prod_idx(struct ecore_chain *p_chain)
195 OSAL_ASSERT(is_chain_u16(p_chain));
196 return p_chain->u.chain16.prod_idx;
199 static OSAL_INLINE u32 ecore_chain_get_prod_idx_u32(struct ecore_chain *p_chain)
201 OSAL_ASSERT(is_chain_u32(p_chain));
202 return p_chain->u.chain32.prod_idx;
205 static OSAL_INLINE u16 ecore_chain_get_cons_idx(struct ecore_chain *p_chain)
207 OSAL_ASSERT(is_chain_u16(p_chain));
208 return p_chain->u.chain16.cons_idx;
211 static OSAL_INLINE u32 ecore_chain_get_cons_idx_u32(struct ecore_chain *p_chain)
213 OSAL_ASSERT(is_chain_u32(p_chain));
214 return p_chain->u.chain32.cons_idx;
217 #define ECORE_U16_MAX ((u16)~0U)
218 #define ECORE_U32_MAX ((u32)~0U)
220 static OSAL_INLINE u16 ecore_chain_get_elem_left(struct ecore_chain *p_chain)
224 OSAL_ASSERT(is_chain_u16(p_chain));
226 used = (u16)(((u32)ECORE_U16_MAX + 1 +
227 (u32)(p_chain->u.chain16.prod_idx)) -
228 (u32)p_chain->u.chain16.cons_idx);
229 if (p_chain->mode == ECORE_CHAIN_MODE_NEXT_PTR)
230 used -= p_chain->u.chain16.prod_idx / p_chain->elem_per_page -
231 p_chain->u.chain16.cons_idx / p_chain->elem_per_page;
233 return (u16)(p_chain->capacity - used);
236 static OSAL_INLINE u32
237 ecore_chain_get_elem_left_u32(struct ecore_chain *p_chain)
241 OSAL_ASSERT(is_chain_u32(p_chain));
243 used = (u32)(((u64)ECORE_U32_MAX + 1 +
244 (u64)(p_chain->u.chain32.prod_idx)) -
245 (u64)p_chain->u.chain32.cons_idx);
246 if (p_chain->mode == ECORE_CHAIN_MODE_NEXT_PTR)
247 used -= p_chain->u.chain32.prod_idx / p_chain->elem_per_page -
248 p_chain->u.chain32.cons_idx / p_chain->elem_per_page;
250 return p_chain->capacity - used;
253 static OSAL_INLINE u8 ecore_chain_is_full(struct ecore_chain *p_chain)
255 if (is_chain_u16(p_chain))
256 return (ecore_chain_get_elem_left(p_chain) ==
259 return (ecore_chain_get_elem_left_u32(p_chain) ==
263 static OSAL_INLINE u8 ecore_chain_is_empty(struct ecore_chain *p_chain)
265 if (is_chain_u16(p_chain))
266 return (ecore_chain_get_elem_left(p_chain) == 0);
268 return (ecore_chain_get_elem_left_u32(p_chain) == 0);
272 u16 ecore_chain_get_elem_per_page(struct ecore_chain *p_chain)
274 return p_chain->elem_per_page;
278 u16 ecore_chain_get_usable_per_page(struct ecore_chain *p_chain)
280 return p_chain->usable_per_page;
284 u8 ecore_chain_get_unusable_per_page(struct ecore_chain *p_chain)
286 return p_chain->elem_unusable;
289 static OSAL_INLINE u32 ecore_chain_get_size(struct ecore_chain *p_chain)
291 return p_chain->size;
294 static OSAL_INLINE u32 ecore_chain_get_page_cnt(struct ecore_chain *p_chain)
296 return p_chain->page_cnt;
300 dma_addr_t ecore_chain_get_pbl_phys(struct ecore_chain *p_chain)
302 return p_chain->pbl_sp.p_phys_table;
306 * @brief ecore_chain_advance_page -
308 * Advance the next element accros pages for a linked chain
315 static OSAL_INLINE void
316 ecore_chain_advance_page(struct ecore_chain *p_chain, void **p_next_elem,
317 void *idx_to_inc, void *page_to_inc)
319 struct ecore_chain_next *p_next = OSAL_NULL;
322 switch(p_chain->mode) {
323 case ECORE_CHAIN_MODE_NEXT_PTR:
324 p_next = (struct ecore_chain_next *)(*p_next_elem);
325 *p_next_elem = p_next->next_virt;
326 if (is_chain_u16(p_chain))
327 *(u16 *)idx_to_inc += (u16)p_chain->elem_unusable;
329 *(u32 *)idx_to_inc += (u16)p_chain->elem_unusable;
331 case ECORE_CHAIN_MODE_SINGLE:
332 *p_next_elem = p_chain->p_virt_addr;
334 case ECORE_CHAIN_MODE_PBL:
335 if (is_chain_u16(p_chain)) {
336 if (++(*(u16 *)page_to_inc) == p_chain->page_cnt)
337 *(u16 *)page_to_inc = 0;
338 page_index = *(u16 *)page_to_inc;
340 if (++(*(u32 *)page_to_inc) == p_chain->page_cnt)
341 *(u32 *)page_to_inc = 0;
342 page_index = *(u32 *)page_to_inc;
344 *p_next_elem = p_chain->pbl.pp_virt_addr_tbl[page_index];
348 #define is_unusable_idx(p, idx) \
349 (((p)->u.chain16.idx & (p)->elem_per_page_mask) == (p)->usable_per_page)
351 #define is_unusable_idx_u32(p, idx) \
352 (((p)->u.chain32.idx & (p)->elem_per_page_mask) == (p)->usable_per_page)
354 #define is_unusable_next_idx(p, idx) \
355 ((((p)->u.chain16.idx + 1) & (p)->elem_per_page_mask) == (p)->usable_per_page)
357 #define is_unusable_next_idx_u32(p, idx) \
358 ((((p)->u.chain32.idx + 1) & (p)->elem_per_page_mask) == (p)->usable_per_page)
360 #define test_and_skip(p, idx) \
362 if (is_chain_u16(p)) { \
363 if (is_unusable_idx(p, idx)) \
364 (p)->u.chain16.idx += (p)->elem_unusable; \
366 if (is_unusable_idx_u32(p, idx)) \
367 (p)->u.chain32.idx += (p)->elem_unusable; \
372 * @brief ecore_chain_return_multi_produced -
374 * A chain in which the driver "Produces" elements should use this API
375 * to indicate previous produced elements are now consumed.
381 void ecore_chain_return_multi_produced(struct ecore_chain *p_chain, u32 num)
383 if (is_chain_u16(p_chain))
384 p_chain->u.chain16.cons_idx += (u16)num;
386 p_chain->u.chain32.cons_idx += num;
387 test_and_skip(p_chain, cons_idx);
391 * @brief ecore_chain_return_produced -
393 * A chain in which the driver "Produces" elements should use this API
394 * to indicate previous produced elements are now consumed.
398 static OSAL_INLINE void ecore_chain_return_produced(struct ecore_chain *p_chain)
400 if (is_chain_u16(p_chain))
401 p_chain->u.chain16.cons_idx++;
403 p_chain->u.chain32.cons_idx++;
404 test_and_skip(p_chain, cons_idx);
408 * @brief ecore_chain_produce -
410 * A chain in which the driver "Produces" elements should use this to get
411 * a pointer to the next element which can be "Produced". It's driver
412 * responsibility to validate that the chain has room for new element.
416 * @return void*, a pointer to next element
418 static OSAL_INLINE void *ecore_chain_produce(struct ecore_chain *p_chain)
420 void *p_ret = OSAL_NULL, *p_prod_idx, *p_prod_page_idx;
422 if (is_chain_u16(p_chain)) {
423 if ((p_chain->u.chain16.prod_idx &
424 p_chain->elem_per_page_mask) ==
425 p_chain->next_page_mask) {
426 p_prod_idx = &p_chain->u.chain16.prod_idx;
427 p_prod_page_idx = &p_chain->pbl.c.pbl_u16.prod_page_idx;
428 ecore_chain_advance_page(p_chain, &p_chain->p_prod_elem,
429 p_prod_idx, p_prod_page_idx);
431 p_chain->u.chain16.prod_idx++;
433 if ((p_chain->u.chain32.prod_idx &
434 p_chain->elem_per_page_mask) ==
435 p_chain->next_page_mask) {
436 p_prod_idx = &p_chain->u.chain32.prod_idx;
437 p_prod_page_idx = &p_chain->pbl.c.pbl_u32.prod_page_idx;
438 ecore_chain_advance_page(p_chain, &p_chain->p_prod_elem,
439 p_prod_idx, p_prod_page_idx);
441 p_chain->u.chain32.prod_idx++;
444 p_ret = p_chain->p_prod_elem;
445 p_chain->p_prod_elem = (void*)(((u8*)p_chain->p_prod_elem) +
452 * @brief ecore_chain_get_capacity -
454 * Get the maximum number of BDs in chain
459 * @return number of unusable BDs
461 static OSAL_INLINE u32 ecore_chain_get_capacity(struct ecore_chain *p_chain)
463 return p_chain->capacity;
467 * @brief ecore_chain_recycle_consumed -
469 * Returns an element which was previously consumed;
470 * Increments producers so they could be written to FW.
475 void ecore_chain_recycle_consumed(struct ecore_chain *p_chain)
477 test_and_skip(p_chain, prod_idx);
478 if (is_chain_u16(p_chain))
479 p_chain->u.chain16.prod_idx++;
481 p_chain->u.chain32.prod_idx++;
485 * @brief ecore_chain_consume -
487 * A Chain in which the driver utilizes data written by a different source
488 * (i.e., FW) should use this to access passed buffers.
492 * @return void*, a pointer to the next buffer written
494 static OSAL_INLINE void *ecore_chain_consume(struct ecore_chain *p_chain)
496 void *p_ret = OSAL_NULL, *p_cons_idx, *p_cons_page_idx;
498 if (is_chain_u16(p_chain)) {
499 if ((p_chain->u.chain16.cons_idx &
500 p_chain->elem_per_page_mask) ==
501 p_chain->next_page_mask) {
502 p_cons_idx = &p_chain->u.chain16.cons_idx;
503 p_cons_page_idx = &p_chain->pbl.c.pbl_u16.cons_page_idx;
504 ecore_chain_advance_page(p_chain, &p_chain->p_cons_elem,
505 p_cons_idx, p_cons_page_idx);
507 p_chain->u.chain16.cons_idx++;
509 if ((p_chain->u.chain32.cons_idx &
510 p_chain->elem_per_page_mask) ==
511 p_chain->next_page_mask) {
512 p_cons_idx = &p_chain->u.chain32.cons_idx;
513 p_cons_page_idx = &p_chain->pbl.c.pbl_u32.cons_page_idx;
514 ecore_chain_advance_page(p_chain, &p_chain->p_cons_elem,
515 p_cons_idx, p_cons_page_idx);
517 p_chain->u.chain32.cons_idx++;
520 p_ret = p_chain->p_cons_elem;
521 p_chain->p_cons_elem = (void*)(((u8*)p_chain->p_cons_elem) +
528 * @brief ecore_chain_reset -
530 * Resets the chain to its start state
532 * @param p_chain pointer to a previously allocted chain
534 static OSAL_INLINE void ecore_chain_reset(struct ecore_chain *p_chain)
538 if (is_chain_u16(p_chain)) {
539 p_chain->u.chain16.prod_idx = 0;
540 p_chain->u.chain16.cons_idx = 0;
542 p_chain->u.chain32.prod_idx = 0;
543 p_chain->u.chain32.cons_idx = 0;
545 p_chain->p_cons_elem = p_chain->p_virt_addr;
546 p_chain->p_prod_elem = p_chain->p_virt_addr;
548 if (p_chain->mode == ECORE_CHAIN_MODE_PBL) {
549 /* Use (page_cnt - 1) as a reset value for the prod/cons page's
550 * indices, to avoid unnecessary page advancing on the first
551 * call to ecore_chain_produce/consume. Instead, the indices
552 * will be advanced to page_cnt and then will be wrapped to 0.
554 u32 reset_val = p_chain->page_cnt - 1;
556 if (is_chain_u16(p_chain)) {
557 p_chain->pbl.c.pbl_u16.prod_page_idx = (u16)reset_val;
558 p_chain->pbl.c.pbl_u16.cons_page_idx = (u16)reset_val;
560 p_chain->pbl.c.pbl_u32.prod_page_idx = reset_val;
561 p_chain->pbl.c.pbl_u32.cons_page_idx = reset_val;
565 switch (p_chain->intended_use) {
566 case ECORE_CHAIN_USE_TO_CONSUME:
567 /* produce empty elements */
568 for (i = 0; i < p_chain->capacity; i++)
569 ecore_chain_recycle_consumed(p_chain);
572 case ECORE_CHAIN_USE_TO_CONSUME_PRODUCE:
573 case ECORE_CHAIN_USE_TO_PRODUCE:
581 * @brief ecore_chain_init_params -
583 * Initalizes a basic chain struct
586 * @param page_cnt number of pages in the allocated buffer
587 * @param elem_size size of each element in the chain
588 * @param intended_use
593 static OSAL_INLINE void
594 ecore_chain_init_params(struct ecore_chain *p_chain, u32 page_cnt, u8 elem_size,
595 enum ecore_chain_use_mode intended_use,
596 enum ecore_chain_mode mode,
597 enum ecore_chain_cnt_type cnt_type, void *dp_ctx)
599 /* chain fixed parameters */
600 p_chain->p_virt_addr = OSAL_NULL;
601 p_chain->p_phys_addr = 0;
602 p_chain->elem_size = elem_size;
603 p_chain->intended_use = (u8)intended_use;
604 p_chain->mode = mode;
605 p_chain->cnt_type = (u8)cnt_type;
607 p_chain->elem_per_page = ELEMS_PER_PAGE(elem_size);
608 p_chain->usable_per_page = USABLE_ELEMS_PER_PAGE(elem_size, mode);
609 p_chain->elem_per_page_mask = p_chain->elem_per_page - 1;
610 p_chain->elem_unusable = UNUSABLE_ELEMS_PER_PAGE(elem_size, mode);
611 p_chain->next_page_mask = (p_chain->usable_per_page &
612 p_chain->elem_per_page_mask);
614 p_chain->page_cnt = page_cnt;
615 p_chain->capacity = p_chain->usable_per_page * page_cnt;
616 p_chain->size = p_chain->elem_per_page * page_cnt;
617 p_chain->b_external_pbl = false;
618 p_chain->pbl_sp.p_phys_table = 0;
619 p_chain->pbl_sp.p_virt_table = OSAL_NULL;
620 p_chain->pbl.pp_virt_addr_tbl = OSAL_NULL;
622 p_chain->dp_ctx = dp_ctx;
626 * @brief ecore_chain_init_mem -
628 * Initalizes a basic chain struct with its chain buffers
631 * @param p_virt_addr virtual address of allocated buffer's beginning
632 * @param p_phys_addr physical address of allocated buffer's beginning
635 static OSAL_INLINE void ecore_chain_init_mem(struct ecore_chain *p_chain,
637 dma_addr_t p_phys_addr)
639 p_chain->p_virt_addr = p_virt_addr;
640 p_chain->p_phys_addr = p_phys_addr;
644 * @brief ecore_chain_init_pbl_mem -
646 * Initalizes a basic chain struct with its pbl buffers
649 * @param p_virt_pbl pointer to a pre allocated side table which will hold
650 * virtual page addresses.
651 * @param p_phys_pbl pointer to a pre-allocated side table which will hold
652 * physical page addresses.
653 * @param pp_virt_addr_tbl
654 * pointer to a pre-allocated side table which will hold
655 * the virtual addresses of the chain pages.
658 static OSAL_INLINE void ecore_chain_init_pbl_mem(struct ecore_chain *p_chain,
660 dma_addr_t p_phys_pbl,
661 void **pp_virt_addr_tbl)
663 p_chain->pbl_sp.p_phys_table = p_phys_pbl;
664 p_chain->pbl_sp.p_virt_table = p_virt_pbl;
665 p_chain->pbl.pp_virt_addr_tbl = pp_virt_addr_tbl;
669 * @brief ecore_chain_init_next_ptr_elem -
671 * Initalizes a next pointer element
674 * @param p_virt_curr virtual address of a chain page of which the next
675 * pointer element is initialized
676 * @param p_virt_next virtual address of the next chain page
677 * @param p_phys_next physical address of the next chain page
680 static OSAL_INLINE void
681 ecore_chain_init_next_ptr_elem(struct ecore_chain *p_chain, void *p_virt_curr,
682 void *p_virt_next, dma_addr_t p_phys_next)
684 struct ecore_chain_next *p_next;
687 size = p_chain->elem_size * p_chain->usable_per_page;
688 p_next = (struct ecore_chain_next *)((u8 *)p_virt_curr + size);
690 DMA_REGPAIR_LE(p_next->next_phys, p_phys_next);
692 p_next->next_virt = p_virt_next;
696 * @brief ecore_chain_get_last_elem -
698 * Returns a pointer to the last element of the chain
704 static OSAL_INLINE void *ecore_chain_get_last_elem(struct ecore_chain *p_chain)
706 struct ecore_chain_next *p_next = OSAL_NULL;
707 void *p_virt_addr = OSAL_NULL;
708 u32 size, last_page_idx;
710 if (!p_chain->p_virt_addr)
713 switch (p_chain->mode) {
714 case ECORE_CHAIN_MODE_NEXT_PTR:
715 size = p_chain->elem_size * p_chain->usable_per_page;
716 p_virt_addr = p_chain->p_virt_addr;
717 p_next = (struct ecore_chain_next *)((u8 *)p_virt_addr + size);
718 while (p_next->next_virt != p_chain->p_virt_addr) {
719 p_virt_addr = p_next->next_virt;
720 p_next = (struct ecore_chain_next *)((u8 *)p_virt_addr +
724 case ECORE_CHAIN_MODE_SINGLE:
725 p_virt_addr = p_chain->p_virt_addr;
727 case ECORE_CHAIN_MODE_PBL:
728 last_page_idx = p_chain->page_cnt - 1;
729 p_virt_addr = p_chain->pbl.pp_virt_addr_tbl[last_page_idx];
732 /* p_virt_addr points at this stage to the last page of the chain */
733 size = p_chain->elem_size * (p_chain->usable_per_page - 1);
734 p_virt_addr = (u8 *)p_virt_addr + size;
740 * @brief ecore_chain_set_prod - sets the prod to the given value
745 static OSAL_INLINE void ecore_chain_set_prod(struct ecore_chain *p_chain,
746 u32 prod_idx, void *p_prod_elem)
748 if (is_chain_u16(p_chain))
749 p_chain->u.chain16.prod_idx = (u16)prod_idx;
751 p_chain->u.chain32.prod_idx = prod_idx;
752 p_chain->p_prod_elem = p_prod_elem;
756 * @brief ecore_chain_pbl_zero_mem - set chain memory to 0
760 static OSAL_INLINE void ecore_chain_pbl_zero_mem(struct ecore_chain *p_chain)
764 if (p_chain->mode != ECORE_CHAIN_MODE_PBL)
767 page_cnt = ecore_chain_get_page_cnt(p_chain);
769 for (i = 0; i < page_cnt; i++)
770 OSAL_MEM_ZERO(p_chain->pbl.pp_virt_addr_tbl[i],
771 ECORE_CHAIN_PAGE_SIZE);
774 int ecore_chain_print(struct ecore_chain *p_chain, char *buffer,
775 u32 buffer_size, u32 *element_indx, u32 stop_indx,
777 int (*func_ptr_print_element)(struct ecore_chain *p_chain,
780 int (*func_ptr_print_metadata)(struct ecore_chain *p_chain,
783 #endif /* __ECORE_CHAIN_H__ */