summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/sys
diff options
context:
space:
mode:
authorZhong Wang <Zhong.Wang@Sun.COM>2009-08-05 17:14:23 -0700
committerZhong Wang <Zhong.Wang@Sun.COM>2009-08-05 17:14:23 -0700
commit7ff836697c120cb94bd30d5c2204eb9b74718e4c (patch)
tree2fec718afdfa781207ea1408a409fd0394e89bd8 /usr/src/uts/common/sys
parent0df7087fda4bb16f7e1cf07d1b90fcf070c19484 (diff)
downloadillumos-joyent-7ff836697c120cb94bd30d5c2204eb9b74718e4c.tar.gz
PSARC 2008/311 FCoE (Fibre Channel over Ethernet) Initiator
6823827 FCoE initiator for Leadville
Diffstat (limited to 'usr/src/uts/common/sys')
-rw-r--r--usr/src/uts/common/sys/fcoe/fcoe_common.h49
-rw-r--r--usr/src/uts/common/sys/fibre-channel/impl/fc_portif.h42
-rw-r--r--usr/src/uts/common/sys/fibre-channel/impl/fcgs2.h5
-rw-r--r--usr/src/uts/common/sys/fibre-channel/impl/fctl.h14
-rw-r--r--usr/src/uts/common/sys/fibre-channel/ulp/fcp.h61
-rw-r--r--usr/src/uts/common/sys/fibre-channel/ulp/fcpvar.h68
-rw-r--r--usr/src/uts/common/sys/fibre-channel/ulp/fcsm.h70
7 files changed, 193 insertions, 116 deletions
diff --git a/usr/src/uts/common/sys/fcoe/fcoe_common.h b/usr/src/uts/common/sys/fcoe/fcoe_common.h
index c59554c2e7..6ab5ea2cbf 100644
--- a/usr/src/uts/common/sys/fcoe/fcoe_common.h
+++ b/usr/src/uts/common/sys/fcoe/fcoe_common.h
@@ -57,10 +57,8 @@ extern "C" {
#define FLOGI_REQ_PAYLOAD_SIZE 116
#define FLOGI_ACC_PAYLOAD_SIZE 116
-/*
- * Minimum MTU size
- */
#define FCOE_MIN_MTU_SIZE 2500
+#define FCOE_MAX_FC_FRAME_SIZE 2136
/*
* 24 byte FC frame header
@@ -96,10 +94,19 @@ struct fcoe_port;
typedef struct fcoe_frame {
uint32_t frm_flags;
void *frm_netb;
+
+ /*
+ * frm_hdr will be cleared by fcoe explicitly
+ */
fcoe_fc_frame_header_t *frm_hdr;
uint8_t *frm_ofh1;
uint8_t *frm_ofh2;
uint8_t *frm_fc_frame;
+
+ /*
+ * fcoe client need clear FC payload explicitly,
+ * except for RD/WR data frames
+ */
uint8_t *frm_payload;
uint32_t frm_fc_frame_size;
uint32_t frm_payload_size;
@@ -107,6 +114,7 @@ typedef struct fcoe_frame {
struct fcoe_port *frm_eport;
void *frm_fcoe_private;
void *frm_client_private;
+ clock_t frm_clock;
} fcoe_frame_t;
/*
@@ -122,6 +130,7 @@ typedef struct fcoe_port {
uint32_t eport_mtu;
uint64_t eport_link_speed;
uint8_t eport_efh_dst[ETHERADDRL];
+
void (*eport_tx_frame)(fcoe_frame_t *frame);
fcoe_frame_t *(*eport_alloc_frame)(struct fcoe_port *eport,
uint32_t this_fc_frame_size, void *netb);
@@ -152,7 +161,23 @@ typedef struct fcoe_port {
#define FCOE_CMD_PORT_ONLINE (FCOE_PORT_CTL_CMDS | 0x01)
#define FCOE_CMD_PORT_OFFLINE (FCOE_PORT_CTL_CMDS | 0x02)
+/*
+ * FCoE version control
+ */
+typedef enum fcoe_ver
+{
+ FCOE_VER_1 = 0xAA01,
+ FCOE_VER_2,
+ FCOE_VER_3,
+ FCOE_VER_4,
+ FCOE_VER_5
+} fcoe_ver_e;
+
+#define FCOE_VER_NOW FCOE_VER_1
+extern const fcoe_ver_e fcoe_ver_now;
+
typedef struct fcoe_client {
+ fcoe_ver_e ect_fcoe_ver;
uint32_t ect_eport_flags;
uint32_t ect_max_fc_frame_size;
uint32_t ect_private_frame_struct_size;
@@ -262,6 +287,7 @@ typedef struct fcoe_client {
* frame header checking
*/
#define FRM_IS_LAST_FRAME(x_frm) (FRM_F_CTL(x_frm) & (1 << 19))
+#define FRM_SENDER_IS_XCH_RESPONDER(x_frm) (FRM_F_CTL(x_frm) & (1 << 23))
/*
* FCOET/FCOEI will only call this fcoe function explicitly, all others
@@ -336,7 +362,24 @@ typedef struct fcoe_fcp_xfer_rdy {
/*
* FCOE project global functions
*/
+#if !defined(__FUNCTION__)
+#define __FUNCTION__ ((caddr_t)__func__)
+#endif
+
+#define FCOE_STR_LEN 32
+
+/*
+ * timestamp (golbal variable in sys/systm.h)
+ */
+#define CURRENT_CLOCK lbolt
#define FCOE_SEC2TICK(x_sec) (drv_usectohz((x_sec) * 1000000))
+
+/*
+ * Form/convert mod_hash_key from/to xch ID
+ */
+#define FMHK(x_xid) (mod_hash_key_t)(uintptr_t)(x_xid)
+#define CMHK(x_key) (uint16_t)(uintptr_t)(x_key)
+
typedef void (*TQ_FUNC_P)(void *);
extern void fcoe_trace(caddr_t ident, const char *fmt, ...);
diff --git a/usr/src/uts/common/sys/fibre-channel/impl/fc_portif.h b/usr/src/uts/common/sys/fibre-channel/impl/fc_portif.h
index ca1a387dce..2abf07c386 100644
--- a/usr/src/uts/common/sys/fibre-channel/impl/fc_portif.h
+++ b/usr/src/uts/common/sys/fibre-channel/impl/fc_portif.h
@@ -19,21 +19,19 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _FC_PORTIF_H
#define _FC_PORTIF_H
-
#include <sys/note.h>
#ifdef __cplusplus
extern "C" {
#endif
-
/*
* To remove the port WWN from the orphan list; An orphan list
* scan typically happens during ONLINE processing (after a LIP
@@ -103,6 +101,7 @@ extern "C" {
#define FP_DETACH_INPROGRESS 0x0200
#define FP_DETACH_FAILED 0x0400
#define FP_SOFT_NO_PMCOMP 0x0800
+#define FP_SOFT_FCA_IS_NODMA 0x1000
/*
* Instruct the port driver to just accept logins from these addresses
@@ -144,14 +143,14 @@ extern "C" {
/*
* Structure for issuing a work request to the per-instance "job handler"
* thread. Primarily allocated/initialized by fctl_alloc_job() and freed by
- * fctl_dealloc_job(). fctl keeps a kmem_cache of these structs anchored by the
+ * fctl_dealloc_job(). fctl keeps a kmem_cache of these structs anchored by the
* fctl_job_cache global variable. The cache is created at fctl's _init(9E) and
* destroyed at fctl's _fini(9E). See also fctl_cache_constructor()
* and fctl_cache_destructor().
*/
typedef struct job_request {
/*
- * ID code for the job or task to be performed. Set by fctl_alloc_job()
+ * ID code for the job or task to be performed. Set by fctl_alloc_job()
* and read by fp_job_handler().
*/
int job_code;
@@ -197,7 +196,7 @@ typedef struct job_request {
* maintained on a per-instance basis by the fp_port_head and
* fp_port_tail pointers in the fc_local_port_t struct.
*/
- struct job_request *job_next;
+ struct job_request *job_next;
} job_request_t;
@@ -250,7 +249,7 @@ _NOTE(MUTEX_PROTECTS_DATA(job_request::job_mutex, job_request::job_counter))
*
* JOB_TYPE_FCTL_ASYNC is set in various places in fp and fctl. If set then
* fctl_jobdone() will call the completion function in the job_comp field and
- * deallocate the job_request_t struct. If not set then fctl_jobdone() will
+ * deallocate the job_request_t struct. If not set then fctl_jobdone() will
* sema_v() the job_fctl_sema to wake up any waiting thread. This bit is also
* checked in fc_ulp_login(): if *clear* then fc_ulp_login() will call
* fctl_jobwait() in order to block the calling thread in the job_fctl_sema, and
@@ -258,7 +257,7 @@ _NOTE(MUTEX_PROTECTS_DATA(job_request::job_mutex, job_request::job_counter))
*
* JOB_TYPE_FP_ASYNC is set in various places in fp. If set then fp_jobdone()
* will call fctl_jobdone(); if clear then fp_jobdone() will sema_v() the
- * job_port_sema in the job_request_t. fp_port_shutdown() also looks for
+ * job_port_sema in the job_request_t. fp_port_shutdown() also looks for
* JOB_TYPE_FP_ASYNC. Just to keep thing interesting, JOB_TYPE_FP_ASYNC is
* also set in fp_validate_area_domain() and cleared in fp_fcio_login() and
* fp_ns_get_devcount()
@@ -281,7 +280,7 @@ typedef struct fc_port_clist {
uint32_t clist_state; /* port state */
uint32_t clist_len; /* map len */
uint32_t clist_size; /* alloc len */
- fc_portmap_t *clist_map; /* changelist */
+ fc_portmap_t *clist_map; /* changelist */
uint32_t clist_flags; /* port topology */
uint32_t clist_wait; /* for synchronous requests */
kmutex_t clist_mutex; /* clist lock */
@@ -329,13 +328,34 @@ typedef struct fc_orphan {
struct fc_orphan *orp_next; /* Next orphan */
} fc_orphan_t;
+#define FC_GET_RSP(x_port, x_handle, x_dest, x_src, x_size, x_flag) \
+ { \
+ if (!((x_port)->fp_soft_state & FP_SOFT_FCA_IS_NODMA)) {\
+ ddi_rep_get8((x_handle), (uint8_t *)(x_dest), \
+ (uint8_t *)(x_src), (x_size), \
+ (x_flag)); \
+ } else { \
+ bcopy((x_src), (x_dest), (x_size)); \
+ } \
+ }
+
+#define FC_SET_CMD(x_port, x_handle, x_src, x_dest, x_size, x_flag) \
+ { \
+ if (!((x_port)->fp_soft_state & FP_SOFT_FCA_IS_NODMA)) {\
+ ddi_rep_put8((x_handle), (uint8_t *)(x_src), \
+ (uint8_t *)(x_dest), (x_size), \
+ (x_flag)); \
+ } else { \
+ bcopy((x_src), (x_dest), (x_size)); \
+ } \
+ }
+
#if !defined(__lint)
_NOTE(SCHEME_PROTECTS_DATA("scans don't interleave",
- fc_orphan::orp_nscan fc_orphan::orp_pwwn fc_orphan::orp_tstamp))
+ fc_orphan::orp_nscan fc_orphan::orp_pwwn fc_orphan::orp_tstamp))
_NOTE(MUTEX_PROTECTS_DATA(fc_local_port::fp_mutex, fc_orphan::orp_next))
#endif /* __lint */
-
fc_remote_node_t *fctl_create_remote_node(la_wwn_t *nwwn, int sleep);
void fctl_destroy_remote_node(fc_remote_node_t *rnp);
fc_remote_port_t *fctl_create_remote_port(fc_local_port_t *port,
diff --git a/usr/src/uts/common/sys/fibre-channel/impl/fcgs2.h b/usr/src/uts/common/sys/fibre-channel/impl/fcgs2.h
index f124055675..b18419299c 100644
--- a/usr/src/uts/common/sys/fibre-channel/impl/fcgs2.h
+++ b/usr/src/uts/common/sys/fibre-channel/impl/fcgs2.h
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -154,6 +154,9 @@ extern "C" {
#define NSRJTX_BADPORTID 0x11 /* Unacceptable port ID */
#define NSRJTX_DBEMPTY 0x12 /* Data base empty */
+/* Management Service Command Codes */
+#define MS_GIEL 0x0101 /* Get Interconnect Element List */
+
#define FC_NS_CLASSF 0x01
#define FC_NS_CLASS1 0x02
#define FC_NS_CLASS2 0x04
diff --git a/usr/src/uts/common/sys/fibre-channel/impl/fctl.h b/usr/src/uts/common/sys/fibre-channel/impl/fctl.h
index db66561121..8b672e82ef 100644
--- a/usr/src/uts/common/sys/fibre-channel/impl/fctl.h
+++ b/usr/src/uts/common/sys/fibre-channel/impl/fctl.h
@@ -70,6 +70,9 @@ extern "C" {
#define FC_STATE_FULL_SPEED FC_STATE_1GBIT_SPEED
#define FC_STATE_DOUBLE_SPEED FC_STATE_2GBIT_SPEED
+/* pi_port_state, used only when binding port */
+#define FC_STATE_FCA_IS_NODMA 0x80000000
+
/*
* Macros to discriminate between the link state byte and the link speed
* byte in fp_state (also good for improved code obfuscation and job security
@@ -98,7 +101,6 @@ extern "C" {
#define FC_NOTIFY_GET_FLAG(cmd) FC_NOTIFY_FLAG_MASK(cmd)
#define FC_NOTIFY_GET_VALUE(cmd) (FC_NOTIFY_VALUE_MASK(cmd) >> 8)
-
/*
* pkt_tran_flags definitions
*/
@@ -151,7 +153,7 @@ typedef struct fc_packet {
struct buf *pkt_data_buf; /* reserved */
void (*pkt_ulp_comp)(struct fc_packet *);
/* framework private */
- opaque_t pkt_ulp_private; /* caller's private */
+ opaque_t pkt_ulp_private; /* caller's private */
void (*pkt_comp)(struct fc_packet *); /* callback */
struct fc_remote_port *pkt_pd; /* port device */
ddi_dma_handle_t pkt_cmd_dma; /* command DMA */
@@ -162,12 +164,12 @@ typedef struct fc_packet {
ddi_dma_cookie_t *pkt_resp_cookie; /* response cookie */
ddi_dma_handle_t pkt_data_dma; /* data DMA */
ddi_acc_handle_t pkt_data_acc; /* data access */
- ddi_dma_cookie_t *pkt_data_cookie; /* data cookie */
+ ddi_dma_cookie_t *pkt_data_cookie; /* data cookie */
uint_t pkt_cmd_cookie_cnt;
uint_t pkt_resp_cookie_cnt;
uint_t pkt_data_cookie_cnt; /* of a window */
fc_frame_hdr_t pkt_cmd_fhdr; /* command frame hdr */
- opaque_t pkt_fca_private; /* FCA private */
+ opaque_t pkt_fca_private; /* FCA private */
uchar_t pkt_state; /* packet state */
uchar_t pkt_action; /* packet action */
uchar_t pkt_expln; /* reason explanation */
@@ -228,7 +230,7 @@ typedef struct fca_hba_fru_details {
#define FC_HBA_PORTSPEED_4GBIT 8 /* 4 GBit/sec */
#define FC_HBA_PORTSPEED_8GBIT 16 /* 8 GBit/sec */
#define FC_HBA_PORTSPEED_16GBIT 32 /* 16 GBit/sec */
-#define FC_HBA_PORTSPEED_NOT_NEGOTIATED (1<<15) /* Speed not established */
+#define FC_HBA_PORTSPEED_NOT_NEGOTIATED (1<<15) /* Speed not established */
#define FCHBA_MANUFACTURER_LEN 64
#define FCHBA_SERIAL_NUMBER_LEN 64
@@ -275,7 +277,7 @@ typedef struct unsolicited_buffer {
opaque_t ub_port_handle;
opaque_t ub_resp_token; /* Response token */
uint64_t ub_token;
- fc_frame_hdr_t ub_frame;
+ fc_frame_hdr_t ub_frame;
} fc_unsol_buf_t;
#define FC_UB_RESP_LOGIN_REQUIRED 0x4000
diff --git a/usr/src/uts/common/sys/fibre-channel/ulp/fcp.h b/usr/src/uts/common/sys/fibre-channel/ulp/fcp.h
index 3891293a15..8f6db0bd3a 100644
--- a/usr/src/uts/common/sys/fibre-channel/ulp/fcp.h
+++ b/usr/src/uts/common/sys/fibre-channel/ulp/fcp.h
@@ -19,14 +19,13 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _FCP_H
#define _FCP_H
-
/*
* Frame format and protocol definitions for transferring
* commands and data between a SCSI initiator and target
@@ -50,7 +49,6 @@ extern "C" {
#define FCP_SCSI_RSP 0x03 /* frame contains SCSI response */
#define FCP_SCSI_XFER_RDY 0x05 /* frame contains xfer rdy block */
-
/*
* fcp SCSI control structure
*/
@@ -109,7 +107,6 @@ typedef struct fcp_cntl {
#define FCP_QTYPE_ACA_Q_TAG 4 /* ACA queueing */
#define FCP_QTYPE_UNTAGGED 5 /* Untagged */
-
/*
* fcp SCSI entity address
*
@@ -125,7 +122,6 @@ typedef struct fcp_ent_addr {
ushort_t ent_addr_3; /* entity address 3 */
} fcp_ent_addr_t;
-
/*
* maximum size of SCSI cdb in fcp SCSI command
*/
@@ -143,7 +139,6 @@ typedef struct fcp_cmd {
int fcp_data_len; /* data length */
} fcp_cmd_t;
-
/*
* fcp SCSI status
*/
@@ -170,7 +165,6 @@ typedef struct fcp_status {
uchar_t scsi_status; /* status of cmd */
} fcp_status_t;
-
/*
* fcp SCSI response payload
*/
@@ -190,11 +184,9 @@ typedef struct fcp_rsp {
*/
} fcp_rsp_t;
-
/* MAde 256 for sonoma as it wants to give tons of sense info */
#define FCP_MAX_RSP_IU_SIZE 256
-
/*
* fcp rsp_info field format
*/
@@ -219,7 +211,6 @@ struct fcp_rsp_info {
#define FCP_TASK_MGMT_NOT_SUPPTD 0x4
#define FCP_TASK_MGMT_FAILED 0x5
-
#ifdef THIS_NEEDED_YET
/*
@@ -289,33 +280,51 @@ struct fcp_prli {
};
-
/*
* fcp PRLI ACC payload
*/
struct fcp_prli_acc {
uchar_t type;
- uchar_t resvd1;
+ uchar_t resvd1; /* type code extension */
+
+#if defined(_BIT_FIELDS_HTOL)
+ uint16_t orig_process_assoc_valid : 1,
+ resp_process_assoc_valid : 1,
+ image_pair_established : 1,
+ resvd2 : 1,
+ accept_response_code : 4,
+ resvd3 : 8;
+#elif defined(_BIT_FIELDS_LTOH)
+ uint16_t resvd3 : 8,
+ accept_response_code : 4,
+ resvd2 : 1,
+ image_pair_established : 1,
+ resp_process_assoc_valid : 1,
+ orig_process_assoc_valid : 1;
+#endif
- uint32_t orig_process_assoc_valid : 1;
- uint32_t resp_process_assoc_valid : 1;
- uint32_t image_pair_established : 1;
- uint32_t resvd2 : 1;
- uint32_t accept_response_code : 4;
- uint32_t resvd3 : 8;
uint32_t orig_process_associator;
uint32_t resp_process_associator;
- uint32_t resvd4 : 26;
- uint32_t initiator_fn : 1;
- uint32_t target_fn : 1;
- uint32_t cmd_data_mixed : 1;
- uint32_t data_resp_mixed : 1;
- uint32_t read_xfer_rdy_disabled : 1;
- uint32_t write_xfer_rdy_disabled : 1;
+#if defined(_BIT_FIELDS_HTOL)
+ uint32_t resvd4 : 26,
+ initiator_fn : 1,
+ target_fn : 1,
+ cmd_data_mixed : 1,
+ data_resp_mixed : 1,
+ read_xfer_rdy_disabled : 1,
+ write_xfer_rdy_disabled : 1;
+#elif defined(_BIT_FIELDS_LTOH)
+ uint32_t write_xfer_rdy_disabled : 1,
+ read_xfer_rdy_disabled : 1,
+ data_resp_mixed : 1,
+ cmd_data_mixed : 1,
+ target_fn : 1,
+ initiator_fn : 1,
+ resvd4 : 26;
+#endif
};
-
#define FC_UB_FCP_CDB_FLAG 0x0001 /* UB has valid cdb */
#define FC_UB_FCP_PORT_LOGOUT 0x0002 /* Port logout UB */
#define FC_UB_FCP_ABORT_TASK 0x0004 /* Abort task UB */
diff --git a/usr/src/uts/common/sys/fibre-channel/ulp/fcpvar.h b/usr/src/uts/common/sys/fibre-channel/ulp/fcpvar.h
index 35be66da30..b642f97219 100644
--- a/usr/src/uts/common/sys/fibre-channel/ulp/fcpvar.h
+++ b/usr/src/uts/common/sys/fibre-channel/ulp/fcpvar.h
@@ -26,8 +26,6 @@
#ifndef _FCPVAR_H
#define _FCPVAR_H
-
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -127,7 +125,7 @@ struct fcp_stats {
* This is the master structure off of which all the others will be hanging at
* some point and is the Solaris per-instance soft-state structure.
*/
-struct fcp_port {
+typedef struct fcp_port {
/*
* This mutex protects the access to this structure (or most of its
* fields).
@@ -409,7 +407,7 @@ struct fcp_port {
* list.
*/
int port_dmacookie_sz;
-};
+} fcp_port_t;
/*
* We need to save the target change count values in a map tag so as
@@ -438,6 +436,11 @@ typedef int fcp_map_tag_t;
*/
#define FCP_STATE_IN_CB_DEVC 0x0400
+/*
+ * FCP_STATE_FCA_IS_NODMA indicates that FCA doesn't support DMA at all
+ */
+#define FCP_STATE_FCA_IS_NODMA 0x80000000
+
#define FCP_MAX_DEVICES 127
/* To remember that dip was allocated for a lun on this target. */
@@ -521,7 +524,7 @@ typedef int fcp_map_tag_t;
* (a) The underlying FCA does NOT support DMA for this field
* (b) The underlying FCA supports DMA for this field
*/
-struct fcp_pkt {
+typedef struct fcp_pkt {
/*
* The two following fields are used to queue fcp_pkt in the double
* link list of the lun structure. The packet is queued in
@@ -578,7 +581,7 @@ struct fcp_pkt {
* fp/fctl.
*/
struct fc_packet cmd_fc_packet;
-};
+} fcp_pkt_t;
/*
* fcp_ipkt : Packet for internal commands.
@@ -645,7 +648,7 @@ struct fcp_pkt {
* (a) The underlying FCA does NOT support DMA for this field
* (b) The underlying FCA supports DMA for this field
*/
-struct fcp_ipkt {
+typedef struct fcp_ipkt {
/*
* Pointer to the port (fcp_port) in behalf of which this internal
* packet was allocated.
@@ -713,7 +716,7 @@ struct fcp_ipkt {
* FC packet.
*/
struct fc_packet ipkt_fc_packet;
-};
+} fcp_ipkt_t;
/*
* cmd_state definitions
@@ -725,7 +728,9 @@ struct fcp_ipkt {
/*
* These are the defined cmd_flags for this structure.
*/
-#define CFLAG_IN_QUEUE 0x2000 /* command in fcp queue */
+#define CFLAG_NONE 0x0000
+#define CFLAG_IS_READ 0x0001
+#define CFLAG_IN_QUEUE 0x0002 /* command in fcp queue */
/*
* Target structure
@@ -735,7 +740,7 @@ struct fcp_ipkt {
* structure doesn't represent the object registered with the OS (NDI or
* MPxIO...).
*/
-struct fcp_tgt {
+typedef struct fcp_tgt {
/*
* This field is used to queue the target structure in one of the
* buckets of the fcp_port target hash table port_tgt_hash_table[].
@@ -850,7 +855,7 @@ struct fcp_tgt {
* used to detect user unconfig when auto configuration is enabled.
*/
uint32_t tgt_manual_config_only;
-};
+} fcp_tgt_t;
/*
* Target States
@@ -964,7 +969,7 @@ typedef void *child_info_t;
* structure is the one representing the object registered with the OS (NDI
* or MPxIO...).
*/
-struct fcp_lun {
+typedef struct fcp_lun {
/*
* Mutex protecting the access to this structure.
*/
@@ -1058,7 +1063,7 @@ struct fcp_lun {
* LUN inquiry data (as returned by the INQUIRY command).
*/
struct scsi_inquiry lun_inq;
-};
+} fcp_lun_t;
/*
@@ -1297,10 +1302,10 @@ typedef struct fcp_black_list_entry {
int masked;
} fcp_black_list_entry_t;
-#define ADDR2FCP(ap) ((struct fcp_port *) \
- ((ap)->a_hba_tran->tran_hba_private))
-#define ADDR2LUN(ap) ((struct fcp_lun *) \
- scsi_device_hba_private_get(scsi_address_device(ap)))
+#define ADDR2FCP(ap) ((struct fcp_port *) \
+ ((ap)->a_hba_tran->tran_hba_private))
+#define ADDR2LUN(ap) ((struct fcp_lun *) \
+ scsi_device_hba_private_get(scsi_address_device(ap)))
#define CMD2PKT(cmd) ((cmd)->cmd_pkt)
#define PKT2CMD(pkt) ((struct fcp_pkt *)((pkt)->pkt_ha_private))
@@ -1366,13 +1371,28 @@ _NOTE(SCHEME_PROTECTS_DATA("Safe Data",
scsi_pkt scsi_arq_status scsi_device scsi_hba_tran scsi_cdb))
#endif /* __lint */
-#define FCP_CP_IN(s, d, handle, len) (ddi_rep_get8((handle), \
- (uint8_t *)(d), (uint8_t *)(s), \
- (len), DDI_DEV_AUTOINCR))
-
-#define FCP_CP_OUT(s, d, handle, len) (ddi_rep_put8((handle), \
- (uint8_t *)(s), (uint8_t *)(d), \
- (len), DDI_DEV_AUTOINCR))
+/*
+ * Local variable "pptr" must exist before using these
+ */
+#define FCP_CP_IN(s, d, handle, len) \
+ { \
+ if (!((pptr)->port_state & FCP_STATE_FCA_IS_NODMA)) { \
+ ddi_rep_get8((handle), (uint8_t *)(d), \
+ (uint8_t *)(s), (len), DDI_DEV_AUTOINCR); \
+ } else { \
+ bcopy((s), (d), (len)); \
+ } \
+ }
+
+#define FCP_CP_OUT(s, d, handle, len) \
+ { \
+ if (!((pptr)->port_state & FCP_STATE_FCA_IS_NODMA)) { \
+ ddi_rep_put8((handle), (uint8_t *)(s), \
+ (uint8_t *)(d), (len), DDI_DEV_AUTOINCR); \
+ } else { \
+ bcopy((s), (d), (len)); \
+ } \
+ }
#define FCP_ONLINE 0x1
#define FCP_OFFLINE 0x2
diff --git a/usr/src/uts/common/sys/fibre-channel/ulp/fcsm.h b/usr/src/uts/common/sys/fibre-channel/ulp/fcsm.h
index e3248a5d48..78b7704b5e 100644
--- a/usr/src/uts/common/sys/fibre-channel/ulp/fcsm.h
+++ b/usr/src/uts/common/sys/fibre-channel/ulp/fcsm.h
@@ -19,15 +19,13 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _FCSM_H
#define _FCSM_H
-
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -95,7 +93,7 @@ typedef struct fcsm_job {
ksema_t job_sema; /* To wait for completion */
struct fcsm_job *job_next; /* for linked list */
int job_retry_count; /* Retry count */
- void *job_priv; /* for fcsm private use */
+ void *job_priv; /* for fcsm private use */
uint32_t job_priv_flags; /* fcsm private flags */
} fcsm_job_t;
@@ -163,6 +161,7 @@ typedef struct fcsm_cmd {
#define FCSM_LINK_DOWN 0x1000
#define FCSM_MGMT_SERVER_LOGGED_IN 0x2000
#define FCSM_MGMT_SERVER_LOGIN_IN_PROG 0x4000
+#define FCSM_USING_NODMA_FCA 0x8000
/* Command flags for Job structure */
#define FCSM_JOBFLAG_SYNC 0x01
@@ -197,48 +196,29 @@ typedef struct fcsm_cmd {
/*
* Macros to address endian issues
+ * local variable "fcsm" must exist before using these
*/
-#define FCSM_RD8(acchandle, addr) \
- ddi_get8((acchandle), (uint8_t *)(addr))
-#define FCSM_RD16(acchandle, addr) \
- ddi_get16((acchandle), (uint16_t *)(addr))
-#define FCSM_RD32(acchandle, addr) \
- ddi_get32((acchandle), (uint32_t *)(addr))
-#define FCSM_RD64(acchandle, addr) \
- ddi_get64((acchandle), (uint64_t *)(addr))
-
-#define FCSM_WR8(acchandle, addr, val) \
- ddi_put8((acchandle), (uint8_t *)(addr), (uint8_t)(val))
-#define FCSM_WR16(acchandle, addr, val) \
- ddi_put16((acchandle), (uint16_t *)(addr), (uint16_t)(val))
-#define FCSM_WR32(acchandle, addr, val) \
- ddi_put32((acchandle), (uint32_t *)(addr), (uint32_t)(val))
-#define FCSM_WR64(acchandle, addr, val) \
- ddi_put64((acchandle), (uint64_t *)(addr), (uint64_t)(val))
-
-#define FCSM_REP_RD(acchandle, hostaddr, devaddr, cnt) \
- ddi_rep_get8((acchandle), (uint8_t *)(hostaddr), (uint8_t *)(devaddr),\
- (size_t)(cnt), DDI_DEV_AUTOINCR)
-#define FCSM_REP_RD32(acchandle, hostaddr, devaddr, cnt) \
- ddi_rep_get32((acchandle), (uint32_t *)(hostaddr), \
- (uint32_t *)(devaddr), ((size_t)(cnt)) >> 2, DDI_DEV_AUTOINCR)
-
-#define FCSM_REP_WR(acchandle, hostaddr, devaddr, cnt) \
- ddi_rep_put8((acchandle), (uint8_t *)(hostaddr), (uint8_t *)(devaddr),\
- (size_t)(cnt), DDI_DEV_AUTOINCR)
-#define FCSM_REP_WR32(acchandle, hostaddr, devaddr, cnt) \
- ddi_rep_put32((acchandle), (uint32_t *)(hostaddr),\
- (uint32_t *)(devaddr), ((size_t)(cnt)) >> 2, DDI_DEV_AUTOINCR)
-
-/*
- * Macros to perform DMA Sync
- */
-#define FCSM_SYNC_FOR_DEV(dmahandle, offset, length) \
- (void) ddi_dma_sync((dmahandle), (offset),\
- (size_t)(length), DDI_DMA_SYNC_FORDEV)
-#define FCSM_SYNC_FOR_KERNEL(dmahandle, offset, length) \
- (void) ddi_dma_sync((acchandle), (offset),\
- (length), DDI_DMA_SYNC_FORKERNEL)
+#define FCSM_REP_RD(handle, hostaddr, devaddr, cnt) \
+ { \
+ if (!((fcsm)->sm_flags & FCSM_USING_NODMA_FCA)) { \
+ ddi_rep_get8((handle), (uint8_t *)(hostaddr), \
+ (uint8_t *)(devaddr), (cnt), \
+ DDI_DEV_AUTOINCR); \
+ } else { \
+ bcopy((devaddr), (hostaddr), (cnt)); \
+ } \
+ }
+
+#define FCSM_REP_WR(handle, hostaddr, devaddr, cnt) \
+ { \
+ if (!((fcsm)->sm_flags & FCSM_USING_NODMA_FCA)) { \
+ ddi_rep_put8((handle), (uint8_t *)(hostaddr), \
+ (uint8_t *)(devaddr), (cnt), \
+ DDI_DEV_AUTOINCR); \
+ } else { \
+ bcopy((hostaddr), (devaddr), (cnt)); \
+ } \
+ }
#endif /* _KERNEL */