--- zzzz-none-000/linux-5.4.213/drivers/usb/storage/scsiglue.c 2022-09-15 10:04:56.000000000 +0000 +++ alder-5690pro-762/linux-5.4.213/drivers/usb/storage/scsiglue.c 2024-08-14 09:02:08.000000000 +0000 @@ -588,8 +588,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, }; @@ -644,7 +673,14 @@ * and Apple Mac OS X 10.11 limiting transfers to 256 sectors for USB2 * and 2048 for USB3 devices. */ +#if defined(CONFIG_AVM_ENHANCED) + /* == AVM/WKR 20230426 - transfer speed optimization for USB 2.0 devices == */ + /* 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 /* emulated HBA */ .emulated = 1,