aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-17 20:54:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-17 20:54:40 -0400
commitc55d267de274d308927b60c3e740c1a826832317 (patch)
tree21b53a8c725d9f9650f60d94b349459d5b8dae10 /include
parent61ef46fd45c3c62dc7c880a45dd2aa841b9af8fb (diff)
parentbc898c97f7ba24def788d9f80786cf028a197122 (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: (170 commits) [SCSI] scsi_dh_rdac: Add MD36xxf into device list [SCSI] scsi_debug: add consecutive medium errors [SCSI] libsas: fix ata list corruption issue [SCSI] hpsa: export resettable host attribute [SCSI] hpsa: move device attributes to avoid forward declarations [SCSI] scsi_debug: Logical Block Provisioning (SBC3r26) [SCSI] sd: Logical Block Provisioning update [SCSI] Include protection operation in SCSI command trace [SCSI] hpsa: fix incorrect PCI IDs and add two new ones (2nd try) [SCSI] target: Fix volume size misreporting for volumes > 2TB [SCSI] bnx2fc: Broadcom FCoE offload driver [SCSI] fcoe: fix broken fcoe interface reset [SCSI] fcoe: precedence bug in fcoe_filter_frames() [SCSI] libfcoe: Remove stale fcoe-netdev entries [SCSI] libfcoe: Move FCOE_MTU definition from fcoe.h to libfcoe.h [SCSI] libfc: introduce __fc_fill_fc_hdr that accepts fc_hdr as an argument [SCSI] fcoe, libfc: initialize EM anchors list and then update npiv EMs [SCSI] Revert "[SCSI] libfc: fix exchange being deleted when the abort itself is timed out" [SCSI] libfc: Fixing a memory leak when destroying an interface [SCSI] megaraid_sas: Version and Changelog update ... Fix up trivial conflicts due to whitespace differences in drivers/scsi/libsas/{sas_ata.c,sas_scsi_host.c}
Diffstat (limited to 'include')
-rw-r--r--include/linux/pci_ids.h2
-rw-r--r--include/scsi/fc/fc_ns.h11
-rw-r--r--include/scsi/fc_encode.h26
-rw-r--r--include/scsi/libfc.h74
-rw-r--r--include/scsi/libfcoe.h105
-rw-r--r--include/scsi/libiscsi.h8
-rw-r--r--include/scsi/scsi.h5
-rw-r--r--include/scsi/scsi_device.h1
-rw-r--r--include/scsi/scsi_transport_iscsi.h6
-rw-r--r--include/trace/events/scsi.h28
10 files changed, 244 insertions, 22 deletions
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 5b038d410e26..511e5ee809ef 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2079,6 +2079,8 @@
2079#define PCI_DEVICE_ID_TIGON3_5723 0x165b 2079#define PCI_DEVICE_ID_TIGON3_5723 0x165b
2080#define PCI_DEVICE_ID_TIGON3_5705M 0x165d 2080#define PCI_DEVICE_ID_TIGON3_5705M 0x165d
2081#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e 2081#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e
2082#define PCI_DEVICE_ID_NX2_57712 0x1662
2083#define PCI_DEVICE_ID_NX2_57712E 0x1663
2082#define PCI_DEVICE_ID_TIGON3_5714 0x1668 2084#define PCI_DEVICE_ID_TIGON3_5714 0x1668
2083#define PCI_DEVICE_ID_TIGON3_5714S 0x1669 2085#define PCI_DEVICE_ID_TIGON3_5714S 0x1669
2084#define PCI_DEVICE_ID_TIGON3_5780 0x166a 2086#define PCI_DEVICE_ID_TIGON3_5780 0x166a
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/libfc.h b/include/scsi/libfc.h
index f53c8e31d5fb..24193c1b0da0 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/**
@@ -551,6 +561,16 @@ struct libfc_function_template {
551 struct fc_seq *(*seq_start_next)(struct fc_seq *); 561 struct fc_seq *(*seq_start_next)(struct fc_seq *);
552 562
553 /* 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 /*
554 * Assign a sequence for an incoming request frame. 574 * Assign a sequence for an incoming request frame.
555 * 575 *
556 * STATUS: OPTIONAL 576 * STATUS: OPTIONAL
@@ -558,6 +578,13 @@ struct libfc_function_template {
558 struct fc_seq *(*seq_assign)(struct fc_lport *, struct fc_frame *); 578 struct fc_seq *(*seq_assign)(struct fc_lport *, struct fc_frame *);
559 579
560 /* 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 /*
561 * Reset an exchange manager, completing all sequences and exchanges. 588 * Reset an exchange manager, completing all sequences and exchanges.
562 * 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.
563 * 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.
@@ -656,6 +683,15 @@ struct libfc_function_template {
656 void (*rport_destroy)(struct kref *); 683 void (*rport_destroy)(struct kref *);
657 684
658 /* 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 /*
659 * Send a fcp cmd from fsp pkt. 695 * Send a fcp cmd from fsp pkt.
660 * Called with the SCSI host lock unlocked and irqs disabled. 696 * Called with the SCSI host lock unlocked and irqs disabled.
661 * 697 *
@@ -749,6 +785,15 @@ struct fc_disc {
749 enum fc_disc_event); 785 enum fc_disc_event);
750}; 786};
751 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
752/** 797/**
753 * struct fc_lport - Local port 798 * struct fc_lport - Local port
754 * @host: The SCSI host associated with a local port 799 * @host: The SCSI host associated with a local port
@@ -789,8 +834,10 @@ struct fc_disc {
789 * @lso_max: The maximum large offload send size 834 * @lso_max: The maximum large offload send size
790 * @fcts: FC-4 type mask 835 * @fcts: FC-4 type mask
791 * @lp_mutex: Mutex to protect the local port 836 * @lp_mutex: Mutex to protect the local port
792 * @list: Handle for list of local ports 837 * @list: Linkage on list of vport peers
793 * @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
794 */ 841 */
795struct fc_lport { 842struct fc_lport {
796 /* Associations */ 843 /* Associations */
@@ -846,8 +893,32 @@ struct fc_lport {
846 struct mutex lp_mutex; 893 struct mutex lp_mutex;
847 struct list_head list; 894 struct list_head list;
848 struct delayed_work retry_work; 895 struct delayed_work retry_work;
896 void *prov[FC_FC4_PROV_SIZE];
897 struct list_head lport_list;
849}; 898};
850 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
851/* 922/*
852 * FC_LPORT HELPER FUNCTIONS 923 * FC_LPORT HELPER FUNCTIONS
853 *****************************/ 924 *****************************/
@@ -978,6 +1049,7 @@ struct fc_lport *libfc_vport_create(struct fc_vport *, int privsize);
978struct 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);
979int fc_lport_bsg_request(struct fc_bsg_job *); 1050int fc_lport_bsg_request(struct fc_bsg_job *);
980void 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 *);
981 1053
982/* 1054/*
983 * REMOTE PORT LAYER 1055 * REMOTE PORT LAYER
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index feb6a94c90ea..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 */
@@ -221,6 +227,8 @@ int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_lport *,
221u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int); 227u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int);
222int fcoe_libfc_config(struct fc_lport *, struct fcoe_ctlr *, 228int fcoe_libfc_config(struct fc_lport *, struct fcoe_ctlr *,
223 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);
224 232
225/** 233/**
226 * is_fip_mode() - returns true if FIP mode selected. 234 * is_fip_mode() - returns true if FIP mode selected.
@@ -231,5 +239,102 @@ static inline bool is_fip_mode(struct fcoe_ctlr *fip)
231 return fip->state == FIP_ST_ENABLED; 239 return fip->state == FIP_ST_ENABLED;
232} 240}
233 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);
234 339
235#endif /* _LIBFCOE_H */ 340#endif /* _LIBFCOE_H */
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 748382b32b52..0f4367751b71 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -212,9 +212,6 @@ struct iscsi_conn {
212 /* values userspace uses to id a conn */ 212 /* values userspace uses to id a conn */
213 int persistent_port; 213 int persistent_port;
214 char *persistent_address; 214 char *persistent_address;
215 /* remote portal currently connected to */
216 int portal_port;
217 char portal_address[ISCSI_ADDRESS_BUF_LEN];
218 215
219 /* MIB-statistics */ 216 /* MIB-statistics */
220 uint64_t txdata_octets; 217 uint64_t txdata_octets;
@@ -319,9 +316,6 @@ struct iscsi_host {
319 /* hw address or netdev iscsi connection is bound to */ 316 /* hw address or netdev iscsi connection is bound to */
320 char *hwaddress; 317 char *hwaddress;
321 char *netdev; 318 char *netdev;
322 /* local address */
323 int local_port;
324 char local_address[ISCSI_ADDRESS_BUF_LEN];
325 319
326 wait_queue_head_t session_removal_wq; 320 wait_queue_head_t session_removal_wq;
327 /* protects sessions and state */ 321 /* protects sessions and state */
@@ -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);
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index b76d4006e36d..3668903e397b 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -435,6 +435,10 @@ static inline int scsi_is_wlun(unsigned int lun)
435 * recover the link. Transport class will 435 * recover the link. Transport class will
436 * retry or fail IO */ 436 * retry or fail IO */
437#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 */
438#define DRIVER_OK 0x00 /* Driver status */ 442#define DRIVER_OK 0x00 /* Driver status */
439 443
440/* 444/*
@@ -464,6 +468,7 @@ static inline int scsi_is_wlun(unsigned int lun)
464#define TIMEOUT_ERROR 0x2007 468#define TIMEOUT_ERROR 0x2007
465#define SCSI_RETURN_NOT_HANDLED 0x2008 469#define SCSI_RETURN_NOT_HANDLED 0x2008
466#define FAST_IO_FAIL 0x2009 470#define FAST_IO_FAIL 0x2009
471#define TARGET_ERROR 0x200A
467 472
468/* 473/*
469 * Midlevel queue return values. 474 * Midlevel queue return values.
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 85867dcde335..f171c65dc5a8 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -184,6 +184,7 @@ typedef void (*activate_complete)(void *, int);
184struct scsi_device_handler { 184struct scsi_device_handler {
185 /* Used by the infrastructure */ 185 /* Used by the infrastructure */
186 struct list_head list; /* list of scsi_device_handlers */ 186 struct list_head list; /* list of scsi_device_handlers */
187 int idx;
187 188
188 /* Filled by the hardware handler */ 189 /* Filled by the hardware handler */
189 struct module *module; 190 struct module *module;
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/trace/events/scsi.h b/include/trace/events/scsi.h
index 25fbefdf2f2e..db6c93510f74 100644
--- a/include/trace/events/scsi.h
+++ b/include/trace/events/scsi.h
@@ -184,6 +184,17 @@
184 scsi_statusbyte_name(SAM_STAT_ACA_ACTIVE), \ 184 scsi_statusbyte_name(SAM_STAT_ACA_ACTIVE), \
185 scsi_statusbyte_name(SAM_STAT_TASK_ABORTED)) 185 scsi_statusbyte_name(SAM_STAT_TASK_ABORTED))
186 186
187#define scsi_prot_op_name(result) { result, #result }
188#define show_prot_op_name(val) \
189 __print_symbolic(val, \
190 scsi_prot_op_name(SCSI_PROT_NORMAL), \
191 scsi_prot_op_name(SCSI_PROT_READ_INSERT), \
192 scsi_prot_op_name(SCSI_PROT_WRITE_STRIP), \
193 scsi_prot_op_name(SCSI_PROT_READ_STRIP), \
194 scsi_prot_op_name(SCSI_PROT_WRITE_INSERT), \
195 scsi_prot_op_name(SCSI_PROT_READ_PASS), \
196 scsi_prot_op_name(SCSI_PROT_WRITE_PASS))
197
187const char *scsi_trace_parse_cdb(struct trace_seq*, unsigned char*, int); 198const char *scsi_trace_parse_cdb(struct trace_seq*, unsigned char*, int);
188#define __parse_cdb(cdb, len) scsi_trace_parse_cdb(p, cdb, len) 199#define __parse_cdb(cdb, len) scsi_trace_parse_cdb(p, cdb, len)
189 200
@@ -202,6 +213,7 @@ TRACE_EVENT(scsi_dispatch_cmd_start,
202 __field( unsigned int, cmd_len ) 213 __field( unsigned int, cmd_len )
203 __field( unsigned int, data_sglen ) 214 __field( unsigned int, data_sglen )
204 __field( unsigned int, prot_sglen ) 215 __field( unsigned int, prot_sglen )
216 __field( unsigned char, prot_op )
205 __dynamic_array(unsigned char, cmnd, cmd->cmd_len) 217 __dynamic_array(unsigned char, cmnd, cmd->cmd_len)
206 ), 218 ),
207 219
@@ -214,13 +226,15 @@ TRACE_EVENT(scsi_dispatch_cmd_start,
214 __entry->cmd_len = cmd->cmd_len; 226 __entry->cmd_len = cmd->cmd_len;
215 __entry->data_sglen = scsi_sg_count(cmd); 227 __entry->data_sglen = scsi_sg_count(cmd);
216 __entry->prot_sglen = scsi_prot_sg_count(cmd); 228 __entry->prot_sglen = scsi_prot_sg_count(cmd);
229 __entry->prot_op = scsi_get_prot_op(cmd);
217 memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len); 230 memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len);
218 ), 231 ),
219 232
220 TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u prot_sgl=%u" \ 233 TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u prot_sgl=%u" \
221 " cmnd=(%s %s raw=%s)", 234 " prot_op=%s cmnd=(%s %s raw=%s)",
222 __entry->host_no, __entry->channel, __entry->id, 235 __entry->host_no, __entry->channel, __entry->id,
223 __entry->lun, __entry->data_sglen, __entry->prot_sglen, 236 __entry->lun, __entry->data_sglen, __entry->prot_sglen,
237 show_prot_op_name(__entry->prot_op),
224 show_opcode_name(__entry->opcode), 238 show_opcode_name(__entry->opcode),
225 __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len), 239 __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len),
226 __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len)) 240 __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len))
@@ -242,6 +256,7 @@ TRACE_EVENT(scsi_dispatch_cmd_error,
242 __field( unsigned int, cmd_len ) 256 __field( unsigned int, cmd_len )
243 __field( unsigned int, data_sglen ) 257 __field( unsigned int, data_sglen )
244 __field( unsigned int, prot_sglen ) 258 __field( unsigned int, prot_sglen )
259 __field( unsigned char, prot_op )
245 __dynamic_array(unsigned char, cmnd, cmd->cmd_len) 260 __dynamic_array(unsigned char, cmnd, cmd->cmd_len)
246 ), 261 ),
247 262
@@ -255,13 +270,15 @@ TRACE_EVENT(scsi_dispatch_cmd_error,
255 __entry->cmd_len = cmd->cmd_len; 270 __entry->cmd_len = cmd->cmd_len;
256 __entry->data_sglen = scsi_sg_count(cmd); 271 __entry->data_sglen = scsi_sg_count(cmd);
257 __entry->prot_sglen = scsi_prot_sg_count(cmd); 272 __entry->prot_sglen = scsi_prot_sg_count(cmd);
273 __entry->prot_op = scsi_get_prot_op(cmd);
258 memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len); 274 memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len);
259 ), 275 ),
260 276
261 TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u prot_sgl=%u" \ 277 TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u prot_sgl=%u" \
262 " cmnd=(%s %s raw=%s) rtn=%d", 278 " prot_op=%s cmnd=(%s %s raw=%s) rtn=%d",
263 __entry->host_no, __entry->channel, __entry->id, 279 __entry->host_no, __entry->channel, __entry->id,
264 __entry->lun, __entry->data_sglen, __entry->prot_sglen, 280 __entry->lun, __entry->data_sglen, __entry->prot_sglen,
281 show_prot_op_name(__entry->prot_op),
265 show_opcode_name(__entry->opcode), 282 show_opcode_name(__entry->opcode),
266 __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len), 283 __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len),
267 __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len), 284 __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len),
@@ -284,6 +301,7 @@ DECLARE_EVENT_CLASS(scsi_cmd_done_timeout_template,
284 __field( unsigned int, cmd_len ) 301 __field( unsigned int, cmd_len )
285 __field( unsigned int, data_sglen ) 302 __field( unsigned int, data_sglen )
286 __field( unsigned int, prot_sglen ) 303 __field( unsigned int, prot_sglen )
304 __field( unsigned char, prot_op )
287 __dynamic_array(unsigned char, cmnd, cmd->cmd_len) 305 __dynamic_array(unsigned char, cmnd, cmd->cmd_len)
288 ), 306 ),
289 307
@@ -297,14 +315,16 @@ DECLARE_EVENT_CLASS(scsi_cmd_done_timeout_template,
297 __entry->cmd_len = cmd->cmd_len; 315 __entry->cmd_len = cmd->cmd_len;
298 __entry->data_sglen = scsi_sg_count(cmd); 316 __entry->data_sglen = scsi_sg_count(cmd);
299 __entry->prot_sglen = scsi_prot_sg_count(cmd); 317 __entry->prot_sglen = scsi_prot_sg_count(cmd);
318 __entry->prot_op = scsi_get_prot_op(cmd);
300 memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len); 319 memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len);
301 ), 320 ),
302 321
303 TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u " \ 322 TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u " \
304 "prot_sgl=%u cmnd=(%s %s raw=%s) result=(driver=%s host=%s " \ 323 "prot_sgl=%u prot_op=%s cmnd=(%s %s raw=%s) result=(driver=" \
305 "message=%s status=%s)", 324 "%s host=%s message=%s status=%s)",
306 __entry->host_no, __entry->channel, __entry->id, 325 __entry->host_no, __entry->channel, __entry->id,
307 __entry->lun, __entry->data_sglen, __entry->prot_sglen, 326 __entry->lun, __entry->data_sglen, __entry->prot_sglen,
327 show_prot_op_name(__entry->prot_op),
308 show_opcode_name(__entry->opcode), 328 show_opcode_name(__entry->opcode),
309 __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len), 329 __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len),
310 __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len), 330 __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len),