/* Encapsulate one IP datagram and stuff into a TTY queue. */ static void x25_asy_encaps(struct x25_asy *sl, unsigned char *icp, int len) { unsigned char *p; int actual, count, mtu = sl->dev->mtu; if (len > mtu) { /* Sigh, shouldn't occur BUT ... */ len = mtu; printk(KERN_DEBUG "%s: truncating oversized transmit packet!\n", sl->dev->name); sl->dev->stats.tx_dropped++; x25_asy_unlock(sl); return; } p = icp; count = x25_asy_esc(p, sl->xbuff, len); /* Order of next two lines is *very* important. * When we are sending a little amount of data, * the transfer may be completed inside driver.write() * routine, because it's running with interrupts enabled. * In this case we *never* got WRITE_WAKEUP event, * if we did not request it before write operation. * 14 Oct 1994 Dmitry Gorodchanin. */ set_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags); actual = sl->tty->ops->write(sl->tty, sl->xbuff, count); sl->xleft = count - actual; sl->xhead = sl->xbuff + actual; /* VSV */ clear_bit(SLF_OUTWAIT, &sl->flags); /* reset outfill flag */ }
static void x25_asy_encaps(struct x25_asy *sl, unsigned char *icp, int len) { unsigned char *p; int actual, count, mtu = sl->dev->mtu; if (len > mtu) { /* */ len = mtu; printk(KERN_DEBUG "%s: truncating oversized transmit packet!\n", sl->dev->name); sl->dev->stats.tx_dropped++; x25_asy_unlock(sl); return; } p = icp; count = x25_asy_esc(p, (unsigned char *) sl->xbuff, len); /* */ set_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags); actual = sl->tty->ops->write(sl->tty, sl->xbuff, count); sl->xleft = count - actual; sl->xhead = sl->xbuff + actual; /* */ clear_bit(SLF_OUTWAIT, &sl->flags); /* */ }