Received: by 10.223.164.202 with SMTP id h10csp206936wrb; Mon, 13 Nov 2017 05:16:21 -0800 (PST) X-Google-Smtp-Source: AGs4zMZvC+1rKnh+yXoHBCsA+ROZj5FUTZpF7NHlcSWbKQfQXQXyFycW0Og9KmvqWs/CKqqx4viT X-Received: by 10.101.75.7 with SMTP id r7mr8754155pgq.133.1510578980852; Mon, 13 Nov 2017 05:16:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510578980; cv=none; d=google.com; s=arc-20160816; b=T5EX4lukLLzTTjbro7HPd4uySvbtrOH7xz4Vdn6qnvYsQOJGWnRF2BSSISGLL3BHKp wMXo4QPwBi6+/u3qk1ajHvKo766Jp6N2ygzsby9BIUkWG1wnaruAMLUUUyf0zzODmBu+ wWrxV0vx2DOTCkUAGkjU+IMyw7DwXtKY87b3ZOb600amkYUwHWFgXN80kOxRSz+3x7KH B3Q7+0EIQ0wB0T7WgggWZN3JKBDfLfn/UobstNw8496o7bfO3gFcoP06DHWJJj0vjLlE SY4rSiI7UcHsR5V3+TAXKUvygmqivo1FQsxAYMw9ZCQkyfRyI4GAvyOhuEfekKRLt6J8 IITA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=SYysEf824E9DUq4T/viPs7HZ7WI94UfkPs+ZCrVG6vc=; b=RFnysvpuKtmwUFT3kNqJ066BFmNqRl2PcsDru7VsGp/S2J0i9tz3UBs8K2d+mR0/zN Y5NqMBkdsdmjZIW2bY0HJcYTHQbGIUcyl7n5a65RmxYYcwjJw78gFR2WpljqERn7qp98 XoH0JJP+7KZZP99ZNXujBnOmP/OSqaMcGZvqAQeIoqkDoTFd34l+bsbkUr6JelwNCQhi mPpyOh3adJDxrn/9PvnsunfGGjY1i/+K1gThJtQPkZx6WvCBIIKOCbVZE/EIw1D9UUfB kM+WcSYlK/jt58Qfw1kHalhtvNJ7BjB5Pwo538/tQSjRqqhksmPrB3HMXa7OQf1TD8nK BOFA== ARC-Authentication-Results: i=1; mx.google.com; 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 r9si3561569pgp.521.2017.11.13.05.16.07; Mon, 13 Nov 2017 05:16:20 -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; 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 S1755120AbdKMNO1 (ORCPT + 95 others); Mon, 13 Nov 2017 08:14:27 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:51362 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755003AbdKMNDG (ORCPT ); Mon, 13 Nov 2017 08:03:06 -0500 Received: from localhost (LFbn-1-12253-150.w90-92.abo.wanadoo.fr [90.92.67.150]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 61329AAE; Mon, 13 Nov 2017 13:03:05 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gerhard Bertelsmann , Marc Kleine-Budde Subject: [PATCH 4.9 82/87] can: sun4i: handle overrun in RX FIFO Date: Mon, 13 Nov 2017 13:56:39 +0100 Message-Id: <20171113125622.637732902@linuxfoundation.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171113125615.304035578@linuxfoundation.org> References: <20171113125615.304035578@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Gerhard Bertelsmann commit 4dcf924c2eda0c47a5c53b7703e3dc65ddaa8920 upstream. SUN4Is CAN IP has a 64 byte deep FIFO buffer. If the buffer is not drained fast enough (overrun) it's getting mangled. Already received frames are dropped - the data can't be restored. Signed-off-by: Gerhard Bertelsmann Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/sun4i_can.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) --- a/drivers/net/can/sun4i_can.c +++ b/drivers/net/can/sun4i_can.c @@ -539,6 +539,13 @@ static int sun4i_can_err(struct net_devi } stats->rx_over_errors++; stats->rx_errors++; + + /* reset the CAN IP by entering reset mode + * ignoring timeout error + */ + set_reset_mode(dev); + set_normal_mode(dev); + /* clear bit */ sun4i_can_write_cmdreg(priv, SUN4I_CMD_CLEAR_OR_FLAG); } @@ -653,8 +660,9 @@ static irqreturn_t sun4i_can_interrupt(i netif_wake_queue(dev); can_led_event(dev, CAN_LED_EVENT_TX); } - if (isrc & SUN4I_INT_RBUF_VLD) { - /* receive interrupt */ + if ((isrc & SUN4I_INT_RBUF_VLD) && + !(isrc & SUN4I_INT_DATA_OR)) { + /* receive interrupt - don't read if overrun occurred */ while (status & SUN4I_STA_RBUF_RDY) { /* RX buffer is not empty */ sun4i_can_rx(dev); From 1583956201103815280@xxx Mon Nov 13 13:05:47 +0000 2017 X-GM-THRID: 1583955830698984001 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread