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;
218 * Should create OSALs for the below definitions.
219 * For Linux, replace them with the existing U16_MAX and U32_MAX, and handle
220 * kernel versions that lack them.
222 #define ECORE_U16_MAX ((u16)~0U)
223 #define ECORE_U32_MAX ((u32)~0U)
225 static OSAL_INLINE u16 ecore_chain_get_elem_left(struct ecore_chain *p_chain)
229 OSAL_ASSERT(is_chain_u16(p_chain));
231 used = (u16)(((u32)ECORE_U16_MAX + 1 +
232 (u32)(p_chain->u.chain16.prod_idx)) -
233 (u32)p_chain->u.chain16.cons_idx);
234 if (p_chain->mode == ECORE_CHAIN_MODE_NEXT_PTR)
235 used -= p_chain->u.chain16.prod_idx / p_chain->elem_per_page -
236 p_chain->u.chain16.cons_idx / p_chain->elem_per_page;
238 return (u16)(p_chain->capacity - used);
241 static OSAL_INLINE u32
242 ecore_chain_get_elem_left_u32(struct ecore_chain *p_chain)
246 OSAL_ASSERT(is_chain_u32(p_chain));
248 used = (u32)(((u64)ECORE_U32_MAX + 1 +
249 (u64)(p_chain->u.chain32.prod_idx)) -
250 (u64)p_chain->u.chain32.cons_idx);
251 if (p_chain->mode == ECORE_CHAIN_MODE_NEXT_PTR)
252 used -= p_chain->u.chain32.prod_idx / p_chain->elem_per_page -
253 p_chain->u.chain32.cons_idx / p_chain->elem_per_page;
255 return p_chain->capacity - used;
258 static OSAL_INLINE u8 ecore_chain_is_full(struct ecore_chain *p_chain)
260 if (is_chain_u16(p_chain))
261 return (ecore_chain_get_elem_left(p_chain) ==
264 return (ecore_chain_get_elem_left_u32(p_chain) ==
268 static OSAL_INLINE u8 ecore_chain_is_empty(struct ecore_chain *p_chain)
270 if (is_chain_u16(p_chain))
271 return (ecore_chain_get_elem_left(p_chain) == 0);
273 return (ecore_chain_get_elem_left_u32(p_chain) == 0);
277 u16 ecore_chain_get_elem_per_page(struct ecore_chain *p_chain)
279 return p_chain->elem_per_page;
283 u16 ecore_chain_get_usable_per_page(struct ecore_chain *p_chain)
285 return p_chain->usable_per_page;
289 u8 ecore_chain_get_unusable_per_page(struct ecore_chain *p_chain)
291 return p_chain->elem_unusable;
294 static OSAL_INLINE u32 ecore_chain_get_size(struct ecore_chain *p_chain)
296 return p_chain->size;
299 static OSAL_INLINE u32 ecore_chain_get_page_cnt(struct ecore_chain *p_chain)
301 return p_chain->page_cnt;
305 dma_addr_t ecore_chain_get_pbl_phys(struct ecore_chain *p_chain)
307 return p_chain->pbl_sp.p_phys_table;
311 * @brief ecore_chain_advance_page -
313 * Advance the next element accros pages for a linked chain
320 static OSAL_INLINE void
321 ecore_chain_advance_page(struct ecore_chain *p_chain, void **p_next_elem,
322 void *idx_to_inc, void *page_to_inc)
324 struct ecore_chain_next *p_next = OSAL_NULL;
327 switch(p_chain->mode) {
328 case ECORE_CHAIN_MODE_NEXT_PTR:
329 p_next = (struct ecore_chain_next *)(*p_next_elem);
330 *p_next_elem = p_next->next_virt;
331 if (is_chain_u16(p_chain))
332 *(u16 *)idx_to_inc += (u16)p_chain->elem_unusable;
334 *(u32 *)idx_to_inc += (u16)p_chain->elem_unusable;
336 case ECORE_CHAIN_MODE_SINGLE:
337 *p_next_elem = p_chain->p_virt_addr;
339 case ECORE_CHAIN_MODE_PBL:
340 if (is_chain_u16(p_chain)) {
341 if (++(*(u16 *)page_to_inc) == p_chain->page_cnt)
342 *(u16 *)page_to_inc = 0;
343 page_index = *(u16 *)page_to_inc;
345 if (++(*(u32 *)page_to_inc) == p_chain->page_cnt)
346 *(u32 *)page_to_inc = 0;
347 page_index = *(u32 *)page_to_inc;
349 *p_next_elem = p_chain->pbl.pp_virt_addr_tbl[page_index];
353 #define is_unusable_idx(p, idx) \
354 (((p)->u.chain16.idx & (p)->elem_per_page_mask) == (p)->usable_per_page)
356 #define is_unusable_idx_u32(p, idx) \
357 (((p)->u.chain32.idx & (p)->elem_per_page_mask) == (p)->usable_per_page)
359 #define is_unusable_next_idx(p, idx) \
360 ((((p)->u.chain16.idx + 1) & (p)->elem_per_page_mask) == (p)->usable_per_page)
362 #define is_unusable_next_idx_u32(p, idx) \
363 ((((p)->u.chain32.idx + 1) & (p)->elem_per_page_mask) == (p)->usable_per_page)
365 #define test_and_skip(p, idx) \
367 if (is_chain_u16(p)) { \
368 if (is_unusable_idx(p, idx)) \
369 (p)->u.chain16.idx += (p)->elem_unusable; \
371 if (is_unusable_idx_u32(p, idx)) \
372 (p)->u.chain32.idx += (p)->elem_unusable; \
377 * @brief ecore_chain_return_multi_produced -
379 * A chain in which the driver "Produces" elements should use this API
380 * to indicate previous produced elements are now consumed.
386 void ecore_chain_return_multi_produced(struct ecore_chain *p_chain, u32 num)
388 if (is_chain_u16(p_chain))
389 p_chain->u.chain16.cons_idx += (u16)num;
391 p_chain->u.chain32.cons_idx += num;
392 test_and_skip(p_chain, cons_idx);
396 * @brief ecore_chain_return_produced -
398 * A chain in which the driver "Produces" elements should use this API
399 * to indicate previous produced elements are now consumed.
403 static OSAL_INLINE void ecore_chain_return_produced(struct ecore_chain *p_chain)
405 if (is_chain_u16(p_chain))
406 p_chain->u.chain16.cons_idx++;
408 p_chain->u.chain32.cons_idx++;
409 test_and_skip(p_chain, cons_idx);
413 * @brief ecore_chain_produce -
415 * A chain in which the driver "Produces" elements should use this to get
416 * a pointer to the next element which can be "Produced". It's driver
417 * responsibility to validate that the chain has room for new element.
421 * @return void*, a pointer to next element
423 static OSAL_INLINE void *ecore_chain_produce(struct ecore_chain *p_chain)
425 void *p_ret = OSAL_NULL, *p_prod_idx, *p_prod_page_idx;
427 if (is_chain_u16(p_chain)) {
428 if ((p_chain->u.chain16.prod_idx &
429 p_chain->elem_per_page_mask) ==
430 p_chain->next_page_mask) {
431 p_prod_idx = &p_chain->u.chain16.prod_idx;
432 p_prod_page_idx = &p_chain->pbl.c.pbl_u16.prod_page_idx;
433 ecore_chain_advance_page(p_chain, &p_chain->p_prod_elem,
434 p_prod_idx, p_prod_page_idx);
436 p_chain->u.chain16.prod_idx++;
438 if ((p_chain->u.chain32.prod_idx &
439 p_chain->elem_per_page_mask) ==
440 p_chain->next_page_mask) {
441 p_prod_idx = &p_chain->u.chain32.prod_idx;
442 p_prod_page_idx = &p_chain->pbl.c.pbl_u32.prod_page_idx;
443 ecore_chain_advance_page(p_chain, &p_chain->p_prod_elem,
444 p_prod_idx, p_prod_page_idx);
446 p_chain->u.chain32.prod_idx++;
449 p_ret = p_chain->p_prod_elem;
450 p_chain->p_prod_elem = (void*)(((u8*)p_chain->p_prod_elem) +
457 * @brief ecore_chain_get_capacity -
459 * Get the maximum number of BDs in chain
464 * @return number of unusable BDs
466 static OSAL_INLINE u32 ecore_chain_get_capacity(struct ecore_chain *p_chain)
468 return p_chain->capacity;
472 * @brief ecore_chain_recycle_consumed -
474 * Returns an element which was previously consumed;
475 * Increments producers so they could be written to FW.
480 void ecore_chain_recycle_consumed(struct ecore_chain *p_chain)
482 test_and_skip(p_chain, prod_idx);
483 if (is_chain_u16(p_chain))
484 p_chain->u.chain16.prod_idx++;
486 p_chain->u.chain32.prod_idx++;
490 * @brief ecore_chain_consume -
492 * A Chain in which the driver utilizes data written by a different source
493 * (i.e., FW) should use this to access passed buffers.
497 * @return void*, a pointer to the next buffer written
499 static OSAL_INLINE void *ecore_chain_consume(struct ecore_chain *p_chain)
501 void *p_ret = OSAL_NULL, *p_cons_idx, *p_cons_page_idx;
503 if (is_chain_u16(p_chain)) {
504 if ((p_chain->u.chain16.cons_idx &
505 p_chain->elem_per_page_mask) ==
506 p_chain->next_page_mask) {
507 p_cons_idx = &p_chain->u.chain16.cons_idx;
508 p_cons_page_idx = &p_chain->pbl.c.pbl_u16.cons_page_idx;
509 ecore_chain_advance_page(p_chain, &p_chain->p_cons_elem,
510 p_cons_idx, p_cons_page_idx);
512 p_chain->u.chain16.cons_idx++;
514 if ((p_chain->u.chain32.cons_idx &
515 p_chain->elem_per_page_mask) ==
516 p_chain->next_page_mask) {
517 p_cons_idx = &p_chain->u.chain32.cons_idx;
518 p_cons_page_idx = &p_chain->pbl.c.pbl_u32.cons_page_idx;
519 ecore_chain_advance_page(p_chain, &p_chain->p_cons_elem,
520 p_cons_idx, p_cons_page_idx);
522 p_chain->u.chain32.cons_idx++;
525 p_ret = p_chain->p_cons_elem;
526 p_chain->p_cons_elem = (void*)(((u8*)p_chain->p_cons_elem) +
533 * @brief ecore_chain_reset -
535 * Resets the chain to its start state
537 * @param p_chain pointer to a previously allocted chain
539 static OSAL_INLINE void ecore_chain_reset(struct ecore_chain *p_chain)
543 if (is_chain_u16(p_chain)) {
544 p_chain->u.chain16.prod_idx = 0;
545 p_chain->u.chain16.cons_idx = 0;
547 p_chain->u.chain32.prod_idx = 0;
548 p_chain->u.chain32.cons_idx = 0;
550 p_chain->p_cons_elem = p_chain->p_virt_addr;
551 p_chain->p_prod_elem = p_chain->p_virt_addr;
553 if (p_chain->mode == ECORE_CHAIN_MODE_PBL) {
554 /* Use (page_cnt - 1) as a reset value for the prod/cons page's
555 * indices, to avoid unnecessary page advancing on the first
556 * call to ecore_chain_produce/consume. Instead, the indices
557 * will be advanced to page_cnt and then will be wrapped to 0.
559 u32 reset_val = p_chain->page_cnt - 1;
561 if (is_chain_u16(p_chain)) {
562 p_chain->pbl.c.pbl_u16.prod_page_idx = (u16)reset_val;
563 p_chain->pbl.c.pbl_u16.cons_page_idx = (u16)reset_val;
565 p_chain->pbl.c.pbl_u32.prod_page_idx = reset_val;
566 p_chain->pbl.c.pbl_u32.cons_page_idx = reset_val;
570 switch (p_chain->intended_use) {
571 case ECORE_CHAIN_USE_TO_CONSUME:
572 /* produce empty elements */
573 for (i = 0; i < p_chain->capacity; i++)
574 ecore_chain_recycle_consumed(p_chain);
577 case ECORE_CHAIN_USE_TO_CONSUME_PRODUCE:
578 case ECORE_CHAIN_USE_TO_PRODUCE:
586 * @brief ecore_chain_init_params -
588 * Initalizes a basic chain struct
591 * @param page_cnt number of pages in the allocated buffer
592 * @param elem_size size of each element in the chain
593 * @param intended_use
598 static OSAL_INLINE void
599 ecore_chain_init_params(struct ecore_chain *p_chain, u32 page_cnt, u8 elem_size,
600 enum ecore_chain_use_mode intended_use,
601 enum ecore_chain_mode mode,
602 enum ecore_chain_cnt_type cnt_type, void *dp_ctx)
604 /* chain fixed parameters */
605 p_chain->p_virt_addr = OSAL_NULL;
606 p_chain->p_phys_addr = 0;
607 p_chain->elem_size = elem_size;
608 p_chain->intended_use = (u8)intended_use;
609 p_chain->mode = mode;
610 p_chain->cnt_type = (u8)cnt_type;
612 p_chain->elem_per_page = ELEMS_PER_PAGE(elem_size);
613 p_chain->usable_per_page = USABLE_ELEMS_PER_PAGE(elem_size, mode);
614 p_chain->elem_per_page_mask = p_chain->elem_per_page - 1;
615 p_chain->elem_unusable = UNUSABLE_ELEMS_PER_PAGE(elem_size, mode);
616 p_chain->next_page_mask = (p_chain->usable_per_page &
617 p_chain->elem_per_page_mask);
619 p_chain->page_cnt = page_cnt;
620 p_chain->capacity = p_chain->usable_per_page * page_cnt;
621 p_chain->size = p_chain->elem_per_page * page_cnt;
622 p_chain->b_external_pbl = false;
623 p_chain->pbl_sp.p_phys_table = 0;
624 p_chain->pbl_sp.p_virt_table = OSAL_NULL;
625 p_chain->pbl.pp_virt_addr_tbl = OSAL_NULL;
627 p_chain->dp_ctx = dp_ctx;
631 * @brief ecore_chain_init_mem -
633 * Initalizes a basic chain struct with its chain buffers
636 * @param p_virt_addr virtual address of allocated buffer's beginning
637 * @param p_phys_addr physical address of allocated buffer's beginning
640 static OSAL_INLINE void ecore_chain_init_mem(struct ecore_chain *p_chain,
642 dma_addr_t p_phys_addr)
644 p_chain->p_virt_addr = p_virt_addr;
645 p_chain->p_phys_addr = p_phys_addr;
649 * @brief ecore_chain_init_pbl_mem -
651 * Initalizes a basic chain struct with its pbl buffers
654 * @param p_virt_pbl pointer to a pre allocated side table which will hold
655 * virtual page addresses.
656 * @param p_phys_pbl pointer to a pre-allocated side table which will hold
657 * physical page addresses.
658 * @param pp_virt_addr_tbl
659 * pointer to a pre-allocated side table which will hold
660 * the virtual addresses of the chain pages.
663 static OSAL_INLINE void ecore_chain_init_pbl_mem(struct ecore_chain *p_chain,
665 dma_addr_t p_phys_pbl,
666 void **pp_virt_addr_tbl)
668 p_chain->pbl_sp.p_phys_table = p_phys_pbl;
669 p_chain->pbl_sp.p_virt_table = p_virt_pbl;
670 p_chain->pbl.pp_virt_addr_tbl = pp_virt_addr_tbl;
674 * @brief ecore_chain_init_next_ptr_elem -
676 * Initalizes a next pointer element
679 * @param p_virt_curr virtual address of a chain page of which the next
680 * pointer element is initialized
681 * @param p_virt_next virtual address of the next chain page
682 * @param p_phys_next physical address of the next chain page
685 static OSAL_INLINE void
686 ecore_chain_init_next_ptr_elem(struct ecore_chain *p_chain, void *p_virt_curr,
687 void *p_virt_next, dma_addr_t p_phys_next)
689 struct ecore_chain_next *p_next;
692 size = p_chain->elem_size * p_chain->usable_per_page;
693 p_next = (struct ecore_chain_next *)((u8 *)p_virt_curr + size);
695 DMA_REGPAIR_LE(p_next->next_phys, p_phys_next);
697 p_next->next_virt = p_virt_next;
701 * @brief ecore_chain_get_last_elem -
703 * Returns a pointer to the last element of the chain
709 static OSAL_INLINE void *ecore_chain_get_last_elem(struct ecore_chain *p_chain)
711 struct ecore_chain_next *p_next = OSAL_NULL;
712 void *p_virt_addr = OSAL_NULL;
713 u32 size, last_page_idx;
715 if (!p_chain->p_virt_addr)
718 switch (p_chain->mode) {
719 case ECORE_CHAIN_MODE_NEXT_PTR:
720 size = p_chain->elem_size * p_chain->usable_per_page;
721 p_virt_addr = p_chain->p_virt_addr;
722 p_next = (struct ecore_chain_next *)((u8 *)p_virt_addr + size);
723 while (p_next->next_virt != p_chain->p_virt_addr) {
724 p_virt_addr = p_next->next_virt;
725 p_next = (struct ecore_chain_next *)((u8 *)p_virt_addr +
729 case ECORE_CHAIN_MODE_SINGLE:
730 p_virt_addr = p_chain->p_virt_addr;
732 case ECORE_CHAIN_MODE_PBL:
733 last_page_idx = p_chain->page_cnt - 1;
734 p_virt_addr = p_chain->pbl.pp_virt_addr_tbl[last_page_idx];
737 /* p_virt_addr points at this stage to the last page of the chain */
738 size = p_chain->elem_size * (p_chain->usable_per_page - 1);
739 p_virt_addr = (u8 *)p_virt_addr + size;
745 * @brief ecore_chain_set_prod - sets the prod to the given value
750 static OSAL_INLINE void ecore_chain_set_prod(struct ecore_chain *p_chain,
751 u32 prod_idx, void *p_prod_elem)
753 if (is_chain_u16(p_chain))
754 p_chain->u.chain16.prod_idx = (u16)prod_idx;
756 p_chain->u.chain32.prod_idx = prod_idx;
757 p_chain->p_prod_elem = p_prod_elem;
761 * @brief ecore_chain_pbl_zero_mem - set chain memory to 0
765 static OSAL_INLINE void ecore_chain_pbl_zero_mem(struct ecore_chain *p_chain)
769 if (p_chain->mode != ECORE_CHAIN_MODE_PBL)
772 page_cnt = ecore_chain_get_page_cnt(p_chain);
774 for (i = 0; i < page_cnt; i++)
775 OSAL_MEM_ZERO(p_chain->pbl.pp_virt_addr_tbl[i],
776 ECORE_CHAIN_PAGE_SIZE);
779 int ecore_chain_print(struct ecore_chain *p_chain, char *buffer,
780 u32 buffer_size, u32 *element_indx, u32 stop_indx,
782 int (*func_ptr_print_element)(struct ecore_chain *p_chain,
785 int (*func_ptr_print_metadata)(struct ecore_chain *p_chain,
788 #endif /* __ECORE_CHAIN_H__ */