Skip to content

Commit 6d820b8

Browse files
axelf4marckleinebudde
authored andcommitted
can: kvaser_pciefd: Continue parsing DMA buf after dropped RX
Going bus-off on a channel doing RX could result in dropped packets. As netif_running() gets cleared before the channel abort procedure, the handling of any last RDATA packets would see netif_rx() return non-zero to signal a dropped packet. kvaser_pciefd_read_buffer() dealt with this "error" by breaking out of processing the remaining DMA RX buffer. Only return an error from kvaser_pciefd_read_buffer() due to packet corruption, otherwise handle it internally. Cc: stable@vger.kernel.org Signed-off-by: Axel Forsman <axfo@kvaser.com> Tested-by: Jimmy Assarsson <extja@kvaser.com> Reviewed-by: Jimmy Assarsson <extja@kvaser.com> Link: https://patch.msgid.link/20250520114332.8961-4-axfo@kvaser.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
1 parent 8256e0c commit 6d820b8

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

drivers/net/can/kvaser_pciefd.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,7 +1209,7 @@ static int kvaser_pciefd_handle_data_packet(struct kvaser_pciefd *pcie,
12091209
skb = alloc_canfd_skb(priv->dev, &cf);
12101210
if (!skb) {
12111211
priv->dev->stats.rx_dropped++;
1212-
return -ENOMEM;
1212+
return 0;
12131213
}
12141214

12151215
cf->len = can_fd_dlc2len(dlc);
@@ -1221,7 +1221,7 @@ static int kvaser_pciefd_handle_data_packet(struct kvaser_pciefd *pcie,
12211221
skb = alloc_can_skb(priv->dev, (struct can_frame **)&cf);
12221222
if (!skb) {
12231223
priv->dev->stats.rx_dropped++;
1224-
return -ENOMEM;
1224+
return 0;
12251225
}
12261226
can_frame_set_cc_len((struct can_frame *)cf, dlc, priv->ctrlmode);
12271227
}
@@ -1239,7 +1239,9 @@ static int kvaser_pciefd_handle_data_packet(struct kvaser_pciefd *pcie,
12391239
priv->dev->stats.rx_packets++;
12401240
kvaser_pciefd_set_skb_timestamp(pcie, skb, p->timestamp);
12411241

1242-
return netif_rx(skb);
1242+
netif_rx(skb);
1243+
1244+
return 0;
12431245
}
12441246

12451247
static void kvaser_pciefd_change_state(struct kvaser_pciefd_can *can,

0 commit comments

Comments
 (0)