Lines Matching defs:io
91 static int32_t ocs_task_set_full_or_busy(ocs_io_t *io);
111 static inline void ocs_target_io_free(ocs_io_t *io)
113 io->tgt_io.state = OCS_CAM_IO_FREE;
114 io->tgt_io.flags = 0;
115 io->tgt_io.app = NULL;
116 ocs_scsi_io_complete(io);
117 if(io->ocs->io_in_use != 0)
118 atomic_subtract_acq_32(&io->ocs->io_in_use, 1);
540 * @param io pointer to IO context
548 int32_t ocs_scsi_recv_cmd(ocs_io_t *io, uint64_t lun, uint8_t *cdb,
551 ocs_t *ocs = io->ocs;
553 ocs_node_t *node = io->node;
566 /* set target io timeout */
567 io->timeout = ocs->target_io_timer_sec;
571 return ocs_task_set_full_or_busy(io);
573 atomic_store_rel_32(&io->node->tgt_node.busy_sent, FALSE);
594 atio->tag_id = io->tag;
595 atio->ccb_h.ccb_io_ptr = io;
613 io->tgt_io.flags = 0;
614 io->tgt_io.state = OCS_CAM_IO_COMMAND;
615 io->tgt_io.lun = lun;
625 be16toh(io->init_task_tag));
627 io->tgt_io.state = OCS_CAM_IO_MAX;
628 ocs_target_io_free(io);
640 * @param io pointer to IO context
650 int32_t ocs_scsi_recv_cmd_first_burst(ocs_io_t *io, uint64_t lun, uint8_t *cdb,
703 device_printf(tmfio->ocs->dev, "%s: io=%u(index) cmd=%#x LU=%lx en=%s\n",
1225 * @param io pointer to SCSI IO object
1230 ocs_scsi_tgt_io_init(ocs_io_t *io)
1238 * Uninitialize target server private data in a SCSI io object
1240 * @param io pointer to SCSI IO object
1245 ocs_scsi_tgt_io_exit(ocs_io_t *io)
1257 * @param io pointer to SCSI IO object
1262 ocs_scsi_ini_io_init(ocs_io_t *io)
1270 * Uninitialize initiator client private data in a SCSI io object
1272 * @param io pointer to SCSI IO object
1277 ocs_scsi_ini_io_exit(ocs_io_t *io)
1293 ocs_task_set_full_or_busy_cb(ocs_io_t *io, ocs_scsi_io_status_e scsi_status,
1297 ocs_target_io_free(io);
1308 * @param io pointer to IO context
1314 ocs_task_set_full_or_busy(ocs_io_t *io)
1317 ocs_t *ocs = io->ocs;
1326 if (atomic_cmpset_acq_32(&io->node->tgt_node.busy_sent, FALSE, TRUE)) {
1329 io->node->display_name, io->tag,
1330 io->ocs->io_in_use, io->ocs->io_high_watermark);
1333 printf("%s: full tag=%x iiu=%d\n", __func__, io->tag,
1334 io->ocs->io_in_use);
1353 ocs_scsi_send_resp(io, 0, &rsp, ocs_task_set_full_or_busy_cb, NULL);
1360 * @param io
1367 static int32_t ocs_scsi_target_io_cb(ocs_io_t *io,
1389 bus_dmamap_sync(ocs->buf_dmat, io->tgt_io.dmap, op);
1390 if (io->tgt_io.flags & OCS_CAM_IO_F_DMAPPED) {
1391 bus_dmamap_unload(ocs->buf_dmat, io->tgt_io.dmap);
1395 if (io->tgt_io.sendresp) {
1396 io->tgt_io.sendresp = 0;
1398 io->tgt_io.state = OCS_CAM_IO_RESP;
1404 resp.residual = io->exp_xfer_len - io->transferred;
1406 return ocs_scsi_send_resp(io, 0, &resp, ocs_scsi_target_io_cb, ccb);
1421 if ((io->tgt_io.flags & OCS_CAM_IO_F_ABORT_NOTIFY) == 0) {
1422 ocs_target_io_free(io);
1425 io->tgt_io.state = OCS_CAM_IO_DATA_DONE;
1427 __func__, io->tgt_io.state, io->tag);*/
1441 ocs_io_abort_cb(ocs_io_t *io, ocs_scsi_io_status_e scsi_status, uint32_t flags, void *arg)
1448 ocs = io->ocs;
1450 io->tgt_io.flags &= ~OCS_CAM_IO_F_ABORT_DEV;
1475 * @param io
1483 static int32_t ocs_scsi_initiator_io_cb(ocs_io_t *io,
1503 bus_dmamap_sync(ocs->buf_dmat, io->tgt_io.dmap, op);
1504 if (io->tgt_io.flags & OCS_CAM_IO_F_DMAPPED) {
1505 bus_dmamap_unload(ocs->buf_dmat, io->tgt_io.dmap);
1602 ocs_scsi_io_free(io);
1669 * @param io pointer to the previously allocated IO object
1676 ocs_build_scsi_sgl(struct ocs_softc *ocs, union ccb *ccb, ocs_io_t *io,
1682 if (!ocs || !ccb || !io || !sgl) {
1684 ocs, ccb, io, sgl);
1688 io->tgt_io.flags &= ~OCS_CAM_IO_F_DMAPPED;
1695 err = bus_dmamap_load_ccb(ocs->buf_dmat, io->tgt_io.dmap, ccb,
1705 io->tgt_io.flags |= OCS_CAM_IO_F_DMAPPED;
1722 ocs_io_t *io = NULL;
1728 io = ocs_scsi_find_io(ocs, csio->tag_id);
1729 if (io == NULL) {
1736 if (io->tgt_io.flags & OCS_CAM_IO_F_ABORT_RECV) {
1739 __func__, io->tgt_io.state, io->tag, io->init_task_tag,
1740 io->tgt_io.flags);*/
1741 io->tgt_io.flags |= OCS_CAM_IO_F_ABORT_CAM;
1745 ocs_target_io_free(io);
1754 io->tgt_io.app = ccb;
1760 csio->ccb_h.ccb_io_ptr = io;
1767 io->tgt_io.state = OCS_CAM_IO_RESP;
1776 resp.residual = io->exp_xfer_len - io->transferred;
1777 rc = ocs_scsi_send_resp(io, 0, &resp, ocs_scsi_target_io_cb, ccb);
1783 io->tgt_io.state = OCS_CAM_IO_DATA;
1786 io->tgt_io.sendresp = 1;
1788 sgl = io->sgl;
1790 sgl_count = ocs_build_scsi_sgl(ocs, ccb, io, sgl, io->sgl_allocated);
1793 rc = ocs_scsi_send_rd_data(io, 0, NULL, sgl,
1797 rc = ocs_scsi_recv_wr_data(io, 0, NULL, sgl,
1823 io->tgt_io.state = OCS_CAM_IO_DATA_DONE;
1825 __func__, io->tgt_io.state, io->tag);
1827 ocs_target_io_free(io);
1835 ocs_target_tmf_cb(ocs_io_t *io, ocs_scsi_io_status_e scsi_status, uint32_t flags,
1839 /*device_printf(io->ocs->dev, "%s: tag=%x io=%p s=%#x\n",
1840 __func__, io->tag, io, scsi_status);*/
1841 ocs_scsi_io_complete(io);
1862 ocs_io_t *io = NULL;
1894 io = ocs_scsi_io_alloc(node, OCS_SCSI_IO_ROLE_ORIGINATOR);
1895 if (io == NULL) {
1902 io->tgt_io.app = ccb;
1905 csio->ccb_h.ccb_io_ptr = io;
1906 sgl = io->sgl;
1908 sgl_count = ocs_build_scsi_sgl(ocs, ccb, io, sgl, io->sgl_allocated);
1910 ocs_scsi_io_free(io);
1916 io->timeout = 0;
1918 io->timeout = OCS_CAM_IO_TIMEOUT;
1921 io->timeout = 1;
1923 io->timeout = ccb->ccb_h.timeout / 1000;
1948 rc = ocs_scsi_send_nodata_io(node, io, ccb_h->target_lun,
1955 rc = ocs_scsi_send_rd_io(node, io, ccb_h->target_lun,
1964 rc = ocs_scsi_send_wr_io(node, io, ccb_h->target_lun,
2369 ocs_io_t *io = NULL;
2382 io = ocs_scsi_io_alloc(node, OCS_SCSI_IO_ROLE_ORIGINATOR);
2383 if (io == NULL) {
2391 rc = ocs_scsi_send_tmf(node, io, NULL, ccb_h->target_lun,
2495 ocs_io_t *io = NULL;
2499 io = ocs_scsi_find_io(ocs, ccb->cna2.tag_id);
2500 if (io == NULL) {
2509 abortio = io->tgt_io.app;
2519 ocs_scsi_send_tmf_resp(io,
2559 ocs_initiator_tmf_cb(ocs_io_t *io, ocs_scsi_io_status_e scsi_status,
2570 ocs_log_test(io->ocs, "check response without data?!?\n");
2576 ocs_log_test(io->ocs, "TMF status %08x\n",
2583 ocs_log_test(io->ocs, "status=%#x\n", scsi_status);
2587 ocs_scsi_io_free(io);
2704 device_printf(ocs->dev, "%s: abort not received or io completed \n", __func__);
2751 ocs_io_t *io = NULL;
2765 io = ocs_scsi_io_alloc(node, OCS_SCSI_IO_ROLE_ORIGINATOR);
2766 if (io == NULL) {
2774 rc = ocs_scsi_send_tmf(node, io,
2805 //ocs_io_t *io = obj;
2835 ocs_io_t *io = obj;
2838 switch (io->tgt_io.state) {
2858 if (io->tgt_io.app) {
2860 ((union ccb *)(io->tgt_io.app))->ccb_h.flags);
2862 ((union ccb *)(io->tgt_io.app))->ccb_h.status);
2873 int32_t ocs_scsi_get_block_vaddr(ocs_io_t *io, uint64_t blocknumber,