iser.h revision 30e7468f8f41aa30ada067b2c1d5d284046514da
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap * CDDL HEADER START
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap * The contents of this file are subject to the terms of the
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap * Common Development and Distribution License (the "License").
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap * You may not use this file except in compliance with the License.
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap * See the License for the specific language governing permissions
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap * and limitations under the License.
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap * When distributing Covered Code, include this CDDL HEADER in each
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap * If applicable, add the following below this CDDL HEADER, with the
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap * fields enclosed by brackets "[]" replaced with your own identifying
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap * information: Portions Copyright [yyyy] [name of copyright owner]
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap * CDDL HEADER END
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap * Use is subject to license terms.
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap * Definitions and macros related to iSER core functionality,
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap * softstate and DDI routines.
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap#define ISER_DELAY_HALF_SECOND 500000 /* for use with drv_usectohz() */
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap/* iSER Operational Parameters */
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap#define ISER_TARGET_RECV_DATA_SEGMENT_LENGTH_MIN 0x200
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap#define ISER_TARGET_RECV_DATA_SEGMENT_LENGTH_MAX 0xFFFFFF
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap#define ISER_TARGET_RECV_DATA_SEGMENT_LENGTH_IMPL_MAX 0xFFFFFF
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap#define ISER_TARGET_RECV_DATA_SEGMENT_LENGTH_DEFAULT \
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap#define ISER_INITIATOR_RECV_DATA_SEGMENT_LENGTH_MIN 0x200
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap#define ISER_INITIATOR_RECV_DATA_SEGMENT_LENGTH_MAX 0xFFFFFF
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap#define ISER_INITIATOR_RECV_DATA_SEGMENT_LENGTH_IMPL_MAX 0xFFFFFF
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap#define ISER_INITIATOR_RECV_DATA_SEGMENT_LENGTH_DEFAULT \
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap#define ISER_MAX_OUTSTANDING_UNEXPECTED_PDUS_MIN 0x0
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap#define ISER_MAX_OUTSTANDING_UNEXPECTED_PDUS_MAX 0xFFFFFFFF
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap#define ISER_MAX_OUTSTANDING_UNEXPECTED_PDUS_IMPL_MAX 0xFFFFFFFF
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap#define ISER_MAX_OUTSTANDING_UNEXPECTED_PDUS_DEFAULT 0x0
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap/* iSCSI key names that iSER is interested in */
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap#define ISER_KV_KEY_NAME_RDMA_EXTENSIONS "RDMAExtensions"
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap#define ISER_KV_KEY_NAME_TGT_RECV_SEGLEN "TargetRecvDataSegmentLength"
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap#define ISER_KV_KEY_NAME_INI_RECV_SEGLEN "InitiatorRecvDataSegmentLength"
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap#define ISER_KV_KEY_NAME_MAX_OUTSTANDING_PDU "MaxOutstandingUnexpectedPDUs"
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlaptypedef struct iser_sbind_s {
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap/* iSER-specific portion of idm_svc_t */
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlaptypedef struct iser_svc_s {
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap /* list of service bind handles - one per HCA port */
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap * iSER endpoint connection type
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlaptypedef enum {
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap * iSER Connection States to keep track of the connection going into
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap * iSER-assisted mode
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlaptypedef enum {
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap ISER_CONN_STAGE_ALLOCATED, /* conn handle allocated */
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap ISER_CONN_STAGE_IC_CONNECTED, /* conn established */
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap ISER_CONN_STAGE_HELLO_SENT, /* hello exchange stages */
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap ISER_CONN_STAGE_IC_DISCONNECTED, /* conn disconnected */
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap ISER_CONN_STAGE_IC_FREED, /* conn handle allocated */
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap * iSER operations parameters negotiated for a given connection
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlaptypedef struct iser_op_params_s {
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap uint64_t op_initiator_recv_data_segment_length;
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap * iSER connection information
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlaptypedef struct iser_conn_s {
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap iser_conn_stage_t ic_stage; /* for iSER-assisted mode */
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap * iser_state_t is the iser driver's state structure, encoding all of
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap * the state information.
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlaptypedef struct iser_state_s {
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap /* IDM open ref counter and lock */
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap /* list of HCAs */
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap kmutex_t is_hcalist_lock; /* locked by is_hcalist_lock */
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap /* Connection list */
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap /* Global work request handle cache */
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlaptypedef enum {
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlapiser_status_t iser_register_service(idm_svc_t *idm_svc);
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlapiser_status_t iser_bind_service(idm_svc_t *idm_svc);
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlapvoid iser_deregister_service(idm_svc_t *idm_svc);
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlapboolean_t iser_path_exists(idm_sockaddr_t *laddr, idm_sockaddr_t *raddr);
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlapiser_chan_t *iser_channel_alloc(idm_sockaddr_t *laddr, idm_sockaddr_t *raddr);
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlapiser_status_t iser_channel_open(iser_chan_t *chan);
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlapvoid iser_internal_conn_destroy(iser_conn_t *ic);
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap/* IDM refcnt utilities for the iSER tgt svc handle */
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap#endif /* _ISER_H */