openwrt/staging/blogic.git
15 years agotc35815: Fix rx_missed_errors count
Atsushi Nemoto [Thu, 6 Aug 2009 04:41:48 +0000 (04:41 +0000)]
tc35815: Fix rx_missed_errors count

The Miss_Cnt register is cleared by reading.  Accumulate its value to
rx_missed_errors count.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agotc35815: Increase timeout for mdio
Atsushi Nemoto [Thu, 6 Aug 2009 04:41:47 +0000 (04:41 +0000)]
tc35815: Increase timeout for mdio

The current timeout value is too short for very high-load condition
which jiffies might jump up in busy-loop.
Also add minimum delay before checking completion of MDIO.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agotc35815: Improve BLEx / FDAEx handling
Atsushi Nemoto [Thu, 6 Aug 2009 04:41:46 +0000 (04:41 +0000)]
tc35815: Improve BLEx / FDAEx handling

Clear Int_BLEx / Int_FDAEx after (not before) processing Rx interrupt.
This will reduce number of unnecessary interrupts.
Also print rx error messages only if netif_msg_rx_err() enabled.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agotc35815: Disable StripCRC
Atsushi Nemoto [Thu, 6 Aug 2009 04:41:45 +0000 (04:41 +0000)]
tc35815: Disable StripCRC

It seems Rx_StripCRC cause trouble on recovering from the BLEx (Buffer
List Exhaust) or FDAEx (Free Descriptor Area Exhaust) condition.
Do not use it.

Also bump version number up.

Reported-by: Ralf Roesch <ralf.roesch@rw-gmbh.de>
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
David S. Miller [Thu, 6 Aug 2009 19:57:18 +0000 (12:57 -0700)]
Merge branch 'master' of git://git./linux/kernel/git/linville/wireless-next-2.6

15 years agonet/rds: Use AF_INET for sin_family field
Julia Lawall [Thu, 6 Aug 2009 03:30:13 +0000 (20:30 -0700)]
net/rds: Use AF_INET for sin_family field

Elsewhere the sin_family field holds a value with a name of the form
AF_..., so it seems reasonable to do so here as well.  Also the values of
PF_INET and AF_INET are the same.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
struct sockaddr_in sip;
@@

(
sip.sin_family ==
- PF_INET
+ AF_INET
|
sip.sin_family !=
- PF_INET
+ AF_INET
|
sip.sin_family =
- PF_INET
+ AF_INET
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agocxgb3: fix 2 ports 1G regression
Divy Le Ray [Thu, 6 Aug 2009 03:28:27 +0000 (20:28 -0700)]
cxgb3: fix 2 ports 1G regression

commit 88045b3cf0f8981129cb489c7b6bc36c21dd33a7
cxgb3: fix mac index mapping

Override the mac index computation for the gen2 adapter,
as each port is expected to use index 0.

introduces a regression on 2 port 1G adapter
as its xauicfg vpd value is null.
Add a check on the device id.

Signed-off-by: Divy Le Ray <divy@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agovxge: Version update
Benjamin LaHaise [Tue, 4 Aug 2009 10:22:19 +0000 (10:22 +0000)]
vxge: Version update

Update the driver version number for any bug reports from end users.

Signed-off-by: Benjamin LaHaise <ben.lahaise@neterion.com>
Signed-off-by: Ramkrishna Vepa <ram.vepa@neterion.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agovxge: prefetch skb->data
Benjamin LaHaise [Tue, 4 Aug 2009 10:21:57 +0000 (10:21 +0000)]
vxge: prefetch skb->data

This patch implements prefetching of skb->data from a copy of the pointer
in the descriptor (which is already in the L1 cache at this point).  This
improves netperf rx performance (netperf -L 0,0 -c -H 192.168.254.2 -- -M
131072 -m 131072) by 4.9% on a P4 Xeon host.

Signed-off-by: Benjamin LaHaise <ben.lahaise@neterion.com>
Signed-off-by: Sreenivasa Honnur <sreenivasa.honnur@neterion.com>
Signed-off-by: Ramkrishna Vepa <ram.vepa@neterion.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agovxge: prefetch RxD descriptors
Benjamin LaHaise [Tue, 4 Aug 2009 10:21:39 +0000 (10:21 +0000)]
vxge: prefetch RxD descriptors

This patch prefetches RxD descriptors which helps to lower the latency of a
cache miss in vxge_hw_ring_rxd_next_completed.  This lowers the % of CPU
time used by vxge_hw_ring_rxd_next_completed() where the descriptor is
accessed in profiling netperf on a P4 Xeon from 1.5% to 1.0%.

Signed-off-by: Benjamin LaHaise <ben.lahaise@neterion.com>
Signed-off-by: Sreenivasa Honnur <sreenivasa.honnur@neterion.com>
Signed-off-by: Ramkrishna Vepa <ram.vepa@neterion.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agovxge: improve tx performance by using mmiowb() instead of wmb()
Benjamin LaHaise [Tue, 4 Aug 2009 10:21:21 +0000 (10:21 +0000)]
vxge: improve tx performance by using mmiowb() instead of wmb()

wmb() is extremely heavy on x86.  The semantics required in the driver are
provided by mmiowb(), so use that and improve tx performance on P4 Xeons by
5-10%.

Signed-off-by: Benjamin LaHaise <ben.lahaise@neterion.com>
Signed-off-by: Sreenivasa Honnur <sreenivasa.honnur@neterion.com>
Signed-off-by: Ramkrishna Vepa <ram.vepa@neterion.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agovxge: fix pktgen hangs (don't abuse skb->cb[])
Benjamin LaHaise [Tue, 4 Aug 2009 10:21:03 +0000 (10:21 +0000)]
vxge: fix pktgen hangs (don't abuse skb->cb[])

This patch fixes a case in the transmit completion code which was resulting
in pktgen hanging at the end of a run.  The cause is due to the fact that
the ->cb[] area of an skb cannot be used in a network driver's transmit
path, as that area belongs to the network protocol.  Pktgen hangs, as it
sends out the same packet multiple times, and vxge's use of this area of
the skb for a temporary list can only add the packet to the temporary list
once (while it may be on the queue many times).  The fix is to remove this
abuse of skb->cb[].  Instead, skb pointers are placed into a temporary
stack array, and then free outside of the tx lock.  This retains the smp
optimization of doing dev_kfree_skb() outside of the tx lock.

Signed-off-by: Benjamin LaHaise <ben.lahaise@neterion.com>
Signed-off-by: Sreenivasa Honnur <sreenivasa.honnur@neterion.com>
Signed-off-by: Ramkrishna Vepa <ram.vepa@neterion.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agovxge: don't drop frame on tx queue full
Benjamin LaHaise [Tue, 4 Aug 2009 10:20:44 +0000 (10:20 +0000)]
vxge: don't drop frame on tx queue full

The vxge driver will drop a packet in its transmit function if the number
of TxDs available hits 0.  Instead of doing that, simply stop the transmit
queue when transmitting a packet with the last available TxD.

Signed-off-by: Benjamin LaHaise <ben.lahaise@neterion.com>
Signed-off-by: Sreenivasa Honnur <sreenivasa.honnur@neterion.com>
Signed-off-by: Ramkrishna Vepa <ram.vepa@neterion.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agoixgbe: allow vlan egress priority mapping in DCB mode
Lucy Liu [Wed, 5 Aug 2009 20:06:34 +0000 (13:06 -0700)]
ixgbe: allow vlan egress priority mapping in DCB mode

The skb priority to vlan-qos egress mapping that can be configured using
set_egress_map with vconfig is overriden by the DCB code in the driver.

This patch allows this existing mechanism to work and will increase the
configuration flexibility of DCB mode on Linux.

A hierarchy of configuration is:

1. Modifies the ixgbe_select_queue() routine for DCB mode to return the
priority value from the VLAN tag. It will normally be zero, unless the egress
priority map has modified it. This will get packets into the correct queue and
result in the queue_mapping field being set correctly.

2. Any tc filter which modifies queue_mapping will be honored, as the filters
are handled after the vlan egress map is handled.

Signed-off-by: Lucy Liu <lucy.liu@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agobe2net: Patch to perform function reset at initialization
sarveshwarb [Wed, 5 Aug 2009 20:05:24 +0000 (13:05 -0700)]
be2net: Patch to perform function reset at initialization

This patch is a bug fix to avoid system going into a bad state when
driver is loaded in context of kdump kernel. The patch fixes the issue
by performing a soft reset of pci function at probe time.

Signed-off-by: sarveshwarb <sarveshwarb@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agonet: implement a SO_DOMAIN getsockoption
Jan Engelhardt [Tue, 4 Aug 2009 07:28:29 +0000 (07:28 +0000)]
net: implement a SO_DOMAIN getsockoption

This sockopt goes in line with SO_TYPE and SO_PROTOCOL. It makes it
possible for userspace programs to pass around file descriptors — I
am referring to arguments-to-functions, but it may even work for the
fd passing over UNIX sockets — without needing to also pass the
auxiliary information (PF_INET6/IPPROTO_TCP).

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agonet: implement a SO_PROTOCOL getsockoption
Jan Engelhardt [Tue, 4 Aug 2009 07:28:28 +0000 (07:28 +0000)]
net: implement a SO_PROTOCOL getsockoption

Similar to SO_TYPE returning the socket type, SO_PROTOCOL allows to
retrieve the protocol used with a given socket.

I am not quite sure why we have that-many copies of socket.h, and why
the values are not the same on all arches either, but for where hex
numbers dominate, I use 0x1029 for SO_PROTOCOL as that seems to be
the next free unused number across a bunch of operating systems, or
so Google results make me want to believe. SO_PROTOCOL for others
just uses the next free Linux number, 38.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agonetxen: add hardware LRO support
Dhananjay Phadke [Wed, 5 Aug 2009 07:34:09 +0000 (07:34 +0000)]
netxen: add hardware LRO support

Add support to handle aggregate packets from firmware.
Local TCP flows are automatically identified by firmware
based on the dest IP hash added by driver for local IP
addresses.

The packets are sent down on the jumbo rx ring.

Signed-off-by: Narender Kumar <narender.kumar@qlogic.com>
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agonetxen: remove unnecessary structures
Dhananjay Phadke [Wed, 5 Aug 2009 07:34:08 +0000 (07:34 +0000)]
netxen: remove unnecessary structures

Remove unnecessary offsetof calulations on these structures:
netxen_board_info, netxen_user_old_info, netxen_new_user_info.

The offsets into the flash are fixed, don't need to be calculated.

Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agonetxen: fix vlan tso case
Dhananjay Phadke [Wed, 5 Aug 2009 07:34:07 +0000 (07:34 +0000)]
netxen: fix vlan tso case

Fix the calculation of remaining header length in TSO
over vlan device case. This was inadvertently missed
out in patch 028afe719855a157e32450c ("netxen: add vlan
tx acceleration support").

Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agocpmac: unmark as broken
Florian Fainelli [Tue, 4 Aug 2009 11:17:49 +0000 (11:17 +0000)]
cpmac: unmark as broken

Starting with version 0.5.1, cpmac is no longer broken.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agocpmac: bump version to 0.5.1
Florian Fainelli [Tue, 4 Aug 2009 10:53:00 +0000 (10:53 +0000)]
cpmac: bump version to 0.5.1

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agocpmac: wait longer after MDIO reset
Florian Fainelli [Tue, 4 Aug 2009 10:52:57 +0000 (10:52 +0000)]
cpmac: wait longer after MDIO reset

This patch slows down the MDIO_ALIVE busy waiting to let
switches and PHY come up after reset. Previous loop was
too quick for IC+175C and ADM6996C/L switches to come up.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agocpmac: add support for fixed PHY
Florian Fainelli [Tue, 4 Aug 2009 10:52:52 +0000 (10:52 +0000)]
cpmac: add support for fixed PHY

This patch adds support for fixed PHY connected in MII mode
to cpmac. We allow external and dumb_switch module parameters
to override the PHY detection process since they are always connected
with MDIO bus identifier 0. This lets fixed PHYs to be detected
correctly and be connected to the their corresponding MDIO
bus identifier.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agoar7: add fixed PHY support for the two on-board cpmac
Florian Fainelli [Tue, 4 Aug 2009 10:52:47 +0000 (10:52 +0000)]
ar7: add fixed PHY support for the two on-board cpmac

This patch adds fixed PHY support for the two on-chip
cpmac Ethernet adapters.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agocpmac: fix wrong MDIO bus identifier
Florian Fainelli [Tue, 4 Aug 2009 10:52:41 +0000 (10:52 +0000)]
cpmac: fix wrong MDIO bus identifier

This patch fixes the wrong MDIO bus identifier which was
set to 0 unconditionaly, suitable for external switches while
it is actually 1 for PHYs different than external switches
which are autodetected.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agonet: mark read-only arrays as const
Jan Engelhardt [Wed, 5 Aug 2009 17:42:58 +0000 (10:42 -0700)]
net: mark read-only arrays as const

String literals are constant, and usually, we can also tag the array
of pointers const too, moving it to the .rodata section.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agoxfrm6: Fix xfrm6_policy.c build when SYSCTL disabled.
David S. Miller [Wed, 5 Aug 2009 03:32:16 +0000 (20:32 -0700)]
xfrm6: Fix xfrm6_policy.c build when SYSCTL disabled.

Same as how Randy Dunlap fixed the ipv4 side of things.

Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agoxfrm4: fix build when SYSCTLs are disabled
Randy Dunlap [Wed, 5 Aug 2009 03:18:33 +0000 (20:18 -0700)]
xfrm4: fix build when SYSCTLs are disabled

Fix build errors when SYSCTLs are not enabled:
(.init.text+0x5154): undefined reference to `net_ipv4_ctl_path'
(.init.text+0x5176): undefined reference to `register_net_sysctl_table'
xfrm4_policy.c:(.exit.text+0x573): undefined reference to `unregister_net_sysctl_table

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agoath9k: fix compile warning on ath9k_hw_AR9287_check_eeprom()
Luis R. Rodriguez [Mon, 3 Aug 2009 20:51:49 +0000 (13:51 -0700)]
ath9k: fix compile warning on ath9k_hw_AR9287_check_eeprom()

CC [M]  drivers/net/wireless/ath/ath9k/eeprom.o
drivers/net/wireless/ath/ath9k/eeprom.c: In function ‘ath9k_hw_AR9287_check_eeprom’:
drivers/net/wireless/ath/ath9k/eeprom.c:2866: warning: comparison of distinct pointer types lacks a cast

Cc: Vivek Natarajan <vnatarajan@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agomac80211: FIF_PSPOLL filter flag
Igor Perminov [Tue, 4 Aug 2009 12:48:51 +0000 (16:48 +0400)]
mac80211: FIF_PSPOLL filter flag

When an interface is configured in the AP mode, the mac80211
implementation doesn't inform the driver to receive PS Poll frames.
It leads to inability to communicate with power-saving stations
reliably.
The FIF_CONTROL flag isn't passed by mac80211 to
ieee80211_ops.configure_filter when an interface is in the AP mode.
And it's ok, because we don't want to receive ACK frames and other
control ones, but only PS Poll ones.

This patch introduces the FIF_PSPOLL filter flag in addition to
FIF_CONTROL, which means for the driver "pass PS Poll frames".

This flag is passed to the driver:
A) When an interface is configured in the AP mode.
B) In all cases, when the FIF_CONTROL flag was passed earlier (in
addition to it).

Signed-off-by: Igor Perminov <igor.perminov@inbox.ru>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: cancel xmit poll work at stop() callback
Luis R. Rodriguez [Sat, 25 Jul 2009 00:47:33 +0000 (20:47 -0400)]
ath9k: cancel xmit poll work at stop() callback

We forgot to cancel this work at the stop() callback.

------------[ cut here ]------------
WARNING: at net/mac80211/util.c:511 ieee80211_queue_delayed_work+0x3a/0x40 [mac80211]()
Hardware name: 6460DWU
queueing ieee80211 work while going to suspend
Modules linked in: <-- snip -->
Pid: 5124, comm: phy0 Tainted: G        W  2.6.31-rc3-wl #4
Call Trace:
 [<ffffffffa03adcda>] ? ieee80211_queue_delayed_work+0x3a/0x40 [mac80211]
 [<ffffffff810552b8>] warn_slowpath_common+0x78/0xd0
 [<ffffffff81055394>] warn_slowpath_fmt+0x64/0x70
 [<ffffffff814ed2c9>] ? thread_return+0x3e/0x635
 [<ffffffffa03adcda>] ieee80211_queue_delayed_work+0x3a/0x40 [mac80211]
 [<ffffffffa0297690>] ath_tx_complete_poll_work+0xc0/0x100 [ath9k]
 [<ffffffffa02975d0>] ? ath_tx_complete_poll_work+0x0/0x100 [ath9k]
 [<ffffffff81069b68>] worker_thread+0x178/0x260
 [<ffffffff8106ecc0>] ? autoremove_wake_function+0x0/0x40
 [<ffffffff810699f0>] ? worker_thread+0x0/0x260
 [<ffffffff8106e89e>] kthread+0x9e/0xb0
 [<ffffffff8101302a>] child_rip+0xa/0x20
 [<ffffffff8106e800>] ? kthread+0x0/0xb0
 [<ffffffff81013020>] ? child_rip+0x0/0x20

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: add initial hardware support for ar9271
Luis R. Rodriguez [Tue, 4 Aug 2009 03:14:12 +0000 (23:14 -0400)]
ath9k: add initial hardware support for ar9271

We will finalize this after some driver core changes, for now
we leave this unsupported.

Cc: Stephen Chen <stephen.chen@atheros.com>
Cc: Zhifeng Cai <zhifeng.cai@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: add initvals and registry definitions for AR9271
Luis R. Rodriguez [Tue, 4 Aug 2009 03:14:11 +0000 (23:14 -0400)]
ath9k: add initvals and registry definitions for AR9271

Cc: Stephen Chen <stephen.chen@atheros.com>
Cc: Zhifeng Cai <zhifeng.cai@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: add ar9271 revision and subrevision ID helpers
Luis R. Rodriguez [Tue, 4 Aug 2009 03:14:10 +0000 (23:14 -0400)]
ath9k: add ar9271 revision and subrevision ID helpers

These will be used later to add support for ar9271.

Cc: Stephen Chen <stephen.chen@atheros.com>
Cc: Zhifeng Cai <zhifeng.cai@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: Remove _t postfix for ar9287_eeprom structure
Luis R. Rodriguez [Mon, 3 Aug 2009 21:31:25 +0000 (17:31 -0400)]
ath9k: Remove _t postfix for ar9287_eeprom structure

We don't use typdefs on ath9k, remove that _t.

Cc: Vivek Natarajan <vnatarajan@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: remove spurious check for channel on keycache reset
Luis R. Rodriguez [Mon, 3 Aug 2009 19:24:56 +0000 (12:24 -0700)]
ath9k: remove spurious check for channel on keycache reset

ath9k_hw_keyreset() has a spurious check for ah->curchan..
remove it.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: remove dangling error check on keycache reset on hw init
Luis R. Rodriguez [Mon, 3 Aug 2009 19:24:55 +0000 (12:24 -0700)]
ath9k: remove dangling error check on keycache reset on hw init

The keycache reset will not fail as right above we ensure
to set the sc->keymax to be <= ah->caps.keycache_size. Just remove
this dangling check.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: call ath9k_hw_detach() once upon hw init failure
Luis R. Rodriguez [Mon, 3 Aug 2009 19:24:54 +0000 (12:24 -0700)]
ath9k: call ath9k_hw_detach() once upon hw init failure

If hw initialization fails (ath9k_hw_init()) on ath_init_softc()
we bail out and call ath9k_hw_detach(). The call ath9k_hw_detach()
is conditional though as ath9k_hw_init() could itself have called
ath9k_hw_detach(). Just describing this is itself a brain twister.
Avoid this nonsense by removing ath9k_hw_detach() from ath9k_hw_init().

Upon hw initialization failure we expect the callers to take care of
the cleanup.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: set sc->sc_ah to NULL after freeing it
Luis R. Rodriguez [Mon, 3 Aug 2009 19:24:53 +0000 (12:24 -0700)]
ath9k: set sc->sc_ah to NULL after freeing it

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: set ah to null after freeing
Luis R. Rodriguez [Mon, 3 Aug 2009 19:24:52 +0000 (12:24 -0700)]
ath9k: set ah to null after freeing

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: rename ath9k_hw_ani_detach() to ath9k_hw_ani_disable()
Luis R. Rodriguez [Mon, 3 Aug 2009 19:24:51 +0000 (12:24 -0700)]
ath9k: rename ath9k_hw_ani_detach() to ath9k_hw_ani_disable()

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: rename ath9k_hw_rfdetach() to ath9k_hw_rf_free()
Luis R. Rodriguez [Mon, 3 Aug 2009 19:24:50 +0000 (12:24 -0700)]
ath9k: rename ath9k_hw_rfdetach() to ath9k_hw_rf_free()

This makes it clear what this does.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: use helper macro to kfree and nullify on ath9k_hw_rfdetach()
Luis R. Rodriguez [Mon, 3 Aug 2009 19:24:49 +0000 (12:24 -0700)]
ath9k: use helper macro to kfree and nullify on ath9k_hw_rfdetach()

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: remove !NULL check before kfree()
Luis R. Rodriguez [Mon, 3 Aug 2009 19:24:48 +0000 (12:24 -0700)]
ath9k: remove !NULL check before kfree()

kfree(NULL) works so remove all those branches which check
for it before kfree()'ing on ath9k_hw_rfdetach().

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: distinguish between device initialization and ath_softc init
Luis R. Rodriguez [Mon, 3 Aug 2009 19:24:47 +0000 (12:24 -0700)]
ath9k: distinguish between device initialization and ath_softc init

We re-label the device driver initialization routines from the
ath_softc, the "Software Carrier" fillers. This should make it
clearer what each of these do.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: describe hw initialization better
Luis R. Rodriguez [Mon, 3 Aug 2009 19:24:46 +0000 (12:24 -0700)]
ath9k: describe hw initialization better

During initialization ath9k tends to use "attach" to when we
initialize hardware due to the fact we used to attach a "HAL".
The notion of a HAL is long gone, so lets just be clear on what
we are doing.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: break up hw initialization into a few more helpers
Luis R. Rodriguez [Mon, 3 Aug 2009 19:24:45 +0000 (12:24 -0700)]
ath9k: break up hw initialization into a few more helpers

This makes reading the hardware initialization process
easier to understand. The new helpers added are:

ath9k_hw_init_cal_settings()
ath9k_hw_init_mode_regs()
ath9k_hw_init_mode_gain_regs()
ath9k_hw_init_11a_eeprom_fix()

This patch has no functional changes.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: remove debug message for no memoery on ath_init()
Luis R. Rodriguez [Mon, 3 Aug 2009 19:24:44 +0000 (12:24 -0700)]
ath9k: remove debug message for no memoery on ath_init()

We're now propagating the -ENOMEM error so there is no need to
keep a debug message there now.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: rename ath9k_hw_set_defaults() to ath9k_hw_init_config()
Luis R. Rodriguez [Mon, 3 Aug 2009 19:24:43 +0000 (12:24 -0700)]
ath9k: rename ath9k_hw_set_defaults() to ath9k_hw_init_config()

This reflects better what we are actually doing there.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: rename ath9k_hw_newstate() to ath9k_hw_init_defaults()
Luis R. Rodriguez [Mon, 3 Aug 2009 19:24:42 +0000 (12:24 -0700)]
ath9k: rename ath9k_hw_newstate() to ath9k_hw_init_defaults()

This reflects better what we are actually doing there.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: move hw macrevision checker to helper
Luis R. Rodriguez [Mon, 3 Aug 2009 19:24:41 +0000 (12:24 -0700)]
ath9k: move hw macrevision checker to helper

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: pass only one argument to hw attach
Luis R. Rodriguez [Mon, 3 Aug 2009 19:24:40 +0000 (12:24 -0700)]
ath9k: pass only one argument to hw attach

The softc is cached and set within the ath_hw struct.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: call hw initializer directly
Luis R. Rodriguez [Mon, 3 Aug 2009 19:24:39 +0000 (12:24 -0700)]
ath9k: call hw initializer directly

ath9k_hw_attach() was going first through some device id verifier,
and then calling some other helper which was doing the real hardware
initialization. Lets just do the devid checks within the real worker
by calling a helper ath9k_hw_devid_supported().

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: move cache setting of softc ah prior to attach
Luis R. Rodriguez [Mon, 3 Aug 2009 19:24:38 +0000 (12:24 -0700)]
ath9k: move cache setting of softc ah prior to attach

We do this in case attach and friends try to get back to
ah from the softc somehow.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: move devid cache setting to ath_init()
Luis R. Rodriguez [Mon, 3 Aug 2009 19:24:37 +0000 (12:24 -0700)]
ath9k: move devid cache setting to ath_init()

This lets us trim one argument off of hw initializer routines.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: move memory allocation of ath_hw to ath_init()
Luis R. Rodriguez [Mon, 3 Aug 2009 19:24:36 +0000 (12:24 -0700)]
ath9k: move memory allocation of ath_hw to ath_init()

This lets us simplify attach code and arguments passed.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: propagate hw initialization errors
Luis R. Rodriguez [Mon, 3 Aug 2009 19:24:35 +0000 (12:24 -0700)]
ath9k: propagate hw initialization errors

We were never propagating hw initialization errors, lets
do that now and also use -EOPNOTSUPP when device revision is
not supported yet.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: use a switch for revising supported hw mac revisions
Luis R. Rodriguez [Mon, 3 Aug 2009 19:24:34 +0000 (12:24 -0700)]
ath9k: use a switch for revising supported hw mac revisions

This makes adding new hw revisions a one line change here.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: remove usage of AR_SREV_*() wrapper to detect supported hw
Luis R. Rodriguez [Mon, 3 Aug 2009 19:24:33 +0000 (12:24 -0700)]
ath9k: remove usage of AR_SREV_*() wrapper to detect supported hw

We will clean this up next to just use a switch.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agocfg80211: clear SSID on disconnect/no connection
Johannes Berg [Tue, 4 Aug 2009 07:32:23 +0000 (09:32 +0200)]
cfg80211: clear SSID on disconnect/no connection

The SME state machine in cfg80211 uses the SSID stored
in struct wireless_dev internally, but fails to clear
it in multiple places (when giving up on a connection
attempt and when disconnecting). This doesn't matter to
the SME state machine, but does matter for IBSS. Thus,
in those cases, clear the SSID to avoid messing up the
IBSS state machine.

Reported-by: Joerg Albert <jal2@gmx.de>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoiwmc3200wifi: avoid setting default key for 802.1X and RSNA
Zhu Yi [Mon, 3 Aug 2009 06:37:03 +0000 (14:37 +0800)]
iwmc3200wifi: avoid setting default key for 802.1X and RSNA

UMAC only allows us to set default key for WEP and auth type is
not 802.1X or RSNA. This patch fixes iwmc3200wifi for 802.1X with
WEP104.

Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoiwmc3200wifi: set WEP key static flag correctly
Zhu Yi [Mon, 3 Aug 2009 06:37:02 +0000 (14:37 +0800)]
iwmc3200wifi: set WEP key static flag correctly

We should only set the static_key flag for open and legacy
authentication types. It should not be set for 802.1X and TKIP.

Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoiwmc3200wifi: fix set_wpa_version and set_auth_type order
Zhu Yi [Mon, 3 Aug 2009 06:37:01 +0000 (14:37 +0800)]
iwmc3200wifi: fix set_wpa_version and set_auth_type order

iwm->umac_profile->sec.flags is set by iwm_set_wpa_version and
checked by iwm_set_auth_type. The patch changes the order to
make the flag used correctly.

Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agob43: implement baseband init for LP-PHY <= rev1
Gábor Stefanik [Sun, 2 Aug 2009 23:28:12 +0000 (01:28 +0200)]
b43: implement baseband init for LP-PHY <= rev1

Implement baseband init for rev.0 and rev.1 LP PHYs. Convert boardflags_hi values to defines.
Implement b43_phy_copy for easier copying between registers, as needed by LP-PHY init.

Signed-off-by: Gábor Stefanik<netrolller.3d@gmail.com>
Cc: Michael Buesch<mb@bu3sch.de>
Cc: Larry Finger<larry.finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agort2x00: cancel all work on disconnect
Pavel Roskin [Sun, 2 Aug 2009 18:30:15 +0000 (14:30 -0400)]
rt2x00: cancel all work on disconnect

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agort61pci: fix module reloading
Pavel Roskin [Sun, 2 Aug 2009 18:30:02 +0000 (14:30 -0400)]
rt61pci: fix module reloading

Unloading rt61pci can leave the device in such state that reloading
rt61pci would fail to reinitialize it.  Bogus data would be read from
the EEPROM and the RF version won't be recognized.

It appears that unloading rt61pci with power saving enabled would have
such effect.  To initialize the device properly, SOFT_RESET_CSR should
be set to the same value as rt61pci_config_ps() uses to wake up the
device.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agob43legacy: Work around mac80211 race condition
Larry Finger [Sun, 2 Aug 2009 03:32:48 +0000 (22:32 -0500)]
b43legacy: Work around mac80211 race condition

As shown in http://thread.gmane.org/gmane.linux.kernel.wireless.general/36497,
mac80211 has a bug that allows a call to the TX routine after the queues have
been stopped. This situation will only occur under extreme stress. Although
b43legacy does not crash when this condition occurs, it does generate a WARN_ON
and also logs a queue overrun message. This patch recognizes b43legacy is not
at fault and logs a message only when the most verbose debugging mode is
enabled. In the unlikely event that the queue is not stopped when the DMA
queue becomes full, then a warning is issued.

This patch is based on the one used by b43.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agorfkill: add the GPS radio type
Tomas Winkler [Sat, 1 Aug 2009 23:36:49 +0000 (02:36 +0300)]
rfkill: add the GPS radio type

Althoug GPS is a technology w/o transmitting radio
and thus not a primary candidate for rfkill switch,
rfkill gives unified interface point for devices with
wireless technology.

The input key is not supplied as it is too be deprecated.

Cc: johannes@sipsolutions.net
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agodrivers/net/wireless: Use DIV_ROUND_CLOSEST
Julia Lawall [Sat, 1 Aug 2009 19:50:31 +0000 (21:50 +0200)]
drivers/net/wireless: Use DIV_ROUND_CLOSEST

The kernel.h macro DIV_ROUND_CLOSEST performs the computation (x + d/2)/d
but is perhaps more readable.

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@haskernel@
@@

#include <linux/kernel.h>

@depends on haskernel@
expression x,__divisor;
@@

- (((x) + ((__divisor) / 2)) / (__divisor))
+ DIV_ROUND_CLOSEST(x,__divisor)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agolibertas: Fix WEP association failure with open source wpa_supplicant 0.5.10
Maithili Hinge [Sat, 1 Aug 2009 03:02:19 +0000 (20:02 -0700)]
libertas: Fix WEP association failure with open source wpa_supplicant 0.5.10

Add code to handle IW_AUTH_PRIVACY_INVOKED and IW_AUTH_RX_UNENCRYPTED_EAPOL
cases in lbs_set_auth() function in libertas code.

Signed-off-by: Maithili Hinge <maithili@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoiwlwifi: remove duplicated version info from sysfs
Jay Sternberg [Fri, 31 Jul 2009 21:28:09 +0000 (14:28 -0700)]
iwlwifi: remove duplicated version info from sysfs

version info in sysfs had been determined to be unnecessary as it
is already provided in syslog info.  nvm version is added to syslog
version info as a debug level message to provide all info that was
in the version sysfs data.

Signed-off-by: Jay Sternberg <jay.e.sternberg@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoiwlwifi: remove deprecated 6000 series adapters
Wey-Yi Guy [Fri, 31 Jul 2009 21:28:08 +0000 (14:28 -0700)]
iwlwifi: remove deprecated 6000 series adapters

Remove the support for deprecated devices. These devices are
engineering samples and no longer supported by the uCode.

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoiwlwifi: Distinguish power amplifier for 6000 series
Wey-Yi Guy [Fri, 31 Jul 2009 21:28:07 +0000 (14:28 -0700)]
iwlwifi: Distinguish power amplifier for 6000 series

For 6x00 2x2 NIC, two types of Power Amplifier are available.
In order for uCode to apply correct tx power,
driver needs to program the CSR_GP_DRIVER_REG register and
let uCode know the type of PA.
If driver do not program CSR_GP_DRIVER_REG register (default to 0),
then it is uCode's decision for tx power

2x2 Hybrid card: use both internal and external PA
2x2 IPA(Internal Power Amplifier) card: internal PA only

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoiwlwifi: clear iwl_cmd_meta structure before use
Daniel C Halperin [Fri, 31 Jul 2009 21:28:06 +0000 (14:28 -0700)]
iwlwifi: clear iwl_cmd_meta structure before use

Resolve an issue in which out-dated fields in iwl_cmd_meta
could be used for later hardware commands.

Signed-off-by: Daniel C Halperin <daniel.c.halperin@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agob43: remove wrong probe_resp_plcp write
gregor kowski [Fri, 31 Jul 2009 20:35:49 +0000 (22:35 +0200)]
b43: remove wrong probe_resp_plcp write

The tkip hw support uncovered a bug in b43_write_probe_resp_template : it is
writing at the wrong shm offset, it is in the B43_SHM_SH_TKIPTSCTTAK zone. This
patch comments these writes.

Signed-off-by: Gregor Kowski <gregor.kowski@gmail.com>
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agob43: Fix unaligned 32bit SHM-shared access
Michael Buesch [Fri, 31 Jul 2009 18:51:41 +0000 (20:51 +0200)]
b43: Fix unaligned 32bit SHM-shared access

This fixes unaligned 32bit SHM-shared read/write access.
The low and high 16 bits were swapped.
It also adds a testcase for this to the chipaccess validation.

(Thanks to Albert Herranz for tracking down this bug.)

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agolibertas: check valid bits in SPI bus mode reg
Andrey Yurovsky [Fri, 31 Jul 2009 18:35:19 +0000 (11:35 -0700)]
libertas: check valid bits in SPI bus mode reg

The SPI driver writes to the bus mode register and performs a sanity
check by reading back what we wrote, however only the lower four bits of
that register are defined.  In some cases, the device side seems to set
the higher bits, causing us to fail the sanity check unnecessarily.
Check only the lower four bits instead.

Thanks to John Goyette from Schick Technologies for pointing out the
problem.

Signed-off-by: Andrey Yurovsky <andrey@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agomac80211: Increase timeouts for station polling
Maxim Levitsky [Fri, 31 Jul 2009 15:54:23 +0000 (18:54 +0300)]
mac80211: Increase timeouts for station polling

Do a probe request every 30 seconds, and wait for probe response,
half a second This should lower the traffic that card sends, thus save
power Wainting longer for response makes probe more robust against
'slow' access points

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Tested-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agomac80211: Retry probe request few times
Maxim Levitsky [Fri, 31 Jul 2009 15:54:12 +0000 (18:54 +0300)]
mac80211: Retry probe request few times

Retry 5 times  (chosen arbitary ), before assuming
that station is out of range.

Fixes frequent disassociations while connected to weak,
and sometimes even strong access points.

Signed-off-by: Maxim Levitky <maximlevitsky@gmail.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agocfg80211: lower dynamic PS timeout to 100ms
Johannes Berg [Fri, 31 Jul 2009 09:18:13 +0000 (11:18 +0200)]
cfg80211: lower dynamic PS timeout to 100ms

The default of 500ms is pretty high, and leads
to the device being awake at least 50% of the
time under such light traffic conditions as a
simple 1 second interval ping. Reduce to just
100ms -- it should have a similar effect while
providing a better sleep time.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Kalle Valo <kalle.valo@iki.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoiwlwifi: remove usage of orig_flags
Luis R. Rodriguez [Fri, 31 Jul 2009 01:37:27 +0000 (21:37 -0400)]
iwlwifi: remove usage of orig_flags

This is a private flag, internal to cfg80211. cfg80211
will set orig_* stuff internally upon wiphy registration,
drivers do not need to muck with it.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Acked-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agocfg80211: enable country IE support to all cfg80211 drivers
Luis R. Rodriguez [Fri, 31 Jul 2009 00:38:09 +0000 (17:38 -0700)]
cfg80211: enable country IE support to all cfg80211 drivers

Since the bss is always set now once we are connected, if the
bss has its own information element we refer to it and pass that
instead of relying on mac80211's parsing.

Now all cfg80211 drivers get country IE support, automatically and
we reduce the call overhead that we had on mac80211 which called this
upon every beacon and instead now call this only upon a successfull
connection by a STA on cfg80211.

Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agocfg80211: decouple regulatory variables from cfg80211_mutex
Luis R. Rodriguez [Fri, 31 Jul 2009 00:38:08 +0000 (17:38 -0700)]
cfg80211: decouple regulatory variables from cfg80211_mutex

We change regulatory code to be protected by its own regulatory
mutex and alleviate cfg80211_mutex to only be used to protect
cfg80211_rdev_list, the registered device list.

By doing this we will be able to work on regulatory core components
without having to have hog up the cfg80211_mutex. An example here is
we no longer need to use the cfg80211_mutex during driver specific
wiphy_apply_custom_regulatory(). We also no longer need it for the
the country IE regulatory hint; by doing so we end up curing this
new lockdep warning:

=======================================================
[ INFO: possible circular locking dependency detected ]
2.6.31-rc4-wl #12
-------------------------------------------------------
phy1/1709 is trying to acquire lock:
 (cfg80211_mutex){+.+.+.}, at: [<ffffffffa00af852>] regulatory_hint_11d+0x32/0x3f0 [cfg80211]

but task is already holding lock:
 (&ifmgd->mtx){+.+.+.}, at: [<ffffffffa0144228>] ieee80211_sta_work+0x108/0x10f0 [mac80211]

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> #3 (&ifmgd->mtx){+.+.+.}:
       [<ffffffff810857b6>] __lock_acquire+0xd76/0x12b0
       [<ffffffff81085dd3>] lock_acquire+0xe3/0x120
       [<ffffffff814eeae4>] mutex_lock_nested+0x44/0x350
       [<ffffffffa0141bb8>] ieee80211_mgd_auth+0x108/0x1f0 [mac80211]
       [<ffffffffa0148563>] ieee80211_auth+0x13/0x20 [mac80211]
       [<ffffffffa00bc3a1>] __cfg80211_mlme_auth+0x1b1/0x2a0 [cfg80211]
       [<ffffffffa00bc516>] cfg80211_mlme_auth+0x86/0xc0 [cfg80211]
       [<ffffffffa00b368d>] nl80211_authenticate+0x21d/0x230 [cfg80211]
       [<ffffffff81416ba6>] genl_rcv_msg+0x1b6/0x1f0
       [<ffffffff81415c39>] netlink_rcv_skb+0x89/0xb0
       [<ffffffff814169d9>] genl_rcv+0x29/0x40
       [<ffffffff8141591d>] netlink_unicast+0x29d/0x2b0
       [<ffffffff81416514>] netlink_sendmsg+0x214/0x300
       [<ffffffff813e4407>] sock_sendmsg+0x107/0x130
       [<ffffffff813e45b9>] sys_sendmsg+0x189/0x320
       [<ffffffff81011f82>] system_call_fastpath+0x16/0x1b
       [<ffffffffffffffff>] 0xffffffffffffffff

-> #2 (&wdev->mtx){+.+.+.}:
       [<ffffffff810857b6>] __lock_acquire+0xd76/0x12b0
       [<ffffffff81085dd3>] lock_acquire+0xe3/0x120
       [<ffffffff814eeae4>] mutex_lock_nested+0x44/0x350
       [<ffffffffa00ab304>] cfg80211_netdev_notifier_call+0x1a4/0x390 [cfg80211]
       [<ffffffff814f3dff>] notifier_call_chain+0x3f/0x80
       [<ffffffff81075a91>] raw_notifier_call_chain+0x11/0x20
       [<ffffffff813f665a>] dev_open+0x10a/0x120
       [<ffffffff813f59bd>] dev_change_flags+0x9d/0x1e0
       [<ffffffff8144eb6e>] devinet_ioctl+0x6fe/0x760
       [<ffffffff81450204>] inet_ioctl+0x94/0xc0
       [<ffffffff813e25fa>] sock_ioctl+0x6a/0x290
       [<ffffffff8111e911>] vfs_ioctl+0x31/0xa0
       [<ffffffff8111ea9a>] do_vfs_ioctl+0x8a/0x5c0
       [<ffffffff8111f069>] sys_ioctl+0x99/0xa0
       [<ffffffff81011f82>] system_call_fastpath+0x16/0x1b
       [<ffffffffffffffff>] 0xffffffffffffffff

-> #1 (&rdev->mtx){+.+.+.}:
       [<ffffffff810857b6>] __lock_acquire+0xd76/0x12b0
       [<ffffffff81085dd3>] lock_acquire+0xe3/0x120
       [<ffffffff814eeae4>] mutex_lock_nested+0x44/0x350
       [<ffffffffa00ac4d0>] cfg80211_get_dev_from_ifindex+0x60/0x90 [cfg80211]
       [<ffffffffa00b21ff>] get_rdev_dev_by_info_ifindex+0x6f/0xa0 [cfg80211]
       [<ffffffffa00b51eb>] nl80211_set_interface+0x3b/0x260 [cfg80211]
       [<ffffffff81416ba6>] genl_rcv_msg+0x1b6/0x1f0
       [<ffffffff81415c39>] netlink_rcv_skb+0x89/0xb0
       [<ffffffff814169d9>] genl_rcv+0x29/0x40
       [<ffffffff8141591d>] netlink_unicast+0x29d/0x2b0
       [<ffffffff81416514>] netlink_sendmsg+0x214/0x300
       [<ffffffff813e4407>] sock_sendmsg+0x107/0x130
       [<ffffffff813e45b9>] sys_sendmsg+0x189/0x320
       [<ffffffff81011f82>] system_call_fastpath+0x16/0x1b
       [<ffffffffffffffff>] 0xffffffffffffffff

other info that might help us debug this:

3 locks held by phy1/1709:
 #0:  ((wiphy_name(local->hw.wiphy))){+.+.+.}, at: [<ffffffff8106b45d>] worker_thread+0x19d/0x340
 #1:  (&ifmgd->work){+.+.+.}, at: [<ffffffff8106b45d>] worker_thread+0x19d/0x340
 #2:  (&ifmgd->mtx){+.+.+.}, at: [<ffffffffa0144228>] ieee80211_sta_work+0x108/0x10f0 [mac80211]

Reported-by: Reinette Chatre <reinette.chatre@intel.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agocfg80211: do not iterate over rdev list on country IE hint
Luis R. Rodriguez [Fri, 31 Jul 2009 00:38:07 +0000 (17:38 -0700)]
cfg80211: do not iterate over rdev list on country IE hint

Simplify the country IE hint code by just bailing out if
a previous country IE has been issued. We currently just trust
the first AP we connect to on any card. The idea was to perform
conflict resolution within this routine but since we can no longer
iterate over the registered device list here we leave conflict
resolution to be dealt with at a later time on the workqueue.

This code has no functional changes other than saving us an
interation over the registered device list when a second card
is connected, or you unplug and connect the same one, and a
country IE is received. This would have been done upon every
beacon received.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agocfg80211: use goto out on country IE reg hint failure
Luis R. Rodriguez [Fri, 31 Jul 2009 00:38:06 +0000 (17:38 -0700)]
cfg80211: use goto out on country IE reg hint failure

This has no functional changes.

Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agomac80211: fix powersave
Johannes Berg [Thu, 30 Jul 2009 19:43:55 +0000 (21:43 +0200)]
mac80211: fix powersave

Some of the recent MLME rework I did broke powersave
because the ps_sdata isn't assigned at the right time,
and the work item wasn't removed from the list before
calling ieee80211_recalc_ps(). To be more specific,
this broke the case where you'd enabled PS before
associating, either automatically or with iwconfig.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agorndis_wlan: rework key handling
Jussi Kivilinna [Thu, 30 Jul 2009 16:42:08 +0000 (19:42 +0300)]
rndis_wlan: rework key handling

Organize key data in private structure better and store WPA keys, so
they can be restored as WEP keys.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agorndis_wlan: add missing padding to struct rndis_80211_remove_key
Jussi Kivilinna [Thu, 30 Jul 2009 16:42:03 +0000 (19:42 +0300)]
rndis_wlan: add missing padding to struct rndis_80211_remove_key

OID_802_11_REMOVE_KEY failed with invalid length error, add missing padding to
structure fix this.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agorndis_wlan: handle 802.11 indications from device
Jussi Kivilinna [Thu, 30 Jul 2009 16:41:58 +0000 (19:41 +0300)]
rndis_wlan: handle 802.11 indications from device

Add handling for 802.11 specific rndis indications.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agorndis_host: allow rndis_wlan to see all indications
Jussi Kivilinna [Thu, 30 Jul 2009 16:41:52 +0000 (19:41 +0300)]
rndis_host: allow rndis_wlan to see all indications

Allow rndis_wlan to see all indications. Currently rndis_host lets rndis_wlan to
know about link state changes only, but there is whole set of other
802.11-specific indications that rndis_wlan should handle properly. So rename
link_change() to indication() and convert rndis_wlan to use it.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agorndis_wlan: add rndis_set/query_oid debugging
Jussi Kivilinna [Thu, 30 Jul 2009 16:41:47 +0000 (19:41 +0300)]
rndis_wlan: add rndis_set/query_oid debugging

Add better debugging for failed OID queries.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agorndis_wlan: set current packet filter to zero on stop
Jussi Kivilinna [Thu, 30 Jul 2009 16:41:42 +0000 (19:41 +0300)]
rndis_wlan: set current packet filter to zero on stop

Set current packet filter to zero to block receiving data packets from
device.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agorndis_wlan: reset device and restore multicast list on rndis_wlan_reset()
Jussi Kivilinna [Thu, 30 Jul 2009 16:41:37 +0000 (19:41 +0300)]
rndis_wlan: reset device and restore multicast list on rndis_wlan_reset()

Reset device properly with RNDIS_MSG_RESET in rndis_wlan_reset() and restore
multicast list afterwards.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agorndis_wlan: clear cfg80211 scan on rndis_wlan_stop()
Jussi Kivilinna [Thu, 30 Jul 2009 16:41:31 +0000 (19:41 +0300)]
rndis_wlan: clear cfg80211 scan on rndis_wlan_stop()

Scanning gets stuck if device is stopped when scan is active. Fix by
clearing/aborting cfg80211 scan on rndis_wlan_stop().

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agorndis_wlan: stop workers on rndis_wlan_stop() and restore on rndis_wlan_reset()
Jussi Kivilinna [Thu, 30 Jul 2009 16:41:26 +0000 (19:41 +0300)]
rndis_wlan: stop workers on rndis_wlan_stop() and restore on rndis_wlan_reset()

Driver doesn't need to poll statistics/link status when stopped.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agousbnet: allow "minidriver" to prevent urb unlinking on usbnet_stop
Jussi Kivilinna [Thu, 30 Jul 2009 16:41:20 +0000 (19:41 +0300)]
usbnet: allow "minidriver" to prevent urb unlinking on usbnet_stop

rndis_wlan devices freeze after running usbnet_stop several times. It appears
that firmware freezes in state where it does not respond to any RNDIS commands
and device have to be physically unplugged/replugged. This patch lets
minidrivers to disable unlink_urbs on usbnet_stop through new info flag.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agocfg80211: fix NETDEV_UNREGISTER notifier
Johannes Berg [Thu, 30 Jul 2009 12:04:01 +0000 (14:04 +0200)]
cfg80211: fix NETDEV_UNREGISTER notifier

It's possible to get the NETDEV_UNREGISTER callback multiple
times (see net/core/dev.c:netdev_wait_allrefs) and this will
completely mess up our cleanup code. To avoid that, clean up
only when the interface is still on the wiphy interface list
from which it's removed on the first NETDEV_UNREGISTER call.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoiwlwifi: don't export symbols not needed in other modules
Johannes Berg [Thu, 30 Jul 2009 09:58:16 +0000 (11:58 +0200)]
iwlwifi: don't export symbols not needed in other modules

Even with the split into iwlcore/agn/3945 not all symbols
that cross file boundaries are needed in other modules, a
few are only used within iwlcore, for example.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agomac80211: redefine usage of the mac80211 workqueue
Luis R. Rodriguez [Thu, 30 Jul 2009 00:08:07 +0000 (20:08 -0400)]
mac80211: redefine usage of the mac80211 workqueue

The mac80211 workqueue exists to enable mac80211 and drivers
to queue their own work on a single threaded workqueue. mac80211
takes care to flush the workqueue during suspend but we never
really had requirements on drivers for how they should use
the workqueue in consideration for suspend.

We extend mac80211 to document how the mac80211 workqueue should
be used, how it should not be used and finally move raw access to
the workqueue to mac80211 only. Drivers and mac80211 use helpers
to queue work onto the mac80211 workqueue:

  * ieee80211_queue_work()
  * ieee80211_queue_delayed_work()

These helpers will now warn if mac80211 already completed its
suspend cycle and someone is trying to queue work. mac80211
flushes the mac80211 workqueue prior to suspend a few times,
but we haven't taken the care to ensure drivers won't add more
work after suspend. To help with this we add a warning when
someone tries to add work and mac80211 already completed the
suspend cycle.

Drivers should ensure they cancel any work or delayed work
in the mac80211 stop() callback.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>