On 22/02/2021 13:24, Hannes Reinecke wrote:
@ -4398,9 +4397,9 @@ static int pm8001_chip_reg_dev_req(struct pm8001_hba_info *pm8001_ha,
circularQ = &pm8001_ha->inbnd_q_tbl[0];
memset(&payload, 0, sizeof(payload));
- rc = pm8001_tag_alloc(pm8001_ha, &tag);
- if (rc)
- return rc;
+ tag = pm8001_tag_alloc(pm8001_ha, dev);
+ if (tag == -1)
+ return -SAS_QUEUE_FULL;
ccb = &pm8001_ha->ccb_info[tag];
ccb->device = pm8001_dev;
ccb->ccb_tag = tag;
@@ -4434,6 +4433,8 @@ static int pm8001_chip_reg_dev_req(struct pm8001_hba_info *pm8001_ha,
SAS_ADDR_SIZE);
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload,
sizeof(payload), 0);
So this above code means that we send on queue #0 always.
However, since we hope to use managed interrupt in the future, the
interrupt for queue may be offline.
That's why I don't like storing a tag in sas_task structure. We already
can get it elsewhere in the structure.
I would rather get it from sas_task.slow_task in this case, which saves
the request/scsi_cmd pointer, and we can use blk_mq_unique_tag_to_hwq()
here to get the tag and queue index.
Thanks,
John
+ if (rc)
+ pm8001_tag_free(pm8001_ha, tag);
return rc;
}