]> git.openfabrics.org - ~aditr/compat-rdma.git/commitdiff
IB/srp: backport queue command to 2.6.37 and before
authorMike Marciniszyn <mike.marciniszyn@intel.com>
Tue, 29 May 2012 20:12:16 +0000 (16:12 -0400)
committerMike Marciniszyn <mike.marciniszyn@intel.com>
Tue, 29 May 2012 20:12:16 +0000 (16:12 -0400)
queuecommand changed in 2.6.37 and again before that.

Add in KERNEL_VERSION aware changes to detect the
kernel differences.

Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
01-srp_queue_command.patch [new file with mode: 0644]
patches/01-srp_queue_command.patch [new file with mode: 0644]

diff --git a/01-srp_queue_command.patch b/01-srp_queue_command.patch
new file mode 100644 (file)
index 0000000..f4a8a57
--- /dev/null
@@ -0,0 +1,52 @@
+diff -rup a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
+--- a/drivers/infiniband/ulp/srp/ib_srp.c      2012-05-29 13:39:21.000000000 -0400
++++ b/drivers/infiniband/ulp/srp/ib_srp.c      2012-05-29 13:50:43.000000000 -0400
+@@ -1236,7 +1236,15 @@ static void srp_send_completion(struct i
+       }
+ }
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,37))
+ static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd)
++#elif ((LINUX_VERSION_CODE == KERNEL_VERSION(2,6,37))
++static int srp_queuecommand_lck(struct scsi_cmnd *scmnd,
++                                              void (*done)(struct scsi_cmnd *))
++#else
++static int srp_queuecommand(struct scsi_cmnd *scmnd,
++                                              void (*done)(struct scsi_cmnd *))
++#endif
+ {
+       struct srp_target_port *target = host_to_target(shost);
+       struct srp_request *req;
+@@ -1252,7 +1260,11 @@ static int srp_queuecommand(struct Scsi_
+       if (target->state == SRP_TARGET_DEAD ||
+           target->state == SRP_TARGET_REMOVED) {
+               scmnd->result = DID_BAD_TARGET << 16;
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,37))
+               scmnd->scsi_done(scmnd);
++#else
++              done(scmnd);
++#endif
+               return 0;
+       }
+@@ -1269,6 +1281,9 @@ static int srp_queuecommand(struct Scsi_
+       ib_dma_sync_single_for_cpu(dev, iu->dma, target->max_iu_len,
+                                  DMA_TO_DEVICE);
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37))
++      scmnd->scsi_done     = done;
++#endif
+       scmnd->result        = 0;
+       scmnd->host_scribble = (void *) req;
+@@ -1316,6 +1331,10 @@ err:
+       return SCSI_MLQUEUE_HOST_BUSY;
+ }
++#if ((LINUX_VERSION_CODE == KERNEL_VERSION(2,6,37))
++static DEF_SCSI_QCMD(srp_queuecommand)
++#endif
++
+ static int srp_alloc_iu_bufs(struct srp_target_port *target)
+ {
+       int i;
diff --git a/patches/01-srp_queue_command.patch b/patches/01-srp_queue_command.patch
new file mode 100644 (file)
index 0000000..1f963c0
--- /dev/null
@@ -0,0 +1,66 @@
+IB/srp: backport queue command to 2.6.37 and before
+
+queuecommand changed in 2.6.37 and again before that.
+
+Add in KERNEL_VERSION aware changes to detect the
+kernel differences.
+
+Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
+diff -rup a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
+--- a/drivers/infiniband/ulp/srp/ib_srp.c      2012-05-29 13:39:21.000000000 -0400
++++ b/drivers/infiniband/ulp/srp/ib_srp.c      2012-05-29 14:12:57.000000000 -0400
+@@ -1236,9 +1236,21 @@ static void srp_send_completion(struct i
+       }
+ }
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,37))
+ static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd)
++#elif (LINUX_VERSION_CODE == KERNEL_VERSION(2,6,37))
++static int srp_queuecommand_lck(struct scsi_cmnd *scmnd,
++                                              void (*done)(struct scsi_cmnd *))
++#else
++static int srp_queuecommand(struct scsi_cmnd *scmnd,
++                                              void (*done)(struct scsi_cmnd *))
++#endif
+ {
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,37))
+       struct srp_target_port *target = host_to_target(shost);
++#else
++      struct srp_target_port *target = host_to_target(scmnd->device->host);
++#endif
+       struct srp_request *req;
+       struct srp_iu *iu;
+       struct srp_cmd *cmd;
+@@ -1252,7 +1264,11 @@ static int srp_queuecommand(struct Scsi_
+       if (target->state == SRP_TARGET_DEAD ||
+           target->state == SRP_TARGET_REMOVED) {
+               scmnd->result = DID_BAD_TARGET << 16;
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,37))
+               scmnd->scsi_done(scmnd);
++#else
++              done(scmnd);
++#endif
+               return 0;
+       }
+@@ -1269,6 +1285,9 @@ static int srp_queuecommand(struct Scsi_
+       ib_dma_sync_single_for_cpu(dev, iu->dma, target->max_iu_len,
+                                  DMA_TO_DEVICE);
++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,37))
++      scmnd->scsi_done     = done;
++#endif
+       scmnd->result        = 0;
+       scmnd->host_scribble = (void *) req;
+@@ -1316,6 +1335,10 @@ err:
+       return SCSI_MLQUEUE_HOST_BUSY;
+ }
++#if (LINUX_VERSION_CODE == KERNEL_VERSION(2,6,37))
++static DEF_SCSI_QCMD(srp_queuecommand)
++#endif
++
+ static int srp_alloc_iu_bufs(struct srp_target_port *target)
+ {
+       int i;