Re: [PATCH 1/3] virtio_console:Merge struct buffer_token into struct port_buffer

2012-10-01 Thread Amit Shah
On (Wed) 26 Sep 2012 [09:48:12], Sjur BRENDELAND wrote: > > > This merge reduces code size by unifying the approach for > > > sending scatter-lists and regular buffers. Any type of > > > write operation (splice, write, put_chars) will now allocate > > > a port_buffer and send_buf() and free_buf()

Re: [PATCH 1/3] virtio_console:Merge struct buffer_token into struct port_buffer

2012-10-01 Thread Amit Shah
On (Tue) 25 Sep 2012 [15:47:15], sjur.brandel...@stericsson.com wrote: > From: Sjur Brændeland > > This merge reduces code size by unifying the approach for > sending scatter-lists and regular buffers. Any type of > write operation (splice, write, put_chars) will now allocate > a port_buffer and

Re: [PATCH 1/3] virtio_console:Merge struct buffer_token into struct port_buffer

2012-10-01 Thread Amit Shah
On (Tue) 25 Sep 2012 [15:47:15], sjur.brandel...@stericsson.com wrote: From: Sjur Brændeland sjur.brandel...@stericsson.com This merge reduces code size by unifying the approach for sending scatter-lists and regular buffers. Any type of write operation (splice, write, put_chars) will now

Re: [PATCH 1/3] virtio_console:Merge struct buffer_token into struct port_buffer

2012-10-01 Thread Amit Shah
On (Wed) 26 Sep 2012 [09:48:12], Sjur BRENDELAND wrote: This merge reduces code size by unifying the approach for sending scatter-lists and regular buffers. Any type of write operation (splice, write, put_chars) will now allocate a port_buffer and send_buf() and free_buf() can always

RE: [PATCH 1/3] virtio_console:Merge struct buffer_token into struct port_buffer

2012-09-26 Thread Rusty Russell
Sjur BRENDELAND writes: >> This allocates one redundant sg entry when nrbuf > 0, >> but I think it is OK. (just a comment) > > I did this on purpose for the sake of simplicity, but I can > change this to something like: >alloc_size = sizeof(*buf) + sizeof(buf->sg) * max(nrbufs - 1, 1);

Re: [PATCH 1/3] virtio_console:Merge struct buffer_token into struct port_buffer

2012-09-26 Thread Masami Hiramatsu
(2012/09/26 16:48), Sjur BRENDELAND wrote: >>> -static struct port_buffer *alloc_buf(size_t buf_size) >>> +static struct port_buffer *alloc_buf(struct virtqueue *vq, size_t buf_size, >>> +int nrbufs) >>> { >>> struct port_buffer *buf; >>> + size_t alloc_size;

RE: [PATCH 1/3] virtio_console:Merge struct buffer_token into struct port_buffer

2012-09-26 Thread Sjur BRENDELAND
> > This merge reduces code size by unifying the approach for > > sending scatter-lists and regular buffers. Any type of > > write operation (splice, write, put_chars) will now allocate > > a port_buffer and send_buf() and free_buf() can always be used. > > Thanks! > This looks much nicer and

RE: [PATCH 1/3] virtio_console:Merge struct buffer_token into struct port_buffer

2012-09-26 Thread Sjur BRENDELAND
This merge reduces code size by unifying the approach for sending scatter-lists and regular buffers. Any type of write operation (splice, write, put_chars) will now allocate a port_buffer and send_buf() and free_buf() can always be used. Thanks! This looks much nicer and simpler. I

Re: [PATCH 1/3] virtio_console:Merge struct buffer_token into struct port_buffer

2012-09-26 Thread Masami Hiramatsu
(2012/09/26 16:48), Sjur BRENDELAND wrote: -static struct port_buffer *alloc_buf(size_t buf_size) +static struct port_buffer *alloc_buf(struct virtqueue *vq, size_t buf_size, +int nrbufs) { struct port_buffer *buf; + size_t alloc_size; - buf =

RE: [PATCH 1/3] virtio_console:Merge struct buffer_token into struct port_buffer

2012-09-26 Thread Rusty Russell
Sjur BRENDELAND sjur.brandel...@stericsson.com writes: This allocates one redundant sg entry when nrbuf 0, but I think it is OK. (just a comment) I did this on purpose for the sake of simplicity, but I can change this to something like: alloc_size = sizeof(*buf) + sizeof(buf-sg) *

Re: [PATCH 1/3] virtio_console:Merge struct buffer_token into struct port_buffer

2012-09-25 Thread Masami Hiramatsu
(2012/09/25 22:47), sjur.brandel...@stericsson.com wrote: > From: Sjur Brændeland > > This merge reduces code size by unifying the approach for > sending scatter-lists and regular buffers. Any type of > write operation (splice, write, put_chars) will now allocate > a port_buffer and send_buf()

Re: [PATCH 1/3] virtio_console:Merge struct buffer_token into struct port_buffer

2012-09-25 Thread Masami Hiramatsu
(2012/09/25 22:47), sjur.brandel...@stericsson.com wrote: From: Sjur Brændeland sjur.brandel...@stericsson.com This merge reduces code size by unifying the approach for sending scatter-lists and regular buffers. Any type of write operation (splice, write, put_chars) will now allocate a