From patchwork Fri Aug 19 09:50:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jitendra Bhivare X-Patchwork-Id: 9289949 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5C43F607FF for ; Fri, 19 Aug 2016 09:51:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D0E0292FF for ; Fri, 19 Aug 2016 09:51:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 41DA229333; Fri, 19 Aug 2016 09:51:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CBBA9292FF for ; Fri, 19 Aug 2016 09:51:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754474AbcHSJv4 (ORCPT ); Fri, 19 Aug 2016 05:51:56 -0400 Received: from mail-wm0-f48.google.com ([74.125.82.48]:38828 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752244AbcHSJvz (ORCPT ); Fri, 19 Aug 2016 05:51:55 -0400 Received: by mail-wm0-f48.google.com with SMTP id o80so32623386wme.1 for ; Fri, 19 Aug 2016 02:51:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=smmSCZytqD91VLYon8fD2PoiLFLOwQADUwN4q1241hA=; b=ZAewjjBnKm4aicG6Zw5siCQZJQJsKozziwI3K4HlgAwtnt/N00o7D10fy/09tWfKH9 SibxS7u4VA5rEuVAWCECttYwu6VZnKi/WbDy/iWFK90BGduPr3UahLRk80GvxN/Vwoyk hMdFBZHdQ6N0PcwziTpkkrPAgXLz8YgAzhF2I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=smmSCZytqD91VLYon8fD2PoiLFLOwQADUwN4q1241hA=; b=a3+ubim/oZf7YHoXmAEj/Q78LuGPp2u9PwOT9KkP0649edtnrvSxwnLOxvE2oOVSIS enW8rRq6/xp67dRf6Item548degG7no510YE/G5IbMBeVdSutAyP214+04w5a7DAJ3Mh pQNtVAvm4X7XGR3Gpdu8T1fBH4kEke1+LoYtEilovZaBdq9HsJliNO6g6HPIu1S9RjD7 T8uDwA3M6LWhj7WlQxAhN26WdFajzKdi1NPGPOo8hzTTHRc7BlUcUNCumDWjKs8hINEG RPZp8EeuuSgMY8tB2wRiTDElmTPHWHphuxODrSygkKLiKEgfbJG5/K8oeKrhdFdyIHPS UvAg== X-Gm-Message-State: AEkoouvoEPpP3HI52EYiVR0yjnWXnRSMya/jIJB2dkbL928hxaHCHnTfh5bRVg7M4cHiLxFd X-Received: by 10.194.178.193 with SMTP id da1mr5469806wjc.66.1471600313421; Fri, 19 Aug 2016 02:51:53 -0700 (PDT) Received: from android.dhcp.avagotech.net ([192.19.239.250]) by smtp.gmail.com with ESMTPSA id n131sm3650096wmd.3.2016.08.19.02.51.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 Aug 2016 02:51:52 -0700 (PDT) From: Jitendra Bhivare To: linux-scsi@vger.kernel.org Cc: mchristi@redhat.com, Jitendra Bhivare Subject: [PATCH v2 22/29] be2iscsi: Fail the sessions immediately after TPE Date: Fri, 19 Aug 2016 15:20:19 +0530 Message-Id: <1471600226-22055-23-git-send-email-jitendra.bhivare@broadcom.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1471600226-22055-1-git-send-email-jitendra.bhivare@broadcom.com> References: <1471600226-22055-1-git-send-email-jitendra.bhivare@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Sessions are no longer valid, so schedule sess_work to fail the sessions immediately when error is detected. This is done to avoid iSCSI transport layer to keep sending NOP-Out which driver any ways fail. Schedule sess_work immediately in case of HBA error. Old sessions are gone for good and need to be re-established. iscsi_session_failure needs process context hence this work. Signed-off-by: Jitendra Bhivare Reviewed-by: Hannes Reinecke --- drivers/scsi/be2iscsi/be_main.c | 24 +++++++++++++++++++++--- drivers/scsi/be2iscsi/be_main.h | 1 + 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 0625bd0..cf82973 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c @@ -5398,7 +5398,10 @@ static void beiscsi_hw_health_check(unsigned long ptr) if (beiscsi_detect_ue(phba)) { __beiscsi_log(phba, KERN_ERR, "BM_%d : port in error: %lx\n", phba->state); - /* detect TPE if UER supported */ + /* sessions are no longer valid, so first fail the sessions */ + queue_work(phba->wq, &phba->sess_work); + + /* detect UER supported */ if (!test_bit(BEISCSI_HBA_UER_SUPP, &phba->state)) return; /* modify this timer to check TPE */ @@ -5562,12 +5565,24 @@ static void beiscsi_disable_port(struct beiscsi_hba *phba, int unload) hwi_cleanup_port(phba); } +static void beiscsi_sess_work(struct work_struct *work) +{ + struct beiscsi_hba *phba; + + phba = container_of(work, struct beiscsi_hba, sess_work); + /* + * This work gets scheduled only in case of HBA error. + * Old sessions are gone so need to be re-established. + * iscsi_session_failure needs process context hence this work. + */ + iscsi_host_for_each_session(phba->shost, beiscsi_session_fail); +} + static void beiscsi_recover_port(struct work_struct *work) { struct beiscsi_hba *phba; phba = container_of(work, struct beiscsi_hba, recover_port.work); - iscsi_host_for_each_session(phba->shost, beiscsi_session_fail); beiscsi_disable_port(phba, 0); beiscsi_enable_port(phba); } @@ -5587,6 +5602,8 @@ static pci_ers_result_t beiscsi_eeh_err_detected(struct pci_dev *pdev, del_timer_sync(&phba->hw_check); cancel_delayed_work_sync(&phba->recover_port); + /* sessions are no longer valid, so first fail the sessions */ + iscsi_host_for_each_session(phba->shost, beiscsi_session_fail); beiscsi_disable_port(phba, 0); if (state == pci_channel_io_perm_failure) { @@ -5832,6 +5849,7 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev, schedule_delayed_work(&phba->eqd_update, msecs_to_jiffies(BEISCSI_EQD_UPDATE_INTERVAL)); + INIT_WORK(&phba->sess_work, beiscsi_sess_work); INIT_DELAYED_WORK(&phba->recover_port, beiscsi_recover_port); /** * Start UE detection here. UE before this will cause stall in probe @@ -5842,7 +5860,6 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev, phba->hw_check.data = (unsigned long)phba; mod_timer(&phba->hw_check, jiffies + msecs_to_jiffies(BEISCSI_UE_DETECT_INTERVAL)); - beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT, "\n\n\n BM_%d : SUCCESS - DRIVER LOADED\n\n\n"); return 0; @@ -5888,6 +5905,7 @@ static void beiscsi_remove(struct pci_dev *pcidev) /* first stop UE detection before unloading */ del_timer_sync(&phba->hw_check); cancel_delayed_work_sync(&phba->recover_port); + cancel_work_sync(&phba->sess_work); beiscsi_iface_destroy_default(phba); iscsi_host_remove(phba->shost); diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h index 1fd6c18..953d94a 100644 --- a/drivers/scsi/be2iscsi/be_main.h +++ b/drivers/scsi/be2iscsi/be_main.h @@ -418,6 +418,7 @@ struct beiscsi_hba { #define BEISCSI_UE_DETECT_INTERVAL 1000 u32 ue2rp; struct delayed_work recover_port; + struct work_struct sess_work; bool mac_addr_set; u8 mac_address[ETH_ALEN];