+ if (test_and_clear_bit(SLF_TMOUTEVENT, &sl->flags)) {
+ printk(KERN_INFO "sllin_kthread TMOUTEVENT \n");
+ sl->rx_cnt = 0;
+ sl->rx_expect = 0;
+ sl->rx_lim = sl->lin_master ? 0 : SLLIN_BUFF_LEN;
+ sl->tx_cnt = 0;
+ sl->tx_lim = 0;
+ sl->id_to_send = false;
+ sl->data_to_send = false;
+
+ sl->lin_state = SLSTATE_IDLE;
+ }
+
+ if ((sl->lin_state == SLSTATE_IDLE) && test_bit(SLF_MSGEVENT, &sl->flags)) {
+ cf = (struct can_frame *)sl->rec_skb->data;
+
+ /* EFF CAN frame -> "Configuration" frame */
+ if (cf->can_id & CAN_EFF_FLAG) {
+ sllin_configure_frame_cache(sl, cf);
+ goto free_skb;
+ } /* SFF RTR CAN frame -> LIN header */
+ else if (cf->can_id & CAN_RTR_FLAG) {
+ printk(KERN_INFO "%s: RTR SFF CAN frame, ID = %x\n",
+ __FUNCTION__, cf->can_id & SLLIN_ID_MASK);
+
+ /* Is there Slave response in linfr_cache to be sent? */
+ if ((sl->linfr_cache[cf->can_id & SLLIN_ID_MASK].frame_fl &
+ SLLIN_LOC_SLAVE_CACHE)
+ && (sl->linfr_cache[cf->can_id & SLLIN_ID_MASK].dlc > 0)) {
+
+ printk(KERN_INFO "Sending LIN response from linfr_cache\n");
+ lin_data = &sl->linfr_cache[cf->can_id & SLLIN_ID_MASK].data;
+ lin_dlc = sl->linfr_cache[cf->can_id & SLLIN_ID_MASK].dlc;
+ } else {
+ lin_data = NULL;
+ lin_dlc = 0;
+ }
+ } else { /* SFF NON-RTR CAN frame -> LIN header + LIN response */
+ printk(KERN_INFO "%s: NON-RTR SFF CAN frame, ID = %x\n",
+ __FUNCTION__, (int)cf->can_id & SLLIN_ID_MASK);
+
+ lin_data = cf->data;
+ lin_dlc = tx_bytes = cf->can_dlc;
+ }
+
+ if (sllin_setup_msg(sl, 0, cf->can_id & SLLIN_ID_MASK,
+ lin_data, lin_dlc) != -1) {
+
+ sl->id_to_send = true;
+ sl->data_to_send = (lin_dlc > 0) ? true : false;
+ sl->dev->stats.tx_packets++;
+ sl->dev->stats.tx_bytes += tx_bytes;
+ }
+
+ free_skb:
+ clear_bit(SLF_MSGEVENT, &sl->flags);
+ kfree_skb(sl->rec_skb);
+ netif_wake_queue(sl->dev);