Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178213540
D62308.1796265799.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D62308.1796265799.diff
View Options
diff --git a/sys/dev/ufshci/ufshci_req_queue.c b/sys/dev/ufshci/ufshci_req_queue.c
--- a/sys/dev/ufshci/ufshci_req_queue.c
+++ b/sys/dev/ufshci/ufshci_req_queue.c
@@ -398,15 +398,10 @@
req->request_upiu.header.task_tag,
("response task_tag does not match request task_tag\n"));
- if (!retry) {
- if (req->payload_valid) {
- bus_dmamap_sync(req_queue->dma_tag_payload,
- tr->payload_dma_map,
- BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
- }
- /* Copy response from the command descriptor */
- if (req->cb_fn)
- req->cb_fn(req->cb_arg, &cpl, error);
+ if (!retry && req->payload_valid) {
+ bus_dmamap_sync(req_queue->dma_tag_payload,
+ tr->payload_dma_map,
+ BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
}
mtx_lock(&hwq->qlock);
@@ -418,26 +413,35 @@
req->retries++;
ufshci_req_queue_submit_tracker(req_queue, tr,
req->data_direction);
- } else {
- if (req->payload_valid) {
- bus_dmamap_unload(req_queue->dma_tag_payload,
- tr->payload_dma_map);
- }
+ mtx_unlock(&hwq->qlock);
+ return;
+ }
+
+ if (req->payload_valid) {
+ bus_dmamap_unload(req_queue->dma_tag_payload,
+ tr->payload_dma_map);
+ }
- /* Clear tracker */
- ufshci_free_request(req);
- tr->req = NULL;
- tr->slot_state = UFSHCI_SLOT_STATE_FREE;
+ /*
+ * Free the slot before the callback. CAM sends its next request
+ * from inside the callback, and with every slot in use that
+ * request needs this one.
+ */
+ tr->req = NULL;
+ tr->slot_state = UFSHCI_SLOT_STATE_FREE;
- TAILQ_REMOVE(&hwq->outstanding_tr, tr, tailq);
- TAILQ_INSERT_HEAD(&hwq->free_tr, tr, tailq);
+ TAILQ_REMOVE(&hwq->outstanding_tr, tr, tailq);
+ TAILQ_INSERT_HEAD(&hwq->free_tr, tr, tailq);
- /* A slot came free, so the next held I/O can go out. */
- if (req_queue->ctrlr->io_ready && !req_queue->ctrlr->is_failed)
- ufshci_req_queue_submit_queued(hwq);
- }
+ /* A slot came free, so the next held I/O can go out. */
+ if (req_queue->ctrlr->io_ready && !req_queue->ctrlr->is_failed)
+ ufshci_req_queue_submit_queued(hwq);
- mtx_unlock(&tr->hwq->qlock);
+ mtx_unlock(&hwq->qlock);
+
+ if (req->cb_fn)
+ req->cb_fn(req->cb_arg, &cpl, error);
+ ufshci_free_request(req);
}
bool
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 3, 2:43 AM (21 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42164328
Default Alt Text
D62308.1796265799.diff (2 KB)
Attached To
Mode
D62308: ufshci: free the slot before the completion callback
Attached
Detach File
Event Timeline