1. 10 5月, 2012 2 次提交
    • C
      firewire: Move fw_card kref functions into linux/firewire.h · fc5f80b1
      Chris Boot 提交于
      When writing a firewire driver that doesn't deal with struct fw_device
      objects (e.g. it only publishes FireWire units and doesn't subscribe to
      them), you likely need to keep referenced to struct fw_card objects so
      that you can send messages to other nodes. This patch moves
      fw_card_put(), fw_card_get() and fw_card_release() into the public
      include/linux/firewire.h header instead of drivers/firewire/core.h, and
      adds EXPORT_SYMBOL_GPL(fw_card_release).
      
      The firewire-sbp-target module requires these so it can keep a reference
      to the fw_card object in order that it can fetch ORBs to execute and
      read/write related data and status information.
      Signed-off-by: NChris Boot <bootc@bootc.net>
      Acked-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      Cc: Clemens Ladisch <clemens@ladisch.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      fc5f80b1
    • C
      firewire: Add function to get speed from opaque struct fw_request · 253d9237
      Chris Boot 提交于
      Sometimes it's useful to know the FireWire speed of the request that has
      just come in to a fw_address_handler callback. As struct fw_request is
      opaque we can't peek inside to get the speed out of the struct fw_packet
      that's just inside. For example, the SBP-2 spec says:
      
      "The speed at which the block write request to the MANAGEMENT_AGENT
      register is received shall determine the speed used by the target for
      all subsequent requests to read the initiator’s configuration ROM, fetch
      ORB’s from initiator memory or store status at the initiator’s
      status_FIFO. Command block ORB’s separately specify the speed for
      requests addressed to the data buffer or page table."
      
      [ ANSI T10/1155D Revision 4 page 53/54 ]
      Signed-off-by: NChris Boot <bootc@bootc.net>
      Acked-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      Cc: Clemens Ladisch <clemens@ladisch.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      253d9237
  2. 03 4月, 2012 1 次提交
  3. 19 3月, 2012 1 次提交
  4. 16 3月, 2012 1 次提交
    • P
      device.h: audit and cleanup users in main include dir · 313162d0
      Paul Gortmaker 提交于
      The <linux/device.h> header includes a lot of stuff, and
      it in turn gets a lot of use just for the basic "struct device"
      which appears so often.
      
      Clean up the users as follows:
      
      1) For those headers only needing "struct device" as a pointer
      in fcn args, replace the include with exactly that.
      
      2) For headers not really using anything from device.h, simply
      delete the include altogether.
      
      3) For headers relying on getting device.h implicitly before
      being included themselves, now explicitly include device.h
      
      4) For files in which doing #1 or #2 uncovers an implicit
      dependency on some other header, fix by explicitly adding
      the required header(s).
      
      Any C files that were implicitly relying on device.h to be
      present have already been dealt with in advance.
      
      Total removals from #1 and #2: 51.  Total additions coming
      from #3: 9.  Total other implicit dependencies from #4: 7.
      
      As of 3.3-rc1, there were 110, so a net removal of 42 gives
      about a 38% reduction in device.h presence in include/*
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      313162d0
  5. 23 2月, 2012 1 次提交
    • S
      firewire: core: prefix log messages with card name · 26b4950d
      Stefan Richter 提交于
      Associate all log messages from firewire-core with the respective card
      because some people have more than one card.  E.g.
          firewire_ohci 0000:04:00.0: added OHCI v1.10 device as card 0, 8 IR + 8 IT contexts, quirks 0x0
          firewire_ohci 0000:05:00.0: added OHCI v1.10 device as card 1, 8 IR + 8 IT contexts, quirks 0x0
          firewire_core: created device fw0: GUID 0814438400000389, S800
          firewire_core: phy config: new root=ffc1, gap_count=5
          firewire_core: created device fw1: GUID 0814438400000388, S800
          firewire_core: created device fw2: GUID 0001d202e06800d1, S800
      turns into
          firewire_ohci 0000:04:00.0: added OHCI v1.10 device as card 0, 8 IR + 8 IT contexts, quirks 0x0
          firewire_ohci 0000:05:00.0: added OHCI v1.10 device as card 1, 8 IR + 8 IT contexts, quirks 0x0
          firewire_core 0000:04:00.0: created device fw0: GUID 0814438400000389, S800
          firewire_core 0000:04:00.0: phy config: new root=ffc1, gap_count=5
          firewire_core 0000:05:00.0: created device fw1: GUID 0814438400000388, S800
          firewire_core 0000:04:00.0: created device fw2: GUID 0001d202e06800d1, S800
      
      This increases the module size slightly; to keep this in check, turn the
      former printk wrapper macros into functions.  Their implementation is
      largely copied from driver core's dev_printk counterparts.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      26b4950d
  6. 16 1月, 2012 1 次提交
  7. 27 7月, 2011 1 次提交
  8. 11 5月, 2011 3 次提交
    • S
      firewire: sbp2: parallelize login, reconnect, logout · 105e53f8
      Stefan Richter 提交于
      The struct sbp2_logical_unit.work items can all be executed in parallel
      but are not reentrant.  Furthermore, reconnect or re-login work must be
      executed in a WQ_MEM_RECLAIM workqueue.
      
      Hence replace the old single-threaded firewire-sbp2 workqueue by a
      concurrency-managed but non-reentrant workqueue with rescuer.
      firewire-core already maintains one, hence use this one.
      
      In earlier versions of this change, I observed occasional failures of
      parallel INQUIRY to an Initio INIC-2430 FireWire 800 to dual IDE bridge.
      More testing indicates that parallel INQUIRY is not actually a problem,
      but too quick successions of logout and login + INQUIRY, e.g. a quick
      sequence of cable plugout and plugin, can result in failed INQUIRY.
      This does not seem to be something that should or could be addressed by
      serialization.
      
      Another dual-LU device to which I currently have access to, an
      OXUF924DSB FireWire 800 to dual SATA bridge with firmware from MacPower,
      has been successfully tested with this too.
      
      This change is beneficial to environments with two or more FireWire
      storage devices, especially if they are located on the same bus.
      Management tasks that should be performed as soon and as quickly as
      possible, especially reconnect, are no longer held up by tasks on other
      devices that may take a long time, especially login with INQUIRY and sd
      or sr driver probe.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      105e53f8
    • C
      firewire: optimize iso queueing by setting wake only after the last packet · 13882a82
      Clemens Ladisch 提交于
      When queueing iso packets, the run time is dominated by the two
      MMIO accesses that set the DMA context's wake bit.  Because most
      drivers submit packets in batches, we can save much time by
      removing all but the last wakeup.
      
      The internal kernel API is changed to require a call to
      fw_iso_context_queue_flush() after a batch of queued packets.
      The user space API does not change, so one call to
      FW_CDEV_IOC_QUEUE_ISO must specify multiple packets to take
      advantage of this optimization.
      
      In my measurements, this patch reduces the time needed to queue
      fifty skip packets from userspace to one sixth on a 2.5 GHz CPU,
      or to one third at 800 MHz.
      Signed-off-by: NClemens Ladisch <clemens@ladisch.de>
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      13882a82
    • S
      firewire: octlet AT payloads can be stack-allocated · f30e6d3e
      Stefan Richter 提交于
      We do not need slab allocations anymore in order to satisfy
      streaming DMA mapping constraints, thanks to commit da28947e
      "firewire: ohci: avoid separate DMA mapping for small AT payloads".
      
      (Besides, the slab-allocated buffers that firewire-core, firewire-sbp2,
      and firedtv used to provide for 8-byte write and lock requests were
      still not fully portable since they crossed cacheline boundaries or
      shared a cacheline with unrelated CPU-accessed data.  snd-firewire-lib
      got this aspect right by using an extra kmalloc/ kfree just for the
      8-byte transaction buffer.)
      
      This change replaces kmalloc'ed lock transaction scratch buffers in
      firewire-core, firedtv, and snd-firewire-lib by local stack allocations.
      Perhaps the most notable result of the change is simpler locking because
      there is no need to serialize usages of preallocated per-device buffers
      anymore.  Also, allocations and deallocations are simpler.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      Acked-by: NClemens Ladisch <clemens@ladisch.de>
      f30e6d3e
  9. 15 3月, 2011 1 次提交
  10. 23 1月, 2011 1 次提交
  11. 04 1月, 2011 1 次提交
  12. 30 7月, 2010 1 次提交
    • S
      firewire: add isochronous multichannel reception · 872e330e
      Stefan Richter 提交于
      This adds the DMA context programming and userspace ABI for multichannel
      reception, i.e. for listening on multiple channel numbers by means of a
      single DMA context.
      
      The use case is reception of more streams than there are IR DMA units
      offered by the link layer.  This is already implemented by the older
      ohci1394 + ieee1394 + raw1394 stack.  And as discussed recently on
      linux1394-devel, this feature is occasionally used in practice.
      
      The big drawbacks of this mode are that buffer layout and interrupt
      generation necessarily differ from single-channel reception:  Headers
      and trailers are not stripped from packets, packets are not aligned with
      buffer chunks, interrupts are per buffer chunk, not per packet.
      
      These drawbacks also cause a rather hefty code footprint to support this
      rarely used OHCI-1394 feature.  (367 lines added, among them 94 lines of
      added userspace ABI documentation.)
      
      This implementation enforces that a multichannel reception context may
      only listen to channels to which no single-channel context on the same
      link layer is presently listening to.  OHCI-1394 would allow to overlay
      single-channel contexts by the multi-channel context, but this would be
      a departure from the present first-come-first-served policy of IR
      context creation.
      
      The implementation is heavily based on an earlier one by Jay Fenlason.
      Thanks Jay.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      872e330e
  13. 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
  14. 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
  15. 08 7月, 2010 1 次提交
  16. 21 6月, 2010 1 次提交
    • S
      firewire: remove an unused function argument · 33e553fe
      Stefan Richter 提交于
      void (*fw_address_callback_t)(..., int speed, ...) is the speed that a
      remote node chose to transmit a request to us.  In case of split
      transactions, firewire-core will transmit the response at that speed.
      
      Upper layer drivers on the other hand (firewire-net, -sbp2, firedtv, and
      userspace drivers) cannot do anything useful with that speed datum,
      except log it for debug purposes.  But data that is merely potentially
      (not even actually) used for debug purposes does not belong into the API.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      33e553fe
  17. 19 6月, 2010 2 次提交
  18. 10 6月, 2010 4 次提交
  19. 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
  20. 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
  21. 30 12月, 2009 4 次提交
  22. 31 10月, 2009 1 次提交
    • S
      firewire: ohci: 0 may be a valid DMA address · 19593ffd
      Stefan Richter 提交于
      I was told that there are obscure architectures with non-coherent DMA
      which may DMA-map to bus address 0.  We shall not use 0 as a magic
      number of uninitialized bus address variables.
      
      The packet->payload_length > 0 test cannot be used either (except in
      at_context_queue_packet) because local requests are not DMA-mapped
      regardless of payload_length.  Hence add a state flag to struct
      fw_packet.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      19593ffd
  23. 15 10月, 2009 2 次提交
    • 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: 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
  24. 12 9月, 2009 1 次提交
  25. 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
  26. 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