Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2543908imu; Thu, 29 Nov 2018 06:39:57 -0800 (PST) X-Google-Smtp-Source: AFSGD/VcPc9FWRrCOwdCHVwWRIHRxCF41aaqFTeayc4dPhHxPUCP3Dg6alR6eRMtCqzbjk7+yZPE X-Received: by 2002:a62:1043:: with SMTP id y64mr1672741pfi.78.1543502396986; Thu, 29 Nov 2018 06:39:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543502396; cv=none; d=google.com; s=arc-20160816; b=xtzJt7E1sq+sM7ib9XUjBuvVNvDHRVaJwR9USzNanZg6uyjeCkVhz95Tfny2XXf8IO Nxm0qP5Y19rqlAaDKSYJkZShUMvLSLPTKDQD/lmiohtDyueSJtrhkj99WgTmp6DFAsNq P2T8e+eb5tFmAi+vXJUNFcHLLg+sIvXfI7eVm6R6cnQTr1PfgKpiZsPoZvKZnAyOd+fh XNSNpkjLjM1uYX/+1/d2JH1ttW4jzPD6x50DWDeGJk8r0QLN1lhtZR72Ff782ktXjnLE 3DBSf2bWefJBzBEBdlK4NgO1LD8ks6y10iDZ73MsfBSn7L9LZzvYabIqJUWTBtUjq3Mk jmzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+r/pDtTopKFkwcGD5l7e1Id8u4aXUHKjAELbEIbjMXM=; b=gpORFQH4exiyZzcsM7msDRu1YEID0UN+oyfyc9hZaEaLNLnfjWNoO2b7UIyhKPCndh xQVfsyLdTpribH9MgZhFjelUAU71fUAWfv1jueaf0ZahuIwGvOxYMVQ9QN83RlWgoNiD yC35qOka/ST9fXuUMYXc7hz5t+2J58EAZqLKinIbeU0js8Z9ww1b3/BxHIcTkV2XCUCo Tg7ONF3QWYn7LNmHH2jgd9olcT9jjw1oL82His0UtjTPQUyq0VzMJNt6a09nYKgedpUC 6dft39fjFfpvUcWJH/Eh9PgM8ViD+ORnvc+VuG98HntqVIg36BlnP3EP3CzgprKPI5H+ nYtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zpGyDgDR; 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 c1si2417007pld.194.2018.11.29.06.39.36; Thu, 29 Nov 2018 06:39:56 -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=@kernel.org header.s=default header.b=zpGyDgDR; 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 S2388860AbeK3BgN (ORCPT + 99 others); Thu, 29 Nov 2018 20:36:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:38454 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388288AbeK3BgM (ORCPT ); Thu, 29 Nov 2018 20:36:12 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1157B2146D; Thu, 29 Nov 2018 14:30:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543501839; bh=9YuLFtH4iJ5jvMI1LylK1xbOIh5NUDK9xjc5blcQeyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zpGyDgDR4yd62sN5SAc86ZAbGC5uJN1KbF66THvh1XOV/DZ/wQ2lysPrxzn7HIhjV jHunSnbwNr0OFczGVT7bNG0Xmbk4M5ltCfyjs7YGxM7pZygINlfFhSCMbE0VB0JE8Q 0RdFLe2tmYEGKW37/3rzVAjGh5M65IhNu8rE1DE4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oleksij Rempel , Marc Kleine-Budde Subject: [PATCH 4.19 055/110] can: flexcan: use can_rx_offload_queue_sorted() for flexcan_irq_bus_*() Date: Thu, 29 Nov 2018 15:12:26 +0100 Message-Id: <20181129135923.487469738@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181129135921.231283053@linuxfoundation.org> References: <20181129135921.231283053@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Oleksij Rempel commit d788905f68fd4714c82936f6f7f1d3644d7ae7ef upstream. Currently, in case of bus error, driver will generate error message and put in the tail of the message queue. To avoid confusions, this change should place the bus related messages in proper order. Signed-off-by: Oleksij Rempel Cc: linux-stable Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/flexcan.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -563,9 +563,13 @@ static netdev_tx_t flexcan_start_xmit(st static void flexcan_irq_bus_err(struct net_device *dev, u32 reg_esr) { struct flexcan_priv *priv = netdev_priv(dev); + struct flexcan_regs __iomem *regs = priv->regs; struct sk_buff *skb; struct can_frame *cf; bool rx_errors = false, tx_errors = false; + u32 timestamp; + + timestamp = priv->read(®s->timer) << 16; skb = alloc_can_err_skb(dev, &cf); if (unlikely(!skb)) @@ -612,17 +616,21 @@ static void flexcan_irq_bus_err(struct n if (tx_errors) dev->stats.tx_errors++; - can_rx_offload_queue_tail(&priv->offload, skb); + can_rx_offload_queue_sorted(&priv->offload, skb, timestamp); } static void flexcan_irq_state(struct net_device *dev, u32 reg_esr) { struct flexcan_priv *priv = netdev_priv(dev); + struct flexcan_regs __iomem *regs = priv->regs; struct sk_buff *skb; struct can_frame *cf; enum can_state new_state, rx_state, tx_state; int flt; struct can_berr_counter bec; + u32 timestamp; + + timestamp = priv->read(®s->timer) << 16; flt = reg_esr & FLEXCAN_ESR_FLT_CONF_MASK; if (likely(flt == FLEXCAN_ESR_FLT_CONF_ACTIVE)) { @@ -652,7 +660,7 @@ static void flexcan_irq_state(struct net if (unlikely(new_state == CAN_STATE_BUS_OFF)) can_bus_off(dev); - can_rx_offload_queue_tail(&priv->offload, skb); + can_rx_offload_queue_sorted(&priv->offload, skb, timestamp); } static inline struct flexcan_priv *rx_offload_to_priv(struct can_rx_offload *offload)