2 * Copyright (c) 2016 QLogic Corporation.
6 * See LICENSE.qede_pmd for copyright and licensing details.
9 #ifndef __ECORE_CXT_API_H__
10 #define __ECORE_CXT_API_H__
14 struct ecore_cxt_info {
17 enum protocol_type type;
20 #define MAX_TID_BLOCKS 512
21 struct ecore_tid_mem {
23 u32 num_tids_per_block;
25 u8 *blocks[MAX_TID_BLOCKS]; /* 4K */
28 static OSAL_INLINE void *get_task_mem(struct ecore_tid_mem *info, u32 tid)
30 /* note: waste is superfluous */
31 return (void *)(info->blocks[tid / info->num_tids_per_block] +
32 (tid % info->num_tids_per_block) * info->tid_size);
34 /* more elaborate alternative with no modulo
35 * u32 mask = info->tid_size * info->num_tids_per_block +
37 * u32 index = tid / info->num_tids_per_block;
38 * u32 offset = tid * info->tid_size + index * info->waste;
39 * return (void *)(blocks[index] + (offset & mask));
44 * @brief ecore_cxt_acquire - Acquire a new cid of a specific protocol type
50 * @return enum _ecore_status_t
52 enum _ecore_status_t ecore_cxt_acquire_cid(struct ecore_hwfn *p_hwfn,
53 enum protocol_type type,
57 * @brief ecoreo_cid_get_cxt_info - Returns the context info for a specific cid
61 * @param p_info in/out
63 * @return enum _ecore_status_t
65 enum _ecore_status_t ecore_cxt_get_cid_info(struct ecore_hwfn *p_hwfn,
66 struct ecore_cxt_info *p_info);
69 * @brief ecore_cxt_get_tid_mem_info
74 * @return enum _ecore_status_t
76 enum _ecore_status_t ecore_cxt_get_tid_mem_info(struct ecore_hwfn *p_hwfn,
77 struct ecore_tid_mem *p_info);