summaryrefslogtreecommitdiffstats
path: root/include/scsi
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-09 19:42:25 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-09 19:42:25 -0800
commit382f51fe2f2276344d8a21447656778cdf6583b6 (patch)
treec2836a2cca4126c9c026ce5aa2fdf9f1c8ccded6 /include/scsi
parent701791cc3c8fc6dd83f6ec8af7e2541b4a316606 (diff)
parent54987386ee3790f3900de4df2ed4deb0e18dfc9f (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (222 commits) [SCSI] zfcp: Remove flag ZFCP_STATUS_FSFREQ_TMFUNCNOTSUPP [SCSI] zfcp: Activate fc4s attributes for zfcp in FC transport class [SCSI] zfcp: Block scsi_eh thread for rport state BLOCKED [SCSI] zfcp: Update FSF error reporting [SCSI] zfcp: Improve ELS ADISC handling [SCSI] zfcp: Simplify handling of ct and els requests [SCSI] zfcp: Remove ZFCP_DID_MASK [SCSI] zfcp: Move WKA port to zfcp FC code [SCSI] zfcp: Use common code definitions for FC CT structs [SCSI] zfcp: Use common code definitions for FC ELS structs [SCSI] zfcp: Update FCP protocol related code [SCSI] zfcp: Dont fail SCSI commands when transitioning to blocked fc_rport [SCSI] zfcp: Assign scheduled work to driver queue [SCSI] zfcp: Remove STATUS_COMMON_REMOVE flag as it is not required anymore [SCSI] zfcp: Implement module unloading [SCSI] zfcp: Merge trace code for fsf requests in one function [SCSI] zfcp: Access ports and units with container_of in sysfs code [SCSI] zfcp: Remove suspend callback [SCSI] zfcp: Remove global config_mutex [SCSI] zfcp: Replace local reference counting with common kref ...
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/Kbuild1
-rw-r--r--include/scsi/fc/Kbuild4
-rw-r--r--include/scsi/fc/fc_els.h6
-rw-r--r--include/scsi/fc/fc_fcoe.h12
-rw-r--r--include/scsi/fc/fc_fcp.h8
-rw-r--r--include/scsi/fc/fc_fip.h12
-rw-r--r--include/scsi/fc/fc_fs.h2
-rw-r--r--include/scsi/fc/fc_gs.h2
-rw-r--r--include/scsi/fc/fc_ns.h35
-rw-r--r--include/scsi/fc_encode.h68
-rw-r--r--include/scsi/fc_frame.h22
-rw-r--r--include/scsi/iscsi_if.h3
-rw-r--r--include/scsi/iscsi_proto.h2
-rw-r--r--include/scsi/libfc.h1158
-rw-r--r--include/scsi/libfcoe.h93
-rw-r--r--include/scsi/libiscsi.h4
-rw-r--r--include/scsi/libsas.h3
-rw-r--r--include/scsi/osd_initiator.h81
-rw-r--r--include/scsi/osd_protocol.h1
-rw-r--r--include/scsi/osd_sense.h3
-rw-r--r--include/scsi/scsi.h4
-rw-r--r--include/scsi/scsi_device.h12
-rw-r--r--include/scsi/scsi_dh.h6
-rw-r--r--include/scsi/scsi_host.h24
-rw-r--r--include/scsi/scsi_transport_fc.h1
25 files changed, 889 insertions, 678 deletions
diff --git a/include/scsi/Kbuild b/include/scsi/Kbuild
index 33b2750e9283..b3a0ee6b2f1c 100644
--- a/include/scsi/Kbuild
+++ b/include/scsi/Kbuild
@@ -2,3 +2,4 @@ header-y += scsi.h
header-y += scsi_netlink.h
header-y += scsi_netlink_fc.h
header-y += scsi_bsg_fc.h
+header-y += fc/
diff --git a/include/scsi/fc/Kbuild b/include/scsi/fc/Kbuild
new file mode 100644
index 000000000000..56603813c6cd
--- /dev/null
+++ b/include/scsi/fc/Kbuild
@@ -0,0 +1,4 @@
+header-y += fc_els.h
+header-y += fc_fs.h
+header-y += fc_gs.h
+header-y += fc_ns.h
diff --git a/include/scsi/fc/fc_els.h b/include/scsi/fc/fc_els.h
index 195ca014d3ce..f94328132a26 100644
--- a/include/scsi/fc/fc_els.h
+++ b/include/scsi/fc/fc_els.h
@@ -20,6 +20,8 @@
#ifndef _FC_ELS_H_
#define _FC_ELS_H_
+#include <linux/types.h>
+
/*
* Fibre Channel Switch - Enhanced Link Services definitions.
* From T11 FC-LS Rev 1.2 June 7, 2005.
@@ -248,10 +250,12 @@ struct fc_els_csp {
/*
* sp_features
*/
-#define FC_SP_FT_CIRO 0x8000 /* continuously increasing rel. off. */
+#define FC_SP_FT_NPIV 0x8000 /* multiple N_Port_ID support (FLOGI) */
+#define FC_SP_FT_CIRO 0x8000 /* continuously increasing rel off (PLOGI) */
#define FC_SP_FT_CLAD 0x8000 /* clean address (in FLOGI LS_ACC) */
#define FC_SP_FT_RAND 0x4000 /* random relative offset */
#define FC_SP_FT_VAL 0x2000 /* valid vendor version level */
+#define FC_SP_FT_NPIV_ACC 0x2000 /* NPIV assignment (FLOGI LS_ACC) */
#define FC_SP_FT_FPORT 0x1000 /* F port (1) vs. N port (0) */
#define FC_SP_FT_ABB 0x0800 /* alternate BB_credit management */
#define FC_SP_FT_EDTR 0x0400 /* E_D_TOV Resolution is nanoseconds */
diff --git a/include/scsi/fc/fc_fcoe.h b/include/scsi/fc/fc_fcoe.h
index ccb3dbe90463..e6ad3d2ae475 100644
--- a/include/scsi/fc/fc_fcoe.h
+++ b/include/scsi/fc/fc_fcoe.h
@@ -86,6 +86,18 @@ struct fcoe_crc_eof {
#define FCOE_MIN_FRAME 46
/*
+ * FCoE Link Error Status Block: T11 FC-BB-5 Rev2.0, Clause 7.10.
+ */
+struct fcoe_fc_els_lesb {
+ __be32 lesb_link_fail; /* link failure count */
+ __be32 lesb_vlink_fail; /* virtual link failure count */
+ __be32 lesb_miss_fka; /* missing FIP keep-alive count */
+ __be32 lesb_symb_err; /* symbol error during carrier count */
+ __be32 lesb_err_block; /* errored block count */
+ __be32 lesb_fcs_error; /* frame check sequence error count */
+};
+
+/*
* fc_fcoe_set_mac - Store OUI + DID into MAC address field.
* @mac: mac address to be set
* @did: fc dest id to use
diff --git a/include/scsi/fc/fc_fcp.h b/include/scsi/fc/fc_fcp.h
index 5d38f1989f37..747e2c7d88d6 100644
--- a/include/scsi/fc/fc_fcp.h
+++ b/include/scsi/fc/fc_fcp.h
@@ -83,6 +83,8 @@ struct fcp_cmnd32 {
* fc_tm_flags - task management flags field.
*/
#define FCP_TMF_CLR_ACA 0x40 /* clear ACA condition */
+#define FCP_TMF_TGT_RESET 0x20 /* target reset task management,
+ deprecated as of FCP-3 */
#define FCP_TMF_LUN_RESET 0x10 /* logical unit reset task management */
#define FCP_TMF_CLR_TASK_SET 0x04 /* clear task set */
#define FCP_TMF_ABT_TASK_SET 0x02 /* abort task set */
@@ -196,4 +198,10 @@ struct fcp_srr {
__u8 srr_resvd2[3]; /* reserved */
};
+/*
+ * Feature bits in name server FC-4 Features object.
+ */
+#define FCP_FEAT_TARG (1 << 0) /* target function supported */
+#define FCP_FEAT_INIT (1 << 1) /* initiator function supported */
+
#endif /* _FC_FCP_H_ */
diff --git a/include/scsi/fc/fc_fip.h b/include/scsi/fc/fc_fip.h
index 3d138c1fcf8a..17baa19380f0 100644
--- a/include/scsi/fc/fc_fip.h
+++ b/include/scsi/fc/fc_fip.h
@@ -214,11 +214,21 @@ struct fip_vn_desc {
*/
struct fip_fka_desc {
struct fip_desc fd_desc;
- __u8 fd_resvd[2];
+ __u8 fd_resvd;
+ __u8 fd_flags; /* bit0 is fka disable flag */
__be32 fd_fka_period; /* adv./keep-alive period in mS */
} __attribute__((packed));
/*
+ * flags for fip_fka_desc.fd_flags
+ */
+enum fip_fka_flags {
+ FIP_FKA_ADV_D = 0x01, /* no need for FKA from ENode */
+};
+
+/* FIP_DT_FKA flags */
+
+/*
* FIP_DT_VENDOR descriptor.
*/
struct fip_vendor_desc {
diff --git a/include/scsi/fc/fc_fs.h b/include/scsi/fc/fc_fs.h
index ac4cd38c860e..50f28b143451 100644
--- a/include/scsi/fc/fc_fs.h
+++ b/include/scsi/fc/fc_fs.h
@@ -20,6 +20,8 @@
#ifndef _FC_FS_H_
#define _FC_FS_H_
+#include <linux/types.h>
+
/*
* Fibre Channel Framing and Signalling definitions.
* From T11 FC-FS-2 Rev 0.90 - 9 August 2005.
diff --git a/include/scsi/fc/fc_gs.h b/include/scsi/fc/fc_gs.h
index 324dd0e3c622..a37346d47eb1 100644
--- a/include/scsi/fc/fc_gs.h
+++ b/include/scsi/fc/fc_gs.h
@@ -20,6 +20,8 @@
#ifndef _FC_GS_H_
#define _FC_GS_H_
+#include <linux/types.h>
+
/*
* Fibre Channel Services - Common Transport.
* From T11.org FC-GS-2 Rev 5.3 November 1998.
diff --git a/include/scsi/fc/fc_ns.h b/include/scsi/fc/fc_ns.h
index 790d7b97d4bc..e7d3ac497d7d 100644
--- a/include/scsi/fc/fc_ns.h
+++ b/include/scsi/fc/fc_ns.h
@@ -20,6 +20,8 @@
#ifndef _FC_NS_H_
#define _FC_NS_H_
+#include <linux/types.h>
+
/*
* Fibre Channel Services - Name Service (dNS)
* From T11.org FC-GS-2 Rev 5.3 November 1998.
@@ -44,9 +46,12 @@ enum fc_ns_req {
FC_NS_GID_FT = 0x0171, /* get IDs by FC4 type */
FC_NS_GPN_FT = 0x0172, /* get port names by FC4 type */
FC_NS_GID_PT = 0x01a1, /* get IDs by port type */
- FC_NS_RFT_ID = 0x0217, /* reg FC4 type for ID */
FC_NS_RPN_ID = 0x0212, /* reg port name for ID */
FC_NS_RNN_ID = 0x0213, /* reg node name for ID */
+ FC_NS_RFT_ID = 0x0217, /* reg FC4 type for ID */
+ FC_NS_RSPN_ID = 0x0218, /* reg symbolic port name */
+ FC_NS_RFF_ID = 0x021f, /* reg FC4 Features for ID */
+ FC_NS_RSNN_NN = 0x0239, /* reg symbolic node name */
};
/*
@@ -156,4 +161,32 @@ struct fc_ns_rn_id {
__be64 fr_wwn; /* node name or port name */
} __attribute__((__packed__));
+/*
+ * RSNN_NN request - register symbolic node name
+ */
+struct fc_ns_rsnn {
+ __be64 fr_wwn; /* node name */
+ __u8 fr_name_len;
+ char fr_name[];
+} __attribute__((__packed__));
+
+/*
+ * RSPN_ID request - register symbolic port name
+ */
+struct fc_ns_rspn {
+ struct fc_ns_fid fr_fid; /* port ID object */
+ __u8 fr_name_len;
+ char fr_name[];
+} __attribute__((__packed__));
+
+/*
+ * RFF_ID request - register FC-4 Features for ID.
+ */
+struct fc_ns_rff_id {
+ struct fc_ns_fid fr_fid; /* port ID object */
+ __u8 fr_resvd[2];
+ __u8 fr_feat; /* FC-4 Feature bits */
+ __u8 fr_type; /* FC-4 type */
+} __attribute__((__packed__));
+
#endif /* _FC_NS_H_ */
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h
index 27dad703824f..8eb0a0fc0a71 100644
--- a/include/scsi/fc_encode.h
+++ b/include/scsi/fc_encode.h
@@ -32,7 +32,10 @@ struct fc_ct_req {
struct fc_ns_gid_ft gid;
struct fc_ns_rn_id rn;
struct fc_ns_rft rft;
+ struct fc_ns_rff_id rff;
struct fc_ns_fid fid;
+ struct fc_ns_rsnn snn;
+ struct fc_ns_rspn spn;
} payload;
};
@@ -109,6 +112,7 @@ static inline int fc_ct_fill(struct fc_lport *lport,
enum fc_fh_type *fh_type)
{
struct fc_ct_req *ct;
+ size_t len;
switch (op) {
case FC_NS_GPN_FT:
@@ -128,12 +132,41 @@ static inline int fc_ct_fill(struct fc_lport *lport,
ct->payload.rft.fts = lport->fcts;
break;
- case FC_NS_RPN_ID:
+ case FC_NS_RFF_ID:
+ ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rff_id));
+ hton24(ct->payload.rff.fr_fid.fp_fid,
+ fc_host_port_id(lport->host));
+ ct->payload.rff.fr_type = FC_TYPE_FCP;
+ if (lport->service_params & FCP_SPPF_INIT_FCN)
+ ct->payload.rff.fr_feat = FCP_FEAT_INIT;
+ if (lport->service_params & FCP_SPPF_TARG_FCN)
+ ct->payload.rff.fr_feat |= FCP_FEAT_TARG;
+ break;
+
+ case FC_NS_RNN_ID:
ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id));
hton24(ct->payload.rn.fr_fid.fp_fid,
fc_host_port_id(lport->host));
- ct->payload.rft.fts = lport->fcts;
- put_unaligned_be64(lport->wwpn, &ct->payload.rn.fr_wwn);
+ put_unaligned_be64(lport->wwnn, &ct->payload.rn.fr_wwn);
+ break;
+
+ case FC_NS_RSPN_ID:
+ len = strnlen(fc_host_symbolic_name(lport->host), 255);
+ ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rspn) + len);
+ hton24(ct->payload.spn.fr_fid.fp_fid,
+ fc_host_port_id(lport->host));
+ strncpy(ct->payload.spn.fr_name,
+ fc_host_symbolic_name(lport->host), len);
+ ct->payload.spn.fr_name_len = len;
+ break;
+
+ case FC_NS_RSNN_NN:
+ len = strnlen(fc_host_symbolic_name(lport->host), 255);
+ ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rsnn) + len);
+ put_unaligned_be64(lport->wwnn, &ct->payload.snn.fr_wwn);
+ strncpy(ct->payload.snn.fr_name,
+ fc_host_symbolic_name(lport->host), len);
+ ct->payload.snn.fr_name_len = len;
break;
default:
@@ -198,6 +231,31 @@ static inline void fc_flogi_fill(struct fc_lport *lport, struct fc_frame *fp)
sp->sp_bb_data = htons((u16) lport->mfs);
cp = &flogi->fl_cssp[3 - 1]; /* class 3 parameters */
cp->cp_class = htons(FC_CPC_VALID | FC_CPC_SEQ);
+ if (lport->does_npiv)
+ sp->sp_features = htons(FC_SP_FT_NPIV);
+}
+
+/**
+ * fc_fdisc_fill - Fill in a fdisc request frame.
+ */
+static inline void fc_fdisc_fill(struct fc_lport *lport, struct fc_frame *fp)
+{
+ struct fc_els_csp *sp;
+ struct fc_els_cssp *cp;
+ struct fc_els_flogi *fdisc;
+
+ fdisc = fc_frame_payload_get(fp, sizeof(*fdisc));
+ memset(fdisc, 0, sizeof(*fdisc));
+ fdisc->fl_cmd = (u8) ELS_FDISC;
+ put_unaligned_be64(lport->wwpn, &fdisc->fl_wwpn);
+ put_unaligned_be64(lport->wwnn, &fdisc->fl_wwnn);
+ sp = &fdisc->fl_csp;
+ sp->sp_hi_ver = 0x20;
+ sp->sp_lo_ver = 0x20;
+ sp->sp_bb_cred = htons(10); /* this gets set by gateway */
+ sp->sp_bb_data = htons((u16) lport->mfs);
+ cp = &fdisc->fl_cssp[3 - 1]; /* class 3 parameters */
+ cp->cp_class = htons(FC_CPC_VALID | FC_CPC_SEQ);
}
/**
@@ -296,6 +354,10 @@ static inline int fc_els_fill(struct fc_lport *lport,
fc_flogi_fill(lport, fp);
break;
+ case ELS_FDISC:
+ fc_fdisc_fill(lport, fp);
+ break;
+
case ELS_LOGO:
fc_logo_fill(lport, fp);
break;
diff --git a/include/scsi/fc_frame.h b/include/scsi/fc_frame.h
index c35d2383cc26..4d3e9c7b7c57 100644
--- a/include/scsi/fc_frame.h
+++ b/include/scsi/fc_frame.h
@@ -28,6 +28,8 @@
#include <scsi/fc/fc_fcp.h>
#include <scsi/fc/fc_encaps.h>
+#include <linux/if_ether.h>
+
/*
* The fc_frame interface is used to pass frame data between functions.
* The frame includes the data buffer, length, and SOF / EOF delimiter types.
@@ -37,6 +39,9 @@
#define FC_FRAME_HEADROOM 32 /* headroom for VLAN + FCoE headers */
#define FC_FRAME_TAILROOM 8 /* trailer space for FCoE */
+/* Max number of skb frags allowed, reserving one for fcoe_crc_eof page */
+#define FC_FRAME_SG_LEN (MAX_SKB_FRAGS - 1)
+
#define fp_skb(fp) (&((fp)->skb))
#define fr_hdr(fp) ((fp)->skb.data)
#define fr_len(fp) ((fp)->skb.len)
@@ -64,6 +69,7 @@ struct fcoe_rcv_info {
enum fc_sof fr_sof; /* start of frame delimiter */
enum fc_eof fr_eof; /* end of frame delimiter */
u8 fr_flags; /* flags - see below */
+ u8 granted_mac[ETH_ALEN]; /* FCoE MAC address */
};
@@ -94,17 +100,7 @@ static inline void fc_frame_init(struct fc_frame *fp)
}
struct fc_frame *fc_frame_alloc_fill(struct fc_lport *, size_t payload_len);
-
-struct fc_frame *__fc_frame_alloc(size_t payload_len);
-
-/*
- * Get frame for sending via port.
- */
-static inline struct fc_frame *_fc_frame_alloc(struct fc_lport *dev,
- size_t payload_len)
-{
- return __fc_frame_alloc(payload_len);
-}
+struct fc_frame *_fc_frame_alloc(size_t payload_len);
/*
* Allocate fc_frame structure and buffer. Set the initial length to
@@ -118,10 +114,10 @@ static inline struct fc_frame *fc_frame_alloc(struct fc_lport *dev, size_t len)
* Note: Since len will often be a constant multiple of 4,
* this check will usually be evaluated and eliminated at compile time.
*/
- if ((len % 4) != 0)
+ if (len && len % 4)
fp = fc_frame_alloc_fill(dev, len);
else
- fp = _fc_frame_alloc(dev, len);
+ fp = _fc_frame_alloc(len);
return fp;
}
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index d67dda2b6aa0..66d377b9c72b 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -311,6 +311,8 @@ enum iscsi_param {
ISCSI_PARAM_IFACE_NAME,
ISCSI_PARAM_ISID,
ISCSI_PARAM_INITIATOR_NAME,
+
+ ISCSI_PARAM_TGT_RESET_TMO,
/* must always be last */
ISCSI_PARAM_MAX,
};
@@ -350,6 +352,7 @@ enum iscsi_param {
#define ISCSI_IFACE_NAME (1ULL << ISCSI_PARAM_IFACE_NAME)
#define ISCSI_ISID (1ULL << ISCSI_PARAM_ISID)
#define ISCSI_INITIATOR_NAME (1ULL << ISCSI_PARAM_INITIATOR_NAME)
+#define ISCSI_TGT_RESET_TMO (1ULL << ISCSI_PARAM_TGT_RESET_TMO)
/* iSCSI HBA params */
enum iscsi_host_param {
diff --git a/include/scsi/iscsi_proto.h b/include/scsi/iscsi_proto.h
index f2a2c1169486..dd0a52cea95a 100644
--- a/include/scsi/iscsi_proto.h
+++ b/include/scsi/iscsi_proto.h
@@ -279,6 +279,8 @@ struct iscsi_tm {
#define ISCSI_TM_FUNC_TARGET_COLD_RESET 7
#define ISCSI_TM_FUNC_TASK_REASSIGN 8
+#define ISCSI_TM_FUNC_VALUE(hdr) ((hdr)->flags & ISCSI_FLAG_TM_FUNC_MASK)
+
/* SCSI Task Management Response Header */
struct iscsi_tm_rsp {
uint8_t opcode;
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 65dc9aacbf70..4b912eee33e5 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -26,6 +26,7 @@
#include <scsi/scsi_transport.h>
#include <scsi/scsi_transport_fc.h>
+#include <scsi/scsi_bsg_fc.h>
#include <scsi/fc/fc_fcp.h>
#include <scsi/fc/fc_ns.h>
@@ -34,67 +35,6 @@
#include <scsi/fc_frame.h>
-#define FC_LIBFC_LOGGING 0x01 /* General logging, not categorized */
-#define FC_LPORT_LOGGING 0x02 /* lport layer logging */
-#define FC_DISC_LOGGING 0x04 /* discovery layer logging */
-#define FC_RPORT_LOGGING 0x08 /* rport layer logging */
-#define FC_FCP_LOGGING 0x10 /* I/O path logging */
-#define FC_EM_LOGGING 0x20 /* Exchange Manager logging */
-#define FC_EXCH_LOGGING 0x40 /* Exchange/Sequence logging */
-#define FC_SCSI_LOGGING 0x80 /* SCSI logging (mostly error handling) */
-
-extern unsigned int fc_debug_logging;
-
-#define FC_CHECK_LOGGING(LEVEL, CMD) \
-do { \
- if (unlikely(fc_debug_logging & LEVEL)) \
- do { \
- CMD; \
- } while (0); \
-} while (0)
-
-#define FC_LIBFC_DBG(fmt, args...) \
- FC_CHECK_LOGGING(FC_LIBFC_LOGGING, \
- printk(KERN_INFO "libfc: " fmt, ##args))
-
-#define FC_LPORT_DBG(lport, fmt, args...) \
- FC_CHECK_LOGGING(FC_LPORT_LOGGING, \
- printk(KERN_INFO "host%u: lport %6x: " fmt, \
- (lport)->host->host_no, \
- fc_host_port_id((lport)->host), ##args))
-
-#define FC_DISC_DBG(disc, fmt, args...) \
- FC_CHECK_LOGGING(FC_DISC_LOGGING, \
- printk(KERN_INFO "host%u: disc: " fmt, \
- (disc)->lport->host->host_no, \
- ##args))
-
-#define FC_RPORT_ID_DBG(lport, port_id, fmt, args...) \
- FC_CHECK_LOGGING(FC_RPORT_LOGGING, \
- printk(KERN_INFO "host%u: rport %6x: " fmt, \
- (lport)->host->host_no, \
- (port_id), ##args))
-
-#define FC_RPORT_DBG(rdata, fmt, args...) \
- FC_RPORT_ID_DBG((rdata)->local_port, (rdata)->ids.port_id, fmt, ##args)
-
-#define FC_FCP_DBG(pkt, fmt, args...) \
- FC_CHECK_LOGGING(FC_FCP_LOGGING, \
- printk(KERN_INFO "host%u: fcp: %6x: " fmt, \
- (pkt)->lp->host->host_no, \
- pkt->rport->port_id, ##args))
-
-#define FC_EXCH_DBG(exch, fmt, args...) \
- FC_CHECK_LOGGING(FC_EXCH_LOGGING, \
- printk(KERN_INFO "host%u: xid %4x: " fmt, \
- (exch)->lp->host->host_no, \
- exch->xid, ##args))
-
-#define FC_SCSI_DBG(lport, fmt, args...) \
- FC_CHECK_LOGGING(FC_SCSI_LOGGING, \
- printk(KERN_INFO "host%u: scsi: " fmt, \
- (lport)->host->host_no, ##args))
-
/*
* libfc error codes
*/
@@ -115,15 +55,28 @@ do { \
p[2] = ((v) & 0xFF); \
} while (0)
-/*
- * FC HBA status
+/**
+ * enum fc_lport_state - Local port states
+ * @LPORT_ST_DISABLED: Disabled
+ * @LPORT_ST_FLOGI: Fabric login (FLOGI) sent
+ * @LPORT_ST_DNS: Waiting for name server remote port to become ready
+ * @LPORT_ST_RPN_ID: Register port name by ID (RPN_ID) sent
+ * @LPORT_ST_RFT_ID: Register Fibre Channel types by ID (RFT_ID) sent
+ * @LPORT_ST_RFF_ID: Register FC-4 Features by ID (RFF_ID) sent
+ * @LPORT_ST_SCR: State Change Register (SCR) sent
+ * @LPORT_ST_READY: Ready for use
+ * @LPORT_ST_LOGO: Local port logout (LOGO) sent
+ * @LPORT_ST_RESET: Local port reset
*/
enum fc_lport_state {
LPORT_ST_DISABLED = 0,
LPORT_ST_FLOGI,
LPORT_ST_DNS,
- LPORT_ST_RPN_ID,
+ LPORT_ST_RNN_ID,
+ LPORT_ST_RSNN_NN,
+ LPORT_ST_RSPN_ID,
LPORT_ST_RFT_ID,
+ LPORT_ST_RFF_ID,
LPORT_ST_SCR,
LPORT_ST_READY,
LPORT_ST_LOGO,
@@ -136,15 +89,28 @@ enum fc_disc_event {
DISC_EV_FAILED
};
+/**
+ * enum fc_rport_state - Remote port states
+ * @RPORT_ST_INIT: Initialized
+ * @RPORT_ST_PLOGI: Waiting for PLOGI completion
+ * @RPORT_ST_PRLI: Waiting for PRLI completion
+ * @RPORT_ST_RTV: Waiting for RTV completion
+ * @RPORT_ST_READY: Ready for use
+ * @RPORT_ST_LOGO: Remote port logout (LOGO) sent
+ * @RPORT_ST_ADISC: Discover Address sent
+ * @RPORT_ST_DELETE: Remote port being deleted
+ * @RPORT_ST_RESTART: Remote port being deleted and will restart
+*/
enum fc_rport_state {
- RPORT_ST_INIT, /* initialized */
- RPORT_ST_PLOGI, /* waiting for PLOGI completion */
- RPORT_ST_PRLI, /* waiting for PRLI completion */
- RPORT_ST_RTV, /* waiting for RTV completion */
- RPORT_ST_READY, /* ready for use */
- RPORT_ST_LOGO, /* port logout sent */
- RPORT_ST_ADISC, /* Discover Address sent */
- RPORT_ST_DELETE, /* port being deleted */
+ RPORT_ST_INIT,
+ RPORT_ST_PLOGI,
+ RPORT_ST_PRLI,
+ RPORT_ST_RTV,
+ RPORT_ST_READY,
+ RPORT_ST_LOGO,
+ RPORT_ST_ADISC,
+ RPORT_ST_DELETE,
+ RPORT_ST_RESTART,
};
/**
@@ -155,12 +121,20 @@ enum fc_rport_state {
* @port_id: Port ID of the discovered port
*/
struct fc_disc_port {
- struct fc_lport *lp;
- struct list_head peers;
- struct work_struct rport_work;
- u32 port_id;
+ struct fc_lport *lp;
+ struct list_head peers;
+ struct work_struct rport_work;
+ u32 port_id;
};
+/**
+ * enum fc_rport_event - Remote port events
+ * @RPORT_EV_NONE: No event
+ * @RPORT_EV_READY: Remote port is ready for use
+ * @RPORT_EV_FAILED: State machine failed, remote port is not ready
+ * @RPORT_EV_STOP: Remote port has been stopped
+ * @RPORT_EV_LOGO: Remote port logout (LOGO) sent
+ */
enum fc_rport_event {
RPORT_EV_NONE = 0,
RPORT_EV_READY,
@@ -171,6 +145,10 @@ enum fc_rport_event {
struct fc_rport_priv;
+/**
+ * struct fc_rport_operations - Operations for a remote port
+ * @event_callback: Function to be called for remote port events
+ */
struct fc_rport_operations {
void (*event_callback)(struct fc_lport *, struct fc_rport_priv *,
enum fc_rport_event);
@@ -178,11 +156,11 @@ struct fc_rport_operations {
/**
* struct fc_rport_libfc_priv - libfc internal information about a remote port
- * @local_port: Fibre Channel host port instance
- * @rp_state: indicates READY for I/O or DELETE when blocked.
- * @flags: REC and RETRY supported flags
- * @e_d_tov: error detect timeout value (in msec)
- * @r_a_tov: resource allocation timeout value (in msec)
+ * @local_port: The associated local port
+ * @rp_state: Indicates READY for I/O or DELETE when blocked
+ * @flags: REC and RETRY supported flags
+ * @e_d_tov: Error detect timeout value (in msec)
+ * @r_a_tov: Resource allocation timeout value (in msec)
*/
struct fc_rport_libfc_priv {
struct fc_lport *local_port;
@@ -195,47 +173,66 @@ struct fc_rport_libfc_priv {
};
/**
- * struct fc_rport_priv - libfc rport and discovery info about a remote port
- * @local_port: Fibre Channel host port instance
- * @rport: transport remote port
- * @kref: reference counter
- * @rp_state: state tracks progress of PLOGI, PRLI, and RTV exchanges
- * @ids: remote port identifiers and roles
- * @flags: REC and RETRY supported flags
- * @max_seq: maximum number of concurrent sequences
- * @disc_id: discovery identifier
- * @maxframe_size: maximum frame size
- * @retries: retry count in current state
- * @e_d_tov: error detect timeout value (in msec)
- * @r_a_tov: resource allocation timeout value (in msec)
- * @rp_mutex: mutex protects rport
- * @retry_work:
- * @event_callback: Callback for rport READY, FAILED or LOGO
+ * struct fc_rport_priv - libfc remote port and discovery info
+ * @local_port: The associated local port
+ * @rport: The FC transport remote port
+ * @kref: Reference counter
+ * @rp_state: Enumeration that tracks progress of PLOGI, PRLI,
+ * and RTV exchanges
+ * @ids: The remote port identifiers and roles
+ * @flags: REC and RETRY supported flags
+ * @max_seq: Maximum number of concurrent sequences
+ * @disc_id: The discovery identifier
+ * @maxframe_size: The maximum frame size
+ * @retries: The retry count for the current state
+ * @e_d_tov: Error detect timeout value (in msec)
+ * @r_a_tov: Resource allocation timeout value (in msec)
+ * @rp_mutex: The mutex that protects the remote port
+ * @retry_work: Handle for retries
+ * @event_callback: Callback when READY, FAILED or LOGO states complete
*/
struct fc_rport_priv {
- struct fc_lport *local_port;
- struct fc_rport *rport;
- struct kref kref;
- enum fc_rport_state rp_state;
+ struct fc_lport *local_port;
+ struct fc_rport *rport;
+ struct kref kref;
+ enum fc_rport_state rp_state;
struct fc_rport_identifiers ids;
- u16 flags;
- u16 max_seq;
- u16 disc_id;
- u16 maxframe_size;
- unsigned int retries;
- unsigned int e_d_tov;
- unsigned int r_a_tov;
- struct mutex rp_mutex;
- struct delayed_work retry_work;
- enum fc_rport_event event;
- struct fc_rport_operations *ops;
- struct list_head peers;
- struct work_struct event_work;
- u32 supported_classes;
+ u16 flags;
+ u16 max_seq;
+ u16 disc_id;
+ u16 maxframe_size;
+ unsigned int retries;
+ unsigned int e_d_tov;
+ unsigned int r_a_tov;
+ struct mutex rp_mutex;
+ struct delayed_work retry_work;
+ enum fc_rport_event event;
+ struct fc_rport_operations *ops;
+ struct list_head peers;
+ struct work_struct event_work;
+ u32 supported_classes;
};
-/*
- * fcoe stats structure
+/**
+ * struct fcoe_dev_stats - fcoe stats structure
+ * @SecondsSinceLastReset: Seconds since the last reset
+ * @TxFrames: Number of transmitted frames
+ * @TxWords: Number of transmitted words
+ * @RxFrames: Number of received frames
+ * @RxWords: Number of received words
+ * @ErrorFrames: Number of received error frames
+ * @DumpedFrames: Number of dumped frames
+ * @LinkFailureCount: Number of link failures
+ * @LossOfSignalCount: Number for signal losses
+ * @InvalidTxWordCount: Number of invalid transmitted words
+ * @InvalidCRCCount: Number of invalid CRCs
+ * @InputRequests: Number of input requests
+ * @OutputRequests: Number of output requests
+ * @ControlRequests: Number of control requests
+ * @InputMegabytes: Number of received megabytes
+ * @OutputMegabytes: Number of transmitted megabytes
+ * @VLinkFailureCount: Number of virtual link failures
+ * @MissDiscAdvCount: Number of missing FIP discovery advertisement
*/
struct fcoe_dev_stats {
u64 SecondsSinceLastReset;
@@ -254,12 +251,17 @@ struct fcoe_dev_stats {
u64 ControlRequests;
u64 InputMegabytes;
u64 OutputMegabytes;
+ u64 VLinkFailureCount;
+ u64 MissDiscAdvCount;
};
-/*
- * els data is used for passing ELS respone specific
- * data to send ELS response mainly using infomation
- * in exchange and sequence in EM layer.
+/**
+ * struct fc_seq_els_data - ELS data used for passing ELS specific responses
+ * @fp: The ELS frame
+ * @reason: The reason for rejection
+ * @explan: The explaination of the rejection
+ *
+ * Mainly used by the exchange manager layer.
*/
struct fc_seq_els_data {
struct fc_frame *fp;
@@ -267,77 +269,87 @@ struct fc_seq_els_data {
enum fc_els_rjt_explan explan;
};
-/*
- * FCP request structure, one for each scsi cmd request
+/**
+ * struct fc_fcp_pkt - FCP request structure (one for each scsi_cmnd request)
+ * @lp: The associated local port
+ * @state: The state of the I/O
+ * @tgt_flags: Target's flags
+ * @ref_cnt: Reference count
+ * @scsi_pkt_lock: Lock to protect the SCSI packet (must be taken before the
+ * host_lock if both are to be held at the same time)
+ * @cmd: The SCSI command (set and clear with the host_lock held)
+ * @list: Tracks queued commands (accessed with the host_lock held)
+ * @timer: The command timer
+ * @tm_done: Completion indicator
+ * @wait_for_comp: Indicator to wait for completion of the I/O (in jiffies)
+ * @start_time: Timestamp indicating the start of the I/O (in jiffies)
+ * @end_time: Timestamp indicating the end of the I/O (in jiffies)
+ * @last_pkt_time: Timestamp of the last frame received (in jiffies)
+ * @data_len: The length of the data
+ * @cdb_cmd: The CDB command
+ * @xfer_len: The transfer length
+ * @xfer_ddp: Indicates if this transfer used DDP (XID of the exchange
+ * will be set here if DDP was setup)
+ * @xfer_contig_end: The offset into the buffer if the buffer is contiguous
+ * (Tx and Rx)
+ * @max_payload: The maximum payload size (in bytes)
+ * @io_status: SCSI result (upper 24 bits)
+ * @cdb_status: CDB status
+ * @status_code: FCP I/O status
+ * @scsi_comp_flags: Completion flags (bit 3 Underrun bit 2: overrun)
+ * @req_flags: Request flags (bit 0: read bit:1 write)
+ * @scsi_resid: SCSI residule length
+ * @rport: The remote port that the SCSI command is targeted at
+ * @seq_ptr: The sequence that will carry the SCSI command
+ * @recov_retry: Number of recovery retries
+ * @recov_seq: The sequence for REC or SRR
*/
struct fc_fcp_pkt {
- /*
- * housekeeping stuff
- */
- struct fc_lport *lp; /* handle to hba struct */
- u16 state; /* scsi_pkt state state */
- u16 tgt_flags; /* target flags */
- atomic_t ref_cnt; /* fcp pkt ref count */
- spinlock_t scsi_pkt_lock; /* Must be taken before the host lock
- * if both are held at the same time */
- /*
- * SCSI I/O related stuff
- */
- struct scsi_cmnd *cmd; /* scsi command pointer. set/clear
- * under host lock */
- struct list_head list; /* tracks queued commands. access under
- * host lock */
- /*
- * timeout related stuff
- */
- struct timer_list timer; /* command timer */
+ /* Housekeeping information */
+ struct fc_lport *lp;
+ u16 state;
+ u16 tgt_flags;
+ atomic_t ref_cnt;
+ spinlock_t scsi_pkt_lock;
+
+ /* SCSI I/O related information */
+ struct scsi_cmnd *cmd;
+ struct list_head list;
+
+ /* Timeout related information */
+ struct timer_list timer;
struct completion tm_done;
- int wait_for_comp;
- unsigned long start_time; /* start jiffie */
- unsigned long end_time; /* end jiffie */
- unsigned long last_pkt_time; /* jiffies of last frame received */