56 #define OCS_HAL_READ_FCF_SIZE 4096
57 #define OCS_HAL_DEFAULT_AUTO_XFER_RDY_IOS 256
58 #define OCS_HAL_WQ_TIMER_PERIOD_MS 500
61 #define OCS_HAL_TOW_BLK_SIZE_DEFAULT 0
62 #define OCS_HAL_TOW_REF_TAG_LBA_DEFAULT TRUE
63 #define OCS_HAL_TOW_APP_TAG_VALID_DEFAULT FALSE
64 #define OCS_HAL_TOW_APP_TAG_VALUE_DEFAULT 0
71 #define OCS_HAL_REQUE_XRI_REGTAG 65534
74 #define OCS_HAL_DMTF_CLP_CMD_MAX 256
75 #define OCS_HAL_DMTF_CLP_RSP_MAX 256
96 static int32_t
ocs_hal_io_ini_sge(ocs_hal_t *, ocs_hal_io_t *, ocs_dma_t *, uint32_t, ocs_dma_t *);
99 static int32_t
ocs_hal_cb_sfp(ocs_hal_t *, int32_t, uint8_t *,
void *);
100 static int32_t
ocs_hal_cb_temp(ocs_hal_t *, int32_t, uint8_t *,
void *);
104 static int32_t
ocs_hal_clp_resp_get_value(ocs_hal_t *hal,
const char *keyword,
char *value, uint32_t value_len,
const char *resp, uint32_t resp_len);
171 ocs_log_err(hal->os,
"SLI4_RSP: cmd_opcode: %#x, cmd_subsystem: %#x, status: %#x, addl_status: %#x\n",
173 ocs_log_err(hal->os,
" %08X %08X %08X %08X\n", ((uint32_t *)hdr)[0],
174 ((uint32_t *)hdr)[1], ((uint32_t *)hdr)[2], ((uint32_t *)hdr)[3]);
179 uint32_t ramdisc_blocksize = 512;
185 if (
ocs_get_property(
"ramdisc_blocksize", prop_buf,
sizeof(prop_buf)) == 0) {
186 ramdisc_blocksize = ocs_strtoul(prop_buf, 0, 0);
191 hal->config.tow_io_size,
195 hal->config.tow_io_size,
196 hal->config.tow_xri_cnt,
197 ramdisc_blocksize, tow_feature);
201 ocs_log_err(hal->os,
"Failed to populate TOW ESOC command\n");
220 hal->config.tow_io_size);
223 hal->config.tow_io_size,
224 hal->config.tow_xri_cnt,
229 ocs_log_err(hal->os,
"Failed to populate TOW comamnd\n");
247 ocs_log_err(hal->os,
"Failed to config AXR T10 PI\n");
252 ocs_log_err(hal->os,
"Failed to config tow T10 PI\n");
264 uint32_t tow_feature = 0;
267 hal->tow_enabled = FALSE;
273 if (hal->config.esoc) {
280 ocs_log_err(hal->os,
"Failed to enable TOW feature\n");
284 if (hal->config.tow_t10_enable) {
287 ocs_log_err(hal->os,
"Failed to config optimized write T10 PI\n");
292 hal->tow_enabled = TRUE;
293 ocs_log_info(hal->os,
"TOW feature is successfully enabled\n");
300 if (hal->config.emulate_tgt_wqe_timeout && io->tgt_wqe_timeout) {
305 ocs_lock(&hal->io_lock);
307 io->submit_ticks = ocs_get_os_ticks();
308 ocs_unlock(&hal->io_lock);
315 if (hal->config.emulate_tgt_wqe_timeout) {
320 ocs_lock(&hal->io_lock);
324 ocs_unlock(&hal->io_lock);
379 uint32_t num_chutes = 1;
393 ocs_log_err(NULL,
"bad parameter hal=%p\n", hal);
401 hal->link.logical_link_speed = 0;
402 hal->link.loop_map = NULL;
403 hal->link.fc_id = UINT32_MAX;
428 ocs_log_debug(hal->os,
"Function only supported for I/F type 2/6\n");
436 if (hal->workaround.disable_dump_loc) {
437 ocs_log_test(hal->os,
"FW version is too old for this feature\n");
450 ocs_log_debug(hal->os,
"Dump size: %x\n", sli4_rsp->
buffer_length);
496 hal->wq[i] = ocs_malloc(hal->os,
sizeof(
sli4_queue_t), OCS_M_ZERO);
498 ocs_log_err(hal->os,
"Failed to allocate memory for SLI WQ[%d]\n", i);
499 goto free_sli_queues;
504 hal->rq[i] = ocs_malloc(hal->os,
sizeof(
sli4_queue_t), OCS_M_ZERO);
506 ocs_log_err(hal->os,
"Failed to allocate memory for SLI RQ[%d]\n", i);
507 goto free_sli_queues;
512 hal->mq[i] = ocs_malloc(hal->os,
sizeof(
sli4_queue_t), OCS_M_ZERO);
514 ocs_log_err(hal->os,
"Failed to allocate memory for SLI MQ[%d]\n", i);
515 goto free_sli_queues;
520 hal->cq[i] = ocs_malloc(hal->os,
sizeof(
sli4_queue_t), OCS_M_ZERO);
522 ocs_log_err(hal->os,
"Failed to allocate memory for SLI CQ[%d]\n", i);
523 goto free_sli_queues;
528 hal->eq[i] = ocs_malloc(hal->os,
sizeof(
sli4_queue_t), OCS_M_ZERO);
530 ocs_log_err(hal->os,
"Failed to allocate memory for SLI EQ[%d]\n", i);
531 goto free_sli_queues;
566 ocs_log_err(hal->os,
"CQ hash allocation failed\n");
567 goto free_queue_hash;
572 ocs_log_err(hal->os,
"RQ hash allocation failed\n");
573 goto free_queue_hash;
578 ocs_log_err(hal->os,
"WQ hash allocation failed\n");
579 goto free_queue_hash;
611 ocs_log_err(os,
"bad parameter(s) hal=%p\n", hal);
615 if (hal->hal_setup_called) {
628 ocs_memset(hal, 0,
sizeof(ocs_hal_t));
630 hal->hal_setup_called = TRUE;
634 ocs_sem_init(&hal->bmbx_sem, 1,
"hal_bmbx_sem");
636 ocs_lock_init(hal->os, &hal->cmd_lock,
"HAL_cmd_lock[%d]",
ocs_instance(hal->os));
639 hal->cmd_head_count = 0;
641 ocs_lock_init(hal->os, &hal->io_lock,
"HAL_io_lock[%d]",
ocs_instance(hal->os));
642 ocs_lock_init(hal->os, &hal->io_abort_lock,
"HAL_io_abort_lock[%d]",
ocs_instance(hal->os));
644 ocs_atomic_init(&hal->io_alloc_failed_count, 0);
647 hal->config.dif_seed = 0;
663 if (
sli_setup(&hal->sli, hal->os, port_type)) {
664 ocs_log_err(hal->os,
"SLI setup failed\n");
668 ocs_memset(hal->domains, 0,
sizeof(hal->domains));
670 ocs_memset(hal->fcf_index_fcfi, 0,
sizeof(hal->fcf_index_fcfi));
681 for (i = 0; i < ARRAY_SIZE(hal->num_qentries); i++) {
692 hal->config.i_only_aab = TRUE;
698 if (hal->workaround.override_fcfi) {
699 hal->first_domain_idx = -1;
713 ocs_log_test(hal->os,
"not inline capable, setting mode to seperate\n");
717 if (hal->workaround.use_dif_sec_xri) {
746 ocs_log_debug(hal->os,
"ulp_start %d, ulp_max %d\n",
747 hal->ulp_start, hal->ulp_max);
751 if (hal->qtop == NULL) {
752 ocs_log_crit(hal->os,
"Queue topology string is invalid\n");
756 hal->config.n_eq = hal->qtop->entry_counts[
QTOP_EQ];
757 hal->config.n_cq = hal->qtop->entry_counts[
QTOP_CQ];
758 hal->config.n_rq = hal->qtop->entry_counts[
QTOP_RQ];
759 hal->config.n_wq = hal->qtop->entry_counts[
QTOP_WQ];
760 hal->config.n_mq = hal->qtop->entry_counts[
QTOP_MQ];
771 ocs_log_crit(hal->os,
"Max supported EQs = %d\n",
777 ocs_log_crit(hal->os,
"Max supported CQs = %d\n",
783 ocs_log_crit(hal->os,
"Max supported WQs = %d\n",
789 ocs_log_crit(hal->os,
"Max supported MQs = %d\n",
821 uint32_t q_count = 0;
828 ocs_lock(&hal->cmd_lock);
830 ocs_log_test(hal->os,
"command found on cmd list\n");
831 ocs_unlock(&hal->cmd_lock);
835 ocs_log_test(hal->os,
"command found on pending list\n");
836 ocs_unlock(&hal->cmd_lock);
839 ocs_unlock(&hal->cmd_lock);
861 ocs_log_debug(hal->os,
"removed %d items from io_wait_free list\n", rem_count);
871 ocs_log_debug(hal->os,
"removed %d items from io_inuse list\n", rem_count);
881 ocs_log_debug(hal->os,
"removed %d items from io_free list\n", rem_count);
897 if (hal->config.n_rq == 1) {
898 hal->sli.config.features.flag.mrqp = FALSE;
902 ocs_log_err(hal->os,
"SLI failed to initialize\n");
908 ocs_log_err(hal->os,
"Failed to enable RAS firmware logging\n");
916 ocs_log_err(hal->os,
"Failed to initialize optimized write feature\n");
920 if(hal->sliport_healthcheck) {
923 ocs_log_err(hal->os,
"Enabling Sliport Health check failed \n");
932 ocs_log_err(hal->os,
"Config FEC failed \n");
940 ocs_log_err(hal->os,
"Setting FW Auto-good response configuration not supproted \n");
944 if (hal->sliport_pause_errors && (ocs_strcmp(hal->sliport_pause_errors,
"disabled")) &&
948 ocs_log_err(hal->os,
"Sliport pause state enable failed\n");
964 #if !defined(OCSU_FC_RAMD) && !defined(OCSU_FC_WORKLOAD) && !defined(OCS_USPACE_SPDK)
970 ocs_log_err(hal->os,
"Set FW dump location failed\n");
980 if (hal->config.n_eq > q_count) {
981 ocs_log_err(hal->os,
"requested %d EQ but %d allowed\n",
982 hal->config.n_eq, q_count);
988 if (hal->config.n_cq > q_count) {
989 ocs_log_err(hal->os,
"requested %d CQ but %d allowed\n",
990 hal->config.n_cq, q_count);
996 if (hal->config.n_mq > q_count) {
997 ocs_log_err(hal->os,
"requested %d MQ but %d allowed\n",
998 hal->config.n_mq, q_count);
1004 if (hal->config.n_rq > q_count) {
1005 ocs_log_err(hal->os,
"requested %d RQ but %d allowed\n",
1006 hal->config.n_rq, q_count);
1012 if (hal->config.n_wq > q_count) {
1013 ocs_log_err(hal->os,
"requested %d WQ but %d allowed\n",
1014 hal->config.n_wq, q_count);
1020 ocs_log_debug(hal->os,
"Max CQs %d, hash size = %d\n",
1024 ocs_log_debug(hal->os,
"Max RQs %d, hash size = %d\n",
1028 ocs_log_debug(hal->os,
"Max WQs %d, hash size = %d\n",
1039 ocs_dma_t payload_memory;
1043 if (hal->rnode_mem.size) {
1044 ocs_dma_free(hal->os, &hal->rnode_mem);
1047 if (ocs_dma_alloc(hal->os, &hal->rnode_mem, i, 4096)) {
1048 ocs_log_err(hal->os,
"remote node memory allocation fail\n");
1052 payload_memory.size = 0;
1054 &hal->rnode_mem, UINT16_MAX, &payload_memory)) {
1057 if (payload_memory.size) {
1059 ocs_dma_free(hal->os, &payload_memory);
1064 ocs_log_err(hal->os,
"header template registration failed\n");
1072 ocs_log_err(hal->os,
"rx_allocate failed\n");
1077 if (hal->seq_pool == NULL) {
1082 for (i = 0; i < hal->hal_rq_count; i++) {
1083 count += hal->hal_rq[i]->entry_count;
1087 if (hal->seq_pool == NULL) {
1088 ocs_log_err(hal->os,
"malloc seq_pool failed\n");
1094 ocs_log_err(hal->os,
"WARNING - error posting RQ buffers\n");
1098 if (hal->rpi_ref == NULL) {
1099 hal->rpi_ref = ocs_malloc(hal->os, max_rpi *
sizeof(*hal->rpi_ref),
1100 OCS_M_ZERO | OCS_M_NOWAIT);
1101 if (hal->rpi_ref == NULL) {
1102 ocs_log_err(hal->os,
"rpi_ref allocation failure (%d)\n", i);
1107 for (i = 0; i < max_rpi; i ++) {
1108 ocs_atomic_init(&hal->rpi_ref[i].rpi_count, 0);
1109 ocs_atomic_init(&hal->rpi_ref[i].rpi_attached, 0);
1112 ocs_memset(hal->domains, 0,
sizeof(hal->domains));
1115 if (hal->workaround.override_fcfi) {
1116 hal->first_domain_idx = -1;
1119 ocs_memset(hal->fcf_index_fcfi, 0,
sizeof(hal->fcf_index_fcfi));
1124 if (hal->hal_mrq_used) {
1125 ocs_log_info(hal->os,
"using REG_FCFI MRQ\n");
1129 ocs_log_err(hal->os,
"REG_FCFI_MRQ FCFI registration failed\n");
1135 ocs_log_err(hal->os,
"REG_FCFI_MRQ MRQ registration failed\n");
1141 ocs_log_info(hal->os,
"using REG_FCFI standard\n");
1145 rq_cfg[i].
rq_id = 0xffff;
1146 rq_cfg[i].
r_ctl_mask = (uint8_t) hal->config.filter_def[i];
1147 rq_cfg[i].
r_ctl_match = (uint8_t) (hal->config.filter_def[i] >> 8);
1148 rq_cfg[i].
type_mask = (uint8_t) (hal->config.filter_def[i] >> 16);
1149 rq_cfg[i].
type_match = (uint8_t) (hal->config.filter_def[i] >> 24);
1156 for (i = 0; i < OCS_MIN(hal->hal_rq_count, SLI4_CMD_REG_FCFI_NUM_RQ_CFG); i++) {
1157 hal_rq_t *rq = hal->hal_rq[i];
1160 uint32_t mask = (rq->filter_mask != 0) ? rq->filter_mask : 1;
1161 if (mask & (1U << j)) {
1162 rq_cfg[j].
rq_id = rq->hdr->id;
1163 ocs_log_info(hal->os,
"REG_FCFI: filter[%d] %08X -> RQ[%d] id=%d\n",
1164 j, hal->config.filter_def[j], i, rq->hdr->id);
1184 ocs_log_err(hal->os,
"ocs_pool_alloc hal_wq_callback_t failed: %d\n", rc);
1190 ocs_log_err(hal->os,
"IO allocation failure\n");
1196 ocs_log_err(hal->os,
"IO initialization failure\n");
1211 ocs_log_err(hal->os,
"Failed to set ethernet license\n");
1218 ocs_log_err(hal->os,
"Failed to set DIF seed value\n");
1227 ocs_log_err(hal->os,
"Failed to set DIF mode value\n");
1235 for (i = 0; i < hal->eq_count; i++) {
1242 for (i = 0; i < hal->rq_count; i++) {
1249 for (i = 0; i < hal->wq_count; i++) {
1256 for (i = 0; i < hal->cq_count; i++) {
1266 ocs_log_err(hal->os,
"WARNING - error initializing RQ pair\n");
1270 if (hal->config.emulate_tgt_wqe_timeout) {
1280 for (i = 0; i < count; i++) {
1283 if (wq->send_frame_io == NULL) {
1284 ocs_log_err(hal->os,
"ocs_hal_io_alloc for send_frame_io failed\n");
1289 if (hal->hal_wq[0]->send_frame_io == NULL) {
1290 ocs_log_err(hal->os,
"ocs_hal_io_alloc for send_frame_io failed\n");
1295 ocs_atomic_init(&hal->send_frame_seq_id, 0);
1298 hal->expiration_logged = 0;
1299 if(hal->watchdog_timeout) {
1300 if((hal->watchdog_timeout < 1) || (hal->watchdog_timeout > 65534)) {
1301 ocs_log_err(hal->os,
"watchdog_timeout out of range: Valid range is 1 - 65534\n");
1303 ocs_log_info(hal->os,
"watchdog timer configured with timeout = %d seconds \n", hal->watchdog_timeout);
1329 ocs_t *ocs = (ocs_t *)hal->os;
1337 rq_filter[i].
rq_id = 0xffff;
1338 rq_filter[i].
is_mrq = FALSE;
1339 rq_filter[i].
r_ctl_mask = (uint8_t) hal->config.filter_def[i];
1340 rq_filter[i].
r_ctl_match = (uint8_t) (hal->config.filter_def[i] >> 8);
1341 rq_filter[i].
type_mask = (uint8_t) (hal->config.filter_def[i] >> 16);
1342 rq_filter[i].
type_match = (uint8_t) (hal->config.filter_def[i] >> 24);
1348 for (i = 0; i < hal->hal_rq_count; i++) {
1349 rq = hal->hal_rq[i];
1351 if (rq->filter_mask & (1U << j)) {
1352 if (rq_filter[j].rq_id != 0xffff) {
1354 if (!rq->is_mrq || (rq_filter[j].
rq_id != rq->base_mrq_id)) {
1355 ocs_log_err(hal->os,
"Wrong queue topology.\n");
1361 rq_filter[j].
rq_id = rq->base_mrq_id;
1363 rq_filter[j].
is_mrq = TRUE;
1367 if (rq->policy == 3) {
1370 }
else if (ocs->enable_nvme_tgt) {
1379 rq_filter[j].
rq_id = rq->hdr->id;
1396 ocs_log_err(hal->os,
"sli_cmd_reg_fcfi_mrq() failed: %d\n", rc);
1406 hal->fcf_indicator = rsp->
fcfi;
1424 ocs_hal_t *hal = (ocs_hal_t *)arg;
1430 ocs_log_debug(hal->os,
"linkcfg=%d\n", hal->linkcfg);
1449 uint32_t iters = 10;
1451 uint32_t destroy_queues;
1452 uint32_t free_memory;
1455 ocs_log_err(NULL,
"bad parameter(s) hal=%p\n", hal);
1466 if(hal->watchdog_timeout) {
1467 hal->watchdog_timeout = 0;
1472 if(hal->sliport_healthcheck) {
1473 hal->sliport_healthcheck = 0;
1485 ocs_delay_usec(10000);
1491 ocs_log_debug(hal->os,
"All commands completed on MQ queue\n");
1493 ocs_log_debug(hal->os,
"Some commands still pending on MQ queue\n");
1502 ocs_lock_free(&hal->cmd_lock);
1505 if (hal->workaround.use_unregistered_rpi) {
1507 ocs_log_err(hal->os,
"FCOE_RPI (%d) free failed\n", hal->workaround.unregistered_rid);
1513 for (i = 0; i < max_rpi; i++) {
1514 if (ocs_atomic_read(&hal->rpi_ref[i].rpi_count)) {
1515 ocs_log_debug(hal->os,
"non-zero ref [%d]=%d\n",
1516 i, ocs_atomic_read(&hal->rpi_ref[i].rpi_count));
1519 ocs_free(hal->os, hal->rpi_ref, max_rpi *
sizeof(*hal->rpi_ref));
1520 hal->rpi_ref = NULL;
1523 ocs_dma_free(hal->os, &hal->rnode_mem);
1526 for (i = 0; i < hal->config.n_io; i++) {
1531 if (hal->io[i]->sgl && hal->io[i]->sgl->virt) {
1532 if (hal->io[i]->is_port_owned) {
1533 ocs_lock_free(&hal->io[i]->tow_lock);
1535 ocs_dma_free(hal->os, hal->io[i]->sgl);
1538 ocs_free(hal->os, hal->io[i],
sizeof(ocs_hal_io_t));
1542 ocs_free(hal->os, hal->wqe_buffs, hal->config.n_io * hal->sli.config.wqe_size);
1543 hal->wqe_buffs = NULL;
1544 ocs_free(hal->os, hal->io, hal->config.n_io *
sizeof(ocs_hal_io_t *));
1548 ocs_dma_free(hal->os, &hal->xfer_rdy);
1549 ocs_dma_free(hal->os, &hal->chip_dump_sges);
1550 ocs_dma_free(hal->os, &hal->func_dump_sges);
1551 ocs_dma_free(hal->os, &hal->loop_map);
1553 ocs_lock_free(&hal->io_lock);
1554 ocs_lock_free(&hal->io_abort_lock);
1557 for (i = 0; i < hal->wq_count; i++) {
1558 sli_queue_free(&hal->sli, hal->wq[i], destroy_queues, free_memory);
1562 for (i = 0; i < hal->rq_count; i++) {
1563 sli_queue_free(&hal->sli, hal->rq[i], destroy_queues, free_memory);
1566 for (i = 0; i < hal->mq_count; i++) {
1567 sli_queue_free(&hal->sli, hal->mq[i], destroy_queues, free_memory);
1570 for (i = 0; i < hal->cq_count; i++) {
1571 sli_queue_free(&hal->sli, hal->cq[i], destroy_queues, free_memory);
1574 for (i = 0; i < hal->eq_count; i++) {
1575 sli_queue_free(&hal->sli, hal->eq[i], destroy_queues, free_memory);
1590 ocs_log_err(hal->os,
"SLI teardown failed\n");
1606 hal->seq_pool = NULL;
1612 hal->hal_setup_called = FALSE;
1624 ocs_log_debug(hal->os,
"issuing function level reset\n");
1626 ocs_log_err(hal->os,
"sli_reset failed\n");
1631 ocs_log_debug(hal->os,
"issuing firmware reset\n");
1633 ocs_log_err(hal->os,
"sli_soft_reset failed\n");
1640 ocs_log_debug(hal->os,
"issuing function level reset\n");
1642 ocs_log_err(hal->os,
"sli_reset failed\n");
1647 ocs_log_err(hal->os,
"unknown reset type - no reset performed\n");
1648 hal->state = prev_state;
1661 ocs_log_debug(hal->os,
"issuing Port migration\n");
1663 ocs_log_err(hal->os,
"sli_port_migration failed\n");
1675 uint32_t destroy_queues, free_memory;
1676 ocs_domain_t *domain;
1677 ocs_t *ocs = (ocs_t *)hal->os;
1680 ocs_log_test(hal->os,
"HAL state %d is not active\n", hal->state);
1697 if(hal->watchdog_timeout) {
1698 hal->watchdog_timeout = 0;
1712 ocs_delay_usec(10000);
1718 ocs_log_debug(hal->os,
"All commands completed on MQ queue\n");
1720 ocs_log_debug(hal->os,
"Some commands still pending on MQ queue\n");
1737 ocs_memset(hal->domains, 0,
sizeof(hal->domains));
1738 ocs_memset(hal->fcf_index_fcfi, 0,
sizeof(hal->fcf_index_fcfi));
1742 ocs_lock(&hal->io_lock);
1756 ocs_unlock(&hal->io_lock);
1764 ocs_log_debug(ocs,
"free domain %p\n", domain);
1769 for (i = 0; i < hal->wq_count; i++) {
1770 sli_queue_free(&hal->sli, hal->wq[i], destroy_queues, free_memory);
1773 for (i = 0; i < hal->rq_count; i++) {
1774 sli_queue_free(&hal->sli, hal->rq[i], destroy_queues, free_memory);
1777 for (i = 0; i < hal->hal_rq_count; i++) {
1778 hal_rq_t *rq = hal->hal_rq[i];
1779 if (rq->rq_tracker != NULL) {
1782 for (j = 0; j < rq->entry_count; j++) {
1783 rq->rq_tracker[j] = NULL;
1788 for (i = 0; i < hal->mq_count; i++) {
1789 sli_queue_free(&hal->sli, hal->mq[i], destroy_queues, free_memory);
1792 for (i = 0; i < hal->cq_count; i++) {
1793 sli_queue_free(&hal->sli, hal->cq[i], destroy_queues, free_memory);
1796 for (i = 0; i < hal->eq_count; i++) {
1797 sli_queue_free(&hal->sli, hal->eq[i], destroy_queues, free_memory);
1825 return hal->eq_count;
1853 *value = hal->config.n_io;
1868 *value = hal->config.rq_default_buffer_size;
1880 switch (hal->config.tow_blksize_chip) {
1903 *value = hal->config.tow_t10_enable;
1906 *value = hal->config.tow_p_type;
1909 *value = hal->config.tow_ref_tag_lba;
1912 *value = hal->config.tow_app_tag_valid;
1915 *value = hal->config.tow_app_tag_value;
1918 *value = hal->config.tow_feature;
1921 *value = hal->config.tow_xri_cnt;
1924 *value = hal->config.tow_io_size;
1937 if (hal->link.speed == 0) {
1941 switch (hal->link.topology) {
1952 ocs_log_test(hal->os,
"unsupported topology %#x\n", hal->link.topology);
1958 *value = hal->config.topology;
1961 *value = hal->link.speed;
1964 *value = hal->link.logical_link_speed;
1967 *value = hal->link.aggregate_link_speed;
1970 switch (hal->config.speed) {
1993 ocs_log_test(hal->os,
"unsupported speed %#x\n", hal->config.speed);
2011 *value = hal->config.dif_seed;
2014 *value = hal->config.dif_mode;
2025 *value = hal->dump_size;
2032 ocs_t *ocs = (ocs_t *)hal->os;
2034 if (ocs->enable_auto_recovery) {
2052 *value = ocs->fw_dump.type;
2092 *value = hal->linkcfg;
2095 *value = hal->eth_license;
2104 *value = hal->workaround.disable_ar_tgt_dif;
2107 *value = hal->config.i_only_aab;
2110 *value = hal->config.emulate_tgt_wqe_timeout;
2144 if (hal->workaround.ignore_send_frame) {
2152 *value = hal->config.rq_selection_policy;
2155 *value = hal->config.rr_quanta;
2164 *value = hal->config.suppress_rsp_capable;
2167 ocs_log_test(hal->os,
"unsupported property %#x\n", prop);
2205 ocs_log_test(hal->os,
"unsupported property %#x\n", prop);
2222 ocs_log_test(hal->os,
"IO value out of range %d vs %d\n",
2226 hal->config.n_io = value;
2232 ocs_log_test(hal->os,
"SGL value out of range %d vs %d\n",
2236 hal->config.n_sgl = value;
2242 ocs_log_test(hal->os,
"unsupported topology=%#x medium=%#x\n",
2263 ocs_log_test(hal->os,
"unsupported topology %#x\n", value);
2266 hal->config.topology = value;
2276 ocs_log_test(hal->os,
"unsupported speed=%#x medium=%#x\n",
2303 ocs_log_test(hal->os,
"unsupported speed %d\n", value);
2310 ocs_log_test(hal->os,
"DIF seed not supported for this device\n");
2313 hal->config.dif_seed = value;
2326 hal->config.dif_mode = value;
2328 ocs_log_test(hal->os,
"chip does not support DIF inline\n");
2335 hal->config.dif_mode = value;
2337 ocs_log_test(hal->os,
"chip does not support DIF separate\n");
2343 hal->config.rq_default_buffer_size = value;
2346 hal->config.tow_io_size = value;
2349 hal->config.tow_xri_cnt = value;
2352 hal->config.tow_feature = value;
2357 hal->config.tow_blksize_chip = 0;
2360 hal->config.tow_blksize_chip = 1;
2363 hal->config.tow_blksize_chip = 2;
2366 hal->config.tow_blksize_chip = 3;
2369 hal->config.tow_blksize_chip = 4;
2372 ocs_log_err(hal->os,
"Invalid block size %d\n", value);
2377 hal->config.tow_t10_enable = value;
2380 hal->config.tow_p_type = value;
2383 hal->config.tow_ref_tag_lba = value;
2386 hal->config.tow_app_tag_valid = value;
2389 hal->config.tow_app_tag_value = value;
2392 hal->config.esoc = value;
2404 hal->eth_license = value;
2407 hal->config.i_only_aab = value;
2410 hal->config.emulate_tgt_wqe_timeout = value;
2413 hal->config.bounce = value;
2416 hal->config.rq_selection_policy = value;
2419 hal->config.rr_quanta = value;
2422 hal->config.cq_process_limit = value;
2425 hal->config.suppress_rsp_capable = value;
2428 ocs_log_test(hal->os,
"unsupported property %#x\n", prop);
2443 hal->hal_war_version = value;
2449 for (idx = 0; idx < ARRAY_SIZE(hal->config.filter_def); idx++) {
2450 hal->config.filter_def[idx] = 0;
2453 for (idx = 0; (idx < ARRAY_SIZE(hal->config.filter_def)) && (p != NULL) && *p; ) {
2454 hal->config.filter_def[idx++] = ocs_strtoul(p, 0, 0);
2455 p = ocs_strchr(p,
',');
2464 ocs_log_test(hal->os,
"unsupported property %#x\n", prop);
2485 ocs_log_err(NULL,
"HAL context NULL?!?\n");
2489 if (vector > hal->eq_count) {
2490 ocs_log_err(hal->os,
"vector %d. max %d\n",
2491 vector, hal->eq_count);
2521 ocs_hal_t *hal = seq->
hal;
2526 hal->callback.unsolicited(hal->args.unsolicited, seq);
2553 eq = hal->hal_eq[vector];
2562 eq->queue->last_processed_time = ocs_ticks_to_ms(ocs_get_os_ticks());
2591 uint32_t done = FALSE;
2594 tstart = ocs_get_os_ticks();
2611 for (i = 0; i < hal->cq_count; i++) {
2620 if (likely(index >= 0)) {
2624 ocs_log_err(hal->os,
"bad CQ_ID %#06x\n", cq_id);
2629 if (eq->queue->n_posted > (eq->queue->posted_limit)) {
2633 telapsed = ocs_get_os_ticks() - tstart;
2634 if (ocs_ticks_to_ms(telapsed) >= max_isr_time_msec) {
2647 void *bmbx = hal->sli.bmbx.virt;
2649 int32_t mcqe_status;
2655 if (mcqe_status < 0) {
2656 ocs_log_err(hal->os,
"BMBX submission failed\n");
2665 ocs_log_err(hal->os,
"BMBX failed; bmbx_hdr: %08x, bmbx_cmd: %#x, bmbx_status: %#x\n",
2692 while (hal->cmd_head_count < (hal->mq[0]->length - 1U)) {
2699 hal->cmd_head_count++;
2743 if (hal->expiration_logged == 0 && err1 == 0x2 && err2 == 0x10) {
2744 hal->expiration_logged = 1;
2745 ocs_log_crit(hal->os,
"Emulex: Heartbeat expired after %d seconds\n",
2746 hal->watchdog_timeout);
2749 ocs_log_crit(hal->os,
"Chip is in an error state - reset needed\n");
2750 ocs_log_crit(hal->os,
"status=%#x error1=%#x error2=%#x\n",
2762 ocs_log_err(hal->os,
"MQ is not empty\n");
2764 ocs_sem_p(&hal->bmbx_sem, OCS_SEM_FOREVER);
2766 ocs_sem_v(&hal->bmbx_sem);
2771 ctx = ocs_malloc(hal->os,
sizeof(*ctx), OCS_M_ZERO | OCS_M_NOWAIT);
2773 ocs_log_err(hal->os,
"Can't allocate the command context\n");
2779 ocs_log_err(hal->os,
"HAL state (%d) is not active\n", hal->state);
2780 ocs_free(hal->os, ctx,
sizeof(*ctx));
2791 ocs_lock(&hal->cmd_lock);
2798 ocs_log_err(hal->os,
"MQE submission failed\n");
2799 ocs_free(hal->os, ctx,
sizeof(*ctx));
2801 ocs_unlock(&hal->cmd_lock);
2806 ocs_log_err(hal->os,
"MBOX command: %#x failed, rc: %d\n",
2828 ocs_log_err(NULL,
"bad parameter hal=%p which=%#x func=%p\n",
2835 hal->callback.domain = func;
2836 hal->args.domain = arg;
2839 hal->callback.port = func;
2840 hal->args.port = arg;
2843 hal->callback.unsolicited = func;
2844 hal->args.unsolicited = arg;
2847 hal->callback.rnode = func;
2848 hal->args.rnode = arg;
2851 hal->callback.bounce = func;
2852 hal->args.bounce = arg;
2855 hal->callback.xport = func;
2856 hal->args.xport = arg;
2859 ocs_log_test(hal->os,
"unknown callback %#x\n", which);
2885 uint8_t *cmd = NULL;
2889 sport->indicator = UINT32_MAX;
2891 sport->ctx.app = sport;
2892 sport->sm_free_req_pending = 0;
2898 ocs_log_crit(hal->os,
"Chip is in an error state - reset needed\n");
2903 ocs_memcpy(&sport->sli_wwpn, wwpn,
sizeof(sport->sli_wwpn));
2907 ocs_log_err(hal->os,
"FCOE_VPI allocation failure\n");
2911 if (domain != NULL) {
2914 cmd = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_ZERO | OCS_M_NOWAIT);
2916 ocs_log_err(hal->os,
"command memory allocation failed\n");
2918 goto ocs_hal_port_alloc_out;
2932 ocs_log_test(hal->os,
"need WWN for physical port\n");
2939 ocs_hal_port_alloc_out:
2944 ocs_log_err(hal->os,
"FCOE_VPI (%d) free failed, addr=%#x\n", sport->indicator, sport->fc_id);
2968 uint8_t *buf = NULL;
2971 if (!hal || !sport) {
2972 ocs_log_err(hal ? hal->os : NULL,
2973 "bad parameter(s) hal=%p sport=%p\n", hal,
2982 ocs_log_crit(hal->os,
"Chip is in an error state - reset needed\n");
2988 ocs_log_err(hal->os,
"no buffer for command\n");
2992 sport->fc_id = fc_id;
3069 uint8_t reset_alpa = 0;
3075 if (cfg_link == NULL) {
3076 ocs_log_err(hal->os,
"no buffer for command\n");
3087 speed = hal->config.speed;
3088 reset_alpa = (uint8_t)(value & 0xff);
3096 if (hal->workaround.fw_version_too_low) {
3099 ocs_log_err(hal->os,
"Cannot bring up link. Please update firmware to %s or later (current version is %s)\n",
3102 ocs_log_err(hal->os,
"Cannot bring up link. Please update firmware to %s or later (current version is %s)\n",
3111 if (init_link == NULL) {
3112 ocs_log_err(hal->os,
"no buffer for command\n");
3124 ocs_log_err(hal->os,
"INIT_LINK failed\n");
3134 if (down_link == NULL) {
3135 ocs_log_err(hal->os,
"no buffer for command\n");
3151 ocs_log_test(hal->os,
"unhandled control %#x\n", ctrl);
3176 if (!hal || !sport) {
3177 ocs_log_err(hal ? hal->os : NULL,
3178 "bad parameter(s) hal=%p sport=%p\n", hal,
3187 ocs_log_crit(hal->os,
"Chip is in an error state - reset needed\n");
3219 uint8_t *cmd = NULL;
3222 if (!hal || !domain || !domain->sport) {
3223 ocs_log_err(NULL,
"bad parameter(s) hal=%p domain=%p sport=%p\n",
3224 hal, domain, domain ? domain->sport : NULL);
3232 ocs_log_crit(hal->os,
"Chip is in an error state - reset needed\n");
3236 cmd = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_ZERO | OCS_M_NOWAIT);
3238 ocs_log_err(hal->os,
"command memory allocation failed\n");
3243 if (ocs_dma_alloc(hal->os, &domain->dma, 112, 4)) {
3244 ocs_log_err(hal->os,
"Failed to allocate DMA memory\n");
3250 domain->sm.app = domain;
3252 domain->fcf_indicator = UINT32_MAX;
3253 domain->vlan_id = vlan;
3254 domain->indicator = UINT32_MAX;
3257 ocs_log_err(hal->os,
"FCOE_VFI allocation failure\n");
3260 ocs_dma_free(hal->os, &domain->dma);
3282 uint8_t *buf = NULL;
3285 if (!hal || !domain) {
3286 ocs_log_err(hal ? hal->os : NULL,
3287 "bad parameter(s) hal=%p domain=%p\n",
3296 ocs_log_crit(hal->os,
"Chip is in an error state - reset needed\n");
3302 ocs_log_err(hal->os,
"no buffer for command\n");
3306 domain->sport->fc_id = fc_id;
3328 if (!hal || !domain) {
3329 ocs_log_err(hal ? hal->os : NULL,
3330 "bad parameter(s) hal=%p domain=%p\n",
3339 ocs_log_crit(hal->os,
"Chip is in an error state - reset needed\n");
3364 if (!hal || !domain) {
3365 ocs_log_err(NULL,
"bad parameter(s) hal=%p domain=%p\n", hal, domain);
3369 ocs_dma_free(hal->os, &domain->dma);
3371 ocs_log_err(hal->os,
"FCOE_VFI (%d) free failed\n", domain->indicator);
3390 ocs_sli_port_t *sport)
3393 if (UINT32_MAX != rnode->indicator) {
3394 ocs_log_err(hal->os,
"FCOE_RPI allocation failure addr=%#x rpi=%#x\n",
3395 fc_addr, rnode->indicator);
3403 ocs_log_crit(hal->os,
"Chip is in an error state - reset needed\n");
3408 rnode->sport = NULL;
3411 ocs_log_err(hal->os,
"FCOE_RPI allocation failure addr=%#x\n",
3416 rnode->fc_id = fc_addr;
3417 rnode->sport = sport;
3436 uint8_t *buf = NULL;
3438 uint8_t hlm = FALSE;
3440 if (!hal || !rnode || !sparms) {
3441 ocs_log_err(NULL,
"bad parameter(s) hal=%p rnode=%p sparms=%p\n",
3442 hal, rnode, sparms);
3450 ocs_log_crit(hal->os,
"Chip is in an error state - reset needed\n");
3456 ocs_log_err(hal->os,
"no buffer for command\n");
3464 if (rnode->index == UINT32_MAX) {
3465 ocs_log_err(NULL,
"bad parameter rnode->index invalid\n");
3469 count = ocs_atomic_add_return(&hal->rpi_ref[rnode->index].rpi_count, 1);
3476 ocs_log_test(hal->os,
"attach to already attached node HLM=%d count=%d\n",
3480 rnode->node_group = TRUE;
3481 rnode->attached = ocs_atomic_read(&hal->rpi_ref[rnode->index].rpi_attached);
3485 rnode->node_group = FALSE;
3490 rnode->indicator, rnode->sport->indicator, sparms, 0,
3491 (hal->tow_enabled && hal->config.tow_t10_enable), hlm);
3497 ocs_atomic_sub_return(&hal->rpi_ref[rnode->index].rpi_count, 1);
3498 ocs_log_err(hal->os,
"%s error\n", count ?
"HLM" :
"REG_RPI");
3520 if (!hal || !rnode) {
3521 ocs_log_err(NULL,
"bad parameter(s) hal=%p rnode=%p\n",
3527 if (!rnode->attached) {
3528 if (rnode->indicator != UINT32_MAX) {
3529 if (ocs_atomic_read(&hal->rpi_ref[rnode->index].rpi_count) > 0)
3533 ocs_log_err(hal->os,
"FCOE_RPI (%d) free failed, addr=%#x\n",
3534 rnode->indicator, rnode->fc_id);
3537 rnode->node_group = FALSE;
3538 rnode->indicator = UINT32_MAX;
3539 rnode->index = UINT32_MAX;
3540 rnode->free_group = FALSE;
3544 ocs_log_err(hal->os,
"Error: rnode is still attached\n");
3564 uint8_t *buf = NULL;
3566 uint32_t index = UINT32_MAX;
3570 if (!hal || !rnode) {
3571 ocs_log_err(NULL,
"bad parameter(s) hal=%p rnode=%p\n", hal, rnode);
3575 node = (ocs_node_t *)rnode->node;
3577 ocs_log_err(hal->os,
"bad parameter node=%p\n", node);
3585 ocs_log_crit(hal->os,
"Chip is in an error state - reset needed\n");
3589 index = rnode->index;
3595 if (!rnode->attached)
3600 ocs_log_err(hal->os,
"no buffer for command\n");
3604 indicator = rnode->indicator;
3605 count = ocs_atomic_sub_return(&hal->rpi_ref[index].rpi_count, 1);
3610 rnode->node_group = FALSE;
3611 rnode->free_group = TRUE;
3613 ocs_atomic_set(&hal->rpi_ref[index].rpi_attached, 0);
3616 ocs_log_err(hal->os,
"Invalid count with HLM disabled, count=%d\n", count);
3618 fc_id = rnode->fc_id & 0x00ffffff;
3619 rnode->free_group = FALSE;
3625 rnode->indicator = UINT32_MAX;
3628 if (!node->unreg_rpi) {
3629 node->unreg_rpi = TRUE;
3660 uint8_t *buf = NULL;
3664 ocs_log_err(NULL,
"bad parameter hal=%p\n", hal);
3672 ocs_log_crit(hal->os,
"Chip is in an error state - reset needed\n");
3678 ocs_log_err(hal->os,
"no buffer for command\n");
3697 if (!hal || !ngroup) {
3698 ocs_log_err(NULL,
"bad parameter hal=%p ngroup=%p\n",
3705 ocs_log_err(hal->os,
"FCOE_RPI allocation failure addr=%#x\n",
3716 if (!hal || !ngroup || !rnode) {
3717 ocs_log_err(NULL,
"bad parameter hal=%p ngroup=%p rnode=%p\n",
3718 hal, ngroup, rnode);
3722 if (rnode->attached) {
3723 ocs_log_err(hal->os,
"node already attached RPI=%#x addr=%#x\n",
3724 rnode->indicator, rnode->fc_id);
3728 if (rnode->indicator != UINT32_MAX &&
3729 ocs_atomic_read(&hal->rpi_ref[rnode->index].rpi_count) == 0) {
3731 ocs_log_err(hal->os,
"FCOE_RPI (%d) free failed, addr=%#x\n", rnode->indicator, rnode->fc_id);
3736 rnode->indicator = ngroup->indicator;
3737 rnode->index = ngroup->index;
3745 if (!hal || !ngroup) {
3746 ocs_log_err(NULL,
"bad parameter hal=%p ngroup=%p\n",
3751 ocs_assert(ocs_atomic_read(&hal->rpi_ref[ngroup->index].rpi_count) == 0, -1);
3754 ocs_log_err(hal->os,
"FCOE_RPI (%d) free failed\n", ngroup->indicator);
3758 ngroup->indicator = UINT32_MAX;
3759 ngroup->index = UINT32_MAX;
3782 io->abort_done = NULL;
3783 io->status_saved = 0;
3784 io->abort_in_progress = FALSE;
3785 io->port_owned_abort_count = 0;
3790 io->tgt_wqe_timeout = 0;
3805 static inline ocs_hal_io_t *
3808 ocs_hal_io_t *io = NULL;
3813 io->quarantine = FALSE;
3814 io->quarantine_first_phase = TRUE;
3815 io->abort_reqtag = UINT32_MAX;
3816 io->saved_status = 0;
3821 ocs_atomic_add_return(&hal->io_alloc_failed_count, 1);
3841 ocs_hal_io_t *io = NULL;
3843 ocs_lock(&hal->io_lock);
3845 ocs_unlock(&hal->io_lock);
3869 if (ocs_ref_read_count(&io->ref) > 0) {
3870 ocs_log_err(hal->os,
"Bad parameter: refcount > 0\n");
3874 if (io->wq != NULL) {
3875 ocs_log_err(hal->os,
"xri=%#x already in use\n", io->indicator);
3911 if (hal->workaround.use_dif_sec_xri) {
3943 ocs_hal_io_t *io = (ocs_hal_io_t *)arg;
3944 ocs_hal_t *hal = io->hal;
3951 ocs_lock(&hal->io_lock);
3955 ocs_unlock(&hal->io_lock);
3972 ocs_hal_io_t *io = (ocs_hal_io_t *)arg;
3973 ocs_hal_t *hal = io->hal;
3978 ocs_lock(&hal->io_lock);
3984 ocs_unlock(&hal->io_lock);
4004 if (ocs_ref_read_count(&io->ref) <= 0) {
4005 ocs_log_err(hal->os,
"Bad parameter: refcount <= 0 io=%p xri=%#x tag=%#x\n",
4006 io, io->indicator, io->reqtag);
4011 return ocs_ref_put(&io->ref);
4031 return (ocs_ref_read_count(&io->ref) > 0);
4054 if (wq->wqec_count) {
4057 if (wq->wqec_count == 0) {
4060 wq->wqec_count = wq->wqec_set_count;
4114 if (wq->free_count > 0) {
4148 wq->free_count += update_free_count;
4182 ocs_hal_io_t *sec_io;
4189 if (sec_io == NULL) {
4196 io->sec_hio = sec_io;
4200 sec_io->quarantine = TRUE;
4203 flags = io->sec_iparam.fcp_tgt.flags;
4210 io->tgt_wqe_timeout = io->sec_iparam.fcp_tgt.timeout;
4216 io->sec_iparam.fcp_tgt.offset, io->sec_len, io->indicator, io->sec_hio->indicator,
4218 io->sec_iparam.fcp_tgt.ox_id, io->rnode->indicator, io->rnode,
4220 io->sec_iparam.fcp_tgt.dif_oper, io->sec_iparam.fcp_tgt.blk_size, io->sec_iparam.fcp_tgt.cs_ctl,
4221 io->sec_iparam.fcp_tgt.app_id, io->sec_iparam.fcp_tgt.wqe_timer)) {
4222 ocs_log_test(hal->os,
"TRECEIVE WQE error\n");
4228 io->sec_iparam.fcp_tgt.offset, io->sec_len, io->indicator,
4230 io->sec_iparam.fcp_tgt.ox_id, io->rnode->indicator, io->rnode,
4232 io->sec_iparam.fcp_tgt.dif_oper, io->sec_iparam.fcp_tgt.blk_size,
4233 io->sec_iparam.fcp_tgt.cs_ctl, io->sec_iparam.fcp_tgt.app_id, io->sec_iparam.fcp_tgt.wqe_timer)) {
4234 ocs_log_test(hal->os,
"TRECEIVE WQE error\n");
4239 if (io->wq == NULL) {
4256 ocs_log_err(hal->os,
"sli_queue_write failed: %d\n", rc);
4296 ocs_dma_t *send, uint32_t len, ocs_dma_t *receive,
4302 uint16_t local_flags = 0;
4304 if (!hal || !io || !rnode || !iparam) {
4305 ocs_log_err(NULL,
"bad parm hal=%p io=%p send=%p receive=%p rnode=%p iparam=%p\n",
4306 hal, io, send, receive, rnode, iparam);
4311 ocs_log_test(hal->os,
"cannot send SRRS, HAL state=%d\n", hal->state);
4324 sge = io->sgl->virt;
4327 ocs_memset(io->sgl->virt, 0, 2 *
sizeof(
sli4_sge_t));
4349 *((uint8_t *)(send->virt)),
4352 ocs_log_err(hal->os,
"REQ WQE error\n");
4360 rnode, local_flags, UINT32_MAX)) {
4361 ocs_log_err(hal->os,
"RSP WQE error\n");
4370 ocs_log_err(hal->os,
"RSP (SID) WQE error\n");
4375 if ( (!send) ||
sli_gen_request64_wqe(&hal->sli, io->wqe.wqebuf, hal->sli.config.wqe_size, io->sgl, len,
4379 ocs_log_err(hal->os,
"GEN WQE error\n");
4388 ocs_log_err(hal->os,
"XMIT SEQ WQE error\n");
4409 io->indicator, io->reqtag,
4411 rnode, UINT32_MAX)) {
4412 ocs_log_err(hal->os,
"XMIT_BLS_RSP64 WQE error\n");
4428 io->indicator, io->reqtag,
4431 ocs_log_err(hal->os,
"XMIT_BLS_RSP64 WQE SID error\n");
4437 if ( (!send) ||
sli_xmit_bcast64_wqe(&hal->sli, io->wqe.wqebuf, hal->sli.config.wqe_size, send, len,
4441 ocs_log_err(hal->os,
"XMIT_BCAST64 WQE error\n");
4446 ocs_log_err(hal->os,
"bad SRRS type %#x\n", type);
4451 if (io->wq == NULL) {
4469 ocs_log_err(hal->os,
"sli_queue_write failed: %d\n", rc);
4509 void *cb,
void *arg)
4513 uint8_t send_wqe = TRUE;
4517 if (!hal || !io || !rnode || !iparam) {
4518 ocs_log_err(NULL,
"bad parm hal=%p io=%p iparam=%p rnode=%p\n",
4519 hal, io, iparam, rnode);
4524 ocs_log_err(hal->os,
"cannot send IO, HAL state=%d\n", hal->state);
4528 rpi = rnode->indicator;
4530 if (hal->workaround.use_unregistered_rpi && (rpi == UINT32_MAX)) {
4531 rpi = hal->workaround.unregistered_rid;
4532 ocs_log_test(hal->os,
"using unregistered RPI: %d\n", rpi);
4554 io->quarantine = TRUE;
4560 if (
sli_fcp_iread64_wqe(&hal->sli, io->wqe.wqebuf, hal->sli.config.wqe_size, &io->def_sgl, io->first_data_sge, len,
4564 ocs_log_err(hal->os,
"IREAD WQE error\n");
4572 if (
sli_fcp_iwrite64_wqe(&hal->sli, io->wqe.wqebuf, hal->sli.config.wqe_size, &io->def_sgl, io->first_data_sge,
4574 io->indicator, io->reqtag,
4578 ocs_log_err(hal->os,
"IWRITE WQE error\n");
4586 if (
sli_fcp_icmnd64_wqe(&hal->sli, io->wqe.wqebuf, hal->sli.config.wqe_size, &io->def_sgl,
4589 ocs_log_err(hal->os,
"ICMND WQE error\n");
4602 *((uint32_t *)xfer->
rsvd) = 0;
4618 io->quarantine = TRUE;
4635 if (io->ovfl_io != NULL) {
4636 io->sec_hio = io->ovfl_io;
4637 io->sec_hio->quarantine = TRUE;
4641 if (io->sec_hio == NULL) {
4645 io->sec_iparam = *iparam;
4647 ocs_lock(&hal->io_lock);
4651 hal->sec_hio_wait_count++;
4652 ocs_unlock(&hal->io_lock);
4659 io->sec_hio->quarantine = TRUE;
4667 if (io->xbusy && (io->sec_hio != NULL)) {
4669 iparam->
fcp_tgt.
offset, len, io->indicator, io->sec_hio->indicator,
4675 ocs_log_err(hal->os,
"TRECEIVE WQE error\n");
4679 if (
sli_fcp_treceive64_wqe(&hal->sli, io->wqe.wqebuf, hal->sli.config.wqe_size, &io->def_sgl, io->first_data_sge,
4686 ocs_log_err(hal->os,
"TRECEIVE WQE error\n");
4694 uint32_t suppress_rsp =
false;
4715 if (
sli_fcp_tsend64_wqe(&hal->sli, io->wqe.wqebuf, hal->sli.config.wqe_size, &io->def_sgl, io->first_data_sge,
4724 ocs_log_err(hal->os,
"TSEND WQE error\n");
4726 }
else if (hal->workaround.retain_tsend_io_length) {
4741 if (hal->tow_enabled && io->is_port_owned) {
4751 io->indicator, io->reqtag,
4758 ocs_log_err(hal->os,
"TRSP WQE error\n");
4765 ocs_log_err(hal->os,
"unsupported IO type %#x\n", type);
4770 if (io->wq == NULL) {
4781 OCS_STAT(hal->tcmd_wq_submit[io->wq->instance]++);
4790 ocs_log_err(hal->os,
"sli_queue_write failed: %d\n", rc);
4832 if (ctx->
wqcb == NULL) {
4833 ocs_log_err(hal->os,
"can't allocate request tag\n");
4840 wq = hal->hal_wq[0];
4844 xri = wq->send_frame_io->indicator;
4850 ocs_log_err(hal->os,
"sli_send_frame_wqe failed: %d\n", rc);
4857 ocs_log_err(hal->os,
"hal_wq_write failed: %d\n", rc);
4870 ocs_log_err(hal->os,
"can't use temporary SGL with pre-registered SGLs\n");
4874 io->ovfl_sgl_count = sgl_count;
4884 io->sgl = &io->def_sgl;
4885 io->sgl_count = io->def_sgl_count;
4895 if (io->ovfl_io != NULL) {
4901 io->ovfl_sgl = NULL;
4902 io->ovfl_sgl_count = 0;
4903 io->ovfl_lsp = NULL;
4924 ocs_log_err(hal ? hal->os : NULL,
"bad parameter hal=%p io=%p\n",
4930 io->sgl = &io->def_sgl;
4931 io->sgl_count = io->def_sgl_count;
4932 io->first_data_sge = 0;
4934 ocs_memset(io->sgl->virt, 0, 2 *
sizeof(
sli4_sge_t));
4940 data = io->sgl->virt;
4969 #define OCS_TARGET_WRITE_SKIPS 2
4987 #define OCS_TARGET_READ_SKIPS 2
4996 ocs_log_err(hal->os,
"unsupported IO type %#x\n", type);
5003 for (i = 0; i < skips; i++) {
5040 ocs_log_err(hal ? hal->os : NULL,
"bad parameter hal=%p io=%p dif_info=%p\n",
5045 data = io->sgl->virt;
5112 ocs_log_err(hal->os,
"unsupported DIF operation %#x\n",
5122 data[-1].
last = FALSE;
5136 if (io->sgl == io->ovfl_sgl) {
5147 io->def_sgl_count > 4 &&
5148 io->ovfl_io == NULL &&
5152 if (io->ovfl_io != NULL) {
5158 io->ovfl_sgl = &io->ovfl_io->def_sgl;
5159 io->ovfl_sgl_count = io->ovfl_io->def_sgl_count;
5164 if (io->ovfl_io == NULL || io->ovfl_sgl == NULL) {
5176 ocs_memset(lsp, 0,
sizeof(*lsp));
5182 io->ovfl_io->indicator,
5195 io->sgl = io->ovfl_sgl;
5196 io->sgl_count = io->ovfl_sgl_count;
5218 if (!hal || !io || !addr || !length) {
5219 ocs_log_err(hal ? hal->os : NULL,
5220 "bad parameter hal=%p io=%p addr=%lx length=%u\n",
5221 hal, io, addr, length);
5225 if ((length != 0) && (io->n_sge + 1) > io->sgl_count) {
5227 ocs_log_err(hal->os,
"SGL full (%d)\n", io->n_sge);
5233 ocs_log_err(hal->os,
"length of SGE %d bigger than allowed %d\n",
5238 data = io->sgl->virt;
5253 data[-1].
last = FALSE;
5257 if (io->first_data_sge == 0) {
5258 io->first_data_sge = io->n_sge;
5261 io->sge_offset += length;
5265 if (io->ovfl_lsp != NULL) {
5266 io->ovfl_lsp->segment_length = io->n_sge *
sizeof(
sli4_sge_t);
5287 if (!hal || !io || !addr) {
5288 ocs_log_err(hal ? hal->os : NULL,
5289 "bad parameter hal=%p io=%p addr=%lx\n",
5294 if ((io->n_sge + 1) > hal->config.n_sgl) {
5296 ocs_log_err(hal->os,
"SGL full (%d)\n", io->n_sge);
5301 data = io->sgl->virt;
5321 data[-1].
last = FALSE;
5343 ocs_hal_io_abort(ocs_hal_t *hal, ocs_hal_io_t *io_to_abort, uint32_t send_abts,
void *cb,
void *arg)
5346 uint32_t
id = 0, mask = 0;
5350 if (!hal || !io_to_abort) {
5351 ocs_log_err(hal ? hal->os : NULL,
5352 "bad parameter hal=%p io=%p\n",
5358 ocs_log_err(hal->os,
"cannot send IO abort, HAL state=%d\n",
5364 if (ocs_ref_get_unless_zero(&io_to_abort->ref) == 0) {
5366 ocs_log_test(hal ? hal->os : NULL,
5367 "io not active xri=0x%x tag=0x%x\n",
5368 io_to_abort->indicator, io_to_abort->reqtag);
5375 ocs_log_test(hal->os,
"is_port_owned %d io_to_abort xri=0x%x not active on WQ %p\n",
5376 io_to_abort->is_port_owned, io_to_abort->indicator, io_to_abort->wq);
5377 ocs_ref_put(&io_to_abort->ref);
5382 ocs_lock(&hal->io_abort_lock);
5383 if (io_to_abort->abort_in_progress) {
5384 ocs_unlock(&hal->io_abort_lock);
5385 ocs_ref_put(&io_to_abort->ref);
5386 ocs_log_debug(hal ? hal->os : NULL,
5387 "io already being aborted xri=0x%x tag=0x%x\n",
5388 io_to_abort->indicator, io_to_abort->reqtag);
5396 io_to_abort->abort_in_progress = 1;
5397 ocs_unlock(&hal->io_abort_lock);
5413 io_to_abort->abort_done = cb;
5414 io_to_abort->abort_arg = arg;
5417 id = io_to_abort->indicator;
5422 ocs_log_err(hal->os,
"can't allocate request tag\n");
5431 if (io_to_abort->wq != NULL) {
5434 io_to_abort->wqe.abort_wqe_submit_needed = 1;
5435 io_to_abort->wqe.send_abts = send_abts;
5436 io_to_abort->wqe.id = id;
5437 io_to_abort->wqe.abort_reqtag = io_to_abort->abort_reqtag;
5444 if (
sli_abort_wqe(&hal->sli, io_to_abort->wqe.wqebuf, hal->sli.config.wqe_size, atype, send_abts,
id, mask,
5446 ocs_log_err(hal->os,
"ABORT WQE error\n");
5447 io_to_abort->abort_reqtag = UINT32_MAX;
5453 if (io_to_abort->wq == NULL) {
5470 ocs_lock(&hal->io_abort_lock);
5471 io_to_abort->abort_in_progress = 0;
5472 ocs_unlock(&hal->io_abort_lock);
5473 ocs_ref_put(&io_to_abort->ref);
5491 ocs_log_err(hal ? hal->os : NULL,
5492 "bad parameter hal=%p io=%p\n", hal, io);
5496 return io->indicator;
5500 typedef struct ocs_hal_fw_write_cb_arg {
5505 typedef struct ocs_hal_sfp_cb_arg {
5511 typedef struct ocs_hal_temp_cb_arg {
5516 typedef struct ocs_hal_link_stat_cb_arg {
5521 typedef struct ocs_hal_host_stat_cb_arg {
5526 typedef struct ocs_hal_parity_stat_cb_arg {
5531 typedef struct ocs_hal_dump_get_cb_arg {
5537 typedef struct ocs_hal_dump_clear_cb_arg {
5543 typedef struct ocs_hal_fw_dump_location_results_s {
5611 ocs_log_test(hal->os,
"Function only supported for I/F type 2/6\n");
5615 mbxdata = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_ZERO | OCS_M_NOWAIT);
5616 if (mbxdata == NULL) {
5617 ocs_log_err(hal->os,
"failed to malloc mbox\n");
5622 if (cb_arg == NULL) {
5623 ocs_log_err(hal->os,
"failed to malloc cb_arg\n");
5635 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
5664 uint32_t bytes_written;
5665 uint32_t change_status;
5670 if (!cb_arg || !cb_arg->cb)
5671 goto ocs_hal_cb_fw_write_done;
5683 cb_arg->cb(status, wr_obj_rsp->
hdr.
additional_status, bytes_written, change_status, cb_arg->arg);
5685 ocs_hal_cb_fw_write_done:
5687 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
5715 ocs_dma_t *payload = NULL;
5716 uint32_t bytes_written;
5718 if (!cb_arg || !cb_arg->
cb)
5719 goto ocs_hal_cb_sfp_done;
5735 cb_arg->
cb(hal->os, status, bytes_written, sli4_rsp->
page_data, cb_arg->
arg);
5737 ocs_hal_cb_sfp_done:
5739 ocs_dma_free(hal->os, &cb_arg->
payload);
5740 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
5766 mbxdata = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_ZERO | OCS_M_NOWAIT);
5767 if (mbxdata == NULL) {
5768 ocs_log_err(hal->os,
"failed to malloc mbox\n");
5774 if (cb_arg == NULL) {
5775 ocs_log_err(hal->os,
"failed to malloc cb_arg\n");
5785 OCS_MIN_DMA_ALIGNMENT)) {
5786 ocs_log_err(hal->os,
"Failed to allocate DMA buffer\n");
5796 ocs_dma_free(hal->os, &cb_arg->
payload);
5797 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
5820 mbxdata = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_ZERO | OCS_M_NOWAIT);
5821 if (mbxdata == NULL) {
5822 ocs_log_err(hal->os,
"failed to malloc mbox");
5827 if (cb_arg == NULL) {
5828 ocs_log_err(hal->os,
"failed to malloc cb_arg");
5840 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
5867 uint32_t curr_temp = mbox_rsp->
resp_data[0];
5868 uint32_t crit_temp_thrshld = mbox_rsp->
resp_data[1];
5869 uint32_t warn_temp_thrshld = mbox_rsp->
resp_data[2];
5870 uint32_t norm_temp_thrshld = mbox_rsp->
resp_data[3];
5871 uint32_t fan_off_thrshld = mbox_rsp->
resp_data[4];
5872 uint32_t fan_on_thrshld = mbox_rsp->
resp_data[5];
5874 ocs_log_debug(hal->os,
"CB status %08x, curr_temp=%d crit_temp_thr=%d "\
5875 "warn_temp_thr %d norm_temp_thr %d foff_thr %d fon_thr %d\n",
5876 status, curr_temp, crit_temp_thrshld, warn_temp_thrshld,
5877 norm_temp_thrshld, fan_off_thrshld, fan_on_thrshld);
5879 if (!cb_arg || !cb_arg->
cb)
5880 goto ocs_hal_cb_temp_done;
5882 if ((0 == status) && mbox_rsp->
hdr.
status)
5885 cb_arg->
cb(status, curr_temp, crit_temp_thrshld, warn_temp_thrshld,
5886 norm_temp_thrshld, fan_off_thrshld, fan_on_thrshld, cb_arg->
arg);
5888 ocs_hal_cb_temp_done:
5890 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
5910 uint8_t req_ext_counters,
5911 uint8_t clear_overflow_flags,
5912 uint8_t clear_all_counters,
5920 mbxdata = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_ZERO | OCS_M_NOWAIT);
5921 if (mbxdata == NULL) {
5922 ocs_log_err(hal->os,
"failed to malloc mbox");
5927 if (cb_arg == NULL) {
5928 ocs_log_err(hal->os,
"failed to malloc cb_arg");
5938 clear_overflow_flags, clear_all_counters);
5941 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
5969 uint32_t num_counters = (mbox_rsp->
gec ? 20 : 13);
5971 if (!cb_arg || !cb_arg->
cb)
5972 goto ocs_hal_cb_link_stat_done;
6020 if ((0 == status) && mbox_rsp->
hdr.
status)
6023 cb_arg->
cb(status, num_counters, counts, cb_arg->
arg);
6025 ocs_hal_cb_link_stat_done:
6027 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
6050 mbxdata = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_ZERO | OCS_M_NOWAIT);
6051 if (mbxdata == NULL) {
6052 ocs_log_err(hal->os,
"failed to malloc mbox");
6057 OCS_M_ZERO | OCS_M_NOWAIT);
6058 if (cb_arg == NULL) {
6059 ocs_log_err(hal->os,
"failed to malloc cb_arg");
6071 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
6103 if (!cb_arg || !cb_arg->
cb)
6104 goto ocs_hal_cb_host_stat_done;
6123 if ((0 == status) && mbox_rsp->
hdr.
status)
6126 cb_arg->
cb(status, num_counters, counts, cb_arg->
arg);
6128 ocs_hal_cb_host_stat_done:
6130 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
6144 typedef struct ocs_hal_linkcfg_map_s {
6169 typedef struct ocs_hal_skyhawk_linkcfg_map_s {
6194 for (i = 0; i < ARRAY_SIZE(linkcfg_map); i++) {
6195 if (ocs_strncmp(linkcfg_map[i].clp_str, clp_str, ocs_strlen(clp_str)) == 0) {
6196 return linkcfg_map[i].
linkcfg;
6215 for (i = 0; i < ARRAY_SIZE(linkcfg_map); i++) {
6216 if (linkcfg_map[i].linkcfg == linkcfg) {
6217 return linkcfg_map[i].
clp_str;
6236 for (i = 0; i < ARRAY_SIZE(skyhawk_linkcfg_map); i++) {
6237 if (skyhawk_linkcfg_map[i].linkcfg == linkcfg) {
6238 return skyhawk_linkcfg_map[i].
config_id;
6256 for (i = 0; i < ARRAY_SIZE(skyhawk_linkcfg_map); i++) {
6257 if (skyhawk_linkcfg_map[i].config_id == config_id) {
6258 return skyhawk_linkcfg_map[i].
linkcfg;
6267 typedef struct ocs_hal_linkcfg_cb_arg_s {
6293 ocs_log_debug(hal->os,
"Function not supported\n");
6303 ocs_log_test(hal->os,
"Function not supported for this IF_TYPE\n");
6325 const char *value_str = NULL;
6332 cb_arg = ocs_malloc(hal->os,
sizeof(*cb_arg), OCS_M_NOWAIT);
6333 if (cb_arg == NULL) {
6334 ocs_log_err(hal->os,
"failed to malloc cb_arg");
6340 if (ocs_dma_alloc(hal->os, &cb_arg->
dma_cmd, ocs_strlen(cmd)+1, 4096)) {
6341 ocs_log_err(hal->os,
"malloc failed\n");
6342 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
6345 ocs_memset(cb_arg->
dma_cmd.virt, 0, ocs_strlen(cmd)+1);
6346 ocs_memcpy(cb_arg->
dma_cmd.virt, cmd, ocs_strlen(cmd));
6350 ocs_log_err(hal->os,
"malloc failed\n");
6351 ocs_dma_free(hal->os, &cb_arg->
dma_cmd);
6352 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
6357 cb_arg->
opts = opts;
6367 ocs_log_test(hal->os,
"CLP cmd=\"%s\" failed\n",
6368 (
char *)cb_arg->
dma_cmd.virt);
6370 ocs_dma_free(hal->os, &cb_arg->
dma_cmd);
6371 ocs_dma_free(hal->os, &cb_arg->
dma_resp);
6372 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
6393 if (!cb_arg || !cb_arg->
cb)
6394 goto ocs_hal_set_active_link_config_cb_done;
6396 if ((0 == status) && mbox_rsp->
hdr.
status)
6399 cb_arg->
cb(status, 0, cb_arg->
arg);
6401 ocs_hal_set_active_link_config_cb_done:
6403 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
6430 if (config_id == 0) {
6431 ocs_log_test(hal->os,
"Link config %d not supported by Skyhawk\n", value);
6436 mbxdata = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_ZERO | OCS_M_NOWAIT);
6437 if (mbxdata == NULL) {
6438 ocs_log_err(hal->os,
"failed to malloc mbox\n");
6444 if (cb_arg == NULL) {
6445 ocs_log_err(hal->os,
"failed to malloc cb_arg\n");
6457 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
6481 ocs_log_debug(hal->os,
"Function not supported\n");
6492 ocs_log_test(hal->os,
"Function not supported for this IF_TYPE\n");
6515 cb_arg = ocs_malloc(hal->os,
sizeof(*cb_arg), OCS_M_NOWAIT);
6516 if (cb_arg == NULL) {
6517 ocs_log_err(hal->os,
"failed to malloc cb_arg");
6524 if (ocs_dma_alloc(hal->os, &cb_arg->
dma_cmd, ocs_strlen(cmd)+1, 4096)) {
6525 ocs_log_err(hal->os,
"malloc failed\n");
6526 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
6531 ocs_memset(cb_arg->
dma_cmd.virt, 0, ocs_strlen(cmd)+1);
6532 ocs_memcpy(cb_arg->
dma_cmd.virt, cmd, ocs_strlen(cmd));
6536 ocs_log_err(hal->os,
"malloc failed\n");
6537 ocs_dma_free(hal->os, &cb_arg->
dma_cmd);
6538 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
6543 cb_arg->
opts = opts;
6553 ocs_log_test(hal->os,
"CLP cmd=\"%s\" failed\n",
6554 (
char *)cb_arg->
dma_cmd.virt);
6556 ocs_dma_free(hal->os, &cb_arg->
dma_cmd);
6557 ocs_dma_free(hal->os, &cb_arg->
dma_resp);
6558 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
6581 if (!cb_arg || !cb_arg->
cb)
6582 goto ocs_hal_get_active_link_config_cb_done;
6598 cb_arg->
cb(status, value, cb_arg->
arg);
6600 ocs_hal_get_active_link_config_cb_done:
6602 ocs_dma_free(hal->os, &cb_arg->
dma_cmd);
6603 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
6627 mbxdata = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_ZERO | OCS_M_NOWAIT);
6628 if (mbxdata == NULL) {
6629 ocs_log_err(hal->os,
"failed to malloc mbox\n");
6635 if (cb_arg == NULL) {
6636 ocs_log_err(hal->os,
"failed to malloc cb_arg\n");
6643 cb_arg->
opts = opts;
6647 ocs_log_err(hal->os,
"Failed to allocate DMA buffer\n");
6657 ocs_dma_free(hal->os, &cb_arg->
dma_cmd);
6658 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
6682 ocs_memset(&seed_param, 0,
sizeof(seed_param));
6683 seed_param.
seed = hal->config.dif_seed;
6693 ocs_log_debug(hal->os,
"DIF seed set to 0x%x\n", hal->config.dif_seed);
6711 ocs_memset(&mode_param, 0,
sizeof(mode_param));
6722 ocs_log_test(hal->os,
"DIF mode set to %s\n",
6730 ocs_hal_t *hal = (ocs_hal_t *)arg;
6740 uint16_t timeout = hal->watchdog_timeout;
6756 (timeout*1000 - 500),
false);
6758 ocs_del_timer(&hal->watchdog_timer);
6777 uint8_t *buf = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_NOWAIT);
6780 ocs_log_err(hal->os,
"no buffer for command\n");
6803 if (!cb_arg || !cb_arg->
cb)
6804 goto ocs_hal_cb_itcm_parity_stats_done;
6815 ocs_hal_cb_itcm_parity_stats_done:
6817 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
6825 uint8_t *buf = NULL;
6831 ocs_log_err(hal->os,
"Failed to malloc mbox\n");
6835 cb_arg = ocs_malloc(hal->os,
sizeof(*cb_arg), OCS_M_NOWAIT);
6837 ocs_log_err(hal->os,
"Failed to malloc cb_arg\n");
6848 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
6866 status = sli4_rsp_hdr->
status;
6875 results->
status = ((0 == status) ? 0 : 1);
6878 if (ocs_atomic_sub_and_test(&results->
refcnt, 1))
6879 ocs_free(hal->os, results,
sizeof(*results));
6903 if (results == NULL) {
6904 ocs_log_err(hal->os,
"Failed to allocate memory\n");
6911 ocs_sem_init(&results->
wait_sem, 0,
"mq_mbx_results_sem");
6912 ocs_atomic_init(&results->
refcnt, 2);
6918 ocs_atomic_sub_and_test(&results->
refcnt, 1);
6922 if (ocs_sem_p(&results->
wait_sem, timeout_usecs)) {
6923 ocs_log_err(hal->os,
"ocs_sem_p failed\n");
6929 if (rc || results->
status) {
6930 ocs_log_err(hal->os,
"MBOX command failed\n");
6936 if (ocs_atomic_sub_and_test(&results->
refcnt, 1))
6937 ocs_free(hal->os, results,
sizeof(*results));
6957 ocs_log_err(NULL,
"Failed to access HAL\n");
6962 ocs_log_err(hal->os,
"[ Trunk ] Invalid mode %d\n", trunk_mode);
6969 ocs_log_err(hal->os,
"[ Trunk ] config failed, rc = %d\n", rc);
6971 ocs_log_info(hal->os,
"[ Trunk ] mode=%d configured successfully."
6972 "Host reboot is required for the new configuration to take effect\n",
7003 ocs_log_err(hal->os,
"[ Trunk ] READ_TOPOLOGY failed, rc = %d\n", rc);
7021 ocs_log_info(hal->os,
"[RAS] Attempting to stop diagnostic logging\n");
7022 buf = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_NOWAIT | OCS_M_ZERO);
7024 ocs_log_err(hal->os,
"no buffer for FW diag logging command\n");
7033 ocs_log_info(hal->os,
"[RAS] stopped diagnostic logging successfully\n");
7067 uintptr_t lwpd_phys;
7068 uint32_t *buf_phys_tbl = NULL;
7074 ocs_log_info(hal->os,
"[RAS] Setup firmware diagnostic logging\n");
7077 if (rc == -EEXIST) {
7079 ocs_log_info(hal->os,
"[RAS] firmware diagnostic logging is active for the adapter\n");
7081 }
else if (rc == -EPERM) {
7091 if (!lwpd_phys || !buf_phys_tbl || !buf_count) {
7092 ocs_log_err(hal->os,
"[RAS] resource error\n");
7097 buf = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_NOWAIT | OCS_M_ZERO);
7099 ocs_log_err(hal->os,
"[RAS] no buffer for LOWLEVEL_SET_DIAG_LOG_OPTIONS mailbox command\n");
7105 log_size / buf_count, buf_count, buf_phys_tbl, lwpd_phys);
7111 ocs_log_info(hal->os,
"[RAS] diagnostic logging configured successfully\n");
7117 ocs_vfree(hal->os, buf_phys_tbl, buf_count * 8);
7137 ocs_memset(¶m, 0,
sizeof(param));
7152 ocs_log_info(hal->os,
"Optimized Write T10 PI configured \n");
7171 ocs_memset(¶m, 0,
sizeof(param));
7172 param.
rtc = (hal->config.tow_ref_tag_lba ? 0 : 1);
7173 param.
atv = (hal->config.tow_app_tag_valid ? 1 : 0);
7175 param.
app_tag = hal->config.tow_app_tag_value;
7176 param.
blk_size = hal->config.tow_blksize_chip;
7178 switch (hal->config.tow_p_type) {
7186 ocs_log_err(hal->os,
"unsupported p_type %d\n", hal->config.tow_p_type);
7199 ocs_log_info(hal->os,
"Auto XFER RDY T10 PI configured rtc:%d atv:%d p_type:%d app_tag:%x blk_size:%d\n",
7225 ocs_memset(¶m, 0,
sizeof(param));
7239 ocs_log_test(hal->os,
"SLI Port Health Check is enabled \n");
7260 ocs_memset(¶m, 0,
sizeof(param));
7275 ocs_log_test(hal->os,
"FEC feature set to %d \n", enable);
7299 ocs_memset(¶m, 0,
sizeof(param));
7312 ocs_log_test(hal->os,
"Auto-response parameter field reset feature set to %d \n", enable);
7320 int i, token_cnt = 0;
7322 char *dup_str = ocs_strdup(hal->sliport_pause_errors);
7323 char *pause_errors = dup_str;
7326 while (NULL != (token = ocs_strsep(&pause_errors,
","))) {
7327 errx_pair[token_cnt++] = token;
7335 for (i = 0; i < token_cnt; i++) {
7340 while (NULL != (err1 = ocs_strsep(&errx_pair[i],
" "))) {
7341 if (
'\0' != *err1) {
7347 while (NULL != (err2 = ocs_strsep(&errx_pair[i],
" "))) {
7348 if (
'\0' != *err2) {
7355 hal->sli.pause_errx_pair[i].err1 = ocs_strtoul(err1, &token, 16);
7362 hal->sli.pause_errx_pair[i].err2 = ocs_strtoul(err2, &token, 16);
7364 hal->sli.pause_errx_pair[i].err2 = 0xFFFFFFFF;
7367 ocs_log_info(hal->os,
"err1[%d]: 0x%x, err2[%d]: 0x%x\n",
7368 i, hal->sli.pause_errx_pair[i].err1,
7369 i, hal->sli.pause_errx_pair[i].err2);
7372 ocs_free(hal->os, dup_str, ocs_strlen(hal->sliport_pause_errors) + 1);
7382 ocs_memset(¶m, 0,
sizeof(param));
7388 sizeof(param), ¶m);
7395 ocs_log_test(hal->os,
"Sliport pause state is enabled\n");
7416 ocs_memset(¶m, 0,
sizeof(param));
7428 ocs_log_info(hal->os,
"Set FTD transfer hint to %d\n", param.
fdt_xfer_hint);
7447 char retdata_str[64];
7452 ocs_log_test(hal->os,
"CLP cmd failed, status=%d\n", status);
7456 sizeof(retdata_str),
7461 ocs_log_err(hal->os,
"failed to get retdata %d\n", result_len);
7470 cb_arg->
cb(status, linkcfg, cb_arg->
arg);
7475 ocs_dma_free(hal->os, &cb_arg->
dma_cmd);
7476 ocs_dma_free(hal->os, &cb_arg->
dma_resp);
7477 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
7481 #if !defined(OCSU_FC_RAMD) && !defined(OCSU_FC_WORKLOAD) && !defined(OCS_USPACE_SPDK)
7501 ocs_dma_t *dump_sges = NULL;
7503 if (!dump_buffers || !num_buffers) {
7504 ocs_log_err(hal->os,
"Dump buffers are missing\n");
7512 if (num_buffers > 1) {
7513 uint32_t sge_size = num_buffers *
sizeof(
sli4_sge_t);
7517 dump_sges = (fdb ? &hal->func_dump_sges : &hal->chip_dump_sges);
7518 if (dump_sges->size < sge_size) {
7519 ocs_dma_free(hal->os, dump_sges);
7520 if (ocs_dma_alloc(hal->os, dump_sges, sge_size, OCS_MIN_DMA_ALIGNMENT)) {
7521 ocs_log_err(hal->os,
"SGE DMA allocation failed\n");
7527 ocs_memset(dump_sges->virt, 0, dump_sges->size);
7528 dump_sges->len = sge_size;
7529 sge = dump_sges->virt;
7531 for (i = 0; i < num_buffers; i++) {
7532 sge[i].buffer_address_high = ocs_addr32_hi(dump_buffers[i].phys);
7533 sge[i].buffer_address_low = ocs_addr32_lo(dump_buffers[i].phys);
7534 sge[i].last = (i == num_buffers - 1 ? 1 : 0);
7535 sge[i].buffer_length = dump_buffers[i].size;
7541 dump_buffers->len = dump_buffers->size;
7548 ocs_log_debug(hal->os,
"Set %s dump location is successful\n", fdb ?
"func" :
"chip");
7552 ocs_dma_free(hal->os, dump_sges);
7554 ocs_log_err(hal->os,
"Set %s dump location command failed\n", fdb ?
"func" :
"chip");
7563 ocs_t *ocs = (ocs_t *)hal->os;
7564 ocs_dma_t *dump_buffers = NULL;
7565 uint32_t i, num_buffers = 0;
7567 if (ocs->fw_dump.chip_dump_buffers) {
7568 dump_buffers = ocs->fw_dump.chip_dump_buffers;
7569 num_buffers = ocs->fw_dump.num_chip_dump_buffers;
7571 for (i = 0; i < num_buffers; i++) {
7572 ocs_dma_free(ocs, &dump_buffers[i]);
7575 ocs_free(ocs, dump_buffers,
sizeof(ocs_dma_t) * num_buffers);
7576 ocs->fw_dump.chip_dump_buffers = NULL;
7577 ocs->fw_dump.num_chip_dump_buffers = 0;
7580 if (ocs->fw_dump.func_dump_buffers) {
7581 dump_buffers = ocs->fw_dump.func_dump_buffers;
7582 num_buffers = ocs->fw_dump.num_func_dump_buffers;
7584 for (i = 0; i < num_buffers; i++) {
7585 ocs_dma_free(ocs, &dump_buffers[i]);
7588 ocs_free(ocs, dump_buffers,
sizeof(ocs_dma_t) * num_buffers);
7589 ocs->fw_dump.func_dump_buffers = NULL;
7590 ocs->fw_dump.num_func_dump_buffers = 0;
7593 if (ocs->fw_dump.saved_buff) {
7594 ocs_free(ocs, ocs->fw_dump.saved_buff, ocs->fw_dump.size);
7595 ocs->fw_dump.saved_buff = NULL;
7597 ocs->fw_dump.size = 0;
7600 ocs_lock_free(&ocs->fw_dump.lock);
7608 uint32_t rem_bytes = 0;
7609 uint32_t num_buffers = 0;
7610 ocs_dma_t *dump_buffers = NULL;
7613 dump_buffers = ocs->fw_dump.func_dump_buffers;
7614 num_buffers = ocs->fw_dump.num_func_dump_buffers;
7616 dump_buffers = ocs->fw_dump.chip_dump_buffers;
7617 num_buffers = ocs->fw_dump.num_chip_dump_buffers;
7621 if ((NULL != dump_buffers) && (0 != num_buffers)) {
7626 if (!ocs->fw_dump.saved_buff)
7627 ocs->fw_dump.saved_buff = ocs_malloc(ocs, ocs->fw_dump.size, OCS_M_ZERO);
7629 if (!ocs->fw_dump.saved_buff) {
7630 ocs_log_err(ocs,
"Failed to allocated dump saved buffer\n");
7632 goto free_dump_buffers;
7635 num_buffers = ((ocs->fw_dump.size + OCS_MAX_DMA_ALLOC - 1) / OCS_MAX_DMA_ALLOC);
7636 dump_buffers = ocs_malloc(ocs,
sizeof(ocs_dma_t) * num_buffers, OCS_M_ZERO);
7637 if (!dump_buffers) {
7638 ocs_log_err(ocs,
"Failed to allocate buffer dma objects for dump\n");
7640 goto free_dump_buffers;
7644 ocs->fw_dump.func_dump_buffers = dump_buffers;
7645 ocs->fw_dump.num_func_dump_buffers = num_buffers;
7647 ocs->fw_dump.chip_dump_buffers = dump_buffers;
7648 ocs->fw_dump.num_chip_dump_buffers = num_buffers;
7652 rem_bytes = ocs->fw_dump.size;
7654 for (i = 0; i < num_buffers; i++) {
7655 uint32_t num_bytes = OCS_MIN(rem_bytes, OCS_MAX_DMA_ALLOC);
7656 rc = ocs_dma_alloc(ocs, &dump_buffers[i], num_bytes, OCS_MIN_DMA_ALIGNMENT);
7658 ocs_log_err(ocs,
"Failed to allocate buffer for dump\n");
7660 goto free_dump_buffers;
7662 rem_bytes -= num_bytes;
7665 ocs_log_debug(ocs,
"Successfully allocated FW dump buffers\n");
7676 ocs_t *ocs = (ocs_t *)hal->os;
7678 uint32_t num_buffers = 0;
7679 ocs_dma_t *dump_buffers = NULL;
7685 ocs_log_err(ocs,
"Failed to register FW dump buffers\n");
7691 dump_buffers = ocs->fw_dump.func_dump_buffers;
7692 num_buffers = ocs->fw_dump.num_func_dump_buffers;
7695 dump_buffers = ocs->fw_dump.chip_dump_buffers;
7696 num_buffers = ocs->fw_dump.num_chip_dump_buffers;
7701 ocs_log_err(hal->os,
"Failed to register dump to host buffers\n");
7703 ocs_log_info(hal->os,
"Dump to host buffers registered with FW successfully\n");
7723 ocs_t *ocs = (ocs_t *)hal->os;
7724 uint8_t bus, dev, func;
7728 ocs_log_err(ocs,
"ocs context is missing\n");
7741 if (hal->workaround.disable_dump_loc) {
7742 ocs_log_err(hal->os,
"FW version is too old for this feature\n");
7778 ocs_log_err(NULL,
"Failed to access HAL\n");
7802 void *rx_buff,
size_t rx_buff_len)
7806 ocs_dma_t tx_dma_buf, rx_dma_buf;
7809 ocs_log_err(NULL,
"Failed to access HAL\n");
7813 if (ocs_dma_alloc(hal->os, &tx_dma_buf, tx_buff_len, OCS_MIN_DMA_ALIGNMENT)) {
7814 ocs_log_err(hal->os,
"Failed to alloc DMA memory for TX buffer\n");
7818 if (ocs_dma_alloc(hal->os, &rx_dma_buf, rx_buff_len, OCS_MIN_DMA_ALIGNMENT)) {
7819 ocs_log_err(hal->os,
"Failed to alloc DMA memory for RX buffer\n");
7820 ocs_dma_free(hal->os, &tx_dma_buf);
7823 ocs_memset(tx_dma_buf.virt, 0, tx_buff_len);
7824 ocs_memset(rx_dma_buf.virt, 0, rx_buff_len);
7826 ocs_memcpy(tx_dma_buf.virt, tx_buff, tx_buff_len);
7829 &tx_dma_buf, tx_buff_len,
7830 &rx_dma_buf, rx_buff_len))
7835 goto exit_run_biu_diag;
7837 ocs_log_err(hal->os,
"sli_cmd_config_run_biu_diag failed\n");
7839 goto exit_run_biu_diag;
7842 ocs_memcpy(rx_buff, rx_dma_buf.virt, rx_buff_len);
7845 ocs_dma_free(hal->os, &tx_dma_buf);
7846 ocs_dma_free(hal->os, &rx_dma_buf);
7873 ocs_log_test(hal->os,
"Function only supported for I/F type 2\n");
7879 if (ocs_dma_alloc(hal->os, &dma_cmd, ocs_strlen(cmd)+1, 4096)) {
7880 ocs_log_err(hal->os,
"malloc failed\n");
7883 ocs_memset(dma_cmd.virt, 0, ocs_strlen(cmd)+1);
7884 ocs_memcpy(dma_cmd.virt, cmd, ocs_strlen(cmd));
7888 ocs_log_err(hal->os,
"malloc failed\n");
7889 ocs_dma_free(hal->os, &dma_cmd);
7895 ocs_log_err(hal->os,
"CLP cmd=\"%s\" failed\n", (
char *)dma_cmd.virt);
7899 ocs_dma_free(hal->os, &dma_cmd);
7900 ocs_dma_free(hal->os, &dma_resp);
7907 typedef struct ocs_hal_clp_cb_arg_s {
7936 mbxdata = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_ZERO | OCS_M_NOWAIT);
7937 if (mbxdata == NULL) {
7938 ocs_log_err(hal->os,
"failed to malloc mbox\n");
7943 cb_arg = ocs_malloc(hal->os,
sizeof(*cb_arg), OCS_M_NOWAIT);
7944 if (cb_arg == NULL) {
7945 ocs_log_err(hal->os,
"failed to malloc cb_arg");
7953 cb_arg->
opts = opts;
7959 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
7982 uint8_t bus, dev, func;
7990 if (hal->workaround.disable_dump_loc) {
7991 ocs_log_test(hal->os,
"FW version is too old for this feature\n");
8009 ocs_log_err(hal->os,
"Clear dump locaton failed\n");
8011 ocs_log_info(hal->os,
"Dump buffers cleared with FW successfully\n");
8034 char stat_str[8] = {
'\0' };
8035 int32_t stat_len = 0;
8036 uint32_t result_len = 0;
8038 if (clp_rsp->hdr.status)
8041 if (!cb_arg || !cb_arg->cb)
8042 goto ocs_hal_dmtf_clp_cb_done;
8045 if (mbox_rsp->hdr.status)
8046 status = mbox_rsp->hdr.status;
8047 else if (clp_rsp->hdr.status)
8048 status = clp_rsp->hdr.status;
8052 result_len = clp_rsp->resp_length;
8054 goto ocs_hal_dmtf_clp_invoke_cb;
8056 if (!result_len || (cb_arg->dma_resp->size < result_len)) {
8057 ocs_log_test(hal->os,
"Invalid response length: resp_len=%zu result len=%d\n",
8058 cb_arg->dma_resp->size, result_len);
8060 goto ocs_hal_dmtf_clp_invoke_cb;
8065 cb_arg->dma_resp->virt, result_len);
8066 if (stat_len <= 0) {
8067 ocs_log_test(hal->os,
"Failed to get status, status len=%d\n", stat_len);
8069 goto ocs_hal_dmtf_clp_invoke_cb;
8072 if (0 != ocs_strcmp(stat_str,
"0")) {
8073 ocs_log_test(hal->os,
"CLP status indicates failure=%s\n", stat_str);
8077 ocs_hal_dmtf_clp_invoke_cb:
8078 cb_arg->status = status;
8079 cb_arg->cb(hal, cb_arg->status, result_len, cb_arg->arg);
8081 ocs_hal_dmtf_clp_cb_done:
8083 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
8110 start = ocs_strstr(resp, keyword);
8111 if (start == NULL) {
8112 ocs_log_test(hal->os,
"could not find keyword=%s in CLP response\n",
8118 start = ocs_strchr(start,
'=');
8119 if (start == NULL) {
8120 ocs_log_test(hal->os,
"could not find \'=\' in CLP response for keyword=%s\n",
8127 end = ocs_strstr(start,
"\r\n");
8129 ocs_log_test(hal->os,
"could not find \\r\\n for keyword=%s in CLP response\n",
8135 if ((end - start + 1) > value_len) {
8136 ocs_log_test(hal->os,
"value len=%d not large enough for actual=%ld\n",
8137 value_len, (end-start));
8141 ocs_strncpy(value, start, (end - start));
8142 value[end-start] =
'\0';
8143 return (end-start+1);
8199 uint8_t eof = rd_obj_rsp->
eof;
8204 if (!cb_arg || !cb_arg->cb)
8205 goto ocs_hal_cb_dump_get_done;
8214 cb_arg->cb(status, bytes_read, eof, cb_arg->arg);
8216 ocs_hal_cb_dump_get_done:
8218 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
8254 ocs_log_test(hal->os,
"Function only supported for I/F type 2\n");
8259 ocs_log_test(hal->os,
"No dump is present\n");
8264 ocs_log_test(hal->os,
"device reset required\n");
8268 mbxdata = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_ZERO | OCS_M_NOWAIT);
8269 if (mbxdata == NULL) {
8270 ocs_log_err(hal->os,
"failed to malloc mbox\n");
8275 if (cb_arg == NULL) {
8276 ocs_log_err(hal->os,
"failed to malloc cb_arg\n");
8289 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
8320 if (!cb_arg || !cb_arg->
cb)
8321 goto ocs_hal_cb_dump_clear_done;
8323 if ((0 == status) && mbox_rsp->
hdr.
status)
8326 cb_arg->
cb(status, cb_arg->
arg);
8328 ocs_hal_cb_dump_clear_done:
8330 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
8362 ocs_log_test(hal->os,
"Function only supported for I/F type 2\n");
8366 mbxdata = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_ZERO | OCS_M_NOWAIT);
8367 if (mbxdata == NULL) {
8368 ocs_log_err(hal->os,
"failed to malloc mbox\n");
8373 if (cb_arg == NULL) {
8374 ocs_log_err(hal->os,
"failed to malloc cb_arg\n");
8387 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
8397 typedef struct ocs_hal_get_port_protocol_cb_arg_s {
8421 ocs_dma_t *payload = NULL;
8425 int i, num_descriptors;
8427 if (!cb_arg || !cb_arg->
cb)
8428 goto ocs_hal_get_port_protocol_cb_done;
8437 for (i = 0; i < num_descriptors; i++) {
8441 switch(pcie_desc_p->
pf_type) {
8465 cb_arg->
cb(status, port_protocol, cb_arg->
arg);
8467 ocs_hal_get_port_protocol_cb_done:
8469 ocs_dma_free(hal->os, &cb_arg->
payload);
8470 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
8511 mbxdata = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_ZERO | OCS_M_NOWAIT);
8512 if (mbxdata == NULL) {
8513 ocs_log_err(hal->os,
"failed to malloc mbox\n");
8520 if (cb_arg == NULL) {
8521 ocs_log_err(hal->os,
"failed to malloc cb_arg\n");
8527 cb_arg->
arg = ul_arg;
8531 if (ocs_dma_alloc(hal->os, &cb_arg->
payload, 4096, 4)) {
8532 ocs_log_err(hal->os,
"Failed to allocate DMA buffer\n");
8542 ocs_dma_free(hal->os, &cb_arg->
payload);
8543 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
8551 typedef struct ocs_hal_set_port_protocol_cb_arg_s {
8582 ocs_dma_t *payload = NULL;
8584 if (!cb_arg || !cb_arg->
cb)
8585 goto ocs_hal_set_port_protocol_cb2_done;
8599 cb_arg->
cb(status, cb_arg->
arg);
8601 ocs_hal_set_port_protocol_cb2_done:
8603 ocs_dma_free(hal->os, &cb_arg->
payload);
8604 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
8639 ocs_dma_t *payload = &cb_arg->
payload;
8645 uint8_t *dst, *mbxdata;
8646 int i, num_descriptors = response->
desc_count;
8647 int pci_descriptor_count = 0;
8648 int num_fcoe_ports = 0;
8649 int num_iscsi_ports = 0;
8653 for (i = 0; i < num_descriptors; i++) {
8655 ++pci_descriptor_count;
8661 mbxdata = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_ZERO | OCS_M_NOWAIT);
8663 ocs_log_err(hal->os,
"Failed to malloc mbox\n");
8668 new_cb_arg = ocs_malloc(hal->os,
sizeof(*new_cb_arg), OCS_M_NOWAIT);
8670 ocs_log_err(hal->os,
"Failed to malloc cb_arg\n");
8675 new_cb_arg->
cb = cb_arg->
cb;
8676 new_cb_arg->
arg = cb_arg->
arg;
8685 ocs_log_err(hal->os,
"Failed to allocate DMA buffer\n");
8686 ocs_free(hal->os, new_cb_arg,
sizeof(*new_cb_arg));
8692 &new_cb_arg->
payload, 0, pci_descriptor_count+1, 1);
8703 for (i = 0; i < num_descriptors; i++) {
8711 switch(new_protocol) {
8733 ocs_memcpy(dst, pcie_desc_p,
sizeof(*pcie_desc_p));
8734 dst +=
sizeof(*pcie_desc_p);
8744 if (num_iscsi_ports > 0) {
8749 if (num_fcoe_ports > 0) {
8756 ocs_dma_free(hal->os, &cb_arg->
payload);
8757 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
8765 new_cb_arg->
cb(rc, new_cb_arg->
arg);
8768 ocs_dma_free(hal->os, &new_cb_arg->
payload);
8769 ocs_free(hal->os, new_cb_arg,
sizeof(*new_cb_arg));
8816 mbxdata = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_ZERO | OCS_M_NOWAIT);
8817 if (mbxdata == NULL) {
8818 ocs_log_err(hal->os,
"failed to malloc mbox\n");
8825 if (cb_arg == NULL) {
8826 ocs_log_err(hal->os,
"failed to malloc cb_arg\n");
8832 cb_arg->
arg = ul_arg;
8837 if (ocs_dma_alloc(hal->os, &cb_arg->
payload, 4096, 4)) {
8838 ocs_log_err(hal->os,
"Failed to allocate DMA buffer\n");
8848 ocs_dma_free(hal->os, &cb_arg->
payload);
8849 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
8856 typedef struct ocs_hal_get_profile_list_cb_arg_s {
8885 ocs_dma_t *payload = NULL;
8887 int i, num_descriptors;
8889 if (!cb_arg || !cb_arg->
cb)
8890 goto ocs_hal_get_profile_list_cb_done;
8897 list = ocs_malloc(hal->os,
sizeof(*list), OCS_M_ZERO);
8905 for (i = 0; i < num_descriptors; i++) {
8919 cb_arg->
cb(status, list, cb_arg->
arg);
8921 ocs_free(hal->os, list,
sizeof(*list));
8923 ocs_hal_get_profile_list_cb_done:
8925 ocs_dma_free(hal->os, &cb_arg->
payload);
8926 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
8967 mbxdata = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_ZERO | OCS_M_NOWAIT);
8968 if (mbxdata == NULL) {
8969 ocs_log_err(hal->os,
"failed to malloc mbox\n");
8976 if (cb_arg == NULL) {
8977 ocs_log_err(hal->os,
"failed to malloc cb_arg\n");
8983 cb_arg->
arg = ul_arg;
8987 ocs_log_err(hal->os,
"Failed to allocate DMA buffer\n");
8997 ocs_dma_free(hal->os, &cb_arg->
payload);
8998 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
9005 typedef struct ocs_hal_get_active_profile_cb_arg_s {
9027 uint32_t active_profile;
9033 if (!cb_arg || !cb_arg->
cb)
9034 goto ocs_hal_get_active_profile_cb_done;
9045 cb_arg->
cb(status, active_profile, cb_arg->
arg);
9047 ocs_hal_get_active_profile_cb_done:
9049 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
9089 mbxdata = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_ZERO | OCS_M_NOWAIT);
9090 if (mbxdata == NULL) {
9091 ocs_log_err(hal->os,
"failed to malloc mbox\n");
9097 if (cb_arg == NULL) {
9098 ocs_log_err(hal->os,
"failed to malloc cb_arg\n");
9104 cb_arg->
arg = ul_arg;
9110 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
9117 typedef struct ocs_hal_get_nvparms_cb_arg_s {
9139 if (!cb_arg || !cb_arg->
cb)
9140 goto ocs_hal_get_nvparms_cb_done;
9142 if ((0 == status) && mbox_rsp->
hdr.
status)
9148 ocs_hal_get_nvparms_cb_done:
9150 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
9185 mbxdata = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_ZERO | OCS_M_NOWAIT);
9186 if (mbxdata == NULL) {
9187 ocs_log_err(hal->os,
"failed to malloc mbox\n");
9193 if (cb_arg == NULL) {
9194 ocs_log_err(hal->os,
"failed to malloc cb_arg\n");
9200 cb_arg->
arg = ul_arg;
9206 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
9213 typedef struct ocs_hal_set_nvparms_cb_arg_s {
9235 if (!cb_arg || !cb_arg->
cb)
9236 goto ocs_hal_set_nvparms_cb_done;
9238 if ((0 == status) && mbox_rsp->
hdr.
status)
9241 cb_arg->
cb(status, cb_arg->
arg);
9243 ocs_hal_set_nvparms_cb_done:
9245 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
9281 uint8_t *wwnn, uint8_t hard_alpa, uint32_t preferred_d_id,
void* ul_arg)
9288 mbxdata = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_ZERO | OCS_M_NOWAIT);
9289 if (mbxdata == NULL) {
9290 ocs_log_err(hal->os,
"failed to malloc mbox\n");
9296 if (cb_arg == NULL) {
9297 ocs_log_err(hal->os,
"failed to malloc cb_arg\n");
9303 cb_arg->
arg = ul_arg;
9309 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
9327 ocs_hal_io_t *io = NULL;
9330 ocs_lock(&hal->io_lock);
9332 switch (io_count_type) {
9354 count = hal->config.n_io;
9358 ocs_unlock(&hal->io_lock);
9373 uint32_t active_rpi_count = 0;
9376 uint32_t max_rpi, i;
9379 for (i = 0; i < max_rpi; i ++) {
9380 if (ocs_atomic_read(&hal->rpi_ref[i].rpi_attached)) {
9381 active_rpi_count += ocs_atomic_read(&hal->rpi_ref[i].rpi_count);
9386 return active_rpi_count;
9402 for (i = 0; i < hal->hal_rq_count; i++) {
9403 hal_rq_t *rq = hal->hal_rq[i];
9404 if (rq->rq_tracker != NULL) {
9405 for (j = 0; j < rq->entry_count; j++) {
9406 if (rq->rq_tracker[j] != NULL) {
9416 typedef struct ocs_hal_set_active_profile_cb_arg_s {
9443 if (!cb_arg || !cb_arg->
cb)
9444 goto ocs_hal_set_active_profile_cb_done;
9453 cb_arg->
cb(status, cb_arg->
arg);
9455 ocs_hal_set_active_profile_cb_done:
9457 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
9496 mbxdata = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_ZERO | OCS_M_NOWAIT);
9497 if (mbxdata == NULL) {
9498 ocs_log_err(hal->os,
"failed to malloc mbox\n");
9505 if (cb_arg == NULL) {
9506 ocs_log_err(hal->os,
"failed to malloc cb_arg\n");
9512 cb_arg->
arg = ul_arg;
9518 ocs_free(hal->os, cb_arg,
sizeof(*cb_arg));
9545 while(hash[hash_index].in_use) {
9550 hash[hash_index].
id = id;
9551 hash[hash_index].
in_use = 1;
9552 hash[hash_index].
index = index;
9575 if (hash[index].in_use &&
9576 hash[index].
id ==
id) {
9577 rc = hash[index].
index;
9581 }
while(rc == -1 && hash[index].in_use);
9590 uint16_t fcfi = UINT16_MAX;
9592 if ((hal == NULL) || (domain == NULL)) {
9593 ocs_log_err(NULL,
"bad parameter hal=%p domain=%p\n",
9598 fcfi = domain->fcf_indicator;
9601 uint16_t fcf_index = UINT16_MAX;
9603 ocs_log_debug(hal->os,
"adding domain %p @ %#x\n",
9605 hal->domains[fcfi] = domain;
9608 if (hal->workaround.override_fcfi) {
9609 if (hal->first_domain_idx < 0) {
9610 hal->first_domain_idx = fcfi;
9614 fcf_index = domain->fcf;
9617 ocs_log_debug(hal->os,
"adding map of FCF index %d to FCFI %d\n",
9619 hal->fcf_index_fcfi[fcf_index] = fcfi;
9622 ocs_log_test(hal->os,
"FCF index %d out of range (max %d)\n",
9624 hal->domains[fcfi] = NULL;
9627 ocs_log_test(hal->os,
"FCFI %#x out of range (max %#x)\n",
9638 uint16_t fcfi = UINT16_MAX;
9640 if ((hal == NULL) || (domain == NULL)) {
9641 ocs_log_err(NULL,
"bad parameter hal=%p domain=%p\n",
9646 fcfi = domain->fcf_indicator;
9649 uint16_t fcf_index = UINT16_MAX;
9651 ocs_log_debug(hal->os,
"deleting domain %p @ %#x\n",
9654 if (domain != hal->domains[fcfi]) {
9655 ocs_log_test(hal->os,
"provided domain %p does not match stored domain %p\n",
9656 domain, hal->domains[fcfi]);
9660 hal->domains[fcfi] = NULL;
9663 if (hal->workaround.override_fcfi) {
9664 if (hal->first_domain_idx == fcfi) {
9665 hal->first_domain_idx = -1;
9669 fcf_index = domain->fcf;
9672 if (hal->fcf_index_fcfi[fcf_index] == fcfi) {
9673 hal->fcf_index_fcfi[fcf_index] = 0;
9676 ocs_log_test(hal->os,
"indexed FCFI %#x doesn't match provided %#x @ %d\n",
9677 hal->fcf_index_fcfi[fcf_index], fcfi, fcf_index);
9680 ocs_log_test(hal->os,
"FCF index %d out of range (max %d)\n",
9684 ocs_log_test(hal->os,
"FCFI %#x out of range (max %#x)\n",
9696 ocs_log_err(NULL,
"bad parameter hal=%p\n", hal);
9701 return hal->domains[fcfi];
9703 ocs_log_test(hal->os,
"FCFI %#x out of range (max %#x)\n",
9709 static ocs_domain_t *
9714 ocs_log_err(NULL,
"bad parameter hal=%p\n", hal);
9721 ocs_log_test(hal->os,
"FCF index %d out of range (max %d)\n",
9746 ocs_hal_io_t *free_io = NULL;
9749 if (!io->quarantine) {
9754 if (ocs_ref_get_unless_zero(&io->ref) == 0) {
9756 ocs_log_debug(hal ? hal->os : NULL,
9757 "io not active xri=%#x tag=%#x\n",
9758 io->indicator, io->reqtag);
9769 if (free_io != NULL) {
9770 ocs_ref_put(&free_io->ref);
9786 uint16_t rid = UINT16_MAX;
9789 uint32_t n_processed = 0;
9790 uint64_t elapsed_time_ms;
9793 tstart = ocs_get_os_ticks();
9796 status =
sli_cq_parse(&hal->sli, cq->queue, cqe, &ctype, &rid);
9836 uint32_t wq_id = rid;
9838 hal_wq_t *wq = hal->hal_wq[index];
9857 ocs_log_test(hal->os,
"unhandled ctype=%#x rid=%#x\n", ctype, rid);
9862 if (n_processed == cq_process_limit) {
9866 if (cq->queue->n_posted >= (cq->queue->posted_limit)) {
9873 cq->queue->last_processed_time = ocs_ticks_to_ms(ocs_get_os_ticks());
9875 if (n_processed > cq->queue->max_num_processed) {
9876 cq->queue->max_num_processed = n_processed;
9879 telapsed = ocs_get_os_ticks() - tstart;
9880 elapsed_time_ms = ocs_ticks_to_ms(telapsed);
9881 if (elapsed_time_ms > cq->queue->max_process_time_ms) {
9882 cq->queue->max_process_time_ms = elapsed_time_ms;
9903 ((cq->queue->index - 1) & (cq->queue->length - 1)));
9907 ocs_log_err(hal->os,
"invalid request tag: x%x\n", rid);
9912 ocs_log_err(hal->os,
"wqcb callback is NULL\n");
9935 ocs_hal_io_t *io = arg;
9936 ocs_hal_t *hal = io->hal;
9940 uint8_t tow_ooo_cmd = FALSE;
9941 uint8_t tow_ooo_data = FALSE;
9942 uint8_t lock_taken = 0;
9943 #if defined(OCS_DISC_SPIN_DELAY)
9954 if (io->quarantine && io->quarantine_first_phase) {
9955 io->quarantine = (wcqe->
qx == 1);
9958 io->quarantine_first_phase = FALSE;
9961 if (io->sec_hio != NULL &&
9962 io->sec_hio->quarantine) {
9969 io->sec_hio->quarantine = (wcqe->
qx == 1);
9977 if (io->xbusy && wcqe->
xb == 0) {
10000 #if defined(OCS_DISC_SPIN_DELAY)
10001 if (
ocs_get_property(
"disk_spin_delay", prop_buf,
sizeof(prop_buf)) == 0) {
10002 delay = ocs_strtoul(prop_buf, 0, 0);
10003 ocs_delay_usec(delay);
10014 if (hal->workaround.retain_tsend_io_length && !len && !status) {
10020 if(io->is_port_owned) {
10021 ocs_lock(&io->tow_lock);
10023 if(io->tow_buf->call_tow_cmd) {
10024 tow_ooo_cmd = TRUE;
10027 if(io->tow_buf->call_tow_data) {
10028 tow_ooo_data = TRUE;
10045 ocs_log_err(hal->os,
"Unhandled io type %#x for io=%p xri=%#x tag=%#x\n",
10046 io->type, io, io->indicator, io->reqtag);
10053 io->status_saved = 1;
10054 io->saved_status = status;
10055 io->saved_ext = ext;
10056 io->saved_len = len;
10061 if (hal->config.i_only_aab &&
10066 ocs_log_info(hal->os,
"aborting xri=%#x tag=%#x type=%d\n",
10067 io->indicator, io->reqtag, io->type);
10076 goto exit_ocs_hal_wq_process_io;
10083 ocs_log_info(hal->os,
"abort in progress xri=%#x tag=%#x type=%d\n",
10084 io->indicator, io->reqtag, io->type);
10088 ocs_log_err(hal->os,
10089 "Failed to abort xri=%#x tag=%#x type=%d rc=%d\n",
10090 io->indicator, io->reqtag, io->type, rc);
10100 ocs_log_info(hal->os,
"aborting xri=%#x tag=%#x type=%d\n",
10101 io->indicator, io->reqtag, io->type);
10117 goto exit_ocs_hal_wq_process_io;
10120 ocs_log_test(hal->os,
"Failed to abort xri=%#x tag=%#x rc=%d\n",
10121 io->indicator, io->reqtag, rc);
10126 if (io->sec_hio != NULL) {
10128 io->sec_hio = NULL;
10131 if (io->done != NULL) {
10133 void *arg = io->arg;
10137 if (io->status_saved) {
10139 status = io->saved_status;
10140 len = io->saved_len;
10141 ext = io->saved_ext;
10142 io->status_saved = 0;
10144 ocs_log_info(hal->os,
10145 "IO marked as timedout, xri=%#x tag=%#x type=%d\n",
10146 io->indicator, io->reqtag, io->type);
10152 done(io, io->rnode, len, status, ext, arg);
10157 if (hal->config.bounce) {
10158 fc_header_t *hdr = io->tow_buf->cmd_seq->header->dma.virt;
10161 uint32_t ox_id = ocs_be16toh(hdr->
ox_id);
10162 if (hal->callback.bounce != NULL) {
10166 hal->callback.unsolicited(hal->args.unsolicited, io->tow_buf->cmd_seq);
10169 if (tow_ooo_data) {
10171 if (hal->config.bounce) {
10172 fc_header_t *hdr = io->tow_buf->seq.header->dma.virt;
10175 uint32_t ox_id = ocs_be16toh(hdr->
ox_id);
10176 if (hal->callback.bounce != NULL) {
10180 hal->callback.unsolicited(hal->args.unsolicited, &io->tow_buf->seq);
10185 exit_ocs_hal_wq_process_io:
10187 ocs_unlock(&io->tow_lock);
10203 ocs_hal_io_t *io = arg;
10204 ocs_hal_t *hal = io->hal;
10221 io->done != NULL) {
10223 void *arg = io->arg;
10233 status = io->saved_status;
10234 len = io->saved_len;
10235 ext = io->saved_ext;
10236 io->status_saved = 0;
10239 ocs_log_info(hal->os,
10240 "IO marked as timedout, xri=%#x tag=%#x type=%d\n",
10241 io->indicator, io->reqtag, io->type);
10244 done(io, io->rnode, len, status, ext, arg);
10247 if (io->abort_done != NULL) {
10249 void *arg = io->abort_arg;
10251 io->abort_done = NULL;
10253 done(io, io->rnode, len, status, ext, arg);
10255 ocs_lock(&hal->io_abort_lock);
10257 io->abort_in_progress = 0;
10258 ocs_unlock(&hal->io_abort_lock);
10287 ocs_hal_io_t *io = NULL;
10292 ((cq->queue->index - 1) & (cq->queue->length - 1)));
10295 ocs_log_err(hal->os,
"Error: xabt io lookup failed rid=%#x\n", rid);
10300 ocs_log_debug(hal->os,
"xabt io not busy rid=%#x\n", rid);
10306 if (io->is_port_owned) {
10307 ocs_lock(&hal->io_lock);
10309 ocs_ref_get(&io->ref);
10310 ocs_unlock(&hal->io_lock);
10314 if (io->status_saved && io->done != NULL) {
10316 void *arg = io->arg;
10319 int32_t status = io->saved_status;
10320 uint32_t len = io->saved_len;
10321 uint32_t ext = io->saved_ext;
10324 io->status_saved = 0;
10327 ocs_log_info(hal->os,
10328 "IO marked as timedout, xri=%#x tag=%#x type=%d\n",
10329 io->indicator, io->reqtag, io->type);
10332 done(io, io->rnode, len, status, ext, arg);
10336 if (io->is_port_owned) {
10337 ocs_lock(&hal->io_lock);
10339 ocs_unlock(&hal->io_lock);
10345 ocs_lock(&hal->io_lock);
10354 ocs_unlock(&hal->io_lock);
10371 uint32_t max_wq_entries = hal->num_qentries[
SLI_QTYPE_WQ];
10372 uint32_t max_cq_entries = hal->num_qentries[
SLI_QTYPE_CQ];
10379 if (max_cq_entries < max_wq_entries * 2) {
10380 max_wq_entries = hal->num_qentries[
SLI_QTYPE_WQ] = max_cq_entries / 2;
10391 hal->config.n_wq = ((hal->config.n_io * 2) + (max_wq_entries - 1)) / max_wq_entries;
10397 if (hal->config.n_wq < 4 &&
10399 hal->config.n_wq = 4;
10405 if (hal->config.n_wq < 2 &&
10407 hal->config.n_wq = 2;
10416 if (hal->config.n_wq > max_wq_num) {
10417 hal->config.n_wq = max_wq_num;
10432 ocs_lock(&hal->cmd_lock);
10434 ocs_log_err(hal->os,
"Can't find the MQE command context!!!\n");
10435 ocs_unlock(&hal->cmd_lock);
10439 hal->cmd_head_count--;
10443 ocs_unlock(&hal->cmd_lock);
10445 if (status || hdr->
status) {
10450 ocs_log_err(hal->os,
"MQE failed; mqe_hdr: %08X, mqe_cmd: %#x, mqe_status: %#x, cqe_status: %#x\n",
10456 ocs_memcpy(ctx->
buf, mqe, size);
10458 ctx->
cb(hal, status, ctx->
buf, ctx->
arg);
10461 ocs_memset(ctx, 0,
sizeof(*ctx));
10462 ocs_free(hal->os, ctx,
sizeof(*ctx));
10500 ocs_dma_t *dma = NULL;
10501 uint8_t *buf = NULL;
10506 ocs_log_err(hal->os,
"no buffer for command\n");
10510 dma = ocs_malloc(hal->os,
sizeof(*dma), OCS_M_ZERO | OCS_M_NOWAIT);
10512 ocs_log_err(hal->os,
"ocs_malloc(ocs_dma_t) failed\n");
10518 ocs_log_err(hal->os,
"ocs_dma_alloc() failed\n");
10520 ocs_free(hal->os, dma,
sizeof(ocs_dma_t));
10529 ocs_log_test(hal->os,
"FCOE_READ_FCF_TABLE failed\n");
10530 ocs_dma_free(hal->os, dma);
10531 ocs_free(hal->os, dma,
sizeof(*dma));
10561 ocs_dma_t *payload = arg;
10565 goto ocs_hal_cb_read_fcf_done;
10578 goto ocs_hal_cb_read_fcf_done;
10582 if (hal->callback.domain) {
10590 drec.
speed = hal->link.speed;
10591 drec.
fc_id = hal->link.fc_id;
10595 ocs_memcpy(drec.
map.
loop, hal->link.loop_map,
sizeof(drec.
map.
loop));
10615 ocs_log_test(hal->os,
"Ignoring the invalid FCF entry\n");
10621 ocs_hal_cb_read_fcf_done:
10622 ocs_dma_free(hal->os, payload);
10623 ocs_free(hal->os, payload,
sizeof(*payload));
10642 if ((0 == status) && mbox_rsp->
hdr.
status)
10646 hal->sli.config.link_module_type = mbox_rsp->
lmt;
10648 if (hal->callback.xport)
10666 uint8_t *buf = NULL;
10671 ocs_log_err(hal->os,
"no buffer for command\n");
10698 ocs_hal_t *hal = ctx;
10700 ocs_domain_t *d = NULL;
10704 switch (event->status) {
10708 hal->link = *event;
10711 uint8_t *buf = NULL;
10712 ocs_log_info(hal->os,
"Link Up, NPORT, speed is %d\n", event->speed);
10717 ocs_log_err(hal->os,
"no buffer for command\n");
10727 ocs_log_test(hal->os,
"READ_TOPOLOGY failed\n");
10731 uint8_t *buf = NULL;
10732 ocs_log_info(hal->os,
"Link Up, LOOP, speed is %d\n", event->speed);
10733 if ((0 == hal->loop_map.size) &&
10734 ocs_dma_alloc(hal->os, &hal->loop_map,
10736 ocs_log_err(hal->os,
"XXX ocs_dma_alloc_fail\n");
10741 ocs_log_err(hal->os,
"no buffer for command\n");
10750 ocs_log_test(hal->os,
"READ_TOPOLOGY failed\n");
10754 ocs_log_info(hal->os,
"Link Up, link in internal loopback mode, speed is %d\n", event->speed);
10757 ocs_log_info(hal->os,
"Link Up, unsupported topology (%#x), speed is %d\n",
10758 event->topology, event->speed);
10762 ocs_log_info(hal->os,
"Link down\n");
10765 hal->link.status =
event->status;
10768 d = hal->domains[i];
10769 if (d != NULL && hal->callback.domain != NULL) {
10778 hal->link.logical_link_speed =
event->logical_link_speed;
10779 hal->link.aggregate_link_speed =
event->aggregate_link_speed;
10782 ocs_log_test(hal->os,
"unhandled link status %#x\n", event->status);
10792 ocs_hal_t *hal = ctx;
10793 ocs_domain_t *domain = NULL;
10798 ocs_domain_t *d = NULL;
10805 d = hal->domains[i];
10807 ocs_sport_t *sport = NULL;
10810 if (sport->indicator == event->index) {
10817 if (domain != NULL) {
10826 switch (event->type) {
10831 if (domain != NULL &&
10832 hal->callback.domain != NULL) {
10837 if (domain != NULL &&
10838 hal->callback.domain != NULL) {
10843 domain->req_rediscover_fcf = TRUE;
10848 if (domain != NULL &&
10849 hal->callback.domain != NULL) {
10856 ocs_log_test(hal->os,
"unsupported event %#x\n", event->type);
10865 ocs_remote_node_t *rnode = arg;
10869 if (status || hdr->
status) {
10870 rnode->attached = FALSE;
10873 rnode->attached = TRUE;
10874 ocs_atomic_set(&hal->rpi_ref[rnode->index].rpi_attached, 1);
10878 if (hal->callback.rnode)
10879 hal->callback.rnode(hal->args.rnode, evt, rnode);
10888 ocs_remote_node_t *rnode = arg;
10893 if (status || hdr->
status) {
10900 if (!rnode->attached || ((
sli_get_hlm(&hal->sli) == TRUE) && !rnode->node_group) ||
10907 rnode->node_group = FALSE;
10908 rnode->attached = FALSE;
10914 if (rnode->indicator != UINT32_MAX) {
10916 ocs_log_err(hal->os,
"FCOE_RPI (%d) free failed, addr=%#x\n", rnode->indicator, rnode->fc_id);
10919 rnode->indicator = UINT32_MAX;
10922 rnode->free_group = FALSE;
10923 if (hal->callback.rnode)
10924 hal->callback.rnode(hal->args.rnode, evt, rnode);
10935 ocs_sport_t *sport = arg;
10936 ocs_remote_node_t *rnode;
10938 ocs_node_t *node_next;
10941 if (status || hdr->
status) {
10948 rnode = &node->rnode;
10949 if (!rnode->attached)
10952 rnode->node_group = FALSE;
10953 rnode->attached = FALSE;
10954 if (ocs_atomic_read(&hal->rpi_ref[rnode->index].rpi_count) == 0)
10955 ocs_atomic_set(&hal->rpi_ref[rnode->index].rpi_attached, 0);
10957 if (hal->callback.rnode)
10958 hal->callback.rnode(hal->args.rnode, evt, rnode);
10976 ocs_hal_io_t *io = NULL;
10977 uintptr_t xfer_virt = 0;
10978 uintptr_t xfer_phys = 0;
10980 uint8_t new_alloc = TRUE;
10982 if (NULL == hal->io) {
10983 hal->io = ocs_malloc(hal->os, hal->config.n_io *
sizeof(ocs_hal_io_t *), OCS_M_ZERO | OCS_M_NOWAIT);
10985 if (NULL == hal->io) {
10986 ocs_log_err(hal->os,
"IO pointer memory allocation failed, %d Ios at size %zu\n",
10988 sizeof(ocs_hal_io_t *));
10991 for (i = 0; i < hal->config.n_io; i++) {
10992 hal->io[i] = ocs_malloc(hal->os,
sizeof(ocs_hal_io_t),
10993 OCS_M_ZERO | OCS_M_NOWAIT);
10994 if (hal->io[i] == NULL) {
10995 ocs_log_err(hal->os,
"IO(%d) memory allocation failed\n", i);
11001 hal->wqe_buffs = ocs_malloc(hal->os, hal->config.n_io * hal->sli.config.wqe_size,
11002 OCS_M_ZERO | OCS_M_NOWAIT);
11003 if (NULL == hal->wqe_buffs) {
11004 ocs_free(hal->os, hal->io, hal->config.n_io *
sizeof(ocs_hal_io_t));
11005 ocs_log_err(hal->os,
"IO WQE buff allocation failed, %d Ios at size %zu\n",
11006 hal->config.n_io, hal->sli.config.wqe_size);
11016 if (ocs_dma_alloc(hal->os, &hal->xfer_rdy,
11019 ocs_log_err(hal->os,
"XFER_RDY buffer allocation failed\n");
11023 xfer_virt = (uintptr_t)hal->xfer_rdy.virt;
11024 xfer_phys = hal->xfer_rdy.phys;
11026 for (i = 0; i < hal->config.n_io; i++) {
11035 io->wqe.wqebuf = &hal->wqe_buffs[i * hal->sli.config.wqe_size];
11039 if (wqcb == NULL) {
11040 ocs_log_err(hal->os,
"can't allocate request tag\n");
11052 ocs_log_err(hal->os,
"sli_resource_alloc failed @ %d\n", i);
11056 if (new_alloc && ocs_dma_alloc(hal->os, &io->def_sgl, hal->config.n_sgl *
sizeof(
sli4_sge_t), 64)) {
11057 ocs_log_err(hal->os,
"ocs_dma_alloc failed @ %d\n", i);
11058 ocs_memset(&io->def_sgl, 0,
sizeof(ocs_dma_t));
11061 io->def_sgl_count = hal->config.n_sgl;
11062 io->sgl = &io->def_sgl;
11063 io->sgl_count = io->def_sgl_count;
11065 if (hal->xfer_rdy.size) {
11066 io->xfer_rdy.virt = (
void *)xfer_virt;
11067 io->xfer_rdy.phys = xfer_phys;
11077 for (i = 0; i < hal->config.n_io && hal->io[i]; i++) {
11078 ocs_free(hal->os, hal->io[i],
sizeof(ocs_hal_io_t));
11088 uint32_t i = 0, io_index = 0;
11089 uint32_t prereg = 0, sge_index = 0;
11090 ocs_hal_io_t *io = NULL;
11093 uint32_t nremaining;
11095 uint32_t sgls_per_request = 256;
11096 ocs_dma_t **sgls = NULL;
11097 ocs_dma_t reqbuf = { 0 };
11103 sgls = ocs_malloc(hal->os,
sizeof(*sgls) * sgls_per_request, OCS_M_NOWAIT);
11104 if (sgls == NULL) {
11105 ocs_log_err(hal->os,
"ocs_malloc sgls failed\n");
11110 rc = ocs_dma_alloc(hal->os, &reqbuf, reqbuf_length, OCS_MIN_DMA_ALIGNMENT);
11112 ocs_log_err(hal->os,
"ocs_dma_alloc reqbuf failed\n");
11113 ocs_free(hal->os, sgls,
sizeof(*sgls) * sgls_per_request);
11118 for (nremaining = hal->config.n_io; nremaining; nremaining -= n) {
11123 for (n = 0; n < MIN(sgls_per_request, nremaining); n++) {
11124 sge_index = io_index + n;
11128 if (hal->io[sge_index]->indicator != (hal->io[sge_index-1]->indicator+1)) {
11132 sgls[n] = hal->io[sge_index]->sgl;
11136 hal->io[io_index]->indicator, n, sgls, NULL, &reqbuf);
11147 for (i = 0; i < n; i++, io_index++) {
11148 io = hal->io[io_index];
11149 io->is_port_owned = 0;
11156 ocs_dma_free(hal->os, &reqbuf);
11157 ocs_free(hal->os, sgls,
sizeof(*sgls) * sgls_per_request);
11169 for (i = 0; i < hal->eq_count; i++) {
11180 ocs_lock(&hal->cmd_lock);
11191 ocs_log_test(hal->os,
"hung command %08x\n",
11192 NULL == ctx ? UINT32_MAX :
11193 (NULL == ctx->
buf ? UINT32_MAX : *((uint32_t *)ctx->
buf)));
11194 ocs_unlock(&hal->cmd_lock);
11196 ocs_lock(&hal->cmd_lock);
11199 ocs_unlock(&hal->cmd_lock);
11217 return hal->io[ioindex];
11244 void *arg = io->arg;
11247 ocs_unlock(&hal->io_lock);
11249 ocs_lock(&hal->io_lock);
11252 if (io->abort_done != NULL) {
11253 void *abort_arg = io->abort_arg;
11255 io->abort_done = NULL;
11256 ocs_unlock(&hal->io_lock);
11258 ocs_lock(&hal->io_lock);
11264 ocs_hal_io_t *io = NULL;
11265 ocs_hal_io_t *tmp_io = NULL;
11266 uint32_t iters = 100;
11272 ocs_lock(&hal->io_lock);
11289 if (done == NULL &&
11290 abort_done == NULL) {
11310 ocs_ref_put(&io->ref);
11316 ocs_unlock(&hal->io_lock);
11320 ocs_delay_usec(10000);
11326 ocs_log_test(hal->os,
"io_inuse list is not empty\n");
11339 ocs_log_err(NULL,
"bad parm hal=%p io=%p\n", hal, io);
11343 data = io->def_sgl.virt;
11365 if ((0 == status) && (0 == read_topo->
hdr.
status))
11366 ocs_log_info(hal->os,
"fec_enable = %d, fec_state = %d, current_link_speed = %d\n",
11405 hal->link.loop_map = hal->loop_map.virt;
11418 hal->link.speed = 1 * 1000;
11421 hal->link.speed = 2 * 1000;
11424 hal->link.speed = 4 * 1000;
11427 hal->link.speed = 8 * 1000;
11430 hal->link.speed = 16 * 1000;
11431 hal->link.loop_map = NULL;
11434 hal->link.speed = 32 * 1000;
11435 hal->link.loop_map = NULL;
11448 ocs_sli_port_t *sport = ctx->app;
11449 ocs_hal_t *hal = sport->hal;
11460 if (data != NULL) {
11465 ocs_log_test(hal->os,
"%s %-20s not handled\n", funcname,
ocs_sm_event_name(evt));
11475 ocs_sli_port_t *sport = ctx->app;
11476 ocs_hal_t *hal = sport->hal;
11482 if (data != NULL) {
11485 if (hal->callback.port != NULL) {
11486 hal->callback.port(hal->args.port,
11500 ocs_sli_port_t *sport = ctx->app;
11501 ocs_hal_t *hal = sport->hal;
11509 ocs_log_err(hal->os,
"FCOE_VPI (%d) free failed, addr=%#x\n", sport->indicator, sport->fc_id);
11513 if (data != NULL) {
11517 if (hal->callback.port != NULL) {
11518 hal->callback.port(hal->args.port,
11532 ocs_sli_port_t *sport = ctx->app;
11533 ocs_hal_t *hal = sport->hal;
11541 ocs_log_err(hal->os,
"FCOE_VPI (%d) free failed, addr=%#x\n", sport->indicator, sport->fc_id);
11545 if (data != NULL) {
11549 if (hal->callback.port != NULL) {
11550 hal->callback.port(hal->args.port,
11554 if (sport->sm_free_req_pending) {
11569 ocs_sli_port_t *sport = ctx->app;
11570 ocs_hal_t *hal = sport->hal;
11571 uint8_t *cmd = NULL;
11578 cmd = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_ZERO | OCS_M_NOWAIT);
11586 ocs_log_err(hal->os,
"UNREG_VPI format failure\n");
11615 ocs_sli_port_t *sport = ctx->app;
11616 ocs_hal_t *hal = sport->hal;
11624 ocs_log_err(hal->os,
"ocs_hal_async_call failed\n");
11643 ocs_sli_port_t *sport = ctx->app;
11644 ocs_hal_t *hal = sport->hal;
11650 if (data != NULL) {
11653 if (hal->callback.port != NULL) {
11654 hal->callback.port(hal->args.port,
11657 if (sport->sm_free_req_pending) {
11676 ocs_sli_port_t *sport = ctx->app;
11677 ocs_hal_t *hal = sport->hal;
11684 ocs_log_err(hal->os,
"REG_VPI format failure\n");
11701 sport->sm_free_req_pending = 1;
11714 ocs_sli_port_t *sport = ctx->app;
11715 ocs_hal_t *hal = sport->hal;
11723 ocs_log_err(hal->os,
"FCOE_VPI (%d) free failed, addr=%#x\n", sport->indicator, sport->fc_id);
11727 if (data != NULL) {
11742 ocs_sli_port_t *sport = ctx->app;
11743 ocs_hal_t *hal = sport->hal;
11749 if (data != NULL) {
11752 if (hal->callback.port != NULL) {
11753 hal->callback.port(hal->args.port,
11757 if (sport->sm_free_req_pending) {
11796 ocs_sli_port_t *sport = ctx->app;
11797 ocs_hal_t *hal = sport->hal;
11805 ocs_log_err(hal->os,
"FCOE_VPI (%d) free failed, addr=%#x\n", sport->indicator, sport->fc_id);
11809 if (data != NULL) {
11813 if (hal->callback.port != NULL) {
11814 hal->callback.port(hal->args.port,
11819 if (sport->sm_free_req_pending) {
11834 ocs_sli_port_t *sport = ctx->app;
11835 ocs_hal_t *hal = sport->hal;
11836 uint8_t *payload = NULL;
11843 if (ocs_dma_alloc(hal->os, &sport->dma, 112, 4)) {
11844 ocs_log_err(hal->os,
"Failed to allocate DMA memory\n");
11850 &sport->dma, sport->indicator)) {
11851 ocs_log_err(hal->os,
"READ_SPARM64 allocation failure\n");
11852 ocs_dma_free(hal->os, &sport->dma);
11858 ocs_dma_free(hal->os, &sport->dma);
11864 payload = sport->dma.virt;
11869 sizeof(sport->sli_wwpn));
11871 sizeof(sport->sli_wwnn));
11873 ocs_dma_free(hal->os, &sport->dma);
11877 ocs_dma_free(hal->os, &sport->dma);
11882 sport->sm_free_req_pending = 1;
11897 ocs_sli_port_t *sport = ctx->app;
11913 sport->sm_free_req_pending = 1;
11926 ocs_sli_port_t *sport = ctx->app;
11927 ocs_hal_t *hal = sport->hal;
11934 if (sport->sm_free_req_pending) {
11944 sport->indicator, sport->domain->indicator)) {
11945 ocs_log_err(hal->os,
"INIT_VPI allocation failure\n");
11962 sport->sm_free_req_pending = 1;
11977 ocs_sli_port_t *sport = arg;
11981 if (status || hdr->
status) {
11994 ocs_sli_port_t *sport = arg;
11999 if (status || hdr->
status) {
12009 mqecpy = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_ZERO | OCS_M_NOWAIT);
12010 if (mqecpy == NULL) {
12011 ocs_log_err(hal->os,
"malloc mqecpy failed\n");
12028 ocs_domain_t *domain = ctx->app;
12029 ocs_hal_t *hal = domain->hal;
12039 ocs_log_test(hal->os,
"%s %-20s not handled\n", funcname,
ocs_sm_event_name(evt));
12049 ocs_domain_t *domain = ctx->app;
12050 ocs_hal_t *hal = domain->hal;
12057 if (domain->dma.virt) {
12058 ocs_dma_free(hal->os, &domain->dma);
12062 if (data != NULL) {
12068 ocs_log_err(hal->os,
"FCOE_VFI (%d) free failed\n", domain->indicator);
12073 if (hal->callback.domain != NULL) {
12088 ocs_domain_t *domain = ctx->app;
12089 ocs_hal_t *hal = domain->hal;
12100 if (hal->callback.domain != NULL) {
12101 hal->callback.domain(hal->args.domain,
12120 ocs_domain_t *domain = ctx->app;
12121 ocs_hal_t *hal = domain->hal;
12128 if (domain->dma.virt) {
12129 ocs_dma_free(hal->os, &domain->dma);
12133 if (data != NULL) {
12139 ocs_log_err(hal->os,
"FCOE_VFI (%d) free failed\n", domain->indicator);
12144 if (hal->callback.domain != NULL) {
12161 ocs_domain_t *domain = ctx->app;
12162 ocs_hal_t *hal = domain->hal;
12172 ocs_log_err(hal->os,
"REG_VFI format failure\n");
12198 ocs_domain_t *domain = ctx->app;
12199 ocs_hal_t *hal = domain->hal;
12212 if (hal->callback.domain != NULL) {
12213 hal->callback.domain(hal->args.domain,
12240 ocs_domain_t *domain = ctx->app;
12241 ocs_hal_t *hal = domain->hal;
12249 ocs_log_err(hal->os,
"READ_SPARM64 format failure\n");
12279 ocs_domain_t *domain = ctx->app;
12280 ocs_sli_port_t *sport = domain->sport;
12281 ocs_hal_t *hal = domain->hal;
12288 domain->fcf_indicator, sport->indicator)) {
12289 ocs_log_err(hal->os,
"INIT_VFI format failure\n");
12317 ocs_domain_t *domain = ctx->app;
12318 ocs_hal_t *hal = domain->hal;
12329 rq_cfg[i].
rq_id = 0xffff;
12330 rq_cfg[i].
r_ctl_mask = (uint8_t) hal->config.filter_def[i];
12331 rq_cfg[i].
r_ctl_match = (uint8_t) (hal->config.filter_def[i] >> 8);
12332 rq_cfg[i].
type_mask = (uint8_t) (hal->config.filter_def[i] >> 16);
12333 rq_cfg[i].
type_match = (uint8_t) (hal->config.filter_def[i] >> 24);
12337 for (i = 0; i < hal->hal_rq_count; i++) {
12338 if (i >= ARRAY_SIZE(rq_cfg)) {
12339 ocs_log_warn(hal->os,
"more RQs than REG_FCFI filter entries\n");
12342 rq_cfg[i].
rq_id = hal->hal_rq[i]->hdr->id;
12350 if (hal->hal_mrq_used) {
12352 domain->vlan_id, domain->fcf)) {
12353 ocs_log_err(hal->os,
"REG_FCFI_MRQ format failure\n");
12360 rq_cfg, domain->vlan_id)) {
12361 ocs_log_err(hal->os,
"REG_FCFI format failure\n");
12407 ocs_domain_t *domain = ctx->app;
12408 ocs_hal_t *hal = domain->hal;
12419 domain->fcf_indicator = hal->fcf_indicator;
12436 ocs_domain_t *domain = ctx->app;
12442 if (domain != NULL) {
12443 ocs_hal_t *hal = domain->hal;
12446 ocs_dma_free(hal->os, &domain->dma);
12448 if (hal->callback.domain != NULL) {
12449 hal->callback.domain(hal->args.domain,
12456 if (data != NULL) {
12457 ocs_free(domain != NULL ? domain->hal->os : NULL, data,
SLI4_BMBX_SIZE);
12473 ocs_domain_t *domain = ctx->app;
12480 if (domain != NULL) {
12481 ocs_hal_t *hal = domain->hal;
12485 ocs_log_err(hal->os,
"FCOE_VFI (%d) free failed\n", domain->indicator);
12489 ocs_dma_free(hal->os, &domain->dma);
12492 if (hal->callback.domain != NULL) {
12496 if (data != NULL) {
12497 ocs_free(domain != NULL ? domain->hal->os : NULL, data,
SLI4_BMBX_SIZE);
12514 ocs_domain_t *domain = ctx->app;
12515 ocs_hal_t *hal = domain->hal;
12527 ocs_log_err(hal->os,
"REDISCOVER_FCF format failure\n");
12554 ocs_domain_t *domain = ctx->app;
12555 ocs_hal_t *hal = domain->hal;
12561 if (data == NULL) {
12562 data = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_ZERO | OCS_M_NOWAIT);
12570 ocs_log_err(hal->os,
"UNREG_FCFI format failure\n");
12583 if (domain->req_rediscover_fcf) {
12584 domain->req_rediscover_fcf = FALSE;
12606 ocs_domain_t *domain = ctx->app;
12607 ocs_hal_t *hal = domain->hal;
12608 uint8_t is_fc = FALSE;
12616 if (data == NULL) {
12617 data = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_ZERO | OCS_M_NOWAIT);
12626 ocs_log_err(hal->os,
"UNREG_VFI format failure\n");
12664 ocs_domain_t *domain = arg;
12668 if (status || hdr->
status) {
12681 ocs_hal_io_t *io = NULL;
12682 ocs_hal_io_t *io_next = NULL;
12683 uint64_t ticks_current = ocs_get_os_ticks();
12684 uint32_t sec_elapsed;
12688 ocs_lock(&hal->io_lock);
12690 sec_elapsed = ((ticks_current - io->submit_ticks) / ocs_get_os_tick_freq());
12696 if (sec_elapsed > io->tgt_wqe_timeout) {
12697 ocs_log_info(hal->os,
"IO timeout xri=%#x tag=%#x type=%d\n",
12698 io->indicator, io->reqtag, io->type);
12704 io->status_saved = 1;
12712 ocs_log_err(hal->os,
12713 "Abort submit failed on timedout xri=%#x " \
12714 "tag=%#x type=%d rc=%d\n",
12715 io->indicator, io->reqtag, io->type, rc);
12723 ocs_unlock(&hal->io_lock);
12726 if (!hal->active_wqe_timer_shutdown) {
12730 hal->in_active_wqe_timer = FALSE;
12737 ocs_hal_t *hal = (ocs_hal_t *)arg;
12740 hal->in_active_wqe_timer = TRUE;
12741 ocs_del_timer(&hal->wqe_timer);
12745 ocs_log_test(hal->os,
"ocs_hal_async_call failed\n");
12752 uint32_t iters = 100;
12754 if (hal->config.emulate_tgt_wqe_timeout) {
12756 hal->active_wqe_timer_shutdown = TRUE;
12759 ocs_del_timer(&hal->wqe_timer);
12762 while (hal->in_active_wqe_timer && iters) {
12772 ocs_log_test(hal->os,
"Failed to shutdown active wqe timer\n");
12792 return io->is_port_owned;
12811 return (io == NULL ? FALSE : io->is_port_owned);
12830 for (i = 0; i < xri_count; i++) {
12837 if (hal->tow_enabled) {
12841 ocs_lock(&hal->io_lock);
12843 io->is_port_owned = 0;
12845 ocs_unlock(&hal->io_lock);
12869 ocs_log_debug(hal->os,
"Status 0x%x for XRI base 0x%x, cnt =x%x\n",
12896 if (post_xri == NULL) {
12897 ocs_log_err(hal->os,
"no buffer for command\n");
12925 uint32_t num_posted = 0;
12932 ocs_lock(&hal->io_lock);
12934 for (i = 0; i < num_xri; i++) {
12944 if (hal->tow_enabled) {
12946 ocs_unlock(&hal->io_lock);
12948 ocs_lock(&hal->io_lock);
12955 ocs_lock_init(hal->os, &io->tow_lock,
"tow_lock[%d]", io->indicator);
12956 io->is_port_owned = 1;
12961 ocs_log_info(hal->os,
"Post xri failed! reclaim xri %d\n",
12972 ocs_unlock(&hal->io_lock);
12997 if ((0 == status) && (0 == release_xri->
hdr.
status)) {
13024 uint8_t *release_xri;
13028 release_xri = ocs_malloc(hal->os,
SLI4_BMBX_SIZE, OCS_M_NOWAIT);
13029 if (release_xri == NULL) {
13030 ocs_log_err(hal->os,
"no buffer for command\n");
13058 ocs_t *ocs = hal->os;
13062 for (i = 0; i < count && rq_buf[i]; i++) {
13063 ocs_dma_free(ocs, &rq_buf[i]->dma);
13088 ocs_t *ocs = hal->os;
13095 ocs_log_err(hal->os,
"Failed to alloc pointer for unsolicited DMA trackers\n");
13096 goto free_rx_buffer;
13099 for (i = 0; i < count; i++) {
13102 ocs_log_err(hal->os,
"Failed to alloc unsolicited DMA tracker[%d]\n", i);
13103 goto free_rx_buffer;
13106 rq_buf[i]->
rqindex = rqindex;
13107 if (ocs_dma_alloc(ocs, &rq_buf[i]->dma, size, OCS_MIN_DMA_ALIGNMENT)) {
13108 ocs_log_err(hal->os,
"DMA allocation failed\n");
13109 goto free_rx_buffer;
13131 ocs_t *ocs = hal->os;
13134 uint32_t rqindex = 0;
13137 uint32_t payload_size = hal->config.rq_default_buffer_size;
13141 for (i = 0; i < hal->hal_rq_count; i++) {
13142 rq = hal->hal_rq[i];
13152 if (rq->hdr_buf == NULL) {
13153 ocs_log_err(ocs,
"ocs_hal_rx_buffer_alloc hdr_buf failed\n");
13158 ocs_log_debug(hal->os,
"rq[%2d] rq_id %02d header %4d by %4d bytes\n", i, rq->hdr->id,
13159 rq->entry_count, hdr_size);
13165 if (rq->payload_buf == NULL) {
13166 ocs_log_err(ocs,
"ocs_hal_rx_buffer_alloc fb_buf failed\n");
13170 ocs_log_debug(hal->os,
"rq[%2d] rq_id %02d default %4d by %4d bytes\n", i, rq->data->id,
13171 rq->entry_count, payload_size);
13197 for (rq_idx = 0, idx = 0; rq_idx < hal->hal_rq_count; rq_idx++) {
13198 hal_rq_t *rq = hal->hal_rq[rq_idx];
13204 for (i = 0; i < rq->entry_count-1; i++) {
13208 seq->
header = rq->hdr_buf[i];
13209 seq->
payload = rq->payload_buf[i];
13237 for (i = 0; i < hal->hal_rq_count; i++) {
13238 rq = hal->hal_rq[i];
13244 rq->hdr_buf = NULL;
13246 rq->payload_buf = NULL;
13286 goto ocs_hal_async_cb_done;
13297 ocs_hal_async_cb_done:
13299 ocs_free(hal->os, ctx,
sizeof(*ctx));
13326 ctx = ocs_malloc(hal->os,
sizeof(*ctx), OCS_M_ZERO | OCS_M_NOWAIT);
13328 ocs_log_err(hal->os,
"failed to malloc async call context\n");
13339 ocs_free(hal->os, ctx,
sizeof(*ctx));
13357 if (hal->wq_reqtag_pool == NULL) {
13359 if (hal->wq_reqtag_pool == NULL) {
13360 ocs_log_err(hal->os,
"ocs_pool_alloc hal_wq_callback_t failed\n");
13387 if (wqcb != NULL) {
13431 if (wqcb == NULL) {
13432 ocs_log_err(hal->os,
"wqcb for instance %d is null\n", instance_index);
13485 ocs_printf(
"%s(%d): HAL assertion (%s) failed\n", filename, linenum, cond);
13504 ocs_printf(
"%s(%d): HAL verify (%s) failed\n", filename, linenum, cond);
13511 uint32_t *ptr = (uint32_t *)cqe;
13513 ocs_log_err(NULL,
"requeue_xri failed, status = %d, CQE = [ %#x, %#x, %#x, %#x ]\n",
13514 status, *ptr, *(ptr + 1), *(ptr + 2), *(ptr + 3));
13537 goto exit_ocs_hal_reque_xri;
13543 goto exit_ocs_hal_reque_xri;
13554 io->tow_buf = NULL;
13556 ocs_log_err(hal->os,
"requeue_xri WQE error\n");
13560 goto exit_ocs_hal_reque_xri;
13563 if (io->wq == NULL) {
13572 OCS_STAT(hal->tcmd_wq_submit[io->wq->instance]++);
13577 ocs_log_err(hal->os,
"sli_queue_write reque xri failed: %d\n", rc);
13581 exit_ocs_hal_reque_xri:
#define OCS_HAL_TOW_APP_TAG_VALID_DEFAULT
sli4_mbox_command_header_t hdr
ocs_hal_rtn_e ocs_hal_dump_get(ocs_hal_t *hal, ocs_dma_t *dma, uint32_t size, uint32_t offset, ocs_hal_dump_get_cb_t cb, void *arg)
Read a dump image to the host.
READ_STATUS - read tx/rx status of a particular port.
int32_t ocs_node_suppress_resp(ocs_remote_node_t *rnode)
Return node suppress_rsp state.
Mailbox Completion Queue Entry.
ocs_hal_rtn_e ocs_hal_domain_attach(ocs_hal_t *hal, ocs_domain_t *domain, uint32_t fc_id)
Attach a SLI port to a domain.
int32_t sli_cmd_read_link_stats(sli4_t *sli4, void *buf, size_t size, uint8_t req_ext_counters, uint8_t clear_overflow_flags, uint8_t clear_all_counters)
Write a READ_LINK_STAT command to the provided buffer.
#define OCS_HAL_READ_FCF_SIZE
int32_t sli_cmd_down_link(sli4_t *sli4, void *buf, size_t size)
Write a DOWN_LINK command to the provided buffer.
ocs_hal_rtn_e ocs_hal_rqpair_init(ocs_hal_t *hal)
Configure the rq_pair function from ocs_hal_init(). Must be after the IOs are setup and the state is ...
void ocs_hal_xabt_process(ocs_hal_t *hal, hal_cq_t *cq, uint8_t *cqe, uint16_t rid)
Process XABT completions.
int32_t ocs_hal_flush(ocs_hal_t *hal)
#define SLI4_FCOE_FIP_FCF_MODIFIED
static void __ocs_hal_read_lmt_cb(ocs_hal_t *, int32_t, uint8_t *, void *)
callback function to read link module type
int32_t sli_cmd_fcoe_post_hdr_templates(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *dma, uint16_t rpi, ocs_dma_t *payload_dma)
Write an FCOE_POST_HDR_TEMPLATES command.
uint32_t ocs_instance(void *os)
Return instance index of an opaque ocs structure.
int32_t sli_cmd_read_status(sli4_t *sli4, void *buf, size_t size, uint8_t clear_counters)
Write a READ_STATUS command to the provided buffer.
int32_t sli_cmd_common_nop(sli4_t *sli4, void *buf, size_t size, uint64_t context)
Write a COMMON_NOP command.
#define SLI4_SGE_DIF_OP_IN_CHKSUM_OUT_CHKSUM
union sli4_cmd_sli_config_t::@36 payload
static int32_t ocs_hal_cb_temp(ocs_hal_t *, int32_t, uint8_t *, void *)
Called when the DUMP command completes.
#define SLI4_SET_FEATURES_SET_CONFIG_AXR_T10PI
int32_t sli_cmd_write_nvparms(sli4_t *sli4, void *buf, size_t size, uint8_t *wwpn, uint8_t *wwnn, uint8_t hard_alpa, uint32_t preferred_d_id)
Write a WRITE_NVPARMS command to the provided buffer.
#define FC_LINK_SPEED_AUTO_16_8_4
uint32_t received_dropped_no_available_rpi_resources_count
ocs_hal_port_control_cb_t cb
static uint32_t sli_get_hlm_capable(sli4_t *sli4)
static int32_t ocs_hal_cb_release_xri(ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
Called when the RELEASE_XRI command completes.
int32_t ocs_hal_io_free(ocs_hal_t *hal, ocs_hal_io_t *io)
Free a previously-allocated HAL IO object.
uint32_t uint32_t iscsi_tgt
void _ocs_hal_assert(const char *cond, const char *filename, int linenum)
Handle HAL assertion.
static ocs_hal_rtn_e ocs_hal_init_io(ocs_hal_t *)
ocs_hal_rtn_e ocs_hal_srrs_send(ocs_hal_t *hal, ocs_hal_io_type_e type, ocs_hal_io_t *io, ocs_dma_t *send, uint32_t len, ocs_dma_t *receive, ocs_remote_node_t *rnode, ocs_hal_io_param_t *iparam, ocs_hal_srrs_cb_t cb, void *arg)
Send a Single Request/Response Sequence (SRRS).
uint32_t empty_xri_pool_count
static int32_t ocs_list_on_list(ocs_list_link_t *link)
Test if object is on a list.
static ocs_hal_rtn_e ocs_hal_init_tow_t10pi(ocs_hal_t *hal)
int32_t sli_cmd_common_read_transceiver_data(sli4_t *sli4, void *buf, size_t size, uint32_t page_num, ocs_dma_t *dma)
Write a COMMON_READ_TRANSCEIVER_DATA command.
ocs_hal_rtn_e ocs_hal_get_itcm_parity_stats(ocs_hal_t *hal, bool clear_stats, ocs_hal_parity_stat_cb_t cb, void *arg)
#define SLI4_READ_TOPOLOGY_SPEED_32G
ocs_hal_rtn_e ocs_hal_get_sfp(ocs_hal_t *hal, uint16_t page, ocs_hal_sfp_cb_t cb, void *arg)
Function to retrieve the SFP information.
static void ocs_hal_get_active_link_config_cb(ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
Get the link configuration callback.
void ocs_hal_rqpair_tow_move_to_host(ocs_hal_t *hal, ocs_hal_io_t *io)
Prepares an XRI to move back to the host.
uint8_t ocs_hal_io_inuse(ocs_hal_t *hal, ocs_hal_io_t *io)
Check if given HAL IO is in-use.
uint32_t uint32_t iscsi_ini
ocs_hal_rtn_e ocs_hal_node_alloc(ocs_hal_t *hal, ocs_remote_node_t *rnode, uint32_t fc_addr, ocs_sli_port_t *sport)
Allocate a remote node object.
#define SLI4_SET_FEATURES_SLI_PORT_PAUSE_STATE
uint8_t ocs_hal_is_io_port_owned(ocs_hal_t *hal, ocs_hal_io_t *io)
Determine if HAL IO is owned by the port.
uint32_t ocs_hal_get_rqes_produced_count(ocs_hal_t *hal)
Called to obtain the count of produced RQs.
HAL object describing fc host stats.
int32_t sli_fw_error_status(sli4_t *sli4)
Read the SLIPORT_SEMAPHORE and SLIPORT_STATUS registers to check if the port status indicates that a ...
int32_t hal_wq_write(hal_wq_t *wq, ocs_hal_wqe_t *wqe)
Write a HAL IO to a work queue.
static uint32_t sli_get_is_ulp_enabled(sli4_t *sli4, uint16_t ulp)
static int32_t ocs_hal_cb_sfp(ocs_hal_t *, int32_t, uint8_t *, void *)
Called when the READ_TRANSCEIVER_DATA command completes.
void ocs_hal_reqtag_free(ocs_hal_t *hal, hal_wq_callback_t *wqcb)
Free a WQ request tag.
sli4_mbox_command_header_t hdr
static void ocs_hal_init_free_io(ocs_hal_io_t *io)
Initialize IO fields on each free call.
#define SLI4_MIN_LOOP_MAP_BYTES
ocs_hal_rtn_e ocs_hal_get_port_protocol(ocs_hal_t *hal, uint32_t pci_func, ocs_get_port_protocol_cb_t cb, void *ul_arg)
Get the current port protocol.
static uint32_t sli_get_max_sgl(sli4_t *sli4)
struct ocs_hal_io_param_t::@18 fc_ct
int32_t sli_cmd_common_set_dump_location(sli4_t *sli4, void *buf, size_t size, uint8_t query, uint8_t is_buffer_list, ocs_dma_t *buffer, uint8_t fdb)
Write a COMMON_SET_DUMP_LOCATION command.
void * ocs_pool_get(ocs_pool_t *pool)
Allocate a memory pool item.
static int32_t ocs_hal_cb_read_fcf(ocs_hal_t *, int32_t, uint8_t *, void *)
Callback function for the FCOE_READ_FCF_TABLE command.
void ocs_domain_force_free(ocs_domain_t *domain)
Free memory resources of a domain object.
void ocs_hal_reqtag_reset(ocs_hal_t *hal)
Reset the WQ request tag pool.
sli4_mbox_command_header_t hdr
static ocs_hal_skyhawk_linkcfg_map_t skyhawk_linkcfg_map[]
Mapping from the HAL linkcfg enum to the Skyhawk link config IDs.
#define OCS_HAL_RQ_SIZE_PAYLOAD
static void * __ocs_hal_port_free_nop(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
int32_t sli_cq_parse(sli4_t *sli4, sli4_queue_t *cq, uint8_t *cqe, sli4_qentry_e *etype, uint16_t *q_id)
Parse a CQ entry to retrieve the event type and the associated queue.
#define SLI4_RESOURCE_DESCRIPTOR_TYPE_PCIE
Resource descriptor.
static ocs_hal_rtn_e ocs_hal_config_set_fdt_xfer_hint(ocs_hal_t *hal, uint32_t fdt_xfer_hint)
Set FTD transfer hint feature.
int32_t sli_dump_is_ready(sli4_t *sli4)
Read the SLIPORT_STATUS register to to check if a dump is present.
ocs_hal_rtn_e ocs_hal_init(ocs_hal_t *hal)
Allocate memory structures to prepare for the device operation.
static ocs_hal_rtn_e ocs_hal_teardown_fw_diagnostic_logging(ocs_hal_t *hal)
If required disable firmware diagnostic logging (RAS) and then free resources.
#define SLI4_FC_WCQE_STATUS_SHUTDOWN
#define SLI4_FCOE_FIP_FCF_DISCOVERED
#define SLI4_PAUSE_ERRX_PAIR_CNT
static void ocs_hal_cb_itcm_parity_stats(ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
int32_t sli_xmit_sequence64_wqe(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *payload, uint32_t payload_len, uint8_t timeout, uint16_t ox_id, uint16_t xri, uint16_t tag, ocs_remote_node_t *rnode, uint8_t r_ctl, uint8_t type, uint8_t df_ctl)
Write a XMIT_SEQUENCE64 work queue entry.
ocs_hal_rtn_e ocs_hal_port_migration(ocs_hal_t *hal)
ocs_hal_rq_buffer_t * header
void(* ocs_set_active_profile_cb_t)(int32_t status, void *arg)
Link configuration callback argument.
static int32_t ocs_hal_cb_dump_get(ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
Called when the OBJECT_GET command completes.
static int32_t _hal_wq_write(hal_wq_t *wq, ocs_hal_wqe_t *wqe)
Write a HAL IO to a work queue.
#define FC_LINK_SPEED_32G
#define ocs_queue_history_wq(...)
uint32_t uint32_t additional_status
#define SLI4_MGMT_STATUS_FEATURE_NOT_SUPPORTED
struct sli_bls_payload_t::@52::@53 acc
static int32_t ocs_hal_read_lmt(ocs_hal_t *hal)
function to read link module type
int32_t ocs_hal_io_get_xid(ocs_hal_t *hal, ocs_hal_io_t *io)
Return the OX_ID/RX_ID of the IO.
static int32_t ocs_hal_cmd_submit_pending(ocs_hal_t *hal)
Submit queued (pending) mbx commands.
static void * sli_get_wwn_port(sli4_t *sli4)
static uint32_t sli_is_dif_separate_capable(sli4_t *sli4)
uint8_t ocs_hal_is_xri_port_owned(ocs_hal_t *hal, uint32_t xri)
Return TRUE if exchange is port-owned.
int32_t sli_cmd_init_link(sli4_t *sli4, void *buf, size_t size, uint32_t speed, uint8_t reset_alpa)
Write an INIT_LINK command to the provided buffer.
static int32_t ocs_list_empty(ocs_list_t *list)
Test if a list is empty.
static int32_t ocs_fw_dump_buffer_alloc(ocs_t *ocs, uint8_t dump_level)
static ocs_hal_linkcfg_e ocs_hal_linkcfg_from_clp(const char *clp_str)
Helper function for getting the HAL linkcfg enum from the CLP string value.
uint32_t total_exchanges_originator
#define ocs_queue_history_init(...)
uint32_t receive_frame_count
void hal_queue_teardown(ocs_hal_t *hal)
Teardown HAL queue objects.
static ocs_hal_rtn_e ocs_hal_set_linkcfg(ocs_hal_t *, ocs_hal_linkcfg_e, uint32_t, ocs_hal_port_control_cb_t, void *)
Set link configuration.
T10 DIF information passed to the transport.
static void shutdown_target_wqe_timer(ocs_hal_t *hal)
static void ocs_hal_check_sec_hio_list(ocs_hal_t *hal)
Check to see if there are any BZ 161832 workaround waiting IOs.
int32_t sli_cmd_common_set_features(sli4_t *sli4, void *buf, size_t size, uint32_t feature, uint32_t param_len, void *parameter)
Write a COMMON_SET_FEATURES command.
static int32_t ocs_hal_cb_dump_clear(ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
Called when the OBJECT_DELETE command completes.
int32_t ocs_hal_rqpair_process_rq(ocs_hal_t *hal, hal_cq_t *cq, uint8_t *cqe)
Process receive queue completions for RQ Pair mode.
#define SLI4_READ_TOPOLOGY_LINK_UP
static ocs_hal_rtn_e ocs_hal_config_sli_port_health_check(ocs_hal_t *hal, uint8_t query, uint8_t enable)
enable sli port health check
#define SLI4_READ_CFG_TOPO_FC_DA
static ocs_hal_rtn_e ocs_hal_queue_hash_alloc(ocs_hal_t *hal)
int32_t ocs_hal_get_num_eq(ocs_hal_t *hal)
#define SLI4_READ_CFG_TOPO_FCOE
ocs_hal_rtn_e ocs_hal_teardown(ocs_hal_t *hal)
Tear down the Hardware Abstraction Layer module.
static void ocs_hal_adjust_wqs(ocs_hal_t *hal)
Adjust the number of WQs and CQs within the HAL.
uint8_t cmd[SLI4_BMBX_SIZE]
static void ocs_hal_linkcfg_dmtf_clp_cb(ocs_hal_t *hal, int32_t status, uint32_t result_len, void *arg)
Get the link configuration callback.
static void * __ocs_hal_port_attach_report_fail(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
int32_t sli_setup(sli4_t *sli4, ocs_os_handle_t os, sli4_port_type_e port_type)
Set up the SLI context.
void(* ocs_hal_parity_stat_cb_t)(int32_t status, uint8_t num_ulp, ocs_parity_err_count_t *counter, void *arg)
#define SLI4_FCOE_FIP_FCF_CLEAR_VLINK
static int32_t __ocs_hal_port_realloc_cb(ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
#define SLI4_CMD_REG_FCFI_NUM_RQ_CFG
REG_FCFI - activate a FC Forwarder.
static int32_t sli_set_dpp(sli4_t *sli4, uint32_t value)
int32_t sli_cmd_config_optimized_write_hp(sli4_t *sli4, void *buf, size_t size, uint32_t max_burst_len, uint32_t xri_cnt, uint32_t block_size, uint32_t tow_feature)
Write an CONFIG_OPTIMIZED_WRITE_HP command to the provided buffer.
#define SLI4_WKI_TAG_SAT_TEM
DUMP Type 4.
void ocs_pool_put(ocs_pool_t *pool, void *item)
free memory pool item
void sli4_cmd_lowlevel_get_itcm_parity_stats(sli4_t *sli4, void *buf, size_t size, bool clear_stats)
#define SLI4_FC_WCQE_STATUS_LOCAL_REJECT
static void ocs_hal_set_active_link_config_cb(ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
Callback for ocs_hal_set_linkcfg_skyhawk.
ocs_hal_rtn_e ocs_hal_send_frame(ocs_hal_t *hal, fc_header_le_t *hdr, uint8_t sof, uint8_t eof, ocs_dma_t *payload, ocs_hal_send_frame_context_t *ctx, void(*callback)(void *arg, uint8_t *cqe, int32_t status), void *arg)
Send a raw frame.
ocs_hal_rtn_e ocs_hal_unreg_rpi_all(ocs_hal_t *hal, ocs_sport_t *sport)
Free all remote node objects.
static ocs_hal_rtn_e ocs_hal_set_eth_license(ocs_hal_t *hal, uint32_t license)
Set the Ethernet license.
static ocs_hal_rtn_e ocs_hal_set_dump_location(ocs_hal_t *hal, uint32_t num_buffers, ocs_dma_t *dump_buffers, uint8_t fdb)
Set the Lancer dump location.
ocs_hal_async_cb_t callback
int32_t sli_queue_write(sli4_t *sli4, sli4_queue_t *q, uint8_t *entry)
Write an entry to the queue object.
void ocs_hal_free_dump_to_host_buffers(ocs_hal_t *hal)
static void ocs_hal_wq_handle_bad_reque_xri(void *arg, uint8_t *cqe, int32_t status)
static void * __ocs_hal_port_alloc_init(ocs_sm_ctx_t *, ocs_sm_event_t, void *)
static void * ocs_list_get_head(ocs_list_t *list)
Return the first item in the list.
#define ocs_queue_history_cqe(...)
ocs_hal_rtn_e ocs_hal_init_queues(ocs_hal_t *hal, ocs_hal_qtop_t *qtop)
Initialize queues.
char profile_description[512]
static int32_t ocs_hal_get_profile_list_cb(ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
Called for the completion of get_profile_list for a user request.
ocs_hal_global_t hal_global
void sli4_cmd_lowlevel_set_watchdog(sli4_t *sli4, void *buf, size_t size, uint16_t timeout)
Write a LOWLEVEL_SET_WATCHDOG command.
struct ocs_hal_io_param_t::@20 fcp_tgt
#define OCS_HAL_MAX_NUM_RQ
Node group rpi reference.
uint32_t descriptor_length
ocs_hal_rtn_e ocs_hal_io_abort(ocs_hal_t *hal, ocs_hal_io_t *io_to_abort, uint32_t send_abts, void *cb, void *arg)
Abort a previously-started IO.
#define OCS_HAL_RQ_SIZE_HDR
Defines the size of the RQ buffers used for each RQ.
ocs_hal_rtn_e ocs_hal_port_attach(ocs_hal_t *hal, ocs_sli_port_t *sport, uint32_t fc_id)
Attach a physical/virtual SLI port to a domain.
#define SLI4_READ_TOPOLOGY_SPEED_16G
static void * __ocs_hal_domain_free_unreg_fcfi(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
ocs_hal_rtn_e ocs_hal_get_profile_list(ocs_hal_t *hal, ocs_get_profile_list_cb_t cb, void *ul_arg)
Get a list of available profiles.
void(* ocs_get_profile_list_cb_t)(int32_t status, ocs_hal_profile_list_t *, void *arg)
T10 DIF Seed Scatter-Gather Entry (SGE)
static ocs_hal_rtn_e ocs_hal_exec_dmtf_clp_cmd(ocs_hal_t *hal, ocs_dma_t *dma_cmd, ocs_dma_t *dma_resp, uint32_t opts, ocs_hal_dmtf_clp_cb_t cb, void *arg)
Execute the DMTF CLP command.
#define OCS_FW_VER_STR(x)
ocs_hal_rtn_e ocs_hal_node_group_attach(ocs_hal_t *hal, ocs_remote_node_group_t *ngroup, ocs_remote_node_t *rnode)
static ocs_domain_t * ocs_hal_domain_get_indexed(ocs_hal_t *hal, uint16_t fcf_index)
static void ocs_hal_cb_cfg_watchdog(ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
#define SLI4_PROTOCOL_FCOE
static uint32_t sli_get_tow_capable(sli4_t *sli4)
static int32_t __ocs_hal_domain_cb(ocs_hal_t *, int32_t, uint8_t *, void *)
static void sli_queue_lock(sli4_queue_t *q)
int32_t sli_queue_free(sli4_t *sli4, sli4_queue_t *q, uint32_t destroy_queues, uint32_t free_memory)
Free a queue.
#define SLI4_SGE_DIF_OP_IN_CRC_OUT_NODIF
int32_t sli_xmit_bcast64_wqe(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *payload, uint32_t payload_len, uint8_t timeout, uint16_t xri, uint16_t tag, uint16_t cq_id, ocs_remote_node_t *rnode, uint8_t r_ctl, uint8_t type, uint8_t df_ctl)
#define SLI4_READ_SPARM64_VPI_DEFAULT
#define SLI4_READ_TOPOLOGY_SPEED_2G
int32_t sli_fw_ready(sli4_t *sli4)
Determine if the chip FW is in a ready state.
ocs_hal_rtn_e ocs_hal_io_add_seed_sge(ocs_hal_t *hal, ocs_hal_io_t *io, ocs_hal_dif_info_t *dif_info)
Add a T10 PI seed scatter gather list entry.
static uint32_t sli_is_dif_inline_capable(sli4_t *sli4)
uint32_t fw_diag_log_size
static ocs_hal_rtn_e ocs_hal_config_tow_t10pi(ocs_hal_t *hal)
Set configuration parameters for TOW T10 PI feature.
#define OCS_MIN_FW_VER_LANCER
int32_t sli_resource_alloc(sli4_t *sli4, sli4_resource_e rtype, uint32_t *rid, uint32_t *index)
Allocate SLI Port resources.
int32_t sli_cmd_post_xri(sli4_t *sli4, void *buf, size_t size, uint16_t xri_base, uint16_t xri_count)
Write a POST_XRI command to the provided buffer.
int32_t sli_cmd_unreg_rpi(sli4_t *sli4, void *buf, size_t size, uint16_t indicator, sli4_resource_e which, uint32_t fc_id)
Write an UNREG_RPI command to the provided buffer.
int32_t sli_queue_is_empty(sli4_t *sli4, sli4_queue_t *q)
Check if the given queue is empty.
sli4_mbox_command_header_t hdr
int32_t sli_cmd_fc_set_trunk_mode(sli4_t *sli4, void *buf, size_t size, uint32_t trunk_mode)
Write a SLI4_OPC_FC_SET_TRUNK_MODE command.
int32_t ocs_fw_dump_state_check(ocs_t *ocs, uint32_t state)
Check the fw dump state.
ocs_hal_linkcfg_e linkcfg
uintptr_t ocs_ras_get_lwpd_dma_addr(ocs_os_handle_t *ocs_os)
uint32_t buffer_address_high
#define OCS_HAL_MAX_NUM_EQ
uint32_t sli_fc_io_length(sli4_t *sli4, uint8_t *cqe)
Return the FCP IO length.
int32_t ocs_hal_reque_xri(ocs_hal_t *hal, ocs_hal_io_t *io)
Reque XRI.
static void * __ocs_hal_domain_free_redisc_fcf(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
#define SLI4_FC_LOCAL_REJECT_ABORT_REQUESTED
void(* ocs_get_active_profile_cb_t)(int32_t status, uint32_t active_profile, void *arg)
HAL async call context structure.
ocs_hal_rtn_e ocs_hal_set_loopback_mode(ocs_hal_t *hal, uint32_t type)
Set the Lancer dump location.
uint32_t dropped_frames_due_to_no_rq_buffer_count
uint32_t uint32_t profile_description[128]
ocs_hal_rtn_e ocs_hal_get_host_stats(ocs_hal_t *hal, uint8_t cc, ocs_hal_host_stat_cb_t cb, void *arg)
Function to retrieve the link and host statistics.
static int32_t ocs_hal_command_process(ocs_hal_t *, int32_t, uint8_t *, size_t)
ocs_hal_rtn_e ocs_hal_xri_move_to_host_owned(ocs_hal_t *hal, uint8_t num_xri)
Move XRIs from the port-controlled pool to the host.
static void ocs_hal_reclaim_xri(ocs_hal_t *hal, uint16_t xri_base, uint16_t xri_count)
Returns an XRI from the port owned list to the host.
#define SLI4_SGE_TYPE_DISEED
#define SLI4_SGE_TYPE_DIF
struct ocs_hal_io_param_t::@13 bls
#define OCS_HAL_WQ_TIMER_PERIOD_MS
ocs_hal_link_stat_cb_t cb
#define SLI4_IF_TYPE_BE3_SKH_VF
int32_t sli_cmd_reg_fcfi(sli4_t *sli4, void *buf, size_t size, uint16_t index, sli4_cmd_rq_cfg_t rq_cfg[SLI4_CMD_REG_FCFI_NUM_RQ_CFG], uint16_t vlan_id)
Write a REG_FCFI command to the provided buffer.
uint32_t receive_kbyte_count
ocs_hal_rtn_e ocs_hal_io_add_sge(ocs_hal_t *hal, ocs_hal_io_t *io, uintptr_t addr, uint32_t length)
Add a scatter gather list entry to an IO.
#define SLI4_SET_FEATURES_AUTO_RSP_PARAM_RESET
uint32_t advertised_receive_bufftor_to_buffer_credit
ocs_hal_rtn_e ocs_hal_domain_force_free(ocs_hal_t *hal, ocs_domain_t *domain)
Free a fabric domain object.
#define SLI4_CMD_REG_FCFI_SET_MRQ_MODE
#define FW_FUNC_DUMP_STATE_VALID
static sli4_link_medium_e sli_get_medium(sli4_t *sli4)
uint32_t actual_read_length
static void ocs_hal_remove_io_timed_wqe(ocs_hal_t *hal, ocs_hal_io_t *io)
static ocs_hal_rtn_e ocs_hal_init_tow_feature(ocs_hal_t *hal)
Initialize TOW feature for AXR/FB.
#define OCS_HAL_MAX_NUM_WQ
int32_t sli_cmd_config_optimized_write(sli4_t *sli4, void *buf, size_t size, uint32_t max_burst_len, uint32_t xri_cnt, uint32_t tow_feature)
Write an CONFIG_OPTIMIZED_WRITE command to the provided buffer.
Define the WQ callback object.
ocs_hal_rtn_e ocs_hal_callback(ocs_hal_t *hal, ocs_hal_callback_e which, void *func, void *arg)
Register a callback for the given event.
READ_LNK_STAT - read link status of a particular port.
int32_t sli_xmit_els_rsp64_wqe(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *rsp, uint32_t rsp_len, uint16_t xri, uint16_t tag, uint16_t cq_id, uint16_t ox_id, ocs_remote_node_t *rnode, uint32_t flags, uint32_t s_id)
Write a XMIT_ELS_RSP64_WQE work queue entry.
int32_t ocs_hal_queue_hash_find(ocs_queue_hash_t *hash, uint16_t id)
Find index given queue ID.
int32_t sli_queue_read(sli4_t *sli4, sli4_queue_t *q, uint8_t *entry)
Read an entry from the queue object.
void ocs_display_sparams(const char *prelabel, const char *reqlabel, int dest, void *textbuf, void *sparams)
Display service parameters.
static void * sli_get_wwn_node(sli4_t *sli4)
void(* ocs_hal_temp_cb_t)(int32_t status, uint32_t curr_temp, uint32_t crit_temp_thrshld, uint32_t warn_temp_thrshld, uint32_t norm_temp_thrshld, uint32_t fan_off_thrshld, uint32_t fan_on_thrshld, void *arg)
static void ocs_hal_io_free_move_correct_list(ocs_hal_t *hal, ocs_hal_io_t *io)
When an IO is freed, depending on the exchange busy flag, and other workarounds, move it to the corre...
#define SLI4_READ_TOPOLOGY_SPEED_4G
#define OCS_HAL_MAX_NUM_MQ
static uint32_t sli_get_max_sge(sli4_t *sli4)
hal_wq_callback_t * ocs_hal_reqtag_get_instance(ocs_hal_t *hal, uint32_t instance_index)
Return WQ request tag by index.
#define SLI4_READ_CFG_TOPO_FC
T10 DIF Scatter-Gather Entry (SGE)
int32_t sli_teardown(sli4_t *sli4)
Tear down a SLI context.
uint32_t fw_diag_log_level
uint32_t active_link_config_id
#define SLI4_READ_TOPOLOGY_LINK_DOWN
static ocs_hal_rtn_e ocs_hal_config_sliport_pause(ocs_hal_t *hal, uint8_t enable)
#define SLI4_SGE_DIF_OP_IN_CRC_OUT_CRC
#define SLI4_SGE_DIF_OP_IN_NODIF_OUT_CRC
uint32_t sli4_diseed_sge_t scsi_diseed_sge
int32_t sli_cmd_reg_fcfi_mrq(sli4_t *sli4, void *buf, size_t size, uint8_t mode, uint16_t fcf_index, uint16_t vlan_id, sli4_cmd_rq_cfg_t rq_cfg[SLI4_CMD_REG_FCFI_NUM_RQ_CFG])
Write REG_FCFI_MRQ to provided command buffer.
int32_t sli_cmd_common_write_object(sli4_t *sli4, void *buf, size_t size, uint16_t noc, uint16_t eof, uint32_t desired_write_length, uint32_t offset, char *object_name, ocs_dma_t *dma)
Write a COMMON_WRITE_OBJECT command.
struct ocs_hal_io_param_t::@14 bls_sid
sli4_profile_descriptor_t profile_descriptor[MAX_PRODUCT_DESCRIPTORS]
ocs_pool_t * ocs_pool_alloc(ocs_os_handle_t os, uint32_t size, uint32_t count, uint32_t use_lock)
Allocate a memory pool.
union ocs_domain_record_t::@5 map
void(* ocs_hal_fw_cb_t)(int32_t status, int32_t ext_status, uint32_t bytes_written, uint32_t change_status, void *arg)
#define OCS_HAL_REQUE_XRI_REGTAG
uint8_t fabric_name_id[8]
#define OCS_HAL_TOW_BLK_SIZE_DEFAULT
static void ocs_hal_wq_process_abort(void *arg, uint8_t *cqe, int32_t status)
Process WQ completions for abort requests.
ocs_hal_port_protocol_e
Port protocols.
static ocs_hal_rtn_e ocs_hal_sli_reset(ocs_hal_t *hal, ocs_hal_reset_e reset, ocs_hal_state_e prev_state)
ocs_hal_profile_descriptor_t descriptors[OCS_HAL_MAX_PROFILES]
void ocs_pool_free(ocs_pool_t *pool)
Free a previously allocated memory pool.
READ_NVPARMS - read SLI port configuration parameters.
sli4_mbox_command_header_t hdr
static int32_t sli_set_sgl_preregister(sli4_t *sli4, uint32_t value)
static void * ocs_list_remove(ocs_list_t *list, void *item)
Remove an item from the list.
static ocs_hal_io_t * _ocs_hal_io_alloc(ocs_hal_t *hal)
Lockless allocate a HAL IO object.
ocs_hal_io_t * ocs_hal_io_lookup(ocs_hal_t *hal, uint32_t xri)
Find IO given indicator (xri).
static uint32_t sli_get_sgl_preregister_required(sli4_t *sli4)
static uint32_t sli_get_max_queue(sli4_t *sli4, sli4_qtype_e qtype)
uint8_t ocs_hal_rqpair_tow_xri_buffer_attach(ocs_hal_t *hal, ocs_hal_io_t *io, int reuse_buf)
int ocs_hal_can_accept_wqes(struct ocs_hal_io_s *hio)
Validate HAL IO state to make sure HAL can accept and post wqe to SLI.
static ocs_hal_rtn_e ocs_hal_sequence_free(ocs_hal_t *hal, ocs_hal_sequence_t *seq)
static void * __ocs_hal_domain_allocated(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
int32_t sli_link_is_configurable(sli4_t *sli)
Determine if the link can be configured.
static int32_t ocs_hal_command_cancel(ocs_hal_t *)
#define SLI4_FC_WCQE_STATUS_TARGET_WQE_TIMEOUT
uint32_t uint32_t trunk_config
static void ocs_hal_watchdog_timer_cb(void *arg)
int32_t sli_resource_free(sli4_t *sli4, sli4_resource_e rtype, uint32_t rid)
Free the SLI Port resources.
static uint8_t ocs_hal_iotype_is_originator(uint16_t io_type)
ocs_hal_dump_clear_cb_t cb
ocs_hal_dif_oper_e dif_oper
static void * sli_get_fw_name(sli4_t *sli4, uint32_t which)
static int32_t ocs_hal_cb_fip(void *, void *)
#define SLI4_RESOURCE_DESCRIPTOR_TYPE_ISAP
int32_t sli_cqe_async(sli4_t *sli4, void *buf)
Check the asynchronous event completion entry.
static int32_t ocs_hal_get_fw_timed_out(ocs_hal_t *hal)
int32_t sli_cmd_config_auto_xfer_rdy(sli4_t *sli4, void *buf, size_t size, uint32_t max_burst_len)
Write an CONFIG_AUTO_XFER_RDY command to the provided buffer. Command to enable AXR in G5...
static uint32_t sli_get_hlm(sli4_t *sli4)
const char * ocs_sm_event_name(ocs_sm_event_t evt)
ocs_hal_io_t * ocs_hal_io_alloc(ocs_hal_t *hal)
Allocate a HAL IO object.
static ocs_hal_rtn_e ocs_hal_read_fcf(ocs_hal_t *hal, uint32_t index)
Read a FCF table entry.
int32_t sli_cmd_read_sparm64(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *dma, uint16_t vpi)
Write a READ_SPARM64 command to the provided buffer.
ocs_hal_rtn_e ocs_hal_set_dump_to_host_buffers(ocs_hal_t *hal)
Allocates dump dma buffers, if not already allocated. Set the Lancer dump location.
#define OCS_HAL_DMTF_CLP_RSP_MAX
int32_t sli_cmd_common_set_reconfig_link_id(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *dma, uint32_t fd, uint32_t active_link_config_id)
Write a COMMON_SET_RECONFIG_LINK_ID command.
uint32_t sli_fc_get_rpi_requirements(sli4_t *sli4, uint32_t n_rpi)
Get the RPI resource requirements.
static uint8_t ocs_hal_wcqe_abort_needed(uint16_t status, uint8_t ext, uint8_t xb)
static void * __ocs_hal_port_freed(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
ocs_hal_rtn_e ocs_hal_domain_alloc(ocs_hal_t *hal, ocs_domain_t *domain, uint32_t fcf, uint32_t vlan)
Allocate a fabric domain object.
int32_t sli_port_migration(sli4_t *sli4)
uint32_t uint32_t saved_status
uint32_t uint32_t uint32_t response_length
#define SLI4_FC_LOCAL_REJECT_NO_XRI
static uint32_t sli_get_max_qentries(sli4_t *sli4, sli4_qtype_e qtype)
ocs_hal_rtn_e ocs_hal_node_detach(ocs_hal_t *hal, ocs_remote_node_t *rnode)
Free a remote node object.
#define ocs_list_init(head, type, link)
#define SLI4_FCOE_FCF_TABLE_FIRST
ocs_hal_rtn_e ocs_hal_reset(ocs_hal_t *hal, ocs_hal_reset_e reset)
static int32_t ocs_hal_set_active_profile_cb(ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
Called for the completion of set_active_profile for a user request.
uint32_t received_eofa_count
ocs_hal_rtn_e ocs_hal_io_register_sgl(ocs_hal_t *hal, ocs_hal_io_t *io, ocs_dma_t *sgl, uint32_t sgl_count)
int32_t sli_queue_eq_arm(sli4_t *sli4, sli4_queue_t *q, uint8_t arm)
Arm an EQ.
static void * __ocs_hal_port_attach_reg_vpi(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
int32_t sli_raise_ue(sli4_t *sli4, uint8_t dump)
Cause chip to enter an unrecoverable error state.
FC/FCoE WQ completion queue entry.
static int ocs_list_valid(ocs_list_t *list)
Test if a list is valid (ready for use)
hal_wq_callback_t * ocs_hal_reqtag_alloc(ocs_hal_t *hal, void(*callback)(void *arg, uint8_t *cqe, int32_t status), void *arg)
Allocate a WQ request tag.
ocs_hal_rtn_e ocs_hal_dump_clear(ocs_hal_t *hal, ocs_hal_dump_clear_cb_t cb, void *arg)
Clear a dump image from the device.
void(* ocs_set_nvparms_cb_t)(int32_t status, void *arg)
static int32_t ocs_hal_io_ini_sge(ocs_hal_t *, ocs_hal_io_t *, ocs_dma_t *, uint32_t, ocs_dma_t *)
uint32_t ocs_hal_rpi_active_count(ocs_hal_t *hal)
Called to obtain active RPI count.
static ocs_hal_rtn_e ocs_hal_read_max_dump_size(ocs_hal_t *hal)
Read the max dump size for this port.
static ocs_hal_rtn_e ocs_hal_bmbx_command(ocs_hal_t *hal, uint8_t *cmd)
#define SLI4_READ_TOPOLOGY_SPEED_1G
void(* ocs_hal_host_stat_cb_t)(int32_t status, uint32_t num_counters, ocs_hal_host_stat_counts_t *counters, void *arg)
static ocs_hal_rtn_e ocs_hal_init_tow(ocs_hal_t *hal, uint32_t tow_feature)
int32_t sli_requeue_xri_wqe(sli4_t *sli4, void *buf, size_t size, uint16_t xri, uint16_t tag, uint16_t cq_id)
Write a REQUEUE_XRI_WQE work queue entry.
static int32_t ocs_hal_cb_host_stat(ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
Called when the READ_STATUS command completes.
#define SLI4_READ_TOPOLOGY_FC_AL
static ocs_hal_rtn_e ocs_hal_post_xri(ocs_hal_t *hal, uint32_t xri_start, uint32_t num_to_post)
Issues a mailbox command to move XRIs from the host-controlled pool to the port.
uint32_t active_profile_id
hal_wq_t * ocs_hal_queue_next_wq(ocs_hal_t *hal, ocs_hal_io_t *io)
Allocate a WQ to an IO object.
void(* ocs_hal_dump_clear_cb_t)(int32_t status, void *arg)
static int32_t ocs_hal_config_mrq(ocs_hal_t *hal, uint8_t, uint16_t, uint16_t)
Configure Multi-RQ.
static void ocs_hal_io_cancel_cleanup(ocs_hal_t *hal, ocs_hal_io_t *io)
Issue any pending callbacks for an IO and remove off the timer and pending lists. ...
void _ocs_hal_verify(const char *cond, const char *filename, int linenum)
Handle HAL verify.
void *(* ocs_sm_function_t)(ocs_sm_ctx_t *, ocs_sm_event_t, void *)
int32_t sli_fc_els_did(sli4_t *sli4, uint8_t *cqe, uint32_t *d_id)
Retrieve the D_ID from the completion.
#define ocs_list_foreach_safe(list, item, nxt)
Iterate a linked list safely.
static uint32_t sli_get_hw_revision(sli4_t *sli4, uint32_t which)
COMMON_SET_PROFILE_CONFIG.
int32_t sli_fcp_treceive64_wqe(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *sgl, uint32_t first_data_sge, uint32_t relative_off, uint32_t xfer_len, uint16_t xri, uint16_t tag, uint16_t cq_id, uint16_t xid, uint32_t rpi, ocs_remote_node_t *rnode, uint32_t flags, uint8_t dif, uint8_t bs, uint8_t csctl, uint32_t app_id, uint8_t timer)
Write an FCP_TRECEIVE64_WQE work queue entry.
int32_t sli_cmd_reg_vpi(sli4_t *sli4, void *buf, size_t size, ocs_sli_port_t *sport, uint8_t update)
Write a REG_VPI command to the provided buffer.
int32_t(* cb)(struct ocs_hal_s *, int32_t, uint8_t *, void *)
uint32_t sli4_fcf_entry_t fcf_entry
uint32_t * ocs_ras_get_dma_addr_list(ocs_os_handle_t *ocs_os, int32_t *buf_count)
uint32_t elastic_buffer_overrun_error_count
int32_t sli_eq_parse(sli4_t *sli4, uint8_t *buf, uint16_t *cq_id)
Parse an EQ entry to retrieve the CQ_ID for this event.
sli4_mbox_command_header_t hdr
ocs_hal_linkcfg_e
Link configurations.
static uint32_t sli_get_sli_rev(sli4_t *sli4)
uint32_t empty_rq_timeout_count
int32_t ocs_hal_set_nvparms(ocs_hal_t *hal, ocs_set_nvparms_cb_t cb, uint8_t *wwpn, uint8_t *wwnn, uint8_t hard_alpa, uint32_t preferred_d_id, void *ul_arg)
Write non-volatile parms.
static ocs_hal_rtn_e ocs_hal_set_linkcfg_lancer(ocs_hal_t *, ocs_hal_linkcfg_e, uint32_t, ocs_hal_port_control_cb_t, void *)
Set link configuration for Lancer.
void ocs_hal_wq_process(ocs_hal_t *hal, hal_cq_t *cq, uint8_t *cqe, int32_t status, uint16_t rid)
Process WQ completion queue entries.
ocs_hal_rtn_e ocs_hal_io_add_dif_sge(ocs_hal_t *hal, ocs_hal_io_t *io, uintptr_t addr)
Add a T10 DIF scatter gather list entry to an IO.
#define SLI4_SGE_DIF_OP_IN_CHKSUM_OUT_CRC
static int32_t ocs_hal_cb_node_free(ocs_hal_t *, int32_t, uint8_t *, void *)
static void * __ocs_hal_domain_alloc_read_sparm64(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
static int32_t __ocs_read_topology_cb(ocs_hal_t *, int32_t, uint8_t *, void *)
ocs_hal_rtn_e ocs_hal_get(ocs_hal_t *hal, ocs_hal_property_e prop, uint32_t *value)
POST_XRI - post XRI resources to the SLI Port.
uint32_t dropped_frames_due_to_no_xri_count
int32_t sli_send_frame_wqe(sli4_t *sli4, void *buf, size_t size, uint8_t sof, uint8_t eof, uint32_t *hdr, ocs_dma_t *payload, uint32_t req_len, uint8_t timeout, uint16_t xri, uint16_t req_tag)
Write a SEND_FRAME work queue entry.
void ocs_hal_qtop_free(ocs_hal_qtop_t *qtop)
free queue topology object
ocs_hal_rtn_e ocs_hal_port_free(ocs_hal_t *hal, ocs_sli_port_t *sport)
Free port resources.
ocs_array_t * ocs_array_alloc(ocs_os_handle_t os, uint32_t size, uint32_t count)
Allocate an array object.
uint32_t received_eofni_count
static void ocs_hal_io_restore_sgl(ocs_hal_t *, ocs_hal_io_t *)
static ocs_hal_rtn_e ocs_hal_config_fec(ocs_hal_t *hal, uint8_t enable)
configure fec (enable/disable) on physical port
uint32_t disable_app_ffff
static int32_t sli_set_topology(sli4_t *sli4, uint32_t value)
uint32_t received_eofdti_count
sli4_mbox_command_header_t hdr
static uint32_t sli_get_sgl_preregister(sli4_t *sli4)
#define SLI4_READ_CFG_TOPO_FC_AL
#define SLI4_FCOE_FIP_FCF_DEAD
#define ocs_queue_history_free(...)
int32_t sli_cmd_fcoe_read_fcf_table(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *dma, uint16_t index)
Write an FCOE_READ_FCF_TABLE command.
static ocs_hal_rtn_e ocs_hal_sli_queue_alloc(ocs_hal_t *hal)
uint32_t advertised_transmit_buffer_to_buffer_credit
void ocs_array_free(ocs_array_t *array)
Free an array object.
ocs_hal_rtn_e ocs_hal_node_attach(ocs_hal_t *hal, ocs_remote_node_t *rnode, ocs_dma_t *sparms)
Update a remote node object with the remote port's service parameters.
uint32_t arbitration_fc_al_timout_count
static int32_t ocs_hal_mq_process(ocs_hal_t *, int32_t, sli4_queue_t *)
Process entries on the given mailbox queue.
ocs_hal_rtn_e ocs_hal_set_ptr(ocs_hal_t *hal, ocs_hal_property_e prop, void *value)
int32_t sli_cmd_read_nvparms(sli4_t *sli4, void *buf, size_t size)
Write a READ_NVPARMS command to the provided buffer.
uint32_t primitive_sequence_event_timeout_count
int32_t sli_dump_is_present(sli4_t *sli4)
Read the SLIPORT_STATUS register to check if a dump is present.
int32_t(* ocs_hal_done_t)(struct ocs_hal_io_s *, ocs_remote_node_t *, uint32_t len, int32_t status, uint32_t ext, void *ul_arg)
HAL callback type.
static int32_t ocs_hal_cb_node_attach(ocs_hal_t *, int32_t, uint8_t *, void *)
uint32_t profile_descriptor_count
int ocs_hal_stop_fw_diagnostic_logging(ocs_hal_t *hal)
Stop firmware diagnostic logging (RAS).
uint32_t received_dropped_no_aer_count
static void * __ocs_hal_port_done(ocs_sm_ctx_t *, ocs_sm_event_t, void *)
#define OCS_HAL_Q_HASH_SIZE
Defines a wrapper for the RQ payload buffers so that we can place it back on the proper queue...
static int32_t __ocs_read_fec_cb(ocs_hal_t *, int32_t, uint8_t *, void *)
static void ocs_hal_generic_mbx_command_cb(ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
ocs_hal_rtn_e ocs_hal_raise_ue(ocs_hal_t *hal, uint8_t dump)
Cause chip to enter an unrecoverable error state.
static int32_t __ocs_hal_port_common(const char *funcname, ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
static void sli_skh_chain_sge_build(sli4_t *sli4, sli4_sge_t *sge, uint32_t xri_index, uint32_t frag_num, uint32_t offset)
struct ocs_hal_io_param_t::@19 fc_ct_rsp
ocs_hal_rtn_e ocs_hal_port_alloc(ocs_hal_t *hal, ocs_sli_port_t *sport, ocs_domain_t *domain, uint8_t *wwpn)
Allocate a port object.
static void ocs_hal_parse_pause_errx_pairs(ocs_hal_t *hal)
uint32_t buffer_address_low
static void * __ocs_hal_domain_init(ocs_sm_ctx_t *, ocs_sm_event_t, void *)
uint32_t descriptor_length
int32_t sli_fcp_iread64_wqe(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *sgl, uint32_t first_data_sge, uint32_t xfer_len, uint16_t xri, uint16_t tag, uint16_t cq_id, uint32_t rpi, ocs_remote_node_t *rnode, uint8_t dif, uint8_t bs, uint8_t timeout)
Write an FCP_IREAD64_WQE work queue entry.
ocs_hal_rtn_e ocs_hal_port_control(ocs_hal_t *hal, ocs_hal_port_e ctrl, uintptr_t value, ocs_hal_port_control_cb_t cb, void *arg)
Control a port (initialize, shutdown, or set link configuration).
uint32_t receive_f_bsy_count
uint32_t received_soff_count
#define OCS_HAL_DMTF_CLP_CMD_MAX
static ocs_hal_rtn_e ocs_hal_config_fw_ag_rsp(ocs_hal_t *hal, uint8_t enable)
Enable/disable firmware path to send auto-good response.
int32_t ocs_hal_event_check(ocs_hal_t *hal, uint32_t vector)
Check for the events associated with the interrupt vector.
void ocs_sm_transition(ocs_sm_ctx_t *ctx, ocs_sm_function_t state, void *data)
Transition to a new state.
void * ocs_pool_get_instance(ocs_pool_t *pool, uint32_t idx)
Return item given an index.
int32_t ocs_hal_get_nvparms(ocs_hal_t *hal, ocs_get_nvparms_cb_t cb, void *ul_arg)
Read non-volatile parms.
static void * __ocs_hal_domain_freed(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
static ocs_hal_rtn_e ocs_hal_exec_mbx_command_generic_results(ocs_hal_t *hal, uint8_t *req_rsp_buf, bool handle_sli4_rsp, int timeout_usecs)
Issue a blocking hal command that has generic response handling in callback handler.
#define SLI4_SGE_DIF_OP_IN_CHKSUM_OUT_NODIF
int32_t sli_abort_wqe(sli4_t *sli4, void *buf, size_t size, sli4_abort_type_e type, uint32_t send_abts, uint32_t ids, uint32_t mask, uint16_t tag, uint16_t cq_id)
Write an ABORT_WQE work queue entry.
static uint32_t sli_get_sli_family(sli4_t *sli4)
static int32_t ocs_hal_set_port_protocol_cb1(ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
Called for the completion of set_port_profile for a user request.
static int32_t target_wqe_timer_nop_cb(ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
ocs_get_port_protocol_cb_t cb
static void * __ocs_hal_domain_alloc_init_vfi(ocs_sm_ctx_t *, ocs_sm_event_t, void *)
int32_t sli_cmd_fcoe_set_loopback_mode(sli4_t *sli4, void *buf, size_t size, int type)
Write a SLI4_OPC_FCOE_SET_LINK_DIAG_LOOPBACK command.
#define SLI4_SET_FEATURES_SLI_PORT_HEALTH_CHECK
int32_t sli_cmd_common_get_profile_list(sli4_t *sli4, void *buf, size_t size, uint32_t start_profile_index, ocs_dma_t *dma)
Write a COMMON_COMMON_GET_PROFILE_LIST command.
int32_t sli_cmd_common_read_object(sli4_t *sli4, void *buf, size_t size, uint32_t desired_read_length, uint32_t offset, char *object_name, ocs_dma_t *dma)
Write a COMMON_READ_OBJECT command.
void(* ocs_get_port_protocol_cb_t)(int32_t status, ocs_hal_port_protocol_e port_protocol, void *arg)
static uint32_t sli_get_vpd_len(sli4_t *sli4)
static uint32_t sli_get_max_rsrc(sli4_t *sli4, sli4_resource_e rsrc)
static ocs_hal_rtn_e ocs_hal_get_linkcfg_skyhawk(ocs_hal_t *, uint32_t, ocs_hal_port_control_cb_t, void *)
Get link configuration for a Skyhawk.
static void * __ocs_hal_domain_attach_report_fail(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
static int32_t __ocs_hal_port_cb(ocs_hal_t *, int32_t, uint8_t *, void *)
static int32_t ocs_hal_get_port_protocol_cb(ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
Called for the completion of get_port_profile for a user request.
static void * __ocs_hal_port_alloc_read_sparm64(ocs_sm_ctx_t *, ocs_sm_event_t, void *)
static void ocs_hal_queue_hash_add(ocs_queue_hash_t *, uint16_t, uint16_t)
Update the queue hash with the ID and index.
ocs_hal_rtn_e ocs_hal_set_port_protocol(ocs_hal_t *hal, ocs_hal_port_protocol_e new_protocol, uint32_t pci_func, ocs_set_port_protocol_cb_t cb, void *ul_arg)
Set the port protocol.
void ocs_hal_workaround_setup(struct ocs_hal_s *hal)
Setup HAL runtime workarounds.
#define SLI4_SET_FEATURES_DIF_MEMORY_MODE
static void * __ocs_hal_port_free_report_fail(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
sli4_mbox_command_header_t hdr
static void ocs_hal_io_free_internal(void *arg)
Free a previously-allocated HAL IO object. Called when IO refcount goes to zero (host-owned IOs only)...
static char * sli_get_bios_version_string(sli4_t *sli4)
static ocs_hal_linkcfg_e ocs_hal_linkcfg_from_config_id(const uint32_t config_id)
Helper function for getting the HAL linkcfg enum from a Skyhawk config ID.
ocs_domain_t * ocs_hal_domain_get(ocs_hal_t *hal, uint16_t fcfi)
uint32_t sli_fc_ext_status(sli4_t *sli4, uint8_t *cqe)
static void * __ocs_hal_domain_free_report_fail(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
WRITE_NVPARMS - write SLI port configuration parameters.
ocs_hal_rtn_e ocs_hal_rqpair_tow_move_to_port(ocs_hal_t *hal, ocs_hal_io_t *io)
Prepares an XRI to move to the chip.
ocs_get_active_profile_cb_t cb
#define FC_LINK_SPEED_16G
uint32_t auto_incr_ref_tag
static int32_t ocs_hal_get_nvparms_cb(ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
Called for the completion of get_nvparms for a user request.
int32_t sli_cmd_fcoe_post_sgl_pages(sli4_t *sli4, void *buf, size_t size, uint16_t xri, uint32_t xri_count, ocs_dma_t *page0[], ocs_dma_t *page1[], ocs_dma_t *dma)
Write an FCOE_POST_SGL_PAGES command.
int32_t sli_queue_arm(sli4_t *sli4, sli4_queue_t *q, uint8_t arm)
Arm a queue.
HAL link configuration enum to Skyhawk link config ID mapping.
void(* ocs_get_nvparms_cb_t)(int32_t status, uint8_t *wwpn, uint8_t *wwnn, uint8_t hard_alpa, uint32_t preferred_d_id, void *arg)
void ocs_ras_init(uint32_t fw_log_level, uint32_t log_buf_size)
int32_t sli_reset(sli4_t *sli4)
int32_t sli_cmd_dmtf_exec_clp_cmd(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *cmd, ocs_dma_t *resp)
Write a DMTF_EXEC_CLP_CMD command.
static void * __ocs_hal_domain_attach_reg_vfi(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
#define FW_DUMP_TYPE_DUMPTOHOST
uint32_t ocs_varray_get_count(ocs_varray_t *va)
Return entry count for a void pointer array.
static ocs_hal_rtn_e ocs_hal_set_dif_mode(ocs_hal_t *hal)
Sets the DIF mode value.
void ocs_hal_cq_process(ocs_hal_t *hal, hal_cq_t *cq, uint32_t cq_process_limit)
Process entries on the given completion queue.
RELEASE_XRI - Release XRI resources from the SLI Port.
static ocs_hal_rtn_e ocs_hal_config_watchdog_timer(ocs_hal_t *hal)
Set configuration parameters for watchdog timer feature.
#define SLI4_FCOE_FCF_TABLE_LAST
void ocs_hal_rx_free(ocs_hal_t *hal)
Free the RQ data buffers.
static void * __ocs_hal_port_alloc_init_vpi(ocs_sm_ctx_t *, ocs_sm_event_t, void *)
uint32_t current_receive_buffer_to_buffer_credit
#define FW_FUNC_DESC_DUMP
static void sli_queue_unlock(sli4_queue_t *q)
ocs_hal_rtn_e ocs_hal_node_free_resources(ocs_hal_t *hal, ocs_remote_node_t *rnode)
Free a remote node resource.
#define SLI4_MBOX_STATUS_RPI_NOT_REG
#define SLI4_PROTOCOL_ISCSI
const char * queue_topology_string
FCOE_READ_FCF_TABLE response.
#define SLI4_READ_SPARM64_WWNN_OFFSET
static void ocs_hal_queue_hash_free(ocs_hal_t *hal)
static uint32_t sli_get_dpp_capable(sli4_t *sli4)
int ocs_sm_post_event(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
Post an event to a context.
ocs_hal_rtn_e ocs_hal_get_temperature(ocs_hal_t *hal, ocs_hal_temp_cb_t cb, void *arg)
Function to retrieve the temperature information.
void * ocs_varray_iter_next(ocs_varray_t *va)
Return next entry from a void pointer array.
ocs_hal_rtn_e ocs_hal_set(ocs_hal_t *hal, ocs_hal_property_e prop, uint32_t value)
#define SLI4_SET_FEATURES_SET_FTD_XFER_HINT
static void ocs_hal_io_quarantine(ocs_hal_t *hal, hal_wq_t *wq, ocs_hal_io_t *io)
Quaratine an IO by taking a reference count and adding it to the quarantine list. When the IO is popp...
ocs_hal_rtn_e ocs_hal_rx_allocate(ocs_hal_t *hal)
Allocate the RQ data buffers.
int ocs_ras_free_resc(ocs_os_handle_t *ocs_os)
static void hal_wq_submit_pending(hal_wq_t *wq, uint32_t update_free_count)
Update free count and submit any pending HAL IOs.
ocs_hal_rtn_e ocs_hal_io_send(ocs_hal_t *hal, ocs_hal_io_type_e type, ocs_hal_io_t *io, uint32_t len, ocs_hal_io_param_t *iparam, ocs_remote_node_t *rnode, void *cb, void *arg)
Send a read, write, or response IO.
ocs_hal_io_t * quarantine_ios[OCS_HAL_QUARANTINE_QUEUE_DEPTH]
int32_t sli_fcp_icmnd64_wqe(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *sgl, uint16_t xri, uint16_t tag, uint16_t cq_id, uint32_t rpi, ocs_remote_node_t *rnode, uint8_t timeout)
Write an FCP_ICMND64_WQE work queue entry.
static void ocs_list_add_tail(ocs_list_t *list, void *item)
Add an item to the tail of the list.
#define OCS_HAL_MAX_NUM_CQ
int32_t sli_cmd_common_get_profile_config(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *dma)
Write a COMMON_COMMON_GET_PROFILE_CONFIG command.
static ocs_hal_rtn_e ocs_hal_init_tow_esoc(ocs_hal_t *hal, uint32_t tow_feature)
ocs_hal_rtn_e ocs_hal_node_group_free(ocs_hal_t *hal, ocs_remote_node_group_t *ngroup)
Description of discovered Fabric Domain.
static void * __ocs_hal_domain_alloc_reg_fcfi(ocs_sm_ctx_t *, ocs_sm_event_t, void *)
static ocs_hal_rtn_e ocs_hal_alloc_set_dump_buffers(ocs_hal_t *hal, uint8_t dump_level)
int32_t sli_els_request64_wqe(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *sgl, uint8_t req_type, uint32_t req_len, uint32_t max_rsp_len, uint8_t timeout, uint16_t xri, uint16_t tag, uint16_t cq_id, ocs_remote_node_t *rnode)
Write an ELS_REQUEST64_WQE work queue entry.
uint32_t auto_incr_ref_tag
void ocs_hal_unsol_process_bounce(void *arg)
sli4_port_state_t link_current
Callback argument structure for the DMTF CLP commands.
#define FW_CHIP_LEVEL_DUMP
static const char * ocs_hal_clp_from_linkcfg(ocs_hal_linkcfg_e linkcfg)
Helper function for getting the CLP string value from the HAL linkcfg enum.
ocs_hal_dif_oper_e dif_oper
uint32_t ocs_hal_xri_move_to_port_owned(ocs_hal_t *hal, uint32_t num_xri)
Move XRIs from the host-controlled pool to the port.
void(* ocs_hal_port_control_cb_t)(int32_t status, uintptr_t value, void *arg)
int32_t ocs_hal_get_active_profile(ocs_hal_t *hal, ocs_get_active_profile_cb_t cb, void *ul_arg)
Get the currently active profile.
static ocs_hal_rtn_e ocs_hal_link_event_init(ocs_hal_t *hal)
uint32_t uint32_t iscsi_dif
#define ocs_list_remove_head(list)
Remove and return an item from the head of the list.
static uint16_t sli_get_link_module_type(sli4_t *sli4)
int32_t sli_cmd_config_auto_xfer_rdy_hp(sli4_t *sli4, void *buf, size_t size, uint32_t max_burst_len, uint32_t block_size)
Write an CONFIG_AUTO_XFER_RDY_HP command to the provided buffer.
ocs_hal_io_t * ocs_hal_io_activate_port_owned(ocs_hal_t *hal, ocs_hal_io_t *io)
Allocate/Activate a port owned HAL IO object.
int32_t ocs_hal_set_active_profile(ocs_hal_t *hal, ocs_set_active_profile_cb_t cb, uint32_t profile_id, void *ul_arg)
Set the currently active profile.
uint32_t quarantine_index
uint32_t loss_of_sync_error_count
int32_t sli_reset_required(sli4_t *sli4)
Read the SLIPORT_STATUS register to check if the reset required is set.
ocs_hal_rtn_e ocs_hal_domain_free(ocs_hal_t *hal, ocs_domain_t *domain)
Free a fabric domain object.
ocs_hal_rtn_e ocs_hal_rx_post(ocs_hal_t *hal)
Post the RQ data buffers to the chip.
uint32_t sli_reg_read(sli4_t *sli, sli4_regname_e reg)
Read the given SLI register.
static void ocs_list_add_head(ocs_list_t *list, void *item)
Add an item to the head of the list.
uint32_t sli_fc_response_length(sli4_t *sli4, uint8_t *cqe)
Return the ELS/CT response length.
int32_t sli_cmd_common_delete_object(sli4_t *sli4, void *buf, size_t size, char *object_name)
Write a COMMON_DELETE_OBJECT command.
static void ocs_hal_sli_queue_free(ocs_hal_t *hal)
uint32_t buffer_address_low
#define SLI4_SGE_TYPE_DATA
#define SLI4_SET_FEATURES_SET_CONFIG_TOW_T10PI
static int32_t ocs_hal_cb_link_stat(ocs_hal_t *, int32_t, uint8_t *, void *)
Called when the READ_LINK_STAT command completes.
#define SLI4_IF_TYPE_LANCER_G7
#define SLI4_SGE_DIF_OP_IN_RAW_OUT_RAW
static uint32_t sli_get_is_sgl_chaining_capable(sli4_t *sli4)
uint32_t primitive_sequence_error_count
#define SLI4_READ_TOPOLOGY_SPEED_8G
READ_TOPOLOGY - read the link event information.
#define FC_LINK_SPEED_10G
static void ocs_hal_dmtf_clp_cb(ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
Called when the DMTF CLP command completes.
#define OCS_HAL_TOW_APP_TAG_VALUE_DEFAULT
ocs_hal_rtn_e ocs_hal_get_trunk_info(ocs_hal_t *hal, uint32_t *trunk_info)
Get trunking mode information.
uint32_t actual_write_length
static ocs_hal_rtn_e ocs_hal_set_dif_seed(ocs_hal_t *hal)
Sets the DIF seed value.
static int32_t ocs_hal_clp_resp_get_value(ocs_hal_t *hal, const char *keyword, char *value, uint32_t value_len, const char *resp, uint32_t resp_len)
Parse the CLP result and get the value corresponding to the given keyword.
struct ocs_hal_io_param_t::@15 bcast
#define SLI4_SGE_TYPE_LSP
static int32_t ocs_hal_cb_port_control(ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
Called when the port control command completes.
#define SLI4_SGE_DIF_OP_IN_NODIF_OUT_CHKSUM
#define SLI4_SGE_MAX_RESERVED
int32_t ocs_hal_process(ocs_hal_t *hal, uint32_t vector, uint32_t max_isr_time_msec)
uint32_t abort_wqe_submit_needed
ocs_hal_rtn_e ocs_hal_reqtag_init(ocs_hal_t *hal)
Initialize the reqtag pool.
uint32_t buffer_address_low
void sli4_cmd_lowlevel_disable_ras(sli4_t *sli4, void *buf, size_t size)
Write a LOWLEVEL_SET_DIAG_LOG_OPTIONS command.
static void * __ocs_hal_port_alloc_report_fail(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
ocs_hal_qtop_t * ocs_hal_qtop_parse(ocs_hal_t *hal, const char *qtop_string)
Parse queue topology string.
int32_t sli_fw_reset(sli4_t *sli4)
Issue a Firmware Reset.
static int32_t ocs_hal_set_nvparms_cb(ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
Called for the completion of set_nvparms for a user request.
int32_t sli_cmd_reg_vfi(sli4_t *sli4, void *buf, size_t size, ocs_domain_t *domain)
Write a REG_VFI command to the provided buffer.
Defines a general FC sequence object, consisting of a header, payload buffers and a HAL IO in the cas...
static char * sli_get_ipl_name(sli4_t *sli4)
#define OCS_MIN_FW_VER_SKYHAWK
uint8_t cmd_buf[SLI4_BMBX_SIZE]
int32_t ocs_hal_eq_process(ocs_hal_t *hal, hal_eq_t *eq, uint32_t max_isr_time_msec)
Process events associated with an EQ.
#define SLI4_IO_AUTO_GOOD_RESPONSE
static void ocs_hal_rx_buffer_free(ocs_hal_t *hal, ocs_hal_rq_buffer_t **rq_buf, uint32_t count)
Free an ocs_hal_rx_buffer_t array.
static ocs_hal_rtn_e ocs_hal_config_axr_t10pi(ocs_hal_t *hal)
Set configuration parameters for AXR T10 PI feature.
ocs_hal_rtn_e ocs_hal_node_group_alloc(ocs_hal_t *hal, ocs_remote_node_group_t *ngroup)
#define SLI4_CMD_REG_FCFI_SET_FCFI_MODE
uint32_t released_xri_count
uint32_t uint32_t topology
int32_t sli_cmd_common_get_reconfig_link_info(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *dma)
Write a COMMON_GET_RECONFIG_LINK_INFO command.
#define SLI4_FC_LOCAL_REJECT_INVALID_RPI
struct ocs_hal_io_param_t::@21 fcp_ini
uint32_t struct sli4_cmd_release_xri_t::@31 xri_tbl[62]
int32_t sli_cmd_unreg_vpi(sli4_t *sli4, void *buf, size_t size, uint16_t indicator, uint32_t which)
Write an UNREG_VPI command to the provided buffer.
static void * __ocs_hal_port_allocated(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
int32_t sli_cmd_common_set_active_profile(sli4_t *sli4, void *buf, size_t size, uint32_t fd, uint32_t active_profile_id)
Write a COMMON_COMMON_SET_ACTIVE_PROFILE command.
static void ocs_hal_io_free_port_owned(void *arg)
Free a HAL IO object associated with a port-owned XRI.
uint32_t ocs_hal_io_get_count(ocs_hal_t *hal, ocs_hal_io_count_type_e io_count_type)
Called to obtain the count for the specified type.
#define ocs_hal_assert(cond)
int32_t sli_cmd_common_get_active_profile(sli4_t *sli4, void *buf, size_t size)
Write a COMMON_COMMON_GET_ACTIVE_PROFILE command.
#define SLI4_IF_TYPE_BE3_SKH_PF
ocs_hal_rtn_e ocs_hal_io_init_sges(ocs_hal_t *hal, ocs_hal_io_t *io, ocs_hal_io_type_e type)
Initialize the scatter gather list entries of an IO.
static int32_t sli_set_hlm(sli4_t *sli4, uint32_t value)
int32_t sli_cmd_release_xri(sli4_t *sli4, void *buf, size_t size, uint8_t num_xri)
Write a RELEASE_XRI command to the provided buffer.
static ocs_hal_rtn_e ocs_hal_config_fw_diagnostic_logging(ocs_hal_t *hal, int32_t log_size, int32_t log_level)
Set configuration parameters for adapter firmware diagnostic logging (RAS) feature.
void(* ocs_hal_sfp_cb_t)(void *, int32_t, uint32_t, uint32_t *, void *)
union sli_bls_payload_t::@52 u
int32_t ocs_hal_rqpair_tow_data_process(ocs_hal_t *hal, hal_cq_t *cq, uint8_t *cqe)
Process CQ completions for Auto xfer rdy data phases.
static void * __ocs_hal_domain_alloc_report_fail(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
int32_t sli_cmd_read_config(sli4_t *sli4, void *buf, size_t size)
Write a READ_CONFIG command to the provided buffer.
uint32_t receive_p_bsy_count
int32_t ocs_get_bus_dev_func(ocs_t *ocs, uint8_t *bus, uint8_t *dev, uint8_t *func)
static void ocs_hal_async_cb(ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
HAL async callback handler.
#define SLI4_IO_CONTINUATION
int32_t ocs_hal_rqpair_tow_cmd_process(ocs_hal_t *hal, hal_cq_t *cq, uint8_t *cqe)
Process receive queue completions for RQ Pair mode - Auto xfer rdy.
int32_t sli_gen_request64_wqe(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *sgl, uint32_t req_len, uint32_t max_rsp_len, uint8_t timeout, uint16_t xri, uint16_t tag, uint16_t cq_id, ocs_remote_node_t *rnode, uint8_t r_ctl, uint8_t type, uint8_t df_ctl)
Write a GEN_REQUEST64 work queue entry.
static uint32_t sli_get_dif_capable(sli4_t *sli4)
uint32_t buffer_address_high
#define OCS_HAL_TOW_REF_TAG_LBA_DEFAULT
static void target_wqe_timer_cb(void *arg)
ocs_get_profile_list_cb_t cb
uint32_t buffer_address_high
int32_t ocs_hal_async_call(ocs_hal_t *hal, ocs_hal_async_cb_t callback, void *arg)
Make an async callback using NOP mailbox command.
ocs_hal_remote_node_event_e
List Segment Pointer Scatter-Gather Entry (SGE)
#define OCS_HAL_FDT_XFER_HINT
static void ocs_hal_wq_process_io(void *arg, uint8_t *cqe, int32_t status)
Process WQ completions for IO requests.
ocs_hal_host_stat_cb_t cb
#define SLI4_MAX_FCFI
Maximum value for a FCFI.
int32_t sli_xmit_bls_rsp64_wqe(sli4_t *sli4, void *buf, size_t size, sli_bls_payload_t *payload, uint16_t xri, uint16_t tag, uint16_t cq_id, ocs_remote_node_t *rnode, uint32_t s_id)
Write an XMIT_BLS_RSP64_WQE work queue entry.
int32_t sli_bmbx_command(sli4_t *sli4)
Submit a command to the bootstrap mailbox and check the status.
struct ocs_hal_io_param_t::@17 els_sid
ocs_hal_linkcfg_e linkcfg
static ocs_hal_rtn_e ocs_hal_firmware_write_lancer(ocs_hal_t *hal, ocs_dma_t *dma, uint32_t size, uint32_t offset, int last, ocs_hal_fw_cb_t cb, void *arg)
Write a portion of a firmware image to the Emulex XE201 ASIC (Lancer).
#define OCS_HAL_QUARANTINE_QUEUE_DEPTH
Define the fields required to implement the skyhawk DIF quarantine.
ocs_set_active_profile_cb_t cb
uint32_t receive_sequence_count
static void * __ocs_hal_domain_attached(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
static ocs_hal_rtn_e ocs_hal_setup_io(ocs_hal_t *)
Initialize the pool of HAL IO objects.
int32_t ocs_get_property(const char *prop_name, char *buffer, uint32_t buffer_len)
get driver wide property value
static void ocs_hal_init_linkcfg_cb(int32_t status, uintptr_t value, void *arg)
Callback function for getting linkcfg during HAL initialization.
uint32_t current_transmit_buffer_to_buffer_credit
int32_t sli_cmd_unreg_vfi(sli4_t *sli4, void *buf, size_t size, ocs_domain_t *domain, uint32_t which)
Write an UNREG_VFI command to the provided buffer.
ocs_hal_rtn_e ocs_hal_setup(ocs_hal_t *hal, ocs_os_handle_t os, sli4_port_type_e port_type)
Set up the Hardware Abstraction Layer module.
int32_t sli_cmd_dump_type4(sli4_t *sli4, void *buf, size_t size, uint16_t wki)
Write a DUMP Type 4 command to the provided buffer.
static int32_t ocs_hal_get_active_profile_cb(ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
Called for the completion of get_active_profile for a user request.
int32_t sli_cmd_init_vpi(sli4_t *sli4, void *buf, size_t size, uint16_t vpi, uint16_t vfi)
Write an INIT_VPI command to the provided buffer.
#define ocs_assert(cond,...)
int32_t sli_callback(sli4_t *sli4, sli4_callback_e which, void *func, void *arg)
Register a callback for the given event.
int32_t sli_fcp_tsend64_wqe(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *sgl, uint32_t first_data_sge, uint32_t relative_off, uint32_t xfer_len, uint16_t xri, uint16_t tag, uint16_t cq_id, uint16_t xid, uint32_t rpi, ocs_remote_node_t *rnode, uint32_t flags, uint8_t dif, uint8_t bs, uint8_t csctl, uint32_t app_id)
Write an FCP_TSEND64_WQE work queue entry.
#define SLI4_READ_TOPOLOGY_LINK_NO_ALPA
int32_t sli_fcp_iwrite64_wqe(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *sgl, uint32_t first_data_sge, uint32_t xfer_len, uint32_t first_burst, uint16_t xri, uint16_t tag, uint16_t cq_id, uint32_t rpi, ocs_remote_node_t *rnode, uint8_t dif, uint8_t bs, uint8_t timeout)
Write an FCP_IWRITE64_WQE work queue entry.
uint8_t embed[58 *sizeof(uint32_t)]
#define OCS_TARGET_READ_SKIPS
Scatter-Gather Entry (SGE)
ocs_hal_rtn_e ocs_hal_run_biu_diag(ocs_hal_t *hal, void *tx_buff, size_t tx_buff_len, void *rx_buff, size_t rx_buff_len)
Run Diagnostic PCI Loopback test.
uint32_t sli4_parity_err_count_t counter[SLI4_MAX_ULP]
void sli4_cmd_lowlevel_enable_ras(sli4_t *sli4, void *buf, size_t size, int log_level, uint32_t unit_size, int32_t buf_count, uint32_t *phys_addr, uintptr_t lwpd_phys_addr)
Write a LOWLEVEL_SET_DIAG_LOG_OPTIONS command.
int32_t sli_cmd_common_set_profile_config(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *dma, uint8_t profile_id, uint32_t descriptor_count, uint8_t isap)
Write a COMMON_COMMON_SET_PROFILE_CONFIG command.
static void * __ocs_hal_port_free_unreg_vpi(ocs_sm_ctx_t *, ocs_sm_event_t, void *)
static int32_t ocs_hal_cb_fw_write(ocs_hal_t *, int32_t, uint8_t *, void *)
Called when the WRITE OBJECT command completes.
#define SLI4_SET_FEATURES_DIF_SEED
COMMON_SET_SET_FEATURES.
uint8_t fcf_mac_address[6]
static void * __ocs_hal_port_attached(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
int32_t sli_cmd_config_run_biu_diag(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *tx_buffer, size_t tx_buf_len, ocs_dma_t *rx_buffer, size_t rx_buf_len)
Write a RUN_BIU_DIAG command.
struct ocs_hal_io_param_t::@16 els
static int32_t ocs_hal_cb_link(void *, void *)
Callback function for the SLI link events.
#define SLI4_FC_LOCAL_REJECT_RPI_SUSPENDED
static uint32_t sli_get_if_type(sli4_t *sli4)
int32_t sli_cmd_init_vfi(sli4_t *sli4, void *buf, size_t size, uint16_t vfi, uint16_t fcfi, uint16_t vpi)
Write an INIT_VFI command to the provided buffer.
static uint32_t fc_be24toh(uint32_t x)
ocs_hal_rtn_e ocs_hal_command(ocs_hal_t *hal, uint8_t *cmd, uint32_t opts, void *cb, void *arg)
Issue a SLI command.
ocs_hal_rtn_e ocs_hal_clear_dump_location(ocs_hal_t *hal)
Clear the Lancer dump location.
static ocs_hal_rtn_e ocs_hal_set_linkcfg_skyhawk(ocs_hal_t *, ocs_hal_linkcfg_e, uint32_t, ocs_hal_port_control_cb_t, void *)
Set link configuration for a Skyhawk.
sli4_mbox_command_header_t hdr
void(* ocs_hal_link_stat_cb_t)(int32_t status, uint32_t num_counters, ocs_hal_link_stat_counts_t *counters, void *arg)
static void ocs_hal_add_io_timed_wqe(ocs_hal_t *hal, ocs_hal_io_t *io)
#define SLI4_SGE_TYPE_SKIP
#define FW_DUMP_STATE_NONE
static uint32_t sli_get_is_dual_ulp_capable(sli4_t *sli4)
uint32_t total_exchanges_responder
void * ocs_hal_get_ptr(ocs_hal_t *hal, ocs_hal_property_e prop)
int32_t(* ocs_hal_async_cb_t)(ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
int32_t sli_cmd_unreg_fcfi(sli4_t *sli4, void *buf, size_t size, uint16_t indicator)
Write a UNREG_FCFI command to the provided buffer.
#define SLI4_READ_TOPOLOGY_NPORT
static ocs_hal_rtn_e ocs_hal_get_linkcfg(ocs_hal_t *, uint32_t, ocs_hal_port_control_cb_t, void *)
Get link configuration.
int32_t sli_cmd_config_link(sli4_t *sli4, void *buf, size_t size)
Write a CONFIG_LINK command to the provided buffer.
static ocs_hal_rq_buffer_t ** ocs_hal_rx_buffer_alloc(ocs_hal_t *hal, uint32_t rqindex, uint32_t count, uint32_t size)
Allocate an ocs_hal_rx_buffer_t array.
#define SLI4_PROTOCOL_DEFAULT
#define SLI4_MAX_FCF_INDEX
Maximum value for FCF index.
#define SLI4_FC_LOCAL_REJECT_LINK_DOWN
#define SLI4_IO_SUPPRESS_RESPONSE
sli4_mbox_command_header_t hdr
#define ocs_list_foreach(list, item)
Iterate a linked list.
static uint32_t ocs_hal_config_id_from_linkcfg(ocs_hal_linkcfg_e linkcfg)
Helper function for getting a Skyhawk link config ID from the HAL linkcfg enum.
static int32_t __ocs_hal_domain_common(const char *funcname, ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
int32_t ocs_hal_io_cancel(ocs_hal_t *hal)
void ocs_hal_rqpair_teardown(ocs_hal_t *hal)
Tear down the rq_pair function from ocs_hal_teardown().
Generic Command Response header.
void(* callback)(void *arg, uint8_t *cqe, int32_t status)
ocs_hal_dif_blk_size_e blk_size
uint32_t transmit_sequence_count
static int32_t ocs_hal_domain_add(ocs_hal_t *, ocs_domain_t *)
void(* ocs_hal_dmtf_clp_cb_t)(ocs_hal_t *hal, int32_t status, uint32_t result_len, void *arg)
uint32_t invalid_transmission_word_error_count
void * ocs_array_get(ocs_array_t *array, uint32_t idx)
Return reference to an element of an array object.
int32_t(* ocs_hal_srrs_cb_t)(ocs_hal_io_t *io, ocs_remote_node_t *rnode, uint32_t length, int32_t status, uint32_t ext_status, void *arg)
static int32_t ocs_hal_set_port_protocol_cb2(ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
Called for the completion of set_port_profile for a user request.
struct sli_bls_payload_t::@52::@54 rjt
static void ocs_hal_io_free_common(ocs_hal_t *hal, ocs_hal_io_t *io)
Free a HAL IO object. Perform cleanup common to port and host-owned IOs.
#define OCS_HAL_SEND_FRAME_TIMEOUT
#define SLI4_READ_SPARM64_WWPN_OFFSET
#define OCS_TARGET_WRITE_SKIPS
static void * __ocs_hal_domain_free_unreg_vfi(ocs_sm_ctx_t *, ocs_sm_event_t, void *)
int32_t sli_cmd_read_topology(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *dma)
Write a READ_TOPOLOGY command to the provided buffer.
int32_t ocs_ras_allocate_resc(ocs_os_handle_t *ocs_os)
uint32_t disable_app_ref_ffff
static int32_t ocs_hal_cb_unreg_rpi_all(ocs_hal_t *, int32_t, uint8_t *, void *)
int32_t _sli_queue_write(sli4_t *sli4, sli4_queue_t *q, uint8_t *entry)
Write an entry to the queue object.
int32_t sli_fcp_cont_treceive64_wqe(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *sgl, uint32_t first_data_sge, uint32_t relative_off, uint32_t xfer_len, uint16_t xri, uint16_t sec_xri, uint16_t tag, uint16_t cq_id, uint16_t xid, uint32_t rpi, ocs_remote_node_t *rnode, uint32_t flags, uint8_t dif, uint8_t bs, uint8_t csctl, uint32_t app_id, uint8_t timer)
Write an FCP_CONT_TRECEIVE64_WQE work queue entry.
static void * sli_get_vpd(sli4_t *sli4)
int32_t sli_fcp_trsp64_wqe(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *sgl, uint32_t rsp_len, uint16_t xri, uint16_t tag, uint16_t cq_id, uint16_t xid, uint32_t rpi, ocs_remote_node_t *rnode, uint32_t flags, uint8_t csctl, uint8_t port_owned, uint32_t app_id)
Write an FCP_TRSP64_WQE work queue entry.
uint32_t transmit_kbyte_count
static ocs_hal_rtn_e ocs_hal_io_overflow_sgl(ocs_hal_t *hal, ocs_hal_io_t *io)
static ocs_hal_linkcfg_map_t linkcfg_map[]
Mapping from the HAL linkcfg enum to the CLP command value string.
#define SLI4_SGE_DIF_OP_IN_CRC_OUT_CHKSUM
uint32_t loss_of_signal_error_count
static uint32_t ocs_hal_get_num_chutes(ocs_hal_t *hal)
Determine the number of chutes on the device.
static void ocs_hal_log_sli4_rsp_hdr(ocs_hal_t *hal, sli4_res_hdr_t *hdr)
static uint32_t sli_get_portnum(sli4_t *sli4)
int32_t sli_init(sli4_t *sli4)
int32_t sli_cmd_reg_rpi(sli4_t *sli4, void *buf, size_t size, uint32_t nport_id, uint16_t rpi, uint16_t vpi, ocs_dma_t *dma, uint8_t update, uint8_t enable_t10_pi, uint8_t hlm)
Write a REG_RPI command to the provided buffer.
void(* ocs_set_port_protocol_cb_t)(int32_t status, void *arg)
ocs_set_port_protocol_cb_t cb
uint32_t link_failure_error_count
ocs_hal_rtn_e ocs_hal_set_trunk_mode(ocs_hal_t *hal, uint32_t trunk_mode)
Set trunking mode.
ocs_hal_rq_buffer_t * payload
static uint32_t sli_get_auto_xfer_rdy_capable(sli4_t *sli4)
uint32_t transmit_frame_count
ocs_hal_rtn_e ocs_hal_firmware_write(ocs_hal_t *hal, ocs_dma_t *dma, uint32_t size, uint32_t offset, int last, ocs_hal_fw_cb_t cb, void *arg)
Write a portion of a firmware image to the device.
ocs_hal_rtn_e ocs_hal_get_link_stats(ocs_hal_t *hal, uint8_t req_ext_counters, uint8_t clear_overflow_flags, uint8_t clear_all_counters, ocs_hal_link_stat_cb_t cb, void *arg)
Function to retrieve the link statistics.
#define SLI4_SET_FEATURES_FEC
void(* ocs_hal_dump_get_cb_t)(int32_t status, uint32_t bytes_read, uint8_t eof, void *arg)
static uint32_t sli_get_tow_xris_max(sli4_t *sli4)
#define SLI4_IF_TYPE_LANCER_FC_ETH
ocs_hal_parity_stat_cb_t cb
static int32_t ocs_hal_cb_post_xri(ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
Called when the POST_XRI command completes.
static ocs_hal_rtn_e ocs_hal_get_linkcfg_lancer(ocs_hal_t *, uint32_t, ocs_hal_port_control_cb_t, void *)
Get link configuration for a Lancer.
Stucture used for the hash lookup of queue IDs.
static int32_t ocs_hal_domain_del(ocs_hal_t *, ocs_domain_t *)
ocs_hal_dif_blk_size_e blk_size
uint32_t received_dropped_no_available_xri_resources_count
HAL link configuration enum to the CLP string value mapping.
int32_t sli_cmd_fcoe_rediscover_fcf(sli4_t *sli4, void *buf, size_t size, uint16_t index)
#define SLI4_CONFIG_FEC_LINK_TYPE_FC
uint32_t uint32_t app_tag
#define OCS_HAL_MAX_PROFILES