5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
23 */
24 /*
25 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
26 */
27
28 #ifndef _IDM_IMPL_H_
29 #define _IDM_IMPL_H_
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 #include <sys/avl.h>
36 #include <sys/socket_impl.h>
37 #include <sys/taskq_impl.h>
38
39 /*
40 * IDM lock order:
41 *
42 * idm_taskid_table_lock, idm_task_t.idt_mutex
43 */
44
45 #define CF_LOGIN_READY 0x00000001
360 * isp_data is used for sending SCSI status, NOP, text, scsi and
361 * non-scsi data. Data is received using isp_iov and isp_iovlen
362 * to support data over multiple buffers.
363 */
364 void *isp_private;
365 idm_pdu_cb_t *isp_callback;
366 idm_status_t isp_status;
367
368 /*
369 * The following four elements are only used in
370 * idm_sorecv_scsidata() currently.
371 */
372 struct iovec isp_iov[PDU_MAX_IOVLEN];
373 int isp_iovlen;
374 idm_buf_t *isp_sorx_buf;
375
376 /* Implementation data for idm_pdu_alloc and sorx PDU cache */
377 uint32_t isp_flags;
378 uint_t isp_hdrbuflen;
379 uint_t isp_databuflen;
380 time_t isp_queue_time;
381
382 /* Taskq dispatching state for deferred PDU */
383 taskq_ent_t isp_tqent;
384 } idm_pdu_t;
385
386 /*
387 * This "generic" object is used when removing an item from the ic_tx_list
388 * in order to determine whether it's an idm_pdu_t or an idm_buf_t
389 */
390
391 typedef struct {
392 uint32_t idm_tx_obj_magic;
393 /*
394 * idm_tx_link *must* be the second element in this structure.
395 */
396 list_node_t idm_tx_link;
397 } idm_tx_obj_t;
398
399
400 #define IDM_PDU_OPCODE(PDU) \
|
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
23 */
24 /*
25 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
26 */
27
28 #ifndef _IDM_IMPL_H_
29 #define _IDM_IMPL_H_
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 #include <sys/avl.h>
36 #include <sys/socket_impl.h>
37 #include <sys/taskq_impl.h>
38
39 /*
40 * IDM lock order:
41 *
42 * idm_taskid_table_lock, idm_task_t.idt_mutex
43 */
44
45 #define CF_LOGIN_READY 0x00000001
360 * isp_data is used for sending SCSI status, NOP, text, scsi and
361 * non-scsi data. Data is received using isp_iov and isp_iovlen
362 * to support data over multiple buffers.
363 */
364 void *isp_private;
365 idm_pdu_cb_t *isp_callback;
366 idm_status_t isp_status;
367
368 /*
369 * The following four elements are only used in
370 * idm_sorecv_scsidata() currently.
371 */
372 struct iovec isp_iov[PDU_MAX_IOVLEN];
373 int isp_iovlen;
374 idm_buf_t *isp_sorx_buf;
375
376 /* Implementation data for idm_pdu_alloc and sorx PDU cache */
377 uint32_t isp_flags;
378 uint_t isp_hdrbuflen;
379 uint_t isp_databuflen;
380 hrtime_t isp_queue_time;
381
382 /* Taskq dispatching state for deferred PDU */
383 taskq_ent_t isp_tqent;
384 } idm_pdu_t;
385
386 /*
387 * This "generic" object is used when removing an item from the ic_tx_list
388 * in order to determine whether it's an idm_pdu_t or an idm_buf_t
389 */
390
391 typedef struct {
392 uint32_t idm_tx_obj_magic;
393 /*
394 * idm_tx_link *must* be the second element in this structure.
395 */
396 list_node_t idm_tx_link;
397 } idm_tx_obj_t;
398
399
400 #define IDM_PDU_OPCODE(PDU) \
|