From patchwork Wed Nov 8 23:57:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ching Huang X-Patchwork-Id: 10050369 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B2A66603FF for ; Thu, 9 Nov 2017 07:57:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A52312AB77 for ; Thu, 9 Nov 2017 07:57:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 995A12AB79; Thu, 9 Nov 2017 07:57:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.9 required=2.0 tests=BAYES_00, DATE_IN_PAST_06_12, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13F842AB78 for ; Thu, 9 Nov 2017 07:57:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753093AbdKIH5Q (ORCPT ); Thu, 9 Nov 2017 02:57:16 -0500 Received: from mail-io0-f180.google.com ([209.85.223.180]:48548 "EHLO mail-io0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753035AbdKIH5O (ORCPT ); Thu, 9 Nov 2017 02:57:14 -0500 Received: by mail-io0-f180.google.com with SMTP id d66so8869619ioe.5 for ; Wed, 08 Nov 2017 23:57:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=areca-com-tw.20150623.gappssmtp.com; s=20150623; h=subject:from:to:date:message-id:mime-version :content-transfer-encoding; bh=PyvMhM+LSFYpC8Pj1x4y3RDvnIuSy1zDgCMF2tKtn2E=; b=GCL9y5mvFNl9hdno+ta9CP0FEtwNAYvKWffo2zOTGX5eulFSL77/pBywdqBH/Wk9Pi wghWJ3V/VPDd+ub5F9vYXKNgn8r0Ho35CnxEomN920Z4uS6o0XtWNAGEa93sfwlPd8v0 Gzr0ZnzuIR5w896oIksmNyeyfFMOAzZgkcQGpz4blqbzcx9lwI7XTWfOwiu5TqdYm+4G A98ssZSECbfooRYSjQ/y0VFyxN2MHobbz4/LCDAIvSRm1SC4hc/CzkRv+eg5SCGrL5Pg ikjAJLLrzF1Ap+rlBvNSF6fpTDbD8eqd4bxpldtuiYNNbLMIvIRUCsemcWsX4swmr/Wy CMuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:date:message-id:mime-version :content-transfer-encoding; bh=PyvMhM+LSFYpC8Pj1x4y3RDvnIuSy1zDgCMF2tKtn2E=; b=DN7WFo5xNgQhz7B9zzY2QC/gKncFpuPk2hbeaqbFYmp064iDgHZ9qd5KPSef7HJEVi 5w8+kMwY6l94S5Mr6DLMsyrml7lDBK9v4rIUsH4bT+x57Uf0Ta8fjw46EOEFvfw83T1n AmGaBURnu1V8LDPZtL4ZOyO+gR/ZoF5T0iYcgSzeWu9ZxbaESbdRRVA0kYxd6bQyhdO+ OGSL5sCTMUhwfKavARraiC04omdKYvTxuMcjMtflIO1lJwUQ06KL8r+aRTr/hi5O2Tbo oDy4ogYZmkZjAgpk6eghIQxS/lsIofP5Inc5byGkQWOXM3PG7a8atfSFc25tCQGYR3X6 fdjQ== X-Gm-Message-State: AJaThX7BNQf8OOdRAK4GUYXdhALvhw+cbNkX5zpsQ/FyQplPogmC7lxE tEsnSbkeH9th3WJ1xi99EgLO2w== X-Google-Smtp-Source: ABhQp+QPfnByz9gdslGHfyxOMHk2IZNYHdYDKqt7o7NVwIIxYklogZkIlXzsyQNqGqc0yPrnUgHY1w== X-Received: by 10.107.176.14 with SMTP id z14mr3912065ioe.50.1510214233325; Wed, 08 Nov 2017 23:57:13 -0800 (PST) Received: from [192.168.0.106] (60-248-88-209.HINET-IP.hinet.net. [60.248.88.209]) by smtp.gmail.com with ESMTPSA id w6sm3357580itc.43.2017.11.08.23.57.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Nov 2017 23:57:12 -0800 (PST) Subject: [PATCH 4/13] scsi: arcmsr: replace constant ARCMSR_MAX_FREECCB_NUM by variable acb->maxFreeCCB that was got from firmware From: Ching Huang To: martin.petersen@oracle.com, James.Bottomley@HansenPartnership.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, jthumshirn@suse.de, hare@suse.de, dan.carpenter@oracle.com, hch@infradead.org Date: Thu, 09 Nov 2017 07:57:05 +0800 Message-ID: <1510185425.4523.70.camel@Centos6.3-64> Mime-Version: 1.0 X-Mailer: Evolution 2.32.3 (2.32.3-37.el6) Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ching Huang replace constant ARCMSR_MAX_FREECCB_NUM by variable acb->maxFreeCCB that was got from firmware Signed-off-by: Ching Huang diff -uprN a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h --- a/drivers/scsi/arcmsr/arcmsr.h 2017-08-04 11:19:22.000000000 +0800 +++ b/drivers/scsi/arcmsr/arcmsr.h 2017-08-04 17:07:52.000000000 +0800 @@ -836,6 +836,7 @@ struct AdapterControlBlock atomic_t ante_token_value; uint32_t maxOutstanding; int vector_count; + uint32_t maxFreeCCB; uint32_t doneq_index; uint32_t ccbsize; uint32_t in_doorbell; diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c --- a/drivers/scsi/arcmsr/arcmsr_hba.c 2017-11-08 18:48:46.000000000 +0800 +++ b/drivers/scsi/arcmsr/arcmsr_hba.c 2017-11-08 18:50:28.000000000 +0800 @@ -688,7 +688,7 @@ static int arcmsr_alloc_ccb_pool(struct acb->host->max_sectors = max_xfer_len/512; acb->host->sg_tablesize = max_sg_entrys; roundup_ccbsize = roundup(sizeof(struct CommandControlBlock) + (max_sg_entrys - 1) * sizeof(struct SG64ENTRY), 32); - acb->uncache_size = roundup_ccbsize * ARCMSR_MAX_FREECCB_NUM; + acb->uncache_size = roundup_ccbsize * acb->maxFreeCCB; dma_coherent = dma_alloc_coherent(&pdev->dev, acb->uncache_size, &dma_coherent_handle, GFP_KERNEL); if(!dma_coherent){ printk(KERN_NOTICE "arcmsr%d: dma_alloc_coherent got error\n", acb->host->host_no); @@ -700,7 +700,7 @@ static int arcmsr_alloc_ccb_pool(struct acb->ccbsize = roundup_ccbsize; ccb_tmp = dma_coherent; acb->vir2phy_offset = (unsigned long)dma_coherent - (unsigned long)dma_coherent_handle; - for(i = 0; i < ARCMSR_MAX_FREECCB_NUM; i++){ + for(i = 0; i < acb->maxFreeCCB; i++){ cdb_phyaddr = dma_coherent_handle + offsetof(struct CommandControlBlock, arcmsr_cdb); switch (acb->adapter_type) { case ACB_ADAPTER_TYPE_A: @@ -1431,7 +1431,7 @@ static void arcmsr_remove(struct pci_dev arcmsr_abort_allcmd(acb); arcmsr_done4abort_postqueue(acb); - for (i = 0; i < ARCMSR_MAX_FREECCB_NUM; i++) { + for (i = 0; i < acb->maxFreeCCB; i++) { struct CommandControlBlock *ccb = acb->pccb_pool[i]; if (ccb->startdone == ARCMSR_CCB_START) { ccb->startdone = ARCMSR_CCB_ABORTED; @@ -3243,6 +3243,9 @@ static bool arcmsr_get_firmware_spec(str else acb->maxOutstanding = acb->firm_numbers_queue - 1; acb->host->can_queue = acb->maxOutstanding; + acb->maxFreeCCB = acb->host->can_queue; + if (acb->maxFreeCCB < ARCMSR_MAX_FREECCB_NUM) + acb->maxFreeCCB += 64; return rtn; } @@ -4265,7 +4268,7 @@ static uint8_t arcmsr_iop_reset(struct A rtnval = arcmsr_abort_allcmd(acb); /* clear all outbound posted Q */ arcmsr_done4abort_postqueue(acb); - for (i = 0; i < ARCMSR_MAX_FREECCB_NUM; i++) { + for (i = 0; i < acb->maxFreeCCB; i++) { ccb = acb->pccb_pool[i]; if (ccb->startdone == ARCMSR_CCB_START) { scsi_dma_unmap(ccb->pcmd); @@ -4373,7 +4376,7 @@ static int arcmsr_abort(struct scsi_cmnd } intmask_org = arcmsr_disable_outbound_ints(acb); - for (i = 0; i < ARCMSR_MAX_FREECCB_NUM; i++) { + for (i = 0; i < acb->maxFreeCCB; i++) { struct CommandControlBlock *ccb = acb->pccb_pool[i]; if (ccb->startdone == ARCMSR_CCB_START && ccb->pcmd == cmd) { ccb->startdone = ARCMSR_CCB_ABORTED;