--- zzzz-none-000/linux-2.6.39.4/drivers/usb/storage/transport.c 2011-08-03 19:43:28.000000000 +0000 +++ puma6-arm-6490-729/linux-2.6.39.4/drivers/usb/storage/transport.c 2021-11-10 13:23:10.000000000 +0000 @@ -62,6 +62,25 @@ #include #include "../../scsi/sd.h" +/* 20170405 AVM/VGJ USB KPI */ +#if defined (CONFIG_AVM_KERNEL) + +#define BYTES_PER_GB (1024*1024*1024) + +int reset_count = 0; +module_param(reset_count, int, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(reset_count, "Count of reset errors"); + +int gb_transferred = 0; +module_param(gb_transferred, int, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(gb_transferred, "Count of gigabytes transferred"); + +int bytes_transferred = 0; +module_param(bytes_transferred, int, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(bytes_transferred, "Count of bytes transferred since last GB"); + +#endif + /*********************************************************************** * Data transfer routines @@ -879,6 +898,12 @@ usb_stor_report_device_reset(us); scsi_unlock(us_to_host(us)); us->transport_reset(us); + } else { +/* 20170405 AVM/VGJ Increment reset counter */ +#if defined (CONFIG_AVM_KERNEL) + printk(KERN_ERR "USB Storage device reset\n"); + reset_count++; +#endif } clear_bit(US_FLIDX_RESETTING, &us->dflags); last_sector_hacks(us, srb); @@ -1210,6 +1235,14 @@ return USB_STOR_TRANSPORT_NO_SENSE; } +/* 20170405 AVM/VGJ Increment bytes transferred counters */ +#if defined (CONFIG_AVM_KERNEL) + bytes_transferred += transfer_length; + if(bytes_transferred > BYTES_PER_GB) { + gb_transferred++; + bytes_transferred -= BYTES_PER_GB; + } +#endif /* command good -- note that data could be short */ return USB_STOR_TRANSPORT_GOOD;