1. 27 7月, 2010 5 次提交
    • S
      firewire: nosy: use flagless variants of spinlock accessors · 685c3f80
      Stefan Richter 提交于
      nosy_start/stop_snoop() are always only called by the ioctl method, i.e.
      with IRQs enabled.  packet_handler() and bus_reset_handler() are always
      only called by the IRQ handler.  Hence neither one needs to track IRQ
      flags.
      
      To underline the call context of packet_handler() and
      bus_reset_handler(), rename these functions to *_irq_handler().
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      685c3f80
    • S
      firewire: nosy: fix list corruption by NOSY_IOC_STOP · a2d39db9
      Stefan Richter 提交于
      nosy_stop_snoop() would blow up the second time it was called without
      nosy_start_snoop() in between.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      a2d39db9
    • S
      firewire: nosy: convert to unlocked ioctl · c7b2a99c
      Stefan Richter 提交于
      The required serialization of NOSY_IOC_START and NOSY_IOC_STOP is
      already provided by the client_list_lock.
      
      NOSY_IOC_FILTER does not really require serialization since accesses
      to tcode_mask are atomic on any sane CPU architecture.  Nevertheless,
      make it explicit that we want this to be atomic by means of
      client_list_lock (which also surrounds the other tcode_mask access in
      the IRQ handler).  While we are at it, change the type of tcode_mask to
      u32 for consistency with the user API.
      
      NOSY_IOC_GET_STATS does not require serialization against itself.  But
      there is a bug here regarding concurrent updates of the two counters
      by the IRQ handler.  Fix it by taking the client_list_lock in this ioctl
      too.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      c7b2a99c
    • S
      firewire: nosy: misc cleanups · b5e47729
      Stefan Richter 提交于
      Extend copyright note to 2007, c.f. Kristian's git log.
      
      Includes:
        - replace some <asm/*.h> by <linux/*.h>
        - add required indirectly included <linux/spinlock.h>
        - order alphabetically
      
      Coding style related changes:
        - change to utf8
        - normalize whitespace
        - normalize comment style
        - remove usages of __FUNCTION__
        - remove an unnecessary cast from void *
      
      Const and static declarations:
        - driver_name is not const in pci_driver.name, drop const qualifier
        - driver_name can be taken from KBUILD_MODNAME
        - the global variable minors[] can and should be static
        - constify struct file_operations instance
      
      Data types:
        - Remove unused struct member struct packet.code.  struct packet is
          only used for driver-internal bookkeeping; it does not appear on the
          wire or in DMA programs or the userspace ABI.  Hence the unused
          member .code can be removed without worries.
      
      Preprocessor macros:
        - unroll a preprocessor macro that containd a return
        - use list_for_each_entry
      
      Printk:
        - add missing terminating \n in some format strings
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      b5e47729
    • S
      firewire: new driver: nosy - IEEE 1394 traffic sniffer · 28646821
      Stefan Richter 提交于
      This adds the traffic sniffer driver for Texas Instruments PCILynx/
      PCILynx2 based cards.  The use cases for nosy are analysis of
      nonstandard protocols and as an aid in development of drivers,
      applications, or firmwares.
      
      Author of the driver is Kristian Høgsberg.  Known contributers are
      Jody McIntyre and Jonathan Woithe.
      
      Nosy programs PCILynx chips to operate in promiscuous mode, which is a
      feature that is not found in OHCI-1394 controllers.  Hence, only special
      hardware as mentioned in the Kconfig help text is suitable for nosy.
      
      This is only the kernelspace part of nosy.  There is a userspace
      interface to it, called nosy-dump, proposed to be added into the tools/
      subdirectory of the kernel sources in a subsequent change.  Kernelspace
      and userspave component of nosy communicate via a 'misc' character
      device file called /dev/nosy with a simple ioctl() and read() based
      protocol, as described by nosy-user.h.
      
      The files added here are taken from
      git://anongit.freedesktop.org/~krh/nosy commit ee29be97 (2009-11-10)
      with the following changes by Stefan Richter:
        - Kconfig and Makefile hunks are written from scratch.
        - Commented out version printk in nosy.c.
        - Included missing <linux/sched.h>, reported by Stephen Rothwell.
      
      "git shortlog nosy{-user.h,.c,.h}" from nosy's git repository:
      
      Jonathan Woithe (2):
            Nosy updates for recent kernels
            Fix uninitialised memory (needed for 2.6.31 kernel)
      
      Kristian Høgsberg (5):
            Pull over nosy from mercurial repo.
            Use a misc device instead.
            Add simple AV/C decoder.
            Don't break down on big payloads.
            Set parent device for misc device.
      
      As a low-level IEEE 1394 driver, its files are placed into
      drivers/firewire/ although nosy is not part of the firewire driver
      stack.
      
      I am aware of the following literature from Texas Instruments about
      PCILynx programming:
            SCPA020A - PCILynx 1394 to PCI Bus Interface TSB12LV21BPGF
                       Functional Specification
            SLLA023  - Initialization and Asynchronous Programming of the
                       TSB12LV21A 1394 Device
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      Acked-by: NKristian Høgsberg <krh@bitplanet.net>
      28646821
  2. 20 4月, 2010 4 次提交
  3. 10 4月, 2010 3 次提交
  4. 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
  5. 25 3月, 2010 2 次提交
    • S
      firewire: core: align driver match with modalias · fe43d6d9
      Stefan Richter 提交于
      The driver match strategy was:
        - Match vendor/model/specifier/version of the unit directory.
        - If that was a miss, match vendor from the root directory and
          model/specifier/version of the unit directory.
      
      This was inconsistent with how the modalias string was constructed
      until recently (take vendor/model from root directory and specifier/
      version from unit directory).  It was also inconsistent with how it is
      done since the parent commit:
        - Use vendor/model/specifier/version of the unit directory if possible,
        - fall back to one or more of vendor/model/specifier/version from the
          root directory depending on which ones are not present at the unit
          directory.
      
      Fix this inconsistency by sharing the ROM scanner function between
      modalias printer function and driver match function.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      fe43d6d9
    • S
      firewire: core: fix Model_ID in modalias · 5ae73518
      Stefan Richter 提交于
      The modalias string of devices that represent units on a FireWire node
      did not show Module_ID entries within unit directories.  This was
      because firewire-core searched only the root directory of the
      configuration ROM for a Model_ID entry.
      
      We now search first the root directory, then the unit directory.  IOW
      honor a unit directory's Model_ID if present, otherwise fall back to the
      root directory's model ID (if present).
      
      Furthermore, apply the same change to Vendor_ID.  This had the same
      issue but it was less apparent because most devices provide Vendor_ID
      only in the root directory.
      
      And finally, also use this strategy for the remaining two IDs in the
      modalias, Specifier_ID and Version.  It does not actually make sense to
      look for them elsewhere than in the unit directory because they are
      mandatory there.  However, a uniform search order simplifies the
      implementation and has no adverse affect in practice.
      
      Side notes:
        - The older counterpart of this, nodemgr.c of ieee1394, looked for
          Vendor_ID first in the root directory, then in the unit directory,
          and for Model_ID only in the unit directory.
        - There is a single mainline driver which requires Vendor_ID and
          Model_ID --- the firedtv driver.  This one worked because FireDTVs
          provide Vendor_ID in the root directory and Model_ID identically in
          root directory and unit directory.
        - Apart from firedtv, there are currently no drivers known to me
          (including userspace drivers) that look at the Vendor_ID or Model_ID
          of the modalias.
      Reported-by: NMaciej Żenczykowski <zenczykowski@gmail.com>
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      5ae73518
  6. 18 3月, 2010 1 次提交
    • C
      firewire: ohci: add cycle timer quirk for the TI TSB12LV22 · 8301b91b
      Clemens Ladisch 提交于
      Among the many entries in the TSB12LV22 errata list (TI literature
      number SLLS312) is the following:
      
        PCI Slave reads of the Cycle Timer register may occasionally get an
        incorrect value.
        Software may be able to validate value by reading the register
        multiple times rapidly and evaluating for a reasonable difference.
      
      Signed-off-by: Clemens Ladisch <clemens@ladisch.de> (untested)
      Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (added #define)
      8301b91b
  7. 15 3月, 2010 1 次提交
  8. 08 3月, 2010 1 次提交
    • G
      Driver core: create lock/unlock functions for struct device · 8e9394ce
      Greg Kroah-Hartman 提交于
      In the future, we are going to be changing the lock type for struct
      device (once we get the lockdep infrastructure properly worked out)  To
      make that changeover easier, and to possibly burry the lock in a
      different part of struct device, let's create some functions to lock and
      unlock a device so that no out-of-core code needs to be changed in the
      future.
      
      This patch creates the device_lock/unlock/trylock() functions, and
      converts all in-tree users to them.
      
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Jean Delvare <khali@linux-fr.org>
      Cc: Dave Young <hidave.darkstar@gmail.com>
      Cc: Ming Lei <tom.leiming@gmail.com>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Phil Carmody <ext-phil.2.carmody@nokia.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
      Cc: Rafael J. Wysocki <rjw@sisk.pl>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Len Brown <len.brown@intel.com>
      Cc: Magnus Damm <damm@igel.co.jp>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Randy Dunlap <randy.dunlap@oracle.com>
      Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
      Cc: David Brownell <dbrownell@users.sourceforge.net>
      Cc: Vegard Nossum <vegard.nossum@gmail.com>
      Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
      Cc: Alex Chiang <achiang@hp.com>
      Cc: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andrew Patterson <andrew.patterson@hp.com>
      Cc: Yu Zhao <yu.zhao@intel.com>
      Cc: Dominik Brodowski <linux@dominikbrodowski.net>
      Cc: Samuel Ortiz <sameo@linux.intel.com>
      Cc: Wolfram Sang <w.sang@pengutronix.de>
      Cc: CHENG Renquan <rqcheng@smu.edu.sg>
      Cc: Oliver Neukum <oliver@neukum.org>
      Cc: Frans Pop <elendil@planet.nl>
      Cc: David Vrabel <david.vrabel@csr.com>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      8e9394ce
  9. 26 2月, 2010 1 次提交
  10. 25 2月, 2010 14 次提交
    • S
      firewire: ohci: extend initialization log message · 6fdb2ee2
      Stefan Richter 提交于
      by the number of available isochronous DMA contexts and active quirks
      which is occasionally useful information.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      6fdb2ee2
    • S
      firewire: ohci: fix IR/IT context mask mixup · 4802f16d
      Stefan Richter 提交于
      This bug was present in firewire-ohci since day one:  The number of
      available isochronous receive DMA contexts was mixed up with that of
      available isochronous transmit DMA contexts.
      
      This is harmless on a few chips which offer the same number of contexts
      in both directions, but most chips nowadays implement only the standard
      minimum of 4 IR contexts, but 8 IT contexts.  If a user attempted to run
      a lot of IR contexts at once, results with more than four were therefore
      unpredictable.  I suppose the controller would simply refuse to start
      DMA of any unimplemented context.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      4802f16d
    • S
      firewire: ohci: add module parameter to activate quirk fixes · 3e9cc2f3
      Stefan Richter 提交于
      This way, we can advise users of precompiled kernel packages to test
      existing quirk fixes on chips which have not been listed yet, without
      them having to build a kernel from source.
      
      Note, to use this feature on a machine with more than one controller,
      steps like these are necessary:
      # lspci | grep 1394
      # ls /sys/bus/pci/drivers/firewire_ohci/
      # echo -n "0000:03:02.0" > /sys/bus/pci/drivers/firewire_ohci/unbind
      # echo 2 > /sys/module/firewire_ohci/parameters/quirks
      # echo -n "0000:03:02.0" > /sys/bus/pci/drivers/firewire_ohci/bind
      # echo 0 > /sys/module/firewire_ohci/parameters/quirks
      
      The parameter can also be used to switch off quirk flags that were
      hardwired into firewire-ohci's quirks table.  Simply specify a non-zero
      quirks value but without any known flags, e.g. 0x100.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      3e9cc2f3
    • S
      firewire: ohci: use an ID table for quirks detection · 4a635593
      Stefan Richter 提交于
      We don't have a lot of quirks to take into account (especially since
      dual-buffer IR is out of the picture), but still, a table-based approach
      is more organized than a series of if () clauses.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      4a635593
    • S
      firewire: ohci: reorder struct fw_ohci for better cache efficiency · ecb1cf9c
      Stefan Richter 提交于
      The config_rom struct members are only accessed during relatively
      infrequent self-ID-complete interrupts and only if the local config ROM
      was changed, while the ar_, at_, ir_, it_ members are used very
      frequently during I/O.  Hence move the config_rom members further down.
      
      More importantly, make the huge self_id_buffer member the last one; this
      is only accessed in self-ID-complete interrupts.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      ecb1cf9c
    • S
      firewire: ohci: remove unused dualbuffer IR code · 6498ba04
      Stefan Richter 提交于
      This code was no longer used since 2.6.33, "firewire: ohci: always use
      packet-per-buffer mode for isochronous reception" commit 090699c0.  If
      anybody needs this code in the future for special purposes, it can be
      brought back in.  But it must not be re-enabled by default; drivers
      (kernelspace or userspace drivers) should only get this mode if they
      explicitly request it.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      6498ba04
    • S
      64582298
    • S
      firewire: core: change type of a data buffer · 6e95dea7
      Stefan Richter 提交于
      from array of char to union of structs.  I already used a union to size
      the buffer which holds ioctl arguments; more consequent is to define it
      as an instance of this union in the first place.
      
      Also rename several local variables from "request" to "a"(rgument) since
      the term request can be mistaken to mean a transaction subaction, e.g.
      an instance of struct fw_request.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      6e95dea7
    • S
      firewire: cdev: add more flexible cycle timer ioctl · abfe5a01
      Stefan Richter 提交于
      The system time from CLOCK_REALTIME is not monotonic, hence problematic
      for the main user of the FW_CDEV_IOC_GET_CYCLE_TIMER ioctl.  This issue
      exists in its successor ABI, i.e. raw1394, too.
      http://subversion.ffado.org/ticket/242
      
      We now offer an alternative ioctl which lets the caller choose between
      CLOCK_REALTIME, CLOCK_MONOTONIC, and CLOCK_MONOTONIC_RAW as source of
      the local time, very similar to the clock_gettime libc function.  The
      format of the local time return value matches that of clock_gettime
      (seconds and nanoseconds, instead of a single microseconds value from
      the existing ioctl).
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      abfe5a01
    • S
      firewire: core: rename an internal function · fd6e0c51
      Stefan Richter 提交于
      according to what it really does.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      fd6e0c51
    • S
      firewire: core: fix an information leak · 137d9ebf
      Stefan Richter 提交于
      If a device exposes a sparsely populated configuration ROM,
      firewire-core's sysfs interface and character device file interface
      showed random data in the gaps between config ROM blocks.  Fix this by
      zero-initialization of the config ROM reader's scratch buffer.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      137d9ebf
    • S
      firewire: core: increase stack size of config ROM reader · 58aaa542
      Stefan Richter 提交于
      The stack size of 16 was artificially chosen and may be too small in
      extreme cases.  A device won't be accessible then.
      
      Since it doesn't really matter to the slab allocator whether we ask for
      1088 bytes or 2048 bytes of scratch memory, just allocate 2048 bytes for
      the sum of temporary config ROM image and stack, and we will never ever
      overflow the stack (because there simply can't be more stack items than
      ROM entries).
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      58aaa542
    • S
      firewire: core: don't fail device creation in case of too large config ROM blocks · 2799d5c5
      Stefan Richter 提交于
      It never happened yet, but better safe than sorry:  If a device's config
      ROM contains a block which overlaps the boundary at 0xfffff00007ff, just
      ignore that one block instead of refusing to add the device
      representation.  That way, upper layers (kernelspace or userspace
      drivers) might still be able to use the device to some degree.
      
      That's better than total inaccessibility of the device.  Worse, the core
      would have logged only a generic "giving up on config rom" message which
      could only be debugged by feeding a firewire-ohci debug logging session
      through a config ROM interpreter, IOW would likely remain undiagnosed.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      2799d5c5
    • S
      firewire: core: fix "giving up on config rom" with Panasonic AG-DV2500 · d54423c6
      Stefan Richter 提交于
      The Panasonic AG-DV2500 tape deck contains an invalid entry in its
      configuration ROM root directory:  A leaf pointer with the undefined key
      ID 0 and an offset that points way out of the standard config ROM area.
      This caused firewire-core to dismiss the device with the generic log
      message "giving up on config rom for node id...", after which it was of
      course impossible to access the tape deck with dvgrab or any other
      program.  https://bugzilla.redhat.com/show_bug.cgi?id=449252#c29
      
      The fix is to simply ignore this invalid ROM entry and proceed to read
      the valid rest of the ROM.  There is a catch though:  When the kernel
      later iterates over the ROM, it would be nasty having to check again for
      such too large ROM offsets.  Therefore we manipulate the defective or
      unsupported ROM entry to become a harmless immediate entry that won't
      have any side effects later (an entry with the value 0x00000000).
      
      Reported-by: George Chriss
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      d54423c6
  11. 21 2月, 2010 2 次提交
    • S
      firewire: remove incomplete Bus_Time CSR support · 168cf9af
      Stefan Richter 提交于
      The current implementation of Bus_Time read access was buggy since it
      did not ensure that Bus_Time.second_count_hi and second_count_lo came
      from the same 128 seconds period.
      Reported-by: NHåkan Johansson <f96hajo@chalmers.se>
      
      Instead of a fix, remove Bus_Time register support altogether.  The spec
      requires all cycle master capable nodes to implement this (all Linux
      nodes are cycle master capable) while it also says that it "may" be
      initialized by the bus manager or by the IRM standing in for a bus
      manager.  (Neither Linux' firewire-core nor ieee1394 nodemgr implement
      this.)
      
      Since we cannot rely on Bus_Time having been initialized by a bus
      manager, it is better to return an error instead of a nonsensical value
      on a read request to Bus_Time.
      
      Alternatively, we could fix the Bus_Time read integrity bug _and_
      implement (a) cycle master's write support of the register as well as
      (b) bus manager's Bus_Time initialization service, i.e. preservation of
      the Bus_Time when the cycle master node of a bus changes.  However, that
      would be quite some code for a feature that is unreliable to begin with
      and very likely unused in practice.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      168cf9af
    • S
      firewire: get_cycle_timer optimization and cleanup · 4a9bde9b
      Stefan Richter 提交于
      ohci:  Break out of the retry loop if too many attempts were necessary.
      This may theoretically happen if the chip is fatally defective or if the
      get_cycle_timer ioctl was performed after a CardBus controller was
      ejected.
      
      Also micro-optimize the loop by re-using the last two register reads in
      the next iteration, remove a questionable inline keyword, and shuffle a
      comment around.
      
      core:  ioctl_get_cycle_timer() is always called with interrupts on,
      therefore local_irq_save() can be replaced by local_irq_disable().
      Disabled local IRQs imply disabled preemption, hence preempt_disable()
      can be removed.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      4a9bde9b
  12. 20 2月, 2010 2 次提交
  13. 14 2月, 2010 1 次提交
    • C
      firewire: ohci: retransmit isochronous transmit packets on cycle loss · 7f51a100
      Clemens Ladisch 提交于
      In isochronous transmit DMA descriptors, link the skip address pointer
      back to the descriptor itself.  When a cycle is lost, the controller
      will send the packet in the next cycle, instead of terminating the
      entire DMA program.
      
      There are two reasons for this:
      
      * This behaviour is compatible with the old IEEE1394 stack.  Old
        applications would not expect the DMA program to stop in this case.
      
      * Since the OHCI driver does not report any uncompleted packets, the
        context would stop silently; clients would not have any chance to
        detect and handle this error without a watchdog timer.
      Signed-off-by: NClemens Ladisch <clemens@ladisch.de>
      
      Pieter Palmers notes:
      
      "The reason I added this retry behavior to the old stack is because some
      cards now and then fail to send a packet (e.g. the o2micro card in my
      dell laptop).  I couldn't figure out why exactly this happens, my best
      guess is that the card cannot fetch the payload data on time.  This
      happens much more frequently when sending large packets, which leads me
      to suspect that there are some contention issues with the DMA that fills
      the transmit FIFO.
      
      In the old stack it was a pretty critical issue as it resulted in a
      freeze of the userspace application.
      
      The omission of a packet doesn't necessarily have to be an issue.  E.g.
      in IEC61883 streams the DBC field can be used to detect discontinuities
      in the stream.  So as long as the other side doesn't bail when no
      [packet] is present in a cycle, there is not really a problem.
      
      I'm not convinced though that retrying is the proper solution, but it is
      simple and effective for what it had to do.  And I think there are no
      reasons not to do it this way.  Userspace can still detect this by
      checking the cycle the descriptor was sent in."
      
      Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (changelog, comment)
      7f51a100
  14. 02 2月, 2010 1 次提交
    • S
      firewire: net: fix panic in fwnet_write_complete · 110f82d7
      Stefan Richter 提交于
      In the transmit path of firewire-net (IPv4 over 1394), the following
      race condition may occur:
        - The networking soft IRQ inserts a datagram into the 1394 async
          request transmit DMA.
        - The 1394 async transmit completion tasklet runs to finish cleaning
          up (unlink datagram from list of pending ones, release skb and
          outbound 1394 transaction object) --- before the networking soft IRQ
          had a chance to proceed and add the datagram to the list of pending
          datagrams.
      
      This caused a panic in the 1394 async transmit completion tasklet when
      it dereferenced unitialized list heads:
      http://bugzilla.kernel.org/show_bug.cgi?id=15077
      
      The fix is to add checks in the tx soft IRQ and in the tasklet to
      determine which of these two is the last referrer to the transaction
      object.  Then handle the cleanup of the object by the last referrer
      rather than assuming that the tasklet is always the last one.
      
      There is another similar race:  Between said tasklet and fwnet_close,
      i.e. at ifdown.  However, that race is much less likely to occur in
      practice and shall be fixed in a separate update.
      Reported-by: NИлья Басин <basinilya@gmail.com>
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      110f82d7
  15. 28 1月, 2010 1 次提交