From patchwork Mon Oct 9 16:18:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Tee X-Patchwork-Id: 731342 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A86DE95A9F for ; Mon, 9 Oct 2023 16:05:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377100AbjJIQF3 (ORCPT ); Mon, 9 Oct 2023 12:05:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377072AbjJIQF2 (ORCPT ); Mon, 9 Oct 2023 12:05:28 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6691E99 for ; Mon, 9 Oct 2023 09:05:27 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1c76ef40e84so8472905ad.0 for ; Mon, 09 Oct 2023 09:05:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696867527; x=1697472327; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ANXO/4U1CWyDTjjBTbo/Pgx7AydEgFFfWGdDyy2SRB4=; b=cNXG0biIpxeWVKHFDHa/EAIG81Pc9CwL785/OTFxBtXI+NfpGdMdWMt5SRU3HSewSC nSDHoWGUUsZLkGEE70G/kb1Cq1AjozRE6a+bFbPyeN/Mp1u/IbjUirhDIC/58NiXSDoa 4n0u2E2ytzAsDuJEjD8ZJJTVqF95YQlz7CWWhIiuVN2VrFbOmt6TSY+S+8v4Ll7zA69a C1fG3Wd3GcC4MEMCYmbhgsUYt4IVZM1bRcbD/VWQluwhFGUFloN3pb3ZkxR/7BPp5hG3 EkdWoWDyKeKcsfkx3tqTn0IIakB3AxoHM/NX1bXEaOgLt7D4+OxjPDpEQMU2veF5N1Rk je/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696867527; x=1697472327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ANXO/4U1CWyDTjjBTbo/Pgx7AydEgFFfWGdDyy2SRB4=; b=fCZa25Bq+W6aQq9N8mkKlvnghLtwASyyJYJSZg6P+708nnVtXQxbsfhKfAwh9rDSWi H7290clRoubuIUYRaE12NOenVglLrU3hqrmw1S6ZXdnHk9YJ3hEz5FOb+0KoG6kGk55L Xe+pyU47ux116spMHyZUp8RLBZ/52UrNzHtRFJCjnlxZUMzKreF0MVNzvzuh9+K/J/7V mxLTDvFAjdTCIedVm66Gv7wP5kcKhg3FC96E9WTQPHKukEAZA4z6YKVhJgIRusjXVDKg sJwt4evgJmAeXp8JQh7Xo1ZjrQvLjipGUUaMwKZGl4QBdRhtvSFGevFGrh/vvPL6O/FQ 9gZw== X-Gm-Message-State: AOJu0YzmEcsHmhzfbtsDSploagPSajvUUX+W55b+MqeZxtsXxZ/lLaDo HgcoyHPKvscP8pLe6SJlRPgEokTHTBg= X-Google-Smtp-Source: AGHT+IFRFAOiqHFObMeKqfqZgwxYLjAlUj1wOzzAFU8iOMIA55LQwpiktO3HYcWQ9DDRRt+JxLyXIg== X-Received: by 2002:a17:902:dacd:b0:1b3:d8ac:8db3 with SMTP id q13-20020a170902dacd00b001b3d8ac8db3mr17853013plx.6.1696867526587; Mon, 09 Oct 2023 09:05:26 -0700 (PDT) Received: from dhcp-10-231-55-133.dhcp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id l13-20020a170902d34d00b001bb9f104328sm9793418plk.146.2023.10.09.09.05.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Oct 2023 09:05:26 -0700 (PDT) From: Justin Tee To: linux-scsi@vger.kernel.org Cc: jsmart2021@gmail.com, justin.tee@broadcom.com, Justin Tee Subject: [PATCH 1/6] lpfc: Remove unnecessary zero return code assignment in lpfc_sli4_hba_setup Date: Mon, 9 Oct 2023 09:18:07 -0700 Message-Id: <20231009161812.97232-2-justintee8345@gmail.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20231009161812.97232-1-justintee8345@gmail.com> References: <20231009161812.97232-1-justintee8345@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org In order to enter the !rc if statement block in question, rc had to have been zero to begin with. Thus, the rc = 0 assignment is unnecessary and can be removed. Signed-off-by: Justin Tee --- drivers/scsi/lpfc/lpfc_sli.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 4dfadf254a72..9386e7b44750 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -8571,12 +8571,10 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) * is not fatal as the driver will use generic values. */ rc = lpfc_parse_vpd(phba, vpd, vpd_size); - if (unlikely(!rc)) { + if (unlikely(!rc)) lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, "0377 Error %d parsing vpd. " "Using defaults.\n", rc); - rc = 0; - } kfree(vpd); /* Save information as VPD data */ From patchwork Mon Oct 9 16:18:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Tee X-Patchwork-Id: 731812 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0575E95A9F for ; Mon, 9 Oct 2023 16:05:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377116AbjJIQFf (ORCPT ); Mon, 9 Oct 2023 12:05:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377115AbjJIQFd (ORCPT ); Mon, 9 Oct 2023 12:05:33 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBEDBB9 for ; Mon, 9 Oct 2023 09:05:31 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-58974d4335aso380777a12.1 for ; Mon, 09 Oct 2023 09:05:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696867531; x=1697472331; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CJMlSWQpA9rqmtNfH38LZQij/Ap34ZSy56VYO7Y7PEY=; b=Y9AoFypnM+szPhcbs1kUf431oHGDB1Qdw3cIMAj4USSwSlLkqqgH2OFSVojhTnRgvD 9uRc3c8zGozEJ7YPUdaPyR+SFT2qMjzV8W1ikbYd4pLnnKvMYtIAtzyanPXm8kl2/Pac /Xel8qPFSRy0hjTdePpDRjGHcQU66gR6LN0KbLSuDsIwM1knCUE3L24CwpJRVsk4FwtE P31Cq7it8VIBRuZJtEr8mSrB/XKFxgteyvpCsoamV9IkrYMl/XdETlglfC+vzlyl4wr8 MTlmLIpKtv6oWF7GvXH9gJCDb82laFs+QlwUxODvyL4wQSaIjE6/Uy0DwhEflyJLuk2x BPZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696867531; x=1697472331; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CJMlSWQpA9rqmtNfH38LZQij/Ap34ZSy56VYO7Y7PEY=; b=REufoKTAkLzHoLsbVXhWg7R2yqKS2ReebMqkBPTik+e2EIhWNaBZRjzJPclugtmC/Y ukItUWfzdZ/3jKrFoYuyTYN+ezQpAhMHQnKYFKRemTddQJ5sMLPqYO+6RsqSgkcnNFGt kzdaspyFB9ja4wFP1iCbmoSTXw7pOgjPHlLr5m/dnTI5vi5CvCA4Y4WsQspcyTor1vgK sfULp4E/hIC7D1j1nrBgE9YfMZ5KY+8b/82KyKmTNWU+gdrzpJ9ip133P281vXde0aXR YTSunHUs/QO6BIqXVSIZlpBkuVOPNqVYGchQqb1wSrKD5bmKZ7FN+/kaeWrboAi8dD0H gBWA== X-Gm-Message-State: AOJu0YxeKBodW4/xAXCHfw9Pu3rLI5Lu4EbpQrhevDIvYrLzBQgRSu3R 9+YB4m9YC6rrPuN4Dj0eszZzX6Y3HFM= X-Google-Smtp-Source: AGHT+IHWFxQjdkUgIxzRu12KPHYgxilWN+6mt0iKF/jIvQSFS0ixcMQWBmS3bAebzAB5tcAQx1raVg== X-Received: by 2002:a05:6a20:a10c:b0:171:737:df97 with SMTP id q12-20020a056a20a10c00b001710737df97mr936348pzk.2.1696867531004; Mon, 09 Oct 2023 09:05:31 -0700 (PDT) Received: from dhcp-10-231-55-133.dhcp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id l13-20020a170902d34d00b001bb9f104328sm9793418plk.146.2023.10.09.09.05.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Oct 2023 09:05:30 -0700 (PDT) From: Justin Tee To: linux-scsi@vger.kernel.org Cc: jsmart2021@gmail.com, justin.tee@broadcom.com, Justin Tee Subject: [PATCH 2/6] lpfc: Treat IOERR_SLI_DOWN I/O completion status the same as pci offline Date: Mon, 9 Oct 2023 09:18:08 -0700 Message-Id: <20231009161812.97232-3-justintee8345@gmail.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20231009161812.97232-1-justintee8345@gmail.com> References: <20231009161812.97232-1-justintee8345@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org During receipt of a hardware error attention ACQE, IOERR_SLI_DOWN status is set by the driver for all outstanding I/Os. In such hardware error attention cases, we can treat the situation exactly the same as pci_channel_offline. Thus, add IOERR_SLI_DOWN status to the same category as pci_channel_offline handling in lpfc_nvme_io_cmd_cmpl. Signed-off-by: Justin Tee --- drivers/scsi/lpfc/lpfc_nvme.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c index 96e11a26c297..128fc1bab586 100644 --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c @@ -950,7 +950,7 @@ lpfc_nvme_io_cmd_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn, #ifdef CONFIG_SCSI_LPFC_DEBUG_FS int cpu; #endif - int offline = 0; + bool offline = false; /* Sanity check on return of outstanding command */ if (!lpfc_ncmd) { @@ -1124,7 +1124,9 @@ lpfc_nvme_io_cmd_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn, nCmd->transferred_length = 0; nCmd->rcv_rsplen = 0; nCmd->status = NVME_SC_INTERNAL; - offline = pci_channel_offline(vport->phba->pcidev); + if (pci_channel_offline(vport->phba->pcidev) || + lpfc_ncmd->result == IOERR_SLI_DOWN) + offline = true; } } From patchwork Mon Oct 9 16:18:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Tee X-Patchwork-Id: 731341 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA5D0E95A9E for ; Mon, 9 Oct 2023 16:05:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377125AbjJIQFi (ORCPT ); Mon, 9 Oct 2023 12:05:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377115AbjJIQFg (ORCPT ); Mon, 9 Oct 2023 12:05:36 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D2CBB9 for ; Mon, 9 Oct 2023 09:05:35 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1c72e235debso10391185ad.0 for ; Mon, 09 Oct 2023 09:05:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696867534; x=1697472334; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RPQezVvb1qjUo9gKCLXjmW6CdbPrD/D3+FVg9MKqrGw=; b=Q2tIX6MYihVlwjuIZyEetRtLe2wnlm7zcY9fA9nDDndyNmIYStgZcue+qFeVsz2kop XqmxwupfVb5Ensu0vgcM6/FAWH5Gx539GRWZOoudRxyN9Zb4S05ccFRy4PK5H0Q95z6v WrfYwR9wyyMjAg00jvyaPFTFiVpvbQL1mOzY9bkOLJG5iirZ/gYx3/OuwLpCU1uLsWwn 2P+aBi/5iKg5v2TUPPvkvdgNZgJyQ9oVV5g/fMreSefiIHadKoSQkfY0+0xRISmwgSK0 s+8Ww3qu/F7choVoe/rZVklF1CIErNTA+2Xpm/yw+F5myXv5Tkqp8SRC+fwyC59uwfG0 Gl2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696867534; x=1697472334; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RPQezVvb1qjUo9gKCLXjmW6CdbPrD/D3+FVg9MKqrGw=; b=flmr+vGKzx0jZMDh6vlumnecKbUI5pl6kilZGRnC1T++iYnKKHkcIkhjovpcyYKJrY ieiiHLlBFhf9YDjTRRszyFC7F1lKO/S5U0shB3GO1hRVLw4fiIdB+gKVXoRxKMidLaSj aFM1sgEQdlYuyz2PLIX+qW6pVYBZWh9bPuBrS8afE8otiZRH7IGK1PZz7kD6m7Q1o2U2 lIBvMW6V/1zO3LQ4m84iP2bCdaH7wKnxpWQil6HOakawiwZEFKHYWhAvETmoevj7votV Y7wANEEE/YpBEtSuOgkrXRMu98qE14hy7hlmjye+oRMGYKQ1geTz+qmpvs4RZBnzFnEy gGcA== X-Gm-Message-State: AOJu0YwycBz9nJZL2tO4XnD2xq08k0hHYIcD/8rwWWvJ8vL9H4L5vMsP VGOZhbfrBhGNkjVIpfcFCY2jKUtb+S8= X-Google-Smtp-Source: AGHT+IGqpaiQfK3PLz4Bm5Q+tgKCOrNFu9KKUQNQOhXCW1MuJKUv4/236QXUR+YQBV1Y6uIMTSOTsA== X-Received: by 2002:a17:902:f686:b0:1c7:5581:f9c with SMTP id l6-20020a170902f68600b001c755810f9cmr17536570plg.0.1696867534472; Mon, 09 Oct 2023 09:05:34 -0700 (PDT) Received: from dhcp-10-231-55-133.dhcp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id l13-20020a170902d34d00b001bb9f104328sm9793418plk.146.2023.10.09.09.05.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Oct 2023 09:05:34 -0700 (PDT) From: Justin Tee To: linux-scsi@vger.kernel.org Cc: jsmart2021@gmail.com, justin.tee@broadcom.com, Justin Tee Subject: [PATCH 3/6] lpfc: Reject received PRLIs with only initiator fcn role for NPIV ports Date: Mon, 9 Oct 2023 09:18:09 -0700 Message-Id: <20231009161812.97232-4-justintee8345@gmail.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20231009161812.97232-1-justintee8345@gmail.com> References: <20231009161812.97232-1-justintee8345@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Currently, NPIV ports send PRLI_ACC to all received unsolicited PRLI requests. For an NPIV port, there is no point to PRLI_ACC if the received PRLI request has the initiator function bit set and the target function bit unset. Modify the lpfc_rcv_prli_support_check routine to send a PRLI_RJT in such cases. NPIV ports are expected to send PRLI_ACC only if the Target function bit is set. Signed-off-by: Justin Tee --- drivers/scsi/lpfc/lpfc_nportdisc.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c index 1eb7f7e60bba..d9074929fbab 100644 --- a/drivers/scsi/lpfc/lpfc_nportdisc.c +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c @@ -934,25 +934,35 @@ lpfc_rcv_prli_support_check(struct lpfc_vport *vport, struct ls_rjt stat; uint32_t *payload; uint32_t cmd; + PRLI *npr; payload = cmdiocb->cmd_dmabuf->virt; cmd = *payload; + npr = (PRLI *)((uint8_t *)payload + sizeof(uint32_t)); + if (vport->phba->nvmet_support) { /* Must be a NVME PRLI */ - if (cmd == ELS_CMD_PRLI) + if (cmd == ELS_CMD_PRLI) goto out; } else { /* Initiator mode. */ if (!vport->nvmei_support && (cmd == ELS_CMD_NVMEPRLI)) goto out; + + /* NPIV ports will RJT initiator only functions */ + if (vport->port_type == LPFC_NPIV_PORT && + npr->initiatorFunc && !npr->targetFunc) + goto out; } return 1; out: - lpfc_printf_vlog(vport, KERN_WARNING, LOG_NVME_DISC, + lpfc_printf_vlog(vport, KERN_WARNING, LOG_DISCOVERY, "6115 Rcv PRLI (%x) check failed: ndlp rpi %d " - "state x%x flags x%x\n", + "state x%x flags x%x port_type: x%x " + "npr->initfcn: x%x npr->tgtfcn: x%x\n", cmd, ndlp->nlp_rpi, ndlp->nlp_state, - ndlp->nlp_flag); + ndlp->nlp_flag, vport->port_type, + npr->initiatorFunc, npr->targetFunc); memset(&stat, 0, sizeof(struct ls_rjt)); stat.un.b.lsRjtRsnCode = LSRJT_CMD_UNSUPPORTED; stat.un.b.lsRjtRsnCodeExp = LSEXP_REQ_UNSUPPORTED; From patchwork Mon Oct 9 16:18:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Tee X-Patchwork-Id: 731811 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7ADCBE95A9F for ; Mon, 9 Oct 2023 16:05:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377119AbjJIQFo (ORCPT ); Mon, 9 Oct 2023 12:05:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377113AbjJIQFk (ORCPT ); Mon, 9 Oct 2023 12:05:40 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3BCAAC for ; Mon, 9 Oct 2023 09:05:38 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1c45c45efeeso2364335ad.0 for ; Mon, 09 Oct 2023 09:05:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696867538; x=1697472338; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e4uwH4EBz0Ok57QjNGlE5d8xvVvRPv/4sT/KxlUc+rk=; b=EuieGNJqjlloaha9bmI1tF3qiyTxuziLIlBwtnjeE4K9nhAc3Tq2K65jIy0zZXdnmK RdrUciUMgEOO01pnXYIQbXRCyiIGD8EW6JGUpr7KAckK2I8xJRS2obzZhqUKPyYP9vdw 4TyJlMkTDO7blSKmiZdXmMra/rgP1mUEnLE/H/atz7gDBeJdDfMO96LO+omTJ5u3V6Jl OFCmihyPLy+xSfzSY98f7A4KzwPZsjkjE0xjUyC24y57DONLk/IZGR614I5WXGjZKrzZ pjAai8yGfYYk/iD1y0DQhQznDFzcnUB7KjMgIoxEw6JNJVvLIz3IfC5Ae9QQ3HX8YaVT IX5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696867538; x=1697472338; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e4uwH4EBz0Ok57QjNGlE5d8xvVvRPv/4sT/KxlUc+rk=; b=MIqJ3LGe+ANu0n+ColnKII6VtVKxw/j4Lap6Zcr/6I0KE+HMQZMwSH9+FeTTnET8YB TeZDm+jFZB1kG6z3OwCM0Gd6JTMpdbB9+rVqI+CJqxAl3nsI+wuGUVc+Dfly9bIpXKus q3anwNRDov3SFVxlT9IcSTXcfoZztKsq0itzV1Zko+FM63V0asiys1e2Eqh9p+g0KOrJ ZZEf2BPP/z2M7Z3sPDljAHyLK3Fnkmpy5jJuAp75SkiUHXvQVj2RBMt78h3UKBfDxUIJ lI1Ryrd4eGaA3bMeLlYk5qjatPF4QpDukbIsh3UNTx1VdE09Zhp2LkF40azRKlwQSdKf FIQA== X-Gm-Message-State: AOJu0YxKBpV68D/YqeXSqAqFJJXqA60ruG375cAvwY3GqYE9sXZQo4vT YFLdtXu2mkv8tfG5fROh5Ne2N0bZRdk= X-Google-Smtp-Source: AGHT+IHoZwdb50BuDO1GBJGpe37Vk3rYFlwIGjUSt10zlPfYLBRLPklAGj+P6MGJpoEk5843rkk6pA== X-Received: by 2002:a17:902:e80a:b0:1c4:1e65:1e5e with SMTP id u10-20020a170902e80a00b001c41e651e5emr18063615plg.0.1696867538262; Mon, 09 Oct 2023 09:05:38 -0700 (PDT) Received: from dhcp-10-231-55-133.dhcp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id l13-20020a170902d34d00b001bb9f104328sm9793418plk.146.2023.10.09.09.05.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Oct 2023 09:05:38 -0700 (PDT) From: Justin Tee To: linux-scsi@vger.kernel.org Cc: jsmart2021@gmail.com, justin.tee@broadcom.com, Justin Tee Subject: [PATCH 4/6] lpfc: Validate ELS LS_ACC completion payload Date: Mon, 9 Oct 2023 09:18:10 -0700 Message-Id: <20231009161812.97232-5-justintee8345@gmail.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20231009161812.97232-1-justintee8345@gmail.com> References: <20231009161812.97232-1-justintee8345@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org A WCQE success completion status does not guarantee valid LS_ACC receipt for ELS commands. So, introduce a small helper routine that validates ELS LS_ACC frames in ELS cmpl routines. Signed-off-by: Justin Tee --- drivers/scsi/lpfc/lpfc_els.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 54e47f268235..f9627eddab08 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -131,6 +131,15 @@ lpfc_els_chk_latt(struct lpfc_vport *vport) return 1; } +static bool lpfc_is_els_acc_rsp(struct lpfc_dmabuf *buf) +{ + struct fc_els_ls_acc *rsp = buf->virt; + + if (rsp && rsp->la_cmd == ELS_LS_ACC) + return true; + return false; +} + /** * lpfc_prep_els_iocb - Allocate and prepare a lpfc iocb data structure * @vport: pointer to a host virtual N_Port data structure. @@ -1107,6 +1116,8 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, prsp = list_get_first(&pcmd->list, struct lpfc_dmabuf, list); if (!prsp) goto out; + if (!lpfc_is_els_acc_rsp(prsp)) + goto out; sp = prsp->virt + sizeof(uint32_t); /* FLOGI completes successfully */ @@ -2119,6 +2130,10 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, /* Good status, call state machine */ prsp = list_entry(cmdiocb->cmd_dmabuf->list.next, struct lpfc_dmabuf, list); + if (!prsp) + goto out; + if (!lpfc_is_els_acc_rsp(prsp)) + goto out; ndlp = lpfc_plogi_confirm_nport(phba, prsp->virt, ndlp); sp = (struct serv_parm *)((u8 *)prsp->virt + @@ -3445,6 +3460,8 @@ lpfc_cmpl_els_disc_cmd(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, prdf = (struct lpfc_els_rdf_rsp *)prsp->virt; if (!prdf) goto out; + if (!lpfc_is_els_acc_rsp(prsp)) + goto out; for (i = 0; i < ELS_RDF_REG_TAG_CNT && i < be32_to_cpu(prdf->reg_d1.reg_desc.count); i++) @@ -4043,6 +4060,9 @@ lpfc_cmpl_els_edc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, edc_rsp->acc_hdr.la_cmd, be32_to_cpu(edc_rsp->desc_list_len)); + if (!lpfc_is_els_acc_rsp(prsp)) + goto out; + /* * Payload length in bytes is the response descriptor list * length minus the 12 bytes of Link Service Request @@ -11339,6 +11359,9 @@ lpfc_cmpl_els_fdisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, prsp = list_get_first(&pcmd->list, struct lpfc_dmabuf, list); if (!prsp) goto out; + if (!lpfc_is_els_acc_rsp(prsp)) + goto out; + sp = prsp->virt + sizeof(uint32_t); fabric_param_changed = lpfc_check_clean_addr_bit(vport, sp); memcpy(&vport->fabric_portname, &sp->portName, From patchwork Mon Oct 9 16:18:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Tee X-Patchwork-Id: 731340 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C993E95A9E for ; Mon, 9 Oct 2023 16:05:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377124AbjJIQFq (ORCPT ); Mon, 9 Oct 2023 12:05:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377115AbjJIQFo (ORCPT ); Mon, 9 Oct 2023 12:05:44 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D0CA9F for ; Mon, 9 Oct 2023 09:05:42 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1c8903a45ccso3057355ad.0 for ; Mon, 09 Oct 2023 09:05:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696867541; x=1697472341; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ba0Cf2+NLE11PutzUzWqa0sMY6wnPnQD7etJtbPA/Iw=; b=k1Xc4tyMPvnkN1VyyF2cLZu3ew1RZqpOykKUUfjQ9UBc3GiLPcVKrPl2SOGWp8y2EE jZeu3kHNYLRa++QTZevyg3YPuF1xJyp6yvJCLu/mLbLrq5dnODlpYfA+Ivi94KirOO9I oC8992Vn6qroklg+bTOPlzSYNGI7+U5iPHWn6mStcp0czm31CYy7/DDnWoVmqazP+IaD +0/x6LmdvXRmjQJzW2Undjj6lrNtABAkC2oaUnxP3JdoU1UyJ6CUvYxpHiMAkktF7BEj 2GSinfJsDpN+2hG3xPqXHImEM7Nji7riJ0cfMCsYMpI0iZ77v8U/O7zCYq4a9sDcxCj2 ge0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696867541; x=1697472341; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ba0Cf2+NLE11PutzUzWqa0sMY6wnPnQD7etJtbPA/Iw=; b=GQ7ONB2oP7qMthDx28ho3ASKF/Zoq1ecqNnCXZg7uR+hHp1IV6Wtsoi7FarNOouwZf flriswVxZY1Ffmxf5DocT9++5hT0E5yWltX2UqwRqlL6CDEih1RwS3QBvaovDhNayH8j k+k2AyfSoobxYRcRoI1LT9Gr597NySuoC6S2i7RkeP2JuSBefp1bG3Wb14es+pUD4pop OifaHvZ33inrsk+5eVQMamKhjLAnoFJ8WhyY+bg4nHvFl/q+MT1cOZh++SWNyaqh9pjg iQCO/TatTq4jLp9xZ9Mi8Q58ICSgTTrDhZo2zE8hdWR/gFm/aTfXdNVdZz9/0sGPCkVa QevA== X-Gm-Message-State: AOJu0YxsYrzgbW3w+IYdoZ9TRkATnC+9jRqA/Fhb/1jmZL8HlIDtyjKv 4KccXGhvI9jEyKj/3zM7l12TNjXBImI= X-Google-Smtp-Source: AGHT+IEr6fVRqkoUi30ojuVF/fzcyRkKYIf9g/0ip/caOKLFI5lw4MjxRVU01ZjpBWwcHkB6HxsNQw== X-Received: by 2002:a17:902:e74b:b0:1c7:1eed:10f2 with SMTP id p11-20020a170902e74b00b001c71eed10f2mr18083549plf.2.1696867541620; Mon, 09 Oct 2023 09:05:41 -0700 (PDT) Received: from dhcp-10-231-55-133.dhcp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id l13-20020a170902d34d00b001bb9f104328sm9793418plk.146.2023.10.09.09.05.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Oct 2023 09:05:41 -0700 (PDT) From: Justin Tee To: linux-scsi@vger.kernel.org Cc: jsmart2021@gmail.com, justin.tee@broadcom.com, Justin Tee Subject: [PATCH 5/6] lpfc: Introduce LOG_NODE_VERBOSE messaging flag Date: Mon, 9 Oct 2023 09:18:11 -0700 Message-Id: <20231009161812.97232-6-justintee8345@gmail.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20231009161812.97232-1-justintee8345@gmail.com> References: <20231009161812.97232-1-justintee8345@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The preexisting LOG_NODE message flag frequently spams a subset of the same log messages during normal FC driver operations. When analyzing driver logs, this sometimes leads to difficulty in troubleshooting. Because LOG_IP log message flag is unused, convert it to a new LOG_NODE_VERBOSE flag. The LOG_NODE_VERBOSE shall specifically be used for diagnosing issues that require precise ndlp tracking detail. Signed-off-by: Justin Tee --- drivers/scsi/lpfc/lpfc_hbadisc.c | 8 ++++---- drivers/scsi/lpfc/lpfc_logmsg.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index 5154eeaee0ec..7ef9841f0728 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -5654,7 +5654,7 @@ __lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did) ((uint32_t)ndlp->nlp_xri << 16) | ((uint32_t)ndlp->nlp_type << 8) ); - lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE, + lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE_VERBOSE, "0929 FIND node DID " "Data: x%px x%x x%x x%x x%x x%px\n", ndlp, ndlp->nlp_DID, @@ -5701,8 +5701,8 @@ lpfc_findnode_mapped(struct lpfc_vport *vport) ((uint32_t)ndlp->nlp_type << 8) | ((uint32_t)ndlp->nlp_rpi & 0xff)); spin_unlock_irqrestore(shost->host_lock, iflags); - lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE, - "2025 FIND node DID " + lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE_VERBOSE, + "2025 FIND node DID MAPPED " "Data: x%px x%x x%x x%x x%px\n", ndlp, ndlp->nlp_DID, ndlp->nlp_flag, data1, @@ -6468,7 +6468,7 @@ __lpfc_find_node(struct lpfc_vport *vport, node_filter filter, void *param) list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { if (filter(ndlp, param)) { - lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE, + lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE_VERBOSE, "3185 FIND node filter %ps DID " "ndlp x%px did x%x flg x%x st x%x " "xri x%x type x%x rpi x%x\n", diff --git a/drivers/scsi/lpfc/lpfc_logmsg.h b/drivers/scsi/lpfc/lpfc_logmsg.h index f896ec610433..59bd2bafc73f 100644 --- a/drivers/scsi/lpfc/lpfc_logmsg.h +++ b/drivers/scsi/lpfc/lpfc_logmsg.h @@ -25,7 +25,7 @@ #define LOG_MBOX 0x00000004 /* Mailbox events */ #define LOG_INIT 0x00000008 /* Initialization events */ #define LOG_LINK_EVENT 0x00000010 /* Link events */ -#define LOG_IP 0x00000020 /* IP traffic history */ +#define LOG_NODE_VERBOSE 0x00000020 /* Node verbose events */ #define LOG_FCP 0x00000040 /* FCP traffic history */ #define LOG_NODE 0x00000080 /* Node table events */ #define LOG_TEMP 0x00000100 /* Temperature sensor events */ From patchwork Mon Oct 9 16:18:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Tee X-Patchwork-Id: 731810 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AFD3E95A9F for ; Mon, 9 Oct 2023 16:05:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377115AbjJIQFu (ORCPT ); Mon, 9 Oct 2023 12:05:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377104AbjJIQFr (ORCPT ); Mon, 9 Oct 2023 12:05:47 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCD8099 for ; Mon, 9 Oct 2023 09:05:44 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1c746bc3bceso10363675ad.1 for ; Mon, 09 Oct 2023 09:05:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696867544; x=1697472344; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Oib3fjAcsXA/T/a8xx3dKwofWah2xN6hPwaTcB9cC8M=; b=WHlQtv7of7miKFxBoh900LX3lW5d3BBsk29TjDfyVLrcA/5rtADS8pmWjMeufUkhg2 ST3RUD5pE65IGADXDtpfu3PxulEqRtHHUCHLwcUZYLTbaPpAnzcCpfvu5Hk5SJ59IaZQ M5OnyqhTcPZpWqIwJS3c0rvMe/vO60haINQAFsoFFSRUUVHkPLD3/7oD7BAhWFfmxalE F1RGhlKDOtO3/Dy45rcm36QPFFWLq0U5nMyb+0HIWzMFp2OmTL/zqFOkh394FtHFco5j Wgj8QtcN5ogVFCzoSBkoJeBdsuZG9lwxxRBKcPsI5sfHAjEcSfVbApyTo61ruelYvjq5 a48Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696867544; x=1697472344; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Oib3fjAcsXA/T/a8xx3dKwofWah2xN6hPwaTcB9cC8M=; b=D6MZZal0RW2kZX82X/CHSo2lcNtZMVHRqPXidiZtH1fyuCUoA1+4tu2Nneg21fR9jg om5bYjv8mJRfCLvWbF+wk7RBqMWdnad9PJhbP1DvBZQKm8Jb8t52MKcF6vf4PoYuYVvL p3Q7s2cwmN21Lx89MwsjV9A2dYmGZ2VwqOCipBvBa0hxHxia0ItXXxofA+dvhjC7Xl0z teLTx6hQ0Lth3bL4/h2QoBmsMdCsn7mOfUBAoaDwInGAqUmK0bXbzV75sXybiFwhpfkw Fa7o8JL2c17S0vd9ZGnaOeJDauGYsDpCqKRGZ90TqFNv8W2T9/RQMPqlosD8WsXznRa/ g8Hg== X-Gm-Message-State: AOJu0Yye1Dayma8cD0p7BAyCkgJDQt4shJ2owMKywpTwpao0sT2wCFe7 vsw8mwaeYZ8fRDm6O9JKqRkLdbIt7Io= X-Google-Smtp-Source: AGHT+IFT3VWs81jeR9k5IMZwC9689gIH0LADSZsQ8dIPACAeubXmjyPj4RJFfd7+0VmMmOdh7tV4GA== X-Received: by 2002:a17:902:ec88:b0:1c0:bf60:ba4f with SMTP id x8-20020a170902ec8800b001c0bf60ba4fmr17543391plg.4.1696867544155; Mon, 09 Oct 2023 09:05:44 -0700 (PDT) Received: from dhcp-10-231-55-133.dhcp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id l13-20020a170902d34d00b001bb9f104328sm9793418plk.146.2023.10.09.09.05.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Oct 2023 09:05:43 -0700 (PDT) From: Justin Tee To: linux-scsi@vger.kernel.org Cc: jsmart2021@gmail.com, justin.tee@broadcom.com, Justin Tee Subject: [PATCH 6/6] lpfc: Update lpfc version to 14.2.0.15 Date: Mon, 9 Oct 2023 09:18:12 -0700 Message-Id: <20231009161812.97232-7-justintee8345@gmail.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20231009161812.97232-1-justintee8345@gmail.com> References: <20231009161812.97232-1-justintee8345@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Update lpfc version to 14.2.0.15 Signed-off-by: Justin Tee --- drivers/scsi/lpfc/lpfc_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h index 13a547277f97..88068834cab9 100644 --- a/drivers/scsi/lpfc/lpfc_version.h +++ b/drivers/scsi/lpfc/lpfc_version.h @@ -20,7 +20,7 @@ * included with this package. * *******************************************************************/ -#define LPFC_DRIVER_VERSION "14.2.0.14" +#define LPFC_DRIVER_VERSION "14.2.0.15" #define LPFC_DRIVER_NAME "lpfc" /* Used for SLI 2/3 */