From: manish.r Date: Tue, 30 Oct 2018 05:28:20 +0000 (+0530) Subject: Revert "ffs: Limit bulk transfer size to page size (4096 bytes)" X-Git-Tag: submit/tizen/20181030.052858^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=18b65bdb315e1274ee5b0b88e32b948692121484;p=sdk%2Ftarget%2Fsdbd.git Revert "ffs: Limit bulk transfer size to page size (4096 bytes)" This reverts commit fb2b9232685cf0ca860f4129dc05ddf3941d1768. --- diff --git a/src/usb_funcfs_client.c b/src/usb_funcfs_client.c index 8111388..dd9fa65 100644 --- a/src/usb_funcfs_client.c +++ b/src/usb_funcfs_client.c @@ -39,22 +39,6 @@ static const char ep0_path[] = USB_FUNCFS_SDB_PATH"/ep0"; static const char ep1_path[] = USB_FUNCFS_SDB_PATH"/ep1"; static const char ep2_path[] = USB_FUNCFS_SDB_PATH"/ep2"; -/* Limit bulk read/write transfers to page size (usually 4096 bytes) - * - * This is the size individual transfer that sdbd will request to/from - * kernel (via read/write(endpoint, ...). While the buffer could be - * bigger (ffs allows that) this size is also the size of the - * _continuous memory_ buffer allocated in kernel. Continous memory - * is scarce resource and allocation of higher order can often fail in - * a system with fragmented memory (kernel message: "sdbd: page - * allocation failure: order:6, mode:0x24040c0"). - * - * Only page-sized allocation are guaranteed to succeed and this is - * used as default below (ffs_usb_init() will update to system's page - * size, if possible). - */ -#define XFER_MAX_DEFAULT 4096 -static int xfer_max = XFER_MAX_DEFAULT; /* A local struct to store state of application */ struct usb_handle @@ -348,8 +332,7 @@ static int bulk_write(int bulkin_fd, const void *buf, size_t length) int ret; do { - int xfer_len = length - count > xfer_max ? xfer_max : length - count; - ret = sdb_write(bulkin_fd, buf + count, xfer_len); + ret = sdb_write(bulkin_fd, buf + count, length - count); if (ret < 0) { if (errno != EINTR) return ret; @@ -374,8 +357,7 @@ static int bulk_read(int bulkout_fd, void *buf, size_t length) int ret; do { - int xfer_len = length - count > xfer_max ? xfer_max : length - count; - ret = sdb_read(bulkout_fd, buf + count, xfer_len); + ret = sdb_read(bulkout_fd, buf + count, length - count); if (ret < 0) { if (errno != EINTR) { @@ -435,10 +417,6 @@ void ffs_usb_init() D("[ usb_init - using FunctionFS ]\n"); - int pagesize = sysconf(_SC_PAGESIZE); - if (pagesize > 0) - xfer_max = pagesize; - h = calloc(1, sizeof(usb_handle)); if (h == NULL) { perror("[ failed to allocate memory for usb FunctionFS bulk device ]\n");