Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp794762rwb; Thu, 15 Dec 2022 02:30:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf45yWVm97t/Ch96FYtsJPyB5nHXQGTiOfN0zjqx6eakaaO2ZpdN/hmqyB5n8GL9kHgpjbOR X-Received: by 2002:a17:902:6b05:b0:185:441f:7087 with SMTP id o5-20020a1709026b0500b00185441f7087mr26628228plk.12.1671100249062; Thu, 15 Dec 2022 02:30:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671100249; cv=none; d=google.com; s=arc-20160816; b=U0pJZPuu6PqQ9UCloOzE8ekPTHYE7kZO5gk/kF5ce6Qew3OfUkdT9MG+kd8cxjNCiz +66Vy78WNcxHrbtxIu3zrkcQpKRS5Vvo/MalnLSwVSUQNlkPaznbwD+sH6fTXj4VtPyl v/NA5gGL1saqiekswr5m1UCz3uh3ZvGt06T6O/+tpyv8U5jU0xSEdFQWAGHNvfFLZL6C xr63b15hgS8oD7/G/IwHJBQJBVUWtYByvDHC4Kt4NFDZnXEOP8lkv5nvLVSUJ8UI3p+8 2hylSR/PNE+RoT/4qTOqE2XzZpcwiNHyGXBlXVnJM6KQc8bddWFRZ5pEOXXA7nnYfGzU vMcQ== 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=Q0YAKGDMlZN4p7SGu1vmDkPv/Bp6BjxoeHp4dwkcNfc=; b=MnXlNU4jzeQgkk5nGi1WY9Hu05mkhVU9fNkLL4E4C01LPUOMxbVZ0aHLdLV3qUgcVM dU9wqltGtlYWqDw80MgRErtgDQwzqb6hrCUurgR6SOa+bt/7S+eNGoH9dXqDGk8BqerT mk4l8ZqJahCN61xe/whq0bAj70iyGleZuMWTcotKowSvqyDlzV7atJQ4nLIZa+3u4+up ejOkUadJ6ADNYuz1AmZ28F+xPtWZnCViOc2eM3nZgEaXrYPukZp8U00k4SnxqMa0UITN DEtlvP67RQ946lUgB0a9WDkBtO/iGmtrT7seGyJAilzu+prY4FNO3hROc70jgyh+Axfx iAoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=2f3RUKhI; 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 r7-20020a170902be0700b00189239e6a29si5432379pls.95.2022.12.15.02.30.40; Thu, 15 Dec 2022 02:30:49 -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=2f3RUKhI; 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 S230012AbiLOJcX (ORCPT + 68 others); Thu, 15 Dec 2022 04:32:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230063AbiLOJbo (ORCPT ); Thu, 15 Dec 2022 04:31:44 -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 02AB3AE54 for ; Thu, 15 Dec 2022 01:31:43 -0800 (PST) Received: by mail-ej1-x632.google.com with SMTP id qk9so50900086ejc.3 for ; Thu, 15 Dec 2022 01:31:42 -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=Q0YAKGDMlZN4p7SGu1vmDkPv/Bp6BjxoeHp4dwkcNfc=; b=2f3RUKhIBSh486JTHI1LtttZ415mWNa9U2TLd2xJ81N+di7BPRGccKUXO+B3tWnv6e MxQp+ywMvY0KT2MHPteX66Cdkxc4vDCFl8wwsT2H/KnrJtqboZ4v4xVW1WIcOwscQJtk EXzS14okcECBa5A0LwliClUG49W/vadFAt5c5kXewKUNjocHSDwjLDc1/F56FHMDmNf6 OhFVmx9F5p6v/4cL58/0nfgyDfLhxNeazfLAv/ACjn8x/rwopoNPKgfp6LdUVQsy0oyn zbQ7+wvE/BNvLJdFrWw1SsyUq9c9qS5NRtSaD2PcPuLLfl9gJZfzc0B0tZ6aXUCUA3eR tLIA== 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=Q0YAKGDMlZN4p7SGu1vmDkPv/Bp6BjxoeHp4dwkcNfc=; b=xswKPxUvqSDIvIXK9AzTjO1+oG1r81xYwechBdiX7RplF3kikaiMd/iRYByWY76Bk4 mAS+AAlZ7l6bSwX/67OL9PIczX1l+DOoC4kxSYka6/Vcv2xprKVuVslA44bkazlsmiUA H6jmKf4R8bssF3deUbfZNFak+sq4/rfKKCaE6XtypQEh69uLLbft6Jqg9bG3fqgMqsvq OOvvZAqZ8nedKQ8AerI1o//x5hLenVY69C6mvE40OXNROJOV3WdTMJ5lQ9aemDkC6Xnu mBdzl311yM6ghcBWQleO4tNV2G23ViDk49eJ8cqHXvx9djbIMhAWwq4F3sYZK22+4hlf uKcA== X-Gm-Message-State: AFqh2kqmumKIaG4DbchOpvRNAdZNGF06/QbOUwpCcdFEH1hzrAv6FvoB 8GY9FzJWoLNziqmF4x1TYmta8Q== X-Received: by 2002:a17:906:26c6:b0:7c5:fd:4352 with SMTP id u6-20020a17090626c600b007c500fd4352mr5582566ejc.49.1671096701556; Thu, 15 Dec 2022 01:31:41 -0800 (PST) Received: from blmsp ([185.238.219.6]) by smtp.gmail.com with ESMTPSA id v2-20020a170906292200b007c09d37eac7sm6796931ejd.216.2022.12.15.01.31.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Dec 2022 01:31:41 -0800 (PST) Date: Thu, 15 Dec 2022 10:31:40 +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: <20221215093140.fwpezasd6whhk7p7@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> <20221214103542.c5g32qtbuvn5mv4u@blmsp> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20221214103542.c5g32qtbuvn5mv4u@blmsp> 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 Hi, On Wed, Dec 14, 2022 at 11:35:43AM +0100, Markus Schneider-Pargmann wrote: > 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. Thanks again, it looks like it is working after adding netdev_sent_queue and netdev_complete_queue. Best, Markus