From: Mike Marciniszyn Date: Wed, 30 May 2012 15:53:40 +0000 (-0400) Subject: IB/srp: backport queue command to 2.6.37 and before X-Git-Tag: vofed-3.5-x~80^2 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=af0157b6654f9275f1e9c046eb1e757dc55289d7;p=~emulex%2Fcompat-rdma_3.12.git 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 --- diff --git a/patches/01-srp_queue_command.patch b/patches/01-srp_queue_command.patch new file mode 100644 index 0000000..1f963c0 --- /dev/null +++ b/patches/01-srp_queue_command.patch @@ -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 +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;