Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp773943rwb; Wed, 14 Dec 2022 02:35:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf7PMkcdZRqGCikOD7x5kGntompZhJC+DjviE1Dh8+YJpKbhL4AJzZtiXc0xHYdbsfPrfaQv X-Received: by 2002:a05:6402:5387:b0:45c:835b:9448 with SMTP id ew7-20020a056402538700b0045c835b9448mr19955017edb.4.1671014101296; Wed, 14 Dec 2022 02:35:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671014101; cv=none; d=google.com; s=arc-20160816; b=LF4D3r/Wg9i071WrtEcg/WA39XhUxh8SwZUSJLFXopJ8TICw5qm29NopssiLNKV3E0 m6XPPRCmvWFWDrcQitHunbkx2vutCanoC+cjQU15iVXKHykYrHu+1ElW2+Vg5HsTgGhb v6P0VOB3jABUriw4vVbdDwQ1FPjOszncukF/Gxy7o6SMSOxcoLbiQnmJ75qgjM9aE25t kh3RgblCtxtalbGki+t0F08s1BNHeWSbg0c0/uwwbWC4F2RO6xnC60D9Tbu43mwLCQnS SL/Z1T/E8fYeYYel0IcWadeoYAL8H8tnQGGasVrUKpWMirQ6AOvPu3gwC1hev40AXaZA UMgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=6oKCe6FlnGVIrrL38oYuOUwNAzfDStCwEdUL/iWCuNk=; b=jn4dGs8f5FP8YcQyb6jEniCtl+mdeKLOFM16VxCvRsdPZJG9EIoncyh0pzZMSOc8JY 29LRg6zbjl0ZMf5z+3/VSDy1rQ+Un/rZY0x0FZf0wX0S3wiWYyd9NJxw4NAXCG/DirDq +QHPkkuH8FITqK3CUj6YXX4TZFK+bKL2G5222yhtnKaQxTzZ4akKHUqT97FNqCUO/XTr SLVwBvq6XajE0D4e+gaCZw6ygO7M8u2YOqCw12g+l9Zw+/PulDw+miOHq1BZ0ila87Yt sovf5cx6OeuhStRXjCWa7kJkvLkuDr+mGZ+j910UHo69Gbj+1DrEtPwT8eKBDpTiN26q yfvg== 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 h14-20020aa7c60e000000b0046cad997ceasi3762048edq.455.2022.12.14.02.34.44; Wed, 14 Dec 2022 02:35:01 -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 S237325AbiLNKPk (ORCPT + 70 others); Wed, 14 Dec 2022 05:15:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229464AbiLNKPi (ORCPT ); Wed, 14 Dec 2022 05:15:38 -0500 Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 571DAA8; Wed, 14 Dec 2022 02:15:37 -0800 (PST) Received: by mail-pj1-f42.google.com with SMTP id z8-20020a17090abd8800b00219ed30ce47so6632862pjr.3; Wed, 14 Dec 2022 02:15:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=6oKCe6FlnGVIrrL38oYuOUwNAzfDStCwEdUL/iWCuNk=; b=k8Z+r54fnjtP/41GuAvlsUhW+jjQVn9MIFpagWD4cGEm1wsQm5uEseSepqJwxYJeS1 RhN3UGxK6+HNYy6qsBVgHl/SGNWIc3c5C0UFTJMm2mWhSGEJaWsdFgJFpqF5ECqqatJJ OXumTcuZz4F0/v8Lk/x7usQUo79oxlRS2rKY5mLbvQ17Km4ZRSxAzLSnSXQ/sPo+3GgD KMswVe93r66oVbKmXqp6BBZgfssHFXf0JJT3qeSWm1iIo4W5PgNjOPluBN541guX94sr 5D642ltEOQT0cU6dWUF6VEcxFJC1N2EpTKDKiALukyveqDrDD1jiL/rycTNts/quGAw7 ymzw== X-Gm-Message-State: AFqh2kqVJiIuaDZbNOkPuS2/1t+k+LP3TsXLTGFW6SeDEtCtQz/W6/UH boR2cAckf/BiWGcYhnEmNaHzuDQiPr44Kwvf5xdOoxr+ubc= X-Received: by 2002:a17:90b:2741:b0:21c:bc8b:b080 with SMTP id qi1-20020a17090b274100b0021cbc8bb080mr216728pjb.19.1671012936773; Wed, 14 Dec 2022 02:15:36 -0800 (PST) MIME-Version: 1.0 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> In-Reply-To: <20221214092201.xpb3rnwp5rtvrpkr@pengutronix.de> From: Vincent MAILHOL Date: Wed, 14 Dec 2022 19:15:25 +0900 Message-ID: Subject: Re: [PATCH 02/15] can: m_can: Wakeup net queue once tx was issued To: Marc Kleine-Budde Cc: Markus Schneider-Pargmann , Chandrasekar Ramakrishnan , Wolfgang Grandegger , linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no 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 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). Yours sincerely, Vincent Mailhol