GitHub/LineageOS/android_kernel_motorola_exynos9610.git
12 years agoath5k: Fix range scaling when setting rate power table
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>
12 years agoath5k: Use correct value for min_pwr and cur_pwr
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>
12 years agobcma: make some functions static
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>
12 years agop54: parse output power table
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>
12 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth...
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

12 years agomwifiex: add AES_CMAC support in key_material cmd
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>
12 years agomwifiex: pass key_params pointer in mwifiex_set_encode
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>
12 years agomwifiex: rename wapi_rxpn to pn
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>
12 years agomwifiex: cleanup TX/RX BA tables for uAP
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>
12 years agomwifiex: add 11n Block Ack support for uAP
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>
12 years agomwifiex: support RX AMSDU aggregation for uAP
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>
12 years agomwifiex: improve uAP RX handling
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>
12 years agomwifiex: create list for associated stations in AP mode
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>
12 years agomwifiex: separate file for handling AP events
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>
12 years agomwifiex: update 11n status as per start_ap IE
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>
12 years agomwifiex: improve scan delay logic during Tx traffic
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>
12 years agomwifiex: update max_chan_per_scan correctly for SSID scan
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>
12 years agomwifiex: do le_to_cpu conversion for Rx packet header elements
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>
12 years agomwifiex: correction in MSDU padding logic
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>
12 years agomwifiex: remove extra padding to AMSDU
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>
12 years agomwifiex: copy MSDU subframes correctly
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>
12 years agoath9k: fix indentation in ar9003_hw_set_power_per_rate_table
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>
12 years agoath9k: optimize power level initialization for CTL_[25]GHT20
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>
12 years agocarl9170: Add support for NL80211_IFTYPE_MESH_POINT interfaces
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>
12 years agob43: N-PHY: add overriding RF control for rev7+
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>
12 years agob43: be more user friendly with PHY info
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>
12 years agob43: N-PHY: init 0x2057 radio
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>
12 years agob43: N-PHY: finish 0x2056 radio setup
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>
12 years agob43: add helper waiting for given value in radio reg
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>
12 years agob43: rename host flags defines
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>
12 years agop54pci: convert driver to use asynchronous firmware loading
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>
12 years agob43: N-PHY: add PHY rev7+ workarounds
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>
12 years agob43: N-PHY: update workarounds
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>
12 years agobrcmsmac: use ieee80211_channel_to_frequency
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>
12 years agoBluetooth: Refactor in hci_le_conn_complete_evt
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>
12 years agoBluetooth: Lookup hci_conn in hci_le_conn_complete_evt
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>
12 years agoBluetooth: Find hci_conn by BT_CONNECT state
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>
12 years agoBluetooth: Refactor hci_cs_le_create_conn
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>
12 years agoBluetooth: Remove unneeded code
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>
12 years agoBluetooth: Fix hci_le_conn_complete_evt
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>
12 years agoBluetooth: Trivial refactoring
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>
12 years agoBluetooth: Use devm_kzalloc in dtl1_cs.c file
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>
12 years agoBluetooth: Use devm_kzalloc in btwilink.c file
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>
12 years agoBluetooth: Use devm_kzalloc in btusb.c file
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>
12 years agoBluetooth: Use devm_kzalloc in btuart_cs.c file
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>
12 years agoBluetooth: Use devm_kzalloc in btsdio.c file
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>
12 years agoBluetooth: Use devm_kzalloc in btmrvl_sdio.c file
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>
12 years agoBluetooth: Use devm_kzalloc in bt3c_cs.c file
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>
12 years agoBluetooth: Use devm_kzalloc in bpa10x.c file
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>
12 years agoBluetooth: Use devm_kzalloc in bluecard_cs.c file
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>
12 years agoBluetooth: Use devm_kzalloc in bfusb.c file
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>
12 years agoBluetooth: Use devm_kzalloc in bcm203x.c file.
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>
12 years agoBluetooth: Added /proc/net/sco via bt_procfs_init()
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>
12 years agoBluetooth: Added /proc/net/rfcomm via bt_procfs_init()
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>
12 years agoBluetooth: Added /proc/net/l2cap via bt_procfs_init()
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>
12 years agoBluetooth: Added /proc/net/hidp via bt_procfs_init()
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>
12 years agoBluetooth: Added /proc/net/hci via bt_procfs_init()
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>
12 years agoBluetooth: Added /proc/net/cmtp via bt_procfs_init()
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>
12 years agoBluetooth: Added /proc/net/bnep via bt_procfs_init()
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>
12 years agoBluetooth: /proc/net/ entries for bluetooth protocols
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>
12 years agoBluetooth: Free the l2cap channel list only when refcount is zero
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>
12 years agoBluetooth: Move l2cap_chan_hold/put to l2cap_core.c
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>
12 years agoBluetooth: Remove locking in hci_user_passkey_request_evt
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>
12 years agoBluetooth: Make connect / disconnect cfm functions return void
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>
12 years agoBluetooth: Use lmp_no_flush_capable where applicable
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>
12 years agoBluetooth: Use lmp_sniffsubr_capable where applicable
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>
12 years agoBluetooth: Use lmp_sniff_capable where applicable
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>
12 years agoBluetooth: Use lmp_rswitch_capable where applicable
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>
12 years agoBluetooth: Use lmp_esco_capable where applicable
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>
12 years agoBluetooth: Use lmp_ssp_capable where applicable
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>
12 years agoBluetooth: Use lmp_le_capable where applicable
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>
12 years agoBluetooth: Use lmp_bredr_capable where applicable
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>
12 years agoBluetooth: Fix processing A2MP chan in security_cfm
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>
12 years agoBluetooth: Do not shadow hdr variable
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>
12 years agoBluetooth: Define AMP controller statuses
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>
12 years agoBluetooth: trivial: Fix mixing spaces and tabs in smp
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>
12 years agoBluetooth: debug: Fix printing refcnt for hci_conn
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>
12 years agoBluetooth: debug: Fix printing A2MP cmd code format
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>
12 years agoBluetooth: mgmt: Managing only BR/EDR HCI controllers
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>
12 years agoBluetooth: Remove missing code
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>
12 years agoipv4: Properly purge netdev references on uncached routes.
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>
12 years agoipv4: Cache routes in nexthop exception entries.
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>
12 years agoipv4: percpu nh_rth_output cache
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>
12 years agoipv4: Restore old dst_free() behavior.
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>
12 years agobridge: make port attributes const
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>
12 years agoipv4: remove rt_cache_rebuild_count
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>
12 years agonet: ipv4: fix RCU races on dst refcounts
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>
12 years agonet: TCP early demux cleanup
Eric Dumazet [Sun, 29 Jul 2012 21:06:13 +0000 (21:06 +0000)]
net: TCP early demux cleanup

early_demux() handlers should be called in RCU context, and as we
use skb_dst_set_noref(skb, dst), caller must not exit from RCU context
before dst use (skb_dst(skb)) or release (skb_drop(dst))

Therefore, rcu_read_lock()/rcu_read_unlock() pairs around
->early_demux() are confusing and not needed :

Protocol handlers are already in an RCU read lock section.
(__netif_receive_skb() does the rcu_read_lock() )

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 years agotun: Fix formatting.
David S. Miller [Mon, 30 Jul 2012 21:52:48 +0000 (14:52 -0700)]
tun: Fix formatting.

Signed-off-by: David S. Miller <davem@davemloft.net>
12 years agonet/tun: fix ioctl() based info leaks
Mathias Krause [Sun, 29 Jul 2012 19:45:14 +0000 (19:45 +0000)]
net/tun: fix ioctl() based info leaks

The tun module leaks up to 36 bytes of memory by not fully initializing
a structure located on the stack that gets copied to user memory by the
TUNGETIFF and SIOCGIFHWADDR ioctl()s.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 years agotg3: Update version to 3.124
Michael Chan [Sun, 29 Jul 2012 19:15:45 +0000 (19:15 +0000)]
tg3: Update version to 3.124

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 years agotg3: Fix race condition in tg3_get_stats64()
Michael Chan [Sun, 29 Jul 2012 19:15:44 +0000 (19:15 +0000)]
tg3: Fix race condition in tg3_get_stats64()

Spinlock should be taken before checking for tp->hw_stats.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 years agotg3: Add New 5719 Read DMA workaround
Michael Chan [Sun, 29 Jul 2012 19:15:43 +0000 (19:15 +0000)]
tg3: Add New 5719 Read DMA workaround

After Power-on-reset, the 5719's TX DMA length registers may contain
uninitialized values and cause TX DMA to stall.  Check for invalid
values and set a register bit to flush the TX channels.  The bit
needs to be turned off after the DMA channels have been flushed.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 years agotg3: Fix Read DMA workaround for 5719 A0.
Michael Chan [Sun, 29 Jul 2012 19:15:42 +0000 (19:15 +0000)]
tg3: Fix Read DMA workaround for 5719 A0.

The workaround was mis-applied to all 5719 and 5720 chips.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 years agotg3: Request APE_LOCK_PHY before PHY access
Michael Chan [Sun, 29 Jul 2012 19:15:41 +0000 (19:15 +0000)]
tg3: Request APE_LOCK_PHY before PHY access

to prevent PHY access conflict with APE firmware.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 years agoipv6: fix incorrect route 'expires' value passed to userspace
Li Wei [Sun, 29 Jul 2012 16:01:30 +0000 (16:01 +0000)]
ipv6: fix incorrect route 'expires' value passed to userspace

When userspace use RTM_GETROUTE to dump route table, with an already
expired route entry, we always got an 'expires' value(2147157)
calculated base on INT_MAX.

The reason of this problem is in the following satement:
rt->dst.expires - jiffies < INT_MAX
gcc promoted the type of both sides of '<' to unsigned long, thus
a small negative value would be considered greater than INT_MAX.

With the help of Eric Dumazet, do the out of bound checks in
rtnl_put_cacheinfo(), _after_ conversion to clock_t.

Signed-off-by: Li Wei <lw@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 years agomISDN: Bugfix only few bytes are transfered on a connection
Karsten Keil [Sun, 29 Jul 2012 07:15:13 +0000 (07:15 +0000)]
mISDN: Bugfix only few bytes are transfered on a connection

The test for the fillempty condition was wrong in one place.
Changed the variable to the right boolean type.

Signed-off-by: Karsten Keil <keil@b1-systems.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 years agoseeq: use PTR_RET at init_module of driver
Devendra Naga [Sun, 29 Jul 2012 03:28:47 +0000 (03:28 +0000)]
seeq: use PTR_RET at init_module of driver

the driver sees wether the dev_seeq pointer is having a error that can be
read by using the PTR_ERR, and returns it at error case, other wise 0 at
success case.

the PTR_RET does the same thing, and use PTR_RET instead of redoing the
code of PTR_RET

Signed-off-by: Devendra Naga <develkernel412222@gmail.com>
Acked-by: David Howells <dhowells@redhat.com>
Reviewed-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 years agobnx2x: remove cast around the kmalloc in bnx2x_prev_mark_path
Devendra Naga [Sun, 29 Jul 2012 03:19:23 +0000 (03:19 +0000)]
bnx2x: remove cast around the kmalloc in bnx2x_prev_mark_path

casting the void pointer is redundant (Documentation/CodingStyle)

Signed-off-by: Devendra Naga <develkernel412222@gmail.com>
Acked-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 years agoipv4: clean up put_child
Lin Ming [Sun, 29 Jul 2012 02:00:03 +0000 (02:00 +0000)]
ipv4: clean up put_child

The first parameter struct trie *t is not used anymore.
Remove it.

Signed-off-by: Lin Ming <mlin@ss.pku.edu.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>