linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/1] Modify dql.min_limit value inside the driver
@ 2021-03-09 15:23 Vincent Mailhol
  2021-03-09 15:23 ` [RFC PATCH 1/1] dql: add dql_set_min_limit() Vincent Mailhol
  0 siblings, 1 reply; 5+ messages in thread
From: Vincent Mailhol @ 2021-03-09 15:23 UTC (permalink / raw)
  To: Marc Kleine-Budde, linux-can, linux-kernel, netdev, Tom Herbert,
	Eric Dumazet
  Cc: Peter Zijlstra, Randy Dunlap, Vincent Mailhol

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 = <some empirical value>;
> #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


Vincent Mailhol (1):
  dql: add dql_set_min_limit()

 include/linux/dynamic_queue_limits.h | 3 +++
 lib/dynamic_queue_limits.c           | 8 ++++++++
 2 files changed, 11 insertions(+)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-03-10 15:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09 15:23 [RFC PATCH 0/1] Modify dql.min_limit value inside the driver Vincent Mailhol
2021-03-09 15:23 ` [RFC PATCH 1/1] dql: add dql_set_min_limit() Vincent Mailhol
2021-03-09 18:00   ` Vincent MAILHOL
2021-03-09 19:44   ` Dave Taht
2021-03-10 15:56     ` Vincent MAILHOL

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).