Received: by 10.223.164.202 with SMTP id h10csp1271570wrb; Sun, 26 Nov 2017 23:45:51 -0800 (PST) X-Google-Smtp-Source: AGs4zMYE9z9LFpJU3wDIqAIJzi/iuTOEcG4RJxbsXp091l52zaKwT8ixwelVXPRj8kUQcFn9ohnG X-Received: by 10.98.156.204 with SMTP id u73mr26709733pfk.8.1511768751793; Sun, 26 Nov 2017 23:45:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511768751; cv=none; d=google.com; s=arc-20160816; b=MdPpg1NYqzvqIAJAasL/DtT2z/uoqzpIUyOs/IS5fZcnNJdd9HsR8YssZJszZaPDsR +/R3KO4WwDaOAFoTdLbgQp+RQgqDOaLBwWK8RiXJ6SkrwYir8/BGktSVkg2XlInqlMRl kwdHp7ZsStVX/D80zs8q4bFjoy4gSGsX5IB/82LcmhzfFEVOO5kzxxIhRlT5vtDMuxHb 1dqMGCSgjVOraUs5AlqweL8ECHLJ171rNa56caFJeZWkOeY76eemGHfPP+ZS2RRLVAeq 2/+leil+ot/zR2tS7SCxDjzlMKjRNsPZTTLBSeenz9LlbHy9KNzcy4ogncN4KqorSDmW 1jPQ== 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=iSwrEFX3bufLbE0IRYrLCYmMr8m7t6h/0y7XdHDclXIKgqs14BkGkrF+c39ykMcFFR aqKo0+6BRvdopADagv7NWyFtlCphrBTFT1dtPnafGatxXgC8l/L5nFkPEaBJFX8PEmdZ gF1IZBApADIQxxbAfUyRM9mVOSl/b+BCpKHoBeBVnofkQ+D/qOdDcFNEOskTl4P2yKH9 NyZSuofDjenwIAvXNGa4rbGHWDpfsCr6Gc0DJa4gnsVv4abwrRU38dSH7dW7bcWWZ18+ GQOuOj+Xc87+f76UFtgijcVsfWvb1NiRkp4IKK7WTiNZRLiKGwWEwtnZKuQwfGq+mt5Z ikFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector1-xilinx-com header.b=rBhxWSjg; 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 m63si11813728pld.467.2017.11.26.23.45.40; Sun, 26 Nov 2017 23:45:51 -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=rBhxWSjg; 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 S1751740AbdK0Hoj (ORCPT + 78 others); Mon, 27 Nov 2017 02:44:39 -0500 Received: from mail-bn3nam01on0070.outbound.protection.outlook.com ([104.47.33.70]:55916 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750979AbdK0Hnq (ORCPT ); Mon, 27 Nov 2017 02:43:46 -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=rBhxWSjgXvmL9hiWRvcx6i3XFh19m8x8uCZ8ljpRp4takZSBj13Q950Z6uQAQj6qKWcaOFHfMoYKdp9mfUKu1qTy6Uz2F0Fi0Xb0Tmzx9LvebPqQqEaT5unLDEEPFHuZrVjNDd9YrJyrJexToXmDO7cTFhAWW97CNHupeicjRaM= Received: from MWHPR0201CA0075.namprd02.prod.outlook.com (10.167.161.16) by MWHPR02MB3390.namprd02.prod.outlook.com (10.164.187.167) 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:43:40 +0000 Received: from SN1NAM02FT036.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::209) by MWHPR0201CA0075.outlook.office365.com (2603:10b6:301:75::16) 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:43:40 +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 SN1NAM02FT036.mail.protection.outlook.com (10.152.72.149) 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:43:40 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:41791 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1eJE4p-0002Z8-Ne; Sun, 26 Nov 2017 23:43:39 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1eJE4p-00018V-Kj; Sun, 26 Nov 2017 23:43:39 -0800 Received: from xsj-pvapsmtp01 (xsj-pvapsmtp01.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id vAR7hT8n017373; Sun, 26 Nov 2017 23:43:29 -0800 Received: from [172.23.37.92] (helo=xhdharinik40.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1eJE4f-00016g-9o; Sun, 26 Nov 2017 23:43:29 -0800 From: Harini Katakam To: , , CC: , , , , "Edgar E. Iglesias" , Michal Simek Subject: [RFC PATCH 2/3] net: macb: Tie-off unused RX queues Date: Mon, 27 Nov 2017 13:07:17 +0530 Message-ID: <1511768238-3051-3-git-send-email-harinik@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511768238-3051-1-git-send-email-harinik@xilinx.com> References: <1511768238-3051-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)(376002)(346002)(2980300002)(438002)(189002)(199003)(77096006)(2201001)(36386004)(50226002)(39060400002)(2906002)(356003)(48376002)(478600001)(106466001)(8936002)(16586007)(107886003)(316002)(4326008)(189998001)(50466002)(305945005)(36756003)(81156014)(54906003)(106002)(110136005)(9786002)(50986999)(76176999)(7696005)(63266004)(47776003)(51416003)(33646002)(8676002)(6666003)(81166006)(2950100002)(5660300001)(107986001)(5001870100001)(217873001);DIR:OUT;SFP:1101;SCL:1;SRVR:MWHPR02MB3390;H:xsj-pvapsmtpgw02;FPR:;SPF:Pass;PTR:unknown-60-100.xilinx.com,xapps1.xilinx.com;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;SN1NAM02FT036;1:bJ++aSvpYsqTlFLgeY/DV775SHm+EdooyE+eLNrEpFC4WUXX4eMUPBanGZgEbfyemOcfDBYfReFXKpj+ibORVGzT0qzI/f6tyWDyaQ5vEANlGGLwO2OK37Uzg6ZaW+En MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 11f693fd-c9ce-4639-aa2c-08d5356a93ce X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603258);SRVR:MWHPR02MB3390; X-Microsoft-Exchange-Diagnostics: 1;MWHPR02MB3390;3:73N22cr5H/XoAdbVBr69tWDY57SGCDdBwBxfQKuGjnN112XttMxNKjv0X0olKVqMAA/kn8GGUyTYrLQEFM5J1R3hckoh+6n/Zi7L+EthB8TIz9TSiqJbsKlWwk0ZQpVgm+UTYKd558a2z5BXg/xm6/xOC00SCNq31piUzd8Jsf2B3saQFV73ADP2H0woalTFl7MRLIVvQ4SHKg760TpR4dMRlLsXW7BmIRRCYbwzcnKlyDwGs13IQQF+rjyLnY+fLoqvLsLqmrLkLn/0OMJQD+/Q2BaxQH7tWkgFMpSEsqI15XiKucgFC+JkYoEz6XnGwlN69mfn8TMvFKnjTLWQGdE6fZBOi5fWs1UHHVY8UhM=;25:kMKLPGuWXMD7ghfNPBh/3r1HsyBd9FhSlD3n6sFPu07HNhdoALTzASo+FF7w8NDKqrZ9PJ4EDF8a4uAFkkKPBHw0luzofhRfwW62yDC6mRPqy/xEZfaGWD6G6gIE64eRbqjBexS4x2oWbFIS2TP3XA3afD3WlZRdaO9V11kYyYEvyR6cqosw9VOD12dwdYTGynT8sXwNTMe7VkhJ5QOE0n3y87CE/pQU0EvvIH48JK+LPxfWDn+8auI0EgjTWWxrYelEABglEXN3nNXBJBywotIRtJ/HkfSQxyc036avf1bW2x3b6AFENEWd9LMM3iPm7eHDyjE70QpCSO+2hOry6g== X-MS-TrafficTypeDiagnostic: MWHPR02MB3390: X-Microsoft-Exchange-Diagnostics: 1;MWHPR02MB3390;31:hOwHY4kf69HLf4CpyUP6UeLXJLFMEDG8x9Zn0FbprHp9YYTH/lRfo5pMvKClTPpVnHt+a8YOjvmuJ6RAagYuW7ynEpIQ2dB5OGTveDVO2LHIkB+P3T5UcNhw+iX41cK37/P3t1a9aGbre+dgBhTLgAeWJsFAP9VEacpBk4m8pN1dG+6Ifr+zJopiP/+EJHx1wxGzpUAsnRc7ShVaWzMFlEim0lbJCkVNK6U2MpKAbl4=;20:c6R7P1NHvFsnWSrrbuFDiBCGqQsx7rBixIF79sLkgKiVV937SL3tIzZ1OScUBRM2WkJl67e0dGFY9rPMAifMd1YqwSDqvsj9lrr3MrOiBznYGsioz49XVaMA4BaiCfdw1cc34AlTS+AvrIrYbeOT7wnZgfgbyDeF5vos5LfETgHhPe8pukqQ5mvoaSKKOzTi3CqkBoVMs5V8OsBskLx6y4Hci4lMUnStC6tNrtqVfSzbVZwvTswmfg5ykfEIvYWZFOGasKJ9JLSS9XlB6JjVVhoMEvKoVNayYobafDU/3lLWKk4LFX4zyk7g1JZ9ZT/KAMAMh90ablr9ygiy0y8aXUBJ5rlyCkVeWjuP4pqaK6IV/d+FgzmxacVYw6GEaJEGDdJOJI2wNUTm2JH5G5tvzXk93xZB9DIqOQtiMsarPyHUq12bNZ5ey/NfpxoiR+lTidacTCbwndnKSDALHJIQiCa7n18+kWYOIzpfQmOgMuGRa6cuFl4KeMgbkD11uKQm 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)(93006095)(93004095)(3231022)(10201501046)(6055026)(6041248)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123558100)(20161123555025)(20161123564025)(6072148)(201708071742011);SRVR:MWHPR02MB3390;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:MWHPR02MB3390; X-Microsoft-Exchange-Diagnostics: 1;MWHPR02MB3390;4:uGEu71Ae836gjPZfq1IZPjLYpBglWDKBGkSQm75c6pkkOdjFPZJ1JTGD/Ce9NNI7M8hZ3VTLUk+uhLqfmVv7nvCg9iawjUneF/kLNS+8OSxdSk65Xsx/tKHGQHfM7O9vS97jT4XyjqvDHfEgNTN5PxNYsaIcw8cvRbokEjQgmHYtsAU+hq7vqX92AZEZab76TbWao1DEDUyCCq7dpgd8CfFlTa/SZ4gGY8VzWsgvYW4rbIx3cKbcCmD30jX07aswz6IQqJhIGYH9WMNlMrVHZ/kSCevkvrQwv1jcgKgE+RbIyjrJ011q1cGiLgPqmK8J X-Forefront-PRVS: 0504F29D72 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;MWHPR02MB3390;23:LVH2KOL41YKyMn4jE9akeDdFMgUd3dnyeydyZ53hp?= =?us-ascii?Q?Ajq+Z8Gr+z24ib7ZEoLn5aZDTnCtNCvy7fdjx6O+ME4Me2VZW+oBZ7+GUqmH?= =?us-ascii?Q?gz0nSjxPvbhXt5i7F8Af6yLVUGUNPxAi8OZNcgfxlcvii4TXNOChv5gDJhLt?= =?us-ascii?Q?yJMwpV9MPlEf3kWIOOj8orKfY0Pai7AYeez29LnjNpI5MGxYd2SjBVlsxA+g?= =?us-ascii?Q?p8uqWITeeEGwjpD/zaaMcbeMee0rhtjEOtyiT5Fx9W9g7x+SCJwdseKus40m?= =?us-ascii?Q?5r9ADNKYWtv4Y/DKOnMRsTpnVj59Dk0vyIvwmyzd3wO+0AzYzC1PjO67nhwN?= =?us-ascii?Q?MGGbd8fCDayg5RBxtvC+TtSc1w2z0miuomCeYRTEZFENzxnDCW+9e2tqL2kW?= =?us-ascii?Q?jPFtDFrif61dvTg2JYO+GmIBKry1OOw5iGQxf+eWQ4VsSy/KAw8poVd3dS2h?= =?us-ascii?Q?zZDmUiQJyxPUpfAsmtr01QeW3rp5XrQu4ett09TQOqY/Dxfiw5RhKTCd+QoA?= =?us-ascii?Q?bm3a744vjwBuINTARdWhhUqH56FiDfzmjmg3USJbfeWbpA7UDu0BZlgKUY/7?= =?us-ascii?Q?fHG1I3V5/+wWzVOJ1wH9sk07/Mlgsfqh67wgGAEMUZilifYvXkWdhdYj11Fx?= =?us-ascii?Q?nGL8PqizAZQ5whwhEnutUNhYB63UyHcpmgKGYj+5CoUDpM221/gyejdqnTP+?= =?us-ascii?Q?Hj++m47jfHg0OTE1j/A+wFkM2kQmOvsw/rmYAvIyYKqaTGohMKPuFO+JN667?= =?us-ascii?Q?dnzStRMzhazR0rSYG86RI5H9MXxSi9Y7NIsZve3B4MOpk90+8SzdcOIsHhTK?= =?us-ascii?Q?n8RgBaiPwj7Au962alMNpxq1rglEeT+/2zAGAgWgyz5WyQlOFQlGlmgzUUKs?= =?us-ascii?Q?an2DOzkjW68pWK2RZBuS2xRhUB4zbHx4l3laZOzfl9XFnBNBtyjnFKNQOcf8?= =?us-ascii?Q?lw/3Ms/NXlTLYDL2M/SlcQC6cZgSqZmru02yKH0sTStel5S/RNkoJkfW/kBJ?= =?us-ascii?Q?FVliMf6oiiFmRUkQL59SoA6C8WqLDdnAdqMeGzCnqCX/toVrj66MiZHn+pIg?= =?us-ascii?Q?xiTVNW/fUjZiYnEps3nLjrqfHsUI+dUpgRIGCmFizqixv112A=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;MWHPR02MB3390;6:10di0clrPtGl8MhHnjJqkm8WKBG/ZWbPhZyV/W6HYP8L3vdINsy4al0CsIrhBoVHpr/4yeP5AniUtQh1Oq3wwS9gPpcfOdvy91A5rNvbD3PxJrp13Jw3LiLHQSgCVS/OEI0FtLkkc6e4r2GozwIsJrj+lNSBORNQOTp+z5E7Yvt2m5sz7kx4Y/vXifVs6NQJVKisKVnEbwKTx86ClnhS8IK4M/RCOux0wOxMe3WmdJ9ZOZb+N1zNpXCoPVtnDJL+/iCU0aIvM/dkY11tKv+pHwb2RfJc/uXHGOIIC17AQW8FjBxDaYIGiOSCHQTHAkrzzsz3TXy2hf7O34rXUROBnW+ZvN9PIh/+b94aE4sVqjg=;5:Rd+qVUQsXvc0FZ9LQXKDixfcwb7qkynmq8ZhGRFJQjJn03FvHfVZZxRwtYgubtVe1fMLC8MJm4xueTKpMrVTtzkHZGTKrwDn72KokcPTpzR2uo5qx6C0MkhAAjm0Oy57IO0W3FW7YroC98dQfKqn67/W3QH+jGZ5VspbbPyiuOQ=;24:f+E4y3V9o7qs/4kihEMeU4QvFhGS8DY/Y+449tnqEb7wwOJDFQ6ZzvMeJPA1hd4TgXCkBV/orbZKyJnQl8dcQmfQHsGx6hhmZgxSXHBhCYg=;7:Hka4XaNF1zjblAJmdhVfAyYRZ3EECpYM8HPo1fdFGESZgk3/gYBp7b7eejko25CXL78PAUmfAQcmH5fDbfnyPtr3YTABtrA7W20ZKojvUGZUs7CglgOPxoYXmb/4xYOpWJSTG/BeHuM/XWg5A66htzzhT1YzFmiI9hitQNO3O9Hh4fOW/oQmdYagn5xFUZeR15uXA/FMuctOiLXN4gUSXlIELJGZS5YMYs7AKuZNO/y3U5rGCUso6e1Up3F4nKrT SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2017 07:43:40.2424 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 11f693fd-c9ce-4639-aa2c-08d5356a93ce 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: MWHPR02MB3390 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 1585202297511965068@xxx Mon Nov 27 07:11:57 +0000 2017 X-GM-THRID: 1585202297511965068 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread