From 9122e991cebb90a7225109ed7627950f485c5f58 Mon Sep 17 00:00:00 2001 From: Jitendra Bhivare Date: Fri, 19 Aug 2016 15:20:11 +0530 Subject: scsi: be2iscsi: Fix checks for HBA in error state Save ue_detected and fw_timeout errors in state field of beiscsi_hba. BEISCSI_HBA_RUNNING BEISCSI_HBA_LINK_UP BEISCSI_HBA_BOOT_FOUND BEISCSI_HBA_PCI_ERR BEISCSI_HBA_FW_TIMEOUT BEISCSI_HBA_IN_UE Make sure no PCI transaction happens once in error state. Add checks in IO path to detect HBA in error. Skip hwi_purge_eq step which can't be done in error state. Signed-off-by: Jitendra Bhivare Reviewed-by: Hannes Reinecke Signed-off-by: Martin K. Petersen --- drivers/scsi/be2iscsi/be_main.h | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) (limited to 'drivers/scsi/be2iscsi/be_main.h') diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h index 90cdc10c01fb..8ab16516ae9a 100644 --- a/drivers/scsi/be2iscsi/be_main.h +++ b/drivers/scsi/be2iscsi/be_main.h @@ -98,20 +98,9 @@ #define INVALID_SESS_HANDLE 0xFFFFFFFF -/** - * Adapter States - **/ -#define BE_ADAPTER_LINK_UP 0x001 -#define BE_ADAPTER_LINK_DOWN 0x002 -#define BE_ADAPTER_PCI_ERR 0x004 -#define BE_ADAPTER_CHECK_BOOT 0x008 - - -#define BEISCSI_CLEAN_UNLOAD 0x01 -#define BEISCSI_EEH_UNLOAD 0x02 - #define BE_GET_BOOT_RETRIES 45 #define BE_GET_BOOT_TO 20 + /** * hardware needs the async PDU buffers to be posted in multiples of 8 * So have atleast 8 of them by default @@ -417,11 +406,20 @@ struct beiscsi_hba { unsigned long ulp_supported; } fw_config; - unsigned int state; + unsigned long state; +#define BEISCSI_HBA_RUNNING 0 +#define BEISCSI_HBA_LINK_UP 1 +#define BEISCSI_HBA_BOOT_FOUND 2 +#define BEISCSI_HBA_PCI_ERR 3 +#define BEISCSI_HBA_FW_TIMEOUT 4 +#define BEISCSI_HBA_IN_UE 5 +/* error bits */ +#define BEISCSI_HBA_IN_ERR ((1 << BEISCSI_HBA_PCI_ERR) | \ + (1 << BEISCSI_HBA_FW_TIMEOUT) | \ + (1 << BEISCSI_HBA_IN_UE)) + u8 optic_state; int get_boot; - bool fw_timeout; - bool ue_detected; struct delayed_work beiscsi_hw_check_task; bool mac_addr_set; @@ -445,6 +443,8 @@ struct beiscsi_hba { uint32_t writedir); }; +#define beiscsi_hba_in_error(phba) ((phba)->state & BEISCSI_HBA_IN_ERR) + struct beiscsi_session { struct pci_pool *bhs_pool; }; @@ -507,6 +507,7 @@ struct beiscsi_io_task { struct sgl_handle *psgl_handle; struct beiscsi_conn *conn; struct scsi_cmnd *scsi_cmnd; + int num_sg; struct hwi_wrb_context *pwrb_context; unsigned int cmd_sn; unsigned int flags; @@ -854,11 +855,6 @@ void hwi_ring_cq_db(struct beiscsi_hba *phba, unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq, int budget); void beiscsi_process_mcc_cq(struct beiscsi_hba *phba); -static inline bool beiscsi_error(struct beiscsi_hba *phba) -{ - return phba->ue_detected || phba->fw_timeout; -} - struct pdu_nop_out { u32 dw[12]; }; -- cgit v1.2.3