Lines Matching full:ocs
34 * OCS Linux SCSI API base driver implementation.
41 #include "ocs.h"
49 #define SCSI_ITT_SIZE(ocs) ((ocs->ocs_xport == OCS_XPORT_FC) ? 4 : 8) argument
51 …IOFMT_ARGS(io) io->instance_index, SCSI_ITT_SIZE(io->ocs), io->init_task_tag, SCSI_ITT_SIZE(io->oc…
53 #define enable_tsend_auto_resp(ocs) ((ocs->ctrlmask & OCS_CTRLMASK_XPORT_DISABLE_AUTORSP_TSEND) ==… argument
54 #define enable_treceive_auto_resp(ocs) ((ocs->ctrlmask & OCS_CTRLMASK_XPORT_DISABLE_AUTORSP_TRECEIV… argument
56 #define scsi_io_printf(io, fmt, ...) ocs_log_info(io->ocs, "[%s]" SCSI_IOFMT fmt, \
61 if (OCS_LOG_ENABLE_SCSI_TRACE(io->ocs)) \
65 #define scsi_log(ocs, fmt, ...) \ argument
67 if (OCS_LOG_ENABLE_SCSI_TRACE(ocs)) \
68 ocs_log_info(ocs, fmt, ##__VA_ARGS__); \
81 static uint32_t ocs_scsi_dif_check_app_tag(ocs_t *ocs, ocs_hw_dif_info_t *dif_info, uint16_t exp_ap…
82 static uint32_t ocs_scsi_dif_check_ref_tag(ocs_t *ocs, ocs_hw_dif_info_t *dif_info, uint32_t exp_re…
83 static int32_t ocs_scsi_convert_dif_info(ocs_t *ocs, ocs_scsi_dif_info_t *scsi_dif_info,
170 ocs_t *ocs; in ocs_scsi_io_alloc() local
175 ocs_assert(node->ocs, NULL); in ocs_scsi_io_alloc()
177 ocs = node->ocs; in ocs_scsi_io_alloc()
178 ocs_assert(ocs->xport, NULL); in ocs_scsi_io_alloc()
179 xport = ocs->xport; in ocs_scsi_io_alloc()
188 io = ocs_io_alloc(ocs); in ocs_scsi_io_alloc()
199 ocs_log_err(node->ocs, "assertion failed: io->hio is not NULL\n"); in ocs_scsi_io_alloc()
200 ocs_io_free(ocs, io); in ocs_scsi_io_alloc()
206 io->ocs = ocs; in ocs_scsi_io_alloc()
249 ocs_t *ocs = io->ocs; in _ocs_scsi_io_free() local
269 ocs_io_free(ocs, io); in _ocs_scsi_io_free()
320 ocs_t *ocs; in ocs_target_io_cb() local
332 ocs = io->ocs; in ocs_target_io_cb()
333 ocs_assert(ocs); in ocs_target_io_cb()
433 ocs_scsi_check_pending(ocs); in ocs_target_io_cb()
503 ocs_t *ocs = io->ocs; in ocs_scsi_dif_check_unknown() local
520 …ocs_log_debug(ocs, "blocksize %d first check_block %" PRId64 " last_check_block %" PRId64 " check_… in ocs_scsi_dif_check_unknown()
526 ocs_log_test(ocs, "ocs_scsi_get_block_vaddr() failed: %d\n", addrlen_count); in ocs_scsi_dif_check_unknown()
532 ocs_log_debug(ocs, "block guard check error, lba %" PRId64 "\n", scsi_dif_info.lba + i); in ocs_scsi_dif_check_unknown()
536 if (! ocs_scsi_dif_check_app_tag(ocs, dif_info, scsi_dif_info.app_tag, dif)) { in ocs_scsi_dif_check_unknown()
537 ocs_log_debug(ocs, "app tag check error, lba %" PRId64 "\n", scsi_dif_info.lba + i); in ocs_scsi_dif_check_unknown()
541 if (! ocs_scsi_dif_check_ref_tag(ocs, dif_info, (scsi_dif_info.ref_tag + i), dif)) { in ocs_scsi_dif_check_unknown()
542 ocs_log_debug(ocs, "ref tag check error, lba %" PRId64 "\n", scsi_dif_info.lba + i); in ocs_scsi_dif_check_unknown()
594 * @param ocs Pointer to the ocs structure for logging.
602 ocs_scsi_dif_check_app_tag(ocs_t *ocs, ocs_hw_dif_info_t *dif_info, uint16_t exp_app_tag, ocs_dif_t… in ocs_scsi_dif_check_app_tag() argument
608 ocs_log_debug(ocs, "expected app tag 0x%x, actual 0x%x\n", in ocs_scsi_dif_check_app_tag()
620 * @param ocs Pointer to the ocs structure for logging.
628 ocs_scsi_dif_check_ref_tag(ocs_t *ocs, ocs_hw_dif_info_t *dif_info, uint32_t exp_ref_tag, ocs_dif_t… in ocs_scsi_dif_check_ref_tag() argument
635 ocs_log_debug(ocs, "expected ref tag 0x%x, actual 0x%x\n", in ocs_scsi_dif_check_ref_tag()
687 ocs_t *ocs = hw->os; in ocs_scsi_build_sgls() local
696 ocs_log_err(ocs, "ocs_hw_io_init_sges failed: %d\n", rc); in ocs_scsi_build_sgls()
761 ocs_log_err(ocs, "ocs_hw_io_add_sge failed: count=%d rc=%d\n", in ocs_scsi_build_sgls()
774 ocs_log_err(ocs, "ocs_hw_io_add_sge failed: count=%d rc=%d\n", in ocs_scsi_build_sgls()
787 * @param ocs Pointer to the ocs structure for logging.
795 ocs_scsi_convert_dif_info(ocs_t *ocs, ocs_scsi_dif_info_t *scsi_dif_info, ocs_hw_dif_info_t *hw_dif… in ocs_scsi_convert_dif_info() argument
845 ocs_log_test(ocs, "unhandled SCSI DIF operation %d\n", in ocs_scsi_convert_dif_info()
870 ocs_log_test(ocs, "unhandled SCSI DIF block size %d\n", in ocs_scsi_convert_dif_info()
893 ocs_hw_get(&ocs->hw, OCS_HW_DIF_SEED, &dif_seed); in ocs_scsi_convert_dif_info()
983 * @param ocs Pointer to the OCS structure.
989 ocs_scsi_check_pending(ocs_t *ocs) in ocs_scsi_check_pending() argument
991 ocs_xport_t *xport = ocs->xport; in ocs_scsi_check_pending()
1014 hio = ocs_hw_io_alloc(&ocs->hw); in ocs_scsi_check_pending()
1049 if (ocs_hw_async_call(&ocs->hw, ocs_scsi_check_pending_async_cb, io)) { in ocs_scsi_check_pending()
1050 ocs_log_test(ocs, "call to ocs_hw_async_call() failed\n"); in ocs_scsi_check_pending()
1087 if (ocs_hw_async_call(&ocs->hw, ocs_scsi_check_pending_async_cb, io)) { in ocs_scsi_check_pending()
1088 ocs_log_test(ocs, "call to ocs_hw_async_call() failed\n"); in ocs_scsi_check_pending()
1121 ocs_t *ocs = io->ocs; in ocs_scsi_io_dispatch() local
1122 ocs_xport_t *xport = ocs->xport; in ocs_scsi_io_dispatch()
1157 ocs_scsi_check_pending(ocs); in ocs_scsi_io_dispatch()
1166 hio = ocs_hw_io_alloc(&io->ocs->hw); in ocs_scsi_io_dispatch()
1200 ocs_t *ocs = io->ocs; in ocs_scsi_io_dispatch_abort() local
1201 ocs_xport_t *xport = ocs->xport; in ocs_scsi_io_dispatch_abort()
1219 ocs_scsi_check_pending(ocs); in ocs_scsi_io_dispatch_abort()
1246 ocs_t *ocs = io->ocs; in ocs_scsi_io_dispatch_hw_io() local
1278 ocs_hw_get(&ocs->hw, OCS_HW_N_SGL, &max_sgl); in ocs_scsi_io_dispatch_hw_io()
1279 ocs_hw_get(&ocs->hw, OCS_HW_SGL_CHAINING_HOST_ALLOCATED, &host_allocated); in ocs_scsi_io_dispatch_hw_io()
1294 rc = ocs_dma_alloc(ocs, &io->ovfl_sgl, count*sizeof(sli4_sge_t), 64); in ocs_scsi_io_dispatch_hw_io()
1296 ocs_log_err(ocs, "ocs_dma_alloc overflow sgl failed\n"); in ocs_scsi_io_dispatch_hw_io()
1299 rc = ocs_hw_io_register_sgl(&ocs->hw, io->hio, &io->ovfl_sgl, count); in ocs_scsi_io_dispatch_hw_io()
1302 ocs_log_err(ocs, "ocs_hw_io_register_sgl() failed\n"); in ocs_scsi_io_dispatch_hw_io()
1309 rc = ocs_scsi_build_sgls(&ocs->hw, io->hio, &io->hw_dif, io->sgl, io->sgl_count, io->hio_type); in ocs_scsi_io_dispatch_hw_io()
1315 if (OCS_LOG_ENABLE_SCSI_TRACE(ocs)) { in ocs_scsi_io_dispatch_hw_io()
1323 …rc = ocs_hw_io_send(&io->ocs->hw, io->hio_type, io->hio, io->wire_len, &io->iparam, &io->node->rno… in ocs_scsi_io_dispatch_hw_io()
1329 rc = ocs_hw_srrs_send(&ocs->hw, io->hio_type, io->hio, in ocs_scsi_io_dispatch_hw_io()
1336 rc = ocs_hw_srrs_send(&ocs->hw, io->hio_type, io->hio, in ocs_scsi_io_dispatch_hw_io()
1345 rc = ocs_hw_srrs_send(&ocs->hw, io->hio_type, io->hio, in ocs_scsi_io_dispatch_hw_io()
1397 rc = ocs_hw_io_abort(&io->ocs->hw, hio_to_abort, io->send_abts, in ocs_scsi_io_dispatch_no_hw_io()
1462 ocs_t *ocs; in ocs_scsi_xfer_data() local
1473 ocs_hw_get(&io->ocs->hw, OCS_HW_DISABLE_AR_TGT_DIF, &disable_ar_tgt_dif); in ocs_scsi_xfer_data()
1487 ocs = io->ocs; in ocs_scsi_xfer_data()
1488 ocs_assert(ocs, -1); in ocs_scsi_xfer_data()
1502 rc = ocs_scsi_convert_dif_info(ocs, dif_info, &io->hw_dif); in ocs_scsi_xfer_data()
1576 enable_tsend_auto_resp(io->ocs), cb, arg); in ocs_scsi_send_rd_data()
1586 enable_treceive_auto_resp(io->ocs), cb, arg); in ocs_scsi_recv_wr_data()
1603 ocs_dma_free(io->ocs, &io->ovfl_sgl); in ocs_scsi_io_free_ovfl()
1631 ocs_t *ocs; in ocs_scsi_send_resp() local
1641 ocs = io->ocs; in ocs_scsi_send_resp()
1642 ocs_assert(ocs, -1); in ocs_scsi_send_resp()
1646 ocs_scsi_convert_dif_info(ocs, NULL, &io->hw_dif); in ocs_scsi_send_resp()
1679 ocs_log_err(ocs, "NULL response buffer\n"); in ocs_scsi_send_resp()
1751 ocs_t *ocs = NULL; in ocs_scsi_send_tmf_resp() local
1757 ocs_assert(io->ocs, -1); in ocs_scsi_send_tmf_resp()
1760 ocs = io->ocs; in ocs_scsi_send_tmf_resp()
1763 ocs_scsi_convert_dif_info(ocs, NULL, &io->hw_dif); in ocs_scsi_send_tmf_resp()
1849 ocs_t *ocs; in ocs_target_abort_cb() local
1853 ocs_assert(io->ocs, -1); in ocs_target_abort_cb()
1855 ocs = io->ocs; in ocs_target_abort_cb()
1898 ocs_io_free(ocs, io); in ocs_target_abort_cb()
1900 ocs_scsi_check_pending(ocs); in ocs_target_abort_cb()
1921 ocs_t *ocs; in ocs_scsi_tgt_abort_io() local
1928 ocs_assert(io->ocs, -1); in ocs_scsi_tgt_abort_io()
1930 ocs = io->ocs; in ocs_scsi_tgt_abort_io()
1931 xport = ocs->xport; in ocs_scsi_tgt_abort_io()
1945 abort_io = ocs_io_alloc(ocs); in ocs_scsi_tgt_abort_io()
1995 ocs_t *ocs; in ocs_target_bls_resp_cb() local
1999 ocs_assert(io->ocs, -1); in ocs_target_bls_resp_cb()
2001 ocs = io->ocs; in ocs_target_bls_resp_cb()
2022 ocs_scsi_check_pending(ocs); in ocs_target_bls_resp_cb()
2093 ocs_log_test(io->ocs, "Got completion for non-busy io with tag 0x%x\n", io->tag); in ocs_scsi_io_complete()
2123 ocs_t *ocs; in ocs_initiator_io_cb() local
2131 ocs = io->ocs; in ocs_initiator_io_cb()
2132 ocs_assert(ocs); in ocs_initiator_io_cb()
2199 ocs_log_test(io->ocs, "[%s]" SCSI_IOFMT "local reject=0x%02x\n", in ocs_initiator_io_cb()
2234 ocs_scsi_check_pending(ocs); in ocs_initiator_io_cb()
2488 ocs_t *ocs; in ocs_scsi_send_io() local
2497 ocs = io->ocs; in ocs_scsi_send_io()
2514 if (OCS_LOG_ENABLE_SCSI_TRACE(ocs)) { in ocs_scsi_send_io()
2519 ocs_textbuf_init(ocs, &txtbuf, buf, sizeof(buf)); in ocs_scsi_send_io()
2622 ocs_log_test(ocs, "bad IO type %d\n", io->hio_type); in ocs_scsi_send_io()
2626 rc = ocs_scsi_convert_dif_info(ocs, dif_info, &io->hw_dif); in ocs_scsi_send_io()
2669 ocs_t *ocs; in ocs_scsi_abort_io_cb() local
2674 ocs_assert(io->ocs, -1); in ocs_scsi_abort_io_cb()
2676 ocs = io->ocs; in ocs_scsi_abort_io_cb()
2678 ocs_log_debug(ocs, "status %d ext %d\n", status, ext_status); in ocs_scsi_abort_io_cb()
2697 ocs_log_test(ocs, "Unhandled local reject 0x%x/0x%x\n", status, ext_status); in ocs_scsi_abort_io_cb()
2712 ocs_scsi_check_pending(ocs); in ocs_scsi_abort_io_cb()
2724 * @param ocs Pointer to the ocs.
2730 ocs_scsi_get_property(ocs_t *ocs, ocs_scsi_property_e prop) in ocs_scsi_get_property() argument
2732 ocs_xport_t *xport = ocs->xport; in ocs_scsi_get_property()
2737 if (0 == ocs_hw_get(&ocs->hw, OCS_HW_MAX_SGE, &val)) { in ocs_scsi_get_property()
2742 if (ocs->ctrlmask & OCS_CTRLMASK_TEST_CHAINED_SGLS) { in ocs_scsi_get_property()
2749 if (0 == ocs_hw_get(&ocs->hw, OCS_HW_N_SGL, &val)) { in ocs_scsi_get_property()
2756 if (0 == ocs_hw_get(&ocs->hw, OCS_HW_DIF_CAPABLE, &val)) { in ocs_scsi_get_property()
2763 if (ocs_hw_get(&ocs->hw, OCS_HW_DIF_MULTI_SEPARATE, &val) == 0) { in ocs_scsi_get_property()
2769 if (ocs_hw_get(&ocs->hw, OCS_HW_SEND_FRAME_CAPABLE, &val) == 0) { in ocs_scsi_get_property()
2777 ocs_log_debug(ocs, "invalid property request %d\n", prop); in ocs_scsi_get_property()
2789 * @param ocs Pointer to the ocs.
2794 void *ocs_scsi_get_property_ptr(ocs_t *ocs, ocs_scsi_property_e prop) in ocs_scsi_get_property_ptr() argument
2800 rc = ocs_hw_get_ptr(&ocs->hw, OCS_HW_WWN_NODE); in ocs_scsi_get_property_ptr()
2803 rc = ocs_hw_get_ptr(&ocs->hw, OCS_HW_WWN_PORT); in ocs_scsi_get_property_ptr()
2806 rc = ocs_hw_get_ptr(&ocs->hw, OCS_HW_PORTNUM); in ocs_scsi_get_property_ptr()
2809 rc = ocs_hw_get_ptr(&ocs->hw, OCS_HW_BIOS_VERSION_STRING); in ocs_scsi_get_property_ptr()
2816 if (ocs_hw_get(&ocs->hw, OCS_HW_VPD_LEN, &vpd_len)) { in ocs_scsi_get_property_ptr()
2817 ocs_log_test(ocs, "Can't get VPD length\n"); in ocs_scsi_get_property_ptr()
2822 pvpd = ocs_hw_get_ptr(&ocs->hw, OCS_HW_VPD); in ocs_scsi_get_property_ptr()
2830 scsi_log(ocs, "Note: VPD is missing, using wwnn for serial number\n"); in ocs_scsi_get_property_ptr()
2832 if ((ocs == NULL) || (ocs->domain == NULL) || (ocs->domain->sport == NULL)) { in ocs_scsi_get_property_ptr()
2835 rc = &ocs->domain->sport->wwnn_str[8]; in ocs_scsi_get_property_ptr()
2845 if (ocs_hw_get(&ocs->hw, OCS_HW_VPD_LEN, &vpd_len)) { in ocs_scsi_get_property_ptr()
2846 ocs_log_test(ocs, "Can't get VPD length\n"); in ocs_scsi_get_property_ptr()
2850 pvpd = ocs_hw_get_ptr(&ocs->hw, OCS_HW_VPD); in ocs_scsi_get_property_ptr()
2866 ocs_log_debug(ocs, "invalid property request %d\n", prop); in ocs_scsi_get_property_ptr()
2936 * @param ocs Pointer to device object.
2942 ocs_scsi_register_bounce(ocs_t *ocs, void(*fctn)(void(*fctn)(void *arg), void *arg, uint32_t s_id, … in ocs_scsi_register_bounce() argument
2947 rc = ocs_hw_callback(&ocs->hw, OCS_HW_CB_BOUNCE, fctn, NULL); in ocs_scsi_register_bounce()
2949 ocs_log_test(ocs, "ocs_hw_callback(OCS_HW_CB_BOUNCE) failed: %d\n", rc); in ocs_scsi_register_bounce()