Commit 7de971b0 authored by Peter Hurley's avatar Peter Hurley Committed by Greg Kroah-Hartman

n_tty: Factor PARMRK from normal per-char i/o

Handle PARMRK processing on the slow per-char i/o path.
Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6baad008
...@@ -1457,6 +1457,47 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c) ...@@ -1457,6 +1457,47 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c)
n_tty_receive_char_special(tty, c); n_tty_receive_char_special(tty, c);
} }
static inline void
n_tty_receive_char_fast(struct tty_struct *tty, unsigned char c)
{
struct n_tty_data *ldata = tty->disc_data;
/*
* If the previous character was LNEXT, or we know that this
* character is not one of the characters that we'll have to
* handle specially, do shortcut processing to speed things
* up.
*/
if (!test_bit(c, ldata->char_map) || ldata->lnext) {
ldata->lnext = 0;
if (tty->stopped && !tty->flow_stopped && I_IXON(tty) &&
I_IXANY(tty)) {
start_tty(tty);
process_echoes(tty);
}
if (read_cnt(ldata) >= (N_TTY_BUF_SIZE - 1)) {
/* beep if no space */
if (L_ECHO(tty))
process_output('\a', tty);
return;
}
if (L_ECHO(tty)) {
finish_erasing(ldata);
/* Record the column of first canon char. */
if (ldata->canon_head == ldata->read_head)
echo_set_canon_col(ldata);
echo_char(c, tty);
commit_echoes(tty);
}
put_tty_queue(c, ldata);
return;
}
n_tty_receive_char_special(tty, c);
}
static inline void static inline void
n_tty_receive_char_closing(struct tty_struct *tty, unsigned char c) n_tty_receive_char_closing(struct tty_struct *tty, unsigned char c)
{ {
...@@ -1610,7 +1651,7 @@ n_tty_receive_buf_fast(struct tty_struct *tty, const unsigned char *cp, ...@@ -1610,7 +1651,7 @@ n_tty_receive_buf_fast(struct tty_struct *tty, const unsigned char *cp,
if (fp) if (fp)
flag = *fp++; flag = *fp++;
if (likely(flag == TTY_NORMAL)) if (likely(flag == TTY_NORMAL))
n_tty_receive_char(tty, *cp++); n_tty_receive_char_fast(tty, *cp++);
else else
n_tty_receive_char_flagged(tty, *cp++, flag); n_tty_receive_char_flagged(tty, *cp++, flag);
} }
...@@ -1629,7 +1670,7 @@ static void __receive_buf(struct tty_struct *tty, const unsigned char *cp, ...@@ -1629,7 +1670,7 @@ static void __receive_buf(struct tty_struct *tty, const unsigned char *cp,
else if (tty->closing && !L_EXTPROC(tty)) else if (tty->closing && !L_EXTPROC(tty))
n_tty_receive_buf_closing(tty, cp, fp, count); n_tty_receive_buf_closing(tty, cp, fp, count);
else { else {
if (!preops) if (!preops && !I_PARMRK(tty))
n_tty_receive_buf_fast(tty, cp, fp, count); n_tty_receive_buf_fast(tty, cp, fp, count);
else else
n_tty_receive_buf_standard(tty, cp, fp, count); n_tty_receive_buf_standard(tty, cp, fp, count);
......
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