Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6245353iob; Tue, 10 May 2022 13:50:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyD0BnTKA6AdMHNSNU7o/vG5KxWBp5RxZmryC9gV4OFP61XaBboCfZ7yJwmLsB5SZycsESV X-Received: by 2002:a17:906:58d3:b0:6da:bdb2:2727 with SMTP id e19-20020a17090658d300b006dabdb22727mr21170205ejs.549.1652215831704; Tue, 10 May 2022 13:50:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652215831; cv=none; d=google.com; s=arc-20160816; b=qNPyGZg6n+/w2YS4as6fJUsjbtcCrjyT7NLl2QHZHBPg/e5yVT4COHvd/xmewqGaLC YGUK1gmiLvvgvzFTVd+ebmMB25s5Nz3piPzg3C42Bvi3x2A8J+tflZqbfJH+46nEqcIt LYgAVRX9ZNTgHaZJhD/zGyCIekvOyC99U6nhUR9G61dMs4BvLb6TCa2tgvRtI7X5bgBJ T0YJwhXcKka8Lhd3Pxo49ldzZ1cCeevcxxJOQ6SGA7UnX86RnBJUxDBJBNP+YNqSvwgz 7Dx2ad7YtlL3l0WMlEp0ZfXrg6xOCoRanoLRLEwRauSi84l3hlKBffxvNKdlZstM04xp Eu8A== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hyweSp9FKzufyO85xA9n+0jaje6yIdOOisp8tdkqdgk=; b=Rq09g5+DSnytfx9+ZeW/knPlKj7On97hQ2dm2Pk9/d6cY9AaKAatd6KTspg8Xi2soe cBJA3EevC+2tRhN7fFlYZsXwvwbahJod/Po8hhzbStfGtawyO/UzyF6/zXaAPbEQyJj/ Ls1VEIgFik0mBjhBius5h9UyBqyxQMHu2zhVpez74h5WjTmp2drGCmxMlKIbnPDSMJxP 6Kt5G/jLOqxs0IEc4U/ncFs2ws01RKlriHp8cvI/2s3BRhl937u6qQCDQsJin59TJFpX VsOylJG+TIaExB/K7lXZT1g2tQ6MR1mEkYYcRVW7Wt7WtnOFro4ELpEPiXrCv+9LJ2eK 2B3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ykz2cUcu; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g15-20020a50ec0f000000b00425f2e6bef2si272771edr.242.2022.05.10.13.50.08; Tue, 10 May 2022 13:50:31 -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=@linuxfoundation.org header.s=korg header.b=Ykz2cUcu; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242564AbiEJOEB (ORCPT + 99 others); Tue, 10 May 2022 10:04:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244614AbiEJNmC (ORCPT ); Tue, 10 May 2022 09:42:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 341EA2CCD16; Tue, 10 May 2022 06:30:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2C252B81DA0; Tue, 10 May 2022 13:29:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E3FAC385D8; Tue, 10 May 2022 13:29:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652189396; bh=sYcx22CNtW7hSY2tI7NBOUw3XnIwaKgfLUJasIi6tks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ykz2cUcu90pKcArr8GDvsCanf9Xq2jIQPXhUJ5uTtzotfxEbFhTbWr3wnf4KjJaw7 nknrHY1ElYdKR0VFJ2CbOIC9edjYgTYgxlD3aIIS7sEuN7eAd4x2Lo1Jf39ucW9U+0 v0Eqbm9IcpaPO7vMptHWzu0Rhb5WR5vIz2SmamHE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andreas Larsson , Marc Kleine-Budde Subject: [PATCH 5.15 036/135] can: grcan: only use the NAPI poll budget for RX Date: Tue, 10 May 2022 15:06:58 +0200 Message-Id: <20220510130741.439388975@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220510130740.392653815@linuxfoundation.org> References: <20220510130740.392653815@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 From: Andreas Larsson commit 2873d4d52f7c52d60b316ba6c47bd7122b5a9861 upstream. The previous split budget between TX and RX made it return not using the entire budget but at the same time not having calling called napi_complete. This sometimes led to the poll to not be called, and at the same time having TX and RX interrupts disabled resulting in the driver getting stuck. Fixes: 6cec9b07fe6a ("can: grcan: Add device driver for GRCAN and GRHCAN cores") Link: https://lore.kernel.org/all/20220429084656.29788-4-andreas@gaisler.com Cc: stable@vger.kernel.org Signed-off-by: Andreas Larsson Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/grcan.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) --- a/drivers/net/can/grcan.c +++ b/drivers/net/can/grcan.c @@ -1137,7 +1137,7 @@ static int grcan_close(struct net_device return 0; } -static int grcan_transmit_catch_up(struct net_device *dev, int budget) +static void grcan_transmit_catch_up(struct net_device *dev) { struct grcan_priv *priv = netdev_priv(dev); unsigned long flags; @@ -1145,7 +1145,7 @@ static int grcan_transmit_catch_up(struc spin_lock_irqsave(&priv->lock, flags); - work_done = catch_up_echo_skb(dev, budget, true); + work_done = catch_up_echo_skb(dev, -1, true); if (work_done) { if (!priv->resetting && !priv->closing && !(priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)) @@ -1159,8 +1159,6 @@ static int grcan_transmit_catch_up(struc } spin_unlock_irqrestore(&priv->lock, flags); - - return work_done; } static int grcan_receive(struct net_device *dev, int budget) @@ -1242,19 +1240,13 @@ static int grcan_poll(struct napi_struct struct net_device *dev = priv->dev; struct grcan_registers __iomem *regs = priv->regs; unsigned long flags; - int tx_work_done, rx_work_done; - int rx_budget = budget / 2; - int tx_budget = budget - rx_budget; + int work_done; - /* Half of the budget for receiving messages */ - rx_work_done = grcan_receive(dev, rx_budget); + work_done = grcan_receive(dev, budget); - /* Half of the budget for transmitting messages as that can trigger echo - * frames being received - */ - tx_work_done = grcan_transmit_catch_up(dev, tx_budget); + grcan_transmit_catch_up(dev); - if (rx_work_done < rx_budget && tx_work_done < tx_budget) { + if (work_done < budget) { napi_complete(napi); /* Guarantee no interference with a running reset that otherwise @@ -1271,7 +1263,7 @@ static int grcan_poll(struct napi_struct spin_unlock_irqrestore(&priv->lock, flags); } - return rx_work_done + tx_work_done; + return work_done; } /* Work tx bug by waiting while for the risky situation to clear. If that fails,