--- zzzz-none-000/linux-4.1.52/drivers/usb/storage/scsiglue.c 2018-05-28 02:26:45.000000000 +0000 +++ bcm63-7530ax-731/linux-4.1.52/drivers/usb/storage/scsiglue.c 2022-03-02 11:37:13.000000000 +0000 @@ -531,9 +531,38 @@ } static DEVICE_ATTR_RW(max_sectors); +#if defined (CONFIG_AVM_USB_SUSPEND) +/* Output routine for the sysfs max_spinup_ms file */ +static ssize_t show_max_spinup_ms(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 store_max_spinup_ms(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(max_spinup_ms, S_IRUGO | S_IWUSR, show_max_spinup_ms, store_max_spinup_ms); +#endif + static struct device_attribute *sysfs_device_attr_list[] = { - &dev_attr_max_sectors, - NULL, + &dev_attr_max_sectors, +#if defined (CONFIG_AVM_USB_SUSPEND) + &dev_attr_max_spinup_ms, +#endif + NULL, }; /* @@ -570,8 +599,18 @@ /* lots of sg segments can be handled */ .sg_tablesize = SCSI_MAX_SG_CHAIN_SEGMENTS, +#if defined(CONFIG_AVM_KERNEL) + /* limit the total size of a transfer to 1024 KB */ + .max_sectors = 2048, +#else +#if defined(CONFIG_BCM_KF_USB_STORAGE) + /* limit the total size of a transfer to 256 KB */ + .max_sectors = 512, +#else /* limit the total size of a transfer to 120 KB */ .max_sectors = 240, +#endif +#endif /* merge commands... this seems to help performance, but * periodically someone should test to see which setting is more