1 /* QLogic qed NIC Driver
2 * Copyright (c) 2015-2017 QLogic Corporation
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and /or other materials
21 * provided with the distribution.
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36 #include <linux/types.h>
37 #include <linux/slab.h>
38 #include <linux/qed/qed_if.h>
45 enum protocol_type type
;
48 #define MAX_TID_BLOCKS 512
51 u32 num_tids_per_block
;
53 u8
*blocks
[MAX_TID_BLOCKS
]; /* 4K */
57 * @brief qed_cxt_acquire - Acquire a new cid of a specific protocol type
65 int qed_cxt_acquire_cid(struct qed_hwfn
*p_hwfn
,
66 enum protocol_type type
,
70 * @brief qedo_cid_get_cxt_info - Returns the context info for a specific cid
74 * @param p_info in/out
78 int qed_cxt_get_cid_info(struct qed_hwfn
*p_hwfn
,
79 struct qed_cxt_info
*p_info
);
82 * @brief qed_cxt_get_tid_mem_info
89 int qed_cxt_get_tid_mem_info(struct qed_hwfn
*p_hwfn
,
90 struct qed_tid_mem
*p_info
);
92 #define QED_CXT_ISCSI_TID_SEG PROTOCOLID_ISCSI
93 #define QED_CXT_ROCE_TID_SEG PROTOCOLID_ROCE
94 #define QED_CXT_FCOE_TID_SEG PROTOCOLID_FCOE
95 enum qed_cxt_elem_type
{
101 u32
qed_cxt_get_proto_cid_count(struct qed_hwfn
*p_hwfn
,
102 enum protocol_type type
, u32
*vf_cid
);
105 * @brief qed_cxt_set_pf_params - Set the PF params for cxt init
111 int qed_cxt_set_pf_params(struct qed_hwfn
*p_hwfn
);
114 * @brief qed_cxt_cfg_ilt_compute - compute ILT init parameters
120 int qed_cxt_cfg_ilt_compute(struct qed_hwfn
*p_hwfn
);
123 * @brief qed_cxt_mngr_alloc - Allocate and init the context manager struct
129 int qed_cxt_mngr_alloc(struct qed_hwfn
*p_hwfn
);
132 * @brief qed_cxt_mngr_free
136 void qed_cxt_mngr_free(struct qed_hwfn
*p_hwfn
);
139 * @brief qed_cxt_tables_alloc - Allocate ILT shadow, Searcher T2, acquired map
145 int qed_cxt_tables_alloc(struct qed_hwfn
*p_hwfn
);
148 * @brief qed_cxt_mngr_setup - Reset the acquired CIDs
152 void qed_cxt_mngr_setup(struct qed_hwfn
*p_hwfn
);
155 * @brief qed_cxt_hw_init_common - Initailze ILT and DQ, common phase, per path.
161 void qed_cxt_hw_init_common(struct qed_hwfn
*p_hwfn
);
164 * @brief qed_cxt_hw_init_pf - Initailze ILT and DQ, PF phase, per path.
170 void qed_cxt_hw_init_pf(struct qed_hwfn
*p_hwfn
);
173 * @brief qed_qm_init_pf - Initailze the QM PF phase, per path
178 void qed_qm_init_pf(struct qed_hwfn
*p_hwfn
);
181 * @brief Reconfigures QM pf on the fly
188 int qed_qm_reconf(struct qed_hwfn
*p_hwfn
, struct qed_ptt
*p_ptt
);
191 * @brief qed_cxt_release - Release a cid
196 void qed_cxt_release_cid(struct qed_hwfn
*p_hwfn
,
198 int qed_cxt_dynamic_ilt_alloc(struct qed_hwfn
*p_hwfn
,
199 enum qed_cxt_elem_type elem_type
, u32 iid
);
200 u32
qed_cxt_get_proto_tid_count(struct qed_hwfn
*p_hwfn
,
201 enum protocol_type type
);
202 u32
qed_cxt_get_proto_cid_start(struct qed_hwfn
*p_hwfn
,
203 enum protocol_type type
);
204 int qed_cxt_free_proto_ilt(struct qed_hwfn
*p_hwfn
, enum protocol_type proto
);
206 #define QED_CTX_WORKING_MEM 0
207 #define QED_CTX_FL_MEM 1
208 int qed_cxt_get_task_ctx(struct qed_hwfn
*p_hwfn
,
209 u32 tid
, u8 ctx_type
, void **task_ctx
);