Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752430AbbGXEPy (ORCPT ); Fri, 24 Jul 2015 00:15:54 -0400 Received: from mail-bn1on0088.outbound.protection.outlook.com ([157.56.110.88]:33922 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750778AbbGXEPu (ORCPT ); Fri, 24 Jul 2015 00:15:50 -0400 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; dave.eu; dkim=none (message not signed) header.d=none; Subject: Re: [PATCH] can: xilinx: fix RX FIFO overflow error handling To: Andrea Scian , References: <1437685986-25824-1-git-send-email-andrea.scian@dave.eu> CC: , , , , Kedareswara rao Appana From: Michal Simek Message-ID: <55B1BBEA.7020506@xilinx.com> Date: Fri, 24 Jul 2015 06:15:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <1437685986-25824-1-git-send-email-andrea.scian@dave.eu> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-21698.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11OLC009;1:fpo9Jk738AzYYjB3kKoxyi0zzLsh1Pw8xHmJnUgyRwZ1Lz52dOCYB6rGgETEF1p0FR32Khbu2tL2eMGlUzKl8ZLqJwNOSeALRpmqjW6P5PijiWN9ixfB/iUSuLiSoC1GK5UiVND0+fyscccJGP79j+XSaaiw/EHhfqLapHixiAPJjwJA7kPPKizEVJQYE53LUbhhQID97/Z1Q5TNQli8JYMBX9/mQaatTYaOeRbsd4Yph6AbE6aGL9Yd1yuSTtwrqRW41n1cGFN3YGuaQ0hk/CzWNnxR2GP8Lk+YA1rTxWs= X-Forefront-Antispam-Report: CIP:149.199.60.83;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(438002)(24454002)(479174004)(189002)(377454003)(199003)(80316001)(19580395003)(47776003)(62966003)(4001350100001)(5001770100001)(19580405001)(5001960100002)(77156002)(64126003)(107886002)(65806001)(83506001)(65956001)(92566002)(50466002)(33656002)(86362001)(54356999)(77096005)(87936001)(106466001)(2950100001)(5001920100001)(6806004)(63266004)(50986999)(87266999)(76176999)(36756003)(65816999)(4001450100002)(189998001)(23746002)(46102003)(107986001)(4001430100001);DIR:OUT;SFP:1101;SCL:1;SRVR:BL2FFO11HUB032;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;MLV:sfv;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11HUB032;2:mDohgILbD2yS2U/RLI08vcu0/XYv2K1LoUS/H/VaulRk0VaOpkwU9Bkaz4cJJI6O;3:20Vya4qVhxN12W3rkcmQa7FRToViks99BdbVPsmdEIjSWOo6GD8HY5K5Lu5HV4c5NiQFq3xwSe23YiTwJdE60bxEAZZwzxMLt+Ey2a3UMvOl4OGfS4jRt2OaSrbvApcH8X5NBELcjYYduZrE8+P129eewVels2YTWjDsg8sWysXGlm5HzTDlrN25IQvbTr4zLWggbHbPBrY4nE35yHFXCv2GF0OOvwM0zONA/n3jXSc=;25:GXdG+Idhj2kD/0XD4PCgB4fP8gGl7UVN6pXq7iyM+Gn7xjj8sCLaezCzcw70/pc6hv/ctPai6abgvmkDfyox/4ptKS9nhWHWoFxn3/sEo167nug+2+Xi3wK8VX3OR4Y4RKlDBj7WCuBE19AMA0B+O2Vjjm8ScWfuWZF7SJGwfATL4dVQpyJj7IU2q1Uh6SlZPOf+DPZWcJq6mmUOMo9ghGQE9/YYJmu+LtkhNEOeo9pOIO8uGI1wMC9xTNO80UcCqyMrV/qb9hwqq+n3BA1z0Q== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BL2FFO11HUB032; X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11HUB032;20:SDcnaBoZknOJEyjU5SucelBtHo3orVXWrkQcuX5+dGCsMTyc0Z3CwbjLjGVdVum/kv4tUnap7U+7XolcdRdt8aSb2zvtYqv4gHQUWxs6UzyHsLbeX5mMaCmX++neRMp4glwCr+bddgnTCN554SU+Jy8j6C74IA7X+0EyJI9MhNCBtxZ+Bgsx8BCTCAUdC3SbmctqSgOWssIUPcG6fVlC/ki9IKAAcMPYa67VNUXbbY8tqPPKy9+KsaAKTKoPf6jBNDegXs/NgusqBfsUXelUiX22i9Fk4RL3vs/7JFicQWPsDDAeIUQ5ITkZ5GaMUi1qMCEjxMWJflU45ERzd4wSgJZp/eQ/TLBW8kpmVu2R7gRZ1EXVzuNya0VjlXmsHKiHPC02F6ZxPKWRYp1wrblnqJScYAF3ZZvku1jS0uVa6WI1iMIDIpD+3EAqAepBFh/VvSEZlmrkSey1Fa8ib38ibJ0AzkewHQbAw1TVcGZTGa6awJUH2ZeArS55spsEwH6e;4:zc/xy8/Q+jEQiZSUByyzQ7NSk+CG5PBAC7p1JBy51s7VtWdDzTwLzNus5K3ff+S93LWYdUZwDIIivn3cSlTClvBejoE22mhJ4069GzT9CEzHVhez8IRwZ99dFQeIIBFRYQOcCbfxKUDc/P5MzkXHDsDKPb8ZKXeq4pjg3nBMo+SlYF4H33FxhEd+WPLYY5HOUfVFQskiKivbr/zTplCUiqsAXeYQleCTlt7GkG0cGiz+bbFzgmLcUeSTBBvv2ImlUsc3SR417iO7W+MAboTm+LfTipPd4uo2/yz8X15b7mI= BL2FFO11HUB032: X-MS-Exchange-Organization-RulesExecuted X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:BL2FFO11HUB032;BCL:0;PCL:0;RULEID:;SRVR:BL2FFO11HUB032; X-Forefront-PRVS: 0647963F84 X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;BL2FFO11HUB032;23:qDufuuzjZQaa9SEnGHu048X6nCKkUb6R29Y6?= =?Windows-1252?Q?E7y4gTY8pE9l2mjJQOi1Gq7DLSGxHldySMHrxetUI+ZFmLDFjztPiuTg?= =?Windows-1252?Q?lGkxpcWdRIfipsFLLX6j5hRwar+Mb57sl3pgaYx8J5deaaMFWJkV/7r4?= =?Windows-1252?Q?6ekgOVKFPKDo4oFAvrNORXeASuQrT6WEOO+l248aMYA3yEjMlKHNBy4/?= =?Windows-1252?Q?E33VX1dBp9hCq0XdHFWLUxfIfhZs4spV6pEc/Gvx8zRZFIsAC/yrP+lg?= =?Windows-1252?Q?n1UbU2q6+XZ6eBKfTeoEz9QyQt6knHJMzzMfezRimshbRw+NpSUYhzd+?= =?Windows-1252?Q?3ouoYIzQm5wq7soOuhz7E/DPgH5XbuaCFS+bd5K5gelHn/GseAzIpr9X?= =?Windows-1252?Q?IZTDBDvoU6JQqQFksQOiUOvWPUl02q0tLQvjUGJazlrEfIk33IpeYuCx?= =?Windows-1252?Q?7RtHTKKnV6jAJKoJQUomuLL/5+rjjSsDPlalwGNlywS5XcSADDPnwlc0?= =?Windows-1252?Q?Kk+ErtryJ9cW8YW9Wood+ShnZDmOa5VEAxWaqH4YsbKHCnRcAcbEFnrJ?= =?Windows-1252?Q?T3bF56vNXQb8oJfMOPmhLwF1j+eNNDR4m0QDapAeVAh89v7WghOMSdrW?= =?Windows-1252?Q?l97TnEJeVxeYqj6OWIyGyMqUfcORQXZkmGtWiraqlzS3AYuTb0AsiMGw?= =?Windows-1252?Q?6I2jPzZ3Vywq53Y3Bop76i3nj4GddWEYkm4G/YQl9FGDMDMn3dADRwFt?= =?Windows-1252?Q?6vlQBTUTvOl+lbwxRsaokTOfXkE6jzsp/ReyWVXfKWOgulLigv+xOzCQ?= =?Windows-1252?Q?qwTUr8/dfqYirZPYRBWbiDftFsTxLfS1xkqjXxpXsLd/4gKC52PoRdVJ?= =?Windows-1252?Q?N2qeqJUjIabNPIa2qoV1zLLuWMTaCCDOPPg20ejg8sreq/OlQBmsHXtZ?= =?Windows-1252?Q?UQRncPLtpegeS28HNk/5IvVpncJ5So6zQeL7sIj13RsaZ5db4u9NM9/V?= =?Windows-1252?Q?Q6yc3xyQUy72iVN5STOrTedN/8LMQpn7iwhK9Lu20UmqahqSk2eWxZvJ?= =?Windows-1252?Q?ZcMljPKWik4riwqz9d76oWfoSjaoxwXPwhd9BjIDPLnWI2aolIr/lkQp?= =?Windows-1252?Q?U0xTf02AFsfwGwYc7bK2g3zRpXz3cErN3IjZ8Q0qQ5o6Bp6g12nBuI7T?= =?Windows-1252?Q?MwYJi+oRKHP9xBuhOKZr6U4piMWOViwNTT1zzQB5K12AskKdeqs7Lfld?= =?Windows-1252?Q?ZLdNoBr+ayrehg/lL9TY0Il9x+F2J5dtIxpZsJY=3D?= X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11HUB032;5:xFzGussC/gS+Skfm3rSl8ESiNU1UfYVgvMmPfZFrXA32RE3+TdeHtFi2Tnrq47Fk3ixDlVhoOkxMOBw/GaqsM882w3ddOI3loymzu4d8xR5eo6jV4CTbS6Ct0SN2NRve+hJirt1CSovvwUquQPFTfA==;24:LQOJm6C3W1njhyOqegwfJUXOQDWG59T4/sXVkb69L9vQNdC6DpFquPpnQt9J8ZY/wu2hElda+ge1lnseAMAnOYlgbpHfIijjWnCSjieIXcY= X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2015 04:15:47.1798 (UTC) 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: BL2FFO11HUB032 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2930 Lines: 78 + Kedar On 07/23/2015 11:13 PM, Andrea Scian wrote: > Simply resetting the peripheral on RX FIFO overflow in not enough, > because we also need to re-initialize the whole device. > Also always enable RX FIFO overflow interrupt otherwise we may hang > until another interrupt arrives (this happens if FIFO overrun and just > read from CAN bus with candump) > > Signed-off-by: Andrea Scian > --- > > You can reproduce the problem with the following test-bed > * connect a Zynq based board to a PC with a CAN bus adapter (e.g. PCAN USB) > * start sending lots of CAN messages to Zynq system > * configure and start xilinx CAN driver > ** canconfig can0 bitrate 1000000 > ** canconfig can0 start > * try to send/receive messages (cansend/candump) > * if you send a CAN message you'll get the RX FIFO error and additional messages > will not be received > * if you try to get messages you simple don't receive them (no interrupt triggered) > * with canconfig stop/start the hang goes away (if the others peers stop sending > send lots of messages ;-) ) > > I tested the patch over xilinx-2014.04 kernel, but the patch applies cleanly to > mainline too. > > If someone has a better understanding of Xilinx CAN driver, please let me know if > it's better to handle the error in a different manner. > > Maybe the bus off handler need the same threadment too. > > TIA, > > Andrea Scian > > --- > drivers/net/can/xilinx_can.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c > index 5e8b560..c278177 100644 > --- a/drivers/net/can/xilinx_can.c > +++ b/drivers/net/can/xilinx_can.c > @@ -100,6 +100,7 @@ enum xcan_reg { > #define XCAN_INTR_ALL (XCAN_IXR_TXOK_MASK | XCAN_IXR_BSOFF_MASK |\ > XCAN_IXR_WKUP_MASK | XCAN_IXR_SLP_MASK | \ > XCAN_IXR_RXNEMP_MASK | XCAN_IXR_ERROR_MASK | \ > + XCAN_IXR_RXOFLW_MASK | \ > XCAN_IXR_ARBLST_MASK | XCAN_IXR_RXOK_MASK) > > /* CAN register bit shift - XCAN___SHIFT */ > @@ -526,6 +527,7 @@ static int xcan_rx(struct net_device *ndev) > return 1; > } > > +static void xcan_chip_stop(struct net_device *ndev); > /** > * xcan_err_interrupt - error frame Isr > * @ndev: net_device pointer > @@ -597,7 +599,8 @@ static void xcan_err_interrupt(struct net_device *ndev, u32 isr) > if (isr & XCAN_IXR_RXOFLW_MASK) { > stats->rx_over_errors++; > stats->rx_errors++; > - priv->write_reg(priv, XCAN_SRR_OFFSET, XCAN_SRR_RESET_MASK); > + xcan_chip_stop(ndev); > + xcan_chip_start(ndev); > if (skb) { > cf->can_id |= CAN_ERR_CRTL; > cf->data[1] |= CAN_ERR_CRTL_RX_OVERFLOW; > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/