Commit a43e3606 authored by Martin Jeřábek's avatar Martin Jeřábek Committed by Ille, Ondrej, Ing.
Browse files

driver: add debug prints to ERR interrupt handler

parent 0b4e6ad4
......@@ -369,7 +369,7 @@ static void ctucan_err_interrupt(struct net_device *ndev, union ctu_can_fd_int_s
struct can_frame *cf;
struct sk_buff *skb;
struct can_berr_counter berr;
netdev_info(ndev, "ctucan_err_interrupt");
netdev_info(ndev, "ctucan_err_interrupt: ISR = 0x%08x", isr.u32);
skb = alloc_can_err_skb(ndev, &cf);
......@@ -384,14 +384,17 @@ static void ctucan_err_interrupt(struct net_device *ndev, union ctu_can_fd_int_s
if (isr.s.epi) {
/* error passive or bus off */
enum can_state state = ctu_can_fd_read_error_state(&priv->p);
netdev_info(ndev, " epi: state = %u", state);
priv->can.state = state;
if (state == CAN_STATE_BUS_OFF) {
priv->can.can_stats.bus_off++;
netdev_info(ndev, " bus_off");
can_bus_off(ndev);
if (skb)
cf->can_id |= CAN_ERR_BUSOFF;
} else if (state == CAN_STATE_ERROR_PASSIVE) {
priv->can.can_stats.error_passive++;
netdev_info(ndev, " error_passive");
if (skb) {
cf->can_id |= CAN_ERR_CRTL;
cf->data[1] = (berr.rxerr > 127) ?
......@@ -400,11 +403,14 @@ static void ctucan_err_interrupt(struct net_device *ndev, union ctu_can_fd_int_s
cf->data[6] = berr.txerr;
cf->data[7] = berr.rxerr;
}
} else {
netdev_warn(ndev, " unhandled error state!");
}
} else if (isr.s.ei) {
/* error warning */
priv->can.state = CAN_STATE_ERROR_WARNING;
priv->can.can_stats.error_warning++;
netdev_info(ndev, " error_warning");
if (skb) {
cf->can_id |= CAN_ERR_CRTL;
cf->data[1] |= (berr.txerr > berr.rxerr) ?
......@@ -417,6 +423,7 @@ static void ctucan_err_interrupt(struct net_device *ndev, union ctu_can_fd_int_s
/* Check for Arbitration Lost interrupt */
if (isr.s.ali) {
netdev_info(ndev, " arbitration lost");
priv->can.can_stats.arbitration_lost++;
if (skb) {
cf->can_id |= CAN_ERR_LOSTARB;
......@@ -426,6 +433,7 @@ static void ctucan_err_interrupt(struct net_device *ndev, union ctu_can_fd_int_s
/* Check for RX FIFO Overflow interrupt */
if (isr.s.doi) {
netdev_info(ndev, " doi (rx fifo overflow)");
stats->rx_over_errors++;
stats->rx_errors++;
if (skb) {
......@@ -436,6 +444,7 @@ static void ctucan_err_interrupt(struct net_device *ndev, union ctu_can_fd_int_s
/* Check for Bus Error interrupt */
if (isr.s.bei) {
netdev_info(ndev, " bus error");
priv->can.can_stats.bus_error++;
stats->tx_errors++; // TODO: really?
if (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