1 /* QLogic qed NIC Driver
2 * Copyright (c) 2015 QLogic Corporation
4 * This software is available under the terms of the GNU General Public License
5 * (GPL) Version 2, available from the file COPYING in the main directory of
12 #include <linux/types.h>
13 #include <linux/slab.h>
14 #include <linux/qed/qed_if.h>
21 enum protocol_type type;
24 #define MAX_TID_BLOCKS 512
27 u32 num_tids_per_block;
29 u8 *blocks[MAX_TID_BLOCKS]; /* 4K */
33 * @brief qed_cxt_acquire - Acquire a new cid of a specific protocol type
41 int qed_cxt_acquire_cid(struct qed_hwfn *p_hwfn,
42 enum protocol_type type,
46 * @brief qedo_cid_get_cxt_info - Returns the context info for a specific cid
50 * @param p_info in/out
54 int qed_cxt_get_cid_info(struct qed_hwfn *p_hwfn,
55 struct qed_cxt_info *p_info);
58 * @brief qed_cxt_get_tid_mem_info
65 int qed_cxt_get_tid_mem_info(struct qed_hwfn *p_hwfn,
66 struct qed_tid_mem *p_info);
68 #define QED_CXT_ISCSI_TID_SEG PROTOCOLID_ISCSI
69 #define QED_CXT_ROCE_TID_SEG PROTOCOLID_ROCE
70 enum qed_cxt_elem_type {
76 u32 qed_cxt_get_proto_cid_count(struct qed_hwfn *p_hwfn,
77 enum protocol_type type, u32 *vf_cid);
80 * @brief qed_cxt_set_pf_params - Set the PF params for cxt init
86 int qed_cxt_set_pf_params(struct qed_hwfn *p_hwfn);
89 * @brief qed_cxt_cfg_ilt_compute - compute ILT init parameters
95 int qed_cxt_cfg_ilt_compute(struct qed_hwfn *p_hwfn);
98 * @brief qed_cxt_mngr_alloc - Allocate and init the context manager struct
104 int qed_cxt_mngr_alloc(struct qed_hwfn *p_hwfn);
107 * @brief qed_cxt_mngr_free
111 void qed_cxt_mngr_free(struct qed_hwfn *p_hwfn);
114 * @brief qed_cxt_tables_alloc - Allocate ILT shadow, Searcher T2, acquired map
120 int qed_cxt_tables_alloc(struct qed_hwfn *p_hwfn);
123 * @brief qed_cxt_mngr_setup - Reset the acquired CIDs
127 void qed_cxt_mngr_setup(struct qed_hwfn *p_hwfn);
130 * @brief qed_cxt_hw_init_common - Initailze ILT and DQ, common phase, per path.
136 void qed_cxt_hw_init_common(struct qed_hwfn *p_hwfn);
139 * @brief qed_cxt_hw_init_pf - Initailze ILT and DQ, PF phase, per path.
145 void qed_cxt_hw_init_pf(struct qed_hwfn *p_hwfn);
148 * @brief qed_qm_init_pf - Initailze the QM PF phase, per path
153 void qed_qm_init_pf(struct qed_hwfn *p_hwfn);
156 * @brief Reconfigures QM pf on the fly
163 int qed_qm_reconf(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
166 * @brief qed_cxt_release - Release a cid
171 void qed_cxt_release_cid(struct qed_hwfn *p_hwfn,
173 int qed_cxt_dynamic_ilt_alloc(struct qed_hwfn *p_hwfn,
174 enum qed_cxt_elem_type elem_type, u32 iid);
175 u32 qed_cxt_get_proto_tid_count(struct qed_hwfn *p_hwfn,
176 enum protocol_type type);
177 u32 qed_cxt_get_proto_cid_start(struct qed_hwfn *p_hwfn,
178 enum protocol_type type);
179 int qed_cxt_free_proto_ilt(struct qed_hwfn *p_hwfn, enum protocol_type proto);
181 #define QED_CTX_WORKING_MEM 0
182 #define QED_CTX_FL_MEM 1