From patchwork Sun Nov 26 05:31:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandrakanth Patil X-Patchwork-Id: 747515 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="g4zpum5Z" Received: from mail-yw1-x1130.google.com (mail-yw1-x1130.google.com [IPv6:2607:f8b0:4864:20::1130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AFECDC for ; Sat, 25 Nov 2023 21:31:05 -0800 (PST) Received: by mail-yw1-x1130.google.com with SMTP id 00721157ae682-5c85e8fdd2dso29249577b3.2 for ; Sat, 25 Nov 2023 21:31:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1700976664; x=1701581464; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=Pplkkx3QSqkMXfA3cR/+JosWlTFrJrbmsz6cfxprViQ=; b=g4zpum5ZAEJvoEtawfEuKIEOBcaikaMlU//NHLfzXcGb9ilvyYx64qo91OdPGWaWxn phLLVO2jGe7nkHSWBy5MF+PFRic5F6wmIfavM2GvDL7el2tsXh/PxWcGhtr9VGYL9+YM Yj6dJB+vRiyKqMPcdXxRgqTU0lRhKZESFcyqM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700976664; x=1701581464; h=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=Pplkkx3QSqkMXfA3cR/+JosWlTFrJrbmsz6cfxprViQ=; b=QmiSMP/ZPIPXU6RUGaDE7RTNW5O+cIP+Yc/wTxQiNR6As0rBI7umJsAQHLnND0GzrC eUX+rAyzL5cUwzE4kcAhuaZrG5CyNCO1cKsdfY3I7ZW11e1nuCbRnLaJM/d8Mwt+TAl4 H7Ee+yR0QwC0i1R84ib/jfVvdr/hj0vFBlSP9Gv2h7K3FkPw/bxXrPjfO9aV6IC27Uh+ lZRbcKAZzE0hpykrhnbQbz1gZN5PYjybZXRyz0lMCzR1/X/CbGS8rOdR+SqN+HWuV+Oa Y85ZhCEg20iUuOPLRF0nXsbxUpOjNkztGYLJ6WMfbet/gH+hGNVz6su2iwKHq5aydFxK YxuQ== X-Gm-Message-State: AOJu0YzMRhpkrOj4KTCUnNd7xCd0HT7r9vXUHzGxzAAJvNjo/7VLPFcT 2EaRvfpjL9Ph2Cn0/CDEAYAUjBOOJZIGxjsujEouWSY3bOrfbCPeHcoiC0BJ5GCTplb5rBtAiad g7Egqjg8cWGeXDFzoQ42Po8sDrHcDzdiCcYd6bj+H0JU2L14OE0Gy+9N1jCcmdN4wB0SAVhPbtP /99fErNlsiPciN/Bhs/A== X-Google-Smtp-Source: AGHT+IE6yl2vfJyeaX1ogQweJkK2DJdS+QjzQvP43bpLT2g4XC8OUI0jQS03nFttip2jU4Ow7fOHsg== X-Received: by 2002:a81:9190:0:b0:5a8:e6f4:4b6c with SMTP id i138-20020a819190000000b005a8e6f44b6cmr8512052ywg.25.1700976663763; Sat, 25 Nov 2023 21:31:03 -0800 (PST) Received: from dhcp-10-123-20-35.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id s78-20020a632c51000000b00578b8fab907sm5516166pgs.73.2023.11.25.21.31.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Nov 2023 21:31:03 -0800 (PST) From: Chandrakanth patil To: linux-scsi@vger.kernel.org, sathya.prakash@broadcom.com, sumit.saxena@broadcom.com, ranjan.kumar@broadcom.com, prayas.patel@broadcom.com Cc: Chandrakanth patil , stable@vger.kernel.org Subject: [PATCH 3/4] mpi3mr: Block PEL Enable Command on Controller Reset and Unrecoverable State Date: Sun, 26 Nov 2023 11:01:33 +0530 Message-Id: <20231126053134.10133-4-chandrakanth.patil@broadcom.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231126053134.10133-1-chandrakanth.patil@broadcom.com> References: <20231126053134.10133-1-chandrakanth.patil@broadcom.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 If a controller reset is underway or the controller is in an unrecoverable state, the PEL enable management command will be returned as EAGAIN or EFAULT. Cc: # v6.1+ Signed-off-by: Sathya Prakash Signed-off-by: Chandrakanth patil --- drivers/scsi/mpi3mr/mpi3mr_app.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/scsi/mpi3mr/mpi3mr_app.c b/drivers/scsi/mpi3mr/mpi3mr_app.c index 08645a99ad6b..9dacbb8570c9 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_app.c +++ b/drivers/scsi/mpi3mr/mpi3mr_app.c @@ -223,6 +223,22 @@ static long mpi3mr_bsg_pel_enable(struct mpi3mr_ioc *mrioc, return rval; } + if (mrioc->unrecoverable) { + dprint_bsg_err(mrioc, "%s: unrecoverable controller\n", + __func__); + return -EFAULT; + } + + if (mrioc->reset_in_progress) { + dprint_bsg_err(mrioc, "%s: reset in progress\n", __func__); + return -EAGAIN; + } + + if (mrioc->stop_bsgs) { + dprint_bsg_err(mrioc, "%s: bsgs are blocked\n", __func__); + return -EAGAIN; + } + sg_copy_to_buffer(job->request_payload.sg_list, job->request_payload.sg_cnt, &pel_enable, sizeof(pel_enable));