Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp797365rwb; Wed, 14 Dec 2022 02:58:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf5S4BwZmdFNz9KZ2M3BL4UrM/QxF7D2VCdgHUHAErR2awOJkKxCBRzDzCeGYjs9cQzWTB4D X-Received: by 2002:a17:903:2345:b0:189:ba1f:b178 with SMTP id c5-20020a170903234500b00189ba1fb178mr35596868plh.9.1671015518631; Wed, 14 Dec 2022 02:58:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671015518; cv=none; d=google.com; s=arc-20160816; b=yLRav2oWn1EbrVygpJEZ5LYh8WKS1zbKLbNmloYqLnB1haGUay+eThy3eEtNfnXIuN lnQUJb76UTHoEbJOtvKVD3vAGgAIFynNgIrdVFJozur0K/eRptynfJlG8jUZ/zmuXFUm UQLUCl3TB78j59YLHPzuQQQNqHIDKfodq8AoGB+h2OX34d3W5sYZc8mDFHPM3XJnV6lJ XhOiUKK7y49JUdAxEnbUDDot7HBK17yRbQnWgM+/1/9+nIAmtDHevSjTLVtF0Kp5Jlsi BhUCEfyaQIjlPyxTeMU6o8NOyxU/lDcC9CEt69RXHPrTo8/VCayZURFA9xwK/y3DnX9c c/SQ== 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:dkim-signature; bh=2RvFiiCnhAAKi7d+1qBnwz6NP+D+/ZIyHDhOt+BilbQ=; b=cMLs7NTf4oSuKzMYbRwgjqFk/+cgJi2ILdaOLFfepKm2jcxvzaSZPq+YuDyS0GXBOI kjhR0CRlEnyNlWJGiG2gOSDlkXlBa/5EbMLYCtbsT+i93xeeycpZpVHhQ/gRN8RKojwN 01kdTeZbuX2mRn2IakPcvlns5/W2ou8V4oZT0ad4dCbMrEroybE0SnU4mHPaUYE/Ilm2 RPQRh61MLFtpausaslKOOFPZXwXtmYaM1Y0XLdTxfMOQ5S1sq1PU5lN22gW1nd5/CFaZ UepvvjEkUROGnaEjs+f9OtHxUg2173K7lYxlXZrVRnLxL33mnePebusjCyPzx8TgXV+W u31w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=2V4nT4w2; 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 az1-20020a170902a58100b00189db2e76f1si2210506plb.389.2022.12.14.02.58.29; Wed, 14 Dec 2022 02:58:38 -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=2V4nT4w2; 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 S237979AbiLNKfu (ORCPT + 70 others); Wed, 14 Dec 2022 05:35:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237965AbiLNKfr (ORCPT ); Wed, 14 Dec 2022 05:35:47 -0500 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27E9620BE6 for ; Wed, 14 Dec 2022 02:35:45 -0800 (PST) Received: by mail-ej1-x632.google.com with SMTP id fc4so43367824ejc.12 for ; Wed, 14 Dec 2022 02:35:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=2RvFiiCnhAAKi7d+1qBnwz6NP+D+/ZIyHDhOt+BilbQ=; b=2V4nT4w2BZ/X/Hf4t9dDrH6FezCbRaJT9eK8gARAwOK5jTLArjG27ZFq2pWOBuSLpl bCY3WZSuMi6v1+06iAFKfMMs/kttgxTMRcA4PCJaKOVbqdTS5gm+ME6W+Z3l7dxOSOIS 5e89STE0Lk+Yj5LDgU/Rde2I+SLS3aJrlkufHUKUG3+RDf+fq6+Q3x42STGClCSCoWR+ FQmQfqwqFF6ScBSiX+oAl+IgjoyJ6nXWnUKwlok6TIcqbM7/Jc4Eeih5E95NSaOXfFyy gzam1E6rhlLU2daKpN29DA6aGJoZ9U6nc7hrDqDb2JLOFoKVwOsFjgto9ypjC52kIIfj /wpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=2RvFiiCnhAAKi7d+1qBnwz6NP+D+/ZIyHDhOt+BilbQ=; b=xWOm2ysPoaL4pc/QaRgpKiaRxel/RotAKdHI4nL6SBGRaQAfBF7TFON1CqxiGxxe+A 12E9gUPFHCCcD4pUOZg+FpEY34MNcGYNpQxfhVS3fLgkDn0+RQ8t5hYytEV1L7T6zpi5 VgguWT+crRP9SpMh1qRzenxiaVx6J7g/gggsQT7/9SZceQvqmawtt+1bFWoKp7AMDdEL nXyVtVuZFuBxs1JhJwZqh/pAG7DxpubaCx/S/EPCiItQyHmAMkv1dquay93eDx/N4oSn hkz54LWItubFz2wqTN9TnulwTH9zuVL0YUIHbONCcILsw5FbE593JoKCbHFe1XML1+z1 oUHA== X-Gm-Message-State: ANoB5pksDDq0wq1CA3U9qriMWDbdTElKZCOzDraiypl1NMdsMSdbFKeT PJrBO+cVPEF2NfpWSL9R8Ehzfw== X-Received: by 2002:a17:906:698f:b0:7ad:d250:b903 with SMTP id i15-20020a170906698f00b007add250b903mr19732691ejr.56.1671014143640; Wed, 14 Dec 2022 02:35:43 -0800 (PST) Received: from blmsp ([185.238.219.46]) by smtp.gmail.com with ESMTPSA id 1-20020a170906318100b0077b2b0563f4sm5740827ejy.173.2022.12.14.02.35.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Dec 2022 02:35:43 -0800 (PST) Date: Wed, 14 Dec 2022 11:35:42 +0100 From: Markus Schneider-Pargmann To: Vincent MAILHOL Cc: Marc Kleine-Budde , 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: <20221214103542.c5g32qtbuvn5mv4u@blmsp> References: <20221116205308.2996556-1-msp@baylibre.com> <20221116205308.2996556-3-msp@baylibre.com> <20221130172100.ef4xn6j6kzrymdyn@pengutronix.de> <20221214091406.g6vim5hvlkm34naf@blmsp> <20221214091820.geugui5ws3f7a5ng@pengutronix.de> <20221214092201.xpb3rnwp5rtvrpkr@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: 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 Hi Vincent, On Wed, Dec 14, 2022 at 07:15:25PM +0900, Vincent MAILHOL wrote: > On Wed. 14 Dec. 2022 at 18:28, Marc Kleine-Budde wrote: > > On 14.12.2022 10:18:20, Marc Kleine-Budde wrote: > > > On 14.12.2022 10:14:06, Markus Schneider-Pargmann wrote: > > > > Hi Marc, > > > > > > > > On Wed, Nov 30, 2022 at 06:21:00PM +0100, Marc Kleine-Budde wrote: > > > > > 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. > > > > > > > > > > > > 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. > > > > > > > > > > If you want to really speed up the TX path, remove the worker and use > > > > > the spi_async() API from the xmit callback, see mcp251xfd_start_xmit(). > > > > > > > > > > Extra bonus if you implement xmit_more() and transfer more than 1 skb > > > > > per SPI transfer. > > > > > > > > Just a quick question here, I mplemented a xmit_more() call and I am > > > > testing it right now, but it always returns false even under high > > > > pressure. The device has a txqueuelen set to 1000. Do I need to turn > > > > some other knob for this to work? > > I was the first to use BQL in a CAN driver. It also took me time to > first figure out the existence of xmit_more() and even more to > understand how to make it so that it would return true. > > > > AFAIK you need BQL support: see 0084e298acfe ("can: mcp251xfd: add BQL support"). > > > > > > The etas_es58x driver implements xmit_more(), I added the Author Vincent > > > on Cc. > > > > Have a look at netdev_queue_set_dql_min_limit() in the etas driver. > > The functions you need are the netdev_send_queue() and the > netdev_complete_queue(): > > https://elixir.bootlin.com/linux/latest/source/include/linux/netdevice.h#L3424 > > For CAN, you probably want to have a look to can_skb_get_frame_len(). > > https://elixir.bootlin.com/linux/latest/source/include/linux/can/length.h#L166 > > The netdev_queue_set_dql_min_limit() gives hints by setting a minimum > value for BQL. It is optional (and as of today I am the only user of > it). Thank you for this summary, great that you already invested the time to make it work with a CAN driver. I will give it a try in the m_can driver. Best, Markus