From patchwork Wed Mar 15 11:05:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Schneider-Pargmann X-Patchwork-Id: 70127 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2261980wrd; Wed, 15 Mar 2023 04:08:28 -0700 (PDT) X-Google-Smtp-Source: AK7set8EiLWbj5UIwcHXqW5bAPsdlNKI94KJPuN43nFULpw2J68AzHjNYE6kva4YctdN9PHkvhq9 X-Received: by 2002:a05:6a20:699a:b0:d3:e7da:c3eb with SMTP id t26-20020a056a20699a00b000d3e7dac3ebmr17200970pzk.11.1678878508128; Wed, 15 Mar 2023 04:08:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678878508; cv=none; d=google.com; s=arc-20160816; b=ydC0OKpVUhL81021N9fROUmDdzhK6xaWNGZTLZO4bBIxDoj8dRrwP9HZSJioU67U6s lrhxd7ETIUj6a222kG2RI35LpqzFtc12WVXN4GF9DVo1HVVTDrQGQBhEPyxTbBIvxRca bb2fypM+/MKnSYbFVO/Ya4SE9fc30Fxc8gFFtIafHkEaEtkot576kGHLggqEjjkW/jIZ WNGpkWYvnkommHmId3Xth1c1qo4p0W+zh2LMbPYqM3p6YwaAIrLudvOO/mfhmkNe3Dy/ iZ8EJoiJBu1TShysY2KJzEb0f4oKSt5lskD9dDINag1mvMjHqIfv2lZJh6uVimTEb+C+ 7JBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YFt4bxPMCgWg0M7+jSOYYgnyoXJC6PqUm+WV19TP9H4=; b=GkUbjuArID74pun27k4uU8HyPgh+9T9LE/gqfaXXIuZxwrQC6TsQNcIoGJRA29lFSG s9oDw6usVzJqyq/2eG7mnFSaZKr5+7AO0a0XRR35jUbCSfjK4BJQT8aBmAHp09FYhueJ Qq1BAYuvElBEsagFmJoOQ+cbxKs1RmZtSAdbxRmbEX3D+Algx/D21Fwm3orD/qHoKPBb a8hdMRUA/rh5X/70EbQCcuzrJtULBjNuGtKE18UNnkhAeQ0jY5sbzzcdyMmE3/yJb8fP UFxcMEoV70DsN8T4W5rzuNUCrxBl/5eAqxoeR9xEC4fEkvYWf+Yv8NsFoYKFpWhYsSyh vU1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=osaePjHp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e35-20020a635023000000b004dffd0e0409si4602558pgb.518.2023.03.15.04.08.14; Wed, 15 Mar 2023 04:08:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=osaePjHp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231861AbjCOLGy (ORCPT + 99 others); Wed, 15 Mar 2023 07:06:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231419AbjCOLGi (ORCPT ); Wed, 15 Mar 2023 07:06:38 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA3AD80936 for ; Wed, 15 Mar 2023 04:06:30 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id p23-20020a05600c1d9700b003ead4835046so1872495wms.0 for ; Wed, 15 Mar 2023 04:06:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; t=1678878389; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YFt4bxPMCgWg0M7+jSOYYgnyoXJC6PqUm+WV19TP9H4=; b=osaePjHp3RUs+eN/4I1mDejB79EY61Itw7Y16r9hbWxfv60LpNsBSXMxYcff1nEF1c H8D8bgR4ayHvgrZI3fTPQ2JyhzgVCW4VnvK3AgPtvJwaay44H7tBzD6tFtb7YkgaAKWk hsZRE+xijpqBCm7nXKZOhdL241g749MaTKmbjyWkKm2waIJ9+JK8KYDSzWbbgHdQ1xqQ YftE5KtMuine9O4ukfkBRPqc18/jrD7DcDn8gkLMYw5oc8QZz5DY/xiCYDVyUmAlHUx3 5KYJzKnbbrDptDcsUgpq920v8ulCVVxnhqLaULtjbge8DyJ9u/pYL4e0/v2HdJTlLR/b rqeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678878389; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YFt4bxPMCgWg0M7+jSOYYgnyoXJC6PqUm+WV19TP9H4=; b=pE/1VuBDd4+I1l23OFteOFNqcEsZPK4Gji5auvyQS6ZCLzg011fcdRKalF/2+vaIN9 EHScQkoxKJIj2xzfJpLpDPvdSbhY3QJlv6arE+4aJOfg+On2DZ/K2TW1yr/5IEDeEDvo KdlgoIb0NqUSJxxBNFp/dlsQEE9jY4+UeJsZQOEWKyOjerQqA6Yf/Xbl8yGt0MMWPq5e Y0ggHO1IXqXDxDwlGvo7+20krAnhzDdi3igBL8MQ3mkz+olmTc2EeI1ohyUj6PvVrwxD 6dI5HZjUE/D5vOnho6y9CMpgtQZHvcE56/mfX1cHuCAP9bfg7Ro0XGUR+8sTwISAWVSX 9S7g== X-Gm-Message-State: AO0yUKUvJuhJ9hCYc8B4dzs0AIBas2Ivg9soeUvXwZNpGXOOMk6L9Yd6 v9EoKloR1iAJRcmwnzQlnDfG1Q== X-Received: by 2002:a05:600c:3595:b0:3ed:2a91:3bc9 with SMTP id p21-20020a05600c359500b003ed2a913bc9mr6268192wmq.15.1678878389346; Wed, 15 Mar 2023 04:06:29 -0700 (PDT) Received: from blmsp.fritz.box ([2001:4090:a247:8056:be7d:83e:a6a5:4659]) by smtp.gmail.com with ESMTPSA id l4-20020a7bc444000000b003eafc47eb09sm1460563wmi.43.2023.03.15.04.06.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Mar 2023 04:06:28 -0700 (PDT) From: Markus Schneider-Pargmann To: Marc Kleine-Budde , Chandrasekar Ramakrishnan , Wolfgang Grandegger Cc: Vincent MAILHOL , Simon Horman , linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Markus Schneider-Pargmann Subject: [PATCH v3 05/16] can: m_can: Keep interrupts enabled during peripheral read Date: Wed, 15 Mar 2023 12:05:35 +0100 Message-Id: <20230315110546.2518305-6-msp@baylibre.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230315110546.2518305-1-msp@baylibre.com> References: <20230315110546.2518305-1-msp@baylibre.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760431710759529452?= X-GMAIL-MSGID: =?utf-8?q?1760431710759529452?= Interrupts currently get disabled if the interrupt status shows new received data. Non-peripheral chips handle receiving in a worker thread, but peripheral chips are handling the receive process in the threaded interrupt routine itself without scheduling it for a different worker. So there is no need to disable interrupts for peripheral chips. Signed-off-by: Markus Schneider-Pargmann Reviewed-by: Simon Horman --- drivers/net/can/m_can/m_can.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c index e7aceeba3759..a5003435802b 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c @@ -972,8 +972,8 @@ static int m_can_rx_peripheral(struct net_device *dev, u32 irqstatus) /* Don't re-enable interrupts if the driver had a fatal error * (e.g., FIFO read failure). */ - if (work_done >= 0) - m_can_enable_all_interrupts(cdev); + if (work_done < 0) + m_can_disable_all_interrupts(cdev); return work_done; } @@ -1095,11 +1095,12 @@ static irqreturn_t m_can_isr(int irq, void *dev_id) */ if ((ir & IR_RF0N) || (ir & IR_ERR_ALL_30X)) { cdev->irqstatus = ir; - m_can_disable_all_interrupts(cdev); - if (!cdev->is_peripheral) + if (!cdev->is_peripheral) { + m_can_disable_all_interrupts(cdev); napi_schedule(&cdev->napi); - else if (m_can_rx_peripheral(dev, ir) < 0) + } else if (m_can_rx_peripheral(dev, ir) < 0) { goto out_fail; + } } if (cdev->version == 30) {