Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2936668pxb; Tue, 12 Jan 2021 02:13:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJxpKO+xaP0xXkqReNbXlX1a+EteaaTmCxiQC+5jbd+ZPii+8cEBk9/d2tMgWBvjD09VcmHf X-Received: by 2002:a17:906:e18:: with SMTP id l24mr2589895eji.434.1610446418193; Tue, 12 Jan 2021 02:13:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610446418; cv=none; d=google.com; s=arc-20160816; b=weWtn+qy8FOplitHbxAPZtU/PI0Shvzt2n4UqRbfFbGsyXeCT9xFeRWDTnq7xT/v2c j8aQY+lG/rqCOCkcoDiX/bpIjTlmC8hXLiAKTDjOOIGI+93Tlmp0328fc/6KSOTvtWr8 Sj/y93olxFF5UEHYlW7cW7tQZVqFzq6/hB7n7oKioN3Lv4yoAzbLol+DGzU4m/KofxBs LqpJ9NFqVeW5Y92FpGkimZMKD9MsGs7ruI8fsCBSp2ShInxarKebbsZNuZdK97M1YAAo d6jsCSPSzT4wSMBZOalucmD+XrCWvx0NDfxYIiQOsh1XIML3Dr+ueFVZh3JF3ZGzXSJw ufhA== 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=QjcsI1qOMV2f2DMfiZGn6+ursQYzl5WtmahCDPBRtb4=; b=muJhNSsCPG1WYlUyxFgupmaqAxUZ49dlTB7Xt8NGu5abzdtVSgESJWWmzmziMngXMg 1ENahxJGNvv2u3PlQSOJ8yxvU7h8RV8i2b1ExAULhuAsMtsSERV0y2yOChk9M3P30Z22 tpOTsIbRdlip9XYzxS7kLFhNqdBKP4YOH06b3S+AFNQTGZr6iiJQe1tJ3lPquP7TN4+8 91U6izkxVqyTo+Yr5xbn49yuzjvQ/vRUPLNP69aEvMrAis1g4bE/au8+oXk+GJNOs4fN X+n9lCgizZgt8QZDIkzJi1L4lV1FoHJsO4zM81hozRqlwprRS7+U8pQkD5RsYD1Cxc3z MP7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=ITWcoSx8; 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 cs10si882257ejc.200.2021.01.12.02.13.13; Tue, 12 Jan 2021 02:13:38 -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=ITWcoSx8; 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 S2404712AbhALAY7 (ORCPT + 99 others); Mon, 11 Jan 2021 19:24:59 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:22758 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2403943AbhAKXOu (ORCPT ); Mon, 11 Jan 2021 18:14:50 -0500 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 10BN1fbS094000; Mon, 11 Jan 2021 18:12:32 -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=QjcsI1qOMV2f2DMfiZGn6+ursQYzl5WtmahCDPBRtb4=; b=ITWcoSx898ZkAWnxWO6P7zT1k+EtL7IkFsWwLup68su8Vmg/vQX3goLU1b3zEJ7kzwyt 453ylCBVBIo4hQpXeZi5lSk+D+sDJuM27JXRufso+aK9f890T1qRa20QKPHPlpO1dt4u E1DWtDIrOyAErgPVkPiDyCDaEID5vrqh+fRKfxt4QenDpLm3r/7tza92vkhzl5ROxBuk f4iRjl0HFosg8GonEKZNdERYqz418ZHAKMsfnXJcHIVuJduREA6wC2opcQBVn2cObbbx 0JwxLZ/YmNg0BUWk0BOGq7VMewKFUYdl4rN760S4iDfa8gag3voL5aibRNPZpWJzQzMq RQ== Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0b-001b2d01.pphosted.com with ESMTP id 360yexs1by-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Jan 2021 18:12:32 -0500 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 10BN8UwZ022002; Mon, 11 Jan 2021 23:12:31 GMT Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by ppma04dal.us.ibm.com with ESMTP id 35y448xfh9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Jan 2021 23:12:31 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 10BNCT9328508434 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Jan 2021 23:12:29 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B4DD878063; Mon, 11 Jan 2021 23:12:29 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 527727805F; Mon, 11 Jan 2021 23:12:29 +0000 (GMT) Received: from vios4361.aus.stglabs.ibm.com (unknown [9.3.43.61]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP; Mon, 11 Jan 2021 23:12:29 +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 v4 04/21] ibmvfc: add size parameter to ibmvfc_init_event_pool Date: Mon, 11 Jan 2021 17:12:08 -0600 Message-Id: <20210111231225.105347-5-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210111231225.105347-1-tyreld@linux.ibm.com> References: <20210111231225.105347-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.343,18.0.737 definitions=2021-01-11_32:2021-01-11,2021-01-11 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 lowpriorityscore=0 mlxlogscore=999 clxscore=1015 priorityscore=1501 mlxscore=0 spamscore=0 bulkscore=0 adultscore=0 suspectscore=0 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101110126 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With the upcoming addition of Sub-CRQs the event pool size may vary per-queue. Add a size parameter to ibmvfc_init_event_pool such that different size event pools can be requested by ibmvfc_alloc_queue. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index 9330f5a65a7e..524e81164d70 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c @@ -723,19 +723,23 @@ static int ibmvfc_send_crq_init_complete(struct ibmvfc_host *vhost) * Returns zero on success. **/ static int ibmvfc_init_event_pool(struct ibmvfc_host *vhost, - struct ibmvfc_queue *queue) + struct ibmvfc_queue *queue, + unsigned int size) { int i; struct ibmvfc_event_pool *pool = &queue->evt_pool; ENTER; - pool->size = max_requests + IBMVFC_NUM_INTERNAL_REQ; - pool->events = kcalloc(pool->size, sizeof(*pool->events), GFP_KERNEL); + if (!size) + return 0; + + pool->size = size; + pool->events = kcalloc(size, sizeof(*pool->events), GFP_KERNEL); if (!pool->events) return -ENOMEM; pool->iu_storage = dma_alloc_coherent(vhost->dev, - pool->size * sizeof(*pool->iu_storage), + size * sizeof(*pool->iu_storage), &pool->iu_token, 0); if (!pool->iu_storage) { @@ -747,7 +751,7 @@ static int ibmvfc_init_event_pool(struct ibmvfc_host *vhost, INIT_LIST_HEAD(&queue->free); spin_lock_init(&queue->l_lock); - for (i = 0; i < pool->size; ++i) { + for (i = 0; i < size; ++i) { struct ibmvfc_event *evt = &pool->events[i]; atomic_set(&evt->free, 1); @@ -5013,6 +5017,7 @@ static int ibmvfc_alloc_queue(struct ibmvfc_host *vhost, { struct device *dev = vhost->dev; size_t fmt_size; + unsigned int pool_size = 0; ENTER; spin_lock_init(&queue->_lock); @@ -5021,10 +5026,7 @@ static int ibmvfc_alloc_queue(struct ibmvfc_host *vhost, switch (fmt) { case IBMVFC_CRQ_FMT: fmt_size = sizeof(*queue->msgs.crq); - if (ibmvfc_init_event_pool(vhost, queue)) { - dev_err(dev, "Couldn't initialize event pool.\n"); - return -ENOMEM; - } + pool_size = max_requests + IBMVFC_NUM_INTERNAL_REQ; break; case IBMVFC_ASYNC_FMT: fmt_size = sizeof(*queue->msgs.async); @@ -5034,6 +5036,11 @@ static int ibmvfc_alloc_queue(struct ibmvfc_host *vhost, return -EINVAL; } + if (ibmvfc_init_event_pool(vhost, queue, pool_size)) { + dev_err(dev, "Couldn't initialize event pool.\n"); + return -ENOMEM; + } + queue->msgs.handle = (void *)get_zeroed_page(GFP_KERNEL); if (!queue->msgs.handle) return -ENOMEM; -- 2.27.0