Linux CAN drivers development
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, linux-can@vger.kernel.org,
	kernel@pengutronix.de,
	Chris Strong <chris.strong@flocksafety.com>,
	Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [PATCH net 15/16] can: rx-offload: add IRQ queue flush predicate
Date: Tue, 29 Sep 2026 22:44:05 +0200	[thread overview]
Message-ID: <20260929210700.1183036-16-mkl@pengutronix.de> (raw)
In-Reply-To: <20260929210700.1183036-1-mkl@pengutronix.de>

From: Chris Strong <chris.strong@flocksafety.com>

Drivers that queue received SKBs from a threaded interrupt may need to
publish a partial batch before the handler returns. The existing overflow
check covers only the NAPI-visible queue after the IRQ-local queue has been
spliced, so it cannot guide that decision.

Add can_rx_offload_irq_queue_needs_flush() to report when the IRQ-local
queue reaches the NAPI poll weight. Keep the query separate from the flush
operation so callers can finish processing related interrupt sources before
publishing the batch.

Assisted-by: LLM
Signed-off-by: Chris Strong <chris.strong@flocksafety.com>
Link: https://patch.msgid.link/20260929-upstream-can-rx-offload-batching-v2-1-3b587c519f5d@flocksafety.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 include/linux/can/rx-offload.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/linux/can/rx-offload.h b/include/linux/can/rx-offload.h
index d29bb4521947..f9b9474f7190 100644
--- a/include/linux/can/rx-offload.h
+++ b/include/linux/can/rx-offload.h
@@ -62,4 +62,11 @@ static inline void can_rx_offload_disable(struct can_rx_offload *offload)
 	napi_disable(&offload->napi);
 }
 
+static inline bool
+can_rx_offload_irq_queue_needs_flush(const struct can_rx_offload *offload)
+{
+	/* skb_irq_queue is owned by the interrupt context queuing the SKBs. */
+	return skb_queue_len(&offload->skb_irq_queue) >= offload->napi.weight;
+}
+
 #endif /* !_CAN_RX_OFFLOAD_H */
-- 
2.53.0


  parent reply	other threads:[~2026-09-29 21:07 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29 20:43 [PATCH net 0/16] pull-request: can 2026-09-29 Marc Kleine-Budde
2026-09-29 20:43 ` [PATCH net 01/16] can: dev: can_dropped_invalid_skb: drop CAN XL frames on non-CAN XL devices Marc Kleine-Budde
2026-09-29 21:13   ` netdev-bot+sinfo
2026-09-29 20:43 ` [PATCH net 02/16] can: dev: init_can_skb(): restore skb header initialization Marc Kleine-Budde
2026-09-29 20:43 ` [PATCH net 03/16] can: remove CAN filters independent from namespace Marc Kleine-Budde
2026-09-29 20:43 ` [PATCH net 04/16] can: convert unreliable ARPHRD_CAN type checks to robust can_get_ml_priv() Marc Kleine-Budde
2026-09-29 20:43 ` [PATCH net 05/16] can: fix unique skb identifier regression under RPS Marc Kleine-Budde
2026-09-29 20:43 ` [PATCH net 06/16] can: isotp: check the frame type, not just the length Marc Kleine-Budde
2026-09-29 20:43 ` [PATCH net 07/16] can: m_can: pci: add missing pm_runtime_dont_use_autosuspend() call Marc Kleine-Budde
2026-09-29 20:43 ` [PATCH net 08/16] can: xilinx_can: set CAN FD flags on received frames Marc Kleine-Budde
2026-09-29 20:43 ` [PATCH net 09/16] can: mcp251xfd: mcp251xfd_probe(): reject devices without match data Marc Kleine-Budde
2026-09-29 20:44 ` [PATCH net 10/16] usb: f81604: fix struct f81604_int_data size mismatch Marc Kleine-Budde
2026-09-29 20:44 ` [PATCH net 11/16] can: gs_usb: kill RX URBs before destroying the netdevs Marc Kleine-Budde
2026-09-29 20:44 ` [PATCH net 12/16] can: gs_usb: add workarounds for HScanT USB to CAN adapter Marc Kleine-Budde
2026-09-29 20:44 ` [PATCH net 13/16] can: kvaser_usb: validate command format before parsing in hydra receive path Marc Kleine-Budde
2026-09-29 20:44 ` [PATCH net 14/16] can: peak_usb: fix missing CAN_ERR_FLAG when reporting error counters Marc Kleine-Budde
2026-09-29 20:44 ` Marc Kleine-Budde [this message]
2026-09-29 20:44 ` [PATCH net 16/16] can: mcp251xfd: flush RX offload queue during long IRQs Marc Kleine-Budde
2026-10-01  8:40 ` [PATCH net 0/16] pull-request: can 2026-09-29 Paolo Abeni
2026-10-01  9:23   ` Oliver Hartkopp
2026-10-01 10:13     ` Paolo Abeni
2026-10-01 10:28       ` Oliver Hartkopp
2026-10-01 10:55         ` Marc Kleine-Budde
2026-10-01 15:25           ` Jakub Kicinski
2026-10-01 15:38             ` Marc Kleine-Budde
2026-10-01 18:19               ` Jakub Kicinski
2026-10-05  7:28                 ` Oliver Hartkopp
2026-10-05  9:20                   ` Marc Kleine-Budde
2026-10-05  9:24                     ` Oliver Hartkopp
2026-10-05  9:32                       ` Marc Kleine-Budde
2026-10-01 15:28 ` Jakub Kicinski
2026-10-01 15:37   ` Marc Kleine-Budde

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=20260929210700.1183036-16-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=chris.strong@flocksafety.com \
    --cc=davem@davemloft.net \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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