Johan Hedberg [Mon, 13 Dec 2010 19:07:03 +0000 (21:07 +0200)]
Bluetooth: Add error handling for managment command handlers
The command handlers for bluetooth management messaging should be able
to report errors (such as memory allocation failures) to the higher
levels in the call stack.
Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Tue, 7 Dec 2010 22:21:07 +0000 (00:21 +0200)]
Bluetooth: Make hci_send_to_sock usable for management control sockets
In order to send data to management control sockets the function should:
- skip checks intended for raw HCI data and stack internal events
- make sure RAW HCI data or stack internal events don't go to
management control sockets
In order to accomplish this the patch adds a new member to the bluetooth
skb private data to flag skb's that are destined for management control
sockets.
Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Felix Fietkau [Thu, 2 Dec 2010 09:27:21 +0000 (10:27 +0100)]
ath5k: Fix reset and interrupts for AHB type of devices.
On WiSoc we cannot access mac register before it is resetted.
It will crash hardware otherwise.
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Felix Fietkau [Thu, 2 Dec 2010 09:27:16 +0000 (10:27 +0100)]
ath5k: Add AHB bus support.
AHB specific functions are now in ahb.c file. AHB bus is
compiled in when CONFIG_ATHEROS_AR231X is set in kernel.
All other platforms will use PCI bus.
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Felix Fietkau [Thu, 2 Dec 2010 09:27:11 +0000 (10:27 +0100)]
ath5k: Add initial registers values for radio RF2317 chip.
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Felix Fietkau [Thu, 2 Dec 2010 09:27:06 +0000 (10:27 +0100)]
ath5k: Add a function to read chipset's MAC revision
Add bus dependent revision read function which is used to
determine chipset's MAC before hardware is initialized.
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Felix Fietkau [Thu, 2 Dec 2010 09:27:06 +0000 (10:27 +0100)]
ath5k: Check if pci pdev struct is initialized in common functions.
To be able to support other busses than PCI check if pci device
structure is initialized.
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Felix Fietkau [Thu, 2 Dec 2010 09:27:01 +0000 (10:27 +0100)]
ath5k: Use generic eeprom read from common ath_bus_opts struct.
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Felix Fietkau [Thu, 2 Dec 2010 09:27:01 +0000 (10:27 +0100)]
ath5k: Move PCI bus functions to separate file.
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Felix Fietkau [Thu, 2 Dec 2010 09:26:56 +0000 (10:26 +0100)]
ath5k: Introduce ath5k_init_softc function as in ath9k
Split pci initialization into hardware specific
functions and softc structure initialization.
Make function naming similar to ones ath9k.
Introduce ath_bus_opts in ath5k for later
AHB bus integration.
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Felix Fietkau [Thu, 2 Dec 2010 09:26:51 +0000 (10:26 +0100)]
ath5k: Use Generic DMA for later support of AHB bus.
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Andy Shevchenko [Thu, 2 Dec 2010 12:45:07 +0000 (14:45 +0200)]
wireless: ray_cs: use '%pm' format option to print MAC
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Cc: "John W. Linville" <linville@tuxdriver.com> Cc: linux-wireless@vger.kernel.org Signed-off-by: John W. Linville <linville@tuxdriver.com>
Hauke Mehrtens [Sun, 28 Nov 2010 11:22:52 +0000 (12:22 +0100)]
ssb: Add sysfs attributes to ssb devices
Make it possible to read out the attributes, till now only show on
dmesg, through sysfs.
This patch was some time in OpenWrt.
Signed-off-by: Bernhard Loos <bernhardloos@googlemail.com> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
"As far as I can tell, either of these patches breaks multiple VIF
scenarios. I'm not sure exactly why, but I had to revert this to
get any of my interfaces to associate."
-- Ben Greear <greearb@candelatech.com>
Felix Fietkau [Wed, 1 Dec 2010 18:07:47 +0000 (19:07 +0100)]
ath9k_hw: fix more bitfield related endian issues
A few LNA control related flags were also specified as a bitfields, however
for some strange reason they were written in big-endian order this time.
Fix this by using flags instead.
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Felix Fietkau [Wed, 1 Dec 2010 18:07:46 +0000 (19:07 +0100)]
ath9k_hw: fix endian issues with CTLs on AR9003
Parsing data using bitfields is messy, because it makes endian handling
much harder. AR9002 and earlier got it right, AR9003 got it wrong.
This might lead to either using too high or too low tx power values,
depending on frequency and eeprom settings.
Fix it by getting rid of the CTL related bitfields entirely and use
masks instead.
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Cc: stable@kernel.org Signed-off-by: John W. Linville <linville@tuxdriver.com>
ath9k: Fix bug in reading input gpio state for ar9003
The register which gives input gpio state is 0x404c for ar9003,
currently 0x4048 is wrongly used. This will disable RF and make
it unusable on some of AR9003.
Cc:stable@kernel.org Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Anderson Lizardo [Mon, 29 Nov 2010 16:15:50 +0000 (12:15 -0400)]
Bluetooth: Fix error handling for l2cap_init()
create_singlethread_workqueue() may fail with errors such as -ENOMEM. If
this happens, the return value is not set to a negative value and the
module load will succeed. It will then crash on module unload because of
a destroy_workqueue() call on a NULL pointer.
Additionally, the _busy_wq workqueue is not being destroyed if any
errors happen on l2cap_init().
Signed-off-by: Anderson Lizardo <anderson.lizardo@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Bluetooth: Get rid of __rfcomm_get_sock_by_channel()
rfcomm_get_sock_by_channel() was the only user of this function, so I merged
both into rfcomm_get_sock_by_channel(). The socket lock now should be hold
outside of rfcomm_get_sock_by_channel() once we hold and release it inside the
same function now.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
l2cap_get_sock_by_psm() was the only user of this function, so I merged
both into l2cap_get_sock_by_psm(). The socket lock now should be hold
outside of l2cap_get_sock_by_psm() once we hold and release it inside the
same function now.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Fix checkpatch errors like:
"ERROR: do not use assignment in if condition"
Simplify code and fix one long line.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@nokia.com> Acked-by: Ville Tervo <ville.tervo@nokia.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Bluetooth: Check sk is not owned before freeing l2cap_conn
Check that socket sk is not locked in user process before removing
l2cap connection handler.
lock_sock and release_sock do not hold a normal spinlock directly but
instead hold the owner field. This means bh_lock_sock can still execute
even if the socket is "locked". More info can be found here:
http://www.linuxfoundation.org/collaborate/workgroups/networking/socketlocks
krfcommd kernel thread may be preempted with l2cap tasklet which remove
l2cap_conn structure. If krfcommd is in process of sending of RFCOMM reply
(like "RFCOMM UA" reply to "RFCOMM DISC") then kernel crash happens.
...
[ 694.175933] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[ 694.184936] pgd = c0004000
[ 694.187683] [00000000] *pgd=00000000
[ 694.191711] Internal error: Oops: 5 [#1] PREEMPT
[ 694.196350] last sysfs file: /sys/devices/platform/hci_h4p/firmware/hci_h4p/loading
[ 694.260375] CPU: 0 Not tainted (2.6.32.10 #1)
[ 694.265106] PC is at l2cap_sock_sendmsg+0x43c/0x73c [l2cap]
[ 694.270721] LR is at 0xd7017303
...
[ 694.525085] Backtrace:
[ 694.527587] [<bf266be0>] (l2cap_sock_sendmsg+0x0/0x73c [l2cap]) from [<c02f2cc8>] (sock_sendmsg+0xb8/0xd8)
[ 694.537292] [<c02f2c10>] (sock_sendmsg+0x0/0xd8) from [<c02f3044>] (kernel_sendmsg+0x48/0x80)
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@nokia.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Vasiliy Kulikov [Sat, 30 Oct 2010 14:26:31 +0000 (18:26 +0400)]
Bluetooth: hidp: fix information leak to userland
Structure hidp_conninfo is copied to userland with version, product,
vendor and name fields unitialized if both session->input and session->hid
are NULL. It leads to leaking of contents of kernel stack memory.
Vasiliy Kulikov [Sat, 30 Oct 2010 14:26:21 +0000 (18:26 +0400)]
Bluetooth: bnep: fix information leak to userland
Structure bnep_conninfo is copied to userland with the field "device"
that has the last elements unitialized. It leads to leaking of
contents of kernel stack memory.
Johan Hedberg [Thu, 18 Nov 2010 20:22:29 +0000 (22:22 +0200)]
Bluetooth: Automate remote name requests
In Bluetooth there are no automatic updates of remote device names when
they get changed on the remote side. Instead, it is a good idea to do a
manual name request when a new connection gets created (for whatever
reason) since at this point it is very cheap (no costly baseband
connection creation needed just for the sake of the name request).
So far userspace has been responsible for this extra name request but
tighter control is needed in order not to flood Bluetooth controllers
with two many commands during connection creation. It has been shown
that some controllers simply fail to function correctly if they get too
many (almost) simultaneous commands during connection creation. The
simplest way to acheive better control of these commands is to move
their sending completely to the kernel side.
This patch inserts name requests into the sequence of events that the
kernel performs during connection creation. It does this after the
remote features have been successfully requested and before any pending
authentication requests are performed. The code will work sub-optimally
with userspace versions that still do the name requesting themselves (it
shouldn't break anything though) so it is recommended to combine this
with a userspace software version that doesn't have automated name
requests.
Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Thu, 18 Nov 2010 20:22:28 +0000 (22:22 +0200)]
Bluetooth: Create a unified authentication request function
This patch adds a single function that's responsible for requesting
authentication for outgoing connections. This is preparation for the
next patch which will add automated name requests and thereby move the
authentication requests to a different location.
Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Wed, 10 Nov 2010 15:11:51 +0000 (17:11 +0200)]
Bluetooth: Simplify remote features callback function logic
The current remote and remote extended features event callbacks logic
can be made simpler by using a label and goto statements instead of the
current multiple levels of nested if statements.
Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Stefan Seyfried [Tue, 30 Nov 2010 20:49:08 +0000 (21:49 +0100)]
Bluetooth: Fix log spamming in btusb due to autosuspend
If a device is autosuspended an inability to resubmit URBs is
to be expected. Check the error code and only log real errors.
(Now that autosuspend is default enabled for btusb, those log
messages were happening all the time e.g. with a BT mouse)
Signed-off-by: Stefan Seyfried <seife+kernel@b1-systems.com> Signed-off-by: Oliver Neukum <oneukum@suse.de> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Commit dbbf1755b09eef8ff6dd21c8dafe1606f051ce12 "iwlwifi: use
antenna information in EEPROM" caused 4965 device breakage with
"Microcode SW error detected. Restarting 0x82000000." message.
This patch reverts 4965 part of that commit.
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Acked-by: Johannes Berg <johannes@sipsolutions.net> Acked-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Helmut Schaa [Tue, 30 Nov 2010 11:19:34 +0000 (12:19 +0100)]
mac80211: Minor optimization in ieee80211_rx_h_data
Remove a superfluous ieee80211_is_data check as that was checked a few
lines before already and we wont't get here for non-data frames at all.
Second, the frame was already converted to 802.3 header format and
reading the fc and addr1 fields was only possible because the 802.3
header is short enough and didn't overwrite the relevant parts of the
802.11 header. Make the code more obvious by checking the ethernet
header's h_dest field.
Furthermore reorder the conditions to reduce the number of checks
when dynamic powersave is not needed (AP mode for example).
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com> Reviewed-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
All rt2x00 drivers except rt2800pci call ieee80211_tx_status() from
a workqueue, which causes "NOHZ: local_softirq_pending 08" messages.
To fix it, add ieee80211_tx_status_ni() similar to ieee80211_rx_ni()
which can be called from process context, and call it from
rt2x00lib_txdone(). For the rt2800pci special case a driver
flag is introduced.
Signed-off-by: Johannes Stezenbach <js@sig21.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Nick Kossifidis [Tue, 23 Nov 2010 19:53:28 +0000 (21:53 +0200)]
ath5k: Set turbo bit on rf bank 2
* A diff between rfbuffer settings of turbo and non-turbo
modes indicates there is a bit on bank 2 related to turbo operation
(it's set on turbo modes). This bit is present on all radios except
RF5413 that seems to have a completely different bank 2. Also
since 2317 has the same rf-registers locations with 2425 and
since the bit exists on 2317 I assume it also exists on 2425/2417).
So in case we use turbo mode (40MHz) enable it on bank modification.
Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Nick Kossifidis [Tue, 23 Nov 2010 19:51:38 +0000 (21:51 +0200)]
ath5k: Clean up turbo mode initvals/rfregs
* Clean up what's left of turbo mode, since we handle all
register modifications (rfbuffer comes next) on code there
is no need to have duplicated arrays.
* Rename change_channel to skip_pcu on initvals.c as we did
on reset.c
Signed-off-by: Nick Kossifidis <micklfemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Nick Kossifidis [Tue, 23 Nov 2010 19:45:21 +0000 (21:45 +0200)]
ath5k: Skip tx power setting on AR5210 for now
* Don't return -EINVAL when trying to set tx power
on RF5110 because AR5210 reset will fail. We need to
add support for RF5110 and AR5210 eeprom in the future
but for now just skip it.
Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Nick Kossifidis [Tue, 23 Nov 2010 19:42:22 +0000 (21:42 +0200)]
ath5k: No need to save/restore staid flags on reset
* Since we set antenna flags on phy init and ack bitrate
mode on pcu init, there is no need to save/restore sta_id
flags on ath5k_hw_reset. Also we don't need to re-set our
mac address because it's not affected by resets.
Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Nick Kossifidis [Tue, 23 Nov 2010 19:39:28 +0000 (21:39 +0200)]
ath5k: Support synth-only channel change for AR2413/AR5413
* Add synth-only channel change for AR2413/5413. When we call
ath5k_reset with a channel ath5k_hw_reset will first try to
set channel on PHY while PHY is running instead of doing a normal
full reset. To do this phy_init has to change to implement this
functionality.
* Clean up change_channel flag, what it really did was skip PCU
registers when setting initvals. This is done because on reset
PCU registers are not affected (except the registers we set
in pcu init and -due to hw problems- TSF). Use a new skip_pcu
flag that's not misleading instead. In the future we might use
that to also skip PCU reset and save us the TSF etc problems
(needs testing because standard practice is to reset everything).
* Use fast channel change only when setting channel, and set skip_pcu
to false only on init. When we reset the card due to DMA or PHY
problems skip pcu but never do a fast channel change.
Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Nick Kossifidis [Tue, 23 Nov 2010 19:19:45 +0000 (21:19 +0200)]
ath5k: Set all IFS intervals, not just slot time
* Replace set_slot_time with set_ifs_intervals that also sets
the various inter-frame space intervals based on current bwmode.
* Clean up AR5210 mess from reset_tx_queue, AR5210 only has one
data queue and we set IFS intervals for that queue on set_ifs_intervals
so there is nothing left to do for 5210 on reset_tx_queue.
Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Nick Kossifidis [Tue, 23 Nov 2010 19:12:23 +0000 (21:12 +0200)]
ath5k: Extend rate_duration
* Extend ieee80211_generic_frame_duration to support the various
bwmodes.
* Better document what's going on with ack bitrates and update
write_rate_duration to support the standard ack bitrates (when
we don't set the high bit).
* Get rid of set_ack_bitrate_high and introduce a flag on ath5k_hw
for this (we only called the function on init anyway so there is no
difference).
Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Nick Kossifidis [Tue, 23 Nov 2010 19:04:43 +0000 (21:04 +0200)]
ath5k: Increase PHY settling parameters for turo mode
* On turbo mode increase PHY settling times, note that
we only increase switch settling time on AR5212 as indicated
by initvals.
* A few cleanups: Move frame control settings for AR5210 from
reset_tx_queue to tweak_initvals and remove phy_scal settings
from tweak_initvals (we tweak them alread on set_sleep_clock).
Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Nick Kossifidis [Tue, 23 Nov 2010 19:02:20 +0000 (21:02 +0200)]
ath5k: Small cleanup on tweak_initvals
* Now that we properly set rx/tx latencies for AR5311 remove
that old buggy part of code left inside ath5k_hw_tweak_initval_settings
that was never executed (you can't have an RF5112 radio on a mac older
than AR5212). Also use a magic value for 5311 PHY_SCAL value.
Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Nick Kossifidis [Tue, 23 Nov 2010 18:58:34 +0000 (20:58 +0200)]
ath5k: Add new field on ath5k_hw to track bandwidth modes
* Prepare for half/quarter/turbo support, introduce a new
ah_bwmode parameter and get rid of ah_turbo. Bwmode stands
for "bandwidth mode" and can have 4 values, default (20MHz),
turbo (40MHz), half rate (10MHz), and quarter rate (5MHz).
Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Nick Kossifidis [Tue, 23 Nov 2010 18:55:17 +0000 (20:55 +0200)]
ath5k: Use new function to stop beacon queue
* Since we only use ath5k_hw_stop_tx_dma to stop the beacon
queue, introduce a new function ath5k_hw_stop_beacon_queue so
that we can use that instead and have better control. In the future
we can add more beacon queue specific stuff there (maybe tweak
beacon timers or something), for now just call ath5k_hw_stop_tx_dma.
* Also since we don't call ath5k_hw_stop_rx/tx_dma from outside
dma.c, make them static.
Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Nick Kossifidis [Tue, 23 Nov 2010 18:50:16 +0000 (20:50 +0200)]
ath5k: Use DCU early termination correctly
* DCU early termination should be used to quickly flush QCU
according to docs so don't enable it for all queues, enable
it only when stopping each queue and disable it when we are
done.
Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Nick Kossifidis [Tue, 23 Nov 2010 18:45:38 +0000 (20:45 +0200)]
ath5k: Use new dma_stop function on base.c
* Since we stop rx/tx dma and pcu durring reset there is no need to
call ath5k_hw_stop_rx/tx_dma before, also there is no need to call
them durring stop_locked since we can use ath5k_hw_dma_stop for
both.
Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Nick Kossifidis [Tue, 23 Nov 2010 18:43:18 +0000 (20:43 +0200)]
ath5k: Stop PCU on reset
* Stop PCU receive logic (DRU) durring reset
We need to be sure pcu is not active when trying to stop rx dma
right now this is done on ath5k_reset (base.c) but later we are
going to clean it up.
Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>