GitHub/LineageOS/android_kernel_motorola_exynos9610.git
9 years agoBluetooth: Add missing response structure for HCI Delete Stored Link Key
Marcel Holtmann [Mon, 12 Jan 2015 17:21:27 +0000 (09:21 -0800)]
Bluetooth: Add missing response structure for HCI Delete Stored Link Key

This patch adds this missing structure for processing the result of the
HCI Delete Stored Link Key command.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Read stored link key information when powering on controller
Marcel Holtmann [Mon, 12 Jan 2015 17:21:26 +0000 (09:21 -0800)]
Bluetooth: Read stored link key information when powering on controller

The information about max stored link keys and current stored link keys
should be read at controller initialization. So issue HCI Read Stored
Link Key command with BDADDR_ANY and read_all flag set to 0x01 to
retrieve this information.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Handle command complete event for HCI Read Stored Link Keys
Marcel Holtmann [Mon, 12 Jan 2015 17:21:25 +0000 (09:21 -0800)]
Bluetooth: Handle command complete event for HCI Read Stored Link Keys

When the HCI Read Stored Link Keys command completes it gives useful
information of the current stored keys and maximum keys a controller
can actually store. So process this event and store these information
in hci_dev structure.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Add defintions for HCI Read Stored Link Key command
Marcel Holtmann [Mon, 12 Jan 2015 17:21:24 +0000 (09:21 -0800)]
Bluetooth: Add defintions for HCI Read Stored Link Key command

This patch adds the missing commmand structure and command complete
structure for the HCI Read Store Link Key command.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Replace send_monitor_event with queue_monitor_skb
Marcel Holtmann [Mon, 12 Jan 2015 03:33:33 +0000 (19:33 -0800)]
Bluetooth: Replace send_monitor_event with queue_monitor_skb

The send_monitor_event function is essentially the same as the newly
introduced queue_monitor_skb. So instead of having duplicated code,
replace send_monitor_event with queue_monitor_skb.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Create generic queue_monitor_skb helper function
Marcel Holtmann [Mon, 12 Jan 2015 03:33:32 +0000 (19:33 -0800)]
Bluetooth: Create generic queue_monitor_skb helper function

The hci_send_to_monitor function contains generic code for queueing the
packet into the receive queue of every monitor client. To avoid code
duplication, create a generic queue_monitor_skb function to interate
over all monitor sockets.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Simplify packet copy in hci_send_to_monitor function
Marcel Holtmann [Mon, 12 Jan 2015 03:33:31 +0000 (19:33 -0800)]
Bluetooth: Simplify packet copy in hci_send_to_monitor function

Within the monitor functionality, the global atomic variable called
monitor_promisc ensures that no memory allocation happend when there
is actually no client listening. This means it is safe to just create
a copy of the skb since it is guaranteed that at least one client
exists. No extra checks needed.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Add BUILD_BUG_ON for size of struct sockaddr_sco
Marcel Holtmann [Sun, 11 Jan 2015 23:21:06 +0000 (15:21 -0800)]
Bluetooth: Add BUILD_BUG_ON for size of struct sockaddr_sco

This adds an extra check for ensuring that the size of sockaddr_sco
does not grow larger than sockaddr.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Add BUILD_BUG_ON for size of struct sockaddr_rc
Marcel Holtmann [Sun, 11 Jan 2015 23:18:20 +0000 (15:18 -0800)]
Bluetooth: Add BUILD_BUG_ON for size of struct sockaddr_rc

This adds an extra check for ensuring that the size of sockaddr_rc
does not grow larger than sockaddr.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Add BUILD_BUG_ON for size of struct sockaddr_l2
Marcel Holtmann [Sun, 11 Jan 2015 23:18:19 +0000 (15:18 -0800)]
Bluetooth: Add BUILD_BUG_ON for size of struct sockaddr_l2

This adds an extra check for ensuring that the size of sockaddr_l2
does not grow larger than sockaddr.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Add BUILD_BUG_ON for size of struct sockaddr_hci
Marcel Holtmann [Sun, 11 Jan 2015 23:18:17 +0000 (15:18 -0800)]
Bluetooth: Add BUILD_BUG_ON for size of struct sockaddr_hci

This adds an extra check for ensuring that the size of sockaddr_hci
does not grow larger than sockaddr.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Add opcode parameter to hci_req_complete_t callback
Marcel Holtmann [Sun, 11 Jan 2015 21:50:44 +0000 (13:50 -0800)]
Bluetooth: Add opcode parameter to hci_req_complete_t callback

When hci_req_run() calls its provided complete function and one of the
HCI commands in the sequence fails, then provide the opcode of failing
command. In case of success HCI_OP_NOP is provided since all commands
completed.

This patch fixes the prototype of hci_req_complete_t and all its users.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoieee802154: 6lowpan: fix Makefile entry
Alexander Aring [Thu, 8 Jan 2015 10:30:10 +0000 (11:30 +0100)]
ieee802154: 6lowpan: fix Makefile entry

Since commit ea81ac2e7050798109356150ea16e71622a5c329 ("ieee802154:
create 6lowpan sub-directory") we have a subdirectory for the ieee802154
6lowpan implementation. This commit also moves the Kconfig entry inside
of net/ieee802154/6lowpan/ and forgot to rename the Makefile entry from
obj-$(CONFIG_IEEE802154_6LOWPAN) to obj-y and handle the
obj-$(CONFIG_IEEE802154_6LOWPAN) inside the created 6lowpan directory.
This will occur that the ieee802154_6lowpan can't be build.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: 6lowpan: rename to core
Alexander Aring [Sun, 4 Jan 2015 16:10:57 +0000 (17:10 +0100)]
ieee802154: 6lowpan: rename to core

This patch renames the 6lowpan_rtnl.c file to core.c. 6lowpan_rtnl.c
contains functionality to put all 802.15.4 6LoWPAN functionality
together.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: 6lowpan: move transmit functionality
Alexander Aring [Sun, 4 Jan 2015 16:10:56 +0000 (17:10 +0100)]
ieee802154: 6lowpan: move transmit functionality

This patch moves all relevant transmit functionality into a separate tx.c
file. We can simple separate this functionality like we did it in mac802154.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: 6lowpan: move receive functionality
Alexander Aring [Sun, 4 Jan 2015 16:10:55 +0000 (17:10 +0100)]
ieee802154: 6lowpan: move receive functionality

This patch moves all relevant receive functionality into a separate rx.c
file. We can simple separate this functionality like we did it in mac802154.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: 6lowpan: rename internal header
Alexander Aring [Sun, 4 Jan 2015 16:10:54 +0000 (17:10 +0100)]
ieee802154: 6lowpan: rename internal header

This patch renames the internal header for af802154. This naming
convention is like ieee802154_i.h in mac802154 and avoids naming
confusing with the global af802154 header. Furthermore this header
contains more ieee802154 specific definitions.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: create 6lowpan sub-directory
Alexander Aring [Sun, 4 Jan 2015 16:10:53 +0000 (17:10 +0100)]
ieee802154: create 6lowpan sub-directory

This patch creates an 6lowpan sub-directory inside ieee802154.
Additional we move all ieee802154 6lowpan relevant files into
this sub-directory instead of placing the 6lowpan related files
inside ieee802154.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: btmrvl: fix card reset and suspend race issue
Amitkumar Karwar [Wed, 7 Jan 2015 05:36:56 +0000 (21:36 -0800)]
Bluetooth: btmrvl: fix card reset and suspend race issue

Sometimes suspend thread queues a command and wait for it's
response, meanwhile WLAN driver power cycles the card which
leads to crash. This patch makes sure that suspend thread is
woken up in remove path.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: btmrvl: use msecs_to_jiffies within macro definition
Amitkumar Karwar [Wed, 7 Jan 2015 05:36:55 +0000 (21:36 -0800)]
Bluetooth: btmrvl: use msecs_to_jiffies within macro definition

This change improves readability and fixes allignment problem.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agobluetooth: btmrvl: increase the priority of firmware download message
Amitkumar Karwar [Thu, 1 Jan 2015 08:13:42 +0000 (00:13 -0800)]
bluetooth: btmrvl: increase the priority of firmware download message

When driver is loaded, it is important to know if FW was already
active or it is freshly downloaded. This patch increases the
priority of the message.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: btmrvl: add surprise_removed flag
Amitkumar Karwar [Thu, 1 Jan 2015 08:13:41 +0000 (00:13 -0800)]
Bluetooth: btmrvl: add surprise_removed flag

This flag will be set in unload path to make sure that we skip
sending further commands, ignore interrupts and stop main thread
when unload starts.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: btmrvl: error path handling in setup handler
Amitkumar Karwar [Thu, 1 Jan 2015 08:13:40 +0000 (00:13 -0800)]
Bluetooth: btmrvl: error path handling in setup handler

If module init command fails, FW might not be in good state.
We will return from setup handler and skip downloading further
commands.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: btmrvl: fix race issue while stopping main thread
Amitkumar Karwar [Thu, 1 Jan 2015 08:13:39 +0000 (00:13 -0800)]
Bluetooth: btmrvl: fix race issue while stopping main thread

btmrvl_remove_card() calls kthread_stop() to stop the main thread,
but kthread_should_stop() is checked when all the activities are done
in the main thread before sleeping.
We will have kthread_should_stop() check as soon as main thread is
woken up. This fixes a crash issue caused due to an invalid memory
access while unnecessarily processing interrupts after card removal.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Use HCI_QUIRK_FIXUP_INQUIRY_MODE for Silicon Wave devices
Marcel Holtmann [Sat, 3 Jan 2015 07:35:20 +0000 (23:35 -0800)]
Bluetooth: Use HCI_QUIRK_FIXUP_INQUIRY_MODE for Silicon Wave devices

The Silicon Wave based devices do support Inquiry Result with RSSI and
so let the core know to enable them.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Introduce HCI_QUIRK_FIXUP_INQUIRY_MODE option
Marcel Holtmann [Sat, 3 Jan 2015 07:35:19 +0000 (23:35 -0800)]
Bluetooth: Introduce HCI_QUIRK_FIXUP_INQUIRY_MODE option

The HCI_QUIRK_FIXUP_INQUIRY_MODE option allows to force Inquiry Result
with RSSI setting on controllers that do not indicate support for it,
but where it is known to be fully functional.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Remove dead code for manufacturer inquiry mode quirks
Marcel Holtmann [Sat, 3 Jan 2015 07:35:18 +0000 (23:35 -0800)]
Bluetooth: Remove dead code for manufacturer inquiry mode quirks

There are some old Bluetooth modules from Silicon Wave and Broadcom
which support Inquiry Result with RSSI, but do not advertise it. The
core has quirks in the code to enable that inquiry mode. However as
it stands right now, that code is not even executed since entering
the function to determine which inquiry mode requires that the device
has the feature bit for Inquiry Result with RSSI set in the first
place. So this makes this dead code that hasn't work for a long
time.

In conclusion, just remove these extra quirks and simplify the setup
of the inquiry mode to be inline and with that a lot easier to read
and understand.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agomac802154: fix kbuild test robot warning
Alexander Aring [Fri, 2 Jan 2015 14:49:41 +0000 (15:49 +0100)]
mac802154: fix kbuild test robot warning

This patch fixs the following kbuild test robot warning:

coccinelle warnings: (new ones prefixed by >>)

>> net/mac802154/cfg.c:53:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: handle config as menuconfig
Alexander Aring [Wed, 31 Dec 2014 18:39:13 +0000 (19:39 +0100)]
ieee802154: handle config as menuconfig

This patch handles the IEEE802154 Kconfig entry as menuconfig.
Furthermore we move this entry out of "Network Options" and put it into
"Networking" where the other networking subsystems are. This requires a
menuconfig entry like all other networking subsystems.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: rename af_ieee802154.c to socket.c
Alexander Aring [Wed, 31 Dec 2014 18:39:12 +0000 (19:39 +0100)]
ieee802154: rename af_ieee802154.c to socket.c

This patch renames the "af_ieee802154.c" to "socket.c". This is just a
cleanup to have a short name for it which describes the implementationm
stuff more human understandable.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: socket: fix checkpatch issue
Alexander Aring [Wed, 31 Dec 2014 18:39:11 +0000 (19:39 +0100)]
ieee802154: socket: fix checkpatch issue

This patch solves the following checkpatch issue:

CHECK: Comparison to NULL could be written "skb"
+ if (skb != NULL) {

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: socket: put handling into one file
Alexander Aring [Wed, 31 Dec 2014 18:39:10 +0000 (19:39 +0100)]
ieee802154: socket: put handling into one file

This patch puts all related socket handling into one file. This is just
a cleanup to do all socket handling stuff inside of one implementation
file.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: socket: change module name
Alexander Aring [Wed, 31 Dec 2014 18:39:09 +0000 (19:39 +0100)]
ieee802154: socket: change module name

This patch changes the module name of af_802154 to ieee802154_socket.
Just for keeping the name convention according to the 6LoWPAN module
ieee802154_6lowpan.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoieee802154: handle socket functionality as module
Alexander Aring [Wed, 31 Dec 2014 18:39:08 +0000 (19:39 +0100)]
ieee802154: handle socket functionality as module

This patch makes the ieee802154 socket handling as module. Currently
this is part of ieee802154 module. It pointed out that ieee802154 module
has also two module_init/module_exit functions. One inside of core.c and
the other in af_ieee802154.c. This patch will also solve this issue by
handle the af_802154 as separate module.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Fix issue with Roper Class 1 Bluetooth Dongle
Marcel Holtmann [Fri, 2 Jan 2015 01:34:37 +0000 (17:34 -0800)]
Bluetooth: Fix issue with Roper Class 1 Bluetooth Dongle

The Roper Class 1 Bluetooth Dongle is another device that claims to
support Bluetooth 1.2 specification, but does not support the HCI
command for reading the local supported commands.

  < HCI Command: Read Local Version Information (0x04|0x0001) plen 0
  > HCI Event: Command Complete (0x0e) plen 12
      Read Local Version Information (0x04|0x0001) ncmd 1
      status 0x00
      HCI Version: 1.2 (0x2) HCI Revision: 0x0
      LMP Version: 1.2 (0x2) LMP Subversion: 0x757
      Manufacturer: Silicon Wave (11)

It clearly claims Bluetooth 1.2 support and in that regard has the
same issue as the AVM BlueFritz! USB devices (Silicon Wave based),
but the HCI Read Local Supported Commands command fails.

  < HCI Command: Read Local Supported Commands (0x04|0x0002) plen 0
  > HCI Event: Command Status (0x0f) plen 4
      Read Local Supported Commands (0x04|0x0002) status 0x01 ncmd 1
      Error: Unknown HCI Command

Use the HCI_QUIRK_BROKEN_LOCAL_COMMANDS quirk for these devices and
the failing command will be skipped.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Fix SMP channel registration for unconfigured controllers
Marcel Holtmann [Thu, 1 Jan 2015 10:05:16 +0000 (02:05 -0800)]
Bluetooth: Fix SMP channel registration for unconfigured controllers

When the Bluetooth controllers requires an unconfigured state (for
example when the BD_ADDR is missing), then it is important to try
to register the SMP channels when the controller transitions to the
configured state.

This also fixes an issue with the debugfs entires that are not present
for controllers that start out as unconfigured.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Fix for a leftover debug of pairing credentials
Marcel Holtmann [Thu, 1 Jan 2015 04:01:22 +0000 (20:01 -0800)]
Bluetooth: Fix for a leftover debug of pairing credentials

One of the LE Secure Connections security credentials was still using
the BT_DBG instead of SMP_DBG.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Fix scope of sc_only_mode debugfs entry
Marcel Holtmann [Wed, 31 Dec 2014 22:43:19 +0000 (14:43 -0800)]
Bluetooth: Fix scope of sc_only_mode debugfs entry

The sc_only_mode debugfs entry is used to read the current state of the
Secure Connections Only mode. Before Bluetooth 4.2 this mode was only
for BR/EDR controllers and with that tight to the support Secure Simple
Pairing. Since Secure Connections is now available for BR/EDR and LE
this debugfs entry is no longer correctly place.

Move it to the common section and enable it when either BR/EDR Secure
Connections feature is supported or when the controller has LE support.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Remove no longer needed force_sc_support debugfs option
Marcel Holtmann [Wed, 31 Dec 2014 22:43:18 +0000 (14:43 -0800)]
Bluetooth: Remove no longer needed force_sc_support debugfs option

The force_sc_support debugfs option was introduced to easily work with
pre-production Bluetooth 4.1 silicon. This option is no longer needed
since controllers supporting BR/EDR Secure Connections feature are now
available.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Remove broken force_lesc_support debugfs option
Marcel Holtmann [Wed, 31 Dec 2014 22:43:17 +0000 (14:43 -0800)]
Bluetooth: Remove broken force_lesc_support debugfs option

The force_lesc_support debugfs option never really worked. It has a race
condition between creating the debugfs entry and registering the L2CAP
fixed channel for BR/EDR SMP support.

Also this has been replaced with a working force_bredr_smp debugfs
switch that developers can use now.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Introduce force_bredr_smp debugfs option for testing
Marcel Holtmann [Wed, 31 Dec 2014 22:43:16 +0000 (14:43 -0800)]
Bluetooth: Introduce force_bredr_smp debugfs option for testing

Testing cross-transport pairing that starts on BR/EDR is only valid when
using a controller with BR/EDR Secure Connections. Devices will indicate
this by providing BR/EDR SMP fixed channel over L2CAP. To allow testing
of this feature on Bluetooth 4.0 controller or controllers without the
BR/EDR Secure Connections features, introduce a force_bredr_smp debugfs
option that allows faking the required AES connection.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agonet: skbuff: don't zero tc members when freeing skb
Florian Westphal [Wed, 31 Dec 2014 12:33:41 +0000 (13:33 +0100)]
net: skbuff: don't zero tc members when freeing skb

Not needed, only four cases:
 - kfree_skb (or one of its aliases).
   Don't need to zero, memory will be freed.
 - kfree_skb_partial and head was stolen:  memory will be freed.
 - skb_morph:  The skb header fields (including tc ones) will be
   copied over from the 'to-be-morphed' skb right after
   skb_release_head_state returns.
 - skb_segment:  Same as before, all the skb header
   fields are copied over from the original skb right away.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetoot...
David S. Miller [Fri, 2 Jan 2015 20:58:21 +0000 (15:58 -0500)]
Merge branch 'for-upstream' of git://git./linux/kernel/git/bluetooth/bluetooth-next

Johan Hedberg say:

====================
pull request: bluetooth-next 2014-12-31

Here's the first batch of bluetooth patches for 3.20.

 - Cleanups & fixes to ieee802154  drivers
 - Fix synchronization of mgmt commands with respective HCI commands
 - Add self-tests for LE pairing crypto functionality
 - Remove 'BlueFritz!' specific handling from core using a new quirk flag
 - Public address configuration support for ath3012
 - Refactor debugfs support into a dedicated file
 - Initial support for LE Data Length Extension feature from Bluetooth 4.2

Please let me know if there are any issues pulling. Thanks.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agogeneve: Add Geneve GRO support
Joe Stringer [Wed, 31 Dec 2014 03:10:16 +0000 (19:10 -0800)]
geneve: Add Geneve GRO support

This results in an approximately 30% increase in throughput
when handling encapsulated bulk traffic.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: Add Transparent Ethernet Bridging GRO support.
Jesse Gross [Wed, 31 Dec 2014 03:10:15 +0000 (19:10 -0800)]
net: Add Transparent Ethernet Bridging GRO support.

Currently the only tunnel protocol that supports GRO with encapsulated
Ethernet is VXLAN. This pulls out the Ethernet code into a proper layer
so that it can be used by other tunnel protocols such as GRE and Geneve.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet/fsl: remove hardcoded clock setting from xgmac_mdio
Shaohui Xie [Tue, 30 Dec 2014 08:28:21 +0000 (16:28 +0800)]
net/fsl: remove hardcoded clock setting from xgmac_mdio

There is no need to set the clock speed in read/write which will be performed
unnecessarily for each mdio access. Init it during probe is enough.

Also, the hardcoded clock value is not a proper way for all SoCs.

Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet/fsl: remove irq assignment from xgmac_mdio
Shaohui Xie [Tue, 30 Dec 2014 08:28:00 +0000 (16:28 +0800)]
net/fsl: remove irq assignment from xgmac_mdio

Which is wrong and not used, so no extra space needed by
mdiobus_alloc_size(), use mdiobus_alloc() instead.

Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet/fsl: remove reset from xgmac_mdio
Shaohui Xie [Tue, 30 Dec 2014 08:27:33 +0000 (16:27 +0800)]
net/fsl: remove reset from xgmac_mdio

Since the reset is just clock setting, individual mdio reset is
not available.

Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'gmac-next'
David S. Miller [Thu, 1 Jan 2015 00:14:52 +0000 (19:14 -0500)]
Merge branch 'gmac-next'

Roger Chen says:

====================
support GMAC driver for RK3288

Roger Chen (6):
  patch1: add driver for Rockchip RK3288 SoCs integrated GMAC
  patch2: define clock ID used for GMAC
  patch3: modify CRU config for Rockchip RK3288 SoCs integrated GMAC
  patch4: dts: rockchip: add gmac info for rk3288
  patch5: dts: rockchip: enable gmac on RK3288 evb board
  patch6: add document for Rockchip RK3288 GMAC

Tested on rk3288 evb board:
Execute the following command to enable ethernet,
set local IP and ping a remote host.

busybox ifconfig eth0 up
busybox ifconfig eth0 192.168.1.111
ping 192.168.1.1
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoGMAC: add document for Rockchip RK3288 GMAC
Roger Chen [Mon, 29 Dec 2014 09:44:34 +0000 (17:44 +0800)]
GMAC: add document for Rockchip RK3288 GMAC

The document descripts how to add properties for GMAC in device tree.

change since v2:

1. remove power-gpio, reset-gpio, phyirq-gpio, pmu_regulator setting
2. add "snps,reset-gpio", "snps,reset-active-low;" "snps,reset-delays-us"

Signed-off-by: Roger Chen <roger.chen@rock-chips.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoARM: dts: rockchip: enable gmac on RK3288 evb board
Roger Chen [Mon, 29 Dec 2014 09:44:25 +0000 (17:44 +0800)]
ARM: dts: rockchip: enable gmac on RK3288 evb board

enable gmac in rk3288-evb-rk808.dts

changes since v2:
1. add fixed regulator for PHY
2. remove power-gpio, reset-gpio, phyirq-gpio, pmu_regulator setting
3. add "snps,reset-gpio", "snps,reset-active-low;" "snps,reset-delays-us"

Signed-off-by: Roger Chen <roger.chen@rock-chips.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoARM: dts: rockchip: add gmac info for rk3288
Roger Chen [Mon, 29 Dec 2014 09:44:16 +0000 (17:44 +0800)]
ARM: dts: rockchip: add gmac info for rk3288

add gmac info in rk3288.dtsi for GMAC driver

changes since v2:
1. add drive-strength in the pinctrl settings

Signed-off-by: Roger Chen <roger.chen@rock-chips.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoGMAC: modify CRU config for Rockchip RK3288 SoCs integrated GMAC
Roger Chen [Mon, 29 Dec 2014 09:44:07 +0000 (17:44 +0800)]
GMAC: modify CRU config for Rockchip RK3288 SoCs integrated GMAC

modify CRU config for GMAC driver

changes since v2:
1. remove SCLK_MAC_PLL

Signed-off-by: Roger Chen <roger.chen@rock-chips.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoGMAC: define clock ID used for GMAC
Roger Chen [Mon, 29 Dec 2014 09:43:55 +0000 (17:43 +0800)]
GMAC: define clock ID used for GMAC

changes since v2:
1. remove SCLK_MAC_PLL

Signed-off-by: Roger Chen <roger.chen@rock-chips.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoGMAC: add driver for Rockchip RK3288 SoCs integrated GMAC
Roger Chen [Mon, 29 Dec 2014 09:43:36 +0000 (17:43 +0800)]
GMAC: add driver for Rockchip RK3288 SoCs integrated GMAC

This driver is based on stmmac driver.

changes since v2:
- use tab instead of space for macros
- use HIWORD_UPDATE macro for GMAC_CLK_RX_DL_CFG and GMAC_CLK_TX_DL_CFG
- remove drive-strength setting in the driver and set it in the pinctrl settings
- use dev_err instead of pr_err
- remove clock names's macros, just use the real name of the clock
- use devm_clk_get() instead of clk_get()
- remove clk_set_parent(bsp_priv->clk_mac, bsp_priv->clk_mac_pll)
- remove gpio setting for LDO, just use regulator API
- remove phy reset using gpio in the glue layer, it has been handled in the stmmac driver
- remove handling phy interrupt (mii interrupt)

changes since v1:
- use BIT() to set register
- combine two remap_write() operations into one for the same register
- use macros for register value setting
- remove grf fail check in rk_gmac_setup() and save all the check in set_rgmii_speed()
- remove .tx_coe=1 in rk_gmac_data

Signed-off-by: Roger Chen <roger.chen@rock-chips.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoigb_ptp: Include clocksource.h to get CLOCKSOURCE_MASK.
David S. Miller [Wed, 31 Dec 2014 23:32:40 +0000 (18:32 -0500)]
igb_ptp: Include clocksource.h to get CLOCKSOURCE_MASK.

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoe1000e: Include clocksource.h to get CLOCKSOURCE_MASK.
David S. Miller [Wed, 31 Dec 2014 23:32:25 +0000 (18:32 -0500)]
e1000e: Include clocksource.h to get CLOCKSOURCE_MASK.

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'fib_trie-next'
David S. Miller [Wed, 31 Dec 2014 23:26:02 +0000 (18:26 -0500)]
Merge branch 'fib_trie-next'

Alexander Duyck says:

====================
fib_trie: Reduce time spent in fib_table_lookup by 35 to 75%

These patches are meant to address several performance issues I have seen
in the fib_trie implementation, and fib_table_lookup specifically.  With
these changes in place I have seen a reduction of up to 35 to 75% for the
total time spent in fib_table_lookup depending on the type of search being
performed.

On a VM running in my Corei7-4930K system with a trie of maximum depth of 7
this resulted in a reduction of over 370ns per packet in the total time to
process packets received from an ixgbe interface and route them to a dummy
interface.  This represents a failed lookup in the local trie followed by
a successful search in the main trie.

Baseline Refactor
  ixgbe->dummy routing 1.20Mpps 2.21Mpps
  ------------------------------------------------------------
  processing time per packet 835ns 453ns
  fib_table_lookup 50.1% 418ns 25.0% 113ns
  check_leaf.isra.9  7.9%  66ns    --  --
  ixgbe_clean_rx_irq  5.3%  44ns  9.8%  44ns
  ip_route_input_noref  2.9%  25ns  4.6%  21ns
  pvclock_clocksource_read  2.6%  21ns  4.6%  21ns
  ip_rcv  2.6%  22ns  4.0%  18ns

In the simple case of receiving a frame and dropping it before it can reach
the socket layer I saw a reduction of 40ns per packet.  This represents a
trip through the local trie with the correct leaf found with no need for
any backtracing.

Baseline Refactor
  ixgbe->local receive 2.65Mpps 2.96Mpps
  ------------------------------------------------------------
  processing time per packet 377ns 337ns
  fib_table_lookup 25.1%  95ns 25.8%  87ns
  ixgbe_clean_rx_irq  8.7%  33ns  9.0%  30ns
  check_leaf.isra.9  7.2%  27ns    --  --
  ip_rcv  5.7%  21ns  6.5%  22ns

These changes have resulted in several functions being inlined such as
check_leaf and fib_find_node, but due to the code simplification the
overall size of the code has been reduced.

   text    data     bss     dec     hex filename
  16932     376      16   17324    43ac net/ipv4/fib_trie.o - before
  15259     376       8   15643    3d1b net/ipv4/fib_trie.o - after

Changes since RFC:
  Replaced this_cpu_ptr with correct call to this_cpu_inc in patch 1
  Changed test for leaf_info mismatch to (key ^ n->key) & li->mask_plen in patch 10
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agofib_trie: Add tracking value for suffix length
Alexander Duyck [Wed, 31 Dec 2014 18:57:08 +0000 (10:57 -0800)]
fib_trie: Add tracking value for suffix length

This change adds a tracking value for the maximum suffix length of all
prefixes stored in any given tnode.  With this value we can determine if we
need to backtrace or not based on if the suffix is greater than the pos
value.

By doing this we can reduce the CPU overhead for lookups in the local table
as many of the prefixes there are 32b long and have a suffix length of 0
meaning we can immediately backtrace to the root node without needing to
test any of the nodes between it and where we ended up.

Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agofib_trie: Remove checks for index >= tnode_child_length from tnode_get_child
Alexander Duyck [Wed, 31 Dec 2014 18:57:02 +0000 (10:57 -0800)]
fib_trie: Remove checks for index >= tnode_child_length from tnode_get_child

For some reason the compiler doesn't seem to understand that when we are in
a loop that runs from tnode_child_length - 1 to 0 we don't expect the value
of tn->bits to change.  As such every call to tnode_get_child was rerunning
tnode_chile_length which ended up consuming quite a bit of space in the
resultant assembly code.

I have gone though and verified that in all cases where tnode_get_child
is used we are either winding though a fixed loop from tnode_child_length -
1 to 0, or are in a fastpath case where we are verifying the value by
either checking for any remaining bits after shifting index by bits and
testing for leaf, or by using tnode_child_length.

size net/ipv4/fib_trie.o
Before:
   text    data     bss     dec     hex filename
  15506     376       8   15890    3e12 net/ipv4/fib_trie.o

After:
   text    data     bss     dec     hex filename
  14827     376       8   15211    3b6b net/ipv4/fib_trie.o

Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agofib_trie: inflate/halve nodes in a more RCU friendly way
Alexander Duyck [Wed, 31 Dec 2014 18:56:55 +0000 (10:56 -0800)]
fib_trie: inflate/halve nodes in a more RCU friendly way

This change pulls the node_set_parent functionality out of put_child_reorg
and instead leaves that to the function to take care of as well.  By doing
this we can fully construct the new cluster of tnodes and all of the
pointers out of it before we start routing pointers into it.

I am suspecting this will likely fix some concurency issues though I don't
have a good test to show as such.

Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agofib_trie: Push tnode flushing down to inflate/halve
Alexander Duyck [Wed, 31 Dec 2014 18:56:49 +0000 (10:56 -0800)]
fib_trie: Push tnode flushing down to inflate/halve

This change pushes the tnode freeing down into the inflate and halve
functions.  It makes more sense here as we have a better grasp of what is
going on and when a given cluster of nodes is ready to be freed.

I believe this may address a bug in the freeing logic as well.  For some
reason if the freelist got to a certain size we would call
synchronize_rcu().  I'm assuming that what they meant to do is call
synchronize_rcu() after they had handed off that much memory via
call_rcu().  As such that is what I have updated the behavior to be.

Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agofib_trie: Push assignment of child to parent down into inflate/halve
Alexander Duyck [Wed, 31 Dec 2014 18:56:43 +0000 (10:56 -0800)]
fib_trie: Push assignment of child to parent down into inflate/halve

This change makes it so that the assignment of the tnode to the parent is
handled directly within whatever function is currently handling the node be
it inflate, halve, or resize.  By doing this we can avoid some of the need
to set NULL pointers in the tree while we are resizing the subnodes.

Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agofib_trie: Add functions should_inflate and should_halve
Alexander Duyck [Wed, 31 Dec 2014 18:56:37 +0000 (10:56 -0800)]
fib_trie: Add functions should_inflate and should_halve

This change pulls the logic for if we should inflate/halve the nodes out
into separate functions.  It also addresses what I believe is a bug where 1
full node is all that is needed to keep a node from ever being halved.

Simple script to reproduce the issue:
modprobe dummy; ifconfig dummy0 up
for i in `seq 0 255`; do ifconfig dummy0:$i 10.0.${i}.1/24 up; done
ifconfig dummy0:256 10.0.255.33/16 up
for i in `seq 0 254`; do ifconfig dummy0:$i down; done

Results from /proc/net/fib_triestat
Before:
Local:
Aver depth:     3.00
Max depth:      4
Leaves:         17
Prefixes:       18
Internal nodes: 11
  1: 8  2: 2  10: 1
Pointers: 1048
Null ptrs: 1021
Total size: 11  kB
After:
Local:
Aver depth:     3.41
Max depth:      5
Leaves:         17
Prefixes:       18
Internal nodes: 12
  1: 8  2: 3  3: 1
Pointers: 36
Null ptrs: 8
Total size: 3  kB

Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agofib_trie: Move resize to after inflate/halve
Alexander Duyck [Wed, 31 Dec 2014 18:56:31 +0000 (10:56 -0800)]
fib_trie: Move resize to after inflate/halve

This change consists of a cut/paste of resize to behind inflate and halve
so that I could remove the two function prototypes.

Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agofib_trie: Push rcu_read_lock/unlock to callers
Alexander Duyck [Wed, 31 Dec 2014 18:56:24 +0000 (10:56 -0800)]
fib_trie: Push rcu_read_lock/unlock to callers

This change is to start cleaning up some of the rcu_read_lock/unlock
handling.  I realized while reviewing the code there are several spots that
I don't believe are being handled correctly or are masking warnings by
locally calling rcu_read_lock/unlock instead of calling them at the correct
level.

A common example is a call to fib_get_table followed by fib_table_lookup.
The rcu_read_lock/unlock ought to wrap both but there are several spots where
they were not wrapped.

Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agofib_trie: Use unsigned long for anything dealing with a shift by bits
Alexander Duyck [Wed, 31 Dec 2014 18:56:18 +0000 (10:56 -0800)]
fib_trie: Use unsigned long for anything dealing with a shift by bits

This change makes it so that anything that can be shifted by, or compared
to a value shifted by bits is updated to be an unsigned long.  This is
mostly a precaution against an insanely huge address space that somehow
starts coming close to the 2^32 root node size which would require
something like 1.5 billion addresses.

I chose unsigned long instead of unsigned long long since I do not believe
it is possible to allocate a 32 bit tnode on a 32 bit system as the memory
consumed would be 16GB + 28B which exceeds the addressible space for any
one process.

Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agofib_trie: Update meaning of pos to represent unchecked bits
Alexander Duyck [Wed, 31 Dec 2014 18:56:12 +0000 (10:56 -0800)]
fib_trie: Update meaning of pos to represent unchecked bits

This change moves the pos value to the other side of the "bits" field.  By
doing this it actually simplifies a significant amount of code in the trie.

For example when halving a tree we know that the bit lost exists at
oldnode->pos, and if we inflate the tree the new bit being add is at
tn->pos.  Previously to find those bits you would have to subtract pos and
bits from the keylength or start with a value of (1 << 31) and then shift
that.

There are a number of spots throughout the code that benefit from this.  In
the case of the hot-path searches the main advantage is that we can drop 2
or more operations from the search path as we no longer need to compute the
value for the index to be shifted by and can instead just use the raw pos
value.

In addition the tkey_extract_bits is now defunct and can be replaced by
get_index since the two operations were doing the same thing, but now
get_index does it much more quickly as it is only an xor and shift versus a
pair of shifts and a subtraction.

Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agofib_trie: Optimize fib_table_insert
Alexander Duyck [Wed, 31 Dec 2014 18:56:06 +0000 (10:56 -0800)]
fib_trie: Optimize fib_table_insert

This patch updates the fib_table_insert function to take advantage of the
changes made to improve the performance of fib_table_lookup.  As a result
the code should be smaller and run faster then the original.

Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agofib_trie: Optimize fib_find_node
Alexander Duyck [Wed, 31 Dec 2014 18:56:00 +0000 (10:56 -0800)]
fib_trie: Optimize fib_find_node

This patch makes use of the same features I made use of for
fib_table_lookup to streamline fib_find_node.  The resultant code should be
smaller and run faster than the original.

Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agofib_trie: Optimize fib_table_lookup to avoid wasting time on loops/variables
Alexander Duyck [Wed, 31 Dec 2014 18:55:54 +0000 (10:55 -0800)]
fib_trie: Optimize fib_table_lookup to avoid wasting time on loops/variables

This patch is meant to reduce the complexity of fib_table_lookup by reducing
the number of variables to the bare minimum while still keeping the same if
not improved functionality versus the original.

Most of this change was started off by the desire to rid the function of
chopped_off and current_prefix_length as they actually added very little to
the function since they only applied when computing the cindex.  I was able
to replace them mostly with just a check for the prefix match.  As long as
the prefix between the key and the node being tested was the same we know
we can search the tnode fully versus just testing cindex 0.

The second portion of the change ended up being a massive reordering.
Originally the calls to check_leaf were up near the start of the loop, and
the backtracing and descending into lower levels of tnodes was later.  This
didn't make much sense as the structure of the tree means the leaves are
always the last thing to be tested.  As such I reordered things so that we
instead have a loop that will delve into the tree and only exit when we
have either found a leaf or we have exhausted the tree.  The advantage of
rearranging things like this is that we can fully inline check_leaf since
there is now only one reference to it in the function.

Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agofib_trie: Merge leaf into tnode
Alexander Duyck [Wed, 31 Dec 2014 18:55:47 +0000 (10:55 -0800)]
fib_trie: Merge leaf into tnode

This change makes it so that leaf and tnode are the same struct.  As a
result there is no need for rt_trie_node anymore since everyting can be
merged into tnode.

On 32b systems this results in the leaf being 4 bytes larger, however I
don't know if that is really an issue as this and an eariler patch that
added bits & pos have increased the size from 20 to 28.  If I am not
mistaken slub/slab allocate on power of 2 sizes so 20 was likely being
rounded up to 32 anyway.

Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agofib_trie: Merge tnode_free and leaf_free into node_free
Alexander Duyck [Wed, 31 Dec 2014 18:55:41 +0000 (10:55 -0800)]
fib_trie: Merge tnode_free and leaf_free into node_free

Both the leaf and the tnode had an rcu_head in them, but they had them in
slightly different places.  Since we now have them in the same spot and
know that any node with bits == 0 is a leaf and the rest are either vmalloc
or kmalloc tnodes depending on the value of bits it makes it easy to combine
the functions and reduce overhead.

In addition I have taken advantage of the rcu_head pointer to go ahead and
put together a simple linked list instead of using the tnode pointer as
this way we can merge either type of structure for freeing.

Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agofib_trie: Make leaf and tnode more uniform
Alexander Duyck [Wed, 31 Dec 2014 18:55:35 +0000 (10:55 -0800)]
fib_trie: Make leaf and tnode more uniform

This change makes some fundamental changes to the way leaves and tnodes are
constructed.  The big differences are:
1.  Leaves now populate pos and bits indicating their full key size.
2.  Trie nodes now mask out their lower bits to be consistent with the leaf
3.  Both structures have been reordered so that rt_trie_node now consisists
    of a much larger region including the pos, bits, and rcu portions of
    the tnode structure.

On 32b systems this will result in the leaf being 4B larger as the pos and
bits values were added to a hole created by the key as it was only 4B in
length.

Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agofib_trie: Update usage stats to be percpu instead of global variables
Alexander Duyck [Wed, 31 Dec 2014 18:55:29 +0000 (10:55 -0800)]
fib_trie: Update usage stats to be percpu instead of global variables

The trie usage stats were currently being shared by all threads that were
calling fib_table_lookup.  As a result when multiple threads were
performing lookups simultaneously the trie would begin to cache bounce
between those threads.

In order to prevent this I have updated the usage stats to use a set of
percpu variables.  By doing this we should be able to avoid the cache
bouncing and still make use of these stats.

Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agogre: allow live address change
stephen hemminger [Sat, 27 Dec 2014 18:01:42 +0000 (10:01 -0800)]
gre: allow live address change

The GRE tap device supports Ethernet over GRE, but doesn't
care about the source address of the tunnel, therefore it
can be changed without bring device down.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agol2tp : multicast notification to the registered listeners
Bill Hong [Sat, 27 Dec 2014 18:12:39 +0000 (10:12 -0800)]
l2tp : multicast notification to the registered listeners

Previously l2tp module did not provide any means for the user space to
get notified when tunnels/sessions are added/modified/deleted.
This change contains the following
- create a multicast group for the listeners to register.
- notify the registered listeners when the tunnels/sessions are
  created/modified/deleted.

Signed-off-by: Bill Hong <bhong@brocade.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Sven-Thorsten Dietrich <sven@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agotun: return proper error code from tun_do_read
Alex Gartrell [Fri, 26 Dec 2014 07:22:49 +0000 (23:22 -0800)]
tun: return proper error code from tun_do_read

Instead of -1 with EAGAIN, read on a O_NONBLOCK tun fd will return 0.  This
fixes this by properly returning the error code from __skb_recv_datagram.

Signed-off-by: Alex Gartrell <agartrell@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agotun: Fixed unsigned/signed comparison
Alex Gartrell [Fri, 26 Dec 2014 07:05:03 +0000 (23:05 -0800)]
tun: Fixed unsigned/signed comparison

Validated that this was actually using the unsigned comparison with gdb.

Signed-off-by: Alex Gartrell <agartrell@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agotipc: replace 0 by NULL for pointers
Fabian Frederick [Thu, 25 Dec 2014 11:05:50 +0000 (12:05 +0100)]
tipc: replace 0 by NULL for pointers

Fix sparse warning:
net/tipc/link.c:1924:40: warning: Using plain integer as NULL pointer

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'enic-next'
David S. Miller [Wed, 31 Dec 2014 18:08:54 +0000 (13:08 -0500)]
Merge branch 'enic-next'

Govindarajulu Varadarajan says:

====================
enic: Check for DMA mapping error

After dma mapping the buffers, enic does not call dma_mapping_error() to check
if mapping is successful.

This series fixes the issue by checking return value of pci_dma_mapping_error()
after pci_map_single().

This is reported by redhat here
https://bugzilla.redhat.com/show_bug.cgi?id=1145016
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoenic: add stats for dma mapping error
Govindarajulu Varadarajan [Wed, 24 Dec 2014 10:29:38 +0000 (15:59 +0530)]
enic: add stats for dma mapping error

This patch adds generic statistics for enic. As of now dma_map_error is the only
member. dma_map_erro is incremented every time dma maping error happens.

Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoenic: check dma_mapping_error
Govindarajulu Varadarajan [Wed, 24 Dec 2014 10:29:37 +0000 (15:59 +0530)]
enic: check dma_mapping_error

This patch checks for pci_dma_mapping_error() after dma mapping the data.
If the dma mapping fails we remove the previously queued frags and return
NETDEV_TX_OK.

Reported-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoenic: make vnic_wq_buf doubly linked
Govindarajulu Varadarajan [Wed, 24 Dec 2014 10:29:36 +0000 (15:59 +0530)]
enic: make vnic_wq_buf doubly linked

This patch makes vnic_wq_buf doubly liked list. This is needed for dma_mapping
error check, in case some frag's dma map fails, we need to move back and remove
previously queued buffers.

Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'fec-next'
David S. Miller [Wed, 31 Dec 2014 18:06:57 +0000 (13:06 -0500)]
Merge branch 'fec-next'

Fugang Duan says:

====================
net: fec: add Wake-on-LAN support

The patch series enable FEC Wake-on-LAN feature for i.MX6q/dl and i.MX6SX SOCs.
FEC HW support sleep mode, when system in suspend status with FEC all clock gate
off, magic packet can wake up system. For different SOCs, there have special SOC
GPR register to let FEC enter sleep mode or exit sleep mode, add these to platform
callback for driver' call.

Patch#1: add WOL interface supports.
Patch#2: add SOC special sleep of/off operations for driver's sleep callback.
Patch#3: add magic pattern support for devicetree.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoARM: dts: imx6qdl: enable FEC magic-packet feature
Nimrod Andy [Wed, 24 Dec 2014 09:30:41 +0000 (17:30 +0800)]
ARM: dts: imx6qdl: enable FEC magic-packet feature

Add FEC magic-packet feature support.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoARM: imx: add FEC sleep mode callback function
Nimrod Andy [Wed, 24 Dec 2014 09:30:40 +0000 (17:30 +0800)]
ARM: imx: add FEC sleep mode callback function

i.MX6q/dl, i.MX6SX SOCs enet support sleep mode that magic packet can
wake up system in suspend status. For different SOCs, there have some
SOC specifical GPR register to set sleep on/off mode. So add these to
callback function for driver.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: add Wake-on-LAN support
Nimrod Andy [Wed, 24 Dec 2014 09:30:39 +0000 (17:30 +0800)]
net: fec: add Wake-on-LAN support

Support for Wake-on-LAN using Magic Packet. ENET IP supports sleep mode
in low power status, when system enter suspend status, Magic packet can
wake up system even if all SOC clocks are gate. The patch doing below things:
- flagging the device as a wakeup source for the system, as well as
  its Wake-on-LAN interrupt
- prepare the hardware for entering WoL mode
- add standard ethtool WOL interface
- enable the ENET interrupt to wake us

Tested on i.MX6q/dl sabresd, sabreauto boards, i.MX6SX arm2 boards.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: gianfar: add missing __iomem annotation
Kevin Hao [Wed, 24 Dec 2014 06:05:45 +0000 (14:05 +0800)]
net: gianfar: add missing __iomem annotation

Fix the following spare warning:
drivers/net/ethernet/freescale/gianfar.c:3521:60: warning: incorrect type in argument 1 (different address spaces)
drivers/net/ethernet/freescale/gianfar.c:3521:60:    expected unsigned int [noderef] <asn:2>*addr
drivers/net/ethernet/freescale/gianfar.c:3521:60:    got unsigned int [usertype] *rfbptr
drivers/net/ethernet/freescale/gianfar.c:205:16: warning: incorrect type in assignment (different address spaces)
drivers/net/ethernet/freescale/gianfar.c:205:16:    expected unsigned int [usertype] *rfbptr
drivers/net/ethernet/freescale/gianfar.c:205:16:    got unsigned int [noderef] <asn:2>*<noident>
drivers/net/ethernet/freescale/gianfar.c:2918:44: warning: incorrect type in argument 1 (different address spaces)
drivers/net/ethernet/freescale/gianfar.c:2918:44:    expected unsigned int [noderef] <asn:2>*addr
drivers/net/ethernet/freescale/gianfar.c:2918:44:    got unsigned int [usertype] *rfbptr

Signed-off-by: Kevin Hao <haokexin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: gianfar: mark the local functions static
Kevin Hao [Wed, 24 Dec 2014 06:05:44 +0000 (14:05 +0800)]
net: gianfar: mark the local functions static

Signed-off-by: Kevin Hao <haokexin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agovirtio-net: don't do header check for dodgy gso packets
Jason Wang [Wed, 24 Dec 2014 03:03:52 +0000 (11:03 +0800)]
virtio-net: don't do header check for dodgy gso packets

There's no need to do header check for virtio-net since:

- Host sets dodgy for all gso packets from guest and check the header.
- Host should be prepared for all kinds of evil packets from guest, since
  malicious guest can send any kinds of packet.

So this patch sets NETIF_F_GSO_ROBUST for virtio-net to skip the check.

Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoarm: sa1100: move irda header to linux/platform_data
Dmitry Eremin-Solenikov [Tue, 23 Dec 2014 22:14:14 +0000 (01:14 +0300)]
arm: sa1100: move irda header to linux/platform_data

In the end asm/mach/irda.h header is not used by anybody except sa1100.
Move the header to the platform data includes dir and rename it to
irda-sa11x0.h.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: sxgbe: Use setup_timer
Julia Lawall [Fri, 26 Dec 2014 14:35:46 +0000 (15:35 +0100)]
net: sxgbe: Use setup_timer

Convert a call to init_timer and accompanying intializations of
the timer's data and function fields to a call to setup_timer.

A simplified version of the semantic match that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression t,f,d;
@@

-init_timer(&t);
+setup_timer(&t,f,d);
-t.function = f;
-t.data = d;
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoksz884x: Use setup_timer
Julia Lawall [Fri, 26 Dec 2014 14:35:42 +0000 (15:35 +0100)]
ksz884x: Use setup_timer

Convert a call to init_timer and accompanying intializations of
the timer's data and function fields to a call to setup_timer.

A simplified version of the semantic match that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression t,f,d;
@@

-init_timer(&t);
+setup_timer(&t,f,d);
-t.function = f;
-t.data = d;
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoatl1e: Use setup_timer
Julia Lawall [Fri, 26 Dec 2014 14:35:35 +0000 (15:35 +0100)]
atl1e: Use setup_timer

Convert a call to init_timer and accompanying intializations of
the timer's data and function fields to a call to setup_timer.

A simplified version of the semantic match that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression t,f,d;
@@

-init_timer(&t);
+setup_timer(&t,f,d);
-t.function = f;
-t.data = d;
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoatheros: atlx: Use setup_timer
Julia Lawall [Fri, 26 Dec 2014 14:35:34 +0000 (15:35 +0100)]
atheros: atlx: Use setup_timer

Convert a call to init_timer and accompanying intializations of
the timer's data and function fields to a call to setup_timer.

A simplified version of the semantic match that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression t,f,d;
@@

-init_timer(&t);
+setup_timer(&t,f,d);
-t.function = f;
-t.data = d;
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'timecounter'
David S. Miller [Tue, 30 Dec 2014 23:30:00 +0000 (18:30 -0500)]
Merge branch 'timecounter'

Richard Cochran says:

====================
Time Counter fixes and improvements

Several PTP Hardware Clock (PHC) drivers implement the clock in
software using the timecounter/cyclecounter code. This series adds one
simple improvement and one more subtle fix to the shared timecounter
facility. Credit for this series goes to Janusz Użycki, who pointed
the issues out to me off list.

Patch #1 simply move the timecounter code into its own file. When
working on this series, it was really annoying to see half the kernel
recompile after every tweak to the timecounter stuff. There is no
reason to keep this together with the clocksource code.

Patch #2 implements an improved adjtime() method, and patches 3-10
convert all of the drivers over to the new method.

Patch #11 fixes a subtle but important issue with the timecounter WRT
frequency adjustment. As it stands now, a timecounter based PHC will
exhibit a variable frequency resolution (and variable time error)
depending on how often the clock is read.

In timecounter_read_delta(), the expression

   (delta * cc->mult) >> cc->shift;

can lose resolution from the adjusted value of 'mult'. If the value
of 'delta' is too small, then small changes in 'mult' have no effect.
However, if the delta value is large enough, then small changes in
'mult' will have an effect.

Reading the clock too often means smaller 'delta' values which in turn
will spoil the fine adjustments made to 'mult'. Up until now, this
effect did not show up in my testing. The following example explains
why.

The CPTS has an input clock of 250 MHz, and the clock source uses
mult=0x80000000 and shift=29, making the ticks to nanoseconds
conversion like this:

   ticks * 2^31
   ------------
       2^29

Imagine what happens if the clock is read every 10 milliseconds. Ten
milliseconds are about 2500000 ticks, which corresponds to about 21
bits. The product in the numerator has then 52 bits. After the shift
operation, 23 bits are preserved. This results in a frequency
adjustment resolution of about 0.1 ppm (not _too_ bad.)

A frequency resolution of 1 ppm requires 20 bits.
A frequency resolution of 1 ppb requires 30 bits.

For the 250 MHz CPTS clock, reading every 4 seconds yields a 1 ppb
resolution (which is the finest that our API allows).

However, the error can be much higher if the clock is read too often
or if time stamps occur close in time to read operations. In general
it is really not acceptable to allow the rate of clock readings to
influence the clock accuracy.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agotimecounter: keep track of accumulated fractional nanoseconds
Richard Cochran [Sun, 21 Dec 2014 18:47:06 +0000 (19:47 +0100)]
timecounter: keep track of accumulated fractional nanoseconds

The current timecounter implementation will drop a variable amount
of resolution, depending on the magnitude of the time delta. In
other words, reading the clock too often or too close to a time
stamp conversion will introduce errors into the time values. This
patch fixes the issue by introducing a fractional nanosecond field
that accumulates the low order bits.

Reported-by: Janusz Użycki <j.uzycki@elproma.com.pl>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: cpts: convert to timecounter adjtime.
Richard Cochran [Sun, 21 Dec 2014 18:47:05 +0000 (19:47 +0100)]
net: cpts: convert to timecounter adjtime.

This patch changes the driver to use the new and improved method
for adjusting the offset of a timecounter.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: mlx4: convert to timecounter adjtime.
Richard Cochran [Sun, 21 Dec 2014 18:47:04 +0000 (19:47 +0100)]
net: mlx4: convert to timecounter adjtime.

This patch changes the driver to use the new and improved method
for adjusting the offset of a timecounter.

Compile tested only.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>