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
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) \
401 ((PDU)->isp_hdr->opcode & ISCSI_OPCODE_MASK)
402
403 #define IDM_PDU_ALLOC 0x00000001
404 #define IDM_PDU_ADDL_HDR 0x00000002
405 #define IDM_PDU_ADDL_DATA 0x00000004
406 #define IDM_PDU_LOGIN_TX 0x00000008
407 #define IDM_PDU_SET_STATSN 0x00000010
408 #define IDM_PDU_ADVANCE_STATSN 0x00000020
409
410 #define OSD_EXT_CDB_AHSLEN (200 - 15)
411 #define BIDI_AHS_LENGTH 5
412 #define IDM_SORX_CACHE_AHSLEN \
413 (((OSD_EXT_CDB_AHSLEN + 3) + \
414 (BIDI_AHS_LENGTH + 3)) / sizeof (uint32_t))
415 #define IDM_SORX_CACHE_HDRLEN (sizeof (iscsi_hdr_t) + IDM_SORX_CACHE_AHSLEN)
416
417 /*
418 * ID pool
419 */
420
421 #define IDM_IDPOOL_MAGIC 0x4944504C /* IDPL */
422 #define IDM_IDPOOL_MIN_SIZE 64 /* Number of IDs to begin with */
423 #define IDM_IDPOOL_MAX_SIZE 64 * 1024
424
425 typedef struct idm_idpool {
426 uint32_t id_magic;
427 kmutex_t id_mutex;
428 uint8_t *id_pool;
429 uint32_t id_size;
430 uint8_t id_bit;
431 uint8_t id_bit_idx;
432 uint32_t id_idx;
433 uint32_t id_idx_msk;
434 uint32_t id_free_counter;
|
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-2015 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
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) \
401 ((PDU)->isp_hdr->opcode & ISCSI_OPCODE_MASK)
402
403 #define IDM_PDU_ALLOC 0x00000001
404 #define IDM_PDU_ADDL_HDR 0x00000002
405 #define IDM_PDU_ADDL_DATA 0x00000004
406 #define IDM_PDU_LOGIN_TX 0x00000008
407 #define IDM_PDU_SET_STATSN 0x00000010
408 #define IDM_PDU_ADVANCE_STATSN 0x00000020
409
410 #define OSD_EXT_CDB_AHSLEN (200 - 15)
411 #define BIDI_AHS_LENGTH 5
412 /*
413 * Additional Header Segment (AHS)
414 * AHS is only valid for SCSI Requests and contains SCSI CDB information
415 * which doesn't fit in the standard 16 byte area of the PDU. Commonly
416 * this only holds true for OSD device commands.
417 *
418 * IDM_SORX_CACHE_ASHLEN is the amount of memory which is preallocated in bytes.
419 * When used in the header the AHS length is stored as the number of 4-byte
420 * words; so IDM_SORX_WIRE_ASHLEN is IDM_SORX_CACHE_ASHLEN in words.
421 */
422 #define IDM_SORX_CACHE_AHSLEN \
423 ((OSD_EXT_CDB_AHSLEN + 3) + (BIDI_AHS_LENGTH + 3))
424 #define IDM_SORX_WIRE_AHSLEN (IDM_SORX_CACHE_AHSLEN / sizeof (uint32_t))
425 #define IDM_SORX_CACHE_HDRLEN (sizeof (iscsi_hdr_t) + IDM_SORX_CACHE_AHSLEN)
426
427 /*
428 * ID pool
429 */
430
431 #define IDM_IDPOOL_MAGIC 0x4944504C /* IDPL */
432 #define IDM_IDPOOL_MIN_SIZE 64 /* Number of IDs to begin with */
433 #define IDM_IDPOOL_MAX_SIZE 64 * 1024
434
435 typedef struct idm_idpool {
436 uint32_t id_magic;
437 kmutex_t id_mutex;
438 uint8_t *id_pool;
439 uint32_t id_size;
440 uint8_t id_bit;
441 uint8_t id_bit_idx;
442 uint32_t id_idx;
443 uint32_t id_idx_msk;
444 uint32_t id_free_counter;
|