From patchwork Tue Mar 5 20:04:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Tee X-Patchwork-Id: 778236 Received: from mail-oo1-f46.google.com (mail-oo1-f46.google.com [209.85.161.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 312C45C607 for ; Tue, 5 Mar 2024 19:49:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709668150; cv=none; b=WieHUqJknhm1+ifHrHO+ly7fOrmqGt0l3ozB4W7YiGm/gEExaRrbnE+gyKZBaBka6V3QiWKZjATWEIa/Oxwn/CXF1Sc2Yezxxc1U6/cAD05bzXRFHUpIDQ90KpYzPmb8i6dM++HPMaNMMG1m/OVZduP1naWwPZOrppg269vJLf4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709668150; c=relaxed/simple; bh=GLFEQgE+JWw38+5XkSoZ2TdrYTWeO6y63BuaXydgmZQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=U0P8cUUCLLtxUxgPpJtzRjO5a/82g2OSMv9S0AIzeYGzCtaS3XCUtcv1ujEhrnfgO2yvL3JOWhXg0WoIBY80i7zk+0/Aay0/xL/o+oFUuVUa5zBO8Za5cBvmeOMGvWfXY+llDcD5NGqVpBp0XjK248UyDqWe/6A/IfgpyEKhbOs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZPahEOKm; arc=none smtp.client-ip=209.85.161.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZPahEOKm" Received: by mail-oo1-f46.google.com with SMTP id 006d021491bc7-5a13ecfb6b8so207921eaf.1 for ; Tue, 05 Mar 2024 11:49:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709668148; x=1710272948; 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=4mAgFthZgucsTp/Ggl0Ae96uDLL2cRRODY9YYTDhP9A=; b=ZPahEOKmkTqWLsysHVW8AOrnPkMVKOLjIssXe2Eh5NhDScEiGvKPf4LeaMD5i35i0c YM3bpl9FLX3EN1/OxYwpwu2krGd7klUxE7Uf2nW29spe4U4WSQ4UWl/DgXcpZlKlO8op ICTLIcKorU9GHUnMyBJp+oUYhTHVJLno8nHO9nZzkuCqZye+QcFlmqrjeFDMjOTUi7WW pYFab0HX2c35xmcMXNKAzg9jnKz4c4I3se0s9pOQOFpilUFQS1fOmGyZit/IFYx7H4oD Gyaz0U3S8hfa0cKRkLiSOBMT1mrXte7+ew/bALckD52BFH4SOHJqj8hXF9vkBUtE2zAn eh8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709668148; x=1710272948; 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=4mAgFthZgucsTp/Ggl0Ae96uDLL2cRRODY9YYTDhP9A=; b=MZIK5DqmwkmB7p4aGFQV/w42ICzZUZ52NU85UZH4EBGld12y8aTtE+Ro/0janXLlIm IjdRMP8+orgE0VL3KvU9+IU96oEqZXk40LcwXtHDNyROyYYS9Nt2PpmIUfCbdhx/U5bF BzKCCf1+RqrmSDCae9lQXvDqs7i9418JXAa09AkW+rKTYvt/HRed9Ffz+lNLFq7DzTZx 0U+mIlm3wTv2mJ5ESoFapZOvnu9QYH6coz67PgDbH6RVze24NCted+nw0ng5ZkqIRa/5 rjSmT5UN/7C0ts4WyHvKXsAou3+XGBj9sJeuN9MQ81ZDu5yK8OyM+7EEKlONnBlWWbCC tV5g== X-Gm-Message-State: AOJu0YxQAKsVbABcRCwMND2dK84rcH1UiJgLEY90n4bx5XaabZwyEocC opNf35nwDNvdivUC1QAOXGMx2dMjDi7H4P9chQfX7znHjuFzw39ZDZFD6K3G X-Google-Smtp-Source: AGHT+IH1BbPZtAn01hEsEZ1GBCDqK4BhG/l6He8YbzKg54Aard+QwkKSo+0nGE6xerQ2rcu0eHwwhQ== X-Received: by 2002:a05:6358:5926:b0:178:9f1d:65e4 with SMTP id g38-20020a056358592600b001789f1d65e4mr1767081rwf.3.1709668148029; Tue, 05 Mar 2024 11:49:08 -0800 (PST) Received: from dhcp-10-231-55-133.dhcp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id bj13-20020a05620a190d00b007877f52a6b9sm5706050qkb.136.2024.03.05.11.49.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2024 11:49:07 -0800 (PST) From: Justin Tee To: linux-scsi@vger.kernel.org Cc: jsmart2021@gmail.com, justin.tee@broadcom.com, Justin Tee Subject: [PATCH 02/12] lpfc: Move NPIV's transport unregistration to after resource clean up Date: Tue, 5 Mar 2024 12:04:53 -0800 Message-Id: <20240305200503.57317-3-justintee8345@gmail.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20240305200503.57317-1-justintee8345@gmail.com> References: <20240305200503.57317-1-justintee8345@gmail.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 There are cases after NPIV deletion where the fabric switch still believes the NPIV is logged into the fabric. This occurs when a vport is unregistered before the Remove All DA_ID CT and LOGO ELS are sent to the fabric. Currently fc_remove_host, which calls dev_loss_tmo for all D_IDs including the fabric D_ID, removes the last ndlp reference and frees the ndlp rport object. This sometimes causes the race condition where the final DA_ID and LOGO are skipped from being sent to the fabric switch. Fix by moving the fc_remove_host and scsi_remove_host calls after DA_ID and LOGO are sent. Signed-off-by: Justin Tee --- drivers/scsi/lpfc/lpfc_vport.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c index 0f79840b9498..9850080ee33d 100644 --- a/drivers/scsi/lpfc/lpfc_vport.c +++ b/drivers/scsi/lpfc/lpfc_vport.c @@ -674,10 +674,6 @@ lpfc_vport_delete(struct fc_vport *fc_vport) lpfc_free_sysfs_attr(vport); lpfc_debugfs_terminate(vport); - /* Remove FC host to break driver binding. */ - fc_remove_host(shost); - scsi_remove_host(shost); - /* Send the DA_ID and Fabric LOGO to cleanup Nameserver entries. */ ndlp = lpfc_findnode_did(vport, Fabric_DID); if (!ndlp) @@ -721,6 +717,10 @@ lpfc_vport_delete(struct fc_vport *fc_vport) skip_logo: + /* Remove FC host to break driver binding. */ + fc_remove_host(shost); + scsi_remove_host(shost); + lpfc_cleanup(vport); /* Remove scsi host now. The nodes are cleaned up. */ From patchwork Tue Mar 5 20:04:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Tee X-Patchwork-Id: 778235 Received: from mail-oa1-f52.google.com (mail-oa1-f52.google.com [209.85.160.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1DC3279953 for ; Tue, 5 Mar 2024 19:49:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709668154; cv=none; b=ZSqo8k1jVYn6St516Wz9Sst8oLCAnFuwPSmLt2ADSf+s9UBcpCsP2m4dvQD1iHuWDbIaoC7J36B+kfZgX1/08bjVZ07vunQ5JRsnRzYf1NT8FxtGaaDO3E+QHk2ZBB8ds2bbryf37D4HyZATH4XMb26idhr4YIV5n/XpSnDPhDY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709668154; c=relaxed/simple; bh=IIbhw+SwZRPcdlyiLWdehPC5LHjqM0Vs4SAlPferXR8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EXsla4qZniHX35yop2P8uApNjn8V5m29x4jyx5IvLoGzv8waR3b/P1bJ/XYZaT/ZNcaR2lWO1xSC9o84EXy/tHvESVlLQn/Hecg/t9Fu1lG+qDrqquVe9DwCksux/jOVDkgxCP3w71mr6mbEKciXOd60k5bt6cIZ5bnIbOQw40g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VudB6H5+; arc=none smtp.client-ip=209.85.160.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VudB6H5+" Received: by mail-oa1-f52.google.com with SMTP id 586e51a60fabf-21f10aae252so559657fac.0 for ; Tue, 05 Mar 2024 11:49:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709668152; x=1710272952; 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=WMYL4XINwiJyrxByVkAt03WJ0yc5MhT9bqgD56m9lEU=; b=VudB6H5+5Y0vzJaYwY8Zx9AeJPn0wRJqz0wkdN/QcSUwRgmAUlywwtp2NT1fkFWcKK Md20fEpMozWf2WIjxGOlws+wh9CN+UfkAK4r/F7C8m5RuLwwr7kAsmUWVMtybX7Tz+1y Q5AA9UNtkkhMZ8y2p3G4hsvGzN4iug1kmhIId5PY6hrgr0zKCVuYkMyWGJx2X8qOYkiM QswmXtKpJP7LVQ2ZNgF6/wY9lzLWRNThFdtRWhwujSD9OW5QbiA/sktjGGvm+myklHQE BLuy5wybP0gBg500NitSsgp7BV5pCAF9qkBGBwXti0vsBJ5+MOBlZxsOlbIKu+2OzVZw qBmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709668152; x=1710272952; 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=WMYL4XINwiJyrxByVkAt03WJ0yc5MhT9bqgD56m9lEU=; b=pwTJdRwqrAvuNX4DK031NsiAFJM6mp5NzYqWMfhW2XEeShOXOohyqdl57z/V2wCX5L x7f0QRb+NpGmPyWJzdBHZvMZAfAnViCK0ZPYznocdUr/dnkBlPFC6LmDaprXEhvSboo6 vTxVEmci+MLXrxxkwvVNc2VqEw3vXX8mX9tM2DFF8K7bwZLtXFcKbUjT7D9D8VYja8CV z3kLNMd9vH1r3+A6tihBqrpb48HtYZSICC9UDj8UyxuElM7kiV8GGeScyOrAJ2o+uatN od/V/mFQEgViEZuemcFiQ/tNVHhCDVmauQ/F0Hfs29edC5hGNv5zH5IYc3PgTCnpXgYw sSEw== X-Gm-Message-State: AOJu0YwYrOwkalUxgiLubqroYmQEXIFcZxd0YC+6764P9n46CbogrpjS YTYenSqCdyuRqZVe2fREqyrVKf+YuwQfdJVpJcuuPKsFSvAH1Kl0NSrIKqFo X-Google-Smtp-Source: AGHT+IE2wHHc32ovQMn8vK1JLDPdhcHCjFrLvZnRFutCqOC5lCAYcQpd3PaOTreP3mOrTOcB3ODjTQ== X-Received: by 2002:a05:6870:5e53:b0:220:c30d:75d7 with SMTP id ne19-20020a0568705e5300b00220c30d75d7mr1501373oac.2.1709668152195; Tue, 05 Mar 2024 11:49:12 -0800 (PST) Received: from dhcp-10-231-55-133.dhcp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id bj13-20020a05620a190d00b007877f52a6b9sm5706050qkb.136.2024.03.05.11.49.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2024 11:49:11 -0800 (PST) From: Justin Tee To: linux-scsi@vger.kernel.org Cc: jsmart2021@gmail.com, justin.tee@broadcom.com, Justin Tee Subject: [PATCH 04/12] lpfc: Update lpfc_ramp_down_queue_handler logic Date: Tue, 5 Mar 2024 12:04:55 -0800 Message-Id: <20240305200503.57317-5-justintee8345@gmail.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20240305200503.57317-1-justintee8345@gmail.com> References: <20240305200503.57317-1-justintee8345@gmail.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Typically when an out of resource CQE status is detected, the lpfc_ramp_down_queue_handler logic is called to help reduce I/O load by reducing an sdev's queue_depth. However, the current lpfc_rampdown_queue_depth logic does not help reduce queue_depth. num_cmd_success is never updated and is always zero, which means new_queue_depth will always be set to sdev->queue_depth. So, new_queue_depth = sdev->queue_depth - new_queue_depth always sets new_queue_depth to zero. And, scsi_change_queue_depth(sdev, 0) is essentially a no-op. Change the lpfc_ramp_down_queue_handler logic to set new_queue_depth equal to sdev->queue_depth subtracted from number of times num_rsrc_err was incremented. If num_rsrc_err is >= sdev->queue_depth, then set new_queue_depth equal to 1. Eventually, the frequency of Good_Status frames will signal SCSI upper layer to auto increase the queue_depth back to the driver default of 64 via scsi_handle_queue_ramp_up. Signed-off-by: Justin Tee --- drivers/scsi/lpfc/lpfc.h | 1 - drivers/scsi/lpfc/lpfc_scsi.c | 13 ++++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 30d20d37554f..18cbfd371ccc 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -1333,7 +1333,6 @@ struct lpfc_hba { struct timer_list fabric_block_timer; unsigned long bit_flags; atomic_t num_rsrc_err; - atomic_t num_cmd_success; unsigned long last_rsrc_error_time; unsigned long last_ramp_down_time; #ifdef CONFIG_SCSI_LPFC_DEBUG_FS diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index e7bfaa0eb811..fc77f19547de 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -167,11 +167,10 @@ lpfc_ramp_down_queue_handler(struct lpfc_hba *phba) struct Scsi_Host *shost; struct scsi_device *sdev; unsigned long new_queue_depth; - unsigned long num_rsrc_err, num_cmd_success; + unsigned long num_rsrc_err; int i; num_rsrc_err = atomic_read(&phba->num_rsrc_err); - num_cmd_success = atomic_read(&phba->num_cmd_success); /* * The error and success command counters are global per @@ -186,20 +185,16 @@ lpfc_ramp_down_queue_handler(struct lpfc_hba *phba) for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { shost = lpfc_shost_from_vport(vports[i]); shost_for_each_device(sdev, shost) { - new_queue_depth = - sdev->queue_depth * num_rsrc_err / - (num_rsrc_err + num_cmd_success); - if (!new_queue_depth) - new_queue_depth = sdev->queue_depth - 1; + if (num_rsrc_err >= sdev->queue_depth) + new_queue_depth = 1; else new_queue_depth = sdev->queue_depth - - new_queue_depth; + num_rsrc_err; scsi_change_queue_depth(sdev, new_queue_depth); } } lpfc_destroy_vport_work_array(phba, vports); atomic_set(&phba->num_rsrc_err, 0); - atomic_set(&phba->num_cmd_success, 0); } /** From patchwork Tue Mar 5 20:04:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Tee X-Patchwork-Id: 778234 Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A02886167A for ; Tue, 5 Mar 2024 19:49:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709668158; cv=none; b=gRMRc50qiI6yAMBf2ERejZwHOFDow1U7qNCYVUBeOg//50iMs6DQwMZmGwMnVA52Uc10SHft6dIVdir5wUQgaCVmuXT1RPc91Vsk5OXv2w9FNQsYmn+e7gANL/Tq5cvKDxYWk76DxxUQzKvggWwAmUieKgorRAGyyVOQwLplsgQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709668158; c=relaxed/simple; bh=AfN5QbEBeqvmDY+2mBdAE6ZASpjRrWBwgPPsdfLvXBA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=iCH7AJ6LaQOcJ266Tc4WHSx9252sHlQuuB22j25GngObQkbuw3e14d+dDMh5y4piMI/bBcvslEykMfO4MdpQS8OrR2YcFbLr/sSi5mKGtTe+x7HqrvnjZOMIU+xmFs6poioTN+nn/HQqMi0N8Rb2scoSsUoQJ4AHORSSsc5ZDLo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=SjR2IpUM; arc=none smtp.client-ip=209.85.219.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SjR2IpUM" Received: by mail-qv1-f43.google.com with SMTP id 6a1803df08f44-68fcd9d336bso9336616d6.1 for ; Tue, 05 Mar 2024 11:49:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709668155; x=1710272955; 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=xEzLi8BIN57DkelYQfY/4ZqdVXOwxA9iYIklXp//HFo=; b=SjR2IpUMxNy+/lhmvWFv09R/eVxbUnzrcDCZm0EYR0VGEYbIcdOWhe4hZyGmfJ4wZH qyatJPP78gpN27UqgWQPJxWk+WzJa4VGZqDGF8mdBhrtNXFMOGwAACAkVtZeID100gaw YDgXBInql2MdDs3rl/PuFG+su13r4NMHB2Q3i0qMmowmnwN0v9ThohRr8yCzHlqT0PQW 2NDSk9mlhex9N3J9qEQFsVLiboN3LoPcCfr0KiDzKM1UaYg0PGvOarWS93RWp9fdPQn4 VeR19eXO/nVuxefACjmqnKdO8OBZoHML4Wt3K0xQpcuZRSQvf50hxEvDMCSKsiFPoskj 5Gpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709668155; x=1710272955; 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=xEzLi8BIN57DkelYQfY/4ZqdVXOwxA9iYIklXp//HFo=; b=MrFlpVV0+irAB6yrn2A7JcRFK4Bx4ohCtdJuWdEKOElDv/XtE1gD9o0PvhTZUJRudL gkXdTACQJckBPfwqCWEt50GK2k7ZARzrqNPya6eDYHf20DMQTANMaNECN9stbFtEdcvI 6/kug0lsGRjXVzAeVcVJ7mYpTLNN/+uUJIRgSoJCAACqW8uRkmN6u/FEUWGSzRclP3Yz UE3FoGpA4hooQeQQduQfDAcvHBaMBYVnmciSD8x1stTF+DQZe+mHUxrWyyB3UFp3AMIu +8nPd8XjvAD8hbAw30257uQa5q/aFqNCO8BhR9NHC8VFKFaRU95RcI6/EIM9LKSpEmRV ZsVw== X-Gm-Message-State: AOJu0Yz2vGf+oeL1HkagcLNAzCe/uk/FQ+WejFEqE2EEzvoL5j4WNZKC 5DZDeHASX0w8xjGpgBmivDzllk0cVjY5l2fVhPeyphNTHBW4rpaeMtnufhxX X-Google-Smtp-Source: AGHT+IHhsAmlFynP/AiPJtKyepj9fobN7UQb5DR6vPHily8hMLMoMQ4Dfve1V2bF3ttz+sJrpTnRaQ== X-Received: by 2002:a05:620a:4150:b0:787:f4bf:507e with SMTP id k16-20020a05620a415000b00787f4bf507emr1378144qko.4.1709668155553; Tue, 05 Mar 2024 11:49:15 -0800 (PST) Received: from dhcp-10-231-55-133.dhcp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id bj13-20020a05620a190d00b007877f52a6b9sm5706050qkb.136.2024.03.05.11.49.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2024 11:49:15 -0800 (PST) From: Justin Tee To: linux-scsi@vger.kernel.org Cc: jsmart2021@gmail.com, justin.tee@broadcom.com, Justin Tee Subject: [PATCH 06/12] lpfc: Release hbalock before calling lpfc_worker_wake_up Date: Tue, 5 Mar 2024 12:04:57 -0800 Message-Id: <20240305200503.57317-7-justintee8345@gmail.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20240305200503.57317-1-justintee8345@gmail.com> References: <20240305200503.57317-1-justintee8345@gmail.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 lpfc_worker_wake_up calls the lpfc_work_done routine, which takes the hbalock. Thus, lpfc_worker_wake_up should not be called while holding the hbalock to avoid potential deadlock. Signed-off-by: Justin Tee --- drivers/scsi/lpfc/lpfc_els.c | 20 ++++++++++---------- drivers/scsi/lpfc/lpfc_hbadisc.c | 5 ++--- drivers/scsi/lpfc/lpfc_sli.c | 14 +++++++------- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 28e56542e072..157a910666db 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -4437,23 +4437,23 @@ lpfc_els_retry_delay(struct timer_list *t) unsigned long flags; struct lpfc_work_evt *evtp = &ndlp->els_retry_evt; + /* Hold a node reference for outstanding queued work */ + if (!lpfc_nlp_get(ndlp)) + return; + spin_lock_irqsave(&phba->hbalock, flags); if (!list_empty(&evtp->evt_listp)) { spin_unlock_irqrestore(&phba->hbalock, flags); + lpfc_nlp_put(ndlp); return; } - /* We need to hold the node by incrementing the reference - * count until the queued work is done - */ - evtp->evt_arg1 = lpfc_nlp_get(ndlp); - if (evtp->evt_arg1) { - evtp->evt = LPFC_EVT_ELS_RETRY; - list_add_tail(&evtp->evt_listp, &phba->work_list); - lpfc_worker_wake_up(phba); - } + evtp->evt_arg1 = ndlp; + evtp->evt = LPFC_EVT_ELS_RETRY; + list_add_tail(&evtp->evt_listp, &phba->work_list); spin_unlock_irqrestore(&phba->hbalock, flags); - return; + + lpfc_worker_wake_up(phba); } /** diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index a7a2309a629f..2ab51397f4a6 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -257,7 +257,9 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport) if (evtp->evt_arg1) { evtp->evt = LPFC_EVT_DEV_LOSS; list_add_tail(&evtp->evt_listp, &phba->work_list); + spin_unlock_irqrestore(&phba->hbalock, iflags); lpfc_worker_wake_up(phba); + return; } spin_unlock_irqrestore(&phba->hbalock, iflags); } else { @@ -275,10 +277,7 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport) lpfc_disc_state_machine(vport, ndlp, NULL, NLP_EVT_DEVICE_RM); } - } - - return; } /** diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 1f8a9b5945cb..030d7084e412 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -1217,9 +1217,9 @@ lpfc_set_rrq_active(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, empty = list_empty(&phba->active_rrq_list); list_add_tail(&rrq->list, &phba->active_rrq_list); phba->hba_flag |= HBA_RRQ_ACTIVE; + spin_unlock_irqrestore(&phba->hbalock, iflags); if (empty) lpfc_worker_wake_up(phba); - spin_unlock_irqrestore(&phba->hbalock, iflags); return 0; out: spin_unlock_irqrestore(&phba->hbalock, iflags); @@ -11373,18 +11373,18 @@ lpfc_sli_post_recovery_event(struct lpfc_hba *phba, unsigned long iflags; struct lpfc_work_evt *evtp = &ndlp->recovery_evt; + /* Hold a node reference for outstanding queued work */ + if (!lpfc_nlp_get(ndlp)) + return; + spin_lock_irqsave(&phba->hbalock, iflags); if (!list_empty(&evtp->evt_listp)) { spin_unlock_irqrestore(&phba->hbalock, iflags); + lpfc_nlp_put(ndlp); return; } - /* Incrementing the reference count until the queued work is done. */ - evtp->evt_arg1 = lpfc_nlp_get(ndlp); - if (!evtp->evt_arg1) { - spin_unlock_irqrestore(&phba->hbalock, iflags); - return; - } + evtp->evt_arg1 = ndlp; evtp->evt = LPFC_EVT_RECOVER_PORT; list_add_tail(&evtp->evt_listp, &phba->work_list); spin_unlock_irqrestore(&phba->hbalock, iflags); From patchwork Tue Mar 5 20:04:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Tee X-Patchwork-Id: 778233 Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 527198664F for ; Tue, 5 Mar 2024 19:49:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709668162; cv=none; b=OeYSvnv8i1q2FQJBV3eZO/hh+c61sfN96uugVEEcruEAEhpxMMRidJpAk6E3WnPU8Zt0OqZM01cAktDjV+XcyV0qZWK7tQMOJEOm3UKPOM8XjZ0mAHkTXRjR3rg2NPYgFVsG/gUi8v+7XDLIwmeIhrww5GLus1uSfuXNPDrIoGM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709668162; c=relaxed/simple; bh=JBDYrl9Rs7SwlIyy5qv0Utf0GUdWaKES/CKNLRp/+Uo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cUB35K2iGbfP+mz05+qSSkmn2X+DQ7HBA+hJZ1mEl/Jhe+UAbpYSLrTtMa1dAuoElEEzXmHE5K9LvxLQXpZKaiO07+zOV+G2MiR9oDO+RiuO0hVT5Vl9gY0wXsDXaWeiyk4squ5pZmVHQtTRtVKhgzJ5voh2pM1bMz6blsDBlXg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=J39bGTiN; arc=none smtp.client-ip=209.85.222.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="J39bGTiN" Received: by mail-qk1-f181.google.com with SMTP id af79cd13be357-788251ac2f5so16310885a.0 for ; Tue, 05 Mar 2024 11:49:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709668159; x=1710272959; 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=/zVNEEZPp8/XxtbvJiWqdZKMg/0wsT0cYyOt5Z1PzU8=; b=J39bGTiN3uYDF/Vu59hOCxOtdYq6okWTsAzYRZNCotIemKXji9zSU/FtW0yyWSiuLP WYQYDD1las7BE4+K/NdiAxpbDlOBYDLmenSboVCBpNR2sDTV1LTsoJ2Mv/aoo8/2kF5G jhSECCChZB+1vZAOf0rCsTLvI+Zm1j7caba3SLWug7TN0T0mIv8hpatqlMm6goQJA4hH phZ6HP5jnn/GzIVGcUd0aGfwKHzr6QadztgwPm9/eoXnepbWvHKLVISBL3xvNpfPp/35 Wi8gqUQm1cbh1if9NTOQxlGJ+4Bi0/yM2EQHmGr1fXI8pCJFqBqFzLeTsn/pJDhFdN74 3gPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709668159; x=1710272959; 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=/zVNEEZPp8/XxtbvJiWqdZKMg/0wsT0cYyOt5Z1PzU8=; b=urffCKN41T9Ot0Ex/UkAR6v3Lua0ULLa4Gtbiw7UT8B39s8LmYfGh+7BKtNErkn+Vl P01JV0WpLc0RqvSeCQHolklfzGW4PCMa5y8HpfBHifG++h71he/ggMvOsuD9uHCoWo95 ruweghvHBUsyZUanwF0EgTEcGNRbZPpIGD1ALoqj31UtJDRTwFqq76hSeMjrkM/U/SEW Y9XEFjncLBt/2SRMZAnU2O5sO0qmy6eXqFe++Wjv8sP1Ia/UbllBZuK/3OsEb31rTlhr EnmBLp4kh1b/i16LRxUXGzxvtG4yMQ+yHX8nxuC1ofi125AIiFsLLW6RL8GXzxJ0Z+OY uysA== X-Gm-Message-State: AOJu0Yzu3WQs4AzME1+SxvVwZoELna/P586UnTLcyHq1IjcpVI66K7zY PQhYpd+3bXTp/6kXpiuEOyGmdGHcb0Lsdn1q2bb7PuHY2fgSYGdrbU6/rNnj X-Google-Smtp-Source: AGHT+IHBwv39yVeJxBQurqQey0HRCZTkHXGPjko2iOg2rbeSNPxrEMIe7iBasWmcthjiSZx6kUp+rg== X-Received: by 2002:a05:620a:471e:b0:788:2c10:3ef3 with SMTP id bs30-20020a05620a471e00b007882c103ef3mr1288038qkb.4.1709668159209; Tue, 05 Mar 2024 11:49:19 -0800 (PST) Received: from dhcp-10-231-55-133.dhcp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id bj13-20020a05620a190d00b007877f52a6b9sm5706050qkb.136.2024.03.05.11.49.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2024 11:49:18 -0800 (PST) From: Justin Tee To: linux-scsi@vger.kernel.org Cc: jsmart2021@gmail.com, justin.tee@broadcom.com, Justin Tee Subject: [PATCH 08/12] lpfc: Define lpfc_nodelist type for ctx_ndlp ptr Date: Tue, 5 Mar 2024 12:04:59 -0800 Message-Id: <20240305200503.57317-9-justintee8345@gmail.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20240305200503.57317-1-justintee8345@gmail.com> References: <20240305200503.57317-1-justintee8345@gmail.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In LPFC_MBOXQ_t data structure, the ctx_ndlp ptr shouldn't be defined as a generic void *ptr. It is named ctx_ndlp and it should only be used as an lpfc_nodelist *ptr. Due to the void* declaration, there have been abuses of ctx_ndlp for things not related to ndlp. So, set the ptr type for *ctx_ndlp as lpfc_nodelist. Remove all type casts on ctx_ndlp because it is no longer a void *ptr. Convert the abuse of ctx_ndlp for things not related to ndlps to use the void *context3 ptr. Signed-off-by: Justin Tee --- drivers/scsi/lpfc/lpfc_bsg.c | 4 ++-- drivers/scsi/lpfc/lpfc_els.c | 10 ++++------ drivers/scsi/lpfc/lpfc_hbadisc.c | 18 +++++++++--------- drivers/scsi/lpfc/lpfc_mbox.c | 10 +++++----- drivers/scsi/lpfc/lpfc_nportdisc.c | 6 +++--- drivers/scsi/lpfc/lpfc_sli.c | 17 ++++++++--------- drivers/scsi/lpfc/lpfc_sli.h | 10 +++++----- 7 files changed, 36 insertions(+), 39 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c index fee485e47041..03605b827f3a 100644 --- a/drivers/scsi/lpfc/lpfc_bsg.c +++ b/drivers/scsi/lpfc/lpfc_bsg.c @@ -3376,7 +3376,7 @@ lpfc_bsg_issue_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq) unsigned long flags; uint8_t *pmb, *pmb_buf; - dd_data = pmboxq->ctx_ndlp; + dd_data = pmboxq->context3; /* * The outgoing buffer is readily referred from the dma buffer, @@ -4875,7 +4875,7 @@ lpfc_bsg_issue_mbox(struct lpfc_hba *phba, struct bsg_job *job, pmboxq->mbox_cmpl = lpfc_bsg_issue_mbox_cmpl; /* setup context field to pass wait_queue pointer to wake function */ - pmboxq->ctx_ndlp = dd_data; + pmboxq->context3 = dd_data; dd_data->type = TYPE_MBOX; dd_data->set_job = job; dd_data->context_un.mbox.pmboxq = pmboxq; diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 157a910666db..1c0ca5de7e1e 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -7238,7 +7238,7 @@ lpfc_get_rdp_info(struct lpfc_hba *phba, struct lpfc_rdp_context *rdp_context) goto rdp_fail; mbox->vport = rdp_context->ndlp->vport; mbox->mbox_cmpl = lpfc_mbx_cmpl_rdp_page_a0; - mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context; + mbox->context3 = (struct lpfc_rdp_context *)rdp_context; rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT); if (rc == MBX_NOT_FINISHED) { lpfc_mbox_rsrc_cleanup(phba, mbox, MBOX_THD_UNLOCKED); @@ -7298,7 +7298,6 @@ int lpfc_get_sfp_info_wait(struct lpfc_hba *phba, mbox->u.mqe.un.mem_dump_type3.addr_hi = putPaddrHigh(mp->phys); } mbox->vport = phba->pport; - mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context; rc = lpfc_sli_issue_mbox_wait(phba, mbox, 30); if (rc == MBX_NOT_FINISHED) { @@ -7358,7 +7357,6 @@ int lpfc_get_sfp_info_wait(struct lpfc_hba *phba, mbox->u.mqe.un.mem_dump_type3.addr_hi = putPaddrHigh(mp->phys); } - mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context; rc = lpfc_sli_issue_mbox_wait(phba, mbox, 30); if (bf_get(lpfc_mqe_status, &mbox->u.mqe)) { rc = 1; @@ -7500,9 +7498,9 @@ lpfc_els_lcb_rsp(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) int rc; mb = &pmb->u.mb; - lcb_context = (struct lpfc_lcb_context *)pmb->ctx_ndlp; + lcb_context = (struct lpfc_lcb_context *)pmb->context3; ndlp = lcb_context->ndlp; - pmb->ctx_ndlp = NULL; + pmb->context3 = NULL; pmb->ctx_buf = NULL; shdr = (union lpfc_sli4_cfg_shdr *) @@ -7642,7 +7640,7 @@ lpfc_sli4_set_beacon(struct lpfc_vport *vport, lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, LPFC_MBOX_OPCODE_SET_BEACON_CONFIG, len, LPFC_SLI4_MBX_EMBED); - mbox->ctx_ndlp = (void *)lcb_context; + mbox->context3 = (void *)lcb_context; mbox->vport = phba->pport; mbox->mbox_cmpl = lpfc_els_lcb_rsp; bf_set(lpfc_mbx_set_beacon_port_num, &mbox->u.mqe.un.beacon_config, diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index 2ab51397f4a6..c1cc2850ba71 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -3851,7 +3851,7 @@ lpfc_mbx_cmpl_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) { struct lpfc_vport *vport = pmb->vport; struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)pmb->ctx_buf; - struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; + struct lpfc_nodelist *ndlp = pmb->ctx_ndlp; /* The driver calls the state machine with the pmb pointer * but wants to make sure a stale ctx_buf isn't acted on. @@ -4168,7 +4168,7 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) { struct lpfc_vport *vport = pmb->vport; MAILBOX_t *mb = &pmb->u.mb; - struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; + struct lpfc_nodelist *ndlp = pmb->ctx_ndlp; pmb->ctx_ndlp = NULL; @@ -4306,7 +4306,7 @@ void lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) { MAILBOX_t *mb = &pmb->u.mb; - struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; + struct lpfc_nodelist *ndlp = pmb->ctx_ndlp; struct lpfc_vport *vport = pmb->vport; int rc; @@ -4430,7 +4430,7 @@ lpfc_mbx_cmpl_fc_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) { struct lpfc_vport *vport = pmb->vport; MAILBOX_t *mb = &pmb->u.mb; - struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; + struct lpfc_nodelist *ndlp = pmb->ctx_ndlp; pmb->ctx_ndlp = NULL; if (mb->mbxStatus) { @@ -5173,7 +5173,7 @@ lpfc_nlp_logo_unreg(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) struct lpfc_vport *vport = pmb->vport; struct lpfc_nodelist *ndlp; - ndlp = (struct lpfc_nodelist *)(pmb->ctx_ndlp); + ndlp = pmb->ctx_ndlp; if (!ndlp) return; lpfc_issue_els_logo(vport, ndlp, 0); @@ -5495,7 +5495,7 @@ lpfc_cleanup_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) if ((mb = phba->sli.mbox_active)) { if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && !(mb->mbox_flag & LPFC_MBX_IMED_UNREG) && - (ndlp == (struct lpfc_nodelist *)mb->ctx_ndlp)) { + (ndlp == mb->ctx_ndlp)) { mb->ctx_ndlp = NULL; mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; } @@ -5506,7 +5506,7 @@ lpfc_cleanup_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) list_for_each_entry(mb, &phba->sli.mboxq_cmpl, list) { if ((mb->u.mb.mbxCommand != MBX_REG_LOGIN64) || (mb->mbox_flag & LPFC_MBX_IMED_UNREG) || - (ndlp != (struct lpfc_nodelist *)mb->ctx_ndlp)) + (ndlp != mb->ctx_ndlp)) continue; mb->ctx_ndlp = NULL; @@ -5516,7 +5516,7 @@ lpfc_cleanup_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) list_for_each_entry_safe(mb, nextmb, &phba->sli.mboxq, list) { if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && !(mb->mbox_flag & LPFC_MBX_IMED_UNREG) && - (ndlp == (struct lpfc_nodelist *)mb->ctx_ndlp)) { + (ndlp == mb->ctx_ndlp)) { list_del(&mb->list); lpfc_mbox_rsrc_cleanup(phba, mb, MBOX_THD_LOCKED); @@ -6356,7 +6356,7 @@ void lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) { MAILBOX_t *mb = &pmb->u.mb; - struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; + struct lpfc_nodelist *ndlp = pmb->ctx_ndlp; struct lpfc_vport *vport = pmb->vport; pmb->ctx_ndlp = NULL; diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c index f7c41958036b..d4c9a537f834 100644 --- a/drivers/scsi/lpfc/lpfc_mbox.c +++ b/drivers/scsi/lpfc/lpfc_mbox.c @@ -2367,7 +2367,7 @@ lpfc_mbx_cmpl_rdp_link_stat(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) MAILBOX_t *mb; int rc = FAILURE; struct lpfc_rdp_context *rdp_context = - (struct lpfc_rdp_context *)(mboxq->ctx_ndlp); + (struct lpfc_rdp_context *)(mboxq->context3); mb = &mboxq->u.mb; if (mb->mbxStatus) @@ -2387,7 +2387,7 @@ lpfc_mbx_cmpl_rdp_page_a2(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox) { struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)mbox->ctx_buf; struct lpfc_rdp_context *rdp_context = - (struct lpfc_rdp_context *)(mbox->ctx_ndlp); + (struct lpfc_rdp_context *)(mbox->context3); if (bf_get(lpfc_mqe_status, &mbox->u.mqe)) goto error_mbox_free; @@ -2401,7 +2401,7 @@ lpfc_mbx_cmpl_rdp_page_a2(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox) /* Save the dma buffer for cleanup in the final completion. */ mbox->ctx_buf = mp; mbox->mbox_cmpl = lpfc_mbx_cmpl_rdp_link_stat; - mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context; + mbox->context3 = (struct lpfc_rdp_context *)rdp_context; if (lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT) == MBX_NOT_FINISHED) goto error_mbox_free; @@ -2418,7 +2418,7 @@ lpfc_mbx_cmpl_rdp_page_a0(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox) int rc; struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)(mbox->ctx_buf); struct lpfc_rdp_context *rdp_context = - (struct lpfc_rdp_context *)(mbox->ctx_ndlp); + (struct lpfc_rdp_context *)(mbox->context3); if (bf_get(lpfc_mqe_status, &mbox->u.mqe)) goto error; @@ -2448,7 +2448,7 @@ lpfc_mbx_cmpl_rdp_page_a0(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox) mbox->u.mqe.un.mem_dump_type3.addr_hi = putPaddrHigh(mp->phys); mbox->mbox_cmpl = lpfc_mbx_cmpl_rdp_page_a2; - mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context; + mbox->context3 = (struct lpfc_rdp_context *)rdp_context; rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT); if (rc == MBX_NOT_FINISHED) goto error; diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c index 8e425be7c7c9..8878f3c3cc2a 100644 --- a/drivers/scsi/lpfc/lpfc_nportdisc.c +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c @@ -683,7 +683,7 @@ lpfc_mbx_cmpl_resume_rpi(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) uint32_t cmd; elsiocb = (struct lpfc_iocbq *)mboxq->ctx_buf; - ndlp = (struct lpfc_nodelist *)mboxq->ctx_ndlp; + ndlp = mboxq->ctx_ndlp; vport = mboxq->vport; cmd = elsiocb->drvrTimeout; @@ -1875,7 +1875,7 @@ lpfc_rcv_logo_reglogin_issue(struct lpfc_vport *vport, /* cleanup any ndlp on mbox q waiting for reglogin cmpl */ if ((mb = phba->sli.mbox_active)) { if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && - (ndlp == (struct lpfc_nodelist *)mb->ctx_ndlp)) { + (ndlp == mb->ctx_ndlp)) { ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND; lpfc_nlp_put(ndlp); mb->ctx_ndlp = NULL; @@ -1886,7 +1886,7 @@ lpfc_rcv_logo_reglogin_issue(struct lpfc_vport *vport, spin_lock_irq(&phba->hbalock); list_for_each_entry_safe(mb, nextmb, &phba->sli.mboxq, list) { if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && - (ndlp == (struct lpfc_nodelist *)mb->ctx_ndlp)) { + (ndlp == mb->ctx_ndlp)) { ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND; lpfc_nlp_put(ndlp); list_del(&mb->list); diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 7f87046e64b7..236b4e7e1de1 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -2914,12 +2914,12 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) } if (pmb->u.mb.mbxCommand == MBX_REG_LOGIN64) { - ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; + ndlp = pmb->ctx_ndlp; lpfc_nlp_put(ndlp); } if (pmb->u.mb.mbxCommand == MBX_UNREG_LOGIN) { - ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; + ndlp = pmb->ctx_ndlp; /* Check to see if there are any deferred events to process */ if (ndlp) { @@ -2952,7 +2952,7 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) /* This nlp_put pairs with lpfc_sli4_resume_rpi */ if (pmb->u.mb.mbxCommand == MBX_RESUME_RPI) { - ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; + ndlp = pmb->ctx_ndlp; lpfc_nlp_put(ndlp); } @@ -13832,8 +13832,7 @@ lpfc_sli_sp_intr_handler(int irq, void *dev_id) if (!pmbox->mbxStatus) { mp = (struct lpfc_dmabuf *) (pmb->ctx_buf); - ndlp = (struct lpfc_nodelist *) - pmb->ctx_ndlp; + ndlp = pmb->ctx_ndlp; /* Reg_LOGIN of dflt RPI was * successful. new lets get @@ -14341,7 +14340,7 @@ lpfc_sli4_sp_handle_mbox_event(struct lpfc_hba *phba, struct lpfc_mcqe *mcqe) pmbox->un.varWords[0], 0); if (mcqe_status == MB_CQE_STATUS_SUCCESS) { mp = (struct lpfc_dmabuf *)(pmb->ctx_buf); - ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; + ndlp = pmb->ctx_ndlp; /* Reg_LOGIN of dflt RPI was successful. Mark the * node as having an UNREG_LOGIN in progress to stop @@ -21035,7 +21034,7 @@ lpfc_cleanup_pending_mbox(struct lpfc_vport *vport) (mb->u.mb.mbxCommand == MBX_REG_VPI)) mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; if (mb->u.mb.mbxCommand == MBX_REG_LOGIN64) { - act_mbx_ndlp = (struct lpfc_nodelist *)mb->ctx_ndlp; + act_mbx_ndlp = mb->ctx_ndlp; /* This reference is local to this routine. The * reference is removed at routine exit. @@ -21064,7 +21063,7 @@ lpfc_cleanup_pending_mbox(struct lpfc_vport *vport) mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; if (mb->u.mb.mbxCommand == MBX_REG_LOGIN64) { - ndlp = (struct lpfc_nodelist *)mb->ctx_ndlp; + ndlp = mb->ctx_ndlp; /* Unregister the RPI when mailbox complete */ mb->mbox_flag |= LPFC_MBX_IMED_UNREG; restart_loop = 1; @@ -21084,7 +21083,7 @@ lpfc_cleanup_pending_mbox(struct lpfc_vport *vport) while (!list_empty(&mbox_cmd_list)) { list_remove_head(&mbox_cmd_list, mb, LPFC_MBOXQ_t, list); if (mb->u.mb.mbxCommand == MBX_REG_LOGIN64) { - ndlp = (struct lpfc_nodelist *)mb->ctx_ndlp; + ndlp = mb->ctx_ndlp; mb->ctx_ndlp = NULL; if (ndlp) { spin_lock(&ndlp->lock); diff --git a/drivers/scsi/lpfc/lpfc_sli.h b/drivers/scsi/lpfc/lpfc_sli.h index c911a39cb46b..60332de27f44 100644 --- a/drivers/scsi/lpfc/lpfc_sli.h +++ b/drivers/scsi/lpfc/lpfc_sli.h @@ -182,11 +182,11 @@ typedef struct lpfcMboxq { struct lpfc_mqe mqe; } u; struct lpfc_vport *vport; /* virtual port pointer */ - void *ctx_ndlp; /* an lpfc_nodelist pointer */ - void *ctx_buf; /* an lpfc_dmabuf pointer */ - void *context3; /* a generic pointer. Code must - * accommodate the actual datatype. - */ + struct lpfc_nodelist *ctx_ndlp; /* caller ndlp pointer */ + void *ctx_buf; /* caller buffer information */ + void *context3; /* a generic pointer. Code must + * accommodate the actual datatype. + */ void (*mbox_cmpl) (struct lpfc_hba *, struct lpfcMboxq *); uint8_t mbox_flag; From patchwork Tue Mar 5 20:05:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Justin Tee X-Patchwork-Id: 778232 Received: from mail-qv1-f45.google.com (mail-qv1-f45.google.com [209.85.219.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F41461272A2 for ; Tue, 5 Mar 2024 19:49:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709668180; cv=none; b=qExNn9P0Z5thEBw/o0to8ixBJdJWhpob4WFAcF5s0krgOENqjb9TW/QYsVSriU8J8x8S0Fu19DJhBjUWCPH2kHN/+cMFfpfchjRozd2jk7eLNtAqFMBZw03qAuhwaTNgQDXIFgw6rclcv2MjPrZc4n9DPJ7hpV59qrczVDOKDcA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709668180; c=relaxed/simple; bh=eArTxbds+9jJBj0X0IckQcyMO9vFBcya1CFb5iEHHqI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=KNIkCi9P09Bwdb70wdcYXwWEs+tivZHP/P8hi82jMM0YZC8axQJodb1gl/AmN7PRZsLdwR6UgZvAJf77sum/5xOkxitUEPs5LGv+txE/EInd/tJsE4brfPCzAYbLrl4oTCB7f7QOQpgWMwmOeqUVg2hTmKZm0vveGfHMPN3Upqg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IbImqtvp; arc=none smtp.client-ip=209.85.219.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IbImqtvp" Received: by mail-qv1-f45.google.com with SMTP id 6a1803df08f44-69069235a0eso4486016d6.0 for ; Tue, 05 Mar 2024 11:49:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709668178; x=1710272978; 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=6QyepeMeNdh4dvf6RFrc0FdzXpa+q1WoVI5foLDSuwc=; b=IbImqtvpgAARTHuk0TNr9ckNIEzKo6gVS0yPrBX8XnRhFUZZhh7udAoy5iRy7pVKqH XJ88UDUAaKQ4bYctucwNJeJtNpUzZLk6bUCZFWJp3vUTOv1nXYm6yWkxVDPg9THjsmMK 0yCsNJETEhq7ZB7OudYKktK9Zo/ILCHjTqVohJAhfqP48OvGNhDU9bC1r+Te6j3TUsv/ lGS5CjJbCNsWpJrEtFWJ7l4VeIm3W/SiPHGC1Pceguj0ge/gweoQBM8k32tMCqcpxxXt Ia89052uNoxnQGWBBG2C/xJ+tn1h8uSb3aBprzm/3v3nSOTno+V/TUcEd/PV4rT/8k5d nMJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709668178; x=1710272978; 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=6QyepeMeNdh4dvf6RFrc0FdzXpa+q1WoVI5foLDSuwc=; b=o7YxRyKxOtSpvdIDqavzY5Ibwf9HdTxTJxs2akt8Dzafderwxs6a7dkxyUKWNjPqcz AwWERvoe4l7fWjsLX0At6sbSjTOkK4hEe6+DYIVXiGT8w4ltD1M9LB3w13BkTVfy7K89 6NatfjrojYu+JC2yX6Nnuow9zp2X6XGI0TwDP/08yRSKUGRrIqjVBTqNWQNpij1VldHR scCllx084/GgZsf7sjzU8yho2T9Iwj3xp4ndqNf4WFOinDBSR0iZyuqHDQJtDpP8i6MT pJ9hGalBkSFI9RyNdZ+Jn1sn3+cMbzbumF7fCr9F9vbYuklw5nCAa6zEIcUmJaZHaaLB amTA== X-Gm-Message-State: AOJu0YyrgNRL6+MBzJxKDQ3AfJzvWvLWZHVpdC2QT5g5R8CIfVAZuY18 X5hA07wN0NkGj2PREy+2xuKfgl/RvjfqIDSMYG0KltSC8yqyja+0zfsZ655J X-Google-Smtp-Source: AGHT+IHaJw4vDglwEy7vnHK9DKFGd30KVxm/FxI8cCIWfAeO8cm1Q0nUKnb9CJ4xFG8mBId3wcX/qw== X-Received: by 2002:a05:620a:4587:b0:788:2f7b:d3 with SMTP id bp7-20020a05620a458700b007882f7b00d3mr786377qkb.7.1709668177859; Tue, 05 Mar 2024 11:49:37 -0800 (PST) Received: from dhcp-10-231-55-133.dhcp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id bj13-20020a05620a190d00b007877f52a6b9sm5706050qkb.136.2024.03.05.11.49.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2024 11:49:37 -0800 (PST) From: Justin Tee To: linux-scsi@vger.kernel.org Cc: jsmart2021@gmail.com, justin.tee@broadcom.com, Justin Tee Subject: [PATCH 12/12] lpfc: Copyright updates for 14.4.0.1 patches Date: Tue, 5 Mar 2024 12:05:03 -0800 Message-Id: <20240305200503.57317-13-justintee8345@gmail.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20240305200503.57317-1-justintee8345@gmail.com> References: <20240305200503.57317-1-justintee8345@gmail.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Update copyrights to 2024 for files modified in the 14.4.0.1 patch set. Signed-off-by: Justin Tee --- drivers/scsi/lpfc/lpfc_sli.h | 2 +- drivers/scsi/lpfc/lpfc_sli4.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_sli.h b/drivers/scsi/lpfc/lpfc_sli.h index 39f78ef291f7..cf7c42ec0306 100644 --- a/drivers/scsi/lpfc/lpfc_sli.h +++ b/drivers/scsi/lpfc/lpfc_sli.h @@ -1,7 +1,7 @@ /******************************************************************* * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters. * - * Copyright (C) 2017-2023 Broadcom. All Rights Reserved. The term * + * Copyright (C) 2017-2024 Broadcom. All Rights Reserved. The term * * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * * Copyright (C) 2004-2016 Emulex. All rights reserved. * * EMULEX and SLI are trademarks of Emulex. * diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h index 37d9ead7a7c0..c1e9ec0243ba 100644 --- a/drivers/scsi/lpfc/lpfc_sli4.h +++ b/drivers/scsi/lpfc/lpfc_sli4.h @@ -1,7 +1,7 @@ /******************************************************************* * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters. * - * Copyright (C) 2017-2023 Broadcom. All Rights Reserved. The term * + * Copyright (C) 2017-2024 Broadcom. All Rights Reserved. The term * * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * * Copyright (C) 2009-2016 Emulex. All rights reserved. * * EMULEX and SLI are trademarks of Emulex. *