linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: "Stefan Mätje" <stefan.maetje@esd.eu>
Cc: "mailhol@kernel.org" <mailhol@kernel.org>,
	"socketcan@hartkopp.net" <socketcan@hartkopp.net>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"wg@grandegger.com" <wg@grandegger.com>,
	"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>,
	socketcan <socketcan@esd.eu>,
	Frank Jungclaus <frank.jungclaus@esd.eu>,
	"mkl@pengutronix.de" <mkl@pengutronix.de>,
	"horms@kernel.org" <horms@kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH v3 3/3] can: esd_usb: Add watermark handling for TX jobs
Date: Fri, 26 Sep 2025 12:50:26 -0700	[thread overview]
Message-ID: <20250926125026.49f20992@kernel.org> (raw)
In-Reply-To: <1b539003186430591736552a3922c441da63a336.camel@esd.eu>

On Fri, 26 Sep 2025 01:35:07 +0000 Stefan Mätje wrote:
> Using the netif_txq_maybe_stop() / netif_txq_completed_wake() pair seem
> not the right thing for me because I don't understand the code completely
> and the netif_txq_completed_wake() should only called from NAPI poll
> context where I would need to call it from the USB callback handler
> possibly on IRQ level.

Ah, true, not NAPI, but you don't use BQL so we'd need a flavor of 
the macro that doesn't picky back on the mb() in BQL.

The main point of the macro is that on one side you need to re-check
after a barrier. No matter how many barriers you put in place you
can still have:


 CPU 0                                 CPU 1
	used++
	if (used > threshold)
		/* long IRQ comes */
                                         used--
					 if (used <= threshold)
						wake();
		/* long IRQ ends */
		stop();

      reply	other threads:[~2025-09-26 19:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-24 17:30 [PATCH v3 0/3] can: esd_usb: Fixes Stefan Mätje
2025-09-24 17:30 ` [PATCH v3 1/3] can: esd_usb: Fix not detecting version reply in probe routine Stefan Mätje
2025-09-24 17:30 ` [PATCH v3 2/3] can: esd_usb: Fix handling of TX context objects Stefan Mätje
2025-09-24 17:30 ` [PATCH v3 3/3] can: esd_usb: Add watermark handling for TX jobs Stefan Mätje
2025-09-25  0:27   ` Jakub Kicinski
2025-09-26  1:35     ` Stefan Mätje
2025-09-26 19:50       ` Jakub Kicinski [this message]

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=20250926125026.49f20992@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=frank.jungclaus@esd.eu \
    --cc=horms@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=mailhol@kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=socketcan@esd.eu \
    --cc=socketcan@hartkopp.net \
    --cc=stefan.maetje@esd.eu \
    --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 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).