aboutsummaryrefslogtreecommitdiff
path: root/include/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/fc/fc_els.h11
-rw-r--r--include/scsi/fc/fc_fcoe.h15
-rw-r--r--include/scsi/fc/fc_fip.h46
-rw-r--r--include/scsi/fc/fc_ns.h7
-rw-r--r--include/scsi/fc_encode.h7
-rw-r--r--include/scsi/fc_frame.h52
-rw-r--r--include/scsi/iscsi_if.h2
-rw-r--r--include/scsi/libfc.h77
-rw-r--r--include/scsi/libfcoe.h72
-rw-r--r--include/scsi/libsas.h12
-rw-r--r--include/scsi/osd_initiator.h16
-rw-r--r--include/scsi/osd_protocol.h42
-rw-r--r--include/scsi/osd_types.h5
-rw-r--r--include/scsi/scsi.h16
-rw-r--r--include/scsi/scsi_device.h10
-rw-r--r--include/scsi/scsi_host.h7
-rw-r--r--include/scsi/scsi_netlink.h4
-rw-r--r--include/scsi/scsi_tcq.h6
-rw-r--r--include/scsi/scsi_transport_fc.h3
-rw-r--r--include/scsi/scsi_transport_iscsi.h2
-rw-r--r--include/scsi/srp.h38
21 files changed, 365 insertions, 85 deletions
diff --git a/include/scsi/fc/fc_els.h b/include/scsi/fc/fc_els.h
index f94328132a2..481abbd48e3 100644
--- a/include/scsi/fc/fc_els.h
+++ b/include/scsi/fc/fc_els.h
@@ -191,6 +191,7 @@ enum fc_els_rjt_reason {
ELS_RJT_UNAB = 0x09, /* unable to perform command request */
ELS_RJT_UNSUP = 0x0b, /* command not supported */
ELS_RJT_INPROG = 0x0e, /* command already in progress */
+ ELS_RJT_FIP = 0x20, /* FIP error */
ELS_RJT_VENDOR = 0xff, /* vendor specific error */
};
@@ -212,6 +213,7 @@ enum fc_els_rjt_explan {
ELS_EXPL_UNAB_DATA = 0x2a, /* unable to supply requested data */
ELS_EXPL_UNSUPR = 0x2c, /* Request not supported */
ELS_EXPL_INV_LEN = 0x2d, /* Invalid payload length */
+ ELS_EXPL_NOT_NEIGHBOR = 0x62, /* VN2VN_Port not in neighbor set */
/* TBD - above definitions incomplete */
};
@@ -405,6 +407,15 @@ struct fc_els_prli {
};
/*
+ * ELS_PRLO - Process logout request and response.
+ */
+struct fc_els_prlo {
+ __u8 prlo_cmd; /* command */
+ __u8 prlo_obs; /* obsolete, but shall be set to 10h */
+ __be16 prlo_len; /* payload length */
+};
+
+/*
* ELS_ADISC payload
*/
struct fc_els_adisc {
diff --git a/include/scsi/fc/fc_fcoe.h b/include/scsi/fc/fc_fcoe.h
index e6ad3d2ae47..d5dcd606281 100644
--- a/include/scsi/fc/fc_fcoe.h
+++ b/include/scsi/fc/fc_fcoe.h
@@ -22,23 +22,18 @@
/*
* FCoE - Fibre Channel over Ethernet.
+ * See T11 FC-BB-5 Rev 2.00 (09-056v5.pdf)
*/
/*
- * FC_FCOE_OUI hasn't been standardized yet. XXX TBD.
+ * Default FC_FCOE_OUI / FC-MAP value.
*/
-#ifndef FC_FCOE_OUI
-#define FC_FCOE_OUI 0x0efc00 /* upper 24 bits of FCOE dest MAC TBD */
-#endif
+#define FC_FCOE_OUI 0x0efc00 /* upper 24 bits of FCOE MAC */
/*
- * The destination MAC address for the fabric login may get a different OUI.
- * This isn't standardized yet.
+ * Fabric Login (FLOGI) MAC for non-FIP use. Non-FIP use is deprecated.
*/
-#ifndef FC_FCOE_FLOGI_MAC
-/* gateway MAC - TBD */
#define FC_FCOE_FLOGI_MAC { 0x0e, 0xfc, 0x00, 0xff, 0xff, 0xfe }
-#endif
#define FC_FCOE_VER 0 /* version */
@@ -51,8 +46,6 @@
/*
* FCoE frame header - 14 bytes
- *
- * This is the August 2007 version of the FCoE header as defined by T11.
* This follows the VLAN header, which includes the ethertype.
*/
struct fcoe_hdr {
diff --git a/include/scsi/fc/fc_fip.h b/include/scsi/fc/fc_fip.h
index 17baa19380f..ae25d4ab254 100644
--- a/include/scsi/fc/fc_fip.h
+++ b/include/scsi/fc/fc_fip.h
@@ -17,9 +17,12 @@
#ifndef _FC_FIP_H_
#define _FC_FIP_H_
+#include <scsi/fc/fc_ns.h>
+
/*
* This version is based on:
* http://www.t11.org/ftp/t11/pub/fc/bb-5/08-543v1.pdf
+ * and T11 FC-BB-6 10-019v4.pdf (June 2010 VN2VN proposal)
*/
#define FIP_DEF_PRI 128 /* default selection priority */
@@ -29,11 +32,24 @@
#define FIP_FCF_FUZZ 100 /* random time added by FCF (mS) */
/*
+ * VN2VN proposed-standard values.
+ */
+#define FIP_VN_FC_MAP 0x0efd00 /* MAC OUI for VN2VN use */
+#define FIP_VN_PROBE_WAIT 100 /* interval between VN2VN probes (ms) */
+#define FIP_VN_ANN_WAIT 400 /* interval between VN2VN announcements (ms) */
+#define FIP_VN_RLIM_INT 10000 /* interval between probes when rate limited */
+#define FIP_VN_RLIM_COUNT 10 /* number of probes before rate limiting */
+#define FIP_VN_BEACON_INT 8000 /* interval between VN2VN beacons */
+#define FIP_VN_BEACON_FUZZ 100 /* random time to add to beacon period (ms) */
+
+/*
* Multicast MAC addresses. T11-adopted.
*/
-#define FIP_ALL_FCOE_MACS ((u8[6]) { 1, 0x10, 0x18, 1, 0, 0 })
-#define FIP_ALL_ENODE_MACS ((u8[6]) { 1, 0x10, 0x18, 1, 0, 1 })
-#define FIP_ALL_FCF_MACS ((u8[6]) { 1, 0x10, 0x18, 1, 0, 2 })
+#define FIP_ALL_FCOE_MACS ((__u8[6]) { 1, 0x10, 0x18, 1, 0, 0 })
+#define FIP_ALL_ENODE_MACS ((__u8[6]) { 1, 0x10, 0x18, 1, 0, 1 })
+#define FIP_ALL_FCF_MACS ((__u8[6]) { 1, 0x10, 0x18, 1, 0, 2 })
+#define FIP_ALL_VN2VN_MACS ((__u8[6]) { 1, 0x10, 0x18, 1, 0, 4 })
+#define FIP_ALL_P2P_MACS ((__u8[6]) { 1, 0x10, 0x18, 1, 0, 5 })
#define FIP_VER 1 /* version for fip_header */
@@ -60,6 +76,7 @@ enum fip_opcode {
FIP_OP_LS = 2, /* Link Service request or reply */
FIP_OP_CTRL = 3, /* Keep Alive / Link Reset */
FIP_OP_VLAN = 4, /* VLAN discovery */
+ FIP_OP_VN2VN = 5, /* VN2VN operation */
FIP_OP_VENDOR_MIN = 0xfff8, /* min vendor-specific opcode */
FIP_OP_VENDOR_MAX = 0xfffe, /* max vendor-specific opcode */
};
@@ -97,11 +114,23 @@ enum fip_vlan_subcode {
};
/*
+ * Subcodes for FIP_OP_VN2VN.
+ */
+enum fip_vn2vn_subcode {
+ FIP_SC_VN_PROBE_REQ = 1, /* probe request */
+ FIP_SC_VN_PROBE_REP = 2, /* probe reply */
+ FIP_SC_VN_CLAIM_NOTIFY = 3, /* claim notification */
+ FIP_SC_VN_CLAIM_REP = 4, /* claim response */
+ FIP_SC_VN_BEACON = 5, /* beacon */
+};
+
+/*
* flags in header fip_flags.
*/
enum fip_flag {
FIP_FL_FPMA = 0x8000, /* supports FPMA fabric-provided MACs */
FIP_FL_SPMA = 0x4000, /* supports SPMA server-provided MACs */
+ FIP_FL_REC_OR_P2P = 0x0008, /* configured addr or point-to-point */
FIP_FL_AVAIL = 0x0004, /* available for FLOGI/ELP */
FIP_FL_SOL = 0x0002, /* this is a solicited message */
FIP_FL_FPORT = 0x0001, /* sent from an F port */
@@ -130,6 +159,7 @@ enum fip_desc_type {
FIP_DT_FKA = 12, /* advertisement keep-alive period */
FIP_DT_VENDOR = 13, /* vendor ID */
FIP_DT_VLAN = 14, /* vlan number */
+ FIP_DT_FC4F = 15, /* FC-4 features */
FIP_DT_LIMIT, /* max defined desc_type + 1 */
FIP_DT_VENDOR_BASE = 128, /* first vendor-specific desc_type */
};
@@ -229,6 +259,16 @@ enum fip_fka_flags {
/* FIP_DT_FKA flags */
/*
+ * FIP_DT_FC4F - FC-4 features.
+ */
+struct fip_fc4_feat {
+ struct fip_desc fd_desc;
+ __u8 fd_resvd[2];
+ struct fc_ns_fts fd_fts;
+ struct fc_ns_ff fd_ff;
+} __attribute__((packed));
+
+/*
* FIP_DT_VENDOR descriptor.
*/
struct fip_vendor_desc {
diff --git a/include/scsi/fc/fc_ns.h b/include/scsi/fc/fc_ns.h
index e7d3ac497d7..185015dd116 100644
--- a/include/scsi/fc/fc_ns.h
+++ b/include/scsi/fc/fc_ns.h
@@ -100,6 +100,13 @@ struct fc_ns_fts {
};
/*
+ * FC4-features object.
+ */
+struct fc_ns_ff {
+ __be32 fd_feat[FC_NS_TYPES * 4 / FC_NS_BPW]; /* 4-bits per FC-type */
+};
+
+/*
* GID_PT request.
*/
struct fc_ns_gid_pt {
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h
index 9b4867c9c2d..6d293c846a4 100644
--- a/include/scsi/fc_encode.h
+++ b/include/scsi/fc_encode.h
@@ -21,6 +21,13 @@
#define _FC_ENCODE_H_
#include <asm/unaligned.h>
+/*
+ * F_CTL values for simple requests and responses.
+ */
+#define FC_FCTL_REQ (FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT)
+#define FC_FCTL_RESP (FC_FC_EX_CTX | FC_FC_LAST_SEQ | \
+ FC_FC_END_SEQ | FC_FC_SEQ_INIT)
+
struct fc_ns_rft {
struct fc_ns_fid fid; /* port ID object */
struct fc_ns_fts fts; /* FC4-types object */
diff --git a/include/scsi/fc_frame.h b/include/scsi/fc_frame.h
index 4d3e9c7b7c5..4ad02041b66 100644
--- a/include/scsi/fc_frame.h
+++ b/include/scsi/fc_frame.h
@@ -30,6 +30,23 @@
#include <linux/if_ether.h>
+/* some helpful macros */
+
+#define ntohll(x) be64_to_cpu(x)
+#define htonll(x) cpu_to_be64(x)
+
+static inline u32 ntoh24(const u8 *p)
+{
+ return (p[0] << 16) | (p[1] << 8) | p[2];
+}
+
+static inline void hton24(u8 *p, u32 v)
+{
+ p[0] = (v >> 16) & 0xff;
+ p[1] = (v >> 8) & 0xff;
+ p[2] = v & 0xff;
+}
+
/*
* The fc_frame interface is used to pass frame data between functions.
* The frame includes the data buffer, length, and SOF / EOF delimiter types.
@@ -51,6 +68,7 @@
#define fr_sof(fp) (fr_cb(fp)->fr_sof)
#define fr_eof(fp) (fr_cb(fp)->fr_eof)
#define fr_flags(fp) (fr_cb(fp)->fr_flags)
+#define fr_encaps(fp) (fr_cb(fp)->fr_encaps)
#define fr_max_payload(fp) (fr_cb(fp)->fr_max_payload)
#define fr_fsp(fp) (fr_cb(fp)->fr_fsp)
#define fr_crc(fp) (fr_cb(fp)->fr_crc)
@@ -66,9 +84,10 @@ struct fcoe_rcv_info {
struct fc_fcp_pkt *fr_fsp; /* for the corresponding fcp I/O */
u32 fr_crc;
u16 fr_max_payload; /* max FC payload */
- enum fc_sof fr_sof; /* start of frame delimiter */
- enum fc_eof fr_eof; /* end of frame delimiter */
+ u8 fr_sof; /* start of frame delimiter */
+ u8 fr_eof; /* end of frame delimiter */
u8 fr_flags; /* flags - see below */
+ u8 fr_encaps; /* LLD encapsulation info (e.g. FIP) */
u8 granted_mac[ETH_ALEN]; /* FCoE MAC address */
};
@@ -97,6 +116,7 @@ static inline void fc_frame_init(struct fc_frame *fp)
fr_dev(fp) = NULL;
fr_seq(fp) = NULL;
fr_flags(fp) = 0;
+ fr_encaps(fp) = 0;
}
struct fc_frame *fc_frame_alloc_fill(struct fc_lport *, size_t payload_len);
@@ -136,13 +156,39 @@ static inline int fc_frame_is_linear(struct fc_frame *fp)
/*
* Get frame header from message in fc_frame structure.
+ * This version doesn't do a length check.
+ */
+static inline
+struct fc_frame_header *__fc_frame_header_get(const struct fc_frame *fp)
+{
+ return (struct fc_frame_header *)fr_hdr(fp);
+}
+
+/*
+ * Get frame header from message in fc_frame structure.
* This hides a cast and provides a place to add some checking.
*/
static inline
struct fc_frame_header *fc_frame_header_get(const struct fc_frame *fp)
{
WARN_ON(fr_len(fp) < sizeof(struct fc_frame_header));
- return (struct fc_frame_header *) fr_hdr(fp);
+ return __fc_frame_header_get(fp);
+}
+
+/*
+ * Get source FC_ID (S_ID) from frame header in message.
+ */
+static inline u32 fc_frame_sid(const struct fc_frame *fp)
+{
+ return ntoh24(__fc_frame_header_get(fp)->fh_s_id);
+}
+
+/*
+ * Get destination FC_ID (D_ID) from frame header in message.
+ */
+static inline u32 fc_frame_did(const struct fc_frame *fp)
+{
+ return ntoh24(__fc_frame_header_get(fp)->fh_d_id);
}
/*
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index 66d377b9c72..a8631acd37c 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -313,6 +313,7 @@ enum iscsi_param {
ISCSI_PARAM_INITIATOR_NAME,
ISCSI_PARAM_TGT_RESET_TMO,
+ ISCSI_PARAM_TARGET_ALIAS,
/* must always be last */
ISCSI_PARAM_MAX,
};
@@ -353,6 +354,7 @@ enum iscsi_param {
#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)
+#define ISCSI_TARGET_ALIAS (1ULL << ISCSI_PARAM_TARGET_ALIAS)
/* iSCSI HBA params */
enum iscsi_host_param {
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 7495c0ba67e..f986ab7ffe6 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -42,24 +42,6 @@
#define FC_EX_TIMEOUT 1 /* Exchange timeout */
#define FC_EX_CLOSED 2 /* Exchange closed */
-/* some helpful macros */
-
-#define ntohll(x) be64_to_cpu(x)
-#define htonll(x) cpu_to_be64(x)
-
-
-static inline u32 ntoh24(const u8 *p)
-{
- return (p[0] << 16) | (p[1] << 8) | p[2];
-}
-
-static inline void hton24(u8 *p, u32 v)
-{
- p[0] = (v >> 16) & 0xff;
- p[1] = (v >> 8) & 0xff;
- p[2] = v & 0xff;
-}
-
/**
* enum fc_lport_state - Local port states
* @LPORT_ST_DISABLED: Disabled
@@ -97,25 +79,25 @@ enum fc_disc_event {
/**
* enum fc_rport_state - Remote port states
* @RPORT_ST_INIT: Initialized
+ * @RPORT_ST_FLOGI: Waiting for FLOGI completion for point-to-multipoint
+ * @RPORT_ST_PLOGI_WAIT: Waiting for peer to login for point-to-multipoint
* @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,
+ RPORT_ST_FLOGI,
+ RPORT_ST_PLOGI_WAIT,
RPORT_ST_PLOGI,
RPORT_ST_PRLI,
RPORT_ST_RTV,
RPORT_ST_READY,
- RPORT_ST_LOGO,
RPORT_ST_ADISC,
RPORT_ST_DELETE,
- RPORT_ST_RESTART,
};
/**
@@ -173,6 +155,7 @@ struct fc_rport_libfc_priv {
u16 flags;
#define FC_RP_FLAGS_REC_SUPPORTED (1 << 0)
#define FC_RP_FLAGS_RETRY (1 << 1)
+ #define FC_RP_STARTED (1 << 2)
unsigned int e_d_tov;
unsigned int r_a_tov;
};
@@ -185,16 +168,18 @@ struct fc_rport_libfc_priv {
* @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
+ * @flags: STARTED, 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
+ * @major_retries: The retry count for the entire PLOGI/PRLI state machine
* @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
+ * @rcu: Structure used for freeing in an RCU-safe manner
*/
struct fc_rport_priv {
struct fc_lport *local_port;
@@ -207,6 +192,7 @@ struct fc_rport_priv {
u16 disc_id;
u16 maxframe_size;
unsigned int retries;
+ unsigned int major_retries;
unsigned int e_d_tov;
unsigned int r_a_tov;
struct mutex rp_mutex;
@@ -216,6 +202,7 @@ struct fc_rport_priv {
struct list_head peers;
struct work_struct event_work;
u32 supported_classes;
+ struct rcu_head rcu;
};
/**
@@ -262,14 +249,12 @@ struct fcoe_dev_stats {
/**
* 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;
enum fc_els_rjt_reason reason;
enum fc_els_rjt_explan explan;
};
@@ -405,6 +390,7 @@ struct fc_seq {
* @esb_stat: ESB exchange status
* @r_a_tov: Resouce allocation time out value (in msecs)
* @seq_id: The next sequence ID to use
+ * @encaps: encapsulation information for lower-level driver
* @f_ctl: F_CTL flags for the sequence
* @fh_type: The frame type
* @class: The class of service
@@ -436,6 +422,7 @@ struct fc_exch {
u32 esb_stat;
u32 r_a_tov;
u8 seq_id;
+ u8 encaps;
u32 f_ctl;
u8 fh_type;
enum fc_class class;
@@ -530,12 +517,11 @@ struct libfc_function_template {
struct fc_frame *);
/*
- * Send an ELS response using infomation from a previous
- * exchange and sequence.
+ * Send an ELS response using infomation from the received frame.
*
* STATUS: OPTIONAL
*/
- void (*seq_els_rsp_send)(struct fc_seq *, enum fc_els_cmd,
+ void (*seq_els_rsp_send)(struct fc_frame *, enum fc_els_cmd,
struct fc_seq_els_data *);
/*
@@ -567,6 +553,13 @@ struct libfc_function_template {
struct fc_seq *(*seq_start_next)(struct fc_seq *);
/*
+ * Assign a sequence for an incoming request frame.
+ *
+ * STATUS: OPTIONAL
+ */
+ struct fc_seq *(*seq_assign)(struct fc_lport *, struct fc_frame *);
+
+ /*
* Reset an exchange manager, completing all sequences and exchanges.
* If s_id is non-zero, reset only exchanges originating from that FID.
* If d_id is non-zero, reset only exchanges sending to that FID.
@@ -587,8 +580,7 @@ struct libfc_function_template {
*
* STATUS: OPTIONAL
*/
- void (*lport_recv)(struct fc_lport *, struct fc_seq *,
- struct fc_frame *);
+ void (*lport_recv)(struct fc_lport *, struct fc_frame *);
/*
* Reset the local port.
@@ -650,8 +642,7 @@ struct libfc_function_template {
*
* STATUS: OPTIONAL
*/
- void (*rport_recv_req)(struct fc_seq *, struct fc_frame *,
- struct fc_lport *);
+ void (*rport_recv_req)(struct fc_lport *, struct fc_frame *);
/*
* lookup an rport by it's port ID.
@@ -697,8 +688,7 @@ struct libfc_function_template {
*
* STATUS: OPTIONAL
*/
- void (*disc_recv_req)(struct fc_seq *, struct fc_frame *,
- struct fc_lport *);
+ void (*disc_recv_req)(struct fc_lport *, struct fc_frame *);
/*
* Start discovery for a local port.
@@ -731,12 +721,12 @@ struct libfc_function_template {
* struct fc_disc - Discovery context
* @retry_count: Number of retries
* @pending: 1 if discovery is pending, 0 if not
- * @requesting: 1 if discovery has been requested, 0 if not
+ * @requested: 1 if discovery has been requested, 0 if not
* @seq_count: Number of sequences used for discovery
* @buf_len: Length of the discovery buffer
* @disc_id: Discovery ID
* @rports: List of discovered remote ports
- * @lport: The local port that discovery is for
+ * @priv: Private pointer for use by discovery code
* @disc_mutex: Mutex that protects the discovery context
* @partial_buf: Partial name buffer (if names are returned
* in multiple frames)
@@ -752,7 +742,7 @@ struct fc_disc {
u16 disc_id;
struct list_head rports;
- struct fc_lport *lport;
+ void *priv;
struct mutex disc_mutex;
struct fc_gpn_ft_resp partial_buf;
struct delayed_work disc_work;
@@ -796,6 +786,7 @@ struct fc_disc {
* @mfs: The maximum Fibre Channel payload size
* @max_retry_count: The maximum retry attempts
* @max_rport_retry_count: The maximum remote port retry attempts
+ * @rport_priv_size: Size needed by driver after struct fc_rport_priv
* @lro_xid: The maximum XID for LRO
* @lso_max: The maximum large offload send size
* @fcts: FC-4 type mask
@@ -842,9 +833,11 @@ struct fc_lport {
u32 lro_enabled:1;
u32 does_npiv:1;
u32 npiv_enabled:1;
+ u32 point_to_multipoint:1;
u32 mfs;
u8 max_retry_count;
u8 max_rport_retry_count;
+ u16 rport_priv_size;
u16 link_speed;
u16 link_supported_speeds;
u16 lro_xid;
@@ -986,6 +979,7 @@ int fc_set_mfs(struct fc_lport *, u32 mfs);
struct fc_lport *libfc_vport_create(struct fc_vport *, int privsize);
struct fc_lport *fc_vport_id_lookup(struct fc_lport *, u32 port_id);
int fc_lport_bsg_request(struct fc_bsg_job *);
+void fc_lport_set_local_id(struct fc_lport *, u32 port_id);
/*
* REMOTE PORT LAYER
@@ -998,6 +992,11 @@ void fc_rport_terminate_io(struct fc_rport *);
*****************************/
int fc_disc_init(struct fc_lport *);
+static inline struct fc_lport *fc_disc_lport(struct fc_disc *disc)
+{
+ return container_of(disc, struct fc_lport, disc);
+}
+
/*
* FCP LAYER
*****************************/
@@ -1029,6 +1028,10 @@ struct fc_seq *fc_elsct_send(struct fc_lport *, u32 did,
void *arg, u32 timer_msec);
void fc_lport_flogi_resp(struct fc_seq *, struct fc_frame *, void *);
void fc_lport_logo_resp(struct fc_seq *, struct fc_frame *, void *);
+void fc_fill_reply_hdr(struct fc_frame *, const struct fc_frame *,
+ enum fc_rctl, u32 parm_offset);
+void fc_fill_hdr(struct fc_frame *, const struct fc_frame *,
+ enum fc_rctl, u32 f_ctl, u16 seq_cnt, u32 parm_offset);
/*
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index ec13f51531f..06f1b5a8ed1 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -26,6 +26,7 @@
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <linux/workqueue.h>
+#include <linux/random.h>
#include <scsi/fc/fc_fcoe.h>
#include <scsi/libfc.h>
@@ -37,6 +38,7 @@
#define FCOE_CTLR_START_DELAY 2000 /* mS after first adv. to choose FCF */
#define FCOE_CTRL_SOL_TOV 2000 /* min. solicitation interval (mS) */
#define FCOE_CTLR_FCF_LIMIT 20 /* max. number of FCF entries */
+#define FCOE_CTLR_VN2VN_LOGIN_LIMIT 3 /* max. VN2VN rport login retries */
/**
* enum fip_state - internal state of FCoE controller.
@@ -45,6 +47,11 @@
* @FIP_ST_AUTO: determining whether to use FIP or non-FIP mode.
* @FIP_ST_NON_FIP: non-FIP mode selected.
* @FIP_ST_ENABLED: FIP mode selected.
+ * @FIP_ST_VNMP_START: VN2VN multipath mode start, wait
+ * @FIP_ST_VNMP_PROBE1: VN2VN sent first probe, listening
+ * @FIP_ST_VNMP_PROBE2: VN2VN sent second probe, listening
+ * @FIP_ST_VNMP_CLAIM: VN2VN sent claim, waiting for responses
+ * @FIP_ST_VNMP_UP: VN2VN multipath mode operation
*/
enum fip_state {
FIP_ST_DISABLED,
@@ -52,8 +59,23 @@ enum fip_state {
FIP_ST_AUTO,
FIP_ST_NON_FIP,
FIP_ST_ENABLED,
+ FIP_ST_VNMP_START,
+ FIP_ST_VNMP_PROBE1,
+ FIP_ST_VNMP_PROBE2,
+ FIP_ST_VNMP_CLAIM,
+ FIP_ST_VNMP_UP,
};
+/*
+ * Modes:
+ * The mode is the state that is to be entered after link up.
+ * It must not change after fcoe_ctlr_init() sets it.
+ */
+#define FIP_MODE_AUTO FIP_ST_AUTO
+#define FIP_MODE_NON_FIP FIP_ST_NON_FIP
+#define FIP_MODE_FABRIC FIP_ST_ENABLED
+#define FIP_MODE_VN2VN FIP_ST_VNMP_START
+
/**
* struct fcoe_ctlr - FCoE Controller and FIP state
* @state: internal FIP state for network link and FIP or non-FIP mode.
@@ -70,19 +92,20 @@ enum fip_state {
* @timer_work: &work_struct for doing keep-alives and resets.
* @recv_work: &work_struct for receiving FIP frames.
* @fip_recv_list: list of received FIP frames.
+ * @rnd_state: state for pseudo-random number generator.
+ * @port_id: proposed or selected local-port ID.
* @user_mfs: configured maximum FC frame size, including FC header.
* @flogi_oxid: exchange ID of most recent fabric login.
* @flogi_count: number of FLOGI attempts in AUTO mode.
* @map_dest: use the FC_MAP mode for destination MAC addresses.
* @spma: supports SPMA server-provided MACs mode
- * @send_ctlr_ka: need to send controller keep alive
- * @send_port_ka: need to send port keep alives
+ * @probe_tries: number of FC_IDs probed
* @dest_addr: MAC address of the selected FC forwarder.
* @ctl_src_addr: the native MAC address of our local port.
* @send: LLD-supplied function to handle sending FIP Ethernet frames
* @update_mac: LLD-supplied function to handle changes to MAC addresses.
* @get_src_addr: LLD-supplied function to supply a source MAC address.
- * @lock: lock protecting this structure.
+ * @ctlr_mutex: lock protecting this structure.
*
* This structure is used by all FCoE drivers. It contains information
* needed by all FCoE low-level drivers (LLDs) as well as internal state
@@ -103,21 +126,23 @@ struct fcoe_ctlr {
struct work_struct timer_work;
struct work_struct recv_work;
struct sk_buff_head fip_recv_list;
+
+ struct rnd_state rnd_state;
+ u32 port_id;
+
u16 user_mfs;
u16 flogi_oxid;
u8 flogi_count;
- u8 reset_req;
u8 map_dest;
u8 spma;
- u8 send_ctlr_ka;
- u8 send_port_ka;
+ u8 probe_tries;
u8 dest_addr[ETH_ALEN];
u8 ctl_src_addr[ETH_ALEN];
void (*send)(struct fcoe_ctlr *, struct sk_buff *);
void (*update_mac)(struct fc_lport *, u8 *addr);
u8 * (*get_src_addr)(struct fc_lport *);
- spinlock_t lock;
+ struct mutex ctlr_mutex;
};
/**
@@ -156,8 +181,26 @@ struct fcoe_fcf {
u8 fd_flags:1;
};
+/**
+ * struct fcoe_rport - VN2VN remote port
+ * @time: time of create or last beacon packet received from node
+ * @fcoe_len: max FCoE frame size, not including VLAN or Ethernet headers
+ * @flags: flags from probe or claim
+ * @login_count: number of unsuccessful rport logins to this port
+ * @enode_mac: E_Node control MAC address
+ * @vn_mac: VN_Node assigned MAC address for data
+ */
+struct fcoe_rport {
+ unsigned long time;
+ u16 fcoe_len;
+ u16 flags;
+ u8 login_count;
+ u8 enode_mac[ETH_ALEN];
+ u8 vn_mac[ETH_ALEN];
+};
+
/* FIP API functions */
-void fcoe_ctlr_init(struct fcoe_ctlr *);
+void fcoe_ctlr_init(struct fcoe_ctlr *, enum fip_state);
void fcoe_ctlr_destroy(struct fcoe_ctlr *);
void fcoe_ctlr_link_up(struct fcoe_ctlr *);
int fcoe_ctlr_link_down(struct fcoe_ctlr *);
@@ -168,6 +211,17 @@ int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_lport *,
/* libfcoe funcs */
u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int);
-int fcoe_libfc_config(struct fc_lport *, struct libfc_function_template *);
+int fcoe_libfc_config(struct fc_lport *, struct fcoe_ctlr *,
+ const struct libfc_function_template *, int init_fcp);
+
+/**
+ * is_fip_mode() - returns true if FIP mode selected.
+ * @fip: FCoE controller.
+ */
+static inline bool is_fip_mode(struct fcoe_ctlr *fip)
+{
+ return fip->state == FIP_ST_ENABLED;
+}
+
#endif /* _LIBFCOE_H */
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index 3b586859669..3dec1949f69 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -205,6 +205,7 @@ struct domain_device {
};
void *lldd_dev;
+ int gone;
};
struct sas_discovery_event {
@@ -422,16 +423,7 @@ enum service_response {
};
enum exec_status {
- SAM_GOOD = 0,
- SAM_CHECK_COND = 2,
- SAM_COND_MET = 4,
- SAM_BUSY = 8,
- SAM_INTERMEDIATE = 0x10,
- SAM_IM_COND_MET = 0x12,
- SAM_RESV_CONFLICT= 0x14,
- SAM_TASK_SET_FULL= 0x28,
- SAM_ACA_ACTIVE = 0x30,
- SAM_TASK_ABORTED = 0x40,
+ /* The SAM_STAT_.. codes fit in the lower 6 bits */
SAS_DEV_NO_RESPONSE = 0x80,
SAS_DATA_UNDERRUN,
diff --git a/include/scsi/osd_initiator.h b/include/scsi/osd_initiator.h
index a8f37012663..53a9e886612 100644
--- a/include/scsi/osd_initiator.h
+++ b/include/scsi/osd_initiator.h
@@ -137,7 +137,7 @@ struct osd_request {
void *buff;
unsigned alloc_size; /* 0 here means: don't call kfree */
unsigned total_bytes;
- } set_attr, enc_get_attr, get_attr;
+ } cdb_cont, set_attr, enc_get_attr, get_attr;
struct _osd_io_info {
struct bio *bio;
@@ -448,6 +448,20 @@ void osd_req_read(struct osd_request *or,
int osd_req_read_kern(struct osd_request *or,
const struct osd_obj_id *obj, u64 offset, void *buff, u64 len);
+/* Scatter/Gather write/read commands */
+int osd_req_write_sg(struct osd_request *or,
+ const struct osd_obj_id *obj, struct bio *bio,
+ const struct osd_sg_entry *sglist, unsigned numentries);
+int osd_req_read_sg(struct osd_request *or,
+ const struct osd_obj_id *obj, struct bio *bio,
+ const struct osd_sg_entry *sglist, unsigned numentries);
+int osd_req_write_sg_kern(struct osd_request *or,
+ const struct osd_obj_id *obj, void **buff,
+ const struct osd_sg_entry *sglist, unsigned numentries);
+int osd_req_read_sg_kern(struct osd_request *or,
+ const struct osd_obj_id *obj, void **buff,
+ const struct osd_sg_entry *sglist, unsigned numentries);
+
/*
* Root/Partition/Collection/Object Attributes commands
*/
diff --git a/include/scsi/osd_protocol.h b/include/scsi/osd_protocol.h
index 68566128354..a6026da25f3 100644
--- a/include/scsi/osd_protocol.h
+++ b/include/scsi/osd_protocol.h
@@ -631,4 +631,46 @@ static inline void osd_sec_set_caps(struct osd_capability_head *cap,
put_unaligned_le16(bit_mask, &cap->permissions_bit_mask);
}
+/* osd2r05a sec 5.3: CDB continuation segment formats */
+enum osd_continuation_segment_format {
+ CDB_CONTINUATION_FORMAT_V2 = 0x01,
+};
+
+struct osd_continuation_segment_header {
+ u8 format;
+ u8 reserved1;
+ __be16 service_action;
+ __be32 reserved2;
+ u8 integrity_check[OSDv2_CRYPTO_KEYID_SIZE];
+} __packed;
+
+/* osd2r05a sec 5.4.1: CDB continuation descriptors */
+enum osd_continuation_descriptor_type {
+ NO_MORE_DESCRIPTORS = 0x0000,
+ SCATTER_GATHER_LIST = 0x0001,
+ QUERY_LIST = 0x0002,
+ USER_OBJECT = 0x0003,
+ COPY_USER_OBJECT_SOURCE = 0x0101,
+ EXTENSION_CAPABILITIES = 0xFFEE
+};
+
+struct osd_continuation_descriptor_header {
+ __be16 type;
+ u8 reserved;
+ u8 pad_length;
+ __be32 length;
+} __packed;
+
+
+/* osd2r05a sec 5.4.2: Scatter/gather list */
+struct osd_sg_list_entry {
+ __be64 offset;
+ __be64 len;
+};
+
+struct osd_sg_continuation_descriptor {
+ struct osd_continuation_descriptor_header hdr;
+ struct osd_sg_list_entry entries[];
+};
+
#endif /* ndef __OSD_PROTOCOL_H__ */
diff --git a/include/scsi/osd_types.h b/include/scsi/osd_types.h
index 3f5e88cc75c..bd0be7ed4bc 100644
--- a/include/scsi/osd_types.h
+++ b/include/scsi/osd_types.h
@@ -37,4 +37,9 @@ struct osd_attr {
void *val_ptr; /* in network order */
};
+struct osd_sg_entry {
+ u64 offset;
+ u64 len;
+};
+
#endif /* ndef __OSD_TYPES_H__ */
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 9ae5c613131..216af8538cc 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -32,6 +32,12 @@ struct scsi_cmnd;
#endif
/*
+ * DIX-capable adapters effectively support infinite chaining for the
+ * protection information scatterlist
+ */
+#define SCSI_MAX_PROT_SG_SEGMENTS 0xFFFF
+
+/*
* Special value for scanning to specify scanning or rescanning of all
* possible channels, (target) ids, or luns on a given shost.
*/
@@ -67,6 +73,7 @@ struct scsi_cmnd;
#define SEND_DIAGNOSTIC 0x1d
#define ALLOW_MEDIUM_REMOVAL 0x1e
+#define READ_FORMAT_CAPACITIES 0x23
#define SET_WINDOW 0x24
#define READ_CAPACITY 0x25
#define READ_10 0x28
@@ -96,6 +103,7 @@ struct scsi_cmnd;
#define WRITE_SAME 0x41
#define UNMAP 0x42
#define READ_TOC 0x43
+#define READ_HEADER 0x44
#define LOG_SELECT 0x4c
#define LOG_SENSE 0x4d
#define XDWRITEREAD_10 0x53
@@ -151,10 +159,10 @@ struct scsi_cmnd;
/* defined in T10 SCSI Primary Commands-2 (SPC2) */
struct scsi_varlen_cdb_hdr {
- u8 opcode; /* opcode always == VARIABLE_LENGTH_CMD */
- u8 control;
- u8 misc[5];
- u8 additional_cdb_length; /* total cdb length - 8 */
+ __u8 opcode; /* opcode always == VARIABLE_LENGTH_CMD */
+ __u8 control;
+ __u8 misc[5];
+ __u8 additional_cdb_length; /* total cdb length - 8 */
__be16 service_action;
/* service specific data follows */
};
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index d80b6dbed1c..85867dcde33 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -148,6 +148,8 @@ struct scsi_device {
unsigned retry_hwerror:1; /* Retry HARDWARE_ERROR */
unsigned last_sector_bug:1; /* do not use multisector accesses on
SD_LAST_BUGGY_SECTORS */
+ unsigned no_read_disc_info:1; /* Avoid READ_DISC_INFO cmds */
+ unsigned no_read_capacity_16:1; /* Avoid READ_CAPACITY_16 cmds */
unsigned is_visible:1; /* is the device visible in sysfs */
DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */
@@ -381,6 +383,14 @@ extern int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd,
struct scsi_sense_hdr *, int timeout, int retries,
int *resid);
+#ifdef CONFIG_PM_RUNTIME
+extern int scsi_autopm_get_device(struct scsi_device *);
+extern void scsi_autopm_put_device(struct scsi_device *);
+#else
+static inline int scsi_autopm_get_device(struct scsi_device *d) { return 0; }
+static inline void scsi_autopm_put_device(struct scsi_device *d) {}
+#endif /* CONFIG_PM_RUNTIME */
+
static inline int __must_check scsi_device_reprobe(struct scsi_device *sdev)
{
return device_reprobe(&sdev->sdev_gendev);
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index b7bdecb7b76..d0a6a845f20 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -388,6 +388,7 @@ struct scsi_host_template {
* of scatter-gather.
*/
unsigned short sg_tablesize;
+ unsigned short sg_prot_tablesize;
/*
* Set this if the host adapter has limitations beside segment count.
@@ -599,6 +600,7 @@ struct Scsi_Host {
int can_queue;
short cmd_per_lun;
short unsigned int sg_tablesize;
+ short unsigned int sg_prot_tablesize;
short unsigned int max_sectors;
unsigned long dma_boundary;
/*
@@ -823,6 +825,11 @@ static inline unsigned int scsi_host_get_prot(struct Scsi_Host *shost)
return shost->prot_capabilities;
}
+static inline int scsi_host_prot_dma(struct Scsi_Host *shost)
+{
+ return shost->prot_capabilities >= SHOST_DIX_TYPE0_PROTECTION;
+}
+
static inline unsigned int scsi_host_dif_capable(struct Scsi_Host *shost, unsigned int target_type)
{
static unsigned char cap[] = { 0,
diff --git a/include/scsi/scsi_netlink.h b/include/scsi/scsi_netlink.h
index 536752c40d4..58ce8fe4478 100644
--- a/include/scsi/scsi_netlink.h
+++ b/include/scsi/scsi_netlink.h
@@ -105,8 +105,8 @@ struct scsi_nl_host_vendor_msg {
* PCI : ID data is the 16 bit PCI Registered Vendor ID
*/
#define SCSI_NL_VID_TYPE_SHIFT 56
-#define SCSI_NL_VID_TYPE_MASK ((u64)0xFF << SCSI_NL_VID_TYPE_SHIFT)
-#define SCSI_NL_VID_TYPE_PCI ((u64)0x01 << SCSI_NL_VID_TYPE_SHIFT)
+#define SCSI_NL_VID_TYPE_MASK ((__u64)0xFF << SCSI_NL_VID_TYPE_SHIFT)
+#define SCSI_NL_VID_TYPE_PCI ((__u64)0x01 << SCSI_NL_VID_TYPE_SHIFT)
#define SCSI_NL_VID_ID_MASK (~ SCSI_NL_VID_TYPE_MASK)
diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h
index 17231385cb3..d6e7994aa63 100644
--- a/include/scsi/scsi_tcq.h
+++ b/include/scsi/scsi_tcq.h
@@ -97,13 +97,9 @@ static inline void scsi_deactivate_tcq(struct scsi_device *sdev, int depth)
static inline int scsi_populate_tag_msg(struct scsi_cmnd *cmd, char *msg)
{
struct request *req = cmd->request;
- struct scsi_device *sdev = cmd->device;
if (blk_rq_tagged(req)) {
- if (sdev->ordered_tags && req->cmd_flags & REQ_HARDBARRIER)
- *msg++ = MSG_ORDERED_TAG;
- else
- *msg++ = MSG_SIMPLE_TAG;
+ *msg++ = MSG_SIMPLE_TAG;
*msg++ = req->tag;
return 2;
}
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 87d81b3ce56..59816fe31e6 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -496,6 +496,7 @@ struct fc_host_attrs {
u64 fabric_name;
char symbolic_name[FC_SYMBOLIC_NAME_SIZE];
char system_hostname[FC_SYMBOLIC_NAME_SIZE];
+ u32 dev_loss_tmo;
/* Private (Transport-managed) Attributes */
enum fc_tgtid_binding_type tgtid_bind_type;
@@ -580,6 +581,8 @@ struct fc_host_attrs {
(((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q_name)
#define fc_host_devloss_work_q(x) \
(((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q)
+#define fc_host_dev_loss_tmo(x) \
+ (((struct fc_host_attrs *)(x)->shost_data)->dev_loss_tmo)
struct fc_bsg_buffer {
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 349c7f30720..7fff94b3b2a 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -32,6 +32,7 @@ struct scsi_transport_template;
struct iscsi_transport;
struct iscsi_endpoint;
struct Scsi_Host;
+struct scsi_cmnd;
struct iscsi_cls_conn;
struct iscsi_conn;
struct iscsi_task;
@@ -255,5 +256,6 @@ extern int iscsi_scan_finished(struct Scsi_Host *shost, unsigned long time);
extern struct iscsi_endpoint *iscsi_create_endpoint(int dd_size);
extern void iscsi_destroy_endpoint(struct iscsi_endpoint *ep);
extern struct iscsi_endpoint *iscsi_lookup_endpoint(u64 handle);
+extern int iscsi_block_scsi_eh(struct scsi_cmnd *cmd);
#endif
diff --git a/include/scsi/srp.h b/include/scsi/srp.h
index ad178fa78f6..1ae84db4c9f 100644
--- a/include/scsi/srp.h
+++ b/include/scsi/srp.h
@@ -239,4 +239,42 @@ struct srp_rsp {
u8 data[0];
} __attribute__((packed));
+struct srp_cred_req {
+ u8 opcode;
+ u8 sol_not;
+ u8 reserved[2];
+ __be32 req_lim_delta;
+ u64 tag;
+};
+
+struct srp_cred_rsp {
+ u8 opcode;
+ u8 reserved[7];
+ u64 tag;
+};
+
+/*
+ * The SRP spec defines the fixed portion of the AER_REQ structure to be
+ * 36 bytes, so it needs to be packed to avoid having it padded to 40 bytes
+ * on 64-bit architectures.
+ */
+struct srp_aer_req {
+ u8 opcode;
+ u8 sol_not;
+ u8 reserved[2];
+ __be32 req_lim_delta;
+ u64 tag;
+ u32 reserved2;
+ __be64 lun;
+ __be32 sense_data_len;
+ u32 reserved3;
+ u8 sense_data[0];
+} __attribute__((packed));
+
+struct srp_aer_rsp {
+ u8 opcode;
+ u8 reserved[7];
+ u64 tag;
+};
+
#endif /* SCSI_SRP_H */