sl->dev->stats.rx_packets++;
sl->dev->stats.rx_bytes += cf.can_dlc;
-
-
}
/**
*/
void sllin_report_error(struct sllin *sl, int err)
{
+ switch (err) {
+ case LIN_ERR_CHECKSUM:
+ sl->dev->stats.rx_crc_errors++;
+ break;
+
+ case LIN_ERR_RX_TIMEOUT:
+ sl->dev->stats.rx_errors++;
+ break;
+ }
+
sllin_send_canfr(sl, 0 | CAN_EFF_FLAG |
(err & ~LIN_ID_MASK), NULL, 0);
}
if (retval)
return retval;
- //udelay(712);
+ /* udelay(712); */
usleep_range_min = (1000000l * SLLIN_SAMPLES_PER_CHAR) / break_baud;
usleep_range_max = usleep_range_min + 50;
usleep_range(usleep_range_min, usleep_range_max);
clear_bit(SLF_MSGEVENT, &sl->flags);
kfree_skb(sl->tx_req_skb);
netif_wake_queue(sl->dev);
+ hrtimer_start(&sl->rx_timer,
+ ktime_add(ktime_get(), sl->rx_timer_timeout),
+ HRTIMER_MODE_ABS);
break;
case SLSTATE_BREAK_SENT:
break;
case SLSTATE_ID_SENT:
+ hrtimer_cancel(&sl->rx_timer);
sl->id_to_send = false;
if (sl->data_to_send) {
sllin_send_tx_buff(sl);
}
}
+ /* Be aware, no BREAK here */
case SLSTATE_RESPONSE_WAIT_BUS:
if (sl->rx_cnt < sl->rx_expect)
continue;
if (sllin_rx_validate(sl) == -1) {
pr_debug("sllin: RX validation failed.\n");
sllin_report_error(sl, LIN_ERR_CHECKSUM);
- //FIXME tx_stat.err++
} else {
- // send CAN non-RTR frame with data
+ /* Send CAN non-RTR frame with data */
pr_debug("sllin: sending NON-RTR CAN"
"frame with LIN payload.");
- sll_bump(sl); //send packet to the network layer
+ sll_bump(sl); /* send packet to the network layer */
}
sl->id_to_send = false;
if (sl->rx_cnt < sl->tx_lim)
continue;
- sll_bump(sl); //send packet to the network layer
+ sll_bump(sl); /* send packet to the network layer */
pr_debug("sllin: response sent ID %d len %d\n",
sl->rx_buff[SLLIN_BUFF_ID], sl->rx_cnt - SLLIN_BUFF_DATA - 1);
sl->lin_state = SLSTATE_IDLE;
break;
}
-
-
-
-
- /* sl->dev->stats.tx_packets++; send frames statistic */
- /* netif_wake_queue(sl->dev); allow next Tx packet arrival */
}
hrtimer_cancel(&sl->rx_timer);