1. 11 5月, 2011 2 次提交
    • 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
  2. 15 3月, 2011 1 次提交
  3. 26 2月, 2011 1 次提交
  4. 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
  5. 13 7月, 2010 1 次提交
    • S
      firewire: core: fix fw_send_request kerneldoc comment · 656b7afd
      Stefan Richter 提交于
      The present inline documentation of the fw_send_request() in-kernel API
      refers to userland code that is not applicable to kernel drivers at all.
      Reported-by: NBen Gamari <bgamari.foss@gmail.com>
      
      While we are at fixing the whole documentation of fw_send_request(),
      also improve the rest of firewire-core's kerneldoc comments:
        - Add a bit of text concerning fw_run_transaction()'s call parameters.
        - Append () to function names and tab-align parameter descriptions as
          suggested by the example in Documentation/kernel-doc-nano-HOWTO.txt.
        - Remove kerneldoc markers from comments on static functions.
        - Remove outdated parameter descriptions at build_tree().
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      656b7afd
  6. 20 4月, 2010 2 次提交
  7. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  8. 15 3月, 2010 1 次提交
  9. 05 9月, 2009 1 次提交
  10. 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
  11. 17 6月, 2009 1 次提交
  12. 14 6月, 2009 1 次提交
    • 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
  13. 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
  14. 25 3月, 2009 6 次提交
    • S
      firewire: normalize a variable name · e1eff7a3
      Stefan Richter 提交于
      Standardize on  if (err)
                              handle_error;
                 and  if (ret < 0)
                              handle_error;
      
      Don't call a variable err if we store values in it which mean success.
      Also, offset some return statements by a blank line since this how we do
      it in drivers/firewire.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      e1eff7a3
    • S
      firewire: cdev: add ioctls for iso resource management, amendment · 5d9cb7d2
      Stefan Richter 提交于
      Some fixes:
        - Remove stale documentation.
        - Fix a != vs. == thinko that got in the way of channel management.
        - Try bandwidth deallocation even if channel deallocation failed.
      
      A simplification:
        - fw_cdev_allocate_iso_resource.channels is now ordered like
          libdc1394's dc1394_iso_allocate_channel() channels_allowed
          argument.
      
      By the way, I looked closer at cards from NEC, TI, and VIA, and noticed
      that they all don't implement IEEE 1394a behaviour which is meant to
      deviate from IEEE 1212's notion of lock compare-swap.  This means that
      we have to do two lock transactions instead of one in many cases where
      one transaction would already succeed on a fully 1394a compliant IRM.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      5d9cb7d2
    • J
      firewire: cdev: add ioctls for isochronous resource management · b1bda4cd
      Jay Fenlason, Stefan Richter 提交于
      Based on
          Date: Tue, 18 Nov 2008 11:41:27 -0500
          From: Jay Fenlason <fenlason@redhat.com>
          Subject: [Patch V4] Add ISO resource management support
      with several changes to the ABI and implementation.  Only the part of
      the ABI which enables auto-reallocation and auto-deallocation is
      included here.
      
      This implements ioctls for kernel-assisted allocation of isochronous
      channels and isochronous bandwidth.  The benefits are:
        - The client does not have to have write access to the /dev/fw* device
          corresponding to the IRM.
        - The client does not have to perform reallocation after bus resets.
        - Channel and bandwidth are deallocated by the kernel if the file is
          closed before the client deallocated the resources.  Thus resources
          are released even if the client crashes.
      
      It is anticipated that future in-kernel code (firewire-core IRM code;
      the firewire port of firedtv), will use the fw-iso.c portions of this
      code too.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      Tested-by: NDavid Moore <dcm@acm.org>
      b1bda4cd
    • S
      firewire: prevent creation of multiple IR DMA contexts for the same channel · 4817ed24
      Stefan Richter 提交于
      OHCI-1394 1.1 clause 10.4.3 says:  "If more than one IR DMA context
      specifies receives for packets from the same isochronous channel, the
      context destination for that channel's packets is undefined."
      
      Any userspace client and in the future also kernelspace clients can
      allocate IR DMA contexts for any channel.  We don't want them to
      interfere with each other, hence it is preferable to return -EBUSY if
      allocation of a second context for a channel is attempted.
      
      Notes:
        - This limitation is OHCI-1394 specific, therefore its proper place of
          implementation is down in the low-level driver.
      
        - Since the <linux/firewire-cdev.h> ABI simply maps one userspace iso
          client context to one hardware iso context, this OHCI-1394
          limitation alas requires userspace to implement its own multiplexing
          of iso reception from the same channel and card to multiple clients
          when needed.
      
        - The limitation is independent of channel allocation at the IRM; the
          latter is really only important for the initiation of iso 
          transmission but not of iso reception.
      
        - We don't need to do the same for IT DMA because OHCI-1394 does not
          have any ties between IT contexts and channels.  Only the voluntary
          channel allocation protocol via the IRM, globally to the FireWire
          bus, can ensure proper isochronous transmit behaviour anyway.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      4817ed24
    • S
      firewire: remove line breaks before function names · 53dca511
      Stefan Richter 提交于
      type
          function_name(parameters);
      
      is nice to look at but was not used consistently.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      53dca511
    • S
      firewire: standardize a variable name · 2dbd7d7e
      Stefan Richter 提交于
      "ret" is the new "retval".
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      2dbd7d7e
  15. 27 7月, 2008 1 次提交
    • F
      dma-mapping: add the device argument to dma_mapping_error() · 8d8bb39b
      FUJITA Tomonori 提交于
      Add per-device dma_mapping_ops support for CONFIG_X86_64 as POWER
      architecture does:
      
      This enables us to cleanly fix the Calgary IOMMU issue that some devices
      are not behind the IOMMU (http://lkml.org/lkml/2008/5/8/423).
      
      I think that per-device dma_mapping_ops support would be also helpful for
      KVM people to support PCI passthrough but Andi thinks that this makes it
      difficult to support the PCI passthrough (see the above thread).  So I
      CC'ed this to KVM camp.  Comments are appreciated.
      
      A pointer to dma_mapping_ops to struct dev_archdata is added.  If the
      pointer is non NULL, DMA operations in asm/dma-mapping.h use it.  If it's
      NULL, the system-wide dma_ops pointer is used as before.
      
      If it's useful for KVM people, I plan to implement a mechanism to register
      a hook called when a new pci (or dma capable) device is created (it works
      with hot plugging).  It enables IOMMUs to set up an appropriate
      dma_mapping_ops per device.
      
      The major obstacle is that dma_mapping_error doesn't take a pointer to the
      device unlike other DMA operations.  So x86 can't have dma_mapping_ops per
      device.  Note all the POWER IOMMUs use the same dma_mapping_error function
      so this is not a problem for POWER but x86 IOMMUs use different
      dma_mapping_error functions.
      
      The first patch adds the device argument to dma_mapping_error.  The patch
      is trivial but large since it touches lots of drivers and dma-mapping.h in
      all the architecture.
      
      This patch:
      
      dma_mapping_error() doesn't take a pointer to the device unlike other DMA
      operations.  So we can't have dma_mapping_ops per device.
      
      Note that POWER already has dma_mapping_ops per device but all the POWER
      IOMMUs use the same dma_mapping_error function.  x86 IOMMUs use device
      argument.
      
      [akpm@linux-foundation.org: fix sge]
      [akpm@linux-foundation.org: fix svc_rdma]
      [akpm@linux-foundation.org: build fix]
      [akpm@linux-foundation.org: fix bnx2x]
      [akpm@linux-foundation.org: fix s2io]
      [akpm@linux-foundation.org: fix pasemi_mac]
      [akpm@linux-foundation.org: fix sdhci]
      [akpm@linux-foundation.org: build fix]
      [akpm@linux-foundation.org: fix sparc]
      [akpm@linux-foundation.org: fix ibmvscsi]
      Signed-off-by: NFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Cc: Muli Ben-Yehuda <muli@il.ibm.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Avi Kivity <avi@qumranet.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8d8bb39b
  16. 18 4月, 2008 1 次提交
    • A
      firewire: cleanups · db8be076
      Adrian Bunk 提交于
      This patch contains the following cleanups:
      - #if 0 the following unused structs:
        - fw-transaction.c:fw_low_memory_region
        - fw-transaction.c:fw_private_region
        - fw-transaction.c:fw_csr_region
        - fw-transaction.c:fw_unit_space_region
      - remove the following unused EXPORT_SYMBOL's:
        - fw-card.c:fw_core_add_descriptor
        - fw-card.c:fw_core_remove_descriptor
        - fw-iso.c:fw_iso_context_create
        - fw-iso.c:fw_iso_context_destroy
        - fw-iso.c:fw_iso_context_start
        - fw-iso.c:fw_iso_context_queue
        - fw-iso.c:fw_iso_context_stop
      Signed-off-by: NAdrian Bunk <bunk@kernel.org>
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      db8be076
  17. 11 5月, 2007 1 次提交
  18. 16 3月, 2007 1 次提交
  19. 10 3月, 2007 13 次提交