aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJohannes Thumshirn <jthumshirn@suse.de>2016-11-17 10:31:19 +0100
committerMartin K. Petersen <martin.petersen@oracle.com>2016-11-17 20:15:25 -0500
commit75cc8cfc6e13d42d50c2bf4307d0a68c2a70f709 (patch)
tree795268cc98266068911a46dde5ced0c73003952e /include
parentblock: add reference counting for struct bsg_job (diff)
downloadlinux-dev-75cc8cfc6e13d42d50c2bf4307d0a68c2a70f709.tar.xz
linux-dev-75cc8cfc6e13d42d50c2bf4307d0a68c2a70f709.zip
scsi: change FC drivers to use 'struct bsg_job'
Change FC drivers to use 'struct bsg_job' from bsg-lib.h instead of 'struct fc_bsg_job' from scsi_transport_fc.h and remove 'struct fc_bsg_job'. Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Hannes Reinecke <hare@suse.com> Acked-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'include')
-rw-r--r--include/scsi/libfc.h2
-rw-r--r--include/scsi/scsi_transport_fc.h63
2 files changed, 19 insertions, 46 deletions
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 6f81b28364da..96dd0b3f70d7 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -912,7 +912,7 @@ 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 *);
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 8ae5680f2216..1da8b719abae 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -32,6 +32,7 @@
#include <asm/unaligned.h>
#include <scsi/scsi.h>
#include <scsi/scsi_netlink.h>
+#include <scsi/scsi_host.h>
struct scsi_transport_template;
@@ -625,38 +626,6 @@ struct fc_host_attrs {
#define fc_host_dev_loss_tmo(x) \
(((struct fc_host_attrs *)(x)->shost_data)->dev_loss_tmo)
-/* 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;
- struct kref kref;
-
- 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 bsg_buffer request_payload;
- struct 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 *);
@@ -693,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;
@@ -817,16 +786,6 @@ fc_vport_set_state(struct fc_vport *vport, enum fc_vport_state new_state)
vport->vport_state = new_state;
}
-static inline struct Scsi_Host *fc_bsg_to_shost(struct fc_bsg_job *job)
-{
- return job->shost;
-}
-
-static inline struct fc_rport *fc_bsg_to_rport(struct fc_bsg_job *job)
-{
- return job->rport;
-}
-
struct scsi_transport_template *fc_attach_transport(
struct fc_function_template *);
void fc_release_transport(struct scsi_transport_template *);
@@ -849,7 +808,21 @@ struct fc_vport *fc_vport_create(struct Scsi_Host *shost, int channel,
struct fc_vport_identifiers *);
int fc_vport_terminate(struct fc_vport *vport);
int fc_block_scsi_eh(struct scsi_cmnd *cmnd);
-void fc_bsg_jobdone(struct fc_bsg_job *job, int result,
+void fc_bsg_jobdone(struct bsg_job *job, int result,
unsigned int reply_payload_rcv_len);
+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 */