From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bart Van Assche Subject: [PATCH RFC] scsi_tcq.h: Add support for multiple hardware queues Date: Wed, 01 Oct 2014 18:14:38 +0200 Message-ID: <542C286E.6080603@acm.org> References: <541C27BF.6070609@acm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <541C27BF.6070609-HInyCGIudOg@public.gmane.org> Sender: linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: "linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" Cc: linux-rdma , Christoph Hellwig , Jens Axboe , Robert Elliott , Ming Lei List-Id: linux-rdma@vger.kernel.org The eight patches I had posted so far did not modify the tag lookup functions in include/scsi/scsi_tcq.h. However, these functions have to be modified in order to become usable in SCSI LLDs that support multiple hardware queues. How about the patch below, which adds support for multiqueue tag lookup without requiring any modifications in existing SCSI LLD drivers ? --- include/scsi/scsi_tcq.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h index e645835..8e3bec34 100644 --- a/include/scsi/scsi_tcq.h +++ b/include/scsi/scsi_tcq.h @@ -111,18 +111,21 @@ static inline int scsi_populate_tag_msg(struct scsi_cmnd *cmd, char *msg) } static inline struct scsi_cmnd *scsi_mq_find_tag(struct Scsi_Host *shost, - unsigned int hw_ctx, int tag) + int tag) { + struct blk_mq_tag mq_tag = { tag }; + u16 hwq = blk_mq_tag_to_hwq(mq_tag); struct request *req; - req = blk_mq_tag_to_rq(shost->tag_set.tags[hw_ctx], tag); + req = blk_mq_tag_to_rq(shost->tag_set.tags[hwq], + blk_mq_tag_to_tag(mq_tag)); return req ? (struct scsi_cmnd *)req->special : NULL; } /** * scsi_find_tag - find a tagged command by device * @SDpnt: pointer to the ScSI device - * @tag: the tag number + * @tag: tag generated by blk_get_mq_tag() * * Notes: * Only works with tags allocated by the generic blk layer. @@ -133,9 +136,9 @@ static inline struct scsi_cmnd *scsi_find_tag(struct scsi_device *sdev, int tag) if (tag != SCSI_NO_TAG) { if (shost_use_blk_mq(sdev->host)) - return scsi_mq_find_tag(sdev->host, 0, tag); + return scsi_mq_find_tag(sdev->host, tag); - req = blk_queue_find_tag(sdev->request_queue, tag); + req = blk_queue_find_tag(sdev->request_queue, tag); return req ? (struct scsi_cmnd *)req->special : NULL; } @@ -174,7 +177,7 @@ static inline int scsi_init_shared_tag_map(struct Scsi_Host *shost, int depth) /** * scsi_host_find_tag - find the tagged command by host * @shost: pointer to scsi_host - * @tag: tag of the scsi_cmnd + * @tag: tag generated by blk_get_mq_tag() * * Notes: * Only works with tags allocated by the generic blk layer. @@ -186,7 +189,7 @@ static inline struct scsi_cmnd *scsi_host_find_tag(struct Scsi_Host *shost, if (tag != SCSI_NO_TAG) { if (shost_use_blk_mq(shost)) - return scsi_mq_find_tag(shost, 0, tag); + return scsi_mq_find_tag(shost, tag); req = blk_map_queue_find_tag(shost->bqt, tag); return req ? (struct scsi_cmnd *)req->special : NULL; } -- 1.8.4.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html