Received: by 10.223.164.202 with SMTP id h10csp1244437wrb; Sun, 26 Nov 2017 23:11:58 -0800 (PST) X-Google-Smtp-Source: AGs4zMaYOdVmmlaFtG43Fc/EZOfRF89FVVhS379E8+TZNFrYreecuDvVVHQ6+xhBx9fTip5+Sf3l X-Received: by 10.84.230.135 with SMTP id e7mr36137580plk.299.1511766717895; Sun, 26 Nov 2017 23:11:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511766717; cv=none; d=google.com; s=arc-20160816; b=cyaQLRCGP7WXZHE78bXDQS1mNZaufaPFEuWCfcD9mPv+v2MmrppvYBJxukUclxgWhM FscgqzkkGnqtljPLfin80JAKSWRIXYI1esHIOkKP724dx7kxZLdlKGe44S6Ea0/E4R2J N/ccpL8hqA0UNfFiUi/yjwQVFSSnC2H6yQB0vupfMVbvX6w3t0CPahwVPw9F10qP9syX LlHEyhqx7SZS+X1/EYKKVngMEoc5Ih6owBhIb6WRu2BHVrqYYIL+8FAjySZ+W5fWKJ/i ZnVJx2tS6xQQN6VR+o+6cVxDlWLeVVnn8UnmMO6ZWcDu1COnnnVl0ULGAyqKW1TUgIga EwsQ== 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=KpPVehFEvqd7cKJMwyRJdTTs1iDU9fvo3KI6P1qR6Q0=; b=ciYoKrCXPUT2b4vYsuUwkBI2h8rLDFtL0kzrrsx+CF1XDLZHhVX54EXQrSvK+dCrQY pl1jYF54o8Y5chNE5OF+D93RZVXJPlCne5K74FRWTDw8fOiDZ16xjdduHCauocOGSZdU ZbSu+5CAVFoeIIPMaVNs20tWAadYFPFJ19WGJdfAFvZt40FI2f3Fs2sbkEepDMLWCE26 27yueUVkdDybCcPSVFNXtD8jFPalqE/RcDHsIrkBV2iyKwF/23LJCaCAzfFQbz+Ddyzi b13gT1ParcxqNjFx+NXDIgV9bo9UwfPHDxyPf+1VHiLlXZeCngbicg8P5zVyyaKawRAF a/Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector1-xilinx-com header.b=rw6KnpUB; 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 g34si16125862pld.328.2017.11.26.23.11.46; Sun, 26 Nov 2017 23:11:57 -0800 (PST) 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=rw6KnpUB; 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 S1751511AbdK0HKi (ORCPT + 78 others); Mon, 27 Nov 2017 02:10:38 -0500 Received: from mail-sn1nam02on0088.outbound.protection.outlook.com ([104.47.36.88]:53662 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751180AbdK0HKS (ORCPT ); Mon, 27 Nov 2017 02:10:18 -0500 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; bh=KpPVehFEvqd7cKJMwyRJdTTs1iDU9fvo3KI6P1qR6Q0=; b=rw6KnpUBiSC0kH2vrHIEvfOFWv34IAymBYkKb7yoZSyKrQApZMCamPmhO9w926xh/zVmK49KOAhdlG+JbuqdaLDLa2KyT4sHkszRidOns5ovkwiLAnt3uR7jHap8uh7W5mePvcgKNw8EMeoQ72HNEZ1zsvwqvwxCTC+e6gdf/7o= Received: from SN4PR0201CA0059.namprd02.prod.outlook.com (10.171.31.149) by MWHPR02MB3278.namprd02.prod.outlook.com (10.164.187.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.4; Mon, 27 Nov 2017 07:10:15 +0000 Received: from BL2NAM02FT054.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::209) by SN4PR0201CA0059.outlook.office365.com (2603:10b6:803:20::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.260.4 via Frontend Transport; Mon, 27 Nov 2017 07:10:15 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.100) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.100 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.100; helo=xsj-pvapsmtpgw02; Received: from xsj-pvapsmtpgw02 (149.199.60.100) by BL2NAM02FT054.mail.protection.outlook.com (10.152.77.107) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.239.4 via Frontend Transport; Mon, 27 Nov 2017 07:10:14 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:43613 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1eJDYT-0002LP-Nz; Sun, 26 Nov 2017 23:10:13 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1eJDYT-00046m-IL; Sun, 26 Nov 2017 23:10:13 -0800 Received: from xsj-pvapsmtp01 (mailman.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id vAR7A6bd003499; Sun, 26 Nov 2017 23:10:06 -0800 Received: from [172.23.37.92] (helo=xhdharinik40.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1eJDYM-0003vl-87; Sun, 26 Nov 2017 23:10:06 -0800 From: Harini Katakam To: , , CC: , , , , "Edgar E. Iglesias" , Michal Simek Subject: [RFC PATCH 2/2] net: macb: Tie-off unused RX queues Date: Mon, 27 Nov 2017 12:33:58 +0530 Message-ID: <1511766238-1710-2-git-send-email-harinik@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511766238-1710-1-git-send-email-harinik@xilinx.com> References: <1511766238-1710-1-git-send-email-harinik@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.1.0.1062-23492.006 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.100;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(39860400002)(346002)(376002)(2980300002)(438002)(199003)(189002)(316002)(2906002)(76176999)(51416003)(33646002)(50986999)(7696005)(63266004)(305945005)(356003)(50466002)(8676002)(81156014)(50226002)(16586007)(9786002)(189998001)(106002)(77096006)(54906003)(110136005)(48376002)(39060400002)(106466001)(5660300001)(478600001)(2201001)(107886003)(4326008)(81166006)(36386004)(6666003)(36756003)(8936002)(2950100002)(47776003)(107986001)(5001870100001)(217873001);DIR:OUT;SFP:1101;SCL:1;SRVR:MWHPR02MB3278;H:xsj-pvapsmtpgw02;FPR:;SPF:Pass;PTR:unknown-60-100.xilinx.com,xapps1.xilinx.com;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BL2NAM02FT054;1:5t+C7LJ/GsPm7JFduUKhmjcbhY730pwAlTVxTt+UV9M19Z0CL7CjWg99X61IZ4ZZkh4jeH7uBfWXTsvaWoYvYIo8WL6DlxEj7I8LMbuTOeNKGQZjoL3OKVuxNyVXmnJv MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c920e18a-d339-4164-4124-08d53565e83c X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603199);SRVR:MWHPR02MB3278; X-Microsoft-Exchange-Diagnostics: 1;MWHPR02MB3278;3:qaCKakBKNBv2q7oXyUTtzwtdU5BWzdTfI6V5qPhaL40+g7PovsywaAS8dLEzyb+cuDT8hFBKqeTY9ya7Bs+xlGtGB+owvPP8TfzkNWfXqDXQRwCgtJn3D3CxtEzT2CVJ7bWSB6fpFfPHmklJ3E2RAyxwlfoC6lVEjXC1w2MpdIGMy6VzIt3Ao5yFbaFefgs/nXWHAtlK+GAvtzGG+dFQDQNgvkTvxH6LXu98IeBhRM3gttDAFWzPLJAdmKlp9a4QHqMoUuvJs8T5KzbY7xPRCqRh+5f0Qoq3hKEglRYicrA5XGmk/NvCspVHXdsyIBzG1uawCSKrG89V95ySEM2zj5AMG9CCfcvcXEi3QAk0ic8=;25:jEf9T8RaZtEPo05L1fZcMKND6bB76rBKb0Ia+/prl1KpKySu1e+zJivZPzxgfQ50AasDcgKp3GXtoP56sDwOGMCc5buOwursQOaYTx8jY2HOxVIsqp364Crw3hPVmZ6IEd46GzyFGMGmdKlVnnDHX0KWK5ZP/uNSaBnwgC3IqiHAyOOim5H3bLQ0+Fc1cCIAVmpIdgKOcsNyZD7UZxd7LInoz79/mKAWt1F6bTx7f9rzOfn0UPBBHt2uT5i7U7xfTgBy8HePm09uX+l3lZ/gbYGdwNB4Emwhmm+EAv62zAZYQ/HP4orgN6mzjgyLSLZQP0qzmh1ThlEezx3Z7w58AA== X-MS-TrafficTypeDiagnostic: MWHPR02MB3278: X-Microsoft-Exchange-Diagnostics: 1;MWHPR02MB3278;31:672yoXX+hKI60dYiZRNBOuFSHGKEgrAg0h5pfwfX0GkVL0Ikz+Wt/y1I+dOLA/bv4A+/T5w0fIWsfzOgqHR/SZm2FVrdICAdgRUHjfntiGq5i+BKnvGmXYM6aiTqKeekWiCuy+/++zYZZYhA2x09DXMvap7EcI8MM5mpUEjIwYc2jD/P6pZOLjNgIc32hxYqu3UUX7pv3h9su18hSzvS8AqpUphzJaXSBpX+xLUZdCE=;20:tE8wSxzKtX+HUd2qCNXtUsV0Z31KxZ0UITTVB/saXeWcI5Y5e34ccRnBlyNG391WApk2Y4kaJrQ5IVfvxXhjQ3QStZVBg6XBURkDScWtQwXgVAcyHE7NG8LndzXIyf1VEKHFxworuuO2y6XJv+4Tnku9JLXn54IJ+tTVOrSm3g6aLa3oQctcyGmrrGdlbkVB0Vsul2auanW4bIaIZqObrokPa44AHZJRnyL7F/QDu6Pp189p47Hbo7UVlX7P6oFFDYKB3J4KbU7cPu6iT+3F5RA+0Z8oBz6NYs1pJPllrqErLrduw7B8+Qi7kg3o0y8orcn+tOIls6zFzD+E+6S612DVOame+vOFOb0hUEvSpfGUqKCST7dRYteN5WCNQVxka7/sRLAGxp0zCNnR+wq8fZHg2ZjEwapqOCQuhe+W0s+3dGOY+V9+eNAuwj+tGfINVX/P9SQ1taG6hnhpeoQwWAT++okuddPmFs5XyGZxt5Zirn0Ur/oV68v4iXSsqtJp X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(2401047)(8121501046)(5005006)(3002001)(3231022)(93006095)(93004095)(10201501046)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123564025)(20161123555025)(20161123558100)(20161123562025)(6072148)(201708071742011);SRVR:MWHPR02MB3278;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:MWHPR02MB3278; X-Microsoft-Exchange-Diagnostics: 1;MWHPR02MB3278;4:Kbqv6gxjmE1WwJPhItrlFTpTUkEYHYtwwkPziD/eLIVZC0qK81+sGbN6Xr3BW8kGR8NxhNQhgfWLqElwBanQ1/YdxANE4Aqs43SfV07TRhx36t6NZx6E1x8RYuNJdyYzUwHVlP7IWOTMvTdWjpKHL3j2uHszCiR/HOycSrcxO93m555vzP2BZnKtYFhHFygpTpgINvIaUrEn25xzesrjc+mlV3CNgfNXK1C2TUrjF57m0L/jzeeYD5Up+9h9SULU45iyPgJOjn0Stdrafm8frUB8FVzoxjb8ORUcGEB8Cq4pgv4H132WlgFEXE54ScRZ X-Forefront-PRVS: 0504F29D72 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;MWHPR02MB3278;23:KVKlZtz+k6/XWca1gQBkHGIBukicUsQmWB0SbO7DM?= =?us-ascii?Q?ufTplVX+2sV4P4WkpDYp3E+WtaV+a/R7amzwua53KnOi10R3hjlh1BPyV96s?= =?us-ascii?Q?6j9SzT3RbDiRXZ86KkYn52wNSVbinXEHcfFb92mc6SSsIq+VKY+3Mg/r/joM?= =?us-ascii?Q?9GvD9DKOxO7rDMxXTJaB5hfpF0rMgHV0X73/32oBjfzZCk0TSuSjqjdK3um9?= =?us-ascii?Q?E6llQvb1qqnFCj2Gbc4FJBRQkoBiRB0zjXbhW/TTR+YrnzJPgPXPDZSJvC4T?= =?us-ascii?Q?BULLWZIfN0kRhEEcr0jH7xpFGdcFQ/Voaw/kwN3nciNMfZtVSiuFzhi2AcJa?= =?us-ascii?Q?ycSQRvTjtzcTuqARlcDB39v3JpN0+M6mmXgCzD2vs6lzpd/6xP8uUQYfNZTx?= =?us-ascii?Q?9c1rr6UfnB6zY29W8xd+3nekOm8/IWSXI7CGwe+mZEtQnXMnHv00fhRObWJA?= =?us-ascii?Q?c3iWcUuinb3QqfG0//iMY7gKVJ8n0UHSpt7yJHS4qxqGfdlpKNfwKpJ8phT7?= =?us-ascii?Q?R2P4Hzove7X7Lg54/+htLof2rIhRCZqWDlGeTe7Xy+UBnduBM9DvN5/Z4LIy?= =?us-ascii?Q?nTp7A3Gqxy4WyGHk45J5R6FDjG+iz8HsHT5ofY5INiX1MpEtYqWLDaUioMBn?= =?us-ascii?Q?OM22yGWQ2Qrp15UsBOmNb9KN9ACWiyIja7kltezVw+nmEqIn0XFhsBmChtiX?= =?us-ascii?Q?L/RNiubaHHK2aOtp6HLexMXLk2Fw27rDk7qMXcC7sU1O6qfLB585rF3ya5Na?= =?us-ascii?Q?Oii/l7sNhhN/ryiVKkSd1IsGKQOWrueZCkNQgzhiEBgEp8MDIaOxn2T0dqt4?= =?us-ascii?Q?5gxdI5m2+QsfwVBxAtLfNMiPPZcptMOF/PL/Coft1WicIG70t9VTXdln32K/?= =?us-ascii?Q?L+zmytkyfY/QbIy7+rBAoHaMHqy+QAgY8sRSuaw+FLfFYfXklWhk6sZLHk+Q?= =?us-ascii?Q?XqMTJwS0hjvAb2lBsyzIERTNAqtbceyFQW9QTxY2VS7H73c/iJjn7TWbpLJH?= =?us-ascii?Q?fVMg1Yr2behYKUgf2B7xH1NjtGIfIZn+vH411xj1hoPJRHTx1echGdKBEfYe?= =?us-ascii?Q?lnDnHGv6h/Tj5NFsz9XnVDB2bK+2DZ9+mJ0f0hGUb1/eY4Ont9y5rPiX3+MT?= =?us-ascii?Q?UL3K2i0bx8=3D?= X-Microsoft-Exchange-Diagnostics: 1;MWHPR02MB3278;6:BpDCKjqZD+QvHUDc6Hn48Q53OhX8Gc7/ar3sM7tYhF93FWSOxYrJffLOv99okuD2rFKd0RxVPIjX21RM1unX5/n3xgDkw2BUxW0ZteoZTd9fWAq+Gi2cwpeKlmKpOAwgx5YwcH74PNW8F6JMvficntvxQ1n6juenNlJgzW2FRqvUgnIdroryZDVZEzgEttDwY3p6vI+RMYUKJKAcvbwcqJRu9sW4jOmM9zQkLBHCNZRdzaCeC8oabzUi27AiN9E87C/j4OLNtvTMae+XrMO1XwmvFKoxvF34kzUG0NVfrIzBN7VqWiAQXOf6j9ewTYpImxJC0Cdsl5TX9hqwsE/PR6lMcaBED1xeHyhZATPdaGI=;5:YorL42PdqRsVH64cDJ5jVcEho6iBa0pm+lU2TEiBE7me6WvFsMC9Zf/5Zdj0F1Br+QVqJlzqwjag65uxWZdb9K3mJOij3ckmjvTBHMuD4rNti65SMXUqrZNh3PIkYZJ4G5WRtP26RQUKt0AceSAJKsB/n2aySRDLtph5cSsb8DM=;24:4qLr0Q5D0PTmScLIqQo8Z9w/th/k7urkVsfGEv5TeX+TgJORAtiNlvp502es4aMT4/mn7ufoI4B1eFKYvz9/VW4wHBzCkyRMHAX6lDKKg3Y=;7:qSpe9sDT5FokKppHcCMHG+yFkueL/mi5pFmvurgkjoyKV0b+EjKhWkqqx5Q1f9VtMcUBbvnIfRDOEcNnN5xsnCmm+PJGh/s4VGOHn5m3e/CWBxYvOT51TC2GHhw+SrD8VN11pT+ijpKkWPZCvMBAvQteRLtexK4125PK7qVc2mkDB+tghWXVfasmRFt1W7mUEz4CbkoqU456i252LCGgkn9GAyb065qZCYJ9BBax53bZr26R5lCNidBzM8Fc+aM8 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2017 07:10:14.4368 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c920e18a-d339-4164-4124-08d53565e83c 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.100];Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR02MB3278 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Edgar E. Iglesias" Currently, we only use the first receive queue and leave the remaining DMA descriptor pointers pointing at 0. Disable unused queues by connecting them to a looped descriptor chain without free slots. Signed-off-by: Edgar E. Iglesias Signed-off-by: Harini Katakam Signed-off-by: Michal Simek --- drivers/net/ethernet/cadence/macb.h | 2 ++ drivers/net/ethernet/cadence/macb_main.c | 42 ++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index acb6578..974c801 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -994,6 +994,7 @@ struct macb { unsigned int rx_tail; unsigned int rx_prepared_head; struct macb_dma_desc *rx_ring; + struct macb_dma_desc *rx_ring_tieoff; struct sk_buff **rx_skbuff; void *rx_buffers; size_t rx_buffer_size; @@ -1019,6 +1020,7 @@ struct macb { } hw_stats; dma_addr_t rx_ring_dma; + dma_addr_t rx_ring_tieoff_dma; dma_addr_t rx_buffers_dma; struct macb_or_gem_ops macbgem_ops; diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 623ae9c..b14a04d 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -1755,6 +1755,12 @@ static void macb_free_consistent(struct macb *bp) bp->rx_ring = NULL; } + if (bp->rx_ring_tieoff) { + dma_free_coherent(&bp->pdev->dev, sizeof(bp->rx_ring_tieoff[0]), + bp->rx_ring_tieoff, bp->rx_ring_tieoff_dma); + bp->rx_ring_tieoff = NULL; + } + for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) { kfree(queue->tx_skb); queue->tx_skb = NULL; @@ -1826,6 +1832,19 @@ static int macb_alloc_consistent(struct macb *bp) &bp->rx_ring_dma, GFP_KERNEL); if (!bp->rx_ring) goto out_err; + + /* If we have more than one queue, allocate a tie off descriptor + * that will be used to disable unused RX queues. + */ + if (bp->num_queues > 1) { + bp->rx_ring_tieoff = dma_alloc_coherent(&bp->pdev->dev, + sizeof(bp->rx_ring_tieoff[0]), + &bp->rx_ring_tieoff_dma, + GFP_KERNEL); + if (!bp->rx_ring_tieoff) + goto out_err; + } + netdev_dbg(bp->dev, "Allocated RX ring of %d bytes at %08lx (mapped %p)\n", size, (unsigned long)bp->rx_ring_dma, bp->rx_ring); @@ -1840,6 +1859,19 @@ static int macb_alloc_consistent(struct macb *bp) return -ENOMEM; } +static void macb_init_tieoff(struct macb *bp) +{ + struct macb_dma_desc *d = bp->rx_ring_tieoff; + + if (bp->num_queues > 1) { + /* Setup a wrapping descriptor with no free slots + * (WRAP and USED) to tie off/disable unused RX queues. + */ + d->addr = MACB_BIT(RX_WRAP) | MACB_BIT(RX_USED); + d->ctrl = 0; + } +} + static void gem_init_rings(struct macb *bp) { struct macb_queue *queue; @@ -1862,6 +1894,7 @@ static void gem_init_rings(struct macb *bp) bp->rx_prepared_head = 0; gem_rx_refill(bp); + macb_init_tieoff(bp); } static void macb_init_rings(struct macb *bp) @@ -1879,6 +1912,7 @@ static void macb_init_rings(struct macb *bp) bp->queues[0].tx_head = 0; bp->queues[0].tx_tail = 0; desc->ctrl |= MACB_BIT(TX_WRAP); + macb_init_tieoff(bp); } static void macb_reset_hw(struct macb *bp) @@ -2063,6 +2097,14 @@ static void macb_init_hw(struct macb *bp) queue_writel(queue, TBQPH, upper_32_bits(queue->tx_ring_dma)); #endif + /* We only use the first queue at the moment. Remaining + * queues must be tied-off before we enable the receiver. + * + * See the documentation for receive_q1_ptr for more info. + */ + if (q) + queue_writel(queue, RBQP, bp->rx_ring_tieoff_dma); + /* Enable interrupts */ queue_writel(queue, IER, MACB_RX_INT_FLAGS | -- 2.7.4 From 1586382173253971996@xxx Sun Dec 10 07:45:34 +0000 2017 X-GM-THRID: 1585818026281513739 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread