GitHub/LineageOS/android_kernel_motorola_exynos9610.git
10 years agomac802154: iface: remove assign to zero
Alexander Aring [Tue, 28 Oct 2014 17:21:28 +0000 (18:21 +0100)]
mac802154: iface: remove assign to zero

These variables should already be zero, so we remove the extra assign to
zero.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: add synchronization handling
Alexander Aring [Tue, 28 Oct 2014 17:21:27 +0000 (18:21 +0100)]
mac802154: add synchronization handling

This patch adds synchronization handling in start and stop driver ops
calls. This patch is mostly grab from mac80211 which was introduced by
commit ea77f12f2cc0f31168f2e0259e65a22202ac4dc2 ("mac80211: remove
tasklet enable/disable"). This is to be sure that we don't run into same
issues.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: move local started handling
Alexander Aring [Tue, 28 Oct 2014 17:21:26 +0000 (18:21 +0100)]
mac802154: move local started handling

This patch removes the current handling of started boolean. This is
actually dead code, because mac802154_netdev_register can't never be
called before ieee802154_register_hw. This means that local->started is
always be true when mac802154_netdev_register is called. Instead we
using this now like mac80211 to indicate that an instance of sdata is
running.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: rename running to started
Alexander Aring [Tue, 28 Oct 2014 17:21:25 +0000 (18:21 +0100)]
mac802154: rename running to started

This variable should be handled like ieee80211_local struct of mac80211.
We rename this variable to started now to have the same name convention.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: rework sdata state change to running
Alexander Aring [Tue, 28 Oct 2014 17:21:24 +0000 (18:21 +0100)]
mac802154: rework sdata state change to running

This patch reworks the handling for setting the state like mac80211. We
use bit's instead a bool variable. The mutex is not needed because it use
test and set bits which are atomic operations.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: remove driver ops in wpan-phy
Alexander Aring [Tue, 28 Oct 2014 17:21:23 +0000 (18:21 +0100)]
mac802154: remove driver ops in wpan-phy

This patch removes the driver ops callbacks inside of wpan_phy struct.
It was used to check if a phy supports this driver ops call. We do this
now via hardware flags.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: remove might_sleep from driver layer
Alexander Aring [Tue, 28 Oct 2014 17:21:22 +0000 (18:21 +0100)]
mac802154: remove might_sleep from driver layer

This patch removes all might_sleep calls from driver layer. This
handling is already done by mac802154 layer.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: use driver-ops function wrappers
Alexander Aring [Tue, 28 Oct 2014 17:21:21 +0000 (18:21 +0100)]
mac802154: use driver-ops function wrappers

This patch replaces all directly called driver ops by previous
introduced driver-ops function wrappers.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: introduce driver-ops header
Alexander Aring [Tue, 28 Oct 2014 17:21:20 +0000 (18:21 +0100)]
mac802154: introduce driver-ops header

This patch introduce a driver-ops header file with function wrappers to
call the driver ops. These wrappers checking on right context
information and warn if optional driver ops are called when these aren't
implemented. This behaviour is like mac80211 driver-ops header file,
just without function tracing calls.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: ops: declare channel and page as u8
Alexander Aring [Tue, 28 Oct 2014 17:21:19 +0000 (18:21 +0100)]
mac802154: ops: declare channel and page as u8

The range of channel and page fits into an unsigned byte range. This
patch changes the set_channel parameter definitions for channel and
page to u8.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Cc: Alan Ott <alan@signal11.us>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: declare struct ieee802154_ops as const
Alexander Aring [Tue, 28 Oct 2014 17:21:18 +0000 (18:21 +0100)]
mac802154: declare struct ieee802154_ops as const

The ieee802154_ops structure should be never changed during runtime.
This patch declare this structure as const to avoid a runtime change.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Cc: Alan Ott <alan@signal11.us>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: main: move open and close into iface
Alexander Aring [Tue, 28 Oct 2014 17:21:17 +0000 (18:21 +0100)]
mac802154: main: move open and close into iface

These functions can be static inside the iface file, because it's not
used anywhere else. This patch moves these functions into iface file.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: monitor: merge into iface implementation
Alexander Aring [Tue, 28 Oct 2014 17:21:16 +0000 (18:21 +0100)]
mac802154: monitor: merge into iface implementation

This patch removes the monitor implementation file and put all monitor
stuff into iface file. It's now small enough to put all necessary
handling into iface.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Fix check for direct advertising
Johan Hedberg [Tue, 28 Oct 2014 21:23:27 +0000 (22:23 +0100)]
Bluetooth: Fix check for direct advertising

These days we allow simultaneous LE scanning and advertising. Checking
for whether advertising is enabled or not is therefore not a reliable
way to determine whether directed advertising was used to trigger the
connection creation. The appropriate place to check (instead of the hdev
context) is the connection role that's stored in the hci_conn. This
patch fixes such a check in le_conn_timeout() which could otherwise lead
to incorrect HCI commands being sent.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Cc: stable@vger.kernel.org # 3.16.x
10 years agoBluetooth: Fix LE connection timeout deadlock
Johan Hedberg [Tue, 28 Oct 2014 21:23:26 +0000 (22:23 +0100)]
Bluetooth: Fix LE connection timeout deadlock

The le_conn_timeout() may call hci_le_conn_failed() which in turn may
call hci_conn_del(). Trying to use the _sync variant for cancelling the
conn timeout from hci_conn_del() could therefore result in a deadlock.
This patch converts hci_conn_del() to use the non-sync variant so the
deadlock is not possible.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Cc: stable@vger.kernel.org # 3.16.x
10 years agoBluetooth: spelling fixes
Stephen Hemminger [Tue, 28 Oct 2014 04:12:20 +0000 (21:12 -0700)]
Bluetooth: spelling fixes

Fix spelling errors in comments.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: 6lowpan: Fix lockdep splats
Jukka Rissanen [Tue, 28 Oct 2014 15:16:48 +0000 (17:16 +0200)]
Bluetooth: 6lowpan: Fix lockdep splats

When a device ndo_start_xmit() calls again dev_queue_xmit(),
lockdep can complain because dev_queue_xmit() is re-entered and the
spinlocks protecting tx queues share a common lockdep class.

Same issue was fixed for ieee802154 in commit "20e7c4e80dcd"

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: 6lowpan: Converting rwlocks to use RCU
Jukka Rissanen [Tue, 28 Oct 2014 15:16:47 +0000 (17:16 +0200)]
Bluetooth: 6lowpan: Converting rwlocks to use RCU

The rwlocks are converted to use RCU. This helps performance as the
irq locks are not needed any more.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Revert SMP self-test patches
Johan Hedberg [Tue, 28 Oct 2014 14:22:12 +0000 (15:22 +0100)]
Bluetooth: Revert SMP self-test patches

This reverts commits c6992e9ef2a17e9738b7bb8a03a7fe581a8f9977 and
4cd3362da899a59955146851dd860198b0aaaa75.

The reason for the revert is that we cannot have more than one module
initialization function and the SMP one breaks the build with modular
kernels. As the proper fix for this is right now looking non-trivial
it's better to simply revert the problematic patches in order to keep
the upstream tree compilable.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: rx: change naming convention
Alexander Aring [Mon, 27 Oct 2014 16:13:43 +0000 (17:13 +0100)]
mac802154: rx: change naming convention

This patch changes the naming convention of mac802154 rx file. It should
be more named like mac80211 stack. Furthermore we introduce a new frame
parsing implementation which is much similar the mac80211
implementation.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoat86rf230: improve receive handling
Alexander Aring [Mon, 27 Oct 2014 16:13:42 +0000 (17:13 +0100)]
at86rf230: improve receive handling

Current behaviour it to copy the frame inclusive CRC into a skb, then
remove the CRC from the skb. This patch optimizes this by not copying
the CRC at the first place.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoat86rf230: use ieee802154_is_valid_psdu_len helper
Alexander Aring [Mon, 27 Oct 2014 16:13:41 +0000 (17:13 +0100)]
at86rf230: use ieee802154_is_valid_psdu_len helper

This patch adds the ieee802154_is_valid_psdu_len function to validate
the psdu length. If the psdu length is invalid we use the maximum
payload to receive also corrupted frames in monitor mode.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoieee802154: add valid psdu length helper
Alexander Aring [Mon, 27 Oct 2014 16:13:40 +0000 (17:13 +0100)]
ieee802154: add valid psdu length helper

This patch adds a generic valid psdu length check function helper. This
is useful to check the length field after receiving. For example the
at86rf231 doesn't filter invalid psdu length. Sometimes the CRC can also
be correct. If we get the lqi value with an invalid frame length the
kernel may crash because we dereference an invalid pointer in the
receive buffer.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: rx: move rcu locking
Alexander Aring [Mon, 27 Oct 2014 16:13:39 +0000 (17:13 +0100)]
mac802154: rx: move rcu locking

Instead of twice lock and unlock mechanism this patch hold these locks
only once at one position.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: rx: move skb_reset_mac_header
Alexander Aring [Mon, 27 Oct 2014 16:13:38 +0000 (17:13 +0100)]
mac802154: rx: move skb_reset_mac_header

This patch moves the skb_reset_mac_header call before frame parsing
while wpan rx and before monitor deliver functionality.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: rx: add monitor pkt_type information
Alexander Aring [Mon, 27 Oct 2014 16:13:37 +0000 (17:13 +0100)]
mac802154: rx: add monitor pkt_type information

This patch adds a PACKET_OTHERHOST setting when a monitor interface
receives a skb. All receiving skb's to the monitor interface should
be PACKET_OTHERHOST.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: rx: add CHECKSUM_UNNECESSARY
Alexander Aring [Mon, 27 Oct 2014 16:13:36 +0000 (17:13 +0100)]
mac802154: rx: add CHECKSUM_UNNECESSARY

This patch adds CHECKSUM_UNNECESSARY to skb->ip_summed before delivery.
There exist no transceiver with IP checksum functionality.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: rx: move skb->protocol setting
Alexander Aring [Mon, 27 Oct 2014 16:13:35 +0000 (17:13 +0100)]
mac802154: rx: move skb->protocol setting

This patch moves the skb->protocol setting to the position when it's
needed. It's only needed when frame parsing was successful.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: rx: rename remove mac802154_subif_rx
Alexander Aring [Mon, 27 Oct 2014 16:13:34 +0000 (17:13 +0100)]
mac802154: rx: rename remove mac802154_subif_rx

This patch removes the mac802154_subif_rx function and do the necessary
calls inside of ieee802154_rx function. The ieee802154_rx is small
enough to move the functionality inside this function.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: tx: remove monitor receive while xmit
Alexander Aring [Mon, 27 Oct 2014 16:13:33 +0000 (17:13 +0100)]
mac802154: tx: remove monitor receive while xmit

This removes the call of monitor receive funktion when any interface
type call xmit. There exist no such use case that a monitor interface
should receive the actual sending frame. One use case could be that a
wpan interface and monitor interface could be running at the same time
on one phy. Then the monitor interface receives the wpan frames also.
Furthermore we adding support for promiscous mode setting. With
promiscous mode setting we can't run a wpan and monitor interface at the
same time.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: rx: move receive handling into rx.c
Alexander Aring [Mon, 27 Oct 2014 16:13:32 +0000 (17:13 +0100)]
mac802154: rx: move receive handling into rx.c

This patch removes all relevant receiving functions inclusive frame
parsing into rx file. Like mac80211 we should implement the complete
receive handling and parsing in this file.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: rx: document ieee802154_rx() context requirement
Alexander Aring [Mon, 27 Oct 2014 16:13:31 +0000 (17:13 +0100)]
mac802154: rx: document ieee802154_rx() context requirement

This patch is similar like d20ef63d32461332958661df73e21c0ca42601b0
("mac80211: document ieee80211_rx() context requirement"). The
netif_receive_skb call requires with softirqs disabled. This patch
adds a warning if softirqs are pending while calling ieee802154_rx.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: rx: use tasklet instead workqueue
Alexander Aring [Mon, 27 Oct 2014 16:13:30 +0000 (17:13 +0100)]
mac802154: rx: use tasklet instead workqueue

Tasklets have much less overhead than workqueues. This patch also
removes the heap allocation for the worker on receiving path.
Like mac80211 we should prefer use a tasklet here instead a workqueue to
getting fast out of interrupt context when ieee802154_rx_irqsafe is
called by driver. Like wireless inside the tasklet context we should
call netif_receive_skb instead netif_rx_ni anymore.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoieee802154: drivers: use dev_alloc_skb
Alexander Aring [Mon, 27 Oct 2014 16:13:29 +0000 (17:13 +0100)]
ieee802154: drivers: use dev_alloc_skb

This patch change the allocation of skb inside the ieee802154 driver
layer to dev_alloc_skb. This changes also the gfp mask to GFP_ATOMIC
which is needed for upcomming change that the receiving is done by a
tasklet and not a workqueue anymore.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Cc: Alan Ott <alan@signal11.us>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: tx: use put_unaligned_le16 for copy crc
Alexander Aring [Mon, 27 Oct 2014 16:13:28 +0000 (17:13 +0100)]
mac802154: tx: use put_unaligned_le16 for copy crc

This patch replaces the memcpy with a put_unaligned_le16. The placement
of crc inside of PSDU can also be unaligned. With memcpy this can fail
on some architectures.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reported-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoieee802154: 6lowpan: rename process_data and lowpan_process_data
Martin Townsend [Thu, 23 Oct 2014 14:40:56 +0000 (15:40 +0100)]
ieee802154: 6lowpan: rename process_data and lowpan_process_data

As we have decouple decompression from data delivery we can now rename all
occurences of process_data in receive path.

Signed-off-by: Martin Townsend <mtownsend1973@gmail.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agobluetooth:6lowpan: use consume_skb when packet processed successfully
Martin Townsend [Thu, 23 Oct 2014 14:40:55 +0000 (15:40 +0100)]
bluetooth:6lowpan: use consume_skb when packet processed successfully

Signed-off-by: Martin Townsend <mtownsend1973@gmail.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years ago6lowpan: fix process_data return values
Martin Townsend [Thu, 23 Oct 2014 14:40:54 +0000 (15:40 +0100)]
6lowpan: fix process_data return values

As process_data now returns just error codes fix up the calls to this
function to only drop the skb if an error code is returned.

Signed-off-by: Martin Townsend <mtownsend1973@gmail.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years ago6lowpan: remove skb_deliver from IPHC
Martin Townsend [Thu, 23 Oct 2014 14:40:53 +0000 (15:40 +0100)]
6lowpan: remove skb_deliver from IPHC

Separating skb delivery from decompression ensures that we can support further
decompression schemes and removes the mixed return value of error codes with
NET_RX_FOO.

Signed-off-by: Martin Townsend <mtownsend1973@gmail.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: tx: make worker information static
Alexander Aring [Sun, 26 Oct 2014 17:15:34 +0000 (18:15 +0100)]
mac802154: tx: make worker information static

This patch moves the worker information struct out of skb control block.
Instead control block we declare it static inside of tx.c file. We can do
that, because the worker can't be used twice at the same time. It's
protected by stop and wake netdev queue.

This patch fix an issue that the "struct ieee802154_xmit_cb" doesn't fit
into the skb control block on some kernel configuartion reported by
kbuild test robot.

It was introduced by commit fe24371d6645b766c59ec664c59d0a9c310ad455
("mac802154: tx: remove kmalloc in xmit hotpath").

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoat86rf230: asynchronous xmit handling
Alexander Aring [Sun, 26 Oct 2014 08:37:15 +0000 (09:37 +0100)]
at86rf230: asynchronous xmit handling

This patch converts the sync xmit handling into an async xmit handling. The
driver was already prepared for this step, all other drivers need more
work to implement a xmit_async function.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: tx: add comment at sync xmit callback
Alexander Aring [Sun, 26 Oct 2014 08:37:14 +0000 (09:37 +0100)]
mac802154: tx: add comment at sync xmit callback

This patch adds a warning that xmit_sync callback is deprecated and
should be removed soon. The 802.15.4 subsystem will not accept synced
drivers anymore.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: tx: change naming convention
Alexander Aring [Sun, 26 Oct 2014 08:37:13 +0000 (09:37 +0100)]
mac802154: tx: change naming convention

This patch changes the naming convention of the tx functions like
mac80211. Just with an 802154 instead 80211 inside the name.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: tx: move stats tx increment
Alexander Aring [Sun, 26 Oct 2014 08:37:12 +0000 (09:37 +0100)]
mac802154: tx: move stats tx increment

This patch moves the stats increment of successful transmitted packets
in the right place when the skb was really successful transmitted.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: tx: cleanup crc calculation
Alexander Aring [Sun, 26 Oct 2014 08:37:11 +0000 (09:37 +0100)]
mac802154: tx: cleanup crc calculation

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: tx: use netdev print helpers
Alexander Aring [Sun, 26 Oct 2014 08:37:10 +0000 (09:37 +0100)]
mac802154: tx: use netdev print helpers

This patch replace the pr_foo printout function to netdev_foo printout
function. Inside the xmit handling, the interface is already known.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: tx: don't allow if down while sync tx
Alexander Aring [Sun, 26 Oct 2014 08:37:09 +0000 (09:37 +0100)]
mac802154: tx: don't allow if down while sync tx

This patch holds rtnl lock while sync xmit inside of workqueue.
Otherwise we could down the interface while worker xmit handling.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: tx: add support for xmit_async callback
Alexander Aring [Sun, 26 Oct 2014 08:37:08 +0000 (09:37 +0100)]
mac802154: tx: add support for xmit_async callback

This patch renames the existsing xmit callback to xmit_sync and
introduces an asynchronous xmit_async function. If ieee802154_ops
doesn't provide the xmit_async callback, then we have a fallback to
the xmit_sync callback.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Cc: Alan Ott <alan@signal11.us>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: tx: fix error handling while xmit
Alexander Aring [Sun, 26 Oct 2014 08:37:07 +0000 (09:37 +0100)]
mac802154: tx: fix error handling while xmit

In case of an error we should call kfree_skb instead of consume_skb which
is called by ieee802154_xmit_complete function.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: tx: use queue helpers in xmit worker
Alexander Aring [Sun, 26 Oct 2014 08:37:06 +0000 (09:37 +0100)]
mac802154: tx: use queue helpers in xmit worker

This patch uses the queue utility helpers inside the xmit worker of
mac802154 subsystem.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: add netdev qeue helpers
Alexander Aring [Sun, 26 Oct 2014 08:37:05 +0000 (09:37 +0100)]
mac802154: add netdev qeue helpers

This patch adds a new file net/mac802154/util.c which contains utility
functions for drivers, etc. This file contains functions to start and
stop queues for all virtual interfaces, this is useful for asynchronous
handling by driver level.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: tx: remove xmit channel context switch
Alexander Aring [Sun, 26 Oct 2014 08:37:04 +0000 (09:37 +0100)]
mac802154: tx: remove xmit channel context switch

This patch removes the channel hopping feature before xmit. There are
several issues to provide a real channel hopping (timing requirements,
etc...).

We don't have any known kernelspace protocol which really use this
feature. And I don't know an real user of this feature.
We simply drop this feature now.

This patch removes also the hold of pib lock which isn't needed by any
real driver xmit callback implementation.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: tx: squash multiple dereferencing
Alexander Aring [Sun, 26 Oct 2014 08:37:03 +0000 (09:37 +0100)]
mac802154: tx: squash multiple dereferencing

This patch introduce some new stack variables to avoid multiple
dereferencing inside the xmit worker function.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: tx: remove kmalloc in xmit hotpath
Alexander Aring [Sun, 26 Oct 2014 08:37:02 +0000 (09:37 +0100)]
mac802154: tx: remove kmalloc in xmit hotpath

This patch removes the kmalloc allocation for workqueue data. This patch
replaces the kmalloc and uses the control block of skb. The control block
has enough space and isn't use by any other layer in this case.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: tx: move xmit callback to tx file
Alexander Aring [Sun, 26 Oct 2014 08:37:01 +0000 (09:37 +0100)]
mac802154: tx: move xmit callback to tx file

This patch moves the netdev xmit callback functions into the tx.c file.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: remove ieee802154_addr from driver_ops
Alexander Aring [Sat, 25 Oct 2014 15:16:42 +0000 (17:16 +0200)]
mac802154: remove ieee802154_addr from driver_ops

This driver_ops callback function is never used by any driver.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: rename dev_workqueue to workqueue
Alexander Aring [Sat, 25 Oct 2014 15:16:41 +0000 (17:16 +0200)]
mac802154: rename dev_workqueue to workqueue

Small rename to use the name workqueue than dev_workqueue. To bring the
same naming convention like wireless into 802.15.4.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: introduce IEEE802154_DEV_TO_SUB_IF
Alexander Aring [Sat, 25 Oct 2014 15:16:40 +0000 (17:16 +0200)]
mac802154: introduce IEEE802154_DEV_TO_SUB_IF

This function adds a wrapper to call netdev_priv to getting the sdata
attribute. This is similar like the IEEE80211_DEV_TO_SUB_IF function
inside wireless stack implementation.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: introduce hw_to_local function
Alexander Aring [Sat, 25 Oct 2014 15:16:39 +0000 (17:16 +0200)]
mac802154: introduce hw_to_local function

This patch replace the mac802154_to_priv macro with a static inline
function named hw_to_local. This brings a similar naming convention like
mac80211 stack.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: rename sdata slaves and slaves_mtx
Alexander Aring [Sat, 25 Oct 2014 15:16:38 +0000 (17:16 +0200)]
mac802154: rename sdata slaves and slaves_mtx

This patch renamens the slaves attribute in sdata to interfaces and
slaves_mtx to iflist_mtx. This is similar like the mac80211 stack naming
convention.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: rename hw subif_data variable to local
Alexander Aring [Sat, 25 Oct 2014 15:16:37 +0000 (17:16 +0200)]
mac802154: rename hw subif_data variable to local

This patch renames the hw attribute in struct ieee802154_sub_if_data to
local. This avoid confusing with the struct ieee802154_hw hw; inside of
local struct.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: rename mac802154_sub_if_data
Alexander Aring [Sat, 25 Oct 2014 15:16:36 +0000 (17:16 +0200)]
mac802154: rename mac802154_sub_if_data

Like wireless this structure should named ieee802154_sub_if_data and not
mac802154_sub_if_data. This patch renames the struct and variables to
sdata instead priv sometimes.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: rename mac802154_priv to ieee802154_local
Alexander Aring [Sat, 25 Oct 2014 15:16:35 +0000 (17:16 +0200)]
mac802154: rename mac802154_priv to ieee802154_local

This patch rename the mac802154_priv to ieee802154_local. The
mac802154_priv structure is like ieee80211_local and so we name it
ieee802154_local.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoieee802154: rename ieee802154_dev to ieee802154_hw
Alexander Aring [Sat, 25 Oct 2014 15:16:34 +0000 (17:16 +0200)]
ieee802154: rename ieee802154_dev to ieee802154_hw

The identical struct of the wireless stack implementation is named
ieee80211_hw. This is useful to name the variable hw instead of get
confusing with netdev dev variable.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Cc: Alan Ott <alan@signal11.us>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoieee802154: remove fakehard driver
Alexander Aring [Sat, 25 Oct 2014 15:16:33 +0000 (17:16 +0200)]
ieee802154: remove fakehard driver

This patch removes the not functional fakehard driver. We don't support
HardMAC 802.15.4 drivers right now.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoMAINTAINERS: add missing headers in 802.15.4
Alexander Aring [Sat, 25 Oct 2014 07:41:05 +0000 (09:41 +0200)]
MAINTAINERS: add missing headers in 802.15.4

This patch adds a lot of include headers which are missing by the
current IEEE 802.15.4 subsystem.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoieee802154: move ieee802154 header
Alexander Aring [Sat, 25 Oct 2014 07:41:04 +0000 (09:41 +0200)]
ieee802154: move ieee802154 header

This patch moves the ieee802154 header into include/linux instead
include/net. Similar like wireless which have the ieee80211 header
inside of include/linux.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Cc: Alan Ott <alan@signal11.us>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoieee802154: move wpan-class.c to core.c
Alexander Aring [Sat, 25 Oct 2014 07:41:03 +0000 (09:41 +0200)]
ieee802154: move wpan-class.c to core.c

Like the wireless core.c file this file contains function for phy
allocation and freeing. Move this file to core.c to get similar
behaviour.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoieee802154: move wpan-phy.h to cfg802154.h
Alexander Aring [Sat, 25 Oct 2014 07:41:02 +0000 (09:41 +0200)]
ieee802154: move wpan-phy.h to cfg802154.h

The wpan-phy header contains the wpan_phy struct information. Later this
header will be have similar function like cfg80211 header. The cfg80211
header contains the wiphy struct which is identically the wpan_phy
struct inside 802.15.4 subsystem.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Cc: Alan Ott <alan@signal11.us>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: move wpan.c to iface.c
Alexander Aring [Sat, 25 Oct 2014 07:41:01 +0000 (09:41 +0200)]
mac802154: move wpan.c to iface.c

The wpan.c file contains the interface handling functions now. It's similar
like the mac80211 iface.c file. This patch renames this file to iface.c to
have similar naming convention in mac802154.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: move mac802154.h to ieee802154_i.h
Alexander Aring [Sat, 25 Oct 2014 07:41:00 +0000 (09:41 +0200)]
mac802154: move mac802154.h to ieee802154_i.h

This patch moves the mac802154.h internal header to ieee802154_i.h like
the wireless stack ieee80211_i.h file. This avoids confusing with the
not internal header include/net/mac802154.h header. Additional we get
the same naming conversion like mac80211 for this file.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: move ieee802154_dev.c to main.c
Alexander Aring [Sat, 25 Oct 2014 07:40:59 +0000 (09:40 +0200)]
mac802154: move ieee802154_dev.c to main.c

The ieee802154_dev functionality contains various function for
allocation and registration of an ieee802154_dev. This is equal to the
net/mac80211/main.c file. This patch rename the ieee802154_dev.c to
main.c to have the same behaviour.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Add self-tests for SMP crypto functions
Johan Hedberg [Sat, 25 Oct 2014 19:15:39 +0000 (21:15 +0200)]
Bluetooth: Add self-tests for SMP crypto functions

This patch adds self-tests for the c1 and s1 crypto functions used for
SMP pairing. The data used is the sample data from the core
specification.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Add skeleton for SMP self-tests
Johan Hedberg [Sat, 25 Oct 2014 19:15:38 +0000 (21:15 +0200)]
Bluetooth: Add skeleton for SMP self-tests

This patch adds a basic skeleton for SMP self-tests. The tests are put
behind a new configuration option since running them will slow down the
boot process. For now there are no actual tests defined but those will
come in a subsequent patch.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Pass only crypto context to SMP crypto functions
Johan Hedberg [Sat, 25 Oct 2014 19:15:37 +0000 (21:15 +0200)]
Bluetooth: Pass only crypto context to SMP crypto functions

In order to make unit testing possible we need to make the SMP crypto
functions only take the crypto context instead of the full SMP context
(the latter would require having hci_dev, hci_conn, l2cap_chan,
l2cap_conn, etc around). The drawback is that we no-longer get the
involved hdev in the debug logs, but this is really the only way to make
simple unit tests for the code.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: fix shadow warning in hci_disconnect()
Fabian Frederick [Sat, 25 Oct 2014 08:48:58 +0000 (10:48 +0200)]
Bluetooth: fix shadow warning in hci_disconnect()

use clkoff_cp for hci_cp_read_clock_offset instead of cp
(already defined above).

Suggested-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoieee802154: wpan-class: fix trailing semicolon
Alexander Aring [Sat, 25 Oct 2014 03:25:12 +0000 (05:25 +0200)]
ieee802154: wpan-class: fix trailing semicolon

This patch removes an unnecessary tailing semicolon after macro
define. Otherwise we get a trailing semicolon while using this macro.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoieee802154: wpan-phy: use blank line after function
Alexander Aring [Sat, 25 Oct 2014 03:25:11 +0000 (05:25 +0200)]
ieee802154: wpan-phy: use blank line after function

This patch adds a blank line after function declaration.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoieee802154: wpan-phy: change to __aligned(size)
Alexander Aring [Sat, 25 Oct 2014 03:25:10 +0000 (05:25 +0200)]
ieee802154: wpan-phy: change to __aligned(size)

This patch fix a checkpatch warning that __aligned(size) is preferred
over __attribute__((aligned(size))).

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agomac802154: fix typo IEEE802515 to IEEE802154
Alexander Aring [Sat, 25 Oct 2014 03:25:09 +0000 (05:25 +0200)]
mac802154: fix typo IEEE802515 to IEEE802154

This patch fixs a typo in address filter defines from IEEE802515 to
IEEE802154.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Cc: Alan Ott <alan@signal11.us>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoieee802154: ieee802154_dev: fix align typo
Alexander Aring [Sat, 25 Oct 2014 03:25:08 +0000 (05:25 +0200)]
ieee802154: ieee802154_dev: fix align typo

This patch fix a typo and fix align instead allign.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoieee802154: mac802154: remove FSF address
Alexander Aring [Sat, 25 Oct 2014 03:25:07 +0000 (05:25 +0200)]
ieee802154: mac802154: remove FSF address

This patch removes the FSF address in files which belongs to ieee802154
and mac802154.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Cc: Alan Ott <alan@signal11.us>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Fix missing channel unlock in l2cap_le_credits
Martin Townsend [Mon, 13 Oct 2014 18:24:45 +0000 (19:24 +0100)]
Bluetooth: Fix missing channel unlock in l2cap_le_credits

In the error case where credits is greater than max_credits there
is a missing l2cap_chan_unlock before returning.

Signed-off-by: Martin Townsend <mtownsend1973@gmail.com>
Tested-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years ago6lowpan: Use skb_cow in IPHC decompression.
Martin Townsend [Mon, 13 Oct 2014 10:00:56 +0000 (11:00 +0100)]
6lowpan: Use skb_cow in IPHC decompression.

Currently there are potentially 2 skb_copy_expand calls in IPHC
decompression.  This patch replaces this with one call to
skb_cow which will check to see if there is enough headroom
first to ensure it's only done if necessary and will handle
alignment issues for cache.
As skb_cow uses pskb_expand_head we ensure the skb isn't shared from
bluetooth and ieee802.15.4 code that use the IPHC decompression.

Signed-off-by: Martin Townsend <martin.townsend@xsilon.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: 6lowpan: remove unnecessary codes in give_skb_to_upper
Li RongQing [Thu, 16 Oct 2014 02:21:55 +0000 (10:21 +0800)]
Bluetooth: 6lowpan: remove unnecessary codes in give_skb_to_upper

netif_rx() only returns NET_RX_DROP and NET_RX_SUCCESS, not returns
negative value

Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Improve RFCOMM __test_pf macro robustness
Szymon Janc [Mon, 13 Oct 2014 09:43:54 +0000 (11:43 +0200)]
Bluetooth: Improve RFCOMM __test_pf macro robustness

Value returned by this macro might be used as bit value so it should
return either 0 or 1 to avoid possible bugs (similar to NSC bug)
when shifting it.

Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Fix RFCOMM NSC response
Szymon Janc [Mon, 13 Oct 2014 09:43:53 +0000 (11:43 +0200)]
Bluetooth: Fix RFCOMM NSC response

rfcomm_send_nsc expects CR to be either 0 or 1 since it is later
passed to __mcc_type macro and shitfed. Unfortunatelly CR extracted
from received frame type was not sanitized and shifted value was passed
resulting in bogus response.

Note: shifted value was also passed to other functions but was used
only in if satements so this bug appears only for NSC case.

The CR bit in the value octet shall be set to the same value
as the CR bit in the type field octet of the not supported command
frame but the CR bit for NCS response should be set to 0 since it is
always a response.

This was affecting TC_RFC_BV_25_C PTS qualification test.

Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Defer connection-parameter removal when unpairing
Alfonso Acosta [Sat, 11 Oct 2014 21:44:47 +0000 (21:44 +0000)]
Bluetooth: Defer connection-parameter removal when unpairing

Systematically removing the LE connection parameters and autoconnect
action is inconvenient for rebonding without disconnecting from
userland (i.e. unpairing followed by repairing without
disconnecting). The parameters will be lost after unparing and
userland needs to take care of book-keeping them and re-adding them.

This patch allows userland to forget about parameter management when
rebonding without disconnecting. It defers clearing the connection
parameters when unparing without disconnecting, giving a chance of
keeping the parameters if a repairing happens before the connection is
closed.

Signed-off-by: Alfonso Acosta <fons@spotify.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoieee802154: 6lowpan: add RTNL assertion
Alexander Aring [Mon, 13 Oct 2014 08:33:07 +0000 (10:33 +0200)]
ieee802154: 6lowpan: add RTNL assertion

This patch ensure that the rtnl lock is hold while newlink callback.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoieee802154: 6lowpan: improve packet registration
Alexander Aring [Mon, 13 Oct 2014 08:33:06 +0000 (10:33 +0200)]
ieee802154: 6lowpan: improve packet registration

This patch improves the packet registration handling. Instead of
registration with module init we have a open count variable and
registration the lowpan packet handler when it's needed.

The open count variable should be protected by RTNL.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Remove redundant check on hci_conn's device class
Alfonso Acosta [Tue, 7 Oct 2014 08:44:12 +0000 (08:44 +0000)]
Bluetooth: Remove redundant check on hci_conn's device class

NULL-checking conn->dev_class is pointless since the variable is
defined as an array, i.e. it will always be non-NULL.

Signed-off-by: Alfonso Acosta <fons@spotify.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Include ADV_IND report in Device Connected event
Alfonso Acosta [Tue, 7 Oct 2014 08:44:11 +0000 (08:44 +0000)]
Bluetooth: Include ADV_IND report in Device Connected event

There are scenarios when autoconnecting to a device after the
reception of an ADV_IND report (action 0x02), in which userland
might want to examine the report's contents.

For instance, the Service Data might have changed and it would be
useful to know ahead of time before starting any GATT procedures.
Also, the ADV_IND may contain Manufacturer Specific data which would
be lost if not propagated to userland. In fact, this patch results
from the need to rebond with a device lacking persistent storage which
notifies about losing its LTK in ADV_IND reports.

This patch appends the ADV_IND report which triggered the
autoconnection to the EIR Data in the Device Connected event.

Signed-off-by: Alfonso Acosta <fons@spotify.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Refactor arguments of mgmt_device_connected
Alfonso Acosta [Tue, 7 Oct 2014 08:44:10 +0000 (08:44 +0000)]
Bluetooth: Refactor arguments of mgmt_device_connected

The values of a lot of the mgmt_device_connected() parameters come
straight from a hci_conn object. We can simplify the function by passing
the full hci_conn pointer to it.

Signed-off-by: Alfonso Acosta <fons@spotify.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoat86rf230: remove unnecessary print of async error
Alexander Aring [Tue, 7 Oct 2014 08:38:33 +0000 (10:38 +0200)]
at86rf230: remove unnecessary print of async error

The async error function will already printout the errno over dev_err.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoat86rf230: fix enable_irq handling on async spi
Alexander Aring [Tue, 7 Oct 2014 08:38:32 +0000 (10:38 +0200)]
at86rf230: fix enable_irq handling on async spi

Sometimes the async state function is call in an context where the spi
irq is diabled. This patch fix the handling to enable the irq when
spi_async failed in the async state change calling chain. We do this by
a context parameter irq_enable and evaluate this parameter when
spi_async failed instead of returning spi_async errno.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoat86rf230: fix race condition
Alexander Aring [Tue, 7 Oct 2014 08:38:31 +0000 (10:38 +0200)]
at86rf230: fix race condition

When the driver waits for a tx completion currently the driver direct
enables the irq. When we switching to RX_AACK_ON some steps afterwards
the driver could receive a new frame and request resources which are
already in use, for example irq state change resource.

To be sure there are no new interrupts when we switching to RX_AACK_ON,
we enable the irq when state change to RX_AACK_ON was completed.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoat86rf230: add missing enable_irq
Alexander Aring [Tue, 7 Oct 2014 08:38:30 +0000 (10:38 +0200)]
at86rf230: add missing enable_irq

This patch adds a missing enable_irq when spi_async in isr failed.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoat86rf230: squash unnecessary dereferencing
Alexander Aring [Tue, 7 Oct 2014 08:38:29 +0000 (10:38 +0200)]
at86rf230: squash unnecessary dereferencing

This patch removes dereferencing irq number over spi struct. Instead we
doing it directly over isr paramater.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoat86rf230: correct at86rf2xx lifs timings
Alexander Aring [Tue, 7 Oct 2014 08:38:28 +0000 (10:38 +0200)]
at86rf230: correct at86rf2xx lifs timings

Symbol rate is 16 us. Lifs is 40 symbols. 16 * 40 = 640 us.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoat86rf230: correct aret lifs and sifs handling
Alexander Aring [Tue, 7 Oct 2014 08:38:27 +0000 (10:38 +0200)]
at86rf230: correct aret lifs and sifs handling

This patch adds lifs/sifs handling only if max_frame_retries is above
zero. The at86rf2xx datasheets says nothing about phy lifs/sifs
handling. I asked the atmel support and they said lifs/sifs is done
by phy when max_frame_retries is above zero.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>