mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chris Strong via B4 Relay <devnull+chris.strong.flocksafety.com@kernel.org>
To: Marc Kleine-Budde <mkl@pengutronix.de>,
	 Vincent Mailhol <mailhol@kernel.org>,
	 Manivannan Sadhasivam <mani@kernel.org>,
	 Thomas Kopp <thomas.kopp@microchip.com>
Cc: linux-can@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Chris Strong <chris.strong@flocksafety.com>
Subject: [PATCH net v2 1/2] can: rx-offload: add IRQ queue flush predicate
Date: Tue, 29 Sep 2026 11:35:01 -0400	[thread overview]
Message-ID: <20260929-upstream-can-rx-offload-batching-v2-1-3b587c519f5d@flocksafety.com> (raw)
In-Reply-To: <20260929-upstream-can-rx-offload-batching-v2-0-3b587c519f5d@flocksafety.com>

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>
---
 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.43.0



  reply	other threads:[~2026-09-29 15:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29 15:35 [PATCH net v2 0/2] can: mcp251xfd: bound RX offload batches during long IRQs Chris Strong via B4 Relay
2026-09-29 15:35 ` Chris Strong via B4 Relay [this message]
2026-09-29 15:35 ` [PATCH net v2 2/2] can: mcp251xfd: flush RX offload queue " Chris Strong via B4 Relay

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=20260929-upstream-can-rx-offload-batching-v2-1-3b587c519f5d@flocksafety.com \
    --to=devnull+chris.strong.flocksafety.com@kernel.org \
    --cc=chris.strong@flocksafety.com \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mailhol@kernel.org \
    --cc=mani@kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=thomas.kopp@microchip.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

all inboxes | Powered by JetHome®