Lines Matching refs:reqlist
356 struct xbb_xen_reqlist *reqlist; member
541 struct xbb_xen_reqlist *reqlist, int operation,
889 xbb_reqlist_vaddr(struct xbb_xen_reqlist *reqlist, int pagenr, int sector) in xbb_reqlist_vaddr() argument
891 return (reqlist->kva + (PAGE_SIZE * pagenr) + (sector << 9)); in xbb_reqlist_vaddr()
907 xbb_reqlist_bounce_addr(struct xbb_xen_reqlist *reqlist, int pagenr, int sector) in xbb_reqlist_bounce_addr() argument
909 return (reqlist->bounce + (PAGE_SIZE * pagenr) + (sector << 9)); in xbb_reqlist_bounce_addr()
930 xbb_reqlist_ioaddr(struct xbb_xen_reqlist *reqlist, int pagenr, int sector) in xbb_reqlist_ioaddr() argument
933 return (xbb_reqlist_bounce_addr(reqlist, pagenr, sector)); in xbb_reqlist_ioaddr()
935 return (xbb_reqlist_vaddr(reqlist, pagenr, sector)); in xbb_reqlist_ioaddr()
957 xbb_get_gntaddr(struct xbb_xen_reqlist *reqlist, int pagenr, int sector) in xbb_get_gntaddr() argument
961 xbb = reqlist->xbb; in xbb_get_gntaddr()
964 (uintptr_t)(reqlist->kva - xbb->kva) + in xbb_get_gntaddr()
1085 xbb_unmap_reqlist(struct xbb_xen_reqlist *reqlist) in xbb_unmap_reqlist() argument
1093 for (i = 0; i < reqlist->nr_segments; i++) { in xbb_unmap_reqlist()
1094 if (reqlist->gnt_handles[i] == GRANT_REF_INVALID) in xbb_unmap_reqlist()
1097 unmap[invcount].host_addr = xbb_get_gntaddr(reqlist, i, 0); in xbb_unmap_reqlist()
1099 unmap[invcount].handle = reqlist->gnt_handles[i]; in xbb_unmap_reqlist()
1100 reqlist->gnt_handles[i] = GRANT_REF_INVALID; in xbb_unmap_reqlist()
1120 struct xbb_xen_reqlist *reqlist; in xbb_get_reqlist() local
1122 reqlist = NULL; in xbb_get_reqlist()
1126 if ((reqlist = STAILQ_FIRST(&xbb->reqlist_free_stailq)) != NULL) { in xbb_get_reqlist()
1128 reqlist->flags = XBB_REQLIST_NONE; in xbb_get_reqlist()
1129 reqlist->kva = NULL; in xbb_get_reqlist()
1130 reqlist->status = BLKIF_RSP_OKAY; in xbb_get_reqlist()
1131 reqlist->residual_512b_sectors = 0; in xbb_get_reqlist()
1132 reqlist->num_children = 0; in xbb_get_reqlist()
1133 reqlist->nr_segments = 0; in xbb_get_reqlist()
1134 STAILQ_INIT(&reqlist->contig_req_list); in xbb_get_reqlist()
1137 return (reqlist); in xbb_get_reqlist()
1149 xbb_release_reqlist(struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist, in xbb_release_reqlist() argument
1160 if (reqlist->kva != NULL) in xbb_release_reqlist()
1161 xbb_free_kva(xbb, reqlist->kva, reqlist->nr_segments); in xbb_release_reqlist()
1163 xbb_release_reqs(xbb, &reqlist->contig_req_list, reqlist->num_children); in xbb_release_reqlist()
1165 STAILQ_INSERT_TAIL(&xbb->reqlist_free_stailq, reqlist, links); in xbb_release_reqlist()
1192 xbb_get_resources(struct xbb_softc *xbb, struct xbb_xen_reqlist **reqlist, in xbb_get_resources() argument
1215 if (*reqlist == NULL) { in xbb_get_resources()
1228 if (*reqlist == NULL) { in xbb_get_resources()
1229 *reqlist = nreqlist; in xbb_get_resources()
1236 nreq->reqlist = *reqlist; in xbb_get_resources()
1250 STAILQ_INSERT_TAIL(&(*reqlist)->contig_req_list, nreq, links); in xbb_get_resources()
1251 (*reqlist)->num_children++; in xbb_get_resources()
1252 (*reqlist)->nr_segments += ring_req->nr_segments; in xbb_get_resources()
1388 xbb_complete_reqlist(struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist) in xbb_complete_reqlist() argument
1396 if (reqlist->flags & XBB_REQLIST_MAPPED) in xbb_complete_reqlist()
1397 xbb_unmap_reqlist(reqlist); in xbb_complete_reqlist()
1410 STAILQ_FOREACH(nreq, &reqlist->contig_req_list, links) { in xbb_complete_reqlist()
1414 xbb_queue_response(xbb, nreq, reqlist->status); in xbb_complete_reqlist()
1417 if (reqlist->status == BLKIF_RSP_OKAY) in xbb_complete_reqlist()
1426 reqlist->ds_tag_type, in xbb_complete_reqlist()
1427 reqlist->ds_trans_type, in xbb_complete_reqlist()
1437 sectors_sent -= reqlist->residual_512b_sectors; in xbb_complete_reqlist()
1443 reqlist->ds_tag_type, in xbb_complete_reqlist()
1444 reqlist->ds_trans_type, in xbb_complete_reqlist()
1446 /*then*/&reqlist->ds_t0); in xbb_complete_reqlist()
1448 xbb_release_reqlist(xbb, reqlist, /*wakeup*/ 1); in xbb_complete_reqlist()
1472 struct xbb_xen_reqlist *reqlist; in xbb_bio_done() local
1474 reqlist = bio->bio_caller1; in xbb_bio_done()
1475 xbb = reqlist->xbb; in xbb_bio_done()
1477 reqlist->residual_512b_sectors += bio->bio_resid >> 9; in xbb_bio_done()
1498 reqlist->status = BLKIF_RSP_ERROR; in xbb_bio_done()
1516 - (vm_offset_t)reqlist->bounce; in xbb_bio_done()
1517 memcpy((uint8_t *)reqlist->kva + kva_offset, in xbb_bio_done()
1526 if (atomic_fetchadd_int(&reqlist->pendcnt, -1) == 1) in xbb_bio_done()
1527 xbb_complete_reqlist(xbb, reqlist); in xbb_bio_done()
1547 xbb_dispatch_io(struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist) in xbb_dispatch_io() argument
1563 reqlist->ds_tag_type = DEVSTAT_TAG_SIMPLE; in xbb_dispatch_io()
1573 reqlist->kva = NULL; in xbb_dispatch_io()
1574 if (reqlist->nr_segments != 0) { in xbb_dispatch_io()
1575 reqlist->kva = xbb_get_kva(xbb, reqlist->nr_segments); in xbb_dispatch_io()
1576 if (reqlist->kva == NULL) { in xbb_dispatch_io()
1584 binuptime(&reqlist->ds_t0); in xbb_dispatch_io()
1585 devstat_start_transaction(xbb->xbb_stats, &reqlist->ds_t0); in xbb_dispatch_io()
1587 switch (reqlist->operation) { in xbb_dispatch_io()
1590 reqlist->ds_tag_type = DEVSTAT_TAG_ORDERED; in xbb_dispatch_io()
1594 reqlist->ds_trans_type = DEVSTAT_WRITE; in xbb_dispatch_io()
1598 reqlist->status = BLKIF_RSP_ERROR; in xbb_dispatch_io()
1604 reqlist->ds_trans_type = DEVSTAT_READ; in xbb_dispatch_io()
1630 reqlist->ds_tag_type = DEVSTAT_TAG_ORDERED; in xbb_dispatch_io()
1631 reqlist->ds_trans_type = DEVSTAT_NO_DATA; in xbb_dispatch_io()
1636 reqlist->operation); in xbb_dispatch_io()
1637 reqlist->status = BLKIF_RSP_ERROR; in xbb_dispatch_io()
1641 reqlist->xbb = xbb; in xbb_dispatch_io()
1646 STAILQ_FOREACH(nreq, &reqlist->contig_req_list, links) { in xbb_dispatch_io()
1665 reqlist->status = BLKIF_RSP_ERROR; in xbb_dispatch_io()
1688 reqlist->status = BLKIF_RSP_ERROR; in xbb_dispatch_io()
1693 map->host_addr = xbb_get_gntaddr(reqlist, in xbb_dispatch_io()
1726 reqlist->status = BLKIF_RSP_ERROR; in xbb_dispatch_io()
1732 xbb->maps, reqlist->nr_segments); in xbb_dispatch_io()
1736 reqlist->flags |= XBB_REQLIST_MAPPED; in xbb_dispatch_io()
1738 for (seg_idx = 0, map = xbb->maps; seg_idx < reqlist->nr_segments; in xbb_dispatch_io()
1747 reqlist->status = BLKIF_RSP_ERROR; in xbb_dispatch_io()
1751 reqlist->gnt_handles[seg_idx] = map->handle; in xbb_dispatch_io()
1753 if (reqlist->starting_sector_number + total_sects > in xbb_dispatch_io()
1758 reqlist->starting_sector_number, in xbb_dispatch_io()
1759 reqlist->starting_sector_number + total_sects, in xbb_dispatch_io()
1761 reqlist->status = BLKIF_RSP_ERROR; in xbb_dispatch_io()
1768 reqlist, in xbb_dispatch_io()
1773 reqlist->status = BLKIF_RSP_ERROR; in xbb_dispatch_io()
1781 xbb_complete_reqlist(xbb, reqlist); in xbb_dispatch_io()
1823 struct xbb_xen_reqlist *reqlist; in xbb_run_queue() local
1847 reqlist = STAILQ_LAST(&xbb->reqlist_pending_stailq, in xbb_run_queue()
1849 if (reqlist != NULL) { in xbb_run_queue()
1850 cur_sector = reqlist->next_contig_sector; in xbb_run_queue()
1851 cur_operation = reqlist->operation; in xbb_run_queue()
1922 if ((reqlist != NULL) in xbb_run_queue()
1927 || ((ring_req->nr_segments + reqlist->nr_segments) > in xbb_run_queue()
1929 reqlist = NULL; in xbb_run_queue()
1938 retval = xbb_get_resources(xbb, &reqlist, ring_req, in xbb_run_queue()
1967 reqlist->next_contig_sector = cur_sector; in xbb_run_queue()
1972 reqlist = STAILQ_FIRST(&xbb->reqlist_pending_stailq); in xbb_run_queue()
1973 if (reqlist == NULL) { in xbb_run_queue()
1987 retval = xbb_dispatch_io(xbb, reqlist); in xbb_run_queue()
1997 reqlist, links); in xbb_run_queue()
2011 reqlist = STAILQ_FIRST(&xbb->reqlist_pending_stailq); in xbb_run_queue()
2013 if (reqlist != NULL) in xbb_run_queue()
2061 xbb_dispatch_dev(struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist, in xbb_dispatch_dev() argument
2076 bio_offset = (off_t)reqlist->starting_sector_number in xbb_dispatch_dev()
2096 bio->bio_caller1 = reqlist; in xbb_dispatch_dev()
2099 reqlist->pendcnt = 1; in xbb_dispatch_dev()
2111 nseg = reqlist->nr_segments; in xbb_dispatch_dev()
2153 bio->bio_data = xbb_reqlist_ioaddr(reqlist, seg_idx, in xbb_dispatch_dev()
2156 bio->bio_caller1 = reqlist; in xbb_dispatch_dev()
2181 reqlist->pendcnt = nbio; in xbb_dispatch_dev()
2189 - (vm_offset_t)reqlist->bounce; in xbb_dispatch_dev()
2192 (uint8_t *)reqlist->kva + kva_offset, in xbb_dispatch_dev()
2237 xbb_dispatch_file(struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist, in xbb_dispatch_file() argument
2284 xuio.uio_offset = (vm_offset_t)reqlist->starting_sector_number in xbb_dispatch_file()
2290 nseg = reqlist->nr_segments; in xbb_dispatch_file()
2303 xiovec->iov_base = xbb_reqlist_ioaddr(reqlist, in xbb_dispatch_file()
2314 *p_vaddr = xbb_reqlist_vaddr(reqlist, seg_idx, in xbb_dispatch_file()
2456 reqlist->status = BLKIF_RSP_ERROR; in xbb_dispatch_file()
2458 xbb_complete_reqlist(xbb, reqlist); in xbb_dispatch_file()
2823 struct xbb_xen_reqlist *reqlist; in xbb_disconnect() local
2827 for (i = 0, reqlist = xbb->request_lists; in xbb_disconnect()
2828 i < xbb->max_requests; i++, reqlist++){ in xbb_disconnect()
2830 if (reqlist->bounce != NULL) { in xbb_disconnect()
2831 free(reqlist->bounce, M_XENBLOCKBACK); in xbb_disconnect()
2832 reqlist->bounce = NULL; in xbb_disconnect()
2835 if (reqlist->gnt_handles != NULL) { in xbb_disconnect()
2836 free(reqlist->gnt_handles, M_XENBLOCKBACK); in xbb_disconnect()
2837 reqlist->gnt_handles = NULL; in xbb_disconnect()
3191 struct xbb_xen_reqlist *reqlist; in xbb_alloc_request_lists() local
3211 reqlist = &xbb->request_lists[i]; in xbb_alloc_request_lists()
3213 reqlist->xbb = xbb; in xbb_alloc_request_lists()
3216 reqlist->bounce = malloc(xbb->max_reqlist_size, in xbb_alloc_request_lists()
3218 if (reqlist->bounce == NULL) { in xbb_alloc_request_lists()
3226 reqlist->gnt_handles = malloc(xbb->max_reqlist_segments * in xbb_alloc_request_lists()
3227 sizeof(*reqlist->gnt_handles), in xbb_alloc_request_lists()
3229 if (reqlist->gnt_handles == NULL) { in xbb_alloc_request_lists()
3237 reqlist->gnt_handles[seg] = GRANT_REF_INVALID; in xbb_alloc_request_lists()
3239 STAILQ_INSERT_TAIL(&xbb->reqlist_free_stailq, reqlist, links); in xbb_alloc_request_lists()