History log of /openbmc/obmc-console/socket-handler.c (Results 26 – 40 of 40)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# c9775ce7 07-Feb-2017 Jeremy Kerr <jk@ozlabs.org>

server: Use ringbuffer for socket backlog

Currently, the socket handler uses a linear buffer for the backlog data;
this means we need to shift up to 128kB of data after each socket
write().

This ch

server: Use ringbuffer for socket backlog

Currently, the socket handler uses a linear buffer for the backlog data;
this means we need to shift up to 128kB of data after each socket
write().

This change introduces a single-producer-multiple-consumer ringbuffer,
to avoid the need for memmove()ing data around; we can simply update
pointers instead of shifting data.

We add this as a new file (ringbuffer.c), to make it a little more
modular. To mitigate the risk of subtle pointer arithmetic issues, we
add a set of tests too.

Change-Id: Ib7c5151d3cf1f588436f5461000b6fed22d0681c
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

show more ...


# abd8e255 19-Jan-2017 Jeremy Kerr <jk@ozlabs.org>

socket-handler: fix leak if we exit with multiple clients

sh->n_clients is decremented by client_close(), so don't iterate through
the array.

Change-Id: Id44b596a483758fb8218d472a3ac411c04aacd74
Si

socket-handler: fix leak if we exit with multiple clients

sh->n_clients is decremented by client_close(), so don't iterate through
the array.

Change-Id: Id44b596a483758fb8218d472a3ac411c04aacd74
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

show more ...


# 5708dfb2 19-Jan-2017 Jeremy Kerr <jk@ozlabs.org>

socket-handler: Use a global backlog buffer instead of per-client

Currently, we keep a backlog buffer for each connected client. This is a
waste, as it's storing the same data, just at different off

socket-handler: Use a global backlog buffer instead of per-client

Currently, we keep a backlog buffer for each connected client. This is a
waste, as it's storing the same data, just at different offsets.

This change uses a global buffer for the client backlog, with each
client tracking its current position in this buffer. We just make this
fixed-size, rather than trying to dynamically allocate.

Change-Id: I20bd0772c95d8237677108c7a62d9ec6ff8ed35d
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

show more ...


# 848fc877 16-Jan-2017 Jeremy Kerr <jk@ozlabs.org>

socket-handler: don't disconnect on slow client writes

If a socket client is slow to receive data from the console server, we
start filling a buffer. Currently, if we have more data to send and the

socket-handler: don't disconnect on slow client writes

If a socket client is slow to receive data from the console server, we
start filling a buffer. Currently, if we have more data to send and the
buffer is full, we disconnect the client.

Instead, this change will start performing blocking writes to the client
if the buffer becomes full. This means we'll rate-limit the console data
(including reads from the tty device) instead of disconnecting. This
gives us a little flow control of tty data.

Fixes openbmc/obmc-console#9 .

Change-Id: Icf8ff7246f9ba776ff6fd76a25156ddd89d271d9
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

show more ...


# 243cab35 16-Jan-2017 Jeremy Kerr <jk@ozlabs.org>

socket-handler: Use MSG_NOSIGNAL

We handle -EPIPE in the error path, no need for a signal on send.

Change-Id: I709262bcda141642d57188e0a2de15e9ddb061b0
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>


# 68a2ece7 16-Jan-2017 Jeremy Kerr <jk@ozlabs.org>

socket-handler: don't set global O_NONBLOCK flag on client sockets

We will want to perform blocking writes in a future change, and setting
O_NONBLOCK on the file descriptor makes this difficult. Ins

socket-handler: don't set global O_NONBLOCK flag on client sockets

We will want to perform blocking writes in a future change, and setting
O_NONBLOCK on the file descriptor makes this difficult. Instead, don't
specify O_NONBLOCK, and use send/recv (which allows us to specify
MSG_DONTWAIT) instead of write/read.

Change-Id: I425b1e4fd37c51e27a9f334dfeff344bb7bc5f97
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

show more ...


# 9c297af2 16-Jan-2017 Jeremy Kerr <jk@ozlabs.org>

socket-handler: only send if the queue is empty

If we're able to do a non-blocking send (but haven't yet received the
POLLOUT event), then we may end up sending data out-of-order.

This change only

socket-handler: only send if the queue is empty

If we're able to do a non-blocking send (but haven't yet received the
POLLOUT event), then we may end up sending data out-of-order.

This change only attempts a write if we have nothing in the queue.

Change-Id: Ie207ee10cdee27731dab30474bbdbafb51c31760
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

show more ...


# 4d80a5b9 18-Mar-2016 Jeremy Kerr <jk@ozlabs.org>

Use non-blocking writes for clients

We may have console clients that are remote, and so the write() to those
clients may block.

Since we're single-threaded, that block will delay output to all othe

Use non-blocking writes for clients

We may have console clients that are remote, and so the write() to those
clients may block.

Since we're single-threaded, that block will delay output to all other
clients (and read from the UART).

This change uses nonblocking IO for the client sockets, and a small
buffer to handle writes that would have blocked.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

show more ...


# ce0e68b3 18-Mar-2016 Jeremy Kerr <jk@ozlabs.org>

socket-handler: Use array of pointers for clients array

When a client registers a poller, it uses a pointer to the struct client
in the poller's data field.

Since the clients are allocated in the s

socket-handler: Use array of pointers for clients array

When a client registers a poller, it uses a pointer to the struct client
in the poller's data field.

Since the clients are allocated in the socket handler's ->clients array
directly, and this array may be realloc()ed, a client's pointer may
change when other clients connect or disconnect.

This change uses separate allocations for the clients and the
sh->clients array, so the client pointers remain valid for the life of
the client.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

show more ...


# 0cff652c 17-Mar-2016 Jeremy Kerr <jk@ozlabs.org>

socket: Actually use the console-socket definitions

Since the console_socket variables aren't declared with 'extern' in
console-server.h, we ended up with default definitions for these. This
happene

socket: Actually use the console-socket definitions

Since the console_socket variables aren't declared with 'extern' in
console-server.h, we ended up with default definitions for these. This
happened to work, but with a zero-length socket path.

This change uses the console-socket.c object as intended, to provide
proper socket paths.

Now that the char[] is an extern, we'll need to get the address of it to
get the pointer value.

Also, fix the sizeof() to take account of the trailing nul.

Found by Joel Stanley <joel@jms.id.au>.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

show more ...


# fbff1c65 17-Mar-2016 Joel Stanley <joel@jms.id.au>

socket-handler: Fix realloc size

We want to allocate n_clients worth of struct client, not n_clients
worth of pointers.

Signed-off-by: Joel Stanley <joel@jms.id.au>


# 9326d779 17-Mar-2016 Jeremy Kerr <jk@ozlabs.org>

Add licence document and per-file headers

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>


# d47963e5 16-Mar-2016 Jeremy Kerr <jk@ozlabs.org>

handlers: pass config to handlers' init()

The handlers may want to consume config parameters, so pass the struct
config to their init call.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>


# 89ea8198 15-Mar-2016 Jeremy Kerr <jk@ozlabs.org>

Free remaining pollers before exiting

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>


# 2bd05186 10-Mar-2016 Jeremy Kerr <jk@ozlabs.org>

Add socket handler & console client

This change adds a socket handler to the console-server, exposing a unix
domain socket for the UART data. We use this to replace the existing
stdio handler.

We a

Add socket handler & console client

This change adds a socket handler to the console-server, exposing a unix
domain socket for the UART data. We use this to replace the existing
stdio handler.

We also add a client for this socket, allowing multiple processes to
read/write data from & to the server.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

show more ...


12