Sujith Manoharan [Fri, 10 Aug 2012 11:15:52 +0000 (16:45 +0530)]
ath9k: Simplify rate table initialization
Remove various local variables that duplicate information
already stored in mac80211.
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Dan Carpenter [Thu, 9 Aug 2012 06:57:57 +0000 (09:57 +0300)]
mwifiex: use GFP_ATOMIC under spin lock
We're holding the sta_list_spinlock here so we can't sleep.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Amitkumar Karwar [Thu, 9 Aug 2012 02:02:56 +0000 (19:02 -0700)]
mwifiex: notify cfg80211 about MIC failures
Call cfg80211_michael_mic_failure() handler when there is a MIC error
event from firmware.
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Bing Zhao [Thu, 9 Aug 2012 02:01:52 +0000 (19:01 -0700)]
mwifiex: fix 'smatch' warning in preparing key_material cmd
The key length can be 32 bytes for TKIP and 16 bytes for AES_CMAC.
'smatch' warns on memcpy using key_len variable to copy data to
a 16 bytes buffer. Use fixed length to avoid the warning.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Rafał Miłecki [Wed, 8 Aug 2012 17:37:04 +0000 (19:37 +0200)]
ssb: check for flash presentence
We can not assume parallel flash is always present, there are boards
with *serial* flash and probably some without flash at all.
Define some bits by the way.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Reviewed-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Rafał Miłecki [Wed, 8 Aug 2012 17:10:16 +0000 (19:10 +0200)]
b43legacy: fix logic in GPIO init
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Rafał Miłecki [Wed, 8 Aug 2012 17:10:15 +0000 (19:10 +0200)]
b43: N-PHY: fix 0x2057 radio calib copy/paste mistake
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Rafał Miłecki [Wed, 8 Aug 2012 17:10:14 +0000 (19:10 +0200)]
bcma: add (mostly) NAND defines
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Bing Zhao [Tue, 7 Aug 2012 23:08:08 +0000 (16:08 -0700)]
mwifiex: fix powerpc64-linux- compilation warnings
These warnings can be detected by using powerpc64-linux toolchain
(gcc-4.6.3-nolibc).
CC [M] drivers/net/wireless/mwifiex/sta_event.o
drivers/net/wireless/mwifiex/sta_event.c: In function 'mwifiex_process_sta_event':
drivers/net/wireless/mwifiex/sta_event.c:388:4: warning: comparison of distinct pointer types lacks a cast [enabled by default]
CC [M] drivers/net/wireless/mwifiex/uap_event.o
drivers/net/wireless/mwifiex/uap_event.c: In function 'mwifiex_process_uap_event':
drivers/net/wireless/mwifiex/uap_event.c:258:11: warning: comparison of distinct pointer types lacks a cast [enabled by default]
Use min_t() instead of min() to fix the warnings.
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Johannes Berg [Tue, 7 Aug 2012 19:46:44 +0000 (21:46 +0200)]
iwlegacy: clean up suspend/resume
There's no need to export the il_pci_suspend
and il_pci_resume functions since they're only
referenced from il_pm_ops. The latter can also
be defined using SIMPLE_DEV_PM_OPS instead of
open-coding it.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Fengguang Wu [Tue, 7 Aug 2012 02:26:53 +0000 (10:26 +0800)]
mwifiex: fix code mis-alignment after the if statement
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Acked-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Nick Kossifidis [Sun, 5 Aug 2012 19:35:36 +0000 (22:35 +0300)]
ath5k: Put power_level where it belongs and rename it
Put power_level to ah_txpower struct with the rest tx power infos and
also rename it to txp_requested to make more sense.
v2 make sure we don't memset it to zero on reset
Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Nick Kossifidis [Sun, 5 Aug 2012 19:35:35 +0000 (22:35 +0300)]
ath5k: Preserve tx power level requested from above on phy_init
By using cur_pwr on phy_init we re-use the power level previously set by the
driver, not the one we got from above.
Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Nick Kossifidis [Sun, 5 Aug 2012 19:35:34 +0000 (22:35 +0300)]
ath5k: Fix range scaling when setting rate power table
rates[i] is unsigned but txp_offset can be negative for newer parts
with PDADC table. We cover the case when rates[i] + txp_offset > 63
but we must also cover the case when its < 0 or else rates[i] will overflow.
Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Nick Kossifidis [Sun, 5 Aug 2012 19:35:33 +0000 (22:35 +0300)]
ath5k: Use correct value for min_pwr and cur_pwr
Make sure we don't store the table offsets for min and cur power levels,
store the 0.25dB values instead. This way we don't clamp the tx power level
to max (because now cur_pwr holds the 0.25dB value, not the table offset) after
re-using cur_pwr on reset.
Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Hauke Mehrtens [Sun, 5 Aug 2012 14:54:41 +0000 (16:54 +0200)]
bcma: make some functions static
The functions and structs are not used in an other file and the
prototypes are in no header file, just make them static so the compiler
is able to optimize them better.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Christian Lamparter [Sat, 28 Jul 2012 00:57:51 +0000 (02:57 +0200)]
p54: parse output power table
For the upcoming tpc changes, the driver needs
to provide sensible max output values for each
supported channel.
And while the eeprom always had a output_limit
table, which defines the upper limit for each
frequency and modulation, it was never really
useful for anything... until now.
Note: For anyone wondering about what your card
is calibrated for: check "iw list".
* 2412 MHz [1] (18.0 dBm)
* 2437 MHz [6] (19.0 dBm)
[...]
* 5180 MHz [36] (18.0 dBm)
* 5260 MHz [52] (17.0 dBm) (radar detection)
* 5680 MHz [136] (19.0 dBm) (radar detection)
(for a Dell Wireless 1450 USB Adapter)
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
John W. Linville [Fri, 10 Aug 2012 19:13:12 +0000 (15:13 -0400)]
Merge branch 'master' of git://git./linux/kernel/git/bluetooth/bluetooth-next
Ying Luo [Sat, 4 Aug 2012 01:06:14 +0000 (18:06 -0700)]
mwifiex: add AES_CMAC support in key_material cmd
The sequence counter will be sent to firmware via key_material
command.
Signed-off-by: Ying Luo <luoy@marvell.com>
Signed-off-by: Stone Piao <piaoyun@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Ying Luo [Sat, 4 Aug 2012 01:06:13 +0000 (18:06 -0700)]
mwifiex: pass key_params pointer in mwifiex_set_encode
'cipher' and 'seq' coming from cfg80211 add_key handler will be
parsed in mwifiex_set_encode() to handle AES_CMAC cipher suite.
Signed-off-by: Ying Luo <luoy@marvell.com>
Signed-off-by: Stone Piao <piaoyun@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Ying Luo [Sat, 4 Aug 2012 01:06:12 +0000 (18:06 -0700)]
mwifiex: rename wapi_rxpn to pn
This array was used for wapi_rxpn only. Now it will be used for
AES_CMAC as well. So make a generic name for it.
Signed-off-by: Ying Luo <luoy@marvell.com>
Signed-off-by: Stone Piao <piaoyun@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Avinash Patil [Sat, 4 Aug 2012 01:06:11 +0000 (18:06 -0700)]
mwifiex: cleanup TX/RX BA tables for uAP
Cleanup TX/RX BA tables when AP receives deauthentication from
associated station. During BSS_IDLE event, all wmm queues, BA
streams created for AP interface are deleted.
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Avinash Patil [Sat, 4 Aug 2012 01:06:10 +0000 (18:06 -0700)]
mwifiex: add 11n Block Ack support for uAP
This patch adds support for handling BA request and BA setup
events for AP interface.
RA list is marked as either 11n enabled or disabled from station's
capabilities in association request. BA setup is initiated only
after some specific number of packets for particular RA list are
transmitted.
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Avinash Patil [Sat, 4 Aug 2012 01:06:09 +0000 (18:06 -0700)]
mwifiex: support RX AMSDU aggregation for uAP
This patch adds support for reception and decoding of AMSDU
aggregation frames for AP interface.
Patch also adds support for handling AMSDU aggregation event.
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Avinash Patil [Sat, 4 Aug 2012 01:06:08 +0000 (18:06 -0700)]
mwifiex: improve uAP RX handling
1. Separate file for uAP RX handling.
2. If received packet is broadcast/multicast, send it to kernel
as well as requeue it back to uAP TX queue.
3. If received packet is for associated STA (intra-BSS), requeue
it back to uAP TX queue.
4. In all other cases (packets for AP or inter-BSS packets),
pass packet to kernel to handle it accordingly.
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Avinash Patil [Sat, 4 Aug 2012 01:06:07 +0000 (18:06 -0700)]
mwifiex: create list for associated stations in AP mode
After station is associated an entry would be added to station
list. This entry would have station specific information such as
11n support, AMSDU size. The entry would be deleted after
deauthentication. All station entries would be deleted during
BSS_IDLE event.
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Avinash Patil [Sat, 4 Aug 2012 01:06:06 +0000 (18:06 -0700)]
mwifiex: separate file for handling AP events
Route AP events handling to separate function defined in
uap_event.c.
AP specific event handling is removed from sta_event.c.
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Avinash Patil [Sat, 4 Aug 2012 01:06:05 +0000 (18:06 -0700)]
mwifiex: update 11n status as per start_ap IE
If HT IE is present in beacon_data of start_ap cfg80211 handler,
enable 11n flag in AP. Disable 11n flag when stop_ap handler is
called.
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Amitkumar Karwar [Sat, 4 Aug 2012 01:06:04 +0000 (18:06 -0700)]
mwifiex: improve scan delay logic during Tx traffic
Earlier scan command was postponed by 20msec multiple times to give
preference to Tx traffic until we find empty wmm queue.
There is a corner case in which wmm queue becomes empty immediately
after processing the packet(before 20msec) and there may be next
packet coming after some time. In this case we should not resume scan
operation.
We will use new flag to check Tx traffic and resume scan operation
only if there is no traffic for 200msec.
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Amitkumar Karwar [Sat, 4 Aug 2012 01:06:03 +0000 (18:06 -0700)]
mwifiex: update max_chan_per_scan correctly for SSID scan
As per recent patch "658f37b mwifiex: scan less channels..."
less channels are scanned per scan command in associated state.
Default number of channels per scan command for normal scan are
already 4, but those are 14 for SSID specific scan operation.
This code change in this patch is required for SSID specific scan.
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Amitkumar Karwar [Sat, 4 Aug 2012 01:06:02 +0000 (18:06 -0700)]
mwifiex: do le_to_cpu conversion for Rx packet header elements
We do similar conversion for Tx packet header but it was missing
for Rx packet header. Without this fix, Rx packet header won't
be correctly parsed on big endian platform.
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Yogesh Ashok Powar [Sat, 4 Aug 2012 01:06:01 +0000 (18:06 -0700)]
mwifiex: correction in MSDU padding logic
Padding arithmetic will always work for MSDUs provided first MSDU
ends on 4-byte boundary. Fixing it by making sure that all MSDU ends
on 4-byte boundary.
Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Yogesh Ashok Powar [Sat, 4 Aug 2012 01:06:00 +0000 (18:06 -0700)]
mwifiex: remove extra padding to AMSDU
Since commit:
fb3c19bc9687d972b83faf366b38ac807eca8f25, adding
extra padding to AMSDU is redundant since same is being performed at
mwifiex_11n_aggregate_pkt after forming the AMSDU packet. Fixing it
by removing it.
Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Yogesh Ashok Powar [Sat, 4 Aug 2012 01:05:59 +0000 (18:05 -0700)]
mwifiex: copy MSDU subframes correctly
All MSDU subframes, except the first one in AMSDU, were being written
wrongly at the location of first MSDU frame. Fixing that by copying
the MSDU at skb->tail of AMSDU.
Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Gabor Juhos [Thu, 2 Aug 2012 14:00:52 +0000 (16:00 +0200)]
ath9k: fix indentation in ar9003_hw_set_power_per_rate_table
The current indentation is off by one tab.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Gabor Juhos [Thu, 2 Aug 2012 14:00:51 +0000 (16:00 +0200)]
ath9k: optimize power level initialization for CTL_[25]GHT20
The first part of the power array is initialized in a loop
and the last two values are initialized separately. Extend
the loop to cover the last two items, and remove the separate
initialization.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Javier Lopez [Fri, 27 Jul 2012 18:27:25 +0000 (11:27 -0700)]
carl9170: Add support for NL80211_IFTYPE_MESH_POINT interfaces
This patch contains following modifications:
- Add mesh capabilities on fw.c to permit creation of mesh
interfaces using this driver.
- Modify carl9170_set_operating_mode, to use AP-style beaconing
with mesh interfaces.
- Allow beacon updates for NL80211_IFTYPE_MESH_POINT type in
carl9170_handle_command_response.
- Add NL80211_IFTYPE_MESH_POINT case on carl9170_op_add_interfaces to
support mesh/ap/sta virtual interface combinations.
Signed-off-by: Javier Lopez <jlopex@cozybit.com>
Acked-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Rafał Miłecki [Thu, 26 Jul 2012 08:25:09 +0000 (10:25 +0200)]
b43: N-PHY: add overriding RF control for rev7+
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Rafał Miłecki [Thu, 26 Jul 2012 06:16:01 +0000 (08:16 +0200)]
b43: be more user friendly with PHY info
First of all, use PHY names instead of magic numbers. It should make
configuring kernel easier in case of not enabled PHY type support.
Secondly, always print info about PHY. This is really basic info about
hardware and quite important for the support level.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Rafał Miłecki [Wed, 25 Jul 2012 22:07:39 +0000 (00:07 +0200)]
b43: N-PHY: init 0x2057 radio
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Rafał Miłecki [Wed, 25 Jul 2012 22:07:38 +0000 (00:07 +0200)]
b43: N-PHY: finish 0x2056 radio setup
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Rafał Miłecki [Wed, 25 Jul 2012 22:07:37 +0000 (00:07 +0200)]
b43: add helper waiting for given value in radio reg
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Rafał Miłecki [Wed, 25 Jul 2012 14:58:38 +0000 (16:58 +0200)]
b43: rename host flags defines
There are more than 3 registers on new hardware. Host flags handling has
to be rewritten, as we can't use u128 type to handle all 5 regs.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Larry Finger [Tue, 24 Jul 2012 19:16:42 +0000 (21:16 +0200)]
p54pci: convert driver to use asynchronous firmware loading
Drivers that load firmware from their probe routine have problems with the
latest versions of udev as they get timeouts while waiting for user
space to start. The problem is fixed by using request_firmware_nowait()
and delaying the start of mac80211 until the firmware is loaded.
To prevent the possibility of the driver being unloaded while the firmware
loading callback is still active, a completion queue entry is used.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Rafał Miłecki [Tue, 24 Jul 2012 17:18:20 +0000 (19:18 +0200)]
b43: N-PHY: add PHY rev7+ workarounds
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Rafał Miłecki [Tue, 24 Jul 2012 17:18:19 +0000 (19:18 +0200)]
b43: N-PHY: update workarounds
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Johannes Berg [Tue, 24 Jul 2012 15:35:57 +0000 (17:35 +0200)]
brcmsmac: use ieee80211_channel_to_frequency
Instead of hard-coding almost the same functionality,
just use ieee80211_channel_to_frequency() directly.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Andre Guedes [Fri, 27 Jul 2012 18:10:16 +0000 (15:10 -0300)]
Bluetooth: Refactor in hci_le_conn_complete_evt
This patch moves the hci_conn check to begining of hci_le_conn_
complete_evt in order to improve code's readability and better
error handling.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Andre Guedes [Fri, 27 Jul 2012 18:10:15 +0000 (15:10 -0300)]
Bluetooth: Lookup hci_conn in hci_le_conn_complete_evt
This patch does a trivial code refactoring in hci_conn lookup in
hci_le_conn_complete_evt. It performs the hci_conn lookup at the
begining of the function since it is used by both flows (error
and success).
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Andre Guedes [Fri, 27 Jul 2012 18:10:14 +0000 (15:10 -0300)]
Bluetooth: Find hci_conn by BT_CONNECT state
This patch changes hci_cs_le_create_conn to perform hci_conn lookup
by state instead of bdaddr.
Since we can have only one LE connection in BT_CONNECT state, we can
perform LE hci_conn lookup by state. This way, we don't rely on
hci_sent_cmd_data helper to find the hci_conn object.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Andre Guedes [Fri, 27 Jul 2012 18:10:13 +0000 (15:10 -0300)]
Bluetooth: Refactor hci_cs_le_create_conn
This patch does some code refactoring in hci_cs_le_create_conn
function. The hci_conn object is only needed in case of failure,
therefore hdev locking and hci_conn lookup were moved to
if-statement scope.
Also, the conn->state check was removed since we should always
close the connection if it fails.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Andre Guedes [Fri, 27 Jul 2012 18:10:12 +0000 (15:10 -0300)]
Bluetooth: Remove unneeded code
This patch removes some unneeded code from hci_cs_le_create_conn.
If the hci_conn is not found, it means this LE connection attempt
was triggered by a thrid-party tool (e.g. hcitool). We should not
create this new hci_conn in LE Create Connection command status
event since it is already properly handled in LE Connection
Complete event.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Andre Guedes [Fri, 27 Jul 2012 18:10:11 +0000 (15:10 -0300)]
Bluetooth: Fix hci_le_conn_complete_evt
We need to check the 'Role' parameter from the LE Connection
Complete Event in order to properly set 'out' and 'link_mode'
fields from hci_conn structure.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Andre Guedes [Fri, 27 Jul 2012 18:10:10 +0000 (15:10 -0300)]
Bluetooth: Trivial refactoring
This patch replaces the unlock-and-return statements by the goto
statement.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Sachin Kamat [Fri, 27 Jul 2012 07:08:41 +0000 (12:38 +0530)]
Bluetooth: Use devm_kzalloc in dtl1_cs.c file
devm_kzalloc() eliminates the need to free memory explicitly
thereby saving some cleanup code.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Sachin Kamat [Fri, 27 Jul 2012 07:08:40 +0000 (12:38 +0530)]
Bluetooth: Use devm_kzalloc in btwilink.c file
devm_kzalloc() eliminates the need to free memory explicitly
thereby saving some cleanup code.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Sachin Kamat [Fri, 27 Jul 2012 07:08:39 +0000 (12:38 +0530)]
Bluetooth: Use devm_kzalloc in btusb.c file
devm_kzalloc() eliminates the need to free memory explicitly
thereby saving some cleanup code.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Sachin Kamat [Fri, 27 Jul 2012 07:08:38 +0000 (12:38 +0530)]
Bluetooth: Use devm_kzalloc in btuart_cs.c file
devm_kzalloc() eliminates the need to free memory explicitly
thereby saving some cleanup code.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Sachin Kamat [Fri, 27 Jul 2012 07:08:37 +0000 (12:38 +0530)]
Bluetooth: Use devm_kzalloc in btsdio.c file
devm_kzalloc() eliminates the need to free memory explicitly
thereby saving some cleanup code.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Sachin Kamat [Fri, 27 Jul 2012 07:08:36 +0000 (12:38 +0530)]
Bluetooth: Use devm_kzalloc in btmrvl_sdio.c file
devm_kzalloc() eliminates the need to free memory explicitly
thereby saving some cleanup code.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Sachin Kamat [Fri, 27 Jul 2012 07:08:35 +0000 (12:38 +0530)]
Bluetooth: Use devm_kzalloc in bt3c_cs.c file
devm_kzalloc() eliminates the need to free memory explicitly
thereby saving some cleanup code.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Sachin Kamat [Fri, 27 Jul 2012 07:08:34 +0000 (12:38 +0530)]
Bluetooth: Use devm_kzalloc in bpa10x.c file
devm_kzalloc() eliminates the need to free memory explicitly
thereby saving some cleanup code.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Sachin Kamat [Fri, 27 Jul 2012 07:08:33 +0000 (12:38 +0530)]
Bluetooth: Use devm_kzalloc in bluecard_cs.c file
devm_kzalloc() eliminates the need to free memory explicitly
thereby saving some cleanup code.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Sachin Kamat [Fri, 27 Jul 2012 07:08:32 +0000 (12:38 +0530)]
Bluetooth: Use devm_kzalloc in bfusb.c file
devm_kzalloc() eliminates the need to free memory explicitly
thereby saving some cleanup code.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Sachin Kamat [Fri, 27 Jul 2012 07:08:31 +0000 (12:38 +0530)]
Bluetooth: Use devm_kzalloc in bcm203x.c file.
devm_kzalloc() eliminates the need to free memory explicitly
thereby saving some cleanup code.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Masatake YAMATO [Wed, 25 Jul 2012 16:30:12 +0000 (01:30 +0900)]
Bluetooth: Added /proc/net/sco via bt_procfs_init()
Added /proc/net/sco via bt_procfs_init().
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Masatake YAMATO [Wed, 25 Jul 2012 16:29:49 +0000 (01:29 +0900)]
Bluetooth: Added /proc/net/rfcomm via bt_procfs_init()
Added /proc/net/rfcomm via bt_procfs_init().
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Masatake YAMATO [Wed, 25 Jul 2012 16:29:25 +0000 (01:29 +0900)]
Bluetooth: Added /proc/net/l2cap via bt_procfs_init()
Added /proc/net/l2cap via bt_procfs_init().
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Masatake YAMATO [Wed, 25 Jul 2012 16:29:00 +0000 (01:29 +0900)]
Bluetooth: Added /proc/net/hidp via bt_procfs_init()
Added /proc/net/hidp via bt_procfs_init().
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Masatake YAMATO [Wed, 25 Jul 2012 16:28:36 +0000 (01:28 +0900)]
Bluetooth: Added /proc/net/hci via bt_procfs_init()
Added /proc/net/hci via bt_procfs_init().
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Masatake YAMATO [Wed, 25 Jul 2012 16:28:07 +0000 (01:28 +0900)]
Bluetooth: Added /proc/net/cmtp via bt_procfs_init()
Added /proc/net/cmtp via bt_procfs_init().
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Masatake YAMATO [Wed, 25 Jul 2012 16:27:35 +0000 (01:27 +0900)]
Bluetooth: Added /proc/net/bnep via bt_procfs_init()
Added /proc/net/bnep via bt_procfs_init().
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Masatake YAMATO [Wed, 25 Jul 2012 16:26:32 +0000 (01:26 +0900)]
Bluetooth: /proc/net/ entries for bluetooth protocols
lsof command can tell the type of socket processes are using.
Internal lsof uses inode numbers on socket fs to resolve the type of
sockets. Files under /proc/net/, such as tcp, udp, unix, etc provides
such inode information.
Unfortunately bluetooth related protocols don't provide such inode
information. This patch series introduces /proc/net files for the protocols.
This patch against af_bluetooth.c provides facility to the implementation
of protocols. This patch extends bt_sock_list and introduces two exported
function bt_procfs_init, bt_procfs_cleanup.
The type bt_sock_list is already used in some of implementation of
protocols. bt_procfs_init prepare seq_operations which converts
protocol own bt_sock_list data to protocol own proc entry when the
entry is accessed.
What I, lsof user, need is just inode number of bluetooth
socket. However, people may want more information. The bt_procfs_init
takes a function pointer for customizing the show handler of
seq_operations.
In v4 patch, __acquires and __releases attributes are added to suppress
sparse warning. Suggested by Andrei Emeltchenko.
In v5 patch, linux/proc_fs.h is included to use PDE. Build error is
reported by Fengguang Wu.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Jaganath Kanakkassery [Fri, 13 Jul 2012 12:47:55 +0000 (18:17 +0530)]
Bluetooth: Free the l2cap channel list only when refcount is zero
Move the l2cap channel list chan->global_l under the refcnt
protection and free it based on the refcnt.
Signed-off-by: Jaganath Kanakkassery <jaganath.k@samsung.com>
Signed-off-by: Syam Sidhardhan <s.syam@samsung.com>
Reviewed-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Jaganath Kanakkassery [Fri, 13 Jul 2012 12:47:54 +0000 (18:17 +0530)]
Bluetooth: Move l2cap_chan_hold/put to l2cap_core.c
Refactor the code in order to use the l2cap_chan_destroy()
from l2cap_chan_put() under the refcnt protection.
Signed-off-by: Jaganath Kanakkassery <jaganath.k@samsung.com>
Signed-off-by: Syam Sidhardhan <s.syam@samsung.com>
Reviewed-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Andre Guedes [Mon, 23 Jul 2012 21:19:04 +0000 (18:19 -0300)]
Bluetooth: Remove locking in hci_user_passkey_request_evt
This patch removes hdev locking in hci_user_passkey_request_evt
since it is not needed. mgmt_user_passkey_request simply calls
mgmt_event which does not require hdev locking at all.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Andrei Emeltchenko [Tue, 24 Jul 2012 13:06:15 +0000 (16:06 +0300)]
Bluetooth: Make connect / disconnect cfm functions return void
Return values are never used because callers hci_proto_connect_cfm
and hci_proto_disconn_cfm return void.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Andre Guedes [Tue, 24 Jul 2012 18:03:53 +0000 (15:03 -0300)]
Bluetooth: Use lmp_no_flush_capable where applicable
This patch replaces all LMP_NO_FLUSH bit checking by the helper
macro lmp_no_flush_capable.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Andre Guedes [Tue, 24 Jul 2012 18:03:52 +0000 (15:03 -0300)]
Bluetooth: Use lmp_sniffsubr_capable where applicable
This patch replaces all LMP_SNIFF_SUBR bit checking by the helper
macro lmp_sniffsubr_capable.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Andre Guedes [Tue, 24 Jul 2012 18:03:51 +0000 (15:03 -0300)]
Bluetooth: Use lmp_sniff_capable where applicable
This patch replaces all LMP_SNIFF bit checking by the helper macro
lmp_sniff_capable.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Andre Guedes [Tue, 24 Jul 2012 18:03:50 +0000 (15:03 -0300)]
Bluetooth: Use lmp_rswitch_capable where applicable
This patch replaces all LMP_RSWITCH bit checking by the helper macro
lmp_rswitch_capable.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Andre Guedes [Tue, 24 Jul 2012 18:03:49 +0000 (15:03 -0300)]
Bluetooth: Use lmp_esco_capable where applicable
This patch replaces all LMP_ESCO bit checking by the helper macro
lmp_esco_capable.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Andre Guedes [Tue, 24 Jul 2012 18:03:48 +0000 (15:03 -0300)]
Bluetooth: Use lmp_ssp_capable where applicable
This patch replaces all LMP_SIMPLE_PAIR bit checking by the helper
macro lmp_ssp_capable.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Andre Guedes [Tue, 24 Jul 2012 18:03:47 +0000 (15:03 -0300)]
Bluetooth: Use lmp_le_capable where applicable
This patch replaces all LMP_LE bit checking by the helper macro
lmp_le_capable.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Andre Guedes [Tue, 24 Jul 2012 18:03:46 +0000 (15:03 -0300)]
Bluetooth: Use lmp_bredr_capable where applicable
This patch replaces all LMP_NO_BREDR bit checking by the helper
macro lmp_bredr_capable.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Andrei Emeltchenko [Thu, 19 Jul 2012 14:03:47 +0000 (17:03 +0300)]
Bluetooth: Fix processing A2MP chan in security_cfm
Do not process A2MP channel in l2cap_security_cfm
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Andrei Emeltchenko [Thu, 19 Jul 2012 14:03:46 +0000 (17:03 +0300)]
Bluetooth: Do not shadow hdr variable
Fix compile warnings below:
...
net/bluetooth/a2mp.c:505:33: warning: symbol 'hdr' shadows an earlier one
net/bluetooth/a2mp.c:498:25: originally declared here
...
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Andrei Emeltchenko [Thu, 19 Jul 2012 14:03:45 +0000 (17:03 +0300)]
Bluetooth: Define AMP controller statuses
AMP status codes copied from Bluez patch sent by Peter Krystad
<pkrystad@codeaurora.org>.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Andrei Emeltchenko [Thu, 19 Jul 2012 14:03:44 +0000 (17:03 +0300)]
Bluetooth: trivial: Fix mixing spaces and tabs in smp
Change spaces to tabs in smp code
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Andrei Emeltchenko [Thu, 19 Jul 2012 14:03:42 +0000 (17:03 +0300)]
Bluetooth: debug: Fix printing refcnt for hci_conn
Use the same style for refcnt printing through all Bluetooth code
taking the reference the l2cap_chan refcnt printing.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Andrei Emeltchenko [Thu, 19 Jul 2012 14:03:41 +0000 (17:03 +0300)]
Bluetooth: debug: Fix printing A2MP cmd code format
Print A2MP code format according to Bluetooth style.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Andrei Emeltchenko [Thu, 19 Jul 2012 14:03:40 +0000 (17:03 +0300)]
Bluetooth: mgmt: Managing only BR/EDR HCI controllers
Add check that HCI controller is BR/EDR. AMP controller shall not be
managed by mgmt interface and consequently user space.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Andre Guedes [Thu, 19 Jul 2012 14:46:13 +0000 (11:46 -0300)]
Bluetooth: Remove missing code
This patch removes the struct adv_entry since it is not used anymore.
This struct should have been removed in commit 479453d (Bluetooth:
Remove advertising cache).
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
David S. Miller [Tue, 31 Jul 2012 22:06:50 +0000 (15:06 -0700)]
ipv4: Properly purge netdev references on uncached routes.
When a device is unregistered, we have to purge all of the
references to it that may exist in the entire system.
If a route is uncached, we currently have no way of accomplishing
this.
So create a global list that is scanned when a network device goes
down. This mirrors the logic in net/core/dst.c's dst_ifdown().
Signed-off-by: David S. Miller <davem@davemloft.net>
David S. Miller [Tue, 31 Jul 2012 22:02:02 +0000 (15:02 -0700)]
ipv4: Cache routes in nexthop exception entries.
Signed-off-by: David S. Miller <davem@davemloft.net>
Eric Dumazet [Tue, 31 Jul 2012 05:45:30 +0000 (05:45 +0000)]
ipv4: percpu nh_rth_output cache
Input path is mostly run under RCU and doesnt touch dst refcnt
But output path on forwarding or UDP workloads hits
badly dst refcount, and we have lot of false sharing, for example
in ipv4_mtu() when reading rt->rt_pmtu
Using a percpu cache for nh_rth_output gives a nice performance
increase at a small cost.
24 udpflood test on my 24 cpu machine (dummy0 output device)
(each process sends 1.000.000 udp frames, 24 processes are started)
before : 5.24 s
after : 2.06 s
For reference, time on linux-3.5 : 6.60 s
Signed-off-by: Eric Dumazet <edumazet@google.com>
Tested-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Eric Dumazet [Tue, 31 Jul 2012 01:08:23 +0000 (01:08 +0000)]
ipv4: Restore old dst_free() behavior.
commit
404e0a8b6a55 (net: ipv4: fix RCU races on dst refcounts) tried
to solve a race but added a problem at device/fib dismantle time :
We really want to call dst_free() as soon as possible, even if sockets
still have dst in their cache.
dst_release() calls in free_fib_info_rcu() are not welcomed.
Root of the problem was that now we also cache output routes (in
nh_rth_output), we must use call_rcu() instead of call_rcu_bh() in
rt_free(), because output route lookups are done in process context.
Based on feedback and initial patch from David Miller (adding another
call_rcu_bh() call in fib, but it appears it was not the right fix)
I left the inet_sk_rx_dst_set() helper and added __rcu attributes
to nh_rth_output and nh_rth_input to better document what is going on in
this code.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
stephen hemminger [Mon, 30 Jul 2012 08:55:49 +0000 (08:55 +0000)]
bridge: make port attributes const
Simple table that can be marked const.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Eric Dumazet [Mon, 30 Jul 2012 07:14:29 +0000 (07:14 +0000)]
ipv4: remove rt_cache_rebuild_count
After IP route cache removal, rt_cache_rebuild_count is no longer
used.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Eric Dumazet [Sun, 29 Jul 2012 23:20:37 +0000 (23:20 +0000)]
net: ipv4: fix RCU races on dst refcounts
commit
c6cffba4ffa2 (ipv4: Fix input route performance regression.)
added various fatal races with dst refcounts.
crashes happen on tcp workloads if routes are added/deleted at the same
time.
The dst_free() calls from free_fib_info_rcu() are clearly racy.
We need instead regular dst refcounting (dst_release()) and make
sure dst_release() is aware of RCU grace periods :
Add DST_RCU_FREE flag so that dst_release() respects an RCU grace period
before dst destruction for cached dst
Introduce a new inet_sk_rx_dst_set() helper, using atomic_inc_not_zero()
to make sure we dont increase a zero refcount (On a dst currently
waiting an rcu grace period before destruction)
rt_cache_route() must take a reference on the new cached route, and
release it if was not able to install it.
With this patch, my machines survive various benchmarks.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>