1. 05 10月, 2010 1 次提交
  2. 21 5月, 2010 1 次提交
    • I
      wimax/i2400m: fix bad race condition check in RX path · 3a24934f
      Inaky Perez-Gonzalez 提交于
      The i2400m->rx_roq data structure is protected against race conditions
      with a reference count (i2400m->rx_roq_refcount); the pointer can be
      read-referenced under the i2400m->rx_lock spinlock.
      
      The code in i2400m_rx_edata() wasn't properly following access
      protocol, performing an invalid check on i2400m->rx_roq (which is
      cleared to NULL when the refcount drops to zero). As such, it was
      missing to detect when the data structure is no longer valid and
      oopsing with a NULL pointer dereference.
      
      This commit fixes said check by verifying, under the rx_lock spinlock,
      that i2400m->rx_roq is non-NULL and then increasing the reference
      count before dropping the spinlock.
      Signed-off-by: NInaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
      3a24934f
  3. 14 5月, 2010 1 次提交
    • J
      drivers/net: Remove unnecessary returns from void function()s · a4b77097
      Joe Perches 提交于
      This patch removes from drivers/net/ all the unnecessary
      return; statements that precede the last closing brace of
      void functions.
      
      It does not remove the returns that are immediately
      preceded by a label as gcc doesn't like that.
      
      It also does not remove null void functions with return.
      
      Done via:
      $ grep -rP --include=*.[ch] -l "return;\n}" net/ | \
        xargs perl -i -e 'local $/ ; while (<>) { s/\n[ \t\n]+return;\n}/\n}/g; print; }'
      
      with some cleanups by hand.
      
      Compile tested x86 allmodconfig only.
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a4b77097
  4. 12 5月, 2010 4 次提交
  5. 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
  6. 04 12月, 2009 1 次提交
  7. 04 11月, 2009 1 次提交
    • I
      wimax/i2400m: introduce i2400m_reset(), stopping TX and carrier · c931ceeb
      Inaky Perez-Gonzalez 提交于
      Currently the i2400m driver was resetting by just calling
      i2400m->bus_reset(). However, this was missing stopping the TX queue
      and downing the carrier. This was causing, for the corner case of the
      driver reseting a device that refuses to go out of idle mode, that a
      few packets would be queued and more than one reset would go through,
      making the recovery a wee bit messy.
      
      To avoid introducing the same cleanup in all the bus-specific driver,
      introduced a i2400m_reset() function that takes care of house cleaning
      and then calling the bus-level reset implementation.
      
      The bulk of the changes in all files are just to rename the call from
      i2400m->bus_reset() to i2400m_reset().
      Signed-off-by: NInaky Perez-Gonzalez <inaky@linux.intel.com>
      c931ceeb
  8. 19 10月, 2009 3 次提交
    • I
      wimax/i2400m: queue device's report until the driver is ready for them · a0beba21
      Inaky Perez-Gonzalez 提交于
      The i2400m might start sending reports to the driver before it is done
      setting up all the infrastructure needed for handling them.
      
      Currently we were just dropping them when the driver wasn't ready and
      that is bad in certain situations, as the sync between the driver's
      idea of the device's state and the device's state dissapears.
      
      This changes that by implementing a queue for handling
      reports. Incoming reports are appended to it and a workstruct is woken
      to process the list of queued reports.
      
      When the device is not yet ready to handle them, the workstruct is not
      woken, but at soon as the device becomes ready again, the queue is
      processed.
      
      As a consequence of this, i2400m_queue_work() is no longer used, and
      thus removed.
      Signed-off-by: NInaky Perez-Gonzalez <inaky@linux.intel.com>
      a0beba21
    • I
      wimax/i2400m: clarify and fix i2400m->{ready,updown} · c2315b4e
      Inaky Perez-Gonzalez 提交于
      The i2400m driver uses two different bits to distinguish how much the
      driver is up. i2400m->ready is used to denote that the infrastructure
      to communicate with the device is up and running. i2400m->updown is
      used to indicate if 'ready' and the device is up and running, ready to
      take control and data traffic.
      
      However, all this was pretty dirty and not clear, with many open spots
      where race conditions were present.
      
      This commit cleans up the situation by:
      
       - documenting the usage of both bits
      
       - setting them only in specific, well controlled places
         (i2400m_dev_start, i2400m_dev_stop)
      
       - ensuring the i2400m workqueue can't get in the middle of the
         setting by flushing it when i2400m->ready is set to zero. This
         allows the report hook not having to check again for the bit to be
         set [rx.c:i2400m_report_hook_work()].
      
       - using i2400m->updown to determine if the device is up and running
         instead of the wimax state in i2400m_dev_reset_handle().
      
       - not loosing missed messages sent by the hardware before
         i2400m->ready is set. In rx.c, whatever the device sends can be
         sent to user space over the message pipes as soon as the wimax
         device is registered, so don't wait for i2400m->ready to be set.
      Signed-off-by: NInaky Perez-Gonzalez <inaky@linux.intel.com>
      c2315b4e
    • I
      wimax/i2400m: rework bootrom initialization to be more flexible · aba3792a
      Inaky Perez-Gonzalez 提交于
      This modifies the bootrom initialization code of the i2400m driver so
      it can more easily support upcoming hardware.
      
      Currently, the code detects two types of barkers (magic numbers) sent
      by the device to indicate the types of firmware it would take (signed
      vs non-signed).
      
      This schema is extended so that multiple reboot barkers are
      recognized; upcoming hw will expose more types barkers which will have
      to match a header in the firmware image before we can load it.
      
      For that, a barker database is introduced; the first time the device
      sends a barker, it is matched in the database. That gives the driver
      the information needed to decide how to upload the firmware and which
      types of firmware to use. The database can be populated from module
      parameters.
      
      The execution flow is not altered; a new function
      (i2400m_is_boot_barker) is introduced to determine in the RX path if
      the device has sent a boot barker. This function is becoming heavier,
      so it is put away from the hot reception path [this is why there is
      some reorganization in sdio-rx.c:i2400ms_rx and
      usb-notifc.c:i2400mu_notification_grok()].
      
      The documentation on the process has also been updated.
      
      All these modifications are heavily based on previous work by Dirk
      Brandewie <dirk.brandewie@intel.com>.
      Signed-off-by: NInaky Perez-Gonzalez <inaky@linux.intel.com>
      aba3792a
  9. 11 6月, 2009 1 次提交
  10. 29 5月, 2009 2 次提交
  11. 15 5月, 2009 1 次提交
    • I
      wimax/i2400m: fix device crash: fix optimization in _roq_queue_update_ws · 4e5b6d00
      Inaky Perez-Gonzalez 提交于
      When the i2400m receives data and the device indicates there has to be
      reordering, we keep an sliding window implementation to sort the
      packets before sending them to the network stack.
      
      One of the "operations" that the device indicates is "queue a packet
      and update the window start". When the queue is empty, this is
      equivalent to "deliver the packet and update the window start".
      
      That case was optimized in i2400m_roq_queue_update_ws() so that we
      would not pointlessly queue and dequeue a packet. However, when the
      optimization was active, it wasn't updating the window start. That
      caused the reorder management code to get confused later on with what
      seemed to be wrong reorder requests from the device.
      
      Thus the fix implemented is to do the right thing and update the
      window start in both cases, when the queue is empty (and the
      optimization is done) and when not.
      Signed-off-by: NInaky Perez-Gonzalez <inaky@linux.intel.com>
      4e5b6d00
  12. 02 3月, 2009 2 次提交
    • I
      wimax/i2400m: implement RX reorder support · c747583d
      Inaky Perez-Gonzalez 提交于
      Allow the device to give the driver RX data with reorder information.
      
      When that is done, the device will indicate the driver if a packet has
      to be held in a (sorted) queue. It will also tell the driver when held
      packets have to be released to the OS.
      
      This is done to improve the WiMAX-protocol level retransmission
      support when missing frames are detected.
      
      The code docs provide details about the implementation.
      
      In general, this just hooks into the RX path in rx.c; if a packet with
      the reorder bit in the RX header is detected, the reorder information
      in the header is extracted and one of the four main reorder operations
      are executed. In one case (queue) no packet will be delivered to the
      networking stack, just queued, whereas in the others (reset, update_ws
      and queue_update_ws), queued packet might be delivered depending on
      the window start for the specific queue.
      
      The modifications to files other than rx.c are:
      
      - control.c: during device initialization, enable reordering support
        if the rx_reorder_disabled module parameter is not enabled
      
      - driver.c: expose a rx_reorder_disable module parameter and call
        i2400m_rx_setup/release() to initialize/shutdown RX reorder
        support.
      
      - i2400m.h: introduce members in 'struct i2400m' needed for
        implementing reorder support.
      
      - linux/i2400m.h: introduce TLVs, commands and constant definitions
        related to RX reorder
      
      Last but not least, the rx reorder code includes an small circular log
      where the last N reorder operations are recorded to be displayed in
      case of inconsistency. Otherwise diagnosing issues would be almost
      impossible.
      Signed-off-by: NInaky Perez-Gonzalez <inaky@linux.intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c747583d
    • I
      wimax/i2400m: support extended data RX protocol (no need to reallocate skbs) · fd5c565c
      Inaky Perez-Gonzalez 提交于
      Newer i2400m firmwares (>= v1.4) extend the data RX protocol so that
      each packet has a 16 byte header. This header is mainly used to
      implement host reordeing (which is addressed in later commits).
      
      However, this header also allows us to overwrite it (once data has
      been extracted) with an Ethernet header and deliver to the networking
      stack without having to reallocate the skb (as it happened in fw <=
      v1.3) to make room for it.
      
      - control.c: indicate the device [dev_initialize()] that the driver
        wants to use the extended data RX protocol. Also involves adding the
        definition of the needed data types in include/linux/wimax/i2400m.h.
      
      - rx.c: handle the new payload type for the extended RX data
        protocol. Prepares the skb for delivery to
        netdev.c:i2400m_net_erx().
      
      - netdev.c: Introduce i2400m_net_erx() that adds the fake ethernet
        address to a prepared skb and delivers it to the networking
        stack.
      
      - cleanup: in most instances in rx.c, the variable 'single' was
        renamed to 'single_last' for it better conveys its meaning.
      Signed-off-by: NInaky Perez-Gonzalez <inaky@linux.intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fd5c565c
  13. 27 2月, 2009 1 次提交
  14. 08 1月, 2009 1 次提交
    • I
      i2400m: RX and TX data/control paths · aa5a7aca
      Inaky Perez-Gonzalez 提交于
      Handling of TX/RX data to/from the i2400m device (IP packets, control
      and diagnostics). On RX, this parses the received read transaction
      from the device, breaks it in chunks and passes it to the
      corresponding subsystems (network and control).
      
      Transmission to the device is done through a software FIFO, as
      data/control frames can be coalesced (while the device is reading the
      previous tx transaction, others accumulate). A FIFO is used because at
      the end it is resource-cheaper that scatter/gather over USB. As well,
      most traffic is going to be download (vs upload).
      Signed-off-by: NInaky Perez-Gonzalez <inaky@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      aa5a7aca