Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752814AbcKRITg (ORCPT ); Fri, 18 Nov 2016 03:19:36 -0500 Received: from mail-db5eur01on0085.outbound.protection.outlook.com ([104.47.2.85]:13376 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752274AbcKRITb (ORCPT ); Fri, 18 Nov 2016 03:19:31 -0500 From: Andy Duan To: Chris Lesiak CC: "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Jaccon Bastiaansen" Subject: RE: [PATCH] net: fec: Detect and recover receive queue hangs Thread-Topic: [PATCH] net: fec: Detect and recover receive queue hangs Thread-Index: AQHSQRf9Yh5sZt2Qwk6CMjQDco2+iKDeRuFw Date: Fri, 18 Nov 2016 06:44:18 +0000 Message-ID: References: <1479417282-15540-1-git-send-email-chris.lesiak@licor.com> In-Reply-To: <1479417282-15540-1-git-send-email-chris.lesiak@licor.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=fugang.duan@nxp.com; x-originating-ip: [199.59.226.141] x-microsoft-exchange-diagnostics: 1;AM4PR0401MB2257;7:UJ9OJP6dBRZcdTXX4XKLMgwMtBk2XyUwuoyMB9XgGq8DazXXCQEgGSxvhEwhqIvD9Q1w/JOmhuVNYVL4faHl7xrKLjbB5UBGXscSCW769y2SI8klCoAWzfIz/R4NexB515ENIOW8xQHbaFmsn1veYs+mI5DmaTMeWU/HMvdiXszY9lTS33HEt9b6/b/g3eMtybOMhASLyNu8ir9Mff9IYOAUmoP5x8F42GmU4MaD0eEvL+SlVGc13d0qcJ4kE4W+1fijmaFgdkJ5di0O15Jmehx1D8bnYK1AJyL50swu9AQoFlYnO5XEYbpu1tSuF7yx0DbBEB5km16Zen8D9AsdfXGw3DNQVIvxgg2NgYyx9gg= x-ms-office365-filtering-correlation-id: 044ebcb1-0992-4a58-f39f-08d40f7e527d x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:AM4PR0401MB2257; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(9452136761055)(185117386973197); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6045074)(6040281)(6060326)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026)(6041223)(6046074)(6061324);SRVR:AM4PR0401MB2257;BCL:0;PCL:0;RULEID:;SRVR:AM4PR0401MB2257; x-forefront-prvs: 01304918F3 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(7916002)(199003)(377454003)(189002)(8936002)(81156014)(8676002)(68736007)(8666005)(92566002)(7846002)(305945005)(6506003)(74316002)(9686002)(7736002)(81166006)(33656002)(122556002)(7696004)(87936001)(38730400001)(6916009)(66066001)(2950100002)(2900100001)(5660300001)(110136003)(77096005)(50986999)(575784001)(86362001)(76576001)(106116001)(101416001)(106356001)(105586002)(2906002)(229853002)(54356999)(3660700001)(189998001)(3280700002)(4326007)(97736004)(76176999)(3846002)(102836003)(6116002)(7059030);DIR:OUT;SFP:1101;SCL:1;SRVR:AM4PR0401MB2257;H:AM4PR0401MB2260.eurprd04.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Nov 2016 06:44:18.9964 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0401MB2257 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id uAI8Jdf4016497 Content-Length: 2833 Lines: 81 From: Chris Lesiak Sent: Friday, November 18, 2016 5:15 AM >To: Andy Duan >Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Jaccon >Bastiaansen ; chris.lesiak@licor.com >Subject: [PATCH] net: fec: Detect and recover receive queue hangs > >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(+) > Firstly, how to reproduce the issue, pls list the reproduce steps. Thanks. Secondly, pls check below comments. >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)) If rx ring is really empty in slight throughput cases, rdar is always cleared, then there always do napi reschedule. >+ 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