Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2390026pxb; Thu, 11 Feb 2021 11:04:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6g88uJovsSPINUCQYJS83A71ZffwbBMQPXx+z5fP64MaB65kdx/vw8NqVTdl4SFg4sXK7 X-Received: by 2002:a05:6402:1641:: with SMTP id s1mr9949518edx.238.1613070283851; Thu, 11 Feb 2021 11:04:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613070283; cv=none; d=google.com; s=arc-20160816; b=Np189PdUyI2xvZ9m0LVpoYmXuhxtGCSQ/nZ3G5RifkzHmCcLXTLW4RxT6lARuTWYjF sgIJzTJfPQKJgoLEUVVrEkE4wyWBbmlEFSyMvDKffQ8ZsPKEhPx/Il4ZSGJeHyG8/lkd AmX5VECs1L+30rzrnRseS36WAyA85GTQDENAKoHGTEgsKWBlvdRR6aPuXTBmN/nZm9GA tN22oDwT+q5IC4a2YAC+ODC7l09JHUEbfZOy1Uo12c0i+MBSem9eddEoas7W44sgxIdS XxrciMdWGaeP3Lplp+eZzT3/NSe7LuT3PWxDrNMmMyPSYG0v1hK5JPAJWHWW5LomyJCC rluw== 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=ixHumqGz8XkQOiZCKpsApQg0t89iAMdKEpOk6Se/MII=; b=XUkcMkdtGDdkRXUu4fNMNZKjRENiDwVXzPYCoLK9dvJGmzLVW2DFts1QSmr60vykv5 3ume2YvZURQTPLNlPL/NpXQs5cPWryb7KYC1n9hkRA5/By18t4EX+UAkE7IHkoVgO/fX TNufoTeKYXPJZWTer7c3L+Yu2od7Z6iiVC5a+EY2ZhUisQ7Jxf/QHKqhVV4m2V6hdgPO A8ceS7J/ftF6dcUNze+LXBfzrbpyS6XoE/fYTFoWS2UjScTxKxSYWNMmLdIF6IK8I56W HoldDx5SV/JQu/lgT2pE2ENheTnM+dVe4ZJbTGrRz4Cu/1X7uCM+uGvUZBU1tdpIH05i JkPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=UnvZ6FQg; 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 a17si4259610edn.146.2021.02.11.11.03.55; Thu, 11 Feb 2021 11:04:43 -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=UnvZ6FQg; 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 S231740AbhBKTDA (ORCPT + 99 others); Thu, 11 Feb 2021 14:03:00 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:23382 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231404AbhBKS6e (ORCPT ); Thu, 11 Feb 2021 13:58:34 -0500 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 11BIh7qT078059; Thu, 11 Feb 2021 13:57:48 -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=ixHumqGz8XkQOiZCKpsApQg0t89iAMdKEpOk6Se/MII=; b=UnvZ6FQgSYTrEQF7wYrwg82pZfA1suT/mx5otvMLipoAoB2SvDjwHl55R0nSqzoqzpE5 hS5CX3gg0HUGb7w2SKHvxyOsKb0iyaiRsiIbaIOgQTFyO0CC++EZJozkfWkWlAaxF/dq 9hVSldfT/tCxM00AxDW9viqMls2+C3Lz/TYjq+zDQV2N6RxPETLW+SeC1XszZwXws0a2 kUUFH9d84ycEGztPiOng+I0A0jmP6rkUEieCUuBVqrhjvtyhW3zJMZsQ+TlS1T7ZgJYh 5WcC+j+y1D5OJJlpIxUkve9GYZO46KlBCOOEHb+D7ZZrXzHXrw+4ywpfzgLHXwwJLtIs 6g== Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0a-001b2d01.pphosted.com with ESMTP id 36na3wgah5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 11 Feb 2021 13:57:48 -0500 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 11BInqbF003471; Thu, 11 Feb 2021 18:57:46 GMT Received: from b03cxnp07027.gho.boulder.ibm.com (b03cxnp07027.gho.boulder.ibm.com [9.17.130.14]) by ppma01wdc.us.ibm.com with ESMTP id 36hjr9qskh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 11 Feb 2021 18:57:46 +0000 Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp07027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 11BIvjVp26411388 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Feb 2021 18:57:45 GMT Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 72EC4136051; Thu, 11 Feb 2021 18:57:45 +0000 (GMT) Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2643A136055; Thu, 11 Feb 2021 18:57:45 +0000 (GMT) Received: from vios4361.aus.stglabs.ibm.com (unknown [9.3.43.61]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTP; Thu, 11 Feb 2021 18:57:45 +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 1/4] ibmvfc: simplify handling of sub-CRQ initialization Date: Thu, 11 Feb 2021 12:57:39 -0600 Message-Id: <20210211185742.50143-2-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210211185742.50143-1-tyreld@linux.ibm.com> References: <20210211185742.50143-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.737 definitions=2021-02-11_07:2021-02-11,2021-02-11 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 impostorscore=0 lowpriorityscore=0 mlxlogscore=999 phishscore=0 bulkscore=0 mlxscore=0 spamscore=0 malwarescore=0 clxscore=1015 adultscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102110146 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 --- 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