Re: PROBLEM: tty_buffer_request_room() vs. ppp_sync_input(): asingle buffer may contains several frames

From: Alan Cox
Date: Thu Sep 09 2010 - 10:27:54 EST


> My problem is that the "tty_buffer_request_room()" function may use the
> same buffer (the tail) if it finds enough place to store the incoming
> frame in.

Correct. The tty layer doesn't preserve record boundaries.

> Please let me know if I'm right and if this fix is the only way to pass
> synchronous frames to upper layers.

The tty buffer system is not intended for framed data. It doesn't handle
all sorts of cases of it and will split buffers and pack them as it sees
fit.

There is a limited provision for tty style handling of such interfaces
because some hardware is dual mode but it requires you don't use the tty
buffering helpers.

If your hardware is a straight sync board you probably want to look at
drivers/net/wan/hdlc*c which provides the interfaces so you can just
throw frames straight off a card into the network layer and appear as a
network stack. Unlike n_syncppp it also supports other protocols pretty
much for free (Cisco HDLC etc)

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/