rpms/kernel/devel drm-next.patch, 1.20, 1.21 iwlwifi-Recover-TX-flow-failure.patch, NONE, 1.1 iwlwifi-Recover-TX-flow-stall-due-to-stuck-queue.patch, NONE, 1.1 iwlwifi-add-internal-short-scan-support-for-3945.patch, NONE, 1.1 iwlwifi-code-cleanup-for-connectivity-recovery.patch, NONE, 1.1 iwlwifi-iwl_good_ack_health-only-apply-to-AGN-device.patch, NONE, 1.1 iwlwifi-move-plcp-check-to-separated-function.patch, NONE, 1.1 kernel.spec, 1.2004, 1.2005 drm-1024x768-85.patch, 1.1, NONE drm-intel-gen5-dither.patch, 1.1, NONE

Kyle McMartin kyle at fedoraproject.org
Mon May 31 14:12:05 UTC 2010


Author: kyle

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv10177

Modified Files:
	kernel.spec 
Added Files:
	drm-next.patch iwlwifi-Recover-TX-flow-failure.patch 
	iwlwifi-Recover-TX-flow-stall-due-to-stuck-queue.patch 
	iwlwifi-add-internal-short-scan-support-for-3945.patch 
	iwlwifi-code-cleanup-for-connectivity-recovery.patch 
	iwlwifi-iwl_good_ack_health-only-apply-to-AGN-device.patch 
	iwlwifi-move-plcp-check-to-separated-function.patch 
Removed Files:
	drm-1024x768-85.patch drm-intel-gen5-dither.patch 
Log Message:
* Mon May 31 2010 Kyle McMartin <kyle at redhat.com> 2.6.34-14
- re-add drm-next.patch, should be in sync with 2.6.35 and what
  was backported to Fedora 13.
- drop patches merged in drm-next to 2.6.35
- rebase relevant iwl fixes on top of 2.6.34 from the ones committed
  to F-13 by linville.


drm-next.patch:
 b/Documentation/DocBook/Makefile                  |    2 
 b/Documentation/DocBook/drm.tmpl                  |  839 +++++++++
 b/arch/x86/include/asm/cacheflush.h               |    2 
 b/arch/x86/mm/pageattr.c                          |   53 
 b/drivers/char/agp/agp.h                          |   80 
 b/drivers/char/agp/ali-agp.c                      |    1 
 b/drivers/char/agp/amd-k7-agp.c                   |    9 
 b/drivers/char/agp/amd64-agp.c                    |   28 
 b/drivers/char/agp/ati-agp.c                      |    8 
 b/drivers/char/agp/efficeon-agp.c                 |    1 
 b/drivers/char/agp/intel-agp.c                    | 1883 +---------------------
 b/drivers/char/agp/intel-agp.h                    |  239 ++
 b/drivers/char/agp/intel-gtt.c                    | 1516 +++++++++++++++++
 b/drivers/char/agp/nvidia-agp.c                   |    1 
 b/drivers/char/agp/sis-agp.c                      |    9 
 b/drivers/char/agp/uninorth-agp.c                 |   16 
 b/drivers/char/agp/via-agp.c                      |    2 
 b/drivers/gpu/drm/Kconfig                         |    4 
 b/drivers/gpu/drm/drm_auth.c                      |    3 
 b/drivers/gpu/drm/drm_crtc.c                      |    9 
 b/drivers/gpu/drm/drm_crtc_helper.c               |  490 +----
 b/drivers/gpu/drm/drm_dma.c                       |    4 
 b/drivers/gpu/drm/drm_edid.c                      |  807 ++++++---
 b/drivers/gpu/drm/drm_fb_helper.c                 |  908 +++++++---
 b/drivers/gpu/drm/drm_fops.c                      |    3 
 b/drivers/gpu/drm/drm_gem.c                       |   49 
 b/drivers/gpu/drm/drm_modes.c                     |  105 -
 b/drivers/gpu/drm/drm_sysfs.c                     |    2 
 b/drivers/gpu/drm/i915/Makefile                   |    2 
 b/drivers/gpu/drm/i915/dvo.h                      |   10 
 b/drivers/gpu/drm/i915/dvo_ch7017.c               |   46 
 b/drivers/gpu/drm/i915/dvo_ch7xxx.c               |   44 
 b/drivers/gpu/drm/i915/dvo_ivch.c                 |   21 
 b/drivers/gpu/drm/i915/dvo_sil164.c               |   38 
 b/drivers/gpu/drm/i915/dvo_tfp410.c               |   32 
 b/drivers/gpu/drm/i915/i915_debugfs.c             |   28 
 b/drivers/gpu/drm/i915/i915_dma.c                 |   15 
 b/drivers/gpu/drm/i915/i915_drv.c                 |   29 
 b/drivers/gpu/drm/i915/i915_drv.h                 |   36 
 b/drivers/gpu/drm/i915/i915_gem.c                 |  152 +
 b/drivers/gpu/drm/i915/i915_gem_debug.c           |    2 
 b/drivers/gpu/drm/i915/i915_gem_tiling.c          |    5 
 b/drivers/gpu/drm/i915/i915_irq.c                 |   23 
 b/drivers/gpu/drm/i915/i915_reg.h                 |  143 +
 b/drivers/gpu/drm/i915/i915_suspend.c             |   41 
 b/drivers/gpu/drm/i915/i915_trace.h               |   88 -
 b/drivers/gpu/drm/i915/intel_bios.c               |    1 
 b/drivers/gpu/drm/i915/intel_crt.c                |   93 -
 b/drivers/gpu/drm/i915/intel_display.c            | 1064 ++++++++----
 b/drivers/gpu/drm/i915/intel_dp.c                 |  256 +-
 b/drivers/gpu/drm/i915/intel_drv.h                |   31 
 b/drivers/gpu/drm/i915/intel_dvo.c                |  103 -
 b/drivers/gpu/drm/i915/intel_fb.c                 |  217 +-
 b/drivers/gpu/drm/i915/intel_hdmi.c               |   71 
 b/drivers/gpu/drm/i915/intel_lvds.c               |  111 -
 b/drivers/gpu/drm/i915/intel_modes.c              |   21 
 b/drivers/gpu/drm/i915/intel_overlay.c            |    8 
 b/drivers/gpu/drm/i915/intel_sdvo.c               | 1009 +++++------
 b/drivers/gpu/drm/i915/intel_tv.c                 |  185 --
 b/drivers/gpu/drm/nouveau/Makefile                |    3 
 b/drivers/gpu/drm/nouveau/nouveau_bios.c          |  500 +++--
 b/drivers/gpu/drm/nouveau/nouveau_bios.h          |    1 
 b/drivers/gpu/drm/nouveau/nouveau_bo.c            |  116 -
 b/drivers/gpu/drm/nouveau/nouveau_connector.c     |   15 
 b/drivers/gpu/drm/nouveau/nouveau_debugfs.c       |    3 
 b/drivers/gpu/drm/nouveau/nouveau_display.c       |   42 
 b/drivers/gpu/drm/nouveau/nouveau_drv.c           |   19 
 b/drivers/gpu/drm/nouveau/nouveau_drv.h           |   12 
 b/drivers/gpu/drm/nouveau/nouveau_encoder.h       |    2 
 b/drivers/gpu/drm/nouveau/nouveau_fb.h            |    6 
 b/drivers/gpu/drm/nouveau/nouveau_fbcon.c         |  259 +--
 b/drivers/gpu/drm/nouveau/nouveau_fbcon.h         |   19 
 b/drivers/gpu/drm/nouveau/nouveau_gem.c           |    5 
 b/drivers/gpu/drm/nouveau/nouveau_grctx.c         |    6 
 b/drivers/gpu/drm/nouveau/nouveau_i2c.c           |   21 
 b/drivers/gpu/drm/nouveau/nouveau_irq.c           |   10 
 b/drivers/gpu/drm/nouveau/nouveau_reg.h           |    1 
 b/drivers/gpu/drm/nouveau/nouveau_state.c         |   58 
 b/drivers/gpu/drm/nouveau/nv04_fbcon.c            |   18 
 b/drivers/gpu/drm/nouveau/nv04_graph.c            |  566 ++++++
 b/drivers/gpu/drm/nouveau/nv40_graph.c            |    8 
 b/drivers/gpu/drm/nouveau/nv40_grctx.c            |    5 
 b/drivers/gpu/drm/nouveau/nv50_calc.c             |   87 +
 b/drivers/gpu/drm/nouveau/nv50_crtc.c             |   46 
 b/drivers/gpu/drm/nouveau/nv50_display.c          |   36 
 b/drivers/gpu/drm/nouveau/nv50_fbcon.c            |   16 
 b/drivers/gpu/drm/nouveau/nv50_sor.c              |   15 
 b/drivers/gpu/drm/radeon/atombios.h               |   76 
 b/drivers/gpu/drm/radeon/atombios_crtc.c          |   23 
 b/drivers/gpu/drm/radeon/atombios_dp.c            |    2 
 b/drivers/gpu/drm/radeon/evergreen.c              | 1549 +++++++++++++++++-
 b/drivers/gpu/drm/radeon/evergreen_reg.h          |    4 
 b/drivers/gpu/drm/radeon/evergreend.h             |  556 ++++++
 b/drivers/gpu/drm/radeon/r100.c                   |  729 ++++++--
 b/drivers/gpu/drm/radeon/r100d.h                  |  164 +
 b/drivers/gpu/drm/radeon/r300.c                   |  152 -
 b/drivers/gpu/drm/radeon/r300d.h                  |   47 
 b/drivers/gpu/drm/radeon/r420.c                   |   36 
 b/drivers/gpu/drm/radeon/r500_reg.h               |    3 
 b/drivers/gpu/drm/radeon/r520.c                   |    7 
 b/drivers/gpu/drm/radeon/r600.c                   |  600 ++++++-
 b/drivers/gpu/drm/radeon/r600_audio.c             |   58 
 b/drivers/gpu/drm/radeon/r600_blit_kms.c          |    3 
 b/drivers/gpu/drm/radeon/r600_hdmi.c              |   65 
 b/drivers/gpu/drm/radeon/r600_reg.h               |   57 
 b/drivers/gpu/drm/radeon/radeon.h                 |  259 ++-
 b/drivers/gpu/drm/radeon/radeon_agp.c             |    5 
 b/drivers/gpu/drm/radeon/radeon_asic.c            |  140 +
 b/drivers/gpu/drm/radeon/radeon_asic.h            |   44 
 b/drivers/gpu/drm/radeon/radeon_atombios.c        |  255 ++
 b/drivers/gpu/drm/radeon/radeon_bios.c            |    3 
 b/drivers/gpu/drm/radeon/radeon_combios.c         |   64 
 b/drivers/gpu/drm/radeon/radeon_connectors.c      |   63 
 b/drivers/gpu/drm/radeon/radeon_cs.c              |    4 
 b/drivers/gpu/drm/radeon/radeon_device.c          |   63 
 b/drivers/gpu/drm/radeon/radeon_display.c         |  129 -
 b/drivers/gpu/drm/radeon/radeon_drv.c             |    7 
 b/drivers/gpu/drm/radeon/radeon_encoders.c        |   44 
 b/drivers/gpu/drm/radeon/radeon_fb.c              |  358 ++--
 b/drivers/gpu/drm/radeon/radeon_fence.c           |  107 -
 b/drivers/gpu/drm/radeon/radeon_gart.c            |    2 
 b/drivers/gpu/drm/radeon/radeon_gem.c             |    6 
 b/drivers/gpu/drm/radeon/radeon_irq_kms.c         |    5 
 b/drivers/gpu/drm/radeon/radeon_kms.c             |   18 
 b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c     |   14 
 b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c |   15 
 b/drivers/gpu/drm/radeon/radeon_mode.h            |   49 
 b/drivers/gpu/drm/radeon/radeon_object.c          |   44 
 b/drivers/gpu/drm/radeon/radeon_object.h          |    2 
 b/drivers/gpu/drm/radeon/radeon_pm.c              |  814 ++++++---
 b/drivers/gpu/drm/radeon/radeon_reg.h             |    4 
 b/drivers/gpu/drm/radeon/radeon_ring.c            |   66 
 b/drivers/gpu/drm/radeon/radeon_ttm.c             |  122 -
 b/drivers/gpu/drm/radeon/rs400.c                  |    9 
 b/drivers/gpu/drm/radeon/rs600.c                  |  231 ++
 b/drivers/gpu/drm/radeon/rs600d.h                 |   80 
 b/drivers/gpu/drm/radeon/rs690.c                  |  289 +--
 b/drivers/gpu/drm/radeon/rv515.c                  |  287 +--
 b/drivers/gpu/drm/radeon/rv515d.h                 |   46 
 b/drivers/gpu/drm/radeon/rv770.c                  |   28 
 b/drivers/gpu/drm/savage/savage_bci.c             |    3 
 b/drivers/gpu/drm/ttm/Makefile                    |    2 
 b/drivers/gpu/drm/ttm/ttm_bo.c                    |   98 -
 b/drivers/gpu/drm/ttm/ttm_bo_util.c               |  122 -
 b/drivers/gpu/drm/ttm/ttm_bo_vm.c                 |   41 
 b/drivers/gpu/drm/ttm/ttm_memory.c                |    7 
 b/drivers/gpu/drm/ttm/ttm_page_alloc.c            |  845 +++++++++
 b/drivers/gpu/drm/ttm/ttm_tt.c                    |   44 
 b/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c          |   50 
 b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c         |    4 
 b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c              |   14 
 b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c             |    6 
 b/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c         |    2 
 b/drivers/gpu/vga/Kconfig                         |    6 
 b/drivers/staging/Kconfig                         |    2 
 b/drivers/video/efifb.c                           |   11 
 b/drivers/video/fbmem.c                           |   74 
 b/drivers/video/fbsysfs.c                         |    1 
 b/drivers/video/offb.c                            |   28 
 b/drivers/video/vesafb.c                          |   11 
 b/drivers/video/vga16fb.c                         |   26 
 b/include/drm/drmP.h                              |    3 
 b/include/drm/drm_crtc.h                          |   43 
 b/include/drm/drm_crtc_helper.h                   |    9 
 b/include/drm/drm_edid.h                          |    5 
 b/include/drm/drm_fb_helper.h                     |   67 
 b/include/drm/drm_fixed.h                         |   67 
 b/include/drm/radeon_drm.h                        |    1 
 b/include/drm/ttm/ttm_bo_api.h                    |   46 
 b/include/drm/ttm/ttm_bo_driver.h                 |   57 
 b/include/drm/ttm/ttm_page_alloc.h                |   74 
 b/include/linux/fb.h                              |   19 
 drivers/gpu/drm/radeon/radeon_fixed.h             |   67 
 173 files changed, 15248 insertions(+), 7307 deletions(-)

View full diff with command:
/usr/bin/cvs -n -f diff -kk -u -p -N -r 1.20 -r 1.21 drm-next.patchIndex: drm-next.patch
===================================================================
RCS file: drm-next.patch
diff -N drm-next.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ drm-next.patch	31 May 2010 14:12:01 -0000	1.21
@@ -0,0 +1,36147 @@
+# generated with:
+#  $ git branch stable-2.6.34 v2.6.34
+#  $ git fetch drm-2.6
+#  $ git branch drm-next drm-2.6/drm-next
+#  $ git branch drm-rebase stable-2.6.34
+#  $ git rebase --onto drm-rebase TAIL..drm-next
+#  <fix up rejects, enable nouveau>
+
+commit 69cf253d1d16fbcc9225582776ebe11f2f13d921
+Author: Kyle McMartin <kyle at dreadnought.i.jkkm.org>
+Date:   Mon May 31 12:38:09 2010 +0100
+
+    nouveau is not in staging on Fedora
+
+commit fc5f2e0a106ffdb3d201ff2d08d384dff38a769e
+Author: Adam Jackson <ajax at redhat.com>
+Date:   Tue May 25 16:33:09 2010 -0400
+
+    drm/edid: Allow non-fatal checksum errors in CEA blocks
+    
+    Switches will try to update the topology address and not correctly fix
+    up the checksum, so just let it slide.
+    
+    https://bugs.freedesktop.org/28229
+    
+    Signed-off-by: Adam Jackson <ajax at redhat.com>
+    Signed-off-by: Dave Airlie <airlied at redhat.com>
+
+commit 42e6272d336e13ddd1ca6daac8e127a5b3b3a672
+Author: Stefan Richter <stefanr at s5r6.in-berlin.de>
+Date:   Wed May 26 10:27:44 2010 +1000
+
+    drm/radeon/kms: suppress a build warning (unused variable)
+    
+    At least 'make CONFIG_DEBUG_SECTION_MISMATCH=y' causes
+    drivers/gpu/drm/radeon/atombios_crtc.c: In function 'atombios_crtc_set_pll':
+    drivers/gpu/drm/radeon/atombios_crtc.c:684: warning: 'pll' may be used uninitialized in this function
+    which has the looks of a falso positive.
+    
+    Add a default: case so that gcc rests assured that all possible pll_id's are covered.
+    Keep the present cases that fall through to the default one for self-documentation.
+    
+    Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
+    Reviewed-by: Alex Deucher <alexdeucher at gmail.com>
+    Signed-off-by: Dave Airlie <airlied at redhat.com>
+
+commit 4bbcbb4866d54dc77ff2aa2cb0a2ac74d147caf0
+Author: Prarit Bhargava <prarit at redhat.com>
+Date:   Mon May 24 10:24:07 2010 +1000
+
+    drm: Fixes linux-next & linux-2.6 checkstack warnings:
+    
+    drivers/gpu/drm/nouveau/nv40_graph.c: In function `nv40_graph_init':
+    drivers/gpu/drm/nouveau/nv40_graph.c:400: warning: the frame size of 1184 bytes is larger than 1024 bytes
+    drivers/gpu/drm/radeon/radeon_atombios.c: In function `radeon_get_atom_connector_info_from_supported_devices_table':
+    drivers/gpu/drm/radeon/radeon_atombios.c:857: warning: the frame size of 1872 bytes is larger than 1024 bytes
+    
+    Signed-off-by: Prarit Bhargava <prarit at redhat.com>
+    Signed-off-by: Dave Airlie <airlied at redhat.com>
+
+commit 718bc70da3469867b05a17449da519443e5b5bd0
+Author: Randy Dunlap <randy.dunlap at oracle.com>
+Date:   Sun May 23 17:00:40 2010 -0700
+
+    nouveau: fix acpi_lid_open undefined
+    
+    When CONFIG_ACPI_BUTTON=m (and probably when ACPI_BUTTON is not enabled)
+    and NOUVEAU is built-in (not as a loadable module):
+    
+    nouveau_connector.c:(.text+0xe17ce): undefined reference to `acpi_lid_open'
+    
+    Signed-off-by: Randy Dunlap <randy.dunlap at oracle.com>
+    Acked-by: Ben Skeggs <bskeggs at redhat.com>
+    Signed-off-by: Dave Airlie <airlied at redhat.com>
+
+commit 5f056ef08a093c2aba47538ea1542820730a2543
+Author: Jerome Glisse <jglisse at redhat.com>
+Date:   Fri May 21 18:48:54 2010 +0200
+
+    drm/radeon/kms: release AGP bridge at suspend
+    
+    I think it's good to release the AGP bridge at suspend
+    and reacquire it at resume. Also fix :
+    https://bugzilla.kernel.org/show_bug.cgi?id=15969
+    
+    Signed-off-by: Jerome Glisse <jglisse at redhat.com>
+    Cc: stable <stable at kernel.org>
+    Signed-off-by: Dave Airlie <airlied at redhat.com>
+
+commit 08d76aad4816808ab8e80956a78b7dc64fec94ae
+Author: Alex Deucher <alexdeucher at gmail.com>
+Date:   Thu May 20 18:44:49 2010 -0400
+
+    drm/radeon/kms/pm/r600: select the mid clock mode for single head low profile
+    
+    This saves some more power at the expense of performance.
+    
+    Signed-off-by: Alex Deucher <alexdeucher at gmail.com>
+    Signed-off-by: Dave Airlie <airlied at redhat.com>
+
+commit 384acf057b2097c43988adebc7b6c2325cf15dc6
+Author: Dave Airlie <airlied at redhat.com>
+Date:   Fri May 21 15:41:20 2010 +1000
+
+    drm/radeon: fix power supply kconfig interaction.
+    
+    radeon needs power supply to get correct PM info so select it at the radeon
+    level not at the kms option.
+    
+    Signed-off-by: Dave Airlie <airlied at redhat.com>
+
+commit 8e3701cbb713150746fd96647d62c36435b69d0c
+Author: Jerome Glisse <jglisse at redhat.com>
+Date:   Wed May 19 16:05:50 2010 +0200
+
+    drm/radeon/kms: record object that have been list reserved
+    
+    list reservation was too optimistic about ttm object reservation
+    and could think that an object reserved by some other process
+    as reserved by the list reservation which was false. Thus when
+    unreserving the list it might unreserve object that it didn't
+    reserved in the list. Sorry if it's hard to follow but this
+    kind of things are just causing headheck.
+    
+    Signed-off-by: Jerome Glisse <jglisse at redhat.com>
+    Signed-off-by: Dave Airlie <airlied at redhat.com>
+
+commit c6463655f4a9b0fba797911ce67337b3eaef1afc
+Author: Michel Dänzer <daenzer at vmware.com>
+Date:   Wed May 19 12:46:22 2010 +0200
+
+    drm/radeon: AGP memory is only I/O if the aperture can be mapped by the CPU.
+    
+    Fixes AGP initialization failure with Apple UniNorth bridges due to trying to
+    ioremap() normal RAM.
+    
+    Signed-off-by: Michel Dänzer <daenzer at vmware.com>
+    Signed-off-by: Dave Airlie <airlied at redhat.com>
+
+commit b9e4fd1b880819e5d6fc3d443b3281b0482b11f7
+Author: Alex Deucher <alexdeucher at gmail.com>
+Date:   Thu May 20 11:26:11 2010 -0400
+
+    drm/radeon/kms: don't default display priority to high on rs4xx
+    
+    Seems to cause issues with the sound hardware.  Fixes kernel
+    bug 15982:
+    https://bugzilla.kernel.org/show_bug.cgi?id=15982
+    
+    Signed-off-by: Alex Deucher <alexdeucher at gmail.com>
+    Cc: stable at kernel.org
+    Signed-off-by: Dave Airlie <airlied at redhat.com>
+
+commit 07c5e6967f97b47ea211a923ff689c2610564c0c
+Author: Alex Deucher <alexdeucher at gmail.com>
+Date:   Wed May 19 11:43:40 2010 -0400
+
+    drm/edid: fix typo in 1600x1200 at 75 mode
+    
+    Spotted by Scott Bertilson.
+    Fixes fdo bug 28146.
+    
+    Signed-off-by: Alex Deucher <alexdeucher at gmail.com>
+    Reviewed-by: Mark Marshall <mark.marshall at csr.com>
+    Signed-off-by: Dave Airlie <airlied at redhat.com>
+
+commit 9a308cd30990ad69d8b132ea6bb63f7c4b174a75
+Author: Ben Skeggs <bskeggs at redhat.com>
+Date:   Wed May 12 16:30:50 2010 +1000
+
+    drm/nouveau: fix i2c-related init table handlers
+    
+    Mutliple issues.  INIT_ZM_I2C_BYTE/INIT_I2C_BYTE didn't even try and
+    use the register value, and all the handlers were using the wrong
+    slave address.
+    
+    Signed-off-by: Ben Skeggs <bskeggs at redhat.com>
+
+commit e4a15865ff22b6cd68fd5f48f710000eab0e65f1
+Author: Ben Skeggs <bskeggs at redhat.com>
+Date:   Wed May 12 14:45:04 2010 +1000
+
+    drm/nouveau: support init table i2c device identifier 0x81
+    
+    It appears to be meant to reference the second "default index".
+    
+    Signed-off-by: Ben Skeggs <bskeggs at redhat.com>
+
+commit dacd3c230cd4f286843d4ff6710ce6440dab5e9a
+Author: Ben Skeggs <bskeggs at redhat.com>
+Date:   Wed May 12 14:38:25 2010 +1000
+
+    drm/nouveau: ensure we've parsed i2c table entry for INIT_*I2C* handlers
[...35754 lines suppressed...]
+  *
+@@ -682,6 +682,11 @@ extern int ttm_bo_pci_offset(struct ttm_bo_device *bdev,
+ 			     unsigned long *bus_offset,
+ 			     unsigned long *bus_size);
+ 
++extern int ttm_mem_io_reserve(struct ttm_bo_device *bdev,
++				struct ttm_mem_reg *mem);
++extern void ttm_mem_io_free(struct ttm_bo_device *bdev,
++				struct ttm_mem_reg *mem);
++
+ extern void ttm_bo_global_release(struct ttm_global_reference *ref);
+ extern int ttm_bo_global_init(struct ttm_global_reference *ref);
+ 
+@@ -798,7 +803,8 @@ extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo,
+  *
+  * @bo: A pointer to a struct ttm_buffer_object.
+  * @evict: 1: This is an eviction. Don't try to pipeline.
+- * @no_wait: Never sleep, but rather return with -EBUSY.
++ * @no_wait_reserve: Return immediately if other buffers are busy.
++ * @no_wait_gpu: Return immediately if the GPU is busy.
+  * @new_mem: struct ttm_mem_reg indicating where to move.
+  *
+  * Optimized move function for a buffer object with both old and
+@@ -812,15 +818,16 @@ extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo,
+  */
+ 
+ extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
+-			   bool evict, bool no_wait,
+-			   struct ttm_mem_reg *new_mem);
++			   bool evict, bool no_wait_reserve,
++			   bool no_wait_gpu, struct ttm_mem_reg *new_mem);
+ 
+ /**
+  * ttm_bo_move_memcpy
+  *
+  * @bo: A pointer to a struct ttm_buffer_object.
+  * @evict: 1: This is an eviction. Don't try to pipeline.
+- * @no_wait: Never sleep, but rather return with -EBUSY.
++ * @no_wait_reserve: Return immediately if other buffers are busy.
++ * @no_wait_gpu: Return immediately if the GPU is busy.
+  * @new_mem: struct ttm_mem_reg indicating where to move.
+  *
+  * Fallback move function for a mappable buffer object in mappable memory.
+@@ -834,8 +841,8 @@ extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
+  */
+ 
+ extern int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
+-			      bool evict,
+-			      bool no_wait, struct ttm_mem_reg *new_mem);
++			      bool evict, bool no_wait_reserve,
++			      bool no_wait_gpu, struct ttm_mem_reg *new_mem);
+ 
+ /**
+  * ttm_bo_free_old_node
+@@ -854,7 +861,8 @@ extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
+  * @sync_obj_arg: An argument to pass to the sync object idle / wait
+  * functions.
+  * @evict: This is an evict move. Don't return until the buffer is idle.
+- * @no_wait: Never sleep, but rather return with -EBUSY.
++ * @no_wait_reserve: Return immediately if other buffers are busy.
++ * @no_wait_gpu: Return immediately if the GPU is busy.
+  * @new_mem: struct ttm_mem_reg indicating where to move.
+  *
+  * Accelerated move function to be called when an accelerated move
+@@ -868,7 +876,8 @@ extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
+ extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
+ 				     void *sync_obj,
+ 				     void *sync_obj_arg,
+-				     bool evict, bool no_wait,
++				     bool evict, bool no_wait_reserve,
++				     bool no_wait_gpu,
+ 				     struct ttm_mem_reg *new_mem);
+ /**
+  * ttm_io_prot
+diff --git a/include/drm/ttm/ttm_page_alloc.h b/include/drm/ttm/ttm_page_alloc.h
+new file mode 100644
+index 0000000..8bb4de5
+--- /dev/null
++++ b/include/drm/ttm/ttm_page_alloc.h
+@@ -0,0 +1,74 @@
++/*
++ * Copyright (c) Red Hat Inc.
++
++ * Permission is hereby granted, free of charge, to any person obtaining a
++ * copy of this software and associated documentation files (the "Software"),
++ * to deal in the Software without restriction, including without limitation
++ * the rights to use, copy, modify, merge, publish, distribute, sub license,
++ * and/or sell copies of the Software, and to permit persons to whom the
++ * Software is furnished to do so, subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice (including the
++ * next paragraph) shall be included in all copies or substantial portions
++ * of the Software.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
++ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
++ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
++ * DEALINGS IN THE SOFTWARE.
++ *
++ * Authors: Dave Airlie <airlied at redhat.com>
++ *          Jerome Glisse <jglisse at redhat.com>
++ */
++#ifndef TTM_PAGE_ALLOC
++#define TTM_PAGE_ALLOC
++
++#include "ttm_bo_driver.h"
++#include "ttm_memory.h"
++
++/**
++ * Get count number of pages from pool to pages list.
++ *
++ * @pages: heado of empty linked list where pages are filled.
++ * @flags: ttm flags for page allocation.
++ * @cstate: ttm caching state for the page.
++ * @count: number of pages to allocate.
++ */
++int ttm_get_pages(struct list_head *pages,
++		  int flags,
++		  enum ttm_caching_state cstate,
++		  unsigned count);
++/**
++ * Put linked list of pages to pool.
++ *
++ * @pages: list of pages to free.
++ * @page_count: number of pages in the list. Zero can be passed for unknown
++ * count.
++ * @flags: ttm flags for page allocation.
++ * @cstate: ttm caching state.
++ */
++void ttm_put_pages(struct list_head *pages,
++		   unsigned page_count,
++		   int flags,
++		   enum ttm_caching_state cstate);
++/**
++ * Initialize pool allocator.
++ *
++ * Pool allocator is internaly reference counted so it can be initialized
++ * multiple times but ttm_page_alloc_fini has to be called same number of
++ * times.
++ */
++int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages);
++/**
++ * Free pool allocator.
++ */
++void ttm_page_alloc_fini(void);
++
++/**
++ * Output the state of pools to debugfs file
++ */
++extern int ttm_page_alloc_debugfs(struct seq_file *m, void *data);
++#endif
+diff --git a/include/linux/fb.h b/include/linux/fb.h
+index c10163b..1296af4 100644
+--- a/include/linux/fb.h
++++ b/include/linux/fb.h
+@@ -403,6 +403,7 @@ struct fb_cursor {
+ #include <linux/notifier.h>
+ #include <linux/list.h>
+ #include <linux/backlight.h>
++#include <linux/slab.h>
+ #include <asm/io.h>
+ 
+ struct vm_area_struct;
+@@ -862,10 +863,22 @@ struct fb_info {
+ 	/* we need the PCI or similiar aperture base/size not
+ 	   smem_start/size as smem_start may just be an object
+ 	   allocated inside the aperture so may not actually overlap */
+-	resource_size_t aperture_base;
+-	resource_size_t aperture_size;
++	struct apertures_struct {
++		unsigned int count;
++		struct aperture {
++			resource_size_t base;
++			resource_size_t size;
++		} ranges[0];
++	} *apertures;
+ };
+ 
++static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
++	struct apertures_struct *a = kzalloc(sizeof(struct apertures_struct)
++			+ max_num * sizeof(struct aperture), GFP_KERNEL);
++	a->count = max_num;
++	return a;
++}
++
+ #ifdef MODULE
+ #define FBINFO_DEFAULT	FBINFO_MODULE
+ #else
+@@ -958,6 +971,8 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
+ /* drivers/video/fbmem.c */
+ extern int register_framebuffer(struct fb_info *fb_info);
+ extern int unregister_framebuffer(struct fb_info *fb_info);
++extern void remove_conflicting_framebuffers(struct apertures_struct *a,
++				const char *name, bool primary);
+ extern int fb_prepare_logo(struct fb_info *fb_info, int rotate);
+ extern int fb_show_logo(struct fb_info *fb_info, int rotate);
+ extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size);

iwlwifi-Recover-TX-flow-failure.patch:
 iwl-agn.c |   14 +++++++++++++-
 iwl-dev.h |   20 ++++++++++++++++++++
 iwl-rx.c  |   51 +++++++++++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 82 insertions(+), 3 deletions(-)

--- NEW FILE iwlwifi-Recover-TX-flow-failure.patch ---
>From 5b51e801eef53be8e521316eea9e78e5c4595fd4 Mon Sep 17 00:00:00 2001
From: Wey-Yi Guy <wey-yi.w.guy at intel.com>
Date: Thu, 4 Mar 2010 13:38:59 -0800
Subject: [PATCH] iwlwifi: Recover TX flow failure

Monitors the tx statistics to detect the drop in throughput.
When the throughput drops, the ratio of the actual_ack_count and the
expected_ack_count also drops.  At the same time, the aggregated
ba_timeout (the number of ba timeout retries) also rises.  If the
actual_ack_count/expected_ack_count ratio is 0 and the number of ba
timeout retries rises to BA_TIMEOUT_MAX, no tx packets can be delivered.
Reloading the uCode and bring the system back to normal operational
state.

Signed-off-by: Trieu 'Andrew' Nguyen <trieux.t.nguyen at intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy at intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre at intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-agn.c |   14 ++++++++-
 drivers/net/wireless/iwlwifi/iwl-dev.h |   21 +++++++++++++
 drivers/net/wireless/iwlwifi/iwl-rx.c  |   50 +++++++++++++++++++++++++++++++-
 3 files changed, 83 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 07a9a02..dc751cb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -2965,10 +2965,21 @@ static int iwl_mac_ampdu_action(struct ieee80211_hw *hw,
 			return ret;
 	case IEEE80211_AMPDU_TX_START:
 		IWL_DEBUG_HT(priv, "start Tx\n");
-		return iwl_tx_agg_start(priv, sta->addr, tid, ssn);
+		ret = iwl_tx_agg_start(priv, sta->addr, tid, ssn);
+		if (ret == 0) {
+			priv->_agn.agg_tids_count++;
+			IWL_DEBUG_HT(priv, "priv->_agn.agg_tids_count = %u\n",
+				     priv->_agn.agg_tids_count);
+		}
+		return ret;
 	case IEEE80211_AMPDU_TX_STOP:
 		IWL_DEBUG_HT(priv, "stop Tx\n");
 		ret = iwl_tx_agg_stop(priv, sta->addr, tid);
+		if ((ret == 0) && (priv->_agn.agg_tids_count > 0)) {
+			priv->_agn.agg_tids_count--;
+			IWL_DEBUG_HT(priv, "priv->_agn.agg_tids_count = %u\n",
+				     priv->_agn.agg_tids_count);
+		}
 		if (test_bit(STATUS_EXIT_PENDING, &priv->status))
 			return 0;
 		else
@@ -3399,6 +3410,7 @@ static int iwl_init_drv(struct iwl_priv *priv)
 	priv->iw_mode = NL80211_IFTYPE_STATION;
 	priv->current_ht_config.smps = IEEE80211_SMPS_STATIC;
 	priv->missed_beacon_threshold = IWL_MISSED_BEACON_THRESHOLD_DEF;
+	priv->_agn.agg_tids_count = 0;
 
 	/* initialize force reset */
 	priv->force_reset[IWL_RF_RESET].reset_duration =
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 447e14b..e2a6b76 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -1275,6 +1275,26 @@ struct iwl_priv {
 	void *shared_virt;
 	dma_addr_t shared_phys;
 	/*End*/
+	union {
+#if defined(CONFIG_IWLAGN) || defined(CONFIG_IWLAGN_MODULE)
+		struct {
+			/* INT ICT Table */
+			__le32 *ict_tbl;
+			void *ict_tbl_vir;
+			dma_addr_t ict_tbl_dma;
+			dma_addr_t aligned_ict_tbl_dma;
+			int ict_index;
+			u32 inta;
+			bool use_ict;
+			/*
+			 * reporting the number of tids has AGG on. 0 means
+			 * no AGGREGATION
+			 */
+			u8 agg_tids_count;
+		} _agn;
+#endif
+	};
+
 	struct iwl_hw_params hw_params;
 
 	/* INT ICT Table */
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index fabc52f..f48d685 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -617,9 +617,18 @@ static void iwl_accumulative_statistics(struct iwl_priv *priv,
 
 #define REG_RECALIB_PERIOD (60)
 
+/* the threshold ratio of actual_ack_cnt to expected_ack_cnt in percent */
+#define ACK_CNT_RATIO (50)
+#define BA_TIMEOUT_CNT (5)
+#define BA_TIMEOUT_MAX (16)
+
 #define PLCP_MSG "plcp_err exceeded %u, %u, %u, %u, %u, %d, %u mSecs\n"
 /*
- * This function checks for plcp error.
+ * This function checks for plcp error, ACK count ratios, aggregated BA
+ * timeout retries.
+ * - When the ACK count ratio is 0 and aggregated BA timeout retries is
+ * exceeding the BA_TIMEOUT_MAX, it will recover the failure by resetting
+ * the firmware.
  * - When the plcp error is exceeding the thresholds, it will reset the radio
  * to improve the throughput.
  */
@@ -629,6 +638,45 @@ void iwl_recover_from_statistics(struct iwl_priv *priv,
 	int combined_plcp_delta;
 	unsigned int plcp_msec;
 	unsigned long plcp_received_jiffies;
+	int actual_ack_cnt_delta;
+	int expected_ack_cnt_delta;
+	int ba_timeout_delta;
+
+	actual_ack_cnt_delta =
+		le32_to_cpu(pkt->u.stats.tx.actual_ack_cnt) -
+		le32_to_cpu(priv->statistics.tx.actual_ack_cnt);
+	expected_ack_cnt_delta =
+		le32_to_cpu(pkt->u.stats.tx.expected_ack_cnt) -
+		le32_to_cpu(priv->statistics.tx.expected_ack_cnt);
+	ba_timeout_delta =
+		le32_to_cpu(pkt->u.stats.tx.agg.ba_timeout) -
+		le32_to_cpu(priv->statistics.tx.agg.ba_timeout);
+	if ((priv->_agn.agg_tids_count > 0) &&
+	    (expected_ack_cnt_delta > 0) &&
+	    (((actual_ack_cnt_delta * 100) / expected_ack_cnt_delta)
+		< ACK_CNT_RATIO) &&
+	    (ba_timeout_delta > BA_TIMEOUT_CNT)) {
+		IWL_DEBUG_RADIO(priv, "actual_ack_cnt delta = %d,"
+				" expected_ack_cnt = %d\n",
+				actual_ack_cnt_delta, expected_ack_cnt_delta);
+
+#ifdef CONFIG_IWLWIFI_DEBUG
+		IWL_DEBUG_RADIO(priv, "rx_detected_cnt delta = %d\n",
+				priv->delta_statistics.tx.rx_detected_cnt);
+		IWL_DEBUG_RADIO(priv,
+				"ack_or_ba_timeout_collision delta = %d\n",
+				priv->delta_statistics.tx.
+				ack_or_ba_timeout_collision);
+#endif
+		IWL_DEBUG_RADIO(priv, "agg ba_timeout delta = %d\n",
+				ba_timeout_delta);
+		if ((actual_ack_cnt_delta == 0) &&
+		    (ba_timeout_delta >= BA_TIMEOUT_MAX)) {
+			IWL_DEBUG_RADIO(priv,
+					"call iwl_force_reset(IWL_FW_RESET)\n");
+			iwl_force_reset(priv, IWL_FW_RESET);
+		}
+	}
 
 	/*
 	 * check for plcp_err and trigger radio reset if it exceeds
-- 
1.7.0.1


iwlwifi-Recover-TX-flow-stall-due-to-stuck-queue.patch:
 iwl-1000.c     |    3 +
 iwl-3945.c     |    2 +
 iwl-4965.c     |    1 
 iwl-5000.c     |    9 +++++
 iwl-6000.c     |    8 ++++
 iwl-agn.c      |   16 +++++++++
 iwl-core.c     |   93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 iwl-core.h     |    7 ++++
 iwl-dev.h      |   10 ++++++
 iwl-tx.c       |    2 +
 iwl3945-base.c |   17 +++++++++-
 11 files changed, 167 insertions(+), 1 deletion(-)

--- NEW FILE iwlwifi-Recover-TX-flow-stall-due-to-stuck-queue.patch ---
>From 8483e011e2ad5d5b27ebe4517fedf13e16d0b7cb Mon Sep 17 00:00:00 2001
From: Wey-Yi Guy <wey-yi.w.guy at intel.com>
Date: Mon, 1 Mar 2010 17:23:50 -0800
Subject: [PATCH] iwlwifi: Recover TX flow stall due to stuck queue

Monitors the internal TX queues periodically.  When a queue is stuck
for some unknown conditions causing the throughput to drop and the
transfer is stop, the driver will force firmware reload and bring the
system back to normal operational state.

The iwlwifi devices behave differently in this regard so this feature is
made part of the ops infrastructure so we can have more control on how to
monitor and recover from tx queue stall case per device.

Signed-off-by: Trieu 'Andrew' Nguyen <trieux.t.nguyen at intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy at intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre at intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-1000.c     |    3 +
 drivers/net/wireless/iwlwifi/iwl-3945.c     |    2 +
 drivers/net/wireless/iwlwifi/iwl-4965.c     |    1 +
 drivers/net/wireless/iwlwifi/iwl-5000.c     |    9 +++
 drivers/net/wireless/iwlwifi/iwl-6000.c     |    8 ++
 drivers/net/wireless/iwlwifi/iwl-agn.c      |   16 +++++
 drivers/net/wireless/iwlwifi/iwl-core.c     |   93 +++++++++++++++++++++++++++
 drivers/net/wireless/iwlwifi/iwl-core.h     |    7 ++
 drivers/net/wireless/iwlwifi/iwl-dev.h      |   10 +++
 drivers/net/wireless/iwlwifi/iwl-tx.c       |    2 +
 drivers/net/wireless/iwlwifi/iwl3945-base.c |   16 +++++
 11 files changed, 167 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
index 3bf2e6e..89dc401 100644
--- a/drivers/net/wireless/iwlwifi/iwl-1000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
@@ -211,6 +211,7 @@ static struct iwl_lib_ops iwl1000_lib = {
 		.set_ct_kill = iwl1000_set_ct_threshold,
 	 },
 	.add_bcast_station = iwl_add_bcast_station,
+	.recover_from_tx_stall = iwl_bg_monitor_recover,
 };
 
 static const struct iwl_ops iwl1000_ops = {
@@ -248,6 +249,7 @@ struct iwl_cfg iwl1000_bgn_cfg = {
 	.support_ct_kill_exit = true,
 	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF,
 	.chain_noise_scale = 1000,
+	.monitor_recover_period = IWL_MONITORING_PERIOD,
 };
 
 struct iwl_cfg iwl1000_bg_cfg = {
@@ -276,6 +278,7 @@ struct iwl_cfg iwl1000_bg_cfg = {
 	.support_ct_kill_exit = true,
 	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF,
 	.chain_noise_scale = 1000,
+	.monitor_recover_period = IWL_MONITORING_PERIOD,
 };
 
 MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX));
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 0728054..caebec4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -2827,6 +2827,7 @@ static struct iwl_cfg iwl3945_bg_cfg = {
 	.led_compensation = 64,
 	.broken_powersave = true,
 	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
+	.monitor_recover_period = IWL_MONITORING_PERIOD,
 };
 
 static struct iwl_cfg iwl3945_abg_cfg = {
@@ -2845,6 +2846,7 @@ static struct iwl_cfg iwl3945_abg_cfg = {
 	.led_compensation = 64,
 	.broken_powersave = true,
 	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
+	.monitor_recover_period = IWL_MONITORING_PERIOD,
 };
 
 DEFINE_PCI_DEVICE_TABLE(iwl3945_hw_card_ids) = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 8972166..aa49a6e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -2251,6 +2251,7 @@ struct iwl_cfg iwl4965_agn_cfg = {
 	.led_compensation = 61,
 	.chain_noise_num_beacons = IWL4965_CAL_NUM_BEACONS,
 	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
+	.monitor_recover_period = IWL_MONITORING_PERIOD,
 };
 
 /* Module firmware */
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index e476acb..d05fad4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -1500,6 +1500,7 @@ struct iwl_lib_ops iwl5000_lib = {
 		.set_ct_kill = iwl5000_set_ct_threshold,
 	 },
 	.add_bcast_station = iwl_add_bcast_station,
+	.recover_from_tx_stall = iwl_bg_monitor_recover,
 };
 
 static struct iwl_lib_ops iwl5150_lib = {
@@ -1554,6 +1555,7 @@ static struct iwl_lib_ops iwl5150_lib = {
 		.set_ct_kill = iwl5150_set_ct_threshold,
 	 },
 	.add_bcast_station = iwl_add_bcast_station,
+	.recover_from_tx_stall = iwl_bg_monitor_recover,
 };
 
 static const struct iwl_ops iwl5000_ops = {
@@ -1603,6 +1605,7 @@ struct iwl_cfg iwl5300_agn_cfg = {
 	.chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
 	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
 	.chain_noise_scale = 1000,
+	.monitor_recover_period = IWL_MONITORING_PERIOD,
 };
 
 struct iwl_cfg iwl5100_bgn_cfg = {
@@ -1629,6 +1632,7 @@ struct iwl_cfg iwl5100_bgn_cfg = {
 	.chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
 	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
 	.chain_noise_scale = 1000,
+	.monitor_recover_period = IWL_MONITORING_PERIOD,
 };
 
 struct iwl_cfg iwl5100_abg_cfg = {
@@ -1653,6 +1657,7 @@ struct iwl_cfg iwl5100_abg_cfg = {
 	.chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
 	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
 	.chain_noise_scale = 1000,
+	.monitor_recover_period = IWL_MONITORING_PERIOD,
 };
 
 struct iwl_cfg iwl5100_agn_cfg = {
@@ -1679,6 +1684,7 @@ struct iwl_cfg iwl5100_agn_cfg = {
 	.chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
 	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
 	.chain_noise_scale = 1000,
+	.monitor_recover_period = IWL_MONITORING_PERIOD,
 };
 
 struct iwl_cfg iwl5350_agn_cfg = {
@@ -1705,6 +1711,7 @@ struct iwl_cfg iwl5350_agn_cfg = {
 	.chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
 	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
 	.chain_noise_scale = 1000,
+	.monitor_recover_period = IWL_MONITORING_PERIOD,
 };
 
 struct iwl_cfg iwl5150_agn_cfg = {
@@ -1731,6 +1738,7 @@ struct iwl_cfg iwl5150_agn_cfg = {
 	.chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
 	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
 	.chain_noise_scale = 1000,
+	.monitor_recover_period = IWL_MONITORING_PERIOD,
 };
 
 struct iwl_cfg iwl5150_abg_cfg = {
@@ -1755,6 +1763,7 @@ struct iwl_cfg iwl5150_abg_cfg = {
 	.chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
 	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
 	.chain_noise_scale = 1000,
+	.monitor_recover_period = IWL_MONITORING_PERIOD,
 };
 
 MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX));
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index 92b3e64..0c965cd 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -277,6 +277,7 @@ static struct iwl_lib_ops iwl6000_lib = {
 		.set_ct_kill = iwl6000_set_ct_threshold,
 	 },
 	.add_bcast_station = iwl_add_bcast_station,
+	.recover_from_tx_stall = iwl_bg_monitor_recover,
 };
 
 static const struct iwl_ops iwl6000_ops = {
@@ -342,6 +343,7 @@ static struct iwl_lib_ops iwl6050_lib = {
 		.set_calib_version = iwl6050_set_calib_version,
 	 },
 	.add_bcast_station = iwl_add_bcast_station,
+	.recover_from_tx_stall = iwl_bg_monitor_recover,
 };
 
 static const struct iwl_ops iwl6050_ops = {
@@ -385,6 +387,7 @@ struct iwl_cfg iwl6000i_2agn_cfg = {
 	.support_ct_kill_exit = true,
 	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
 	.chain_noise_scale = 1000,
+	.monitor_recover_period = IWL_MONITORING_PERIOD,
 };
 
 struct iwl_cfg iwl6000i_2abg_cfg = {
@@ -416,6 +419,7 @@ struct iwl_cfg iwl6000i_2abg_cfg = {
 	.support_ct_kill_exit = true,
 	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
 	.chain_noise_scale = 1000,
+	.monitor_recover_period = IWL_MONITORING_PERIOD,
 };
 
 struct iwl_cfg iwl6000i_2bg_cfg = {
@@ -447,6 +451,7 @@ struct iwl_cfg iwl6000i_2bg_cfg = {
 	.support_ct_kill_exit = true,
 	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
 	.chain_noise_scale = 1000,
+	.monitor_recover_period = IWL_MONITORING_PERIOD,
 };
 
 struct iwl_cfg iwl6050_2agn_cfg = {
@@ -479,6 +484,7 @@ struct iwl_cfg iwl6050_2agn_cfg = {
 	.support_ct_kill_exit = true,
 	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
 	.chain_noise_scale = 1500,
+	.monitor_recover_period = IWL_MONITORING_PERIOD,
 };
 
 struct iwl_cfg iwl6050_2abg_cfg = {
@@ -510,6 +516,7 @@ struct iwl_cfg iwl6050_2abg_cfg = {
 	.support_ct_kill_exit = true,
 	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
 	.chain_noise_scale = 1500,
+	.monitor_recover_period = IWL_MONITORING_PERIOD,
 };
 
 struct iwl_cfg iwl6000_3agn_cfg = {
@@ -542,6 +549,7 @@ struct iwl_cfg iwl6000_3agn_cfg = {
 	.support_ct_kill_exit = true,
 	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
 	.chain_noise_scale = 1000,
+	.monitor_recover_period = IWL_MONITORING_PERIOD,
 };
 
 MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX));
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index bdff565..07a9a02 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -2106,6 +2106,13 @@ static void iwl_alive_start(struct iwl_priv *priv)
 	/* After the ALIVE response, we can send host commands to the uCode */
 	set_bit(STATUS_ALIVE, &priv->status);
 
+	if (priv->cfg->ops->lib->recover_from_tx_stall) {
+		/* Enable timer to monitor the driver queues */
+		mod_timer(&priv->monitor_recover,
+			jiffies +
+			msecs_to_jiffies(priv->cfg->monitor_recover_period));
+	}
+
 	if (iwl_is_rfkill(priv))
 		return;
 
@@ -3316,6 +3323,13 @@ static void iwl_setup_deferred_work(struct iwl_priv *priv)
 	priv->ucode_trace.data = (unsigned long)priv;
 	priv->ucode_trace.function = iwl_bg_ucode_trace;
 
+	if (priv->cfg->ops->lib->recover_from_tx_stall) {
+		init_timer(&priv->monitor_recover);
+		priv->monitor_recover.data = (unsigned long)priv;
+		priv->monitor_recover.function =
+			priv->cfg->ops->lib->recover_from_tx_stall;
+	}
+
 	if (!priv->cfg->use_isr_legacy)
 		tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long))
 			iwl_irq_tasklet, (unsigned long)priv);
@@ -3336,6 +3350,8 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv)
 	cancel_work_sync(&priv->beacon_update);
 	del_timer_sync(&priv->statistics_periodic);
 	del_timer_sync(&priv->ucode_trace);
+	if (priv->cfg->ops->lib->recover_from_tx_stall)
+		del_timer_sync(&priv->monitor_recover);
 }
 
 static void iwl_init_hw_rates(struct iwl_priv *priv,
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 049b652..a5a2de6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -3403,6 +3403,99 @@ int iwl_force_reset(struct iwl_priv *priv, int mode)
 	}
 	return 0;
 }
+EXPORT_SYMBOL(iwl_force_reset);
+
+/**
+ * iwl_bg_monitor_recover - Timer callback to check for stuck queue and recover
+ *
+ * During normal condition (no queue is stuck), the timer is continually set to
+ * execute every monitor_recover_period milliseconds after the last timer
+ * expired.  When the queue read_ptr is at the same place, the timer is
+ * shorten to 100mSecs.  This is
+ *      1) to reduce the chance that the read_ptr may wrap around (not stuck)
+ *      2) to detect the stuck queues quicker before the station and AP can
+ *      disassociate each other.
+ *
+ * This function monitors all the tx queues and recover from it if any
+ * of the queues are stuck.
+ * 1. It first check the cmd queue for stuck conditions.  If it is stuck,
+ *      it will recover by resetting the firmware and return.
+ * 2. Then, it checks for station association.  If it associates it will check
+ *      other queues.  If any queue is stuck, it will recover by resetting
+ *      the firmware.
+ * Note: It the number of times the queue read_ptr to be at the same place to
+ *      be MAX_REPEAT+1 in order to consider to be stuck.
+ */
+/*
+ * The maximum number of times the read pointer of the tx queue at the
+ * same place without considering to be stuck.
+ */
+#define MAX_REPEAT      (2)
+static int iwl_check_stuck_queue(struct iwl_priv *priv, int cnt)
+{
+	struct iwl_tx_queue *txq;
+	struct iwl_queue *q;
+
+	txq = &priv->txq[cnt];
+	q = &txq->q;
+	/* queue is empty, skip */
+	if (q->read_ptr != q->write_ptr) {
+		if (q->read_ptr == q->last_read_ptr) {
+			/* a queue has not been read from last time */
+			if (q->repeat_same_read_ptr > MAX_REPEAT) {
+				IWL_ERR(priv,
+					"queue %d stuck %d time. Fw reload.\n",
+					q->id, q->repeat_same_read_ptr);
+				q->repeat_same_read_ptr = 0;
+				iwl_force_reset(priv, IWL_FW_RESET);
+			} else {
+				q->repeat_same_read_ptr++;
+				IWL_DEBUG_RADIO(priv,
+						"queue %d, not read %d time\n",
+						q->id,
+						q->repeat_same_read_ptr);
+				mod_timer(&priv->monitor_recover, jiffies +
+					msecs_to_jiffies(IWL_ONE_HUNDRED_MSECS));
+			}
+			return 1;
+		} else {
+			q->last_read_ptr = q->read_ptr;
+			q->repeat_same_read_ptr = 0;
+		}
+	}
+	return 0;
+}
+
+void iwl_bg_monitor_recover(unsigned long data)
+{
+	struct iwl_priv *priv = (struct iwl_priv *)data;
+	int cnt;
+
+	if (test_bit(STATUS_EXIT_PENDING, &priv->status))
+		return;
+
+	/* monitor and check for stuck cmd queue */
+	if (iwl_check_stuck_queue(priv, IWL_CMD_QUEUE_NUM))
+		return;
+
+	/* monitor and check for other stuck queues */
+	if (iwl_is_associated(priv)) {
+		for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) {
+			/* skip as we already checked the command queue */
+			if (cnt == IWL_CMD_QUEUE_NUM)
+				continue;
+			if (iwl_check_stuck_queue(priv, cnt))
+				return;
+		}
+	}
+	/*
+	 * Reschedule the timer to occur in
+	 * priv->cfg->monitor_recover_period
+	 */
+	mod_timer(&priv->monitor_recover,
+		jiffies + msecs_to_jiffies(priv->cfg->monitor_recover_period));
+}
+EXPORT_SYMBOL(iwl_bg_monitor_recover);
 
 #ifdef CONFIG_PM
 
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 36940a9..9076576 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -191,6 +191,8 @@ struct iwl_lib_ops {
 	struct iwl_temp_ops temp_ops;
 	/* station management */
 	void (*add_bcast_station)(struct iwl_priv *priv);
+	/* recover from tx queue stall */
+	void (*recover_from_tx_stall)(unsigned long data);
 };
 
 struct iwl_led_ops {
@@ -295,6 +297,8 @@ struct iwl_cfg {
 	const bool support_wimax_coexist;
 	u8 plcp_delta_threshold;
 	s32 chain_noise_scale;
+	/* timer period for monitor the driver queues */
+	u32 monitor_recover_period;
 };
 
 /***************************
@@ -577,6 +581,9 @@ static inline u16 iwl_pcie_link_ctl(struct iwl_priv *priv)
 	pci_read_config_word(priv->pci_dev, pos + PCI_EXP_LNKCTL, &pci_lnk_ctl);
 	return pci_lnk_ctl;
 }
+
+void iwl_bg_monitor_recover(unsigned long data);
+
 #ifdef CONFIG_PM
 int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state);
 int iwl_pci_resume(struct pci_dev *pdev);
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index ef1720a..447e14b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -183,6 +183,10 @@ struct iwl_queue {
 	int n_bd;              /* number of BDs in this queue */
 	int write_ptr;       /* 1-st empty entry (index) host_w*/
 	int read_ptr;         /* last used entry (index) host_r*/
+	/* use for monitoring and recovering the stuck queue */
+	int last_read_ptr;      /* storing the last read_ptr */
+	/* number of time read_ptr and last_read_ptr are the same */
+	u8 repeat_same_read_ptr;
 	dma_addr_t dma_addr;   /* physical addr for BD's */
 	int n_window;	       /* safe queue window */
 	u32 id;
@@ -1039,6 +1043,11 @@ struct iwl_event_log {
 #define IWL_DELAY_NEXT_FORCE_RF_RESET  (HZ*3)
 #define IWL_DELAY_NEXT_FORCE_FW_RELOAD (HZ*5)
 
+/* timer constants use to monitor and recover stuck tx queues in mSecs */
+#define IWL_MONITORING_PERIOD  (1000)
+#define IWL_ONE_HUNDRED_MSECS   (100)
+#define IWL_SIXTY_SECS          (60000)
+
 enum iwl_reset {
 	IWL_RF_RESET = 0,
 	IWL_FW_RESET,
@@ -1339,6 +1348,7 @@ struct iwl_priv {
 	struct work_struct run_time_calib_work;
 	struct timer_list statistics_periodic;
 	struct timer_list ucode_trace;
+	struct timer_list monitor_recover;
 	bool hw_ready;
 	/*For 3945*/
 #define IWL_DEFAULT_TX_POWER 0x0F
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index 8dd0c03..6af23f2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -310,6 +310,8 @@ static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q,
 		q->high_mark = 2;
 
 	q->write_ptr = q->read_ptr = 0;
+	q->last_read_ptr = 0;
+	q->repeat_same_read_ptr = 0;
 
 	return 0;
 }
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 19c77a8..853511e 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2513,6 +2513,13 @@ static void iwl3945_alive_start(struct iwl_priv *priv)
 	/* After the ALIVE response, we can send commands to 3945 uCode */
 	set_bit(STATUS_ALIVE, &priv->status);
 
+	if (priv->cfg->ops->lib->recover_from_tx_stall) {
+		/* Enable timer to monitor the driver queues */
+		mod_timer(&priv->monitor_recover,
+			jiffies +
+			msecs_to_jiffies(priv->cfg->monitor_recover_period));
+	}
+
 	if (iwl_is_rfkill(priv))
 		return;
 
@@ -3789,6 +3796,13 @@ static void iwl3945_setup_deferred_work(struct iwl_priv *priv)
 
 	iwl3945_hw_setup_deferred_work(priv);
 
+	if (priv->cfg->ops->lib->recover_from_tx_stall) {
+		init_timer(&priv->monitor_recover);
+		priv->monitor_recover.data = (unsigned long)priv;
+		priv->monitor_recover.function =
+			priv->cfg->ops->lib->recover_from_tx_stall;
+	}
+
 	tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long))
 		     iwl3945_irq_tasklet, (unsigned long)priv);
 }
@@ -3801,6 +3815,8 @@ static void iwl3945_cancel_deferred_work(struct iwl_priv *priv)
 	cancel_delayed_work(&priv->scan_check);
 	cancel_delayed_work(&priv->alive_start);
 	cancel_work_sync(&priv->beacon_update);
+	if (priv->cfg->ops->lib->recover_from_tx_stall)
+		del_timer_sync(&priv->monitor_recover);
 }
 
 static struct attribute *iwl3945_sysfs_entries[] = {
-- 
1.7.0.1


iwlwifi-add-internal-short-scan-support-for-3945.patch:
 iwl3945-base.c |   23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

--- NEW FILE iwlwifi-add-internal-short-scan-support-for-3945.patch ---
>From dcde3533b9f501ad079c297b3bf7659739c4c287 Mon Sep 17 00:00:00 2001
From: Wey-Yi Guy <wey-yi.w.guy at intel.com>
Date: Wed, 24 Feb 2010 08:28:30 -0800
Subject: [PATCH] iwlwifi: add internal short scan support for 3945

Add internal short scan support for 3945 NIC, This allows 3945 NIC
to support radio reset request like the other series of NICs.

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy at intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre at intel.com>
---
 drivers/net/wireless/iwlwifi/iwl3945-base.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index b74a56c..19c77a8 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2821,7 +2821,6 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
 		.len = sizeof(struct iwl3945_scan_cmd),
 		.flags = CMD_SIZE_HUGE,
 	};
-	int rc = 0;
 	struct iwl3945_scan_cmd *scan;
 	struct ieee80211_conf *conf = NULL;
 	u8 n_probes = 0;
@@ -2849,7 +2848,6 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
 	if (test_bit(STATUS_SCAN_HW, &priv->status)) {
 		IWL_DEBUG_INFO(priv, "Multiple concurrent scan requests  "
 				"Ignoring second request.\n");
-		rc = -EIO;
 		goto done;
 	}
 
@@ -2884,7 +2882,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
 		priv->scan = kmalloc(sizeof(struct iwl3945_scan_cmd) +
 				     IWL_MAX_SCAN_SIZE, GFP_KERNEL);
 		if (!priv->scan) {
-			rc = -ENOMEM;
+			IWL_DEBUG_SCAN(priv, "Fail to allocate scan memory\n");
 			goto done;
 		}
 	}
@@ -2927,7 +2925,9 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
 			       scan_suspend_time, interval);
 	}
 
-	if (priv->scan_request->n_ssids) {
+	if (priv->is_internal_short_scan) {
+		IWL_DEBUG_SCAN(priv, "Start internal passive scan.\n");
+	} else if (priv->scan_request->n_ssids) {
 		int i, p = 0;
 		IWL_DEBUG_SCAN(priv, "Kicking off active scan\n");
 		for (i = 0; i < priv->scan_request->n_ssids; i++) {
@@ -2975,13 +2975,20 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
 		goto done;
 	}
 
-	scan->tx_cmd.len = cpu_to_le16(
+	if (!priv->is_internal_short_scan) {
+		scan->tx_cmd.len = cpu_to_le16(
 			iwl_fill_probe_req(priv,
 				(struct ieee80211_mgmt *)scan->data,
 				priv->scan_request->ie,
 				priv->scan_request->ie_len,
 				IWL_MAX_SCAN_SIZE - sizeof(*scan)));
-
+	} else {
+		scan->tx_cmd.len = cpu_to_le16(
+			iwl_fill_probe_req(priv,
+				(struct ieee80211_mgmt *)scan->data,
+				NULL, 0,
+				IWL_MAX_SCAN_SIZE - sizeof(*scan)));
+	}
 	/* select Rx antennas */
 	scan->flags |= iwl3945_get_antenna_flags(priv);
 
@@ -3003,8 +3010,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
 	scan->len = cpu_to_le16(cmd.len);
 
 	set_bit(STATUS_SCAN_HW, &priv->status);
-	rc = iwl_send_cmd_sync(priv, &cmd);
-	if (rc)
+	if (iwl_send_cmd_sync(priv, &cmd))
 		goto done;
 
 	queue_delayed_work(priv->workqueue, &priv->scan_check,
-- 
1.7.0.1


iwlwifi-code-cleanup-for-connectivity-recovery.patch:
 iwl-1000.c |    3 +
 iwl-4965.c |    2 -
 iwl-5000.c |    6 ++-
 iwl-6000.c |    6 ++-
 iwl-core.h |   11 ++++--
 iwl-rx.c   |   98 +++++++++++++++++++++++++++++++++++++++++--------------------
 6 files changed, 85 insertions(+), 41 deletions(-)

--- NEW FILE iwlwifi-code-cleanup-for-connectivity-recovery.patch ---
>From 56cf16e34b896ac40c6707eb053d45d2cab18bbd Mon Sep 17 00:00:00 2001
From: Wey-Yi Guy <wey-yi.w.guy at intel.com>
Date: Fri, 5 Mar 2010 14:22:46 -0800
Subject: [PATCH] iwlwifi: code cleanup for connectivity recovery

Split the connectivity check and recovery routine into separated
functions based on the types
   1. iwl_good_ack_health() - check for ack count
   2. iwl_good_plcp_health() - check for plcp error

Based on the type of errors being detected, different recovery methods
will be used to bring the system back to normal operational state.

Because different NIC has different HW and uCode, the behavior is also
different; these functions thus now form part of the ops infrastructure,
so we can have more control on how to monitor and recover from error condition
case per device.

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy at intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre at intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-1000.c |    3 +-
 drivers/net/wireless/iwlwifi/iwl-4965.c |    2 +-
 drivers/net/wireless/iwlwifi/iwl-5000.c |    6 +-
 drivers/net/wireless/iwlwifi/iwl-6000.c |    6 +-
 drivers/net/wireless/iwlwifi/iwl-core.h |   11 +++-
 drivers/net/wireless/iwlwifi/iwl-rx.c   |   97 +++++++++++++++++++++----------
 6 files changed, 85 insertions(+), 40 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
index 2597574..7087631 100644
--- a/drivers/net/wireless/iwlwifi/iwl-1000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
@@ -212,7 +212,8 @@ static struct iwl_lib_ops iwl1000_lib = {
 	 },
 	.add_bcast_station = iwl_add_bcast_station,
 	.recover_from_tx_stall = iwl_bg_monitor_recover,
-	.recover_from_statistics = iwl_recover_from_statistics,
+	.check_plcp_health = iwl_good_plcp_health,
+	.check_ack_health = iwl_good_ack_health,
 };
 
 static const struct iwl_ops iwl1000_ops = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 6dd4328..dcca310 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -2217,7 +2217,7 @@ static struct iwl_lib_ops iwl4965_lib = {
 		.set_ct_kill = iwl4965_set_ct_threshold,
 	},
 	.add_bcast_station = iwl_add_bcast_station,
-	.recover_from_statistics = iwl_recover_from_statistics,
+	.check_plcp_health = iwl_good_plcp_health,
 };
 
 static const struct iwl_ops iwl4965_ops = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index 0c2469c..8e0dd13 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -1501,7 +1501,8 @@ struct iwl_lib_ops iwl5000_lib = {
 	 },
 	.add_bcast_station = iwl_add_bcast_station,
 	.recover_from_tx_stall = iwl_bg_monitor_recover,
-	.recover_from_statistics = iwl_recover_from_statistics,
+	.check_plcp_health = iwl_good_plcp_health,
+	.check_ack_health = iwl_good_ack_health,
 };
 
 static struct iwl_lib_ops iwl5150_lib = {
@@ -1557,7 +1558,8 @@ static struct iwl_lib_ops iwl5150_lib = {
 	 },
 	.add_bcast_station = iwl_add_bcast_station,
 	.recover_from_tx_stall = iwl_bg_monitor_recover,
-	.recover_from_statistics = iwl_recover_from_statistics,
+	.check_plcp_health = iwl_good_plcp_health,
+	.check_ack_health = iwl_good_ack_health,
 };
 
 static const struct iwl_ops iwl5000_ops = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index 189a8ce..1d4fea1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -278,7 +278,8 @@ static struct iwl_lib_ops iwl6000_lib = {
 	 },
 	.add_bcast_station = iwl_add_bcast_station,
 	.recover_from_tx_stall = iwl_bg_monitor_recover,
-	.recover_from_statistics = iwl_recover_from_statistics,
+	.check_plcp_health = iwl_good_plcp_health,
+	.check_ack_health = iwl_good_ack_health,
 };
 
 static const struct iwl_ops iwl6000_ops = {
@@ -345,7 +346,8 @@ static struct iwl_lib_ops iwl6050_lib = {
 	 },
 	.add_bcast_station = iwl_add_bcast_station,
 	.recover_from_tx_stall = iwl_bg_monitor_recover,
-	.recover_from_statistics = iwl_recover_from_statistics,
+	.check_plcp_health = iwl_good_plcp_health,
+	.check_ack_health = iwl_good_ack_health,
 };
 
 static const struct iwl_ops iwl6050_ops = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index d67048e..5234a85 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -193,8 +193,11 @@ struct iwl_lib_ops {
 	void (*add_bcast_station)(struct iwl_priv *priv);
 	/* recover from tx queue stall */
 	void (*recover_from_tx_stall)(unsigned long data);
-	/* recover from errors showed in statistics */
-	void (*recover_from_statistics)(struct iwl_priv *priv,
+	/* check for plcp health */
+	bool (*check_plcp_health)(struct iwl_priv *priv,
+					struct iwl_rx_packet *pkt);
+	/* check for ack health */
+	bool (*check_ack_health)(struct iwl_priv *priv,
 					struct iwl_rx_packet *pkt);
 };
 
@@ -438,7 +441,9 @@ void iwl_rx_missed_beacon_notif(struct iwl_priv *priv,
 			       struct iwl_rx_mem_buffer *rxb);
 void iwl_rx_spectrum_measure_notif(struct iwl_priv *priv,
 					  struct iwl_rx_mem_buffer *rxb);
-void iwl_recover_from_statistics(struct iwl_priv *priv,
+bool iwl_good_plcp_health(struct iwl_priv *priv,
+				 struct iwl_rx_packet *pkt);
+bool iwl_good_ack_health(struct iwl_priv *priv,
 				 struct iwl_rx_packet *pkt);
 void iwl_rx_statistics(struct iwl_priv *priv,
 			      struct iwl_rx_mem_buffer *rxb);
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index f48d685..506ccf7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -622,24 +622,18 @@ static void iwl_accumulative_statistics(struct iwl_priv *priv,
 #define BA_TIMEOUT_CNT (5)
 #define BA_TIMEOUT_MAX (16)
 
-#define PLCP_MSG "plcp_err exceeded %u, %u, %u, %u, %u, %d, %u mSecs\n"
-/*
- * This function checks for plcp error, ACK count ratios, aggregated BA
- * timeout retries.
- * - When the ACK count ratio is 0 and aggregated BA timeout retries is
- * exceeding the BA_TIMEOUT_MAX, it will recover the failure by resetting
- * the firmware.
- * - When the plcp error is exceeding the thresholds, it will reset the radio
- * to improve the throughput.
+/**
+ * iwl_good_ack_health - checks for ACK count ratios, BA timeout retries.
+ *
+ * When the ACK count ratio is 0 and aggregated BA timeout retries exceeding
+ * the BA_TIMEOUT_MAX, reload firmware and bring system back to normal
+ * operation state.
  */
-void iwl_recover_from_statistics(struct iwl_priv *priv,
-				   struct iwl_rx_packet *pkt)
+bool iwl_good_ack_health(struct iwl_priv *priv,
+				struct iwl_rx_packet *pkt)
 {
-	int combined_plcp_delta;
-	unsigned int plcp_msec;
-	unsigned long plcp_received_jiffies;
-	int actual_ack_cnt_delta;
-	int expected_ack_cnt_delta;
+	bool rc = true;
+	int actual_ack_cnt_delta, expected_ack_cnt_delta;
 	int ba_timeout_delta;
 
 	actual_ack_cnt_delta =
@@ -670,13 +664,27 @@ void iwl_recover_from_statistics(struct iwl_priv *priv,
 #endif
 		IWL_DEBUG_RADIO(priv, "agg ba_timeout delta = %d\n",
 				ba_timeout_delta);
-		if ((actual_ack_cnt_delta == 0) &&
-		    (ba_timeout_delta >= BA_TIMEOUT_MAX)) {
-			IWL_DEBUG_RADIO(priv,
-					"call iwl_force_reset(IWL_FW_RESET)\n");
-			iwl_force_reset(priv, IWL_FW_RESET);
-		}
+		if (!actual_ack_cnt_delta &&
+		    (ba_timeout_delta >= BA_TIMEOUT_MAX))
+			rc = false;
 	}
+	return rc;
+}
+EXPORT_SYMBOL(iwl_good_ack_health);
+
+/**
+ * iwl_good_plcp_health - checks for plcp error.
+ *
+ * When the plcp error is exceeding the thresholds, reset the radio
+ * to improve the throughput.
+ */
+bool iwl_good_plcp_health(struct iwl_priv *priv,
+				struct iwl_rx_packet *pkt)
+{
+	bool rc = true;
+	int combined_plcp_delta;
+	unsigned int plcp_msec;
+	unsigned long plcp_received_jiffies;
 
 	/*
 	 * check for plcp_err and trigger radio reset if it exceeds
@@ -711,7 +719,8 @@ void iwl_recover_from_statistics(struct iwl_priv *priv,
 			 *    combined_plcp_delta,
 			 *    plcp_msec
 			 */
-			IWL_DEBUG_RADIO(priv, PLCP_MSG,
+			IWL_DEBUG_RADIO(priv, "plcp_err exceeded %u, "
+				"%u, %u, %u, %u, %d, %u mSecs\n",
 				priv->cfg->plcp_delta_threshold,
 				le32_to_cpu(pkt->u.stats.rx.ofdm.plcp_err),
 				le32_to_cpu(priv->statistics.rx.ofdm.plcp_err),
@@ -719,15 +728,42 @@ void iwl_recover_from_statistics(struct iwl_priv *priv,
 				le32_to_cpu(
 				  priv->statistics.rx.ofdm_ht.plcp_err),
 				combined_plcp_delta, plcp_msec);
-			/*
-			 * Reset the RF radio due to the high plcp
-			 * error rate
-			 */
-			iwl_force_reset(priv, IWL_RF_RESET);
+			rc = false;
+		}
+	}
+	return rc;
+}
+EXPORT_SYMBOL(iwl_good_plcp_health);
+
+static void iwl_recover_from_statistics(struct iwl_priv *priv,
+				struct iwl_rx_packet *pkt)
+{
+	if (test_bit(STATUS_EXIT_PENDING, &priv->status))
+		return;
+	if (iwl_is_associated(priv)) {
+		if (priv->cfg->ops->lib->check_ack_health) {
+			if (!priv->cfg->ops->lib->check_ack_health(
+			    priv, pkt)) {
+				/*
+				 * low ack count detected
+				 * restart Firmware
+				 */
+				IWL_ERR(priv, "low ack count detected, "
+					"restart firmware\n");
+				iwl_force_reset(priv, IWL_FW_RESET);
+			}
+		} else if (priv->cfg->ops->lib->check_plcp_health) {
+			if (!priv->cfg->ops->lib->check_plcp_health(
+			    priv, pkt)) {
+				/*
+				 * high plcp error detected
+				 * reset Radio
+				 */
+				iwl_force_reset(priv, IWL_RF_RESET);
+			}
 		}
 	}
 }
-EXPORT_SYMBOL(iwl_recover_from_statistics);
 
 void iwl_rx_statistics(struct iwl_priv *priv,
 			      struct iwl_rx_mem_buffer *rxb)
@@ -749,8 +785,7 @@ void iwl_rx_statistics(struct iwl_priv *priv,
 #ifdef CONFIG_IWLWIFI_DEBUG
 	iwl_accumulative_statistics(priv, (__le32 *)&pkt->u.stats);
 #endif
-	if (priv->cfg->ops->lib->recover_from_statistics)
-		priv->cfg->ops->lib->recover_from_statistics(priv, pkt);
+	iwl_recover_from_statistics(priv, pkt);
 
 	memcpy(&priv->statistics, &pkt->u.stats, sizeof(priv->statistics));
 
-- 
1.7.0.1


iwlwifi-iwl_good_ack_health-only-apply-to-AGN-device.patch:
 iwl-agn.c |   54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 iwl-rx.c  |   56 --------------------------------------------------------
 2 files changed, 54 insertions(+), 56 deletions(-)

--- NEW FILE iwlwifi-iwl_good_ack_health-only-apply-to-AGN-device.patch ---
>From 8ac33071b4c991e302be67fd0dae1d9cc4b502e3 Mon Sep 17 00:00:00 2001
From: Wey-Yi Guy <wey-yi.w.guy at intel.com>
Date: Tue, 16 Mar 2010 10:46:31 -0700
Subject: [PATCH] iwlwifi: iwl_good_ack_health() only apply to AGN device

iwl_good_ack_health() check for expected and actual ack count which only
apply to aggregation mode. Move the function to iwlagn module.

Reported-by: Chantry Xavier <chantry.xavier at gmail.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy at intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre at intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-agn.c |   54 +++++++++++++++++++++++++++++++
 drivers/net/wireless/iwlwifi/iwl-rx.c  |   55 --------------------------------
 2 files changed, 54 insertions(+), 55 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index dc751cb..b5d410b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1448,6 +1448,60 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
 		iwl_enable_interrupts(priv);
 }
 
+/* the threshold ratio of actual_ack_cnt to expected_ack_cnt in percent */
+#define ACK_CNT_RATIO (50)
+#define BA_TIMEOUT_CNT (5)
+#define BA_TIMEOUT_MAX (16)
+
+/**
+ * iwl_good_ack_health - checks for ACK count ratios, BA timeout retries.
+ *
+ * When the ACK count ratio is 0 and aggregated BA timeout retries exceeding
+ * the BA_TIMEOUT_MAX, reload firmware and bring system back to normal
+ * operation state.
+ */
+bool iwl_good_ack_health(struct iwl_priv *priv,
+				struct iwl_rx_packet *pkt)
+{
+	bool rc = true;
+	int actual_ack_cnt_delta, expected_ack_cnt_delta;
+	int ba_timeout_delta;
+
+	actual_ack_cnt_delta =
+		le32_to_cpu(pkt->u.stats.tx.actual_ack_cnt) -
+		le32_to_cpu(priv->statistics.tx.actual_ack_cnt);
+	expected_ack_cnt_delta =
+		le32_to_cpu(pkt->u.stats.tx.expected_ack_cnt) -
+		le32_to_cpu(priv->statistics.tx.expected_ack_cnt);
+	ba_timeout_delta =
+		le32_to_cpu(pkt->u.stats.tx.agg.ba_timeout) -
+		le32_to_cpu(priv->statistics.tx.agg.ba_timeout);
+	if ((priv->_agn.agg_tids_count > 0) &&
+	    (expected_ack_cnt_delta > 0) &&
+	    (((actual_ack_cnt_delta * 100) / expected_ack_cnt_delta)
+		< ACK_CNT_RATIO) &&
+	    (ba_timeout_delta > BA_TIMEOUT_CNT)) {
+		IWL_DEBUG_RADIO(priv, "actual_ack_cnt delta = %d,"
+				" expected_ack_cnt = %d\n",
+				actual_ack_cnt_delta, expected_ack_cnt_delta);
+
+#ifdef CONFIG_IWLWIFI_DEBUG
+		IWL_DEBUG_RADIO(priv, "rx_detected_cnt delta = %d\n",
+				priv->delta_statistics.tx.rx_detected_cnt);
+		IWL_DEBUG_RADIO(priv,
+				"ack_or_ba_timeout_collision delta = %d\n",
+				priv->delta_statistics.tx.
+				ack_or_ba_timeout_collision);
+#endif
+		IWL_DEBUG_RADIO(priv, "agg ba_timeout delta = %d\n",
+				ba_timeout_delta);
+		if (!actual_ack_cnt_delta &&
+		    (ba_timeout_delta >= BA_TIMEOUT_MAX))
+			rc = false;
+	}
+	return rc;
+}
+
 
 /******************************************************************************
  *
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index 506ccf7..def5042 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -617,61 +617,6 @@ static void iwl_accumulative_statistics(struct iwl_priv *priv,
 
 #define REG_RECALIB_PERIOD (60)
 
-/* the threshold ratio of actual_ack_cnt to expected_ack_cnt in percent */
-#define ACK_CNT_RATIO (50)
-#define BA_TIMEOUT_CNT (5)
-#define BA_TIMEOUT_MAX (16)
-
-/**
- * iwl_good_ack_health - checks for ACK count ratios, BA timeout retries.
- *
- * When the ACK count ratio is 0 and aggregated BA timeout retries exceeding
- * the BA_TIMEOUT_MAX, reload firmware and bring system back to normal
- * operation state.
- */
-bool iwl_good_ack_health(struct iwl_priv *priv,
-				struct iwl_rx_packet *pkt)
-{
-	bool rc = true;
-	int actual_ack_cnt_delta, expected_ack_cnt_delta;
-	int ba_timeout_delta;
-
-	actual_ack_cnt_delta =
-		le32_to_cpu(pkt->u.stats.tx.actual_ack_cnt) -
-		le32_to_cpu(priv->statistics.tx.actual_ack_cnt);
-	expected_ack_cnt_delta =
-		le32_to_cpu(pkt->u.stats.tx.expected_ack_cnt) -
-		le32_to_cpu(priv->statistics.tx.expected_ack_cnt);
-	ba_timeout_delta =
-		le32_to_cpu(pkt->u.stats.tx.agg.ba_timeout) -
-		le32_to_cpu(priv->statistics.tx.agg.ba_timeout);
-	if ((priv->_agn.agg_tids_count > 0) &&
-	    (expected_ack_cnt_delta > 0) &&
-	    (((actual_ack_cnt_delta * 100) / expected_ack_cnt_delta)
-		< ACK_CNT_RATIO) &&
-	    (ba_timeout_delta > BA_TIMEOUT_CNT)) {
-		IWL_DEBUG_RADIO(priv, "actual_ack_cnt delta = %d,"
-				" expected_ack_cnt = %d\n",
-				actual_ack_cnt_delta, expected_ack_cnt_delta);
-
-#ifdef CONFIG_IWLWIFI_DEBUG
-		IWL_DEBUG_RADIO(priv, "rx_detected_cnt delta = %d\n",
-				priv->delta_statistics.tx.rx_detected_cnt);
-		IWL_DEBUG_RADIO(priv,
-				"ack_or_ba_timeout_collision delta = %d\n",
-				priv->delta_statistics.tx.
-				ack_or_ba_timeout_collision);
-#endif
-		IWL_DEBUG_RADIO(priv, "agg ba_timeout delta = %d\n",
-				ba_timeout_delta);
-		if (!actual_ack_cnt_delta &&
-		    (ba_timeout_delta >= BA_TIMEOUT_MAX))
-			rc = false;
-	}
-	return rc;
-}
-EXPORT_SYMBOL(iwl_good_ack_health);
-
 /**
  * iwl_good_plcp_health - checks for plcp error.
  *
-- 
1.7.0.1


iwlwifi-move-plcp-check-to-separated-function.patch:
 iwl-1000.c |    1 +
 iwl-4965.c |    1 +
 iwl-5000.c |    2 ++
 iwl-6000.c |    2 ++
 iwl-core.h |    5 +++++
 iwl-rx.c   |   59 ++++++++++++++++++++++++++++++++++++-----------------------
 6 files changed, 47 insertions(+), 23 deletions(-)

--- NEW FILE iwlwifi-move-plcp-check-to-separated-function.patch ---
>From b3786de4e1033b00d522a5c457a3ea9f8376d0d0 Mon Sep 17 00:00:00 2001
From: Wey-Yi Guy <wey-yi.w.guy at intel.com>
Date: Thu, 4 Mar 2010 13:38:58 -0800
Subject: [PATCH] iwlwifi: move plcp check to separated function

Move the plcp error checking into stand alone function and pointed by ops
to accommodate devices not needing this recovery.

Signed-off-by: Trieu 'Andrew' Nguyen <trieux.t.nguyen at intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy at intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre at intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-1000.c |    1 +
 drivers/net/wireless/iwlwifi/iwl-4965.c |    1 +
 drivers/net/wireless/iwlwifi/iwl-5000.c |    2 +
 drivers/net/wireless/iwlwifi/iwl-6000.c |    2 +
 drivers/net/wireless/iwlwifi/iwl-core.h |    5 +++
 drivers/net/wireless/iwlwifi/iwl-rx.c   |   58 +++++++++++++++++++------------
 6 files changed, 47 insertions(+), 22 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
index 89dc401..2597574 100644
--- a/drivers/net/wireless/iwlwifi/iwl-1000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
@@ -212,6 +212,7 @@ static struct iwl_lib_ops iwl1000_lib = {
 	 },
 	.add_bcast_station = iwl_add_bcast_station,
 	.recover_from_tx_stall = iwl_bg_monitor_recover,
+	.recover_from_statistics = iwl_recover_from_statistics,
 };
 
 static const struct iwl_ops iwl1000_ops = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index aa49a6e..6dd4328 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -2217,6 +2217,7 @@ static struct iwl_lib_ops iwl4965_lib = {
 		.set_ct_kill = iwl4965_set_ct_threshold,
 	},
 	.add_bcast_station = iwl_add_bcast_station,
+	.recover_from_statistics = iwl_recover_from_statistics,
 };
 
 static const struct iwl_ops iwl4965_ops = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index d05fad4..0c2469c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -1501,6 +1501,7 @@ struct iwl_lib_ops iwl5000_lib = {
 	 },
 	.add_bcast_station = iwl_add_bcast_station,
 	.recover_from_tx_stall = iwl_bg_monitor_recover,
+	.recover_from_statistics = iwl_recover_from_statistics,
 };
 
 static struct iwl_lib_ops iwl5150_lib = {
@@ -1556,6 +1557,7 @@ static struct iwl_lib_ops iwl5150_lib = {
 	 },
 	.add_bcast_station = iwl_add_bcast_station,
 	.recover_from_tx_stall = iwl_bg_monitor_recover,
+	.recover_from_statistics = iwl_recover_from_statistics,
 };
 
 static const struct iwl_ops iwl5000_ops = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index 0c965cd..189a8ce 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -278,6 +278,7 @@ static struct iwl_lib_ops iwl6000_lib = {
 	 },
 	.add_bcast_station = iwl_add_bcast_station,
 	.recover_from_tx_stall = iwl_bg_monitor_recover,
+	.recover_from_statistics = iwl_recover_from_statistics,
 };
 
 static const struct iwl_ops iwl6000_ops = {
@@ -344,6 +345,7 @@ static struct iwl_lib_ops iwl6050_lib = {
 	 },
 	.add_bcast_station = iwl_add_bcast_station,
 	.recover_from_tx_stall = iwl_bg_monitor_recover,
+	.recover_from_statistics = iwl_recover_from_statistics,
 };
 
 static const struct iwl_ops iwl6050_ops = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 9076576..d67048e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -193,6 +193,9 @@ struct iwl_lib_ops {
 	void (*add_bcast_station)(struct iwl_priv *priv);
 	/* recover from tx queue stall */
 	void (*recover_from_tx_stall)(unsigned long data);
+	/* recover from errors showed in statistics */
+	void (*recover_from_statistics)(struct iwl_priv *priv,
+					struct iwl_rx_packet *pkt);
 };
 
 struct iwl_led_ops {
@@ -435,6 +438,8 @@ void iwl_rx_missed_beacon_notif(struct iwl_priv *priv,
 			       struct iwl_rx_mem_buffer *rxb);
 void iwl_rx_spectrum_measure_notif(struct iwl_priv *priv,
 					  struct iwl_rx_mem_buffer *rxb);
+void iwl_recover_from_statistics(struct iwl_priv *priv,
+				 struct iwl_rx_packet *pkt);
 void iwl_rx_statistics(struct iwl_priv *priv,
 			      struct iwl_rx_mem_buffer *rxb);
 void iwl_reply_statistics(struct iwl_priv *priv,
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index e5eb339..fabc52f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -618,28 +618,18 @@ static void iwl_accumulative_statistics(struct iwl_priv *priv,
 #define REG_RECALIB_PERIOD (60)
 
 #define PLCP_MSG "plcp_err exceeded %u, %u, %u, %u, %u, %d, %u mSecs\n"
-void iwl_rx_statistics(struct iwl_priv *priv,
-			      struct iwl_rx_mem_buffer *rxb)
+/*
+ * This function checks for plcp error.
+ * - When the plcp error is exceeding the thresholds, it will reset the radio
+ * to improve the throughput.
+ */
+void iwl_recover_from_statistics(struct iwl_priv *priv,
+				   struct iwl_rx_packet *pkt)
 {
-	int change;
-	struct iwl_rx_packet *pkt = rxb_addr(rxb);
 	int combined_plcp_delta;
 	unsigned int plcp_msec;
 	unsigned long plcp_received_jiffies;
 
-	IWL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n",
-		     (int)sizeof(priv->statistics),
-		     le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK);
-
-	change = ((priv->statistics.general.temperature !=
-		   pkt->u.stats.general.temperature) ||
-		  ((priv->statistics.flag &
-		    STATISTICS_REPLY_FLG_HT40_MODE_MSK) !=
-		   (pkt->u.stats.flag & STATISTICS_REPLY_FLG_HT40_MODE_MSK)));
-
-#ifdef CONFIG_IWLWIFI_DEBUG
-	iwl_accumulative_statistics(priv, (__le32 *)&pkt->u.stats);
-#endif
 	/*
 	 * check for plcp_err and trigger radio reset if it exceeds
 	 * the plcp error threshold plcp_delta.
@@ -660,11 +650,11 @@ void iwl_rx_statistics(struct iwl_priv *priv,
 			le32_to_cpu(priv->statistics.rx.ofdm_ht.plcp_err));
 
 		if ((combined_plcp_delta > 0) &&
-			((combined_plcp_delta * 100) / plcp_msec) >
+		    ((combined_plcp_delta * 100) / plcp_msec) >
 			priv->cfg->plcp_delta_threshold) {
 			/*
-			 * if plcp_err exceed the threshold, the following
-			 * data is printed in csv format:
+			 * if plcp_err exceed the threshold,
+			 * the following data is printed in csv format:
 			 *    Text: plcp_err exceeded %d,
 			 *    Received ofdm.plcp_err,
 			 *    Current ofdm.plcp_err,
@@ -679,9 +669,8 @@ void iwl_rx_statistics(struct iwl_priv *priv,
 				le32_to_cpu(priv->statistics.rx.ofdm.plcp_err),
 				le32_to_cpu(pkt->u.stats.rx.ofdm_ht.plcp_err),
 				le32_to_cpu(
-					priv->statistics.rx.ofdm_ht.plcp_err),
+				  priv->statistics.rx.ofdm_ht.plcp_err),
 				combined_plcp_delta, plcp_msec);
-
 			/*
 			 * Reset the RF radio due to the high plcp
 			 * error rate
@@ -689,6 +678,31 @@ void iwl_rx_statistics(struct iwl_priv *priv,
 			iwl_force_reset(priv, IWL_RF_RESET);
 		}
 	}
+}
+EXPORT_SYMBOL(iwl_recover_from_statistics);
+
+void iwl_rx_statistics(struct iwl_priv *priv,
+			      struct iwl_rx_mem_buffer *rxb)
+{
+	int change;
+	struct iwl_rx_packet *pkt = rxb_addr(rxb);
+
+
+	IWL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n",
+		     (int)sizeof(priv->statistics),
+		     le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK);
+
+	change = ((priv->statistics.general.temperature !=
+		   pkt->u.stats.general.temperature) ||
+		  ((priv->statistics.flag &
+		    STATISTICS_REPLY_FLG_HT40_MODE_MSK) !=
+		   (pkt->u.stats.flag & STATISTICS_REPLY_FLG_HT40_MODE_MSK)));
+
+#ifdef CONFIG_IWLWIFI_DEBUG
+	iwl_accumulative_statistics(priv, (__le32 *)&pkt->u.stats);
+#endif
+	if (priv->cfg->ops->lib->recover_from_statistics)
+		priv->cfg->ops->lib->recover_from_statistics(priv, pkt);
 
 	memcpy(&priv->statistics, &pkt->u.stats, sizeof(priv->statistics));
 
-- 
1.7.0.1



Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.2004
retrieving revision 1.2005
diff -u -p -r1.2004 -r1.2005
--- kernel.spec	26 May 2010 20:27:19 -0000	1.2004
+++ kernel.spec	31 May 2010 14:12:04 -0000	1.2005
@@ -700,9 +700,15 @@ Patch670: linux-2.6-ata-quirk.patch
 
 Patch681: linux-2.6-mac80211-age-scan-results-on-resume.patch
 
-Patch690: iwlwifi-recalculate-average-tpt-if-not-current.patch
-Patch691: iwlwifi-fix-internal-scan-race.patch
-Patch692: iwlwifi-recover_from_tx_stall.patch
+Patch690: iwlwifi-add-internal-short-scan-support-for-3945.patch
+Patch691: iwlwifi-Recover-TX-flow-stall-due-to-stuck-queue.patch
+Patch692: iwlwifi-move-plcp-check-to-separated-function.patch
+Patch693: iwlwifi-Recover-TX-flow-failure.patch
+Patch694: iwlwifi-code-cleanup-for-connectivity-recovery.patch
+Patch695: iwlwifi-iwl_good_ack_health-only-apply-to-AGN-device.patch
+Patch696: iwlwifi-recalculate-average-tpt-if-not-current.patch
+Patch697: iwlwifi-fix-internal-scan-race.patch
+Patch698: iwlwifi-recover_from_tx_stall.patch
 
 Patch800: linux-2.6-crash-driver.patch
 
@@ -716,7 +722,7 @@ Patch1550: virtqueue-wrappers.patch
 Patch1554: virt_console-rollup.patch
 
 # DRM
-Patch1810: drm-1024x768-85.patch
+Patch1800: drm-next.patch
 # nouveau + drm fixes
 Patch1815: drm-nouveau-drm-fixed-header.patch
 Patch1819: drm-intel-big-hammer.patch
@@ -724,9 +730,6 @@ Patch1819: drm-intel-big-hammer.patch
 Patch1824: drm-intel-next.patch
 # make sure the lvds comes back on lid open
 Patch1825: drm-intel-make-lvds-work.patch
-Patch1826: drm-intel-gen5-dither.patch
-Patch1827: drm-intel-sdvo-fix-2.patch
-Patch1828: drm-intel-sdvo-fix.patch
 Patch1900: linux-2.6-intel-iommu-igfx.patch
 
 # linux1394 git patches
@@ -1327,7 +1330,7 @@ ApplyPatch hdpvr-ir-enable.patch
 ApplyPatch virtqueue-wrappers.patch
 ApplyPatch virt_console-rollup.patch
 
-ApplyPatch drm-1024x768-85.patch
+ApplyPatch drm-next.patch
 
 # Nouveau DRM + drm fixes
 ApplyPatch drm-nouveau-drm-fixed-header.patch
@@ -1335,9 +1338,6 @@ ApplyPatch drm-intel-big-hammer.patch
 ApplyOptionalPatch drm-intel-next.patch
 ApplyPatch drm-intel-make-lvds-work.patch
 ApplyPatch linux-2.6-intel-iommu-igfx.patch
-ApplyPatch drm-intel-gen5-dither.patch
-#ApplyPatch drm-intel-sdvo-fix.patch
-#ApplyPatch drm-intel-sdvo-fix-2.patch
 
 # linux1394 git patches
 #ApplyPatch linux-2.6-firewire-git-update.patch
@@ -1372,6 +1372,13 @@ ApplyPatch neuter_intel_microcode_load.p
 # rhbz#533746
 ApplyPatch ssb_check_for_sprom.patch
 
+# iwlwifi fixes from F-13-2.6.33
+ApplyPatch iwlwifi-add-internal-short-scan-support-for-3945.patch
+ApplyPatch iwlwifi-Recover-TX-flow-stall-due-to-stuck-queue.patch
+ApplyPatch iwlwifi-move-plcp-check-to-separated-function.patch
+ApplyPatch iwlwifi-Recover-TX-flow-failure.patch
+ApplyPatch iwlwifi-code-cleanup-for-connectivity-recovery.patch
+ApplyPatch iwlwifi-iwl_good_ack_health-only-apply-to-AGN-device.patch
 ApplyPatch iwlwifi-recalculate-average-tpt-if-not-current.patch
 ApplyPatch iwlwifi-fix-internal-scan-race.patch
 ApplyPatch iwlwifi-recover_from_tx_stall.patch
@@ -2036,6 +2043,13 @@ fi
 #                 ||     ||
 
 %changelog
+* Mon May 31 2010 Kyle McMartin <kyle at redhat.com> 2.6.34-14
+- re-add drm-next.patch, should be in sync with 2.6.35 and what
+  was backported to Fedora 13.
+- drop patches merged in drm-next to 2.6.35
+- rebase relevant iwl fixes on top of 2.6.34 from the ones committed
+  to F-13 by linville.
+
 * Wed May 26 2010 Adam Jackson <ajax at redhat.com>
 - config-generic: Stop building i830.ko
 


--- drm-1024x768-85.patch DELETED ---


--- drm-intel-gen5-dither.patch DELETED ---



More information about the scm-commits mailing list