diff options
author | Hans de Goede <hdegoede@redhat.com> | 2015-04-21 05:20:31 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-04-28 06:48:57 -0400 |
commit | ee136af4a064c2f61e2025873584d2c7ec93f4ae (patch) | |
tree | 5021e9e7d52d817f39695546f81509e929cf6ced | |
parent | a5011d44f0e1117a6db14b19b57c51f8be5673a0 (diff) |
uas: Add US_FL_MAX_SECTORS_240 flag
The usb-storage driver sets max_sectors = 240 in its scsi-host template,
for uas we do not want to do that for all devices, but testing has shown
that some devices need it.
This commit adds a US_FL_MAX_SECTORS_240 flag for such devices, and
implements support for it in uas.c, while at it it also adds support
for US_FL_MAX_SECTORS_64 to uas.c.
Cc: stable@vger.kernel.org # 3.16
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | Documentation/kernel-parameters.txt | 2 | ||||
-rw-r--r-- | drivers/usb/storage/uas.c | 10 | ||||
-rw-r--r-- | drivers/usb/storage/usb.c | 6 | ||||
-rw-r--r-- | include/linux/usb_usual.h | 2 |
4 files changed, 18 insertions, 2 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index f6befa9855c1..61ab1628a057 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -3787,6 +3787,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
3787 | READ_CAPACITY_16 command); | 3787 | READ_CAPACITY_16 command); |
3788 | f = NO_REPORT_OPCODES (don't use report opcodes | 3788 | f = NO_REPORT_OPCODES (don't use report opcodes |
3789 | command, uas only); | 3789 | command, uas only); |
3790 | g = MAX_SECTORS_240 (don't transfer more than | ||
3791 | 240 sectors at a time, uas only); | ||
3790 | h = CAPACITY_HEURISTICS (decrease the | 3792 | h = CAPACITY_HEURISTICS (decrease the |
3791 | reported device capacity by one | 3793 | reported device capacity by one |
3792 | sector if the number is odd); | 3794 | sector if the number is odd); |
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index c6109c111aab..6d3122afeed3 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c | |||
@@ -759,7 +759,10 @@ static int uas_eh_bus_reset_handler(struct scsi_cmnd *cmnd) | |||
759 | 759 | ||
760 | static int uas_slave_alloc(struct scsi_device *sdev) | 760 | static int uas_slave_alloc(struct scsi_device *sdev) |
761 | { | 761 | { |
762 | sdev->hostdata = (void *)sdev->host->hostdata; | 762 | struct uas_dev_info *devinfo = |
763 | (struct uas_dev_info *)sdev->host->hostdata; | ||
764 | |||
765 | sdev->hostdata = devinfo; | ||
763 | 766 | ||
764 | /* USB has unusual DMA-alignment requirements: Although the | 767 | /* USB has unusual DMA-alignment requirements: Although the |
765 | * starting address of each scatter-gather element doesn't matter, | 768 | * starting address of each scatter-gather element doesn't matter, |
@@ -778,6 +781,11 @@ static int uas_slave_alloc(struct scsi_device *sdev) | |||
778 | */ | 781 | */ |
779 | blk_queue_update_dma_alignment(sdev->request_queue, (512 - 1)); | 782 | blk_queue_update_dma_alignment(sdev->request_queue, (512 - 1)); |
780 | 783 | ||
784 | if (devinfo->flags & US_FL_MAX_SECTORS_64) | ||
785 | blk_queue_max_hw_sectors(sdev->request_queue, 64); | ||
786 | else if (devinfo->flags & US_FL_MAX_SECTORS_240) | ||
787 | blk_queue_max_hw_sectors(sdev->request_queue, 240); | ||
788 | |||
781 | return 0; | 789 | return 0; |
782 | } | 790 | } |
783 | 791 | ||
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index db6f6b5ec745..6c10c888f35f 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -479,7 +479,8 @@ void usb_stor_adjust_quirks(struct usb_device *udev, unsigned long *fflags) | |||
479 | US_FL_SINGLE_LUN | US_FL_NO_WP_DETECT | | 479 | US_FL_SINGLE_LUN | US_FL_NO_WP_DETECT | |
480 | US_FL_NO_READ_DISC_INFO | US_FL_NO_READ_CAPACITY_16 | | 480 | US_FL_NO_READ_DISC_INFO | US_FL_NO_READ_CAPACITY_16 | |
481 | US_FL_INITIAL_READ10 | US_FL_WRITE_CACHE | | 481 | US_FL_INITIAL_READ10 | US_FL_WRITE_CACHE | |
482 | US_FL_NO_ATA_1X | US_FL_NO_REPORT_OPCODES); | 482 | US_FL_NO_ATA_1X | US_FL_NO_REPORT_OPCODES | |
483 | US_FL_MAX_SECTORS_240); | ||
483 | 484 | ||
484 | p = quirks; | 485 | p = quirks; |
485 | while (*p) { | 486 | while (*p) { |
@@ -520,6 +521,9 @@ void usb_stor_adjust_quirks(struct usb_device *udev, unsigned long *fflags) | |||
520 | case 'f': | 521 | case 'f': |
521 | f |= US_FL_NO_REPORT_OPCODES; | 522 | f |= US_FL_NO_REPORT_OPCODES; |
522 | break; | 523 | break; |
524 | case 'g': | ||
525 | f |= US_FL_MAX_SECTORS_240; | ||
526 | break; | ||
523 | case 'h': | 527 | case 'h': |
524 | f |= US_FL_CAPACITY_HEURISTICS; | 528 | f |= US_FL_CAPACITY_HEURISTICS; |
525 | break; | 529 | break; |
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h index a7f2604c5f25..7f5f78bd15ad 100644 --- a/include/linux/usb_usual.h +++ b/include/linux/usb_usual.h | |||
@@ -77,6 +77,8 @@ | |||
77 | /* Cannot handle ATA_12 or ATA_16 CDBs */ \ | 77 | /* Cannot handle ATA_12 or ATA_16 CDBs */ \ |
78 | US_FLAG(NO_REPORT_OPCODES, 0x04000000) \ | 78 | US_FLAG(NO_REPORT_OPCODES, 0x04000000) \ |
79 | /* Cannot handle MI_REPORT_SUPPORTED_OPERATION_CODES */ \ | 79 | /* Cannot handle MI_REPORT_SUPPORTED_OPERATION_CODES */ \ |
80 | US_FLAG(MAX_SECTORS_240, 0x08000000) \ | ||
81 | /* Sets max_sectors to 240 */ \ | ||
80 | 82 | ||
81 | #define US_FLAG(name, value) US_FL_##name = value , | 83 | #define US_FLAG(name, value) US_FL_##name = value , |
82 | enum { US_DO_ALL_FLAGS }; | 84 | enum { US_DO_ALL_FLAGS }; |