1. 31 1月, 2008 14 次提交
    • S
      firewire: fw-core: react on bus resets while the config ROM is being fetched · f8d2dc39
      Stefan Richter 提交于
      read_rom() obtained a fresh new fw_device.generation for each read
      transaction.  Hence it was able to continue reading in the middle of the
      ROM even if a bus reset happened.  However the device may have modified
      the ROM during the reset.  We would end up with a corrupt fetched ROM
      image then.
      
      Although all of this is quite unlikely, it is not impossible.
      Therefore we now restart reading the ROM if the bus generation changed.
      
      Note, the memory barrier in read_rom() is still necessary according to
      tests by Jarod Wilson, despite of the ->generation access being moved up
      in the call chain.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      
      This is essentially what I've been beating on locally, and I've yet to hit
      another config rom read failure with it.
      Signed-off-by: NJarod Wilson <jwilson@redhat.com>
      f8d2dc39
    • S
      firewire: enforce access order between generation and node ID, fix "giving up on config rom" · b5d2a5e0
      Stefan Richter 提交于
      fw_device.node_id and fw_device.generation are accessed without mutexes.
      We have to ensure that all readers will get to see node_id updates
      before generation updates.
      
      Fixes an inability to recognize devices after "giving up on config rom",
      https://bugzilla.redhat.com/show_bug.cgi?id=429950Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      
      Reviewed by Nick Piggin <nickpiggin@yahoo.com.au>.
      
      Verified to fix 'giving up on config rom' issues on multiple system and
      drive combinations that were previously affected.
      Signed-off-by: NJarod Wilson <jwilson@redhat.com>
      Signed-off-by: NKristian Høgsberg <krh@redhat.com>
      b5d2a5e0
    • S
      firewire: fw-cdev: use device generation, not card generation · cf5a56ac
      Stefan Richter 提交于
      We have to use the fw_device.generation here, not the fw_card.generation,
      because the generation must never be newer than the node ID when we emit
      a transaction.  This cannot be guaranteed with fw_card.generation.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      
      Verified in concert with subsequent memory barriers patch to fix 'giving
      up on config rom' issues on multiple system and drive combinations that
      were previously affected.
      Signed-off-by: NJarod Wilson <jwilson@redhat.com>
      cf5a56ac
    • S
      firewire: fw-sbp2: use device generation, not card generation · 5a8a1bcd
      Stefan Richter 提交于
      There was a small window where a login or reconnect job could use an
      already updated card generation with an outdated node ID.  We have to
      use the fw_device.generation here, not the fw_card.generation, because
      the generation must never be newer than the node ID when we emit a
      transaction.  This cannot be guaranteed with fw_card.generation.
      
      Furthermore, the target's and initiator's node IDs can be obtained from
      fw_device and fw_card.  Dereferencing their underlying topology objects
      is not necessary.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      
      Verified in concert with subsequent memory barriers patch to fix 'giving
      up on config rom' issues on multiple system and drive combinations that
      were previously affected.
      Signed-off-by: NJarod Wilson <jwilson@redhat.com>
      5a8a1bcd
    • S
      firewire: fw-sbp2: try to increase reconnect_hold (speed up reconnection) · 14dc992a
      Stefan Richter 提交于
      Ask the target to grant 4 seconds instead of the standard and minimum of
      1 second window after bus reset for reconnection.  This accelerates
      reconnection if there are more than one targets on the bus:  If a login
      and inquiry to one target blocks the fw-sbp2 workqueue for more than 1s
      after bus reset, we now still can reconnect to the other target.
      
      Before that, fw-sbp2's reconnect attempts would be rejected with "error
      status: 0:9" (function rejected), and fw-sbp2 would finally re-login.
      All those futile reconnect attemps cost extra time until the target
      which needs re-login is ready for I/O again.
      
      The reconnect timeout field in the login ORB doesn't have to be honored
      by the target though.  I found that we could get up to
        - allegedly 32768s from an old OXFW911 firmware
        - 256s from LSI bridges
        - 4s from OXUF922 and OXFW912 bridges,
        - 2s from TI bridges,
        - only the standard 1s from Initio and Prolific bridges and from
          Apple OpenFirmware in target mode.
      
      We just try to get 4 seconds which already covers the case of a few
      HDDs on the same bus quite nicely.
      
      A minor drawback occurs in the following (rare and impractical) border
      case:
        - two initiators are there, initiator 1 holds an exclusive login to
          a target,
        - initiator 1 goes off the bus,
        - target refuses login attempts from initiator 2 until reconnect_hold
          seconds after bus reset.
      
      An alternative approach to the issue at hand would be to parallelize
      fw-sbp2's reconnect and login work.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      Acked-by: NJarod Wilson <jwilson@redhat.com>
      14dc992a
    • S
      firewire: fw-sbp2: skip unnecessary logout · 4dccd020
      Stefan Richter 提交于
      Don't attempt to send a logout ORB if the target was already unplugged
      or had its link switched off.  If two targets are attached, this
      enhances the chance to quickly reconnect to the remaining target when
      one target is plugged out.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      Acked-by: NJarod Wilson <jwilson@redhat.com>
      4dccd020
    • D
      firewire: fw-ohci: Dynamically allocate buffers for DMA descriptors · fe5ca634
      David Moore 提交于
      Previously, the fw-ohci driver used fixed-length buffers for storing
      descriptors for isochronous receive DMA programs.  If an application
      (such as libdc1394) generated a DMA program that was too large, fw-ohci
      would reach the limit of its fixed-sized buffer and return an error to
      userspace.
      
      This patch replaces the fixed-length ring-buffer with a linked-list of
      page-sized buffers.  Additional buffers can be dynamically allocated and
      appended to the list when necessary.  For a particular context, buffers
      are kept around after use and reused as necessary, so there is no
      allocation taking place after the DMA program is generated for the first
      time.
      
      In addition, the buffers it uses are coherent for DMA so there is no
      syncing required before and after writes.  This syncing wasn't properly
      done in the previous version of the code.
      
      -
      
      This is the fourth version of my patch that replaces a fixed-length
      buffer for DMA descriptors with a dynamically allocated linked-list of
      buffers.
      
      As we discovered with the last attempt, new context programs are
      sometimes queued from interrupt context, making it unacceptable to call
      tasklet_disable() from context_get_descriptors().
      
      This version of the patch uses ohci->lock for all locking needs instead
      of tasklet_disable/enable.  There is a new requirement that
      context_get_descriptors() be called while holding ohci->lock.  It was
      already held for the AT context, so adding the requirement for the iso
      context did not seem particularly onerous.  In addition, this has the
      side benefit of allowing iso queue to be safely called from concurrent
      user-space threads, which previously was not safe.
      Signed-off-by: NDavid Moore <dcm@acm.org>
      Signed-off-by: NKristian Høgsberg <krh@redhat.com>
      Signed-off-by: NJarod Wilson <jwilson@redhat.com>
      
      -
      
      Fixes the following issues:
        - Isochronous reception stopped prematurely if an application used a
          larger buffer.  (Reproduced with coriander.)
        - Isochronous reception stopped after one or a few frames on VT630x
          in OHCI 1.0 mode.  (Fixes reception in coriander, but dvgrab still
          doesn't work with these chips.)
      
      Patch update: struct member alignment, whitespace nits
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      fe5ca634
    • S
      firewire: fw-ohci: CycleTooLong interrupt management · bb9f2206
      Stefan Richter 提交于
      The firewire-ohci driver so far lacked the ability to resume cycle
      master duty after that condition happened, as added to ohci1394 in Linux
      2.6.18 by commit 57fdb58f.  This ports
      this patch to fw-ohci.
      
      The "cycle too long" condition has been seen in practice
        - with IIDC cameras if a mode with packets too large for a speed is
          chosen,
        - sporadically when capturing DV on a VIA VT6306 card with ohci1394/
          ieee1394/ raw1394/ dvgrab 2.
          https://bugzilla.redhat.com/show_bug.cgi?id=415841#c7
      (This does not fix Fedora bug 415841.)
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      bb9f2206
    • R
      firewire: Fix extraction of source node id · 478b233e
      Rabin Vincent 提交于
      Fix extraction of the source node id from the packet header.
      Signed-off-by: NRabin Vincent <rabin@rab.in>
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      478b233e
    • D
      firewire: fw-ohci: Bug fixes for packet-per-buffer support · bcee893c
      David Moore 提交于
      This patch corrects a number of bugs in the current OHCI 1.0
      packet-per-buffer support:
      
      1. Correctly deal with payloads that cross a page boundary.  The
      previous version would not split the descriptor at such a boundary,
      potentially corrupting unrelated memory.
      
      2. Allow user-space to specify multiple packets per struct
      fw_cdev_iso_packet in the same way that dual-buffer allows.  This is
      signaled by header_length being a multiple of header_size.  This
      multiple determines the number of packets.  The payload size allocated
      per packet is determined by dividing the total payload size by the
      number of packets.
      
      3. Make sync support work properly for packet-per-buffer.
      
      I have tested this patch with libdc1394 by forcing my OHCI 1.1
      controller to use the packet-per-buffer support instead of dual-buffer.
      
      I would greatly appreciate testing by those who have a DV devices and
      other types of iso streamers to make sure I didn't cause any
      regressions.
      
      Stefan, with this patch, I'm hoping that libdc1394 will work with all
      your OHCI 1.0 controllers now.
      
      The one bit of future work that remains for packet-per-buffer support is
      the automatic compaction of short payloads that I discussed with
      Kristian.
      Signed-off-by: NDavid Moore <dcm@acm.org>
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      bcee893c
    • D
      firewire: fw-ohci: Fix for dualbuffer three-or-more buffers · 0642b657
      David Moore 提交于
      This patch fixes the problem where different OHCI 1.1 controllers behave
      differently when a received iso packet straddles three or more buffers
      when using the dual-buffer receive mode.  Two changes are made in order
      to handle this situation:
      
      1. The packet sync DMA descriptor is given a non-zero header length and
      non-zero payload length.  This is because zero-payload descriptors are
      not discussed in the OHCI 1.1 specs and their behavior is thus
      undefined.  Instead we use a header size just large enough for a single
      header and a payload length of 4 bytes for this first descriptor.
      
      2. As we process received packets in the context's tasklet, read the
      packet length out of the headers.  Keep track of the running total of
      the packet length as "excess_bytes", so we can ignore any descriptors
      where no packet starts or ends.  These descriptors may not have had
      their first_res_count or second_res_count fields updated by the
      controller so we cannot rely on those values.
      
      The main drawback of this patch is that the excess_bytes value might get
      "out of sync" with the packet descriptors if something strange happens
      to the DMA program.  I'm not if such a thing could ever happen, but I
      appreciate any suggestions in making it more robust.
      
      Also, the packet-per-buffer support may need a similar fix to deal with
      issue 1, but I haven't done any work on that yet.
      
      Stefan, I'm hoping that with this patch, all your OHCI 1.1 controllers
      will work properly with an unmodified version of libdc1394.
      Signed-off-by: NDavid Moore <dcm@acm.org>
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      0642b657
    • S
      firewire: fw-sbp2: remove unused misleading macro · 4b11ea96
      Stefan Richter 提交于
      SBP2_MAX_SECTORS is nowhere used in fw-sbp2.
      It merely got copied over from sbp2 where it played a role in the past.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      4b11ea96
    • S
      b7811da2
    • S
      firewire: fw-sbp2: refactor workq and kref handling · 285838eb
      Stefan Richter 提交于
      This somewhat reduces the size of firewire-sbp2.ko.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      285838eb
  2. 12 1月, 2008 1 次提交
  3. 11 12月, 2007 1 次提交
    • J
      firewire: OHCI 1.0 Isochronous Receive support · a186b4a6
      Jarod Wilson 提交于
      Third rendition of FireWire OHCI 1.0 Isochronous Receive support, using a
      zer-copy method similar to OHCI 1.1 which puts the IR data payload directly
      into the userspace buffer. The zero-copy implementation eliminates the
      video artifacts, audio popping, and buffer underrun problems seen with
      version 1 of this patch, as well as fixing a regression in OHCI 1.1 support
      introduced by version 2 of this patch.
      
      Successfully tested in OHCI 1.1 mode on the following chipsets:
      
      - NEC uPD72847 (rev 01), OHCI 1.1 (PCI)
      - Ti XIO2200(A) (rev 01), OHCI 1.1 (PCIe)
      - Ti TSB41AB2 (rev 01), OHCI 1.1 (PCI on SB Audigy)
      - Apple UniNorth 2 (rev 81), OHCI 1.1 (PowerBook G4 onboard)
      
      Successfully tested in OHCI 1.0 mode on the following chipsets:
      
      - Agere FW323 (rev 06), OHCI 1.0 (Mac Mini onboard)
      - Agere FW323 (rev 06), OHCI 1.0 (PCI)
      - Via VT6306 (rev 46), OHCI 1.0 (PCI)
      - NEC OrangeLink (rev 01), OHCI 1.0 (PCI)
      - NEC uPD72847 (rev 01), OHCI 1.1 (PCI)
      - Ti XIO2200(A) (rev 01), OHCI 1.1 (PCIe)
      
      The bulk of testing was done in an x86_64 system, but was also successfully
      sanity-tested on other systems, including a PPC(32) PowerBook G4 and an i686
      EPIA M10k. Crude benchmarking (watching top during capture) puts the cpu
      utilization during capture on the EPIA's 1GHz Via C3 processor around 13%,
      which is down from 30% with the v1 code.
      
      Some implementation details:
      
      To maintain the same userspace API as dual-buffer mode, we set up two
      descriptors for every incoming packet. The first is an INPUT_MORE descriptor,
      pointing to a buffer large enough to hold just the packet's iso headers,
      immediately followed by an INPUT_LAST descriptor, pointing to a chunk of the
      userspace buffer big enough for the packet's data payload. With this setup,
      each incoming packet fills in these two descriptors in a manner that very
      closely emulates dual-buffer receive, to the point where the bulk of the
      handle_ir_* code is now identical between the two (and probably primed for
      some restructuring to share code between them).
      
      The only caveat I have at the moment is that neither of my OHCI 1.0 Via
      VT6307-based FireWire controllers work particularly well with this code
      for reasons I have yet to figure out.
      Signed-off-by: NJarod Wilson <jwilson@redhat.com>
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      a186b4a6
  4. 07 11月, 2007 1 次提交
    • S
      firewire: fw-sbp2: fix refcounting · 7c45d191
      Stefan Richter 提交于
      Since patch "fw-sbp2: use an own workqueue (fix system responsiveness)"
      increased parallelism between fw-sbp2 and fw-core, it was possible that
      fw-sbp2 didn't release the SCSI device when the FireWire device was
      disconnected.
      
      This happened if sbp2_update() ran during sbp2_login(), because a bus
      reset occurred during sbp2_login().  The sbp2_login() work would [try
      to] reschedule itself because it failed due to the bus reset, and it
      would _not_ drop its reference on the target.  However, sbp2_update()
      would schedule sbp2_login() too before sbp2_login() rescheduled itself
      and hence sbp2_update() would take an additional reference.  And then
      we would have one reference too many.
      
      The fix is to _always_ drop the reference when leaving the sbp2_login()
      work.  If the sbp2_login() work reschedules itself, it takes a
      reference, but only if it wasn't already rescheduled by sbp2_update().
      
      Ditto in the sbp2_reconnect() work.
      
      The resulting code is actually simpler than before:  We _always_ take
      a reference when successfully scheduling work.  And we _always_ drop
      a reference when leaving a workqueue job.  No exceptions.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      7c45d191
  5. 01 11月, 2007 1 次提交
  6. 23 10月, 2007 2 次提交
  7. 20 10月, 2007 1 次提交
  8. 17 10月, 2007 16 次提交
  9. 15 10月, 2007 1 次提交
  10. 13 10月, 2007 1 次提交
    • K
      Driver core: change add_uevent_var to use a struct · 7eff2e7a
      Kay Sievers 提交于
      This changes the uevent buffer functions to use a struct instead of a
      long list of parameters. It does no longer require the caller to do the
      proper buffer termination and size accounting, which is currently wrong
      in some places. It fixes a known bug where parts of the uevent
      environment are overwritten because of wrong index calculations.
      
      Many thanks to Mathieu Desnoyers for finding bugs and improving the
      error handling.
      Signed-off-by: NKay Sievers <kay.sievers@vrfy.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      7eff2e7a
  11. 07 10月, 2007 1 次提交