Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp733142pxb; Thu, 25 Feb 2021 13:45:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJx4BnlycEIU1rtt7ujvgF8yYs4CYw2FQCXV9STREWKYzxYpzrzCQuZ2utxPITsVaAgMTo1D X-Received: by 2002:a05:6402:31a5:: with SMTP id dj5mr14645edb.388.1614289505142; Thu, 25 Feb 2021 13:45:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614289505; cv=none; d=google.com; s=arc-20160816; b=ZWvvq0NJQoUiFmiNKnuzjXfDw748i6frFElat1Oziqb3zB2OWwYUI2l6JC4CcJDVO6 mAo0dgqrkS/CQHKM/+lSM7zHmkUmukCwF8dd4jUmuCRmRqSK7tJKk3W6tgsdF9x4ZWWO 2RmA4t4hjdsW+cML/ObhoWS/fpISyla0yXaZYxFH4Lj1ICbVNH0DmdX04pP7X92fuP92 3XxS+HgiCWrzBmPvDxgc12Ewx5Ttk14RJ9zQsfcS41vT7alpl/dIuVHxRAEr8q3hRcjt DkOXqOsZzBmbKm57He/OR36/qnz1BTxqmlZwqyYA2cPSLPlV9ng2sbqqRILIJHUyjqFS OJYA== 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=JGMR3wq7iroHjO6YNAzTo4xWKg2QW6voayOfjj/jUsm/CohnxSriuz6v9dN5hqhF2y ooroCPPFKHK5axmIDl/ZTUQjwESxCTZUuJ2wxOIk2uaGwUul+xeqRF4M629c5XqKhxD7 tC+zbKE2g9evCSQhmswVj+kaomEziwDmhRFAN18e0rCCZQCTK32J3XwpHMh4F/GHHAaZ AYEooOV0SNjvAiO3TgwRqEhCSjhzMC5+7p5PG+qC/Skez+y9IbFgTszQtBav2rQAN2UB uMEkJ5qladbksJAAya3wmjJC2f4MYJdWSgBrr6u4q6rzxpgS+WK/ZcjsKPipr9NvHMFK kTkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=GeLh6sQ3; 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 e26si1694526edv.55.2021.02.25.13.44.42; Thu, 25 Feb 2021 13:45:05 -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=GeLh6sQ3; 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 S234637AbhBYVnm (ORCPT + 99 others); Thu, 25 Feb 2021 16:43:42 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:21680 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233127AbhBYVn3 (ORCPT ); Thu, 25 Feb 2021 16:43:29 -0500 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 11PLWcVu042234; Thu, 25 Feb 2021 16:42:42 -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=GeLh6sQ3uRhx6ZO4ArSj98AWQSseVLjkGxFG7zq5Qubp4GJlHkG6+PED31UwllbtAOZ3 XrajU4SM7QbV8IsaferHEase1wPhrpVF089bbBY0QZMWTe3RkXW/xKy0VwA6AF5HBHA1 eDwIuEOv0wkO6Y/kRV1B0U6E6gHbqXVHipXLT1kAVn8uBUZMmhmcptAyWMpNFg+0prfv kEH2B23z1TC7PlXqYwjXUgeMG30onF2tr857DqFQIYDQIr1uF3QVbKqPDzqiXc5Oh+tn zKBYF1mvopm9e+Np5y7riYJWMWuOe0drM5Jvg0Cz7Mplq3TcaBVP3z1Tjk6+QNnX5G6E bQ== Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0b-001b2d01.pphosted.com with ESMTP id 36xh8t4x8c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Feb 2021 16:42:42 -0500 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 11PLS69A017296; Thu, 25 Feb 2021 21:42:41 GMT Received: from b03cxnp07028.gho.boulder.ibm.com (b03cxnp07028.gho.boulder.ibm.com [9.17.130.15]) by ppma05wdc.us.ibm.com with ESMTP id 36tt2a9rrq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Feb 2021 21:42:41 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 11PLgeA529819298 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Feb 2021 21:42:40 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1EFCF78063; Thu, 25 Feb 2021 21:42:40 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9532678060; Thu, 25 Feb 2021 21:42:39 +0000 (GMT) Received: from vios4361.aus.stglabs.ibm.com (unknown [9.3.43.61]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP; Thu, 25 Feb 2021 21:42:39 +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 v3 1/5] ibmvfc: simplify handling of sub-CRQ initialization Date: Thu, 25 Feb 2021 15:42:33 -0600 Message-Id: <20210225214237.22400-2-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210225214237.22400-1-tyreld@linux.ibm.com> References: <20210225214237.22400-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-02-25_14:2021-02-24,2021-02-25 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=999 spamscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 malwarescore=0 mlxscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102250163 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