Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp384266pxf; Wed, 10 Mar 2021 08:13:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJx6DGklsUaPGHDZmJqH7/vTg2BH8QV8KOYSVvdryA2vebLUwtecqO9Dws1CNKZIkmO3DaF/ X-Received: by 2002:a17:906:7f12:: with SMTP id d18mr4363966ejr.368.1615392795835; Wed, 10 Mar 2021 08:13:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615392795; cv=none; d=google.com; s=arc-20160816; b=S2eFqmS1DIQbkNmeUX2t0PsKusmFnCJ66BhFyKJCiaFf/anXHKVtAr2UQSQHH6ZMJM w7qydFgXCLQgWOdJri4t7BWyLVTljw3aZLvemwGDbfNXyehypFwgwZUE+EzdXI9L8hrJ Fu74nONgNdMs3KcTvEh3p4BeqDC2xvPEK9hB/ZHCYQnHBcOxtJowRlrxWQrOyk3OjZ7r BG6G2gz+u+Cp9r7xfGowLjNceebj044DgJ5qzKcdkV6skn1yhktbR9yXqfeNpUNRtpPU DVtkteCRjZNOUMzNDIyZeXcvgFSMWP/Zhtv3H+3KH49I38aAwzwtrrpZcQWwEmApPkSL ifHQ== 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 :message-id:date:subject:cc:to:from; bh=lHSSkowFWeDP/EoIYgi7AFj2kwmTOIZV55lZ/DJAVLM=; b=D/j5k/T4tzEo95KKOdl8fHZHMJIGzajrGkwKvqgny5U+ps78U7fQpZfD1IeNd71/LM mPo4v+pjFO3p/NjnLJjEX+AQuW3Z/fGbbD823DPf8oUhBv3mpQMK//Xrb6vgFoOIuDTB PkmsZZqxe0s5csjxnadil1OeECX9T99lAgQ4xFX4p1F4B4z5sdkNiN34RaeMRMwHzMu7 yJDBrR85euuZ0/hBFbH5nO4LTjjuVKEAH9kv+QHO7Np8SorB+sH2K0ifqgklaIHD517Y 7QyetiAXarIwbisWIt7Kz1U0IvGLgSwb4KmvXw+2mSl94bUKl1RQBYYTxmuiwC/sFhM8 TC1A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pw11si12407250ejb.2.2021.03.10.08.12.53; Wed, 10 Mar 2021 08:13:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233444AbhCJQLi (ORCPT + 99 others); Wed, 10 Mar 2021 11:11:38 -0500 Received: from smtp06.smtpout.orange.fr ([80.12.242.128]:33164 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233410AbhCJQLX (ORCPT ); Wed, 10 Mar 2021 11:11:23 -0500 Received: from localhost.localdomain ([153.202.107.157]) by mwinf5d63 with ME id egAx2400D3PnFJp03gB5sC; Wed, 10 Mar 2021 17:11:11 +0100 X-ME-Helo: localhost.localdomain X-ME-Auth: bWFpbGhvbC52aW5jZW50QHdhbmFkb28uZnI= X-ME-Date: Wed, 10 Mar 2021 17:11:11 +0100 X-ME-IP: 153.202.107.157 From: Vincent Mailhol To: Marc Kleine-Budde , linux-can@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Eric Dumazet , Dave Taht Cc: Peter Zijlstra , Randy Dunlap , "David S . Miller" , Jakub Kicinski , Vincent Mailhol Subject: [RFC PATCH v2 0/1] Allow drivers to modify dql.min_limit value Date: Thu, 11 Mar 2021 01:10:50 +0900 Message-Id: <20210310161051.23826-1-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Abstract: would like to directly set dql.min_limit value inside a driver to improve BQL performances of a CAN USB driver. CAN packets have a small PDU: for classical CAN maximum size is roughly 16 bytes (8 for payload and 8 for arbitration, CRC and others). I am writing an CAN driver for an USB interface. To compensate the extra latency introduced by the USB, I want to group several CAN frames and do one USB bulk send. To this purpose, I implemented BQL in my driver. However, the BQL algorithms can take time to adjust, especially if there are small bursts. The best way I found is to directly modify the dql.min_limit and set it to some empirical values. This way, even during small burst events I can have a good throughput. Slightly increasing the dql.min_limit has no measurable impact on the latency as long as frames fit in the same USB packet (i.e. BQL overheard is negligible compared to USB overhead). The BQL was not designed for USB nor was it designed for CAN's small PDUs which probably explains why I am the first one to ever have thought of using dql.min_limit within the driver. The code I wrote looks like: > #ifdef CONFIG_BQL > netdev_get_tx_queue(netdev, 0)->dql.min_limit = ; > #endif Using #ifdef to set up some variables is not a best practice. I am sending this RFC to see if we can add a function to set this dql.min_limit in a more pretty way. For your reference, this RFQ is a follow-up of a discussion on the linux-can mailing list: https://lore.kernel.org/linux-can/20210309125708.ei75tr5vp2sanfh6@pengutronix.de/ Thank you for your comments. Yours sincerely, Vincent ** Changelog ** RFC v1 -> RFC v2 - Fix incorect #ifdef use. Reference: https://lore.kernel.org/linux-can/20210309153547.q7zspf46k6terxqv@pengutronix.de/ Link to RFC v1: https://lore.kernel.org/linux-can/20210309152354.95309-1-mailhol.vincent@wanadoo.fr/T/#t Vincent Mailhol (1): dql: add dql_set_min_limit() include/linux/netdevice.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) -- 2.26.2