linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* What's the rationale behind sending a Xoff character when the port is stopped ?
@ 2012-05-07 20:00 Karthik Manamcheri
  2012-05-07 20:50 ` Alan Cox
  0 siblings, 1 reply; 4+ messages in thread
From: Karthik Manamcheri @ 2012-05-07 20:00 UTC (permalink / raw)
  To: linux-serial

Hi,

I noticed in drivers/tty/serial/8250.c that when we transmit
characters (by calling transmit_chars), we check for uart_tx_stopped
only after sending the x_char (if any). What's the rationale behind
this ? I would expect the uart not to send ANY characters (including a
Xoff character) if its throttled (or stopped).

-- 
Karthik Manamcheri
Software R&D | Instrument Control Products | National Instruments
http://www.linkedin.com/in/kmanamcheri
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: What's the rationale behind sending a Xoff character when the port is stopped ?
  2012-05-07 20:00 What's the rationale behind sending a Xoff character when the port is stopped ? Karthik Manamcheri
@ 2012-05-07 20:50 ` Alan Cox
  2012-05-07 21:47   ` Karthik Manamcheri
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Cox @ 2012-05-07 20:50 UTC (permalink / raw)
  To: Karthik Manamcheri; +Cc: linux-serial

On Mon, 7 May 2012 15:00:50 -0500
Karthik Manamcheri <karthik.manamcheri@gmail.com> wrote:

> Hi,
> 
> I noticed in drivers/tty/serial/8250.c that when we transmit
> characters (by calling transmit_chars), we check for uart_tx_stopped
> only after sending the x_char (if any). What's the rationale behind
> this ? I would expect the uart not to send ANY characters (including a
> Xoff character) if its throttled (or stopped).

We implement xon/xoff flow control. Therefore we need to send characters
when throttled.

Think about the case where you are flow controlled for transmit and your
receive buffer fills up...

Alan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: What's the rationale behind sending a Xoff character when the port is stopped ?
  2012-05-07 20:50 ` Alan Cox
@ 2012-05-07 21:47   ` Karthik Manamcheri
  2012-05-08 14:11     ` Grant Edwards
  0 siblings, 1 reply; 4+ messages in thread
From: Karthik Manamcheri @ 2012-05-07 21:47 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-serial

In the case when I am flow controlled (meaning I received a Xoff from
the other end) and my receive buffer fills up, sending a Xoff to the
other end might overflow the buffer for the other guy, right ? Is that
Ok ?

On Mon, May 7, 2012 at 3:50 PM, Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
> On Mon, 7 May 2012 15:00:50 -0500
> Karthik Manamcheri <karthik.manamcheri@gmail.com> wrote:
>
>> Hi,
>>
>> I noticed in drivers/tty/serial/8250.c that when we transmit
>> characters (by calling transmit_chars), we check for uart_tx_stopped
>> only after sending the x_char (if any). What's the rationale behind
>> this ? I would expect the uart not to send ANY characters (including a
>> Xoff character) if its throttled (or stopped).
>
> We implement xon/xoff flow control. Therefore we need to send characters
> when throttled.
>
> Think about the case where you are flow controlled for transmit and your
> receive buffer fills up...
>
> Alan



-- 
Karthik Manamcheri
Software R&D | Instrument Control Products | National Instruments
http://www.karthikmanamcheri.com
http://www.linkedin.com/in/kmanamcheri
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: What's the rationale behind sending a Xoff character when the port is stopped ?
  2012-05-07 21:47   ` Karthik Manamcheri
@ 2012-05-08 14:11     ` Grant Edwards
  0 siblings, 0 replies; 4+ messages in thread
From: Grant Edwards @ 2012-05-08 14:11 UTC (permalink / raw)
  To: linux-serial

On 2012-05-07, Karthik Manamcheri <karthik.manamcheri@gmail.com> wrote:

> In the case when I am flow controlled (meaning I received a Xoff from
> the other end) and my receive buffer fills up, sending a Xoff to the
> other end might overflow the buffer for the other guy, right?

Not really.  The Xoff doesn't go into the other guy's receive buffer.
It's processed by the flow-control software (or hardware) before it
gets to the receive buffer.

-- 
Grant Edwards               grant.b.edwards        Yow! I put aside my copy
                                  at               of "BOWLING WORLD" and
                              gmail.com            think about GUN CONTROL
                                                   legislation...


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-05-08 14:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-07 20:00 What's the rationale behind sending a Xoff character when the port is stopped ? Karthik Manamcheri
2012-05-07 20:50 ` Alan Cox
2012-05-07 21:47   ` Karthik Manamcheri
2012-05-08 14:11     ` Grant Edwards

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).