1. 29 Apr, 2007 17 commits
    • Stefan Richter's avatar
      ieee1394: csr1212: warn on unreachable code · c94ccf9e
      Stefan Richter authored
      We want bugs to show themselves.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      c94ccf9e
    • Stefan Richter's avatar
      ieee1394: shrink csr1212_new_string_descriptor_leaf · a1c6250c
      Stefan Richter authored
      Make unnecessarily generic code specific and thus simpler.
      Shrink a lookup table from 128 to 16 bytes.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      a1c6250c
    • Stefan Richter's avatar
      ieee1394: csr1212: coding style · c868ae2a
      Stefan Richter authored
      Whitespace, line breaks, braces...
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      c868ae2a
    • Stefan Richter's avatar
      ieee1394: replace vmalloc by kmalloc in csr1212 · fd2f3bdd
      Stefan Richter authored
      The biggest chunk ever allocated by CSR1212_MALLOC is 1024 Bytes +
      sizeof(struct csr1212_csr_rom_cache) big.  Most of the time much
      smaller data structures are allocated.  Therefore vmalloc is a waste.
      
      The one exception is csr1212_append_new_cache() which is called to
      append a chunk of CSR1212_EXTENDED_ROM_SIZE + sizeof(struct
      csr1212_csr_rom_cache) if the currently allocated ROM cache is too
      small.  CSR1212_EXTENDED_ROM_SIZE is generously defined as 256 kBytes.
      In SVN commit 1220, Steve Kinneberg lowered this to 2 kBytes in the
      config_rom_2.4 branch.  This same commit also switched CSR1212_MALLOC
      from kmalloc to vmalloc in the SVN trunk branch:
      
      > r1220 | kberg | 2004-05-31 01:51:44 +0200 (Mon, 31 May 2004) | 13 lines
      >
      > CSR1212 Extended ROM bug fixes:
      > trunk line changes:
      >   - Use vmalloc instead of kmalloc
      >   - Change delayed_reset_bus() to operate in a work_queue instead of a
      >     timer interrupt.
      >   - Fix hpsb_allocate_and_register_addrspace() to not allocate space
      >     on top of already allocated space.
      >   - Fix problems in csr1212.c filling ConfigROM images when extend
      >     ROMs are present.
      > config-rom-2.4 changes:
      >   - Changed extended rom allocation from 256K to 8K.
      (It was actually 2 kB, not 8 kB.)
      >   - Fix hpsb_allocate_and_register_addrspace() to not allocate space
      >     on top of already allocated space.
      >   - Fix problems in csr1212.c filling ConfigROM images when extend
      >     ROMs are present.
      
      I am now setting CSR1212_EXTENDED_ROM_SIZE to 2 kB minus the overhead of
      struct csr1212_csr_rom_cache.  Note, this code path is not used by the
      in-kernel drivers though.  raw1394 could trigger it, but the respective
      libraw1394 functions don't exist yet.
      
      Furthermore, userspace programs can replace the entire local ROM via
      raw1394.  If kmalloc does not fulfill their needs --- well, tough luck.
      I decree that nobody needs such huge extended ROMs.  (Extended ROMs are
      defined by IEEE 1212 clause 7.7.18.  The spec does not impose
      practically relevant restrictions on the size of extended ROM chunks.)
      
      Another potentially demanding use of CSR1212_MALLOC is if external
      FireWire devices come with Extended ROM entries.  If they are too big
      for kmalloc (or have been too big for vmalloc) we just fail to read
      their ROM.  This is quite unlikely though, to my knowledge.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      fd2f3bdd
    • Stefan Richter's avatar
      ieee1394: de-inline some functions · c1a37f2c
      Stefan Richter authored
      This small reorganization of public csr1212 functions saves one
      exported symbol and a few bytes in the driver modules.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      c1a37f2c
    • Stefan Richter's avatar
      ieee1394: stricter error checks in csr1212 · 64ff7123
      Stefan Richter authored
      return -EINVAL becomes BUG_ON in checks of function call parameters.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      64ff7123
    • Stefan Richter's avatar
      ieee1394: csr1212: rename some types · 982610bd
      Stefan Richter authored
      Use u8, u32 etc. instead of u_int8_t, csr1212_quad_t etc.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      982610bd
    • Stefan Richter's avatar
      ieee1394: drop csr1212's support for external compilation · 7fb9addb
      Stefan Richter authored
      csr1212 was written to be compiled either as part of the ieee1394 kernel
      driver or of an anticipated IEEE 1212 userspace library.  We now drop
      support for the latter.  The costs in terms of code footprint and depth
      of abstraction are not countered by any actual benefit.
      
      Also remove some obsolete #includes.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      7fb9addb
    • Stefan Richter's avatar
      ieee1394: remove unused csr1212 code · 6c88e475
      Stefan Richter authored
      Delete unused code.
      Make some extern functions static.
      Remove superfluous inline keywords.
      Move private definitions from csr1212.h to csr1212.c.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      6c88e475
    • Stefan Richter's avatar
      ieee1394: small header cleanup · e167c88e
      Stefan Richter authored
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      e167c88e
    • Stefan Richter's avatar
    • Stefan Richter's avatar
    • Andrew Morton's avatar
      ieee1394: sbp2: include fixes · f84c922b
      Andrew Morton authored
      drivers/ieee1394/sbp2.c: In function 'sbp2util_access_timeout':
      drivers/ieee1394/sbp2.c:399: error: 'TASK_INTERRUPTIBLE' undeclared (first use in this function)
      drivers/ieee1394/sbp2.c:399: error: (Each undeclared identifier is reported only once
      drivers/ieee1394/sbp2.c:399: error: for each function it appears in.)
      drivers/ieee1394/sbp2.c:399: warning: implicit declaration of function 'signal_pending'
      drivers/ieee1394/sbp2.c:399: warning: implicit declaration of function 'schedule_timeout'
      drivers/ieee1394/sbp2.c: In function 'sbp2_prep_command_orb_sg':
      drivers/ieee1394/sbp2.c:1438: warning: implicit declaration of function 'page_address'
      drivers/ieee1394/sbp2.c:1438: warning: passing argument 2 of 'dma_map_single' makes pointer from integer without a cast
      drivers/ieee1394/sbp2.c: In function 'sbp2_handle_status_write':
      drivers/ieee1394/sbp2.c:1842: error: 'TASK_INTERRUPTIBLE' undeclared (first use in this function)
      
      Possibly due to changes in -mm, but this file should explicitly include the
      headers for the stuff it uses.
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (brought into alphabetic order)
      f84c922b
    • Stefan Richter's avatar
      ieee1394: sbp2: move some memory allocations into non-atomic context · 3d269cb5
      Stefan Richter authored
      When the command ORB pool is created, the ORB list won't be accessed
      concurrently.  Therefore we don't have to take the spinlock there.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      3d269cb5
    • Stefan Richter's avatar
      ieee1394: sbp2: optimize DMA direction of s/g tables · 2446a79f
      Stefan Richter authored
      Unlike the name suggests, "cmd->scatter_gather_element" holds only the
      s/g table, not the actual s/g elements.  Since the table is only read
      but never written by the device, DMA_BIDIRECTIONAL can be replaced by
      DMA_TO_DEVICE which may be cheaper on some architectures.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      2446a79f
    • Stefan Richter's avatar
      ieee1394: sbp2: enforce 32bit DMA mapping · 0555659d
      Stefan Richter authored
      In order to use OHCI-1394 physical DMA, all s/g elements, s/g tables,
      ORBs, and response buffers have to reside within the first 4 GB of the
      FireWire controller's physical address space.  Set the correct mask for
      DMA mappings.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      0555659d
    • Stefan Richter's avatar
      ieee1394: sbp2: remove unnecessary alignments of struct members · f412bf44
      Stefan Richter authored
      The members "dma_addr_t command_orb_dma" and "dma_addr_t sge_dma" of
      sbp2.h::sbp2_command_info do not have to be aligned themselves --- only
      the memory which they point to has to be.
      
      The member "struct sbp2_command_orb command_orb" has to be aligned on
      4 bytes boundary which is guaranteed because it contains u32 members.
      
      The member "struct sbp2_unrestricted_page_table scatter_gather_element",
      i.e. the SBP-2 s/g table, has to be aligned on 8 bytes boundary
      according to the SBP-2 spec.  This is not a requirement for FireWire
      controllers but could be expected by SBP-2 targets.
      
      I see no need to align the members command_orb and
      scatter_gather_element on CPU cacheline boundaries.  It could have
      performance benefits, but on the other hand sbp2 has a somewhat wasteful
      allocation scheme which should be optimized first before further tweaks
      like cacheline alignments.  (E.g. don't always allocate SG_ALL s/g table
      elements.)
      
      Note, before as well as after the patch, the code relies on the
      assumption that memory alignment in the virtual address space is
      preserved in the physical address space after DMA mapping.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      f412bf44
  2. 28 Apr, 2007 3 commits
    • Linus Torvalds's avatar
      Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6 · b9099ff6
      Linus Torvalds authored
      * 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6:
        sis900: Allocate rx replacement buffer before rx operation
        usb-net/pegasus: simplify carrier detection
      b9099ff6
    • Neil Horman's avatar
      sis900: Allocate rx replacement buffer before rx operation · dc5a1449
      Neil Horman authored
      Just found a hole in my last patch.  It was reported to me that shortly after we
      integrated this patch.  The report was of an oops that took place inside of
      netif_rx when using the sis900 driver.  Looking at my origional patch I noted
      that there was a spot between the new skb_alloc and the refill_rx_ring label
      where skb got reassigned to the pointer currently held in the rx_ring for the
      purposes of receiveing the frame.  The result of this is however that the buffer
      that gets passed to netif_rx (if it is called), then gets placed right back into
      the rx_ring.  So if you receive frames fast enough the skb being processed by
      the network stack can get corrupted.  The reporter is testing out the fix I've
      written for this below (I'm not near my hardware at the moment to test myself),
      but I wanted to post it for review ASAP.  I'll post test results when I hear
      them, but I think this is a pretty straightforward fix.  It just uses a separate
      pointer to do the rx operation, so that we don't improperly reassign the pointer
      that we use to refill the rx ring.
      Signed-off-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
      dc5a1449
    • Dan Williams's avatar
      usb-net/pegasus: simplify carrier detection · 1764f150
      Dan Williams authored
      Simplify pegasus carrier detection; rely only on the periodic MII
      polling.  Reverts pieces of c43c49bd.
      Signed-off-by: default avatarDan Williams <dcbw@redhat.com>
      Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
      1764f150
  3. 27 Apr, 2007 20 commits