From patchwork Mon Sep 28 04:50:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muneendra Kumar X-Patchwork-Id: 287308 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.9 required=3.0 tests=BAYES_00, DATE_IN_PAST_06_12, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D726FC2D0A8 for ; Mon, 28 Sep 2020 11:44:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8144721D95 for ; Mon, 28 Sep 2020 11:44:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="c7ODsJcA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726630AbgI1Lor (ORCPT ); Mon, 28 Sep 2020 07:44:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726608AbgI1Lor (ORCPT ); Mon, 28 Sep 2020 07:44:47 -0400 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFEE7C061755 for ; Mon, 28 Sep 2020 04:44:46 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id mn7so485355pjb.5 for ; Mon, 28 Sep 2020 04:44:46 -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=2Oa7nLWj6s51DZc57OiVZhXUIx9niedcnvuQsf9d3Ls=; b=c7ODsJcAHVAEREasZy/RYGm8CW1kWtXRke8DWnxLf7FU8qm5rrEtWpPoAJ44qTNWl7 c2ZxaBTb/MaTWCRrMtc2J1Dw5XItD/CrOsRZ5N5IWeOeqHQnfmo1AsKDb54O1WEFjP/H qm/rmTkJO9hHmE0ul2mfXBOBrjaC4OrA1mxpY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2Oa7nLWj6s51DZc57OiVZhXUIx9niedcnvuQsf9d3Ls=; b=gAEyNAKPOoBDOMaNY1CfccKTgepveSAofiEj/spdB/cvTXifM1h6z3SyJ7yfBzvNCT nxfunrb5b0VOu7AFoJyNpNcz0WwJ2nGKtZ/atBbyNgUaSG9uwBU6tlWqXWLDiQSSPyx8 2FyXIk+ZyzfVC3ExjBkkjTKnRkxSThCOhupwK46Josc0Xfvou3zw/O4sgmAVNTKueNtD uz0CoXgSmnCrw43MDAyhWzPnOS050DNBbOO/ixOdtTvPyLJZIWL3d8s9JXPv3smYXd34 UGBv59j2woO7heTpLZ7txWFKOkqHK0gx/KaIhd5iWvBMZTpeBHKDfImg+QtbgJUVGqfG Hl6g== X-Gm-Message-State: AOAM5313kQtpeTCW6qGnG9jgC1jhDLLynA2malqqmrmjDn2xzWu80kab mHQ6Tj4s8SxAr4t6+FmxCMHNZ6WN4cFG83FP+CBMjF6OxdCa65EgEnylLuFE0P24aTWOfm5Z+R1 x5wLCLOJDVyMfs9g1Txp3q/mzkA5TXGA4KgiKNSCPewwWd3aBOzsFMjbNTGxGmz9OSdIohfWsx+ xIEsqsCDan X-Google-Smtp-Source: ABdhPJxwV7uCS5YVJpDdkLZbENfht5AUw2vUe4TtRrf+DUBiss0QPpT+a8z9sPFn1lLJCMKMdZqsQA== X-Received: by 2002:a17:90b:d86:: with SMTP id bg6mr937203pjb.155.1601293486055; Mon, 28 Sep 2020 04:44:46 -0700 (PDT) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id w19sm1468866pfq.60.2020.09.28.04.44.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Sep 2020 04:44:45 -0700 (PDT) From: Muneendra To: linux-scsi@vger.kernel.org, hare@suse.de Cc: jsmart2021@gmail.com, emilne@redhat.com, mkumar@redhat.com, Muneendra Subject: [PATCH v2 6/8] scsi_transport_fc: Added a new rport state FC_PORTSTATE_MARGINAL Date: Mon, 28 Sep 2020 10:20:55 +0530 Message-Id: <1601268657-940-7-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1601268657-940-1-git-send-email-muneendra.kumar@broadcom.com> References: <1601268657-940-1-git-send-email-muneendra.kumar@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Added a new rport state FC_PORTSTATE_MARGINAL. Made changes in fc_remote_port_chkready function to treat marginal and online as same Added a new inline function fc_rport_chkmarginal_set_noretries which will set the SCMD_NORETRIES_ABORT bit in cmd->state if rport state is marginal. Signed-off-by: Muneendra --- v2: New patch --- include/scsi/scsi_transport_fc.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h index 1c7dd35cb7a0..ee99c6ca7e45 100644 --- a/include/scsi/scsi_transport_fc.h +++ b/include/scsi/scsi_transport_fc.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -67,6 +68,7 @@ enum fc_port_state { FC_PORTSTATE_ERROR, FC_PORTSTATE_LOOPBACK, FC_PORTSTATE_DELETED, + FC_PORTSTATE_MARGINAL, }; @@ -383,6 +385,7 @@ struct fc_starget_attrs { /* aka fc_target_attrs */ u64 node_name; u64 port_name; u32 port_id; + enum fc_port_state port_state; }; #define fc_starget_node_name(x) \ @@ -391,6 +394,8 @@ struct fc_starget_attrs { /* aka fc_target_attrs */ (((struct fc_starget_attrs *)&(x)->starget_data)->port_name) #define fc_starget_port_id(x) \ (((struct fc_starget_attrs *)&(x)->starget_data)->port_id) +#define fc_starget_port_state(x) \ + (((struct fc_starget_attrs *)&(x)->starget_data)->port_state) #define starget_to_rport(s) \ scsi_is_fc_rport(s->dev.parent) ? dev_to_rport(s->dev.parent) : NULL @@ -723,6 +728,7 @@ fc_remote_port_chkready(struct fc_rport *rport) switch (rport->port_state) { case FC_PORTSTATE_ONLINE: + case FC_PORTSTATE_MARGINAL: if (rport->roles & FC_PORT_ROLE_FCP_TARGET) result = 0; else if (rport->flags & FC_RPORT_DEVLOSS_PENDING) @@ -743,6 +749,24 @@ fc_remote_port_chkready(struct fc_rport *rport) return result; } +/** + * fc_rport_chkmarginal_set_noretries - Set the SCMD_NORETRIES_ABORT bit + * in cmd->state if port state is marginal prior to initiating + * io to the port. + * @rport: remote port to be checked + * @scmd: scsi_cmd + **/ +static inline void +fc_rport_chkmarginal_set_noretries(struct fc_rport *rport, struct scsi_cmnd *cmd) +{ + if ((rport->port_state == FC_PORTSTATE_MARGINAL) && + (cmd->request->cmd_flags & REQ_FAILFAST_TRANSPORT)) + set_bit(SCMD_NORETRIES_ABORT, &cmd->state); + else + clear_bit(SCMD_NORETRIES_ABORT, &cmd->state); + +} + static inline u64 wwn_to_u64(const u8 *wwn) { return get_unaligned_be64(wwn);