450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * CDDL HEADER START
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * The contents of this file are subject to the terms of the
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Common Development and Distribution License (the "License").
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * You may not use this file except in compliance with the License.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * See the License for the specific language governing permissions
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * and limitations under the License.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * If applicable, add the following below this CDDL HEADER, with the
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * CDDL HEADER END
716c180559045549271833327182dc6a266134f1Nattuvetty Bhavyan * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * ALUA messaging and interconnect API.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Message type.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef enum {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Message id: uniquely identifies a message.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * This need not be a sequence number since we don't depend on
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * messages being delivered in sequence.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * IC message. This is a container for the various specific message types.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Note that the message contains a pointer to an nvlist. This pointer
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * is valid only in the case of messages which are unmarshaled from
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * nvlists. In that case, it's important to retain a pointer to the nvlist,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * since the message and the nvlist share data in the case of strings
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * and array elements, and data in the message may be invalid if used
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * after the nvlist is freed.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte nvlist_t *icm_nvlist; /* nvlist associated with the msg */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Register port message.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef struct {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /* opaque callback data */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Deregister port message.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef struct {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /* opaque callback data */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Register/deregister lun message.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef struct {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /* opaque callback data */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * SCSI cmd msg.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef struct {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * fields from scsi_task_t
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t icsc_task_flags; /* See def. for task flags */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t icsc_task_mgmt_function; /* if is a TM req */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * SCSI data message.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef struct {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t icsd_task_msgid; /* matches msgid of cmd */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * SCSI data xfer done msg
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef struct {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t icsx_task_msgid; /* matches msgid of cmd */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * SCSI status msg.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef struct {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t icss_task_msgid; /* matches msgid of cmd */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t icss_response; /* was command processed? */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t icss_flags; /* TASK_SCTRL_OVER, TASK_SCTRL_UNDER */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Ready to transfer (r2t) msg.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef struct {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t icrt_task_msgid; /* matches msgid of cmd */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Status message: sent in response to messages other than SCSI messages.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef struct {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msg_type_t ics_msg_type; /* msg type rpting status on */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t ics_msgid; /* msgid reporting status on */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Session create/destroy message.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef struct {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Echo request/reply message
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef struct {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef enum {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Function prototypes.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Note: Functions which are exported to other modules must have a function
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * typedef and a prototype; the function type definition is used by
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * the other module to import the symbol using ddi_modsym().
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortevoid stmf_ic_ioctl_cmd(void *ibuf, uint32_t ibuf_size);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate a register port message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *(*stmf_ic_reg_port_msg_alloc_func_t)(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate a deregister port message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *(*stmf_ic_dereg_port_msg_alloc_func_t)(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate a register lun message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *(*stmf_ic_reg_lun_msg_alloc_func_t)(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate a lun active message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *(*stmf_ic_lun_active_msg_alloc_func_t)(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate a deregister lun message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *(*stmf_ic_dereg_lun_msg_alloc_func_t)(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate a scsi cmd message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *(*stmf_ic_scsi_cmd_msg_alloc_func_t)(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate a scsi data message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *(*stmf_ic_scsi_data_msg_alloc_func_t)(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate a scsi transfer done message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *(*stmf_ic_scsi_data_xfer_done_msg_alloc_func_t)(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *stmf_ic_scsi_data_xfer_done_msg_alloc(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate a scsi status message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid); /* must match corresponding scsi cmd msgid */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate a scsi ready to transfer (r2t) message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid); /* must match corresponding scsi cmd msgid */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate a status message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msg_type_t msg_type, /* msg type reporting status on */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid); /* id of msg reporting status on */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate a session create message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *(*stmf_ic_session_create_msg_alloc_func_t)(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate a session destroy message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *(*stmf_ic_session_destroy_msg_alloc_func_t)(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate an echo request message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate an echo reply message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Free a msg.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef void (*stmf_ic_msg_free_func_t)(stmf_ic_msg_t *msg);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Send a message out over the interconnect, in the process marshalling
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * the arguments.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * After being sent, the message is freed by tx_msg().
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef stmf_ic_msg_status_t (*stmf_ic_tx_msg_func_t)(stmf_ic_msg_t *msg);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_status_t stmf_ic_tx_msg(stmf_ic_msg_t *msg);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * This is a low-level upcall which is called when a message has
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * been received on the interconnect.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte#endif /* _SYS_PPPT_IC_IF_H */