cascardo/linux.git
9 years agoBluetooth: Fix sparse warning in amp.c
Johan Hedberg [Mon, 10 Nov 2014 13:53:45 +0000 (15:53 +0200)]
Bluetooth: Fix sparse warning in amp.c

This fixes the following sparse warning:

net/bluetooth/amp.c:152:53: warning: Variable length array is used.

The warning itself is probably harmless since this kind of usage of
shash_desc is present also in other places in the kernel (there's even a
convenience macro SHASH_DESC_ON_STACK available for defining such stack
variables). However, dynamically allocated versions are also used in
several places of the kernel (e.g. kernel/kexec.c and lib/digsig.c)
which have the benefit of not exhibiting the sparse warning.

Since there are no more sparse warnings in the Bluetooth subsystem after
fixing this one it is now easier to spot whenever new ones might get
introduced by future patches.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agomac802154: protect address changes via ioctl
Alexander Aring [Sun, 9 Nov 2014 07:36:59 +0000 (08:36 +0100)]
mac802154: protect address changes via ioctl

This patch adds a netif_running check while trying to change the address
attributes via ioctl. While netif_running is true these attributes
should be only readable.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: fix iface dump with lowpan
Alexander Aring [Sun, 9 Nov 2014 07:36:58 +0000 (08:36 +0100)]
ieee802154: fix iface dump with lowpan

This patch adds a hacked solution for an interface dump with a running
lowpan interface. This will crash because lowpan and wpan interface use
the same arphdr. To change the arphdr will change the UAPI, this patch
checks on mtu which should on lowpan interface always different than
IEEE802154_MTU.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: netlink add rtnl lock
Alexander Aring [Sun, 9 Nov 2014 07:36:57 +0000 (08:36 +0100)]
ieee802154: netlink add rtnl lock

This patch adds rtnl lock hold mechanism while accessing wpan_dev
attributes. Furthermore these attributes should be protected by rtnl
lock and netif_running only.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agomac820154: don't set monitor dev_addr
Alexander Aring [Sun, 9 Nov 2014 07:36:56 +0000 (08:36 +0100)]
mac820154: don't set monitor dev_addr

This patch removes the setting of dev_addr on a monitor device. This
address should be zero. A monitor should only sniff and send raw frames
out. The address should be never used by upper layers and receiving
frame parsing.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: add wpan_dev dump support
Alexander Aring [Sun, 9 Nov 2014 07:36:55 +0000 (08:36 +0100)]
ieee802154: add wpan_dev dump support

This patch adds support for wpan_dev dump via nl802154 framework.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: add wpan_phy dump support
Alexander Aring [Sun, 9 Nov 2014 07:36:54 +0000 (08:36 +0100)]
ieee802154: add wpan_phy dump support

This patch adds support for dumping wpan_phy attributes via nl802154.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: add nl802154 framework
Alexander Aring [Sun, 9 Nov 2014 07:36:53 +0000 (08:36 +0100)]
ieee802154: add nl802154 framework

This patch adds a basic nl802154 framework. Most of this code was
grabbed from nl80211 framework.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: add new nl802154 header
Alexander Aring [Sun, 9 Nov 2014 07:36:52 +0000 (08:36 +0100)]
ieee802154: add new nl802154 header

This patch adds the new userspace header for nl802154. We don't place
this header in include/uapi now. This header could be modified in the
next time.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: sysfs add wpan_phy index and name
Alexander Aring [Sun, 9 Nov 2014 07:36:51 +0000 (08:36 +0100)]
ieee802154: sysfs add wpan_phy index and name

This patch adds new sysfs entries for wpan_phy index and name. This
needed for the new 802.15.4 userspace tool.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: add wpan_dev_list
Alexander Aring [Sun, 9 Nov 2014 07:36:50 +0000 (08:36 +0100)]
ieee802154: add wpan_dev_list

This patch adds a wpan_dev_list list into cfg802154_registered_device
struct. Also adding new wpan_dev into this list while
cfg802154_netdev_notifier_call. This behaviour is mostly grab from
wireless core.c implementation and is needed for preparing nl802154
framework.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: add iftype to wpan_dev
Alexander Aring [Sun, 9 Nov 2014 07:36:49 +0000 (08:36 +0100)]
ieee802154: add iftype to wpan_dev

This patch adds an iftype argument to the wpan_dev. This is needed to
get the interface type from netdev ieee802154_ptr. The subif data struct
can only accessible in mac802154 branch.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: add cfg802154_registered_device list
Alexander Aring [Sun, 9 Nov 2014 07:36:48 +0000 (08:36 +0100)]
ieee802154: add cfg802154_registered_device list

This patch adds a new cfg802154_rdev_list to remember all registered
cfg802154_registered_device structs. This is needed to prepare the
upcomming nl802154 framework.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: rename wpan_phy_alloc
Alexander Aring [Sun, 9 Nov 2014 07:36:47 +0000 (08:36 +0100)]
ieee802154: rename wpan_phy_alloc

This patch renames the wpan_phy_alloc function to wpan_phy_new. This
naming convention is like wireless and "wiphy_new" function.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agomac802154: remove mac_params in sdata
Alexander Aring [Sun, 9 Nov 2014 07:36:46 +0000 (08:36 +0100)]
mac802154: remove mac_params in sdata

This patch removes the mac_params from subif data struct. Instead we
manipulate the wpan attributes directly.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agomac802154: move mac pib attributes into wpan_dev
Alexander Aring [Sun, 9 Nov 2014 07:36:45 +0000 (08:36 +0100)]
mac802154: move mac pib attributes into wpan_dev

This patch moves all mac pib attributes into the wpan_dev struct.
Furthermore we can easier access these attributes over the netdev
802154_ptr pointer. Currently this is only possible over a complicated
callback structure in mac802154 because subif data structure is
accessable inside mac802154 only.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: 6lowpan: fix skb_unshare behaviour
Alexander Aring [Wed, 8 Oct 2014 08:24:53 +0000 (10:24 +0200)]
Bluetooth: 6lowpan: fix skb_unshare behaviour

This patch reverts commit:

a7807d73 ("Bluetooth: 6lowpan: Avoid memory leak if memory allocation
fails")

which was wrong suggested by Alexander Aring. The function skb_unshare
run also kfree_skb on failure.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Cc: stable@vger.kernel.org # 3.18.x
9 years agoBluetooth: Send mgmt_connected only if state is BT_CONFIG
Jaganath Kanakkassery [Fri, 7 Nov 2014 11:09:09 +0000 (16:39 +0530)]
Bluetooth: Send mgmt_connected only if state is BT_CONFIG

If a remote name request is initiated while acl connection is going on,
and if it fails then mgmt_connected will be sent. Evetually after acl
connection, authentication will not be initiated and userspace will
never get pairing reply.

< HCI Command: Create Connection (0x01|0x0005) plen 13
    bdaddr AA:BB:CC:DD:EE:FF ptype 0xcc18 rswitch 0x01 clkoffset 0x2306 (valid)
    Packet type: DM1 DM3 DM5 DH1 DH3 DH5
> HCI Event: Command Status (0x0f) plen 4
    Create Connection (0x01|0x0005) status 0x00 ncmd 1
> HCI Event: Inquiry Complete (0x01) plen 1
    status 0x00
< HCI Command: Remote Name Request (0x01|0x0019) plen 10
    bdaddr AA:BB:CC:DD:EE:FF mode 1 clkoffset 0x2306
> HCI Event: Command Status (0x0f) plen 4
    Remote Name Request (0x01|0x0019) status 0x0c ncmd 1
    Error: Command Disallowed
> HCI Event: Connect Complete (0x03) plen 11
    status 0x00 handle 50 bdaddr 00:0D:FD:47:53:B2 type ACL encrypt 0x00
< HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2
    handle 50
> HCI Event: Command Status (0x0f) plen 4
    Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 1
> HCI Event: Max Slots Change (0x1b) plen 3
    handle 50 slots 5
> HCI Event: Read Remote Supported Features (0x0b) plen 11
    status 0x00 handle 50
    Features: 0xff 0xff 0x8f 0xfe 0x9b 0xff 0x59 0x83
< HCI Command: Read Remote Extended Features (0x01|0x001c) plen 3
    handle 50 page 1
> HCI Event: Command Status (0x0f) plen 4
    Read Remote Extended Features (0x01|0x001c) status 0x00 ncmd 1
> HCI Event: Read Remote Extended Features (0x23) plen 13
    status 0x00 handle 50 page 1 max 1
    Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00

This patch sends mgmt_connected in remote name command status only if
conn->state is BT_CONFIG

Signed-off-by: Jaganath Kanakkassery <jaganath.k@samsung.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years ago6lowpan: move skb_free from error paths in decompression
Martin Townsend [Thu, 6 Nov 2014 19:15:13 +0000 (19:15 +0000)]
6lowpan: move skb_free from error paths in decompression

Currently we ensure that the skb is freed on every error path in IPHC
decompression which makes it easy to introduce skb leaks.  By centralising
the skb_free into the receive function it makes future decompression routines
easier to maintain.  It does come at the expense of ensuring that the skb
passed into the decompression routine must not be copied.

Signed-off-by: Martin Townsend <mtownsend1973@gmail.com>
Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Sort switch cases by opcode's numeric value
Kuba Pawlak [Thu, 6 Nov 2014 18:36:53 +0000 (19:36 +0100)]
Bluetooth: Sort switch cases by opcode's numeric value

Opcodes in switch/case in hci_cmd_status_evt are not sorted
by value. This patch restores proper ordering.

Signed-off-by: Kuba Pawlak <kubax.t.pawlak@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Clear role switch pending flag
Kuba Pawlak [Thu, 6 Nov 2014 18:36:52 +0000 (19:36 +0100)]
Bluetooth: Clear role switch pending flag

If role switch was rejected by the controller and HCI Event: Command Status
returned with status "Command Disallowed" (0x0C) the flag
HCI_CONN_RSWITCH_PEND remains set. No further role switches are
possible as this flag prevents us from sending any new HCI Switch Role
requests and the only way to clear it is to receive a valid
HCI Event Switch Role.

This patch clears the flag if command was rejected.

2013-01-01 00:03:44.209913 < HCI Command: Switch Role (0x02|0x000b) plen 7
    bdaddr BC:C6:DB:C4:6F:79 role 0x00
    Role: Master
2013-01-01 00:03:44.210867 > HCI Event: Command Status (0x0f) plen 4
    Switch Role (0x02|0x000b) status 0x0c ncmd 1
    Error: Command Disallowed

Signed-off-by: Kuba Pawlak <kubax.t.pawlak@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoat86rf230: fix simple_return.cocci warnings
Fengguang Wu [Thu, 6 Nov 2014 07:31:57 +0000 (15:31 +0800)]
at86rf230: fix simple_return.cocci warnings

drivers/net/ieee802154/at86rf230.c:1365:1-3: WARNING: end returns can be simpified

 Simplify a trivial if-return sequence.  Possibly combine with a
 preceding function call.
Generated by: scripts/coccinelle/misc/simple_return.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agomac802154: fix typo promisuous to promiscuous
Alexander Aring [Wed, 5 Nov 2014 19:51:29 +0000 (20:51 +0100)]
mac802154: fix typo promisuous to promiscuous

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agomac802154: use IEEE802154_EXTENDED_ADDR_LEN
Alexander Aring [Wed, 5 Nov 2014 19:51:28 +0000 (20:51 +0100)]
mac802154: use IEEE802154_EXTENDED_ADDR_LEN

This patch removes the af_ieee802154 defines and use the
IEEE802154_EXTENDED_ADDR_LEN. We should do this everywhere in the
802.15.4 subsystem because af_ieee802154 should be normally an uapi
header.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoat86rf230: add force slotted operation bit
Alexander Aring [Wed, 5 Nov 2014 19:51:27 +0000 (20:51 +0100)]
at86rf230: add force slotted operation bit

This patch adds a force setting of slotted operation bit. The atben
chips sometimes set these bit. The reason is unknown. Nevertheless we
don't support slotted operation so we set this bit now force while
probing.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoat86rf230: generate random perm extended address
Alexander Aring [Wed, 5 Nov 2014 19:51:26 +0000 (20:51 +0100)]
at86rf230: generate random perm extended address

This patch adds support for a random generated perm extended address for
the at86rf230 driver.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agomac802154: add support for perm_extended_addr
Alexander Aring [Wed, 5 Nov 2014 19:51:25 +0000 (20:51 +0100)]
mac802154: add support for perm_extended_addr

This patch adding support for a perm extended address. This is useful
when a device supports an eeprom with a programmed static extended address.
If a device doesn't support such eeprom or serial registers then the
driver should generate a random extended address.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agomac802154: cleanup ieee802154_netdev_to_extended_addr
Alexander Aring [Wed, 5 Nov 2014 19:51:24 +0000 (20:51 +0100)]
mac802154: cleanup ieee802154_netdev_to_extended_addr

This patch cleanups the ieee802154_be64_to_le64 to have a similar
function like ieee802154_le64_to_be64 only with switched source and
destionation types.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agomac802154: add ieee802154_le64_to_be64
Alexander Aring [Wed, 5 Nov 2014 19:51:23 +0000 (20:51 +0100)]
mac802154: add ieee802154_le64_to_be64

This patch adds a new function to convert a le64 to a be64. This is
useful to translate an extended address to a netdev dev_addr.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: add ieee802154_random_extended_addr
Alexander Aring [Wed, 5 Nov 2014 19:51:22 +0000 (20:51 +0100)]
ieee802154: add ieee802154_random_extended_addr

This patch adds a new function to generate a random IEEE 802.15.4
extended address.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: add IEEE802154_EXTENDED_ADDR_LEN
Alexander Aring [Wed, 5 Nov 2014 19:51:21 +0000 (20:51 +0100)]
ieee802154: add IEEE802154_EXTENDED_ADDR_LEN

This patch adds a new define for getting the length of an extended
address.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agomac802154: add ieee802154_vif struct
Alexander Aring [Wed, 5 Nov 2014 19:51:20 +0000 (20:51 +0100)]
mac802154: add ieee802154_vif struct

This patch adds an ieee802154_vif similar like the ieee80211_vif which
holds the interface type and maybe further more attributes like the
ieee80211_vif structure.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Cc: Varka Bhadram <varkabhadram@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agomac802154: add default interface registration
Alexander Aring [Wed, 5 Nov 2014 19:51:19 +0000 (20:51 +0100)]
mac802154: add default interface registration

This patch adds a default interface registration for a wpan interface
type. Currently the 802.15.4 subsystem need to call userspace tools to
add an interface. This patch is like mac80211 handling for registration
a station interface type by default.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: remove mlme get_phy callback
Alexander Aring [Wed, 5 Nov 2014 19:51:18 +0000 (20:51 +0100)]
ieee802154: remove mlme get_phy callback

This patch removes the get_phy callback from mlme ops structure. Instead
we doing a dereference via ieee802154_ptr dev pointer. For backwards
compatibility we need to run get_device after dereference wpan_phy via
ieee802154_ptr.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: rework interface registration
Alexander Aring [Wed, 5 Nov 2014 19:51:17 +0000 (20:51 +0100)]
ieee802154: rework interface registration

This patch meld mac802154_netdev_register into ieee802154_if_add
function. Also we have now only one alloc_netdev call with one interface
setup routine "ieee802154_if_setup" instead two different one for each
interface type. This patch checks via runtime the interface type and do
different handling now. Additional we add the wpan_dev struct in
ieee802154_sub_if_data and set the new ieee802154_ptr while netdev
registration. This behaviour is very similar the mac80211 netdev
registration functionality.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agomac802154: move dev_hold out of ieee802154_if_add
Alexander Aring [Wed, 5 Nov 2014 19:51:16 +0000 (20:51 +0100)]
mac802154: move dev_hold out of ieee802154_if_add

This patch moves the dev_hold call inside of nl-phy ieee802154_add_iface
function. The ieee802154_add_iface is the only one function which use the
ieee802154_if_add function and contains the corresponding dev_put call.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agomac802154: move interface add handling in iface
Alexander Aring [Wed, 5 Nov 2014 19:51:15 +0000 (20:51 +0100)]
mac802154: move interface add handling in iface

This patch moves and renames the mac802154_add_iface and
mac802154_netdev_register functions into iface.c. The function
mac802154_add_iface is renamed to ieee802154_if_add which is a similar naming
convention like mac80211.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agomac802154: move interface del handling in iface
Alexander Aring [Wed, 5 Nov 2014 19:51:14 +0000 (20:51 +0100)]
mac802154: move interface del handling in iface

This patch moves and rename the mac802154_del_iface function into
iface.c and rename the function to ieee802154_if_remove which is a similar
naming convention like mac80211.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: remove nl802154 unused functions
Alexander Aring [Wed, 5 Nov 2014 19:51:13 +0000 (20:51 +0100)]
ieee802154: remove nl802154 unused functions

The include/net/nl802154.h file contains a lot of prototypes which are
not used inside of ieee802154 subsystem. This patch removes this file
and make the only one used prototype "ieee802154_nl_start_confirm" as
static declaration in ieee802154/nl-mac.c

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: rework wpan_phy index assignment
Alexander Aring [Wed, 5 Nov 2014 19:51:12 +0000 (20:51 +0100)]
ieee802154: rework wpan_phy index assignment

This patch reworks the wpan_phy index incrementation. It's now similar
like wireless wiphy index incrementation. We move the wpan_phy index
attribute inside of cfg802154_registered_device and use atomic
operations instead locking mechanism via wpan_phy_mutex.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: || vs && in ieee802154_is_valid_extended_addr()
Dan Carpenter [Tue, 4 Nov 2014 08:55:09 +0000 (11:55 +0300)]
ieee802154: || vs && in ieee802154_is_valid_extended_addr()

The ieee802154_is_valid_extended_addr() always returns true because
there is a typo.  The || should be &&.  Neither 0x0000000000000000ULL
nor 0xffffffffffffffffULL are valid addresses.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years ago6lowpan: fix udp header compression when using raw sockets
Simon Vincent [Tue, 4 Nov 2014 15:29:51 +0000 (15:29 +0000)]
6lowpan: fix udp header compression when using raw sockets

If you use RAW sockets the transport header offset is not set by the
ipv6 stack so when we get to the udp header compression it does not
compress the right part of the packet.

This patch adds a check for this scenario and sets the transport
header offset.

Signed-off-by: Simon Vincent <simon.vincent@xsilon.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Fix sparse warnings in RFCOMM
Johan Hedberg [Tue, 4 Nov 2014 06:45:45 +0000 (08:45 +0200)]
Bluetooth: Fix sparse warnings in RFCOMM

This patch fixes the following sparse warnings in rfcomm/core.c:

net/bluetooth/rfcomm/core.c:391:16: warning: dubious: x | !y
net/bluetooth/rfcomm/core.c:546:24: warning: dubious: x | !y

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agonetdevice: add ieee802154_ptr to net_device
Alexander Aring [Sun, 2 Nov 2014 05:44:54 +0000 (06:44 +0100)]
netdevice: add ieee802154_ptr to net_device

This patch adds an ieee802154_ptr to the net_device structure.
Furthermore the 802.15.4 subsystem will introduce a nl802154 framework
which is similar like the nl80211 framework and a wpan_dev structure.
The wpan_dev structure will hold additional net_device attributes like
address options which are 802.15.4 specific. In the upcoming nl802154
implementation we will introduce a NL802154_FLAG_NEED_WPAN_DEV like
NL80211_FLAG_NEED_WDEV. For this flag an ieee802154_ptr in net_device is
needed. Additional we can access the wpan_dev attributes in upper layers
like IEEE 802.15.4 6LoWPAN easily. Current solution is a complicated
callback interface and getting these values over subif data structure
in mac802154.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Fix invalid response for 'Start Discovery' command
Szymon Janc [Mon, 3 Nov 2014 13:20:56 +0000 (14:20 +0100)]
Bluetooth: Fix invalid response for 'Start Discovery' command

According to Management Interface API 'Start Discovery' command should
generate a Command Complete event on failure. Currently kernel is
sending Command Status on early errors. This results in userspace
ignoring such event due to invalid size.

bluetoothd[28499]: src/adapter.c:trigger_start_discovery()
bluetoothd[28499]: src/adapter.c:cancel_passive_scanning()
bluetoothd[28499]: src/adapter.c:start_discovery_timeout()
bluetoothd[28499]: src/adapter.c:start_discovery_complete() status 0x0a
bluetoothd[28499]: Wrong size of start discovery return parameters

Reported-by: Jukka Taimisto <jtt@codenomicon.com>
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Add hci_conn_lookup_type() helper function
Marcel Holtmann [Mon, 3 Nov 2014 04:16:08 +0000 (05:16 +0100)]
Bluetooth: Add hci_conn_lookup_type() helper function

Some drivers require knowledge of what connection handle is assigned
to what connection link type (ACL or SCO/eSCO). Instead of having each
driver implement connection tracking, provide a simple helper function
for lookup of the link type.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: btusb: Add internal callback for USB bulk rx data
Marcel Holtmann [Mon, 3 Nov 2014 04:16:07 +0000 (05:16 +0100)]
Bluetooth: btusb: Add internal callback for USB bulk rx data

Some vendors require special handling of the rx data from the USB
bulk endpoints. For that case provide an internal callback that
can overwrite it with a custom receive function.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Consolidate whitelist debugfs entry into device_list
Marcel Holtmann [Sun, 2 Nov 2014 20:46:52 +0000 (21:46 +0100)]
Bluetooth: Consolidate whitelist debugfs entry into device_list

The debufs entry for the BR/EDR whitelist is confusing since there is
a controller debugfs entry with the name white_list and both are two
different things.

With the BR/EDR whitelist, the actual interface in use is the device
list and thus just include all values from the internal BR/EDR whitelist
in the device_list debugfs entry.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Set HCI_QUIRK_STRICT_DUPLICATE_FILTER for Broadcom devices
Marcel Holtmann [Sun, 2 Nov 2014 19:52:24 +0000 (20:52 +0100)]
Bluetooth: Set HCI_QUIRK_STRICT_DUPLICATE_FILTER for Broadcom devices

The Bluetooth controllers from Broadcom use a strict scanning filter
policy that filters based on Bluetooth device addresses and not on
RSSI. So tell the core about this.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Introduce HCI_QUIRK_STRICT_DUPLICATE_FILTER
Marcel Holtmann [Sun, 2 Nov 2014 19:52:23 +0000 (20:52 +0100)]
Bluetooth: Introduce HCI_QUIRK_STRICT_DUPLICATE_FILTER

Some vendors decide to use a strict duplicate filter policy that only
filters on Bluetooth device addresses. This means that when the RSSI
changes, these devices are not reported again. During discovery it is
useful to actually get the RSSI updates.

Since this is specific to each controller, add a new quirk setting
that allows drivers to tell the core what kind of filtering policy
the controller uses.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoieee802154: remove unnecessary functions
Alexander Aring [Sun, 2 Nov 2014 20:43:06 +0000 (21:43 +0100)]
ieee802154: remove unnecessary functions

This patch fixes commit c7420c367d63a7e1414e010afb52c3837fd9134e
("mac802154: move mac_params functions into mac_cmd"). The mac_params
functions wasn't deleted by this commit.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reported-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agomac802154: cfg: add missing include
Alexander Aring [Sun, 2 Nov 2014 20:43:05 +0000 (21:43 +0100)]
mac802154: cfg: add missing include

Running make C=2 occurs warning:

symbol 'mac802154_config_ops' was not declared. Should it be static?

This patch adds a missing include in cfg.c to solve this warning.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reported-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: sysfs: add missing include
Alexander Aring [Sun, 2 Nov 2014 20:43:04 +0000 (21:43 +0100)]
ieee802154: sysfs: add missing include

Running make C=2 occurs in warnings:

symbol 'wpan_phy_class' was not declared. Should it be static?
symbol 'wpan_phy_sysfs_init' was not declared. Should it be static?
symbol 'wpan_phy_sysfs_exit' wasnot declared. Should it be static?

This patch adds a missing include "sysfs.h" to solve these warnings.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reported-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agomac802154: fix byteorder issues
Alexander Aring [Sun, 2 Nov 2014 20:43:03 +0000 (21:43 +0100)]
mac802154: fix byteorder issues

Running make C=2 occurs these warnings:

cast from restricted __be64
incorrect type in argument 1 (different base types)
expected unsigned long long[unsigned] [usertype] val
got restricted __be64 [usertype]<noident>
cast from restricted __be64
cast to restricted __le64

This patch fix these warnings by forcing to __le64 type and using swabp64
instead swab64.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reported-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: fix byteorder issues
Alexander Aring [Sun, 2 Nov 2014 20:43:02 +0000 (21:43 +0100)]
ieee802154: fix byteorder issues

This patch fix byteorder issues which occurs because we compare __le64
with an host byteorder value. Simple add a cpu_to_le64 to convert the
host byteorder values to __le64.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reported-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: add missing ULL definition
Alexander Aring [Sun, 2 Nov 2014 20:43:01 +0000 (21:43 +0100)]
ieee802154: add missing ULL definition

Running make C=2 occurs warning:

constant 0xffffffffffffffff is so big it is unsigned long

This patch fix this warning by adding a ULL to the constant definitions.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reported-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Switch HCI H5 driver to use hci_reset_dev() function
Marcel Holtmann [Sun, 2 Nov 2014 07:15:39 +0000 (08:15 +0100)]
Bluetooth: Switch HCI H5 driver to use hci_reset_dev() function

Instead of having the driver generate the HCI Hardware Error event
manually, just call hci_reset_dev() to trigger the upper stack reset.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Add hci_reset_dev() for driver triggerd stack reset
Marcel Holtmann [Sun, 2 Nov 2014 07:15:38 +0000 (08:15 +0100)]
Bluetooth: Add hci_reset_dev() for driver triggerd stack reset

Some Bluetooth drivers require to reset the upper stack. To avoid having
all drivers send HCI Hardware Error events, provide a generic function
to wrap the reset functionality.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Introduce BT_BREDR and BT_LE config options
Marcel Holtmann [Sun, 2 Nov 2014 02:32:25 +0000 (03:32 +0100)]
Bluetooth: Introduce BT_BREDR and BT_LE config options

The current kernel options do not make it clear which modules are for
Bluetooth Classic (BR/EDR) and which are for Bluetooth Low Energy (LE).

To make it really clear, introduce BT_BREDR and BT_LE options with
proper dependencies into the different modules. Both new options
default to y to not create a regression with previous kernel config
files.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Use HCI_EV_HARDWARE_ERROR define for event payload
Marcel Holtmann [Sun, 2 Nov 2014 02:02:01 +0000 (03:02 +0100)]
Bluetooth: Use HCI_EV_HARDWARE_ERROR define for event payload

When constructing the event payload for the HCI_Hardware_Error event
message, use the HCI_EV_HARDWARE_ERROR define.

In addition rename the variables from hard_err to hw_err to clearly
indicate that this is about the hardware error and not a hard error.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Print error message for HCI_Hardware_Error event
Marcel Holtmann [Sun, 2 Nov 2014 01:56:41 +0000 (02:56 +0100)]
Bluetooth: Print error message for HCI_Hardware_Error event

When the HCI_Hardware_Error event is send by the controller or
injected by the driver, then at least print an error message.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Check status of command complete for HCI_Reset
Marcel Holtmann [Sun, 2 Nov 2014 01:45:58 +0000 (02:45 +0100)]
Bluetooth: Check status of command complete for HCI_Reset

When the HCI_Reset command returns, the status needs to be checked. It
is unlikely that HCI_Reset actually fails, but when it fails, it is a
bad idea to reset all values since the controller will have not reset
its values in that case.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoieee802154: 6lowpan: remove set of mac address
Alexander Aring [Sun, 2 Nov 2014 03:18:47 +0000 (04:18 +0100)]
ieee802154: 6lowpan: remove set of mac address

Currently the ieee802154 6lowpan interface operates on wpan interfaces
only. Setting the wpan mac address over 6lowpan interface is complex and
maybe we can't never do this. This patch removes the set of mac address
handling in ieee802154 6lowpan interface for now.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agomac802154: iface: add validation for extended address
Alexander Aring [Sun, 2 Nov 2014 03:18:46 +0000 (04:18 +0100)]
mac802154: iface: add validation for extended address

This patch use the validation function to check if an extended address
is valid or not while set the extended address.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: add extended address validation helper
Alexander Aring [Sun, 2 Nov 2014 03:18:45 +0000 (04:18 +0100)]
ieee802154: add extended address validation helper

This patch introduce an extended address validation helper to check if
an extended address is valid or not.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agomac802154: move phy settings into netlink receive
Alexander Aring [Sun, 2 Nov 2014 03:18:44 +0000 (04:18 +0100)]
mac802154: move phy settings into netlink receive

All PHY attributes should be directly set to the transceiver after netlink.
MAC attributes should be set by interface up. Currently the macparams
netlink cmd contains mixed attributes of phy and mac settings. This patch
moves all phy settings to the netlink receive function for setting macparams.
This is the only way which doesn't change the userspace API and keep the
deprecated netlink interface alive.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agomac802154: set panid address filter on ifup
Alexander Aring [Sun, 2 Nov 2014 03:18:43 +0000 (04:18 +0100)]
mac802154: set panid address filter on ifup

This patch moves the setting of hardware panid address filtering
inside of interface up instead doing it it directly inside of netlink
interface. The netlink call which can only be called when netif isn't
running sets only the necessary panid value in sdata. After an
interface up the address filter will be set with this value.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agomac802154: set short address filter on ifup
Alexander Aring [Sun, 2 Nov 2014 03:18:42 +0000 (04:18 +0100)]
mac802154: set short address filter on ifup

This patch moves the setting of hardware short address filtering
inside of interface up instead doing it it directly inside of netlink
interface. The netlink call which can only be called when netif isn't
running sets only the necessary short_addr value in sdata. After an
interface up the address filter will be set with this value.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agomac802154: set extended address filter on ifup
Alexander Aring [Sun, 2 Nov 2014 03:18:41 +0000 (04:18 +0100)]
mac802154: set extended address filter on ifup

This patch moves the setting of hardware extended address filtering
inside of interface up instead doing it directly inside of netlink interface.
Also we don't need to set the sdata extended attribute in netlink. This
is already done by ndo_set_mac_address of net_device_ops.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agomac802154: add helper for converting dev_addr
Alexander Aring [Sun, 2 Nov 2014 03:18:40 +0000 (04:18 +0100)]
mac802154: add helper for converting dev_addr

This patch adds a helper for converting the dev_addr attribute in
netdevice to __le64 type. The dev_addr attribute is a char pointer
and contains the extended address in big endian byte order.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: don't allow to change addr while netif_running
Alexander Aring [Sun, 2 Nov 2014 03:18:39 +0000 (04:18 +0100)]
ieee802154: don't allow to change addr while netif_running

This patch changes the actual behaviour for setting address attributes.
We should not change addresses while netif_running is true. Furthermore
when netif_running is running the address attributes becomes read only
and we can remove locking mechanism in receive and transmit hothpaths
of 802.15.4 subsystem.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agocfg802154: convert deprecated iface add and del
Alexander Aring [Sun, 2 Nov 2014 03:18:38 +0000 (04:18 +0100)]
cfg802154: convert deprecated iface add and del

This patch removes the wpan_phy callbacks for add and del an interface
on a phy. Instead we introduce deprecated cfg802154 callbacks for this.
Furthermore we introduce a new netlink interface nl802154 which use
different callbacks. The deprecated function is to have a backwards
compatibility with the current netlink interface.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: add helper wpan_phy_to_rdev function
Alexander Aring [Sun, 2 Nov 2014 03:18:37 +0000 (04:18 +0100)]
ieee802154: add helper wpan_phy_to_rdev function

This patch introduce a function to get the cfg802154_registered_device
from a wpan_phy.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agomac802154: introduce mac802154_config_ops
Alexander Aring [Sun, 2 Nov 2014 03:18:36 +0000 (04:18 +0100)]
mac802154: introduce mac802154_config_ops

This patch introduces mac802154_config_ops struct. Like wireless this
struct should be the only one interface between ieee802154 to mac802154
or possible HardMAC drivers.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agocfg802154: introduce cfg802154_registered_device
Alexander Aring [Sun, 2 Nov 2014 03:18:35 +0000 (04:18 +0100)]
cfg802154: introduce cfg802154_registered_device

This patch introduce the cfg802154_registered_device struct. Like
cfg80211_registered_device in wireless this should contain similar
functionality for cfg802154. This patch should not change any behaviour.
We just adds cfg802154_registered_device as container for wpan_phy struct.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoat86rf230: add default channel settings
Alexander Aring [Sun, 2 Nov 2014 03:18:34 +0000 (04:18 +0100)]
at86rf230: add default channel settings

This patch sets the reset state channels accoridng at86rf2xx datasheets.
We don't need to set the default page here which is zero on all chips.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: remove default channel settings
Alexander Aring [Sun, 2 Nov 2014 03:18:33 +0000 (04:18 +0100)]
ieee802154: remove default channel settings

This patch removes the default channel setting. A channel is always set
and there is no default channel setting according 802.15.4.

Drivers should set the default channel and page in probing routine. This
behaviour is currently a lack of all 802.15.4 drivers.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoat86rf230: fix page parameter constraints
Alexander Aring [Sun, 2 Nov 2014 03:18:32 +0000 (04:18 +0100)]
at86rf230: fix page parameter constraints

Since commit e37d2ec82a222f1819e7793a27bc052999a379fb ("mac802154: ops:
declare channel and page as u8") the page parameter can't be below zero.
This patch fix a kbuild test robot warning. Furthermore this check
should be removed and handled by netlink 802.15.4 interface.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Fix hci_sync missing wakeup interrupt
Chan-yeol Park [Fri, 31 Oct 2014 05:23:06 +0000 (14:23 +0900)]
Bluetooth: Fix hci_sync missing wakeup interrupt

__hci_cmd_sync_ev(), __hci_req_sync() could miss wake_up_interrupt from
hci_req_sync_complete() because hci_cmd_work() workqueue and its response
could be completed before they are ready to get the signal through
add_wait_queue(), set_current_state(TASK_INTERRUPTIBLE).

Signed-off-by: Chan-yeol Park <chanyeol.park@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agomwifiex: add cfg80211 dump_survey handler
Xinming Hu [Fri, 31 Oct 2014 10:38:27 +0000 (16:08 +0530)]
mwifiex: add cfg80211 dump_survey handler

This patch add cfg80211 dump_survey handler for mwifiex.
This handler will be called to report channel statistics
to cfg80211.

This in turn adds ACS support for mwifiex AP.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agomwifiex: channel statistics support for mwifiex
Avinash Patil [Fri, 31 Oct 2014 10:38:26 +0000 (16:08 +0530)]
mwifiex: channel statistics support for mwifiex

This patch adds support to record channel statistics during
scan. With extended scan, scan results are returned as events from
FW while channel statistics are part of scan command response.
We store these channel statistics in adapter.

Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Xinmin Hu <huxm@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agoMerge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetoot...
John W. Linville [Fri, 31 Oct 2014 20:05:31 +0000 (16:05 -0400)]
Merge branch 'for-upstream' of git://git./linux/kernel/git/bluetooth/bluetooth-next

9 years agoBluetooth: HCI H5 peer reset detection
Loic Poulain [Wed, 8 Oct 2014 14:54:28 +0000 (16:54 +0200)]
Bluetooth: HCI H5 peer reset detection

H5 Specification says:
If a SYNC message is received while in the Active State, it is
assumed that the peer device has reset. The local device should
therefore perform a full reset of the upper stack, and start Link
Establishment again at the Uninitialized State. Upon entering the
Active State, the first packet sent shall have its SEQ and ACK
numbers set to zero.

This patch resets the HCI H5 driver data/state to unitialized and
reports an HCI hardware error event to notify the upper stack that
HCI synchronization has been lost. H5 will be re-synchronized and
upper stack should generate an HCI Reset command.

Signed-off-by: Loic Poulain <loic.poulain@intel.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agortlwifi: rtl8821ae: Remove extra semicolons
Larry Finger [Thu, 30 Oct 2014 04:17:12 +0000 (23:17 -0500)]
rtlwifi: rtl8821ae: Remove extra semicolons

The kbuild test robot reports that there are extra semicolons in this
driver. All of them are caused by using "};" rather than "}" at the
end of a switch statement. This patch does not change any functionality.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Murilo Opsfelder Araujo <mopsfelder@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agobrcmsmac: expose 802.11 core statistics in debugfs
Arend van Spriel [Wed, 29 Oct 2014 15:02:51 +0000 (16:02 +0100)]
brcmsmac: expose 802.11 core statistics in debugfs

The 802.11 statistics obtained from the device can be retrieved
dumping the 'macstat' file in debugfs folder.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agobrcmsmac: fix statistic counter update function
Arend van Spriel [Wed, 29 Oct 2014 15:02:50 +0000 (16:02 +0100)]
brcmsmac: fix statistic counter update function

The 802.11 core statistics are retrieved from the core registers
but not stored. So the debug code was never triggered to give a
warning message on tx underruns or rx overflows. This patch fixes
this and assures the statistics are stored in the snapshot.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agocarl9170: Convert byte_rev_table uses to bitrev8
Joe Perches [Tue, 28 Oct 2014 21:18:58 +0000 (14:18 -0700)]
carl9170: Convert byte_rev_table uses to bitrev8

Use the inline function instead of directly indexing the array.

This allows some architectures with hardware instructions
for bit reversals to eliminate the array.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agowil6210: Add support for large packets
Vladimir Kondratiev [Tue, 28 Oct 2014 14:51:27 +0000 (16:51 +0200)]
wil6210: Add support for large packets

It is possible to configure driver using mtu_max module parameter
by setting it to value in range of 68..7920 inclusive.
This is sub-optimal performance-wise in case packet is larger than 1 page.
mtu_max default value is 2228.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agowil6210: improve dmesg for fw error handling
Vladimir Kondratiev [Tue, 28 Oct 2014 14:50:09 +0000 (16:50 +0200)]
wil6210: improve dmesg for fw error handling

In case of FW error, make it clear (in dmesg) what branch is taken
in the error recovery code.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agowil6210: prevent double disconnect command issuing
Vladimir Kondratiev [Tue, 28 Oct 2014 14:50:08 +0000 (16:50 +0200)]
wil6210: prevent double disconnect command issuing

Disconnect flow may be invoked either from upper layer request,
or from event reported by the firmware.

In case of firmware event, driver need to release resources for the station but
not send another disconnect WMI command.

In case of upper layer request, WMI_DISCONNECT_STA_CMDID command need to
be issued for the firmware to perform disconnect on the MAC layer. Eventually,
event is expected to confirm MAC disconnect, but it is better to not wait for
firmware event and release station resources immediately. FW may fail to
report disconnect for various reasons, so one could not rely on event always reported.

Introduce parameter to distinguish 2 cases above to prevent double WMI command
issuing.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agowil6210: reset flow updates
Vladimir Kondratiev [Tue, 28 Oct 2014 14:50:07 +0000 (16:50 +0200)]
wil6210: reset flow updates

As communicated with the firmware & hardware teams

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agowil6210: do not attempt FW recovery if interface is down
Vladimir Kondratiev [Tue, 28 Oct 2014 14:50:06 +0000 (16:50 +0200)]
wil6210: do not attempt FW recovery if interface is down

When interface is down, recovery flow should not be attempted.
Next ndo_open() will trigger target reset, that is FW recovery.

Doing recovery while interface is down cause internal "up", leaving
internal driver state in conflict with network stack. Then, when network
stack will call ndo_open(), kernel oops will be triggered.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agobrcmfmac: (clean) Move sdio related function.
Hante Meuleman [Tue, 28 Oct 2014 13:56:19 +0000 (14:56 +0100)]
brcmfmac: (clean) Move sdio related function.

prec_enq is a sdio specific function. Move it to sdio.c.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agobrcmfmac: (clean) Rename sdio related files.
Hante Meuleman [Tue, 28 Oct 2014 13:56:18 +0000 (14:56 +0100)]
brcmfmac: (clean) Rename sdio related files.

Rename sdio_host.h to sdio.h and dhd_sdio.c to sdio.c.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agobrcmfmac: (clean) Rename sdio related files.
Hante Meuleman [Tue, 28 Oct 2014 13:56:17 +0000 (14:56 +0100)]
brcmfmac: (clean) Rename sdio related files.

Rename sdio_host.h to sdio.h and dhd_sdio.c to sdio.c.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agobrcmfmac: (clean) Rename files wl_cfg80211 to cfg80211
Hante Meuleman [Tue, 28 Oct 2014 13:56:16 +0000 (14:56 +0100)]
brcmfmac: (clean) Rename files wl_cfg80211 to cfg80211

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agobrcmfmac: (clean) Rename dhd_common.c in common.c
Hante Meuleman [Tue, 28 Oct 2014 13:56:15 +0000 (14:56 +0100)]
brcmfmac: (clean) Rename dhd_common.c in common.c

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agobrcmfmac: (clean) Rename dhd_bus.h in bus.h
Hante Meuleman [Tue, 28 Oct 2014 13:56:14 +0000 (14:56 +0100)]
brcmfmac: (clean) Rename dhd_bus.h in bus.h

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agobrcmfmac: (clean) Rename files dhd_dbg to debug
Hante Meuleman [Tue, 28 Oct 2014 13:56:13 +0000 (14:56 +0100)]
brcmfmac: (clean) Rename files dhd_dbg to debug

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agobrcmfmac: (clean) Move tracepoint related function.
Hante Meuleman [Tue, 28 Oct 2014 13:56:12 +0000 (14:56 +0100)]
brcmfmac: (clean) Move tracepoint related function.

__brcmf_err is a tracepoint specific function. Move it to
tracepoint.c.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>