Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2786034pxf; Sun, 21 Mar 2021 06:52:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNNrChA1G0yYvSgfWZTTUqIVaH9A1IEO+Xpkf/vlieTmb4nJF1EDNYzvi5RzqTsM+sHzfS X-Received: by 2002:a17:906:f283:: with SMTP id gu3mr14405901ejb.91.1616334747463; Sun, 21 Mar 2021 06:52:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616334747; cv=none; d=google.com; s=arc-20160816; b=GppxqdxjiFuLNsOQ5r0wuo3i3qAhEAvt7PqiXB9DUyXjlyLIfdbcmEzCkJmOKF1SlT XH/o7V1+2N3XwEixaIFM8HbvwY4ZsuO/WuJJFRDEd29eucpqLLchmoOrMtTY5pryXnJe dfzvOSzvXkDGc68LvVNpE+fsZdOxlP7yyVtzBhTDiFr7fRVFCrHCbUm1+52iyvRQAcEe oRdlDIYjfQGOdNQ+FcWc25ITq52ZmwxU6Ud//FfUw5jCKrCgIeCAFCSWb5Y0bFDvWYR0 QUM2SIxPhm57s195KCNdxlrby3Om2RnosZWTPq7ktNPesBOBN2OoCQRExjiobLDYkVWF INrQ== 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=VS6z9vXBvwt8+hOGjcAOFOtZKKKO/Ks192I+67+7mxo=; b=UkbbhHuBg4qd5n+9llag7tIDm3IQfj5NwwfpikXZNM8zHhC4Tm4/2Ff1ojWSOKPRc2 gjV0P5eG+777YA+aPz5YpzS+hbsWcydalh5r1+c8m8mdhNbQTOzOjU5Zq5lwMSNgayCp vNg8X5ZLZ7uyjOjQK2K7/bBkMMa6//n2SRNNNDyazbuMOcdBXbzGjc/A8DTPvPjKKv1d 4Bf8mbC0JCi64A5GjTVSHKPymEUZfAg2nEcSvHwoS+6Ox30GrCi3MtTE0WtX/PWful5n ttIqUHjqVVXfzoFjvAYHYy4k8CyY2NDf6sliWVNOwFlFVZjzfxb77Y/zBvJrW97MPew/ waVQ== 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 b26si9354267eja.162.2021.03.21.06.52.03; Sun, 21 Mar 2021 06:52:27 -0700 (PDT) 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 S229990AbhCUNtV (ORCPT + 99 others); Sun, 21 Mar 2021 09:49:21 -0400 Received: from smtp07.smtpout.orange.fr ([80.12.242.129]:34234 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229863AbhCUNtQ (ORCPT ); Sun, 21 Mar 2021 09:49:16 -0400 Received: from tomoyo.flets-east.jp ([153.202.107.157]) by mwinf5d13 with ME id j1oz240023PnFJp031p6zA; Sun, 21 Mar 2021 14:49:14 +0100 X-ME-Helo: tomoyo.flets-east.jp X-ME-Auth: bWFpbGhvbC52aW5jZW50QHdhbmFkb28uZnI= X-ME-Date: Sun, 21 Mar 2021 14:49:14 +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: [PATCH v3 0/1] Allow drivers to modify dql.min_limit value Date: Sun, 21 Mar 2021 22:48:48 +0900 Message-Id: <20210321134849.463560-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 v2 -> v3 - More verbose commit description. - Fix kernel documentation. 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): netdev: add netdev_queue_set_dql_min_limit() include/linux/netdevice.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) -- 2.26.2