1. 20 3月, 2011 1 次提交
    • C
      firewire: core: increase default SPLIT_TIMEOUT value · dd5eeb99
      Clemens Ladisch 提交于
      The SPLIT_TIMEOUT mechanism is intended to detect requests that somehow
      got lost.  However, when the timeout value is too low, transactions that
      could have been completed successfully will be cancelled.  Furthermore,
      there are chips whose firmwares ignore the configured split timeout and
      send late split response; known examples are the DM1x00 (BeBoB), TCD22x0
      (DICE), and some OXUF936QSE firmwares.
      
      This patch changes the default timeout to two seconds, which happens to
      be the default on other OSes, too.
      
      Actual lost requests are extremely rare, so there should be no practical
      downside to increasing the split timeout even on devices that work
      correctly.
      Signed-off-by: NClemens Ladisch <clemens@ladisch.de>
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      dd5eeb99
  2. 23 1月, 2011 1 次提交
  3. 21 1月, 2011 1 次提交
    • S
      firewire: core: fix unstable I/O with Canon camcorder · 6044565a
      Stefan Richter 提交于
      Regression since commit 10389536, "firewire: core: check for 1394a
      compliant IRM, fix inaccessibility of Sony camcorder":
      
      The camcorder Canon MV5i generates lots of bus resets when asynchronous
      requests are sent to it (e.g. Config ROM read requests or FCP Command
      write requests) if the camcorder is not root node.  This causes drop-
      outs in videos or makes the camcorder entirely inaccessible.
      https://bugzilla.redhat.com/show_bug.cgi?id=633260
      
      Fix this by allowing any Canon device, even if it is a pre-1394a IRM
      like MV5i are, to remain root node (if it is at least Cycle Master
      capable).  With the FireWire controller cards that I tested, MV5i always
      becomes root node when plugged in and left to its own devices.
      
      Reported-by: Ralf Lange
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      Cc: <stable@kernel.org> # 2.6.32.y and newer
      6044565a
  4. 02 8月, 2010 1 次提交
  5. 23 7月, 2010 2 次提交
    • S
      firewire: cdev: add PHY packet reception · bf54e146
      Stefan Richter 提交于
      Add an FW_CDEV_IOC_RECEIVE_PHY_PACKETS ioctl() and
      FW_CDEV_EVENT_PHY_PACKET_RECEIVED poll()/read() event for /dev/fw*.
      This can be used to get information from remote PHYs by remote access
      PHY packets.
      
      This is also the 2nd half of the functionality (the receive part) to
      support a userspace implementation of a VersaPHY transaction layer.
      
      Safety considerations:
      
        - PHY packets are generally broadcasts, hence some kind of elevated
          privileges should be required of a process to be able to listen in
          on PHY packets.  This implementation assumes that a process that is
          allowed to open the /dev/fw* of a local node does have this
          privilege.
      
          There was an inconclusive discussion about introducing POSIX
          capabilities as a means to check for user privileges for these
          kinds of operations.
      
      Other limitations:
      
        - PHY packet reception may be switched on by ioctl() but cannot be
          switched off again.  It would be trivial to provide an off switch,
          but this is not worth the code.  The client should simply close()
          the fd then, or just ignore further events.
      
        - For sake of simplicity of API and kernel-side implementation, no
          filter per packet content is provided.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      bf54e146
    • S
      firewire: normalize status values in packet callbacks · 18d0cdfd
      Stefan Richter 提交于
      core-transaction.c transmit_complete_callback() and close_transaction()
      expect packet callback status to be an ACK or RCODE, and ACKs get
      translated to RCODEs for transaction callbacks.
      
      An old comment on the packet callback API (been there from the initial
      submission of the stack) and the dummy_driver implementation of
      send_request/send_response deviated from this as they also included
      -ERRNO in the range of status values.
      
      Let's narrow status values down to ACK and RCODE to prevent surprises.
      RCODE_CANCELLED is chosen as the dummy_driver's RCODE as its meaning of
      "transaction timed out" comes closest to what happens when a transaction
      coincides with card removal.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      18d0cdfd
  6. 13 7月, 2010 1 次提交
    • S
      firewire: core: integrate software-forced bus resets with bus management · 02d37bed
      Stefan Richter 提交于
      Bus resets which are triggered
        - by the kernel drivers after updates of the local nodes' config ROM,
        - by userspace software via ioctl
      shall be deferred until after >=2 seconds after the last bus reset.
      
      If multiple modifications of the local nodes' config ROM happen in a row,
      only a single bus reset should happen after them.
      
      When the local node's link goes from inactive to active or vice versa,
      and at the two occasions of bus resets mentioned above --- and if the
      current gap count differs from 63 --- the bus reset should be preceded
      by a PHY configuration packet that reaffirms the gap count.  Otherwise a
      bus manager would have to reset the bus again right after that.
      
      This is necessary to promote bus stability, e.g. leave grace periods for
      allocations and reallocations of isochronous channels and bandwidth,
      SBP-2 reconnections etc.; see IEEE 1394 clause 8.2.1.
      
      This change implements all of the above by moving bus reset initiation
      into a delayed work (except for bus resets which are triggered by the
      bus manager workqueue job and are performed there immediately).  It
      comes with a necessary addition to the card driver methods that allows
      to get the current gap count from PHY registers.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      02d37bed
  7. 08 7月, 2010 2 次提交
  8. 19 6月, 2010 1 次提交
  9. 10 6月, 2010 5 次提交
  10. 03 6月, 2010 1 次提交
    • S
      firewire: core: check for 1394a compliant IRM, fix inaccessibility of Sony camcorder · 10389536
      Stefan Richter 提交于
      Per IEEE 1394 clause 8.4.2.3, a contender for the IRM role shall check
      whether the current IRM complies to 1394a-2000 or later.  If not force a
      compliant node (e.g. itself) to become IRM.  This was implemented in the
      older ieee1394 driver but not yet in firewire-core.
      
      An older Sony camcorder (Sony DCR-TRV25) which implements 1394-1995 IRM
      but neither 1394a-2000 IRM nor BM was now found to cause an
      interoperability bug:
        - Camcorder becomes root node when plugged in, hence gets IRM role.
        - firewire-core successfully contends for BM role, proceeds to perform
          gap count optimization and resets the bus.
        - Sony camcorder ignores presence of a BM (against the spec, this is
          a firmware bug), performs its idea of gap count optimization and
          resets the bus.
        - Preceding two steps are repeated endlessly, bus never settles,
          regular I/O is practically impossible.
      http://thread.gmane.org/gmane.linux.kernel.firewire.user/3913
      
      This is an interoperability regression from the old to the new drivers.
      Fix it indirectly by adding the 1394a IRM check.  The spec suggests
      three and a half methods to determine 1394a compliance of a remote IRM;
      we choose the method of testing the Config_ROM.Bus_Info.generation
      field.  This is data that firewire-core should have readily available at
      this point, i.e. does not require extra I/O.
      
      Reported-by: Clemens Ladisch <clemens@ladisch.de> (missing 1394a check)
      Reported-by: H. S. <hs.samix@gmail.com> (issue with Sony DCR-TRV25)
      Tested-by: NH. S. <hs.samix@gmail.com>
      
      Cc: <stable@kernel.org> # .32.x and newer
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      10389536
  11. 19 5月, 2010 1 次提交
    • C
      firewire: core: use separate timeout for each transaction · 5c40cbfe
      Clemens Ladisch 提交于
      Using a single timeout for all transaction that need to be flushed does
      not work if the submission of new transactions can defer the timeout
      indefinitely into the future.  We need to have timeouts that do not
      change due to other transactions; the simplest way to do this is with a
      separate timer for each transaction.
      Signed-off-by: NClemens Ladisch <clemens@ladisch.de>
      Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (+ one lockdep annotation)
      5c40cbfe
  12. 20 4月, 2010 1 次提交
    • S
      firewire: core: clean up config ROM related defined constants · edd5bdaf
      Stefan Richter 提交于
      Clemens Ladisch pointed out that
        - BIB_IMC is not named like the field is called in the standard,
        - readers of the code may get worried about the magic 0x0c0083c0,
        - a CSR_NODE_CAPABILITIES key is there in the header but not put to
          good use.
      
      So let's rename BIB_IMC, add a defined constant for Node_Capabilities
      and a comment which reassures people that somebody thought about it and
      they don't have to (or if they still do, tell them where they have to
      look for confirmation), and prune our incomplete and arbitrary set of
      defined constants of CSR key IDs.  And there is a nother magic number,
      that of Bus_Information_Block.Bus_Name, to be defined and commented.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      edd5bdaf
  13. 27 1月, 2010 1 次提交
    • S
      firewire: core: add_descriptor size check · e300839d
      Stefan Richter 提交于
      Presently, firewire-core only checks whether descriptors that are to be
      added by userspace drivers to the local node's config ROM do not exceed
      a size of 256 quadlets.  However, the sum of the bare minimum ROM plus
      all descriptors (from firewire-core, from firewire-net, from userspace)
      must not exceed 256 quadlets.
      
      Otherwise, the bounds of a statically allocated buffer will be
      overwritten.  If the kernel survives that, firewire-core will
      subsequently be unable to parse the local node's config ROM.
      
      (Note, userspace drivers can add descriptors only through device files
      of local nodes.  These are usually only accessible by root, unlike
      device files of remote nodes which may be accessible to lesser
      privileged users.)
      
      Therefore add a test which takes the actual present and required ROM
      size into account for all descriptors of kernelspace and userspace
      drivers.
      
      Cc: stable@kernel.org
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      e300839d
  14. 15 10月, 2009 4 次提交
    • S
      firewire: core: optimize Topology Map creation · cb7c96da
      Stefan Richter 提交于
      The Topology Map of the local node was created in CPU byte order,
      then a temporary big endian copy was created to compute the CRC,
      and when a read request to the Topology Map arrived it had to be
      converted to big endian byte order again.
      
      We now generate it in big endian byte order in the first place.
      This also rids us of 1000 bytes stack usage in tasklet context.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      cb7c96da
    • S
      firewire: core: clarify generate_config_rom usage · fe242579
      Stefan Richter 提交于
      Move the static config ROM buffer into the scope of the two callers of
      generate_config_rom().  That way the ROM length can be passed over as
      return value rather than through a pointer argument.
      
      It also becomes more obvious that accesses to the config ROM buffer have
      to be serialized and how this is accomplished.  And firewire-core.ko
      shrinks a bit as well.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      fe242579
    • S
      firewire: optimize config ROM creation · 8e85973e
      Stefan Richter 提交于
      The config ROM image of the local node was created in CPU byte order,
      then a temporary big endian copy was created to compute the CRC, and
      finally the card driver created its own big endian copy.
      
      We now generate it in big endian byte order in the first place to avoid
      one byte order conversion and the temporary on-stack copy of the ROM
      image (1000 bytes stack usage in process context).  Furthermore, two
      1000 bytes memset()s are replaced by one 1000 bytes - ROM length sized
      memset.
      
      The trivial fw_memcpy_{from,to}_be32() helpers are now superfluous and
      removed.  The newly added __compute_block_crc() function will be folded
      into fw_compute_block_crc() in a subsequent change.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      8e85973e
    • S
      firewire: normalize style of queue_work wrappers · 9fb551bf
      Stefan Richter 提交于
      A few stylistic changes to unify some code patterns in the subsystem:
      
        - The similar queue_delayed_work helpers fw_schedule_bm_work,
          schedule_iso_resource, and sbp2_queue_work now have the same call
          convention.
        - Two conditional calls of schedule_iso_resource are factored into
          another small helper.
        - An sbp2_target_get helper is added as counterpart to
          sbp2_target_put.
      
      Object size of firewire-core is decreased a little bit, object size of
      firewire-sbp2 remains unchanged.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      9fb551bf
  15. 12 9月, 2009 1 次提交
    • S
      firewire: core: fix race with parallel PCI device probe · b171e204
      Stefan Richter 提交于
      The config ROM buffer received from generate_config_rom is a globally
      shared static buffer.  Extend the card_mutex protection in fw_add_card
      until after the config ROM was copied into the card driver's buffer.
      Otherwise, parallelized card driver probes may end up with ROM contents
      that were meant for a different card.
      
      firewire-ohci's card->driver->enable hook is safe to be called within
      the card_mutex.  Furthermore, it is safe to reorder card_list update
      versus card enable, which simplifies the code a little.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      b171e204
  16. 26 6月, 2009 1 次提交
    • S
      firewire: core: do not DMA-map stack addresses · 6fdc0370
      Stefan Richter 提交于
      The DMA mapping API cannot map on-stack addresses, as explained in
      Documentation/DMA-mapping.txt.  Convert the two cases of on-stack packet
      payload buffers in firewire-core (payload of lock requests in the bus
      manager work and in iso resource management) to slab-allocated memory.
      
      There are a number on-stack buffers for quadlet write or quadlet read
      requests in firewire-core and firewire-sbp2.  These are harmless; they
      are copied to/ from card driver internal DMA buffers since quadlet
      payloads are inlined with packet headers.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      6fdc0370
  17. 17 6月, 2009 1 次提交
    • S
      firewire: core: fix iso context shutdown on card removal · d645f4da
      Stefan Richter 提交于
      If isochronous contexts existed when firewire-ohci was unloaded, the
      core iso shutdown functions crashed with NULL dereferences, and buffers
      etc. weren't released.
      
      How the fix works:  We first copy the card driver's iso shutdown hooks
      into the dummy driver, then fw_destroy_nodes notifies upper layers of
      devices going away, these should shut down (including their iso
      contexts), wait_for_completion(&card->done) will be triggered after
      upper layers gave up all fw_device references, after which the card
      driver's shutdown proceeds.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      d645f4da
  18. 14 6月, 2009 3 次提交
    • S
      firewire: net: allow for unordered unit discovery · 5a124d38
      Stefan Richter 提交于
      Decouple the creation and destruction of the net_device from the order
      of discovery and removal of nodes with RFC 2734 unit directories since
      there is no reliable order.  The net_device is now created when the
      first RFC 2734 unit on a card is discovered, and destroyed when the last
      RFC 2734 unit on a card went away.  This includes all remote units as
      well as the local unit, which is therefore tracked as a peer now too.
      
      Also, locking around the list of peers is slightly extended to guard
      against peer removal.  As a side effect, fwnet_peer.pdg_lock has become
      superfluous and is deleted.
      
      Peer data (max_rec, speed, node ID, generation) are updated more
      carefully.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      5a124d38
    • S
      firewire: net: style changes · f91e3bd8
      Stefan Richter 提交于
      Change names of types, variables, functions.
      Omit debug code.
      Use get_unaligned*, put_unaligned*.
      Annotate big endian data.
      Handle errors in __init.
      Change whitespace.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      f91e3bd8
    • J
      firewire: add IPv4 support · c76acec6
      Jay Fenlason 提交于
      Implement IPv4 over IEEE 1394 as per RFC 2734 for the newer firewire
      stack.  This feature has only been present in the older ieee1394 stack
      via the eth1394 driver.
      
      Still to do:
        - fix ipv4_priv and ipv4_node lifetime logic
        - fix determination of speeds and max payloads
        - fix bus reset handling
        - fix unaligned memory accesses
        - fix coding style
        - further testing/ improvement of fragment reassembly
        - perhaps multicast support
      Signed-off-by: NJay Fenlason <fenlason@redhat.com>
      Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (rebased, copyright note, changelog)
      c76acec6
  19. 07 6月, 2009 1 次提交
  20. 05 6月, 2009 3 次提交
    • S
      firewire: rename source files · e71d31da
      Stefan Richter 提交于
      The source files of firewire-core, firewire-ohci, firewire-sbp2, i.e.
       "drivers/firewire/fw-*.c"
      are renamed to
       "drivers/firewire/core-*.c",
       "drivers/firewire/ohci.c",
       "drivers/firewire/sbp2.c".
      
      The old fw- prefix was redundant to the directory name.  The new core-
      prefix distinguishes the files according to which driver they belong to.
      
      This change comes a little late, but still before further firewire
      drivers are added as anticipated RSN.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      e71d31da
    • S
      firewire: reorganize header files · 77c9a5da
      Stefan Richter 提交于
      The three header files of firewire-core, i.e.
       "drivers/firewire/fw-device.h",
       "drivers/firewire/fw-topology.h",
       "drivers/firewire/fw-transaction.h",
      are replaced by
       "drivers/firewire/core.h",
       "include/linux/firewire.h".
      
      The latter includes everything which a firewire high-level driver (like
      firewire-sbp2) needs besides linux/firewire-constants.h, while core.h
      contains the rest which is needed by firewire-core itself and by low-
      level drivers (card drivers) like firewire-ohci.
      
      High-level drivers can now also reside outside of drivers/firewire
      without having to add drivers/firewire to the header file search path in
      makefiles.  At least the firedtv driver will be such a driver.
      
      I also considered to spread the contents of core.h over several files,
      one for each .c file where the respective implementation resides.  But
      it turned out that most core .c files will end up including most of the
      core .h files.  Also, the combined core.h isn't unreasonably big, and it
      will lose more of its contents to linux/firewire.h anyway soon when more
      firewire drivers are added.  (IP-over-1394, firedtv, and there are plans
      for one or two more.)
      
      Furthermore, fw-ohci.h is renamed to ohci.h.  The name of core.h and
      ohci.h is chosen with regard to name changes of the .c files in a
      follow-up change.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      77c9a5da
    • S
      firewire: clean up includes · e8ca9702
      Stefan Richter 提交于
      Include required headers which were only indirectly included.
      Remove unused includes and an unused constant.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      e8ca9702
  21. 25 3月, 2009 6 次提交
  22. 01 2月, 2009 1 次提交