Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1451627imm; Thu, 5 Jul 2018 23:50:31 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfiOXKIkciAGl55lcQm0PvefSyNVzFVbZj4xnktLPol4sv9w0JNmqugQkJamVhSzNwKEeTl X-Received: by 2002:a62:e0d5:: with SMTP id d82-v6mr9401008pfm.59.1530859831668; Thu, 05 Jul 2018 23:50:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530859831; cv=none; d=google.com; s=arc-20160816; b=cfxCvpKh/DGdKOZV1a+gHcXx+s5j5olZxCPk6PPuZyWF7wJxMd0V5P0sd83sSGu1N3 1qFtdsXhX2nWSFIdNIsuvmEW7wGGPSCtgbLJkpziV4prEsrMvR73BzARnQbDbkKTZZ/m hY5MXKL+JQf3ElFXJIyBySTDs4O1JgtwcKeg9mYmUZfD2cSUaPbM0UFlMn5s4UIC9otA FlF9iR89AppoSBJMjLY6rjinAzPPHpshoxhEuB57ocYijRhOGV/Q9EftXxLXFnmnx3b+ 7uZiSuEIR3Zv96PTA7bO+P+XMbCDZyY79W8he6JiJzwunZ1EpC3gZC8fBGDkwCN5uscV J+hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:arc-authentication-results; bh=NTFYRDJzL4FbkReX5Ah9/X0XDadDa8fqPSP/0cK+tYs=; b=fa+hfNNKZSW+1BhFi3NzpqK3Ih/r5U9Tsov775zENlZ4YbFBNAfn4eUHloI6aLyFhw 1TwVQxjjrndM8DrH1hrBLmadsyeMPoykbTpCiBI1FcHvwnjC9XwM4+t7IW297jAKO9LR ESVLqqMkdUpfJn9Y9QxpCcSHRcbqAMP3bTpS1URrqgS4QC+ToJJ6RHFA6Tv/ZfPd4dB9 0RHJAhvZ4WkGziLm5z9UEcn7h88oabK3rxgRD+tyOHWCPJH8CBlpld8uinF2oQhNPhb6 41saOOQP45AUr3wqAnhZOtmFlSJVzm5HRACb/+zJu3icnbOmiu3FWT5mVx9FeyQj/ugr bFSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector1-xilinx-com header.b=hqKbWwn+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z77-v6si8165527pff.100.2018.07.05.23.50.17; Thu, 05 Jul 2018 23:50:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector1-xilinx-com header.b=hqKbWwn+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754121AbeGFGt2 (ORCPT + 99 others); Fri, 6 Jul 2018 02:49:28 -0400 Received: from mail-sn1nam02on0078.outbound.protection.outlook.com ([104.47.36.78]:24058 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753814AbeGFGtZ (ORCPT ); Fri, 6 Jul 2018 02:49:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NTFYRDJzL4FbkReX5Ah9/X0XDadDa8fqPSP/0cK+tYs=; b=hqKbWwn+nARzpotMOMEYa+yEdHznDAHHHUKmFH3z6bFPZ0+ruC+roJYurfsYkUhdrDVULfXppoxxFwwZ6p90PXj4D2FMFYgB1WQ0Z2jq1IXn8mS/hEVHBoPF7Kcr/rff7jMveRmyhdAUSvEFhxCxueMpVDlxemcXdJy2e70QTwI= Received: from MWHPR0201CA0007.namprd02.prod.outlook.com (2603:10b6:301:74::20) by MWHPR0201MB3514.namprd02.prod.outlook.com (2603:10b6:301:77::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.24; Fri, 6 Jul 2018 06:49:22 +0000 Received: from SN1NAM02FT038.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::205) by MWHPR0201CA0007.outlook.office365.com (2603:10b6:301:74::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.930.19 via Frontend Transport; Fri, 6 Jul 2018 06:49:22 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by SN1NAM02FT038.mail.protection.outlook.com (10.152.72.69) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.906.15 via Frontend Transport; Fri, 6 Jul 2018 06:49:21 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1fbKYT-0004Yy-GU; Thu, 05 Jul 2018 23:49:21 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1fbKYO-0002ZS-Dc; Thu, 05 Jul 2018 23:49:16 -0700 Received: from xsj-pvapsmtp01 (xsj-pvapsmtp01.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id w666n7H9004746; Thu, 5 Jul 2018 23:49:07 -0700 Received: from [172.23.37.92] (helo=xhdharinik40.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1fbKYF-0002WH-2q; Thu, 05 Jul 2018 23:49:07 -0700 From: Harini Katakam To: , , CC: , , , , Subject: [PATCH v2 2/2] net: macb: Allocate valid memory for TX and RX BD prefetch Date: Fri, 6 Jul 2018 12:18:58 +0530 Message-ID: <1530859738-11802-2-git-send-email-harini.katakam@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530859738-11802-1-git-send-email-harini.katakam@xilinx.com> References: <1530859738-11802-1-git-send-email-harini.katakam@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(39860400002)(136003)(346002)(396003)(376002)(2980300002)(438002)(189003)(199004)(486006)(2906002)(6666003)(81156014)(106002)(81166006)(36756003)(8676002)(50466002)(8936002)(9786002)(36386004)(5660300001)(54906003)(110136005)(356003)(305945005)(316002)(50226002)(63266004)(2201001)(16586007)(478600001)(106466001)(4326008)(76176011)(51416003)(7696005)(48376002)(47776003)(336012)(26005)(14444005)(77096007)(186003)(11346002)(126002)(476003)(426003)(446003)(2616005)(44832011)(39060400002)(107886003)(107986001);DIR:OUT;SFP:1101;SCL:1;SRVR:MWHPR0201MB3514;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-83.xilinx.com;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;SN1NAM02FT038;1:dCODEgfAzQV6VBi8XfR85sfXOo/dJ34F2vT8nmLz8sgqFXLiZQVUakHjkdCkOpwEL5n32+dsAKe0lrM1q0ZCy2yTuLcOugf6DRJlzhCZIq1AHkqlrJM8B7kX3R/Th90m MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7cee2df7-3dd7-44ed-b12a-08d5e30c9af4 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4608076)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060);SRVR:MWHPR0201MB3514; X-Microsoft-Exchange-Diagnostics: 1;MWHPR0201MB3514;3:MaSN8JgX5DTZptu8bN0+emcLBlA7polSJ4qbfR+RUXNTNfilBiMoIjeBsPn4x01zdr6S+HlLmvz4TrmN2rDuiOGZIlElYOi/CA1adSbo7dLPLRGurqYlKrUiB/XL2dIudXTuBtQFqT6mQ2/1u9tbJVe1cFmE9VIUTDEohju3SqeWyUf6rPenA6sHd+bfjKCOxFUXR87G81AxB4WtvJmq8gttbgXJgscIfYa/ijvyJC0f1Y1Kl9BumB68BI8c6y4q4KnHrvLYyxBlIj6vWyewa0p2twJm5/pCG7ONKrj9gcLguESEjy0g2tr+D6X/Ay0/yi2h+yo28GgeAovh8Uj9R+Vh7MpGJiip1Nzumn+Udnc=;25:oqMY4182xN62gnXJlLnhJ//ji913FCT/yBWphHrIzHgNXheW2zaCdTCeuFw0dAwXz7Co47oDk3YfsE+TXVp6lB1/IumtQ1+NuxIfhisFWqbZSab0rO/2MgcdGiLH4PxciM3gSEX0QCLNyRI+9spH1bmw+xhXN0MYpuYo1augsZalq7gDK5fhHosY7ydeUVzxMMhoJFdbBzErBy1NwGlrfeWuovCtBJXIOOxXz/1d8LaHzq/DBRYFFcsJU0mAIiRO7Ks3zzRUaG1P0s/SmZgAou0LRXlZg1kTKPlGfN+vICU7mMg/O8h22dOXg1imq8/eio3+BOwfz/3g3vc4it+khg== X-MS-TrafficTypeDiagnostic: MWHPR0201MB3514: X-Microsoft-Exchange-Diagnostics: 1;MWHPR0201MB3514;31:cZdJ24vngkeHSygwBWTWBGs5D7LVpfgkCt0QfL3EUZcLnw0Wqkns7YpSX5bjDb+VNnjTFAzX10X58fXOkprDCR0ghWpbJShH95Ouy8M+o3Yq0Hheb2Mnp47+Gb4GjqGovE/ITOheU3jNQdLAv1SRSYTuhKluZBtfgPBGr1b4hx4f+V2UemO/6XLTXxSKMoqA9Kv+rTRzD5EzVxZ/T54JOiXokTzX4IzBiPR6vuyj2oo=;20:0E+LXKQ1kjynkBf5LU1pUM+R7HTHUmMGyXgL/m0Tdmb+gcpf90r/Rld2KVdd3pKkJz1CUt2fT+u16WLdKXojbAX4UkSdAxSHUYUNfuIosN2wf6jGpX/Xz3CaSsFkY/pSjqnFMsX4opCPuf+4PWkgOPhIntEUK5snuV0ejUYZj0N86FnmtOpPZ4jzkg2tXAck8pPK5K9p/mXP/Upy4+FMxWuoj01kcte2gM09JfClv8GbIN/Ahrvr3+Mwr22FdunPBsWU7Vt7aYvUrjQXu1gx8jAb/sQbpl/p5dK9KPc5Oev7UuIVQYw5KIODPJYqEt3AIqFOcJgrkFgXgAbX8nmm6cyO8vYJ1Kl1vd+OR14cPfKq0jwjoAoZQAzJ3lDvqWkIpF7hdcJbNpuKy/DTZqIWkL0zA0XkZZKvdWFiYXGJgNieoRcxGeBk8diFbj8OdIdUqKsIm+OvImgdf2U/3ztnsxlFJfTm2VMtIpIwFSC0f1DxogpRZw4PWoK1ToRdNKjz X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231254)(944501410)(52105095)(93006095)(93004095)(6055026)(149027)(150027)(6041310)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011)(7699016);SRVR:MWHPR0201MB3514;BCL:0;PCL:0;RULEID:;SRVR:MWHPR0201MB3514; X-Microsoft-Exchange-Diagnostics: 1;MWHPR0201MB3514;4:1htOGu9HBMEYufTW+9t9gJuc7EvHsL7Tv+/ik5utLPLoAvyqAunQ6VJaB8GJ/63jqX2mtlj1H3bcaIeyRxNb22hj83F9Y3ZfZi1GHwTEFVy1VXKmR8y/U1pSObYEVAYWx6zKzID0rGJu1ruONpmA7843sZAp2PVTZZ8d4ICGpl/DF+zsJkV/yTNnbLLplQbenVcofJLtta8qkyhrNUiAio0znUgUGAWt+dYdcxldMlAqNPHclLIvp18hUf1OEbbjPpQDAl/1mZ6gxY6ePOvRVuYOGYv7+u+L+tRPYqo438Np/ZoSpyre9qgzJ7RyNh0j X-Forefront-PRVS: 0725D9E8D0 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;MWHPR0201MB3514;23:3HdtnGOcDhYoYfF1NwugC+uuh1tOHA+sqAZZVa5?= =?us-ascii?Q?q+o1HhyKbQq4KW2NRkwNkjHH46xOZMPpH8yfAPkixZjiMZkP2dupUKF97jgS?= =?us-ascii?Q?gS0iPNI4lOY1us5QNAxcgaS3wK/ckfdTE934wNpYQGf+juwlliU6em7p0v2j?= =?us-ascii?Q?TWeCzMEDrhXPAupbzo9pDvP9ItceVdrMgSuBg0jkKxFnibR5r82jSZ/SefJP?= =?us-ascii?Q?JUaZYomNQjRBi3j0nl2LIg8mn80d1zXollGVdP93oHoWtmkjPG7sBkMN4szR?= =?us-ascii?Q?YhkTREPtRb1UYPjMlO6O02GpcJSBic85dgpRGtLJaqvveACJTUA2ofqnRFm8?= =?us-ascii?Q?FY9V6xrxnvcwdiTNGctu9YTK9DPfPVhZrMb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wpy9IoKYwRYuKg6MJcx8CbEUwFhIvOa5cUhEsQWWobc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;MWHPR0201MB3514;7:bXTSDHzRGfIIHTQK8dK1Jr+iODI/pEVUY1Z9HZaCscEk+q+szMb9qNxWZvAt6/yKUer/CT9iyYBPlBO+rTlMoylfZz7htyUbtH0xT6aa9XHcddF6x8Q56YnHttM7+gms67jOZVFisr7Sjw8hOG61RYD1p26SBjzY4gNxCyIjRT0WCyHojZBqDcPbsaavDtNjOAoh3r9O0yGcBwhTTHRzUaF0s5tWyc9C2o1dcj/89C1J+AJ1fRnxzoHfVeE6KWpk X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2018 06:49:21.8820 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7cee2df7-3dd7-44ed-b12a-08d5e30c9af4 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR0201MB3514 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org GEM version in ZynqMP and most versions greater than r1p07 supports TX and RX BD prefetch. The number of BDs that can be prefetched is a HW configurable parameter. For ZynqMP, this parameter is 4. When GEM DMA is accessing the last BD in the ring, even before the BD is processed and the WRAP bit is noticed, it will have prefetched BDs outside the BD ring. These will not be processed but it is necessary to have accessible memory after the last BD. Especially in cases where SMMU is used, memory locations immediately after the last BD may not have translation tables triggering HRESP errors. Hence always allocate extra BDs to accommodate for prefetch. The value of tx/rx bd prefetch for any given SoC version is: 2 ^ (corresponding field in design config 10 register). (value of this field >= 1) Added a capability flag so that older IP versions that do not have DCFG10 or this prefetch capability are not affected. Signed-off-by: Harini Katakam Reviewed-by: Claudiu Beznea --- v2: Suggested by Claudiu: - Renamed CAPS macro and variabled to indicate RD prefetch; renamed buff - Removed unecessary prefetch variable initialization Additional change: - Moved computation of BD prefetch bytes to one place in probe drivers/net/ethernet/cadence/macb.h | 11 +++++++++++ drivers/net/ethernet/cadence/macb_main.c | 27 +++++++++++++++++++++------ 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index 8665982..3d45f4c 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -166,6 +166,7 @@ #define GEM_DCFG6 0x0294 /* Design Config 6 */ #define GEM_DCFG7 0x0298 /* Design Config 7 */ #define GEM_DCFG8 0x029C /* Design Config 8 */ +#define GEM_DCFG10 0x02A4 /* Design Config 10 */ #define GEM_TXBDCTRL 0x04cc /* TX Buffer Descriptor control register */ #define GEM_RXBDCTRL 0x04d0 /* RX Buffer Descriptor control register */ @@ -490,6 +491,12 @@ #define GEM_SCR2CMP_OFFSET 0 #define GEM_SCR2CMP_SIZE 8 +/* Bitfields in DCFG10 */ +#define GEM_TXBD_RDBUFF_OFFSET 12 +#define GEM_TXBD_RDBUFF_SIZE 4 +#define GEM_RXBD_RDBUFF_OFFSET 8 +#define GEM_RXBD_RDBUFF_SIZE 4 + /* Bitfields in TISUBN */ #define GEM_SUBNSINCR_OFFSET 0 #define GEM_SUBNSINCR_SIZE 16 @@ -635,6 +642,7 @@ #define MACB_CAPS_USRIO_DISABLED 0x00000010 #define MACB_CAPS_JUMBO 0x00000020 #define MACB_CAPS_GEM_HAS_PTP 0x00000040 +#define MACB_CAPS_BD_RD_PREFETCH 0x00000080 #define MACB_CAPS_FIFO_MODE 0x10000000 #define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x20000000 #define MACB_CAPS_SG_DISABLED 0x40000000 @@ -1203,6 +1211,9 @@ struct macb { unsigned int max_tuples; struct tasklet_struct hresp_err_tasklet; + + int rx_bd_rd_prefetch; + int tx_bd_rd_prefetch; }; #ifdef CONFIG_MACB_USE_HWSTAMP diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index e56ffa9..c4d08a4 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -1811,6 +1811,7 @@ static void macb_free_consistent(struct macb *bp) { struct macb_queue *queue; unsigned int q; + int size; bp->macbgem_ops.mog_free_rx_buffers(bp); @@ -1818,12 +1819,14 @@ static void macb_free_consistent(struct macb *bp) kfree(queue->tx_skb); queue->tx_skb = NULL; if (queue->tx_ring) { - dma_free_coherent(&bp->pdev->dev, TX_RING_BYTES(bp), + size = TX_RING_BYTES(bp) + bp->tx_bd_rd_prefetch; + dma_free_coherent(&bp->pdev->dev, size, queue->tx_ring, queue->tx_ring_dma); queue->tx_ring = NULL; } if (queue->rx_ring) { - dma_free_coherent(&bp->pdev->dev, RX_RING_BYTES(bp), + size = RX_RING_BYTES(bp) + bp->rx_bd_rd_prefetch; + dma_free_coherent(&bp->pdev->dev, size, queue->rx_ring, queue->rx_ring_dma); queue->rx_ring = NULL; } @@ -1873,7 +1876,7 @@ static int macb_alloc_consistent(struct macb *bp) int size; for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) { - size = TX_RING_BYTES(bp); + size = TX_RING_BYTES(bp) + bp->tx_bd_rd_prefetch; queue->tx_ring = dma_alloc_coherent(&bp->pdev->dev, size, &queue->tx_ring_dma, GFP_KERNEL); @@ -1889,7 +1892,7 @@ static int macb_alloc_consistent(struct macb *bp) if (!queue->tx_skb) goto out_err; - size = RX_RING_BYTES(bp); + size = RX_RING_BYTES(bp) + bp->rx_bd_rd_prefetch; queue->rx_ring = dma_alloc_coherent(&bp->pdev->dev, size, &queue->rx_ring_dma, GFP_KERNEL); if (!queue->rx_ring) @@ -3794,7 +3797,7 @@ static const struct macb_config np4_config = { static const struct macb_config zynqmp_config = { .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_JUMBO | - MACB_CAPS_GEM_HAS_PTP, + MACB_CAPS_GEM_HAS_PTP | MACB_CAPS_BD_RD_PREFETCH, .dma_burst_length = 16, .clk_init = macb_clk_init, .init = macb_init, @@ -3855,7 +3858,7 @@ static int macb_probe(struct platform_device *pdev) void __iomem *mem; const char *mac; struct macb *bp; - int err; + int err, val; regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); mem = devm_ioremap_resource(&pdev->dev, regs); @@ -3944,6 +3947,18 @@ static int macb_probe(struct platform_device *pdev) else dev->max_mtu = ETH_DATA_LEN; + if (bp->caps & MACB_CAPS_BD_RD_PREFETCH) { + val = GEM_BFEXT(RXBD_RDBUFF, gem_readl(bp, DCFG10)); + if (val) + bp->rx_bd_rd_prefetch = (2 << (val - 1)) * + macb_dma_desc_get_size(bp); + + val = GEM_BFEXT(TXBD_RDBUFF, gem_readl(bp, DCFG10)); + if (val) + bp->tx_bd_rd_prefetch = (2 << (val - 1)) * + macb_dma_desc_get_size(bp); + } + mac = of_get_mac_address(np); if (mac) { ether_addr_copy(bp->dev->dev_addr, mac); -- 2.7.4