xref: /freebsd/sys/dev/ocs_fc/ocs_scsi.h (revision a64729f5077d77e13b9497cb33ecb3c82e606ee8)
1 /*-
2  * Copyright (c) 2017 Broadcom. All rights reserved.
3  * The term "Broadcom" refers to Broadcom Limited and/or its subsidiaries.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  *    this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  *    this list of conditions and the following disclaimer in the documentation
13  *    and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its contributors
16  *    may be used to endorse or promote products derived from this software
17  *    without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 /**
33  * @file
34  * OCS SCSI API declarations
35  *
36  */
37 
38 #if !defined(__OCS_SCSI_H__)
39 #define __OCS_SCSI_H__
40 
41 #include "ocs_ddump.h"
42 #include "ocs_mgmt.h"
43 #include "ocs_utils.h"
44 
45 /* ocs_scsi_rcv_cmd() ocs_scsi_rcv_tmf() flags */
46 #define OCS_SCSI_CMD_DIR_IN		(1U << 0)
47 #define OCS_SCSI_CMD_DIR_OUT		(1U << 1)
48 #define OCS_SCSI_CMD_SIMPLE		(1U << 2)
49 #define OCS_SCSI_CMD_HEAD_OF_QUEUE	(1U << 3)
50 #define OCS_SCSI_CMD_ORDERED		(1U << 4)
51 #define OCS_SCSI_CMD_UNTAGGED		(1U << 5)
52 #define OCS_SCSI_CMD_ACA		(1U << 6)
53 #define OCS_SCSI_FIRST_BURST_ERR	(1U << 7)
54 #define OCS_SCSI_FIRST_BURST_ABORTED	(1U << 8)
55 #define OCS_SCSI_PRIORITY_MASK		0xf0000
56 #define OCS_SCSI_PRIORITY_SHIFT		16
57 
58 /* ocs_scsi_send_rd_data/recv_wr_data/send_resp flags */
59 #define OCS_SCSI_LAST_DATAPHASE		(1U << 0)
60 #define OCS_SCSI_NO_AUTO_RESPONSE	(1U << 1)
61 #define OCS_SCSI_LOW_LATENCY		(1U << 2)
62 
63 #define OCS_SCSI_WQ_STEERING_SHIFT	(16)
64 #define OCS_SCSI_WQ_STEERING_MASK	(0xf << OCS_SCSI_WQ_STEERING_SHIFT)
65 #define OCS_SCSI_WQ_STEERING_CLASS	(0 << OCS_SCSI_WQ_STEERING_SHIFT)
66 #define OCS_SCSI_WQ_STEERING_REQUEST	(1 << OCS_SCSI_WQ_STEERING_SHIFT)
67 #define OCS_SCSI_WQ_STEERING_CPU	(2 << OCS_SCSI_WQ_STEERING_SHIFT)
68 
69 #define OCS_SCSI_WQ_CLASS_SHIFT		(20)
70 #define OCS_SCSI_WQ_CLASS_MASK		(0xf << OCS_SCSI_WQ_CLASS_SHIFT)
71 #define OCS_SCSI_WQ_CLASS(x)		((x & OCS_SCSI_WQ_CLASS_MASK) << OCS_SCSI_WQ_CLASS_SHIFT)
72 
73 #define OCS_SCSI_WQ_CLASS_LOW_LATENCY	(1)
74 
75 /*!
76  * @defgroup scsi_api_base SCSI Base Target/Initiator
77  * @defgroup scsi_api_target SCSI Target
78  * @defgroup scsi_api_initiator SCSI Initiator
79  */
80 
81 /**
82  * @brief SCSI command response.
83  *
84  * This structure is used by target-servers to specify SCSI status and
85  * sense data.  In this case all but the @b residual element are used. For
86  * initiator-clients, this structure is used by the SCSI API to convey the
87  * response data for issued commands, including the residual element.
88  */
89 typedef struct {
90 	uint8_t scsi_status;			/**< SCSI status */
91 	uint16_t scsi_status_qualifier;		/**< SCSI status qualifier */
92 	uint8_t *response_data;			/**< pointer to response data buffer */
93 	uint32_t response_data_length;		/**< length of response data buffer (bytes) */
94 	uint8_t *sense_data;			/**< pointer to sense data buffer */
95 	uint32_t sense_data_length;		/**< length of sense data buffer (bytes) */
96 	int32_t residual;			/**< command residual (not used for target), positive value
97 						  *  indicates an underflow, negative value indicates overflow
98 						  */
99 	uint32_t response_wire_length;		/**< Command response length received in wcqe */
100 } ocs_scsi_cmd_resp_t;
101 
102 /* Status values returned by IO callbacks */
103 typedef enum {
104 	OCS_SCSI_STATUS_GOOD = 0,
105 	OCS_SCSI_STATUS_ABORTED,
106 	OCS_SCSI_STATUS_ERROR,
107 	OCS_SCSI_STATUS_DIF_GUARD_ERROR,
108 	OCS_SCSI_STATUS_DIF_REF_TAG_ERROR,
109 	OCS_SCSI_STATUS_DIF_APP_TAG_ERROR,
110 	OCS_SCSI_STATUS_DIF_UNKNOWN_ERROR,
111 	OCS_SCSI_STATUS_PROTOCOL_CRC_ERROR,
112 	OCS_SCSI_STATUS_NO_IO,
113 	OCS_SCSI_STATUS_ABORT_IN_PROGRESS,
114 	OCS_SCSI_STATUS_CHECK_RESPONSE,
115 	OCS_SCSI_STATUS_COMMAND_TIMEOUT,
116 	OCS_SCSI_STATUS_TIMEDOUT_AND_ABORTED,
117 	OCS_SCSI_STATUS_SHUTDOWN,
118 	OCS_SCSI_STATUS_NEXUS_LOST,
119 
120 } ocs_scsi_io_status_e;
121 
122 /* SCSI command status */
123 #define SCSI_STATUS_GOOD				0x00
124 #define SCSI_STATUS_CHECK_CONDITION			0x02
125 #define SCSI_STATUS_CONDITION_MET			0x04
126 #define SCSI_STATUS_BUSY				0x08
127 #define SCSI_STATUS_RESERVATION_CONFLICT		0x18
128 #define SCSI_STATUS_TASK_SET_FULL			0x28
129 #define SCSI_STATUS_ACA_ACTIVE				0x30
130 #define SCSI_STATUS_TASK_ABORTED			0x40
131 
132 /* Callback used by send_rd_data(), recv_wr_data(), send_resp() */
133 typedef int32_t (*ocs_scsi_io_cb_t)(ocs_io_t *io, ocs_scsi_io_status_e status, uint32_t flags,
134 	void *arg);
135 
136 /* Callback used by send_rd_io(), send_wr_io() */
137 typedef int32_t (*ocs_scsi_rsp_io_cb_t)(ocs_io_t *io, ocs_scsi_io_status_e status, ocs_scsi_cmd_resp_t *rsp,
138 	uint32_t flags, void *arg);
139 
140 /* ocs_scsi_cb_t flags */
141 #define OCS_SCSI_IO_CMPL		(1U << 0)	/* IO completed */
142 #define OCS_SCSI_IO_CMPL_RSP_SENT	(1U << 1)	/* IO completed, response sent */
143 #define OCS_SCSI_IO_ABORTED		(1U << 2)	/* IO was aborted */
144 
145 /* ocs_scsi_recv_tmf() request values */
146 typedef enum {
147 	OCS_SCSI_TMF_ABORT_TASK = 1,
148 	OCS_SCSI_TMF_QUERY_TASK_SET,
149 	OCS_SCSI_TMF_ABORT_TASK_SET,
150 	OCS_SCSI_TMF_CLEAR_TASK_SET,
151 	OCS_SCSI_TMF_QUERY_ASYNCHRONOUS_EVENT,
152 	OCS_SCSI_TMF_LOGICAL_UNIT_RESET,
153 	OCS_SCSI_TMF_CLEAR_ACA,
154 	OCS_SCSI_TMF_TARGET_RESET,
155 } ocs_scsi_tmf_cmd_e;
156 
157 /* ocs_scsi_send_tmf_resp() response values */
158 typedef enum {
159 	OCS_SCSI_TMF_FUNCTION_COMPLETE = 1,
160 	OCS_SCSI_TMF_FUNCTION_SUCCEEDED,
161 	OCS_SCSI_TMF_FUNCTION_IO_NOT_FOUND,
162 	OCS_SCSI_TMF_FUNCTION_REJECTED,
163 	OCS_SCSI_TMF_INCORRECT_LOGICAL_UNIT_NUMBER,
164 	OCS_SCSI_TMF_SERVICE_DELIVERY,
165 } ocs_scsi_tmf_resp_e;
166 
167 /**
168  * @brief property names for ocs_scsi_get_property() functions
169  */
170 
171 typedef enum {
172 	OCS_SCSI_MAX_SGE,
173 	OCS_SCSI_MAX_SGL,
174 	OCS_SCSI_WWNN,
175 	OCS_SCSI_WWPN,
176 	OCS_SCSI_SERIALNUMBER,
177 	OCS_SCSI_PARTNUMBER,
178 	OCS_SCSI_PORTNUM,
179 	OCS_SCSI_BIOS_VERSION_STRING,
180 	OCS_SCSI_MAX_IOS,
181 	OCS_SCSI_DIF_CAPABLE,
182 	OCS_SCSI_DIF_MULTI_SEPARATE,
183 	OCS_SCSI_MAX_FIRST_BURST,
184 	OCS_SCSI_ENABLE_TASK_SET_FULL,
185 } ocs_scsi_property_e;
186 
187 #define DIF_SIZE		8
188 
189 /**
190  * @brief T10 DIF operations
191  *
192  *	WARNING: do not reorder or insert to this list without making appropriate changes in ocs_dif.c
193  */
194 typedef enum {
195 	OCS_SCSI_DIF_OPER_DISABLED,
196 	OCS_SCSI_DIF_OPER_IN_NODIF_OUT_CRC,
197 	OCS_SCSI_DIF_OPER_IN_CRC_OUT_NODIF,
198 	OCS_SCSI_DIF_OPER_IN_NODIF_OUT_CHKSUM,
199 	OCS_SCSI_DIF_OPER_IN_CHKSUM_OUT_NODIF,
200 	OCS_SCSI_DIF_OPER_IN_CRC_OUT_CRC,
201 	OCS_SCSI_DIF_OPER_IN_CHKSUM_OUT_CHKSUM,
202 	OCS_SCSI_DIF_OPER_IN_CRC_OUT_CHKSUM,
203 	OCS_SCSI_DIF_OPER_IN_CHKSUM_OUT_CRC,
204 	OCS_SCSI_DIF_OPER_IN_RAW_OUT_RAW,
205 } ocs_scsi_dif_oper_e;
206 #define OCS_SCSI_DIF_OPER_PASS_THRU	OCS_SCSI_DIF_OPER_IN_CRC_OUT_CRC
207 #define OCS_SCSI_DIF_OPER_STRIP		OCS_SCSI_DIF_OPER_IN_CRC_OUT_NODIF
208 #define OCS_SCSI_DIF_OPER_INSERT	OCS_SCSI_DIF_OPER_IN_NODIF_OUT_CRC
209 
210 /**
211  * @brief T10 DIF block sizes
212  */
213 typedef enum {
214 	OCS_SCSI_DIF_BK_SIZE_512,
215 	OCS_SCSI_DIF_BK_SIZE_1024,
216 	OCS_SCSI_DIF_BK_SIZE_2048,
217 	OCS_SCSI_DIF_BK_SIZE_4096,
218 	OCS_SCSI_DIF_BK_SIZE_520,
219 	OCS_SCSI_DIF_BK_SIZE_4104
220 } ocs_scsi_dif_blk_size_e;
221 
222 /**
223  * @brief generic scatter-gather list structure
224  */
225 
226 typedef struct ocs_scsi_sgl_s {
227 	uintptr_t	addr;			/**< physical address */
228 	uintptr_t	dif_addr;		/**< address of DIF segment, zero if DIF is interleaved */
229 	size_t		len;			/**< length */
230 } ocs_scsi_sgl_t;
231 
232 /**
233  * @brief T10 DIF information passed to the transport
234  */
235 
236 typedef struct ocs_scsi_dif_info_s {
237 	ocs_scsi_dif_oper_e dif_oper;
238 	ocs_scsi_dif_blk_size_e blk_size;
239 	uint32_t ref_tag;
240 	uint32_t app_tag:16,
241 		check_ref_tag:1,
242 		check_app_tag:1,
243 		check_guard:1,
244 		dif_separate:1,
245 
246 		/* If the APP TAG is 0xFFFF, disable checking the REF TAG and CRC fields */
247 		disable_app_ffff:1,
248 
249 		/* if the APP TAG is 0xFFFF and REF TAG is 0xFFFF_FFFF, disable checking the received CRC field. */
250 		disable_app_ref_ffff:1,
251 		:10;
252 	uint64_t lba;
253 } ocs_scsi_dif_info_t;
254 
255 /* Return values for calls from base driver to target-server/initiator-client */
256 #define OCS_SCSI_CALL_COMPLETE	0 /* All work is done */
257 #define OCS_SCSI_CALL_ASYNC	1 /* Work will be completed asynchronously */
258 
259 /* Calls from target/initiator to base driver */
260 
261 typedef enum {
262 	OCS_SCSI_IO_ROLE_ORIGINATOR,
263 	OCS_SCSI_IO_ROLE_RESPONDER,
264 } ocs_scsi_io_role_e;
265 
266 extern void ocs_scsi_io_alloc_enable(ocs_node_t *node);
267 extern void ocs_scsi_io_alloc_disable(ocs_node_t *node);
268 extern ocs_io_t *ocs_scsi_io_alloc(ocs_node_t *node, ocs_scsi_io_role_e role);
269 extern void ocs_scsi_io_free(ocs_io_t *io);
270 extern ocs_io_t *ocs_io_get_instance(ocs_t *ocs, uint32_t index);
271 
272 extern void ocs_scsi_register_bounce(ocs_t *ocs, void(*fctn)(void(*fctn)(void *arg), void *arg,
273 							     uint32_t s_id, uint32_t d_id, uint32_t ox_id));
274 
275 /* Calls from base driver to target-server */
276 
277 extern int32_t ocs_scsi_tgt_driver_init(void);
278 extern int32_t ocs_scsi_tgt_driver_exit(void);
279 extern int32_t ocs_scsi_tgt_io_init(ocs_io_t *io);
280 extern int32_t ocs_scsi_tgt_io_exit(ocs_io_t *io);
281 extern int32_t ocs_scsi_tgt_new_device(ocs_t *ocs);
282 extern int32_t ocs_scsi_tgt_del_device(ocs_t *ocs);
283 extern int32_t ocs_scsi_tgt_new_domain(ocs_domain_t *domain);
284 extern void ocs_scsi_tgt_del_domain(ocs_domain_t *domain);
285 extern int32_t ocs_scsi_tgt_new_sport(ocs_sport_t *sport);
286 extern void ocs_scsi_tgt_del_sport(ocs_sport_t *sport);
287 extern void ocs_scsi_sport_deleted(ocs_sport_t *sport);
288 extern int32_t ocs_scsi_validate_initiator(ocs_node_t *node);
289 extern int32_t ocs_scsi_new_initiator(ocs_node_t *node);
290 typedef enum {
291 	OCS_SCSI_INITIATOR_DELETED,
292 	OCS_SCSI_INITIATOR_MISSING,
293 } ocs_scsi_del_initiator_reason_e;
294 extern int32_t ocs_scsi_del_initiator(ocs_node_t *node, ocs_scsi_del_initiator_reason_e reason);
295 extern int32_t ocs_scsi_recv_cmd(ocs_io_t *io, uint64_t lun, uint8_t *cdb, uint32_t cdb_len, uint32_t flags);
296 extern int32_t ocs_scsi_recv_cmd_first_burst(ocs_io_t *io, uint64_t lun, uint8_t *cdb, uint32_t cdb_len, uint32_t flags,
297 	ocs_dma_t first_burst_buffers[], uint32_t first_burst_bytes);
298 extern int32_t ocs_scsi_recv_tmf(ocs_io_t *tmfio, uint64_t lun, ocs_scsi_tmf_cmd_e cmd, ocs_io_t *abortio,
299 	uint32_t flags);
300 extern ocs_sport_t *ocs_sport_get_instance(ocs_domain_t *domain, uint32_t index);
301 extern ocs_domain_t *ocs_domain_get_instance(ocs_t *ocs, uint32_t index);
302 
303 /* Calls from target-server to base driver */
304 
305 extern int32_t ocs_scsi_send_rd_data(ocs_io_t *io, uint32_t flags,
306 	ocs_scsi_dif_info_t *dif_info,
307 	ocs_scsi_sgl_t *sgl, uint32_t sgl_count,
308 	uint32_t wire_len, ocs_scsi_io_cb_t cb, void *arg);
309 extern int32_t ocs_scsi_recv_wr_data(ocs_io_t *io, uint32_t flags,
310 	ocs_scsi_dif_info_t *dif_info,
311 	ocs_scsi_sgl_t *sgl, uint32_t sgl_count,
312 	uint32_t wire_len, ocs_scsi_io_cb_t cb, void *arg);
313 extern int32_t ocs_scsi_send_resp(ocs_io_t *io, uint32_t flags, ocs_scsi_cmd_resp_t *rsp,
314 		ocs_scsi_io_cb_t cb, void *arg);
315 extern int32_t ocs_scsi_send_tmf_resp(ocs_io_t *io, ocs_scsi_tmf_resp_e rspcode, uint8_t addl_rsp_info[3],
316 		ocs_scsi_io_cb_t cb, void *arg);
317 extern int32_t ocs_scsi_tgt_abort_io(ocs_io_t *io, ocs_scsi_io_cb_t cb, void *arg);
318 extern void ocs_scsi_io_complete(ocs_io_t *io);
319 extern uint32_t ocs_scsi_get_property(ocs_t *ocs, ocs_scsi_property_e prop);
320 extern void *ocs_scsi_get_property_ptr(ocs_t *ocs, ocs_scsi_property_e prop);
321 
322 extern void ocs_scsi_del_initiator_complete(ocs_node_t *node);
323 
324 extern void ocs_scsi_update_first_burst_transferred(ocs_io_t *io, uint32_t transferred);
325 
326 /* Calls from base driver to initiator-client */
327 
328 extern int32_t ocs_scsi_ini_driver_init(void);
329 extern int32_t ocs_scsi_ini_driver_exit(void);
330 extern int32_t ocs_scsi_ini_io_init(ocs_io_t *io);
331 extern int32_t ocs_scsi_ini_io_exit(ocs_io_t *io);
332 extern int32_t ocs_scsi_ini_new_device(ocs_t *ocs);
333 extern int32_t ocs_scsi_ini_del_device(ocs_t *ocs);
334 extern int32_t ocs_scsi_ini_new_domain(ocs_domain_t *domain);
335 extern void ocs_scsi_ini_del_domain(ocs_domain_t *domain);
336 extern int32_t ocs_scsi_ini_new_sport(ocs_sport_t *sport);
337 extern void ocs_scsi_ini_del_sport(ocs_sport_t *sport);
338 extern int32_t ocs_scsi_new_target(ocs_node_t *node);
339 
340 typedef enum {
341 	OCS_SCSI_TARGET_DELETED,
342 	OCS_SCSI_TARGET_MISSING,
343 } ocs_scsi_del_target_reason_e;
344 extern int32_t ocs_scsi_del_target(ocs_node_t *node, ocs_scsi_del_target_reason_e reason);
345 
346 /* Calls from the initiator-client to the base driver */
347 
348 extern int32_t ocs_scsi_send_rd_io(ocs_node_t *node, ocs_io_t *io, uint64_t lun, void *cdb, uint32_t cdb_len,
349 	ocs_scsi_dif_info_t *dif_info,
350 	ocs_scsi_sgl_t *sgl, uint32_t sgl_count, uint32_t wire_len, ocs_scsi_rsp_io_cb_t cb, void *arg, uint32_t flags);
351 extern int32_t ocs_scsi_send_wr_io(ocs_node_t *node, ocs_io_t *io, uint64_t lun, void *cdb, uint32_t cdb_len,
352 	ocs_scsi_dif_info_t *dif_info,
353 	ocs_scsi_sgl_t *sgl, uint32_t sgl_count, uint32_t wire_len, ocs_scsi_rsp_io_cb_t cb, void *arg, uint32_t flags);
354 extern int32_t ocs_scsi_send_wr_io_first_burst(ocs_node_t *node, ocs_io_t *io, uint64_t lun, void *cdb, uint32_t cdb_len,
355 	ocs_scsi_dif_info_t *dif_info,
356 	ocs_scsi_sgl_t *sgl, uint32_t sgl_count, uint32_t wire_len, uint32_t first_burst,
357 	ocs_scsi_rsp_io_cb_t cb, void *arg, uint32_t flags);
358 extern int32_t ocs_scsi_send_tmf(ocs_node_t *node, ocs_io_t *io, ocs_io_t *io_to_abort, uint64_t lun,
359 	ocs_scsi_tmf_cmd_e tmf, ocs_scsi_sgl_t *sgl, uint32_t sgl_count, uint32_t len, ocs_scsi_rsp_io_cb_t cb, void *arg);
360 extern int32_t ocs_scsi_send_nodata_io(ocs_node_t *node, ocs_io_t *io, uint64_t lun, void *cdb, uint32_t cdb_len,
361 	ocs_scsi_rsp_io_cb_t cb, void *arg, uint32_t flags);
362 extern void ocs_scsi_del_target_complete(ocs_node_t *node);
363 
364 typedef enum {
365 	OCS_SCSI_DDUMP_DEVICE,
366 	OCS_SCSI_DDUMP_DOMAIN,
367 	OCS_SCSI_DDUMP_SPORT,
368 	OCS_SCSI_DDUMP_NODE,
369 	OCS_SCSI_DDUMP_IO,
370 } ocs_scsi_ddump_type_e;
371 
372 /* base driver to target/initiator */
373 
374 struct ocs_scsi_vaddr_len_s {
375 	void *vaddr;
376 	uint32_t length;
377 } ;
378 extern int32_t ocs_scsi_get_block_vaddr(ocs_io_t *io, uint64_t blocknumber, ocs_scsi_vaddr_len_t addrlen[],
379 	uint32_t max_addrlen, void **dif_vaddr);
380 
381 extern void ocs_scsi_ini_ddump(ocs_textbuf_t *textbuf, ocs_scsi_ddump_type_e type, void *obj);
382 extern void ocs_scsi_tgt_ddump(ocs_textbuf_t *textbuf, ocs_scsi_ddump_type_e type, void *obj);
383 
384 /* Calls within base driver */
385 extern int32_t ocs_scsi_io_dispatch(ocs_io_t *io, void *cb);
386 extern int32_t ocs_scsi_io_dispatch_abort(ocs_io_t *io, void *cb);
387 extern void ocs_scsi_check_pending(ocs_t *ocs);
388 
389 extern uint32_t ocs_scsi_dif_blocksize(ocs_scsi_dif_info_t *dif_info);
390 extern int32_t ocs_scsi_dif_set_blocksize(ocs_scsi_dif_info_t *dif_info, uint32_t blocksize);
391 extern int32_t ocs_scsi_dif_mem_blocksize(ocs_scsi_dif_info_t *dif_info, int wiretomem);
392 extern int32_t ocs_scsi_dif_wire_blocksize(ocs_scsi_dif_info_t *dif_info, int wiretomem);
393 
394 uint32_t ocs_get_crn(ocs_node_t *node, uint8_t *crn, uint64_t lun);
395 void ocs_del_crn(ocs_node_t *node);
396 void ocs_reset_crn(ocs_node_t *node, uint64_t lun);
397 
398 /**
399  * @brief Notification from base driver that domain is in force-free path.
400  *
401  * @par Description Domain is forcefully going away.  Cleanup any resources associated with it.
402  *
403  * @param domain Pointer to domain being free'd.
404  *
405  * @return None.
406  */
407 
408 static inline void
409 ocs_scsi_notify_domain_force_free(ocs_domain_t *domain)
410 {
411 	/* Nothing to do */
412 	return;
413 }
414 
415 /**
416  * @brief Notification from base driver that sport is in force-free path.
417  *
418  * @par Description Sport is forcefully going away.  Cleanup any resources associated with it.
419  *
420  * @param sport Pointer to sport being free'd.
421  *
422  * @return None.
423  */
424 
425 static inline void
426 ocs_scsi_notify_sport_force_free(ocs_sport_t *sport)
427 {
428 	/* Nothing to do */
429 	return;
430 }
431 
432 /**
433  * @brief Notification from base driver that node is in force-free path.
434  *
435  * @par Description Node is forcefully going away.  Cleanup any resources associated with it.
436  *
437  * @param node Pointer to node being free'd.
438  *
439  * @return None.
440  */
441 
442 static inline void
443 ocs_scsi_notify_node_force_free(ocs_node_t *node)
444 {
445 	/* Nothing to do */
446 	return;
447 }
448 #endif /* __OCS_SCSI_H__ */
449