50 typedef struct ocs_mgmt_lancer_temp_result_s {
60 #if !defined(OCS_USPACE_SPDK)
66 void *arg_out, uint32_t arg_out_length);
68 static void ocs_mgmt_fw_write_cb(int32_t status, int32_t ext_status, uint32_t actual_write_length,
69 uint32_t change_status,
void *arg);
72 #if defined(OCS_INCLUDE_RAMD)
74 ocs_mgmt_read_phys(ocs_t *ocs,
char *,
void *, uint32_t ,
void *, uint32_t);
120 #if defined(ENABLE_FABRIC_EMULATION)
154 #if defined(ENABLE_FABRIC_EMULATION)
155 static int set_femul_enable(ocs_t*,
char*,
char*);
177 #if defined(OCS_INCLUDE_RAMD)
178 static void* find_address_in_target(
ocs_ramdisc_t **ramdisc_array, uint32_t ramdisc_count, uintptr_t target_addr);
192 {
"sn",
get_sn, NULL, NULL},
193 {
"pn",
get_pn, NULL, NULL},
217 #if defined(ENABLE_FABRIC_EMULATION)
218 {
"femul_enable", get_femul_enable, set_femul_enable, NULL},
235 #if !defined(OCS_USPACE_SPDK)
240 #if defined(OCS_INCLUDE_RAMD)
241 {
"read_phys", NULL, NULL, ocs_mgmt_read_phys},
279 ocs_domain_t *domain;
285 for (i=0;i<ARRAY_SIZE(mgmt_table);i++) {
287 if (mgmt_table[i].get_handler) {
290 if (mgmt_table[i].set_handler) {
293 if (mgmt_table[i].action_handler) {
299 if ((ocs->mgmt_functions) && (ocs->mgmt_functions->get_list_handler)) {
300 ocs->mgmt_functions->get_list_handler(textbuf, ocs);
303 if ((ocs->tgt_mgmt_functions) && (ocs->tgt_mgmt_functions->get_list_handler)) {
304 ocs->tgt_mgmt_functions->get_list_handler(textbuf, &(ocs->tgt_ocs));
312 if ((domain->mgmt_functions) && (domain->mgmt_functions->get_list_handler)) {
313 domain->mgmt_functions->get_list_handler(textbuf, domain);
353 ocs_domain_t *domain;
361 snprintf(qualifier,
sizeof(qualifier),
"/ocs");
364 if (ocs_strncmp(name, qualifier, strlen(qualifier)) == 0) {
365 char *unqualified_name = name + strlen(qualifier) + 1;
367 for (i=0;i<ARRAY_SIZE(mgmt_table);i++) {
368 if (ocs_strcmp(unqualified_name, mgmt_table[i].name) == 0) {
369 if (mgmt_table[i].get_handler) {
377 if ((ocs->mgmt_functions) && (ocs->mgmt_functions->get_handler)) {
378 retval = ocs->mgmt_functions->get_handler(textbuf, qualifier, (
char*)name, ocs);
382 if ((ocs->tgt_mgmt_functions) && (ocs->tgt_mgmt_functions->get_handler)) {
383 retval = ocs->tgt_mgmt_functions->get_handler(textbuf, qualifier,
384 (
char*)name, &(ocs->tgt_ocs));
390 ocs_log_err(ocs,
" Failed to acquire device lock\n");
405 if ((domain->mgmt_functions) && (domain->mgmt_functions->get_handler)) {
406 retval = domain->mgmt_functions->get_handler(textbuf, qualifier, (
char*)name, domain);
454 ocs_domain_t *domain;
459 snprintf(qualifier,
sizeof(qualifier),
"/ocs");
462 if (ocs_strncmp(name, qualifier, strlen(qualifier)) == 0) {
463 char *unqualified_name = name + strlen(qualifier) +1;
466 for (i=0;i<ARRAY_SIZE(mgmt_table);i++) {
467 if (ocs_strcmp(unqualified_name, mgmt_table[i].name) == 0) {
468 if (mgmt_table[i].set_handler) {
469 return mgmt_table[i].
set_handler(ocs, name, value);
474 if ((ocs->mgmt_functions) && (ocs->mgmt_functions->set_handler)) {
475 result = ocs->mgmt_functions->set_handler(qualifier, name, (
char *)value, ocs);
479 if ((ocs->tgt_mgmt_functions) && (ocs->tgt_mgmt_functions->set_handler)) {
480 result = ocs->tgt_mgmt_functions->set_handler(qualifier, name,
481 (
char *)value, &(ocs->tgt_ocs));
488 ocs_log_err(ocs,
" Failed to acquire device lock\n");
492 if ((domain->mgmt_functions) && (domain->mgmt_functions->set_handler)) {
493 result = domain->mgmt_functions->set_handler(qualifier, name, (
char*)value, domain);
539 uint32_t arg_in_length,
void *arg_out, uint32_t arg_out_length)
541 ocs_domain_t *domain;
546 snprintf(qualifier,
sizeof(qualifier),
"/ocs");
549 if (ocs_strncmp(action, qualifier, strlen(qualifier)) == 0) {
550 char *unqualified_name = action + strlen(qualifier) +1;
553 for (i=0;i<ARRAY_SIZE(mgmt_table); i++) {
554 if (ocs_strcmp(unqualified_name, mgmt_table[i].
name) == 0) {
555 if (mgmt_table[i].action_handler) {
556 return mgmt_table[i].
action_handler(ocs, action, arg_in, arg_in_length,
557 arg_out, arg_out_length);
563 if ((ocs->mgmt_functions) && (ocs->mgmt_functions->exec_handler)) {
564 result = ocs->mgmt_functions->exec_handler(qualifier, action, arg_in, arg_in_length,
565 arg_out, arg_out_length, ocs);
569 if ((ocs->tgt_mgmt_functions) && (ocs->tgt_mgmt_functions->exec_handler)) {
570 result = ocs->tgt_mgmt_functions->exec_handler(qualifier, action,
571 arg_in, arg_in_length, arg_out, arg_out_length,
581 ocs_log_err(ocs,
"Error: domain is empty\n");
585 OCS_M_NOWAIT | OCS_M_ZERO);
586 if (domain_exec_args == NULL) {
587 ocs_log_err(ocs,
"Failed to allocate memory\n");
590 domain_exec_args->
arg_out = ocs_malloc(ocs, arg_out_length, OCS_M_NOWAIT | OCS_M_ZERO);
591 if (domain_exec_args->
arg_out == NULL) {
593 ocs_log_err(ocs,
"Failed to allocate memory\n");
598 domain_exec_args->
arg_in = arg_in;
600 ocs_sem_init(&domain_exec_args->
sem, 0,
"domain_exec_sem");
601 ocs_atomic_init(&domain_exec_args->
ref_cnt, 2);
605 if ((domain->mgmt_functions) && (domain->mgmt_functions->exec_handler)) {
606 result = domain->mgmt_functions->exec_handler(qualifier, action,
615 if (ocs_sem_p(&domain_exec_args->
sem, OCS_SEM_FOREVER)) {
616 ocs_log_err(ocs,
"ocs_sem_p failed\n");
619 if (ocs_atomic_sub_and_test(&domain_exec_args->
ref_cnt, 1)) {
620 if (ocs_copy_to_user(arg_out, domain_exec_args->
arg_out, arg_out_length))
621 ocs_log_err(ocs,
"Error: copy to user buffer is failed\n");
622 ocs_free(ocs, domain_exec_args->
arg_out, arg_out_length);
623 ocs_free(ocs, domain_exec_args,
sizeof(*domain_exec_args));
634 ocs_domain_t *domain;
639 for (i=0;i<ARRAY_SIZE(mgmt_table);i++) {
640 if (mgmt_table[i].get_handler) {
642 }
else if (mgmt_table[i].action_handler) {
649 if ((ocs->mgmt_functions) && (ocs->mgmt_functions->get_all_handler)) {
650 ocs->mgmt_functions->get_all_handler(textbuf, ocs);
653 if ((ocs->tgt_mgmt_functions) && (ocs->tgt_mgmt_functions->get_all_handler)) {
654 ocs->tgt_mgmt_functions->get_all_handler(textbuf, &(ocs->tgt_ocs));
658 ocs_log_err(ocs,
" Failed to acquire device lock\n");
663 if ((domain->mgmt_functions) && (domain->mgmt_functions->get_all_handler)) {
664 domain->mgmt_functions->get_all_handler(textbuf, domain);
672 #if defined(OCS_INCLUDE_RAMD)
674 ocs_mgmt_read_phys(ocs_t *ocs,
char *
name,
void *arg_in, uint32_t arg_in_length,
void *arg_out, uint32_t arg_out_length)
678 uintptr_t target_addr;
681 uint32_t ramdisc_count;
684 if ((arg_in == NULL) ||
685 (arg_in_length == 0) ||
687 (arg_out_length == 0)) {
691 if (arg_in_length > 80) {
695 if (ocs_copy_from_user(addr_str, arg_in, arg_in_length)) {
696 ocs_log_test(ocs,
"Failed to copy addr from user\n");
700 target_addr = (uintptr_t)ocs_strtoul(addr_str, NULL, 0);
706 if (ocs->tgt_ocs.use_global_ramd) {
708 ramdisc_count = ocs->tgt_ocs.rdisc_count;
709 ramdisc_array = ocs->tgt_ocs.rdisc;
710 vaddr = find_address_in_target(ramdisc_array, ramdisc_count, target_addr);
715 for (domain_idx=0; domain_idx<ocs->domain_instance_count; domain_idx++) {
716 ocs_domain_t *domain;
720 for (sport_idx=0; sport_idx < domain->sport_instance_count; sport_idx++) {
724 ramdisc_count = sport->tgt_sport.rdisc_count;
725 ramdisc_array = sport->tgt_sport.rdisc;
726 vaddr = find_address_in_target(ramdisc_array, ramdisc_count, target_addr);
738 length = arg_out_length;
742 if (ocs_copy_to_user(arg_out, vaddr, length)) {
743 ocs_log_test(ocs,
"Failed to copy buffer to user\n");
760 static void* find_address_in_target(
ocs_ramdisc_t **ramdisc_array, uint32_t ramdisc_count, uintptr_t target_addr)
763 uint32_t ramdisc_idx;
766 for (ramdisc_idx=0; ramdisc_idx<ramdisc_count; ramdisc_idx++) {
767 uint32_t segment_idx;
769 rdisc = ramdisc_array[ramdisc_idx];
771 for (segment_idx=0; segment_idx<rdisc->
segment_count; segment_idx++) {
773 uintptr_t segment_start;
774 uintptr_t segment_end;
779 if ((target_addr >= segment_start) && (target_addr <= segment_end)) {
781 offset = target_addr - segment_start;
788 if ((target_addr >= segment_start) && (target_addr <= segment_end)) {
790 offset = target_addr - segment_start;
813 #if !defined(OCS_USPACE_SPDK)
828 prev_state.
value = 0;
844 #if !defined(OCS_USPACE_SPDK)
851 #define FW_WRITE_BUFSIZE 64*1024
853 typedef struct ocs_mgmt_fw_write_result {
873 uint32_t change_status = 0;
876 ocs_sem_init(&(result.
semaphore), 0,
"fw_write");
878 bytes_left = buf_len;
880 userp = (uint8_t *)buf;
883 ocs_log_err(ocs,
"ocs_mgmt_firmware_write: malloc failed");
887 while (bytes_left > 0) {
893 xfer_size = bytes_left;
897 if (ocs_copy_from_user(dma.virt, userp, xfer_size)) {
903 if (bytes_left == xfer_size) {
912 if (ocs_sem_p(&(result.
semaphore), OCS_SEM_FOREVER) != 0) {
914 ocs_log_err(ocs,
"ocs_sem_p failed\n");
920 ocs_log_test(ocs,
"actual_write_length is %d\n", result.
actual_xfer);
927 ocs_log_err(ocs,
"write returned status %d, additional status %d\n",
930 ocs_log_err(ocs,
"Firmware does not meet minimum version requirement for this IPL\n");
949 if ((arg_out_length > 0) && (arg_out != NULL)) {
950 if (arg_out_length >
sizeof(status_str)) {
951 arg_out_length =
sizeof(status_str);
953 ocs_snprintf(status_str, arg_out_length,
"%d", change_status);
954 if (ocs_copy_to_user(arg_out, status_str, arg_out_length)) {
955 ocs_log_test(ocs,
"copy to user failed for change_status\n");
960 ocs_dma_free(ocs, &dma);
967 uint32_t change_status,
void *arg)
979 typedef struct ocs_mgmt_parity_stats_result_s {
994 for (i = 0; i < num_ulp; i++) {
1005 void *arg_out, uint32_t arg_out_length)
1008 bool clear_stats = FALSE;
1009 char arg_str[8] = {
'\0' };
1013 if (!arg_out_length || !arg_out)
1016 if (arg_in_length && arg_in) {
1017 if (arg_in_length > 8)
1020 if (ocs_copy_from_user(arg_str, arg_in, arg_in_length)) {
1021 ocs_log_err(ocs,
"Failed to copy arg from user\n");
1026 if (0 == ocs_strncmp(arg_str,
"clear", ocs_strlen(
"clear")))
1030 ocs_memset(&result, 0,
sizeof(result));
1031 ocs_sem_init(&result.
semaphore, 0,
"get_parity_stats");
1036 if (ocs_sem_p(&result.
semaphore, OCS_SEM_FOREVER)) {
1038 ocs_log_err(ocs,
"ocs_sem_p failed\n");
1043 ocs_log_err(ocs,
"Read parity stats failed; status: %d\n", result.
status);
1048 if (arg_out_length > stats_counter_size)
1049 arg_out_length = stats_counter_size;
1051 if (ocs_copy_to_user(arg_out, result.
counter, arg_out_length)) {
1052 ocs_log_err(ocs,
"Failed to copy buffer to user\n");
1060 uint32_t crit_temp_thr, uint32_t warn_temp_thr,
1061 uint32_t norm_temp_thr, uint32_t fan_off_thr,
1062 uint32_t fan_on_thr,
void *arg)
1065 ocs_t *ocs = result->
ocs;
1067 ocs_log_debug(ocs,
"CB status %08x, curr_temp=%d crit_temp_thr=%d "
1068 "warn_temp_thr %d norm_temp_thr %d foff_thr %d fon_thr %d\n",
1069 status, curr_temp, crit_temp_thr, warn_temp_thr,
1070 norm_temp_thr, fan_off_thr, fan_on_thr);
1073 result->
resp[0] = curr_temp;
1074 result->
resp[1] = crit_temp_thr;
1075 result->
resp[2] = warn_temp_thr;
1076 result->
resp[3] = norm_temp_thr;
1077 result->
resp[4] = fan_off_thr;
1078 result->
resp[5] = fan_on_thr;
1089 ocs_log_err(ocs,
"Insufficient output buffer\n");
1094 OCS_M_ZERO | OCS_M_NOWAIT);
1095 if (result == NULL) {
1096 ocs_log_err(ocs,
"Failed to allcoate memory\n");
1100 ocs_sem_init(&result->
waitsem, 0,
"dump_type4_mbox");
1104 ocs_log_err(ocs,
"HAL get temperature failed\n");
1108 if (ocs_sem_p(&result->
waitsem, OCS_SEM_FOREVER)) {
1109 ocs_log_err(ocs,
"ocs_sem_p failed\n");
1113 if (result->
status != 0) {
1114 ocs_log_err(ocs,
"Read temperature command failed status %04x\n",
1121 if (ocs_copy_to_user(buf, (uint8_t *)result->
resp,
sizeof(result->
resp))) {
1122 ocs_log_err(ocs,
"Failed to copy resp to user buffer\n");
1133 typedef struct ocs_mgmt_sfp_result {
1139 uint32_t page_data[32];
1152 ocs_unlock(&(result->
cb_lock));
1162 ocs_unlock(&(result->
cb_lock));
1166 void *buf, uint32_t buf_len)
1170 if (result == NULL) {
1171 ocs_log_err(ocs,
"failed to allocate memory for sfp results\n");
1175 ocs_sem_init(&(result->
semaphore), 0,
"get_sfp");
1176 ocs_lock_init(ocs, &(result->
cb_lock),
"get_sfp");
1183 if (ocs_sem_p(&(result->
semaphore), 5 * 1000 * 1000) != 0) {
1188 ocs_log_err(ocs,
"ocs_sem_p failed\n");
1189 ocs_unlock(&(result->
cb_lock));
1193 ocs_unlock(&(result->
cb_lock));
1197 if (result->
status != 0) {
1198 ocs_log_test(ocs,
"read_transceiver_data returned status %d\n",
1200 #define UNSUPPORTED_SFP_ERR_STATUS 0x42
1207 ocs_log_err(ocs,
"failed to submit HAL command to get SFP transaciver data\n");
1231 ocs_xport_t *xport = ocs->xport;
1325 strncpy(sn_buf, (
char*)pserial, len);
1341 strncpy(sn_buf, (
char*)pserial, len);
1378 uint32_t asic_gen_num;
1379 uint32_t asic_rev_num;
1381 char result_buf[80];
1384 family = (ocs_config_read32(ocs,
SLI4_INTF_REG) & 0x00000f00) >> 8;
1386 asic_rev_num = asic_id & 0xff;
1387 asic_gen_num = (asic_id & 0xff00) >> 8;
1394 ocs_strncpy(result_buf,
"BE2 A",
sizeof(result_buf));
1395 ocs_snprintf(tmp_buf, 2,
"%d", rev_id);
1396 strcat(result_buf, tmp_buf);
1400 ocs_strncpy(result_buf,
"BE3",
sizeof(result_buf));
1401 if (rev_id >= 0x10) {
1402 strcat(result_buf,
"-R");
1404 ocs_snprintf(tmp_buf, 3,
" %c", ((rev_id & 0xf0) >> 4) +
'A');
1405 strcat(result_buf, tmp_buf);
1406 ocs_snprintf(tmp_buf, 2,
"%d", rev_id & 0x0f);
1407 strcat(result_buf, tmp_buf);
1411 ocs_strncpy(result_buf,
"Skyhawk A0",
sizeof(result_buf));
1415 ocs_strncpy(result_buf,
"Lancer A",
sizeof(result_buf));
1416 ocs_snprintf(tmp_buf, 2,
"%d", rev_id & 0x0f);
1417 strcat(result_buf, tmp_buf);
1421 ocs_strncpy(result_buf,
"Lancer",
sizeof(result_buf));
1422 ocs_snprintf(tmp_buf, 3,
" %c", ((rev_id & 0xf0) >> 4) +
'A');
1423 strcat(result_buf, tmp_buf);
1424 ocs_snprintf(tmp_buf, 2,
"%d", rev_id & 0x0f);
1425 strcat(result_buf, tmp_buf);
1428 ocs_strncpy(result_buf,
"Lancer G6",
sizeof(result_buf));
1431 ocs_strncpy(result_buf,
"Prism",
sizeof(result_buf));
1435 switch(asic_gen_num) {
1437 ocs_strncpy(result_buf,
"BE2",
sizeof(result_buf));
1440 ocs_strncpy(result_buf,
"BE3-R",
sizeof(result_buf));
1443 ocs_strncpy(result_buf,
"Skyhawk-R",
sizeof(result_buf));
1446 ocs_strncpy(result_buf,
"Corsair",
sizeof(result_buf));
1449 ocs_strncpy(result_buf,
"Lancer",
sizeof(result_buf));
1452 ocs_strncpy(result_buf,
"LancerG6",
sizeof(result_buf));
1455 ocs_strncpy(result_buf,
"Prism",
sizeof(result_buf));
1458 ocs_strncpy(result_buf,
"Unknown",
sizeof(result_buf));
1460 if (ocs_strcmp(result_buf,
"Unknown") != 0) {
1461 ocs_snprintf(tmp_buf, 3,
" %c", ((asic_rev_num & 0xf0) >> 4) +
'A');
1462 strcat(result_buf, tmp_buf);
1463 ocs_snprintf(tmp_buf, 2,
"%d", asic_rev_num & 0x0f);
1464 strcat(result_buf, tmp_buf);
1468 ocs_strncpy(result_buf,
"Unknown",
sizeof(result_buf));
1565 ocs->xport? ocs->xport->lip_count: 0);
1590 page_data = ocs_malloc(ocs,
SFP_PAGE_SIZE, OCS_M_ZERO | OCS_M_NOWAIT);
1591 if (page_data == NULL) {
1595 buf = ocs_malloc(ocs, (
SFP_PAGE_SIZE * 3) + 1, OCS_M_ZERO | OCS_M_NOWAIT);
1603 if (bytes_read <= 0) {
1604 if (bytes_read == -ENODEV) {
1605 ocs_log_debug(ocs,
"%s: No SFP module present on this device\n", __func__);
1612 uint8_t *s = page_data;
1616 for (i = 0; i < bytes_read; i++) {
1617 bytes_added = ocs_snprintf(d, buffer_remaining,
"%02x ", *s);
1620 buffer_remaining -= bytes_added;
1638 page_data = ocs_malloc(ocs,
SFP_PAGE_SIZE, OCS_M_ZERO | OCS_M_NOWAIT);
1639 if (page_data == NULL) {
1643 buf = ocs_malloc(ocs, (
SFP_PAGE_SIZE * 3) + 1, OCS_M_ZERO | OCS_M_NOWAIT);
1651 if (bytes_read <= 0) {
1655 uint8_t *s = page_data;
1659 for (i=0; i < bytes_read; i++) {
1660 bytes_added = ocs_snprintf(d, buffer_remaining,
"%02x ", *s);
1663 buffer_remaining -= bytes_added;
1685 uint32_t max_dump_size = 0;
1819 #if defined(ENABLE_FABRIC_EMULATION)
1821 get_femul_enable(ocs_t *ocs,
char *name,
ocs_textbuf_t *textbuf)
1836 typedef struct ocs_mgmt_linkcfg_map_s {
1861 for (i = 0; i < ARRAY_SIZE(mgmt_linkcfg_map); i++) {
1862 if (ocs_strncmp(mgmt_linkcfg_map[i].mgmt_str,
1863 mgmt_str, ocs_strlen(mgmt_str)) == 0) {
1864 return mgmt_linkcfg_map[i].
linkcfg;
1881 for (i = 0; i < ARRAY_SIZE(mgmt_linkcfg_map); i++) {
1882 if (mgmt_linkcfg_map[i].linkcfg == linkcfg) {
1883 return mgmt_linkcfg_map[i].
mgmt_str;
1892 typedef struct ocs_mgmt_linkcfg_arg_s {
1910 const char *linkcfg_str = NULL;
1931 ocs_xport_t *xport = ocs->xport;
1948 ocs_xport_t *xport = ocs->xport;
1984 if (ocs_strcasecmp(value,
"default") == 0) {
1987 else if (
parse_wwn(value, &wwnn) != 0) {
1988 ocs_log_test(ocs,
"Invalid WWNN: %s\n", value);
1995 ocs_log_test(ocs,
"OCS_XPORT_WWNN_SET failed: %d\n", rc);
2017 if (ocs_strcasecmp(value,
"default") == 0) {
2020 else if (
parse_wwn(value, &wwpn) != 0) {
2021 ocs_log_test(ocs,
"Invalid WWPN: %s\n", value);
2028 ocs_log_test(ocs,
"OCS_XPORT_WWPN_SET failed: %d\n", rc);
2046 ocs->nodedb_mask = ocs_strtoul(value, 0, 0);
2066 ocs_sem_init(&cb_arg.
semaphore, 0,
"mgmt_linkcfg");
2075 ocs_log_test(ocs,
"ocs_hal_set_linkcfg failed\n");
2079 if (ocs_sem_p(&cb_arg.
semaphore, OCS_SEM_FOREVER)) {
2080 ocs_log_err(ocs,
"ocs_sem_p failed\n");
2085 ocs_log_test(ocs,
"failed to set linkcfg from HAL status=%d\n",
2116 if (ocs_strcasecmp(value,
"false") == 0) {
2119 }
else if (ocs_strcasecmp(value,
"true") == 0) {
2134 if (ocs_strcasecmp(value,
"false") == 0) {
2137 }
else if (ocs_strcasecmp(value,
"true") == 0) {
2152 if (ocs_strcasecmp(value,
"false") == 0) {
2155 }
else if (ocs_strcasecmp(value,
"true") == 0) {
2170 if (ocs_strcasecmp(value,
"false") == 0) {
2173 }
else if (ocs_strcasecmp(value,
"true") == 0) {
2187 ocs->logmask = ocs_strtoul(value, NULL, 0);
2196 loglevel = ocs_strtoul(value, NULL, 0);
2209 spd = ocs_strtoul(value, NULL, 0);
2211 ocs_log_debug(ocs,
"Taking port offline\n");
2213 if (xport_rc != 0) {
2214 ocs_log_test(ocs,
"Port offline failed\n");
2217 ocs_log_debug(ocs,
"Setting port to speed %d\n", spd);
2220 ocs_log_test(ocs,
"Speed set failed\n");
2227 ocs_log_debug(ocs,
"Bringing port online\n");
2229 if (xport_rc != 0) {
2245 topo = ocs_strtoul(value, NULL, 0);
2250 ocs_log_debug(ocs,
"Taking port offline\n");
2252 if (xport_rc != 0) {
2253 ocs_log_test(ocs,
"Port offline failed\n");
2256 ocs_log_debug(ocs,
"Setting port to topology %d\n", topo);
2259 ocs_log_test(ocs,
"Topology set failed\n");
2266 ocs_log_debug(ocs,
"Bringing port online\n");
2268 if (xport_rc != 0) {
2282 if (ocs_strcasecmp(value,
"offline") == 0) {
2283 ocs_log_debug(ocs,
"Setting port to %s\n", value);
2285 if (xport_rc != 0) {
2286 ocs_log_test(ocs,
"Setting port to offline failed\n");
2289 }
else if (ocs_strcasecmp(value,
"online") == 0) {
2290 ocs_log_debug(ocs,
"Setting port to %s\n", value);
2292 if (xport_rc != 0) {
2293 ocs_log_test(ocs,
"Setting port to online failed\n");
2297 ocs_log_test(ocs,
"Unsupported link state \"%s\"\n", value);
2304 #if defined(ENABLE_FABRIC_EMULATION)
2306 set_femul_enable(ocs_t *ocs,
char *name,
char *value)
2308 if (ocs_strtoul(value, 0, 0) != 0) {
2317 typedef struct ocs_mgmt_get_port_protocol_result {
2345 ocs_sem_init(&(result.
semaphore), 0,
"get_port_protocol");
2350 if (ocs_sem_p(&(result.
semaphore), OCS_SEM_FOREVER) != 0) {
2352 ocs_log_err(ocs,
"ocs_sem_p failed\n");
2355 if (result.
status == 0) {
2371 ocs_log_test(ocs,
"getting port profile status 0x%x\n", result.
status);
2377 typedef struct ocs_mgmt_set_port_protocol_result {
2420 ocs_sem_init(&(result.
semaphore), 0,
"set_port_protocol");
2422 if (ocs_strcasecmp(value,
"iscsi") == 0) {
2424 }
else if (ocs_strcasecmp(value,
"fc") == 0) {
2426 }
else if (ocs_strcasecmp(value,
"fcoe") == 0) {
2435 if (ocs_sem_p(&(result.
semaphore), OCS_SEM_FOREVER) != 0) {
2437 ocs_log_err(ocs,
"ocs_sem_p failed\n");
2440 if (result.
status == 0) {
2445 ocs_log_test(ocs,
"setting active profile status 0x%x\n",
2453 typedef struct ocs_mgmt_get_profile_list_result_s {
2465 result->
list = list;
2489 ocs_sem_init(&(result.
semaphore), 0,
"get_profile_list");
2492 if (ocs_sem_p(&(result.
semaphore), OCS_SEM_FOREVER) != 0) {
2494 ocs_log_err(ocs,
"ocs_sem_p failed\n");
2497 if (result.
status == 0) {
2499 #define MAX_LINE_SIZE 520
2500 #define BUFFER_SIZE MAX_LINE_SIZE*40
2503 uint32_t bytes_left;
2506 result_buf = ocs_malloc(ocs,
BUFFER_SIZE, OCS_M_ZERO);
2512 if (strlen(result_line) < bytes_left) {
2513 strcat(result_buf, result_line);
2514 bytes_left -= strlen(result_line);
2524 ocs_log_test(ocs,
"getting profile list status 0x%x\n", result.
status);
2529 typedef struct ocs_mgmt_get_active_profile_result {
2546 #define MAX_PROFILE_LENGTH 5
2568 ocs_sem_init(&(result.
semaphore), 0,
"get_active_profile");
2571 if (ocs_sem_p(&(result.
semaphore), OCS_SEM_FOREVER) != 0) {
2573 ocs_log_err(ocs,
"ocs_sem_p failed\n");
2576 if (result.
status == 0) {
2581 ocs_log_test(ocs,
"getting active profile status 0x%x\n", result.
status);
2586 typedef struct ocs_mgmt_set_active_profile_result {
2621 int32_t new_profile;
2623 new_profile = ocs_strtoul(value, NULL, 0);
2625 ocs_sem_init(&(result.
semaphore), 0,
"set_active_profile");
2629 if (ocs_sem_p(&(result.
semaphore), OCS_SEM_FOREVER) != 0) {
2631 ocs_log_err(ocs,
"ocs_sem_p failed\n");
2634 if (result.
status == 0) {
2639 ocs_log_test(ocs,
"setting active profile status 0x%x\n", result.
status);
2646 typedef struct ocs_mgmt_get_nvparms_result {
2657 uint32_t preferred_d_id,
void *ul_arg)
2662 ocs_memcpy(result->
wwpn, wwpn,
sizeof(result->
wwpn));
2663 ocs_memcpy(result->
wwnn, wwnn,
sizeof(result->
wwnn));
2684 char result_string[24];
2687 ocs_sem_init(&(result.
semaphore), 0,
"get_nv_wwpn");
2690 if (ocs_sem_p(&(result.
semaphore), OCS_SEM_FOREVER) != 0) {
2692 ocs_log_err(ocs,
"ocs_sem_p failed\n");
2695 if (result.
status == 0) {
2697 sprintf(result_string,
"%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
2703 ocs_log_test(ocs,
"getting wwpn status 0x%x\n", result.
status);
2722 char result_string[24];
2725 ocs_sem_init(&(result.
semaphore), 0,
"get_nv_wwnn");
2728 if (ocs_sem_p(&(result.
semaphore), OCS_SEM_FOREVER) != 0) {
2730 ocs_log_err(ocs,
"ocs_sem_p failed\n");
2733 if (result.
status == 0) {
2735 ocs_snprintf(result_string,
sizeof(result_string),
"%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
2741 ocs_log_test(ocs,
"getting wwnn status 0x%x\n", result.
status);
2759 uint32_t abort_counts = 0;
2760 ocs_domain_t *domain;
2788 abort_counts += node->abort_cnt;
2802 typedef struct ocs_mgmt_set_nvparms_result {
2833 uint8_t new_wwpn[8];
2834 uint8_t new_wwnn[8];
2835 char *wwpn_p = NULL;
2836 char *wwnn_p = NULL;
2845 ocs_sem_init(&(result.
semaphore), 0,
"set_nv_wwn1");
2850 if (ocs_sem_p(&(result.
semaphore), OCS_SEM_FOREVER) != 0) {
2852 ocs_log_err(ocs,
"ocs_sem_p failed\n");
2855 if (result.
status != 0) {
2856 ocs_log_test(ocs,
"getting nvparms status 0x%x\n", result.
status);
2862 if (wwn_p != NULL) {
2863 wwpn_p = ocs_strsep(&wwn_p,
"@");
2867 if (wwpn_p != NULL) {
2868 wwpn = ocs_strcmp(wwpn_p,
"NA");
2871 if (wwnn_p != NULL) {
2872 wwnn = ocs_strcmp(wwnn_p,
"NA");
2877 if (ocs_sscanf(wwpn_p,
"%2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx",
2878 &(new_wwpn[0]), &(new_wwpn[1]), &(new_wwpn[2]),
2879 &(new_wwpn[3]), &(new_wwpn[4]), &(new_wwpn[5]),
2880 &(new_wwpn[6]), &(new_wwpn[7])) != 8) {
2881 ocs_log_test(ocs,
"can't parse WWPN %s\n", wwpn_p);
2888 if (ocs_sscanf(wwnn_p,
"%2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx",
2889 &(new_wwnn[0]), &(new_wwnn[1]), &(new_wwnn[2]),
2890 &(new_wwnn[3]), &(new_wwnn[4]), &(new_wwnn[5]),
2891 &(new_wwnn[6]), &(new_wwnn[7])) != 8) {
2892 ocs_log_test(ocs,
"can't parse WWNN %s\n", wwnn_p);
2897 for (i = 0; i < 8; i++) {
2900 new_wwpn[i] = result.
wwpn[i];
2905 new_wwnn[i] = result.
wwnn[i];
2910 ocs_sem_init(&(result.
semaphore), 0,
"set_nv_wwn2");
2916 if (ocs_sem_p(&(result.
semaphore), OCS_SEM_FOREVER) != 0) {
2918 ocs_log_err(ocs,
"ocs_sem_p failed\n");
2921 if (result.
status != 0) {
2922 ocs_log_test(ocs,
"setting wwn status 0x%x\n", result.
status);
2933 ocs->tgt_rscn_delay_msec = ocs_strtoul(value, NULL, 0) * 1000;
2934 ocs_log_debug(ocs,
"mgmt set: %s %s\n", name, value);
2941 ocs->tgt_rscn_period_msec = ocs_strtoul(value, NULL, 0) * 1000;
2942 ocs_log_debug(ocs,
"mgmt set: %s %s\n", name, value);
2950 ocs_log_debug(ocs,
"mgmt set: %s %s\n", name, value);
2958 ocs_log_debug(ocs,
"mgmt set: %s %s\n", name, value);
2966 ocs_log_debug(ocs,
"mgmt set: %s %s\n", name, value);
2974 ocs_log_debug(ocs,
"mgmt set: %s %s\n", name, value);
2981 ocs->cmd_err_inject = ocs_strtoul(value, NULL, 0);
2982 ocs_log_debug(ocs,
"mgmt set: %s %s\n", name, value);
2989 ocs->delay_value_msec = ocs_strtoul(value, NULL, 0);
2991 ocs_log_debug(ocs,
"mgmt set: %s %s\n", name, value);
2999 ocs_t *ocs = hal->os;
3006 ocs_mgmt_sli4_queue_status(textbuf,
"wq", hal->wq, ARRAY_SIZE(hal->wq));
3007 ocs_mgmt_sli4_queue_status(textbuf,
"rq", hal->rq, ARRAY_SIZE(hal->rq));
3008 ocs_mgmt_sli4_queue_status(textbuf,
"mq", hal->mq, ARRAY_SIZE(hal->mq));
3009 ocs_mgmt_sli4_queue_status(textbuf,
"cq", hal->cq, ARRAY_SIZE(hal->cq));
3010 ocs_mgmt_sli4_queue_status(textbuf,
"eq", hal->eq, ARRAY_SIZE(hal->eq));
3021 for (i = 0; i < q_count; i ++, q ++) {
3023 ocs_mgmt_status_int(textbuf,
"index",
"%d", q->
index);
3024 ocs_mgmt_status_int(textbuf,
"size",
"%d", q->
size);
3025 ocs_mgmt_status_int(textbuf,
"length",
"%d", q->
length);
3026 ocs_mgmt_status_int(textbuf,
"n_posted",
"%d", q->
n_posted);
3027 ocs_mgmt_status_int(textbuf,
"id",
"%d", q->
id);
3028 ocs_mgmt_status_int(textbuf,
"type",
"%d", q->
type);
3029 ocs_mgmt_status_int(textbuf,
"limit",
"%d", q->limit);
3059 if (ocs_strchr(wwn_in,
':') == NULL) {
3060 rc = ocs_sscanf(wwn_in,
"%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx",
3061 &byte0, &byte1, &byte2, &byte3,
3062 &byte4, &byte5, &byte6, &byte7);
3064 rc = ocs_sscanf(wwn_in,
"%2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx",
3065 &byte0, &byte1, &byte2, &byte3,
3066 &byte4, &byte5, &byte6, &byte7);
3070 *wwn_out = ((uint64_t)byte0 << 56) |
3071 ((uint64_t)byte1 << 48) |
3072 ((uint64_t)byte2 << 40) |
3073 ((uint64_t)byte3 << 32) |
3074 ((uint64_t)byte4 << 24) |
3075 ((uint64_t)byte5 << 16) |
3076 ((uint64_t)byte6 << 8) |
static void get_wwpn(ocs_t *, char *, ocs_textbuf_t *)
static void get_current_speed(ocs_t *, char *, ocs_textbuf_t *)
ocs_sport_t * ocs_sport_get_instance(ocs_domain_t *domain, uint32_t index)
Return a SLI port object, given an instance index.
static int set_configured_link_state(ocs_t *, char *, char *)
#define OCS_CONFIG_LINKCFG_4X10G
linkcfg strings
static void get_node_abort_cnt(ocs_t *ocs, char *name, ocs_textbuf_t *textbuf)
Get accumulated node abort counts.
static void get_sn(ocs_t *, char *, ocs_textbuf_t *)
static int set_loglevel(ocs_t *, char *, char *)
static void get_inject_drop_data(ocs_t *ocs, char *name, ocs_textbuf_t *textbuf)
static void ocs_mgmt_sfp_cb(void *os, int32_t status, uint32_t bytes_read, uint32_t *data, void *arg)
static void get_cmd_err_inject(ocs_t *ocs, char *name, ocs_textbuf_t *textbuf)
ocs_hal_linkcfg_e linkcfg
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)
static void get_configured_link_state(ocs_t *, char *, ocs_textbuf_t *)
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 int set_inject_free_drop_cmd(ocs_t *, char *, char *)
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 int ocs_mgmt_port_migration(ocs_t *ocs, char *, void *buf, uint32_t buf_len, void *, uint32_t)
ocs_mgmt_action_func action_handler
static void get_current_link_state(ocs_t *, char *, ocs_textbuf_t *)
#define OCS_DEBUG_ENABLE_MQ_DUMP
static void get_nodedb_mask(ocs_t *, char *, ocs_textbuf_t *)
Get requested nodedb_mask config value.
int ocs_mgmt_get(ocs_t *ocs, char *name, ocs_textbuf_t *textbuf)
Return the value of a management item.
void ocs_read_temperature_lancer_cb(int32_t status, uint32_t curr_temp, uint32_t crit_temp_thr, uint32_t warn_temp_thr, uint32_t norm_temp_thr, uint32_t fan_off_thr, uint32_t fan_on_thr, void *arg)
int parse_wwn(char *wwn_in, uint64_t *wwn_out)
parse a WWN from a string into a 64-bit value
ocs_mgmt_set_func set_handler
static void get_nodes_count(ocs_t *, char *, ocs_textbuf_t *)
static int32_t ocs_list_empty(ocs_list_t *list)
Test if a list is empty.
ocs_domain_t * ocs_domain_get_instance(ocs_t *ocs, uint32_t index)
Return a pointer to the domain, given the instance index.
static void get_req_wwnn(ocs_t *, char *, ocs_textbuf_t *)
Get requested WWNN config value.
static int set_req_wwnn(ocs_t *, char *, char *)
Set requested WWNN value.
void ocs_mgmt_emit_int(ocs_textbuf_t *textbuf, int mode, const char *name, const char *fmt,...)
Generate a property with an integer value in a management XML document.
static void get_active_xri_count(ocs_t *, char *, ocs_textbuf_t *)
#define OCS_CONFIG_LINKCFG_1X40G
#define UNSUPPORTED_SFP_ERR_STATUS
uint32_t resp[OCS_DUMP_TYPE4_WKI_TAG_SAT_TEM_RESP_LEN/4]
static void get_pci_vendor(ocs_t *, char *, ocs_textbuf_t *)
static int set_configured_speed(ocs_t *, char *, char *)
static void get_driver_version(ocs_t *, char *, ocs_textbuf_t *)
static void get_logmask(ocs_t *, char *, ocs_textbuf_t *)
static void get_fw_dump_max_size(ocs_t *, char *, ocs_textbuf_t *)
char profile_description[512]
ocs_mgmt_get_func get_handler
static void get_pn(ocs_t *, char *, ocs_textbuf_t *)
static void ocs_mgmt_get_active_profile_cb(int32_t status, uint32_t active_profile, void *ul_arg)
int ocs_mgmt_set(ocs_t *ocs, char *name, char *value)
Set the value of a mgmt item.
static void ocs_mgmt_fw_write_cb(int32_t status, int32_t ext_status, uint32_t actual_write_length, uint32_t change_status, void *arg)
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.
#define SLI4_MBOX_EXT_STATUS_OBJ_UNSUPPORTED_FIRMWARE
static void get_debug_wq_dump(ocs_t *, char *, ocs_textbuf_t *)
int ocs_mgmt_exec(ocs_t *ocs, char *action, void *arg_in, uint32_t arg_in_length, void *arg_out, uint32_t arg_out_length)
Perform a management action.
#define OCS_CONFIG_LINKCFG_4X8G
#define OCS_DUMP_TYPE4_WKI_TAG_SAT_TEM_RESP_LEN
static void get_current_topology(ocs_t *, char *, ocs_textbuf_t *)
static void ocs_device_lock(ocs_t *ocs)
static void get_nv_wwpn(ocs_t *ocs, char *name, ocs_textbuf_t *textbuf)
Get wwpn.
static int set_port_protocol(ocs_t *, char *, char *)
Set port protocol.
int32_t ocs_device_detach(ocs_t *ocs)
free resources when pci device detach
void ocs_mgmt_start_unnumbered_section(ocs_textbuf_t *textbuf, const char *name)
Generate the beginning of an unnumbered section in a management XML document.
static int set_cmd_delay_value(ocs_t *, char *, char *)
ramdisc instance structure
static void get_sfp_a0(ocs_t *, char *, ocs_textbuf_t *)
ramdisc segment structure
static void get_configured_speed(ocs_t *, char *, ocs_textbuf_t *)
void ocs_mgmt_start_section(ocs_textbuf_t *textbuf, const char *name, int index)
Generate the beginning of a numbered section in a management XML document.
int const char const char void ocs_mgmt_emit_boolean(ocs_textbuf_t *textbuf, int access, const char *name, const int value)
Generate a property with a boolean value in a management XML document.
#define OCS_RESET_MODE_PORT_MIGRATION
static int set_logmask(ocs_t *, char *, char *)
static void ocs_domain_unlock(ocs_domain_t *domain)
#define SLI4_ASIC_ID_REG
ASIC_ID - SLI ASIC Type and Revision Register.
uint32_t active_profile_id
ocs_hal_port_protocol_e
Port protocols.
static int ocs_mgmt_force_assert(ocs_t *ocs, char *, void *buf, uint32_t buf_len, void *, uint32_t)
ocs_hal_profile_descriptor_t descriptors[OCS_HAL_MAX_PROFILES]
static void get_hw_rev1(ocs_t *, char *, ocs_textbuf_t *)
int32_t ocs_mgmt_get_sfp(ocs_t *ocs, uint16_t page, void *buf, uint32_t buf_len)
static int set_debug_wq_dump(ocs_t *, char *, char *)
void ocs_mgmt_get_list(ocs_t *ocs, ocs_textbuf_t *textbuf)
Get a list of options supported by the driver.
static void get_desc(ocs_t *, char *, ocs_textbuf_t *)
int32_t ocs_xport_control(ocs_xport_t *xport, ocs_xport_ctrl_e cmd,...)
Perform transport attach function.
static void get_inject_drop_cmd(ocs_t *ocs, char *name, ocs_textbuf_t *textbuf)
static int32_t ocs_domain_lock_try(ocs_domain_t *domain)
#define OCS_CONFIG_LINKCFG_UNKNOWN
static void ocs_mgmt_get_nvparms_cb(int32_t status, uint8_t *wwpn, uint8_t *wwnn, uint8_t hard_alpa, uint32_t preferred_d_id, void *ul_arg)
static void get_req_wwpn(ocs_t *, char *, ocs_textbuf_t *)
Get requested WWPN config value.
void ocs_mgmt_get_all(ocs_t *ocs, ocs_textbuf_t *textbuf)
static int ocs_mgmt_read_parity_stats(ocs_t *ocs, char *name, void *arg_in, uint32_t arg_in_length, void *arg_out, uint32_t arg_out_length)
uint32_t ocs_hal_rpi_active_count(ocs_hal_t *hal)
Called to obtain active RPI count.
#define FW_DUMP_LEVEL_NONE
static void get_port_protocol(ocs_t *, char *, ocs_textbuf_t *)
static int set_inject_drop_resp(ocs_t *, char *, char *)
static void get_fw_rev(ocs_t *, char *, ocs_textbuf_t *)
static void get_nv_wwnn(ocs_t *ocs, char *name, ocs_textbuf_t *textbuf)
Get wwnn.
static int set_tgt_rscn_period(ocs_t *, char *, char *)
ramdisc_segment_t ** segments
static void get_wwnn(ocs_t *, char *, ocs_textbuf_t *)
void ocs_mgmt_end_unnumbered_section(ocs_textbuf_t *textbuf, const char *name)
Generate the end of a section in a management XML document.
static void get_pci_device(ocs_t *, char *, ocs_textbuf_t *)
static void ocs_device_unlock(ocs_t *ocs)
static void get_phy_port_num(ocs_t *, char *, ocs_textbuf_t *)
#define MAX_PROFILE_LENGTH
ocs_hal_linkcfg_e
Link configurations.
static int set_configured_topology(ocs_t *, char *, char *)
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 void ocs_mgmt_get_port_protocol_cb(int32_t status, ocs_hal_port_protocol_e port_protocol, void *arg)
static int ocs_mgmt_firmware_write(ocs_t *ocs, char *, void *buf, uint32_t buf_len, void *, uint32_t)
ocs_hal_rtn_e ocs_hal_get(ocs_hal_t *hal, ocs_hal_property_e prop, uint32_t *value)
static void ocs_mgmt_read_parity_stats_cb(int32_t status, uint8_t num_ulp, ocs_parity_err_count_t *counter, void *arg)
static int32_t ocs_device_lock_try(ocs_t *ocs)
#define OCS_CONFIG_LINKCFG_4X1G
void ocs_mgmt_end_section(ocs_textbuf_t *textbuf, const char *name, int index)
Generate the indexed end of a section in a management XML document.
void(* exec_cb)(ocs_domain_t *, void *arg)
ocs_hal_profile_list_t * list
#define OCS_DEBUG_ENABLE_CQ_DUMP
static void get_tgt_rscn_period(ocs_t *ocs, char *name, ocs_textbuf_t *textbuf)
static ocs_mgmt_linkcfg_map_t mgmt_linkcfg_map[]
static void get_profile_list(ocs_t *, char *, ocs_textbuf_t *)
Get list of profiles.
int32_t ocs_device_attach(ocs_t *ocs)
Initialize resources when pci devices attach.
static void get_sfp_a2(ocs_t *, char *, ocs_textbuf_t *)
static void get_fw_rev2(ocs_t *, char *, ocs_textbuf_t *)
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).
static void get_hw_rev3(ocs_t *, char *, ocs_textbuf_t *)
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 get_chip_type(ocs_t *ocs, char *name, ocs_textbuf_t *textbuf)
static void get_lip_count(ocs_t *, char *, ocs_textbuf_t *)
static void get_debug_cq_dump(ocs_t *, char *, ocs_textbuf_t *)
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.
static int set_active_profile(ocs_t *, char *, char *)
Set active profile.
static void get_fw_dump_present(ocs_t *, char *, ocs_textbuf_t *)
static void get_active_profile(ocs_t *, char *, ocs_textbuf_t *)
Get active profile.
#define OCS_CONFIG_LINKCFG_2X16G
static ocs_hal_linkcfg_e ocs_hal_linkcfg_from_mgmt(const char *mgmt_str)
Get the HAL linkcfg enum from the mgmt config string.
#define OCS_CTRLMASK_ENABLE_FABRIC_EMULATION
static void ocs_mgmt_get_profile_list_cb(int32_t status, ocs_hal_profile_list_t *list, void *ul_arg)
int32_t ocs_fw_reset(ocs_t *ocs)
static int set_inject_drop_cmd(ocs_t *, char *, char *)
static int set_debug_cq_dump(ocs_t *, char *, char *)
static void ocs_mgmt_linkcfg_cb(int32_t status, uintptr_t value, void *arg)
Linkcfg callback.
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.
ocs_hal_rtn_e ocs_hal_set(ocs_hal_t *hal, ocs_hal_property_e prop, uint32_t value)
static void get_inject_drop_resp(ocs_t *ocs, char *name, ocs_textbuf_t *textbuf)
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.
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.
#define OCS_CONFIG_LINKCFG_2X10G
static void get_debug_mq_dump(ocs_t *, char *, ocs_textbuf_t *)
#define SLI4_INTF_REG
SLI_INTF - SLI Interface Definition Register.
static void get_inject_free_drop_cmd(ocs_t *ocs, char *name, ocs_textbuf_t *textbuf)
#define SLI4_PCI_CLASS_REVISION
static void get_asic_id(ocs_t *, char *, ocs_textbuf_t *)
int32_t ocs_read_temperature_lancer(ocs_t *ocs, void *buf, uint32_t buf_len)
static int32_t ocs_sport_lock_try(ocs_sport_t *sport)
static void get_businfo(ocs_t *, char *, ocs_textbuf_t *)
static void get_tgt_rscn_delay(ocs_t *ocs, char *name, ocs_textbuf_t *textbuf)
int32_t ocs_recovery_reset(ocs_t *ocs, uint32_t reset_mode, uint8_t dump_level, bool trigger_dump)
Initiate FW dump and do reset.
static void ocs_mgmt_set_active_profile_cb(int32_t status, void *ul_arg)
static int set_cmd_err_inject(ocs_t *, char *, char *)
static int set_linkcfg(ocs_t *, char *, char *)
Set linkcfg config value.
static int set_req_wwpn(ocs_t *, char *, char *)
Set requested WWNP value.
void ocs_debug_enable(uint32_t mask)
enable debug options
static int set_inject_drop_data(ocs_t *, char *, char *)
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.
ocs_hal_port_protocol_e port_protocol
static void ocs_mgmt_set_port_protocol_cb(int32_t status, void *arg)
static int set_debug_mq_dump(ocs_t *, char *, char *)
static void get_linkcfg(ocs_t *, char *, ocs_textbuf_t *)
Get linkcfg config value.
static void get_pci_subsystem_device(ocs_t *, char *, ocs_textbuf_t *)
static void get_hw_rev2(ocs_t *, char *, ocs_textbuf_t *)
static int set_tgt_rscn_delay(ocs_t *, char *, char *)
static int ocs_mgmt_function_reset(ocs_t *ocs, char *, void *buf, uint32_t buf_len, void *, uint32_t)
ocs_parity_err_count_t counter[OCS_MAX_SLI4_ULP]
static const char * ocs_mgmt_from_hal_linkcfg(ocs_hal_linkcfg_e linkcfg)
Get the mgmt string value from the HAL linkcfg enum.
int32_t ocs_get_bus_dev_func(ocs_t *ocs, uint8_t *bus, uint8_t *dev, uint8_t *func)
int ocs_debug_is_enabled(uint32_t mask)
return true if debug bits are enabled
Link configuration callback argument.
static void ocs_mgmt_set_nvparms_cb(int32_t status, void *ul_arg)
#define ocs_assert(cond,...)
static int set_nv_wwn(ocs_t *, char *, char *)
Set wwn.
static void get_debug_eq_dump(ocs_t *, char *, ocs_textbuf_t *)
static void get_loglevel(ocs_t *ocs, char *name, ocs_textbuf_t *textbuf)
static void get_active_rpi_count(ocs_t *, char *, ocs_textbuf_t *)
static int32_t ocs_device_lock_try_timeout(ocs_t *ocs, uint32_t timeout_ms, uint8_t retries)
static int set_nodedb_mask(ocs_t *, char *, char *)
Set node debug mask value.
#define FW_DUMP_STATE_NONE
void * ocs_hal_get_ptr(ocs_hal_t *hal, ocs_hal_property_e prop)
HAL link config enum to mgmt string value mapping.
int32_t ocs_xport_status(ocs_xport_t *xport, ocs_xport_status_e cmd, ocs_xport_stats_t *result)
Return status on a link.
void ocs_mgmt_emit_string(ocs_textbuf_t *textbuf, int access, const char *name, const char *value)
Generate a property with a string value in a management XML document.
void ocs_mgmt_domain_exec_cb(ocs_domain_t *domain, void *)
static void get_logical_link_speed(ocs_t *, char *, ocs_textbuf_t *)
#define ocs_list_foreach(list, item)
Iterate a linked list.
static void get_pci_subsystem_vendor(ocs_t *, char *, ocs_textbuf_t *)
static void get_sli4_intf_reg(ocs_t *, char *, ocs_textbuf_t *)
static void get_ipl(ocs_t *, char *, ocs_textbuf_t *)
#define OCS_DEBUG_ENABLE_EQ_DUMP
void * ocs_scsi_get_property_ptr(ocs_t *ocs, ocs_scsi_property_e prop)
Return a property pointer.
ocs_hal_linkcfg_e linkcfg
#define OCS_CONFIG_LINKCFG_2X10G_2X8G
static void get_cmd_delay_value(ocs_t *ocs, char *name, ocs_textbuf_t *textbuf)
static int set_debug_eq_dump(ocs_t *, char *, char *)
static void ocs_sport_unlock(ocs_sport_t *sport)
static int ocs_mgmt_firmware_reset(ocs_t *ocs, char *, void *buf, uint32_t buf_len, void *, uint32_t)
ocs_mgmt_table_entry_t mgmt_table[]
void ocs_mgmt_emit_property_name(ocs_textbuf_t *textbuf, int access, const char *name)
Generate a property, with no value, in a management XML document.
uint32_t ocs_scsi_get_property(ocs_t *ocs, ocs_scsi_property_e prop)
Return SCSI API integer valued property.
void ocs_debug_disable(uint32_t mask)
disable debug options
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.
#define OCS_DEBUG_ENABLE_WQ_DUMP
static void get_configured_topology(ocs_t *, char *, ocs_textbuf_t *)