From patchwork Sat Oct 24 00:14:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Daney X-Patchwork-Id: 7479021 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B73FB9F1C3 for ; Sat, 24 Oct 2015 00:17:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E04B2209B5 for ; Sat, 24 Oct 2015 00:17:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1C298209B2 for ; Sat, 24 Oct 2015 00:17:18 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZpmUL-0004rZ-FN; Sat, 24 Oct 2015 00:15:13 +0000 Received: from mail-ig0-x233.google.com ([2607:f8b0:4001:c05::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZpmTo-00046G-UL for linux-arm-kernel@lists.infradead.org; Sat, 24 Oct 2015 00:14:42 +0000 Received: by igbdj2 with SMTP id dj2so25901941igb.1 for ; Fri, 23 Oct 2015 17:14:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7+mm6U0p6U1rvUcIWSDVMf9Vf/5YVVtoeNH91OhKodU=; b=uuqRGVMhIOENoBdUq4ZRgnxl966xYL3tFQ/InvBkIAfZhREa2kIlXhpzsX6O/BpnNR lAD/NkYNOsAT6CxYbAhGcVU/NdTVG0BITF5hJTqhoJnQvxwfx9wxlOsibeHlBaihXCun FY4Qy4iU/wDz9SrSWFBf1imN+LNAcwM1wE7vcKrrHdTKQnTOZd3Wgf2i/kAxG0GD49eh +PTup5NG5+PQX81TDSlegRDWQTuWBmLWMizI45Y1txIN2f6Q9IllIU3jZd3OHkvUAzfx 0DelWnZBYCbeSBB3bT8W29xtmiswwQmmDgn6CtDvhljWWqmKFRW7jn9d6gjJ2ZXlN6dC 9cyQ== X-Received: by 10.50.141.136 with SMTP id ro8mr7908936igb.11.1445645659843; Fri, 23 Oct 2015 17:14:19 -0700 (PDT) Received: from dl.caveonetworks.com (64.2.3.194.ptr.us.xo.net. [64.2.3.194]) by smtp.gmail.com with ESMTPSA id q32sm8771235ioi.24.2015.10.23.17.14.15 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 23 Oct 2015 17:14:18 -0700 (PDT) Received: from dl.caveonetworks.com (localhost.localdomain [127.0.0.1]) by dl.caveonetworks.com (8.14.5/8.14.5) with ESMTP id t9O0EEKW017378; Fri, 23 Oct 2015 17:14:14 -0700 Received: (from ddaney@localhost) by dl.caveonetworks.com (8.14.5/8.14.5/Submit) id t9O0EEfr017377; Fri, 23 Oct 2015 17:14:14 -0700 From: David Daney To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, Sunil Goutham , Robert Richter Subject: [PATCH 3/4] net: thunderx: Rewrite silicon revision tests. Date: Fri, 23 Oct 2015 17:14:09 -0700 Message-Id: <1445645650-17328-4-git-send-email-ddaney.cavm@gmail.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1445645650-17328-1-git-send-email-ddaney.cavm@gmail.com> References: <1445645650-17328-1-git-send-email-ddaney.cavm@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151023_171441_158310_655B1FD3 X-CRM114-Status: GOOD ( 15.71 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Daney MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: David Daney The test for pass-1 silicon was incorrect, it should be for all revisions less than 8. Also the revision is already present in the pci_dev, so there is no need to read and keep a private copy. Remove rev_id and code to read it from struct nicpf. Create new static inline function pass1_silicon() to be used to testing the silicon version. Use pass1_silicon() for revision checks, this will be more widely used in follow on patches. Signed-off-by: David Daney --- drivers/net/ethernet/cavium/thunder/nic_main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c index d6e3219..52e1acb 100644 --- a/drivers/net/ethernet/cavium/thunder/nic_main.c +++ b/drivers/net/ethernet/cavium/thunder/nic_main.c @@ -22,7 +22,6 @@ struct nicpf { struct pci_dev *pdev; - u8 rev_id; u8 node; unsigned int flags; u8 num_vf_en; /* No of VF enabled */ @@ -54,6 +53,11 @@ struct nicpf { bool irq_allocated[NIC_PF_MSIX_VECTORS]; }; +static inline bool pass1_silicon(struct nicpf *nic) +{ + return nic->pdev->revision < 8; +} + /* Supported devices */ static const struct pci_device_id nic_id_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, PCI_DEVICE_ID_THUNDER_NIC_PF) }, @@ -117,7 +121,7 @@ static void nic_send_msg_to_vf(struct nicpf *nic, int vf, union nic_mbx *mbx) * when PF writes to MBOX(1), in next revisions when * PF writes to MBOX(0) */ - if (nic->rev_id == 0) { + if (pass1_silicon(nic)) { /* see the comment for nic_reg_write()/nic_reg_read() * functions above */ @@ -998,8 +1002,6 @@ static int nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto err_release_regions; } - pci_read_config_byte(pdev, PCI_REVISION_ID, &nic->rev_id); - nic->node = nic_get_node_id(pdev); nic_set_lmac_vf_mapping(nic);