* to use the slcan driver with an existing kernel.
*/
-#define SLC_CHECK_TRANSMIT
#define SLCAN_MAGIC 0x53CA
static int maxdev = 10; /* MAX number of SLCAN channels;
actual = sl->tty->driver->write(sl->tty, sl->xbuff, strlen(sl->xbuff));
#else
actual = sl->tty->ops->write(sl->tty, sl->xbuff, strlen(sl->xbuff));
-#endif
-#ifdef SLC_CHECK_TRANSMIT
- sl->dev->trans_start = jiffies;
#endif
sl->xleft = strlen(sl->xbuff) - actual;
sl->xhead = sl->xbuff + actual;
sl->xhead += actual;
}
-static void slc_tx_timeout(struct net_device *dev)
-{
- struct slcan *sl = netdev_priv(dev);
-
- spin_lock(&sl->lock);
-
- if (netif_queue_stopped(dev)) {
- if (!netif_running(dev))
- goto out;
-
- /* May be we must check transmitter timeout here ?
- * 14 Oct 1994 Dmitry Gorodchanin.
- */
-#ifdef SLC_CHECK_TRANSMIT
- if (time_before(jiffies, dev->trans_start + 20 * HZ)) {
- /* 20 sec timeout not reached */
- goto out;
- }
- printk(KERN_WARNING "%s: transmit timed out, %s?\n", dev->name,
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
- (sl->tty->driver->chars_in_buffer(sl->tty) || sl->xleft)
-#else
- (tty_chars_in_buffer(sl->tty) || sl->xleft)
-#endif
- ? "bad line quality" : "driver error");
- sl->xleft = 0;
- sl->tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP);
- netif_wake_queue(sl->dev);
-#endif
- }
-out:
- spin_unlock(&sl->lock);
-}
-
/******************************************
* Routines looking at netdevice side.
.ndo_open = slc_open,
.ndo_stop = slc_close,
.ndo_start_xmit = slc_xmit,
-#ifdef SLC_CHECK_TRANSMIT
- .ndo_tx_timeout = slc_tx_timeout,
-#endif
};
#endif
dev->mtu = sizeof(struct can_frame);
dev->type = ARPHRD_CAN;
-#ifdef SLC_CHECK_TRANSMIT
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28)
- dev->tx_timeout = slc_tx_timeout;
-#endif
- dev->watchdog_timeo = 20*HZ;
-#endif
/* New-style flags. */
dev->flags = IFF_NOARP;