Skip to content

Commit 36aea60

Browse files
Jimmy Assarssonmarckleinebudde
authored andcommitted
can: kvaser_pciefd: kvaser_pciefd_rx_error_frame(): increase correct stats->{rx,tx}_errors counter
Check the direction bit in the error frame packet (EPACK) to determine which net_device_stats {rx,tx}_errors counter to increase. Fixes: 26ad340 ("can: kvaser_pciefd: Add driver for Kvaser PCIEcan devices") Link: https://lore.kernel.org/all/[email protected] Cc: [email protected] Signed-off-by: Jimmy Assarsson <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent a50e659 commit 36aea60

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/net/can/kvaser_pciefd.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ MODULE_DESCRIPTION("CAN driver for Kvaser CAN/PCIe devices");
248248
#define KVASER_PCIEFD_SPACK_EWLR BIT(23)
249249
#define KVASER_PCIEFD_SPACK_EPLR BIT(24)
250250

251+
/* Kvaser KCAN_EPACK second word */
252+
#define KVASER_PCIEFD_EPACK_DIR_TX BIT(0)
253+
251254
struct kvaser_pciefd;
252255

253256
struct kvaser_pciefd_can {
@@ -1285,7 +1288,10 @@ static int kvaser_pciefd_rx_error_frame(struct kvaser_pciefd_can *can,
12851288

12861289
can->err_rep_cnt++;
12871290
can->can.can_stats.bus_error++;
1288-
stats->rx_errors++;
1291+
if (p->header[1] & KVASER_PCIEFD_EPACK_DIR_TX)
1292+
stats->tx_errors++;
1293+
else
1294+
stats->rx_errors++;
12891295

12901296
can->bec.txerr = bec.txerr;
12911297
can->bec.rxerr = bec.rxerr;

0 commit comments

Comments
 (0)