mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-06 17:21:22 +00:00
DM USB: dynamically allocate block count for struct usb_xfer
The block count of the struct usb_xfer is hard coded by the macro USB_MAX_XFER_BLOCKS (1024), it wastes memory if 1024 blocks are allocated for low speed transfer such as control transfer or interrupt transfer. This patch introduces a new method to allocate different number of blocks according to different endpoint type. Tracked-On: #3628 Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com> Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
@@ -106,7 +106,7 @@ usb_block_append(struct usb_xfer *xfer, void *buf, int blen, void *hcb,
|
||||
{
|
||||
struct usb_block *xb;
|
||||
|
||||
if (xfer->ndata >= USB_MAX_XFER_BLOCKS)
|
||||
if (xfer->ndata >= xfer->max_blk_cnt)
|
||||
return NULL;
|
||||
|
||||
if (hcb == NULL)
|
||||
@@ -120,7 +120,7 @@ usb_block_append(struct usb_xfer *xfer, void *buf, int blen, void *hcb,
|
||||
xb->bdone = 0;
|
||||
xb->type = USB_DATA_NONE;
|
||||
xfer->ndata++;
|
||||
xfer->tail = index_inc(xfer->tail, USB_MAX_XFER_BLOCKS);
|
||||
xfer->tail = index_inc(xfer->tail, xfer->max_blk_cnt);
|
||||
return xb;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user