--- zzzz-none-000/linux-4.4.271/drivers/usb/storage/scsiglue.c 2021-06-03 06:22:09.000000000 +0000 +++ hawkeye-5590-750/linux-4.4.271/drivers/usb/storage/scsiglue.c 2023-04-19 10:22:30.000000000 +0000 @@ -540,8 +540,37 @@ } static DEVICE_ATTR_RW(max_sectors); +#if defined (CONFIG_AVM_USB_PM) +/* Output routine for the sysfs max_spinup_ms file */ +static ssize_t max_spinup_ms_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct us_data *us = host_to_us(dev_to_shost(dev)); + + return sprintf(buf, "%u\n", us->max_spinup_ms); +} + +/* Input routine for the sysfs max_sectors file */ +static ssize_t max_spinup_ms_store(struct device *dev, struct device_attribute *attr, const char *buf, + size_t count) +{ + struct us_data *us = host_to_us(dev_to_shost(dev)); + unsigned int ms; + + if (sscanf(buf, "%u", &ms) > 0) { + us->max_spinup_ms = ms; + return count; + } + return -EINVAL; +} + +static DEVICE_ATTR_RW(max_spinup_ms); +#endif + static struct device_attribute *sysfs_device_attr_list[] = { &dev_attr_max_sectors, +#if defined (CONFIG_AVM_USB_PM) + &dev_attr_max_spinup_ms, +#endif NULL, }; @@ -578,8 +607,14 @@ /* lots of sg segments can be handled */ .sg_tablesize = SCSI_MAX_SG_CHAIN_SEGMENTS, +#if 1 + /* == AVM/VGJ 20160725 - Transfer speed optimization == */ + /* limit the total size of a transfer to 512 KB to reduce USB irqs */ + .max_sectors = 1024, +#else /* limit the total size of a transfer to 120 KB */ .max_sectors = 240, +#endif /* merge commands... this seems to help performance, but * periodically someone should test to see which setting is more