summaryrefslogtreecommitdiffstats
path: root/include/scsi
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-12-14 10:49:33 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2016-12-14 10:49:33 -0800
commita829a8445f09036404060f4d6489cb13433f4304 (patch)
tree60067e1425239a9f372c10100ede39691c3d612b /include/scsi
parent84b6079134420f4635f23c2088a3892057b23bb0 (diff)
parentf5b893c947151d424a4ab55ea3a8544b81974b31 (diff)
downloadlinux-a829a8445f09036404060f4d6489cb13433f4304.tar.bz2
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI updates from James Bottomley: "This update includes the usual round of major driver updates (ncr5380, lpfc, hisi_sas, megaraid_sas, ufs, ibmvscsis, mpt3sas). There's also an assortment of minor fixes, mostly in error legs or other not very user visible stuff. The major change is the pci_alloc_irq_vectors replacement for the old pci_msix_.. calls; this effectively makes IRQ mapping generic for the drivers and allows blk_mq to use the information" * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (256 commits) scsi: qla4xxx: switch to pci_alloc_irq_vectors scsi: hisi_sas: support deferred probe for v2 hw scsi: megaraid_sas: switch to pci_alloc_irq_vectors scsi: scsi_devinfo: remove synchronous ALUA for NETAPP devices scsi: be2iscsi: set errno on error path scsi: be2iscsi: set errno on error path scsi: hpsa: fallback to use legacy REPORT PHYS command scsi: scsi_dh_alua: Fix RCU annotations scsi: hpsa: use %phN for short hex dumps scsi: hisi_sas: fix free'ing in probe and remove scsi: isci: switch to pci_alloc_irq_vectors scsi: ipr: Fix runaway IRQs when falling back from MSI to LSI scsi: dpt_i2o: double free on error path scsi: cxlflash: Migrate scsi command pointer to AFU command scsi: cxlflash: Migrate IOARRIN specific routines to function pointers scsi: cxlflash: Cleanup queuecommand() scsi: cxlflash: Cleanup send_tmf() scsi: cxlflash: Remove AFU command lock scsi: cxlflash: Wait for active AFU commands to timeout upon tear down scsi: cxlflash: Remove private command pool ...
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/libfc.h206
-rw-r--r--include/scsi/scsi_host.h8
-rw-r--r--include/scsi/scsi_transport_fc.h62
3 files changed, 62 insertions, 214 deletions
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 7428a53257ca..96dd0b3f70d7 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -44,6 +44,11 @@
#define FC_NO_ERR 0 /* no error */
#define FC_EX_TIMEOUT 1 /* Exchange timeout */
#define FC_EX_CLOSED 2 /* Exchange closed */
+#define FC_EX_ALLOC_ERR 3 /* Exchange allocation failed */
+#define FC_EX_XMIT_ERR 4 /* Exchange transmit failed */
+#define FC_EX_ELS_RJT 5 /* ELS rejected */
+#define FC_EX_INV_LOGIN 6 /* Login not completed */
+#define FC_EX_SEQ_ERR 6 /* Exchange sequence error */
/**
* enum fc_lport_state - Local port states
@@ -350,7 +355,8 @@ struct fc_fcp_pkt {
/* Timeout/error related information */
struct timer_list timer;
- int wait_for_comp;
+ int wait_for_comp;
+ int timer_delay;
u32 recov_retry;
struct fc_seq *recov_seq;
struct completion tm_done;
@@ -385,6 +391,7 @@ struct fc_seq {
#define FC_EX_DONE (1 << 0) /* ep is completed */
#define FC_EX_RST_CLEANUP (1 << 1) /* reset is forcing completion */
+#define FC_EX_QUARANTINE (1 << 2) /* exch is quarantined */
/**
* struct fc_exch - Fibre Channel Exchange
@@ -478,37 +485,6 @@ struct libfc_function_template {
void *arg, u32 timer_msec);
/*
- * Send the FC frame payload using a new exchange and sequence.
- *
- * The exchange response handler is set in this routine to resp()
- * function pointer. It can be called in two scenarios: if a timeout
- * occurs or if a response frame is received for the exchange. The
- * fc_frame pointer in response handler will also indicate timeout
- * as error using IS_ERR related macros.
- *
- * The exchange destructor handler is also set in this routine.
- * The destructor handler is invoked by EM layer when exchange
- * is about to free, this can be used by caller to free its
- * resources along with exchange free.
- *
- * The arg is passed back to resp and destructor handler.
- *
- * The timeout value (in msec) for an exchange is set if non zero
- * timer_msec argument is specified. The timer is canceled when
- * it fires or when the exchange is done. The exchange timeout handler
- * is registered by EM layer.
- *
- * STATUS: OPTIONAL
- */
- struct fc_seq *(*exch_seq_send)(struct fc_lport *, struct fc_frame *,
- void (*resp)(struct fc_seq *,
- struct fc_frame *,
- void *),
- void (*destructor)(struct fc_seq *,
- void *),
- void *, unsigned int timer_msec);
-
- /*
* Sets up the DDP context for a given exchange id on the given
* scatterlist if LLD supports DDP for large receive.
*
@@ -537,73 +513,6 @@ struct libfc_function_template {
* STATUS: OPTIONAL
*/
void (*get_lesb)(struct fc_lport *, struct fc_els_lesb *lesb);
- /*
- * Send a frame using an existing sequence and exchange.
- *
- * STATUS: OPTIONAL
- */
- int (*seq_send)(struct fc_lport *, struct fc_seq *,
- struct fc_frame *);
-
- /*
- * Send an ELS response using information from the received frame.
- *
- * STATUS: OPTIONAL
- */
- void (*seq_els_rsp_send)(struct fc_frame *, enum fc_els_cmd,
- struct fc_seq_els_data *);
-
- /*
- * Abort an exchange and sequence. Generally called because of a
- * exchange timeout or an abort from the upper layer.
- *
- * A timer_msec can be specified for abort timeout, if non-zero
- * timer_msec value is specified then exchange resp handler
- * will be called with timeout error if no response to abort.
- *
- * STATUS: OPTIONAL
- */
- int (*seq_exch_abort)(const struct fc_seq *,
- unsigned int timer_msec);
-
- /*
- * Indicate that an exchange/sequence tuple is complete and the memory
- * allocated for the related objects may be freed.
- *
- * STATUS: OPTIONAL
- */
- void (*exch_done)(struct fc_seq *);
-
- /*
- * Start a new sequence on the same exchange/sequence tuple.
- *
- * STATUS: OPTIONAL
- */
- struct fc_seq *(*seq_start_next)(struct fc_seq *);
-
- /*
- * Set a response handler for the exchange of the sequence.
- *
- * STATUS: OPTIONAL
- */
- void (*seq_set_resp)(struct fc_seq *sp,
- void (*resp)(struct fc_seq *, struct fc_frame *,
- void *),
- void *arg);
-
- /*
- * Assign a sequence for an incoming request frame.
- *
- * STATUS: OPTIONAL
- */
- struct fc_seq *(*seq_assign)(struct fc_lport *, struct fc_frame *);
-
- /*
- * Release the reference on the sequence returned by seq_assign().
- *
- * STATUS: OPTIONAL
- */
- void (*seq_release)(struct fc_seq *);
/*
* Reset an exchange manager, completing all sequences and exchanges.
@@ -615,27 +524,6 @@ struct libfc_function_template {
void (*exch_mgr_reset)(struct fc_lport *, u32 s_id, u32 d_id);
/*
- * Flush the rport work queue. Generally used before shutdown.
- *
- * STATUS: OPTIONAL
- */
- void (*rport_flush_queue)(void);
-
- /*
- * Receive a frame for a local port.
- *
- * STATUS: OPTIONAL
- */
- void (*lport_recv)(struct fc_lport *, struct fc_frame *);
-
- /*
- * Reset the local port.
- *
- * STATUS: OPTIONAL
- */
- int (*lport_reset)(struct fc_lport *);
-
- /*
* Set the local port FC_ID.
*
* This may be provided by the LLD to allow it to be
@@ -656,54 +544,6 @@ struct libfc_function_template {
struct fc_frame *);
/*
- * Create a remote port with a given port ID
- *
- * STATUS: OPTIONAL
- */
- struct fc_rport_priv *(*rport_create)(struct fc_lport *, u32);
-
- /*
- * Initiates the RP state machine. It is called from the LP module.
- * This function will issue the following commands to the N_Port
- * identified by the FC ID provided.
- *
- * - PLOGI
- * - PRLI
- * - RTV
- *
- * STATUS: OPTIONAL
- */
- int (*rport_login)(struct fc_rport_priv *);
-
- /*
- * Logoff, and remove the rport from the transport if
- * it had been added. This will send a LOGO to the target.
- *
- * STATUS: OPTIONAL
- */
- int (*rport_logoff)(struct fc_rport_priv *);
-
- /*
- * Receive a request from a remote port.
- *
- * STATUS: OPTIONAL
- */
- void (*rport_recv_req)(struct fc_lport *, struct fc_frame *);
-
- /*
- * lookup an rport by it's port ID.
- *
- * STATUS: OPTIONAL
- */
- struct fc_rport_priv *(*rport_lookup)(const struct fc_lport *, u32);
-
- /*
- * Destroy an rport after final kref_put().
- * The argument is a pointer to the kref inside the fc_rport_priv.
- */
- void (*rport_destroy)(struct kref *);
-
- /*
* Callback routine after the remote port is logged in
*
* STATUS: OPTIONAL
@@ -1068,18 +908,26 @@ void fc_vport_setlink(struct fc_lport *);
void fc_vports_linkchange(struct fc_lport *);
int fc_lport_config(struct fc_lport *);
int fc_lport_reset(struct fc_lport *);
+void fc_lport_recv(struct fc_lport *lport, struct fc_frame *fp);
int fc_set_mfs(struct fc_lport *, u32 mfs);
struct fc_lport *libfc_vport_create(struct fc_vport *, int privsize);
struct fc_lport *fc_vport_id_lookup(struct fc_lport *, u32 port_id);
-int fc_lport_bsg_request(struct fc_bsg_job *);
+int fc_lport_bsg_request(struct bsg_job *);
void fc_lport_set_local_id(struct fc_lport *, u32 port_id);
void fc_lport_iterate(void (*func)(struct fc_lport *, void *), void *);
/*
* REMOTE PORT LAYER
*****************************/
-int fc_rport_init(struct fc_lport *);
void fc_rport_terminate_io(struct fc_rport *);
+struct fc_rport_priv *fc_rport_lookup(const struct fc_lport *lport,
+ u32 port_id);
+struct fc_rport_priv *fc_rport_create(struct fc_lport *, u32);
+void fc_rport_destroy(struct kref *kref);
+int fc_rport_login(struct fc_rport_priv *rdata);
+int fc_rport_logoff(struct fc_rport_priv *rdata);
+void fc_rport_recv_req(struct fc_lport *lport, struct fc_frame *fp);
+void fc_rport_flush_queue(void);
/*
* DISCOVERY LAYER
@@ -1131,6 +979,21 @@ void fc_fill_hdr(struct fc_frame *, const struct fc_frame *,
*****************************/
int fc_exch_init(struct fc_lport *);
void fc_exch_update_stats(struct fc_lport *lport);
+struct fc_seq *fc_exch_seq_send(struct fc_lport *lport,
+ struct fc_frame *fp,
+ void (*resp)(struct fc_seq *,
+ struct fc_frame *fp,
+ void *arg),
+ void (*destructor)(struct fc_seq *, void *),
+ void *arg, u32 timer_msec);
+void fc_seq_els_rsp_send(struct fc_frame *, enum fc_els_cmd,
+ struct fc_seq_els_data *);
+struct fc_seq *fc_seq_start_next(struct fc_seq *sp);
+void fc_seq_set_resp(struct fc_seq *sp,
+ void (*resp)(struct fc_seq *, struct fc_frame *, void *),
+ void *arg);
+struct fc_seq *fc_seq_assign(struct fc_lport *lport, struct fc_frame *fp);
+void fc_seq_release(struct fc_seq *sp);
struct fc_exch_mgr_anchor *fc_exch_mgr_add(struct fc_lport *,
struct fc_exch_mgr *,
bool (*match)(struct fc_frame *));
@@ -1142,6 +1005,9 @@ struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *, enum fc_class class,
void fc_exch_mgr_free(struct fc_lport *);
void fc_exch_recv(struct fc_lport *, struct fc_frame *);
void fc_exch_mgr_reset(struct fc_lport *, u32 s_id, u32 d_id);
+int fc_seq_send(struct fc_lport *lport, struct fc_seq *sp, struct fc_frame *fp);
+int fc_seq_exch_abort(const struct fc_seq *, unsigned int timer_msec);
+void fc_exch_done(struct fc_seq *sp);
/*
* Functions for fc_functions_template
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 7e4cd53139ed..36680f13270d 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -278,6 +278,14 @@ struct scsi_host_template {
int (* change_queue_depth)(struct scsi_device *, int);
/*
+ * This functions lets the driver expose the queue mapping
+ * to the block layer.
+ *
+ * Status: OPTIONAL
+ */
+ int (* map_queues)(struct Scsi_Host *shost);
+
+ /*
* This function determines the BIOS parameters for a given
* harddisk. These tend to be numbers that are made up by
* the host adapter. Parameters:
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index bf66ea6bed2b..924c8e614b45 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -28,9 +28,11 @@
#define SCSI_TRANSPORT_FC_H
#include <linux/sched.h>
+#include <linux/bsg-lib.h>
#include <asm/unaligned.h>
#include <scsi/scsi.h>
#include <scsi/scsi_netlink.h>
+#include <scsi/scsi_host.h>
struct scsi_transport_template;
@@ -624,48 +626,6 @@ struct fc_host_attrs {
#define fc_host_dev_loss_tmo(x) \
(((struct fc_host_attrs *)(x)->shost_data)->dev_loss_tmo)
-
-struct fc_bsg_buffer {
- unsigned int payload_len;
- int sg_cnt;
- struct scatterlist *sg_list;
-};
-
-/* Values for fc_bsg_job->state_flags (bitflags) */
-#define FC_RQST_STATE_INPROGRESS 0
-#define FC_RQST_STATE_DONE 1
-
-struct fc_bsg_job {
- struct Scsi_Host *shost;
- struct fc_rport *rport;
- struct device *dev;
- struct request *req;
- spinlock_t job_lock;
- unsigned int state_flags;
- unsigned int ref_cnt;
- void (*job_done)(struct fc_bsg_job *);
-
- struct fc_bsg_request *request;
- struct fc_bsg_reply *reply;
- unsigned int request_len;
- unsigned int reply_len;
- /*
- * On entry : reply_len indicates the buffer size allocated for
- * the reply.
- *
- * Upon completion : the message handler must set reply_len
- * to indicates the size of the reply to be returned to the
- * caller.
- */
-
- /* DMA payloads for the request/response */
- struct fc_bsg_buffer request_payload;
- struct fc_bsg_buffer reply_payload;
-
- void *dd_data; /* Used for driver-specific storage */
-};
-
-
/* The functions by which the transport class and the driver communicate */
struct fc_function_template {
void (*get_rport_dev_loss_tmo)(struct fc_rport *);
@@ -702,8 +662,8 @@ struct fc_function_template {
int (* it_nexus_response)(struct Scsi_Host *, u64, int);
/* bsg support */
- int (*bsg_request)(struct fc_bsg_job *);
- int (*bsg_timeout)(struct fc_bsg_job *);
+ int (*bsg_request)(struct bsg_job *);
+ int (*bsg_timeout)(struct bsg_job *);
/* allocation lengths for host-specific data */
u32 dd_fcrport_size;
@@ -849,4 +809,18 @@ struct fc_vport *fc_vport_create(struct Scsi_Host *shost, int channel,
int fc_vport_terminate(struct fc_vport *vport);
int fc_block_scsi_eh(struct scsi_cmnd *cmnd);
+static inline struct Scsi_Host *fc_bsg_to_shost(struct bsg_job *job)
+{
+ if (scsi_is_host_device(job->dev))
+ return dev_to_shost(job->dev);
+ return rport_to_shost(dev_to_rport(job->dev));
+}
+
+static inline struct fc_rport *fc_bsg_to_rport(struct bsg_job *job)
+{
+ if (scsi_is_fc_rport(job->dev))
+ return dev_to_rport(job->dev);
+ return NULL;
+}
+
#endif /* SCSI_TRANSPORT_FC_H */