return rc;
}
EXPORT_SYMBOL_GPL(ata_sas_queuecmd);
- tag = tag < max_queue ? tag : 0;
+
+ int ata_sas_allocate_tag(struct ata_port *ap)
+ {
+ unsigned int max_queue = ap->host->n_tags;
+ unsigned int i, tag;
+
+ for (i = 0, tag = ap->sas_last_tag + 1; i < max_queue; i++, tag++) {
++ if (ap->flags & ATA_FLAG_LOWTAG)
++ tag = 1;
++ else
++ tag = tag < max_queue ? tag : 0;
+
+ /* the last tag is reserved for internal command. */
+ if (tag == ATA_TAG_INTERNAL)
+ continue;
+
+ if (!test_and_set_bit(tag, &ap->sas_tag_allocated)) {
+ ap->sas_last_tag = tag;
+ return tag;
+ }
+ }
+ return -1;
+ }
+
+ void ata_sas_free_tag(unsigned int tag, struct ata_port *ap)
+ {
+ clear_bit(tag, &ap->sas_tag_allocated);
+ }
cmd->fn = handler;
cmd->ctx = ctx;
cmd->aborted = 0;
+ blk_mq_start_request(blk_mq_rq_from_pdu(cmd));
}
+ static void *iod_get_private(struct nvme_iod *iod)
+ {
+ return (void *) (iod->private & ~0x1UL);
+ }
+
+ /*
+ * If bit 0 is set, the iod is embedded in the request payload.
+ */
+ static bool iod_should_kfree(struct nvme_iod *iod)
+ {
+ return (iod->private & 0x01) == 0;
+ }
+
/* Special values must be less than 0x1000 */
#define CMD_CTX_BASE ((void *)POISON_POINTER_DELTA)
#define CMD_CTX_CANCELLED (0x30C + CMD_CTX_BASE)