All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vincent MAILHOL <mailhol.vincent@wanadoo.fr>
To: Markus Schneider-Pargmann <msp@baylibre.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>,
	Chandrasekar Ramakrishnan <rcsekar@samsung.com>,
	Wolfgang Grandegger <wg@grandegger.com>,
	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
Date: Fri, 16 Dec 2022 13:40:50 +0900	[thread overview]
Message-ID: <CAMZ6RqLTbD1KHqtg5E8tTGy1BFjJYjzVcK3-1L_WXo+Vw8cO4g@mail.gmail.com> (raw)
In-Reply-To: <20221215093140.fwpezasd6whhk7p7@blmsp>

On Thu. 15 Dec. 2022 at 18:44, Markus Schneider-Pargmann
<msp@baylibre.com> wrote:
> 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 <mkl@pengutronix.de> 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.

Happy to hear that :)

A quick advice just in case: make sure to test the different error
branches (failed TX, can_restart() after bus off…).


Yours sincerely,
Vincent Mailhol

  reply	other threads:[~2022-12-16  4:41 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-16 20:52 [PATCH 00/15] can: m_can: Optimizations for tcan and peripheral chips Markus Schneider-Pargmann
2022-11-16 20:52 ` [PATCH 01/15] can: m_can: Eliminate double read of TXFQS in tx_handler Markus Schneider-Pargmann
2022-11-16 20:52 ` [PATCH 02/15] can: m_can: Wakeup net queue once tx was issued Markus Schneider-Pargmann
2022-11-30 17:21   ` Marc Kleine-Budde
2022-12-01  8:43     ` Markus Schneider-Pargmann
2022-12-01  9:16       ` Marc Kleine-Budde
2022-12-01 16:49         ` Markus Schneider-Pargmann
2022-12-02  9:16           ` Marc Kleine-Budde
2022-12-14  9:14     ` Markus Schneider-Pargmann
2022-12-14  9:18       ` Marc Kleine-Budde
2022-12-14  9:22         ` Marc Kleine-Budde
2022-12-14 10:15           ` Vincent MAILHOL
2022-12-14 10:35             ` Markus Schneider-Pargmann
2022-12-15  9:31               ` Markus Schneider-Pargmann
2022-12-16  4:40                 ` Vincent MAILHOL [this message]
2022-12-14 10:18           ` Markus Schneider-Pargmann
2022-12-02 13:53   ` Marc Kleine-Budde
2022-11-16 20:52 ` [PATCH 03/15] can: m_can: Cache tx putidx and transmits in flight Markus Schneider-Pargmann
2022-12-01 11:14   ` Marc Kleine-Budde
2022-12-02  8:37     ` Markus Schneider-Pargmann
2022-12-02 14:46       ` Marc Kleine-Budde
2022-12-13 17:13         ` Markus Schneider-Pargmann
2022-12-13 19:17           ` Marc Kleine-Budde
2022-12-14  8:32             ` Markus Schneider-Pargmann
2022-11-16 20:52 ` [PATCH 04/15] can: m_can: Use transmit event FIFO watermark level interrupt Markus Schneider-Pargmann
2022-11-30 17:17   ` Marc Kleine-Budde
2022-12-01  8:25     ` Markus Schneider-Pargmann
2022-12-01  9:05       ` Marc Kleine-Budde
2022-12-01 10:12         ` Markus Schneider-Pargmann
2022-12-01 11:00           ` Marc Kleine-Budde
2022-12-01 16:59             ` Markus Schneider-Pargmann
2022-12-02  9:23               ` Marc Kleine-Budde
2022-12-02  9:43                 ` Markus Schneider-Pargmann
2022-12-02 14:03                   ` Marc Kleine-Budde
2022-12-13 17:19               ` Markus Schneider-Pargmann
2022-12-13 19:18                 ` Marc Kleine-Budde
2022-11-16 20:52 ` [PATCH 05/15] can: m_can: Disable unused interrupts Markus Schneider-Pargmann
2022-11-16 20:52 ` [PATCH 06/15] can: m_can: Avoid reading irqstatus twice Markus Schneider-Pargmann
2022-11-16 20:53 ` [PATCH 07/15] can: m_can: Read register PSR only on error Markus Schneider-Pargmann
2022-11-16 20:53 ` [PATCH 08/15] can: m_can: Count TXE FIFO getidx in the driver Markus Schneider-Pargmann
2022-11-16 20:53 ` [PATCH 09/15] can: m_can: Count read getindex " Markus Schneider-Pargmann
2022-11-16 20:53 ` [PATCH 10/15] can: m_can: Batch acknowledge rx fifo Markus Schneider-Pargmann
2022-11-16 20:53 ` [PATCH 11/15] can: m_can: Batch acknowledge transmit events Markus Schneider-Pargmann
2022-11-16 20:53 ` [PATCH 12/15] can: tcan4x5x: Remove invalid write in clear_interrupts Markus Schneider-Pargmann
2022-12-02 14:17   ` Marc Kleine-Budde
2022-11-16 20:53 ` [PATCH 13/15] can: tcan4x5x: Fix use of register error status mask Markus Schneider-Pargmann
2022-12-02 14:19   ` Marc Kleine-Budde
2022-11-16 20:53 ` [PATCH 14/15] can: tcan4x5x: Fix register range of first block Markus Schneider-Pargmann
2022-12-02 14:28   ` Marc Kleine-Budde
2022-12-05  9:30     ` Markus Schneider-Pargmann
2022-12-05  9:44       ` Marc Kleine-Budde
2022-12-05  9:55         ` Markus Schneider-Pargmann
2022-11-16 20:53 ` [PATCH 15/15] can: tcan4x5x: Specify separate read/write ranges Markus Schneider-Pargmann
2022-12-02 14:03 ` [PATCH 00/15] can: m_can: Optimizations for tcan and peripheral chips Marc Kleine-Budde
2022-12-05  9:09   ` Markus Schneider-Pargmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMZ6RqLTbD1KHqtg5E8tTGy1BFjJYjzVcK3-1L_WXo+Vw8cO4g@mail.gmail.com \
    --to=mailhol.vincent@wanadoo.fr \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=msp@baylibre.com \
    --cc=netdev@vger.kernel.org \
    --cc=rcsekar@samsung.com \
    --cc=wg@grandegger.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.