Lines Matching +full:min +full:- +full:heartbeat +full:- +full:sec

1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright (c) 2003-2013 QLogic Corporation
39 "\t\t 0 - Export boot targets\n"
40 "\t\t 1 - Do not export boot targets (Default)");
46 "\t\t 0 - It will reset HBA (Default)\n"
47 "\t\t 1 - It will NOT reset HBA");
53 "\t\t 0 - no logging (Default)\n"
54 "\t\t 2 - debug logging");
59 " Set to enable MSI or MSI-X interrupt mechanism.\n"
61 "\t\t 1 = enable MSI-X interrupt mechanism (Default).\n"
76 "\t\t 0 - Disable.\n"
77 "\t\t 1 - Enable. (Default)");
83 "\t\t Default: 120 sec.");
96 "\t\t 0 - disable minidump\n"
97 "\t\t 1 - enable minidump (Default)");
240 .this_id = -1,
305 reg_val = readl(&ha->qla4_82xx_reg->host_status); in qla4xxx_isp_check_reg()
309 reg_val = readw(&ha->reg->ctrl_status); in qla4xxx_isp_check_reg()
331 (dst_addr->sa_family == AF_INET)) { in qla4xxx_send_ping()
333 memcpy(ipaddr, &addr->sin_addr.s_addr, IP_ADDR_LEN); in qla4xxx_send_ping()
336 &ha->ip_config.ip_address, ipaddr)); in qla4xxx_send_ping()
340 rval = -EINVAL; in qla4xxx_send_ping()
342 (dst_addr->sa_family == AF_INET6)) { in qla4xxx_send_ping()
345 memcpy(ipaddr, &addr6->sin6_addr.in6_u.u6_addr8, IPv6_ADDR_LEN); in qla4xxx_send_ping()
353 &ha->ip_config.ipv6_link_local_addr, in qla4xxx_send_ping()
361 rval = -ENOSYS; in qla4xxx_send_ping()
376 &ha->ip_config.ipv6_addr0, in qla4xxx_send_ping()
383 &ha->ip_config.ipv6_addr1, in qla4xxx_send_ping()
389 rval = -EINVAL; in qla4xxx_send_ping()
392 rval = -ENOSYS; in qla4xxx_send_ping()
623 * qla4xxx_create_chap_list - Create CHAP list from FLASH
646 chap_size = ha->hw.flt_chap_size / 2; in qla4xxx_create_chap_list()
648 chap_flash_data = dma_alloc_coherent(&ha->pdev->dev, chap_size, in qla4xxx_create_chap_list()
658 offset = FLASH_RAW_ACCESS_ADDR + (ha->hw.flt_region_chap << 2); in qla4xxx_create_chap_list()
659 if (ha->port_num == 1) in qla4xxx_create_chap_list()
667 if (ha->chap_list == NULL) in qla4xxx_create_chap_list()
668 ha->chap_list = vmalloc(chap_size); in qla4xxx_create_chap_list()
669 if (ha->chap_list == NULL) { in qla4xxx_create_chap_list()
670 ql4_printk(KERN_ERR, ha, "No memory for ha->chap_list\n"); in qla4xxx_create_chap_list()
674 memcpy(ha->chap_list, chap_flash_data, chap_size); in qla4xxx_create_chap_list()
677 dma_free_coherent(&ha->pdev->dev, chap_size, chap_flash_data, chap_dma); in qla4xxx_create_chap_list()
687 if (!ha->chap_list) { in qla4xxx_get_chap_by_index()
693 max_chap_entries = (ha->hw.flt_chap_size / 2) / in qla4xxx_get_chap_by_index()
703 *chap_entry = (struct ql4_chap_table *)ha->chap_list + chap_index; in qla4xxx_get_chap_by_index()
704 if ((*chap_entry)->cookie != in qla4xxx_get_chap_by_index()
716 * qla4xxx_find_free_chap_index - Find the first free chap index
728 int free_index = -1; in qla4xxx_find_free_chap_index()
733 max_chap_entries = (ha->hw.flt_chap_size / 2) / in qla4xxx_find_free_chap_index()
738 if (!ha->chap_list) { in qla4xxx_find_free_chap_index()
745 chap_table = (struct ql4_chap_table *)ha->chap_list + i; in qla4xxx_find_free_chap_index()
747 if ((chap_table->cookie != in qla4xxx_find_free_chap_index()
755 if (free_index != -1) { in qla4xxx_find_free_chap_index()
777 max_chap_entries = (ha->hw.flt_chap_size / 2) / in qla4xxx_get_chap_list()
786 ret = -ENOMEM; in qla4xxx_get_chap_list()
793 mutex_lock(&ha->chap_sem); in qla4xxx_get_chap_list()
795 chap_table = (struct ql4_chap_table *)ha->chap_list + i; in qla4xxx_get_chap_list()
796 if (chap_table->cookie != in qla4xxx_get_chap_list()
800 chap_rec->chap_tbl_idx = i; in qla4xxx_get_chap_list()
801 strscpy(chap_rec->username, chap_table->name, in qla4xxx_get_chap_list()
802 sizeof(chap_rec->username)); in qla4xxx_get_chap_list()
803 chap_rec->password_length = strscpy(chap_rec->password, in qla4xxx_get_chap_list()
804 chap_table->secret, in qla4xxx_get_chap_list()
805 sizeof(chap_rec->password)); in qla4xxx_get_chap_list()
807 if (chap_table->flags & BIT_7) /* local */ in qla4xxx_get_chap_list()
808 chap_rec->chap_type = CHAP_TYPE_OUT; in qla4xxx_get_chap_list()
810 if (chap_table->flags & BIT_6) /* peer */ in qla4xxx_get_chap_list()
811 chap_rec->chap_type = CHAP_TYPE_IN; in qla4xxx_get_chap_list()
819 mutex_unlock(&ha->chap_sem); in qla4xxx_get_chap_list()
840 sess = cls_session->dd_data; in __qla4xxx_is_chap_active()
841 ddb_entry = sess->dd_data; in __qla4xxx_is_chap_active()
846 if (ddb_entry->chap_tbl_idx == *chap_tbl_idx) in __qla4xxx_is_chap_active()
858 ret = device_for_each_child(&shost->shost_gendev, &chap_tbl_idx, in qla4xxx_is_chap_active()
874 chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL, &chap_dma); in qla4xxx_delete_chap()
876 return -ENOMEM; in qla4xxx_delete_chap()
879 max_chap_entries = (ha->hw.flt_chap_size / 2) / in qla4xxx_delete_chap()
885 ret = -EINVAL; in qla4xxx_delete_chap()
895 ret = -EBUSY; in qla4xxx_delete_chap()
903 offset = FLASH_RAW_ACCESS_ADDR + (ha->hw.flt_region_chap << 2); in qla4xxx_delete_chap()
907 if (ha->port_num == 1) in qla4xxx_delete_chap()
908 offset += (ha->hw.flt_chap_size / 2); in qla4xxx_delete_chap()
914 ret = -EINVAL; in qla4xxx_delete_chap()
919 __le16_to_cpu(chap_table->cookie))); in qla4xxx_delete_chap()
921 if (__le16_to_cpu(chap_table->cookie) != CHAP_VALID_COOKIE) { in qla4xxx_delete_chap()
926 chap_table->cookie = cpu_to_le16(0xFFFF); in qla4xxx_delete_chap()
932 if (ret == QLA_SUCCESS && ha->chap_list) { in qla4xxx_delete_chap()
933 mutex_lock(&ha->chap_sem); in qla4xxx_delete_chap()
935 memcpy((struct ql4_chap_table *)ha->chap_list + chap_tbl_idx, in qla4xxx_delete_chap()
937 mutex_unlock(&ha->chap_sem); in qla4xxx_delete_chap()
940 ret = -EINVAL; in qla4xxx_delete_chap()
943 dma_pool_free(ha->chap_dma_pool, chap_table, chap_dma); in qla4xxx_delete_chap()
948 * qla4xxx_set_chap_entry - Make chap entry with given information
950 * @data: chap info - credentials, index and type to make chap entry
972 rc = -EINVAL; in qla4xxx_set_chap_entry()
978 switch (param_info->param) { in qla4xxx_set_chap_entry()
980 chap_rec.chap_tbl_idx = *(uint16_t *)param_info->value; in qla4xxx_set_chap_entry()
983 chap_rec.chap_type = param_info->value[0]; in qla4xxx_set_chap_entry()
987 param_info->len); in qla4xxx_set_chap_entry()
988 memcpy(chap_rec.username, param_info->value, size); in qla4xxx_set_chap_entry()
992 param_info->len); in qla4xxx_set_chap_entry()
993 memcpy(chap_rec.password, param_info->value, size); in qla4xxx_set_chap_entry()
996 chap_rec.password_length = param_info->value[0]; in qla4xxx_set_chap_entry()
1001 rc = -ENOSYS; in qla4xxx_set_chap_entry()
1012 max_chap_entries = (ha->hw.flt_chap_size / 2) / in qla4xxx_set_chap_entry()
1017 mutex_lock(&ha->chap_sem); in qla4xxx_set_chap_entry()
1026 rc = -EINVAL; in qla4xxx_set_chap_entry()
1037 rc = -EBUSY; in qla4xxx_set_chap_entry()
1045 rc = -EBUSY; in qla4xxx_set_chap_entry()
1054 mutex_unlock(&ha->chap_sem); in qla4xxx_set_chap_entry()
1079 ret = -EINVAL; in qla4xxx_get_host_stats()
1085 ret = -ENOMEM; in qla4xxx_get_host_stats()
1091 ql_iscsi_stats = dma_alloc_coherent(&ha->pdev->dev, stats_size, in qla4xxx_get_host_stats()
1096 ret = -ENOMEM; in qla4xxx_get_host_stats()
1105 ret = -EIO; in qla4xxx_get_host_stats()
1108 host_stats->mactx_frames = le64_to_cpu(ql_iscsi_stats->mac_tx_frames); in qla4xxx_get_host_stats()
1109 host_stats->mactx_bytes = le64_to_cpu(ql_iscsi_stats->mac_tx_bytes); in qla4xxx_get_host_stats()
1110 host_stats->mactx_multicast_frames = in qla4xxx_get_host_stats()
1111 le64_to_cpu(ql_iscsi_stats->mac_tx_multicast_frames); in qla4xxx_get_host_stats()
1112 host_stats->mactx_broadcast_frames = in qla4xxx_get_host_stats()
1113 le64_to_cpu(ql_iscsi_stats->mac_tx_broadcast_frames); in qla4xxx_get_host_stats()
1114 host_stats->mactx_pause_frames = in qla4xxx_get_host_stats()
1115 le64_to_cpu(ql_iscsi_stats->mac_tx_pause_frames); in qla4xxx_get_host_stats()
1116 host_stats->mactx_control_frames = in qla4xxx_get_host_stats()
1117 le64_to_cpu(ql_iscsi_stats->mac_tx_control_frames); in qla4xxx_get_host_stats()
1118 host_stats->mactx_deferral = in qla4xxx_get_host_stats()
1119 le64_to_cpu(ql_iscsi_stats->mac_tx_deferral); in qla4xxx_get_host_stats()
1120 host_stats->mactx_excess_deferral = in qla4xxx_get_host_stats()
1121 le64_to_cpu(ql_iscsi_stats->mac_tx_excess_deferral); in qla4xxx_get_host_stats()
1122 host_stats->mactx_late_collision = in qla4xxx_get_host_stats()
1123 le64_to_cpu(ql_iscsi_stats->mac_tx_late_collision); in qla4xxx_get_host_stats()
1124 host_stats->mactx_abort = le64_to_cpu(ql_iscsi_stats->mac_tx_abort); in qla4xxx_get_host_stats()
1125 host_stats->mactx_single_collision = in qla4xxx_get_host_stats()
1126 le64_to_cpu(ql_iscsi_stats->mac_tx_single_collision); in qla4xxx_get_host_stats()
1127 host_stats->mactx_multiple_collision = in qla4xxx_get_host_stats()
1128 le64_to_cpu(ql_iscsi_stats->mac_tx_multiple_collision); in qla4xxx_get_host_stats()
1129 host_stats->mactx_collision = in qla4xxx_get_host_stats()
1130 le64_to_cpu(ql_iscsi_stats->mac_tx_collision); in qla4xxx_get_host_stats()
1131 host_stats->mactx_frames_dropped = in qla4xxx_get_host_stats()
1132 le64_to_cpu(ql_iscsi_stats->mac_tx_frames_dropped); in qla4xxx_get_host_stats()
1133 host_stats->mactx_jumbo_frames = in qla4xxx_get_host_stats()
1134 le64_to_cpu(ql_iscsi_stats->mac_tx_jumbo_frames); in qla4xxx_get_host_stats()
1135 host_stats->macrx_frames = le64_to_cpu(ql_iscsi_stats->mac_rx_frames); in qla4xxx_get_host_stats()
1136 host_stats->macrx_bytes = le64_to_cpu(ql_iscsi_stats->mac_rx_bytes); in qla4xxx_get_host_stats()
1137 host_stats->macrx_unknown_control_frames = in qla4xxx_get_host_stats()
1138 le64_to_cpu(ql_iscsi_stats->mac_rx_unknown_control_frames); in qla4xxx_get_host_stats()
1139 host_stats->macrx_pause_frames = in qla4xxx_get_host_stats()
1140 le64_to_cpu(ql_iscsi_stats->mac_rx_pause_frames); in qla4xxx_get_host_stats()
1141 host_stats->macrx_control_frames = in qla4xxx_get_host_stats()
1142 le64_to_cpu(ql_iscsi_stats->mac_rx_control_frames); in qla4xxx_get_host_stats()
1143 host_stats->macrx_dribble = in qla4xxx_get_host_stats()
1144 le64_to_cpu(ql_iscsi_stats->mac_rx_dribble); in qla4xxx_get_host_stats()
1145 host_stats->macrx_frame_length_error = in qla4xxx_get_host_stats()
1146 le64_to_cpu(ql_iscsi_stats->mac_rx_frame_length_error); in qla4xxx_get_host_stats()
1147 host_stats->macrx_jabber = le64_to_cpu(ql_iscsi_stats->mac_rx_jabber); in qla4xxx_get_host_stats()
1148 host_stats->macrx_carrier_sense_error = in qla4xxx_get_host_stats()
1149 le64_to_cpu(ql_iscsi_stats->mac_rx_carrier_sense_error); in qla4xxx_get_host_stats()
1150 host_stats->macrx_frame_discarded = in qla4xxx_get_host_stats()
1151 le64_to_cpu(ql_iscsi_stats->mac_rx_frame_discarded); in qla4xxx_get_host_stats()
1152 host_stats->macrx_frames_dropped = in qla4xxx_get_host_stats()
1153 le64_to_cpu(ql_iscsi_stats->mac_rx_frames_dropped); in qla4xxx_get_host_stats()
1154 host_stats->mac_crc_error = le64_to_cpu(ql_iscsi_stats->mac_crc_error); in qla4xxx_get_host_stats()
1155 host_stats->mac_encoding_error = in qla4xxx_get_host_stats()
1156 le64_to_cpu(ql_iscsi_stats->mac_encoding_error); in qla4xxx_get_host_stats()
1157 host_stats->macrx_length_error_large = in qla4xxx_get_host_stats()
1158 le64_to_cpu(ql_iscsi_stats->mac_rx_length_error_large); in qla4xxx_get_host_stats()
1159 host_stats->macrx_length_error_small = in qla4xxx_get_host_stats()
1160 le64_to_cpu(ql_iscsi_stats->mac_rx_length_error_small); in qla4xxx_get_host_stats()
1161 host_stats->macrx_multicast_frames = in qla4xxx_get_host_stats()
1162 le64_to_cpu(ql_iscsi_stats->mac_rx_multicast_frames); in qla4xxx_get_host_stats()
1163 host_stats->macrx_broadcast_frames = in qla4xxx_get_host_stats()
1164 le64_to_cpu(ql_iscsi_stats->mac_rx_broadcast_frames); in qla4xxx_get_host_stats()
1165 host_stats->iptx_packets = le64_to_cpu(ql_iscsi_stats->ip_tx_packets); in qla4xxx_get_host_stats()
1166 host_stats->iptx_bytes = le64_to_cpu(ql_iscsi_stats->ip_tx_bytes); in qla4xxx_get_host_stats()
1167 host_stats->iptx_fragments = in qla4xxx_get_host_stats()
1168 le64_to_cpu(ql_iscsi_stats->ip_tx_fragments); in qla4xxx_get_host_stats()
1169 host_stats->iprx_packets = le64_to_cpu(ql_iscsi_stats->ip_rx_packets); in qla4xxx_get_host_stats()
1170 host_stats->iprx_bytes = le64_to_cpu(ql_iscsi_stats->ip_rx_bytes); in qla4xxx_get_host_stats()
1171 host_stats->iprx_fragments = in qla4xxx_get_host_stats()
1172 le64_to_cpu(ql_iscsi_stats->ip_rx_fragments); in qla4xxx_get_host_stats()
1173 host_stats->ip_datagram_reassembly = in qla4xxx_get_host_stats()
1174 le64_to_cpu(ql_iscsi_stats->ip_datagram_reassembly); in qla4xxx_get_host_stats()
1175 host_stats->ip_invalid_address_error = in qla4xxx_get_host_stats()
1176 le64_to_cpu(ql_iscsi_stats->ip_invalid_address_error); in qla4xxx_get_host_stats()
1177 host_stats->ip_error_packets = in qla4xxx_get_host_stats()
1178 le64_to_cpu(ql_iscsi_stats->ip_error_packets); in qla4xxx_get_host_stats()
1179 host_stats->ip_fragrx_overlap = in qla4xxx_get_host_stats()
1180 le64_to_cpu(ql_iscsi_stats->ip_fragrx_overlap); in qla4xxx_get_host_stats()
1181 host_stats->ip_fragrx_outoforder = in qla4xxx_get_host_stats()
1182 le64_to_cpu(ql_iscsi_stats->ip_fragrx_outoforder); in qla4xxx_get_host_stats()
1183 host_stats->ip_datagram_reassembly_timeout = in qla4xxx_get_host_stats()
1184 le64_to_cpu(ql_iscsi_stats->ip_datagram_reassembly_timeout); in qla4xxx_get_host_stats()
1185 host_stats->ipv6tx_packets = in qla4xxx_get_host_stats()
1186 le64_to_cpu(ql_iscsi_stats->ipv6_tx_packets); in qla4xxx_get_host_stats()
1187 host_stats->ipv6tx_bytes = le64_to_cpu(ql_iscsi_stats->ipv6_tx_bytes); in qla4xxx_get_host_stats()
1188 host_stats->ipv6tx_fragments = in qla4xxx_get_host_stats()
1189 le64_to_cpu(ql_iscsi_stats->ipv6_tx_fragments); in qla4xxx_get_host_stats()
1190 host_stats->ipv6rx_packets = in qla4xxx_get_host_stats()
1191 le64_to_cpu(ql_iscsi_stats->ipv6_rx_packets); in qla4xxx_get_host_stats()
1192 host_stats->ipv6rx_bytes = le64_to_cpu(ql_iscsi_stats->ipv6_rx_bytes); in qla4xxx_get_host_stats()
1193 host_stats->ipv6rx_fragments = in qla4xxx_get_host_stats()
1194 le64_to_cpu(ql_iscsi_stats->ipv6_rx_fragments); in qla4xxx_get_host_stats()
1195 host_stats->ipv6_datagram_reassembly = in qla4xxx_get_host_stats()
1196 le64_to_cpu(ql_iscsi_stats->ipv6_datagram_reassembly); in qla4xxx_get_host_stats()
1197 host_stats->ipv6_invalid_address_error = in qla4xxx_get_host_stats()
1198 le64_to_cpu(ql_iscsi_stats->ipv6_invalid_address_error); in qla4xxx_get_host_stats()
1199 host_stats->ipv6_error_packets = in qla4xxx_get_host_stats()
1200 le64_to_cpu(ql_iscsi_stats->ipv6_error_packets); in qla4xxx_get_host_stats()
1201 host_stats->ipv6_fragrx_overlap = in qla4xxx_get_host_stats()
1202 le64_to_cpu(ql_iscsi_stats->ipv6_fragrx_overlap); in qla4xxx_get_host_stats()
1203 host_stats->ipv6_fragrx_outoforder = in qla4xxx_get_host_stats()
1204 le64_to_cpu(ql_iscsi_stats->ipv6_fragrx_outoforder); in qla4xxx_get_host_stats()
1205 host_stats->ipv6_datagram_reassembly_timeout = in qla4xxx_get_host_stats()
1206 le64_to_cpu(ql_iscsi_stats->ipv6_datagram_reassembly_timeout); in qla4xxx_get_host_stats()
1207 host_stats->tcptx_segments = in qla4xxx_get_host_stats()
1208 le64_to_cpu(ql_iscsi_stats->tcp_tx_segments); in qla4xxx_get_host_stats()
1209 host_stats->tcptx_bytes = le64_to_cpu(ql_iscsi_stats->tcp_tx_bytes); in qla4xxx_get_host_stats()
1210 host_stats->tcprx_segments = in qla4xxx_get_host_stats()
1211 le64_to_cpu(ql_iscsi_stats->tcp_rx_segments); in qla4xxx_get_host_stats()
1212 host_stats->tcprx_byte = le64_to_cpu(ql_iscsi_stats->tcp_rx_byte); in qla4xxx_get_host_stats()
1213 host_stats->tcp_duplicate_ack_retx = in qla4xxx_get_host_stats()
1214 le64_to_cpu(ql_iscsi_stats->tcp_duplicate_ack_retx); in qla4xxx_get_host_stats()
1215 host_stats->tcp_retx_timer_expired = in qla4xxx_get_host_stats()
1216 le64_to_cpu(ql_iscsi_stats->tcp_retx_timer_expired); in qla4xxx_get_host_stats()
1217 host_stats->tcprx_duplicate_ack = in qla4xxx_get_host_stats()
1218 le64_to_cpu(ql_iscsi_stats->tcp_rx_duplicate_ack); in qla4xxx_get_host_stats()
1219 host_stats->tcprx_pure_ackr = in qla4xxx_get_host_stats()
1220 le64_to_cpu(ql_iscsi_stats->tcp_rx_pure_ackr); in qla4xxx_get_host_stats()
1221 host_stats->tcptx_delayed_ack = in qla4xxx_get_host_stats()
1222 le64_to_cpu(ql_iscsi_stats->tcp_tx_delayed_ack); in qla4xxx_get_host_stats()
1223 host_stats->tcptx_pure_ack = in qla4xxx_get_host_stats()
1224 le64_to_cpu(ql_iscsi_stats->tcp_tx_pure_ack); in qla4xxx_get_host_stats()
1225 host_stats->tcprx_segment_error = in qla4xxx_get_host_stats()
1226 le64_to_cpu(ql_iscsi_stats->tcp_rx_segment_error); in qla4xxx_get_host_stats()
1227 host_stats->tcprx_segment_outoforder = in qla4xxx_get_host_stats()
1228 le64_to_cpu(ql_iscsi_stats->tcp_rx_segment_outoforder); in qla4xxx_get_host_stats()
1229 host_stats->tcprx_window_probe = in qla4xxx_get_host_stats()
1230 le64_to_cpu(ql_iscsi_stats->tcp_rx_window_probe); in qla4xxx_get_host_stats()
1231 host_stats->tcprx_window_update = in qla4xxx_get_host_stats()
1232 le64_to_cpu(ql_iscsi_stats->tcp_rx_window_update); in qla4xxx_get_host_stats()
1233 host_stats->tcptx_window_probe_persist = in qla4xxx_get_host_stats()
1234 le64_to_cpu(ql_iscsi_stats->tcp_tx_window_probe_persist); in qla4xxx_get_host_stats()
1235 host_stats->ecc_error_correction = in qla4xxx_get_host_stats()
1236 le64_to_cpu(ql_iscsi_stats->ecc_error_correction); in qla4xxx_get_host_stats()
1237 host_stats->iscsi_pdu_tx = le64_to_cpu(ql_iscsi_stats->iscsi_pdu_tx); in qla4xxx_get_host_stats()
1238 host_stats->iscsi_data_bytes_tx = in qla4xxx_get_host_stats()
1239 le64_to_cpu(ql_iscsi_stats->iscsi_data_bytes_tx); in qla4xxx_get_host_stats()
1240 host_stats->iscsi_pdu_rx = le64_to_cpu(ql_iscsi_stats->iscsi_pdu_rx); in qla4xxx_get_host_stats()
1241 host_stats->iscsi_data_bytes_rx = in qla4xxx_get_host_stats()
1242 le64_to_cpu(ql_iscsi_stats->iscsi_data_bytes_rx); in qla4xxx_get_host_stats()
1243 host_stats->iscsi_io_completed = in qla4xxx_get_host_stats()
1244 le64_to_cpu(ql_iscsi_stats->iscsi_io_completed); in qla4xxx_get_host_stats()
1245 host_stats->iscsi_unexpected_io_rx = in qla4xxx_get_host_stats()
1246 le64_to_cpu(ql_iscsi_stats->iscsi_unexpected_io_rx); in qla4xxx_get_host_stats()
1247 host_stats->iscsi_format_error = in qla4xxx_get_host_stats()
1248 le64_to_cpu(ql_iscsi_stats->iscsi_format_error); in qla4xxx_get_host_stats()
1249 host_stats->iscsi_hdr_digest_error = in qla4xxx_get_host_stats()
1250 le64_to_cpu(ql_iscsi_stats->iscsi_hdr_digest_error); in qla4xxx_get_host_stats()
1251 host_stats->iscsi_data_digest_error = in qla4xxx_get_host_stats()
1252 le64_to_cpu(ql_iscsi_stats->iscsi_data_digest_error); in qla4xxx_get_host_stats()
1253 host_stats->iscsi_sequence_error = in qla4xxx_get_host_stats()
1254 le64_to_cpu(ql_iscsi_stats->iscsi_sequence_error); in qla4xxx_get_host_stats()
1257 dma_free_coherent(&ha->pdev->dev, stats_size, in qla4xxx_get_host_stats()
1273 int len = -ENOSYS; in qla4xxx_get_iface_param()
1278 len = sprintf(buf, "%pI4\n", &ha->ip_config.ip_address); in qla4xxx_get_iface_param()
1282 &ha->ip_config.subnet_mask); in qla4xxx_get_iface_param()
1285 len = sprintf(buf, "%pI4\n", &ha->ip_config.gateway); in qla4xxx_get_iface_param()
1288 if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) { in qla4xxx_get_iface_param()
1289 OP_STATE(ha->ip_config.ipv4_options, in qla4xxx_get_iface_param()
1292 OP_STATE(ha->ip_config.ipv6_options, in qla4xxx_get_iface_param()
1300 (ha->ip_config.tcp_options & in qla4xxx_get_iface_param()
1305 if (iface->iface_num == 0) in qla4xxx_get_iface_param()
1307 &ha->ip_config.ipv6_addr0); in qla4xxx_get_iface_param()
1308 if (iface->iface_num == 1) in qla4xxx_get_iface_param()
1310 &ha->ip_config.ipv6_addr1); in qla4xxx_get_iface_param()
1314 &ha->ip_config.ipv6_link_local_addr); in qla4xxx_get_iface_param()
1318 &ha->ip_config.ipv6_default_router_addr); in qla4xxx_get_iface_param()
1321 pval = (ha->ip_config.ipv6_addl_options & in qla4xxx_get_iface_param()
1328 pval = (ha->ip_config.ipv6_addl_options & in qla4xxx_get_iface_param()
1335 if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) in qla4xxx_get_iface_param()
1336 ival = ha->ip_config.ipv4_vlan_tag & in qla4xxx_get_iface_param()
1339 ival = ha->ip_config.ipv6_vlan_tag & in qla4xxx_get_iface_param()
1345 if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) in qla4xxx_get_iface_param()
1346 ival = (ha->ip_config.ipv4_vlan_tag >> 13) & in qla4xxx_get_iface_param()
1349 ival = (ha->ip_config.ipv6_vlan_tag >> 13) & in qla4xxx_get_iface_param()
1355 if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) { in qla4xxx_get_iface_param()
1356 OP_STATE(ha->ip_config.ipv4_options, in qla4xxx_get_iface_param()
1359 OP_STATE(ha->ip_config.ipv6_options, in qla4xxx_get_iface_param()
1365 len = sprintf(buf, "%d\n", ha->ip_config.eth_mtu_size); in qla4xxx_get_iface_param()
1368 if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) in qla4xxx_get_iface_param()
1370 ha->ip_config.ipv4_port); in qla4xxx_get_iface_param()
1373 ha->ip_config.ipv6_port); in qla4xxx_get_iface_param()
1376 if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) { in qla4xxx_get_iface_param()
1378 ha->ip_config.ipv4_addr_state); in qla4xxx_get_iface_param()
1380 if (iface->iface_num == 0) in qla4xxx_get_iface_param()
1382 ha->ip_config.ipv6_addr0_state); in qla4xxx_get_iface_param()
1383 else if (iface->iface_num == 1) in qla4xxx_get_iface_param()
1385 ha->ip_config.ipv6_addr1_state); in qla4xxx_get_iface_param()
1392 ha->ip_config.ipv6_link_local_state); in qla4xxx_get_iface_param()
1397 ha->ip_config.ipv6_default_router_state); in qla4xxx_get_iface_param()
1401 if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) { in qla4xxx_get_iface_param()
1402 OP_STATE(~ha->ip_config.tcp_options, in qla4xxx_get_iface_param()
1405 OP_STATE(~ha->ip_config.ipv6_tcp_options, in qla4xxx_get_iface_param()
1411 if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) { in qla4xxx_get_iface_param()
1412 OP_STATE(~ha->ip_config.tcp_options, in qla4xxx_get_iface_param()
1415 OP_STATE(~ha->ip_config.ipv6_tcp_options, in qla4xxx_get_iface_param()
1421 if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) { in qla4xxx_get_iface_param()
1422 OP_STATE(~ha->ip_config.tcp_options, in qla4xxx_get_iface_param()
1425 OP_STATE(~ha->ip_config.ipv6_tcp_options, in qla4xxx_get_iface_param()
1432 if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) in qla4xxx_get_iface_param()
1434 ha->ip_config.tcp_wsf); in qla4xxx_get_iface_param()
1437 ha->ip_config.ipv6_tcp_wsf); in qla4xxx_get_iface_param()
1440 if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) in qla4xxx_get_iface_param()
1441 ival = (ha->ip_config.tcp_options & in qla4xxx_get_iface_param()
1444 ival = (ha->ip_config.ipv6_tcp_options & in qla4xxx_get_iface_param()
1450 if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) { in qla4xxx_get_iface_param()
1451 OP_STATE(ha->ip_config.tcp_options, in qla4xxx_get_iface_param()
1454 OP_STATE(ha->ip_config.ipv6_tcp_options, in qla4xxx_get_iface_param()
1460 if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) in qla4xxx_get_iface_param()
1462 ha->ip_config.ipv4_cache_id); in qla4xxx_get_iface_param()
1465 ha->ip_config.ipv6_cache_id); in qla4xxx_get_iface_param()
1468 OP_STATE(ha->ip_config.tcp_options, in qla4xxx_get_iface_param()
1474 OP_STATE(ha->ip_config.tcp_options, in qla4xxx_get_iface_param()
1480 OP_STATE(ha->ip_config.ipv4_options, in qla4xxx_get_iface_param()
1486 len = sprintf(buf, "%d\n", ha->ip_config.ipv4_tos); in qla4xxx_get_iface_param()
1489 OP_STATE(ha->ip_config.ipv4_options, in qla4xxx_get_iface_param()
1495 OP_STATE(ha->ip_config.ipv4_options, IPOPT_ALT_CID_EN, in qla4xxx_get_iface_param()
1501 pval = (ha->ip_config.ipv4_alt_cid_len) ? in qla4xxx_get_iface_param()
1502 (char *)ha->ip_config.ipv4_alt_cid : ""; in qla4xxx_get_iface_param()
1507 OP_STATE(ha->ip_config.ipv4_options, in qla4xxx_get_iface_param()
1513 OP_STATE(ha->ip_config.ipv4_options, in qla4xxx_get_iface_param()
1519 pval = (ha->ip_config.ipv4_vid_len) ? in qla4xxx_get_iface_param()
1520 (char *)ha->ip_config.ipv4_vid : ""; in qla4xxx_get_iface_param()
1525 OP_STATE(ha->ip_config.ipv4_options, in qla4xxx_get_iface_param()
1531 OP_STATE(~ha->ip_config.ipv4_options, in qla4xxx_get_iface_param()
1537 OP_STATE(ha->ip_config.ipv4_options, in qla4xxx_get_iface_param()
1543 if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) { in qla4xxx_get_iface_param()
1544 OP_STATE(ha->ip_config.ipv4_options, in qla4xxx_get_iface_param()
1547 OP_STATE(ha->ip_config.ipv6_options, in qla4xxx_get_iface_param()
1553 len = sprintf(buf, "%d\n", ha->ip_config.ipv4_ttl); in qla4xxx_get_iface_param()
1556 OP_STATE(ha->ip_config.ipv6_options, in qla4xxx_get_iface_param()
1562 OP_STATE(ha->ip_config.ipv6_addl_options, in qla4xxx_get_iface_param()
1568 len = sprintf(buf, "%u\n", ha->ip_config.ipv6_flow_lbl); in qla4xxx_get_iface_param()
1572 ha->ip_config.ipv6_traffic_class); in qla4xxx_get_iface_param()
1576 ha->ip_config.ipv6_hop_limit); in qla4xxx_get_iface_param()
1580 ha->ip_config.ipv6_nd_reach_time); in qla4xxx_get_iface_param()
1584 ha->ip_config.ipv6_nd_rexmit_timer); in qla4xxx_get_iface_param()
1588 ha->ip_config.ipv6_nd_stale_timeout); in qla4xxx_get_iface_param()
1592 ha->ip_config.ipv6_dup_addr_detect_count); in qla4xxx_get_iface_param()
1596 ha->ip_config.ipv6_gw_advrt_mtu); in qla4xxx_get_iface_param()
1599 len = -ENOSYS; in qla4xxx_get_iface_param()
1604 len = sprintf(buf, "%d\n", ha->ip_config.def_timeout); in qla4xxx_get_iface_param()
1607 OP_STATE(ha->ip_config.iscsi_options, in qla4xxx_get_iface_param()
1613 OP_STATE(ha->ip_config.iscsi_options, in qla4xxx_get_iface_param()
1619 OP_STATE(ha->ip_config.iscsi_options, in qla4xxx_get_iface_param()
1625 OP_STATE(ha->ip_config.iscsi_options, in qla4xxx_get_iface_param()
1631 OP_STATE(ha->ip_config.iscsi_options, in qla4xxx_get_iface_param()
1637 OP_STATE(ha->ip_config.iscsi_options, in qla4xxx_get_iface_param()
1644 (ha->ip_config.iscsi_options & in qla4xxx_get_iface_param()
1649 ha->ip_config.iscsi_max_pdu_size * in qla4xxx_get_iface_param()
1654 ha->ip_config.iscsi_first_burst_len * in qla4xxx_get_iface_param()
1659 ha->ip_config.iscsi_max_outstnd_r2t); in qla4xxx_get_iface_param()
1663 ha->ip_config.iscsi_max_burst_len * in qla4xxx_get_iface_param()
1667 OP_STATE(ha->ip_config.iscsi_options, in qla4xxx_get_iface_param()
1673 OP_STATE(ha->ip_config.iscsi_options, in qla4xxx_get_iface_param()
1679 OP_STATE(ha->ip_config.iscsi_options, in qla4xxx_get_iface_param()
1685 OP_STATE(ha->ip_config.iscsi_options, in qla4xxx_get_iface_param()
1691 OP_STATE(ha->ip_config.iscsi_options, in qla4xxx_get_iface_param()
1697 len = sprintf(buf, "%s\n", ha->ip_config.iscsi_name); in qla4xxx_get_iface_param()
1700 len = -ENOSYS; in qla4xxx_get_iface_param()
1719 ret = -ENXIO; in qla4xxx_ep_connect()
1727 ret = -ENOMEM; in qla4xxx_ep_connect()
1731 qla_ep = ep->dd_data; in qla4xxx_ep_connect()
1733 if (dst_addr->sa_family == AF_INET) { in qla4xxx_ep_connect()
1734 memcpy(&qla_ep->dst_addr, dst_addr, sizeof(struct sockaddr_in)); in qla4xxx_ep_connect()
1735 addr = (struct sockaddr_in *)&qla_ep->dst_addr; in qla4xxx_ep_connect()
1737 (char *)&addr->sin_addr)); in qla4xxx_ep_connect()
1738 } else if (dst_addr->sa_family == AF_INET6) { in qla4xxx_ep_connect()
1739 memcpy(&qla_ep->dst_addr, dst_addr, in qla4xxx_ep_connect()
1741 addr6 = (struct sockaddr_in6 *)&qla_ep->dst_addr; in qla4xxx_ep_connect()
1743 (char *)&addr6->sin6_addr)); in qla4xxx_ep_connect()
1749 qla_ep->host = shost; in qla4xxx_ep_connect()
1760 qla_ep = ep->dd_data; in qla4xxx_ep_poll()
1761 ha = to_qla_host(qla_ep->host); in qla4xxx_ep_poll()
1762 DEBUG2(pr_info_ratelimited("%s: host: %ld\n", __func__, ha->host_no)); in qla4xxx_ep_poll()
1764 if (adapter_up(ha) && !test_bit(AF_BUILD_DDB_LIST, &ha->flags)) in qla4xxx_ep_poll()
1775 qla_ep = ep->dd_data; in qla4xxx_ep_disconnect()
1776 ha = to_qla_host(qla_ep->host); in qla4xxx_ep_disconnect()
1778 ha->host_no)); in qla4xxx_ep_disconnect()
1786 struct qla_endpoint *qla_ep = ep->dd_data; in qla4xxx_get_ep_param()
1791 return -ENOTCONN; in qla4xxx_get_ep_param()
1793 ha = to_qla_host(qla_ep->host); in qla4xxx_get_ep_param()
1795 ha->host_no)); in qla4xxx_get_ep_param()
1800 dst_addr = (struct sockaddr *)&qla_ep->dst_addr; in qla4xxx_get_ep_param()
1802 return -ENOTCONN; in qla4xxx_get_ep_param()
1805 &qla_ep->dst_addr, param, buf); in qla4xxx_get_ep_param()
1807 return -ENOSYS; in qla4xxx_get_ep_param()
1824 sess = cls_sess->dd_data; in qla4xxx_conn_get_stats()
1825 ddb_entry = sess->dd_data; in qla4xxx_conn_get_stats()
1826 ha = ddb_entry->ha; in qla4xxx_conn_get_stats()
1829 ha->host_no)); in qla4xxx_conn_get_stats()
1832 ql_iscsi_stats = dma_alloc_coherent(&ha->pdev->dev, stats_size, in qla4xxx_conn_get_stats()
1840 ret = qla4xxx_get_mgmt_data(ha, ddb_entry->fw_ddb_index, stats_size, in qla4xxx_conn_get_stats()
1849 stats->txdata_octets = le64_to_cpu(ql_iscsi_stats->tx_data_octets); in qla4xxx_conn_get_stats()
1850 stats->rxdata_octets = le64_to_cpu(ql_iscsi_stats->rx_data_octets); in qla4xxx_conn_get_stats()
1852 stats->noptx_pdus = le32_to_cpu(ql_iscsi_stats->tx_nopout_pdus); in qla4xxx_conn_get_stats()
1853 stats->scsicmd_pdus = le32_to_cpu(ql_iscsi_stats->tx_scsi_cmd_pdus); in qla4xxx_conn_get_stats()
1854 stats->tmfcmd_pdus = le32_to_cpu(ql_iscsi_stats->tx_tmf_cmd_pdus); in qla4xxx_conn_get_stats()
1855 stats->login_pdus = le32_to_cpu(ql_iscsi_stats->tx_login_cmd_pdus); in qla4xxx_conn_get_stats()
1856 stats->text_pdus = le32_to_cpu(ql_iscsi_stats->tx_text_cmd_pdus); in qla4xxx_conn_get_stats()
1857 stats->dataout_pdus = le32_to_cpu(ql_iscsi_stats->tx_scsi_write_pdus); in qla4xxx_conn_get_stats()
1858 stats->logout_pdus = le32_to_cpu(ql_iscsi_stats->tx_logout_cmd_pdus); in qla4xxx_conn_get_stats()
1859 stats->snack_pdus = le32_to_cpu(ql_iscsi_stats->tx_snack_req_pdus); in qla4xxx_conn_get_stats()
1861 stats->noprx_pdus = le32_to_cpu(ql_iscsi_stats->rx_nopin_pdus); in qla4xxx_conn_get_stats()
1862 stats->scsirsp_pdus = le32_to_cpu(ql_iscsi_stats->rx_scsi_resp_pdus); in qla4xxx_conn_get_stats()
1863 stats->tmfrsp_pdus = le32_to_cpu(ql_iscsi_stats->rx_tmf_resp_pdus); in qla4xxx_conn_get_stats()
1864 stats->textrsp_pdus = le32_to_cpu(ql_iscsi_stats->rx_text_resp_pdus); in qla4xxx_conn_get_stats()
1865 stats->datain_pdus = le32_to_cpu(ql_iscsi_stats->rx_scsi_read_pdus); in qla4xxx_conn_get_stats()
1866 stats->logoutrsp_pdus = in qla4xxx_conn_get_stats()
1867 le32_to_cpu(ql_iscsi_stats->rx_logout_resp_pdus); in qla4xxx_conn_get_stats()
1868 stats->r2t_pdus = le32_to_cpu(ql_iscsi_stats->rx_r2t_pdus); in qla4xxx_conn_get_stats()
1869 stats->async_pdus = le32_to_cpu(ql_iscsi_stats->rx_async_pdus); in qla4xxx_conn_get_stats()
1870 stats->rjt_pdus = le32_to_cpu(ql_iscsi_stats->rx_reject_pdus); in qla4xxx_conn_get_stats()
1873 dma_free_coherent(&ha->pdev->dev, stats_size, ql_iscsi_stats, in qla4xxx_conn_get_stats()
1885 session = starget_to_session(scsi_target(sc->device)); in qla4xxx_eh_cmd_timed_out()
1887 spin_lock_irqsave(&session->lock, flags); in qla4xxx_eh_cmd_timed_out()
1888 if (session->state == ISCSI_SESSION_FAILED) in qla4xxx_eh_cmd_timed_out()
1890 spin_unlock_irqrestore(&session->lock, flags); in qla4xxx_eh_cmd_timed_out()
1898 struct iscsi_cls_host *ihost = shost->shost_data; in qla4xxx_set_port_speed()
1903 switch (ha->addl_fw_state & 0x0F00) { in qla4xxx_set_port_speed()
1917 ihost->port_speed = speed; in qla4xxx_set_port_speed()
1923 struct iscsi_cls_host *ihost = shost->shost_data; in qla4xxx_set_port_state()
1926 if (test_bit(AF_LINK_UP, &ha->flags)) in qla4xxx_set_port_state()
1929 ihost->port_state = state; in qla4xxx_set_port_state()
1940 len = sysfs_format_mac(buf, ha->my_mac, MAC_ADDR_LEN); in qla4xxx_host_get_param()
1943 len = sprintf(buf, "%pI4\n", &ha->ip_config.ip_address); in qla4xxx_host_get_param()
1946 len = sprintf(buf, "%s\n", ha->name_string); in qla4xxx_host_get_param()
1957 return -ENOSYS; in qla4xxx_host_get_param()
1965 if (ha->iface_ipv4) in qla4xxx_create_ipv4_iface()
1969 ha->iface_ipv4 = iscsi_create_iface(ha->host, in qla4xxx_create_ipv4_iface()
1972 if (!ha->iface_ipv4) in qla4xxx_create_ipv4_iface()
1979 if (!ha->iface_ipv6_0) in qla4xxx_create_ipv6_iface()
1980 /* IPv6 iface-0 */ in qla4xxx_create_ipv6_iface()
1981 ha->iface_ipv6_0 = iscsi_create_iface(ha->host, in qla4xxx_create_ipv6_iface()
1985 if (!ha->iface_ipv6_0) in qla4xxx_create_ipv6_iface()
1989 if (!ha->iface_ipv6_1) in qla4xxx_create_ipv6_iface()
1990 /* IPv6 iface-1 */ in qla4xxx_create_ipv6_iface()
1991 ha->iface_ipv6_1 = iscsi_create_iface(ha->host, in qla4xxx_create_ipv6_iface()
1995 if (!ha->iface_ipv6_1) in qla4xxx_create_ipv6_iface()
2002 if (ha->ip_config.ipv4_options & IPOPT_IPV4_PROTOCOL_ENABLE) in qla4xxx_create_ifaces()
2005 if (ha->ip_config.ipv6_options & IPV6_OPT_IPV6_PROTOCOL_ENABLE) in qla4xxx_create_ifaces()
2011 if (ha->iface_ipv4) { in qla4xxx_destroy_ipv4_iface()
2012 iscsi_destroy_iface(ha->iface_ipv4); in qla4xxx_destroy_ipv4_iface()
2013 ha->iface_ipv4 = NULL; in qla4xxx_destroy_ipv4_iface()
2019 if (ha->iface_ipv6_0) { in qla4xxx_destroy_ipv6_iface()
2020 iscsi_destroy_iface(ha->iface_ipv6_0); in qla4xxx_destroy_ipv6_iface()
2021 ha->iface_ipv6_0 = NULL; in qla4xxx_destroy_ipv6_iface()
2023 if (ha->iface_ipv6_1) { in qla4xxx_destroy_ipv6_iface()
2024 iscsi_destroy_iface(ha->iface_ipv6_1); in qla4xxx_destroy_ipv6_iface()
2025 ha->iface_ipv6_1 = NULL; in qla4xxx_destroy_ipv6_iface()
2043 switch (iface_param->param) { in qla4xxx_set_ipv6()
2045 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv6()
2047 memcpy(init_fw_cb->ipv6_addr1, iface_param->value, in qla4xxx_set_ipv6()
2048 sizeof(init_fw_cb->ipv6_addr1)); in qla4xxx_set_ipv6()
2051 memcpy(init_fw_cb->ipv6_addr0, iface_param->value, in qla4xxx_set_ipv6()
2052 sizeof(init_fw_cb->ipv6_addr0)); in qla4xxx_set_ipv6()
2055 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv6()
2057 memcpy(init_fw_cb->ipv6_if_id, &iface_param->value[8], in qla4xxx_set_ipv6()
2058 sizeof(init_fw_cb->ipv6_if_id)); in qla4xxx_set_ipv6()
2061 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv6()
2063 memcpy(init_fw_cb->ipv6_dflt_rtr_addr, iface_param->value, in qla4xxx_set_ipv6()
2064 sizeof(init_fw_cb->ipv6_dflt_rtr_addr)); in qla4xxx_set_ipv6()
2068 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv6()
2071 if (iface_param->value[0] == ISCSI_IPV6_AUTOCFG_DISABLE) in qla4xxx_set_ipv6()
2072 init_fw_cb->ipv6_addtl_opts &= in qla4xxx_set_ipv6()
2075 else if (iface_param->value[0] == ISCSI_IPV6_AUTOCFG_ND_ENABLE) in qla4xxx_set_ipv6()
2076 init_fw_cb->ipv6_addtl_opts |= in qla4xxx_set_ipv6()
2085 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv6()
2088 if (iface_param->value[0] == in qla4xxx_set_ipv6()
2090 init_fw_cb->ipv6_addtl_opts |= cpu_to_le16( in qla4xxx_set_ipv6()
2092 else if (iface_param->value[0] == in qla4xxx_set_ipv6()
2094 init_fw_cb->ipv6_addtl_opts &= cpu_to_le16( in qla4xxx_set_ipv6()
2102 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv6()
2105 if (iface_param->value[0] == ISCSI_IPV6_ROUTER_AUTOCFG_ENABLE) in qla4xxx_set_ipv6()
2106 memset(init_fw_cb->ipv6_dflt_rtr_addr, 0, in qla4xxx_set_ipv6()
2107 sizeof(init_fw_cb->ipv6_dflt_rtr_addr)); in qla4xxx_set_ipv6()
2110 if (iface_param->value[0] == ISCSI_IFACE_ENABLE) { in qla4xxx_set_ipv6()
2111 init_fw_cb->ipv6_opts |= in qla4xxx_set_ipv6()
2115 init_fw_cb->ipv6_opts &= in qla4xxx_set_ipv6()
2122 if (iface_param->len != sizeof(init_fw_cb->ipv6_vlan_tag)) in qla4xxx_set_ipv6()
2124 init_fw_cb->ipv6_vlan_tag = in qla4xxx_set_ipv6()
2125 cpu_to_be16(*(uint16_t *)iface_param->value); in qla4xxx_set_ipv6()
2128 if (iface_param->value[0] == ISCSI_VLAN_ENABLE) in qla4xxx_set_ipv6()
2129 init_fw_cb->ipv6_opts |= in qla4xxx_set_ipv6()
2132 init_fw_cb->ipv6_opts &= in qla4xxx_set_ipv6()
2136 init_fw_cb->eth_mtu_size = in qla4xxx_set_ipv6()
2137 cpu_to_le16(*(uint16_t *)iface_param->value); in qla4xxx_set_ipv6()
2141 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv6()
2144 init_fw_cb->ipv6_port = in qla4xxx_set_ipv6()
2145 cpu_to_le16(*(uint16_t *)iface_param->value); in qla4xxx_set_ipv6()
2148 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv6()
2150 if (iface_param->value[0] == ISCSI_NET_PARAM_DISABLE) in qla4xxx_set_ipv6()
2151 init_fw_cb->ipv6_tcp_opts |= in qla4xxx_set_ipv6()
2154 init_fw_cb->ipv6_tcp_opts &= in qla4xxx_set_ipv6()
2159 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv6()
2161 if (iface_param->value[0] == ISCSI_NET_PARAM_DISABLE) in qla4xxx_set_ipv6()
2162 init_fw_cb->ipv6_tcp_opts |= in qla4xxx_set_ipv6()
2165 init_fw_cb->ipv6_tcp_opts &= in qla4xxx_set_ipv6()
2169 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv6()
2171 if (iface_param->value[0] == ISCSI_NET_PARAM_DISABLE) in qla4xxx_set_ipv6()
2172 init_fw_cb->ipv6_tcp_opts |= in qla4xxx_set_ipv6()
2175 init_fw_cb->ipv6_tcp_opts &= in qla4xxx_set_ipv6()
2179 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv6()
2181 init_fw_cb->ipv6_tcp_wsf = iface_param->value[0]; in qla4xxx_set_ipv6()
2184 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv6()
2186 init_fw_cb->ipv6_tcp_opts &= in qla4xxx_set_ipv6()
2188 init_fw_cb->ipv6_tcp_opts |= in qla4xxx_set_ipv6()
2189 cpu_to_le16((iface_param->value[0] << 1) & in qla4xxx_set_ipv6()
2193 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv6()
2195 if (iface_param->value[0] == ISCSI_NET_PARAM_ENABLE) in qla4xxx_set_ipv6()
2196 init_fw_cb->ipv6_tcp_opts |= in qla4xxx_set_ipv6()
2199 init_fw_cb->ipv6_tcp_opts &= in qla4xxx_set_ipv6()
2203 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv6()
2205 if (iface_param->value[0] == ISCSI_NET_PARAM_ENABLE) in qla4xxx_set_ipv6()
2206 init_fw_cb->ipv6_opts |= in qla4xxx_set_ipv6()
2209 init_fw_cb->ipv6_opts &= in qla4xxx_set_ipv6()
2213 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv6()
2215 if (iface_param->value[0] == ISCSI_NET_PARAM_ENABLE) in qla4xxx_set_ipv6()
2216 init_fw_cb->ipv6_opts |= in qla4xxx_set_ipv6()
2219 init_fw_cb->ipv6_opts &= in qla4xxx_set_ipv6()
2223 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv6()
2225 if (iface_param->value[0] == ISCSI_NET_PARAM_ENABLE) in qla4xxx_set_ipv6()
2226 init_fw_cb->ipv6_addtl_opts |= in qla4xxx_set_ipv6()
2229 init_fw_cb->ipv6_addtl_opts &= in qla4xxx_set_ipv6()
2233 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv6()
2235 init_fw_cb->ipv6_flow_lbl = in qla4xxx_set_ipv6()
2236 cpu_to_le16(*(uint16_t *)iface_param->value); in qla4xxx_set_ipv6()
2239 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv6()
2241 init_fw_cb->ipv6_traffic_class = iface_param->value[0]; in qla4xxx_set_ipv6()
2244 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv6()
2246 init_fw_cb->ipv6_hop_limit = iface_param->value[0]; in qla4xxx_set_ipv6()
2249 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv6()
2251 init_fw_cb->ipv6_nd_reach_time = in qla4xxx_set_ipv6()
2252 cpu_to_le32(*(uint32_t *)iface_param->value); in qla4xxx_set_ipv6()
2255 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv6()
2257 init_fw_cb->ipv6_nd_rexmit_timer = in qla4xxx_set_ipv6()
2258 cpu_to_le32(*(uint32_t *)iface_param->value); in qla4xxx_set_ipv6()
2261 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv6()
2263 init_fw_cb->ipv6_nd_stale_timeout = in qla4xxx_set_ipv6()
2264 cpu_to_le32(*(uint32_t *)iface_param->value); in qla4xxx_set_ipv6()
2267 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv6()
2269 init_fw_cb->ipv6_dup_addr_detect_count = iface_param->value[0]; in qla4xxx_set_ipv6()
2272 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv6()
2274 init_fw_cb->ipv6_gw_advrt_mtu = in qla4xxx_set_ipv6()
2275 cpu_to_le32(*(uint32_t *)iface_param->value); in qla4xxx_set_ipv6()
2279 iface_param->param); in qla4xxx_set_ipv6()
2288 switch (iface_param->param) { in qla4xxx_set_ipv4()
2290 memcpy(init_fw_cb->ipv4_addr, iface_param->value, in qla4xxx_set_ipv4()
2291 sizeof(init_fw_cb->ipv4_addr)); in qla4xxx_set_ipv4()
2294 memcpy(init_fw_cb->ipv4_subnet, iface_param->value, in qla4xxx_set_ipv4()
2295 sizeof(init_fw_cb->ipv4_subnet)); in qla4xxx_set_ipv4()
2298 memcpy(init_fw_cb->ipv4_gw_addr, iface_param->value, in qla4xxx_set_ipv4()
2299 sizeof(init_fw_cb->ipv4_gw_addr)); in qla4xxx_set_ipv4()
2302 if (iface_param->value[0] == ISCSI_BOOTPROTO_DHCP) in qla4xxx_set_ipv4()
2303 init_fw_cb->ipv4_tcp_opts |= in qla4xxx_set_ipv4()
2305 else if (iface_param->value[0] == ISCSI_BOOTPROTO_STATIC) in qla4xxx_set_ipv4()
2306 init_fw_cb->ipv4_tcp_opts &= in qla4xxx_set_ipv4()
2312 if (iface_param->value[0] == ISCSI_IFACE_ENABLE) { in qla4xxx_set_ipv4()
2313 init_fw_cb->ipv4_ip_opts |= in qla4xxx_set_ipv4()
2317 init_fw_cb->ipv4_ip_opts &= in qla4xxx_set_ipv4()
2324 if (iface_param->len != sizeof(init_fw_cb->ipv4_vlan_tag)) in qla4xxx_set_ipv4()
2326 init_fw_cb->ipv4_vlan_tag = in qla4xxx_set_ipv4()
2327 cpu_to_be16(*(uint16_t *)iface_param->value); in qla4xxx_set_ipv4()
2330 if (iface_param->value[0] == ISCSI_VLAN_ENABLE) in qla4xxx_set_ipv4()
2331 init_fw_cb->ipv4_ip_opts |= in qla4xxx_set_ipv4()
2334 init_fw_cb->ipv4_ip_opts &= in qla4xxx_set_ipv4()
2338 init_fw_cb->eth_mtu_size = in qla4xxx_set_ipv4()
2339 cpu_to_le16(*(uint16_t *)iface_param->value); in qla4xxx_set_ipv4()
2342 init_fw_cb->ipv4_port = in qla4xxx_set_ipv4()
2343 cpu_to_le16(*(uint16_t *)iface_param->value); in qla4xxx_set_ipv4()
2346 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv4()
2348 if (iface_param->value[0] == ISCSI_NET_PARAM_DISABLE) in qla4xxx_set_ipv4()
2349 init_fw_cb->ipv4_tcp_opts |= in qla4xxx_set_ipv4()
2352 init_fw_cb->ipv4_tcp_opts &= in qla4xxx_set_ipv4()
2357 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv4()
2359 if (iface_param->value[0] == ISCSI_NET_PARAM_DISABLE) in qla4xxx_set_ipv4()
2360 init_fw_cb->ipv4_tcp_opts |= in qla4xxx_set_ipv4()
2363 init_fw_cb->ipv4_tcp_opts &= in qla4xxx_set_ipv4()
2367 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv4()
2369 if (iface_param->value[0] == ISCSI_NET_PARAM_DISABLE) in qla4xxx_set_ipv4()
2370 init_fw_cb->ipv4_tcp_opts |= in qla4xxx_set_ipv4()
2373 init_fw_cb->ipv4_tcp_opts &= in qla4xxx_set_ipv4()
2377 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv4()
2379 init_fw_cb->ipv4_tcp_wsf = iface_param->value[0]; in qla4xxx_set_ipv4()
2382 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv4()
2384 init_fw_cb->ipv4_tcp_opts &= cpu_to_le16(~TCPOPT_TIMER_SCALE); in qla4xxx_set_ipv4()
2385 init_fw_cb->ipv4_tcp_opts |= in qla4xxx_set_ipv4()
2386 cpu_to_le16((iface_param->value[0] << 1) & in qla4xxx_set_ipv4()
2390 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv4()
2392 if (iface_param->value[0] == ISCSI_NET_PARAM_ENABLE) in qla4xxx_set_ipv4()
2393 init_fw_cb->ipv4_tcp_opts |= in qla4xxx_set_ipv4()
2396 init_fw_cb->ipv4_tcp_opts &= in qla4xxx_set_ipv4()
2400 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv4()
2402 if (iface_param->value[0] == ISCSI_NET_PARAM_ENABLE) in qla4xxx_set_ipv4()
2403 init_fw_cb->ipv4_tcp_opts |= in qla4xxx_set_ipv4()
2406 init_fw_cb->ipv4_tcp_opts &= in qla4xxx_set_ipv4()
2410 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv4()
2412 if (iface_param->value[0] == ISCSI_NET_PARAM_ENABLE) in qla4xxx_set_ipv4()
2413 init_fw_cb->ipv4_tcp_opts |= in qla4xxx_set_ipv4()
2416 init_fw_cb->ipv4_tcp_opts &= in qla4xxx_set_ipv4()
2420 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv4()
2422 if (iface_param->value[0] == ISCSI_NET_PARAM_ENABLE) in qla4xxx_set_ipv4()
2423 init_fw_cb->ipv4_ip_opts |= in qla4xxx_set_ipv4()
2426 init_fw_cb->ipv4_ip_opts &= in qla4xxx_set_ipv4()
2430 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv4()
2432 init_fw_cb->ipv4_tos = iface_param->value[0]; in qla4xxx_set_ipv4()
2435 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv4()
2437 if (iface_param->value[0] == ISCSI_NET_PARAM_ENABLE) in qla4xxx_set_ipv4()
2438 init_fw_cb->ipv4_ip_opts |= in qla4xxx_set_ipv4()
2441 init_fw_cb->ipv4_ip_opts &= in qla4xxx_set_ipv4()
2445 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv4()
2447 if (iface_param->value[0] == ISCSI_NET_PARAM_ENABLE) in qla4xxx_set_ipv4()
2448 init_fw_cb->ipv4_ip_opts |= in qla4xxx_set_ipv4()
2451 init_fw_cb->ipv4_ip_opts &= in qla4xxx_set_ipv4()
2455 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv4()
2457 memcpy(init_fw_cb->ipv4_dhcp_alt_cid, iface_param->value, in qla4xxx_set_ipv4()
2458 (sizeof(init_fw_cb->ipv4_dhcp_alt_cid) - 1)); in qla4xxx_set_ipv4()
2459 init_fw_cb->ipv4_dhcp_alt_cid_len = in qla4xxx_set_ipv4()
2460 strlen(init_fw_cb->ipv4_dhcp_alt_cid); in qla4xxx_set_ipv4()
2463 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv4()
2465 if (iface_param->value[0] == ISCSI_NET_PARAM_ENABLE) in qla4xxx_set_ipv4()
2466 init_fw_cb->ipv4_ip_opts |= in qla4xxx_set_ipv4()
2469 init_fw_cb->ipv4_ip_opts &= in qla4xxx_set_ipv4()
2473 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv4()
2475 if (iface_param->value[0] == ISCSI_NET_PARAM_ENABLE) in qla4xxx_set_ipv4()
2476 init_fw_cb->ipv4_ip_opts |= in qla4xxx_set_ipv4()
2479 init_fw_cb->ipv4_ip_opts &= in qla4xxx_set_ipv4()
2483 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv4()
2485 memcpy(init_fw_cb->ipv4_dhcp_vid, iface_param->value, in qla4xxx_set_ipv4()
2486 (sizeof(init_fw_cb->ipv4_dhcp_vid) - 1)); in qla4xxx_set_ipv4()
2487 init_fw_cb->ipv4_dhcp_vid_len = in qla4xxx_set_ipv4()
2488 strlen(init_fw_cb->ipv4_dhcp_vid); in qla4xxx_set_ipv4()
2491 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv4()
2493 if (iface_param->value[0] == ISCSI_NET_PARAM_ENABLE) in qla4xxx_set_ipv4()
2494 init_fw_cb->ipv4_ip_opts |= in qla4xxx_set_ipv4()
2497 init_fw_cb->ipv4_ip_opts &= in qla4xxx_set_ipv4()
2501 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv4()
2503 if (iface_param->value[0] == ISCSI_NET_PARAM_DISABLE) in qla4xxx_set_ipv4()
2504 init_fw_cb->ipv4_ip_opts |= in qla4xxx_set_ipv4()
2507 init_fw_cb->ipv4_ip_opts &= in qla4xxx_set_ipv4()
2511 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv4()
2513 if (iface_param->value[0] == ISCSI_NET_PARAM_ENABLE) in qla4xxx_set_ipv4()
2514 init_fw_cb->ipv4_ip_opts |= in qla4xxx_set_ipv4()
2517 init_fw_cb->ipv4_ip_opts &= in qla4xxx_set_ipv4()
2521 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv4()
2523 if (iface_param->value[0] == ISCSI_NET_PARAM_ENABLE) in qla4xxx_set_ipv4()
2524 init_fw_cb->ipv4_ip_opts |= in qla4xxx_set_ipv4()
2527 init_fw_cb->ipv4_ip_opts &= in qla4xxx_set_ipv4()
2531 if (iface_param->iface_num & 0x1) in qla4xxx_set_ipv4()
2533 init_fw_cb->ipv4_ttl = iface_param->value[0]; in qla4xxx_set_ipv4()
2537 iface_param->param); in qla4xxx_set_ipv4()
2546 switch (iface_param->param) { in qla4xxx_set_iscsi_param()
2548 if (iface_param->iface_num & 0x1) in qla4xxx_set_iscsi_param()
2550 init_fw_cb->def_timeout = in qla4xxx_set_iscsi_param()
2551 cpu_to_le16(*(uint16_t *)iface_param->value); in qla4xxx_set_iscsi_param()
2554 if (iface_param->iface_num & 0x1) in qla4xxx_set_iscsi_param()
2556 if (iface_param->value[0] == ISCSI_NET_PARAM_ENABLE) in qla4xxx_set_iscsi_param()
2557 init_fw_cb->iscsi_opts |= in qla4xxx_set_iscsi_param()
2560 init_fw_cb->iscsi_opts &= in qla4xxx_set_iscsi_param()
2564 if (iface_param->iface_num & 0x1) in qla4xxx_set_iscsi_param()
2566 if (iface_param->value[0] == ISCSI_NET_PARAM_ENABLE) in qla4xxx_set_iscsi_param()
2567 init_fw_cb->iscsi_opts |= in qla4xxx_set_iscsi_param()
2570 init_fw_cb->iscsi_opts &= in qla4xxx_set_iscsi_param()
2574 if (iface_param->iface_num & 0x1) in qla4xxx_set_iscsi_param()
2576 if (iface_param->value[0] == ISCSI_NET_PARAM_ENABLE) in qla4xxx_set_iscsi_param()
2577 init_fw_cb->iscsi_opts |= in qla4xxx_set_iscsi_param()
2580 init_fw_cb->iscsi_opts &= in qla4xxx_set_iscsi_param()
2584 if (iface_param->iface_num & 0x1) in qla4xxx_set_iscsi_param()
2586 if (iface_param->value[0] == ISCSI_NET_PARAM_ENABLE) in qla4xxx_set_iscsi_param()
2587 init_fw_cb->iscsi_opts |= in qla4xxx_set_iscsi_param()
2590 init_fw_cb->iscsi_opts &= in qla4xxx_set_iscsi_param()
2594 if (iface_param->iface_num & 0x1) in qla4xxx_set_iscsi_param()
2596 if (iface_param->value[0] == ISCSI_NET_PARAM_ENABLE) in qla4xxx_set_iscsi_param()
2597 init_fw_cb->iscsi_opts |= in qla4xxx_set_iscsi_param()
2600 init_fw_cb->iscsi_opts &= in qla4xxx_set_iscsi_param()
2604 if (iface_param->iface_num & 0x1) in qla4xxx_set_iscsi_param()
2606 if (iface_param->value[0] == ISCSI_NET_PARAM_ENABLE) in qla4xxx_set_iscsi_param()
2607 init_fw_cb->iscsi_opts |= in qla4xxx_set_iscsi_param()
2610 init_fw_cb->iscsi_opts &= in qla4xxx_set_iscsi_param()
2614 if (iface_param->iface_num & 0x1) in qla4xxx_set_iscsi_param()
2616 init_fw_cb->iscsi_opts &= cpu_to_le16(~ISCSIOPTS_ERL); in qla4xxx_set_iscsi_param()
2617 init_fw_cb->iscsi_opts |= cpu_to_le16(iface_param->value[0] & in qla4xxx_set_iscsi_param()
2621 if (iface_param->iface_num & 0x1) in qla4xxx_set_iscsi_param()
2623 init_fw_cb->iscsi_max_pdu_size = in qla4xxx_set_iscsi_param()
2624 cpu_to_le32(*(uint32_t *)iface_param->value) / in qla4xxx_set_iscsi_param()
2628 if (iface_param->iface_num & 0x1) in qla4xxx_set_iscsi_param()
2630 init_fw_cb->iscsi_fburst_len = in qla4xxx_set_iscsi_param()
2631 cpu_to_le32(*(uint32_t *)iface_param->value) / in qla4xxx_set_iscsi_param()
2635 if (iface_param->iface_num & 0x1) in qla4xxx_set_iscsi_param()
2637 init_fw_cb->iscsi_max_outstnd_r2t = in qla4xxx_set_iscsi_param()
2638 cpu_to_le16(*(uint16_t *)iface_param->value); in qla4xxx_set_iscsi_param()
2641 if (iface_param->iface_num & 0x1) in qla4xxx_set_iscsi_param()
2643 init_fw_cb->iscsi_max_burst_len = in qla4xxx_set_iscsi_param()
2644 cpu_to_le32(*(uint32_t *)iface_param->value) / in qla4xxx_set_iscsi_param()
2648 if (iface_param->iface_num & 0x1) in qla4xxx_set_iscsi_param()
2650 if (iface_param->value[0] == ISCSI_NET_PARAM_ENABLE) in qla4xxx_set_iscsi_param()
2651 init_fw_cb->iscsi_opts |= in qla4xxx_set_iscsi_param()
2654 init_fw_cb->iscsi_opts &= in qla4xxx_set_iscsi_param()
2658 if (iface_param->iface_num & 0x1) in qla4xxx_set_iscsi_param()
2660 if (iface_param->value[0] == ISCSI_NET_PARAM_ENABLE) in qla4xxx_set_iscsi_param()
2661 init_fw_cb->iscsi_opts |= in qla4xxx_set_iscsi_param()
2664 init_fw_cb->iscsi_opts &= in qla4xxx_set_iscsi_param()
2668 if (iface_param->iface_num & 0x1) in qla4xxx_set_iscsi_param()
2670 if (iface_param->value[0] == ISCSI_NET_PARAM_ENABLE) in qla4xxx_set_iscsi_param()
2671 init_fw_cb->iscsi_opts |= in qla4xxx_set_iscsi_param()
2674 init_fw_cb->iscsi_opts &= in qla4xxx_set_iscsi_param()
2678 if (iface_param->iface_num & 0x1) in qla4xxx_set_iscsi_param()
2680 if (iface_param->value[0] == ISCSI_NET_PARAM_ENABLE) in qla4xxx_set_iscsi_param()
2681 init_fw_cb->iscsi_opts |= in qla4xxx_set_iscsi_param()
2684 init_fw_cb->iscsi_opts &= in qla4xxx_set_iscsi_param()
2688 if (iface_param->iface_num & 0x1) in qla4xxx_set_iscsi_param()
2690 if (iface_param->value[0] == ISCSI_NET_PARAM_ENABLE) in qla4xxx_set_iscsi_param()
2691 init_fw_cb->iscsi_opts |= in qla4xxx_set_iscsi_param()
2694 init_fw_cb->iscsi_opts &= in qla4xxx_set_iscsi_param()
2699 iface_param->param); in qla4xxx_set_iscsi_param()
2709 memset(acb->reserved1, 0, sizeof(acb->reserved1)); in qla4xxx_initcb_to_acb()
2710 memset(acb->reserved2, 0, sizeof(acb->reserved2)); in qla4xxx_initcb_to_acb()
2711 memset(acb->reserved3, 0, sizeof(acb->reserved3)); in qla4xxx_initcb_to_acb()
2712 memset(acb->reserved4, 0, sizeof(acb->reserved4)); in qla4xxx_initcb_to_acb()
2713 memset(acb->reserved5, 0, sizeof(acb->reserved5)); in qla4xxx_initcb_to_acb()
2714 memset(acb->reserved6, 0, sizeof(acb->reserved6)); in qla4xxx_initcb_to_acb()
2715 memset(acb->reserved7, 0, sizeof(acb->reserved7)); in qla4xxx_initcb_to_acb()
2716 memset(acb->reserved8, 0, sizeof(acb->reserved8)); in qla4xxx_initcb_to_acb()
2717 memset(acb->reserved9, 0, sizeof(acb->reserved9)); in qla4xxx_initcb_to_acb()
2718 memset(acb->reserved10, 0, sizeof(acb->reserved10)); in qla4xxx_initcb_to_acb()
2719 memset(acb->reserved11, 0, sizeof(acb->reserved11)); in qla4xxx_initcb_to_acb()
2720 memset(acb->reserved12, 0, sizeof(acb->reserved12)); in qla4xxx_initcb_to_acb()
2721 memset(acb->reserved13, 0, sizeof(acb->reserved13)); in qla4xxx_initcb_to_acb()
2722 memset(acb->reserved14, 0, sizeof(acb->reserved14)); in qla4xxx_initcb_to_acb()
2723 memset(acb->reserved15, 0, sizeof(acb->reserved15)); in qla4xxx_initcb_to_acb()
2739 init_fw_cb = dma_alloc_coherent(&ha->pdev->dev, in qla4xxx_iface_set_param()
2745 return -ENOMEM; in qla4xxx_iface_set_param()
2753 rval = -EIO; in qla4xxx_iface_set_param()
2759 rval = -EINVAL; in qla4xxx_iface_set_param()
2765 if (iface_param->param_type == ISCSI_NET_PARAM) { in qla4xxx_iface_set_param()
2766 switch (iface_param->iface_type) { in qla4xxx_iface_set_param()
2768 switch (iface_param->iface_num) { in qla4xxx_iface_set_param()
2777 iface_param->iface_num); in qla4xxx_iface_set_param()
2782 switch (iface_param->iface_num) { in qla4xxx_iface_set_param()
2792 iface_param->iface_num); in qla4xxx_iface_set_param()
2801 } else if (iface_param->param_type == ISCSI_IFACE_PARAM) { in qla4xxx_iface_set_param()
2809 init_fw_cb->cookie = cpu_to_le32(0x11BEAD5A); in qla4xxx_iface_set_param()
2817 rval = -EIO; in qla4xxx_iface_set_param()
2825 rval = -EIO; in qla4xxx_iface_set_param()
2829 wait_for_completion_timeout(&ha->disable_acb_comp, in qla4xxx_iface_set_param()
2838 rval = -EIO; in qla4xxx_iface_set_param()
2847 dma_free_coherent(&ha->pdev->dev, sizeof(struct addr_ctrl_blk), in qla4xxx_iface_set_param()
2856 struct iscsi_session *sess = cls_sess->dd_data; in qla4xxx_session_get_param()
2857 struct ddb_entry *ddb_entry = sess->dd_data; in qla4xxx_session_get_param()
2858 struct scsi_qla_host *ha = ddb_entry->ha; in qla4xxx_session_get_param()
2859 struct iscsi_cls_conn *cls_conn = ddb_entry->conn; in qla4xxx_session_get_param()
2867 rval = qla4xxx_get_chap_index(ha, sess->username_in, in qla4xxx_session_get_param()
2868 sess->password_in, BIDI_CHAP, in qla4xxx_session_get_param()
2876 if (ddb_entry->ddb_type == FLASH_DDB) { in qla4xxx_session_get_param()
2877 if (ddb_entry->chap_tbl_idx != INVALID_ENTRY) { in qla4xxx_session_get_param()
2878 idx = ddb_entry->chap_tbl_idx; in qla4xxx_session_get_param()
2884 rval = qla4xxx_get_chap_index(ha, sess->username, in qla4xxx_session_get_param()
2885 sess->password, in qla4xxx_session_get_param()
2899 if (ddb_entry->ddb_type == FLASH_DDB && in qla4xxx_session_get_param()
2900 ddb_entry->chap_tbl_idx != INVALID_ENTRY && in qla4xxx_session_get_param()
2901 !sess->username && !sess->password) { in qla4xxx_session_get_param()
2902 idx = ddb_entry->chap_tbl_idx; in qla4xxx_session_get_param()
2930 conn = cls_conn->dd_data; in qla4xxx_conn_get_param()
2931 qla_conn = conn->dd_data; in qla4xxx_conn_get_param()
2932 dst_addr = (struct sockaddr *)&qla_conn->qla_ep->dst_addr; in qla4xxx_conn_get_param()
2951 tmp_ddb_index = find_first_zero_bit(ha->ddb_idx_map, MAX_DDB_ENTRIES); in qla4xxx_get_ddb_index()
2960 if (test_and_set_bit(tmp_ddb_index, ha->ddb_idx_map)) in qla4xxx_get_ddb_index()
2992 if (ddb_entry->fw_ddb_entry.options & DDB_OPT_IPV6_DEVICE) { in qla4xxx_match_ipaddress()
3026 sess = cls_sess->dd_data; in qla4xxx_match_fwdb_session()
3027 conn = cls_conn->dd_data; in qla4xxx_match_fwdb_session()
3029 if (sess->targetname == NULL || in qla4xxx_match_fwdb_session()
3030 conn->persistent_address == NULL || in qla4xxx_match_fwdb_session()
3031 conn->persistent_port == 0) in qla4xxx_match_fwdb_session()
3042 if (ddb_entry->ddb_type != FLASH_DDB) in qla4xxx_match_fwdb_session()
3045 existing_sess = ddb_entry->sess->dd_data; in qla4xxx_match_fwdb_session()
3046 existing_conn = ddb_entry->conn->dd_data; in qla4xxx_match_fwdb_session()
3048 if (existing_sess->targetname == NULL || in qla4xxx_match_fwdb_session()
3049 existing_conn->persistent_address == NULL || in qla4xxx_match_fwdb_session()
3050 existing_conn->persistent_port == 0) in qla4xxx_match_fwdb_session()
3055 existing_sess->targetname, in qla4xxx_match_fwdb_session()
3056 sess->targetname)); in qla4xxx_match_fwdb_session()
3060 existing_conn->persistent_address, in qla4xxx_match_fwdb_session()
3061 conn->persistent_address)); in qla4xxx_match_fwdb_session()
3065 existing_conn->persistent_port, in qla4xxx_match_fwdb_session()
3066 conn->persistent_port)); in qla4xxx_match_fwdb_session()
3068 if (strcmp(existing_sess->targetname, sess->targetname)) in qla4xxx_match_fwdb_session()
3071 existing_conn->persistent_address, in qla4xxx_match_fwdb_session()
3072 conn->persistent_address); in qla4xxx_match_fwdb_session()
3075 if (existing_conn->persistent_port != conn->persistent_port) in qla4xxx_match_fwdb_session()
3106 qla_ep = ep->dd_data; in qla4xxx_session_create()
3107 ha = to_qla_host(qla_ep->host); in qla4xxx_session_create()
3109 ha->host_no)); in qla4xxx_session_create()
3115 cls_sess = iscsi_session_setup(&qla4xxx_iscsi_transport, qla_ep->host, in qla4xxx_session_create()
3122 sess = cls_sess->dd_data; in qla4xxx_session_create()
3123 ddb_entry = sess->dd_data; in qla4xxx_session_create()
3124 ddb_entry->fw_ddb_index = ddb_index; in qla4xxx_session_create()
3125 ddb_entry->fw_ddb_device_state = DDB_DS_NO_CONNECTION_ACTIVE; in qla4xxx_session_create()
3126 ddb_entry->ha = ha; in qla4xxx_session_create()
3127 ddb_entry->sess = cls_sess; in qla4xxx_session_create()
3128 ddb_entry->unblock_sess = qla4xxx_unblock_ddb; in qla4xxx_session_create()
3129 ddb_entry->ddb_change = qla4xxx_ddb_change; in qla4xxx_session_create()
3130 clear_bit(DDB_CONN_CLOSE_FAILURE, &ddb_entry->flags); in qla4xxx_session_create()
3131 cls_sess->recovery_tmo = ql4xsess_recovery_tmo; in qla4xxx_session_create()
3132 ha->fw_ddb_index_map[ddb_entry->fw_ddb_index] = ddb_entry; in qla4xxx_session_create()
3133 ha->tot_ddbs++; in qla4xxx_session_create()
3149 sess = cls_sess->dd_data; in qla4xxx_session_destroy()
3150 ddb_entry = sess->dd_data; in qla4xxx_session_destroy()
3151 ha = ddb_entry->ha; in qla4xxx_session_destroy()
3153 ha->host_no)); in qla4xxx_session_destroy()
3155 fw_ddb_entry = dma_alloc_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), in qla4xxx_session_destroy()
3165 ret = qla4xxx_get_fwddb_entry(ha, ddb_entry->fw_ddb_index, in qla4xxx_session_destroy()
3180 qla4xxx_clear_ddb_entry(ha, ddb_entry->fw_ddb_index); in qla4xxx_session_destroy()
3181 if (test_and_clear_bit(DDB_CONN_CLOSE_FAILURE, &ddb_entry->flags)) in qla4xxx_session_destroy()
3182 clear_bit(ddb_entry->fw_ddb_index, ha->ddb_idx_map); in qla4xxx_session_destroy()
3183 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_session_destroy()
3185 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_session_destroy()
3190 dma_free_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), in qla4xxx_session_destroy()
3210 sess = cls_sess->dd_data; in qla4xxx_conn_create()
3211 ddb_entry = sess->dd_data; in qla4xxx_conn_create()
3212 ddb_entry->conn = cls_conn; in qla4xxx_conn_create()
3214 ha = ddb_entry->ha; in qla4xxx_conn_create()
3231 sess = cls_session->dd_data; in qla4xxx_conn_bind()
3232 ddb_entry = sess->dd_data; in qla4xxx_conn_bind()
3233 ha = ddb_entry->ha; in qla4xxx_conn_bind()
3236 cls_session->sid, cls_conn->cid)); in qla4xxx_conn_bind()
3239 return -EINVAL; in qla4xxx_conn_bind()
3242 return -EINVAL; in qla4xxx_conn_bind()
3243 conn = cls_conn->dd_data; in qla4xxx_conn_bind()
3244 qla_conn = conn->dd_data; in qla4xxx_conn_bind()
3245 qla_conn->qla_ep = ep->dd_data; in qla4xxx_conn_bind()
3262 sess = cls_sess->dd_data; in qla4xxx_conn_start()
3263 ddb_entry = sess->dd_data; in qla4xxx_conn_start()
3264 ha = ddb_entry->ha; in qla4xxx_conn_start()
3266 cls_sess->sid, cls_conn->cid)); in qla4xxx_conn_start()
3276 ret = -EEXIST; in qla4xxx_conn_start()
3280 fw_ddb_entry = dma_alloc_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), in qla4xxx_conn_start()
3285 ret = -ENOMEM; in qla4xxx_conn_start()
3297 if (ddb_entry->fw_ddb_device_state == in qla4xxx_conn_start()
3299 ddb_entry->unblock_sess(ddb_entry->sess); in qla4xxx_conn_start()
3304 __func__, ddb_entry->fw_ddb_index); in qla4xxx_conn_start()
3308 status = qla4xxx_conn_open(ha, ddb_entry->fw_ddb_index); in qla4xxx_conn_start()
3311 sess->targetname); in qla4xxx_conn_start()
3312 ret = -EINVAL; in qla4xxx_conn_start()
3316 if (ddb_entry->fw_ddb_device_state == DDB_DS_NO_CONNECTION_ACTIVE) in qla4xxx_conn_start()
3317 ddb_entry->fw_ddb_device_state = DDB_DS_LOGIN_IN_PROCESS; in qla4xxx_conn_start()
3320 ddb_entry->fw_ddb_device_state)); in qla4xxx_conn_start()
3327 dma_free_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), in qla4xxx_conn_start()
3340 sess = cls_sess->dd_data; in qla4xxx_conn_destroy()
3341 ddb_entry = sess->dd_data; in qla4xxx_conn_destroy()
3342 ha = ddb_entry->ha; in qla4xxx_conn_destroy()
3344 cls_conn->cid)); in qla4xxx_conn_destroy()
3365 ha = task_data->ha; in qla4xxx_task_work()
3366 task = task_data->task; in qla4xxx_task_work()
3367 sts = &task_data->sts; in qla4xxx_task_work()
3373 DEBUG3(qla4xxx_dump_buffer(task_data->resp_buffer, 64)); in qla4xxx_task_work()
3375 conn = task->conn; in qla4xxx_task_work()
3377 switch (sts->completionStatus) { in qla4xxx_task_work()
3379 hdr = (struct iscsi_hdr *)task_data->resp_buffer; in qla4xxx_task_work()
3381 itt = sts->handle; in qla4xxx_task_work()
3382 hdr->itt = itt; in qla4xxx_task_work()
3383 data = task_data->resp_buffer + hdr_len; in qla4xxx_task_work()
3384 data_len = task_data->resp_len - hdr_len; in qla4xxx_task_work()
3389 sts->completionStatus); in qla4xxx_task_work()
3403 sess = task->conn->session; in qla4xxx_alloc_pdu()
3404 ddb_entry = sess->dd_data; in qla4xxx_alloc_pdu()
3405 ha = ddb_entry->ha; in qla4xxx_alloc_pdu()
3406 task_data = task->dd_data; in qla4xxx_alloc_pdu()
3409 if (task->sc) { in qla4xxx_alloc_pdu()
3412 return -EINVAL; in qla4xxx_alloc_pdu()
3416 task_data->ha = ha; in qla4xxx_alloc_pdu()
3417 task_data->task = task; in qla4xxx_alloc_pdu()
3419 if (task->data_count) { in qla4xxx_alloc_pdu()
3420 task_data->data_dma = dma_map_single(&ha->pdev->dev, task->data, in qla4xxx_alloc_pdu()
3421 task->data_count, in qla4xxx_alloc_pdu()
3423 if (dma_mapping_error(&ha->pdev->dev, task_data->data_dma)) in qla4xxx_alloc_pdu()
3424 return -ENOMEM; in qla4xxx_alloc_pdu()
3428 __func__, task->conn->max_recv_dlength, hdr_len)); in qla4xxx_alloc_pdu()
3430 task_data->resp_len = task->conn->max_recv_dlength + hdr_len; in qla4xxx_alloc_pdu()
3431 task_data->resp_buffer = dma_alloc_coherent(&ha->pdev->dev, in qla4xxx_alloc_pdu()
3432 task_data->resp_len, in qla4xxx_alloc_pdu()
3433 &task_data->resp_dma, in qla4xxx_alloc_pdu()
3435 if (!task_data->resp_buffer) in qla4xxx_alloc_pdu()
3438 task_data->req_len = task->data_count + hdr_len; in qla4xxx_alloc_pdu()
3439 task_data->req_buffer = dma_alloc_coherent(&ha->pdev->dev, in qla4xxx_alloc_pdu()
3440 task_data->req_len, in qla4xxx_alloc_pdu()
3441 &task_data->req_dma, in qla4xxx_alloc_pdu()
3443 if (!task_data->req_buffer) in qla4xxx_alloc_pdu()
3446 task->hdr = task_data->req_buffer; in qla4xxx_alloc_pdu()
3448 INIT_WORK(&task_data->task_work, qla4xxx_task_work); in qla4xxx_alloc_pdu()
3453 if (task_data->resp_buffer) in qla4xxx_alloc_pdu()
3454 dma_free_coherent(&ha->pdev->dev, task_data->resp_len, in qla4xxx_alloc_pdu()
3455 task_data->resp_buffer, task_data->resp_dma); in qla4xxx_alloc_pdu()
3457 if (task_data->req_buffer) in qla4xxx_alloc_pdu()
3458 dma_free_coherent(&ha->pdev->dev, task_data->req_len, in qla4xxx_alloc_pdu()
3459 task_data->req_buffer, task_data->req_dma); in qla4xxx_alloc_pdu()
3460 return -ENOMEM; in qla4xxx_alloc_pdu()
3472 sess = task->conn->session; in qla4xxx_task_cleanup()
3473 ddb_entry = sess->dd_data; in qla4xxx_task_cleanup()
3474 ha = ddb_entry->ha; in qla4xxx_task_cleanup()
3475 task_data = task->dd_data; in qla4xxx_task_cleanup()
3477 if (task->data_count) { in qla4xxx_task_cleanup()
3478 dma_unmap_single(&ha->pdev->dev, task_data->data_dma, in qla4xxx_task_cleanup()
3479 task->data_count, DMA_TO_DEVICE); in qla4xxx_task_cleanup()
3483 __func__, task->conn->max_recv_dlength, hdr_len)); in qla4xxx_task_cleanup()
3485 dma_free_coherent(&ha->pdev->dev, task_data->resp_len, in qla4xxx_task_cleanup()
3486 task_data->resp_buffer, task_data->resp_dma); in qla4xxx_task_cleanup()
3487 dma_free_coherent(&ha->pdev->dev, task_data->req_len, in qla4xxx_task_cleanup()
3488 task_data->req_buffer, task_data->req_dma); in qla4xxx_task_cleanup()
3494 struct scsi_cmnd *sc = task->sc; in qla4xxx_task_xmit()
3495 struct iscsi_session *sess = task->conn->session; in qla4xxx_task_xmit()
3496 struct ddb_entry *ddb_entry = sess->dd_data; in qla4xxx_task_xmit()
3497 struct scsi_qla_host *ha = ddb_entry->ha; in qla4xxx_task_xmit()
3504 return -ENOSYS; in qla4xxx_task_xmit()
3514 options = le16_to_cpu(fw_ddb_entry->options); in qla4xxx_copy_from_fwddb_param()
3515 conn->is_fw_assigned_ipv6 = test_bit(OPT_IS_FW_ASSIGNED_IPV6, &options); in qla4xxx_copy_from_fwddb_param()
3517 rc = iscsi_switch_str_param(&sess->portal_type, in qla4xxx_copy_from_fwddb_param()
3522 rc = iscsi_switch_str_param(&sess->portal_type, in qla4xxx_copy_from_fwddb_param()
3528 sess->auto_snd_tgt_disable = test_bit(OPT_AUTO_SENDTGTS_DISABLE, in qla4xxx_copy_from_fwddb_param()
3530 sess->discovery_sess = test_bit(OPT_DISC_SESSION, &options); in qla4xxx_copy_from_fwddb_param()
3531 sess->entry_state = test_bit(OPT_ENTRY_STATE, &options); in qla4xxx_copy_from_fwddb_param()
3533 options = le16_to_cpu(fw_ddb_entry->iscsi_options); in qla4xxx_copy_from_fwddb_param()
3534 conn->hdrdgst_en = test_bit(ISCSIOPT_HEADER_DIGEST_EN, &options); in qla4xxx_copy_from_fwddb_param()
3535 conn->datadgst_en = test_bit(ISCSIOPT_DATA_DIGEST_EN, &options); in qla4xxx_copy_from_fwddb_param()
3536 sess->imm_data_en = test_bit(ISCSIOPT_IMMEDIATE_DATA_EN, &options); in qla4xxx_copy_from_fwddb_param()
3537 sess->initial_r2t_en = test_bit(ISCSIOPT_INITIAL_R2T_EN, &options); in qla4xxx_copy_from_fwddb_param()
3538 sess->dataseq_inorder_en = test_bit(ISCSIOPT_DATA_SEQ_IN_ORDER, in qla4xxx_copy_from_fwddb_param()
3540 sess->pdu_inorder_en = test_bit(ISCSIOPT_DATA_PDU_IN_ORDER, &options); in qla4xxx_copy_from_fwddb_param()
3541 sess->chap_auth_en = test_bit(ISCSIOPT_CHAP_AUTH_EN, &options); in qla4xxx_copy_from_fwddb_param()
3542 conn->snack_req_en = test_bit(ISCSIOPT_SNACK_REQ_EN, &options); in qla4xxx_copy_from_fwddb_param()
3543 sess->discovery_logout_en = test_bit(ISCSIOPT_DISCOVERY_LOGOUT_EN, in qla4xxx_copy_from_fwddb_param()
3545 sess->bidi_chap_en = test_bit(ISCSIOPT_BIDI_CHAP_EN, &options); in qla4xxx_copy_from_fwddb_param()
3546 sess->discovery_auth_optional = in qla4xxx_copy_from_fwddb_param()
3549 sess->erl |= BIT_1; in qla4xxx_copy_from_fwddb_param()
3551 sess->erl |= BIT_0; in qla4xxx_copy_from_fwddb_param()
3553 options = le16_to_cpu(fw_ddb_entry->tcp_options); in qla4xxx_copy_from_fwddb_param()
3554 conn->tcp_timestamp_stat = test_bit(TCPOPT_TIMESTAMP_STAT, &options); in qla4xxx_copy_from_fwddb_param()
3555 conn->tcp_nagle_disable = test_bit(TCPOPT_NAGLE_DISABLE, &options); in qla4xxx_copy_from_fwddb_param()
3556 conn->tcp_wsf_disable = test_bit(TCPOPT_WSF_DISABLE, &options); in qla4xxx_copy_from_fwddb_param()
3558 conn->tcp_timer_scale |= BIT_3; in qla4xxx_copy_from_fwddb_param()
3560 conn->tcp_timer_scale |= BIT_2; in qla4xxx_copy_from_fwddb_param()
3562 conn->tcp_timer_scale |= BIT_1; in qla4xxx_copy_from_fwddb_param()
3564 conn->tcp_timer_scale >>= 1; in qla4xxx_copy_from_fwddb_param()
3565 conn->tcp_timestamp_en = test_bit(TCPOPT_TIMESTAMP_EN, &options); in qla4xxx_copy_from_fwddb_param()
3567 options = le16_to_cpu(fw_ddb_entry->ip_options); in qla4xxx_copy_from_fwddb_param()
3568 conn->fragment_disable = test_bit(IPOPT_FRAGMENT_DISABLE, &options); in qla4xxx_copy_from_fwddb_param()
3570 conn->max_recv_dlength = BYTE_UNITS * in qla4xxx_copy_from_fwddb_param()
3571 le16_to_cpu(fw_ddb_entry->iscsi_max_rcv_data_seg_len); in qla4xxx_copy_from_fwddb_param()
3572 conn->max_xmit_dlength = BYTE_UNITS * in qla4xxx_copy_from_fwddb_param()
3573 le16_to_cpu(fw_ddb_entry->iscsi_max_snd_data_seg_len); in qla4xxx_copy_from_fwddb_param()
3574 sess->first_burst = BYTE_UNITS * in qla4xxx_copy_from_fwddb_param()
3575 le16_to_cpu(fw_ddb_entry->iscsi_first_burst_len); in qla4xxx_copy_from_fwddb_param()
3576 sess->max_burst = BYTE_UNITS * in qla4xxx_copy_from_fwddb_param()
3577 le16_to_cpu(fw_ddb_entry->iscsi_max_burst_len); in qla4xxx_copy_from_fwddb_param()
3578 sess->max_r2t = le16_to_cpu(fw_ddb_entry->iscsi_max_outsnd_r2t); in qla4xxx_copy_from_fwddb_param()
3579 sess->time2wait = le16_to_cpu(fw_ddb_entry->iscsi_def_time2wait); in qla4xxx_copy_from_fwddb_param()
3580 sess->time2retain = le16_to_cpu(fw_ddb_entry->iscsi_def_time2retain); in qla4xxx_copy_from_fwddb_param()
3581 sess->tpgt = le32_to_cpu(fw_ddb_entry->tgt_portal_grp); in qla4xxx_copy_from_fwddb_param()
3582 conn->max_segment_size = le16_to_cpu(fw_ddb_entry->mss); in qla4xxx_copy_from_fwddb_param()
3583 conn->tcp_xmit_wsf = fw_ddb_entry->tcp_xmt_wsf; in qla4xxx_copy_from_fwddb_param()
3584 conn->tcp_recv_wsf = fw_ddb_entry->tcp_rcv_wsf; in qla4xxx_copy_from_fwddb_param()
3585 conn->ipv6_flow_label = le16_to_cpu(fw_ddb_entry->ipv6_flow_lbl); in qla4xxx_copy_from_fwddb_param()
3586 conn->keepalive_timeout = le16_to_cpu(fw_ddb_entry->ka_timeout); in qla4xxx_copy_from_fwddb_param()
3587 conn->local_port = le16_to_cpu(fw_ddb_entry->lcl_port); in qla4xxx_copy_from_fwddb_param()
3588 conn->statsn = le32_to_cpu(fw_ddb_entry->stat_sn); in qla4xxx_copy_from_fwddb_param()
3589 conn->exp_statsn = le32_to_cpu(fw_ddb_entry->exp_stat_sn); in qla4xxx_copy_from_fwddb_param()
3590 sess->discovery_parent_idx = le16_to_cpu(fw_ddb_entry->ddb_link); in qla4xxx_copy_from_fwddb_param()
3591 sess->discovery_parent_type = le16_to_cpu(fw_ddb_entry->ddb_link); in qla4xxx_copy_from_fwddb_param()
3592 sess->chap_out_idx = le16_to_cpu(fw_ddb_entry->chap_tbl_idx); in qla4xxx_copy_from_fwddb_param()
3593 sess->tsid = le16_to_cpu(fw_ddb_entry->tsid); in qla4xxx_copy_from_fwddb_param()
3595 sess->default_taskmgmt_timeout = in qla4xxx_copy_from_fwddb_param()
3596 le16_to_cpu(fw_ddb_entry->def_timeout); in qla4xxx_copy_from_fwddb_param()
3597 conn->port = le16_to_cpu(fw_ddb_entry->port); in qla4xxx_copy_from_fwddb_param()
3599 options = le16_to_cpu(fw_ddb_entry->options); in qla4xxx_copy_from_fwddb_param()
3600 conn->ipaddress = kzalloc(IPv6_ADDR_LEN, GFP_KERNEL); in qla4xxx_copy_from_fwddb_param()
3601 if (!conn->ipaddress) { in qla4xxx_copy_from_fwddb_param()
3602 rc = -ENOMEM; in qla4xxx_copy_from_fwddb_param()
3606 conn->redirect_ipaddr = kzalloc(IPv6_ADDR_LEN, GFP_KERNEL); in qla4xxx_copy_from_fwddb_param()
3607 if (!conn->redirect_ipaddr) { in qla4xxx_copy_from_fwddb_param()
3608 rc = -ENOMEM; in qla4xxx_copy_from_fwddb_param()
3612 memcpy(conn->ipaddress, fw_ddb_entry->ip_addr, IPv6_ADDR_LEN); in qla4xxx_copy_from_fwddb_param()
3613 memcpy(conn->redirect_ipaddr, fw_ddb_entry->tgt_addr, IPv6_ADDR_LEN); in qla4xxx_copy_from_fwddb_param()
3616 conn->ipv6_traffic_class = fw_ddb_entry->ipv4_tos; in qla4xxx_copy_from_fwddb_param()
3618 conn->link_local_ipv6_addr = kmemdup( in qla4xxx_copy_from_fwddb_param()
3619 fw_ddb_entry->link_local_ipv6_addr, in qla4xxx_copy_from_fwddb_param()
3621 if (!conn->link_local_ipv6_addr) { in qla4xxx_copy_from_fwddb_param()
3622 rc = -ENOMEM; in qla4xxx_copy_from_fwddb_param()
3626 conn->ipv4_tos = fw_ddb_entry->ipv4_tos; in qla4xxx_copy_from_fwddb_param()
3629 if (fw_ddb_entry->iscsi_name[0]) { in qla4xxx_copy_from_fwddb_param()
3630 rc = iscsi_switch_str_param(&sess->targetname, in qla4xxx_copy_from_fwddb_param()
3631 (char *)fw_ddb_entry->iscsi_name); in qla4xxx_copy_from_fwddb_param()
3636 if (fw_ddb_entry->iscsi_alias[0]) { in qla4xxx_copy_from_fwddb_param()
3637 rc = iscsi_switch_str_param(&sess->targetalias, in qla4xxx_copy_from_fwddb_param()
3638 (char *)fw_ddb_entry->iscsi_alias); in qla4xxx_copy_from_fwddb_param()
3643 COPY_ISID(sess->isid, fw_ddb_entry->isid); in qla4xxx_copy_from_fwddb_param()
3655 options = le16_to_cpu(fw_ddb_entry->options); in qla4xxx_copy_to_fwddb_param()
3656 SET_BITVAL(conn->is_fw_assigned_ipv6, options, BIT_11); in qla4xxx_copy_to_fwddb_param()
3657 if (!strncmp(sess->portal_type, PORTAL_TYPE_IPV6, 4)) in qla4xxx_copy_to_fwddb_param()
3662 SET_BITVAL(sess->auto_snd_tgt_disable, options, BIT_6); in qla4xxx_copy_to_fwddb_param()
3663 SET_BITVAL(sess->discovery_sess, options, BIT_4); in qla4xxx_copy_to_fwddb_param()
3664 SET_BITVAL(sess->entry_state, options, BIT_3); in qla4xxx_copy_to_fwddb_param()
3665 fw_ddb_entry->options = cpu_to_le16(options); in qla4xxx_copy_to_fwddb_param()
3667 options = le16_to_cpu(fw_ddb_entry->iscsi_options); in qla4xxx_copy_to_fwddb_param()
3668 SET_BITVAL(conn->hdrdgst_en, options, BIT_13); in qla4xxx_copy_to_fwddb_param()
3669 SET_BITVAL(conn->datadgst_en, options, BIT_12); in qla4xxx_copy_to_fwddb_param()
3670 SET_BITVAL(sess->imm_data_en, options, BIT_11); in qla4xxx_copy_to_fwddb_param()
3671 SET_BITVAL(sess->initial_r2t_en, options, BIT_10); in qla4xxx_copy_to_fwddb_param()
3672 SET_BITVAL(sess->dataseq_inorder_en, options, BIT_9); in qla4xxx_copy_to_fwddb_param()
3673 SET_BITVAL(sess->pdu_inorder_en, options, BIT_8); in qla4xxx_copy_to_fwddb_param()
3674 SET_BITVAL(sess->chap_auth_en, options, BIT_7); in qla4xxx_copy_to_fwddb_param()
3675 SET_BITVAL(conn->snack_req_en, options, BIT_6); in qla4xxx_copy_to_fwddb_param()
3676 SET_BITVAL(sess->discovery_logout_en, options, BIT_5); in qla4xxx_copy_to_fwddb_param()
3677 SET_BITVAL(sess->bidi_chap_en, options, BIT_4); in qla4xxx_copy_to_fwddb_param()
3678 SET_BITVAL(sess->discovery_auth_optional, options, BIT_3); in qla4xxx_copy_to_fwddb_param()
3679 SET_BITVAL(sess->erl & BIT_1, options, BIT_1); in qla4xxx_copy_to_fwddb_param()
3680 SET_BITVAL(sess->erl & BIT_0, options, BIT_0); in qla4xxx_copy_to_fwddb_param()
3681 fw_ddb_entry->iscsi_options = cpu_to_le16(options); in qla4xxx_copy_to_fwddb_param()
3683 options = le16_to_cpu(fw_ddb_entry->tcp_options); in qla4xxx_copy_to_fwddb_param()
3684 SET_BITVAL(conn->tcp_timestamp_stat, options, BIT_6); in qla4xxx_copy_to_fwddb_param()
3685 SET_BITVAL(conn->tcp_nagle_disable, options, BIT_5); in qla4xxx_copy_to_fwddb_param()
3686 SET_BITVAL(conn->tcp_wsf_disable, options, BIT_4); in qla4xxx_copy_to_fwddb_param()
3687 SET_BITVAL(conn->tcp_timer_scale & BIT_2, options, BIT_3); in qla4xxx_copy_to_fwddb_param()
3688 SET_BITVAL(conn->tcp_timer_scale & BIT_1, options, BIT_2); in qla4xxx_copy_to_fwddb_param()
3689 SET_BITVAL(conn->tcp_timer_scale & BIT_0, options, BIT_1); in qla4xxx_copy_to_fwddb_param()
3690 SET_BITVAL(conn->tcp_timestamp_en, options, BIT_0); in qla4xxx_copy_to_fwddb_param()
3691 fw_ddb_entry->tcp_options = cpu_to_le16(options); in qla4xxx_copy_to_fwddb_param()
3693 options = le16_to_cpu(fw_ddb_entry->ip_options); in qla4xxx_copy_to_fwddb_param()
3694 SET_BITVAL(conn->fragment_disable, options, BIT_4); in qla4xxx_copy_to_fwddb_param()
3695 fw_ddb_entry->ip_options = cpu_to_le16(options); in qla4xxx_copy_to_fwddb_param()
3697 fw_ddb_entry->iscsi_max_outsnd_r2t = cpu_to_le16(sess->max_r2t); in qla4xxx_copy_to_fwddb_param()
3698 fw_ddb_entry->iscsi_max_rcv_data_seg_len = in qla4xxx_copy_to_fwddb_param()
3699 cpu_to_le16(conn->max_recv_dlength / BYTE_UNITS); in qla4xxx_copy_to_fwddb_param()
3700 fw_ddb_entry->iscsi_max_snd_data_seg_len = in qla4xxx_copy_to_fwddb_param()
3701 cpu_to_le16(conn->max_xmit_dlength / BYTE_UNITS); in qla4xxx_copy_to_fwddb_param()
3702 fw_ddb_entry->iscsi_first_burst_len = in qla4xxx_copy_to_fwddb_param()
3703 cpu_to_le16(sess->first_burst / BYTE_UNITS); in qla4xxx_copy_to_fwddb_param()
3704 fw_ddb_entry->iscsi_max_burst_len = cpu_to_le16(sess->max_burst / in qla4xxx_copy_to_fwddb_param()
3706 fw_ddb_entry->iscsi_def_time2wait = cpu_to_le16(sess->time2wait); in qla4xxx_copy_to_fwddb_param()
3707 fw_ddb_entry->iscsi_def_time2retain = cpu_to_le16(sess->time2retain); in qla4xxx_copy_to_fwddb_param()
3708 fw_ddb_entry->tgt_portal_grp = cpu_to_le16(sess->tpgt); in qla4xxx_copy_to_fwddb_param()
3709 fw_ddb_entry->mss = cpu_to_le16(conn->max_segment_size); in qla4xxx_copy_to_fwddb_param()
3710 fw_ddb_entry->tcp_xmt_wsf = (uint8_t) cpu_to_le32(conn->tcp_xmit_wsf); in qla4xxx_copy_to_fwddb_param()
3711 fw_ddb_entry->tcp_rcv_wsf = (uint8_t) cpu_to_le32(conn->tcp_recv_wsf); in qla4xxx_copy_to_fwddb_param()
3712 fw_ddb_entry->ipv6_flow_lbl = cpu_to_le16(conn->ipv6_flow_label); in qla4xxx_copy_to_fwddb_param()
3713 fw_ddb_entry->ka_timeout = cpu_to_le16(conn->keepalive_timeout); in qla4xxx_copy_to_fwddb_param()
3714 fw_ddb_entry->lcl_port = cpu_to_le16(conn->local_port); in qla4xxx_copy_to_fwddb_param()
3715 fw_ddb_entry->stat_sn = cpu_to_le32(conn->statsn); in qla4xxx_copy_to_fwddb_param()
3716 fw_ddb_entry->exp_stat_sn = cpu_to_le32(conn->exp_statsn); in qla4xxx_copy_to_fwddb_param()
3717 fw_ddb_entry->ddb_link = cpu_to_le16(sess->discovery_parent_idx); in qla4xxx_copy_to_fwddb_param()
3718 fw_ddb_entry->chap_tbl_idx = cpu_to_le16(sess->chap_out_idx); in qla4xxx_copy_to_fwddb_param()
3719 fw_ddb_entry->tsid = cpu_to_le16(sess->tsid); in qla4xxx_copy_to_fwddb_param()
3720 fw_ddb_entry->port = cpu_to_le16(conn->port); in qla4xxx_copy_to_fwddb_param()
3721 fw_ddb_entry->def_timeout = in qla4xxx_copy_to_fwddb_param()
3722 cpu_to_le16(sess->default_taskmgmt_timeout); in qla4xxx_copy_to_fwddb_param()
3724 if (!strncmp(sess->portal_type, PORTAL_TYPE_IPV6, 4)) in qla4xxx_copy_to_fwddb_param()
3725 fw_ddb_entry->ipv4_tos = conn->ipv6_traffic_class; in qla4xxx_copy_to_fwddb_param()
3727 fw_ddb_entry->ipv4_tos = conn->ipv4_tos; in qla4xxx_copy_to_fwddb_param()
3729 if (conn->ipaddress) in qla4xxx_copy_to_fwddb_param()
3730 memcpy(fw_ddb_entry->ip_addr, conn->ipaddress, in qla4xxx_copy_to_fwddb_param()
3731 sizeof(fw_ddb_entry->ip_addr)); in qla4xxx_copy_to_fwddb_param()
3733 if (conn->redirect_ipaddr) in qla4xxx_copy_to_fwddb_param()
3734 memcpy(fw_ddb_entry->tgt_addr, conn->redirect_ipaddr, in qla4xxx_copy_to_fwddb_param()
3735 sizeof(fw_ddb_entry->tgt_addr)); in qla4xxx_copy_to_fwddb_param()
3737 if (conn->link_local_ipv6_addr) in qla4xxx_copy_to_fwddb_param()
3738 memcpy(fw_ddb_entry->link_local_ipv6_addr, in qla4xxx_copy_to_fwddb_param()
3739 conn->link_local_ipv6_addr, in qla4xxx_copy_to_fwddb_param()
3740 sizeof(fw_ddb_entry->link_local_ipv6_addr)); in qla4xxx_copy_to_fwddb_param()
3742 if (sess->targetname) in qla4xxx_copy_to_fwddb_param()
3743 memcpy(fw_ddb_entry->iscsi_name, sess->targetname, in qla4xxx_copy_to_fwddb_param()
3744 sizeof(fw_ddb_entry->iscsi_name)); in qla4xxx_copy_to_fwddb_param()
3746 if (sess->targetalias) in qla4xxx_copy_to_fwddb_param()
3747 memcpy(fw_ddb_entry->iscsi_alias, sess->targetalias, in qla4xxx_copy_to_fwddb_param()
3748 sizeof(fw_ddb_entry->iscsi_alias)); in qla4xxx_copy_to_fwddb_param()
3750 COPY_ISID(fw_ddb_entry->isid, sess->isid); in qla4xxx_copy_to_fwddb_param()
3764 options = le16_to_cpu(fw_ddb_entry->options); in qla4xxx_copy_to_sess_conn_params()
3765 conn->is_fw_assigned_ipv6 = test_bit(OPT_IS_FW_ASSIGNED_IPV6, &options); in qla4xxx_copy_to_sess_conn_params()
3766 sess->auto_snd_tgt_disable = test_bit(OPT_AUTO_SENDTGTS_DISABLE, in qla4xxx_copy_to_sess_conn_params()
3768 sess->discovery_sess = test_bit(OPT_DISC_SESSION, &options); in qla4xxx_copy_to_sess_conn_params()
3770 options = le16_to_cpu(fw_ddb_entry->iscsi_options); in qla4xxx_copy_to_sess_conn_params()
3771 conn->hdrdgst_en = test_bit(ISCSIOPT_HEADER_DIGEST_EN, &options); in qla4xxx_copy_to_sess_conn_params()
3772 conn->datadgst_en = test_bit(ISCSIOPT_DATA_DIGEST_EN, &options); in qla4xxx_copy_to_sess_conn_params()
3773 sess->imm_data_en = test_bit(ISCSIOPT_IMMEDIATE_DATA_EN, &options); in qla4xxx_copy_to_sess_conn_params()
3774 sess->initial_r2t_en = test_bit(ISCSIOPT_INITIAL_R2T_EN, &options); in qla4xxx_copy_to_sess_conn_params()
3775 sess->dataseq_inorder_en = test_bit(ISCSIOPT_DATA_SEQ_IN_ORDER, in qla4xxx_copy_to_sess_conn_params()
3777 sess->pdu_inorder_en = test_bit(ISCSIOPT_DATA_PDU_IN_ORDER, &options); in qla4xxx_copy_to_sess_conn_params()
3778 sess->chap_auth_en = test_bit(ISCSIOPT_CHAP_AUTH_EN, &options); in qla4xxx_copy_to_sess_conn_params()
3779 sess->discovery_logout_en = test_bit(ISCSIOPT_DISCOVERY_LOGOUT_EN, in qla4xxx_copy_to_sess_conn_params()
3781 sess->bidi_chap_en = test_bit(ISCSIOPT_BIDI_CHAP_EN, &options); in qla4xxx_copy_to_sess_conn_params()
3782 sess->discovery_auth_optional = in qla4xxx_copy_to_sess_conn_params()
3785 sess->erl |= BIT_1; in qla4xxx_copy_to_sess_conn_params()
3787 sess->erl |= BIT_0; in qla4xxx_copy_to_sess_conn_params()
3789 options = le16_to_cpu(fw_ddb_entry->tcp_options); in qla4xxx_copy_to_sess_conn_params()
3790 conn->tcp_timestamp_stat = test_bit(TCPOPT_TIMESTAMP_STAT, &options); in qla4xxx_copy_to_sess_conn_params()
3791 conn->tcp_nagle_disable = test_bit(TCPOPT_NAGLE_DISABLE, &options); in qla4xxx_copy_to_sess_conn_params()
3792 conn->tcp_wsf_disable = test_bit(TCPOPT_WSF_DISABLE, &options); in qla4xxx_copy_to_sess_conn_params()
3794 conn->tcp_timer_scale |= BIT_3; in qla4xxx_copy_to_sess_conn_params()
3796 conn->tcp_timer_scale |= BIT_2; in qla4xxx_copy_to_sess_conn_params()
3798 conn->tcp_timer_scale |= BIT_1; in qla4xxx_copy_to_sess_conn_params()
3800 conn->tcp_timer_scale >>= 1; in qla4xxx_copy_to_sess_conn_params()
3801 conn->tcp_timestamp_en = test_bit(TCPOPT_TIMESTAMP_EN, &options); in qla4xxx_copy_to_sess_conn_params()
3803 options = le16_to_cpu(fw_ddb_entry->ip_options); in qla4xxx_copy_to_sess_conn_params()
3804 conn->fragment_disable = test_bit(IPOPT_FRAGMENT_DISABLE, &options); in qla4xxx_copy_to_sess_conn_params()
3806 conn->max_recv_dlength = BYTE_UNITS * in qla4xxx_copy_to_sess_conn_params()
3807 le16_to_cpu(fw_ddb_entry->iscsi_max_rcv_data_seg_len); in qla4xxx_copy_to_sess_conn_params()
3808 conn->max_xmit_dlength = BYTE_UNITS * in qla4xxx_copy_to_sess_conn_params()
3809 le16_to_cpu(fw_ddb_entry->iscsi_max_snd_data_seg_len); in qla4xxx_copy_to_sess_conn_params()
3810 sess->max_r2t = le16_to_cpu(fw_ddb_entry->iscsi_max_outsnd_r2t); in qla4xxx_copy_to_sess_conn_params()
3811 sess->first_burst = BYTE_UNITS * in qla4xxx_copy_to_sess_conn_params()
3812 le16_to_cpu(fw_ddb_entry->iscsi_first_burst_len); in qla4xxx_copy_to_sess_conn_params()
3813 sess->max_burst = BYTE_UNITS * in qla4xxx_copy_to_sess_conn_params()
3814 le16_to_cpu(fw_ddb_entry->iscsi_max_burst_len); in qla4xxx_copy_to_sess_conn_params()
3815 sess->time2wait = le16_to_cpu(fw_ddb_entry->iscsi_def_time2wait); in qla4xxx_copy_to_sess_conn_params()
3816 sess->time2retain = le16_to_cpu(fw_ddb_entry->iscsi_def_time2retain); in qla4xxx_copy_to_sess_conn_params()
3817 sess->tpgt = le32_to_cpu(fw_ddb_entry->tgt_portal_grp); in qla4xxx_copy_to_sess_conn_params()
3818 conn->max_segment_size = le16_to_cpu(fw_ddb_entry->mss); in qla4xxx_copy_to_sess_conn_params()
3819 conn->tcp_xmit_wsf = fw_ddb_entry->tcp_xmt_wsf; in qla4xxx_copy_to_sess_conn_params()
3820 conn->tcp_recv_wsf = fw_ddb_entry->tcp_rcv_wsf; in qla4xxx_copy_to_sess_conn_params()
3821 conn->ipv4_tos = fw_ddb_entry->ipv4_tos; in qla4xxx_copy_to_sess_conn_params()
3822 conn->keepalive_tmo = le16_to_cpu(fw_ddb_entry->ka_timeout); in qla4xxx_copy_to_sess_conn_params()
3823 conn->local_port = le16_to_cpu(fw_ddb_entry->lcl_port); in qla4xxx_copy_to_sess_conn_params()
3824 conn->statsn = le32_to_cpu(fw_ddb_entry->stat_sn); in qla4xxx_copy_to_sess_conn_params()
3825 conn->exp_statsn = le32_to_cpu(fw_ddb_entry->exp_stat_sn); in qla4xxx_copy_to_sess_conn_params()
3826 sess->tsid = le16_to_cpu(fw_ddb_entry->tsid); in qla4xxx_copy_to_sess_conn_params()
3827 COPY_ISID(sess->isid, fw_ddb_entry->isid); in qla4xxx_copy_to_sess_conn_params()
3829 ddb_link = le16_to_cpu(fw_ddb_entry->ddb_link); in qla4xxx_copy_to_sess_conn_params()
3839 iscsi_set_param(conn->cls_conn, ISCSI_PARAM_DISCOVERY_PARENT_TYPE, in qla4xxx_copy_to_sess_conn_params()
3842 iscsi_set_param(conn->cls_conn, ISCSI_PARAM_TARGET_ALIAS, in qla4xxx_copy_to_sess_conn_params()
3843 (char *)fw_ddb_entry->iscsi_alias, 0); in qla4xxx_copy_to_sess_conn_params()
3845 options = le16_to_cpu(fw_ddb_entry->options); in qla4xxx_copy_to_sess_conn_params()
3848 sprintf(ip_addr, "%pI6", fw_ddb_entry->link_local_ipv6_addr); in qla4xxx_copy_to_sess_conn_params()
3849 iscsi_set_param(conn->cls_conn, ISCSI_PARAM_LOCAL_IPADDR, in qla4xxx_copy_to_sess_conn_params()
3867 sess = cls_sess->dd_data; in qla4xxx_copy_fwddb_param()
3868 ddb_entry = sess->dd_data; in qla4xxx_copy_fwddb_param()
3869 conn = cls_conn->dd_data; in qla4xxx_copy_fwddb_param()
3872 ddb_entry->chap_tbl_idx = le16_to_cpu(fw_ddb_entry->chap_tbl_idx); in qla4xxx_copy_fwddb_param()
3876 sess->def_taskmgmt_tmo = le16_to_cpu(fw_ddb_entry->def_timeout); in qla4xxx_copy_fwddb_param()
3877 conn->persistent_port = le16_to_cpu(fw_ddb_entry->port); in qla4xxx_copy_fwddb_param()
3880 options = le16_to_cpu(fw_ddb_entry->options); in qla4xxx_copy_fwddb_param()
3885 sprintf(ip_addr, "%pI6", fw_ddb_entry->ip_addr); in qla4xxx_copy_fwddb_param()
3888 sprintf(ip_addr, "%pI4", fw_ddb_entry->ip_addr); in qla4xxx_copy_fwddb_param()
3894 (char *)fw_ddb_entry->iscsi_name, buflen); in qla4xxx_copy_fwddb_param()
3896 (char *)ha->name_string, buflen); in qla4xxx_copy_fwddb_param()
3898 if (ddb_entry->chap_tbl_idx != INVALID_ENTRY) { in qla4xxx_copy_fwddb_param()
3901 ddb_entry->chap_tbl_idx)) { in qla4xxx_copy_fwddb_param()
3921 fw_ddb_entry = dma_alloc_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), in qla4xxx_update_session_conn_fwddb_param()
3929 if (qla4xxx_get_fwddb_entry(ha, ddb_entry->fw_ddb_index, fw_ddb_entry, in qla4xxx_update_session_conn_fwddb_param()
3934 ha->host_no, __func__, in qla4xxx_update_session_conn_fwddb_param()
3935 ddb_entry->fw_ddb_index)); in qla4xxx_update_session_conn_fwddb_param()
3939 cls_sess = ddb_entry->sess; in qla4xxx_update_session_conn_fwddb_param()
3941 cls_conn = ddb_entry->conn; in qla4xxx_update_session_conn_fwddb_param()
3948 dma_free_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), in qla4xxx_update_session_conn_fwddb_param()
3963 fw_ddb_entry = dma_alloc_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), in qla4xxx_update_session_conn_param()
3971 if (qla4xxx_get_fwddb_entry(ha, ddb_entry->fw_ddb_index, fw_ddb_entry, in qla4xxx_update_session_conn_param()
3976 ha->host_no, __func__, in qla4xxx_update_session_conn_param()
3977 ddb_entry->fw_ddb_index)); in qla4xxx_update_session_conn_param()
3981 cls_sess = ddb_entry->sess; in qla4xxx_update_session_conn_param()
3982 sess = cls_sess->dd_data; in qla4xxx_update_session_conn_param()
3984 cls_conn = ddb_entry->conn; in qla4xxx_update_session_conn_param()
3985 conn = cls_conn->dd_data; in qla4xxx_update_session_conn_param()
3988 ddb_entry->default_relogin_timeout = in qla4xxx_update_session_conn_param()
3989 (le16_to_cpu(fw_ddb_entry->def_timeout) > LOGIN_TOV) && in qla4xxx_update_session_conn_param()
3990 (le16_to_cpu(fw_ddb_entry->def_timeout) < LOGIN_TOV * 10) ? in qla4xxx_update_session_conn_param()
3991 le16_to_cpu(fw_ddb_entry->def_timeout) : LOGIN_TOV; in qla4xxx_update_session_conn_param()
3992 ddb_entry->default_time2wait = in qla4xxx_update_session_conn_param()
3993 le16_to_cpu(fw_ddb_entry->iscsi_def_time2wait); in qla4xxx_update_session_conn_param()
3996 ddb_entry->chap_tbl_idx = le16_to_cpu(fw_ddb_entry->chap_tbl_idx); in qla4xxx_update_session_conn_param()
3999 memcpy(sess->initiatorname, ha->name_string, in qla4xxx_update_session_conn_param()
4000 min(sizeof(ha->name_string), sizeof(sess->initiatorname))); in qla4xxx_update_session_conn_param()
4004 dma_free_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), in qla4xxx_update_session_conn_param()
4017 __func__, ha->host->host_no)); in qla4xxx_start_timer()
4018 timer_setup(&ha->timer, qla4xxx_timer, 0); in qla4xxx_start_timer()
4019 ha->timer.expires = jiffies + interval * HZ; in qla4xxx_start_timer()
4020 add_timer(&ha->timer); in qla4xxx_start_timer()
4021 ha->timer_active = 1; in qla4xxx_start_timer()
4026 timer_delete_sync(&ha->timer); in qla4xxx_stop_timer()
4027 ha->timer_active = 0; in qla4xxx_stop_timer()
4031 * qla4xxx_mark_device_missing - blocks the session
4043 * qla4xxx_mark_all_devices_missing - mark all devices as missing.
4050 iscsi_host_for_each_session(ha->host, qla4xxx_mark_device_missing); in qla4xxx_mark_all_devices_missing()
4059 srb = mempool_alloc(ha->srb_mempool, GFP_ATOMIC); in qla4xxx_get_new_srb()
4063 kref_init(&srb->srb_ref); in qla4xxx_get_new_srb()
4064 srb->ha = ha; in qla4xxx_get_new_srb()
4065 srb->ddb = ddb_entry; in qla4xxx_get_new_srb()
4066 srb->cmd = cmd; in qla4xxx_get_new_srb()
4067 srb->flags = 0; in qla4xxx_get_new_srb()
4068 qla4xxx_cmd_priv(cmd)->srb = srb; in qla4xxx_get_new_srb()
4075 struct scsi_cmnd *cmd = srb->cmd; in qla4xxx_srb_free_dma()
4077 if (srb->flags & SRB_DMA_VALID) { in qla4xxx_srb_free_dma()
4079 srb->flags &= ~SRB_DMA_VALID; in qla4xxx_srb_free_dma()
4081 qla4xxx_cmd_priv(cmd)->srb = NULL; in qla4xxx_srb_free_dma()
4087 struct scsi_cmnd *cmd = srb->cmd; in qla4xxx_srb_compl()
4088 struct scsi_qla_host *ha = srb->ha; in qla4xxx_srb_compl()
4092 mempool_free(srb, ha->srb_mempool); in qla4xxx_srb_compl()
4098 * qla4xxx_queuecommand - scsi layer issues scsi command to driver.
4104 * The mid-level driver tries to ensure that queuecommand never gets
4106 * the interrupt handler may call this routine as part of request-
4113 struct ddb_entry *ddb_entry = cmd->device->hostdata; in qla4xxx_queuecommand()
4114 struct iscsi_cls_session *sess = ddb_entry->sess; in qla4xxx_queuecommand()
4118 if (test_bit(AF_EEH_BUSY, &ha->flags)) { in qla4xxx_queuecommand()
4119 if (test_bit(AF_PCI_CHANNEL_IO_PERM_FAILURE, &ha->flags)) in qla4xxx_queuecommand()
4120 cmd->result = DID_NO_CONNECT << 16; in qla4xxx_queuecommand()
4122 cmd->result = DID_REQUEUE << 16; in qla4xxx_queuecommand()
4127 cmd->result = DID_IMM_RETRY << 16; in qla4xxx_queuecommand()
4133 cmd->result = rval; in qla4xxx_queuecommand()
4137 if (test_bit(DPC_RESET_HA_INTR, &ha->dpc_flags) || in qla4xxx_queuecommand()
4138 test_bit(DPC_RESET_ACTIVE, &ha->dpc_flags) || in qla4xxx_queuecommand()
4139 test_bit(DPC_RESET_HA, &ha->dpc_flags) || in qla4xxx_queuecommand()
4140 test_bit(DPC_HA_UNRECOVERABLE, &ha->dpc_flags) || in qla4xxx_queuecommand()
4141 test_bit(DPC_HA_NEED_QUIESCENT, &ha->dpc_flags) || in qla4xxx_queuecommand()
4142 !test_bit(AF_ONLINE, &ha->flags) || in qla4xxx_queuecommand()
4143 !test_bit(AF_LINK_UP, &ha->flags) || in qla4xxx_queuecommand()
4144 test_bit(AF_LOOPBACK, &ha->flags) || in qla4xxx_queuecommand()
4145 test_bit(DPC_POST_IDC_ACK, &ha->dpc_flags) || in qla4xxx_queuecommand()
4146 test_bit(DPC_RESTORE_ACB, &ha->dpc_flags) || in qla4xxx_queuecommand()
4147 test_bit(DPC_RESET_HA_FW_CONTEXT, &ha->dpc_flags)) in qla4xxx_queuecommand()
4162 mempool_free(srb, ha->srb_mempool); in qla4xxx_queuecommand()
4174 * qla4xxx_mem_free - frees memory allocated to adapter
4181 if (ha->queues) in qla4xxx_mem_free()
4182 dma_free_coherent(&ha->pdev->dev, ha->queues_len, ha->queues, in qla4xxx_mem_free()
4183 ha->queues_dma); in qla4xxx_mem_free()
4185 vfree(ha->fw_dump); in qla4xxx_mem_free()
4187 ha->queues_len = 0; in qla4xxx_mem_free()
4188 ha->queues = NULL; in qla4xxx_mem_free()
4189 ha->queues_dma = 0; in qla4xxx_mem_free()
4190 ha->request_ring = NULL; in qla4xxx_mem_free()
4191 ha->request_dma = 0; in qla4xxx_mem_free()
4192 ha->response_ring = NULL; in qla4xxx_mem_free()
4193 ha->response_dma = 0; in qla4xxx_mem_free()
4194 ha->shadow_regs = NULL; in qla4xxx_mem_free()
4195 ha->shadow_regs_dma = 0; in qla4xxx_mem_free()
4196 ha->fw_dump = NULL; in qla4xxx_mem_free()
4197 ha->fw_dump_size = 0; in qla4xxx_mem_free()
4200 mempool_destroy(ha->srb_mempool); in qla4xxx_mem_free()
4201 ha->srb_mempool = NULL; in qla4xxx_mem_free()
4203 dma_pool_destroy(ha->chap_dma_pool); in qla4xxx_mem_free()
4205 vfree(ha->chap_list); in qla4xxx_mem_free()
4206 ha->chap_list = NULL; in qla4xxx_mem_free()
4208 dma_pool_destroy(ha->fw_ddb_dma_pool); in qla4xxx_mem_free()
4212 if (ha->nx_pcibase) in qla4xxx_mem_free()
4214 (struct device_reg_82xx __iomem *)ha->nx_pcibase); in qla4xxx_mem_free()
4216 if (ha->nx_pcibase) in qla4xxx_mem_free()
4218 (struct device_reg_83xx __iomem *)ha->nx_pcibase); in qla4xxx_mem_free()
4219 } else if (ha->reg) { in qla4xxx_mem_free()
4220 iounmap(ha->reg); in qla4xxx_mem_free()
4223 vfree(ha->reset_tmplt.buff); in qla4xxx_mem_free()
4225 pci_release_regions(ha->pdev); in qla4xxx_mem_free()
4229 * qla4xxx_mem_alloc - allocates memory for use by adapter.
4240 ha->queues_len = ((REQUEST_QUEUE_DEPTH * QUEUE_SIZE) + in qla4xxx_mem_alloc()
4244 (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1); in qla4xxx_mem_alloc()
4245 ha->queues = dma_alloc_coherent(&ha->pdev->dev, ha->queues_len, in qla4xxx_mem_alloc()
4246 &ha->queues_dma, GFP_KERNEL); in qla4xxx_mem_alloc()
4247 if (ha->queues == NULL) { in qla4xxx_mem_alloc()
4249 "Memory Allocation failed - queues.\n"); in qla4xxx_mem_alloc()
4255 * As per RISC alignment requirements -- the bus-address must be a in qla4xxx_mem_alloc()
4256 * multiple of the request-ring size (in bytes). in qla4xxx_mem_alloc()
4259 if ((unsigned long)ha->queues_dma & (MEM_ALIGN_VALUE - 1)) in qla4xxx_mem_alloc()
4260 align = MEM_ALIGN_VALUE - ((unsigned long)ha->queues_dma & in qla4xxx_mem_alloc()
4261 (MEM_ALIGN_VALUE - 1)); in qla4xxx_mem_alloc()
4264 ha->request_dma = ha->queues_dma + align; in qla4xxx_mem_alloc()
4265 ha->request_ring = (struct queue_entry *) (ha->queues + align); in qla4xxx_mem_alloc()
4266 ha->response_dma = ha->queues_dma + align + in qla4xxx_mem_alloc()
4268 ha->response_ring = (struct queue_entry *) (ha->queues + align + in qla4xxx_mem_alloc()
4271 ha->shadow_regs_dma = ha->queues_dma + align + in qla4xxx_mem_alloc()
4274 ha->shadow_regs = (struct shadow_regs *) (ha->queues + align + in qla4xxx_mem_alloc()
4281 ha->srb_mempool = mempool_create(SRB_MIN_REQ, mempool_alloc_slab, in qla4xxx_mem_alloc()
4283 if (ha->srb_mempool == NULL) { in qla4xxx_mem_alloc()
4285 "Memory Allocation failed - SRB Pool.\n"); in qla4xxx_mem_alloc()
4290 ha->chap_dma_pool = dma_pool_create("ql4_chap", &ha->pdev->dev, in qla4xxx_mem_alloc()
4293 if (ha->chap_dma_pool == NULL) { in qla4xxx_mem_alloc()
4299 ha->fw_ddb_dma_pool = dma_pool_create("ql4_fw_ddb", &ha->pdev->dev, in qla4xxx_mem_alloc()
4302 if (ha->fw_ddb_dma_pool == NULL) { in qla4xxx_mem_alloc()
4316 * qla4_8xxx_check_temp - Check the ISP82XX temperature.
4337 if (ha->temperature == QLA82XX_TEMP_NORMAL) in qla4_8xxx_check_temp()
4342 if (ha->temperature == QLA82XX_TEMP_WARN) in qla4_8xxx_check_temp()
4347 ha->temperature = temp_state; in qla4_8xxx_check_temp()
4352 * qla4_8xxx_check_fw_alive - Check firmware health
4368 ha->host_no, __func__)); in qla4_8xxx_check_fw_alive()
4372 if (ha->fw_heartbeat_counter == fw_heartbeat_counter) { in qla4_8xxx_check_fw_alive()
4373 ha->seconds_since_last_heartbeat++; in qla4_8xxx_check_fw_alive()
4375 if (ha->seconds_since_last_heartbeat == 2) { in qla4_8xxx_check_fw_alive()
4376 ha->seconds_since_last_heartbeat = 0; in qla4_8xxx_check_fw_alive()
4381 ha->seconds_since_last_heartbeat = 0; in qla4_8xxx_check_fw_alive()
4383 ha->fw_heartbeat_counter = fw_heartbeat_counter; in qla4_8xxx_check_fw_alive()
4419 set_bit(DPC_HA_UNRECOVERABLE, &ha->dpc_flags); in qla4_8xxx_process_fw_error()
4423 set_bit(DPC_RESET_HA, &ha->dpc_flags); in qla4_8xxx_process_fw_error()
4430 * qla4_8xxx_watchdog - Poll dev state
4443 __func__, ha->func_num); in qla4_8xxx_watchdog()
4446 if (!(test_bit(DPC_RESET_ACTIVE, &ha->dpc_flags) || in qla4_8xxx_watchdog()
4447 test_bit(DPC_RESET_HA, &ha->dpc_flags) || in qla4_8xxx_watchdog()
4448 test_bit(DPC_RETRY_RESET_HA, &ha->dpc_flags))) { in qla4_8xxx_watchdog()
4458 set_bit(DPC_HA_UNRECOVERABLE, &ha->dpc_flags); in qla4_8xxx_watchdog()
4461 !test_bit(DPC_RESET_HA, &ha->dpc_flags)) { in qla4_8xxx_watchdog()
4479 set_bit(DPC_RESET_HA, &ha->dpc_flags); in qla4_8xxx_watchdog()
4483 !test_bit(DPC_HA_NEED_QUIESCENT, &ha->dpc_flags)) { in qla4_8xxx_watchdog()
4486 set_bit(DPC_HA_NEED_QUIESCENT, &ha->dpc_flags); in qla4_8xxx_watchdog()
4502 sess = cls_sess->dd_data; in qla4xxx_check_relogin_flash_ddb()
4503 ddb_entry = sess->dd_data; in qla4xxx_check_relogin_flash_ddb()
4504 ha = ddb_entry->ha; in qla4xxx_check_relogin_flash_ddb()
4506 if (!(ddb_entry->ddb_type == FLASH_DDB)) in qla4xxx_check_relogin_flash_ddb()
4509 if (adapter_up(ha) && !test_bit(DF_RELOGIN, &ddb_entry->flags) && in qla4xxx_check_relogin_flash_ddb()
4511 if (atomic_read(&ddb_entry->retry_relogin_timer) != in qla4xxx_check_relogin_flash_ddb()
4513 if (atomic_read(&ddb_entry->retry_relogin_timer) == in qla4xxx_check_relogin_flash_ddb()
4515 atomic_set(&ddb_entry->retry_relogin_timer, in qla4xxx_check_relogin_flash_ddb()
4517 set_bit(DPC_RELOGIN_DEVICE, &ha->dpc_flags); in qla4xxx_check_relogin_flash_ddb()
4518 set_bit(DF_RELOGIN, &ddb_entry->flags); in qla4xxx_check_relogin_flash_ddb()
4521 __func__, ddb_entry->fw_ddb_index)); in qla4xxx_check_relogin_flash_ddb()
4523 atomic_dec(&ddb_entry->retry_relogin_timer); in qla4xxx_check_relogin_flash_ddb()
4528 if (atomic_read(&ddb_entry->relogin_timer) && in qla4xxx_check_relogin_flash_ddb()
4529 (atomic_dec_and_test(&ddb_entry->relogin_timer) != 0)) { in qla4xxx_check_relogin_flash_ddb()
4536 atomic_inc(&ddb_entry->relogin_retry_count); in qla4xxx_check_relogin_flash_ddb()
4538 "%s: index[%d] relogin timed out-retrying" in qla4xxx_check_relogin_flash_ddb()
4540 ddb_entry->fw_ddb_index, in qla4xxx_check_relogin_flash_ddb()
4541 atomic_read(&ddb_entry->relogin_retry_count), in qla4xxx_check_relogin_flash_ddb()
4542 ddb_entry->default_time2wait + 4)); in qla4xxx_check_relogin_flash_ddb()
4543 set_bit(DPC_RELOGIN_DEVICE, &ha->dpc_flags); in qla4xxx_check_relogin_flash_ddb()
4544 atomic_set(&ddb_entry->retry_relogin_timer, in qla4xxx_check_relogin_flash_ddb()
4545 ddb_entry->default_time2wait + 4); in qla4xxx_check_relogin_flash_ddb()
4551 * qla4xxx_timer - checks every second for work to do.
4560 iscsi_host_for_each_session(ha->host, qla4xxx_check_relogin_flash_ddb); in qla4xxx_timer()
4565 if (test_bit(AF_EEH_BUSY, &ha->flags)) { in qla4xxx_timer()
4566 mod_timer(&ha->timer, jiffies + HZ); in qla4xxx_timer()
4571 if (!pci_channel_offline(ha->pdev)) in qla4xxx_timer()
4572 pci_read_config_word(ha->pdev, PCI_VENDOR_ID, &w); in qla4xxx_timer()
4578 /* Check for heartbeat interval. */ in qla4xxx_timer()
4579 if (ha->firmware_options & FWOPT_HEARTBEAT_ENABLE && in qla4xxx_timer()
4580 ha->heartbeat_interval != 0) { in qla4xxx_timer()
4581 ha->seconds_since_last_heartbeat++; in qla4xxx_timer()
4582 if (ha->seconds_since_last_heartbeat > in qla4xxx_timer()
4583 ha->heartbeat_interval + 2) in qla4xxx_timer()
4584 set_bit(DPC_RESET_HA, &ha->dpc_flags); in qla4xxx_timer()
4589 if (!list_empty(&ha->work_list)) in qla4xxx_timer()
4594 test_bit(DPC_RESET_HA, &ha->dpc_flags) || in qla4xxx_timer()
4595 test_bit(DPC_RETRY_RESET_HA, &ha->dpc_flags) || in qla4xxx_timer()
4596 test_bit(DPC_RELOGIN_DEVICE, &ha->dpc_flags) || in qla4xxx_timer()
4597 test_bit(DPC_RESET_HA_FW_CONTEXT, &ha->dpc_flags) || in qla4xxx_timer()
4598 test_bit(DPC_RESET_HA_INTR, &ha->dpc_flags) || in qla4xxx_timer()
4599 test_bit(DPC_GET_DHCP_IP_ADDR, &ha->dpc_flags) || in qla4xxx_timer()
4600 test_bit(DPC_LINK_CHANGED, &ha->dpc_flags) || in qla4xxx_timer()
4601 test_bit(DPC_HA_UNRECOVERABLE, &ha->dpc_flags) || in qla4xxx_timer()
4602 test_bit(DPC_HA_NEED_QUIESCENT, &ha->dpc_flags) || in qla4xxx_timer()
4603 test_bit(DPC_SYSFS_DDB_EXPORT, &ha->dpc_flags) || in qla4xxx_timer()
4604 test_bit(DPC_AEN, &ha->dpc_flags)) { in qla4xxx_timer()
4606 " - dpc flags = 0x%lx\n", in qla4xxx_timer()
4607 ha->host_no, __func__, ha->dpc_flags)); in qla4xxx_timer()
4612 mod_timer(&ha->timer, jiffies + HZ); in qla4xxx_timer()
4614 DEBUG2(ha->seconds_since_last_intr++); in qla4xxx_timer()
4618 * qla4xxx_cmd_wait - waits for all outstanding commands to complete
4635 wtmo = ha->nx_reset_timeout / 2; in qla4xxx_cmd_wait()
4644 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_cmd_wait()
4646 for (index = 0; index < ha->host->can_queue; index++) { in qla4xxx_cmd_wait()
4647 cmd = scsi_host_find_tag(ha->host, index); in qla4xxx_cmd_wait()
4654 if (cmd != NULL && qla4xxx_cmd_priv(cmd)->srb) in qla4xxx_cmd_wait()
4657 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_cmd_wait()
4660 if (index == ha->host->can_queue) in qla4xxx_cmd_wait()
4675 DEBUG2(printk(KERN_ERR "scsi%ld: %s\n", ha->host_no, __func__)); in qla4xxx_hw_reset()
4680 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_hw_reset()
4686 ctrl_status = readw(&ha->reg->ctrl_status); in qla4xxx_hw_reset()
4688 writel(set_rmask(CSR_SCSI_RESET_INTR), &ha->reg->ctrl_status); in qla4xxx_hw_reset()
4691 writel(set_rmask(CSR_SOFT_RESET), &ha->reg->ctrl_status); in qla4xxx_hw_reset()
4692 readl(&ha->reg->ctrl_status); in qla4xxx_hw_reset()
4694 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_hw_reset()
4699 * qla4xxx_soft_reset - performs soft reset.
4717 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_soft_reset()
4718 ctrl_status = readw(&ha->reg->ctrl_status); in qla4xxx_soft_reset()
4719 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_soft_reset()
4725 } while ((--max_wait_time)); in qla4xxx_soft_reset()
4731 ha->host_no)); in qla4xxx_soft_reset()
4732 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_soft_reset()
4733 writel(set_rmask(CSR_NET_RESET_INTR), &ha->reg->ctrl_status); in qla4xxx_soft_reset()
4734 readl(&ha->reg->ctrl_status); in qla4xxx_soft_reset()
4735 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_soft_reset()
4741 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_soft_reset()
4742 ctrl_status = readw(&ha->reg->ctrl_status); in qla4xxx_soft_reset()
4743 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_soft_reset()
4751 } while ((--max_wait_time)); in qla4xxx_soft_reset()
4757 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_soft_reset()
4758 ctrl_status = readw(&ha->reg->ctrl_status); in qla4xxx_soft_reset()
4760 writel(set_rmask(CSR_SCSI_RESET_INTR), &ha->reg->ctrl_status); in qla4xxx_soft_reset()
4761 readl(&ha->reg->ctrl_status); in qla4xxx_soft_reset()
4763 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_soft_reset()
4773 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_soft_reset()
4774 writel(set_rmask(CSR_FORCE_SOFT_RESET), &ha->reg->ctrl_status); in qla4xxx_soft_reset()
4775 readl(&ha->reg->ctrl_status); in qla4xxx_soft_reset()
4776 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_soft_reset()
4780 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_soft_reset()
4781 ctrl_status = readw(&ha->reg->ctrl_status); in qla4xxx_soft_reset()
4782 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_soft_reset()
4790 } while ((--max_wait_time)); in qla4xxx_soft_reset()
4797 * qla4xxx_abort_active_cmds - returns all outstanding i/o requests to O.S.
4812 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_abort_active_cmds()
4813 for (i = 0; i < ha->host->can_queue; i++) { in qla4xxx_abort_active_cmds()
4816 srb->cmd->result = res; in qla4xxx_abort_active_cmds()
4817 kref_put(&srb->srb_ref, qla4xxx_srb_compl); in qla4xxx_abort_active_cmds()
4820 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_abort_active_cmds()
4825 clear_bit(AF_ONLINE, &ha->flags); in qla4xxx_dead_adapter_cleanup()
4832 clear_bit(AF_INIT_DONE, &ha->flags); in qla4xxx_dead_adapter_cleanup()
4840 sess = cls_session->dd_data; in qla4xxx_fail_session()
4841 ddb_entry = sess->dd_data; in qla4xxx_fail_session()
4842 ddb_entry->fw_ddb_device_state = DDB_DS_SESSION_FAILED; in qla4xxx_fail_session()
4844 if (ddb_entry->ddb_type == FLASH_DDB) in qla4xxx_fail_session()
4845 iscsi_block_session(ddb_entry->sess); in qla4xxx_fail_session()
4847 iscsi_session_failure(cls_session->dd_data, in qla4xxx_fail_session()
4852 * qla4xxx_recover_adapter - recovers adapter after a fatal error
4863 scsi_block_requests(ha->host); in qla4xxx_recover_adapter()
4864 clear_bit(AF_ONLINE, &ha->flags); in qla4xxx_recover_adapter()
4865 clear_bit(AF_LINK_UP, &ha->flags); in qla4xxx_recover_adapter()
4869 set_bit(DPC_RESET_ACTIVE, &ha->dpc_flags); in qla4xxx_recover_adapter()
4872 !test_bit(DPC_RESET_HA_FW_CONTEXT, &ha->dpc_flags)) { in qla4xxx_recover_adapter()
4879 iscsi_host_for_each_session(ha->host, qla4xxx_fail_session); in qla4xxx_recover_adapter()
4881 if (test_bit(DPC_RESET_HA, &ha->dpc_flags)) in qla4xxx_recover_adapter()
4884 /* For the DPC_RESET_HA_INTR case (ISP-4xxx specific) in qla4xxx_recover_adapter()
4886 if (test_bit(DPC_RESET_HA_INTR, &ha->dpc_flags)) { in qla4xxx_recover_adapter()
4891 /* For the ISP-8xxx adapter, issue a stop_firmware if invoked in qla4xxx_recover_adapter()
4894 test_bit(DPC_RESET_HA_FW_CONTEXT, &ha->dpc_flags)) { in qla4xxx_recover_adapter()
4897 "scsi%ld: %s - Performing stop_firmware...\n", in qla4xxx_recover_adapter()
4898 ha->host_no, __func__)); in qla4xxx_recover_adapter()
4899 status = ha->isp_ops->reset_firmware(ha); in qla4xxx_recover_adapter()
4901 ha->isp_ops->disable_intrs(ha); in qla4xxx_recover_adapter()
4908 clear_bit(DPC_RESET_HA_FW_CONTEXT, &ha->dpc_flags); in qla4xxx_recover_adapter()
4909 set_bit(DPC_RESET_HA, &ha->dpc_flags); in qla4xxx_recover_adapter()
4914 * or if stop_firmware fails for ISP-8xxx. in qla4xxx_recover_adapter()
4915 * This is the default case for ISP-4xxx */ in qla4xxx_recover_adapter()
4923 if (test_bit(AF_FW_RECOVERY, &ha->flags)) in qla4xxx_recover_adapter()
4937 if (!test_bit(AF_FW_RECOVERY, &ha->flags)) in qla4xxx_recover_adapter()
4942 "scsi%ld: %s - Performing chip reset..\n", in qla4xxx_recover_adapter()
4943 ha->host_no, __func__)); in qla4xxx_recover_adapter()
4944 status = ha->isp_ops->reset_chip(ha); in qla4xxx_recover_adapter()
4952 /* Upon successful firmware/chip reset, re-initialize the adapter */ in qla4xxx_recover_adapter()
4954 /* For ISP-4xxx, force function 1 to always initialize in qla4xxx_recover_adapter()
4957 if (is_qla40XX(ha) && (ha->mac_index == 3)) in qla4xxx_recover_adapter()
4967 ha->host_no, __func__); in qla4xxx_recover_adapter()
4969 clear_bit(DPC_RETRY_RESET_HA, &ha->dpc_flags); in qla4xxx_recover_adapter()
4970 clear_bit(DPC_RESET_HA, &ha->dpc_flags); in qla4xxx_recover_adapter()
4972 &ha->dpc_flags); in qla4xxx_recover_adapter()
4979 * Do not retry initialize_adapter for RESET_HA_INTR (ISP-4xxx specific) in qla4xxx_recover_adapter()
4980 * case to prevent ping-pong resets between functions */ in qla4xxx_recover_adapter()
4981 if (!test_bit(AF_ONLINE, &ha->flags) && in qla4xxx_recover_adapter()
4982 !test_bit(DPC_RESET_HA_INTR, &ha->dpc_flags)) { in qla4xxx_recover_adapter()
4989 ha->isp_ops->idc_lock(ha); in qla4xxx_recover_adapter()
4992 ha->isp_ops->idc_unlock(ha); in qla4xxx_recover_adapter()
4998 clear_bit(DPC_RETRY_RESET_HA, &ha->dpc_flags); in qla4xxx_recover_adapter()
4999 clear_bit(DPC_RESET_HA, &ha->dpc_flags); in qla4xxx_recover_adapter()
5001 &ha->dpc_flags); in qla4xxx_recover_adapter()
5008 if (!test_bit(DPC_RETRY_RESET_HA, &ha->dpc_flags)) { in qla4xxx_recover_adapter()
5009 ha->retry_reset_ha_cnt = MAX_RESET_HA_RETRIES; in qla4xxx_recover_adapter()
5010 DEBUG2(printk("scsi%ld: recover adapter - retrying " in qla4xxx_recover_adapter()
5011 "(%d) more times\n", ha->host_no, in qla4xxx_recover_adapter()
5012 ha->retry_reset_ha_cnt)); in qla4xxx_recover_adapter()
5013 set_bit(DPC_RETRY_RESET_HA, &ha->dpc_flags); in qla4xxx_recover_adapter()
5016 if (ha->retry_reset_ha_cnt > 0) { in qla4xxx_recover_adapter()
5017 /* Schedule another Reset HA--DPC will retry */ in qla4xxx_recover_adapter()
5018 ha->retry_reset_ha_cnt--; in qla4xxx_recover_adapter()
5019 DEBUG2(printk("scsi%ld: recover adapter - " in qla4xxx_recover_adapter()
5021 ha->host_no, in qla4xxx_recover_adapter()
5022 ha->retry_reset_ha_cnt)); in qla4xxx_recover_adapter()
5026 if (ha->retry_reset_ha_cnt == 0) { in qla4xxx_recover_adapter()
5030 "failed - board disabled\n", in qla4xxx_recover_adapter()
5031 ha->host_no)); in qla4xxx_recover_adapter()
5033 clear_bit(DPC_RETRY_RESET_HA, &ha->dpc_flags); in qla4xxx_recover_adapter()
5034 clear_bit(DPC_RESET_HA, &ha->dpc_flags); in qla4xxx_recover_adapter()
5036 &ha->dpc_flags); in qla4xxx_recover_adapter()
5041 clear_bit(DPC_RESET_HA, &ha->dpc_flags); in qla4xxx_recover_adapter()
5042 clear_bit(DPC_RESET_HA_FW_CONTEXT, &ha->dpc_flags); in qla4xxx_recover_adapter()
5043 clear_bit(DPC_RETRY_RESET_HA, &ha->dpc_flags); in qla4xxx_recover_adapter()
5047 ha->adapter_error_count++; in qla4xxx_recover_adapter()
5049 if (test_bit(AF_ONLINE, &ha->flags)) in qla4xxx_recover_adapter()
5050 ha->isp_ops->enable_intrs(ha); in qla4xxx_recover_adapter()
5052 scsi_unblock_requests(ha->host); in qla4xxx_recover_adapter()
5054 clear_bit(DPC_RESET_ACTIVE, &ha->dpc_flags); in qla4xxx_recover_adapter()
5055 DEBUG2(printk("scsi%ld: recover adapter: %s\n", ha->host_no, in qla4xxx_recover_adapter()
5067 sess = cls_session->dd_data; in qla4xxx_relogin_devices()
5068 ddb_entry = sess->dd_data; in qla4xxx_relogin_devices()
5069 ha = ddb_entry->ha; in qla4xxx_relogin_devices()
5071 if (ddb_entry->fw_ddb_device_state == DDB_DS_SESSION_ACTIVE) { in qla4xxx_relogin_devices()
5073 " unblock session\n", ha->host_no, __func__, in qla4xxx_relogin_devices()
5074 ddb_entry->fw_ddb_index); in qla4xxx_relogin_devices()
5075 iscsi_unblock_session(ddb_entry->sess); in qla4xxx_relogin_devices()
5078 if (ddb_entry->ddb_type == FLASH_DDB) { in qla4xxx_relogin_devices()
5079 if (!(test_bit(DF_RELOGIN, &ddb_entry->flags) || in qla4xxx_relogin_devices()
5081 &ddb_entry->flags))) in qla4xxx_relogin_devices()
5084 iscsi_session_failure(cls_session->dd_data, in qla4xxx_relogin_devices()
5096 sess = cls_session->dd_data; in qla4xxx_unblock_flash_ddb()
5097 ddb_entry = sess->dd_data; in qla4xxx_unblock_flash_ddb()
5098 ha = ddb_entry->ha; in qla4xxx_unblock_flash_ddb()
5100 " unblock session\n", ha->host_no, __func__, in qla4xxx_unblock_flash_ddb()
5101 ddb_entry->fw_ddb_index); in qla4xxx_unblock_flash_ddb()
5103 iscsi_unblock_session(ddb_entry->sess); in qla4xxx_unblock_flash_ddb()
5106 if (test_bit(AF_ONLINE, &ha->flags)) { in qla4xxx_unblock_flash_ddb()
5108 " start scan\n", ha->host_no, __func__, in qla4xxx_unblock_flash_ddb()
5109 ddb_entry->fw_ddb_index); in qla4xxx_unblock_flash_ddb()
5110 queue_work(ddb_entry->sess->workq, &ddb_entry->sess->scan_work); in qla4xxx_unblock_flash_ddb()
5122 sess = cls_session->dd_data; in qla4xxx_unblock_ddb()
5123 ddb_entry = sess->dd_data; in qla4xxx_unblock_ddb()
5124 ha = ddb_entry->ha; in qla4xxx_unblock_ddb()
5126 " unblock user space session\n", ha->host_no, __func__, in qla4xxx_unblock_ddb()
5127 ddb_entry->fw_ddb_index); in qla4xxx_unblock_ddb()
5130 iscsi_conn_start(ddb_entry->conn); in qla4xxx_unblock_ddb()
5131 iscsi_conn_login_event(ddb_entry->conn, in qla4xxx_unblock_ddb()
5136 ha->host_no, __func__, ddb_entry->fw_ddb_index, in qla4xxx_unblock_ddb()
5137 cls_session->sid); in qla4xxx_unblock_ddb()
5146 iscsi_host_for_each_session(ha->host, qla4xxx_relogin_devices); in qla4xxx_relogin_all_devices()
5156 sess = cls_sess->dd_data; in qla4xxx_relogin_flash_ddb()
5157 ddb_entry = sess->dd_data; in qla4xxx_relogin_flash_ddb()
5158 ha = ddb_entry->ha; in qla4xxx_relogin_flash_ddb()
5160 relogin_timer = max(ddb_entry->default_relogin_timeout, in qla4xxx_relogin_flash_ddb()
5162 atomic_set(&ddb_entry->relogin_timer, relogin_timer); in qla4xxx_relogin_flash_ddb()
5165 "scsi%ld: Relogin index [%d]. TOV=%d\n", ha->host_no, in qla4xxx_relogin_flash_ddb()
5166 ddb_entry->fw_ddb_index, relogin_timer)); in qla4xxx_relogin_flash_ddb()
5177 sess = cls_sess->dd_data; in qla4xxx_dpc_relogin()
5178 ddb_entry = sess->dd_data; in qla4xxx_dpc_relogin()
5179 ha = ddb_entry->ha; in qla4xxx_dpc_relogin()
5181 if (!(ddb_entry->ddb_type == FLASH_DDB)) in qla4xxx_dpc_relogin()
5184 if (test_bit(DF_DISABLE_RELOGIN, &ddb_entry->flags)) in qla4xxx_dpc_relogin()
5187 if (test_and_clear_bit(DF_RELOGIN, &ddb_entry->flags) && in qla4xxx_dpc_relogin()
5197 if (ha->dpc_thread) in qla4xxx_wake_dpc()
5198 queue_work(ha->dpc_thread, &ha->dpc_work); in qla4xxx_wake_dpc()
5212 INIT_LIST_HEAD(&e->list); in qla4xxx_alloc_work()
5213 e->type = type; in qla4xxx_alloc_work()
5222 spin_lock_irqsave(&ha->work_lock, flags); in qla4xxx_post_work()
5223 list_add_tail(&e->list, &ha->work_list); in qla4xxx_post_work()
5224 spin_unlock_irqrestore(&ha->work_lock, flags); in qla4xxx_post_work()
5238 e->u.aen.code = aen_code; in qla4xxx_post_aen_work()
5239 e->u.aen.data_size = data_size; in qla4xxx_post_aen_work()
5240 memcpy(e->u.aen.data, data, data_size); in qla4xxx_post_aen_work()
5257 e->u.ping.status = status; in qla4xxx_post_ping_evt_work()
5258 e->u.ping.pid = pid; in qla4xxx_post_ping_evt_work()
5259 e->u.ping.data_size = data_size; in qla4xxx_post_ping_evt_work()
5260 memcpy(e->u.ping.data, data, data_size); in qla4xxx_post_ping_evt_work()
5273 spin_lock_irqsave(&ha->work_lock, flags); in qla4xxx_do_work()
5274 list_splice_init(&ha->work_list, &work); in qla4xxx_do_work()
5275 spin_unlock_irqrestore(&ha->work_lock, flags); in qla4xxx_do_work()
5278 list_del_init(&e->list); in qla4xxx_do_work()
5280 switch (e->type) { in qla4xxx_do_work()
5282 iscsi_post_host_event(ha->host_no, in qla4xxx_do_work()
5284 e->u.aen.code, in qla4xxx_do_work()
5285 e->u.aen.data_size, in qla4xxx_do_work()
5286 e->u.aen.data); in qla4xxx_do_work()
5289 iscsi_ping_comp_event(ha->host_no, in qla4xxx_do_work()
5291 e->u.ping.status, in qla4xxx_do_work()
5292 e->u.ping.pid, in qla4xxx_do_work()
5293 e->u.ping.data_size, in qla4xxx_do_work()
5294 e->u.ping.data); in qla4xxx_do_work()
5298 "supported", e->type); in qla4xxx_do_work()
5305 * qla4xxx_do_dpc - dpc routine
5312 * the mid-level tries to sleep when it reaches the driver threshold
5313 * "host->can_queue". This can cause a panic if we were in our interrupt code.
5323 ha->host_no, __func__, ha->flags, ha->dpc_flags)); in qla4xxx_do_dpc()
5326 if (!test_bit(AF_INIT_DONE, &ha->flags)) in qla4xxx_do_dpc()
5329 if (test_bit(AF_EEH_BUSY, &ha->flags)) { in qla4xxx_do_dpc()
5331 ha->host_no, __func__, ha->flags)); in qla4xxx_do_dpc()
5339 if (test_bit(DPC_HA_UNRECOVERABLE, &ha->dpc_flags)) { in qla4xxx_do_dpc()
5347 ha->isp_ops->idc_lock(ha); in qla4xxx_do_dpc()
5350 ha->isp_ops->idc_unlock(ha); in qla4xxx_do_dpc()
5355 if (test_bit(DPC_POST_IDC_ACK, &ha->dpc_flags)) { in qla4xxx_do_dpc()
5357 if (ha->idc_info.info2 & in qla4xxx_do_dpc()
5370 clear_bit(DPC_POST_IDC_ACK, &ha->dpc_flags); in qla4xxx_do_dpc()
5374 test_bit(DPC_RESTORE_ACB, &ha->dpc_flags)) { in qla4xxx_do_dpc()
5382 clear_bit(DPC_RESTORE_ACB, &ha->dpc_flags); in qla4xxx_do_dpc()
5385 if (test_and_clear_bit(DPC_HA_NEED_QUIESCENT, &ha->dpc_flags)) { in qla4xxx_do_dpc()
5390 if (!test_bit(DPC_RESET_ACTIVE, &ha->dpc_flags) && in qla4xxx_do_dpc()
5391 (test_bit(DPC_RESET_HA, &ha->dpc_flags) || in qla4xxx_do_dpc()
5392 test_bit(DPC_RESET_HA_INTR, &ha->dpc_flags) || in qla4xxx_do_dpc()
5393 test_bit(DPC_RESET_HA_FW_CONTEXT, &ha->dpc_flags))) { in qla4xxx_do_dpc()
5398 ha->host_no, __func__)); in qla4xxx_do_dpc()
5399 clear_bit(DPC_RESET_HA, &ha->dpc_flags); in qla4xxx_do_dpc()
5400 clear_bit(DPC_RESET_HA_INTR, &ha->dpc_flags); in qla4xxx_do_dpc()
5401 clear_bit(DPC_RESET_HA_FW_CONTEXT, &ha->dpc_flags); in qla4xxx_do_dpc()
5404 if (test_bit(DPC_RESET_HA_FW_CONTEXT, &ha->dpc_flags) || in qla4xxx_do_dpc()
5405 test_bit(DPC_RESET_HA, &ha->dpc_flags)) in qla4xxx_do_dpc()
5408 if (test_bit(DPC_RESET_HA_INTR, &ha->dpc_flags)) { in qla4xxx_do_dpc()
5411 while ((readw(&ha->reg->ctrl_status) & in qla4xxx_do_dpc()
5413 if (--wait_time == 0) in qla4xxx_do_dpc()
5419 "bit not cleared-- resetting\n", in qla4xxx_do_dpc()
5420 ha->host_no, __func__)); in qla4xxx_do_dpc()
5426 clear_bit(DPC_RESET_HA_INTR, &ha->dpc_flags); in qla4xxx_do_dpc()
5428 ha->isp_ops->enable_intrs(ha); in qla4xxx_do_dpc()
5433 /* ---- process AEN? --- */ in qla4xxx_do_dpc()
5434 if (test_and_clear_bit(DPC_AEN, &ha->dpc_flags)) in qla4xxx_do_dpc()
5437 /* ---- Get DHCP IP Address? --- */ in qla4xxx_do_dpc()
5438 if (test_and_clear_bit(DPC_GET_DHCP_IP_ADDR, &ha->dpc_flags)) in qla4xxx_do_dpc()
5441 /* ---- relogin device? --- */ in qla4xxx_do_dpc()
5443 test_and_clear_bit(DPC_RELOGIN_DEVICE, &ha->dpc_flags)) { in qla4xxx_do_dpc()
5444 iscsi_host_for_each_session(ha->host, qla4xxx_dpc_relogin); in qla4xxx_do_dpc()
5447 /* ---- link change? --- */ in qla4xxx_do_dpc()
5448 if (!test_bit(AF_LOOPBACK, &ha->flags) && in qla4xxx_do_dpc()
5449 test_and_clear_bit(DPC_LINK_CHANGED, &ha->dpc_flags)) { in qla4xxx_do_dpc()
5450 if (!test_bit(AF_LINK_UP, &ha->flags)) { in qla4xxx_do_dpc()
5451 /* ---- link down? --- */ in qla4xxx_do_dpc()
5454 /* ---- link up? --- * in qla4xxx_do_dpc()
5460 if (test_and_clear_bit(AF_BUILD_DDB_LIST, &ha->flags)) { in qla4xxx_do_dpc()
5461 qla4xxx_build_ddb_list(ha, ha->is_reset); in qla4xxx_do_dpc()
5462 iscsi_host_for_each_session(ha->host, in qla4xxx_do_dpc()
5468 if (test_and_clear_bit(DPC_SYSFS_DDB_EXPORT, &ha->dpc_flags)) { in qla4xxx_do_dpc()
5476 * qla4xxx_free_adapter - release the adapter
5483 /* Turn-off interrupts on the card. */ in qla4xxx_free_adapter()
5484 ha->isp_ops->disable_intrs(ha); in qla4xxx_free_adapter()
5488 &ha->reg->ctrl_status); in qla4xxx_free_adapter()
5489 readl(&ha->reg->ctrl_status); in qla4xxx_free_adapter()
5491 writel(0, &ha->qla4_82xx_reg->host_int); in qla4xxx_free_adapter()
5492 readl(&ha->qla4_82xx_reg->host_int); in qla4xxx_free_adapter()
5494 writel(0, &ha->qla4_83xx_reg->risc_intr); in qla4xxx_free_adapter()
5495 readl(&ha->qla4_83xx_reg->risc_intr); in qla4xxx_free_adapter()
5499 if (ha->timer_active) in qla4xxx_free_adapter()
5503 if (ha->dpc_thread) in qla4xxx_free_adapter()
5504 destroy_workqueue(ha->dpc_thread); in qla4xxx_free_adapter()
5507 if (ha->task_wq) in qla4xxx_free_adapter()
5508 destroy_workqueue(ha->task_wq); in qla4xxx_free_adapter()
5511 ha->isp_ops->reset_firmware(ha); in qla4xxx_free_adapter()
5514 ha->isp_ops->idc_lock(ha); in qla4xxx_free_adapter()
5516 ha->isp_ops->idc_unlock(ha); in qla4xxx_free_adapter()
5530 struct pci_dev *pdev = ha->pdev; in qla4_8xxx_iospace_config()
5536 "status=%d\n", ha->host_no, pci_name(pdev), status); in qla4_8xxx_iospace_config()
5540 DEBUG2(printk(KERN_INFO "%s: revision-id=%d\n", in qla4_8xxx_iospace_config()
5541 __func__, pdev->revision)); in qla4_8xxx_iospace_config()
5542 ha->revision_id = pdev->revision; in qla4_8xxx_iospace_config()
5551 ha->nx_pcibase = (unsigned long)ioremap(mem_base, mem_len); in qla4_8xxx_iospace_config()
5552 if (!ha->nx_pcibase) { in qla4_8xxx_iospace_config()
5555 pci_release_regions(ha->pdev); in qla4_8xxx_iospace_config()
5563 ha->qla4_82xx_reg = (struct device_reg_82xx __iomem *) in qla4_8xxx_iospace_config()
5564 ((uint8_t *)ha->nx_pcibase + 0xbc000 + in qla4_8xxx_iospace_config()
5565 (ha->pdev->devfn << 11)); in qla4_8xxx_iospace_config()
5566 ha->nx_db_wr_ptr = (ha->pdev->devfn == 4 ? QLA82XX_CAM_RAM_DB1 : in qla4_8xxx_iospace_config()
5569 ha->qla4_83xx_reg = (struct device_reg_83xx __iomem *) in qla4_8xxx_iospace_config()
5570 ((uint8_t *)ha->nx_pcibase); in qla4_8xxx_iospace_config()
5575 return -ENOMEM; in qla4_8xxx_iospace_config()
5579 * qla4xxx_iospace_config - maps registers
5590 pio = pci_resource_start(ha->pdev, 0); in qla4xxx_iospace_config()
5591 pio_len = pci_resource_len(ha->pdev, 0); in qla4xxx_iospace_config()
5592 pio_flags = pci_resource_flags(ha->pdev, 0); in qla4xxx_iospace_config()
5605 mmio = pci_resource_start(ha->pdev, 1); in qla4xxx_iospace_config()
5606 mmio_len = pci_resource_len(ha->pdev, 1); in qla4xxx_iospace_config()
5607 mmio_flags = pci_resource_flags(ha->pdev, 1); in qla4xxx_iospace_config()
5622 if (pci_request_regions(ha->pdev, DRIVER_NAME)) { in qla4xxx_iospace_config()
5629 ha->pio_address = pio; in qla4xxx_iospace_config()
5630 ha->pio_length = pio_len; in qla4xxx_iospace_config()
5631 ha->reg = ioremap(mmio, MIN_IOBASE_LEN); in qla4xxx_iospace_config()
5632 if (!ha->reg) { in qla4xxx_iospace_config()
5642 return -ENOMEM; in qla4xxx_iospace_config()
5722 return (uint16_t)le32_to_cpu(ha->shadow_regs->req_q_out); in qla4xxx_rd_shdw_req_q_out()
5727 return (uint16_t)le32_to_cpu(readl(&ha->qla4_82xx_reg->req_q_out)); in qla4_82xx_rd_shdw_req_q_out()
5732 return (uint16_t)le32_to_cpu(ha->shadow_regs->rsp_q_in); in qla4xxx_rd_shdw_rsp_q_in()
5737 return (uint16_t)le32_to_cpu(readl(&ha->qla4_82xx_reg->rsp_q_in)); in qla4_82xx_rd_shdw_rsp_q_in()
5754 rc = sysfs_format_mac(str, ha->my_mac, in qla4xxx_show_boot_eth_info()
5758 rc = -ENOSYS; in qla4xxx_show_boot_eth_info()
5789 rc = sprintf(str, "%s\n", ha->name_string); in qla4xxx_show_boot_ini_info()
5792 rc = -ENOSYS; in qla4xxx_show_boot_ini_info()
5817 struct ql4_conn_info *boot_conn = &boot_sess->conn_list[0]; in qla4xxx_show_boot_tgt_info()
5823 rc = sprintf(buf, "%s\n", (char *)&boot_sess->target_name); in qla4xxx_show_boot_tgt_info()
5826 if (boot_sess->conn_list[0].dest_ipaddr.ip_type == 0x1) in qla4xxx_show_boot_tgt_info()
5828 &boot_conn->dest_ipaddr.ip_address); in qla4xxx_show_boot_tgt_info()
5831 &boot_conn->dest_ipaddr.ip_address); in qla4xxx_show_boot_tgt_info()
5834 rc = sprintf(str, "%d\n", boot_conn->dest_port); in qla4xxx_show_boot_tgt_info()
5838 boot_conn->chap.target_chap_name_length, in qla4xxx_show_boot_tgt_info()
5839 (char *)&boot_conn->chap.target_chap_name); in qla4xxx_show_boot_tgt_info()
5843 boot_conn->chap.target_secret_length, in qla4xxx_show_boot_tgt_info()
5844 (char *)&boot_conn->chap.target_secret); in qla4xxx_show_boot_tgt_info()
5848 boot_conn->chap.intr_chap_name_length, in qla4xxx_show_boot_tgt_info()
5849 (char *)&boot_conn->chap.intr_chap_name); in qla4xxx_show_boot_tgt_info()
5853 boot_conn->chap.intr_secret_length, in qla4xxx_show_boot_tgt_info()
5854 (char *)&boot_conn->chap.intr_secret); in qla4xxx_show_boot_tgt_info()
5863 rc = -ENOSYS; in qla4xxx_show_boot_tgt_info()
5872 struct ql4_boot_session_info *boot_sess = &(ha->boot_tgt.boot_pri_sess); in qla4xxx_show_boot_tgt_pri_info()
5880 struct ql4_boot_session_info *boot_sess = &(ha->boot_tgt.boot_sec_sess); in qla4xxx_show_boot_tgt_sec_info()
5912 scsi_host_put(ha->host); in qla4xxx_boot_release()
5926 func_num = PCI_FUNC(ha->pdev->devfn); in get_fw_boot_info()
5929 __func__, ha->pdev->device, func_num); in get_fw_boot_info()
5965 buf = dma_alloc_coherent(&ha->pdev->dev, size, in get_fw_boot_info()
5975 if (ha->port_num == 0) in get_fw_boot_info()
5977 else if (ha->port_num == 1) in get_fw_boot_info()
5983 addr = FLASH_RAW_ACCESS_ADDR + (ha->hw.flt_iscsi_param * 4) + in get_fw_boot_info()
5988 " failed\n", ha->host_no, __func__)); in get_fw_boot_info()
6017 dma_free_coherent(&ha->pdev->dev, size, buf, buf_dma); in get_fw_boot_info()
6019 ha->pri_ddb_idx = ddb_index[0]; in get_fw_boot_info()
6020 ha->sec_ddb_idx = ddb_index[1]; in get_fw_boot_info()
6025 * qla4xxx_get_bidi_chap - Get a BIDI CHAP user and password
6038 int i, ret = -EINVAL; in qla4xxx_get_bidi_chap()
6043 max_chap_entries = (ha->hw.flt_chap_size / 2) / in qla4xxx_get_bidi_chap()
6048 if (!ha->chap_list) { in qla4xxx_get_bidi_chap()
6053 mutex_lock(&ha->chap_sem); in qla4xxx_get_bidi_chap()
6055 chap_table = (struct ql4_chap_table *)ha->chap_list + i; in qla4xxx_get_bidi_chap()
6056 if (chap_table->cookie != in qla4xxx_get_bidi_chap()
6061 if (chap_table->flags & BIT_7) /* local */ in qla4xxx_get_bidi_chap()
6064 if (!(chap_table->flags & BIT_6)) /* Not BIDI */ in qla4xxx_get_bidi_chap()
6067 strscpy(password, chap_table->secret, QL4_CHAP_MAX_SECRET_LEN); in qla4xxx_get_bidi_chap()
6068 strscpy(username, chap_table->name, QL4_CHAP_MAX_NAME_LEN); in qla4xxx_get_bidi_chap()
6072 mutex_unlock(&ha->chap_sem); in qla4xxx_get_bidi_chap()
6082 struct ql4_conn_info *boot_conn = &boot_sess->conn_list[0]; in qla4xxx_get_boot_target()
6089 fw_ddb_entry = dma_alloc_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), in qla4xxx_get_boot_target()
6108 memcpy(boot_sess->target_name, fw_ddb_entry->iscsi_name, in qla4xxx_get_boot_target()
6109 min(sizeof(boot_sess->target_name), in qla4xxx_get_boot_target()
6110 sizeof(fw_ddb_entry->iscsi_name))); in qla4xxx_get_boot_target()
6112 options = le16_to_cpu(fw_ddb_entry->options); in qla4xxx_get_boot_target()
6114 memcpy(&boot_conn->dest_ipaddr.ip_address, in qla4xxx_get_boot_target()
6115 &fw_ddb_entry->ip_addr[0], IPv6_ADDR_LEN); in qla4xxx_get_boot_target()
6117 boot_conn->dest_ipaddr.ip_type = 0x1; in qla4xxx_get_boot_target()
6118 memcpy(&boot_conn->dest_ipaddr.ip_address, in qla4xxx_get_boot_target()
6119 &fw_ddb_entry->ip_addr[0], IP_ADDR_LEN); in qla4xxx_get_boot_target()
6122 boot_conn->dest_port = le16_to_cpu(fw_ddb_entry->port); in qla4xxx_get_boot_target()
6125 idx = __le16_to_cpu(fw_ddb_entry->chap_tbl_idx); in qla4xxx_get_boot_target()
6127 if (BIT_7 & le16_to_cpu(fw_ddb_entry->iscsi_options)) { in qla4xxx_get_boot_target()
6131 ret = qla4xxx_get_chap(ha, (char *)&boot_conn->chap. in qla4xxx_get_boot_target()
6133 (char *)&boot_conn->chap.target_secret, in qla4xxx_get_boot_target()
6141 boot_conn->chap.target_chap_name_length = QL4_CHAP_MAX_NAME_LEN; in qla4xxx_get_boot_target()
6142 boot_conn->chap.target_secret_length = QL4_CHAP_MAX_SECRET_LEN; in qla4xxx_get_boot_target()
6145 if (BIT_4 & le16_to_cpu(fw_ddb_entry->iscsi_options)) { in qla4xxx_get_boot_target()
6150 (char *)&boot_conn->chap.intr_chap_name, in qla4xxx_get_boot_target()
6151 (char *)&boot_conn->chap.intr_secret); in qla4xxx_get_boot_target()
6159 boot_conn->chap.intr_chap_name_length = QL4_CHAP_MAX_NAME_LEN; in qla4xxx_get_boot_target()
6160 boot_conn->chap.intr_secret_length = QL4_CHAP_MAX_SECRET_LEN; in qla4xxx_get_boot_target()
6164 dma_free_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), in qla4xxx_get_boot_target()
6191 rval = qla4xxx_get_boot_target(ha, &(ha->boot_tgt.boot_pri_sess), in qla4xxx_get_boot_info()
6203 rval = qla4xxx_get_boot_target(ha, &(ha->boot_tgt.boot_sec_sess), in qla4xxx_get_boot_info()
6224 "%s: syfsboot disabled - driver will trigger login " in qla4xxx_setup_boot_info()
6230 ha->boot_kset = iscsi_boot_create_host_kset(ha->host->host_no); in qla4xxx_setup_boot_info()
6231 if (!ha->boot_kset) in qla4xxx_setup_boot_info()
6234 if (!scsi_host_get(ha->host)) in qla4xxx_setup_boot_info()
6236 boot_kobj = iscsi_boot_create_target(ha->boot_kset, 0, ha, in qla4xxx_setup_boot_info()
6243 if (!scsi_host_get(ha->host)) in qla4xxx_setup_boot_info()
6245 boot_kobj = iscsi_boot_create_target(ha->boot_kset, 1, ha, in qla4xxx_setup_boot_info()
6252 if (!scsi_host_get(ha->host)) in qla4xxx_setup_boot_info()
6254 boot_kobj = iscsi_boot_create_initiator(ha->boot_kset, 0, ha, in qla4xxx_setup_boot_info()
6261 if (!scsi_host_get(ha->host)) in qla4xxx_setup_boot_info()
6263 boot_kobj = iscsi_boot_create_ethernet(ha->boot_kset, 0, ha, in qla4xxx_setup_boot_info()
6273 scsi_host_put(ha->host); in qla4xxx_setup_boot_info()
6275 iscsi_boot_destroy_kset(ha->boot_kset); in qla4xxx_setup_boot_info()
6276 return -ENOMEM; in qla4xxx_setup_boot_info()
6289 cls_sess = ddb_entry->sess; in qla4xxx_get_param_ddb()
6290 sess = cls_sess->dd_data; in qla4xxx_get_param_ddb()
6291 cls_conn = ddb_entry->conn; in qla4xxx_get_param_ddb()
6292 conn = cls_conn->dd_data; in qla4xxx_get_param_ddb()
6294 tddb->tpgt = sess->tpgt; in qla4xxx_get_param_ddb()
6295 tddb->port = conn->persistent_port; in qla4xxx_get_param_ddb()
6296 strscpy(tddb->iscsi_name, sess->targetname, sizeof(tddb->iscsi_name)); in qla4xxx_get_param_ddb()
6297 strscpy(tddb->ip_addr, conn->persistent_address, sizeof(tddb->ip_addr)); in qla4xxx_get_param_ddb()
6306 tddb->tpgt = le32_to_cpu(fw_ddb_entry->tgt_portal_grp); in qla4xxx_convert_param_ddb()
6307 memcpy(&tddb->iscsi_name[0], &fw_ddb_entry->iscsi_name[0], in qla4xxx_convert_param_ddb()
6308 min(sizeof(tddb->iscsi_name), sizeof(fw_ddb_entry->iscsi_name))); in qla4xxx_convert_param_ddb()
6310 options = le16_to_cpu(fw_ddb_entry->options); in qla4xxx_convert_param_ddb()
6312 sprintf(tddb->ip_addr, "%pI6", fw_ddb_entry->ip_addr); in qla4xxx_convert_param_ddb()
6314 sprintf(tddb->ip_addr, "%pI4", fw_ddb_entry->ip_addr); in qla4xxx_convert_param_ddb()
6316 tddb->port = le16_to_cpu(fw_ddb_entry->port); in qla4xxx_convert_param_ddb()
6319 memcpy(&tddb->isid[0], &fw_ddb_entry->isid[0], in qla4xxx_convert_param_ddb()
6320 sizeof(tddb->isid)); in qla4xxx_convert_param_ddb()
6322 memcpy(&tddb->isid[0], &flash_isid[0], sizeof(tddb->isid)); in qla4xxx_convert_param_ddb()
6330 if (strcmp(old_tddb->iscsi_name, new_tddb->iscsi_name)) in qla4xxx_compare_tuple_ddb()
6333 if (strcmp(old_tddb->ip_addr, new_tddb->ip_addr)) in qla4xxx_compare_tuple_ddb()
6336 if (old_tddb->port != new_tddb->port) in qla4xxx_compare_tuple_ddb()
6348 __func__, old_tddb->isid, new_tddb->isid)); in qla4xxx_compare_tuple_ddb()
6350 if (memcmp(&old_tddb->isid[0], &new_tddb->isid[0], in qla4xxx_compare_tuple_ddb()
6351 sizeof(old_tddb->isid))) in qla4xxx_compare_tuple_ddb()
6357 old_tddb->port, old_tddb->tpgt, old_tddb->ip_addr, in qla4xxx_compare_tuple_ddb()
6358 old_tddb->iscsi_name, new_tddb->port, new_tddb->tpgt, in qla4xxx_compare_tuple_ddb()
6359 new_tddb->ip_addr, new_tddb->iscsi_name)); in qla4xxx_compare_tuple_ddb()
6413 * qla4xxx_check_existing_isid - check if target with same isid exist
6426 fw_ddb_entry = &nt_ddb_idx->fw_ddb; in qla4xxx_check_existing_isid()
6428 if (memcmp(&fw_ddb_entry->isid[0], &isid[0], in qla4xxx_check_existing_isid()
6429 sizeof(nt_ddb_idx->fw_ddb.isid)) == 0) { in qla4xxx_check_existing_isid()
6437 * qla4xxx_update_isid - compare ddbs and updated isid
6452 base_value = fw_ddb_entry->isid[1] & 0x1f; in qla4xxx_update_isid()
6454 fw_ddb_entry->isid[1] = (base_value | (i << 5)); in qla4xxx_update_isid()
6455 if (qla4xxx_check_existing_isid(list_nt, fw_ddb_entry->isid)) in qla4xxx_update_isid()
6459 if (!qla4xxx_check_existing_isid(list_nt, fw_ddb_entry->isid)) in qla4xxx_update_isid()
6466 * qla4xxx_should_update_isid - check if isid need to update
6478 if (strcmp(old_tddb->ip_addr, new_tddb->ip_addr) == 0) { in qla4xxx_should_update_isid()
6480 if (old_tddb->port == new_tddb->port) in qla4xxx_should_update_isid()
6484 if (strcmp(old_tddb->iscsi_name, new_tddb->iscsi_name)) in qla4xxx_should_update_isid()
6488 if (memcmp(&old_tddb->isid[0], &new_tddb->isid[0], in qla4xxx_should_update_isid()
6489 sizeof(old_tddb->isid))) in qla4xxx_should_update_isid()
6497 * qla4xxx_is_flash_ddb_exists - check if fw_ddb_entry already exists in list_nt
6536 qla4xxx_convert_param_ddb(&nt_ddb_idx->fw_ddb, tmp_tddb, in qla4xxx_is_flash_ddb_exists()
6537 nt_ddb_idx->flash_isid); in qla4xxx_is_flash_ddb_exists()
6545 qla4xxx_convert_param_ddb(&nt_ddb_idx->fw_ddb, tmp_tddb, NULL); in qla4xxx_is_flash_ddb_exists()
6570 list_del_init(&ddb_idx->list); in qla4xxx_free_ddb_list()
6590 if (fw_ddb_entry->options & DDB_OPT_IPV6_DEVICE) { in qla4xxx_get_ep_fwdb()
6592 t_addr->sa_family = AF_INET6; in qla4xxx_get_ep_fwdb()
6594 ip = (char *)&addr6->sin6_addr; in qla4xxx_get_ep_fwdb()
6595 memcpy(ip, fw_ddb_entry->ip_addr, IPv6_ADDR_LEN); in qla4xxx_get_ep_fwdb()
6596 addr6->sin6_port = htons(le16_to_cpu(fw_ddb_entry->port)); in qla4xxx_get_ep_fwdb()
6600 t_addr->sa_family = AF_INET; in qla4xxx_get_ep_fwdb()
6602 ip = (char *)&addr->sin_addr; in qla4xxx_get_ep_fwdb()
6603 memcpy(ip, fw_ddb_entry->ip_addr, IP_ADDR_LEN); in qla4xxx_get_ep_fwdb()
6604 addr->sin_port = htons(le16_to_cpu(fw_ddb_entry->port)); in qla4xxx_get_ep_fwdb()
6607 ep = qla4xxx_ep_connect(ha->host, (struct sockaddr *)dst_addr, 0); in qla4xxx_get_ep_fwdb()
6616 if (idx == ha->pri_ddb_idx || idx == ha->sec_ddb_idx) in qla4xxx_verify_boot_idx()
6627 ddb_entry->ddb_type = FLASH_DDB; in qla4xxx_setup_flash_ddb_entry()
6628 ddb_entry->fw_ddb_index = INVALID_ENTRY; in qla4xxx_setup_flash_ddb_entry()
6629 ddb_entry->fw_ddb_device_state = DDB_DS_NO_CONNECTION_ACTIVE; in qla4xxx_setup_flash_ddb_entry()
6630 ddb_entry->ha = ha; in qla4xxx_setup_flash_ddb_entry()
6631 ddb_entry->unblock_sess = qla4xxx_unblock_flash_ddb; in qla4xxx_setup_flash_ddb_entry()
6632 ddb_entry->ddb_change = qla4xxx_flash_ddb_change; in qla4xxx_setup_flash_ddb_entry()
6633 ddb_entry->chap_tbl_idx = INVALID_ENTRY; in qla4xxx_setup_flash_ddb_entry()
6635 atomic_set(&ddb_entry->retry_relogin_timer, INVALID_ENTRY); in qla4xxx_setup_flash_ddb_entry()
6636 atomic_set(&ddb_entry->relogin_timer, 0); in qla4xxx_setup_flash_ddb_entry()
6637 atomic_set(&ddb_entry->relogin_retry_count, 0); in qla4xxx_setup_flash_ddb_entry()
6638 def_timeout = le16_to_cpu(ddb_entry->fw_ddb_entry.def_timeout); in qla4xxx_setup_flash_ddb_entry()
6639 ddb_entry->default_relogin_timeout = in qla4xxx_setup_flash_ddb_entry()
6642 ddb_entry->default_time2wait = in qla4xxx_setup_flash_ddb_entry()
6643 le16_to_cpu(ddb_entry->fw_ddb_entry.iscsi_def_time2wait); in qla4xxx_setup_flash_ddb_entry()
6646 (idx == ha->pri_ddb_idx || idx == ha->sec_ddb_idx)) in qla4xxx_setup_flash_ddb_entry()
6647 set_bit(DF_BOOT_TGT, &ddb_entry->flags); in qla4xxx_setup_flash_ddb_entry()
6662 if (ip_idx[idx] == -1) in qla4xxx_wait_for_ip_configuration()
6668 ip_idx[idx] = -1; in qla4xxx_wait_for_ip_configuration()
6682 ip_idx[idx] = -1; in qla4xxx_wait_for_ip_configuration()
6686 if ((ip_idx[0] == -1) && in qla4xxx_wait_for_ip_configuration()
6687 (ip_idx[1] == -1) && in qla4xxx_wait_for_ip_configuration()
6688 (ip_idx[2] == -1) && in qla4xxx_wait_for_ip_configuration()
6689 (ip_idx[3] == -1)) in qla4xxx_wait_for_ip_configuration()
6701 options = le16_to_cpu(fw_ddb_entry->options); in qla4xxx_cmp_fw_stentry()
6705 if (memcmp(fw_ddb_entry->ip_addr, flash_ddb_entry->ip_addr, ip_len)) in qla4xxx_cmp_fw_stentry()
6708 if (memcmp(&fw_ddb_entry->isid[0], &flash_ddb_entry->isid[0], in qla4xxx_cmp_fw_stentry()
6709 sizeof(fw_ddb_entry->isid))) in qla4xxx_cmp_fw_stentry()
6712 if (memcmp(&fw_ddb_entry->port, &flash_ddb_entry->port, in qla4xxx_cmp_fw_stentry()
6713 sizeof(fw_ddb_entry->port))) in qla4xxx_cmp_fw_stentry()
6732 flash_ddb_entry = dma_pool_alloc(ha->fw_ddb_dma_pool, GFP_KERNEL, in qla4xxx_find_flash_st_idx()
6770 dma_pool_free(ha->fw_ddb_dma_pool, flash_ddb_entry, in qla4xxx_find_flash_st_idx()
6787 uint32_t flash_index = -1; in qla4xxx_build_st_list()
6790 fw_ddb_entry = dma_pool_alloc(ha->fw_ddb_dma_pool, GFP_KERNEL, in qla4xxx_build_st_list()
6813 if (strlen((char *) fw_ddb_entry->iscsi_name) != 0) in qla4xxx_build_st_list()
6825 st_ddb_idx->flash_ddb_idx = idx; in qla4xxx_build_st_list()
6830 st_ddb_idx->flash_ddb_idx = flash_index; in qla4xxx_build_st_list()
6833 st_ddb_idx->fw_ddb_idx = idx; in qla4xxx_build_st_list()
6835 list_add_tail(&st_ddb_idx->list, list_st); in qla4xxx_build_st_list()
6843 dma_pool_free(ha->fw_ddb_dma_pool, fw_ddb_entry, fw_ddb_dma); in qla4xxx_build_st_list()
6847 * qla4xxx_remove_failed_ddb - Remove inactive or failed ddb from list
6863 ret = qla4xxx_get_fwddb_entry(ha, ddb_idx->fw_ddb_idx, in qla4xxx_remove_failed_ddb()
6871 list_del_init(&ddb_idx->list); in qla4xxx_remove_failed_ddb()
6884 uint16_t ddb_link = -1; in qla4xxx_update_sess_disc_idx()
6889 cls_sess = ddb_entry->sess; in qla4xxx_update_sess_disc_idx()
6890 sess = cls_sess->dd_data; in qla4xxx_update_sess_disc_idx()
6892 ddb_link = le16_to_cpu(fw_ddb_entry->ddb_link); in qla4xxx_update_sess_disc_idx()
6894 sess->discovery_parent_idx = ddb_link; in qla4xxx_update_sess_disc_idx()
6896 sess->discovery_parent_idx = DDB_NO_LINK; in qla4xxx_update_sess_disc_idx()
6917 cls_sess = iscsi_session_setup(&qla4xxx_iscsi_transport, ha->host, in qla4xxx_sess_conn_setup()
6931 sess = cls_sess->dd_data; in qla4xxx_sess_conn_setup()
6932 ddb_entry = sess->dd_data; in qla4xxx_sess_conn_setup()
6933 ddb_entry->sess = cls_sess; in qla4xxx_sess_conn_setup()
6935 cls_sess->recovery_tmo = ql4xsess_recovery_tmo; in qla4xxx_sess_conn_setup()
6936 memcpy(&ddb_entry->fw_ddb_entry, fw_ddb_entry, in qla4xxx_sess_conn_setup()
6948 ddb_entry->conn = cls_conn; in qla4xxx_sess_conn_setup()
6953 ep->conn = cls_conn; in qla4xxx_sess_conn_setup()
6954 cls_conn->ep = ep; in qla4xxx_sess_conn_setup()
6968 * by short-circuiting the logic of setting in qla4xxx_sess_conn_setup()
6969 * timer to relogin - instead set the flags in qla4xxx_sess_conn_setup()
6972 set_bit(DPC_RELOGIN_DEVICE, &ha->dpc_flags); in qla4xxx_sess_conn_setup()
6973 set_bit(DF_RELOGIN, &ddb_entry->flags); in qla4xxx_sess_conn_setup()
6987 ddb_link = le16_to_cpu(fw_ddb_entry->ddb_link); in qla4xxx_update_fw_ddb_link()
6990 if (ddb_idx->fw_ddb_idx == ddb_link) { in qla4xxx_update_fw_ddb_link()
6993 ddb_link, ddb_idx->flash_ddb_idx)); in qla4xxx_update_fw_ddb_link()
6994 fw_ddb_entry->ddb_link = in qla4xxx_update_fw_ddb_link()
6995 cpu_to_le16(ddb_idx->flash_ddb_idx); in qla4xxx_update_fw_ddb_link()
7014 uint32_t ddb_idx = -1; in qla4xxx_build_nt_list()
7016 uint16_t ddb_link = -1; in qla4xxx_build_nt_list()
7019 fw_ddb_entry = dma_pool_alloc(ha->fw_ddb_dma_pool, GFP_KERNEL, in qla4xxx_build_nt_list()
7040 if (strlen((char *) fw_ddb_entry->iscsi_name) == 0) in qla4xxx_build_nt_list()
7043 ddb_link = le16_to_cpu(fw_ddb_entry->ddb_link); in qla4xxx_build_nt_list()
7060 nt_ddb_idx->fw_ddb_idx = idx; in qla4xxx_build_nt_list()
7066 memcpy(&nt_ddb_idx->flash_isid[0], in qla4xxx_build_nt_list()
7067 &fw_ddb_entry->isid[0], in qla4xxx_build_nt_list()
7068 sizeof(nt_ddb_idx->flash_isid)); in qla4xxx_build_nt_list()
7079 memcpy(&nt_ddb_idx->fw_ddb, fw_ddb_entry, in qla4xxx_build_nt_list()
7082 list_add_tail(&nt_ddb_idx->list, list_nt); in qla4xxx_build_nt_list()
7108 dma_pool_free(ha->fw_ddb_dma_pool, fw_ddb_entry, fw_ddb_dma); in qla4xxx_build_nt_list()
7125 fw_ddb_entry = dma_pool_alloc(ha->fw_ddb_dma_pool, GFP_KERNEL, in qla4xxx_build_new_nt_list()
7143 if (strlen((char *)fw_ddb_entry->iscsi_name) == 0) in qla4xxx_build_new_nt_list()
7156 nt_ddb_idx->fw_ddb_idx = idx; in qla4xxx_build_new_nt_list()
7166 fw_ddb_entry->ddb_link = cpu_to_le16(target_id); in qla4xxx_build_new_nt_list()
7168 list_add_tail(&nt_ddb_idx->list, list_nt); in qla4xxx_build_new_nt_list()
7182 dma_pool_free(ha->fw_ddb_dma_pool, fw_ddb_entry, fw_ddb_dma); in qla4xxx_build_new_nt_list()
7186 * qla4xxx_sysfs_ddb_is_non_persistent - check for non-persistence of ddb entry
7191 * 1: if flashnode entry is non-persistent
7204 return (fnode_sess->flash_state == DEV_DB_NON_PERSISTENT); in qla4xxx_sysfs_ddb_is_non_persistent()
7208 * qla4xxx_sysfs_ddb_tgt_create - Create sysfs entry for target
7231 fnode_sess = iscsi_create_flashnode_sess(ha->host, *idx, in qla4xxx_sysfs_ddb_tgt_create()
7236 __func__, *idx, ha->host_no); in qla4xxx_sysfs_ddb_tgt_create()
7240 fnode_conn = iscsi_create_flashnode_conn(ha->host, fnode_sess, in qla4xxx_sysfs_ddb_tgt_create()
7245 __func__, *idx, ha->host_no); in qla4xxx_sysfs_ddb_tgt_create()
7250 fnode_sess->flash_state = DEV_DB_NON_PERSISTENT; in qla4xxx_sysfs_ddb_tgt_create()
7252 fnode_sess->flash_state = DEV_DB_PERSISTENT; in qla4xxx_sysfs_ddb_tgt_create()
7254 if (*idx == ha->pri_ddb_idx || *idx == ha->sec_ddb_idx) in qla4xxx_sysfs_ddb_tgt_create()
7255 fnode_sess->is_boot_target = 1; in qla4xxx_sysfs_ddb_tgt_create()
7257 fnode_sess->is_boot_target = 0; in qla4xxx_sysfs_ddb_tgt_create()
7266 __func__, fnode_sess->dev.kobj.name); in qla4xxx_sysfs_ddb_tgt_create()
7269 __func__, fnode_conn->dev.kobj.name); in qla4xxx_sysfs_ddb_tgt_create()
7281 * qla4xxx_sysfs_ddb_add - Add new ddb entry in flash
7311 fw_ddb_entry = dma_alloc_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), in qla4xxx_sysfs_ddb_add()
7320 dev = iscsi_find_flashnode_sess(ha->host, NULL, in qla4xxx_sysfs_ddb_add()
7324 "%s: A non-persistent entry %s found\n", in qla4xxx_sysfs_ddb_add()
7325 __func__, dev->kobj.name); in qla4xxx_sysfs_ddb_add()
7351 dma_free_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), in qla4xxx_sysfs_ddb_add()
7356 return -EIO; in qla4xxx_sysfs_ddb_add()
7360 * qla4xxx_sysfs_ddb_apply - write the target ddb contents to Flash
7378 fw_ddb_entry = dma_alloc_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), in qla4xxx_sysfs_ddb_apply()
7384 rval = -ENOMEM; in qla4xxx_sysfs_ddb_apply()
7388 if (!strncasecmp(fnode_sess->portal_type, PORTAL_TYPE_IPV6, 4)) in qla4xxx_sysfs_ddb_apply()
7395 dev_db_start_offset += (fnode_sess->target_id * in qla4xxx_sysfs_ddb_apply()
7399 fw_ddb_entry->cookie = DDB_VALID_COOKIE; in qla4xxx_sysfs_ddb_apply()
7405 fnode_sess->flash_state = DEV_DB_PERSISTENT; in qla4xxx_sysfs_ddb_apply()
7408 __func__, fnode_sess->target_id, ha->host_no); in qla4xxx_sysfs_ddb_apply()
7410 rval = -EIO; in qla4xxx_sysfs_ddb_apply()
7413 __func__, fnode_sess->target_id, ha->host_no); in qla4xxx_sysfs_ddb_apply()
7418 dma_free_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), in qla4xxx_sysfs_ddb_apply()
7435 ddb_entry = dma_alloc_coherent(&ha->pdev->dev, sizeof(*ddb_entry), in qla4xxx_sysfs_ddb_conn_open()
7457 tmo = ((ha->def_timeout > LOGIN_TOV) && in qla4xxx_sysfs_ddb_conn_open()
7458 (ha->def_timeout < LOGIN_TOV * 10) ? in qla4xxx_sysfs_ddb_conn_open()
7459 ha->def_timeout : LOGIN_TOV); in qla4xxx_sysfs_ddb_conn_open()
7481 dma_free_coherent(&ha->pdev->dev, sizeof(*ddb_entry), in qla4xxx_sysfs_ddb_conn_open()
7495 if (test_bit(AF_ST_DISCOVERY_IN_PROGRESS, &ha->flags)) { in qla4xxx_ddb_login_st()
7503 set_bit(AF_ST_DISCOVERY_IN_PROGRESS, &ha->flags); in qla4xxx_ddb_login_st()
7516 list_del_init(&ddb_idx->list); in qla4xxx_ddb_login_st()
7517 qla4xxx_clear_ddb_entry(ha, ddb_idx->fw_ddb_idx); in qla4xxx_ddb_login_st()
7527 clear_bit(ddb_index, ha->ddb_idx_map); in qla4xxx_ddb_login_st()
7530 clear_bit(AF_ST_DISCOVERY_IN_PROGRESS, &ha->flags); in qla4xxx_ddb_login_st()
7545 ret = -EPERM; in qla4xxx_ddb_login_nt()
7551 * qla4xxx_sysfs_ddb_login - Login to the specified target
7567 if (fnode_sess->flash_state == DEV_DB_NON_PERSISTENT) { in qla4xxx_sysfs_ddb_login()
7570 ret = -EIO; in qla4xxx_sysfs_ddb_login()
7574 fw_ddb_entry = dma_alloc_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), in qla4xxx_sysfs_ddb_login()
7580 ret = -ENOMEM; in qla4xxx_sysfs_ddb_login()
7584 if (!strncasecmp(fnode_sess->portal_type, PORTAL_TYPE_IPV6, 4)) in qla4xxx_sysfs_ddb_login()
7592 fw_ddb_entry->cookie = DDB_VALID_COOKIE; in qla4xxx_sysfs_ddb_login()
7594 if (strlen((char *)fw_ddb_entry->iscsi_name) == 0) in qla4xxx_sysfs_ddb_login()
7596 fnode_sess->target_id); in qla4xxx_sysfs_ddb_login()
7599 fnode_sess->target_id); in qla4xxx_sysfs_ddb_login()
7602 ret = -EIO; in qla4xxx_sysfs_ddb_login()
7606 dma_free_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), in qla4xxx_sysfs_ddb_login()
7612 * qla4xxx_sysfs_ddb_logout_sid - Logout session for the specified target
7630 sess = cls_sess->dd_data; in qla4xxx_sysfs_ddb_logout_sid()
7631 ddb_entry = sess->dd_data; in qla4xxx_sysfs_ddb_logout_sid()
7632 ha = ddb_entry->ha; in qla4xxx_sysfs_ddb_logout_sid()
7634 if (ddb_entry->ddb_type != FLASH_DDB) { in qla4xxx_sysfs_ddb_logout_sid()
7637 ret = -ENXIO; in qla4xxx_sysfs_ddb_logout_sid()
7641 if (test_bit(DF_BOOT_TGT, &ddb_entry->flags)) { in qla4xxx_sysfs_ddb_logout_sid()
7645 ret = -EPERM; in qla4xxx_sysfs_ddb_logout_sid()
7649 fw_ddb_entry = dma_alloc_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), in qla4xxx_sysfs_ddb_logout_sid()
7654 ret = -ENOMEM; in qla4xxx_sysfs_ddb_logout_sid()
7658 if (test_and_set_bit(DF_DISABLE_RELOGIN, &ddb_entry->flags)) in qla4xxx_sysfs_ddb_logout_sid()
7661 ret = qla4xxx_get_fwddb_entry(ha, ddb_entry->fw_ddb_index, in qla4xxx_sysfs_ddb_logout_sid()
7676 if (test_and_clear_bit(DF_RELOGIN, &ddb_entry->flags)) in qla4xxx_sysfs_ddb_logout_sid()
7683 atomic_set(&ddb_entry->retry_relogin_timer, INVALID_ENTRY); in qla4xxx_sysfs_ddb_logout_sid()
7684 atomic_set(&ddb_entry->relogin_timer, 0); in qla4xxx_sysfs_ddb_logout_sid()
7692 ret = qla4xxx_get_fwddb_entry(ha, ddb_entry->fw_ddb_index, in qla4xxx_sysfs_ddb_logout_sid()
7707 qla4xxx_clear_ddb_entry(ha, ddb_entry->fw_ddb_index); in qla4xxx_sysfs_ddb_logout_sid()
7715 iscsi_destroy_endpoint(ddb_entry->conn->ep); in qla4xxx_sysfs_ddb_logout_sid()
7717 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_sysfs_ddb_logout_sid()
7719 clear_bit(ddb_entry->fw_ddb_index, ha->ddb_idx_map); in qla4xxx_sysfs_ddb_logout_sid()
7720 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_sysfs_ddb_logout_sid()
7722 iscsi_session_teardown(ddb_entry->sess); in qla4xxx_sysfs_ddb_logout_sid()
7724 clear_bit(DF_DISABLE_RELOGIN, &ddb_entry->flags); in qla4xxx_sysfs_ddb_logout_sid()
7729 dma_free_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), in qla4xxx_sysfs_ddb_logout_sid()
7735 * qla4xxx_sysfs_ddb_logout - Logout from the specified target
7757 fw_ddb_entry = dma_pool_alloc(ha->fw_ddb_dma_pool, GFP_KERNEL, in qla4xxx_sysfs_ddb_logout()
7761 ret = -ENOMEM; in qla4xxx_sysfs_ddb_logout()
7769 ret = -ENOMEM; in qla4xxx_sysfs_ddb_logout()
7777 ret = -ENOMEM; in qla4xxx_sysfs_ddb_logout()
7781 if (!fnode_sess->targetname) { in qla4xxx_sysfs_ddb_logout()
7785 ret = -EPERM; in qla4xxx_sysfs_ddb_logout()
7789 if (fnode_sess->is_boot_target) { in qla4xxx_sysfs_ddb_logout()
7793 ret = -EPERM; in qla4xxx_sysfs_ddb_logout()
7797 strscpy(flash_tddb->iscsi_name, fnode_sess->targetname, in qla4xxx_sysfs_ddb_logout()
7798 sizeof(flash_tddb->iscsi_name)); in qla4xxx_sysfs_ddb_logout()
7800 if (!strncmp(fnode_sess->portal_type, PORTAL_TYPE_IPV6, 4)) in qla4xxx_sysfs_ddb_logout()
7801 sprintf(flash_tddb->ip_addr, "%pI6", fnode_conn->ipaddress); in qla4xxx_sysfs_ddb_logout()
7803 sprintf(flash_tddb->ip_addr, "%pI4", fnode_conn->ipaddress); in qla4xxx_sysfs_ddb_logout()
7805 flash_tddb->tpgt = fnode_sess->tpgt; in qla4xxx_sysfs_ddb_logout()
7806 flash_tddb->port = fnode_conn->port; in qla4xxx_sysfs_ddb_logout()
7808 COPY_ISID(flash_tddb->isid, fnode_sess->isid); in qla4xxx_sysfs_ddb_logout()
7815 if (ddb_entry->ddb_type != FLASH_DDB) in qla4xxx_sysfs_ddb_logout()
7818 index = ddb_entry->sess->target_id; in qla4xxx_sysfs_ddb_logout()
7824 ret = -ENOMEM; in qla4xxx_sysfs_ddb_logout()
7833 ret = qla4xxx_sysfs_ddb_logout_sid(ddb_entry->sess); in qla4xxx_sysfs_ddb_logout()
7839 ret = -ESRCH; in qla4xxx_sysfs_ddb_logout()
7845 dma_pool_free(ha->fw_ddb_dma_pool, fw_ddb_entry, fw_ddb_dma); in qla4xxx_sysfs_ddb_logout()
7864 return -EIO; in qla4xxx_sysfs_ddb_get_param()
7870 rc = sprintf(buf, "%u\n", fnode_conn->is_fw_assigned_ipv6); in qla4xxx_sysfs_ddb_get_param()
7873 rc = sprintf(buf, "%s\n", fnode_sess->portal_type); in qla4xxx_sysfs_ddb_get_param()
7876 rc = sprintf(buf, "%u\n", fnode_sess->auto_snd_tgt_disable); in qla4xxx_sysfs_ddb_get_param()
7879 rc = sprintf(buf, "%u\n", fnode_sess->discovery_sess); in qla4xxx_sysfs_ddb_get_param()
7882 rc = sprintf(buf, "%u\n", fnode_sess->entry_state); in qla4xxx_sysfs_ddb_get_param()
7885 rc = sprintf(buf, "%u\n", fnode_conn->hdrdgst_en); in qla4xxx_sysfs_ddb_get_param()
7888 rc = sprintf(buf, "%u\n", fnode_conn->datadgst_en); in qla4xxx_sysfs_ddb_get_param()
7891 rc = sprintf(buf, "%u\n", fnode_sess->imm_data_en); in qla4xxx_sysfs_ddb_get_param()
7894 rc = sprintf(buf, "%u\n", fnode_sess->initial_r2t_en); in qla4xxx_sysfs_ddb_get_param()
7897 rc = sprintf(buf, "%u\n", fnode_sess->dataseq_inorder_en); in qla4xxx_sysfs_ddb_get_param()
7900 rc = sprintf(buf, "%u\n", fnode_sess->pdu_inorder_en); in qla4xxx_sysfs_ddb_get_param()
7903 rc = sprintf(buf, "%u\n", fnode_sess->chap_auth_en); in qla4xxx_sysfs_ddb_get_param()
7906 rc = sprintf(buf, "%u\n", fnode_conn->snack_req_en); in qla4xxx_sysfs_ddb_get_param()
7909 rc = sprintf(buf, "%u\n", fnode_sess->discovery_logout_en); in qla4xxx_sysfs_ddb_get_param()
7912 rc = sprintf(buf, "%u\n", fnode_sess->bidi_chap_en); in qla4xxx_sysfs_ddb_get_param()
7915 rc = sprintf(buf, "%u\n", fnode_sess->discovery_auth_optional); in qla4xxx_sysfs_ddb_get_param()
7918 rc = sprintf(buf, "%u\n", fnode_sess->erl); in qla4xxx_sysfs_ddb_get_param()
7921 rc = sprintf(buf, "%u\n", fnode_conn->tcp_timestamp_stat); in qla4xxx_sysfs_ddb_get_param()
7924 rc = sprintf(buf, "%u\n", fnode_conn->tcp_nagle_disable); in qla4xxx_sysfs_ddb_get_param()
7927 rc = sprintf(buf, "%u\n", fnode_conn->tcp_wsf_disable); in qla4xxx_sysfs_ddb_get_param()
7930 rc = sprintf(buf, "%u\n", fnode_conn->tcp_timer_scale); in qla4xxx_sysfs_ddb_get_param()
7933 rc = sprintf(buf, "%u\n", fnode_conn->tcp_timestamp_en); in qla4xxx_sysfs_ddb_get_param()
7936 rc = sprintf(buf, "%u\n", fnode_conn->fragment_disable); in qla4xxx_sysfs_ddb_get_param()
7939 rc = sprintf(buf, "%u\n", fnode_conn->max_recv_dlength); in qla4xxx_sysfs_ddb_get_param()
7942 rc = sprintf(buf, "%u\n", fnode_conn->max_xmit_dlength); in qla4xxx_sysfs_ddb_get_param()
7945 rc = sprintf(buf, "%u\n", fnode_sess->first_burst); in qla4xxx_sysfs_ddb_get_param()
7948 rc = sprintf(buf, "%u\n", fnode_sess->time2wait); in qla4xxx_sysfs_ddb_get_param()
7951 rc = sprintf(buf, "%u\n", fnode_sess->time2retain); in qla4xxx_sysfs_ddb_get_param()
7954 rc = sprintf(buf, "%u\n", fnode_sess->max_r2t); in qla4xxx_sysfs_ddb_get_param()
7957 rc = sprintf(buf, "%u\n", fnode_conn->keepalive_timeout); in qla4xxx_sysfs_ddb_get_param()
7960 rc = sprintf(buf, "%pm\n", fnode_sess->isid); in qla4xxx_sysfs_ddb_get_param()
7963 rc = sprintf(buf, "%u\n", fnode_sess->tsid); in qla4xxx_sysfs_ddb_get_param()
7966 rc = sprintf(buf, "%d\n", fnode_conn->port); in qla4xxx_sysfs_ddb_get_param()
7969 rc = sprintf(buf, "%u\n", fnode_sess->max_burst); in qla4xxx_sysfs_ddb_get_param()
7973 fnode_sess->default_taskmgmt_timeout); in qla4xxx_sysfs_ddb_get_param()
7976 if (!strncmp(fnode_sess->portal_type, PORTAL_TYPE_IPV6, 4)) in qla4xxx_sysfs_ddb_get_param()
7977 rc = sprintf(buf, "%pI6\n", fnode_conn->ipaddress); in qla4xxx_sysfs_ddb_get_param()
7979 rc = sprintf(buf, "%pI4\n", fnode_conn->ipaddress); in qla4xxx_sysfs_ddb_get_param()
7982 if (fnode_sess->targetalias) in qla4xxx_sysfs_ddb_get_param()
7983 rc = sprintf(buf, "%s\n", fnode_sess->targetalias); in qla4xxx_sysfs_ddb_get_param()
7988 if (!strncmp(fnode_sess->portal_type, PORTAL_TYPE_IPV6, 4)) in qla4xxx_sysfs_ddb_get_param()
7990 fnode_conn->redirect_ipaddr); in qla4xxx_sysfs_ddb_get_param()
7993 fnode_conn->redirect_ipaddr); in qla4xxx_sysfs_ddb_get_param()
7996 rc = sprintf(buf, "%u\n", fnode_conn->max_segment_size); in qla4xxx_sysfs_ddb_get_param()
7999 rc = sprintf(buf, "%u\n", fnode_conn->local_port); in qla4xxx_sysfs_ddb_get_param()
8002 rc = sprintf(buf, "%u\n", fnode_conn->ipv4_tos); in qla4xxx_sysfs_ddb_get_param()
8005 if (!strncmp(fnode_sess->portal_type, PORTAL_TYPE_IPV6, 4)) in qla4xxx_sysfs_ddb_get_param()
8007 fnode_conn->ipv6_traffic_class); in qla4xxx_sysfs_ddb_get_param()
8012 rc = sprintf(buf, "%u\n", fnode_conn->ipv6_flow_label); in qla4xxx_sysfs_ddb_get_param()
8015 if (!strncmp(fnode_sess->portal_type, PORTAL_TYPE_IPV6, 4)) in qla4xxx_sysfs_ddb_get_param()
8017 fnode_conn->link_local_ipv6_addr); in qla4xxx_sysfs_ddb_get_param()
8022 rc = sprintf(buf, "%u\n", fnode_sess->discovery_parent_idx); in qla4xxx_sysfs_ddb_get_param()
8025 if (fnode_sess->discovery_parent_type == DDB_ISNS) in qla4xxx_sysfs_ddb_get_param()
8027 else if (fnode_sess->discovery_parent_type == DDB_NO_LINK) in qla4xxx_sysfs_ddb_get_param()
8029 else if (fnode_sess->discovery_parent_type < MAX_DDB_ENTRIES) in qla4xxx_sysfs_ddb_get_param()
8038 if (fnode_sess->targetname) in qla4xxx_sysfs_ddb_get_param()
8039 rc = sprintf(buf, "%s\n", fnode_sess->targetname); in qla4xxx_sysfs_ddb_get_param()
8044 rc = sprintf(buf, "%u\n", fnode_sess->tpgt); in qla4xxx_sysfs_ddb_get_param()
8047 rc = sprintf(buf, "%u\n", fnode_conn->tcp_xmit_wsf); in qla4xxx_sysfs_ddb_get_param()
8050 rc = sprintf(buf, "%u\n", fnode_conn->tcp_recv_wsf); in qla4xxx_sysfs_ddb_get_param()
8053 rc = sprintf(buf, "%u\n", fnode_sess->chap_out_idx); in qla4xxx_sysfs_ddb_get_param()
8056 if (fnode_sess->chap_auth_en) { in qla4xxx_sysfs_ddb_get_param()
8060 fnode_sess->chap_out_idx); in qla4xxx_sysfs_ddb_get_param()
8067 if (fnode_sess->chap_auth_en) { in qla4xxx_sysfs_ddb_get_param()
8071 fnode_sess->chap_out_idx); in qla4xxx_sysfs_ddb_get_param()
8078 rc = sprintf(buf, "%u\n", fnode_conn->statsn); in qla4xxx_sysfs_ddb_get_param()
8081 rc = sprintf(buf, "%u\n", fnode_conn->exp_statsn); in qla4xxx_sysfs_ddb_get_param()
8084 rc = sprintf(buf, "%u\n", fnode_sess->is_boot_target); in qla4xxx_sysfs_ddb_get_param()
8087 rc = -ENOSYS; in qla4xxx_sysfs_ddb_get_param()
8096 * qla4xxx_sysfs_ddb_set_param - Set parameter for firmware DDB entry
8121 rc = -EINVAL; in qla4xxx_sysfs_ddb_set_param()
8127 switch (fnode_param->param) { in qla4xxx_sysfs_ddb_set_param()
8129 fnode_conn->is_fw_assigned_ipv6 = fnode_param->value[0]; in qla4xxx_sysfs_ddb_set_param()
8132 memcpy(fnode_sess->portal_type, fnode_param->value, in qla4xxx_sysfs_ddb_set_param()
8133 strlen(fnode_sess->portal_type)); in qla4xxx_sysfs_ddb_set_param()
8136 fnode_sess->auto_snd_tgt_disable = in qla4xxx_sysfs_ddb_set_param()
8137 fnode_param->value[0]; in qla4xxx_sysfs_ddb_set_param()
8140 fnode_sess->discovery_sess = fnode_param->value[0]; in qla4xxx_sysfs_ddb_set_param()
8143 fnode_sess->entry_state = fnode_param->value[0]; in qla4xxx_sysfs_ddb_set_param()
8146 fnode_conn->hdrdgst_en = fnode_param->value[0]; in qla4xxx_sysfs_ddb_set_param()
8149 fnode_conn->datadgst_en = fnode_param->value[0]; in qla4xxx_sysfs_ddb_set_param()
8152 fnode_sess->imm_data_en = fnode_param->value[0]; in qla4xxx_sysfs_ddb_set_param()
8155 fnode_sess->initial_r2t_en = fnode_param->value[0]; in qla4xxx_sysfs_ddb_set_param()
8158 fnode_sess->dataseq_inorder_en = fnode_param->value[0]; in qla4xxx_sysfs_ddb_set_param()
8161 fnode_sess->pdu_inorder_en = fnode_param->value[0]; in qla4xxx_sysfs_ddb_set_param()
8164 fnode_sess->chap_auth_en = fnode_param->value[0]; in qla4xxx_sysfs_ddb_set_param()
8166 if (!fnode_sess->chap_auth_en) in qla4xxx_sysfs_ddb_set_param()
8167 fnode_sess->chap_out_idx = INVALID_ENTRY; in qla4xxx_sysfs_ddb_set_param()
8171 fnode_conn->snack_req_en = fnode_param->value[0]; in qla4xxx_sysfs_ddb_set_param()
8174 fnode_sess->discovery_logout_en = fnode_param->value[0]; in qla4xxx_sysfs_ddb_set_param()
8177 fnode_sess->bidi_chap_en = fnode_param->value[0]; in qla4xxx_sysfs_ddb_set_param()
8180 fnode_sess->discovery_auth_optional = in qla4xxx_sysfs_ddb_set_param()
8181 fnode_param->value[0]; in qla4xxx_sysfs_ddb_set_param()
8184 fnode_sess->erl = fnode_param->value[0]; in qla4xxx_sysfs_ddb_set_param()
8187 fnode_conn->tcp_timestamp_stat = fnode_param->value[0]; in qla4xxx_sysfs_ddb_set_param()
8190 fnode_conn->tcp_nagle_disable = fnode_param->value[0]; in qla4xxx_sysfs_ddb_set_param()
8193 fnode_conn->tcp_wsf_disable = fnode_param->value[0]; in qla4xxx_sysfs_ddb_set_param()
8196 fnode_conn->tcp_timer_scale = fnode_param->value[0]; in qla4xxx_sysfs_ddb_set_param()
8199 fnode_conn->tcp_timestamp_en = fnode_param->value[0]; in qla4xxx_sysfs_ddb_set_param()
8202 fnode_conn->fragment_disable = fnode_param->value[0]; in qla4xxx_sysfs_ddb_set_param()
8205 fnode_conn->max_recv_dlength = in qla4xxx_sysfs_ddb_set_param()
8206 *(unsigned *)fnode_param->value; in qla4xxx_sysfs_ddb_set_param()
8209 fnode_conn->max_xmit_dlength = in qla4xxx_sysfs_ddb_set_param()
8210 *(unsigned *)fnode_param->value; in qla4xxx_sysfs_ddb_set_param()
8213 fnode_sess->first_burst = in qla4xxx_sysfs_ddb_set_param()
8214 *(unsigned *)fnode_param->value; in qla4xxx_sysfs_ddb_set_param()
8217 fnode_sess->time2wait = *(uint16_t *)fnode_param->value; in qla4xxx_sysfs_ddb_set_param()
8220 fnode_sess->time2retain = in qla4xxx_sysfs_ddb_set_param()
8221 *(uint16_t *)fnode_param->value; in qla4xxx_sysfs_ddb_set_param()
8224 fnode_sess->max_r2t = in qla4xxx_sysfs_ddb_set_param()
8225 *(uint16_t *)fnode_param->value; in qla4xxx_sysfs_ddb_set_param()
8228 fnode_conn->keepalive_timeout = in qla4xxx_sysfs_ddb_set_param()
8229 *(uint16_t *)fnode_param->value; in qla4xxx_sysfs_ddb_set_param()
8232 memcpy(fnode_sess->isid, fnode_param->value, in qla4xxx_sysfs_ddb_set_param()
8233 sizeof(fnode_sess->isid)); in qla4xxx_sysfs_ddb_set_param()
8236 fnode_sess->tsid = *(uint16_t *)fnode_param->value; in qla4xxx_sysfs_ddb_set_param()
8239 fnode_conn->port = *(uint16_t *)fnode_param->value; in qla4xxx_sysfs_ddb_set_param()
8242 fnode_sess->max_burst = *(unsigned *)fnode_param->value; in qla4xxx_sysfs_ddb_set_param()
8245 fnode_sess->default_taskmgmt_timeout = in qla4xxx_sysfs_ddb_set_param()
8246 *(uint16_t *)fnode_param->value; in qla4xxx_sysfs_ddb_set_param()
8249 memcpy(fnode_conn->ipaddress, fnode_param->value, in qla4xxx_sysfs_ddb_set_param()
8253 rc = iscsi_switch_str_param(&fnode_sess->targetalias, in qla4xxx_sysfs_ddb_set_param()
8254 (char *)fnode_param->value); in qla4xxx_sysfs_ddb_set_param()
8257 memcpy(fnode_conn->redirect_ipaddr, fnode_param->value, in qla4xxx_sysfs_ddb_set_param()
8261 fnode_conn->max_segment_size = in qla4xxx_sysfs_ddb_set_param()
8262 *(unsigned *)fnode_param->value; in qla4xxx_sysfs_ddb_set_param()
8265 fnode_conn->local_port = in qla4xxx_sysfs_ddb_set_param()
8266 *(uint16_t *)fnode_param->value; in qla4xxx_sysfs_ddb_set_param()
8269 fnode_conn->ipv4_tos = fnode_param->value[0]; in qla4xxx_sysfs_ddb_set_param()
8272 fnode_conn->ipv6_traffic_class = fnode_param->value[0]; in qla4xxx_sysfs_ddb_set_param()
8275 fnode_conn->ipv6_flow_label = fnode_param->value[0]; in qla4xxx_sysfs_ddb_set_param()
8278 rc = iscsi_switch_str_param(&fnode_sess->targetname, in qla4xxx_sysfs_ddb_set_param()
8279 (char *)fnode_param->value); in qla4xxx_sysfs_ddb_set_param()
8282 fnode_sess->tpgt = *(uint16_t *)fnode_param->value; in qla4xxx_sysfs_ddb_set_param()
8285 memcpy(fnode_conn->link_local_ipv6_addr, in qla4xxx_sysfs_ddb_set_param()
8286 fnode_param->value, IPv6_ADDR_LEN); in qla4xxx_sysfs_ddb_set_param()
8289 fnode_sess->discovery_parent_idx = in qla4xxx_sysfs_ddb_set_param()
8290 *(uint16_t *)fnode_param->value; in qla4xxx_sysfs_ddb_set_param()
8293 fnode_conn->tcp_xmit_wsf = in qla4xxx_sysfs_ddb_set_param()
8294 *(uint8_t *)fnode_param->value; in qla4xxx_sysfs_ddb_set_param()
8297 fnode_conn->tcp_recv_wsf = in qla4xxx_sysfs_ddb_set_param()
8298 *(uint8_t *)fnode_param->value; in qla4xxx_sysfs_ddb_set_param()
8301 fnode_conn->statsn = *(uint32_t *)fnode_param->value; in qla4xxx_sysfs_ddb_set_param()
8304 fnode_conn->exp_statsn = in qla4xxx_sysfs_ddb_set_param()
8305 *(uint32_t *)fnode_param->value; in qla4xxx_sysfs_ddb_set_param()
8308 chap_out_idx = *(uint16_t *)fnode_param->value; in qla4xxx_sysfs_ddb_set_param()
8313 fnode_sess->chap_out_idx = chap_out_idx; in qla4xxx_sysfs_ddb_set_param()
8315 fnode_sess->chap_auth_en = QL4_PARAM_ENABLE; in qla4xxx_sysfs_ddb_set_param()
8321 rc = -ENOSYS; in qla4xxx_sysfs_ddb_set_param()
8333 * qla4xxx_sysfs_ddb_delete - Delete firmware DDB entry
8352 if (fnode_sess->is_boot_target) { in qla4xxx_sysfs_ddb_delete()
8353 rc = -EPERM; in qla4xxx_sysfs_ddb_delete()
8360 if (fnode_sess->flash_state == DEV_DB_NON_PERSISTENT) in qla4xxx_sysfs_ddb_delete()
8366 dev_db_start_offset += (fnode_sess->target_id * in qla4xxx_sysfs_ddb_delete()
8371 (ha->hw.flt_region_ddb << 2); in qla4xxx_sysfs_ddb_delete()
8375 if (ha->port_num == 1) in qla4xxx_sysfs_ddb_delete()
8376 dev_db_start_offset += (ha->hw.flt_ddb_size / 2); in qla4xxx_sysfs_ddb_delete()
8379 (ha->hw.flt_ddb_size / 2); in qla4xxx_sysfs_ddb_delete()
8381 dev_db_start_offset += (fnode_sess->target_id * in qla4xxx_sysfs_ddb_delete()
8392 rc = -EIO; in qla4xxx_sysfs_ddb_delete()
8394 __func__, fnode_sess->target_id)); in qla4xxx_sysfs_ddb_delete()
8398 pddb = dma_alloc_coherent(&ha->pdev->dev, ddb_size, in qla4xxx_sysfs_ddb_delete()
8401 rc = -ENOMEM; in qla4xxx_sysfs_ddb_delete()
8411 ddb_cookie = &fw_ddb_entry->cookie; in qla4xxx_sysfs_ddb_delete()
8422 target_id = fnode_sess->target_id; in qla4xxx_sysfs_ddb_delete()
8426 __func__, target_id, ha->host_no); in qla4xxx_sysfs_ddb_delete()
8429 dma_free_coherent(&ha->pdev->dev, ddb_size, pddb, in qla4xxx_sysfs_ddb_delete()
8435 * qla4xxx_sysfs_ddb_export - Create sysfs entries for firmware DDBs
8448 fw_ddb_entry = dma_alloc_coherent(&ha->pdev->dev, in qla4xxx_sysfs_ddb_export()
8455 return -ENOMEM; in qla4xxx_sysfs_ddb_export()
8468 ret = -EIO; in qla4xxx_sysfs_ddb_export()
8473 dma_free_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), fw_ddb_entry, in qla4xxx_sysfs_ddb_export()
8481 iscsi_destroy_all_flashnode(ha->host); in qla4xxx_sysfs_ddb_remove()
8485 * qla4xxx_build_ddb_list - Build ddb list and setup sessions
8501 if (!test_bit(AF_LINK_UP, &ha->flags)) { in qla4xxx_build_ddb_list()
8502 set_bit(AF_BUILD_DDB_LIST, &ha->flags); in qla4xxx_build_ddb_list()
8503 ha->is_reset = is_reset; in qla4xxx_build_ddb_list()
8519 qla4xxx_conn_open(ha, st_ddb_idx->fw_ddb_idx); in qla4xxx_build_ddb_list()
8522 /* Wait to ensure all sendtargets are done for min 12 sec wait */ in qla4xxx_build_ddb_list()
8523 tmo = ((ha->def_timeout > LOGIN_TOV) && in qla4xxx_build_ddb_list()
8524 (ha->def_timeout < LOGIN_TOV * 10) ? in qla4xxx_build_ddb_list()
8525 ha->def_timeout : LOGIN_TOV); in qla4xxx_build_ddb_list()
8549 * qla4xxx_wait_login_resp_boot_tgt - Wait for iSCSI boot target login
8569 fw_ddb_entry = dma_alloc_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), in qla4xxx_wait_login_resp_boot_tgt()
8584 if (test_bit(DF_BOOT_TGT, &ddb_entry->flags)) { in qla4xxx_wait_login_resp_boot_tgt()
8587 ddb_entry->fw_ddb_index)); in qla4xxx_wait_login_resp_boot_tgt()
8590 ddb_entry->fw_ddb_index, in qla4xxx_wait_login_resp_boot_tgt()
8616 dma_free_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), in qla4xxx_wait_login_resp_boot_tgt()
8621 * qla4xxx_probe_adapter - callback function to probe HBA
8632 int ret = -ENODEV, status; in qla4xxx_probe_adapter()
8641 return -1; in qla4xxx_probe_adapter()
8655 ha->pdev = pdev; in qla4xxx_probe_adapter()
8656 ha->host = host; in qla4xxx_probe_adapter()
8657 ha->host_no = host->host_no; in qla4xxx_probe_adapter()
8658 ha->func_num = PCI_FUNC(ha->pdev->devfn); in qla4xxx_probe_adapter()
8662 ha->isp_ops = &qla4_82xx_isp_ops; in qla4xxx_probe_adapter()
8663 ha->reg_tbl = (uint32_t *) qla4_82xx_reg_tbl; in qla4xxx_probe_adapter()
8664 ha->qdr_sn_window = -1; in qla4xxx_probe_adapter()
8665 ha->ddr_mn_window = -1; in qla4xxx_probe_adapter()
8666 ha->curr_window = 255; in qla4xxx_probe_adapter()
8667 nx_legacy_intr = &legacy_intr[ha->func_num]; in qla4xxx_probe_adapter()
8668 ha->nx_legacy_intr.int_vec_bit = nx_legacy_intr->int_vec_bit; in qla4xxx_probe_adapter()
8669 ha->nx_legacy_intr.tgt_status_reg = in qla4xxx_probe_adapter()
8670 nx_legacy_intr->tgt_status_reg; in qla4xxx_probe_adapter()
8671 ha->nx_legacy_intr.tgt_mask_reg = nx_legacy_intr->tgt_mask_reg; in qla4xxx_probe_adapter()
8672 ha->nx_legacy_intr.pci_int_reg = nx_legacy_intr->pci_int_reg; in qla4xxx_probe_adapter()
8674 ha->isp_ops = &qla4_83xx_isp_ops; in qla4xxx_probe_adapter()
8675 ha->reg_tbl = (uint32_t *)qla4_83xx_reg_tbl; in qla4xxx_probe_adapter()
8677 ha->isp_ops = &qla4xxx_isp_ops; in qla4xxx_probe_adapter()
8681 rwlock_init(&ha->hw_lock); in qla4xxx_probe_adapter()
8682 ha->pf_bit = ha->func_num << 16; in qla4xxx_probe_adapter()
8684 pdev->needs_freset = 1; in qla4xxx_probe_adapter()
8688 ret = ha->isp_ops->iospace_config(ha); in qla4xxx_probe_adapter()
8693 pdev->device, pdev->irq, ha->reg); in qla4xxx_probe_adapter()
8698 INIT_LIST_HEAD(&ha->free_srb_q); in qla4xxx_probe_adapter()
8700 mutex_init(&ha->mbox_sem); in qla4xxx_probe_adapter()
8701 mutex_init(&ha->chap_sem); in qla4xxx_probe_adapter()
8702 init_completion(&ha->mbx_intr_comp); in qla4xxx_probe_adapter()
8703 init_completion(&ha->disable_acb_comp); in qla4xxx_probe_adapter()
8704 init_completion(&ha->idc_comp); in qla4xxx_probe_adapter()
8705 init_completion(&ha->link_up_comp); in qla4xxx_probe_adapter()
8707 spin_lock_init(&ha->hardware_lock); in qla4xxx_probe_adapter()
8708 spin_lock_init(&ha->work_lock); in qla4xxx_probe_adapter()
8711 INIT_LIST_HEAD(&ha->work_list); in qla4xxx_probe_adapter()
8718 ret = -ENOMEM; in qla4xxx_probe_adapter()
8722 host->cmd_per_lun = 3; in qla4xxx_probe_adapter()
8723 host->max_channel = 0; in qla4xxx_probe_adapter()
8724 host->max_lun = MAX_LUNS - 1; in qla4xxx_probe_adapter()
8725 host->max_id = MAX_TARGETS; in qla4xxx_probe_adapter()
8726 host->max_cmd_len = IOCB_MAX_CDB_LEN; in qla4xxx_probe_adapter()
8727 host->can_queue = MAX_SRBS ; in qla4xxx_probe_adapter()
8728 host->transportt = qla4xxx_scsi_transport; in qla4xxx_probe_adapter()
8732 ret = scsi_add_host(host, &pdev->dev); in qla4xxx_probe_adapter()
8762 while ((!test_bit(AF_ONLINE, &ha->flags)) && in qla4xxx_probe_adapter()
8766 ha->isp_ops->idc_lock(ha); in qla4xxx_probe_adapter()
8769 ha->isp_ops->idc_unlock(ha); in qla4xxx_probe_adapter()
8780 if (ha->isp_ops->reset_chip(ha) == QLA_ERROR) in qla4xxx_probe_adapter()
8791 if (!test_bit(AF_ONLINE, &ha->flags)) { in qla4xxx_probe_adapter()
8799 ha->isp_ops->idc_lock(ha); in qla4xxx_probe_adapter()
8802 ha->isp_ops->idc_unlock(ha); in qla4xxx_probe_adapter()
8804 ret = -ENODEV; in qla4xxx_probe_adapter()
8811 sprintf(buf, "qla4xxx_%lu_dpc", ha->host_no); in qla4xxx_probe_adapter()
8812 ha->dpc_thread = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, buf); in qla4xxx_probe_adapter()
8813 if (!ha->dpc_thread) { in qla4xxx_probe_adapter()
8815 ret = -ENODEV; in qla4xxx_probe_adapter()
8818 INIT_WORK(&ha->dpc_work, qla4xxx_do_dpc); in qla4xxx_probe_adapter()
8820 ha->task_wq = alloc_workqueue("qla4xxx_%lu_task", WQ_MEM_RECLAIM, 1, in qla4xxx_probe_adapter()
8821 ha->host_no); in qla4xxx_probe_adapter()
8822 if (!ha->task_wq) { in qla4xxx_probe_adapter()
8824 ret = -ENODEV; in qla4xxx_probe_adapter()
8829 * For ISP-8XXX, request_irqs is called in qla4_8xxx_load_risc in qla4xxx_probe_adapter()
8838 "interrupt %d already in use.\n", pdev->irq); in qla4xxx_probe_adapter()
8843 pci_save_state(ha->pdev); in qla4xxx_probe_adapter()
8844 ha->isp_ops->enable_intrs(ha); in qla4xxx_probe_adapter()
8849 set_bit(AF_INIT_DONE, &ha->flags); in qla4xxx_probe_adapter()
8856 qla4xxx_version_str, ha->pdev->device, pci_name(ha->pdev), in qla4xxx_probe_adapter()
8857 ha->host_no, ha->fw_info.fw_major, ha->fw_info.fw_minor, in qla4xxx_probe_adapter()
8858 ha->fw_info.fw_patch, ha->fw_info.fw_build); in qla4xxx_probe_adapter()
8868 set_bit(DPC_SYSFS_DDB_EXPORT, &ha->dpc_flags); in qla4xxx_probe_adapter()
8871 iscsi_host_for_each_session(ha->host, qla4xxx_login_flash_ddb); in qla4xxx_probe_adapter()
8880 scsi_remove_host(ha->host); in qla4xxx_probe_adapter()
8886 scsi_host_put(ha->host); in qla4xxx_probe_adapter()
8895 * qla4xxx_prevent_other_port_reinit - prevent other port from re-initialize
8898 * Mark the other ISP-4xxx port to indicate that the driver is being removed,
8899 * so that the other port will not re-initialize while in the process of
8909 if (PCI_FUNC(ha->pdev->devfn) & BIT_1) in qla4xxx_prevent_other_port_reinit()
8913 pci_get_domain_bus_and_slot(pci_domain_nr(ha->pdev->bus), in qla4xxx_prevent_other_port_reinit()
8914 ha->pdev->bus->number, PCI_DEVFN(PCI_SLOT(ha->pdev->devfn), in qla4xxx_prevent_other_port_reinit()
8919 if (atomic_read(&other_pdev->enable_cnt)) { in qla4xxx_prevent_other_port_reinit()
8922 set_bit(AF_HA_REMOVAL, &other_ha->flags); in qla4xxx_prevent_other_port_reinit()
8925 dev_name(&other_ha->pdev->dev))); in qla4xxx_prevent_other_port_reinit()
8948 fw_ddb_entry = dma_alloc_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), in qla4xxx_destroy_ddb()
8958 status = qla4xxx_get_fwddb_entry(ha, ddb_entry->fw_ddb_index, in qla4xxx_destroy_ddb()
8973 dma_free_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), in qla4xxx_destroy_ddb()
8976 qla4xxx_clear_ddb_entry(ha, ddb_entry->fw_ddb_index); in qla4xxx_destroy_ddb()
8988 (ddb_entry->ddb_type == FLASH_DDB)) { in qla4xxx_destroy_fw_ddb_session()
8998 iscsi_destroy_endpoint(ddb_entry->conn->ep); in qla4xxx_destroy_fw_ddb_session()
9000 iscsi_session_teardown(ddb_entry->sess); in qla4xxx_destroy_fw_ddb_session()
9005 * qla4xxx_remove_adapter - callback function to remove adapter.
9027 if ((!ql4xdisablesysfsboot) && ha->boot_kset) in qla4xxx_remove_adapter()
9028 iscsi_boot_destroy_kset(ha->boot_kset); in qla4xxx_remove_adapter()
9034 scsi_remove_host(ha->host); in qla4xxx_remove_adapter()
9038 scsi_host_put(ha->host); in qla4xxx_remove_adapter()
9044 * qla4xxx_config_dma_addressing() - Configure OS DMA addressing method.
9050 if (dma_set_mask_and_coherent(&ha->pdev->dev, DMA_BIT_MASK(64))) { in qla4xxx_config_dma_addressing()
9051 dev_dbg(&ha->pdev->dev, in qla4xxx_config_dma_addressing()
9054 dma_set_mask_and_coherent(&ha->pdev->dev, DMA_BIT_MASK(32)); in qla4xxx_config_dma_addressing()
9065 cls_sess = starget_to_session(sdev->sdev_target); in qla4xxx_sdev_init()
9066 sess = cls_sess->dd_data; in qla4xxx_sdev_init()
9067 ddb = sess->dd_data; in qla4xxx_sdev_init()
9069 sdev->hostdata = ddb; in qla4xxx_sdev_init()
9079 * qla4xxx_del_from_active_array - returns an active srb
9091 cmd = scsi_host_find_tag(ha->host, index); in qla4xxx_del_from_active_array()
9095 srb = qla4xxx_cmd_priv(cmd)->srb; in qla4xxx_del_from_active_array()
9100 if (srb->flags & SRB_DMA_VALID) { in qla4xxx_del_from_active_array()
9101 ha->iocb_cnt -= srb->iocb_cnt; in qla4xxx_del_from_active_array()
9102 if (srb->cmd) in qla4xxx_del_from_active_array()
9103 srb->cmd->host_scribble = in qla4xxx_del_from_active_array()
9110 * qla4xxx_eh_wait_on_command - waits for command to be returned by firmware
9128 if (unlikely(pci_channel_offline(ha->pdev)) || in qla4xxx_eh_wait_on_command()
9129 (test_bit(AF_EEH_BUSY, &ha->flags))) { in qla4xxx_eh_wait_on_command()
9131 ha->host_no, __func__); in qla4xxx_eh_wait_on_command()
9137 rp = qla4xxx_cmd_priv(cmd)->srb; in qla4xxx_eh_wait_on_command()
9144 } while (max_wait_time--); in qla4xxx_eh_wait_on_command()
9150 * qla4xxx_wait_for_hba_online - waits for HBA to come online
9170 * qla4xxx_eh_wait_for_commands - wait for active cmds to finish.
9190 for (cnt = 0; cnt < ha->host->can_queue; cnt++) { in qla4xxx_eh_wait_for_commands()
9191 cmd = scsi_host_find_tag(ha->host, cnt); in qla4xxx_eh_wait_for_commands()
9192 if (cmd && stgt == scsi_target(cmd->device) && in qla4xxx_eh_wait_for_commands()
9193 (!sdev || sdev == cmd->device)) { in qla4xxx_eh_wait_for_commands()
9204 * qla4xxx_eh_abort - callback for abort task.
9212 struct scsi_qla_host *ha = to_qla_host(cmd->device->host); in qla4xxx_eh_abort()
9213 unsigned int id = cmd->device->id; in qla4xxx_eh_abort()
9214 uint64_t lun = cmd->device->lun; in qla4xxx_eh_abort()
9222 ha->host_no, id, lun, cmd, cmd->cmnd[0]); in qla4xxx_eh_abort()
9230 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_eh_abort()
9231 srb = qla4xxx_cmd_priv(cmd)->srb; in qla4xxx_eh_abort()
9233 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_eh_abort()
9235 ha->host_no, id, lun); in qla4xxx_eh_abort()
9238 kref_get(&srb->srb_ref); in qla4xxx_eh_abort()
9239 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_eh_abort()
9243 ha->host_no, id, lun)); in qla4xxx_eh_abort()
9247 ha->host_no, id, lun)); in qla4xxx_eh_abort()
9251 kref_put(&srb->srb_ref, qla4xxx_srb_compl); in qla4xxx_eh_abort()
9257 ha->host_no, id, lun)); in qla4xxx_eh_abort()
9263 "scsi%ld:%d:%llu: Abort command - %s\n", in qla4xxx_eh_abort()
9264 ha->host_no, id, lun, (ret == SUCCESS) ? "succeeded" : "failed"); in qla4xxx_eh_abort()
9270 * qla4xxx_eh_device_reset - callback for target reset.
9278 struct scsi_qla_host *ha = to_qla_host(cmd->device->host); in qla4xxx_eh_device_reset()
9279 struct ddb_entry *ddb_entry = cmd->device->hostdata; in qla4xxx_eh_device_reset()
9292 "scsi%ld:%d:%d:%llu: DEVICE RESET ISSUED.\n", ha->host_no, in qla4xxx_eh_device_reset()
9293 cmd->device->channel, cmd->device->id, cmd->device->lun); in qla4xxx_eh_device_reset()
9297 "dpc_flags=%lx, status=%x allowed=%d\n", ha->host_no, in qla4xxx_eh_device_reset()
9298 cmd, jiffies, scsi_cmd_to_rq(cmd)->timeout / HZ, in qla4xxx_eh_device_reset()
9299 ha->dpc_flags, cmd->result, cmd->allowed)); in qla4xxx_eh_device_reset()
9308 stat = qla4xxx_reset_lun(ha, ddb_entry, cmd->device->lun); in qla4xxx_eh_device_reset()
9314 if (qla4xxx_eh_wait_for_commands(ha, scsi_target(cmd->device), in qla4xxx_eh_device_reset()
9315 cmd->device)) { in qla4xxx_eh_device_reset()
9317 "DEVICE RESET FAILED - waiting for " in qla4xxx_eh_device_reset()
9323 if (qla4xxx_send_marker_iocb(ha, ddb_entry, cmd->device->lun, in qla4xxx_eh_device_reset()
9329 ha->host_no, cmd->device->channel, cmd->device->id, in qla4xxx_eh_device_reset()
9330 cmd->device->lun); in qla4xxx_eh_device_reset()
9340 * qla4xxx_eh_target_reset - callback for target reset.
9347 struct scsi_qla_host *ha = to_qla_host(cmd->device->host); in qla4xxx_eh_target_reset()
9348 struct ddb_entry *ddb_entry = cmd->device->hostdata; in qla4xxx_eh_target_reset()
9359 starget_printk(KERN_INFO, scsi_target(cmd->device), in qla4xxx_eh_target_reset()
9365 ha->host_no, cmd, jiffies, scsi_cmd_to_rq(cmd)->timeout / HZ, in qla4xxx_eh_target_reset()
9366 ha->dpc_flags, cmd->result, cmd->allowed)); in qla4xxx_eh_target_reset()
9376 starget_printk(KERN_INFO, scsi_target(cmd->device), in qla4xxx_eh_target_reset()
9381 if (qla4xxx_eh_wait_for_commands(ha, scsi_target(cmd->device), in qla4xxx_eh_target_reset()
9383 starget_printk(KERN_INFO, scsi_target(cmd->device), in qla4xxx_eh_target_reset()
9384 "WARM TARGET DEVICE RESET FAILED - " in qla4xxx_eh_target_reset()
9390 if (qla4xxx_send_marker_iocb(ha, ddb_entry, cmd->device->lun, in qla4xxx_eh_target_reset()
9392 starget_printk(KERN_INFO, scsi_target(cmd->device), in qla4xxx_eh_target_reset()
9393 "WARM TARGET DEVICE RESET FAILED - " in qla4xxx_eh_target_reset()
9398 starget_printk(KERN_INFO, scsi_target(cmd->device), in qla4xxx_eh_target_reset()
9404 * qla4xxx_is_eh_active - check if error handler is running
9412 if (shost->shost_state == SHOST_RECOVERY) in qla4xxx_is_eh_active()
9418 * qla4xxx_eh_host_reset - kernel callback
9430 ha = to_qla_host(cmd->device->host); in qla4xxx_eh_host_reset()
9449 ha->host_no, __func__)); in qla4xxx_eh_host_reset()
9452 if (qla4xxx_is_eh_active(cmd->device->host)) in qla4xxx_eh_host_reset()
9459 "scsi(%ld:%d:%d:%llu): HOST RESET ISSUED.\n", ha->host_no, in qla4xxx_eh_host_reset()
9460 cmd->device->channel, cmd->device->id, cmd->device->lun); in qla4xxx_eh_host_reset()
9464 "DEAD.\n", ha->host_no, cmd->device->channel, in qla4xxx_eh_host_reset()
9470 if (!test_bit(DPC_RESET_HA, &ha->dpc_flags)) { in qla4xxx_eh_host_reset()
9472 set_bit(DPC_RESET_HA_FW_CONTEXT, &ha->dpc_flags); in qla4xxx_eh_host_reset()
9474 set_bit(DPC_RESET_HA, &ha->dpc_flags); in qla4xxx_eh_host_reset()
9495 acb = dma_alloc_coherent(&ha->pdev->dev, in qla4xxx_context_reset()
9501 rval = -ENOMEM; in qla4xxx_context_reset()
9509 rval = -EIO; in qla4xxx_context_reset()
9515 rval = -EIO; in qla4xxx_context_reset()
9519 wait_for_completion_timeout(&ha->disable_acb_comp, in qla4xxx_context_reset()
9524 rval = -EIO; in qla4xxx_context_reset()
9529 dma_free_coherent(&ha->pdev->dev, sizeof(struct addr_ctrl_blk_def), in qla4xxx_context_reset()
9546 rval = -EPERM; in qla4xxx_host_reset()
9550 if (test_bit(DPC_RESET_HA, &ha->dpc_flags)) in qla4xxx_host_reset()
9555 set_bit(DPC_RESET_HA, &ha->dpc_flags); in qla4xxx_host_reset()
9558 if (!test_bit(DPC_RESET_HA, &ha->dpc_flags)) { in qla4xxx_host_reset()
9562 &ha->dpc_flags); in qla4xxx_host_reset()
9575 test_bit(DPC_RESET_HA, &ha->dpc_flags)) { in qla4xxx_host_reset()
9585 rval = -EIO; in qla4xxx_host_reset()
9596 * - Fatal Errors - link_reset
9597 * - Non-Fatal Errors - driver's error_detected() which
9601 * CAN_RECOVER - driver's mmio_enabled(), mmio_enabled()
9603 * NEED_RESET - driver's slot_reset()
9604 * DISCONNECT - device is dead & cannot recover
9605 * RECOVERED - driver's resume()
9613 ha->host_no, __func__, state); in qla4xxx_pci_error_detected()
9620 clear_bit(AF_EEH_BUSY, &ha->flags); in qla4xxx_pci_error_detected()
9623 set_bit(AF_EEH_BUSY, &ha->flags); in qla4xxx_pci_error_detected()
9631 set_bit(AF_EEH_BUSY, &ha->flags); in qla4xxx_pci_error_detected()
9632 set_bit(AF_PCI_CHANNEL_IO_PERM_FAILURE, &ha->flags); in qla4xxx_pci_error_detected()
9640 * qla4xxx_pci_mmio_enabled() - gets called if
9662 ql4_printk(KERN_WARNING, ha, "scsi%ld: In %s\n", ha->host_no, __func__); in qla4_8xxx_error_recovery()
9664 set_bit(DPC_RESET_ACTIVE, &ha->dpc_flags); in qla4_8xxx_error_recovery()
9666 if (test_bit(AF_ONLINE, &ha->flags)) { in qla4_8xxx_error_recovery()
9667 clear_bit(AF_ONLINE, &ha->flags); in qla4_8xxx_error_recovery()
9668 clear_bit(AF_LINK_UP, &ha->flags); in qla4_8xxx_error_recovery()
9669 iscsi_host_for_each_session(ha->host, qla4xxx_fail_session); in qla4_8xxx_error_recovery()
9673 fn = PCI_FUNC(ha->pdev->devfn); in qla4_8xxx_error_recovery()
9676 fn--; in qla4_8xxx_error_recovery()
9678 ha->host_no, __func__, fn); in qla4_8xxx_error_recovery()
9682 pci_domain_nr(ha->pdev->bus), in qla4_8xxx_error_recovery()
9683 ha->pdev->bus->number, in qla4_8xxx_error_recovery()
9684 PCI_DEVFN(PCI_SLOT(ha->pdev->devfn), in qla4_8xxx_error_recovery()
9690 if (atomic_read(&other_pdev->enable_cnt)) { in qla4_8xxx_error_recovery()
9692 ha->host_no, __func__, fn); in qla4_8xxx_error_recovery()
9712 "0x%x is the owner\n", ha->host_no, __func__, in qla4_8xxx_error_recovery()
9713 ha->pdev->devfn); in qla4_8xxx_error_recovery()
9715 ha->isp_ops->idc_lock(ha); in qla4_8xxx_error_recovery()
9718 ha->isp_ops->idc_unlock(ha); in qla4_8xxx_error_recovery()
9723 ha->host_no, __func__); in qla4_8xxx_error_recovery()
9724 ha->isp_ops->idc_lock(ha); in qla4_8xxx_error_recovery()
9727 ha->isp_ops->idc_unlock(ha); in qla4_8xxx_error_recovery()
9731 clear_bit(AF_FW_RECOVERY, &ha->flags); in qla4_8xxx_error_recovery()
9736 "FAILED\n", ha->host_no, __func__); in qla4_8xxx_error_recovery()
9738 ha->isp_ops->idc_lock(ha); in qla4_8xxx_error_recovery()
9742 ha->isp_ops->idc_unlock(ha); in qla4_8xxx_error_recovery()
9745 "READY\n", ha->host_no, __func__); in qla4_8xxx_error_recovery()
9746 ha->isp_ops->idc_lock(ha); in qla4_8xxx_error_recovery()
9752 ha->isp_ops->idc_unlock(ha); in qla4_8xxx_error_recovery()
9753 ha->isp_ops->enable_intrs(ha); in qla4_8xxx_error_recovery()
9757 "the reset owner\n", ha->host_no, __func__, in qla4_8xxx_error_recovery()
9758 ha->pdev->devfn); in qla4_8xxx_error_recovery()
9761 clear_bit(AF_FW_RECOVERY, &ha->flags); in qla4_8xxx_error_recovery()
9764 ha->isp_ops->enable_intrs(ha); in qla4_8xxx_error_recovery()
9768 ha->isp_ops->idc_lock(ha); in qla4_8xxx_error_recovery()
9770 ha->isp_ops->idc_unlock(ha); in qla4_8xxx_error_recovery()
9774 clear_bit(DPC_RESET_ACTIVE, &ha->dpc_flags); in qla4_8xxx_error_recovery()
9786 ha->host_no, __func__); in qla4xxx_pci_slot_reset()
9791 /* Restore the saved state of PCIe device - in qla4xxx_pci_slot_reset()
9805 ql4_printk(KERN_WARNING, ha, "scsi%ld: %s: Can't re-enable " in qla4xxx_pci_slot_reset()
9806 "device after reset\n", ha->host_no, __func__); in qla4xxx_pci_slot_reset()
9810 ha->isp_ops->disable_intrs(ha); in qla4xxx_pci_slot_reset()
9822 "device after reset\n", ha->host_no, __func__, ret); in qla4xxx_pci_slot_reset()
9833 ha->host_no, __func__); in qla4xxx_pci_resume()
9838 "resume I/O from slot/link_reset\n", ha->host_no, in qla4xxx_pci_resume()
9842 clear_bit(AF_EEH_BUSY, &ha->flags); in qla4xxx_pci_resume()
9915 ret = -ENOMEM; in qla4xxx_module_init()
9922 strcat(qla4xxx_version_str, "-debug"); in qla4xxx_module_init()
9927 ret = -ENODEV; in qla4xxx_module_init()