Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp4851428pxb; Tue, 5 Oct 2021 11:40:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwsU7adIPIe8dnxls9OKwIdxDUwgY69gk5PqxTovMCS6+9LdTp4G5sXhPG1SSmJUrq7wv8 X-Received: by 2002:a17:90a:5d01:: with SMTP id s1mr5676692pji.16.1633459245282; Tue, 05 Oct 2021 11:40:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633459245; cv=none; d=google.com; s=arc-20160816; b=eDa0NiYnZdwLmbHhJJ39iugJTBPRPbUul+lzVM2nAzeicbzLgE4Ps7QvMAr7QJ9RHL djQimeAxrqbGWMMsmbZ4uq1RzCQrH/RyEzAyGHAUgSu69t1hkmv5ZZnMMPqeto0mHUQI ROyHMGmCGl8MLS/F9JHmVTXF4pLfBksuIqY/W9hA1dutUsXB0iPjuxDKO1F72ut5DMg9 JDU3TXdYpJ9sCIr3o0ji2MzZevmbX2BN0Hor0F8VpnXxfMPSGMScTJYEz2tzTVur50Cz qcS53yS0XB9ByjY6zsddzmQK98mg8BgOdEEwkUQgmO7eQ/0BFaiYjwZLRu5vRC8rjXLh wt5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:ironport-sdr:dkim-signature; bh=KnwWS8FxXuoDgDDRlM7P5scofOq7+jfHg9Cs3y6jq5E=; b=WjfeyYA6i2aAhdpFgu4wsEl3yyknAokeV/gAeNj6ol2acq5Y8l8xACWfbONegYCE1a FjAXE8R46XSzXoDpXnP9KtJ/nK2b/17OXwnbpf8J6b5sJCfu8UbteKYXymSBnW1Chkw4 8MplgzffibWPNQsoChGRNYTdUi99uvlWJs6xsGtioTzbE9kN1hfpiOjqEOjNEHJD76II eiSyJmUUbk+LTNJCU/GPqHNe3n6GtHX8nHHTlRFib4mgH19Vf0C7sNZHSYKWVS3hBgMG A3LecEOtXMRrMePORD6t1ZGnG7a7TQ5iBUirPHNF3vfavKS7AG573X0DiicgwlM4Ny1k ikYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@rockwellcollins.com header.s=hrcrc2020 header.b=rBTp802g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=rockwellcollins.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bd2si18797202plb.276.2021.10.05.11.40.31; Tue, 05 Oct 2021 11:40:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@rockwellcollins.com header.s=hrcrc2020 header.b=rBTp802g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=rockwellcollins.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234855AbhJESjt (ORCPT + 99 others); Tue, 5 Oct 2021 14:39:49 -0400 Received: from ch3vs03.rockwellcollins.com ([205.175.226.47]:37686 "EHLO ch3vs03.rockwellcollins.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229577AbhJESjs (ORCPT ); Tue, 5 Oct 2021 14:39:48 -0400 X-Greylist: delayed 427 seconds by postgrey-1.27 at vger.kernel.org; Tue, 05 Oct 2021 14:39:48 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rockwellcollins.com; s=hrcrc2020; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=KnwWS8FxXuoDgDDRlM7P5scofOq7+jfHg9Cs3y6jq5E=; b=rBTp802gP1HQZIHecSVzcp8H0WNOmElvKX9j5ygPUJL82c6wRNk4Udh1 givVUvZjay8v4+WwSuhXG1efnjcUcnmKoO+K8DscjHZFN5cR39VNj4bEy eP7SqS1xwYsscWd8wQ9bOQsBIW/YRNPCCK30EiqpVamgqz3RRe3PDyOSA dacsOYKjQDsAmZ5yI6czaSTyu8gM+XrIbUgQ6NAVquPeYjOpvustvdnIa qUaoE4LwdOeD9UCxETh9msEkjn6KLxB6KJyMJYzaREHycYxwmSIC4rBpO 7wOHAsNmAmMlHnuoFsuOr+/O8mBf8sOEftj0Riuc4PBOo1UclUCc1Terg w==; IronPort-SDR: rkO7ETqPYBTFbL3KKFATaFVfS96dZm5FYwzuP2qG5qayGYRh/rCwTExBt5v7lcwAGZ4fEacaEs 6pfzbCZ9bMBk4DuAXlk6C+kgAMx/rFIwwOcPI6U0ZK00ZEjrvhN8MeNRMBWvCoDkFX1lKQ49Ro pNROYUmlIF53zNy3yjz450idAgvvN+ld/rYYYDCYaPAjyUYAYZ4AW0Hlg+un7eORHf/aGOoISG VnnTpqYCMjcFd4IYpR2WKyrjf8SuLtGxj2nEJb3gYVFBBpIY0f+3IX7PCGu8fNUmzrSSVH1mza N6Y= Received: from ofwch3n02.rockwellcollins.com (HELO crulimr01.rockwellcollins.com) ([205.175.226.14]) by ch3vs03.rockwellcollins.com with ESMTP; 05 Oct 2021 13:30:49 -0500 X-Received: from righttwix.rockwellcollins.com (righttwix.rockwellcollins.com [192.168.141.218]) by crulimr01.rockwellcollins.com (Postfix) with ESMTP id 5ED8B6038E; Tue, 5 Oct 2021 13:30:48 -0500 (CDT) From: Brandon Maier Cc: Brandon Maier , Wolfgang Grandegger , Marc Kleine-Budde , "David S. Miller" , Jakub Kicinski , Nicolas Ferre , Alexandre Belloni , Ludovic Desroches , linux-can@vger.kernel.org (open list:CAN NETWORK DRIVERS), netdev@vger.kernel.org (open list:NETWORKING DRIVERS), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Microchip (AT91) SoC support), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] can: at91_can: fix passive-state AERR flooding Date: Tue, 5 Oct 2021 13:30:23 -0500 Message-Id: <20211005183023.109328-1-brandon.maier@rockwellcollins.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the at91_can is a single node on the bus and a user attempts to transmit, the can state machine will report ack errors and increment the transmit error count until it reaches the passive-state. Per the specification, it will then transmit with a passive error, but will stop incrementing the transmit error count. This results in the host machine being flooded with the AERR interrupt forever, or until another node rejoins the bus. To prevent the AERR flooding, disable the AERR interrupt when we are in passive mode. Signed-off-by: Brandon Maier --- drivers/net/can/at91_can.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c index b06af90a9964..2a8831127bd0 100644 --- a/drivers/net/can/at91_can.c +++ b/drivers/net/can/at91_can.c @@ -804,8 +804,13 @@ static int at91_poll(struct napi_struct *napi, int quota) work_done += at91_poll_err(dev, quota - work_done, reg_sr); if (work_done < quota) { - /* enable IRQs for frame errors and all mailboxes >= rx_next */ + /* enable IRQs for frame errors and all mailboxes >= rx_next, + * disable the ack error in passive mode to avoid flooding + * ourselves with interrupts + */ u32 reg_ier = AT91_IRQ_ERR_FRAME; + if (priv->can.state == CAN_STATE_ERROR_PASSIVE) + reg_ier &= ~AT91_IRQ_AERR; reg_ier |= get_irq_mb_rx(priv) & ~AT91_MB_MASK(priv->rx_next); -- 2.30.2