Commit 1f7f504d authored by Marc Kleine-Budde's avatar Marc Kleine-Budde

can: rx-offload: can_rx_offload_irq_offload_fifo(): continue on error

In case of a resource shortage, i.e. the rx_offload queue will overflow
or a skb fails to be allocated (due to OOM),
can_rx_offload_offload_one() will call mailbox_read() to discard the
mailbox and return an ERR_PTR.

If the hardware FIFO is empty can_rx_offload_offload_one() will return
NULL.

In case a CAN frame was read from the hardware,
can_rx_offload_offload_one() returns the skb containing it.

Without this patch can_rx_offload_irq_offload_fifo() bails out if no skb
returned, regardless of the reason.

Similar to can_rx_offload_irq_offload_timestamp() in case of a resource
shortage the whole FIFO should be discarded, to avoid an IRQ storm and
give the system some time to recover. However if the FIFO is empty the
loop can be left.

With this patch the loop is left in case of empty FIFO, but not on
errors.
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent c2a9f74c
...@@ -248,7 +248,9 @@ int can_rx_offload_irq_offload_fifo(struct can_rx_offload *offload) ...@@ -248,7 +248,9 @@ int can_rx_offload_irq_offload_fifo(struct can_rx_offload *offload)
while (1) { while (1) {
skb = can_rx_offload_offload_one(offload, 0); skb = can_rx_offload_offload_one(offload, 0);
if (IS_ERR_OR_NULL(skb)) if (IS_ERR(skb))
continue;
if (!skb)
break; break;
skb_queue_tail(&offload->skb_queue, skb); skb_queue_tail(&offload->skb_queue, skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment