Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (28 commits)
[SCSI] qla4xxx: fix compilation warning
[SCSI] make error handling more robust in the face of reservations
[SCSI] tgt: fix warning
[SCSI] drivers/message/fusion: Adjust confusing if indentation
[SCSI] Return NEEDS_RETRY for eh commands with status BUSY
[SCSI] ibmvfc: Driver version 1.0.9
[SCSI] ibmvfc: Fix terminate_rport_io
[SCSI] ibmvfc: Fix rport add/delete race resulting in oops
[SCSI] lpfc 8.3.16: Change LPFC driver version to 8.3.16
[SCSI] lpfc 8.3.16: FCoE Discovery and Failover Fixes
[SCSI] lpfc 8.3.16: SLI Additions, updates, and code cleanup
[SCSI] pm8001: introduce missing kfree
[SCSI] qla4xxx: Update driver version to 5.02.00-k3
[SCSI] qla4xxx: Added AER support for ISP82xx
[SCSI] qla4xxx: Handle outstanding mbx cmds on hung f/w scenarios
[SCSI] qla4xxx: updated mbx_sys_info struct to sync with FW 4.6.x
[SCSI] qla4xxx: clear AF_DPC_SCHEDULED flage when exit from do_dpc
[SCSI] qla4xxx: Stop firmware before doing init firmware.
[SCSI] qla4xxx: Use the correct request queue.
[SCSI] qla4xxx: set correct value in sess->recovery_tmo
...

+1546 -395
-8
drivers/firmware/Kconfig
··· 122 122 is necessary for iSCSI Boot Firmware Table Attributes module to work 123 123 properly. 124 124 125 - config ISCSI_BOOT_SYSFS 126 - tristate "iSCSI Boot Sysfs Interface" 127 - default n 128 - help 129 - This option enables support for exposing iSCSI boot information 130 - via sysfs to userspace. If you wish to export this information, 131 - say Y. Otherwise, say N. 132 - 133 125 config ISCSI_IBFT 134 126 tristate "iSCSI Boot Firmware Table Attributes module" 135 127 select ISCSI_BOOT_SYSFS
-1
drivers/firmware/Makefile
··· 10 10 obj-$(CONFIG_DMIID) += dmi-id.o 11 11 obj-$(CONFIG_ISCSI_IBFT_FIND) += iscsi_ibft_find.o 12 12 obj-$(CONFIG_ISCSI_IBFT) += iscsi_ibft.o 13 - obj-$(CONFIG_ISCSI_BOOT_SYSFS) += iscsi_boot_sysfs.o 14 13 obj-$(CONFIG_FIRMWARE_MEMMAP) += memmap.o
drivers/firmware/iscsi_boot_sysfs.c drivers/scsi/iscsi_boot_sysfs.c
+1 -1
drivers/message/fusion/mptbase.c
··· 8049 8049 code_desc = ir_code_str[sas_loginfo.dw.code]; 8050 8050 if (sas_loginfo.dw.subcode >= 8051 8051 ARRAY_SIZE(raid_sub_code_str)) 8052 - break; 8052 + break; 8053 8053 if (sas_loginfo.dw.code == 0) 8054 8054 sub_code_desc = 8055 8055 raid_sub_code_str[sas_loginfo.dw.subcode];
+8
drivers/scsi/Kconfig
··· 370 370 371 371 http://open-iscsi.org 372 372 373 + config ISCSI_BOOT_SYSFS 374 + tristate "iSCSI Boot Sysfs Interface" 375 + default n 376 + help 377 + This option enables support for exposing iSCSI boot information 378 + via sysfs to userspace. If you wish to export this information, 379 + say Y. Otherwise, say N. 380 + 373 381 source "drivers/scsi/cxgb3i/Kconfig" 374 382 source "drivers/scsi/bnx2i/Kconfig" 375 383 source "drivers/scsi/be2iscsi/Kconfig"
+1
drivers/scsi/Makefile
··· 42 42 obj-$(CONFIG_FCOE_FNIC) += fnic/ 43 43 obj-$(CONFIG_ISCSI_TCP) += libiscsi.o libiscsi_tcp.o iscsi_tcp.o 44 44 obj-$(CONFIG_INFINIBAND_ISER) += libiscsi.o 45 + obj-$(CONFIG_ISCSI_BOOT_SYSFS) += iscsi_boot_sysfs.o 45 46 obj-$(CONFIG_SCSI_A4000T) += 53c700.o a4000t.o 46 47 obj-$(CONFIG_SCSI_ZORRO7XX) += 53c700.o zorro7xx.o 47 48 obj-$(CONFIG_A3000_SCSI) += a3000.o wd33c93.o
+1
drivers/scsi/be2iscsi/Kconfig
··· 2 2 tristate "ServerEngines' 10Gbps iSCSI - BladeEngine 2" 3 3 depends on PCI && SCSI && NET 4 4 select SCSI_ISCSI_ATTRS 5 + select ISCSI_BOOT_SYSFS 5 6 6 7 help 7 8 This driver implements the iSCSI functionality for ServerEngines'
+130 -17
drivers/scsi/be2iscsi/be_cmds.h
··· 162 162 #define OPCODE_COMMON_ISCSI_CFG_POST_SGL_PAGES 2 163 163 #define OPCODE_COMMON_ISCSI_CFG_REMOVE_SGL_PAGES 3 164 164 #define OPCODE_COMMON_ISCSI_NTWK_GET_NIC_CONFIG 7 165 + #define OPCODE_COMMON_ISCSI_NTWK_SET_VLAN 14 166 + #define OPCODE_COMMON_ISCSI_NTWK_CONFIGURE_STATELESS_IP_ADDR 17 167 + #define OPCODE_COMMON_ISCSI_NTWK_MODIFY_IP_ADDR 21 168 + #define OPCODE_COMMON_ISCSI_NTWK_GET_DEFAULT_GATEWAY 22 169 + #define OPCODE_COMMON_ISCSI_NTWK_MODIFY_DEFAULT_GATEWAY 23 170 + #define OPCODE_COMMON_ISCSI_NTWK_GET_ALL_IF_ID 24 171 + #define OPCODE_COMMON_ISCSI_NTWK_GET_IF_INFO 25 165 172 #define OPCODE_COMMON_ISCSI_SET_FRAGNUM_BITS_FOR_SGL_CRA 61 166 173 #define OPCODE_COMMON_ISCSI_DEFQ_CREATE 64 167 174 #define OPCODE_COMMON_ISCSI_DEFQ_DESTROY 65 ··· 244 237 u16 rsvd0; /* sword */ 245 238 } __packed; 246 239 240 + struct mgmt_chap_format { 241 + u32 flags; 242 + u8 intr_chap_name[256]; 243 + u8 intr_secret[16]; 244 + u8 target_chap_name[256]; 245 + u8 target_secret[16]; 246 + u16 intr_chap_name_length; 247 + u16 intr_secret_length; 248 + u16 target_chap_name_length; 249 + u16 target_secret_length; 250 + } __packed; 251 + 252 + struct mgmt_auth_method_format { 253 + u8 auth_method_type; 254 + u8 padding[3]; 255 + struct mgmt_chap_format chap; 256 + } __packed; 257 + 258 + struct mgmt_conn_login_options { 259 + u8 flags; 260 + u8 header_digest; 261 + u8 data_digest; 262 + u8 rsvd0; 263 + u32 max_recv_datasegment_len_ini; 264 + u32 max_recv_datasegment_len_tgt; 265 + u32 tcp_mss; 266 + u32 tcp_window_size; 267 + struct mgmt_auth_method_format auth_data; 268 + } __packed; 269 + 270 + struct ip_address_format { 271 + u16 size_of_structure; 272 + u8 reserved; 273 + u8 ip_type; 274 + u8 ip_address[16]; 275 + u32 rsvd0; 276 + } __packed; 277 + 278 + struct mgmt_conn_info { 279 + u32 connection_handle; 280 + u32 connection_status; 281 + u16 src_port; 282 + u16 dest_port; 283 + u16 dest_port_redirected; 284 + u16 cid; 285 + u32 estimated_throughput; 286 + struct ip_address_format src_ipaddr; 287 + struct ip_address_format dest_ipaddr; 288 + struct ip_address_format dest_ipaddr_redirected; 289 + struct mgmt_conn_login_options negotiated_login_options; 290 + } __packed; 291 + 292 + struct mgmt_session_login_options { 293 + u8 flags; 294 + u8 error_recovery_level; 295 + u16 rsvd0; 296 + u32 first_burst_length; 297 + u32 max_burst_length; 298 + u16 max_connections; 299 + u16 max_outstanding_r2t; 300 + u16 default_time2wait; 301 + u16 default_time2retain; 302 + } __packed; 303 + 304 + struct mgmt_session_info { 305 + u32 session_handle; 306 + u32 status; 307 + u8 isid[6]; 308 + u16 tsih; 309 + u32 session_flags; 310 + u16 conn_count; 311 + u16 pad; 312 + u8 target_name[224]; 313 + u8 initiator_iscsiname[224]; 314 + struct mgmt_session_login_options negotiated_login_options; 315 + struct mgmt_conn_info conn_list[1]; 316 + } __packed; 317 + 318 + struct be_cmd_req_get_session { 319 + struct be_cmd_req_hdr hdr; 320 + u32 session_handle; 321 + } __packed; 322 + 323 + struct be_cmd_resp_get_session { 324 + struct be_cmd_resp_hdr hdr; 325 + struct mgmt_session_info session_info; 326 + } __packed; 327 + 247 328 struct mac_addr { 248 329 u16 size_of_struct; 249 330 u8 addr[ETH_ALEN]; 250 331 } __packed; 332 + 333 + struct be_cmd_req_get_boot_target { 334 + struct be_cmd_req_hdr hdr; 335 + } __packed; 336 + 337 + struct be_cmd_resp_get_boot_target { 338 + struct be_cmd_resp_hdr hdr; 339 + u32 boot_session_count; 340 + int boot_session_handle; 341 + }; 251 342 252 343 struct be_cmd_req_mac_query { 253 344 struct be_cmd_req_hdr hdr; ··· 531 426 int mgmt_check_supported_fw(struct be_ctrl_info *ctrl, 532 427 struct beiscsi_hba *phba); 533 428 unsigned int be_cmd_get_mac_addr(struct beiscsi_hba *phba); 429 + unsigned int beiscsi_get_boot_target(struct beiscsi_hba *phba); 430 + unsigned int beiscsi_get_session_info(struct beiscsi_hba *phba, 431 + u32 boot_session_handle, 432 + struct be_dma_mem *nonemb_cmd); 433 + 534 434 void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag); 535 435 /*ISCSI Functuions */ 536 436 int be_cmd_fw_initialize(struct be_ctrl_info *ctrl); ··· 711 601 struct eq_delay delay[8]; 712 602 } __packed; 713 603 714 - struct ip_address_format { 715 - u16 size_of_structure; 716 - u8 reserved; 717 - u8 ip_type; 718 - u8 ip_address[16]; 719 - u32 rsvd0; 720 - } __packed; 721 - 722 604 struct tcp_connect_and_offload_in { 723 605 struct be_cmd_req_hdr hdr; 724 606 struct ip_address_format ip_address; ··· 790 688 u32 function_caps; 791 689 } __packed; 792 690 793 - #define CMD_ISCSI_COMMAND_INVALIDATE 1 794 - #define ISCSI_OPCODE_SCSI_DATA_OUT 5 691 + struct be_all_if_id { 692 + struct be_cmd_req_hdr hdr; 693 + u32 if_count; 694 + u32 if_hndl_list[1]; 695 + } __packed; 696 + 697 + #define ISCSI_OPCODE_SCSI_DATA_OUT 5 698 + #define OPCODE_COMMON_MODIFY_EQ_DELAY 41 699 + #define OPCODE_COMMON_ISCSI_CLEANUP 59 700 + #define OPCODE_COMMON_TCP_UPLOAD 56 795 701 #define OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD 70 796 - #define OPCODE_ISCSI_INI_DRIVER_OFFLOAD_SESSION 41 797 - #define OPCODE_COMMON_MODIFY_EQ_DELAY 41 798 - #define OPCODE_COMMON_ISCSI_CLEANUP 59 799 - #define OPCODE_COMMON_TCP_UPLOAD 56 800 702 #define OPCODE_COMMON_ISCSI_ERROR_RECOVERY_INVALIDATE_COMMANDS 1 801 - /* --- CMD_ISCSI_INVALIDATE_CONNECTION_TYPE --- */ 802 - #define CMD_ISCSI_CONNECTION_INVALIDATE 0x8001 803 - #define CMD_ISCSI_CONNECTION_ISSUE_TCP_RST 0x8002 703 + #define OPCODE_ISCSI_INI_CFG_GET_HBA_NAME 6 704 + #define OPCODE_ISCSI_INI_CFG_SET_HBA_NAME 7 705 + #define OPCODE_ISCSI_INI_SESSION_GET_A_SESSION 14 706 + #define OPCODE_ISCSI_INI_DRIVER_OFFLOAD_SESSION 41 804 707 #define OPCODE_ISCSI_INI_DRIVER_INVALIDATE_CONNECTION 42 708 + #define OPCODE_ISCSI_INI_BOOT_GET_BOOT_TARGET 52 709 + 710 + /* --- CMD_ISCSI_INVALIDATE_CONNECTION_TYPE --- */ 711 + #define CMD_ISCSI_COMMAND_INVALIDATE 1 712 + #define CMD_ISCSI_CONNECTION_INVALIDATE 0x8001 713 + #define CMD_ISCSI_CONNECTION_ISSUE_TCP_RST 0x8002 805 714 806 715 #define INI_WR_CMD 1 /* Initiator write command */ 807 716 #define INI_TMF_CMD 2 /* Initiator TMF command */
+47 -29
drivers/scsi/be2iscsi/be_iscsi.c
··· 300 300 enum iscsi_host_param param, char *buf) 301 301 { 302 302 struct beiscsi_hba *phba = (struct beiscsi_hba *)iscsi_host_priv(shost); 303 - struct be_cmd_resp_get_mac_addr *resp; 304 - struct be_mcc_wrb *wrb; 305 - unsigned int tag, wrb_num; 306 303 int len = 0; 307 - unsigned short status, extd_status; 308 - struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q; 304 + int status; 309 305 310 306 SE_DEBUG(DBG_LVL_8, "In beiscsi_get_host_param, param= %d\n", param); 311 307 switch (param) { 312 308 case ISCSI_HOST_PARAM_HWADDRESS: 313 - tag = be_cmd_get_mac_addr(phba); 314 - if (!tag) { 315 - SE_DEBUG(DBG_LVL_1, "be_cmd_get_mac_addr Failed\n"); 316 - return -EAGAIN; 317 - } else 318 - wait_event_interruptible(phba->ctrl.mcc_wait[tag], 319 - phba->ctrl.mcc_numtag[tag]); 320 - 321 - wrb_num = (phba->ctrl.mcc_numtag[tag] & 0x00FF0000) >> 16; 322 - extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8; 323 - status = phba->ctrl.mcc_numtag[tag] & 0x000000FF; 324 - if (status || extd_status) { 325 - SE_DEBUG(DBG_LVL_1, "be_cmd_get_mac_addr Failed" 326 - " status = %d extd_status = %d\n", 327 - status, extd_status); 328 - free_mcc_tag(&phba->ctrl, tag); 329 - return -EAGAIN; 330 - } else { 331 - wrb = queue_get_wrb(mccq, wrb_num); 332 - free_mcc_tag(&phba->ctrl, tag); 333 - resp = embedded_payload(wrb); 334 - memcpy(phba->mac_address, resp->mac_address, ETH_ALEN); 335 - len = sysfs_format_mac(buf, phba->mac_address, 336 - ETH_ALEN); 309 + status = beiscsi_get_macaddr(buf, phba); 310 + if (status < 0) { 311 + SE_DEBUG(DBG_LVL_1, "beiscsi_get_macaddr Failed\n"); 312 + return status; 337 313 } 338 314 break; 339 315 default: ··· 317 341 } 318 342 return len; 319 343 } 344 + 345 + int beiscsi_get_macaddr(char *buf, struct beiscsi_hba *phba) 346 + { 347 + struct be_cmd_resp_get_mac_addr *resp; 348 + struct be_mcc_wrb *wrb; 349 + unsigned int tag, wrb_num; 350 + unsigned short status, extd_status; 351 + struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q; 352 + int rc; 353 + 354 + if (phba->read_mac_address) 355 + return sysfs_format_mac(buf, phba->mac_address, 356 + ETH_ALEN); 357 + 358 + tag = be_cmd_get_mac_addr(phba); 359 + if (!tag) { 360 + SE_DEBUG(DBG_LVL_1, "be_cmd_get_mac_addr Failed\n"); 361 + return -EBUSY; 362 + } else 363 + wait_event_interruptible(phba->ctrl.mcc_wait[tag], 364 + phba->ctrl.mcc_numtag[tag]); 365 + 366 + wrb_num = (phba->ctrl.mcc_numtag[tag] & 0x00FF0000) >> 16; 367 + extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8; 368 + status = phba->ctrl.mcc_numtag[tag] & 0x000000FF; 369 + if (status || extd_status) { 370 + SE_DEBUG(DBG_LVL_1, "Failed to get be_cmd_get_mac_addr" 371 + " status = %d extd_status = %d\n", 372 + status, extd_status); 373 + free_mcc_tag(&phba->ctrl, tag); 374 + return -EAGAIN; 375 + } 376 + wrb = queue_get_wrb(mccq, wrb_num); 377 + free_mcc_tag(&phba->ctrl, tag); 378 + resp = embedded_payload(wrb); 379 + memcpy(phba->mac_address, resp->mac_address, ETH_ALEN); 380 + rc = sysfs_format_mac(buf, phba->mac_address, 381 + ETH_ALEN); 382 + phba->read_mac_address = 1; 383 + return rc; 384 + } 385 + 320 386 321 387 /** 322 388 * beiscsi_conn_get_stats - get the iscsi stats
+2
drivers/scsi/be2iscsi/be_iscsi.h
··· 54 54 int beiscsi_get_host_param(struct Scsi_Host *shost, 55 55 enum iscsi_host_param param, char *buf); 56 56 57 + int beiscsi_get_macaddr(char *buf, struct beiscsi_hba *phba); 58 + 57 59 int beiscsi_set_param(struct iscsi_cls_conn *cls_conn, 58 60 enum iscsi_param param, char *buf, int buflen); 59 61
+311
drivers/scsi/be2iscsi/be_main.c
··· 26 26 #include <linux/string.h> 27 27 #include <linux/kernel.h> 28 28 #include <linux/semaphore.h> 29 + #include <linux/iscsi_boot_sysfs.h> 29 30 30 31 #include <scsi/libiscsi.h> 31 32 #include <scsi/scsi_transport_iscsi.h> ··· 212 211 return rc; 213 212 } 214 213 214 + static ssize_t beiscsi_show_boot_tgt_info(void *data, int type, char *buf) 215 + { 216 + struct beiscsi_hba *phba = data; 217 + char *str = buf; 218 + int rc; 219 + 220 + switch (type) { 221 + case ISCSI_BOOT_TGT_NAME: 222 + rc = sprintf(buf, "%.*s\n", 223 + (int)strlen(phba->boot_sess.target_name), 224 + (char *)&phba->boot_sess.target_name); 225 + break; 226 + case ISCSI_BOOT_TGT_IP_ADDR: 227 + if (phba->boot_sess.conn_list[0].dest_ipaddr.ip_type == 0x1) 228 + rc = sprintf(buf, "%pI4\n", 229 + (char *)&phba->boot_sess.conn_list[0]. 230 + dest_ipaddr.ip_address); 231 + else 232 + rc = sprintf(str, "%pI6\n", 233 + (char *)&phba->boot_sess.conn_list[0]. 234 + dest_ipaddr.ip_address); 235 + break; 236 + case ISCSI_BOOT_TGT_PORT: 237 + rc = sprintf(str, "%d\n", phba->boot_sess.conn_list[0]. 238 + dest_port); 239 + break; 240 + 241 + case ISCSI_BOOT_TGT_CHAP_NAME: 242 + rc = sprintf(str, "%.*s\n", 243 + phba->boot_sess.conn_list[0]. 244 + negotiated_login_options.auth_data.chap. 245 + target_chap_name_length, 246 + (char *)&phba->boot_sess.conn_list[0]. 247 + negotiated_login_options.auth_data.chap. 248 + target_chap_name); 249 + break; 250 + case ISCSI_BOOT_TGT_CHAP_SECRET: 251 + rc = sprintf(str, "%.*s\n", 252 + phba->boot_sess.conn_list[0]. 253 + negotiated_login_options.auth_data.chap. 254 + target_secret_length, 255 + (char *)&phba->boot_sess.conn_list[0]. 256 + negotiated_login_options.auth_data.chap. 257 + target_secret); 258 + 259 + break; 260 + case ISCSI_BOOT_TGT_REV_CHAP_NAME: 261 + rc = sprintf(str, "%.*s\n", 262 + phba->boot_sess.conn_list[0]. 263 + negotiated_login_options.auth_data.chap. 264 + intr_chap_name_length, 265 + (char *)&phba->boot_sess.conn_list[0]. 266 + negotiated_login_options.auth_data.chap. 267 + intr_chap_name); 268 + 269 + break; 270 + case ISCSI_BOOT_TGT_REV_CHAP_SECRET: 271 + rc = sprintf(str, "%.*s\n", 272 + phba->boot_sess.conn_list[0]. 273 + negotiated_login_options.auth_data.chap. 274 + intr_secret_length, 275 + (char *)&phba->boot_sess.conn_list[0]. 276 + negotiated_login_options.auth_data.chap. 277 + intr_secret); 278 + break; 279 + case ISCSI_BOOT_TGT_FLAGS: 280 + rc = sprintf(str, "2\n"); 281 + break; 282 + case ISCSI_BOOT_TGT_NIC_ASSOC: 283 + rc = sprintf(str, "0\n"); 284 + break; 285 + default: 286 + rc = -ENOSYS; 287 + break; 288 + } 289 + return rc; 290 + } 291 + 292 + static ssize_t beiscsi_show_boot_ini_info(void *data, int type, char *buf) 293 + { 294 + struct beiscsi_hba *phba = data; 295 + char *str = buf; 296 + int rc; 297 + 298 + switch (type) { 299 + case ISCSI_BOOT_INI_INITIATOR_NAME: 300 + rc = sprintf(str, "%s\n", phba->boot_sess.initiator_iscsiname); 301 + break; 302 + default: 303 + rc = -ENOSYS; 304 + break; 305 + } 306 + return rc; 307 + } 308 + 309 + static ssize_t beiscsi_show_boot_eth_info(void *data, int type, char *buf) 310 + { 311 + struct beiscsi_hba *phba = data; 312 + char *str = buf; 313 + int rc; 314 + 315 + switch (type) { 316 + case ISCSI_BOOT_ETH_FLAGS: 317 + rc = sprintf(str, "2\n"); 318 + break; 319 + case ISCSI_BOOT_ETH_INDEX: 320 + rc = sprintf(str, "0\n"); 321 + break; 322 + case ISCSI_BOOT_ETH_MAC: 323 + rc = beiscsi_get_macaddr(buf, phba); 324 + if (rc < 0) { 325 + SE_DEBUG(DBG_LVL_1, "beiscsi_get_macaddr Failed\n"); 326 + return rc; 327 + } 328 + break; 329 + default: 330 + rc = -ENOSYS; 331 + break; 332 + } 333 + return rc; 334 + } 335 + 336 + 337 + static mode_t beiscsi_tgt_get_attr_visibility(void *data, int type) 338 + { 339 + int rc; 340 + 341 + switch (type) { 342 + case ISCSI_BOOT_TGT_NAME: 343 + case ISCSI_BOOT_TGT_IP_ADDR: 344 + case ISCSI_BOOT_TGT_PORT: 345 + case ISCSI_BOOT_TGT_CHAP_NAME: 346 + case ISCSI_BOOT_TGT_CHAP_SECRET: 347 + case ISCSI_BOOT_TGT_REV_CHAP_NAME: 348 + case ISCSI_BOOT_TGT_REV_CHAP_SECRET: 349 + case ISCSI_BOOT_TGT_NIC_ASSOC: 350 + case ISCSI_BOOT_TGT_FLAGS: 351 + rc = S_IRUGO; 352 + break; 353 + default: 354 + rc = 0; 355 + break; 356 + } 357 + return rc; 358 + } 359 + 360 + static mode_t beiscsi_ini_get_attr_visibility(void *data, int type) 361 + { 362 + int rc; 363 + 364 + switch (type) { 365 + case ISCSI_BOOT_INI_INITIATOR_NAME: 366 + rc = S_IRUGO; 367 + break; 368 + default: 369 + rc = 0; 370 + break; 371 + } 372 + return rc; 373 + } 374 + 375 + 376 + static mode_t beiscsi_eth_get_attr_visibility(void *data, int type) 377 + { 378 + int rc; 379 + 380 + switch (type) { 381 + case ISCSI_BOOT_ETH_FLAGS: 382 + case ISCSI_BOOT_ETH_MAC: 383 + case ISCSI_BOOT_ETH_INDEX: 384 + rc = S_IRUGO; 385 + break; 386 + default: 387 + rc = 0; 388 + break; 389 + } 390 + return rc; 391 + } 392 + 393 + static int beiscsi_setup_boot_info(struct beiscsi_hba *phba) 394 + { 395 + struct iscsi_boot_kobj *boot_kobj; 396 + 397 + phba->boot_kset = iscsi_boot_create_host_kset(phba->shost->host_no); 398 + if (!phba->boot_kset) 399 + return -ENOMEM; 400 + 401 + /* get boot info using mgmt cmd */ 402 + boot_kobj = iscsi_boot_create_target(phba->boot_kset, 0, phba, 403 + beiscsi_show_boot_tgt_info, 404 + beiscsi_tgt_get_attr_visibility); 405 + if (!boot_kobj) 406 + goto free_kset; 407 + 408 + boot_kobj = iscsi_boot_create_initiator(phba->boot_kset, 0, phba, 409 + beiscsi_show_boot_ini_info, 410 + beiscsi_ini_get_attr_visibility); 411 + if (!boot_kobj) 412 + goto free_kset; 413 + 414 + boot_kobj = iscsi_boot_create_ethernet(phba->boot_kset, 0, phba, 415 + beiscsi_show_boot_eth_info, 416 + beiscsi_eth_get_attr_visibility); 417 + if (!boot_kobj) 418 + goto free_kset; 419 + return 0; 420 + 421 + free_kset: 422 + iscsi_boot_destroy_kset(phba->boot_kset); 423 + return -ENOMEM; 424 + } 425 + 215 426 /*------------------- PCI Driver operations and data ----------------- */ 216 427 static DEFINE_PCI_DEVICE_TABLE(beiscsi_pci_id_table) = { 217 428 { PCI_DEVICE(BE_VENDOR_ID, BE_DEVICE_ID1) }, ··· 481 268 482 269 if (iscsi_host_add(shost, &phba->pcidev->dev)) 483 270 goto free_devices; 271 + 272 + if (beiscsi_setup_boot_info(phba)) 273 + /* 274 + * log error but continue, because we may not be using 275 + * iscsi boot. 276 + */ 277 + shost_printk(KERN_ERR, phba->shost, "Could not set up " 278 + "iSCSI boot info."); 279 + 484 280 return phba; 485 281 486 282 free_devices: ··· 3501 3279 "In hwi_disable_intr, Already Disabled\n"); 3502 3280 } 3503 3281 3282 + static int beiscsi_get_boot_info(struct beiscsi_hba *phba) 3283 + { 3284 + struct be_cmd_resp_get_boot_target *boot_resp; 3285 + struct be_cmd_resp_get_session *session_resp; 3286 + struct be_mcc_wrb *wrb; 3287 + struct be_dma_mem nonemb_cmd; 3288 + unsigned int tag, wrb_num; 3289 + unsigned short status, extd_status; 3290 + struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q; 3291 + 3292 + tag = beiscsi_get_boot_target(phba); 3293 + if (!tag) { 3294 + SE_DEBUG(DBG_LVL_1, "be_cmd_get_mac_addr Failed\n"); 3295 + return -EAGAIN; 3296 + } else 3297 + wait_event_interruptible(phba->ctrl.mcc_wait[tag], 3298 + phba->ctrl.mcc_numtag[tag]); 3299 + 3300 + wrb_num = (phba->ctrl.mcc_numtag[tag] & 0x00FF0000) >> 16; 3301 + extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8; 3302 + status = phba->ctrl.mcc_numtag[tag] & 0x000000FF; 3303 + if (status || extd_status) { 3304 + SE_DEBUG(DBG_LVL_1, "be_cmd_get_mac_addr Failed" 3305 + " status = %d extd_status = %d\n", 3306 + status, extd_status); 3307 + free_mcc_tag(&phba->ctrl, tag); 3308 + return -EBUSY; 3309 + } 3310 + wrb = queue_get_wrb(mccq, wrb_num); 3311 + free_mcc_tag(&phba->ctrl, tag); 3312 + boot_resp = embedded_payload(wrb); 3313 + 3314 + if (boot_resp->boot_session_handle < 0) { 3315 + printk(KERN_ERR "No Boot Session for this pci_func," 3316 + "session Hndl = %d\n", boot_resp->boot_session_handle); 3317 + return -ENXIO; 3318 + } 3319 + 3320 + nonemb_cmd.va = pci_alloc_consistent(phba->ctrl.pdev, 3321 + sizeof(*session_resp), 3322 + &nonemb_cmd.dma); 3323 + if (nonemb_cmd.va == NULL) { 3324 + SE_DEBUG(DBG_LVL_1, 3325 + "Failed to allocate memory for" 3326 + "beiscsi_get_session_info\n"); 3327 + return -ENOMEM; 3328 + } 3329 + 3330 + memset(nonemb_cmd.va, 0, sizeof(*session_resp)); 3331 + tag = beiscsi_get_session_info(phba, 3332 + boot_resp->boot_session_handle, &nonemb_cmd); 3333 + if (!tag) { 3334 + SE_DEBUG(DBG_LVL_1, "beiscsi_get_session_info" 3335 + " Failed\n"); 3336 + goto boot_freemem; 3337 + } else 3338 + wait_event_interruptible(phba->ctrl.mcc_wait[tag], 3339 + phba->ctrl.mcc_numtag[tag]); 3340 + 3341 + wrb_num = (phba->ctrl.mcc_numtag[tag] & 0x00FF0000) >> 16; 3342 + extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8; 3343 + status = phba->ctrl.mcc_numtag[tag] & 0x000000FF; 3344 + if (status || extd_status) { 3345 + SE_DEBUG(DBG_LVL_1, "beiscsi_get_session_info Failed" 3346 + " status = %d extd_status = %d\n", 3347 + status, extd_status); 3348 + free_mcc_tag(&phba->ctrl, tag); 3349 + goto boot_freemem; 3350 + } 3351 + wrb = queue_get_wrb(mccq, wrb_num); 3352 + free_mcc_tag(&phba->ctrl, tag); 3353 + session_resp = nonemb_cmd.va ; 3354 + memcpy(&phba->boot_sess, &session_resp->session_info, 3355 + sizeof(struct mgmt_session_info)); 3356 + pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, 3357 + nonemb_cmd.va, nonemb_cmd.dma); 3358 + return 0; 3359 + boot_freemem: 3360 + pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, 3361 + nonemb_cmd.va, nonemb_cmd.dma); 3362 + return -ENOMEM; 3363 + } 3364 + 3504 3365 static int beiscsi_init_port(struct beiscsi_hba *phba) 3505 3366 { 3506 3367 int ret; ··· 4146 3841 iscsi_host_remove(phba->shost); 4147 3842 pci_dev_put(phba->pcidev); 4148 3843 iscsi_host_free(phba->shost); 3844 + iscsi_boot_destroy_kset(phba->boot_kset); 4149 3845 } 4150 3846 4151 3847 static void beiscsi_msix_enable(struct beiscsi_hba *phba) ··· 4302 3996 goto free_blkenbld; 4303 3997 } 4304 3998 hwi_enable_intr(phba); 3999 + ret = beiscsi_get_boot_info(phba); 4000 + if (ret < 0) { 4001 + shost_printk(KERN_ERR, phba->shost, "beiscsi_dev_probe-" 4002 + "No Boot Devices !!!!!\n"); 4003 + } 4305 4004 SE_DEBUG(DBG_LVL_8, "\n\n\n SUCCESS - DRIVER LOADED\n\n\n"); 4306 4005 return 0; 4307 4006
+5 -2
drivers/scsi/be2iscsi/be_main.h
··· 35 35 36 36 #include "be.h" 37 37 #define DRV_NAME "be2iscsi" 38 - #define BUILD_STR "2.0.527.0" 38 + #define BUILD_STR "2.0.549.0" 39 39 #define BE_NAME "ServerEngines BladeEngine2" \ 40 40 "Linux iSCSI Driver version" BUILD_STR 41 41 #define DRV_DESC BE_NAME " " "Driver" ··· 63 63 #define BEISCSI_SGLIST_ELEMENTS 30 64 64 65 65 #define BEISCSI_CMD_PER_LUN 128 /* scsi_host->cmd_per_lun */ 66 - #define BEISCSI_MAX_SECTORS 256 /* scsi_host->max_sectors */ 66 + #define BEISCSI_MAX_SECTORS 2048 /* scsi_host->max_sectors */ 67 67 68 68 #define BEISCSI_MAX_CMD_LEN 16 /* scsi_host->max_cmd_len */ 69 69 #define BEISCSI_NUM_MAX_LUN 256 /* scsi_host->max_lun */ ··· 312 312 struct list_head hba_queue; 313 313 unsigned short *cid_array; 314 314 struct iscsi_endpoint **ep_array; 315 + struct iscsi_boot_kset *boot_kset; 315 316 struct Scsi_Host *shost; 316 317 struct { 317 318 /** ··· 343 342 struct work_struct work_cqs; /* The work being queued */ 344 343 struct be_ctrl_info ctrl; 345 344 unsigned int generation; 345 + unsigned int read_mac_address; 346 + struct mgmt_session_info boot_sess; 346 347 struct invalidate_command_table inv_tbl[128]; 347 348 348 349 };
+71
drivers/scsi/be2iscsi/be_mgmt.c
··· 20 20 21 21 #include "be_mgmt.h" 22 22 #include "be_iscsi.h" 23 + #include <scsi/scsi_transport_iscsi.h> 24 + 25 + unsigned int beiscsi_get_boot_target(struct beiscsi_hba *phba) 26 + { 27 + struct be_ctrl_info *ctrl = &phba->ctrl; 28 + struct be_mcc_wrb *wrb; 29 + struct be_cmd_req_get_mac_addr *req; 30 + unsigned int tag = 0; 31 + 32 + SE_DEBUG(DBG_LVL_8, "In bescsi_get_boot_target\n"); 33 + spin_lock(&ctrl->mbox_lock); 34 + tag = alloc_mcc_tag(phba); 35 + if (!tag) { 36 + spin_unlock(&ctrl->mbox_lock); 37 + return tag; 38 + } 39 + 40 + wrb = wrb_from_mccq(phba); 41 + req = embedded_payload(wrb); 42 + wrb->tag0 |= tag; 43 + be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); 44 + be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI_INI, 45 + OPCODE_ISCSI_INI_BOOT_GET_BOOT_TARGET, 46 + sizeof(*req)); 47 + 48 + be_mcc_notify(phba); 49 + spin_unlock(&ctrl->mbox_lock); 50 + return tag; 51 + } 52 + 53 + unsigned int beiscsi_get_session_info(struct beiscsi_hba *phba, 54 + u32 boot_session_handle, 55 + struct be_dma_mem *nonemb_cmd) 56 + { 57 + struct be_ctrl_info *ctrl = &phba->ctrl; 58 + struct be_mcc_wrb *wrb; 59 + unsigned int tag = 0; 60 + struct be_cmd_req_get_session *req; 61 + struct be_cmd_resp_get_session *resp; 62 + struct be_sge *sge; 63 + 64 + SE_DEBUG(DBG_LVL_8, "In beiscsi_get_session_info\n"); 65 + spin_lock(&ctrl->mbox_lock); 66 + tag = alloc_mcc_tag(phba); 67 + if (!tag) { 68 + spin_unlock(&ctrl->mbox_lock); 69 + return tag; 70 + } 71 + 72 + nonemb_cmd->size = sizeof(*resp); 73 + req = nonemb_cmd->va; 74 + memset(req, 0, sizeof(*req)); 75 + wrb = wrb_from_mccq(phba); 76 + sge = nonembedded_sgl(wrb); 77 + wrb->tag0 |= tag; 78 + 79 + 80 + wrb->tag0 |= tag; 81 + be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1); 82 + be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI_INI, 83 + OPCODE_ISCSI_INI_SESSION_GET_A_SESSION, 84 + sizeof(*resp)); 85 + req->session_handle = boot_session_handle; 86 + sge->pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd->dma)); 87 + sge->pa_lo = cpu_to_le32(nonemb_cmd->dma & 0xFFFFFFFF); 88 + sge->len = cpu_to_le32(nonemb_cmd->size); 89 + 90 + be_mcc_notify(phba); 91 + spin_unlock(&ctrl->mbox_lock); 92 + return tag; 93 + } 23 94 24 95 int mgmt_get_fw_config(struct be_ctrl_info *ctrl, 25 96 struct beiscsi_hba *phba)
+241 -199
drivers/scsi/ibmvscsi/ibmvfc.c
··· 433 433 { 434 434 switch (tgt->action) { 435 435 case IBMVFC_TGT_ACTION_DEL_RPORT: 436 + if (action == IBMVFC_TGT_ACTION_DELETED_RPORT) 437 + tgt->action = action; 438 + case IBMVFC_TGT_ACTION_DELETED_RPORT: 436 439 break; 437 440 default: 438 441 if (action == IBMVFC_TGT_ACTION_DEL_RPORT) ··· 2039 2036 } 2040 2037 2041 2038 /** 2042 - * ibmvfc_abort_task_set - Abort outstanding commands to the device 2043 - * @sdev: scsi device to abort commands 2044 - * 2045 - * This sends an Abort Task Set to the VIOS for the specified device. This does 2046 - * NOT send any cancel to the VIOS. That must be done separately. 2039 + * ibmvfc_match_rport - Match function for specified remote port 2040 + * @evt: ibmvfc event struct 2041 + * @device: device to match (rport) 2047 2042 * 2048 2043 * Returns: 2049 - * 0 on success / other on failure 2044 + * 1 if event matches rport / 0 if event does not match rport 2050 2045 **/ 2051 - static int ibmvfc_abort_task_set(struct scsi_device *sdev) 2046 + static int ibmvfc_match_rport(struct ibmvfc_event *evt, void *rport) 2052 2047 { 2053 - struct ibmvfc_host *vhost = shost_priv(sdev->host); 2054 - struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); 2055 - struct ibmvfc_cmd *tmf; 2056 - struct ibmvfc_event *evt, *found_evt; 2057 - union ibmvfc_iu rsp_iu; 2058 - struct ibmvfc_fcp_rsp *fc_rsp = &rsp_iu.cmd.rsp; 2059 - int rsp_rc = -EBUSY; 2060 - unsigned long flags; 2061 - int rsp_code = 0; 2048 + struct fc_rport *cmd_rport; 2062 2049 2063 - spin_lock_irqsave(vhost->host->host_lock, flags); 2064 - found_evt = NULL; 2065 - list_for_each_entry(evt, &vhost->sent, queue) { 2066 - if (evt->cmnd && evt->cmnd->device == sdev) { 2067 - found_evt = evt; 2068 - break; 2069 - } 2050 + if (evt->cmnd) { 2051 + cmd_rport = starget_to_rport(scsi_target(evt->cmnd->device)); 2052 + if (cmd_rport == rport) 2053 + return 1; 2070 2054 } 2071 - 2072 - if (!found_evt) { 2073 - if (vhost->log_level > IBMVFC_DEFAULT_LOG_LEVEL) 2074 - sdev_printk(KERN_INFO, sdev, "No events found to abort\n"); 2075 - spin_unlock_irqrestore(vhost->host->host_lock, flags); 2076 - return 0; 2077 - } 2078 - 2079 - if (vhost->state == IBMVFC_ACTIVE) { 2080 - evt = ibmvfc_get_event(vhost); 2081 - ibmvfc_init_event(evt, ibmvfc_sync_completion, IBMVFC_CMD_FORMAT); 2082 - 2083 - tmf = &evt->iu.cmd; 2084 - memset(tmf, 0, sizeof(*tmf)); 2085 - tmf->resp.va = (u64)evt->crq.ioba + offsetof(struct ibmvfc_cmd, rsp); 2086 - tmf->resp.len = sizeof(tmf->rsp); 2087 - tmf->frame_type = IBMVFC_SCSI_FCP_TYPE; 2088 - tmf->payload_len = sizeof(tmf->iu); 2089 - tmf->resp_len = sizeof(tmf->rsp); 2090 - tmf->cancel_key = (unsigned long)sdev->hostdata; 2091 - tmf->tgt_scsi_id = rport->port_id; 2092 - int_to_scsilun(sdev->lun, &tmf->iu.lun); 2093 - tmf->flags = (IBMVFC_NO_MEM_DESC | IBMVFC_TMF); 2094 - tmf->iu.tmf_flags = IBMVFC_ABORT_TASK_SET; 2095 - evt->sync_iu = &rsp_iu; 2096 - 2097 - init_completion(&evt->comp); 2098 - rsp_rc = ibmvfc_send_event(evt, vhost, default_timeout); 2099 - } 2100 - 2101 - spin_unlock_irqrestore(vhost->host->host_lock, flags); 2102 - 2103 - if (rsp_rc != 0) { 2104 - sdev_printk(KERN_ERR, sdev, "Failed to send abort. rc=%d\n", rsp_rc); 2105 - return -EIO; 2106 - } 2107 - 2108 - sdev_printk(KERN_INFO, sdev, "Aborting outstanding commands\n"); 2109 - wait_for_completion(&evt->comp); 2110 - 2111 - if (rsp_iu.cmd.status) 2112 - rsp_code = ibmvfc_get_err_result(&rsp_iu.cmd); 2113 - 2114 - if (rsp_code) { 2115 - if (fc_rsp->flags & FCP_RSP_LEN_VALID) 2116 - rsp_code = fc_rsp->data.info.rsp_code; 2117 - 2118 - sdev_printk(KERN_ERR, sdev, "Abort failed: %s (%x:%x) " 2119 - "flags: %x fcp_rsp: %x, scsi_status: %x\n", 2120 - ibmvfc_get_cmd_error(rsp_iu.cmd.status, rsp_iu.cmd.error), 2121 - rsp_iu.cmd.status, rsp_iu.cmd.error, fc_rsp->flags, rsp_code, 2122 - fc_rsp->scsi_status); 2123 - rsp_rc = -EIO; 2124 - } else 2125 - sdev_printk(KERN_INFO, sdev, "Abort successful\n"); 2126 - 2127 - spin_lock_irqsave(vhost->host->host_lock, flags); 2128 - ibmvfc_free_event(evt); 2129 - spin_unlock_irqrestore(vhost->host->host_lock, flags); 2130 - return rsp_rc; 2131 - } 2132 - 2133 - /** 2134 - * ibmvfc_cancel_all - Cancel all outstanding commands to the device 2135 - * @sdev: scsi device to cancel commands 2136 - * @type: type of error recovery being performed 2137 - * 2138 - * This sends a cancel to the VIOS for the specified device. This does 2139 - * NOT send any abort to the actual device. That must be done separately. 2140 - * 2141 - * Returns: 2142 - * 0 on success / other on failure 2143 - **/ 2144 - static int ibmvfc_cancel_all(struct scsi_device *sdev, int type) 2145 - { 2146 - struct ibmvfc_host *vhost = shost_priv(sdev->host); 2147 - struct scsi_target *starget = scsi_target(sdev); 2148 - struct fc_rport *rport = starget_to_rport(starget); 2149 - struct ibmvfc_tmf *tmf; 2150 - struct ibmvfc_event *evt, *found_evt; 2151 - union ibmvfc_iu rsp; 2152 - int rsp_rc = -EBUSY; 2153 - unsigned long flags; 2154 - u16 status; 2155 - 2156 - ENTER; 2157 - spin_lock_irqsave(vhost->host->host_lock, flags); 2158 - found_evt = NULL; 2159 - list_for_each_entry(evt, &vhost->sent, queue) { 2160 - if (evt->cmnd && evt->cmnd->device == sdev) { 2161 - found_evt = evt; 2162 - break; 2163 - } 2164 - } 2165 - 2166 - if (!found_evt) { 2167 - if (vhost->log_level > IBMVFC_DEFAULT_LOG_LEVEL) 2168 - sdev_printk(KERN_INFO, sdev, "No events found to cancel\n"); 2169 - spin_unlock_irqrestore(vhost->host->host_lock, flags); 2170 - return 0; 2171 - } 2172 - 2173 - if (vhost->state == IBMVFC_ACTIVE) { 2174 - evt = ibmvfc_get_event(vhost); 2175 - ibmvfc_init_event(evt, ibmvfc_sync_completion, IBMVFC_MAD_FORMAT); 2176 - 2177 - tmf = &evt->iu.tmf; 2178 - memset(tmf, 0, sizeof(*tmf)); 2179 - tmf->common.version = 1; 2180 - tmf->common.opcode = IBMVFC_TMF_MAD; 2181 - tmf->common.length = sizeof(*tmf); 2182 - tmf->scsi_id = rport->port_id; 2183 - int_to_scsilun(sdev->lun, &tmf->lun); 2184 - tmf->flags = (type | IBMVFC_TMF_LUA_VALID); 2185 - tmf->cancel_key = (unsigned long)sdev->hostdata; 2186 - tmf->my_cancel_key = (unsigned long)starget->hostdata; 2187 - 2188 - evt->sync_iu = &rsp; 2189 - init_completion(&evt->comp); 2190 - rsp_rc = ibmvfc_send_event(evt, vhost, default_timeout); 2191 - } 2192 - 2193 - spin_unlock_irqrestore(vhost->host->host_lock, flags); 2194 - 2195 - if (rsp_rc != 0) { 2196 - sdev_printk(KERN_ERR, sdev, "Failed to send cancel event. rc=%d\n", rsp_rc); 2197 - return -EIO; 2198 - } 2199 - 2200 - sdev_printk(KERN_INFO, sdev, "Cancelling outstanding commands.\n"); 2201 - 2202 - wait_for_completion(&evt->comp); 2203 - status = rsp.mad_common.status; 2204 - spin_lock_irqsave(vhost->host->host_lock, flags); 2205 - ibmvfc_free_event(evt); 2206 - spin_unlock_irqrestore(vhost->host->host_lock, flags); 2207 - 2208 - if (status != IBMVFC_MAD_SUCCESS) { 2209 - sdev_printk(KERN_WARNING, sdev, "Cancel failed with rc=%x\n", status); 2210 - return -EIO; 2211 - } 2212 - 2213 - sdev_printk(KERN_INFO, sdev, "Successfully cancelled outstanding commands\n"); 2214 2055 return 0; 2215 2056 } 2216 2057 ··· 2144 2297 } 2145 2298 2146 2299 /** 2300 + * ibmvfc_cancel_all - Cancel all outstanding commands to the device 2301 + * @sdev: scsi device to cancel commands 2302 + * @type: type of error recovery being performed 2303 + * 2304 + * This sends a cancel to the VIOS for the specified device. This does 2305 + * NOT send any abort to the actual device. That must be done separately. 2306 + * 2307 + * Returns: 2308 + * 0 on success / other on failure 2309 + **/ 2310 + static int ibmvfc_cancel_all(struct scsi_device *sdev, int type) 2311 + { 2312 + struct ibmvfc_host *vhost = shost_priv(sdev->host); 2313 + struct scsi_target *starget = scsi_target(sdev); 2314 + struct fc_rport *rport = starget_to_rport(starget); 2315 + struct ibmvfc_tmf *tmf; 2316 + struct ibmvfc_event *evt, *found_evt; 2317 + union ibmvfc_iu rsp; 2318 + int rsp_rc = -EBUSY; 2319 + unsigned long flags; 2320 + u16 status; 2321 + 2322 + ENTER; 2323 + spin_lock_irqsave(vhost->host->host_lock, flags); 2324 + found_evt = NULL; 2325 + list_for_each_entry(evt, &vhost->sent, queue) { 2326 + if (evt->cmnd && evt->cmnd->device == sdev) { 2327 + found_evt = evt; 2328 + break; 2329 + } 2330 + } 2331 + 2332 + if (!found_evt) { 2333 + if (vhost->log_level > IBMVFC_DEFAULT_LOG_LEVEL) 2334 + sdev_printk(KERN_INFO, sdev, "No events found to cancel\n"); 2335 + spin_unlock_irqrestore(vhost->host->host_lock, flags); 2336 + return 0; 2337 + } 2338 + 2339 + if (vhost->state == IBMVFC_ACTIVE) { 2340 + evt = ibmvfc_get_event(vhost); 2341 + ibmvfc_init_event(evt, ibmvfc_sync_completion, IBMVFC_MAD_FORMAT); 2342 + 2343 + tmf = &evt->iu.tmf; 2344 + memset(tmf, 0, sizeof(*tmf)); 2345 + tmf->common.version = 1; 2346 + tmf->common.opcode = IBMVFC_TMF_MAD; 2347 + tmf->common.length = sizeof(*tmf); 2348 + tmf->scsi_id = rport->port_id; 2349 + int_to_scsilun(sdev->lun, &tmf->lun); 2350 + tmf->flags = (type | IBMVFC_TMF_LUA_VALID); 2351 + tmf->cancel_key = (unsigned long)sdev->hostdata; 2352 + tmf->my_cancel_key = (unsigned long)starget->hostdata; 2353 + 2354 + evt->sync_iu = &rsp; 2355 + init_completion(&evt->comp); 2356 + rsp_rc = ibmvfc_send_event(evt, vhost, default_timeout); 2357 + } 2358 + 2359 + spin_unlock_irqrestore(vhost->host->host_lock, flags); 2360 + 2361 + if (rsp_rc != 0) { 2362 + sdev_printk(KERN_ERR, sdev, "Failed to send cancel event. rc=%d\n", rsp_rc); 2363 + return -EIO; 2364 + } 2365 + 2366 + sdev_printk(KERN_INFO, sdev, "Cancelling outstanding commands.\n"); 2367 + 2368 + wait_for_completion(&evt->comp); 2369 + status = rsp.mad_common.status; 2370 + spin_lock_irqsave(vhost->host->host_lock, flags); 2371 + ibmvfc_free_event(evt); 2372 + spin_unlock_irqrestore(vhost->host->host_lock, flags); 2373 + 2374 + if (status != IBMVFC_MAD_SUCCESS) { 2375 + sdev_printk(KERN_WARNING, sdev, "Cancel failed with rc=%x\n", status); 2376 + return -EIO; 2377 + } 2378 + 2379 + sdev_printk(KERN_INFO, sdev, "Successfully cancelled outstanding commands\n"); 2380 + return 0; 2381 + } 2382 + 2383 + /** 2384 + * ibmvfc_match_key - Match function for specified cancel key 2385 + * @evt: ibmvfc event struct 2386 + * @key: cancel key to match 2387 + * 2388 + * Returns: 2389 + * 1 if event matches key / 0 if event does not match key 2390 + **/ 2391 + static int ibmvfc_match_key(struct ibmvfc_event *evt, void *key) 2392 + { 2393 + unsigned long cancel_key = (unsigned long)key; 2394 + 2395 + if (evt->crq.format == IBMVFC_CMD_FORMAT && 2396 + evt->iu.cmd.cancel_key == cancel_key) 2397 + return 1; 2398 + return 0; 2399 + } 2400 + 2401 + /** 2402 + * ibmvfc_abort_task_set - Abort outstanding commands to the device 2403 + * @sdev: scsi device to abort commands 2404 + * 2405 + * This sends an Abort Task Set to the VIOS for the specified device. This does 2406 + * NOT send any cancel to the VIOS. That must be done separately. 2407 + * 2408 + * Returns: 2409 + * 0 on success / other on failure 2410 + **/ 2411 + static int ibmvfc_abort_task_set(struct scsi_device *sdev) 2412 + { 2413 + struct ibmvfc_host *vhost = shost_priv(sdev->host); 2414 + struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); 2415 + struct ibmvfc_cmd *tmf; 2416 + struct ibmvfc_event *evt, *found_evt; 2417 + union ibmvfc_iu rsp_iu; 2418 + struct ibmvfc_fcp_rsp *fc_rsp = &rsp_iu.cmd.rsp; 2419 + int rc, rsp_rc = -EBUSY; 2420 + unsigned long flags, timeout = IBMVFC_ABORT_TIMEOUT; 2421 + int rsp_code = 0; 2422 + 2423 + spin_lock_irqsave(vhost->host->host_lock, flags); 2424 + found_evt = NULL; 2425 + list_for_each_entry(evt, &vhost->sent, queue) { 2426 + if (evt->cmnd && evt->cmnd->device == sdev) { 2427 + found_evt = evt; 2428 + break; 2429 + } 2430 + } 2431 + 2432 + if (!found_evt) { 2433 + if (vhost->log_level > IBMVFC_DEFAULT_LOG_LEVEL) 2434 + sdev_printk(KERN_INFO, sdev, "No events found to abort\n"); 2435 + spin_unlock_irqrestore(vhost->host->host_lock, flags); 2436 + return 0; 2437 + } 2438 + 2439 + if (vhost->state == IBMVFC_ACTIVE) { 2440 + evt = ibmvfc_get_event(vhost); 2441 + ibmvfc_init_event(evt, ibmvfc_sync_completion, IBMVFC_CMD_FORMAT); 2442 + 2443 + tmf = &evt->iu.cmd; 2444 + memset(tmf, 0, sizeof(*tmf)); 2445 + tmf->resp.va = (u64)evt->crq.ioba + offsetof(struct ibmvfc_cmd, rsp); 2446 + tmf->resp.len = sizeof(tmf->rsp); 2447 + tmf->frame_type = IBMVFC_SCSI_FCP_TYPE; 2448 + tmf->payload_len = sizeof(tmf->iu); 2449 + tmf->resp_len = sizeof(tmf->rsp); 2450 + tmf->cancel_key = (unsigned long)sdev->hostdata; 2451 + tmf->tgt_scsi_id = rport->port_id; 2452 + int_to_scsilun(sdev->lun, &tmf->iu.lun); 2453 + tmf->flags = (IBMVFC_NO_MEM_DESC | IBMVFC_TMF); 2454 + tmf->iu.tmf_flags = IBMVFC_ABORT_TASK_SET; 2455 + evt->sync_iu = &rsp_iu; 2456 + 2457 + init_completion(&evt->comp); 2458 + rsp_rc = ibmvfc_send_event(evt, vhost, default_timeout); 2459 + } 2460 + 2461 + spin_unlock_irqrestore(vhost->host->host_lock, flags); 2462 + 2463 + if (rsp_rc != 0) { 2464 + sdev_printk(KERN_ERR, sdev, "Failed to send abort. rc=%d\n", rsp_rc); 2465 + return -EIO; 2466 + } 2467 + 2468 + sdev_printk(KERN_INFO, sdev, "Aborting outstanding commands\n"); 2469 + timeout = wait_for_completion_timeout(&evt->comp, timeout); 2470 + 2471 + if (!timeout) { 2472 + rc = ibmvfc_cancel_all(sdev, IBMVFC_TMF_ABORT_TASK_SET); 2473 + if (!rc) { 2474 + rc = ibmvfc_wait_for_ops(vhost, sdev->hostdata, ibmvfc_match_key); 2475 + if (rc == SUCCESS) 2476 + rc = 0; 2477 + } 2478 + 2479 + if (rc) { 2480 + sdev_printk(KERN_INFO, sdev, "Cancel failed, resetting host\n"); 2481 + ibmvfc_reset_host(vhost); 2482 + rsp_rc = 0; 2483 + goto out; 2484 + } 2485 + } 2486 + 2487 + if (rsp_iu.cmd.status) 2488 + rsp_code = ibmvfc_get_err_result(&rsp_iu.cmd); 2489 + 2490 + if (rsp_code) { 2491 + if (fc_rsp->flags & FCP_RSP_LEN_VALID) 2492 + rsp_code = fc_rsp->data.info.rsp_code; 2493 + 2494 + sdev_printk(KERN_ERR, sdev, "Abort failed: %s (%x:%x) " 2495 + "flags: %x fcp_rsp: %x, scsi_status: %x\n", 2496 + ibmvfc_get_cmd_error(rsp_iu.cmd.status, rsp_iu.cmd.error), 2497 + rsp_iu.cmd.status, rsp_iu.cmd.error, fc_rsp->flags, rsp_code, 2498 + fc_rsp->scsi_status); 2499 + rsp_rc = -EIO; 2500 + } else 2501 + sdev_printk(KERN_INFO, sdev, "Abort successful\n"); 2502 + 2503 + out: 2504 + spin_lock_irqsave(vhost->host->host_lock, flags); 2505 + ibmvfc_free_event(evt); 2506 + spin_unlock_irqrestore(vhost->host->host_lock, flags); 2507 + return rsp_rc; 2508 + } 2509 + 2510 + /** 2147 2511 * ibmvfc_eh_abort_handler - Abort a command 2148 2512 * @cmd: scsi command to abort 2149 2513 * ··· 2409 2351 } 2410 2352 2411 2353 /** 2412 - * ibmvfc_dev_cancel_all_abts - Device iterated cancel all function 2413 - * @sdev: scsi device struct 2414 - * @data: return code 2415 - * 2416 - **/ 2417 - static void ibmvfc_dev_cancel_all_abts(struct scsi_device *sdev, void *data) 2418 - { 2419 - unsigned long *rc = data; 2420 - *rc |= ibmvfc_cancel_all(sdev, IBMVFC_TMF_ABORT_TASK_SET); 2421 - } 2422 - 2423 - /** 2424 2354 * ibmvfc_dev_cancel_all_reset - Device iterated cancel all function 2425 2355 * @sdev: scsi device struct 2426 2356 * @data: return code ··· 2418 2372 { 2419 2373 unsigned long *rc = data; 2420 2374 *rc |= ibmvfc_cancel_all(sdev, IBMVFC_TMF_TGT_RESET); 2421 - } 2422 - 2423 - /** 2424 - * ibmvfc_dev_abort_all - Device iterated abort task set function 2425 - * @sdev: scsi device struct 2426 - * @data: return code 2427 - * 2428 - **/ 2429 - static void ibmvfc_dev_abort_all(struct scsi_device *sdev, void *data) 2430 - { 2431 - unsigned long *rc = data; 2432 - *rc |= ibmvfc_abort_task_set(sdev); 2433 2375 } 2434 2376 2435 2377 /** ··· 2474 2440 **/ 2475 2441 static void ibmvfc_terminate_rport_io(struct fc_rport *rport) 2476 2442 { 2477 - struct scsi_target *starget = to_scsi_target(&rport->dev); 2478 - struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); 2443 + struct Scsi_Host *shost = rport_to_shost(rport); 2479 2444 struct ibmvfc_host *vhost = shost_priv(shost); 2480 - unsigned long cancel_rc = 0; 2481 - unsigned long abort_rc = 0; 2482 - int rc = FAILED; 2445 + struct fc_rport *dev_rport; 2446 + struct scsi_device *sdev; 2447 + unsigned long rc; 2483 2448 2484 2449 ENTER; 2485 - starget_for_each_device(starget, &cancel_rc, ibmvfc_dev_cancel_all_abts); 2486 - starget_for_each_device(starget, &abort_rc, ibmvfc_dev_abort_all); 2450 + shost_for_each_device(sdev, shost) { 2451 + dev_rport = starget_to_rport(scsi_target(sdev)); 2452 + if (dev_rport != rport) 2453 + continue; 2454 + ibmvfc_cancel_all(sdev, IBMVFC_TMF_ABORT_TASK_SET); 2455 + ibmvfc_abort_task_set(sdev); 2456 + } 2487 2457 2488 - if (!cancel_rc && !abort_rc) 2489 - rc = ibmvfc_wait_for_ops(vhost, starget, ibmvfc_match_target); 2458 + rc = ibmvfc_wait_for_ops(vhost, rport, ibmvfc_match_rport); 2490 2459 2491 2460 if (rc == FAILED) 2492 2461 ibmvfc_issue_fc_host_lip(shost); ··· 4230 4193 if (rport && tgt->action == IBMVFC_TGT_ACTION_DEL_RPORT) { 4231 4194 tgt_dbg(tgt, "Deleting rport\n"); 4232 4195 list_del(&tgt->queue); 4196 + ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DELETED_RPORT); 4233 4197 spin_unlock_irqrestore(vhost->host->host_lock, flags); 4234 4198 fc_remote_port_delete(rport); 4235 4199 del_timer_sync(&tgt->timer); 4236 4200 kref_put(&tgt->kref, ibmvfc_release_tgt); 4201 + return; 4202 + } else if (rport && tgt->action == IBMVFC_TGT_ACTION_DELETED_RPORT) { 4203 + spin_unlock_irqrestore(vhost->host->host_lock, flags); 4237 4204 return; 4238 4205 } 4239 4206 ··· 4338 4297 rport = tgt->rport; 4339 4298 tgt->rport = NULL; 4340 4299 list_del(&tgt->queue); 4300 + ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DELETED_RPORT); 4341 4301 spin_unlock_irqrestore(vhost->host->host_lock, flags); 4342 4302 if (rport) 4343 4303 fc_remote_port_delete(rport);
+4 -2
drivers/scsi/ibmvscsi/ibmvfc.h
··· 29 29 #include "viosrp.h" 30 30 31 31 #define IBMVFC_NAME "ibmvfc" 32 - #define IBMVFC_DRIVER_VERSION "1.0.8" 33 - #define IBMVFC_DRIVER_DATE "(June 17, 2010)" 32 + #define IBMVFC_DRIVER_VERSION "1.0.9" 33 + #define IBMVFC_DRIVER_DATE "(August 5, 2010)" 34 34 35 35 #define IBMVFC_DEFAULT_TIMEOUT 60 36 36 #define IBMVFC_ADISC_CANCEL_TIMEOUT 45 ··· 38 38 #define IBMVFC_ADISC_PLUS_CANCEL_TIMEOUT \ 39 39 (IBMVFC_ADISC_TIMEOUT + IBMVFC_ADISC_CANCEL_TIMEOUT) 40 40 #define IBMVFC_INIT_TIMEOUT 120 41 + #define IBMVFC_ABORT_TIMEOUT 8 41 42 #define IBMVFC_ABORT_WAIT_TIMEOUT 40 42 43 #define IBMVFC_MAX_REQUESTS_DEFAULT 100 43 44 ··· 598 597 IBMVFC_TGT_ACTION_INIT, 599 598 IBMVFC_TGT_ACTION_INIT_WAIT, 600 599 IBMVFC_TGT_ACTION_DEL_RPORT, 600 + IBMVFC_TGT_ACTION_DELETED_RPORT, 601 601 }; 602 602 603 603 struct ibmvfc_target {
+2 -2
drivers/scsi/libfc/fc_fcp.c
··· 1765 1765 struct fcoe_dev_stats *stats; 1766 1766 1767 1767 lport = shost_priv(sc_cmd->device->host); 1768 - spin_unlock_irq(lport->host->host_lock); 1769 1768 1770 1769 rval = fc_remote_port_chkready(rport); 1771 1770 if (rval) { 1772 1771 sc_cmd->result = rval; 1773 1772 done(sc_cmd); 1774 - goto out; 1773 + return 0; 1775 1774 } 1775 + spin_unlock_irq(lport->host->host_lock); 1776 1776 1777 1777 if (!*(struct fc_remote_port **)rport->dd_data) { 1778 1778 /*
+3
drivers/scsi/lpfc/lpfc.h
··· 775 775 uint8_t temp_sensor_support; 776 776 /* Fields used for heart beat. */ 777 777 unsigned long last_completion_time; 778 + unsigned long skipped_hb; 778 779 struct timer_list hb_tmofunc; 779 780 uint8_t hb_outstanding; 780 781 enum hba_temp_state over_temp_state; ··· 818 817 uint32_t iocb_cnt; 819 818 uint32_t iocb_max; 820 819 atomic_t sdev_cnt; 820 + uint8_t fips_spec_rev; 821 + uint8_t fips_level; 821 822 }; 822 823 823 824 static inline struct Scsi_Host *
+45 -1
drivers/scsi/lpfc/lpfc_attr.c
··· 1240 1240 } 1241 1241 1242 1242 /** 1243 + * lpfc_fips_level_show - Return the current FIPS level for the HBA 1244 + * @dev: class unused variable. 1245 + * @attr: device attribute, not used. 1246 + * @buf: on return contains the module description text. 1247 + * 1248 + * Returns: size of formatted string. 1249 + **/ 1250 + static ssize_t 1251 + lpfc_fips_level_show(struct device *dev, struct device_attribute *attr, 1252 + char *buf) 1253 + { 1254 + struct Scsi_Host *shost = class_to_shost(dev); 1255 + struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 1256 + struct lpfc_hba *phba = vport->phba; 1257 + 1258 + return snprintf(buf, PAGE_SIZE, "%d\n", phba->fips_level); 1259 + } 1260 + 1261 + /** 1262 + * lpfc_fips_rev_show - Return the FIPS Spec revision for the HBA 1263 + * @dev: class unused variable. 1264 + * @attr: device attribute, not used. 1265 + * @buf: on return contains the module description text. 1266 + * 1267 + * Returns: size of formatted string. 1268 + **/ 1269 + static ssize_t 1270 + lpfc_fips_rev_show(struct device *dev, struct device_attribute *attr, 1271 + char *buf) 1272 + { 1273 + struct Scsi_Host *shost = class_to_shost(dev); 1274 + struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 1275 + struct lpfc_hba *phba = vport->phba; 1276 + 1277 + return snprintf(buf, PAGE_SIZE, "%d\n", phba->fips_spec_rev); 1278 + } 1279 + 1280 + /** 1243 1281 * lpfc_param_show - Return a cfg attribute value in decimal 1244 1282 * 1245 1283 * Description: ··· 1715 1677 static DEVICE_ATTR(used_xri, S_IRUGO, lpfc_used_xri_show, NULL); 1716 1678 static DEVICE_ATTR(npiv_info, S_IRUGO, lpfc_npiv_info_show, NULL); 1717 1679 static DEVICE_ATTR(lpfc_temp_sensor, S_IRUGO, lpfc_temp_sensor_show, NULL); 1680 + static DEVICE_ATTR(lpfc_fips_level, S_IRUGO, lpfc_fips_level_show, NULL); 1681 + static DEVICE_ATTR(lpfc_fips_rev, S_IRUGO, lpfc_fips_rev_show, NULL); 1718 1682 1719 1683 1720 1684 static char *lpfc_soft_wwn_key = "C99G71SL8032A"; ··· 3318 3278 # - Default will result in registering capabilities for all profiles. 3319 3279 # 3320 3280 */ 3321 - unsigned int lpfc_prot_mask = SHOST_DIX_TYPE0_PROTECTION; 3281 + unsigned int lpfc_prot_mask = SHOST_DIF_TYPE1_PROTECTION; 3322 3282 3323 3283 module_param(lpfc_prot_mask, uint, 0); 3324 3284 MODULE_PARM_DESC(lpfc_prot_mask, "host protection mask"); ··· 3423 3383 &dev_attr_iocb_hw, 3424 3384 &dev_attr_txq_hw, 3425 3385 &dev_attr_txcmplq_hw, 3386 + &dev_attr_lpfc_fips_level, 3387 + &dev_attr_lpfc_fips_rev, 3426 3388 NULL, 3427 3389 }; 3428 3390 ··· 3451 3409 &dev_attr_lpfc_max_scsicmpl_time, 3452 3410 &dev_attr_lpfc_stat_data_ctrl, 3453 3411 &dev_attr_lpfc_static_vport, 3412 + &dev_attr_lpfc_fips_level, 3413 + &dev_attr_lpfc_fips_rev, 3454 3414 NULL, 3455 3415 }; 3456 3416
-9
drivers/scsi/lpfc/lpfc_bsg.c
··· 2724 2724 2725 2725 pmboxq->context2 = ext; 2726 2726 pmboxq->in_ext_byte_len = 2727 - mbox_req->inExtWLen * 2728 - sizeof(uint32_t); 2729 - pmboxq->out_ext_byte_len = 2730 - mbox_req->outExtWLen * 2731 - sizeof(uint32_t); 2732 - pmboxq->mbox_offset_word = 2733 - mbox_req->mbOffset; 2734 - pmboxq->context2 = ext; 2735 - pmboxq->in_ext_byte_len = 2736 2727 mbox_req->inExtWLen * sizeof(uint32_t); 2737 2728 pmboxq->out_ext_byte_len = 2738 2729 mbox_req->outExtWLen * sizeof(uint32_t);
+1 -2
drivers/scsi/lpfc/lpfc_compat.h
··· 82 82 static inline void 83 83 lpfc_memcpy_to_slim( void __iomem *dest, void *src, unsigned int bytes) 84 84 { 85 - /* actually returns 1 byte past dest */ 86 - memcpy_toio( dest, src, bytes); 85 + __iowrite32_copy(dest, src, bytes); 87 86 } 88 87 89 88 static inline void
+70 -6
drivers/scsi/lpfc/lpfc_els.c
··· 600 600 vport->fc_flag |= FC_VPORT_NEEDS_INIT_VPI; 601 601 spin_unlock_irq(shost->host_lock); 602 602 } 603 + } else if ((phba->sli_rev == LPFC_SLI_REV4) && 604 + !(vport->fc_flag & FC_VPORT_NEEDS_REG_VPI)) { 605 + /* 606 + * Driver needs to re-reg VPI in order for f/w 607 + * to update the MAC address. 608 + */ 609 + lpfc_register_new_vport(phba, vport, ndlp); 610 + return 0; 603 611 } 604 612 605 613 if (phba->sli_rev < LPFC_SLI_REV4) { ··· 809 801 (irsp->un.ulpWord[4] != IOERR_SLI_ABORTED)) { 810 802 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP | LOG_ELS, 811 803 "2611 FLOGI failed on registered " 812 - "FCF record fcf_index:%d, trying " 813 - "to perform round robin failover\n", 814 - phba->fcf.current_rec.fcf_indx); 804 + "FCF record fcf_index(%d), status: " 805 + "x%x/x%x, tmo:x%x, trying to perform " 806 + "round robin failover\n", 807 + phba->fcf.current_rec.fcf_indx, 808 + irsp->ulpStatus, irsp->un.ulpWord[4], 809 + irsp->ulpTimeout); 815 810 fcf_index = lpfc_sli4_fcf_rr_next_index_get(phba); 816 811 if (fcf_index == LPFC_FCOE_FCF_NEXT_NONE) { 817 812 /* ··· 851 840 goto out; 852 841 } 853 842 } 843 + 844 + /* FLOGI failure */ 845 + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, 846 + "2858 FLOGI failure Status:x%x/x%x TMO:x%x\n", 847 + irsp->ulpStatus, irsp->un.ulpWord[4], 848 + irsp->ulpTimeout); 854 849 855 850 /* Check for retry */ 856 851 if (lpfc_els_retry(phba, cmdiocb, rspiocb)) ··· 1308 1291 struct serv_parm *sp; 1309 1292 uint8_t name[sizeof(struct lpfc_name)]; 1310 1293 uint32_t rc, keepDID = 0; 1294 + int put_node; 1295 + int put_rport; 1311 1296 1312 1297 /* Fabric nodes can have the same WWPN so we don't bother searching 1313 1298 * by WWPN. Just return the ndlp that was given to us. ··· 1398 1379 /* Two ndlps cannot have the same did */ 1399 1380 ndlp->nlp_DID = keepDID; 1400 1381 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); 1382 + /* Since we are swapping the ndlp passed in with the new one 1383 + * and the did has already been swapped, copy over the 1384 + * state and names. 1385 + */ 1386 + memcpy(&new_ndlp->nlp_portname, &ndlp->nlp_portname, 1387 + sizeof(struct lpfc_name)); 1388 + memcpy(&new_ndlp->nlp_nodename, &ndlp->nlp_nodename, 1389 + sizeof(struct lpfc_name)); 1390 + new_ndlp->nlp_state = ndlp->nlp_state; 1391 + /* Fix up the rport accordingly */ 1392 + rport = ndlp->rport; 1393 + if (rport) { 1394 + rdata = rport->dd_data; 1395 + put_node = rdata->pnode != NULL; 1396 + put_rport = ndlp->rport != NULL; 1397 + rdata->pnode = NULL; 1398 + ndlp->rport = NULL; 1399 + if (put_node) 1400 + lpfc_nlp_put(ndlp); 1401 + if (put_rport) 1402 + put_device(&rport->dev); 1403 + } 1401 1404 } 1402 1405 return new_ndlp; 1403 1406 } ··· 2921 2880 retry = 0; 2922 2881 2923 2882 if (retry) { 2883 + if ((cmd == ELS_CMD_PLOGI) || (cmd == ELS_CMD_FDISC)) { 2884 + /* Stop retrying PLOGI and FDISC if in FCF discovery */ 2885 + if (phba->fcf.fcf_flag & FCF_DISCOVERY) { 2886 + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 2887 + "2849 Stop retry ELS command " 2888 + "x%x to remote NPORT x%x, " 2889 + "Data: x%x x%x\n", cmd, did, 2890 + cmdiocb->retry, delay); 2891 + return 0; 2892 + } 2893 + } 2924 2894 2925 2895 /* Retry ELS command <elsCmd> to remote NPORT <did> */ 2926 2896 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, ··· 6128 6076 6129 6077 if (mb->mbxStatus) { 6130 6078 lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX, 6131 - "0915 Register VPI failed: 0x%x\n", 6132 - mb->mbxStatus); 6079 + "0915 Register VPI failed : Status: x%x" 6080 + " upd bit: x%x \n", mb->mbxStatus, 6081 + mb->un.varRegVpi.upd); 6082 + if (phba->sli_rev == LPFC_SLI_REV4 && 6083 + mb->un.varRegVpi.upd) 6084 + goto mbox_err_exit ; 6133 6085 6134 6086 switch (mb->mbxStatus) { 6135 6087 case 0x11: /* unsupported feature */ ··· 6198 6142 } else 6199 6143 lpfc_do_scr_ns_plogi(phba, vport); 6200 6144 } 6201 - 6145 + mbox_err_exit: 6202 6146 /* Now, we decrement the ndlp reference count held for this 6203 6147 * callback function 6204 6148 */ ··· 6443 6387 else 6444 6388 vport->fc_flag |= FC_LOGO_RCVD_DID_CHNG; 6445 6389 spin_unlock_irq(shost->host_lock); 6390 + } else if ((phba->sli_rev == LPFC_SLI_REV4) && 6391 + !(vport->fc_flag & FC_VPORT_NEEDS_REG_VPI)) { 6392 + /* 6393 + * Driver needs to re-reg VPI in order for f/w 6394 + * to update the MAC address. 6395 + */ 6396 + lpfc_register_new_vport(phba, vport, ndlp); 6397 + return ; 6446 6398 } 6447 6399 6448 6400 if (vport->fc_flag & FC_VPORT_NEEDS_INIT_VPI)
+13 -4
drivers/scsi/lpfc/lpfc_hbadisc.c
··· 588 588 (status & 589 589 HA_RXMASK)); 590 590 } 591 - if (pring->txq_cnt) 591 + if ((phba->sli_rev == LPFC_SLI_REV4) && pring->txq_cnt) 592 592 lpfc_drain_txq(phba); 593 593 /* 594 594 * Turn on Ring interrupts ··· 1852 1852 __lpfc_sli4_stop_fcf_redisc_wait_timer(phba); 1853 1853 else if (phba->fcf.fcf_flag & FCF_REDISC_FOV) 1854 1854 /* If in fast failover, mark it's completed */ 1855 - phba->fcf.fcf_flag &= ~(FCF_REDISC_FOV | 1856 - FCF_DISCOVERY); 1855 + phba->fcf.fcf_flag &= ~FCF_REDISC_FOV; 1857 1856 spin_unlock_irq(&phba->hbalock); 1858 1857 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, 1859 1858 "2836 The new FCF record (x%x) " ··· 2650 2651 spin_unlock_irq(&phba->hbalock); 2651 2652 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, 2652 2653 "2778 Start FCF table scan at linkup\n"); 2653 - 2654 2654 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, 2655 2655 LPFC_FCOE_FCF_GET_FIRST); 2656 2656 if (rc) { ··· 2658 2660 spin_unlock_irq(&phba->hbalock); 2659 2661 goto out; 2660 2662 } 2663 + /* Reset FCF roundrobin bmask for new discovery */ 2664 + memset(phba->fcf.fcf_rr_bmask, 0, 2665 + sizeof(*phba->fcf.fcf_rr_bmask)); 2661 2666 } 2662 2667 2663 2668 return; ··· 5098 5097 lpfc_unregister_vfi_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) 5099 5098 { 5100 5099 struct lpfc_vport *vport = mboxq->vport; 5100 + struct Scsi_Host *shost = lpfc_shost_from_vport(vport); 5101 5101 5102 5102 if (mboxq->u.mb.mbxStatus) { 5103 5103 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY|LOG_MBOX, ··· 5106 5104 "HBA state x%x\n", 5107 5105 mboxq->u.mb.mbxStatus, vport->port_state); 5108 5106 } 5107 + spin_lock_irq(shost->host_lock); 5108 + phba->pport->fc_flag &= ~FC_VFI_REGISTERED; 5109 + spin_unlock_irq(shost->host_lock); 5109 5110 mempool_free(mboxq, phba->mbox_mem_pool); 5110 5111 return; 5111 5112 } ··· 5290 5285 spin_lock_irq(&phba->hbalock); 5291 5286 phba->fcf.fcf_flag |= FCF_INIT_DISC; 5292 5287 spin_unlock_irq(&phba->hbalock); 5288 + 5289 + /* Reset FCF roundrobin bmask for new discovery */ 5290 + memset(phba->fcf.fcf_rr_bmask, 0, sizeof(*phba->fcf.fcf_rr_bmask)); 5291 + 5293 5292 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, LPFC_FCOE_FCF_GET_FIRST); 5294 5293 5295 5294 if (rc) {
+19 -13
drivers/scsi/lpfc/lpfc_hw.h
··· 2291 2291 typedef struct { 2292 2292 #ifdef __BIG_ENDIAN_BITFIELD 2293 2293 uint32_t rsvd1; 2294 - uint32_t rsvd2:8; 2294 + uint32_t rsvd2:7; 2295 + uint32_t upd:1; 2295 2296 uint32_t sid:24; 2296 2297 uint32_t wwn[2]; 2297 2298 uint32_t rsvd5; ··· 2301 2300 #else /* __LITTLE_ENDIAN */ 2302 2301 uint32_t rsvd1; 2303 2302 uint32_t sid:24; 2304 - uint32_t rsvd2:8; 2303 + uint32_t upd:1; 2304 + uint32_t rsvd2:7; 2305 2305 uint32_t wwn[2]; 2306 2306 uint32_t rsvd5; 2307 2307 uint16_t vpi; ··· 2808 2806 uint32_t rsvd6; /* Reserved */ 2809 2807 2810 2808 #ifdef __BIG_ENDIAN_BITFIELD 2811 - uint32_t rsvd7 : 16; /* Reserved */ 2809 + uint32_t fips_rev : 3; /* FIPS Spec Revision */ 2810 + uint32_t fips_level : 4; /* FIPS Level */ 2811 + uint32_t sec_err : 9; /* security crypto error */ 2812 2812 uint32_t max_vpi : 16; /* Max number of virt N-Ports */ 2813 2813 #else /* __LITTLE_ENDIAN */ 2814 2814 uint32_t max_vpi : 16; /* Max number of virt N-Ports */ 2815 - uint32_t rsvd7 : 16; /* Reserved */ 2815 + uint32_t sec_err : 9; /* security crypto error */ 2816 + uint32_t fips_level : 4; /* FIPS Level */ 2817 + uint32_t fips_rev : 3; /* FIPS Spec Revision */ 2816 2818 #endif 2817 2819 2818 2820 } CONFIG_PORT_VAR; ··· 3447 3441 static inline uint32_t 3448 3442 lpfc_bgs_get_bidir_bg_prof(uint32_t bgstat) 3449 3443 { 3450 - return (le32_to_cpu(bgstat) & BGS_BIDIR_BG_PROF_MASK) >> 3444 + return (bgstat & BGS_BIDIR_BG_PROF_MASK) >> 3451 3445 BGS_BIDIR_BG_PROF_SHIFT; 3452 3446 } 3453 3447 3454 3448 static inline uint32_t 3455 3449 lpfc_bgs_get_bidir_err_cond(uint32_t bgstat) 3456 3450 { 3457 - return (le32_to_cpu(bgstat) & BGS_BIDIR_ERR_COND_FLAGS_MASK) >> 3451 + return (bgstat & BGS_BIDIR_ERR_COND_FLAGS_MASK) >> 3458 3452 BGS_BIDIR_ERR_COND_SHIFT; 3459 3453 } 3460 3454 3461 3455 static inline uint32_t 3462 3456 lpfc_bgs_get_bg_prof(uint32_t bgstat) 3463 3457 { 3464 - return (le32_to_cpu(bgstat) & BGS_BG_PROFILE_MASK) >> 3458 + return (bgstat & BGS_BG_PROFILE_MASK) >> 3465 3459 BGS_BG_PROFILE_SHIFT; 3466 3460 } 3467 3461 3468 3462 static inline uint32_t 3469 3463 lpfc_bgs_get_invalid_prof(uint32_t bgstat) 3470 3464 { 3471 - return (le32_to_cpu(bgstat) & BGS_INVALID_PROF_MASK) >> 3465 + return (bgstat & BGS_INVALID_PROF_MASK) >> 3472 3466 BGS_INVALID_PROF_SHIFT; 3473 3467 } 3474 3468 3475 3469 static inline uint32_t 3476 3470 lpfc_bgs_get_uninit_dif_block(uint32_t bgstat) 3477 3471 { 3478 - return (le32_to_cpu(bgstat) & BGS_UNINIT_DIF_BLOCK_MASK) >> 3472 + return (bgstat & BGS_UNINIT_DIF_BLOCK_MASK) >> 3479 3473 BGS_UNINIT_DIF_BLOCK_SHIFT; 3480 3474 } 3481 3475 3482 3476 static inline uint32_t 3483 3477 lpfc_bgs_get_hi_water_mark_present(uint32_t bgstat) 3484 3478 { 3485 - return (le32_to_cpu(bgstat) & BGS_HI_WATER_MARK_PRESENT_MASK) >> 3479 + return (bgstat & BGS_HI_WATER_MARK_PRESENT_MASK) >> 3486 3480 BGS_HI_WATER_MARK_PRESENT_SHIFT; 3487 3481 } 3488 3482 3489 3483 static inline uint32_t 3490 3484 lpfc_bgs_get_reftag_err(uint32_t bgstat) 3491 3485 { 3492 - return (le32_to_cpu(bgstat) & BGS_REFTAG_ERR_MASK) >> 3486 + return (bgstat & BGS_REFTAG_ERR_MASK) >> 3493 3487 BGS_REFTAG_ERR_SHIFT; 3494 3488 } 3495 3489 3496 3490 static inline uint32_t 3497 3491 lpfc_bgs_get_apptag_err(uint32_t bgstat) 3498 3492 { 3499 - return (le32_to_cpu(bgstat) & BGS_APPTAG_ERR_MASK) >> 3493 + return (bgstat & BGS_APPTAG_ERR_MASK) >> 3500 3494 BGS_APPTAG_ERR_SHIFT; 3501 3495 } 3502 3496 3503 3497 static inline uint32_t 3504 3498 lpfc_bgs_get_guard_err(uint32_t bgstat) 3505 3499 { 3506 - return (le32_to_cpu(bgstat) & BGS_GUARD_ERR_MASK) >> 3500 + return (bgstat & BGS_GUARD_ERR_MASK) >> 3507 3501 BGS_GUARD_ERR_SHIFT; 3508 3502 } 3509 3503
+85 -47
drivers/scsi/lpfc/lpfc_init.c
··· 1032 1032 /* If there is no heart beat outstanding, issue a heartbeat command */ 1033 1033 if (phba->cfg_enable_hba_heartbeat) { 1034 1034 if (!phba->hb_outstanding) { 1035 - pmboxq = mempool_alloc(phba->mbox_mem_pool,GFP_KERNEL); 1036 - if (!pmboxq) { 1037 - mod_timer(&phba->hb_tmofunc, 1038 - jiffies + HZ * LPFC_HB_MBOX_INTERVAL); 1039 - return; 1040 - } 1035 + if ((!(psli->sli_flag & LPFC_SLI_MBOX_ACTIVE)) && 1036 + (list_empty(&psli->mboxq))) { 1037 + pmboxq = mempool_alloc(phba->mbox_mem_pool, 1038 + GFP_KERNEL); 1039 + if (!pmboxq) { 1040 + mod_timer(&phba->hb_tmofunc, 1041 + jiffies + 1042 + HZ * LPFC_HB_MBOX_INTERVAL); 1043 + return; 1044 + } 1041 1045 1042 - lpfc_heart_beat(phba, pmboxq); 1043 - pmboxq->mbox_cmpl = lpfc_hb_mbox_cmpl; 1044 - pmboxq->vport = phba->pport; 1045 - retval = lpfc_sli_issue_mbox(phba, pmboxq, MBX_NOWAIT); 1046 + lpfc_heart_beat(phba, pmboxq); 1047 + pmboxq->mbox_cmpl = lpfc_hb_mbox_cmpl; 1048 + pmboxq->vport = phba->pport; 1049 + retval = lpfc_sli_issue_mbox(phba, pmboxq, 1050 + MBX_NOWAIT); 1046 1051 1047 - if (retval != MBX_BUSY && retval != MBX_SUCCESS) { 1048 - mempool_free(pmboxq, phba->mbox_mem_pool); 1049 - mod_timer(&phba->hb_tmofunc, 1050 - jiffies + HZ * LPFC_HB_MBOX_INTERVAL); 1051 - return; 1052 - } 1052 + if (retval != MBX_BUSY && 1053 + retval != MBX_SUCCESS) { 1054 + mempool_free(pmboxq, 1055 + phba->mbox_mem_pool); 1056 + mod_timer(&phba->hb_tmofunc, 1057 + jiffies + 1058 + HZ * LPFC_HB_MBOX_INTERVAL); 1059 + return; 1060 + } 1061 + phba->skipped_hb = 0; 1062 + phba->hb_outstanding = 1; 1063 + } else if (time_before_eq(phba->last_completion_time, 1064 + phba->skipped_hb)) { 1065 + lpfc_printf_log(phba, KERN_INFO, LOG_INIT, 1066 + "2857 Last completion time not " 1067 + " updated in %d ms\n", 1068 + jiffies_to_msecs(jiffies 1069 + - phba->last_completion_time)); 1070 + } else 1071 + phba->skipped_hb = jiffies; 1072 + 1053 1073 mod_timer(&phba->hb_tmofunc, 1054 1074 jiffies + HZ * LPFC_HB_MBOX_TIMEOUT); 1055 - phba->hb_outstanding = 1; 1056 1075 return; 1057 1076 } else { 1058 1077 /* ··· 3300 3281 if (!ndlp) 3301 3282 return 0; 3302 3283 } 3303 - if (phba->pport->port_state <= LPFC_FLOGI) 3284 + if (phba->pport->port_state < LPFC_FLOGI) 3304 3285 return NULL; 3305 3286 /* If virtual link is not yet instantiated ignore CVL */ 3306 - if (vport->port_state <= LPFC_FDISC) 3287 + if ((vport != phba->pport) && (vport->port_state < LPFC_FDISC)) 3307 3288 return NULL; 3308 3289 shost = lpfc_shost_from_vport(vport); 3309 3290 if (!shost) ··· 3376 3357 "evt_tag:x%x, fcf_index:x%x\n", 3377 3358 acqe_fcoe->event_tag, 3378 3359 acqe_fcoe->index); 3379 - /* If the FCF discovery is in progress, do nothing. */ 3380 - spin_lock_irq(&phba->hbalock); 3381 - if (phba->hba_flag & FCF_DISC_INPROGRESS) { 3382 - spin_unlock_irq(&phba->hbalock); 3383 - break; 3384 - } 3385 - /* If fast FCF failover rescan event is pending, do nothing */ 3386 - if (phba->fcf.fcf_flag & FCF_REDISC_EVT) { 3387 - spin_unlock_irq(&phba->hbalock); 3388 - break; 3389 - } 3390 - spin_unlock_irq(&phba->hbalock); 3391 - 3392 - if ((phba->fcf.fcf_flag & FCF_DISCOVERY) && 3393 - !(phba->fcf.fcf_flag & FCF_REDISC_FOV)) { 3360 + if (phba->fcf.fcf_flag & FCF_DISCOVERY) { 3394 3361 /* 3395 3362 * During period of FCF discovery, read the FCF 3396 3363 * table record indexed by the event to update ··· 3390 3385 acqe_fcoe->index); 3391 3386 rc = lpfc_sli4_read_fcf_rec(phba, acqe_fcoe->index); 3392 3387 } 3393 - /* If the FCF has been in discovered state, do nothing. */ 3388 + 3389 + /* If the FCF discovery is in progress, do nothing. */ 3394 3390 spin_lock_irq(&phba->hbalock); 3391 + if (phba->hba_flag & FCF_DISC_INPROGRESS) { 3392 + spin_unlock_irq(&phba->hbalock); 3393 + break; 3394 + } 3395 + /* If fast FCF failover rescan event is pending, do nothing */ 3396 + if (phba->fcf.fcf_flag & FCF_REDISC_EVT) { 3397 + spin_unlock_irq(&phba->hbalock); 3398 + break; 3399 + } 3400 + 3401 + /* If the FCF has been in discovered state, do nothing. */ 3395 3402 if (phba->fcf.fcf_flag & FCF_SCAN_DONE) { 3396 3403 spin_unlock_irq(&phba->hbalock); 3397 3404 break; 3398 3405 } 3399 3406 spin_unlock_irq(&phba->hbalock); 3407 + 3400 3408 /* Otherwise, scan the entire FCF table and re-discover SAN */ 3401 3409 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, 3402 3410 "2770 Start FCF table scan due to new FCF " ··· 3435 3417 "2549 FCF disconnected from network index 0x%x" 3436 3418 " tag 0x%x\n", acqe_fcoe->index, 3437 3419 acqe_fcoe->event_tag); 3438 - /* If the event is not for currently used fcf do nothing */ 3439 - if (phba->fcf.current_rec.fcf_indx != acqe_fcoe->index) 3440 - break; 3441 - /* We request port to rediscover the entire FCF table for 3442 - * a fast recovery from case that the current FCF record 3443 - * is no longer valid if we are not in the middle of FCF 3444 - * failover process already. 3420 + /* 3421 + * If we are in the middle of FCF failover process, clear 3422 + * the corresponding FCF bit in the roundrobin bitmap. 3445 3423 */ 3446 3424 spin_lock_irq(&phba->hbalock); 3447 3425 if (phba->fcf.fcf_flag & FCF_DISCOVERY) { ··· 3446 3432 lpfc_sli4_fcf_rr_index_clear(phba, acqe_fcoe->index); 3447 3433 break; 3448 3434 } 3435 + spin_unlock_irq(&phba->hbalock); 3436 + 3437 + /* If the event is not for currently used fcf do nothing */ 3438 + if (phba->fcf.current_rec.fcf_indx != acqe_fcoe->index) 3439 + break; 3440 + 3441 + /* 3442 + * Otherwise, request the port to rediscover the entire FCF 3443 + * table for a fast recovery from case that the current FCF 3444 + * is no longer valid as we are not in the middle of FCF 3445 + * failover process already. 3446 + */ 3447 + spin_lock_irq(&phba->hbalock); 3449 3448 /* Mark the fast failover process in progress */ 3450 3449 phba->fcf.fcf_flag |= FCF_DEAD_DISC; 3451 3450 spin_unlock_irq(&phba->hbalock); 3451 + 3452 3452 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, 3453 3453 "2771 Start FCF fast failover process due to " 3454 3454 "FCF DEAD event: evt_tag:x%x, fcf_index:x%x " ··· 3482 3454 * as a link down to FCF registration. 3483 3455 */ 3484 3456 lpfc_sli4_fcf_dead_failthrough(phba); 3485 - } else 3486 - /* Handling fast FCF failover to a DEAD FCF event 3487 - * is considered equalivant to receiving CVL to all 3488 - * vports. 3457 + } else { 3458 + /* Reset FCF roundrobin bmask for new discovery */ 3459 + memset(phba->fcf.fcf_rr_bmask, 0, 3460 + sizeof(*phba->fcf.fcf_rr_bmask)); 3461 + /* 3462 + * Handling fast FCF failover to a DEAD FCF event is 3463 + * considered equalivant to receiving CVL to all vports. 3489 3464 */ 3490 3465 lpfc_sli4_perform_all_vport_cvl(phba); 3466 + } 3491 3467 break; 3492 3468 case LPFC_FCOE_EVENT_TYPE_CVL: 3493 3469 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, ··· 3566 3534 * the current registered FCF entry. 3567 3535 */ 3568 3536 lpfc_retry_pport_discovery(phba); 3569 - } 3537 + } else 3538 + /* 3539 + * Reset FCF roundrobin bmask for new 3540 + * discovery. 3541 + */ 3542 + memset(phba->fcf.fcf_rr_bmask, 0, 3543 + sizeof(*phba->fcf.fcf_rr_bmask)); 3570 3544 } 3571 3545 break; 3572 3546 default:
+7 -1
drivers/scsi/lpfc/lpfc_mbox.c
··· 815 815 lpfc_reg_vpi(struct lpfc_vport *vport, LPFC_MBOXQ_t *pmb) 816 816 { 817 817 MAILBOX_t *mb = &pmb->u.mb; 818 + struct lpfc_hba *phba = vport->phba; 818 819 819 820 memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); 820 - 821 + /* 822 + * Set the re-reg VPI bit for f/w to update the MAC address. 823 + */ 824 + if ((phba->sli_rev == LPFC_SLI_REV4) && 825 + !(vport->fc_flag & FC_VPORT_NEEDS_REG_VPI)) 826 + mb->un.varRegVpi.upd = 1; 821 827 mb->un.varRegVpi.vpi = vport->vpi + vport->phba->vpi_base; 822 828 mb->un.varRegVpi.sid = vport->fc_myDID; 823 829 mb->un.varRegVpi.vfi = vport->vfi + vport->phba->vfi_base;
+4 -4
drivers/scsi/lpfc/lpfc_scsi.c
··· 1325 1325 bf_set(pde5_type, pde5, LPFC_PDE5_DESCRIPTOR); 1326 1326 pde5->reftag = reftag; 1327 1327 1328 - /* Endian convertion if necessary for PDE5 */ 1328 + /* Endianness conversion if necessary for PDE5 */ 1329 1329 pde5->word0 = cpu_to_le32(pde5->word0); 1330 1330 pde5->reftag = cpu_to_le32(pde5->reftag); 1331 1331 ··· 1347 1347 bf_set(pde6_ai, pde6, 1); 1348 1348 bf_set(pde6_apptagval, pde6, apptagval); 1349 1349 1350 - /* Endian convertion if necessary for PDE6 */ 1350 + /* Endianness conversion if necessary for PDE6 */ 1351 1351 pde6->word0 = cpu_to_le32(pde6->word0); 1352 1352 pde6->word1 = cpu_to_le32(pde6->word1); 1353 1353 pde6->word2 = cpu_to_le32(pde6->word2); ··· 1459 1459 bf_set(pde5_type, pde5, LPFC_PDE5_DESCRIPTOR); 1460 1460 pde5->reftag = reftag; 1461 1461 1462 - /* Endian convertion if necessary for PDE5 */ 1462 + /* Endianness conversion if necessary for PDE5 */ 1463 1463 pde5->word0 = cpu_to_le32(pde5->word0); 1464 1464 pde5->reftag = cpu_to_le32(pde5->reftag); 1465 1465 ··· 1479 1479 bf_set(pde6_ai, pde6, 1); 1480 1480 bf_set(pde6_apptagval, pde6, apptagval); 1481 1481 1482 - /* Endian convertion if necessary for PDE6 */ 1482 + /* Endianness conversion if necessary for PDE6 */ 1483 1483 pde6->word0 = cpu_to_le32(pde6->word0); 1484 1484 pde6->word1 = cpu_to_le32(pde6->word1); 1485 1485 pde6->word2 = cpu_to_le32(pde6->word2);
+25 -11
drivers/scsi/lpfc/lpfc_sli.c
··· 1046 1046 } else 1047 1047 spin_unlock_irq(&phba->hbalock); 1048 1048 1049 - lpfc_printf_log(phba, KERN_ERR,LOG_SLI, 1049 + lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, 1050 1050 "0318 Failed to allocate IOTAG.last IOTAG is %d\n", 1051 1051 psli->last_iotag); 1052 1052 ··· 3914 3914 phba->sli3_options &= ~(LPFC_SLI3_NPIV_ENABLED | 3915 3915 LPFC_SLI3_HBQ_ENABLED | 3916 3916 LPFC_SLI3_CRP_ENABLED | 3917 - LPFC_SLI3_BG_ENABLED); 3917 + LPFC_SLI3_BG_ENABLED | 3918 + LPFC_SLI3_DSS_ENABLED); 3918 3919 if (rc != MBX_SUCCESS) { 3919 3920 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 3920 3921 "0442 Adapter failed to init, mbxCmd x%x " ··· 3950 3949 3951 3950 } else 3952 3951 phba->max_vpi = 0; 3953 - if (pmb->u.mb.un.varCfgPort.gdss) 3952 + phba->fips_level = 0; 3953 + phba->fips_spec_rev = 0; 3954 + if (pmb->u.mb.un.varCfgPort.gdss) { 3954 3955 phba->sli3_options |= LPFC_SLI3_DSS_ENABLED; 3956 + phba->fips_level = pmb->u.mb.un.varCfgPort.fips_level; 3957 + phba->fips_spec_rev = pmb->u.mb.un.varCfgPort.fips_rev; 3958 + lpfc_printf_log(phba, KERN_INFO, LOG_INIT, 3959 + "2850 Security Crypto Active. FIPS x%d " 3960 + "(Spec Rev: x%d)", 3961 + phba->fips_level, phba->fips_spec_rev); 3962 + } 3963 + if (pmb->u.mb.un.varCfgPort.sec_err) { 3964 + lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 3965 + "2856 Config Port Security Crypto " 3966 + "Error: x%x ", 3967 + pmb->u.mb.un.varCfgPort.sec_err); 3968 + } 3955 3969 if (pmb->u.mb.un.varCfgPort.gerbm) 3956 3970 phba->sli3_options |= LPFC_SLI3_HBQ_ENABLED; 3957 3971 if (pmb->u.mb.un.varCfgPort.gcrp) ··· 9056 9040 switch (bf_get(lpfc_cqe_code, &cqevt)) { 9057 9041 case CQE_CODE_COMPL_WQE: 9058 9042 /* Process the WQ/RQ complete event */ 9043 + phba->last_completion_time = jiffies; 9059 9044 workposted = lpfc_sli4_sp_handle_els_wcqe(phba, 9060 9045 (struct lpfc_wcqe_complete *)&cqevt); 9061 9046 break; ··· 9067 9050 break; 9068 9051 case CQE_CODE_XRI_ABORTED: 9069 9052 /* Process the WQ XRI abort event */ 9053 + phba->last_completion_time = jiffies; 9070 9054 workposted = lpfc_sli4_sp_handle_abort_xri_wcqe(phba, cq, 9071 9055 (struct sli4_wcqe_xri_aborted *)&cqevt); 9072 9056 break; 9073 9057 case CQE_CODE_RECEIVE: 9074 9058 /* Process the RQ event */ 9059 + phba->last_completion_time = jiffies; 9075 9060 workposted = lpfc_sli4_sp_handle_rcqe(phba, 9076 9061 (struct lpfc_rcqe *)&cqevt); 9077 9062 break; ··· 9295 9276 { 9296 9277 struct lpfc_wcqe_release wcqe; 9297 9278 bool workposted = false; 9298 - unsigned long iflag; 9299 9279 9300 9280 /* Copy the work queue CQE and convert endian order if needed */ 9301 9281 lpfc_sli_pcimem_bcopy(cqe, &wcqe, sizeof(struct lpfc_cqe)); ··· 9303 9285 switch (bf_get(lpfc_wcqe_c_code, &wcqe)) { 9304 9286 case CQE_CODE_COMPL_WQE: 9305 9287 /* Process the WQ complete event */ 9306 - spin_lock_irqsave(&phba->hbalock, iflag); 9307 9288 phba->last_completion_time = jiffies; 9308 - spin_unlock_irqrestore(&phba->hbalock, iflag); 9309 9289 lpfc_sli4_fp_handle_fcp_wcqe(phba, 9310 9290 (struct lpfc_wcqe_complete *)&wcqe); 9311 9291 break; ··· 9314 9298 break; 9315 9299 case CQE_CODE_XRI_ABORTED: 9316 9300 /* Process the WQ XRI abort event */ 9301 + phba->last_completion_time = jiffies; 9317 9302 workposted = lpfc_sli4_sp_handle_abort_xri_wcqe(phba, cq, 9318 9303 (struct sli4_wcqe_xri_aborted *)&wcqe); 9319 9304 break; ··· 12295 12278 spin_lock_irq(&phba->hbalock); 12296 12279 phba->hba_flag |= FCF_DISC_INPROGRESS; 12297 12280 spin_unlock_irq(&phba->hbalock); 12298 - /* Reset FCF round robin index bmask for new scan */ 12299 - if (fcf_index == LPFC_FCOE_FCF_GET_FIRST) { 12300 - memset(phba->fcf.fcf_rr_bmask, 0, 12301 - sizeof(*phba->fcf.fcf_rr_bmask)); 12281 + /* Reset eligible FCF count for new scan */ 12282 + if (fcf_index == LPFC_FCOE_FCF_GET_FIRST) 12302 12283 phba->fcf.eligible_fcf_cnt = 0; 12303 - } 12304 12284 error = 0; 12305 12285 } 12306 12286 fail_fcf_scan:
+1 -1
drivers/scsi/lpfc/lpfc_version.h
··· 18 18 * included with this package. * 19 19 *******************************************************************/ 20 20 21 - #define LPFC_DRIVER_VERSION "8.3.15" 21 + #define LPFC_DRIVER_VERSION "8.3.16" 22 22 #define LPFC_DRIVER_NAME "lpfc" 23 23 #define LPFC_SP_DRIVER_HANDLER_NAME "lpfc:sp" 24 24 #define LPFC_FP_DRIVER_HANDLER_NAME "lpfc:fp"
+10 -3
drivers/scsi/pm8001/pm8001_hwi.c
··· 4199 4199 circularQ = &pm8001_ha->inbnd_q_tbl[0]; 4200 4200 memset(&nvmd_req, 0, sizeof(nvmd_req)); 4201 4201 rc = pm8001_tag_alloc(pm8001_ha, &tag); 4202 - if (rc) 4202 + if (rc) { 4203 + kfree(fw_control_context); 4203 4204 return rc; 4205 + } 4204 4206 ccb = &pm8001_ha->ccb_info[tag]; 4205 4207 ccb->ccb_tag = tag; 4206 4208 ccb->fw_control_context = fw_control_context; ··· 4278 4276 ioctl_payload->length); 4279 4277 memset(&nvmd_req, 0, sizeof(nvmd_req)); 4280 4278 rc = pm8001_tag_alloc(pm8001_ha, &tag); 4281 - if (rc) 4279 + if (rc) { 4280 + kfree(fw_control_context); 4282 4281 return rc; 4282 + } 4283 4283 ccb = &pm8001_ha->ccb_info[tag]; 4284 4284 ccb->fw_control_context = fw_control_context; 4285 4285 ccb->ccb_tag = tag; ··· 4391 4387 fw_control->len, 0) != 0) { 4392 4388 PM8001_FAIL_DBG(pm8001_ha, 4393 4389 pm8001_printk("Mem alloc failure\n")); 4390 + kfree(fw_control_context); 4394 4391 return -ENOMEM; 4395 4392 } 4396 4393 } ··· 4406 4401 fw_control_context->virtAddr = buffer; 4407 4402 fw_control_context->len = fw_control->len; 4408 4403 rc = pm8001_tag_alloc(pm8001_ha, &tag); 4409 - if (rc) 4404 + if (rc) { 4405 + kfree(fw_control_context); 4410 4406 return rc; 4407 + } 4411 4408 ccb = &pm8001_ha->ccb_info[tag]; 4412 4409 ccb->fw_control_context = fw_control_context; 4413 4410 ccb->ccb_tag = tag;
+33 -3
drivers/scsi/qla4xxx/ql4_def.h
··· 36 36 #include "ql4_dbg.h" 37 37 #include "ql4_nx.h" 38 38 39 + #if defined(CONFIG_PCIEAER) 40 + #include <linux/aer.h> 41 + #else 42 + /* AER releated */ 43 + static inline int pci_enable_pcie_error_reporting(struct pci_dev *dev) 44 + { 45 + return -EINVAL; 46 + } 47 + static inline int pci_disable_pcie_error_reporting(struct pci_dev *dev) 48 + { 49 + return -EINVAL; 50 + } 51 + static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev) 52 + { 53 + return -EINVAL; 54 + } 55 + #endif 56 + 39 57 #ifndef PCI_DEVICE_ID_QLOGIC_ISP4010 40 58 #define PCI_DEVICE_ID_QLOGIC_ISP4010 0x4010 41 59 #endif ··· 154 136 #define ISCSI_IPADDR_SIZE 4 /* IP address size */ 155 137 #define ISCSI_ALIAS_SIZE 32 /* ISCSI Alias name size */ 156 138 #define ISCSI_NAME_SIZE 0xE0 /* ISCSI Name size */ 139 + 140 + #define QL4_SESS_RECOVERY_TMO 30 /* iSCSI session */ 141 + /* recovery timeout */ 157 142 158 143 #define LSDW(x) ((u32)((u64)(x))) 159 144 #define MSDW(x) ((u32)((((u64)(x)) >> 16) >> 16)) ··· 270 249 uint32_t default_time2wait; /* Default Min time between 271 250 * relogins (+aens) */ 272 251 273 - atomic_t port_down_timer; /* Device connection timer */ 274 252 atomic_t retry_relogin_timer; /* Min Time between relogins 275 253 * (4000 only) */ 276 254 atomic_t relogin_timer; /* Max Time to wait for relogin to complete */ ··· 398 378 #define AF_MSI_ENABLED 16 /* 0x00010000 */ 399 379 #define AF_MSIX_ENABLED 17 /* 0x00020000 */ 400 380 #define AF_MBOX_COMMAND_NOPOLL 18 /* 0x00040000 */ 401 - 381 + #define AF_FW_RECOVERY 19 /* 0x00080000 */ 382 + #define AF_EEH_BUSY 20 /* 0x00100000 */ 383 + #define AF_PCI_CHANNEL_IO_PERM_FAILURE 21 /* 0x00200000 */ 402 384 403 385 unsigned long dpc_flags; 404 386 ··· 496 474 uint32_t timer_active; 497 475 498 476 /* Recovery Timers */ 499 - uint32_t port_down_retry_count; 500 477 uint32_t discovery_wait; 501 478 atomic_t check_relogin_timeouts; 502 479 uint32_t retry_reset_ha_cnt; ··· 632 611 } 633 612 634 613 static inline int is_qla8022(struct scsi_qla_host *ha) 614 + { 615 + return ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8022; 616 + } 617 + 618 + /* Note: Currently AER/EEH is now supported only for 8022 cards 619 + * This function needs to be updated when AER/EEH is enabled 620 + * for other cards. 621 + */ 622 + static inline int is_aer_supported(struct scsi_qla_host *ha) 635 623 { 636 624 return ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8022; 637 625 }
+10 -10
drivers/scsi/qla4xxx/ql4_fw.h
··· 673 673 }; /* 200 */ 674 674 675 675 struct mbx_sys_info { 676 - uint8_t board_id_str[16]; /* Keep board ID string first */ 677 - /* in this structure for GUI. */ 678 - uint16_t board_id; /* board ID code */ 679 - uint16_t phys_port_cnt; /* number of physical network ports */ 680 - uint16_t port_num; /* network port for this PCI function */ 676 + uint8_t board_id_str[16]; /* 0-f Keep board ID string first */ 677 + /* in this structure for GUI. */ 678 + uint16_t board_id; /* 10-11 board ID code */ 679 + uint16_t phys_port_cnt; /* 12-13 number of physical network ports */ 680 + uint16_t port_num; /* 14-15 network port for this PCI function */ 681 681 /* (port 0 is first port) */ 682 - uint8_t mac_addr[6]; /* MAC address for this PCI function */ 683 - uint32_t iscsi_pci_func_cnt; /* number of iSCSI PCI functions */ 684 - uint32_t pci_func; /* this PCI function */ 685 - unsigned char serial_number[16]; /* serial number string */ 686 - uint8_t reserved[16]; 682 + uint8_t mac_addr[6]; /* 16-1b MAC address for this PCI function */ 683 + uint32_t iscsi_pci_func_cnt; /* 1c-1f number of iSCSI PCI functions */ 684 + uint32_t pci_func; /* 20-23 this PCI function */ 685 + unsigned char serial_number[16]; /* 24-33 serial number string */ 686 + uint8_t reserved[12]; /* 34-3f */ 687 687 }; 688 688 689 689 struct crash_record {
+2
drivers/scsi/qla4xxx/ql4_glbl.h
··· 93 93 void qla4xxx_process_response_queue(struct scsi_qla_host *ha); 94 94 void qla4xxx_wake_dpc(struct scsi_qla_host *ha); 95 95 void qla4xxx_get_conn_event_log(struct scsi_qla_host *ha); 96 + void qla4xxx_mailbox_premature_completion(struct scsi_qla_host *ha); 96 97 97 98 void qla4_8xxx_pci_config(struct scsi_qla_host *); 98 99 int qla4_8xxx_iospace_config(struct scsi_qla_host *ha); ··· 132 131 int qla4_8xxx_device_state_handler(struct scsi_qla_host *ha); 133 132 void qla4_8xxx_need_qsnt_handler(struct scsi_qla_host *ha); 134 133 void qla4_8xxx_clear_drv_active(struct scsi_qla_host *ha); 134 + inline void qla4_8xxx_set_drv_active(struct scsi_qla_host *ha); 135 135 136 136 extern int ql4xextended_error_logging; 137 137 extern int ql4xdiscoverywait;
+10 -4
drivers/scsi/qla4xxx/ql4_init.c
··· 308 308 DEBUG2(printk("scsi%ld: %s: unable to get firmware " 309 309 "state\n", ha->host_no, __func__)); 310 310 break; 311 - 312 311 } 313 312 314 313 if (ha->firmware_state & FW_STATE_ERROR) { ··· 443 444 static int qla4xxx_init_firmware(struct scsi_qla_host *ha) 444 445 { 445 446 int status = QLA_ERROR; 447 + 448 + if (is_aer_supported(ha) && 449 + test_bit(AF_PCI_CHANNEL_IO_PERM_FAILURE, &ha->flags)) 450 + return status; 451 + 452 + /* For 82xx, stop firmware before initializing because if BIOS 453 + * has previously initialized firmware, then driver's initialize 454 + * firmware will fail. */ 455 + if (is_qla8022(ha)) 456 + qla4_8xxx_stop_firmware(ha); 446 457 447 458 ql4_printk(KERN_INFO, ha, "Initializing firmware..\n"); 448 459 if (qla4xxx_initialize_fw_cb(ha) == QLA_ERROR) { ··· 678 669 } 679 670 680 671 ddb_entry->fw_ddb_index = fw_ddb_index; 681 - atomic_set(&ddb_entry->port_down_timer, ha->port_down_retry_count); 682 672 atomic_set(&ddb_entry->retry_relogin_timer, INVALID_ENTRY); 683 673 atomic_set(&ddb_entry->relogin_timer, 0); 684 674 atomic_set(&ddb_entry->relogin_retry_count, 0); ··· 1564 1556 /* Device is back online. */ 1565 1557 if (ddb_entry->fw_ddb_device_state == DDB_DS_SESSION_ACTIVE) { 1566 1558 atomic_set(&ddb_entry->state, DDB_STATE_ONLINE); 1567 - atomic_set(&ddb_entry->port_down_timer, 1568 - ha->port_down_retry_count); 1569 1559 atomic_set(&ddb_entry->relogin_retry_count, 0); 1570 1560 atomic_set(&ddb_entry->relogin_timer, 0); 1571 1561 clear_bit(DF_RELOGIN, &ddb_entry->flags);
+1 -1
drivers/scsi/qla4xxx/ql4_iocb.c
··· 19 19 20 20 /* Calculate number of free request entries. */ 21 21 if ((req_cnt + 2) >= ha->req_q_count) { 22 - cnt = (uint16_t) le32_to_cpu(ha->shadow_regs->req_q_out); 22 + cnt = (uint16_t) ha->isp_ops->rd_shdw_req_q_out(ha); 23 23 if (ha->request_in < cnt) 24 24 ha->req_q_count = cnt - ha->request_in; 25 25 else
+3
drivers/scsi/qla4xxx/ql4_isr.c
··· 816 816 unsigned long flags = 0; 817 817 uint8_t reqs_count = 0; 818 818 819 + if (unlikely(pci_channel_offline(ha->pdev))) 820 + return IRQ_HANDLED; 821 + 819 822 ha->isr_count++; 820 823 status = qla4_8xxx_rd_32(ha, ISR_INT_VECTOR); 821 824 if (!(status & ha->nx_legacy_intr.int_vec_bit))
+47 -1
drivers/scsi/qla4xxx/ql4_mbx.c
··· 39 39 "pointer\n", ha->host_no, __func__)); 40 40 return status; 41 41 } 42 + 43 + if (is_qla8022(ha) && 44 + test_bit(AF_FW_RECOVERY, &ha->flags)) { 45 + DEBUG2(ql4_printk(KERN_WARNING, ha, "scsi%ld: %s: prematurely " 46 + "completing mbx cmd as firmware recovery detected\n", 47 + ha->host_no, __func__)); 48 + return status; 49 + } 50 + 51 + if ((is_aer_supported(ha)) && 52 + (test_bit(AF_PCI_CHANNEL_IO_PERM_FAILURE, &ha->flags))) { 53 + DEBUG2(printk(KERN_WARNING "scsi%ld: %s: Perm failure on EEH, " 54 + "timeout MBX Exiting.\n", ha->host_no, __func__)); 55 + return status; 56 + } 57 + 42 58 /* Mailbox code active */ 43 59 wait_count = MBOX_TOV * 100; 44 60 ··· 166 150 while (test_bit(AF_MBOX_COMMAND_DONE, &ha->flags) == 0) { 167 151 if (time_after_eq(jiffies, wait_count)) 168 152 break; 153 + 169 154 /* 170 155 * Service the interrupt. 171 156 * The ISR will save the mailbox status registers ··· 213 196 214 197 /* Check for mailbox timeout. */ 215 198 if (!test_bit(AF_MBOX_COMMAND_DONE, &ha->flags)) { 199 + if (is_qla8022(ha) && 200 + test_bit(AF_FW_RECOVERY, &ha->flags)) { 201 + DEBUG2(ql4_printk(KERN_INFO, ha, 202 + "scsi%ld: %s: prematurely completing mbx cmd as " 203 + "firmware recovery detected\n", 204 + ha->host_no, __func__)); 205 + goto mbox_exit; 206 + } 216 207 DEBUG2(printk("scsi%ld: Mailbox Cmd 0x%08X timed out ...," 217 208 " Scheduling Adapter Reset\n", ha->host_no, 218 209 mbx_cmd[0])); ··· 269 244 clear_bit(AF_MBOX_COMMAND_DONE, &ha->flags); 270 245 271 246 return status; 247 + } 248 + 249 + void qla4xxx_mailbox_premature_completion(struct scsi_qla_host *ha) 250 + { 251 + set_bit(AF_FW_RECOVERY, &ha->flags); 252 + ql4_printk(KERN_INFO, ha, "scsi%ld: %s: set FW RECOVERY!\n", 253 + ha->host_no, __func__); 254 + 255 + if (test_bit(AF_MBOX_COMMAND, &ha->flags)) { 256 + if (test_bit(AF_MBOX_COMMAND_NOPOLL, &ha->flags)) { 257 + complete(&ha->mbx_intr_comp); 258 + ql4_printk(KERN_INFO, ha, "scsi%ld: %s: Due to fw " 259 + "recovery, doing premature completion of " 260 + "mbx cmd\n", ha->host_no, __func__); 261 + 262 + } else { 263 + set_bit(AF_MBOX_COMMAND_DONE, &ha->flags); 264 + ql4_printk(KERN_INFO, ha, "scsi%ld: %s: Due to fw " 265 + "recovery, doing premature completion of " 266 + "polling mbx cmd\n", ha->host_no, __func__); 267 + } 268 + } 272 269 } 273 270 274 271 static uint8_t ··· 408 361 min(sizeof(ha->alias), sizeof(init_fw_cb->Alias)));*/ 409 362 410 363 /* Save Command Line Paramater info */ 411 - ha->port_down_retry_count = le16_to_cpu(init_fw_cb->conn_ka_timeout); 412 364 ha->discovery_wait = ql4xdiscoverywait; 413 365 414 366 if (ha->acb_version == ACB_SUPPORTED) {
+13 -4
drivers/scsi/qla4xxx/ql4_nx.c
··· 1418 1418 return QLA_SUCCESS; 1419 1419 } 1420 1420 1421 - static inline void 1421 + inline void 1422 1422 qla4_8xxx_set_drv_active(struct scsi_qla_host *ha) 1423 1423 { 1424 1424 uint32_t drv_active; ··· 1441 1441 static inline int 1442 1442 qla4_8xxx_need_reset(struct scsi_qla_host *ha) 1443 1443 { 1444 - uint32_t drv_state; 1444 + uint32_t drv_state, drv_active; 1445 1445 int rval; 1446 1446 1447 + drv_active = qla4_8xxx_rd_32(ha, QLA82XX_CRB_DRV_ACTIVE); 1447 1448 drv_state = qla4_8xxx_rd_32(ha, QLA82XX_CRB_DRV_STATE); 1448 1449 rval = drv_state & (1 << (ha->func_num * 4)); 1450 + if ((test_bit(AF_EEH_BUSY, &ha->flags)) && drv_active) 1451 + rval = 1; 1452 + 1449 1453 return rval; 1450 1454 } 1451 1455 ··· 1953 1949 uint16_t cnt, chksum; 1954 1950 uint16_t *wptr; 1955 1951 struct qla_fdt_layout *fdt; 1956 - uint16_t mid, fid; 1952 + uint16_t mid = 0; 1953 + uint16_t fid = 0; 1957 1954 struct ql82xx_hw_data *hw = &ha->hw; 1958 1955 1959 1956 hw->flash_conf_off = FARX_ACCESS_FLASH_CONF; ··· 2110 2105 qla4_8xxx_clear_rst_ready(ha); 2111 2106 qla4_8xxx_idc_unlock(ha); 2112 2107 2108 + if (rval == QLA_SUCCESS) 2109 + clear_bit(AF_FW_RECOVERY, &ha->flags); 2110 + 2113 2111 return rval; 2114 2112 } 2115 2113 ··· 2153 2145 goto exit_validate_mac82; 2154 2146 } 2155 2147 2156 - if (mbox_sts[4] < sizeof(*sys_info)) { 2148 + /* Make sure we receive the minimum required data to cache internally */ 2149 + if (mbox_sts[4] < offsetof(struct mbx_sys_info, reserved)) { 2157 2150 DEBUG2(printk("scsi%ld: %s: GET_SYS_INFO data receive" 2158 2151 " error (%x)\n", ha->host_no, __func__, mbox_sts[4])); 2159 2152 goto exit_validate_mac82;
+311 -4
drivers/scsi/qla4xxx/ql4_os.c
··· 163 163 if (atomic_read(&ddb_entry->state) != DDB_STATE_ONLINE) { 164 164 atomic_set(&ddb_entry->state, DDB_STATE_DEAD); 165 165 166 - DEBUG2(printk("scsi%ld: %s: ddb [%d] port down retry count " 166 + DEBUG2(printk("scsi%ld: %s: ddb [%d] session recovery timeout " 167 167 "of (%d) secs exhausted, marking device DEAD.\n", 168 168 ha->host_no, __func__, ddb_entry->fw_ddb_index, 169 - ha->port_down_retry_count)); 169 + QL4_SESS_RECOVERY_TMO)); 170 170 171 171 qla4xxx_wake_dpc(ha); 172 172 } ··· 298 298 { 299 299 int err; 300 300 301 - ddb_entry->sess->recovery_tmo = ddb_entry->ha->port_down_retry_count; 301 + ddb_entry->sess->recovery_tmo = QL4_SESS_RECOVERY_TMO; 302 + 302 303 err = iscsi_add_session(ddb_entry->sess, ddb_entry->fw_ddb_index); 303 304 if (err) { 304 305 DEBUG2(printk(KERN_ERR "Could not add session.\n")); ··· 474 473 struct iscsi_cls_session *sess = ddb_entry->sess; 475 474 struct srb *srb; 476 475 int rval; 476 + 477 + if (test_bit(AF_EEH_BUSY, &ha->flags)) { 478 + if (test_bit(AF_PCI_CHANNEL_IO_PERM_FAILURE, &ha->flags)) 479 + cmd->result = DID_NO_CONNECT << 16; 480 + else 481 + cmd->result = DID_REQUEUE << 16; 482 + goto qc_fail_command; 483 + } 477 484 478 485 if (!sess) { 479 486 cmd->result = DID_IMM_RETRY << 16; ··· 663 654 uint32_t fw_heartbeat_counter, halt_status; 664 655 665 656 fw_heartbeat_counter = qla4_8xxx_rd_32(ha, QLA82XX_PEG_ALIVE_COUNTER); 657 + /* If PEG_ALIVE_COUNTER is 0xffffffff, AER/EEH is in progress, ignore */ 658 + if (fw_heartbeat_counter == 0xffffffff) { 659 + DEBUG2(printk(KERN_WARNING "scsi%ld: %s: Device in frozen " 660 + "state, QLA82XX_PEG_ALIVE_COUNTER is 0xffffffff\n", 661 + ha->host_no, __func__)); 662 + return; 663 + } 666 664 667 665 if (ha->fw_heartbeat_counter == fw_heartbeat_counter) { 668 666 ha->seconds_since_last_heartbeat++; ··· 678 662 ha->seconds_since_last_heartbeat = 0; 679 663 halt_status = qla4_8xxx_rd_32(ha, 680 664 QLA82XX_PEG_HALT_STATUS1); 665 + 681 666 /* Since we cannot change dev_state in interrupt 682 667 * context, set appropriate DPC flag then wakeup 683 668 * DPC */ ··· 690 673 set_bit(DPC_RESET_HA, &ha->dpc_flags); 691 674 } 692 675 qla4xxx_wake_dpc(ha); 676 + qla4xxx_mailbox_premature_completion(ha); 693 677 } 694 678 } 695 679 ha->fw_heartbeat_counter = fw_heartbeat_counter; ··· 716 698 ha->host_no, __func__); 717 699 set_bit(DPC_RESET_HA, &ha->dpc_flags); 718 700 qla4xxx_wake_dpc(ha); 701 + qla4xxx_mailbox_premature_completion(ha); 719 702 } else if (dev_state == QLA82XX_DEV_NEED_QUIESCENT && 720 703 !test_bit(DPC_HA_NEED_QUIESCENT, &ha->dpc_flags)) { 721 704 printk("scsi%ld: %s: HW State: NEED QUIES!\n", ··· 738 719 { 739 720 struct ddb_entry *ddb_entry, *dtemp; 740 721 int start_dpc = 0; 722 + uint16_t w; 723 + 724 + /* If we are in the middle of AER/EEH processing 725 + * skip any processing and reschedule the timer 726 + */ 727 + if (test_bit(AF_EEH_BUSY, &ha->flags)) { 728 + mod_timer(&ha->timer, jiffies + HZ); 729 + return; 730 + } 731 + 732 + /* Hardware read to trigger an EEH error during mailbox waits. */ 733 + if (!pci_channel_offline(ha->pdev)) 734 + pci_read_config_word(ha->pdev, PCI_VENDOR_ID, &w); 741 735 742 736 if (test_bit(AF_HBA_GOING_AWAY, &ha->flags)) { 743 737 DEBUG2(ql4_printk(KERN_INFO, ha, "%s exited. HBA GOING AWAY\n", ··· 1239 1207 1240 1208 /* Initialization not yet finished. Don't do anything yet. */ 1241 1209 if (!test_bit(AF_INIT_DONE, &ha->flags)) 1242 - return; 1210 + goto do_dpc_exit; 1211 + 1212 + if (test_bit(AF_EEH_BUSY, &ha->flags)) { 1213 + DEBUG2(printk(KERN_INFO "scsi%ld: %s: flags = %lx\n", 1214 + ha->host_no, __func__, ha->flags)); 1215 + goto do_dpc_exit; 1216 + } 1243 1217 1244 1218 /* HBA is in the process of being permanently disabled. 1245 1219 * Don't process anything */ ··· 1384 1346 } 1385 1347 } 1386 1348 } 1349 + 1350 + do_dpc_exit: 1387 1351 clear_bit(AF_DPC_SCHEDULED, &ha->flags); 1388 1352 } 1389 1353 ··· 1652 1612 ha->host = host; 1653 1613 ha->host_no = host->host_no; 1654 1614 1615 + pci_enable_pcie_error_reporting(pdev); 1616 + 1655 1617 /* Setup Runtime configurable options */ 1656 1618 if (is_qla8022(ha)) { 1657 1619 ha->isp_ops = &qla4_8xxx_isp_ops; ··· 1671 1629 } else { 1672 1630 ha->isp_ops = &qla4xxx_isp_ops; 1673 1631 } 1632 + 1633 + /* Set EEH reset type to fundamental if required by hba */ 1634 + if (is_qla8022(ha)) 1635 + pdev->needs_freset = 1; 1674 1636 1675 1637 /* Configure PCI I/O space. */ 1676 1638 ret = ha->isp_ops->iospace_config(ha); ··· 1772 1726 } 1773 1727 } 1774 1728 1729 + pci_save_state(ha->pdev); 1775 1730 ha->isp_ops->enable_intrs(ha); 1776 1731 1777 1732 /* Start timer thread. */ ··· 1799 1752 qla4xxx_free_adapter(ha); 1800 1753 1801 1754 probe_failed_ioconfig: 1755 + pci_disable_pcie_error_reporting(pdev); 1802 1756 scsi_host_put(ha->host); 1803 1757 1804 1758 probe_disable_device: ··· 1829 1781 1830 1782 scsi_host_put(ha->host); 1831 1783 1784 + pci_disable_pcie_error_reporting(pdev); 1832 1785 pci_disable_device(pdev); 1833 1786 pci_set_drvdata(pdev, NULL); 1834 1787 } ··· 1926 1877 int done = 0; 1927 1878 struct srb *rp; 1928 1879 uint32_t max_wait_time = EH_WAIT_CMD_TOV; 1880 + int ret = SUCCESS; 1881 + 1882 + /* Dont wait on command if PCI error is being handled 1883 + * by PCI AER driver 1884 + */ 1885 + if (unlikely(pci_channel_offline(ha->pdev)) || 1886 + (test_bit(AF_EEH_BUSY, &ha->flags))) { 1887 + ql4_printk(KERN_WARNING, ha, "scsi%ld: Return from %s\n", 1888 + ha->host_no, __func__); 1889 + return ret; 1890 + } 1929 1891 1930 1892 do { 1931 1893 /* Checking to see if its returned to OS */ ··· 2232 2172 return return_status; 2233 2173 } 2234 2174 2175 + /* PCI AER driver recovers from all correctable errors w/o 2176 + * driver intervention. For uncorrectable errors PCI AER 2177 + * driver calls the following device driver's callbacks 2178 + * 2179 + * - Fatal Errors - link_reset 2180 + * - Non-Fatal Errors - driver's pci_error_detected() which 2181 + * returns CAN_RECOVER, NEED_RESET or DISCONNECT. 2182 + * 2183 + * PCI AER driver calls 2184 + * CAN_RECOVER - driver's pci_mmio_enabled(), mmio_enabled 2185 + * returns RECOVERED or NEED_RESET if fw_hung 2186 + * NEED_RESET - driver's slot_reset() 2187 + * DISCONNECT - device is dead & cannot recover 2188 + * RECOVERED - driver's pci_resume() 2189 + */ 2190 + static pci_ers_result_t 2191 + qla4xxx_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state) 2192 + { 2193 + struct scsi_qla_host *ha = pci_get_drvdata(pdev); 2194 + 2195 + ql4_printk(KERN_WARNING, ha, "scsi%ld: %s: error detected:state %x\n", 2196 + ha->host_no, __func__, state); 2197 + 2198 + if (!is_aer_supported(ha)) 2199 + return PCI_ERS_RESULT_NONE; 2200 + 2201 + switch (state) { 2202 + case pci_channel_io_normal: 2203 + clear_bit(AF_EEH_BUSY, &ha->flags); 2204 + return PCI_ERS_RESULT_CAN_RECOVER; 2205 + case pci_channel_io_frozen: 2206 + set_bit(AF_EEH_BUSY, &ha->flags); 2207 + qla4xxx_mailbox_premature_completion(ha); 2208 + qla4xxx_free_irqs(ha); 2209 + pci_disable_device(pdev); 2210 + return PCI_ERS_RESULT_NEED_RESET; 2211 + case pci_channel_io_perm_failure: 2212 + set_bit(AF_EEH_BUSY, &ha->flags); 2213 + set_bit(AF_PCI_CHANNEL_IO_PERM_FAILURE, &ha->flags); 2214 + qla4xxx_abort_active_cmds(ha, DID_NO_CONNECT << 16); 2215 + return PCI_ERS_RESULT_DISCONNECT; 2216 + } 2217 + return PCI_ERS_RESULT_NEED_RESET; 2218 + } 2219 + 2220 + /** 2221 + * qla4xxx_pci_mmio_enabled() gets called if 2222 + * qla4xxx_pci_error_detected() returns PCI_ERS_RESULT_CAN_RECOVER 2223 + * and read/write to the device still works. 2224 + **/ 2225 + static pci_ers_result_t 2226 + qla4xxx_pci_mmio_enabled(struct pci_dev *pdev) 2227 + { 2228 + struct scsi_qla_host *ha = pci_get_drvdata(pdev); 2229 + 2230 + if (!is_aer_supported(ha)) 2231 + return PCI_ERS_RESULT_NONE; 2232 + 2233 + if (test_bit(AF_FW_RECOVERY, &ha->flags)) { 2234 + ql4_printk(KERN_WARNING, ha, "scsi%ld: %s: firmware hang -- " 2235 + "mmio_enabled\n", ha->host_no, __func__); 2236 + return PCI_ERS_RESULT_NEED_RESET; 2237 + } else 2238 + return PCI_ERS_RESULT_RECOVERED; 2239 + } 2240 + 2241 + uint32_t qla4_8xxx_error_recovery(struct scsi_qla_host *ha) 2242 + { 2243 + uint32_t rval = QLA_ERROR; 2244 + int fn; 2245 + struct pci_dev *other_pdev = NULL; 2246 + 2247 + ql4_printk(KERN_WARNING, ha, "scsi%ld: In %s\n", ha->host_no, __func__); 2248 + 2249 + set_bit(DPC_RESET_ACTIVE, &ha->dpc_flags); 2250 + 2251 + if (test_bit(AF_ONLINE, &ha->flags)) { 2252 + clear_bit(AF_ONLINE, &ha->flags); 2253 + qla4xxx_mark_all_devices_missing(ha); 2254 + qla4xxx_process_aen(ha, FLUSH_DDB_CHANGED_AENS); 2255 + qla4xxx_abort_active_cmds(ha, DID_RESET << 16); 2256 + } 2257 + 2258 + fn = PCI_FUNC(ha->pdev->devfn); 2259 + while (fn > 0) { 2260 + fn--; 2261 + ql4_printk(KERN_INFO, ha, "scsi%ld: %s: Finding PCI device at " 2262 + "func %x\n", ha->host_no, __func__, fn); 2263 + /* Get the pci device given the domain, bus, 2264 + * slot/function number */ 2265 + other_pdev = 2266 + pci_get_domain_bus_and_slot(pci_domain_nr(ha->pdev->bus), 2267 + ha->pdev->bus->number, PCI_DEVFN(PCI_SLOT(ha->pdev->devfn), 2268 + fn)); 2269 + 2270 + if (!other_pdev) 2271 + continue; 2272 + 2273 + if (atomic_read(&other_pdev->enable_cnt)) { 2274 + ql4_printk(KERN_INFO, ha, "scsi%ld: %s: Found PCI " 2275 + "func in enabled state%x\n", ha->host_no, 2276 + __func__, fn); 2277 + pci_dev_put(other_pdev); 2278 + break; 2279 + } 2280 + pci_dev_put(other_pdev); 2281 + } 2282 + 2283 + /* The first function on the card, the reset owner will 2284 + * start & initialize the firmware. The other functions 2285 + * on the card will reset the firmware context 2286 + */ 2287 + if (!fn) { 2288 + ql4_printk(KERN_INFO, ha, "scsi%ld: %s: devfn being reset " 2289 + "0x%x is the owner\n", ha->host_no, __func__, 2290 + ha->pdev->devfn); 2291 + 2292 + qla4_8xxx_idc_lock(ha); 2293 + qla4_8xxx_wr_32(ha, QLA82XX_CRB_DEV_STATE, 2294 + QLA82XX_DEV_COLD); 2295 + 2296 + qla4_8xxx_wr_32(ha, QLA82XX_CRB_DRV_IDC_VERSION, 2297 + QLA82XX_IDC_VERSION); 2298 + 2299 + qla4_8xxx_idc_unlock(ha); 2300 + clear_bit(AF_FW_RECOVERY, &ha->flags); 2301 + rval = qla4xxx_initialize_adapter(ha, PRESERVE_DDB_LIST); 2302 + qla4_8xxx_idc_lock(ha); 2303 + 2304 + if (rval != QLA_SUCCESS) { 2305 + ql4_printk(KERN_INFO, ha, "scsi%ld: %s: HW State: " 2306 + "FAILED\n", ha->host_no, __func__); 2307 + qla4_8xxx_clear_drv_active(ha); 2308 + qla4_8xxx_wr_32(ha, QLA82XX_CRB_DEV_STATE, 2309 + QLA82XX_DEV_FAILED); 2310 + } else { 2311 + ql4_printk(KERN_INFO, ha, "scsi%ld: %s: HW State: " 2312 + "READY\n", ha->host_no, __func__); 2313 + qla4_8xxx_wr_32(ha, QLA82XX_CRB_DEV_STATE, 2314 + QLA82XX_DEV_READY); 2315 + /* Clear driver state register */ 2316 + qla4_8xxx_wr_32(ha, QLA82XX_CRB_DRV_STATE, 0); 2317 + qla4_8xxx_set_drv_active(ha); 2318 + ha->isp_ops->enable_intrs(ha); 2319 + } 2320 + qla4_8xxx_idc_unlock(ha); 2321 + } else { 2322 + ql4_printk(KERN_INFO, ha, "scsi%ld: %s: devfn 0x%x is not " 2323 + "the reset owner\n", ha->host_no, __func__, 2324 + ha->pdev->devfn); 2325 + if ((qla4_8xxx_rd_32(ha, QLA82XX_CRB_DEV_STATE) == 2326 + QLA82XX_DEV_READY)) { 2327 + clear_bit(AF_FW_RECOVERY, &ha->flags); 2328 + rval = qla4xxx_initialize_adapter(ha, 2329 + PRESERVE_DDB_LIST); 2330 + if (rval == QLA_SUCCESS) 2331 + ha->isp_ops->enable_intrs(ha); 2332 + qla4_8xxx_idc_lock(ha); 2333 + qla4_8xxx_set_drv_active(ha); 2334 + qla4_8xxx_idc_unlock(ha); 2335 + } 2336 + } 2337 + clear_bit(DPC_RESET_ACTIVE, &ha->dpc_flags); 2338 + return rval; 2339 + } 2340 + 2341 + static pci_ers_result_t 2342 + qla4xxx_pci_slot_reset(struct pci_dev *pdev) 2343 + { 2344 + pci_ers_result_t ret = PCI_ERS_RESULT_DISCONNECT; 2345 + struct scsi_qla_host *ha = pci_get_drvdata(pdev); 2346 + int rc; 2347 + 2348 + ql4_printk(KERN_WARNING, ha, "scsi%ld: %s: slot_reset\n", 2349 + ha->host_no, __func__); 2350 + 2351 + if (!is_aer_supported(ha)) 2352 + return PCI_ERS_RESULT_NONE; 2353 + 2354 + /* Restore the saved state of PCIe device - 2355 + * BAR registers, PCI Config space, PCIX, MSI, 2356 + * IOV states 2357 + */ 2358 + pci_restore_state(pdev); 2359 + 2360 + /* pci_restore_state() clears the saved_state flag of the device 2361 + * save restored state which resets saved_state flag 2362 + */ 2363 + pci_save_state(pdev); 2364 + 2365 + /* Initialize device or resume if in suspended state */ 2366 + rc = pci_enable_device(pdev); 2367 + if (rc) { 2368 + ql4_printk(KERN_WARNING, ha, "scsi%ld: %s: Cant re-enable " 2369 + "device after reset\n", ha->host_no, __func__); 2370 + goto exit_slot_reset; 2371 + } 2372 + 2373 + ret = qla4xxx_request_irqs(ha); 2374 + if (ret) { 2375 + ql4_printk(KERN_WARNING, ha, "Failed to reserve interrupt %d" 2376 + " already in use.\n", pdev->irq); 2377 + goto exit_slot_reset; 2378 + } 2379 + 2380 + if (is_qla8022(ha)) { 2381 + if (qla4_8xxx_error_recovery(ha) == QLA_SUCCESS) { 2382 + ret = PCI_ERS_RESULT_RECOVERED; 2383 + goto exit_slot_reset; 2384 + } else 2385 + goto exit_slot_reset; 2386 + } 2387 + 2388 + exit_slot_reset: 2389 + ql4_printk(KERN_WARNING, ha, "scsi%ld: %s: Return=%x\n" 2390 + "device after reset\n", ha->host_no, __func__, ret); 2391 + return ret; 2392 + } 2393 + 2394 + static void 2395 + qla4xxx_pci_resume(struct pci_dev *pdev) 2396 + { 2397 + struct scsi_qla_host *ha = pci_get_drvdata(pdev); 2398 + int ret; 2399 + 2400 + ql4_printk(KERN_WARNING, ha, "scsi%ld: %s: pci_resume\n", 2401 + ha->host_no, __func__); 2402 + 2403 + ret = qla4xxx_wait_for_hba_online(ha); 2404 + if (ret != QLA_SUCCESS) { 2405 + ql4_printk(KERN_ERR, ha, "scsi%ld: %s: the device failed to " 2406 + "resume I/O from slot/link_reset\n", ha->host_no, 2407 + __func__); 2408 + } 2409 + 2410 + pci_cleanup_aer_uncorrect_error_status(pdev); 2411 + clear_bit(AF_EEH_BUSY, &ha->flags); 2412 + } 2413 + 2414 + static struct pci_error_handlers qla4xxx_err_handler = { 2415 + .error_detected = qla4xxx_pci_error_detected, 2416 + .mmio_enabled = qla4xxx_pci_mmio_enabled, 2417 + .slot_reset = qla4xxx_pci_slot_reset, 2418 + .resume = qla4xxx_pci_resume, 2419 + }; 2420 + 2235 2421 static struct pci_device_id qla4xxx_pci_tbl[] = { 2236 2422 { 2237 2423 .vendor = PCI_VENDOR_ID_QLOGIC, ··· 2512 2206 .id_table = qla4xxx_pci_tbl, 2513 2207 .probe = qla4xxx_probe_adapter, 2514 2208 .remove = qla4xxx_remove_adapter, 2209 + .err_handler = &qla4xxx_err_handler, 2515 2210 }; 2516 2211 2517 2212 static int __init qla4xxx_module_init(void)
+1 -1
drivers/scsi/qla4xxx/ql4_version.h
··· 5 5 * See LICENSE.qla4xxx for copyright and licensing details. 6 6 */ 7 7 8 - #define QLA4XXX_DRIVER_VERSION "5.02.00-k2" 8 + #define QLA4XXX_DRIVER_VERSION "5.02.00-k3"
+7 -4
drivers/scsi/scsi_error.c
··· 473 473 */ 474 474 return SUCCESS; 475 475 case RESERVATION_CONFLICT: 476 - /* 477 - * let issuer deal with this, it could be just fine 478 - */ 479 - return SUCCESS; 476 + if (scmd->cmnd[0] == TEST_UNIT_READY) 477 + /* it is a success, we probed the device and 478 + * found it */ 479 + return SUCCESS; 480 + /* otherwise, we failed to send the command */ 481 + return FAILED; 480 482 case QUEUE_FULL: 481 483 scsi_handle_queue_full(scmd->device); 482 484 /* fall through */ 483 485 case BUSY: 486 + return NEEDS_RETRY; 484 487 default: 485 488 return FAILED; 486 489 }
+1
drivers/scsi/scsi_tgt_lib.c
··· 185 185 dprintk("cmd %p %d %u\n", cmd, cmd->sc_data_direction, 186 186 rq_data_dir(cmd->request)); 187 187 scsi_unmap_user_pages(tcmd); 188 + tcmd->rq->bio = NULL; 188 189 scsi_host_put_command(scsi_tgt_cmd_to_host(cmd), cmd); 189 190 } 190 191