diff options
author | Michael Brown | 2016-01-19 01:01:11 +0100 |
---|---|---|
committer | Michael Brown | 2016-01-19 01:01:11 +0100 |
commit | 71b83a6d00caedb62cc62a5810f99a7a1478f2ae (patch) | |
tree | 8e1224923a381d42a60f4bac985868e5294dad66 /src/drivers/bus | |
parent | [smsc95xx] Enable LEDs (diff) | |
download | ipxe-71b83a6d00caedb62cc62a5810f99a7a1478f2ae.tar.gz ipxe-71b83a6d00caedb62cc62a5810f99a7a1478f2ae.tar.xz ipxe-71b83a6d00caedb62cc62a5810f99a7a1478f2ae.zip |
[usb] Allow USB endpoints to specify a reserved header length for refills
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/bus')
-rw-r--r-- | src/drivers/bus/usb.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/drivers/bus/usb.c b/src/drivers/bus/usb.c index b1fa4efb..880e3f08 100644 --- a/src/drivers/bus/usb.c +++ b/src/drivers/bus/usb.c @@ -601,6 +601,7 @@ void usb_complete_err ( struct usb_endpoint *ep, struct io_buffer *iobuf, */ int usb_prefill ( struct usb_endpoint *ep ) { struct io_buffer *iobuf; + size_t reserve = ep->reserve; size_t len = ( ep->len ? ep->len : ep->mtu ); unsigned int fill; int rc; @@ -614,11 +615,12 @@ int usb_prefill ( struct usb_endpoint *ep ) { for ( fill = 0 ; fill < ep->max ; fill++ ) { /* Allocate I/O buffer */ - iobuf = alloc_iob ( len ); + iobuf = alloc_iob ( reserve + len ); if ( ! iobuf ) { rc = -ENOMEM; goto err_alloc; } + iob_reserve ( iobuf, reserve ); /* Add to recycled buffer list */ list_add_tail ( &iobuf->list, &ep->recycled ); @@ -639,6 +641,7 @@ int usb_prefill ( struct usb_endpoint *ep ) { */ int usb_refill ( struct usb_endpoint *ep ) { struct io_buffer *iobuf; + size_t reserve = ep->reserve; size_t len = ( ep->len ? ep->len : ep->mtu ); int rc; @@ -652,9 +655,10 @@ int usb_refill ( struct usb_endpoint *ep ) { /* Get or allocate buffer */ if ( list_empty ( &ep->recycled ) ) { /* Recycled buffer list is empty; allocate new buffer */ - iobuf = alloc_iob ( len ); + iobuf = alloc_iob ( reserve + len ); if ( ! iobuf ) return -ENOMEM; + iob_reserve ( iobuf, reserve ); } else { /* Get buffer from recycled buffer list */ iobuf = list_first_entry ( &ep->recycled, |