Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752247AbcKRCwk (ORCPT ); Thu, 17 Nov 2016 21:52:40 -0500 Received: from mail-by2nam01on0091.outbound.protection.outlook.com ([104.47.34.91]:24355 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751243AbcKRCwi (ORCPT ); Thu, 17 Nov 2016 21:52:38 -0500 X-Greylist: delayed 20116 seconds by postgrey-1.27 at vger.kernel.org; Thu, 17 Nov 2016 21:52:38 EST Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=chris.lesiak@licor.com; From: Chris Lesiak To: Fugang Duan CC: , , "Jaccon Bastiaansen" , Subject: [PATCH] net: fec: Detect and recover receive queue hangs Date: Thu, 17 Nov 2016 15:14:42 -0600 Message-ID: <1479417282-15540-1-git-send-email-chris.lesiak@licor.com> X-Mailer: git-send-email 2.5.5 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [208.82.105.200] X-ClientProxiedBy: BLUPR15CA0058.namprd15.prod.outlook.com (10.162.95.154) To BN6PR08MB2900.namprd08.prod.outlook.com (10.175.190.142) X-Microsoft-Exchange-Diagnostics: 1;BN6PR08MB2900;2:uV+RFaE5EhqjnVYovGXW57WeIXuP5jqHAcyGzmKgL+vK1kpVuzAIAVIBgY+x0gKVTQBbOyc6LVCc4ZSJMgcr6sYxg/BWff6blkftDqqj/jOlrCwnM5XwNyjuVA5GBklapnVdJiD7dKvJyEtnuXnObk37VueTO+lVsbDCQz0+dVA=;3:z3oKUt45Rba4rpbdDvtF0WUmxfM5Fd0YPahGyM3M7mXMQqBXNp+9mviwbkA9RIHKTFpu/RvecBXrqDJjzIhR6gdGLPkqjF/F7S5Bc33Y/09LkU4EO+dF2jqmq69sY/jtHdf6vvI7iWzmGM5tWXUhLLoMJILmZO7Duu/A1tqjnyw= X-MS-Office365-Filtering-Correlation-Id: ff2b1d42-88a1-45bc-dfb6-08d40f2f1d09 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BN6PR08MB2900; X-Microsoft-Exchange-Diagnostics: 1;BN6PR08MB2900;25:PH+FcWQfok9+Kl6ZPxr0vjgQiKdJv9U7nhJVqfTJ77LOu243OHvExVozT1mm++fNi+F6ev2taeR2ElhtudGfWazuJZjENQfrnsk76D6MlHlQ+xwapldTljKgP5MlaLD3+W+XpXcy1CPWduiRT5H7m7/wywtn48aq+xkkGmUKqj133WqPWwAfEDVsNti28vRjenbrZXBGls5dAgfuKqxm1ZMIQHFQyGYwp7rWoSICRIeeQ9hvs1/go/W5DkWccFrIMKh9P/ZyMtSQp4JNz25+AljydXu0+TEMzIOD6ATwuh26CkTL1J+4wbtH4JXyTxiVVF+q5o3YCc5W/dMQtbQpwulG02ddt7uOXwcz6d2MzGRUwDkzZ5PKJUekAeWdp32rFhJ5Bzg/Dxb9rZa89Uz/1wQDeOTJU5Gab+ZWtnjfwx6IpoFOQvF4mE+8BnuynkNWj7WOhgvzhPuY2UnXZmkP2htQh3/SqnCE7ATuCtLVx20bFAQnK7jwDN2xrfE4kSeDMcE8Ewpg3tPPh5hE3lRtzbOeMkR5TG0KuUGGx8E6JjtP/jcPvfyYJEcPL5+ISwZCCiB63rmvOpLoXnkvO8jYWKtIqaw6QhfCYobUHFEp4jRbeic3uZYOdTse522rAyBceRghhQHHhgd4hKnTTbSFJCOpNaat3t9RzXtUwAXyOQ4y6JhsS8lvsgZgZnrrNL194yPGcueFWa4ibSa+pGLeTI7SiZiAWAnMr7PXt//hIdebWBK4LQNREBj/uIVC8H1PVLYgE6KxTo/HHcS/WR1hZWfW+50sDaaUZvuhGVhnYF4= X-Microsoft-Exchange-Diagnostics: 1;BN6PR08MB2900;31:japVWAygoBGXUiqITEuU1jG2h9zKkSa7MnLs8yyIoiYzY1SHgytyTsH1jYeFZrZk3qRUpP0fTKJAWaLtAIf1MEWoakfoMfkU5V99/Yd5qj8NU5seBxcsjjkYqnCp1YGc5Z8ofQYkwNv+6sOtFgn/e1bFQNH5I751rgdFbBteT01hoeA2RFnG2l+5GeA6MCyuQwJHY6s3qXfXGBfFmRrq4mf6CMNV7bwjpCh1cXSNN8Ey/Nb9K5cHFW0+mE3YJm8uftgqA5807QUrTpSpiiaVBNOvgwC2UnMcw9a3I/Nv6xM=;20:uPKcK5/bXVQWo6EgOPKpHHfJkcfu8Vzuz2BwcHWPcttEqMs/TAXp3OqJXWcb0bNL1pJ9eDgpREoRtjOEpbdNKIHkC1mRcIe/Gs4w15fZo3wroM9dPNf38S+rygMR9Ef4pO7R6mzpOdcvgjZuGOJG6Nn1nneKOM/VTDBa8Hk91mbdw4BbLqe8e2t3WpPGOKMiG8d/Z7p0MzXjZIJwtZoWS62U9pE/TpUoDv0a5Tl37hYBkY62P6iFCODCp+/ZeXKiMsqCWXegT/6LfbKieMd0hCDbBPWYtq0DwLx1+5h4ayjSgpq84Rb9RW3+W2BEenbDIVwN1vVmGO2aGdhTUPBKeF8FIcF/NnWRPrN9aBf+l6oK/3Sk7w4vVgZVjjLVqU9GM1WF+JbneHmPc8QHNPS/UwaAgApnjdjh4liJwXiz0hkLYB325Bqb4pRvs4/DsBt9b0mCDR8sFX4vUIilfzXddbfvEd57TqUU/n9ZecGotBcs1onJ0T/ZBplhv+NbL8Pq X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6060326)(6040281)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6061324)(6041223);SRVR:BN6PR08MB2900;BCL:0;PCL:0;RULEID:;SRVR:BN6PR08MB2900; X-Microsoft-Exchange-Diagnostics: 1;BN6PR08MB2900;4:jSfawyLuEwLAI48H72wNpr9E+ftItiaFPLjnRKSpuTKfpFq95+bgtm6P7p8Rlo3dI1C9f1zzI3rBnpXGrxCv4sejk2to2h3KzdyqWNViFNbIsWn7yAuf94LV8jmKtse1xey24El2EP3No9XcL1mh11xljGMMcJ3FbRJaHQlh+YAYyEAAg61RFICb3w8cWcRMTwl5pg4nYpfvpQQLB+fPDhpquU3ebuftaIpdVWfRAoc9ooXtqNNTvBA7ul2UpBNn8jjBbb/0aNIhUYGlZUp1XBdpCYvb500d+0UFpRV/OyedsYuKHyPVVSSYZDwhra9WkFuEc/wwktX0jrojZ+MmPEgvN17uewgLnS7wtXXOm4tx8gRt9JPqc+ucIUs5UU22t0SxRVRJ81j746d6eA9SAmM6D4iTkQ8PqNJxPoKvsIDtz76lZYAFjeDanUU4ieu//vd+MHHLL1j8d30WA2ud3g== X-Forefront-PRVS: 01294F875B X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(189002)(68736007)(4001430100002)(6116002)(3846002)(48376002)(50466002)(6666003)(5660300001)(5003940100001)(6916009)(110136003)(36756003)(8676002)(7846002)(50986999)(92566002)(50226002)(47776003)(8666005)(86362001)(7736002)(66066001)(77096005)(4326007)(81166006)(81156014)(575784001)(2906002)(105586002)(33646002)(189998001)(101416001)(106356001)(107886002)(42186005)(305945005)(97736004)(7099028)(7059030);DIR:OUT;SFP:1102;SCL:1;SRVR:BN6PR08MB2900;H:bee.local;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN6PR08MB2900;23:7IY0L5dXi3TMiDT1ZvWEKtpNqz1L08sCl6QbbmIXG?= =?us-ascii?Q?j7u6WNvFialMbItcvGPxzuqttdw5GY4F140SI/2SSLPy36Cd0ST3kyhVy/nT?= =?us-ascii?Q?mt33MMd6I35P6L/nlntqn7Z6lg8P9FRiPUSoHqe8PsQlQXDO2HrO8xn7149A?= =?us-ascii?Q?6TIdSk7KKJarBtpELuW8DTUwEAvgRL/SF27xsbhiRX6kXaFUFQFtB/3S53Xn?= =?us-ascii?Q?r4iAVOJhT5Y487MJhJKil4RjyKcHOS4bdTBpYmFOu8GRw6WE/i63Ug84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ZpM8DA/FiegrbOh63ONRPRKs= X-OriginatorOrg: licor.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2016 21:17:18.8345 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR08MB2900 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2136 Lines: 72 This corrects a problem that appears to be similar to ERR006358. But while ERR006358 is a race when the tx queue transitions from empty to not empty, this problem is a race when the rx queue transitions from full to not full. The symptom is a receive queue that is stuck. The ENET_RDAR register will read 0, indicating that there are no empty receive descriptors in the receive ring. Since no additional frames can be queued, no RXF interrupts occur. This problem can be triggered with a 1 Gb link and about 400 Mbps of traffic. This patch detects this condition, sets the work_rx bit, and reschedules the poll method. Signed-off-by: Chris Lesiak --- drivers/net/ethernet/freescale/fec_main.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index fea0f33..8a87037 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -1588,6 +1588,34 @@ fec_enet_interrupt(int irq, void *dev_id) return ret; } +static inline bool +fec_enet_recover_rxq(struct fec_enet_private *fep, u16 queue_id) +{ + int work_bit = (queue_id == 0) ? 2 : ((queue_id == 1) ? 0 : 1); + + if (readl(fep->rx_queue[queue_id]->bd.reg_desc_active)) + return false; + + dev_notice_once(&fep->pdev->dev, "Recovered rx queue\n"); + + fep->work_rx |= 1 << work_bit; + + return true; +} + +static inline bool fec_enet_recover_rxqs(struct fec_enet_private *fep) +{ + unsigned int q; + bool ret = false; + + for (q = 0; q < fep->num_rx_queues; q++) { + if (fec_enet_recover_rxq(fep, q)) + ret = true; + } + + return ret; +} + static int fec_enet_rx_napi(struct napi_struct *napi, int budget) { struct net_device *ndev = napi->dev; @@ -1601,6 +1629,9 @@ static int fec_enet_rx_napi(struct napi_struct *napi, int budget) if (pkts < budget) { napi_complete(napi); writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK); + + if (fec_enet_recover_rxqs(fep) && napi_reschedule(napi)) + writel(FEC_NAPI_IMASK, fep->hwp + FEC_IMASK); } return pkts; } -- 2.5.5