aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-04 18:15:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-04 18:15:15 -0400
commit03da30986793385af57eeca3296253c887b742e6 (patch)
tree9c46dbe51c9d0856990649dd917ab45474b7be87 /include
parent6ba74014c1ab0e37af7de6f64b4eccbbae3cb9e7 (diff)
parent339f4f4eab80caa6cf0d39fb057ad6ddb84ba91e (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: (276 commits) [SCSI] zfcp: Trigger logging in the FCP channel on qdio error conditions [SCSI] zfcp: Introduce experimental support for DIF/DIX [SCSI] zfcp: Enable data division support for FCP devices [SCSI] zfcp: Prevent access on uninitialized memory. [SCSI] zfcp: Post events through FC transport class [SCSI] zfcp: Cleanup QDIO attachment and improve processing. [SCSI] zfcp: Cleanup function parameters for sbal value. [SCSI] zfcp: Use correct width for timer_interval field [SCSI] zfcp: Remove SCSI device when removing unit [SCSI] zfcp: Use memdup_user and kstrdup [SCSI] zfcp: Fix retry after failed "open port" erp action [SCSI] zfcp: Fail erp after timeout [SCSI] zfcp: Use forced_reopen in terminate_rport_io callback [SCSI] zfcp: Register SCSI devices after successful fc_remote_port_add [SCSI] zfcp: Do not try "forced close" when port is already closed [SCSI] zfcp: Do not unblock rport from REOPEN_PORT_FORCED [SCSI] sd: add support for runtime PM [SCSI] implement runtime Power Management [SCSI] convert to the new PM framework [SCSI] Unify SAM_ and SAM_STAT_ macros ...
Diffstat (limited to 'include')
-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.h75
-rw-r--r--include/scsi/libfcoe.h72
-rw-r--r--include/scsi/libsas.h11
-rw-r--r--include/scsi/scsi_device.h8
-rw-r--r--include/scsi/scsi_transport_iscsi.h2
12 files changed, 236 insertions, 72 deletions
diff --git a/include/scsi/fc/fc_els.h b/include/scsi/fc/fc_els.h
index f94328132a26..481abbd48e39 100644
--- a/include/scsi/fc/fc_els.h
+++ b/include/scsi/fc/fc_els.h
@@ -191,6 +191,7 @@ enum fc_els_rjt_reason {
191 ELS_RJT_UNAB = 0x09, /* unable to perform command request */ 191 ELS_RJT_UNAB = 0x09, /* unable to perform command request */
192 ELS_RJT_UNSUP = 0x0b, /* command not supported */ 192 ELS_RJT_UNSUP = 0x0b, /* command not supported */
193 ELS_RJT_INPROG = 0x0e, /* command already in progress */ 193 ELS_RJT_INPROG = 0x0e, /* command already in progress */
194 ELS_RJT_FIP = 0x20, /* FIP error */
194 ELS_RJT_VENDOR = 0xff, /* vendor specific error */ 195 ELS_RJT_VENDOR = 0xff, /* vendor specific error */
195}; 196};
196 197
@@ -212,6 +213,7 @@ enum fc_els_rjt_explan {
212 ELS_EXPL_UNAB_DATA = 0x2a, /* unable to supply requested data */ 213 ELS_EXPL_UNAB_DATA = 0x2a, /* unable to supply requested data */
213 ELS_EXPL_UNSUPR = 0x2c, /* Request not supported */ 214 ELS_EXPL_UNSUPR = 0x2c, /* Request not supported */
214 ELS_EXPL_INV_LEN = 0x2d, /* Invalid payload length */ 215 ELS_EXPL_INV_LEN = 0x2d, /* Invalid payload length */
216 ELS_EXPL_NOT_NEIGHBOR = 0x62, /* VN2VN_Port not in neighbor set */
215 /* TBD - above definitions incomplete */ 217 /* TBD - above definitions incomplete */
216}; 218};
217 219
@@ -405,6 +407,15 @@ struct fc_els_prli {
405}; 407};
406 408
407/* 409/*
410 * ELS_PRLO - Process logout request and response.
411 */
412struct fc_els_prlo {
413 __u8 prlo_cmd; /* command */
414 __u8 prlo_obs; /* obsolete, but shall be set to 10h */
415 __be16 prlo_len; /* payload length */
416};
417
418/*
408 * ELS_ADISC payload 419 * ELS_ADISC payload
409 */ 420 */
410struct fc_els_adisc { 421struct fc_els_adisc {
diff --git a/include/scsi/fc/fc_fcoe.h b/include/scsi/fc/fc_fcoe.h
index e6ad3d2ae475..d5dcd6062815 100644
--- a/include/scsi/fc/fc_fcoe.h
+++ b/include/scsi/fc/fc_fcoe.h
@@ -22,23 +22,18 @@
22 22
23/* 23/*
24 * FCoE - Fibre Channel over Ethernet. 24 * FCoE - Fibre Channel over Ethernet.
25 * See T11 FC-BB-5 Rev 2.00 (09-056v5.pdf)
25 */ 26 */
26 27
27/* 28/*
28 * FC_FCOE_OUI hasn't been standardized yet. XXX TBD. 29 * Default FC_FCOE_OUI / FC-MAP value.
29 */ 30 */
30#ifndef FC_FCOE_OUI 31#define FC_FCOE_OUI 0x0efc00 /* upper 24 bits of FCOE MAC */
31#define FC_FCOE_OUI 0x0efc00 /* upper 24 bits of FCOE dest MAC TBD */
32#endif
33 32
34/* 33/*
35 * The destination MAC address for the fabric login may get a different OUI. 34 * Fabric Login (FLOGI) MAC for non-FIP use. Non-FIP use is deprecated.
36 * This isn't standardized yet.
37 */ 35 */
38#ifndef FC_FCOE_FLOGI_MAC
39/* gateway MAC - TBD */
40#define FC_FCOE_FLOGI_MAC { 0x0e, 0xfc, 0x00, 0xff, 0xff, 0xfe } 36#define FC_FCOE_FLOGI_MAC { 0x0e, 0xfc, 0x00, 0xff, 0xff, 0xfe }
41#endif
42 37
43#define FC_FCOE_VER 0 /* version */ 38#define FC_FCOE_VER 0 /* version */
44 39
@@ -51,8 +46,6 @@
51 46
52/* 47/*
53 * FCoE frame header - 14 bytes 48 * FCoE frame header - 14 bytes
54 *
55 * This is the August 2007 version of the FCoE header as defined by T11.
56 * This follows the VLAN header, which includes the ethertype. 49 * This follows the VLAN header, which includes the ethertype.
57 */ 50 */
58struct fcoe_hdr { 51struct fcoe_hdr {
diff --git a/include/scsi/fc/fc_fip.h b/include/scsi/fc/fc_fip.h
index 17baa19380f0..ae25d4ab2548 100644
--- a/include/scsi/fc/fc_fip.h
+++ b/include/scsi/fc/fc_fip.h
@@ -17,9 +17,12 @@
17#ifndef _FC_FIP_H_ 17#ifndef _FC_FIP_H_
18#define _FC_FIP_H_ 18#define _FC_FIP_H_
19 19
20#include <scsi/fc/fc_ns.h>
21
20/* 22/*
21 * This version is based on: 23 * This version is based on:
22 * http://www.t11.org/ftp/t11/pub/fc/bb-5/08-543v1.pdf 24 * http://www.t11.org/ftp/t11/pub/fc/bb-5/08-543v1.pdf
25 * and T11 FC-BB-6 10-019v4.pdf (June 2010 VN2VN proposal)
23 */ 26 */
24 27
25#define FIP_DEF_PRI 128 /* default selection priority */ 28#define FIP_DEF_PRI 128 /* default selection priority */
@@ -29,11 +32,24 @@
29#define FIP_FCF_FUZZ 100 /* random time added by FCF (mS) */ 32#define FIP_FCF_FUZZ 100 /* random time added by FCF (mS) */
30 33
31/* 34/*
35 * VN2VN proposed-standard values.
36 */
37#define FIP_VN_FC_MAP 0x0efd00 /* MAC OUI for VN2VN use */
38#define FIP_VN_PROBE_WAIT 100 /* interval between VN2VN probes (ms) */
39#define FIP_VN_ANN_WAIT 400 /* interval between VN2VN announcements (ms) */
40#define FIP_VN_RLIM_INT 10000 /* interval between probes when rate limited */
41#define FIP_VN_RLIM_COUNT 10 /* number of probes before rate limiting */
42#define FIP_VN_BEACON_INT 8000 /* interval between VN2VN beacons */
43#define FIP_VN_BEACON_FUZZ 100 /* random time to add to beacon period (ms) */
44
45/*
32 * Multicast MAC addresses. T11-adopted. 46 * Multicast MAC addresses. T11-adopted.
33 */ 47 */
34#define FIP_ALL_FCOE_MACS ((u8[6]) { 1, 0x10, 0x18, 1, 0, 0 }) 48#define FIP_ALL_FCOE_MACS ((__u8[6]) { 1, 0x10, 0x18, 1, 0, 0 })
35#define FIP_ALL_ENODE_MACS ((u8[6]) { 1, 0x10, 0x18, 1, 0, 1 }) 49#define FIP_ALL_ENODE_MACS ((__u8[6]) { 1, 0x10, 0x18, 1, 0, 1 })
36#define FIP_ALL_FCF_MACS ((u8[6]) { 1, 0x10, 0x18, 1, 0, 2 }) 50#define FIP_ALL_FCF_MACS ((__u8[6]) { 1, 0x10, 0x18, 1, 0, 2 })
51#define FIP_ALL_VN2VN_MACS ((__u8[6]) { 1, 0x10, 0x18, 1, 0, 4 })
52#define FIP_ALL_P2P_MACS ((__u8[6]) { 1, 0x10, 0x18, 1, 0, 5 })
37 53
38#define FIP_VER 1 /* version for fip_header */ 54#define FIP_VER 1 /* version for fip_header */
39 55
@@ -60,6 +76,7 @@ enum fip_opcode {
60 FIP_OP_LS = 2, /* Link Service request or reply */ 76 FIP_OP_LS = 2, /* Link Service request or reply */
61 FIP_OP_CTRL = 3, /* Keep Alive / Link Reset */ 77 FIP_OP_CTRL = 3, /* Keep Alive / Link Reset */
62 FIP_OP_VLAN = 4, /* VLAN discovery */ 78 FIP_OP_VLAN = 4, /* VLAN discovery */
79 FIP_OP_VN2VN = 5, /* VN2VN operation */
63 FIP_OP_VENDOR_MIN = 0xfff8, /* min vendor-specific opcode */ 80 FIP_OP_VENDOR_MIN = 0xfff8, /* min vendor-specific opcode */
64 FIP_OP_VENDOR_MAX = 0xfffe, /* max vendor-specific opcode */ 81 FIP_OP_VENDOR_MAX = 0xfffe, /* max vendor-specific opcode */
65}; 82};
@@ -97,11 +114,23 @@ enum fip_vlan_subcode {
97}; 114};
98 115
99/* 116/*
117 * Subcodes for FIP_OP_VN2VN.
118 */
119enum fip_vn2vn_subcode {
120 FIP_SC_VN_PROBE_REQ = 1, /* probe request */
121 FIP_SC_VN_PROBE_REP = 2, /* probe reply */
122 FIP_SC_VN_CLAIM_NOTIFY = 3, /* claim notification */
123 FIP_SC_VN_CLAIM_REP = 4, /* claim response */
124 FIP_SC_VN_BEACON = 5, /* beacon */
125};
126
127/*
100 * flags in header fip_flags. 128 * flags in header fip_flags.
101 */ 129 */
102enum fip_flag { 130enum fip_flag {
103 FIP_FL_FPMA = 0x8000, /* supports FPMA fabric-provided MACs */ 131 FIP_FL_FPMA = 0x8000, /* supports FPMA fabric-provided MACs */
104 FIP_FL_SPMA = 0x4000, /* supports SPMA server-provided MACs */ 132 FIP_FL_SPMA = 0x4000, /* supports SPMA server-provided MACs */
133 FIP_FL_REC_OR_P2P = 0x0008, /* configured addr or point-to-point */
105 FIP_FL_AVAIL = 0x0004, /* available for FLOGI/ELP */ 134 FIP_FL_AVAIL = 0x0004, /* available for FLOGI/ELP */
106 FIP_FL_SOL = 0x0002, /* this is a solicited message */ 135 FIP_FL_SOL = 0x0002, /* this is a solicited message */
107 FIP_FL_FPORT = 0x0001, /* sent from an F port */ 136 FIP_FL_FPORT = 0x0001, /* sent from an F port */
@@ -130,6 +159,7 @@ enum fip_desc_type {
130 FIP_DT_FKA = 12, /* advertisement keep-alive period */ 159 FIP_DT_FKA = 12, /* advertisement keep-alive period */
131 FIP_DT_VENDOR = 13, /* vendor ID */ 160 FIP_DT_VENDOR = 13, /* vendor ID */
132 FIP_DT_VLAN = 14, /* vlan number */ 161 FIP_DT_VLAN = 14, /* vlan number */
162 FIP_DT_FC4F = 15, /* FC-4 features */
133 FIP_DT_LIMIT, /* max defined desc_type + 1 */ 163 FIP_DT_LIMIT, /* max defined desc_type + 1 */
134 FIP_DT_VENDOR_BASE = 128, /* first vendor-specific desc_type */ 164 FIP_DT_VENDOR_BASE = 128, /* first vendor-specific desc_type */
135}; 165};
@@ -229,6 +259,16 @@ enum fip_fka_flags {
229/* FIP_DT_FKA flags */ 259/* FIP_DT_FKA flags */
230 260
231/* 261/*
262 * FIP_DT_FC4F - FC-4 features.
263 */
264struct fip_fc4_feat {
265 struct fip_desc fd_desc;
266 __u8 fd_resvd[2];
267 struct fc_ns_fts fd_fts;
268 struct fc_ns_ff fd_ff;
269} __attribute__((packed));
270
271/*
232 * FIP_DT_VENDOR descriptor. 272 * FIP_DT_VENDOR descriptor.
233 */ 273 */
234struct fip_vendor_desc { 274struct fip_vendor_desc {
diff --git a/include/scsi/fc/fc_ns.h b/include/scsi/fc/fc_ns.h
index e7d3ac497d7d..185015dd1166 100644
--- a/include/scsi/fc/fc_ns.h
+++ b/include/scsi/fc/fc_ns.h
@@ -100,6 +100,13 @@ struct fc_ns_fts {
100}; 100};
101 101
102/* 102/*
103 * FC4-features object.
104 */
105struct fc_ns_ff {
106 __be32 fd_feat[FC_NS_TYPES * 4 / FC_NS_BPW]; /* 4-bits per FC-type */
107};
108
109/*
103 * GID_PT request. 110 * GID_PT request.
104 */ 111 */
105struct fc_ns_gid_pt { 112struct fc_ns_gid_pt {
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h
index 9b4867c9c2d2..6d293c846a46 100644
--- a/include/scsi/fc_encode.h
+++ b/include/scsi/fc_encode.h
@@ -21,6 +21,13 @@
21#define _FC_ENCODE_H_ 21#define _FC_ENCODE_H_
22#include <asm/unaligned.h> 22#include <asm/unaligned.h>
23 23
24/*
25 * F_CTL values for simple requests and responses.
26 */
27#define FC_FCTL_REQ (FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT)
28#define FC_FCTL_RESP (FC_FC_EX_CTX | FC_FC_LAST_SEQ | \
29 FC_FC_END_SEQ | FC_FC_SEQ_INIT)
30
24struct fc_ns_rft { 31struct fc_ns_rft {
25 struct fc_ns_fid fid; /* port ID object */ 32 struct fc_ns_fid fid; /* port ID object */
26 struct fc_ns_fts fts; /* FC4-types object */ 33 struct fc_ns_fts fts; /* FC4-types object */
diff --git a/include/scsi/fc_frame.h b/include/scsi/fc_frame.h
index 4d3e9c7b7c57..4ad02041b667 100644
--- a/include/scsi/fc_frame.h
+++ b/include/scsi/fc_frame.h
@@ -30,6 +30,23 @@
30 30
31#include <linux/if_ether.h> 31#include <linux/if_ether.h>
32 32
33/* some helpful macros */
34
35#define ntohll(x) be64_to_cpu(x)
36#define htonll(x) cpu_to_be64(x)
37
38static inline u32 ntoh24(const u8 *p)
39{
40 return (p[0] << 16) | (p[1] << 8) | p[2];
41}
42
43static inline void hton24(u8 *p, u32 v)
44{
45 p[0] = (v >> 16) & 0xff;
46 p[1] = (v >> 8) & 0xff;
47 p[2] = v & 0xff;
48}
49
33/* 50/*
34 * The fc_frame interface is used to pass frame data between functions. 51 * The fc_frame interface is used to pass frame data between functions.
35 * The frame includes the data buffer, length, and SOF / EOF delimiter types. 52 * The frame includes the data buffer, length, and SOF / EOF delimiter types.
@@ -51,6 +68,7 @@
51#define fr_sof(fp) (fr_cb(fp)->fr_sof) 68#define fr_sof(fp) (fr_cb(fp)->fr_sof)
52#define fr_eof(fp) (fr_cb(fp)->fr_eof) 69#define fr_eof(fp) (fr_cb(fp)->fr_eof)
53#define fr_flags(fp) (fr_cb(fp)->fr_flags) 70#define fr_flags(fp) (fr_cb(fp)->fr_flags)
71#define fr_encaps(fp) (fr_cb(fp)->fr_encaps)
54#define fr_max_payload(fp) (fr_cb(fp)->fr_max_payload) 72#define fr_max_payload(fp) (fr_cb(fp)->fr_max_payload)
55#define fr_fsp(fp) (fr_cb(fp)->fr_fsp) 73#define fr_fsp(fp) (fr_cb(fp)->fr_fsp)
56#define fr_crc(fp) (fr_cb(fp)->fr_crc) 74#define fr_crc(fp) (fr_cb(fp)->fr_crc)
@@ -66,9 +84,10 @@ struct fcoe_rcv_info {
66 struct fc_fcp_pkt *fr_fsp; /* for the corresponding fcp I/O */ 84 struct fc_fcp_pkt *fr_fsp; /* for the corresponding fcp I/O */
67 u32 fr_crc; 85 u32 fr_crc;
68 u16 fr_max_payload; /* max FC payload */ 86 u16 fr_max_payload; /* max FC payload */
69 enum fc_sof fr_sof; /* start of frame delimiter */ 87 u8 fr_sof; /* start of frame delimiter */
70 enum fc_eof fr_eof; /* end of frame delimiter */ 88 u8 fr_eof; /* end of frame delimiter */
71 u8 fr_flags; /* flags - see below */ 89 u8 fr_flags; /* flags - see below */
90 u8 fr_encaps; /* LLD encapsulation info (e.g. FIP) */
72 u8 granted_mac[ETH_ALEN]; /* FCoE MAC address */ 91 u8 granted_mac[ETH_ALEN]; /* FCoE MAC address */
73}; 92};
74 93
@@ -97,6 +116,7 @@ static inline void fc_frame_init(struct fc_frame *fp)
97 fr_dev(fp) = NULL; 116 fr_dev(fp) = NULL;
98 fr_seq(fp) = NULL; 117 fr_seq(fp) = NULL;
99 fr_flags(fp) = 0; 118 fr_flags(fp) = 0;
119 fr_encaps(fp) = 0;
100} 120}
101 121
102struct fc_frame *fc_frame_alloc_fill(struct fc_lport *, size_t payload_len); 122struct 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)
136 156
137/* 157/*
138 * Get frame header from message in fc_frame structure. 158 * Get frame header from message in fc_frame structure.
159 * This version doesn't do a length check.
160 */
161static inline
162struct fc_frame_header *__fc_frame_header_get(const struct fc_frame *fp)
163{
164 return (struct fc_frame_header *)fr_hdr(fp);
165}
166
167/*
168 * Get frame header from message in fc_frame structure.
139 * This hides a cast and provides a place to add some checking. 169 * This hides a cast and provides a place to add some checking.
140 */ 170 */
141static inline 171static inline
142struct fc_frame_header *fc_frame_header_get(const struct fc_frame *fp) 172struct fc_frame_header *fc_frame_header_get(const struct fc_frame *fp)
143{ 173{
144 WARN_ON(fr_len(fp) < sizeof(struct fc_frame_header)); 174 WARN_ON(fr_len(fp) < sizeof(struct fc_frame_header));
145 return (struct fc_frame_header *) fr_hdr(fp); 175 return __fc_frame_header_get(fp);
176}
177
178/*
179 * Get source FC_ID (S_ID) from frame header in message.
180 */
181static inline u32 fc_frame_sid(const struct fc_frame *fp)
182{
183 return ntoh24(__fc_frame_header_get(fp)->fh_s_id);
184}
185
186/*
187 * Get destination FC_ID (D_ID) from frame header in message.
188 */
189static inline u32 fc_frame_did(const struct fc_frame *fp)
190{
191 return ntoh24(__fc_frame_header_get(fp)->fh_d_id);
146} 192}
147 193
148/* 194/*
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index 66d377b9c72b..a8631acd37c3 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -313,6 +313,7 @@ enum iscsi_param {
313 ISCSI_PARAM_INITIATOR_NAME, 313 ISCSI_PARAM_INITIATOR_NAME,
314 314
315 ISCSI_PARAM_TGT_RESET_TMO, 315 ISCSI_PARAM_TGT_RESET_TMO,
316 ISCSI_PARAM_TARGET_ALIAS,
316 /* must always be last */ 317 /* must always be last */
317 ISCSI_PARAM_MAX, 318 ISCSI_PARAM_MAX,
318}; 319};
@@ -353,6 +354,7 @@ enum iscsi_param {
353#define ISCSI_ISID (1ULL << ISCSI_PARAM_ISID) 354#define ISCSI_ISID (1ULL << ISCSI_PARAM_ISID)
354#define ISCSI_INITIATOR_NAME (1ULL << ISCSI_PARAM_INITIATOR_NAME) 355#define ISCSI_INITIATOR_NAME (1ULL << ISCSI_PARAM_INITIATOR_NAME)
355#define ISCSI_TGT_RESET_TMO (1ULL << ISCSI_PARAM_TGT_RESET_TMO) 356#define ISCSI_TGT_RESET_TMO (1ULL << ISCSI_PARAM_TGT_RESET_TMO)
357#define ISCSI_TARGET_ALIAS (1ULL << ISCSI_PARAM_TARGET_ALIAS)
356 358
357/* iSCSI HBA params */ 359/* iSCSI HBA params */
358enum iscsi_host_param { 360enum iscsi_host_param {
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 7495c0ba67ee..14be49b44e84 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -42,24 +42,6 @@
42#define FC_EX_TIMEOUT 1 /* Exchange timeout */ 42#define FC_EX_TIMEOUT 1 /* Exchange timeout */
43#define FC_EX_CLOSED 2 /* Exchange closed */ 43#define FC_EX_CLOSED 2 /* Exchange closed */
44 44
45/* some helpful macros */
46
47#define ntohll(x) be64_to_cpu(x)
48#define htonll(x) cpu_to_be64(x)
49
50
51static inline u32 ntoh24(const u8 *p)
52{
53 return (p[0] << 16) | (p[1] << 8) | p[2];
54}
55
56static inline void hton24(u8 *p, u32 v)
57{
58 p[0] = (v >> 16) & 0xff;
59 p[1] = (v >> 8) & 0xff;
60 p[2] = v & 0xff;
61}
62
63/** 45/**
64 * enum fc_lport_state - Local port states 46 * enum fc_lport_state - Local port states
65 * @LPORT_ST_DISABLED: Disabled 47 * @LPORT_ST_DISABLED: Disabled
@@ -97,25 +79,25 @@ enum fc_disc_event {
97/** 79/**
98 * enum fc_rport_state - Remote port states 80 * enum fc_rport_state - Remote port states
99 * @RPORT_ST_INIT: Initialized 81 * @RPORT_ST_INIT: Initialized
82 * @RPORT_ST_FLOGI: Waiting for FLOGI completion for point-to-multipoint
83 * @RPORT_ST_PLOGI_WAIT: Waiting for peer to login for point-to-multipoint
100 * @RPORT_ST_PLOGI: Waiting for PLOGI completion 84 * @RPORT_ST_PLOGI: Waiting for PLOGI completion
101 * @RPORT_ST_PRLI: Waiting for PRLI completion 85 * @RPORT_ST_PRLI: Waiting for PRLI completion
102 * @RPORT_ST_RTV: Waiting for RTV completion 86 * @RPORT_ST_RTV: Waiting for RTV completion
103 * @RPORT_ST_READY: Ready for use 87 * @RPORT_ST_READY: Ready for use
104 * @RPORT_ST_LOGO: Remote port logout (LOGO) sent
105 * @RPORT_ST_ADISC: Discover Address sent 88 * @RPORT_ST_ADISC: Discover Address sent
106 * @RPORT_ST_DELETE: Remote port being deleted 89 * @RPORT_ST_DELETE: Remote port being deleted
107 * @RPORT_ST_RESTART: Remote port being deleted and will restart
108*/ 90*/
109enum fc_rport_state { 91enum fc_rport_state {
110 RPORT_ST_INIT, 92 RPORT_ST_INIT,
93 RPORT_ST_FLOGI,
94 RPORT_ST_PLOGI_WAIT,
111 RPORT_ST_PLOGI, 95 RPORT_ST_PLOGI,
112 RPORT_ST_PRLI, 96 RPORT_ST_PRLI,
113 RPORT_ST_RTV, 97 RPORT_ST_RTV,
114 RPORT_ST_READY, 98 RPORT_ST_READY,
115 RPORT_ST_LOGO,
116 RPORT_ST_ADISC, 99 RPORT_ST_ADISC,
117 RPORT_ST_DELETE, 100 RPORT_ST_DELETE,
118 RPORT_ST_RESTART,
119}; 101};
120 102
121/** 103/**
@@ -173,6 +155,7 @@ struct fc_rport_libfc_priv {
173 u16 flags; 155 u16 flags;
174 #define FC_RP_FLAGS_REC_SUPPORTED (1 << 0) 156 #define FC_RP_FLAGS_REC_SUPPORTED (1 << 0)
175 #define FC_RP_FLAGS_RETRY (1 << 1) 157 #define FC_RP_FLAGS_RETRY (1 << 1)
158 #define FC_RP_STARTED (1 << 2)
176 unsigned int e_d_tov; 159 unsigned int e_d_tov;
177 unsigned int r_a_tov; 160 unsigned int r_a_tov;
178}; 161};
@@ -185,16 +168,18 @@ struct fc_rport_libfc_priv {
185 * @rp_state: Enumeration that tracks progress of PLOGI, PRLI, 168 * @rp_state: Enumeration that tracks progress of PLOGI, PRLI,
186 * and RTV exchanges 169 * and RTV exchanges
187 * @ids: The remote port identifiers and roles 170 * @ids: The remote port identifiers and roles
188 * @flags: REC and RETRY supported flags 171 * @flags: STARTED, REC and RETRY_SUPPORTED flags
189 * @max_seq: Maximum number of concurrent sequences 172 * @max_seq: Maximum number of concurrent sequences
190 * @disc_id: The discovery identifier 173 * @disc_id: The discovery identifier
191 * @maxframe_size: The maximum frame size 174 * @maxframe_size: The maximum frame size
192 * @retries: The retry count for the current state 175 * @retries: The retry count for the current state
176 * @major_retries: The retry count for the entire PLOGI/PRLI state machine
193 * @e_d_tov: Error detect timeout value (in msec) 177 * @e_d_tov: Error detect timeout value (in msec)
194 * @r_a_tov: Resource allocation timeout value (in msec) 178 * @r_a_tov: Resource allocation timeout value (in msec)
195 * @rp_mutex: The mutex that protects the remote port 179 * @rp_mutex: The mutex that protects the remote port
196 * @retry_work: Handle for retries 180 * @retry_work: Handle for retries
197 * @event_callback: Callback when READY, FAILED or LOGO states complete 181 * @event_callback: Callback when READY, FAILED or LOGO states complete
182 * @rcu: Structure used for freeing in an RCU-safe manner
198 */ 183 */
199struct fc_rport_priv { 184struct fc_rport_priv {
200 struct fc_lport *local_port; 185 struct fc_lport *local_port;
@@ -207,6 +192,7 @@ struct fc_rport_priv {
207 u16 disc_id; 192 u16 disc_id;
208 u16 maxframe_size; 193 u16 maxframe_size;
209 unsigned int retries; 194 unsigned int retries;
195 unsigned int major_retries;
210 unsigned int e_d_tov; 196 unsigned int e_d_tov;
211 unsigned int r_a_tov; 197 unsigned int r_a_tov;
212 struct mutex rp_mutex; 198 struct mutex rp_mutex;
@@ -216,6 +202,7 @@ struct fc_rport_priv {
216 struct list_head peers; 202 struct list_head peers;
217 struct work_struct event_work; 203 struct work_struct event_work;
218 u32 supported_classes; 204 u32 supported_classes;
205 struct rcu_head rcu;
219}; 206};
220 207
221/** 208/**
@@ -262,14 +249,12 @@ struct fcoe_dev_stats {
262 249
263/** 250/**
264 * struct fc_seq_els_data - ELS data used for passing ELS specific responses 251 * struct fc_seq_els_data - ELS data used for passing ELS specific responses
265 * @fp: The ELS frame
266 * @reason: The reason for rejection 252 * @reason: The reason for rejection
267 * @explan: The explaination of the rejection 253 * @explan: The explaination of the rejection
268 * 254 *
269 * Mainly used by the exchange manager layer. 255 * Mainly used by the exchange manager layer.
270 */ 256 */
271struct fc_seq_els_data { 257struct fc_seq_els_data {
272 struct fc_frame *fp;
273 enum fc_els_rjt_reason reason; 258 enum fc_els_rjt_reason reason;
274 enum fc_els_rjt_explan explan; 259 enum fc_els_rjt_explan explan;
275}; 260};
@@ -405,6 +390,7 @@ struct fc_seq {
405 * @esb_stat: ESB exchange status 390 * @esb_stat: ESB exchange status
406 * @r_a_tov: Resouce allocation time out value (in msecs) 391 * @r_a_tov: Resouce allocation time out value (in msecs)
407 * @seq_id: The next sequence ID to use 392 * @seq_id: The next sequence ID to use
393 * @encaps: encapsulation information for lower-level driver
408 * @f_ctl: F_CTL flags for the sequence 394 * @f_ctl: F_CTL flags for the sequence
409 * @fh_type: The frame type 395 * @fh_type: The frame type
410 * @class: The class of service 396 * @class: The class of service
@@ -436,6 +422,7 @@ struct fc_exch {
436 u32 esb_stat; 422 u32 esb_stat;
437 u32 r_a_tov; 423 u32 r_a_tov;
438 u8 seq_id; 424 u8 seq_id;
425 u8 encaps;
439 u32 f_ctl; 426 u32 f_ctl;
440 u8 fh_type; 427 u8 fh_type;
441 enum fc_class class; 428 enum fc_class class;
@@ -530,12 +517,11 @@ struct libfc_function_template {
530 struct fc_frame *); 517 struct fc_frame *);
531 518
532 /* 519 /*
533 * Send an ELS response using infomation from a previous 520 * Send an ELS response using infomation from the received frame.
534 * exchange and sequence.
535 * 521 *
536 * STATUS: OPTIONAL 522 * STATUS: OPTIONAL
537 */ 523 */
538 void (*seq_els_rsp_send)(struct fc_seq *, enum fc_els_cmd, 524 void (*seq_els_rsp_send)(struct fc_frame *, enum fc_els_cmd,
539 struct fc_seq_els_data *); 525 struct fc_seq_els_data *);
540 526
541 /* 527 /*
@@ -567,6 +553,13 @@ struct libfc_function_template {
567 struct fc_seq *(*seq_start_next)(struct fc_seq *); 553 struct fc_seq *(*seq_start_next)(struct fc_seq *);
568 554
569 /* 555 /*
556 * Assign a sequence for an incoming request frame.
557 *
558 * STATUS: OPTIONAL
559 */
560 struct fc_seq *(*seq_assign)(struct fc_lport *, struct fc_frame *);
561
562 /*
570 * Reset an exchange manager, completing all sequences and exchanges. 563 * Reset an exchange manager, completing all sequences and exchanges.
571 * If s_id is non-zero, reset only exchanges originating from that FID. 564 * If s_id is non-zero, reset only exchanges originating from that FID.
572 * If d_id is non-zero, reset only exchanges sending to that FID. 565 * If d_id is non-zero, reset only exchanges sending to that FID.
@@ -587,8 +580,7 @@ struct libfc_function_template {
587 * 580 *
588 * STATUS: OPTIONAL 581 * STATUS: OPTIONAL
589 */ 582 */
590 void (*lport_recv)(struct fc_lport *, struct fc_seq *, 583 void (*lport_recv)(struct fc_lport *, struct fc_frame *);
591 struct fc_frame *);
592 584
593 /* 585 /*
594 * Reset the local port. 586 * Reset the local port.
@@ -650,8 +642,7 @@ struct libfc_function_template {
650 * 642 *
651 * STATUS: OPTIONAL 643 * STATUS: OPTIONAL
652 */ 644 */
653 void (*rport_recv_req)(struct fc_seq *, struct fc_frame *, 645 void (*rport_recv_req)(struct fc_lport *, struct fc_frame *);
654 struct fc_lport *);
655 646
656 /* 647 /*
657 * lookup an rport by it's port ID. 648 * lookup an rport by it's port ID.
@@ -697,8 +688,7 @@ struct libfc_function_template {
697 * 688 *
698 * STATUS: OPTIONAL 689 * STATUS: OPTIONAL
699 */ 690 */
700 void (*disc_recv_req)(struct fc_seq *, struct fc_frame *, 691 void (*disc_recv_req)(struct fc_lport *, struct fc_frame *);
701 struct fc_lport *);
702 692
703 /* 693 /*
704 * Start discovery for a local port. 694 * Start discovery for a local port.
@@ -736,7 +726,7 @@ struct libfc_function_template {
736 * @buf_len: Length of the discovery buffer 726 * @buf_len: Length of the discovery buffer
737 * @disc_id: Discovery ID 727 * @disc_id: Discovery ID
738 * @rports: List of discovered remote ports 728 * @rports: List of discovered remote ports
739 * @lport: The local port that discovery is for 729 * @priv: Private pointer for use by discovery code
740 * @disc_mutex: Mutex that protects the discovery context 730 * @disc_mutex: Mutex that protects the discovery context
741 * @partial_buf: Partial name buffer (if names are returned 731 * @partial_buf: Partial name buffer (if names are returned
742 * in multiple frames) 732 * in multiple frames)
@@ -752,7 +742,7 @@ struct fc_disc {
752 u16 disc_id; 742 u16 disc_id;
753 743
754 struct list_head rports; 744 struct list_head rports;
755 struct fc_lport *lport; 745 void *priv;
756 struct mutex disc_mutex; 746 struct mutex disc_mutex;
757 struct fc_gpn_ft_resp partial_buf; 747 struct fc_gpn_ft_resp partial_buf;
758 struct delayed_work disc_work; 748 struct delayed_work disc_work;
@@ -796,6 +786,7 @@ struct fc_disc {
796 * @mfs: The maximum Fibre Channel payload size 786 * @mfs: The maximum Fibre Channel payload size
797 * @max_retry_count: The maximum retry attempts 787 * @max_retry_count: The maximum retry attempts
798 * @max_rport_retry_count: The maximum remote port retry attempts 788 * @max_rport_retry_count: The maximum remote port retry attempts
789 * @rport_priv_size: Size needed by driver after struct fc_rport_priv
799 * @lro_xid: The maximum XID for LRO 790 * @lro_xid: The maximum XID for LRO
800 * @lso_max: The maximum large offload send size 791 * @lso_max: The maximum large offload send size
801 * @fcts: FC-4 type mask 792 * @fcts: FC-4 type mask
@@ -842,9 +833,11 @@ struct fc_lport {
842 u32 lro_enabled:1; 833 u32 lro_enabled:1;
843 u32 does_npiv:1; 834 u32 does_npiv:1;
844 u32 npiv_enabled:1; 835 u32 npiv_enabled:1;
836 u32 point_to_multipoint:1;
845 u32 mfs; 837 u32 mfs;
846 u8 max_retry_count; 838 u8 max_retry_count;
847 u8 max_rport_retry_count; 839 u8 max_rport_retry_count;
840 u16 rport_priv_size;
848 u16 link_speed; 841 u16 link_speed;
849 u16 link_supported_speeds; 842 u16 link_supported_speeds;
850 u16 lro_xid; 843 u16 lro_xid;
@@ -986,6 +979,7 @@ int fc_set_mfs(struct fc_lport *, u32 mfs);
986struct fc_lport *libfc_vport_create(struct fc_vport *, int privsize); 979struct fc_lport *libfc_vport_create(struct fc_vport *, int privsize);
987struct fc_lport *fc_vport_id_lookup(struct fc_lport *, u32 port_id); 980struct fc_lport *fc_vport_id_lookup(struct fc_lport *, u32 port_id);
988int fc_lport_bsg_request(struct fc_bsg_job *); 981int fc_lport_bsg_request(struct fc_bsg_job *);
982void fc_lport_set_local_id(struct fc_lport *, u32 port_id);
989 983
990/* 984/*
991 * REMOTE PORT LAYER 985 * REMOTE PORT LAYER
@@ -998,6 +992,11 @@ void fc_rport_terminate_io(struct fc_rport *);
998 *****************************/ 992 *****************************/
999int fc_disc_init(struct fc_lport *); 993int fc_disc_init(struct fc_lport *);
1000 994
995static inline struct fc_lport *fc_disc_lport(struct fc_disc *disc)
996{
997 return container_of(disc, struct fc_lport, disc);
998}
999
1001/* 1000/*
1002 * FCP LAYER 1001 * FCP LAYER
1003 *****************************/ 1002 *****************************/
@@ -1029,6 +1028,10 @@ struct fc_seq *fc_elsct_send(struct fc_lport *, u32 did,
1029 void *arg, u32 timer_msec); 1028 void *arg, u32 timer_msec);
1030void fc_lport_flogi_resp(struct fc_seq *, struct fc_frame *, void *); 1029void fc_lport_flogi_resp(struct fc_seq *, struct fc_frame *, void *);
1031void fc_lport_logo_resp(struct fc_seq *, struct fc_frame *, void *); 1030void fc_lport_logo_resp(struct fc_seq *, struct fc_frame *, void *);
1031void fc_fill_reply_hdr(struct fc_frame *, const struct fc_frame *,
1032 enum fc_rctl, u32 parm_offset);
1033void fc_fill_hdr(struct fc_frame *, const struct fc_frame *,
1034 enum fc_rctl, u32 f_ctl, u16 seq_cnt, u32 parm_offset);
1032 1035
1033 1036
1034/* 1037/*
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index ec13f51531f8..06f1b5a8ed19 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -26,6 +26,7 @@
26#include <linux/netdevice.h> 26#include <linux/netdevice.h>
27#include <linux/skbuff.h> 27#include <linux/skbuff.h>
28#include <linux/workqueue.h> 28#include <linux/workqueue.h>
29#include <linux/random.h>
29#include <scsi/fc/fc_fcoe.h> 30#include <scsi/fc/fc_fcoe.h>
30#include <scsi/libfc.h> 31#include <scsi/libfc.h>
31 32
@@ -37,6 +38,7 @@
37#define FCOE_CTLR_START_DELAY 2000 /* mS after first adv. to choose FCF */ 38#define FCOE_CTLR_START_DELAY 2000 /* mS after first adv. to choose FCF */
38#define FCOE_CTRL_SOL_TOV 2000 /* min. solicitation interval (mS) */ 39#define FCOE_CTRL_SOL_TOV 2000 /* min. solicitation interval (mS) */
39#define FCOE_CTLR_FCF_LIMIT 20 /* max. number of FCF entries */ 40#define FCOE_CTLR_FCF_LIMIT 20 /* max. number of FCF entries */
41#define FCOE_CTLR_VN2VN_LOGIN_LIMIT 3 /* max. VN2VN rport login retries */
40 42
41/** 43/**
42 * enum fip_state - internal state of FCoE controller. 44 * enum fip_state - internal state of FCoE controller.
@@ -45,6 +47,11 @@
45 * @FIP_ST_AUTO: determining whether to use FIP or non-FIP mode. 47 * @FIP_ST_AUTO: determining whether to use FIP or non-FIP mode.
46 * @FIP_ST_NON_FIP: non-FIP mode selected. 48 * @FIP_ST_NON_FIP: non-FIP mode selected.
47 * @FIP_ST_ENABLED: FIP mode selected. 49 * @FIP_ST_ENABLED: FIP mode selected.
50 * @FIP_ST_VNMP_START: VN2VN multipath mode start, wait
51 * @FIP_ST_VNMP_PROBE1: VN2VN sent first probe, listening
52 * @FIP_ST_VNMP_PROBE2: VN2VN sent second probe, listening
53 * @FIP_ST_VNMP_CLAIM: VN2VN sent claim, waiting for responses
54 * @FIP_ST_VNMP_UP: VN2VN multipath mode operation
48 */ 55 */
49enum fip_state { 56enum fip_state {
50 FIP_ST_DISABLED, 57 FIP_ST_DISABLED,
@@ -52,8 +59,23 @@ enum fip_state {
52 FIP_ST_AUTO, 59 FIP_ST_AUTO,
53 FIP_ST_NON_FIP, 60 FIP_ST_NON_FIP,
54 FIP_ST_ENABLED, 61 FIP_ST_ENABLED,
62 FIP_ST_VNMP_START,
63 FIP_ST_VNMP_PROBE1,
64 FIP_ST_VNMP_PROBE2,
65 FIP_ST_VNMP_CLAIM,
66 FIP_ST_VNMP_UP,
55}; 67};
56 68
69/*
70 * Modes:
71 * The mode is the state that is to be entered after link up.
72 * It must not change after fcoe_ctlr_init() sets it.
73 */
74#define FIP_MODE_AUTO FIP_ST_AUTO
75#define FIP_MODE_NON_FIP FIP_ST_NON_FIP
76#define FIP_MODE_FABRIC FIP_ST_ENABLED
77#define FIP_MODE_VN2VN FIP_ST_VNMP_START
78
57/** 79/**
58 * struct fcoe_ctlr - FCoE Controller and FIP state 80 * struct fcoe_ctlr - FCoE Controller and FIP state
59 * @state: internal FIP state for network link and FIP or non-FIP mode. 81 * @state: internal FIP state for network link and FIP or non-FIP mode.
@@ -70,19 +92,20 @@ enum fip_state {
70 * @timer_work: &work_struct for doing keep-alives and resets. 92 * @timer_work: &work_struct for doing keep-alives and resets.
71 * @recv_work: &work_struct for receiving FIP frames. 93 * @recv_work: &work_struct for receiving FIP frames.
72 * @fip_recv_list: list of received FIP frames. 94 * @fip_recv_list: list of received FIP frames.
95 * @rnd_state: state for pseudo-random number generator.
96 * @port_id: proposed or selected local-port ID.
73 * @user_mfs: configured maximum FC frame size, including FC header. 97 * @user_mfs: configured maximum FC frame size, including FC header.
74 * @flogi_oxid: exchange ID of most recent fabric login. 98 * @flogi_oxid: exchange ID of most recent fabric login.
75 * @flogi_count: number of FLOGI attempts in AUTO mode. 99 * @flogi_count: number of FLOGI attempts in AUTO mode.
76 * @map_dest: use the FC_MAP mode for destination MAC addresses. 100 * @map_dest: use the FC_MAP mode for destination MAC addresses.
77 * @spma: supports SPMA server-provided MACs mode 101 * @spma: supports SPMA server-provided MACs mode
78 * @send_ctlr_ka: need to send controller keep alive 102 * @probe_tries: number of FC_IDs probed
79 * @send_port_ka: need to send port keep alives
80 * @dest_addr: MAC address of the selected FC forwarder. 103 * @dest_addr: MAC address of the selected FC forwarder.
81 * @ctl_src_addr: the native MAC address of our local port. 104 * @ctl_src_addr: the native MAC address of our local port.
82 * @send: LLD-supplied function to handle sending FIP Ethernet frames 105 * @send: LLD-supplied function to handle sending FIP Ethernet frames
83 * @update_mac: LLD-supplied function to handle changes to MAC addresses. 106 * @update_mac: LLD-supplied function to handle changes to MAC addresses.
84 * @get_src_addr: LLD-supplied function to supply a source MAC address. 107 * @get_src_addr: LLD-supplied function to supply a source MAC address.
85 * @lock: lock protecting this structure. 108 * @ctlr_mutex: lock protecting this structure.
86 * 109 *
87 * This structure is used by all FCoE drivers. It contains information 110 * This structure is used by all FCoE drivers. It contains information
88 * needed by all FCoE low-level drivers (LLDs) as well as internal state 111 * needed by all FCoE low-level drivers (LLDs) as well as internal state
@@ -103,21 +126,23 @@ struct fcoe_ctlr {
103 struct work_struct timer_work; 126 struct work_struct timer_work;
104 struct work_struct recv_work; 127 struct work_struct recv_work;
105 struct sk_buff_head fip_recv_list; 128 struct sk_buff_head fip_recv_list;
129
130 struct rnd_state rnd_state;
131 u32 port_id;
132
106 u16 user_mfs; 133 u16 user_mfs;
107 u16 flogi_oxid; 134 u16 flogi_oxid;
108 u8 flogi_count; 135 u8 flogi_count;
109 u8 reset_req;
110 u8 map_dest; 136 u8 map_dest;
111 u8 spma; 137 u8 spma;
112 u8 send_ctlr_ka; 138 u8 probe_tries;
113 u8 send_port_ka;
114 u8 dest_addr[ETH_ALEN]; 139 u8 dest_addr[ETH_ALEN];
115 u8 ctl_src_addr[ETH_ALEN]; 140 u8 ctl_src_addr[ETH_ALEN];
116 141
117 void (*send)(struct fcoe_ctlr *, struct sk_buff *); 142 void (*send)(struct fcoe_ctlr *, struct sk_buff *);
118 void (*update_mac)(struct fc_lport *, u8 *addr); 143 void (*update_mac)(struct fc_lport *, u8 *addr);
119 u8 * (*get_src_addr)(struct fc_lport *); 144 u8 * (*get_src_addr)(struct fc_lport *);
120 spinlock_t lock; 145 struct mutex ctlr_mutex;
121}; 146};
122 147
123/** 148/**
@@ -156,8 +181,26 @@ struct fcoe_fcf {
156 u8 fd_flags:1; 181 u8 fd_flags:1;
157}; 182};
158 183
184/**
185 * struct fcoe_rport - VN2VN remote port
186 * @time: time of create or last beacon packet received from node
187 * @fcoe_len: max FCoE frame size, not including VLAN or Ethernet headers
188 * @flags: flags from probe or claim
189 * @login_count: number of unsuccessful rport logins to this port
190 * @enode_mac: E_Node control MAC address
191 * @vn_mac: VN_Node assigned MAC address for data
192 */
193struct fcoe_rport {
194 unsigned long time;
195 u16 fcoe_len;
196 u16 flags;
197 u8 login_count;
198 u8 enode_mac[ETH_ALEN];
199 u8 vn_mac[ETH_ALEN];
200};
201
159/* FIP API functions */ 202/* FIP API functions */
160void fcoe_ctlr_init(struct fcoe_ctlr *); 203void fcoe_ctlr_init(struct fcoe_ctlr *, enum fip_state);
161void fcoe_ctlr_destroy(struct fcoe_ctlr *); 204void fcoe_ctlr_destroy(struct fcoe_ctlr *);
162void fcoe_ctlr_link_up(struct fcoe_ctlr *); 205void fcoe_ctlr_link_up(struct fcoe_ctlr *);
163int fcoe_ctlr_link_down(struct fcoe_ctlr *); 206int fcoe_ctlr_link_down(struct fcoe_ctlr *);
@@ -168,6 +211,17 @@ int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_lport *,
168 211
169/* libfcoe funcs */ 212/* libfcoe funcs */
170u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int); 213u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int);
171int fcoe_libfc_config(struct fc_lport *, struct libfc_function_template *); 214int fcoe_libfc_config(struct fc_lport *, struct fcoe_ctlr *,
215 const struct libfc_function_template *, int init_fcp);
216
217/**
218 * is_fip_mode() - returns true if FIP mode selected.
219 * @fip: FCoE controller.
220 */
221static inline bool is_fip_mode(struct fcoe_ctlr *fip)
222{
223 return fip->state == FIP_ST_ENABLED;
224}
225
172 226
173#endif /* _LIBFCOE_H */ 227#endif /* _LIBFCOE_H */
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index 3b586859669c..d06e13be717b 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -422,16 +422,7 @@ enum service_response {
422}; 422};
423 423
424enum exec_status { 424enum exec_status {
425 SAM_GOOD = 0, 425 /* The SAM_STAT_.. codes fit in the lower 6 bits */
426 SAM_CHECK_COND = 2,
427 SAM_COND_MET = 4,
428 SAM_BUSY = 8,
429 SAM_INTERMEDIATE = 0x10,
430 SAM_IM_COND_MET = 0x12,
431 SAM_RESV_CONFLICT= 0x14,
432 SAM_TASK_SET_FULL= 0x28,
433 SAM_ACA_ACTIVE = 0x30,
434 SAM_TASK_ABORTED = 0x40,
435 426
436 SAS_DEV_NO_RESPONSE = 0x80, 427 SAS_DEV_NO_RESPONSE = 0x80,
437 SAS_DATA_UNDERRUN, 428 SAS_DATA_UNDERRUN,
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index d80b6dbed1ca..50cb34ffef11 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -381,6 +381,14 @@ extern int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd,
381 struct scsi_sense_hdr *, int timeout, int retries, 381 struct scsi_sense_hdr *, int timeout, int retries,
382 int *resid); 382 int *resid);
383 383
384#ifdef CONFIG_PM_RUNTIME
385extern int scsi_autopm_get_device(struct scsi_device *);
386extern void scsi_autopm_put_device(struct scsi_device *);
387#else
388static inline int scsi_autopm_get_device(struct scsi_device *d) { return 0; }
389static inline void scsi_autopm_put_device(struct scsi_device *d) {}
390#endif /* CONFIG_PM_RUNTIME */
391
384static inline int __must_check scsi_device_reprobe(struct scsi_device *sdev) 392static inline int __must_check scsi_device_reprobe(struct scsi_device *sdev)
385{ 393{
386 return device_reprobe(&sdev->sdev_gendev); 394 return device_reprobe(&sdev->sdev_gendev);
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 349c7f30720d..7fff94b3b2a8 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -32,6 +32,7 @@ struct scsi_transport_template;
32struct iscsi_transport; 32struct iscsi_transport;
33struct iscsi_endpoint; 33struct iscsi_endpoint;
34struct Scsi_Host; 34struct Scsi_Host;
35struct scsi_cmnd;
35struct iscsi_cls_conn; 36struct iscsi_cls_conn;
36struct iscsi_conn; 37struct iscsi_conn;
37struct iscsi_task; 38struct iscsi_task;
@@ -255,5 +256,6 @@ extern int iscsi_scan_finished(struct Scsi_Host *shost, unsigned long time);
255extern struct iscsi_endpoint *iscsi_create_endpoint(int dd_size); 256extern struct iscsi_endpoint *iscsi_create_endpoint(int dd_size);
256extern void iscsi_destroy_endpoint(struct iscsi_endpoint *ep); 257extern void iscsi_destroy_endpoint(struct iscsi_endpoint *ep);
257extern struct iscsi_endpoint *iscsi_lookup_endpoint(u64 handle); 258extern struct iscsi_endpoint *iscsi_lookup_endpoint(u64 handle);
259extern int iscsi_block_scsi_eh(struct scsi_cmnd *cmd);
258 260
259#endif 261#endif