Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1486466pxb; Thu, 4 Mar 2021 12:36:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJxi+wQxWS0jaTM2ZmeK1MIYt+7xaBdNz8cPFmupdLG6GUM3RsIzB1mG3O9okfoDqbfM3je8 X-Received: by 2002:a05:6402:26ce:: with SMTP id x14mr6326342edd.359.1614890163416; Thu, 04 Mar 2021 12:36:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614890163; cv=none; d=google.com; s=arc-20160816; b=XAGojJeOagGp7JHN7burCO4wWPvQpHTnkl1JSv9hXQPUUTuEtCCODKFE2NdtXW/Z/R Cb9Jp+y3b6aYAumGTOGvsey4QzBJ4Mh1yGqsfCltr7cGeOMIlPw1OTjVsY9RwTap9FhQ WrDyj8W/VhuzhtPkIj9Y0OzmBYiMAarz5KJa1KxnAmY5LJNPCmeUmpJwWwHs0190GNYB dS7WKwyRXNzCT8/PHD5FV2JJv+dMHFJ1Wimc9JYIFaAKq09mUKV/Gwd38H/a4E17wwWF +8VCdy0KbwHe8yLmS6M4K754o3KuwXjcxSNL5WCaA7nAIsxZyVN+c07qf2CjKSJXvtfk fJsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nILnawZBkXgE9K7dLnpbGy1lY+tttA4o0oEurj3Me0Q=; b=rnbMRiOV1udB+B48+0EYHFea02EV8UF7gmOt+9lnlJSOUTxw5Jg+AjwBNCh3NH5LxP vQIKA4fvHk3j1QcF7dkXMZsf0/KdVQkZDekRWR1AKmkTzI33zcI05eafg1Bvrj1qDV9X CoA2qct64Sj9p9uUu3ZIpC5PriltliAh/E2jZQuIr632R3Ai9CnKgTIurOFbwzvpNHpm WcZ8qEj4O9AJJynQ9keaqSTCFlTJd3aMozqrCKNsUY5g2VkXoe3nO6Y0I1Z0Hm8bdoBB xS76oiboRJmKO1u9K9jTfYeBPTEaRPusjsCFtIix1a4dtOAwBv2dHx/we2Hs3MAjDqYN W80Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=C8zO0n28; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g2si374635edb.398.2021.03.04.12.35.40; Thu, 04 Mar 2021 12:36:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=C8zO0n28; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356263AbhCCKrM (ORCPT + 99 others); Wed, 3 Mar 2021 05:47:12 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:65422 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1840154AbhCBXHu (ORCPT ); Tue, 2 Mar 2021 18:07:50 -0500 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 122N3Q5X085158; Tue, 2 Mar 2021 18:07:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=nILnawZBkXgE9K7dLnpbGy1lY+tttA4o0oEurj3Me0Q=; b=C8zO0n286I4dez3QcnSfpwEjHaCOWP/B7772qTqDYaEkgKZuE0an13qLRAeAwZ3HVnwB gdb0QH32r0JBHo9TBbUet4qpfaCrEmsxyo6yG1BKe/Y+0iPqp5VX81U+L1HO7n424n+n mwCU6yPxYRbbyYpYwg23xuW2L67y8Xj7+LPY9hCm0pLLz7OCV6J3+PKUjci9mLGUnDSR oU7aQdGXy7Ks40dQt2CQhiXTRUWEIf/E/TjZEY7F6tM5mbOkLezLI4pykkpPffM3WgU0 SQLalwVfcS7NpvO4WqSWoz2co6MI2DwzvFYNkG+aIK/EdWrikXGQx9/E/Vhc1OPNocp/ Jw== Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0a-001b2d01.pphosted.com with ESMTP id 371xmwrfx0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Mar 2021 18:07:03 -0500 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 122N2YWe031580; Tue, 2 Mar 2021 23:05:46 GMT Received: from b03cxnp07027.gho.boulder.ibm.com (b03cxnp07027.gho.boulder.ibm.com [9.17.130.14]) by ppma03wdc.us.ibm.com with ESMTP id 37128gatfg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Mar 2021 23:05:46 +0000 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp07027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 122N5jd726738946 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 2 Mar 2021 23:05:45 GMT Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 754FA6E050; Tue, 2 Mar 2021 23:05:45 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F3BF86E04C; Tue, 2 Mar 2021 23:05:44 +0000 (GMT) Received: from vios4361.aus.stglabs.ibm.com (unknown [9.3.43.61]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 2 Mar 2021 23:05:44 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com Cc: martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v5 1/5] ibmvfc: simplify handling of sub-CRQ initialization Date: Tue, 2 Mar 2021 17:05:39 -0600 Message-Id: <20210302230543.9905-2-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210302230543.9905-1-tyreld@linux.ibm.com> References: <20210302230543.9905-1-tyreld@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-03-02_08:2021-03-01,2021-03-02 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 adultscore=0 mlxscore=0 phishscore=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 malwarescore=0 bulkscore=0 mlxlogscore=999 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103020170 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If ibmvfc_init_sub_crqs() fails ibmvfc_probe() simply parrots registration failure reported elsewhere, and futher vhost->scsi_scrq.scrq == NULL is indication enough to the driver that it has no sub-CRQs available. The mq_enabled check can also be moved into ibmvfc_init_sub_crqs() such that each caller doesn't have to gate the call with a mq_enabled check. Finally, in the case of sub-CRQ setup failure setting do_enquiry can be turned off to putting the driver into single queue fallback mode. The aforementioned changes also simplify the next patch in the series that fixes a hard reset issue, by tying a sub-CRQ setup failure and do_enquiry logic into ibmvfc_init_sub_crqs(). Signed-off-by: Tyrel Datwyler Reviewed-by: Brian King --- drivers/scsi/ibmvscsi/ibmvfc.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index 7097028d4cb6..384960036f8b 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c @@ -5705,17 +5705,21 @@ static void ibmvfc_deregister_scsi_channel(struct ibmvfc_host *vhost, int index) LEAVE; } -static int ibmvfc_init_sub_crqs(struct ibmvfc_host *vhost) +static void ibmvfc_init_sub_crqs(struct ibmvfc_host *vhost) { int i, j; ENTER; + if (!vhost->mq_enabled) + return; vhost->scsi_scrqs.scrqs = kcalloc(nr_scsi_hw_queues, sizeof(*vhost->scsi_scrqs.scrqs), GFP_KERNEL); - if (!vhost->scsi_scrqs.scrqs) - return -1; + if (!vhost->scsi_scrqs.scrqs) { + vhost->do_enquiry = 0; + return; + } for (i = 0; i < nr_scsi_hw_queues; i++) { if (ibmvfc_register_scsi_channel(vhost, i)) { @@ -5724,13 +5728,12 @@ static int ibmvfc_init_sub_crqs(struct ibmvfc_host *vhost) kfree(vhost->scsi_scrqs.scrqs); vhost->scsi_scrqs.scrqs = NULL; vhost->scsi_scrqs.active_queues = 0; - LEAVE; - return -1; + vhost->do_enquiry = 0; + break; } } LEAVE; - return 0; } static void ibmvfc_release_sub_crqs(struct ibmvfc_host *vhost) @@ -5997,11 +6000,7 @@ static int ibmvfc_probe(struct vio_dev *vdev, const struct vio_device_id *id) goto remove_shost; } - if (vhost->mq_enabled) { - rc = ibmvfc_init_sub_crqs(vhost); - if (rc) - dev_warn(dev, "Failed to allocate Sub-CRQs. rc=%d\n", rc); - } + ibmvfc_init_sub_crqs(vhost); if (shost_to_fc_host(shost)->rqst_q) blk_queue_max_segments(shost_to_fc_host(shost)->rqst_q, 1); -- 2.27.0