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