firewire: fw-sbp2: enforce s/g segment size limit
authorStefan Richter <stefanr@s5r6.in-berlin.de>
Thu, 14 Aug 2008 19:47:21 +0000 (21:47 +0200)
committerStefan Richter <stefanr@s5r6.in-berlin.de>
Wed, 15 Oct 2008 20:21:10 +0000 (22:21 +0200)
commit09b12dd4e3caff165a0f17a2f3ebd2bbc8544cc6
tree877cbb8887a2b2d0f2b8a512cce3bacf4643e48c
parent1e119fa9950dfe0e6d97470098db776110ca47a9
firewire: fw-sbp2: enforce s/g segment size limit

1. We don't need to round the SBP-2 segment size limit down to a
   multiple of 4 kB (0xffff -> 0xf000).  It is only necessary to
   ensure quadlet alignment (0xffff -> 0xfffc).

2. Use dma_set_max_seg_size() to tell the DMA mapping infrastructure
   and the block IO layer about the restriction.  This way we can
   remove the size checks and segment splitting in the queuecommand
   path.

   This assumes that no other code in the firewire stack uses
   dma_map_sg() with conflicting requirements.  It furthermore assumes
   that the controller device's platform actually allows us to set the
   segment size to our liking.  Assert the latter with a BUG_ON().

3. Also use blk_queue_max_segment_size() to tell the block IO layer
   about it.  It cannot know it because our scsi_add_host() does not
   point to the FireWire controller's device.

Thanks to Grant Grundler and FUJITA Tomonori for advice.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
drivers/firewire/fw-sbp2.c