Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2165147rwb; Fri, 2 Dec 2022 06:23:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Ej1vH6y2G0pzEUHHMQ5G+VwtG7QWRezkzpv/R5iGMbjTD31YN5aBxJYoJVFyIngcbEr3D X-Received: by 2002:aa7:86c7:0:b0:562:45f0:df50 with SMTP id h7-20020aa786c7000000b0056245f0df50mr53612537pfo.16.1669991024762; Fri, 02 Dec 2022 06:23:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669991024; cv=none; d=google.com; s=arc-20160816; b=Q+Oypioq+dvWjMi3cy1JN4G70mWXrjLpn8rKUeSIhWoUaDI+woULtq0850kppqgJX7 w3B21SB136w6bVOhGnSyesB+Q0+smm6BejOQeSvZNaWX1R2U2z00ooiRJrxBObOazein KWBUABs4tGbGxeVxPUcXchRZ9mql7NKu7kZFQj1noJhTFstsCh1lxDHzvbBDW5x3ikHT WoWnVaMlMwaNdHcMS9XB1M8sYZv8+7n6dwlkLOUSfnXMj9ZUJb1i+J6xRzi6uTK40IgF AIHAjmOkd6YX8KgzNcjD4l5AGtfirYw5Cu6pfOwZHtqM0T2LuD1zrLtkgmPUqYbsgcL+ R0Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=1VfWf78HXEYU/uAu17Wk3e4is/tDb3sprmgv9ULlHoQ=; b=Zl1ZK125xHQAuA7XdJKt3iU90cfHGPDwG8LXTEQsFzD1tqI09ecQbtJeMxbnF4sKNT z0RO7UoyX0HTA1Mc6lA+Iq3rpnIe9nmUN6GBKdhMxbtMU36HAqM4vRRsNhgdqkWUTrtx UqfNvXL9KskVJy2dNgIuM5qpBkYUjaUKczTTw45ho6PX5NacSFMWAIt6cUSWYb09DOFB 7omfYcx6SbTUHG3+hLuClx3KIPwjl98E/7TZSvBPhm9Lh1VNmOApZ/ftEAVTo4Zplq8S qyQmKLFNFopzT7zKw+cT6nxbibxIuVIHemCNoi/vJgxUtPA4y3uVw7LnJduYeWiuV0mC SokA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h22-20020a17090ac39600b00218c30f7e1esi7173996pjt.127.2022.12.02.06.23.33; Fri, 02 Dec 2022 06:23:44 -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; 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 S233460AbiLBNx5 (ORCPT + 83 others); Fri, 2 Dec 2022 08:53:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232917AbiLBNxz (ORCPT ); Fri, 2 Dec 2022 08:53:55 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEF8FCE08 for ; Fri, 2 Dec 2022 05:53:54 -0800 (PST) Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=bjornoya.blackshift.org) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p16U9-0004lm-SU; Fri, 02 Dec 2022 14:53:49 +0100 Received: from pengutronix.de (unknown [IPv6:2a03:f580:87bc:d400:63a6:d4c5:22e2:f72a]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: mkl-all@blackshift.org) by smtp.blackshift.org (Postfix) with ESMTPSA id 4EC561316AA; Fri, 2 Dec 2022 13:53:48 +0000 (UTC) Date: Fri, 2 Dec 2022 14:53:39 +0100 From: Marc Kleine-Budde To: Markus Schneider-Pargmann Cc: Chandrasekar Ramakrishnan , Wolfgang Grandegger , linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 02/15] can: m_can: Wakeup net queue once tx was issued Message-ID: <20221202135339.k6355z5pxqikd6rg@pengutronix.de> References: <20221116205308.2996556-1-msp@baylibre.com> <20221116205308.2996556-3-msp@baylibre.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="on7i6codf732a6cd" Content-Disposition: inline In-Reply-To: <20221116205308.2996556-3-msp@baylibre.com> X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: mkl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 --on7i6codf732a6cd Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 16.11.2022 21:52:55, Markus Schneider-Pargmann wrote: > Currently the driver waits to wakeup the queue until the interrupt for > the transmit event is received and acknowledged. If we want to use the > hardware FIFO, this is too late. >=20 > Instead release the queue as soon as the transmit was transferred into > the hardware FIFO. We are then ready for the next transmit to be > transferred. >=20 > Signed-off-by: Markus Schneider-Pargmann > --- > drivers/net/can/m_can/m_can.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) >=20 > diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c > index 2c01e3f7b23f..4adf03111782 100644 > --- a/drivers/net/can/m_can/m_can.c > +++ b/drivers/net/can/m_can/m_can.c > @@ -1097,10 +1097,9 @@ static irqreturn_t m_can_isr(int irq, void *dev_id) > /* New TX FIFO Element arrived */ > if (m_can_echo_tx_event(dev) !=3D 0) > goto out_fail; > - > - if (netif_queue_stopped(dev) && > - !m_can_tx_fifo_full(cdev)) > + if (!cdev->tx_skb && netif_queue_stopped(dev)) > netif_wake_queue(dev); Please don't start the queue if the FIFO is still full. Is this a gamble, that it will take long enough until the work queue runs that the FIFO is not full anymore? > + Nitpick: Please don't introduce an extra newline here. > } > } > =20 > @@ -1705,6 +1704,8 @@ static netdev_tx_t m_can_tx_handler(struct m_can_cl= assdev *cdev) > if (m_can_tx_fifo_full(cdev) || > m_can_next_echo_skb_occupied(dev, putidx)) > netif_stop_queue(dev); > + else if (cdev->is_peripheral && !cdev->tx_skb && netif_queue_stopped(d= ev)) > + netif_wake_queue(dev); Same question as above, what happens if the FIFO is full? e.g. in case of a slow bus or the first CAN frame in the FIFO has a low prio... > } > =20 > return NETDEV_TX_OK; > --=20 > 2.38.1 >=20 > Marc --=20 Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | --on7i6codf732a6cd Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEBsvAIBsPu6mG7thcrX5LkNig010FAmOKA2EACgkQrX5LkNig 013afggAl25h6SI6ZmyZSNEWWC4ARZgKc0sczOh/LH9HiWHr5+B7ZiF2WMgDebtS UvWJoQV6bC9NFGCbtkfIRazuAPV2XGMGZcP6S101NHhmXTBKKipQBe5wPoAQKAkB WkzkNbGqAGZS0kNnOpeR8QJwUurwwi7VmFVmq81Zf+DYeA2lZtEZpjwjyQE19KsV lLRpku3WvRG0zgbo3aaGzBqoNFIAn4EPEh5TpM030DqffD+sMbgm8O6GJxSXtpln eMX0nyK4bQFC1pr0byZWyYzvcnrto+15g8QxPH3/EWA9S17ix99nJaeAG8i1DNmW Sy5MtpNVd1xuA3sXpJGQ4DBWmZHvPg== =fRrh -----END PGP SIGNATURE----- --on7i6codf732a6cd--