[PATCH net v2 1/2] can: rx-offload: add IRQ queue flush predicate
From: Chris Strong via B4 Relay
Date: Tue Sep 29 2026 - 11:35:44 EST
From: Chris Strong <chris.strong@xxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxx>
---
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