aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/fc/fc_fcp.h6
-rw-r--r--include/scsi/fc/fc_ns.h11
-rw-r--r--include/scsi/fc_encode.h26
-rw-r--r--include/scsi/iscsi_if.h3
-rw-r--r--include/scsi/libfc.h97
-rw-r--r--include/scsi/libfcoe.h113
-rw-r--r--include/scsi/libiscsi.h13
-rw-r--r--include/scsi/libiscsi_tcp.h3
-rw-r--r--include/scsi/libsas.h7
-rw-r--r--include/scsi/osd_initiator.h18
-rw-r--r--include/scsi/osd_protocol.h42
-rw-r--r--include/scsi/osd_types.h5
-rw-r--r--include/scsi/sas_ata.h22
-rw-r--r--include/scsi/scsi.h43
-rw-r--r--include/scsi/scsi_device.h6
-rw-r--r--include/scsi/scsi_host.h32
-rw-r--r--include/scsi/scsi_tcq.h7
-rw-r--r--include/scsi/scsi_transport_fc.h9
-rw-r--r--include/scsi/scsi_transport_iscsi.h6
-rw-r--r--include/scsi/srp.h38
20 files changed, 453 insertions, 54 deletions
diff --git a/include/scsi/fc/fc_fcp.h b/include/scsi/fc/fc_fcp.h
index 8e9b222251c2..652dec230514 100644
--- a/include/scsi/fc/fc_fcp.h
+++ b/include/scsi/fc/fc_fcp.h
@@ -46,7 +46,7 @@
46 */ 46 */
47struct fcp_cmnd { 47struct fcp_cmnd {
48 __u8 fc_lun[8]; /* logical unit number */ 48 __u8 fc_lun[8]; /* logical unit number */
49 __u8 fc_cmdref; /* commmand reference number */ 49 __u8 fc_cmdref; /* command reference number */
50 __u8 fc_pri_ta; /* priority and task attribute */ 50 __u8 fc_pri_ta; /* priority and task attribute */
51 __u8 fc_tm_flags; /* task management flags */ 51 __u8 fc_tm_flags; /* task management flags */
52 __u8 fc_flags; /* additional len & flags */ 52 __u8 fc_flags; /* additional len & flags */
@@ -58,7 +58,7 @@ struct fcp_cmnd {
58 58
59struct fcp_cmnd32 { 59struct fcp_cmnd32 {
60 __u8 fc_lun[8]; /* logical unit number */ 60 __u8 fc_lun[8]; /* logical unit number */
61 __u8 fc_cmdref; /* commmand reference number */ 61 __u8 fc_cmdref; /* command reference number */
62 __u8 fc_pri_ta; /* priority and task attribute */ 62 __u8 fc_pri_ta; /* priority and task attribute */
63 __u8 fc_tm_flags; /* task management flags */ 63 __u8 fc_tm_flags; /* task management flags */
64 __u8 fc_flags; /* additional len & flags */ 64 __u8 fc_flags; /* additional len & flags */
@@ -75,7 +75,7 @@ struct fcp_cmnd32 {
75#define FCP_PTA_SIMPLE 0 /* simple task attribute */ 75#define FCP_PTA_SIMPLE 0 /* simple task attribute */
76#define FCP_PTA_HEADQ 1 /* head of queue task attribute */ 76#define FCP_PTA_HEADQ 1 /* head of queue task attribute */
77#define FCP_PTA_ORDERED 2 /* ordered task attribute */ 77#define FCP_PTA_ORDERED 2 /* ordered task attribute */
78#define FCP_PTA_ACA 4 /* auto. contigent allegiance */ 78#define FCP_PTA_ACA 4 /* auto. contingent allegiance */
79#define FCP_PTA_MASK 7 /* mask for task attribute field */ 79#define FCP_PTA_MASK 7 /* mask for task attribute field */
80#define FCP_PRI_SHIFT 3 /* priority field starts in bit 3 */ 80#define FCP_PRI_SHIFT 3 /* priority field starts in bit 3 */
81#define FCP_PRI_RESVD_MASK 0x80 /* reserved bits in priority field */ 81#define FCP_PRI_RESVD_MASK 0x80 /* reserved bits in priority field */
diff --git a/include/scsi/fc/fc_ns.h b/include/scsi/fc/fc_ns.h
index 185015dd1166..f7751d53f1d3 100644
--- a/include/scsi/fc/fc_ns.h
+++ b/include/scsi/fc/fc_ns.h
@@ -41,6 +41,7 @@ enum fc_ns_req {
41 FC_NS_GI_A = 0x0101, /* get identifiers - scope */ 41 FC_NS_GI_A = 0x0101, /* get identifiers - scope */
42 FC_NS_GPN_ID = 0x0112, /* get port name by ID */ 42 FC_NS_GPN_ID = 0x0112, /* get port name by ID */
43 FC_NS_GNN_ID = 0x0113, /* get node name by ID */ 43 FC_NS_GNN_ID = 0x0113, /* get node name by ID */
44 FC_NS_GSPN_ID = 0x0118, /* get symbolic port name */
44 FC_NS_GID_PN = 0x0121, /* get ID for port name */ 45 FC_NS_GID_PN = 0x0121, /* get ID for port name */
45 FC_NS_GID_NN = 0x0131, /* get IDs for node name */ 46 FC_NS_GID_NN = 0x0131, /* get IDs for node name */
46 FC_NS_GID_FT = 0x0171, /* get IDs by FC4 type */ 47 FC_NS_GID_FT = 0x0171, /* get IDs by FC4 type */
@@ -144,7 +145,7 @@ struct fc_ns_gid_pn {
144}; 145};
145 146
146/* 147/*
147 * GID_PN response 148 * GID_PN response or GSPN_ID request
148 */ 149 */
149struct fc_gid_pn_resp { 150struct fc_gid_pn_resp {
150 __u8 fp_resvd; 151 __u8 fp_resvd;
@@ -152,6 +153,14 @@ struct fc_gid_pn_resp {
152}; 153};
153 154
154/* 155/*
156 * GSPN_ID response
157 */
158struct fc_gspn_resp {
159 __u8 fp_name_len;
160 char fp_name[];
161};
162
163/*
155 * RFT_ID request - register FC-4 types for ID. 164 * RFT_ID request - register FC-4 types for ID.
156 */ 165 */
157struct fc_ns_rft_id { 166struct fc_ns_rft_id {
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h
index 6d293c846a46..be418d8448a5 100644
--- a/include/scsi/fc_encode.h
+++ b/include/scsi/fc_encode.h
@@ -46,16 +46,11 @@ struct fc_ct_req {
46 } payload; 46 } payload;
47}; 47};
48 48
49/** 49static inline void __fc_fill_fc_hdr(struct fc_frame_header *fh,
50 * fill FC header fields in specified fc_frame 50 enum fc_rctl r_ctl,
51 */ 51 u32 did, u32 sid, enum fc_fh_type type,
52static inline void fc_fill_fc_hdr(struct fc_frame *fp, enum fc_rctl r_ctl, 52 u32 f_ctl, u32 parm_offset)
53 u32 did, u32 sid, enum fc_fh_type type,
54 u32 f_ctl, u32 parm_offset)
55{ 53{
56 struct fc_frame_header *fh;
57
58 fh = fc_frame_header_get(fp);
59 WARN_ON(r_ctl == 0); 54 WARN_ON(r_ctl == 0);
60 fh->fh_r_ctl = r_ctl; 55 fh->fh_r_ctl = r_ctl;
61 hton24(fh->fh_d_id, did); 56 hton24(fh->fh_d_id, did);
@@ -68,6 +63,19 @@ static inline void fc_fill_fc_hdr(struct fc_frame *fp, enum fc_rctl r_ctl,
68} 63}
69 64
70/** 65/**
66 * fill FC header fields in specified fc_frame
67 */
68static inline void fc_fill_fc_hdr(struct fc_frame *fp, enum fc_rctl r_ctl,
69 u32 did, u32 sid, enum fc_fh_type type,
70 u32 f_ctl, u32 parm_offset)
71{
72 struct fc_frame_header *fh;
73
74 fh = fc_frame_header_get(fp);
75 __fc_fill_fc_hdr(fh, r_ctl, did, sid, type, f_ctl, parm_offset);
76}
77
78/**
71 * fc_adisc_fill() - Fill in adisc request frame 79 * fc_adisc_fill() - Fill in adisc request frame
72 * @lport: local port. 80 * @lport: local port.
73 * @fp: fc frame where payload will be placed. 81 * @fp: fc frame where payload will be placed.
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index a8631acd37c3..ddb04568a509 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -263,6 +263,7 @@ enum iscsi_err {
263 ISCSI_ERR_INVALID_HOST = ISCSI_ERR_BASE + 18, 263 ISCSI_ERR_INVALID_HOST = ISCSI_ERR_BASE + 18,
264 ISCSI_ERR_XMIT_FAILED = ISCSI_ERR_BASE + 19, 264 ISCSI_ERR_XMIT_FAILED = ISCSI_ERR_BASE + 19,
265 ISCSI_ERR_TCP_CONN_CLOSE = ISCSI_ERR_BASE + 20, 265 ISCSI_ERR_TCP_CONN_CLOSE = ISCSI_ERR_BASE + 20,
266 ISCSI_ERR_SCSI_EH_SESSION_RST = ISCSI_ERR_BASE + 21,
266}; 267};
267 268
268/* 269/*
@@ -291,7 +292,7 @@ enum iscsi_param {
291 ISCSI_PARAM_PERSISTENT_PORT, 292 ISCSI_PARAM_PERSISTENT_PORT,
292 ISCSI_PARAM_SESS_RECOVERY_TMO, 293 ISCSI_PARAM_SESS_RECOVERY_TMO,
293 294
294 /* pased in through bind conn using transport_fd */ 295 /* passed in through bind conn using transport_fd */
295 ISCSI_PARAM_CONN_PORT, 296 ISCSI_PARAM_CONN_PORT,
296 ISCSI_PARAM_CONN_ADDRESS, 297 ISCSI_PARAM_CONN_ADDRESS,
297 298
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 14be49b44e84..a3cbda4ddb5c 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -35,6 +35,8 @@
35 35
36#include <scsi/fc_frame.h> 36#include <scsi/fc_frame.h>
37 37
38#define FC_FC4_PROV_SIZE (FC_TYPE_FCP + 1) /* size of tables */
39
38/* 40/*
39 * libfc error codes 41 * libfc error codes
40 */ 42 */
@@ -156,6 +158,7 @@ struct fc_rport_libfc_priv {
156 #define FC_RP_FLAGS_REC_SUPPORTED (1 << 0) 158 #define FC_RP_FLAGS_REC_SUPPORTED (1 << 0)
157 #define FC_RP_FLAGS_RETRY (1 << 1) 159 #define FC_RP_FLAGS_RETRY (1 << 1)
158 #define FC_RP_STARTED (1 << 2) 160 #define FC_RP_STARTED (1 << 2)
161 #define FC_RP_FLAGS_CONF_REQ (1 << 3)
159 unsigned int e_d_tov; 162 unsigned int e_d_tov;
160 unsigned int r_a_tov; 163 unsigned int r_a_tov;
161}; 164};
@@ -179,6 +182,7 @@ struct fc_rport_libfc_priv {
179 * @rp_mutex: The mutex that protects the remote port 182 * @rp_mutex: The mutex that protects the remote port
180 * @retry_work: Handle for retries 183 * @retry_work: Handle for retries
181 * @event_callback: Callback when READY, FAILED or LOGO states complete 184 * @event_callback: Callback when READY, FAILED or LOGO states complete
185 * @prli_count: Count of open PRLI sessions in providers
182 * @rcu: Structure used for freeing in an RCU-safe manner 186 * @rcu: Structure used for freeing in an RCU-safe manner
183 */ 187 */
184struct fc_rport_priv { 188struct fc_rport_priv {
@@ -202,7 +206,13 @@ struct fc_rport_priv {
202 struct list_head peers; 206 struct list_head peers;
203 struct work_struct event_work; 207 struct work_struct event_work;
204 u32 supported_classes; 208 u32 supported_classes;
209 u16 prli_count;
205 struct rcu_head rcu; 210 struct rcu_head rcu;
211 u16 sp_features;
212 u8 spp_type;
213 void (*lld_event_callback)(struct fc_lport *,
214 struct fc_rport_priv *,
215 enum fc_rport_event);
206}; 216};
207 217
208/** 218/**
@@ -221,8 +231,8 @@ struct fc_rport_priv {
221 * @InputRequests: Number of input requests 231 * @InputRequests: Number of input requests
222 * @OutputRequests: Number of output requests 232 * @OutputRequests: Number of output requests
223 * @ControlRequests: Number of control requests 233 * @ControlRequests: Number of control requests
224 * @InputMegabytes: Number of received megabytes 234 * @InputBytes: Number of received bytes
225 * @OutputMegabytes: Number of transmitted megabytes 235 * @OutputBytes: Number of transmitted bytes
226 * @VLinkFailureCount: Number of virtual link failures 236 * @VLinkFailureCount: Number of virtual link failures
227 * @MissDiscAdvCount: Number of missing FIP discovery advertisement 237 * @MissDiscAdvCount: Number of missing FIP discovery advertisement
228 */ 238 */
@@ -241,8 +251,8 @@ struct fcoe_dev_stats {
241 u64 InputRequests; 251 u64 InputRequests;
242 u64 OutputRequests; 252 u64 OutputRequests;
243 u64 ControlRequests; 253 u64 ControlRequests;
244 u64 InputMegabytes; 254 u64 InputBytes;
245 u64 OutputMegabytes; 255 u64 OutputBytes;
246 u64 VLinkFailureCount; 256 u64 VLinkFailureCount;
247 u64 MissDiscAdvCount; 257 u64 MissDiscAdvCount;
248}; 258};
@@ -250,7 +260,7 @@ struct fcoe_dev_stats {
250/** 260/**
251 * struct fc_seq_els_data - ELS data used for passing ELS specific responses 261 * struct fc_seq_els_data - ELS data used for passing ELS specific responses
252 * @reason: The reason for rejection 262 * @reason: The reason for rejection
253 * @explan: The explaination of the rejection 263 * @explan: The explanation of the rejection
254 * 264 *
255 * Mainly used by the exchange manager layer. 265 * Mainly used by the exchange manager layer.
256 */ 266 */
@@ -263,7 +273,6 @@ struct fc_seq_els_data {
263 * struct fc_fcp_pkt - FCP request structure (one for each scsi_cmnd request) 273 * struct fc_fcp_pkt - FCP request structure (one for each scsi_cmnd request)
264 * @lp: The associated local port 274 * @lp: The associated local port
265 * @state: The state of the I/O 275 * @state: The state of the I/O
266 * @tgt_flags: Target's flags
267 * @ref_cnt: Reference count 276 * @ref_cnt: Reference count
268 * @scsi_pkt_lock: Lock to protect the SCSI packet (must be taken before the 277 * @scsi_pkt_lock: Lock to protect the SCSI packet (must be taken before the
269 * host_lock if both are to be held at the same time) 278 * host_lock if both are to be held at the same time)
@@ -298,7 +307,6 @@ struct fc_fcp_pkt {
298 /* Housekeeping information */ 307 /* Housekeeping information */
299 struct fc_lport *lp; 308 struct fc_lport *lp;
300 u16 state; 309 u16 state;
301 u16 tgt_flags;
302 atomic_t ref_cnt; 310 atomic_t ref_cnt;
303 spinlock_t scsi_pkt_lock; 311 spinlock_t scsi_pkt_lock;
304 312
@@ -517,7 +525,7 @@ struct libfc_function_template {
517 struct fc_frame *); 525 struct fc_frame *);
518 526
519 /* 527 /*
520 * Send an ELS response using infomation from the received frame. 528 * Send an ELS response using information from the received frame.
521 * 529 *
522 * STATUS: OPTIONAL 530 * STATUS: OPTIONAL
523 */ 531 */
@@ -553,6 +561,16 @@ struct libfc_function_template {
553 struct fc_seq *(*seq_start_next)(struct fc_seq *); 561 struct fc_seq *(*seq_start_next)(struct fc_seq *);
554 562
555 /* 563 /*
564 * Set a response handler for the exchange of the sequence.
565 *
566 * STATUS: OPTIONAL
567 */
568 void (*seq_set_resp)(struct fc_seq *sp,
569 void (*resp)(struct fc_seq *, struct fc_frame *,
570 void *),
571 void *arg);
572
573 /*
556 * Assign a sequence for an incoming request frame. 574 * Assign a sequence for an incoming request frame.
557 * 575 *
558 * STATUS: OPTIONAL 576 * STATUS: OPTIONAL
@@ -560,6 +578,13 @@ struct libfc_function_template {
560 struct fc_seq *(*seq_assign)(struct fc_lport *, struct fc_frame *); 578 struct fc_seq *(*seq_assign)(struct fc_lport *, struct fc_frame *);
561 579
562 /* 580 /*
581 * Release the reference on the sequence returned by seq_assign().
582 *
583 * STATUS: OPTIONAL
584 */
585 void (*seq_release)(struct fc_seq *);
586
587 /*
563 * Reset an exchange manager, completing all sequences and exchanges. 588 * Reset an exchange manager, completing all sequences and exchanges.
564 * If s_id is non-zero, reset only exchanges originating from that FID. 589 * If s_id is non-zero, reset only exchanges originating from that FID.
565 * If d_id is non-zero, reset only exchanges sending to that FID. 590 * If d_id is non-zero, reset only exchanges sending to that FID.
@@ -638,7 +663,7 @@ struct libfc_function_template {
638 int (*rport_logoff)(struct fc_rport_priv *); 663 int (*rport_logoff)(struct fc_rport_priv *);
639 664
640 /* 665 /*
641 * Recieve a request from a remote port. 666 * Receive a request from a remote port.
642 * 667 *
643 * STATUS: OPTIONAL 668 * STATUS: OPTIONAL
644 */ 669 */
@@ -658,6 +683,15 @@ struct libfc_function_template {
658 void (*rport_destroy)(struct kref *); 683 void (*rport_destroy)(struct kref *);
659 684
660 /* 685 /*
686 * Callback routine after the remote port is logged in
687 *
688 * STATUS: OPTIONAL
689 */
690 void (*rport_event_callback)(struct fc_lport *,
691 struct fc_rport_priv *,
692 enum fc_rport_event);
693
694 /*
661 * Send a fcp cmd from fsp pkt. 695 * Send a fcp cmd from fsp pkt.
662 * Called with the SCSI host lock unlocked and irqs disabled. 696 * Called with the SCSI host lock unlocked and irqs disabled.
663 * 697 *
@@ -670,7 +704,7 @@ struct libfc_function_template {
670 void *)); 704 void *));
671 705
672 /* 706 /*
673 * Cleanup the FCP layer, used durring link down and reset 707 * Cleanup the FCP layer, used during link down and reset
674 * 708 *
675 * STATUS: OPTIONAL 709 * STATUS: OPTIONAL
676 */ 710 */
@@ -721,7 +755,7 @@ struct libfc_function_template {
721 * struct fc_disc - Discovery context 755 * struct fc_disc - Discovery context
722 * @retry_count: Number of retries 756 * @retry_count: Number of retries
723 * @pending: 1 if discovery is pending, 0 if not 757 * @pending: 1 if discovery is pending, 0 if not
724 * @requesting: 1 if discovery has been requested, 0 if not 758 * @requested: 1 if discovery has been requested, 0 if not
725 * @seq_count: Number of sequences used for discovery 759 * @seq_count: Number of sequences used for discovery
726 * @buf_len: Length of the discovery buffer 760 * @buf_len: Length of the discovery buffer
727 * @disc_id: Discovery ID 761 * @disc_id: Discovery ID
@@ -751,6 +785,15 @@ struct fc_disc {
751 enum fc_disc_event); 785 enum fc_disc_event);
752}; 786};
753 787
788/*
789 * Local port notifier and events.
790 */
791extern struct blocking_notifier_head fc_lport_notifier_head;
792enum fc_lport_event {
793 FC_LPORT_EV_ADD,
794 FC_LPORT_EV_DEL,
795};
796
754/** 797/**
755 * struct fc_lport - Local port 798 * struct fc_lport - Local port
756 * @host: The SCSI host associated with a local port 799 * @host: The SCSI host associated with a local port
@@ -791,8 +834,10 @@ struct fc_disc {
791 * @lso_max: The maximum large offload send size 834 * @lso_max: The maximum large offload send size
792 * @fcts: FC-4 type mask 835 * @fcts: FC-4 type mask
793 * @lp_mutex: Mutex to protect the local port 836 * @lp_mutex: Mutex to protect the local port
794 * @list: Handle for list of local ports 837 * @list: Linkage on list of vport peers
795 * @retry_work: Handle to local port for delayed retry context 838 * @retry_work: Handle to local port for delayed retry context
839 * @prov: Pointers available for use by passive FC-4 providers
840 * @lport_list: Linkage on module-wide list of local ports
796 */ 841 */
797struct fc_lport { 842struct fc_lport {
798 /* Associations */ 843 /* Associations */
@@ -848,8 +893,32 @@ struct fc_lport {
848 struct mutex lp_mutex; 893 struct mutex lp_mutex;
849 struct list_head list; 894 struct list_head list;
850 struct delayed_work retry_work; 895 struct delayed_work retry_work;
896 void *prov[FC_FC4_PROV_SIZE];
897 struct list_head lport_list;
851}; 898};
852 899
900/**
901 * struct fc4_prov - FC-4 provider registration
902 * @prli: Handler for incoming PRLI
903 * @prlo: Handler for session reset
904 * @recv: Handler for incoming request
905 * @module: Pointer to module. May be NULL.
906 */
907struct fc4_prov {
908 int (*prli)(struct fc_rport_priv *, u32 spp_len,
909 const struct fc_els_spp *spp_in,
910 struct fc_els_spp *spp_out);
911 void (*prlo)(struct fc_rport_priv *);
912 void (*recv)(struct fc_lport *, struct fc_frame *);
913 struct module *module;
914};
915
916/*
917 * Register FC-4 provider with libfc.
918 */
919int fc_fc4_register_provider(enum fc_fh_type type, struct fc4_prov *);
920void fc_fc4_deregister_provider(enum fc_fh_type type, struct fc4_prov *);
921
853/* 922/*
854 * FC_LPORT HELPER FUNCTIONS 923 * FC_LPORT HELPER FUNCTIONS
855 *****************************/ 924 *****************************/
@@ -980,6 +1049,7 @@ struct fc_lport *libfc_vport_create(struct fc_vport *, int privsize);
980struct fc_lport *fc_vport_id_lookup(struct fc_lport *, u32 port_id); 1049struct fc_lport *fc_vport_id_lookup(struct fc_lport *, u32 port_id);
981int fc_lport_bsg_request(struct fc_bsg_job *); 1050int fc_lport_bsg_request(struct fc_bsg_job *);
982void fc_lport_set_local_id(struct fc_lport *, u32 port_id); 1051void fc_lport_set_local_id(struct fc_lport *, u32 port_id);
1052void fc_lport_iterate(void (*func)(struct fc_lport *, void *), void *);
983 1053
984/* 1054/*
985 * REMOTE PORT LAYER 1055 * REMOTE PORT LAYER
@@ -1006,8 +1076,7 @@ void fc_fcp_destroy(struct fc_lport *);
1006/* 1076/*
1007 * SCSI INTERACTION LAYER 1077 * SCSI INTERACTION LAYER
1008 *****************************/ 1078 *****************************/
1009int fc_queuecommand(struct scsi_cmnd *, 1079int fc_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
1010 void (*done)(struct scsi_cmnd *));
1011int fc_eh_abort(struct scsi_cmnd *); 1080int fc_eh_abort(struct scsi_cmnd *);
1012int fc_eh_device_reset(struct scsi_cmnd *); 1081int fc_eh_device_reset(struct scsi_cmnd *);
1013int fc_eh_host_reset(struct scsi_cmnd *); 1082int fc_eh_host_reset(struct scsi_cmnd *);
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index 06f1b5a8ed19..8c1638b8c28e 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -33,6 +33,12 @@
33#define FCOE_MAX_CMD_LEN 16 /* Supported CDB length */ 33#define FCOE_MAX_CMD_LEN 16 /* Supported CDB length */
34 34
35/* 35/*
36 * Max MTU for FCoE: 14 (FCoE header) + 24 (FC header) + 2112 (max FC payload)
37 * + 4 (FC CRC) + 4 (FCoE trailer) = 2158 bytes
38 */
39#define FCOE_MTU 2158
40
41/*
36 * FIP tunable parameters. 42 * FIP tunable parameters.
37 */ 43 */
38#define FCOE_CTLR_START_DELAY 2000 /* mS after first adv. to choose FCF */ 44#define FCOE_CTLR_START_DELAY 2000 /* mS after first adv. to choose FCF */
@@ -92,10 +98,12 @@ enum fip_state {
92 * @timer_work: &work_struct for doing keep-alives and resets. 98 * @timer_work: &work_struct for doing keep-alives and resets.
93 * @recv_work: &work_struct for receiving FIP frames. 99 * @recv_work: &work_struct for receiving FIP frames.
94 * @fip_recv_list: list of received FIP frames. 100 * @fip_recv_list: list of received FIP frames.
101 * @flogi_req: clone of FLOGI request sent
95 * @rnd_state: state for pseudo-random number generator. 102 * @rnd_state: state for pseudo-random number generator.
96 * @port_id: proposed or selected local-port ID. 103 * @port_id: proposed or selected local-port ID.
97 * @user_mfs: configured maximum FC frame size, including FC header. 104 * @user_mfs: configured maximum FC frame size, including FC header.
98 * @flogi_oxid: exchange ID of most recent fabric login. 105 * @flogi_oxid: exchange ID of most recent fabric login.
106 * @flogi_req_send: send of FLOGI requested
99 * @flogi_count: number of FLOGI attempts in AUTO mode. 107 * @flogi_count: number of FLOGI attempts in AUTO mode.
100 * @map_dest: use the FC_MAP mode for destination MAC addresses. 108 * @map_dest: use the FC_MAP mode for destination MAC addresses.
101 * @spma: supports SPMA server-provided MACs mode 109 * @spma: supports SPMA server-provided MACs mode
@@ -106,6 +114,7 @@ enum fip_state {
106 * @update_mac: LLD-supplied function to handle changes to MAC addresses. 114 * @update_mac: LLD-supplied function to handle changes to MAC addresses.
107 * @get_src_addr: LLD-supplied function to supply a source MAC address. 115 * @get_src_addr: LLD-supplied function to supply a source MAC address.
108 * @ctlr_mutex: lock protecting this structure. 116 * @ctlr_mutex: lock protecting this structure.
117 * @ctlr_lock: spinlock covering flogi_req
109 * 118 *
110 * This structure is used by all FCoE drivers. It contains information 119 * This structure is used by all FCoE drivers. It contains information
111 * needed by all FCoE low-level drivers (LLDs) as well as internal state 120 * needed by all FCoE low-level drivers (LLDs) as well as internal state
@@ -126,12 +135,14 @@ struct fcoe_ctlr {
126 struct work_struct timer_work; 135 struct work_struct timer_work;
127 struct work_struct recv_work; 136 struct work_struct recv_work;
128 struct sk_buff_head fip_recv_list; 137 struct sk_buff_head fip_recv_list;
138 struct sk_buff *flogi_req;
129 139
130 struct rnd_state rnd_state; 140 struct rnd_state rnd_state;
131 u32 port_id; 141 u32 port_id;
132 142
133 u16 user_mfs; 143 u16 user_mfs;
134 u16 flogi_oxid; 144 u16 flogi_oxid;
145 u8 flogi_req_send;
135 u8 flogi_count; 146 u8 flogi_count;
136 u8 map_dest; 147 u8 map_dest;
137 u8 spma; 148 u8 spma;
@@ -143,6 +154,7 @@ struct fcoe_ctlr {
143 void (*update_mac)(struct fc_lport *, u8 *addr); 154 void (*update_mac)(struct fc_lport *, u8 *addr);
144 u8 * (*get_src_addr)(struct fc_lport *); 155 u8 * (*get_src_addr)(struct fc_lport *);
145 struct mutex ctlr_mutex; 156 struct mutex ctlr_mutex;
157 spinlock_t ctlr_lock;
146}; 158};
147 159
148/** 160/**
@@ -155,6 +167,7 @@ struct fcoe_ctlr {
155 * @fcf_mac: Ethernet address of the FCF 167 * @fcf_mac: Ethernet address of the FCF
156 * @vfid: virtual fabric ID 168 * @vfid: virtual fabric ID
157 * @pri: selection priority, smaller values are better 169 * @pri: selection priority, smaller values are better
170 * @flogi_sent: current FLOGI sent to this FCF
158 * @flags: flags received from advertisement 171 * @flags: flags received from advertisement
159 * @fka_period: keep-alive period, in jiffies 172 * @fka_period: keep-alive period, in jiffies
160 * 173 *
@@ -176,6 +189,7 @@ struct fcoe_fcf {
176 u8 fcf_mac[ETH_ALEN]; 189 u8 fcf_mac[ETH_ALEN];
177 190
178 u8 pri; 191 u8 pri;
192 u8 flogi_sent;
179 u16 flags; 193 u16 flags;
180 u32 fka_period; 194 u32 fka_period;
181 u8 fd_flags:1; 195 u8 fd_flags:1;
@@ -213,6 +227,8 @@ int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_lport *,
213u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int); 227u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int);
214int fcoe_libfc_config(struct fc_lport *, struct fcoe_ctlr *, 228int fcoe_libfc_config(struct fc_lport *, struct fcoe_ctlr *,
215 const struct libfc_function_template *, int init_fcp); 229 const struct libfc_function_template *, int init_fcp);
230u32 fcoe_fc_crc(struct fc_frame *fp);
231int fcoe_start_io(struct sk_buff *skb);
216 232
217/** 233/**
218 * is_fip_mode() - returns true if FIP mode selected. 234 * is_fip_mode() - returns true if FIP mode selected.
@@ -223,5 +239,102 @@ static inline bool is_fip_mode(struct fcoe_ctlr *fip)
223 return fip->state == FIP_ST_ENABLED; 239 return fip->state == FIP_ST_ENABLED;
224} 240}
225 241
242/* helper for FCoE SW HBA drivers, can include subven and subdev if needed. The
243 * modpost would use pci_device_id table to auto-generate formatted module alias
244 * into the corresponding .mod.c file, but there may or may not be a pci device
245 * id table for FCoE drivers so we use the following helper for build the fcoe
246 * driver module alias.
247 */
248#define MODULE_ALIAS_FCOE_PCI(ven, dev) \
249 MODULE_ALIAS("fcoe-pci:" \
250 "v" __stringify(ven) \
251 "d" __stringify(dev) "sv*sd*bc*sc*i*")
252
253/* the name of the default FCoE transport driver fcoe.ko */
254#define FCOE_TRANSPORT_DEFAULT "fcoe"
255
256/* struct fcoe_transport - The FCoE transport interface
257 * @name: a vendor specific name for their FCoE transport driver
258 * @attached: whether this transport is already attached
259 * @list: list linkage to all attached transports
260 * @match: handler to allow the transport driver to match up a given netdev
261 * @create: handler to sysfs entry of create for FCoE instances
262 * @destroy: handler to sysfs entry of destroy for FCoE instances
263 * @enable: handler to sysfs entry of enable for FCoE instances
264 * @disable: handler to sysfs entry of disable for FCoE instances
265 */
266struct fcoe_transport {
267 char name[IFNAMSIZ];
268 bool attached;
269 struct list_head list;
270 bool (*match) (struct net_device *device);
271 int (*create) (struct net_device *device, enum fip_state fip_mode);
272 int (*destroy) (struct net_device *device);
273 int (*enable) (struct net_device *device);
274 int (*disable) (struct net_device *device);
275};
276
277/**
278 * struct fcoe_percpu_s - The context for FCoE receive thread(s)
279 * @thread: The thread context
280 * @fcoe_rx_list: The queue of pending packets to process
281 * @page: The memory page for calculating frame trailer CRCs
282 * @crc_eof_offset: The offset into the CRC page pointing to available
283 * memory for a new trailer
284 */
285struct fcoe_percpu_s {
286 struct task_struct *thread;
287 struct sk_buff_head fcoe_rx_list;
288 struct page *crc_eof_page;
289 int crc_eof_offset;
290};
291
292/**
293 * struct fcoe_port - The FCoE private structure
294 * @priv: The associated fcoe interface. The structure is
295 * defined by the low level driver
296 * @lport: The associated local port
297 * @fcoe_pending_queue: The pending Rx queue of skbs
298 * @fcoe_pending_queue_active: Indicates if the pending queue is active
299 * @max_queue_depth: Max queue depth of pending queue
300 * @min_queue_depth: Min queue depth of pending queue
301 * @timer: The queue timer
302 * @destroy_work: Handle for work context
303 * (to prevent RTNL deadlocks)
304 * @data_srt_addr: Source address for data
305 *
306 * An instance of this structure is to be allocated along with the
307 * Scsi_Host and libfc fc_lport structures.
308 */
309struct fcoe_port {
310 void *priv;
311 struct fc_lport *lport;
312 struct sk_buff_head fcoe_pending_queue;
313 u8 fcoe_pending_queue_active;
314 u32 max_queue_depth;
315 u32 min_queue_depth;
316 struct timer_list timer;
317 struct work_struct destroy_work;
318 u8 data_src_addr[ETH_ALEN];
319};
320void fcoe_clean_pending_queue(struct fc_lport *);
321void fcoe_check_wait_queue(struct fc_lport *lport, struct sk_buff *skb);
322void fcoe_queue_timer(ulong lport);
323int fcoe_get_paged_crc_eof(struct sk_buff *skb, int tlen,
324 struct fcoe_percpu_s *fps);
325
326/**
327 * struct netdev_list
328 * A mapping from netdevice to fcoe_transport
329 */
330struct fcoe_netdev_mapping {
331 struct list_head list;
332 struct net_device *netdev;
333 struct fcoe_transport *ft;
334};
335
336/* fcoe transports registration and deregistration */
337int fcoe_transport_attach(struct fcoe_transport *ft);
338int fcoe_transport_detach(struct fcoe_transport *ft);
226 339
227#endif /* _LIBFCOE_H */ 340#endif /* _LIBFCOE_H */
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index ae5196aae1a5..0f4367751b71 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -89,6 +89,7 @@ enum {
89 ISCSI_TASK_RUNNING, 89 ISCSI_TASK_RUNNING,
90 ISCSI_TASK_ABRT_TMF, /* aborted due to TMF */ 90 ISCSI_TASK_ABRT_TMF, /* aborted due to TMF */
91 ISCSI_TASK_ABRT_SESS_RECOV, /* aborted due to session recovery */ 91 ISCSI_TASK_ABRT_SESS_RECOV, /* aborted due to session recovery */
92 ISCSI_TASK_REQUEUE_SCSIQ, /* qcmd requeueing to scsi-ml */
92}; 93};
93 94
94struct iscsi_r2t_info { 95struct iscsi_r2t_info {
@@ -211,9 +212,6 @@ struct iscsi_conn {
211 /* values userspace uses to id a conn */ 212 /* values userspace uses to id a conn */
212 int persistent_port; 213 int persistent_port;
213 char *persistent_address; 214 char *persistent_address;
214 /* remote portal currently connected to */
215 int portal_port;
216 char portal_address[ISCSI_ADDRESS_BUF_LEN];
217 215
218 /* MIB-statistics */ 216 /* MIB-statistics */
219 uint64_t txdata_octets; 217 uint64_t txdata_octets;
@@ -318,9 +316,6 @@ struct iscsi_host {
318 /* hw address or netdev iscsi connection is bound to */ 316 /* hw address or netdev iscsi connection is bound to */
319 char *hwaddress; 317 char *hwaddress;
320 char *netdev; 318 char *netdev;
321 /* local address */
322 int local_port;
323 char local_address[ISCSI_ADDRESS_BUF_LEN];
324 319
325 wait_queue_head_t session_removal_wq; 320 wait_queue_head_t session_removal_wq;
326 /* protects sessions and state */ 321 /* protects sessions and state */
@@ -341,8 +336,7 @@ extern int iscsi_eh_abort(struct scsi_cmnd *sc);
341extern int iscsi_eh_recover_target(struct scsi_cmnd *sc); 336extern int iscsi_eh_recover_target(struct scsi_cmnd *sc);
342extern int iscsi_eh_session_reset(struct scsi_cmnd *sc); 337extern int iscsi_eh_session_reset(struct scsi_cmnd *sc);
343extern int iscsi_eh_device_reset(struct scsi_cmnd *sc); 338extern int iscsi_eh_device_reset(struct scsi_cmnd *sc);
344extern int iscsi_queuecommand(struct scsi_cmnd *sc, 339extern int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc);
345 void (*done)(struct scsi_cmnd *));
346 340
347/* 341/*
348 * iSCSI host helpers. 342 * iSCSI host helpers.
@@ -394,6 +388,8 @@ extern void iscsi_session_failure(struct iscsi_session *session,
394 enum iscsi_err err); 388 enum iscsi_err err);
395extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, 389extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn,
396 enum iscsi_param param, char *buf); 390 enum iscsi_param param, char *buf);
391extern int iscsi_conn_get_addr_param(struct sockaddr_storage *addr,
392 enum iscsi_param param, char *buf);
397extern void iscsi_suspend_tx(struct iscsi_conn *conn); 393extern void iscsi_suspend_tx(struct iscsi_conn *conn);
398extern void iscsi_suspend_queue(struct iscsi_conn *conn); 394extern void iscsi_suspend_queue(struct iscsi_conn *conn);
399extern void iscsi_conn_queue_work(struct iscsi_conn *conn); 395extern void iscsi_conn_queue_work(struct iscsi_conn *conn);
@@ -420,6 +416,7 @@ extern struct iscsi_task *iscsi_itt_to_ctask(struct iscsi_conn *, itt_t);
420extern struct iscsi_task *iscsi_itt_to_task(struct iscsi_conn *, itt_t); 416extern struct iscsi_task *iscsi_itt_to_task(struct iscsi_conn *, itt_t);
421extern void iscsi_requeue_task(struct iscsi_task *task); 417extern void iscsi_requeue_task(struct iscsi_task *task);
422extern void iscsi_put_task(struct iscsi_task *task); 418extern void iscsi_put_task(struct iscsi_task *task);
419extern void __iscsi_put_task(struct iscsi_task *task);
423extern void __iscsi_get_task(struct iscsi_task *task); 420extern void __iscsi_get_task(struct iscsi_task *task);
424extern void iscsi_complete_scsi_task(struct iscsi_task *task, 421extern void iscsi_complete_scsi_task(struct iscsi_task *task,
425 uint32_t exp_cmdsn, uint32_t max_cmdsn); 422 uint32_t exp_cmdsn, uint32_t max_cmdsn);
diff --git a/include/scsi/libiscsi_tcp.h b/include/scsi/libiscsi_tcp.h
index 741ae7ed4394..ac0cc1d925ef 100644
--- a/include/scsi/libiscsi_tcp.h
+++ b/include/scsi/libiscsi_tcp.h
@@ -47,11 +47,12 @@ struct iscsi_segment {
47 struct scatterlist *sg; 47 struct scatterlist *sg;
48 void *sg_mapped; 48 void *sg_mapped;
49 unsigned int sg_offset; 49 unsigned int sg_offset;
50 bool atomic_mapped;
50 51
51 iscsi_segment_done_fn_t *done; 52 iscsi_segment_done_fn_t *done;
52}; 53};
53 54
54/* Socket connection recieve helper */ 55/* Socket connection receive helper */
55struct iscsi_tcp_recv { 56struct iscsi_tcp_recv {
56 struct iscsi_hdr *hdr; 57 struct iscsi_hdr *hdr;
57 struct iscsi_segment segment; 58 struct iscsi_segment segment;
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index d06e13be717b..ee866060f8a4 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -205,6 +205,7 @@ struct domain_device {
205 }; 205 };
206 206
207 void *lldd_dev; 207 void *lldd_dev;
208 int gone;
208}; 209};
209 210
210struct sas_discovery_event { 211struct sas_discovery_event {
@@ -360,6 +361,8 @@ struct sas_ha_struct {
360 /* The class calls this to send a task for execution. */ 361 /* The class calls this to send a task for execution. */
361 int lldd_max_execute_num; 362 int lldd_max_execute_num;
362 int lldd_queue_size; 363 int lldd_queue_size;
364 int strict_wide_ports; /* both sas_addr and attached_sas_addr must match
365 * their siblings when forming wide ports */
363 366
364 /* LLDD calls these to notify the class of an event. */ 367 /* LLDD calls these to notify the class of an event. */
365 void (*notify_ha_event)(struct sas_ha_struct *, enum ha_event); 368 void (*notify_ha_event)(struct sas_ha_struct *, enum ha_event);
@@ -601,6 +604,7 @@ struct sas_domain_function_template {
601 int (*lldd_clear_aca)(struct domain_device *, u8 *lun); 604 int (*lldd_clear_aca)(struct domain_device *, u8 *lun);
602 int (*lldd_clear_task_set)(struct domain_device *, u8 *lun); 605 int (*lldd_clear_task_set)(struct domain_device *, u8 *lun);
603 int (*lldd_I_T_nexus_reset)(struct domain_device *); 606 int (*lldd_I_T_nexus_reset)(struct domain_device *);
607 int (*lldd_ata_soft_reset)(struct domain_device *);
604 int (*lldd_lu_reset)(struct domain_device *, u8 *lun); 608 int (*lldd_lu_reset)(struct domain_device *, u8 *lun);
605 int (*lldd_query_task)(struct sas_task *); 609 int (*lldd_query_task)(struct sas_task *);
606 610
@@ -620,8 +624,7 @@ int sas_set_phy_speed(struct sas_phy *phy,
620int sas_phy_enable(struct sas_phy *phy, int enabled); 624int sas_phy_enable(struct sas_phy *phy, int enabled);
621int sas_phy_reset(struct sas_phy *phy, int hard_reset); 625int sas_phy_reset(struct sas_phy *phy, int hard_reset);
622int sas_queue_up(struct sas_task *task); 626int sas_queue_up(struct sas_task *task);
623extern int sas_queuecommand(struct scsi_cmnd *, 627extern int sas_queuecommand(struct Scsi_Host * ,struct scsi_cmnd *);
624 void (*scsi_done)(struct scsi_cmnd *));
625extern int sas_target_alloc(struct scsi_target *); 628extern int sas_target_alloc(struct scsi_target *);
626extern int sas_slave_alloc(struct scsi_device *); 629extern int sas_slave_alloc(struct scsi_device *);
627extern int sas_slave_configure(struct scsi_device *); 630extern int sas_slave_configure(struct scsi_device *);
diff --git a/include/scsi/osd_initiator.h b/include/scsi/osd_initiator.h
index a8f370126632..0a5079974fe9 100644
--- a/include/scsi/osd_initiator.h
+++ b/include/scsi/osd_initiator.h
@@ -137,7 +137,7 @@ struct osd_request {
137 void *buff; 137 void *buff;
138 unsigned alloc_size; /* 0 here means: don't call kfree */ 138 unsigned alloc_size; /* 0 here means: don't call kfree */
139 unsigned total_bytes; 139 unsigned total_bytes;
140 } set_attr, enc_get_attr, get_attr; 140 } cdb_cont, set_attr, enc_get_attr, get_attr;
141 141
142 struct _osd_io_info { 142 struct _osd_io_info {
143 struct bio *bio; 143 struct bio *bio;
@@ -265,7 +265,7 @@ int osd_execute_request_async(struct osd_request *or,
265 * @osi - Recievs a more detailed error report information (optional). 265 * @osi - Recievs a more detailed error report information (optional).
266 * @silent - Do not print to dmsg (Even if enabled) 266 * @silent - Do not print to dmsg (Even if enabled)
267 * @bad_obj_list - Some commands act on multiple objects. Failed objects will 267 * @bad_obj_list - Some commands act on multiple objects. Failed objects will
268 * be recieved here (optional) 268 * be received here (optional)
269 * @max_obj - Size of @bad_obj_list. 269 * @max_obj - Size of @bad_obj_list.
270 * @bad_attr_list - List of failing attributes (optional) 270 * @bad_attr_list - List of failing attributes (optional)
271 * @max_attr - Size of @bad_attr_list. 271 * @max_attr - Size of @bad_attr_list.
@@ -448,6 +448,20 @@ void osd_req_read(struct osd_request *or,
448int osd_req_read_kern(struct osd_request *or, 448int osd_req_read_kern(struct osd_request *or,
449 const struct osd_obj_id *obj, u64 offset, void *buff, u64 len); 449 const struct osd_obj_id *obj, u64 offset, void *buff, u64 len);
450 450
451/* Scatter/Gather write/read commands */
452int osd_req_write_sg(struct osd_request *or,
453 const struct osd_obj_id *obj, struct bio *bio,
454 const struct osd_sg_entry *sglist, unsigned numentries);
455int osd_req_read_sg(struct osd_request *or,
456 const struct osd_obj_id *obj, struct bio *bio,
457 const struct osd_sg_entry *sglist, unsigned numentries);
458int osd_req_write_sg_kern(struct osd_request *or,
459 const struct osd_obj_id *obj, void **buff,
460 const struct osd_sg_entry *sglist, unsigned numentries);
461int osd_req_read_sg_kern(struct osd_request *or,
462 const struct osd_obj_id *obj, void **buff,
463 const struct osd_sg_entry *sglist, unsigned numentries);
464
451/* 465/*
452 * Root/Partition/Collection/Object Attributes commands 466 * Root/Partition/Collection/Object Attributes commands
453 */ 467 */
diff --git a/include/scsi/osd_protocol.h b/include/scsi/osd_protocol.h
index 685661283540..a6026da25f3e 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,
631 put_unaligned_le16(bit_mask, &cap->permissions_bit_mask); 631 put_unaligned_le16(bit_mask, &cap->permissions_bit_mask);
632} 632}
633 633
634/* osd2r05a sec 5.3: CDB continuation segment formats */
635enum osd_continuation_segment_format {
636 CDB_CONTINUATION_FORMAT_V2 = 0x01,
637};
638
639struct osd_continuation_segment_header {
640 u8 format;
641 u8 reserved1;
642 __be16 service_action;
643 __be32 reserved2;
644 u8 integrity_check[OSDv2_CRYPTO_KEYID_SIZE];
645} __packed;
646
647/* osd2r05a sec 5.4.1: CDB continuation descriptors */
648enum osd_continuation_descriptor_type {
649 NO_MORE_DESCRIPTORS = 0x0000,
650 SCATTER_GATHER_LIST = 0x0001,
651 QUERY_LIST = 0x0002,
652 USER_OBJECT = 0x0003,
653 COPY_USER_OBJECT_SOURCE = 0x0101,
654 EXTENSION_CAPABILITIES = 0xFFEE
655};
656
657struct osd_continuation_descriptor_header {
658 __be16 type;
659 u8 reserved;
660 u8 pad_length;
661 __be32 length;
662} __packed;
663
664
665/* osd2r05a sec 5.4.2: Scatter/gather list */
666struct osd_sg_list_entry {
667 __be64 offset;
668 __be64 len;
669};
670
671struct osd_sg_continuation_descriptor {
672 struct osd_continuation_descriptor_header hdr;
673 struct osd_sg_list_entry entries[];
674};
675
634#endif /* ndef __OSD_PROTOCOL_H__ */ 676#endif /* ndef __OSD_PROTOCOL_H__ */
diff --git a/include/scsi/osd_types.h b/include/scsi/osd_types.h
index 3f5e88cc75c0..bd0be7ed4bcf 100644
--- a/include/scsi/osd_types.h
+++ b/include/scsi/osd_types.h
@@ -37,4 +37,9 @@ struct osd_attr {
37 void *val_ptr; /* in network order */ 37 void *val_ptr; /* in network order */
38}; 38};
39 39
40struct osd_sg_entry {
41 u64 offset;
42 u64 len;
43};
44
40#endif /* ndef __OSD_TYPES_H__ */ 45#endif /* ndef __OSD_TYPES_H__ */
diff --git a/include/scsi/sas_ata.h b/include/scsi/sas_ata.h
index c583193ae929..9c159f74c6d0 100644
--- a/include/scsi/sas_ata.h
+++ b/include/scsi/sas_ata.h
@@ -39,6 +39,11 @@ int sas_ata_init_host_and_port(struct domain_device *found_dev,
39 struct scsi_target *starget); 39 struct scsi_target *starget);
40 40
41void sas_ata_task_abort(struct sas_task *task); 41void sas_ata_task_abort(struct sas_task *task);
42void sas_ata_strategy_handler(struct Scsi_Host *shost);
43int sas_ata_timed_out(struct scsi_cmnd *cmd, struct sas_task *task,
44 enum blk_eh_timer_return *rtn);
45int sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q,
46 struct list_head *done_q);
42 47
43#else 48#else
44 49
@@ -55,6 +60,23 @@ static inline int sas_ata_init_host_and_port(struct domain_device *found_dev,
55static inline void sas_ata_task_abort(struct sas_task *task) 60static inline void sas_ata_task_abort(struct sas_task *task)
56{ 61{
57} 62}
63
64static inline void sas_ata_strategy_handler(struct Scsi_Host *shost)
65{
66}
67
68static inline int sas_ata_timed_out(struct scsi_cmnd *cmd,
69 struct sas_task *task,
70 enum blk_eh_timer_return *rtn)
71{
72 return 0;
73}
74static inline int sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q,
75 struct list_head *done_q)
76{
77 return 0;
78}
79
58#endif 80#endif
59 81
60#endif /* _SAS_ATA_H_ */ 82#endif /* _SAS_ATA_H_ */
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 8fcb6e0e9e72..3668903e397b 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -9,6 +9,7 @@
9#define _SCSI_SCSI_H 9#define _SCSI_SCSI_H
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/scatterlist.h>
12 13
13struct scsi_cmnd; 14struct scsi_cmnd;
14 15
@@ -32,6 +33,12 @@ struct scsi_cmnd;
32#endif 33#endif
33 34
34/* 35/*
36 * DIX-capable adapters effectively support infinite chaining for the
37 * protection information scatterlist
38 */
39#define SCSI_MAX_PROT_SG_SEGMENTS 0xFFFF
40
41/*
35 * Special value for scanning to specify scanning or rescanning of all 42 * Special value for scanning to specify scanning or rescanning of all
36 * possible channels, (target) ids, or luns on a given shost. 43 * possible channels, (target) ids, or luns on a given shost.
37 */ 44 */
@@ -67,6 +74,7 @@ struct scsi_cmnd;
67#define SEND_DIAGNOSTIC 0x1d 74#define SEND_DIAGNOSTIC 0x1d
68#define ALLOW_MEDIUM_REMOVAL 0x1e 75#define ALLOW_MEDIUM_REMOVAL 0x1e
69 76
77#define READ_FORMAT_CAPACITIES 0x23
70#define SET_WINDOW 0x24 78#define SET_WINDOW 0x24
71#define READ_CAPACITY 0x25 79#define READ_CAPACITY 0x25
72#define READ_10 0x28 80#define READ_10 0x28
@@ -96,6 +104,8 @@ struct scsi_cmnd;
96#define WRITE_SAME 0x41 104#define WRITE_SAME 0x41
97#define UNMAP 0x42 105#define UNMAP 0x42
98#define READ_TOC 0x43 106#define READ_TOC 0x43
107#define READ_HEADER 0x44
108#define GET_EVENT_STATUS_NOTIFICATION 0x4a
99#define LOG_SELECT 0x4c 109#define LOG_SELECT 0x4c
100#define LOG_SENSE 0x4d 110#define LOG_SENSE 0x4d
101#define XDWRITEREAD_10 0x53 111#define XDWRITEREAD_10 0x53
@@ -107,33 +117,61 @@ struct scsi_cmnd;
107#define PERSISTENT_RESERVE_OUT 0x5f 117#define PERSISTENT_RESERVE_OUT 0x5f
108#define VARIABLE_LENGTH_CMD 0x7f 118#define VARIABLE_LENGTH_CMD 0x7f
109#define REPORT_LUNS 0xa0 119#define REPORT_LUNS 0xa0
120#define SECURITY_PROTOCOL_IN 0xa2
110#define MAINTENANCE_IN 0xa3 121#define MAINTENANCE_IN 0xa3
111#define MAINTENANCE_OUT 0xa4 122#define MAINTENANCE_OUT 0xa4
112#define MOVE_MEDIUM 0xa5 123#define MOVE_MEDIUM 0xa5
113#define EXCHANGE_MEDIUM 0xa6 124#define EXCHANGE_MEDIUM 0xa6
114#define READ_12 0xa8 125#define READ_12 0xa8
115#define WRITE_12 0xaa 126#define WRITE_12 0xaa
127#define READ_MEDIA_SERIAL_NUMBER 0xab
116#define WRITE_VERIFY_12 0xae 128#define WRITE_VERIFY_12 0xae
117#define VERIFY_12 0xaf 129#define VERIFY_12 0xaf
118#define SEARCH_HIGH_12 0xb0 130#define SEARCH_HIGH_12 0xb0
119#define SEARCH_EQUAL_12 0xb1 131#define SEARCH_EQUAL_12 0xb1
120#define SEARCH_LOW_12 0xb2 132#define SEARCH_LOW_12 0xb2
133#define SECURITY_PROTOCOL_OUT 0xb5
121#define READ_ELEMENT_STATUS 0xb8 134#define READ_ELEMENT_STATUS 0xb8
122#define SEND_VOLUME_TAG 0xb6 135#define SEND_VOLUME_TAG 0xb6
123#define WRITE_LONG_2 0xea 136#define WRITE_LONG_2 0xea
137#define EXTENDED_COPY 0x83
138#define RECEIVE_COPY_RESULTS 0x84
139#define ACCESS_CONTROL_IN 0x86
140#define ACCESS_CONTROL_OUT 0x87
124#define READ_16 0x88 141#define READ_16 0x88
125#define WRITE_16 0x8a 142#define WRITE_16 0x8a
143#define READ_ATTRIBUTE 0x8c
144#define WRITE_ATTRIBUTE 0x8d
126#define VERIFY_16 0x8f 145#define VERIFY_16 0x8f
127#define WRITE_SAME_16 0x93 146#define WRITE_SAME_16 0x93
128#define SERVICE_ACTION_IN 0x9e 147#define SERVICE_ACTION_IN 0x9e
129/* values for service action in */ 148/* values for service action in */
130#define SAI_READ_CAPACITY_16 0x10 149#define SAI_READ_CAPACITY_16 0x10
131#define SAI_GET_LBA_STATUS 0x12 150#define SAI_GET_LBA_STATUS 0x12
151/* values for VARIABLE_LENGTH_CMD service action codes
152 * see spc4r17 Section D.3.5, table D.7 and D.8 */
153#define VLC_SA_RECEIVE_CREDENTIAL 0x1800
132/* values for maintenance in */ 154/* values for maintenance in */
155#define MI_REPORT_IDENTIFYING_INFORMATION 0x05
133#define MI_REPORT_TARGET_PGS 0x0a 156#define MI_REPORT_TARGET_PGS 0x0a
157#define MI_REPORT_ALIASES 0x0b
158#define MI_REPORT_SUPPORTED_OPERATION_CODES 0x0c
159#define MI_REPORT_SUPPORTED_TASK_MANAGEMENT_FUNCTIONS 0x0d
160#define MI_REPORT_PRIORITY 0x0e
161#define MI_REPORT_TIMESTAMP 0x0f
162#define MI_MANAGEMENT_PROTOCOL_IN 0x10
134/* values for maintenance out */ 163/* values for maintenance out */
164#define MO_SET_IDENTIFYING_INFORMATION 0x06
135#define MO_SET_TARGET_PGS 0x0a 165#define MO_SET_TARGET_PGS 0x0a
166#define MO_CHANGE_ALIASES 0x0b
167#define MO_SET_PRIORITY 0x0e
168#define MO_SET_TIMESTAMP 0x0f
169#define MO_MANAGEMENT_PROTOCOL_OUT 0x10
136/* values for variable length command */ 170/* values for variable length command */
171#define XDREAD_32 0x03
172#define XDWRITE_32 0x04
173#define XPWRITE_32 0x06
174#define XDWRITEREAD_32 0x07
137#define READ_32 0x09 175#define READ_32 0x09
138#define VERIFY_32 0x0a 176#define VERIFY_32 0x0a
139#define WRITE_32 0x0b 177#define WRITE_32 0x0b
@@ -397,6 +435,10 @@ static inline int scsi_is_wlun(unsigned int lun)
397 * recover the link. Transport class will 435 * recover the link. Transport class will
398 * retry or fail IO */ 436 * retry or fail IO */
399#define DID_TRANSPORT_FAILFAST 0x0f /* Transport class fastfailed the io */ 437#define DID_TRANSPORT_FAILFAST 0x0f /* Transport class fastfailed the io */
438#define DID_TARGET_FAILURE 0x10 /* Permanent target failure, do not retry on
439 * other paths */
440#define DID_NEXUS_FAILURE 0x11 /* Permanent nexus failure, retry on other
441 * paths might yield different results */
400#define DRIVER_OK 0x00 /* Driver status */ 442#define DRIVER_OK 0x00 /* Driver status */
401 443
402/* 444/*
@@ -426,6 +468,7 @@ static inline int scsi_is_wlun(unsigned int lun)
426#define TIMEOUT_ERROR 0x2007 468#define TIMEOUT_ERROR 0x2007
427#define SCSI_RETURN_NOT_HANDLED 0x2008 469#define SCSI_RETURN_NOT_HANDLED 0x2008
428#define FAST_IO_FAIL 0x2009 470#define FAST_IO_FAIL 0x2009
471#define TARGET_ERROR 0x200A
429 472
430/* 473/*
431 * Midlevel queue return values. 474 * Midlevel queue return values.
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 50cb34ffef11..dd82e02ddde3 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -148,6 +148,8 @@ struct scsi_device {
148 unsigned retry_hwerror:1; /* Retry HARDWARE_ERROR */ 148 unsigned retry_hwerror:1; /* Retry HARDWARE_ERROR */
149 unsigned last_sector_bug:1; /* do not use multisector accesses on 149 unsigned last_sector_bug:1; /* do not use multisector accesses on
150 SD_LAST_BUGGY_SECTORS */ 150 SD_LAST_BUGGY_SECTORS */
151 unsigned no_read_disc_info:1; /* Avoid READ_DISC_INFO cmds */
152 unsigned no_read_capacity_16:1; /* Avoid READ_CAPACITY_16 cmds */
151 unsigned is_visible:1; /* is the device visible in sysfs */ 153 unsigned is_visible:1; /* is the device visible in sysfs */
152 154
153 DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */ 155 DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */
@@ -167,6 +169,7 @@ struct scsi_device {
167 sdev_dev; 169 sdev_dev;
168 170
169 struct execute_work ew; /* used to get process context on put */ 171 struct execute_work ew; /* used to get process context on put */
172 struct work_struct requeue_work;
170 173
171 struct scsi_dh_data *scsi_dh_data; 174 struct scsi_dh_data *scsi_dh_data;
172 enum scsi_device_state sdev_state; 175 enum scsi_device_state sdev_state;
@@ -182,6 +185,7 @@ typedef void (*activate_complete)(void *, int);
182struct scsi_device_handler { 185struct scsi_device_handler {
183 /* Used by the infrastructure */ 186 /* Used by the infrastructure */
184 struct list_head list; /* list of scsi_device_handlers */ 187 struct list_head list; /* list of scsi_device_handlers */
188 int idx;
185 189
186 /* Filled by the hardware handler */ 190 /* Filled by the hardware handler */
187 struct module *module; 191 struct module *module;
@@ -459,7 +463,7 @@ static inline int scsi_device_qas(struct scsi_device *sdev)
459} 463}
460static inline int scsi_device_enclosure(struct scsi_device *sdev) 464static inline int scsi_device_enclosure(struct scsi_device *sdev)
461{ 465{
462 return sdev->inquiry[6] & (1<<6); 466 return sdev->inquiry ? (sdev->inquiry[6] & (1<<6)) : 1;
463} 467}
464 468
465static inline int scsi_device_protection(struct scsi_device *sdev) 469static inline int scsi_device_protection(struct scsi_device *sdev)
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index b7bdecb7b76e..f1f2644137b8 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -46,7 +46,7 @@ struct blk_queue_tags;
46enum { 46enum {
47 SCSI_QDEPTH_DEFAULT, /* default requested change, e.g. from sysfs */ 47 SCSI_QDEPTH_DEFAULT, /* default requested change, e.g. from sysfs */
48 SCSI_QDEPTH_QFULL, /* scsi-ml requested due to queue full */ 48 SCSI_QDEPTH_QFULL, /* scsi-ml requested due to queue full */
49 SCSI_QDEPTH_RAMP_UP, /* scsi-ml requested due to threshhold event */ 49 SCSI_QDEPTH_RAMP_UP, /* scsi-ml requested due to threshold event */
50}; 50};
51 51
52struct scsi_host_template { 52struct scsi_host_template {
@@ -127,8 +127,7 @@ struct scsi_host_template {
127 * 127 *
128 * STATUS: REQUIRED 128 * STATUS: REQUIRED
129 */ 129 */
130 int (* queuecommand)(struct scsi_cmnd *, 130 int (* queuecommand)(struct Scsi_Host *, struct scsi_cmnd *);
131 void (*done)(struct scsi_cmnd *));
132 131
133 /* 132 /*
134 * The transfer functions are used to queue a scsi command to 133 * The transfer functions are used to queue a scsi command to
@@ -388,6 +387,7 @@ struct scsi_host_template {
388 * of scatter-gather. 387 * of scatter-gather.
389 */ 388 */
390 unsigned short sg_tablesize; 389 unsigned short sg_tablesize;
390 unsigned short sg_prot_tablesize;
391 391
392 /* 392 /*
393 * Set this if the host adapter has limitations beside segment count. 393 * Set this if the host adapter has limitations beside segment count.
@@ -504,6 +504,25 @@ struct scsi_host_template {
504}; 504};
505 505
506/* 506/*
507 * Temporary #define for host lock push down. Can be removed when all
508 * drivers have been updated to take advantage of unlocked
509 * queuecommand.
510 *
511 */
512#define DEF_SCSI_QCMD(func_name) \
513 int func_name(struct Scsi_Host *shost, struct scsi_cmnd *cmd) \
514 { \
515 unsigned long irq_flags; \
516 int rc; \
517 spin_lock_irqsave(shost->host_lock, irq_flags); \
518 scsi_cmd_get_serial(shost, cmd); \
519 rc = func_name##_lck (cmd, cmd->scsi_done); \
520 spin_unlock_irqrestore(shost->host_lock, irq_flags); \
521 return rc; \
522 }
523
524
525/*
507 * shost state: If you alter this, you also need to alter scsi_sysfs.c 526 * shost state: If you alter this, you also need to alter scsi_sysfs.c
508 * (for the ascii descriptions) and the state model enforcer: 527 * (for the ascii descriptions) and the state model enforcer:
509 * scsi_host_set_state() 528 * scsi_host_set_state()
@@ -599,6 +618,7 @@ struct Scsi_Host {
599 int can_queue; 618 int can_queue;
600 short cmd_per_lun; 619 short cmd_per_lun;
601 short unsigned int sg_tablesize; 620 short unsigned int sg_tablesize;
621 short unsigned int sg_prot_tablesize;
602 short unsigned int max_sectors; 622 short unsigned int max_sectors;
603 unsigned long dma_boundary; 623 unsigned long dma_boundary;
604 /* 624 /*
@@ -750,6 +770,7 @@ extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *);
750extern void scsi_host_put(struct Scsi_Host *t); 770extern void scsi_host_put(struct Scsi_Host *t);
751extern struct Scsi_Host *scsi_host_lookup(unsigned short); 771extern struct Scsi_Host *scsi_host_lookup(unsigned short);
752extern const char *scsi_host_state_name(enum scsi_host_state); 772extern const char *scsi_host_state_name(enum scsi_host_state);
773extern void scsi_cmd_get_serial(struct Scsi_Host *, struct scsi_cmnd *);
753 774
754extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *); 775extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *);
755 776
@@ -823,6 +844,11 @@ static inline unsigned int scsi_host_get_prot(struct Scsi_Host *shost)
823 return shost->prot_capabilities; 844 return shost->prot_capabilities;
824} 845}
825 846
847static inline int scsi_host_prot_dma(struct Scsi_Host *shost)
848{
849 return shost->prot_capabilities >= SHOST_DIX_TYPE0_PROTECTION;
850}
851
826static inline unsigned int scsi_host_dif_capable(struct Scsi_Host *shost, unsigned int target_type) 852static inline unsigned int scsi_host_dif_capable(struct Scsi_Host *shost, unsigned int target_type)
827{ 853{
828 static unsigned char cap[] = { 0, 854 static unsigned char cap[] = { 0,
diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h
index 17231385cb37..81dd12edc38c 100644
--- a/include/scsi/scsi_tcq.h
+++ b/include/scsi/scsi_tcq.h
@@ -9,6 +9,7 @@
9#define MSG_SIMPLE_TAG 0x20 9#define MSG_SIMPLE_TAG 0x20
10#define MSG_HEAD_TAG 0x21 10#define MSG_HEAD_TAG 0x21
11#define MSG_ORDERED_TAG 0x22 11#define MSG_ORDERED_TAG 0x22
12#define MSG_ACA_TAG 0x24 /* unsupported */
12 13
13#define SCSI_NO_TAG (-1) /* identify no tag in use */ 14#define SCSI_NO_TAG (-1) /* identify no tag in use */
14 15
@@ -97,13 +98,9 @@ static inline void scsi_deactivate_tcq(struct scsi_device *sdev, int depth)
97static inline int scsi_populate_tag_msg(struct scsi_cmnd *cmd, char *msg) 98static inline int scsi_populate_tag_msg(struct scsi_cmnd *cmd, char *msg)
98{ 99{
99 struct request *req = cmd->request; 100 struct request *req = cmd->request;
100 struct scsi_device *sdev = cmd->device;
101 101
102 if (blk_rq_tagged(req)) { 102 if (blk_rq_tagged(req)) {
103 if (sdev->ordered_tags && req->cmd_flags & REQ_HARDBARRIER) 103 *msg++ = MSG_SIMPLE_TAG;
104 *msg++ = MSG_ORDERED_TAG;
105 else
106 *msg++ = MSG_SIMPLE_TAG;
107 *msg++ = req->tag; 104 *msg++ = req->tag;
108 return 2; 105 return 2;
109 } 106 }
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 87d81b3ce564..2a65167a8f10 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -192,9 +192,9 @@ struct fc_vport_identifiers {
192 * 192 *
193 * This structure exists for each FC port is a virtual FC port. Virtual 193 * This structure exists for each FC port is a virtual FC port. Virtual
194 * ports share the physical link with the Physical port. Each virtual 194 * ports share the physical link with the Physical port. Each virtual
195 * ports has a unique presense on the SAN, and may be instantiated via 195 * ports has a unique presence on the SAN, and may be instantiated via
196 * NPIV, Virtual Fabrics, or via additional ALPAs. As the vport is a 196 * NPIV, Virtual Fabrics, or via additional ALPAs. As the vport is a
197 * unique presense, each vport has it's own view of the fabric, 197 * unique presence, each vport has it's own view of the fabric,
198 * authentication privilege, and priorities. 198 * authentication privilege, and priorities.
199 * 199 *
200 * A virtual port may support 1 or more FC4 roles. Typically it is a 200 * A virtual port may support 1 or more FC4 roles. Typically it is a
@@ -370,7 +370,7 @@ struct fc_rport { /* aka fc_starget_attrs */
370/* 370/*
371 * FC SCSI Target Attributes 371 * FC SCSI Target Attributes
372 * 372 *
373 * The SCSI Target is considered an extention of a remote port (as 373 * The SCSI Target is considered an extension of a remote port (as
374 * a remote port can be more than a SCSI Target). Within the scsi 374 * a remote port can be more than a SCSI Target). Within the scsi
375 * subsystem, we leave the Target as a separate entity. Doing so 375 * subsystem, we leave the Target as a separate entity. Doing so
376 * provides backward compatibility with prior FC transport api's, 376 * provides backward compatibility with prior FC transport api's,
@@ -496,6 +496,7 @@ struct fc_host_attrs {
496 u64 fabric_name; 496 u64 fabric_name;
497 char symbolic_name[FC_SYMBOLIC_NAME_SIZE]; 497 char symbolic_name[FC_SYMBOLIC_NAME_SIZE];
498 char system_hostname[FC_SYMBOLIC_NAME_SIZE]; 498 char system_hostname[FC_SYMBOLIC_NAME_SIZE];
499 u32 dev_loss_tmo;
499 500
500 /* Private (Transport-managed) Attributes */ 501 /* Private (Transport-managed) Attributes */
501 enum fc_tgtid_binding_type tgtid_bind_type; 502 enum fc_tgtid_binding_type tgtid_bind_type;
@@ -580,6 +581,8 @@ struct fc_host_attrs {
580 (((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q_name) 581 (((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q_name)
581#define fc_host_devloss_work_q(x) \ 582#define fc_host_devloss_work_q(x) \
582 (((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q) 583 (((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q)
584#define fc_host_dev_loss_tmo(x) \
585 (((struct fc_host_attrs *)(x)->shost_data)->dev_loss_tmo)
583 586
584 587
585struct fc_bsg_buffer { 588struct fc_bsg_buffer {
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 7fff94b3b2a8..bf8f52965675 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -101,6 +101,8 @@ struct iscsi_transport {
101 void (*destroy_conn) (struct iscsi_cls_conn *conn); 101 void (*destroy_conn) (struct iscsi_cls_conn *conn);
102 int (*set_param) (struct iscsi_cls_conn *conn, enum iscsi_param param, 102 int (*set_param) (struct iscsi_cls_conn *conn, enum iscsi_param param,
103 char *buf, int buflen); 103 char *buf, int buflen);
104 int (*get_ep_param) (struct iscsi_endpoint *ep, enum iscsi_param param,
105 char *buf);
104 int (*get_conn_param) (struct iscsi_cls_conn *conn, 106 int (*get_conn_param) (struct iscsi_cls_conn *conn,
105 enum iscsi_param param, char *buf); 107 enum iscsi_param param, char *buf);
106 int (*get_session_param) (struct iscsi_cls_session *session, 108 int (*get_session_param) (struct iscsi_cls_session *session,
@@ -160,8 +162,9 @@ struct iscsi_cls_conn {
160 void *dd_data; /* LLD private data */ 162 void *dd_data; /* LLD private data */
161 struct iscsi_transport *transport; 163 struct iscsi_transport *transport;
162 uint32_t cid; /* connection id */ 164 uint32_t cid; /* connection id */
165 struct mutex ep_mutex;
166 struct iscsi_endpoint *ep;
163 167
164 int active; /* must be accessed with the connlock */
165 struct device dev; /* sysfs transport/container device */ 168 struct device dev; /* sysfs transport/container device */
166}; 169};
167 170
@@ -222,6 +225,7 @@ struct iscsi_endpoint {
222 void *dd_data; /* LLD private data */ 225 void *dd_data; /* LLD private data */
223 struct device dev; 226 struct device dev;
224 uint64_t id; 227 uint64_t id;
228 struct iscsi_cls_conn *conn;
225}; 229};
226 230
227/* 231/*
diff --git a/include/scsi/srp.h b/include/scsi/srp.h
index ad178fa78f66..1ae84db4c9fb 100644
--- a/include/scsi/srp.h
+++ b/include/scsi/srp.h
@@ -239,4 +239,42 @@ struct srp_rsp {
239 u8 data[0]; 239 u8 data[0];
240} __attribute__((packed)); 240} __attribute__((packed));
241 241
242struct srp_cred_req {
243 u8 opcode;
244 u8 sol_not;
245 u8 reserved[2];
246 __be32 req_lim_delta;
247 u64 tag;
248};
249
250struct srp_cred_rsp {
251 u8 opcode;
252 u8 reserved[7];
253 u64 tag;
254};
255
256/*
257 * The SRP spec defines the fixed portion of the AER_REQ structure to be
258 * 36 bytes, so it needs to be packed to avoid having it padded to 40 bytes
259 * on 64-bit architectures.
260 */
261struct srp_aer_req {
262 u8 opcode;
263 u8 sol_not;
264 u8 reserved[2];
265 __be32 req_lim_delta;
266 u64 tag;
267 u32 reserved2;
268 __be64 lun;
269 __be32 sense_data_len;
270 u32 reserved3;
271 u8 sense_data[0];
272} __attribute__((packed));
273
274struct srp_aer_rsp {
275 u8 opcode;
276 u8 reserved[7];
277 u64 tag;
278};
279
242#endif /* SCSI_SRP_H */ 280#endif /* SCSI_SRP_H */