From patchwork Wed Dec 21 15:25:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Schneider-Pargmann X-Patchwork-Id: 35405 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp3586288wrn; Wed, 21 Dec 2022 07:27:18 -0800 (PST) X-Google-Smtp-Source: AMrXdXue/OdPIChoOLEqR7InXwNW483XWI1Z9dMQMp9K2yrmjRq9SzNN8SB3vwE7t3pbXPdWVm1u X-Received: by 2002:a17:90a:e09:b0:20d:bd60:ada4 with SMTP id v9-20020a17090a0e0900b0020dbd60ada4mr1897361pje.32.1671636437780; Wed, 21 Dec 2022 07:27:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671636437; cv=none; d=google.com; s=arc-20160816; b=YCaCp/2YcgfWcft6+Uomqjrf6oYh6DhUJueiiVfn+Lzjb3XnxVjtl9oFN41z4Swcxy NCfTJ5bE1koZ/vJm8idozqDDh81LPL4Cq225bicp1e9dl1IvA8XGRBP1BrC3YVJ+nFoh EEYVQ/eXEX4CunLtPa3cEZortNmQ8g555J6MyKqegVQO77cTzRUpO5EZXyEsUnzshnVa HD0urgnVJpgV8jshJ466sHa1a7Dbm2shmEBkTHbsgxGvrJymv0p8SEB1OXj+2qXmci+5 yQ93/OoV++9tz6hoGpHE5NmzF0hEx5ZNXU5MmMNy3dynJpk52RNCbrHg0Jlt5BOXGaGd D32Q== 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=hyl6rPM+iSY41G/DSGtLfPJHWB9hRIbSevUdKHX4ZAA=; b=q2IyuwCpZmL73MiTnN8DaJ92j/7qiGAEaW0IUBaSJGe1hOG0Er3KM4byZdjeSMaQM1 p1KiGdpuSW1gZ7yH3s+PzHUUVpy7M7g/3QymFVs+l0Mp5a/GBc5tPfc2hOrB+axbtgRF uyESSovoJW3RD4O/byoiElc0GaxOWwrIzDYipNc8ZTgKvUSIA4+GcnmO5rBNGyVYZ7rD sBXaW1jVwAtOQxRE/BWKt+rkL0yscF808TQTZr0rx5SVhzs5hzezd2ckhVvzFfq5/Ir2 H+mp+egLtJ9NgREefHtCNrejMfE6R/DOtL6BM/fkbBb5SHH6AKRgDT+qQ/iVHIQGebG2 dm4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=GsSPSftu; 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 nb6-20020a17090b35c600b00225a710a560si723412pjb.73.2022.12.21.07.27.04; Wed, 21 Dec 2022 07:27:17 -0800 (PST) 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=GsSPSftu; 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 S234764AbiLUP01 (ORCPT + 99 others); Wed, 21 Dec 2022 10:26:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234650AbiLUPZu (ORCPT ); Wed, 21 Dec 2022 10:25:50 -0500 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87A34958A for ; Wed, 21 Dec 2022 07:25:48 -0800 (PST) Received: by mail-ed1-x52a.google.com with SMTP id m19so22436963edj.8 for ; Wed, 21 Dec 2022 07:25:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; 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=hyl6rPM+iSY41G/DSGtLfPJHWB9hRIbSevUdKHX4ZAA=; b=GsSPSftudTd3Pmw3IFMFhTMSnF8KOi3BBUZmMiQYnxSlQWogruWaFF/4GdqBO28s6Z r/aP+jJ0UrYqum+LjfwMuDifjePOXiYmIviOA3sR1tIdUA1vURXafALNfNX6GdidHmSk St6i/EH0dL1i2lAz/FFCpsVhMORUKtknkX7qQQAawhXF7TrydTPnyEeMpWI6r8nraDsm sjbv+XR1grnnfo4t4o9W9dHHhNaZzVuAnmwax8UuOfdY2T/01CubfHp4G3TGXenFfkxQ jN+3pZ8rEMxmn8xygos/0qIhRir42BU+L6Stf866nS7ms8uLBV2jDTznsqoxOvPmMyeg TupQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=hyl6rPM+iSY41G/DSGtLfPJHWB9hRIbSevUdKHX4ZAA=; b=JtKu2nEaG1dJkX2DXelxlVI5SgR910fioqgOkzdqBnQz7PD5Zntqa2JPRYxSxl65PD 94sj6gkEnb/Ijp1eTQpgB05UfdJRkbA7VD64J1FLdIz38btCwcpb9YLZmg3SBuyWfxhl Z41K0qA5MfDB/Cax1JOmYIhNf3jsd5etKjtxFN89doPTVFFpXzf3dW8FbiRv7RlzYgeY FU8LCQDCZx9fwlcADDbKj0Sh9mUp9YUQua1c6ldliqAWsCBjqCq+80r1BzPz8yx3oHb+ EGwJN/Sw0a2UEs9VwZaLYBJVYRVz7NaUixMmi2GyAxvqWGAB2VRxirXkbi8IfKQFHtXv DbRw== X-Gm-Message-State: AFqh2krVT0TWsKTQ3jeg92stF6SCccQHWsc2YYiHvlVOzvow/tJ0Cbxj 5tE6DA2gmmwAgdJwj/2R7dxAVw== X-Received: by 2002:a05:6402:1609:b0:467:7775:ba8 with SMTP id f9-20020a056402160900b0046777750ba8mr2038749edv.1.1671636347131; Wed, 21 Dec 2022 07:25:47 -0800 (PST) Received: from blmsp.fritz.box ([2001:4091:a245:805c:8713:84e4:2a9e:cbe8]) by smtp.gmail.com with ESMTPSA id n19-20020aa7c793000000b0045cf4f72b04sm7105428eds.94.2022.12.21.07.25.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Dec 2022 07:25:46 -0800 (PST) From: Markus Schneider-Pargmann To: Marc Kleine-Budde , Chandrasekar Ramakrishnan , Wolfgang Grandegger Cc: Vincent MAILHOL , linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Markus Schneider-Pargmann Subject: [PATCH 07/18] can: m_can: Keep interrupts enabled during peripheral read Date: Wed, 21 Dec 2022 16:25:26 +0100 Message-Id: <20221221152537.751564-8-msp@baylibre.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221221152537.751564-1-msp@baylibre.com> References: <20221221152537.751564-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=unavailable 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?1752837849129849592?= X-GMAIL-MSGID: =?utf-8?q?1752837849129849592?= 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 --- 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 9749a3248517..bcd3bcdc5123 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c @@ -962,8 +962,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; } @@ -1085,11 +1085,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) {