Skip to content

Commit 099907f

Browse files
Sony Chackodavem330
authored andcommitted
qlcnic: modify reset recovery path in diag mode
Provide diagnostics routines enough time to unwind before proceeding with reset recovery. Signed-off-by: Sony Chacko <[email protected]> Signed-off-by: Shahed Shaikh <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4690a7e commit 099907f

File tree

3 files changed

+34
-8
lines changed

3 files changed

+34
-8
lines changed

drivers/net/ethernet/qlogic/qlcnic/qlcnic.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1477,7 +1477,6 @@ int qlcnic_send_lro_cleanup(struct qlcnic_adapter *adapter);
14771477
void qlcnic_update_cmd_producer(struct qlcnic_host_tx_ring *);
14781478

14791479
/* Functions from qlcnic_ethtool.c */
1480-
14811480
int qlcnic_check_loopback_buff(unsigned char *, u8 []);
14821481
int qlcnic_do_lb_test(struct qlcnic_adapter *, u8);
14831482
int qlcnic_loopback_test(struct net_device *, u8);
@@ -1897,6 +1896,11 @@ static inline void qlcnic_release_diag_lock(struct qlcnic_adapter *adapter)
18971896
clear_bit(__QLCNIC_DIAG_MODE, &adapter->state);
18981897
}
18991898

1899+
static inline int qlcnic_check_diag_status(struct qlcnic_adapter *adapter)
1900+
{
1901+
return test_bit(__QLCNIC_DIAG_MODE, &adapter->state);
1902+
}
1903+
19001904
extern const struct ethtool_ops qlcnic_sriov_vf_ethtool_ops;
19011905
extern const struct ethtool_ops qlcnic_ethtool_ops;
19021906
extern const struct ethtool_ops qlcnic_ethtool_failed_ops;

drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ struct qlc_83xx_idc {
314314
u8 vnic_state;
315315
u8 vnic_wait_limit;
316316
u8 quiesce_req;
317+
u8 delay_reset;
317318
char **name;
318319
};
319320

drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,7 @@ static void qlcnic_83xx_idc_update_idc_params(struct qlcnic_adapter *adapter)
649649
ahw->idc.collect_dump = 0;
650650
ahw->reset_context = 0;
651651
adapter->tx_timeo_cnt = 0;
652+
ahw->idc.delay_reset = 0;
652653

653654
clear_bit(__QLCNIC_RESETTING, &adapter->state);
654655
}
@@ -883,21 +884,41 @@ static int qlcnic_83xx_idc_need_reset_state(struct qlcnic_adapter *adapter)
883884
int ret = 0;
884885

885886
if (adapter->ahw->idc.prev_state != QLC_83XX_IDC_DEV_NEED_RESET) {
886-
qlcnic_83xx_idc_update_drv_ack_reg(adapter, 1, 1);
887887
qlcnic_83xx_idc_update_audit_reg(adapter, 0, 1);
888888
set_bit(__QLCNIC_RESETTING, &adapter->state);
889889
clear_bit(QLC_83XX_MBX_READY, &adapter->ahw->idc.status);
890890
if (adapter->ahw->nic_mode == QLC_83XX_VIRTUAL_NIC_MODE)
891891
qlcnic_83xx_disable_vnic_mode(adapter, 1);
892-
qlcnic_83xx_idc_detach_driver(adapter);
892+
893+
if (qlcnic_check_diag_status(adapter)) {
894+
dev_info(&adapter->pdev->dev,
895+
"%s: Wait for diag completion\n", __func__);
896+
adapter->ahw->idc.delay_reset = 1;
897+
return 0;
898+
} else {
899+
qlcnic_83xx_idc_update_drv_ack_reg(adapter, 1, 1);
900+
qlcnic_83xx_idc_detach_driver(adapter);
901+
}
893902
}
894903

895-
/* Check ACK from other functions */
896-
ret = qlcnic_83xx_idc_check_reset_ack_reg(adapter);
897-
if (ret) {
904+
if (qlcnic_check_diag_status(adapter)) {
898905
dev_info(&adapter->pdev->dev,
899-
"%s: Waiting for reset ACK\n", __func__);
900-
return 0;
906+
"%s: Wait for diag completion\n", __func__);
907+
return -1;
908+
} else {
909+
if (adapter->ahw->idc.delay_reset) {
910+
qlcnic_83xx_idc_update_drv_ack_reg(adapter, 1, 1);
911+
qlcnic_83xx_idc_detach_driver(adapter);
912+
adapter->ahw->idc.delay_reset = 0;
913+
}
914+
915+
/* Check for ACK from other functions */
916+
ret = qlcnic_83xx_idc_check_reset_ack_reg(adapter);
917+
if (ret) {
918+
dev_info(&adapter->pdev->dev,
919+
"%s: Waiting for reset ACK\n", __func__);
920+
return -1;
921+
}
901922
}
902923

903924
/* Transit to INIT state and restart the HW */

0 commit comments

Comments
 (0)