]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/log
mirror_ubuntu-bionic-kernel.git
7 years agoBluetooth: btusb: Add support for 413c:8143
Wen-chien Jesse Sung [Tue, 10 Jan 2017 07:41:13 +0000 (15:41 +0800)]
Bluetooth: btusb: Add support for 413c:8143

This is a Boardcom module and requires patchram to work.

T: Bus=01 Lev=03 Prnt=03 Port=01 Cnt=02 Dev#= 5 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=413c ProdID=8143 Rev= 1.12
S: Manufacturer=Broadcom Corp
S: Product=BCM20702A0
S: SerialNumber=20689D1FAF94
C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr= 0mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms
E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms
I: If#= 1 Alt= 1 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms
I: If#= 1 Alt= 2 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms
I: If#= 1 Alt= 3 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms
I: If#= 1 Alt= 4 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms
I: If#= 1 Alt= 5 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E: Ad=84(I) Atr=02(Bulk) MxPS= 32 Ivl=0ms
E: Ad=04(O) Atr=02(Bulk) MxPS= 32 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)

Signed-off-by: Wen-chien Jesse Sung <jesse.sung@canonical.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
7 years agobtmrvl: use dt's irqflags for wakeup pin
Jeffy Chen [Mon, 23 Jan 2017 04:18:53 +0000 (12:18 +0800)]
btmrvl: use dt's irqflags for wakeup pin

Use irqflags parsed from dt.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
7 years agobtmrvl: set irq_bt to -1 when failed to parse it
Jeffy Chen [Mon, 23 Jan 2017 04:18:52 +0000 (12:18 +0800)]
btmrvl: set irq_bt to -1 when failed to parse it

The irq_of_parse_and_map will return 0 as a invalid irq.

Set irq_bt to -1 in this case, so that the btmrvl resume/suspend code
would not try to enable/disable it.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
7 years agobtmrvl: avoid double-disable_irq() race
Jeffy Chen [Mon, 23 Jan 2017 04:18:51 +0000 (12:18 +0800)]
btmrvl: avoid double-disable_irq() race

It's much the same as what we did for mwifiex in:
b9da4d2 mwifiex: avoid double-disable_irq() race

"We have a race where the wakeup IRQ might be in flight while we're
calling mwifiex_disable_wake() from resume(). This can leave us
disabling the IRQ twice.

Let's disable the IRQ and enable it in case if we have double-disabled
it."

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
7 years agoBluetooth: Fix NULL pointer dereference in bt_sock_recvmsg
Ezequiel Garcia [Thu, 29 Dec 2016 12:51:19 +0000 (09:51 -0300)]
Bluetooth: Fix NULL pointer dereference in bt_sock_recvmsg

As per the comment in include/linux/net.h, the recvfrom handlers
should expect msg_name to be NULL. However, bt_sock_recvmsg()
is currently not checking it, which could lead to a NULL pointer
dereference.

The following NULL pointer dereference was produced while testing
L2CAP datagram reception. Note that the kernel is tainted due to
the r8723bs module being inserted. However, it seems the fix still
applies.

$ l2test -r -G
l2test[326]: Receiving ...
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = ee008000
[00000000] *pgd=7f896835
Internal error: Oops: 817 [#1] PREEMPT SMP ARM
Modules linked in: r8723bs(O)
CPU: 0 PID: 326 Comm: l2test Tainted: G           O 4.8.0 #1
Hardware name: Allwinner sun7i (A20) Family
task: ef1c6880 task.stack: eea70000
PC is at __memzero+0x58/0x80
LR is at l2cap_skb_msg_name+0x1c/0x4c
pc : [<c02c47d8>]    lr : [<c0506278>]    psr: 00070013
sp : eea71e60  ip : 00000000  fp : 00034e1c
r10: 00000000  r9 : 00000000  r8 : eea71ed4
r7 : 000002a0  r6 : eea71ed8  r5 : 00000000  r4 : ee4a5d80
r3 : 00000000  r2 : 00000000  r1 : 0000000e  r0 : 00000000
Flags: nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM Segment none
Control: 10c5387d  Table: 7600806a  DAC: 00000051
Process l2test (pid: 326, stack limit = 0xeea70210)
Stack: (0xeea71e60 to 0xeea72000)
1e60: ee4a5d80 eeac2800 000002a0 c04d7114 173eefa0 00000000 c06ca68e 00000000
1e80: 00000001 eeac2800 eef23500 00000000 000002a0 eea71ed4 eea70000 c0504d50
1ea0: 00000000 00000000 eef23500 00000000 00000000 c044e8a0 eea71edc eea9f904
1ec0: bef89aa0 fffffff7 00000000 00035008 000002a0 00000000 00000000 00000000
1ee0: 00000000 00000000 eea71ed4 00000000 00000000 00000000 00004000 00000000
1f00: 0000011b c01078c4 eea70000 c044e5e4 00000000 00000000 642f0001 6c2f7665
1f20: 0000676f 00000000 00000000 00000000 00000000 00000000 00000000 00000000
1f40: 00000000 00000000 00000000 00000000 00000000 ffffffff 00000001 bef89ad8
1f60: 000000a8 c01078c4 eea70000 00000000 00034e1c c01e6c74 00000000 00000000
1f80: 00034e1c 000341f8 00000000 00000123 c01078c4 c044e90c 00000000 00000000
1fa0: 000002a0 c0107700 00034e1c 000341f8 00000003 00035008 000002a0 00000000
1fc0: 00034e1c 000341f8 00000000 00000123 00000000 00000000 00011ffc 00034e1c
1fe0: 00000000 bef89aa4 0001211c b6eebb60 60070010 00000003 00000000 00000000
[<c02c47d8>] (__memzero) from [<c0506278>] (l2cap_skb_msg_name+0x1c/0x4c)
[<c0506278>] (l2cap_skb_msg_name) from [<c04d7114>] (bt_sock_recvmsg+0x128/0x160)
[<c04d7114>] (bt_sock_recvmsg) from [<c0504d50>] (l2cap_sock_recvmsg+0x98/0x134)
[<c0504d50>] (l2cap_sock_recvmsg) from [<c044e8a0>] (SyS_recvfrom+0x94/0xec)
[<c044e8a0>] (SyS_recvfrom) from [<c044e90c>] (SyS_recv+0x14/0x1c)
[<c044e90c>] (SyS_recv) from [<c0107700>] (ret_fast_syscall+0x0/0x3c)
Code: e3110010 18a0500c e49de004 e3110008 (18a0000c)
---[ end trace 224e35e79fe06b42 ]---

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
7 years agoBluetooth: btusb: Configure Marvell to use one of the pins for oob wakeup
Rajat Jain [Wed, 1 Feb 2017 22:24:10 +0000 (14:24 -0800)]
Bluetooth: btusb: Configure Marvell to use one of the pins for oob wakeup

The Marvell devices may have many gpio pins, and hence for wakeup
on these out-of-band pins, the chip needs to be told which pin is
to be used for wakeup, using an hci command.

Thus, we read the pin number etc from the device tree node and send
a command to the chip.

Signed-off-by: Rajat Jain <rajatja@google.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
7 years agoBluetooth: btusb: Add out-of-band wakeup support
Rajat Jain [Wed, 1 Feb 2017 22:24:09 +0000 (14:24 -0800)]
Bluetooth: btusb: Add out-of-band wakeup support

Some onboard BT chips (e.g. Marvell 8997) contain a wakeup pin that
can be connected to a gpio on the CPU side, and can be used to wakeup
the host out-of-band. This can be useful in situations where the
in-band wakeup is not possible or not preferable (e.g. the in-band
wakeup may require the USB host controller to remain active, and
hence consuming more system power during system sleep).

The oob gpio interrupt to be used for wakeup on the CPU side, is
read from the device tree node, (using standard interrupt descriptors).
A devcie tree binding document is also added for the driver. The
compatible string is in compliance with
Documentation/devicetree/bindings/usb/usb-device.txt

Signed-off-by: Rajat Jain <rajatja@google.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
7 years agoBluetooth: btusb: Use an error label for error paths
Rajat Jain [Wed, 1 Feb 2017 22:24:08 +0000 (14:24 -0800)]
Bluetooth: btusb: Use an error label for error paths

Use a label to remove the repetetive cleanup, for error cases.

Signed-off-by: Rajat Jain <rajatja@google.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
7 years agoBluetooth: btqcomsmd: Fix module autoload
Javier Martinez Canillas [Mon, 2 Jan 2017 13:09:56 +0000 (10:09 -0300)]
Bluetooth: btqcomsmd: Fix module autoload

If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/bluetooth/btqcomsmd.ko | grep alias
$

After this patch:

$ modinfo drivers/bluetooth/btqcomsmd.ko | grep alias
alias:          of:N*T*Cqcom,wcnss-btC*
alias:          of:N*T*Cqcom,wcnss-bt

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
7 years agoBluetooth: btusb: add support for 0bb4:0306
Christoph Haag [Fri, 10 Feb 2017 13:02:45 +0000 (14:02 +0100)]
Bluetooth: btusb: add support for 0bb4:0306

It's a custom USB ID for the broadcom bt adapter in the HTC Vive.

T:  Bus=01 Lev=02 Prnt=02 Port=01 Cnt=02 Dev#=  6 Spd=12   MxCh= 0
D:  Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=0bb4 ProdID=0306 Rev= 1.12
S:  Manufacturer=Broadcom Corp
S:  Product=BCM2045A0
S:  SerialNumber=AC3743E110CE
C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
I:  If#= 1 Alt= 1 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
I:  If#= 1 Alt= 2 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
I:  If#= 1 Alt= 3 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
I:  If#= 1 Alt= 4 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
I:  If#= 1 Alt= 5 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=btusb
E:  Ad=84(I) Atr=02(Bulk) MxPS=  32 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS=  32 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)

dmesg:
Bluetooth: hci0: BCM: chip id 102
Bluetooth: hci0: c-l
Bluetooth: hci0: BCM (001.001.005) build 0000
Bluetooth: hci0: BCM (001.001.005) build 0481
Bluetooth: hci0: BCM20703A1 Generic USB 20Mhz fcbga_BU

Signed-off-by: Christoph Haag <haagch@frickel.club>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
7 years agoatm: idt77252, use setup_timer and mod_timer
Jan Koniarik [Wed, 15 Feb 2017 15:59:35 +0000 (16:59 +0100)]
atm: idt77252, use setup_timer and mod_timer

Stop accessing timer struct members directly and use setup_timer and
mod_timer helpers intended for that use. It makes the code cleaner and
will allow for easier change of the timer struct internals.

Signed-off-by: Jan Koniarik <jan.koniarik@trustica.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Chas Williams <3chas3@gmail.com>
Cc: <linux-atm-general@lists.sourceforge.net>
Cc: <netdev@vger.kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agomlxsw: acl: Use PBS type for forward action
Jiri Pirko [Wed, 15 Feb 2017 11:09:51 +0000 (12:09 +0100)]
mlxsw: acl: Use PBS type for forward action

Current behaviour of "mirred redirect" action (forward) offload is a bit
odd. For matched packets the action forwards them to the desired
destination, but it also lets the packet duplicates to go the original
way down (bridge, router, etc). That is more like "mirred mirror".
Fix this by using PBS type which behaves exactly like "mirred redirect".
Note that PBS does not support loopback mode.

Fixes: 4cda7d8d7098 ("mlxsw: core: Introduce flexible actions support")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'stmmac-misc'
David S. Miller [Wed, 15 Feb 2017 18:20:57 +0000 (13:20 -0500)]
Merge branch 'stmmac-misc'

Corentin Labbe says:

====================
stmmac: misc patchs

This is a follow up of my previous stmmac serie which address some comment
done in v2.
====================

Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: stmmac: invert the logic for dumping regs
LABBE Corentin [Wed, 15 Feb 2017 09:46:45 +0000 (10:46 +0100)]
net: stmmac: invert the logic for dumping regs

It is easier to follow the logic by removing the not operator

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Reviewed-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: stmmac: reduce indentation by adding a continue
LABBE Corentin [Wed, 15 Feb 2017 09:46:44 +0000 (10:46 +0100)]
net: stmmac: reduce indentation by adding a continue

As suggested by Joe Perches, replacing the "if phydev" logic permit to
reduce indentation in the for loop.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Reviewed-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: stmmac: split the stmmac_adjust_link 10/100 case
LABBE Corentin [Wed, 15 Feb 2017 09:46:43 +0000 (10:46 +0100)]
net: stmmac: split the stmmac_adjust_link 10/100 case

The 10/100 case have too many ifcase.
This patch split it for removing an if.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Reviewed-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: stmmac: run stmmac_hw_fix_mac_speed when speed is valid
LABBE Corentin [Wed, 15 Feb 2017 09:46:42 +0000 (10:46 +0100)]
net: stmmac: run stmmac_hw_fix_mac_speed when speed is valid

This patch mutualise a bit by running stmmac_hw_fix_mac_speed() after
the switch in case of valid speed.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Reviewed-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: stmmac: set speed at SPEED_UNKNOWN in case of broken speed
LABBE Corentin [Wed, 15 Feb 2017 09:46:41 +0000 (10:46 +0100)]
net: stmmac: set speed at SPEED_UNKNOWN in case of broken speed

In case of invalid speed given, stmmac_adjust_link() still record it as
current speed.
This patch modify the default case to set speed as SPEED_UNKNOWN if not
10/100/1000.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Reviewed-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: stmmac: use SPEED_UNKNOWN/DUPLEX_UNKNOWN
LABBE Corentin [Wed, 15 Feb 2017 09:46:40 +0000 (10:46 +0100)]
net: stmmac: use SPEED_UNKNOWN/DUPLEX_UNKNOWN

It is better to use DUPLEX_UNKNOWN instead of just "-1".
Using 0 for an invalid speed is bad since 0 is a valid value for speed.
So this patch replace 0 by SPEED_UNKNOWN.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Reviewed-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: stmmac: likely is useless in occasional function
LABBE Corentin [Wed, 15 Feb 2017 09:46:39 +0000 (10:46 +0100)]
net: stmmac: likely is useless in occasional function

The stmmac_adjust_link() function is called too rarely for having
likely() macros being useful.
Just remove likely annotation in it.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Reviewed-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: stmmac: remove useless parenthesis
LABBE Corentin [Wed, 15 Feb 2017 09:46:38 +0000 (10:46 +0100)]
net: stmmac: remove useless parenthesis

This patch remove some useless parenthesis.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Reviewed-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: ethernet: aquantia: switch to pci_alloc_irq_vectors
Christoph Hellwig [Wed, 15 Feb 2017 07:38:47 +0000 (08:38 +0100)]
net: ethernet: aquantia: switch to pci_alloc_irq_vectors

pci_enable_msix has been long deprecated, but this driver adds a new
instance.  Convert it to pci_alloc_irq_vectors so that no new instance
of the deprecated function reaches mainline.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Tested-by: Pavel Belous <pavel.belous@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'qed-ptp'
David S. Miller [Wed, 15 Feb 2017 17:42:54 +0000 (12:42 -0500)]
Merge branch 'qed-ptp'

Yuval Mintz says:

====================
qed*: Add support for PTP

This patch series adds required changes for qed/qede drivers for
supporting the IEEE Precision Time Protocol (PTP).

Changes from previous versions:
v7: Fixed Kbuild robot warnings.

v6: Corrected broken loop iteration in previous version.
    Reduced approximation error of adjfreq.

v5: Removed two divisions from the adjust-frequency loop.
    Resulting logic would use 8 divisions [instead of 24].

v4: Remove the loop iteration for value '0' in the qed_ptp_hw_adjfreq()
    implementation.

v3: Use div_s64 for 64-bit divisions as do_div gives error for signed
    types.
    Incorporated review comments from Richard Cochran.
      - Clear timestamp resgisters as soon as timestamp is read.
      - Use shift operation in the place of 'divide by 16'.

v2: Use do_div for 64-bit divisions.
====================

Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoqede: Add driver support for PTP
Sudarsana Reddy Kalluru [Wed, 15 Feb 2017 08:24:11 +0000 (10:24 +0200)]
qede: Add driver support for PTP

This patch adds the driver support for,
  - Registering the ptp clock functionality with the OS.
  - Timestamping the Rx/Tx PTP packets.
  - Ethtool callbacks related to PTP.

Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoqed: Add infrastructure for PTP support
Sudarsana Reddy Kalluru [Wed, 15 Feb 2017 08:24:10 +0000 (10:24 +0200)]
qed: Add infrastructure for PTP support

The patch adds the required qed interfaces for configuring/reading
the PTP clock on the adapter.

Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agocxgb4: Update proper netdev stats for rx drops
Ganesh Goudar [Wed, 15 Feb 2017 06:15:25 +0000 (11:45 +0530)]
cxgb4: Update proper netdev stats for rx drops

Count buffer group drops or truncates as rx drops rather than
rx errors in netdev stats.

Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: Arjun V <arjun@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoopenvswitch: Set internal device max mtu to ETH_MAX_MTU.
Jarno Rajahalme [Wed, 15 Feb 2017 05:16:28 +0000 (21:16 -0800)]
openvswitch: Set internal device max mtu to ETH_MAX_MTU.

Commit 91572088e3fd ("net: use core MTU range checking in core net
infra") changed the openvswitch internal device to use the core net
infra for controlling the MTU range, but failed to actually set the
max_mtu as described in the commit message, which now defaults to
ETH_DATA_LEN.

This patch fixes this by setting max_mtu to ETH_MAX_MTU after
ether_setup() call.

Fixes: 91572088e3fd ("net: use core MTU range checking in core net infra")
Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agosched: have stub for tcf_destroy_chain in case NET_CLS is not configured
Jiri Pirko [Wed, 15 Feb 2017 10:57:50 +0000 (11:57 +0100)]
sched: have stub for tcf_destroy_chain in case NET_CLS is not configured

This fixes broken build for !NET_CLS:

net/built-in.o: In function `fq_codel_destroy':
/home/sab/linux/net-next/net/sched/sch_fq_codel.c:468: undefined reference to `tcf_destroy_chain'

Fixes: cf1facda2f61 ("sched: move tcf_proto_destroy and tcf_destroy_chain helpers into cls_api")
Reported-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Tested-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: Rebuild bpf.o for any dependency update
Mickaël Salaün [Sat, 11 Feb 2017 22:20:23 +0000 (23:20 +0100)]
bpf: Rebuild bpf.o for any dependency update

This is needed to force a rebuild of bpf.o when one of its dependencies
(e.g. uapi/linux/bpf.h) is updated.

Add a phony target.

Signed-off-by: Mickaël Salaün <mic@digikod.net>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: David S. Miller <davem@davemloft.net>
Cc: Wang Nan <wangnan0@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: Remove redundant ifdef
Mickaël Salaün [Sat, 11 Feb 2017 19:37:08 +0000 (20:37 +0100)]
bpf: Remove redundant ifdef

Remove a useless ifdef __NR_bpf as requested by Wang Nan.

Inline one-line static functions as it was in the bpf_sys.h file.

Signed-off-by: Mickaël Salaün <mic@digikod.net>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: David S. Miller <davem@davemloft.net>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/r/828ab1ff-4dcf-53ff-c97b-074adb895006@huawei.com
Acked-by: Wang Nan <wangnan0@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agomlx4: do not use rwlock in fast path
Eric Dumazet [Thu, 9 Feb 2017 17:10:04 +0000 (09:10 -0800)]
mlx4: do not use rwlock in fast path

Using a reader-writer lock in fast path is silly, when we can
instead use RCU or a seqlock.

For mlx4 hwstamp clock, a seqlock is the way to go, removing
two atomic operations and false sharing.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Tariq Toukan <tariqt@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: ethernet: ti: cpsw: use var instead of func for usage count
Ivan Khoronzhuk [Tue, 14 Feb 2017 14:02:36 +0000 (16:02 +0200)]
net: ethernet: ti: cpsw: use var instead of func for usage count

The usage count function is based on ndev_running flag that is
updated before calling ndo_open/close, but if ndo is called in
another place, as with suspend/resume, the counter is not changed,
that breaks sus/resume. For common resource no difference which
device is using it, does matter only device count. So, replace
usage count function on var and inc and dec it in ndo_open/close.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agopch_gbe: Omit private ndo_get_stats function
Tobias Klauser [Tue, 14 Feb 2017 16:47:12 +0000 (17:47 +0100)]
pch_gbe: Omit private ndo_get_stats function

pch_gbe_get_stats() just returns dev->stats so we can leave it out
altogether and let dev_get_stats() do the job.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: hip04: Omit private ndo_get_stats function
Tobias Klauser [Tue, 14 Feb 2017 14:10:06 +0000 (15:10 +0100)]
net: hip04: Omit private ndo_get_stats function

hip04_get_stats() just returns dev->stats so we can leave it
out altogether and let dev_get_stats() do the job.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet_sched: nla_memdup_cookie() can be static
Wei Yongjun [Tue, 14 Feb 2017 14:19:32 +0000 (14:19 +0000)]
net_sched: nla_memdup_cookie() can be static

Fixes the following sparse warning:

net/sched/act_api.c:532:5: warning:
 symbol 'nla_memdup_cookie' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: irda: au1k_ir: drop useless include
Manuel Lauss [Tue, 14 Feb 2017 12:08:04 +0000 (13:08 +0100)]
net: irda: au1k_ir: drop useless include

remove useless ioport.h include.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: irda: au1k_ir: remove unused timer
Manuel Lauss [Tue, 14 Feb 2017 12:08:03 +0000 (13:08 +0100)]
net: irda: au1k_ir: remove unused timer

remove the unused timer.  I suppose it was intended as a timeout
detector, but never properly implemented.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: reduce compiler warnings by adding fallthrough comments
Alexander Alemayhu [Mon, 13 Feb 2017 23:02:35 +0000 (00:02 +0100)]
bpf: reduce compiler warnings by adding fallthrough comments

Fixes the following warnings:

kernel/bpf/verifier.c: In function â€˜may_access_direct_pkt_data’:
kernel/bpf/verifier.c:702:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
   if (t == BPF_WRITE)
      ^
kernel/bpf/verifier.c:704:2: note: here
  case BPF_PROG_TYPE_SCHED_CLS:
  ^~~~
kernel/bpf/verifier.c: In function â€˜reg_set_min_max_inv’:
kernel/bpf/verifier.c:2057:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
   true_reg->min_value = 0;
   ~~~~~~~~~~~~~~~~~~~~^~~
kernel/bpf/verifier.c:2058:2: note: here
  case BPF_JSGT:
  ^~~~
kernel/bpf/verifier.c:2068:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
   true_reg->min_value = 0;
   ~~~~~~~~~~~~~~~~~~~~^~~
kernel/bpf/verifier.c:2069:2: note: here
  case BPF_JSGE:
  ^~~~
kernel/bpf/verifier.c: In function â€˜reg_set_min_max’:
kernel/bpf/verifier.c:2009:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
   false_reg->min_value = 0;
   ~~~~~~~~~~~~~~~~~~~~~^~~
kernel/bpf/verifier.c:2010:2: note: here
  case BPF_JSGT:
  ^~~~
kernel/bpf/verifier.c:2019:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
   false_reg->min_value = 0;
   ~~~~~~~~~~~~~~~~~~~~~^~~
kernel/bpf/verifier.c:2020:2: note: here
  case BPF_JSGE:
  ^~~~

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Alexander Alemayhu <alexander@alemayhu.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agopcnet32: fix BNC/AUI port on AM79C970A
Ondrej Zary [Mon, 13 Feb 2017 22:45:47 +0000 (23:45 +0100)]
pcnet32: fix BNC/AUI port on AM79C970A

Even though the port autoselection is enabled by default on AM79C970A,
BNC/AUI port does not work because the link is always reported to be
down. The link state reported by the chip belongs only to the TP port
but the driver uses it regardless of the port used. The chip can't
detect BNC/AUI link state.

Disable port autoselection and use TP port by default to keep current
behavior (link detection works on TP port, BNC/AUI port does not work).

Implement ethtool autoneg, port and duplex configuration to allow
using the BNC/AUI port.

Report the TP link state only if the TP port is selected. When the
port autoselection is enabled or AUI port is selected, report the link
as always up.

Move pcnet32_suspend() and pcnet32_clr_suspend() functions to avoid
forward declarations.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agopcnet32: factor out pcnet32_clr_suspend()
Ondrej Zary [Mon, 13 Feb 2017 22:45:46 +0000 (23:45 +0100)]
pcnet32: factor out pcnet32_clr_suspend()

Move the code to clear SUSPEND flag to a separate function to simplify
code.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agomlxsw: spectrum: Change ipv6 unregistered mc table
Nogah Frankel [Mon, 13 Feb 2017 20:03:02 +0000 (21:03 +0100)]
mlxsw: spectrum: Change ipv6 unregistered mc table

Point back the unregister IPv6 mc table to the bc table.
It is done since IPv6 mcast snooping is not supported for Spectrum yet.

Reported-by: Jiri Pirko <jiri@mellanox.com>
Fixes: 71c365bdc439 ("mlxsw: spectrum: Separate bc and mc floods")
Signed-off-by: Nogah Frankel <nogahf@mellanox.com>
Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
Tested-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'sunvnet-driver-updates'
David S. Miller [Tue, 14 Feb 2017 18:04:11 +0000 (13:04 -0500)]
Merge branch 'sunvnet-driver-updates'

Shannon Nelson says:

====================
sunvnet driver updates

The sunvnet ldom virtual network driver was due for some updates and
a bugfix or two.  These patches address a few items left over from
last year's make-over.

v2:
 - changed memory barrier fix to use smp_wmb
 - put NETIF_F_SG back into the advertised ldmvsw hw_features

v3:
 - the sunvnet_common module doesn't need module_init or _exit

v4:
 - dropped the statistics patch
 - fixed up "default" tag for SUNVNET_COMMON
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoldmvsw: disable tso and gso for bridge operations
Shannon Nelson [Mon, 13 Feb 2017 18:57:04 +0000 (10:57 -0800)]
ldmvsw: disable tso and gso for bridge operations

The ldmvsw driver is specifically for supporting the ldom virtual
networking by running in the primary ldom and using the LDC to connect
the remaining ldoms to the outside world via a bridge.  With TSO and GSO
supported while connected the bridge, things tend to misbehave as seen
in our case by delayed packets, enough to begin triggering retransmits
and affecting overall throughput.  By turning off advertised support for
TSO and GSO we restore stable traffic flow through the bridge.

Orabug: 23293104

Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoldmvsw: update and simplify version string
Shannon Nelson [Mon, 13 Feb 2017 18:57:03 +0000 (10:57 -0800)]
ldmvsw: update and simplify version string

New version and simplify the print code.

Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agosunvnet: remove extra rcu_read_unlocks
Shannon Nelson [Mon, 13 Feb 2017 18:57:02 +0000 (10:57 -0800)]
sunvnet: remove extra rcu_read_unlocks

The RCU read lock is grabbed first thing in sunvnet_start_xmit_common()
so it always needs to be released.  This removes the conditional release
in the dropped packet error path and removes a couple of superfluous
calls in the middle of the code.

Reported-by: Bijan Mottahedeh <bijan.mottahedeh@oracle.com>
Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agosunvnet: straighten up message event handling logic
Shannon Nelson [Mon, 13 Feb 2017 18:57:01 +0000 (10:57 -0800)]
sunvnet: straighten up message event handling logic

The use of gotos for handling the incoming events made this code
harder to read and support than it should be.  This patch straightens
out and clears up the logic.

Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agosunvnet: add memory barrier before check for tx enable
Shannon Nelson [Mon, 13 Feb 2017 18:57:00 +0000 (10:57 -0800)]
sunvnet: add memory barrier before check for tx enable

In order to allow the underlying LDC and outstanding memory operations
to potentially catch up with the driver's Tx requests, add a memory
barrier before checking again for available tx descriptors.

Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agosunvnet: update version and version printing
Shannon Nelson [Mon, 13 Feb 2017 18:56:59 +0000 (10:56 -0800)]
sunvnet: update version and version printing

There have been several changes since the first version of this code, so
we bump the version number.  While we're at it, we can simplify the
version printing a bit and drop a couple lines of code.

Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agosunvnet: remove unused variable in maybe_tx_wakeup
Sowmini Varadhan [Mon, 13 Feb 2017 18:56:58 +0000 (10:56 -0800)]
sunvnet: remove unused variable in maybe_tx_wakeup

The vio_dring_state *dr variable is unused in maybe_tx_wakeup().
As the comments indicate, we call maybe_tx_wakeup() whenever we
get a STOPPED LDC message on the port. If the queue is stopped,
we want to wake it up so that we will send another START message
at the next TX and trigger the consumer to drain the dring.

Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agosunvnet: make sunvnet common code dynamically loadable
Shannon Nelson [Mon, 13 Feb 2017 18:56:57 +0000 (10:56 -0800)]
sunvnet: make sunvnet common code dynamically loadable

When the sunvnet_common code was split out for use by both sunvnet
and the newer ldmvsw, it was made into a static kernel library, which
limits the usefulness of sunvnet and ldmvsw as loadables, since most
of the real work is being done in the shared code.  Also, this is
simply dead code in kernels that aren't running the LDoms.

This patch makes the sunvnet_common into a dynamically loadable
module and makes sunvnet and ldmvsw dependent on sunvnet_common.

Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'sfc-bogus-interrupt-mode-fallbacks'
David S. Miller [Tue, 14 Feb 2017 17:43:19 +0000 (12:43 -0500)]
Merge branch 'sfc-bogus-interrupt-mode-fallbacks'

Edward Cree says:

====================
sfc: prevent bogus interrupt-mode fallbacks

EF10 VFs only support MSI-X interrupts, not MSI or legacy.  This series
 stops the probe logic from trying to fallback to those if MSI-X interrupt
 probe fails.  It also prevents selecting them with the interrupt_mode
 module parameter.
This avoids producing messages like "failed to hook legacy IRQ 0" and "IRQ
 handler type mismatch for IRQ 0", and ensures that the relevant error
 (from the attempt to enable MSI-X) is reported to the caller.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agosfc: only fall back to a lower interrupt mode if it is supported
Andrew Rybchenko [Mon, 13 Feb 2017 14:59:04 +0000 (14:59 +0000)]
sfc: only fall back to a lower interrupt mode if it is supported

If we fail to probe interrupts with our minimum mode, return that error.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agosfc: MSI-X is the only interrupt mode for EF10 VFs
Andrew Rybchenko [Mon, 13 Feb 2017 14:57:39 +0000 (14:57 +0000)]
sfc: MSI-X is the only interrupt mode for EF10 VFs

Add min_interrupt_mode specification per NIC type.
It is a bit confusing because of "highest interrupt mode is less capable".

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'bridge-fdb-minor-cleanup'
David S. Miller [Tue, 14 Feb 2017 17:41:04 +0000 (12:41 -0500)]
Merge branch 'bridge-fdb-minor-cleanup'

Nikolay Aleksandrov says:

====================
bridge: minor fdb cleanup

These patches aim to simplify the bridge fdb API a little by removing some
redundant functions and converting them into wrappers of a single function.
Also add proper lock checking to avoid future mistakes for the search
functions.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobridge: fdb: converge fdb_delete_by functions into one
Nikolay Aleksandrov [Mon, 13 Feb 2017 13:59:11 +0000 (14:59 +0100)]
bridge: fdb: converge fdb_delete_by functions into one

We can simplify the logic of entries pointing to the bridge by
converging the fdb_delete_by functions, this would allow us to use the
same function for both cases since the fdb's dst is set to NULL if it is
pointing to the bridge thus we can always check for a port match.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobridge: fdb: add proper lock checks in searching functions
Nikolay Aleksandrov [Mon, 13 Feb 2017 13:59:10 +0000 (14:59 +0100)]
bridge: fdb: add proper lock checks in searching functions

In order to avoid new errors add checks to br_fdb_find and fdb_find_rcu
functions. The first requires hash_lock, the second obviously RCU.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobridge: fdb: converge fdb searching functions into one
Nikolay Aleksandrov [Mon, 13 Feb 2017 13:59:09 +0000 (14:59 +0100)]
bridge: fdb: converge fdb searching functions into one

Before this patch we had 3 different fdb searching functions which was
confusing. This patch reduces all of them to one - fdb_find_rcu(), and
two flavors: br_fdb_find() which requires hash_lock and br_fdb_find_rcu
which requires RCU. This makes it clear what needs to be used, we also
remove two abusers of __br_fdb_get which called it under hash_lock and
replace them with br_fdb_find().

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet:dsa:mv88e6xxx: use watchdog ops for 6097 chip
Volodymyr Bendiuga [Tue, 14 Feb 2017 10:29:30 +0000 (11:29 +0100)]
net:dsa:mv88e6xxx: use watchdog ops for 6097 chip

mv88e6097 chip requires watchdog_ops to be set.

Signed-off-by: Volodymyr Bendiuga <volodymyr.bendiuga@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agosched: Fix accidental removal of errout goto
Jiri Pirko [Tue, 14 Feb 2017 15:27:13 +0000 (16:27 +0100)]
sched: Fix accidental removal of errout goto

Bring back the goto that was removed by accident.

Reported-by: Colin Ian King <colin.king@canonical.com>
Fixes: 40c81b25b16c ("sched: check negative err value to safe one level of indent")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: qcom/emac: fix a sizeof() typo
Dan Carpenter [Mon, 13 Feb 2017 11:00:22 +0000 (14:00 +0300)]
net: qcom/emac: fix a sizeof() typo

We had intended to say "sizeof(u32)" but the "u" is missing.
Fortunately, sizeof(32) is also 4, so the original code still works.

Fixes: c4e7beea2192 ("net: qcom/emac: add ethtool support for reading hardware registers")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: fs_enet: Simplify code
Christophe Jaillet [Fri, 10 Feb 2017 20:17:19 +0000 (21:17 +0100)]
net: fs_enet: Simplify code

There is no need to use an intermediate variable to handle an error code
in this case.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: fs_enet: Fix an error handling path
Christophe Jaillet [Fri, 10 Feb 2017 20:17:06 +0000 (21:17 +0100)]
net: fs_enet: Fix an error handling path

'of_node_put(fpi->phy_node)' should also be called if we branch to
'out_deregister_fixed_link' error handling path.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge tag 'rxrpc-rewrite-20170210' of git://git.kernel.org/pub/scm/linux/kernel/git...
David S. Miller [Tue, 14 Feb 2017 03:24:16 +0000 (22:24 -0500)]
Merge tag 'rxrpc-rewrite-20170210' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs

David Howells says:

====================
afs: Use system UUID generation

There is now a general function for generating a UUID and AFS should make
use of it.  It's also been recommended to me that I switch to using random
rather than time plus MAC address-based UUIDs which this function does.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: make net_device members garp_port and mrp_port conditional
Tobias Klauser [Fri, 10 Feb 2017 15:43:50 +0000 (16:43 +0100)]
net: make net_device members garp_port and mrp_port conditional

garp_port is only used in net/802/garp.c which is only compiled with
CONFIG_GARP enabled. Same goes for mrp_port which is only used in
net/802/mrp.c with CONFIG_MRP enabled.

Only include the two members in struct net_device if their respective
CONFIG_* is enabled. This saves a few bytes in struct net_device in case
CONFIG_GARP or CONFIG_MRP are not enabled.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: busy-poll: remove LL_FLUSH_FAILED and LL_FLUSH_BUSY
Eric Dumazet [Fri, 10 Feb 2017 13:46:46 +0000 (05:46 -0800)]
net: busy-poll: remove LL_FLUSH_FAILED and LL_FLUSH_BUSY

Commit 79e7fff47b7b ("net: remove support for per driver
ndo_busy_poll()") made them obsolete.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next...
David S. Miller [Tue, 14 Feb 2017 03:23:23 +0000 (22:23 -0500)]
Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue

Jeff Kirsher says:

====================
40GbE Intel Wired LAN Driver Updates 2017-02-11

This series contains updates to i40e and i40evf only.

Jake makes a minor change to prevent a minor bit of work, if it is not
necessary.  In the case where we do not have a client, there is no need
to check the client params, so move the check till after we have ensured
we have a client.  Correct a code comment which incorrectly implied
that raw_packet buffers were freed in i40e_clean_tx_ring(), so fixed
the code comment to better explain where memory is freed.  Reduce the
severity and frequency of the message notifying we cleared the receive
timestamp register, since the logic has a much better detection scheme
that could detect a stalled receive timestamp register.  The improved
logic was actually causing the notification message to occur more
frequently and was giving the user a false perception that a timestamp
event was missed for a valid packet, so reduce the severity from
dev_warn to dev_dbg and only fire off the message when 3 or 4 of the
RXTIME registers are stalled and get cleared within the same
watchdog event.  Fixed a bug, where we were modifying the mac_filter
outside a lock when handling the addition of broadcast filters.  Fix
this by updating i40e_update_filter_state logic so that it knows to
avoid broadcast filters, which ensures that we do not have to remove
the filter separately and can put it back using the normal flow.
Refactored how we add new filters to firmware to avoid a race condition
that can occur due to removing filters from the hash temporarily.

Mitch adds a sleep (without timeout) so that we wait for a reply from
the PF before we continue, since the iWarp client cannot continue until
the operation is completed.  Fixed up a function which could never
return an error, to be void and cleaned up the checking of the now
null and void return value.

Scott limits the DMA sync to CPU to the actual length of the incoming
packet, versus the syncing of the entire buffer.  Also reduces the
receive buffer struct (by a single pointer) and align the driver to be
more consistent with other Intel drivers with respect to packets that
span buffers.

Sudheer adds a field to track the bus number info and modified log
statements to print bus, device and function information.

Henry adds the ability to store the FEC status bits from the link up
event.  Also adds the ethtool support for FEC capabilities and 25G
link types.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet:ethernet:aquantia: Add 2500/5000 mbit link modes support.
Pavel Belous [Thu, 9 Feb 2017 20:53:10 +0000 (23:53 +0300)]
net:ethernet:aquantia: Add 2500/5000 mbit link modes support.

Using new link mode indices instead deprecated SUPPORTED_/ADVERTISED_
macro.

Added indication for 2500 and 5000mbit link modes (AQtion adapter already
supports these speeds).

Signed-off-by: Pavel Belous <pavel.belous@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'mv88e6xxx-Watchdog-support'
David S. Miller [Mon, 13 Feb 2017 14:30:22 +0000 (09:30 -0500)]
Merge branch 'mv88e6xxx-Watchdog-support'

Andrew Lunn says:

====================
mv88e6xxx Watchdog support

The Marvell switches have an in built watchdog over some of the
internal state machine. The watchdog can be configured to raise an
interrupt on error. The problem the watchdog found is then logged to
the kernel log.

The older switches can automagically perform a software reset when the
watchdog triggers. This just resets the internal state machine, but
leaves the switch configuration unchanged.

The 6390 family of switches cannot both raise an interrupt and
automagically perform a software reset. So the interrupt handler has
to perform the switch reset, and then re-enable the watchdog
interrupts.

This has been tested using hacked together debugfs code which allows
the "force" bit to be set, so cause a watchdog interrupt.

v2: Remove g2_prefix
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: dsa: mv88e6xxx: Add mv88e6390 watchdog interrupt support
Andrew Lunn [Wed, 8 Feb 2017 23:03:43 +0000 (00:03 +0100)]
net: dsa: mv88e6xxx: Add mv88e6390 watchdog interrupt support

Implement the ops needed to support the watchdog for the MV88E6390
family.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: dsa: mv88e6xxx: Add watchdog interrupt handler
Andrew Lunn [Wed, 8 Feb 2017 23:03:42 +0000 (00:03 +0100)]
net: dsa: mv88e6xxx: Add watchdog interrupt handler

The switch contains a watchdog looking for issues with the internal
gubbins of the switch. Hook the interrupt the watchdog triggers and
log the value of the control register indicating why the watchdog
fired. The watchdog can only be cleared with a switch reset, which
will destroy the current configuration. Rather than doing this, just
disable the interrupt.

The mv88e6390 family has different watchdog registers. So use an ops
structure, so support for the mv88e6390 family can be added later.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: natsemi: ns83820: use new api ethtool_{get|set}_link_ksettings
Philippe Reynes [Fri, 10 Feb 2017 22:57:48 +0000 (23:57 +0100)]
net: natsemi: ns83820: use new api ethtool_{get|set}_link_ksettings

The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: nuvoton: w90p910: use new api ethtool_{get|set}_link_ksettings
Philippe Reynes [Sun, 12 Feb 2017 20:38:29 +0000 (21:38 +0100)]
net: nuvoton: w90p910: use new api ethtool_{get|set}_link_ksettings

The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: neterion: vxge: use new api ethtool_{get|set}_link_ksettings
Philippe Reynes [Sun, 12 Feb 2017 16:33:13 +0000 (17:33 +0100)]
net: neterion: vxge: use new api ethtool_{get|set}_link_ksettings

The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: neterion: s2io: use new api ethtool_{get|set}_link_ksettings
Philippe Reynes [Sun, 12 Feb 2017 10:44:36 +0000 (11:44 +0100)]
net: neterion: s2io: use new api ethtool_{get|set}_link_ksettings

The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: micrel: ks8851_mll: use new api ethtool_{get|set}_link_ksettings
Philippe Reynes [Thu, 9 Feb 2017 10:28:25 +0000 (11:28 +0100)]
net: micrel: ks8851_mll: use new api ethtool_{get|set}_link_ksettings

The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: micrel: ks8851: use new api ethtool_{get|set}_link_ksettings
Philippe Reynes [Thu, 9 Feb 2017 08:57:47 +0000 (09:57 +0100)]
net: micrel: ks8851: use new api ethtool_{get|set}_link_ksettings

The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: micrel: ks8695net: use new api ethtool_{get|set}_link_ksettings
Philippe Reynes [Wed, 8 Feb 2017 22:54:45 +0000 (23:54 +0100)]
net: micrel: ks8695net: use new api ethtool_{get|set}_link_ksettings

The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: natsemi: use new api ethtool_{get|set}_link_ksettings
Philippe Reynes [Thu, 9 Feb 2017 22:58:25 +0000 (23:58 +0100)]
net: natsemi: use new api ethtool_{get|set}_link_ksettings

The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: myricom: myri10ge: use new api ethtool_{get|set}_link_ksettings
Philippe Reynes [Thu, 9 Feb 2017 22:17:23 +0000 (23:17 +0100)]
net: myricom: myri10ge: use new api ethtool_{get|set}_link_ksettings

The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Acked-by: Hyong-Youb Kim <hykim@myri.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: microchip: encx24j600: use new api ethtool_{get|set}_link_ksettings
Philippe Reynes [Thu, 9 Feb 2017 21:42:18 +0000 (22:42 +0100)]
net: microchip: encx24j600: use new api ethtool_{get|set}_link_ksettings

The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: microchip: enc28j60: use new api ethtool_{get|set}_link_ksettings
Philippe Reynes [Thu, 9 Feb 2017 21:02:47 +0000 (22:02 +0100)]
net: microchip: enc28j60: use new api ethtool_{get|set}_link_ksettings

The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: micrel: ksz884x: use new api ethtool_{get|set}_link_ksettings
Philippe Reynes [Thu, 9 Feb 2017 19:25:06 +0000 (20:25 +0100)]
net: micrel: ksz884x: use new api ethtool_{get|set}_link_ksettings

The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'bnxt_en-misc-updates'
David S. Miller [Mon, 13 Feb 2017 03:18:52 +0000 (22:18 -0500)]
Merge branch 'bnxt_en-misc-updates'

Michael Chan says:

====================
bnxt_en: Misc updates.

Miscellaneous updates include update of the firmware spec, ethtool flash
enhancement, ethtool -l minor fix, NTUPLE support enhancements, FEC
link settings message during link up, and new PCI IDs.  Please review.
Thanks.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobnxt_en: Added PCI IDs for BCM57452 and BCM57454 ASICs
Deepak Khungar [Mon, 13 Feb 2017 00:18:18 +0000 (19:18 -0500)]
bnxt_en: Added PCI IDs for BCM57452 and BCM57454 ASICs

Signed-off-by: Deepak Khungar <deepak.khungar@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobnxt_en: Fix bnxt_setup_tc() error message.
Michael Chan [Mon, 13 Feb 2017 00:18:17 +0000 (19:18 -0500)]
bnxt_en: Fix bnxt_setup_tc() error message.

Add proper puctuation to make the message more clear.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobnxt_en: Print FEC settings as part of the linkup dmesg.
Michael Chan [Mon, 13 Feb 2017 00:18:16 +0000 (19:18 -0500)]
bnxt_en: Print FEC settings as part of the linkup dmesg.

Print FEC (Forward Error Correction) autoneg and encoding settings during
link up.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobnxt_en: Do not setup PHY unless driving a single PF.
Michael Chan [Mon, 13 Feb 2017 00:18:15 +0000 (19:18 -0500)]
bnxt_en: Do not setup PHY unless driving a single PF.

If it is a VF or an NPAR function, the firmware call to setup the PHY
will fail.  Adding this check will prevent unnecessary firmware calls
to setup the PHY unless calling from the PF.  This will also eliminate
many unnecessary warning messages when the call from a VF or NPAR fails.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobnxt_en: Add hardware NTUPLE filter for encapsulated packets.
Michael Chan [Mon, 13 Feb 2017 00:18:14 +0000 (19:18 -0500)]
bnxt_en: Add hardware NTUPLE filter for encapsulated packets.

If skb_flow_dissect_flow_keys() returns with the encapsulation flag
set, pass the information to the firmware to setup the NTUPLE filter
accordingly.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobnxt_en: Allow NETIF_F_NTUPLE to be enabled on VFs.
Michael Chan [Mon, 13 Feb 2017 00:18:13 +0000 (19:18 -0500)]
bnxt_en: Allow NETIF_F_NTUPLE to be enabled on VFs.

Commit ae10ae740ad2 ("bnxt_en: Add new hardware RFS mode.") has added
code to allow NTUPLE to be enabled on VFs.  So we now remove the
BNXT_VF() check in rfs_capable() to allow NTUPLE on VFs.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobnxt_en: Fix ethtool -l pre-set max combined channel.
Michael Chan [Mon, 13 Feb 2017 00:18:12 +0000 (19:18 -0500)]
bnxt_en: Fix ethtool -l pre-set max combined channel.

With commit d1e7925e6d80 ("bnxt_en: Centralize logic to reserve rings."),
ring allocation for combined rings has become stricter.  A combined
ring must now have an rx-tx ring pair.  The pre-set max. for combined
rings should now be min(rx, tx).

Fixes: d1e7925e6d80 ("bnxt_en: Centralize logic to reserve rings.")
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobnxt_en: Retry failed NVM_INSTALL_UPDATE with defragmentation flag.
Kshitij Soni [Mon, 13 Feb 2017 00:18:11 +0000 (19:18 -0500)]
bnxt_en: Retry failed NVM_INSTALL_UPDATE with defragmentation flag.

If the HWRM_NVM_INSTALL_UPDATE command fails with the error code
NVM_INSTALL_UPDATE_CMD_ERR_CODE_FRAG_ERR, retry the command with
a new flag to allow defragmentation.  Since we are checking the
response for error code, we also need to take the mutex until
we finish reading the response.

Signed-off-by: Kshitij Soni <kshitij.soni@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobnxt_en: Update to firmware interface spec 1.7.0.
Michael Chan [Mon, 13 Feb 2017 00:18:10 +0000 (19:18 -0500)]
bnxt_en: Update to firmware interface spec 1.7.0.

The new spec has NVRAM defragmentation support which will be used in
the next patch to improve ethtool flash operation.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next
David S. Miller [Mon, 13 Feb 2017 03:11:43 +0000 (22:11 -0500)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next

Pablo Neira Ayuso says:

====================
Netfilter updates for net-next

The following patchset contains Netfilter updates for your net-next
tree, most relevantly they are:

1) Extend nft_exthdr to allow to match TCP options bitfields, from
   Manuel Messner.

2) Allow to check if IPv6 extension header is present in nf_tables,
   from Phil Sutter.

3) Allow to set and match conntrack zone in nf_tables, patches from
   Florian Westphal.

4) Several patches for the nf_tables set infrastructure, this includes
   cleanup and preparatory patches to add the new bitmap set type.

5) Add optional ruleset generation ID check to nf_tables and allow to
   delete rules that got no public handle yet via NFTA_RULE_ID. These
   patches add the missing kernel infrastructure to support rule
   deletion by description from userspace.

6) Missing NFT_SET_OBJECT flag to select the right backend when sets
   stores an object map.

7) A couple of cleanups for the expectation and SIP helper, from Gao
   feng.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonetfilter: nf_tables: honor NFT_SET_OBJECT in set backend selection
Pablo Neira Ayuso [Fri, 10 Feb 2017 18:59:36 +0000 (19:59 +0100)]
netfilter: nf_tables: honor NFT_SET_OBJECT in set backend selection

Check for NFT_SET_OBJECT feature flag, otherwise we may end up selecting
the wrong set backend.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
7 years agonetfilter: update MAINTAINERS
Pablo Neira Ayuso [Fri, 10 Feb 2017 11:08:29 +0000 (12:08 +0100)]
netfilter: update MAINTAINERS

It's been a while since Patrick has been suspended as coreteam member [1].
Update this file to remove him.

While at this, remove references to all foo-tables variants, given the
project hosts more than just that, eg. ipset, conntrack, ...

[1] https://marc.info/?l=netfilter-devel&m=146887464512702

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
7 years agonetfilter: nf_tables: add NFTA_RULE_ID attribute
Pablo Neira Ayuso [Fri, 10 Feb 2017 11:08:23 +0000 (12:08 +0100)]
netfilter: nf_tables: add NFTA_RULE_ID attribute

This new attribute allows us to uniquely identify a rule in transaction.
Robots may trigger an insertion followed by deletion in a batch, in that
scenario we still don't have a public rule handle that we can use to
delete the rule. This is similar to the NFTA_SET_ID attribute that
allows us to refer to an anonymous set from a batch.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
7 years agonetfilter: nf_tables: add check_genid to the nfnetlink subsystem
Pablo Neira Ayuso [Fri, 10 Feb 2017 11:08:20 +0000 (12:08 +0100)]
netfilter: nf_tables: add check_genid to the nfnetlink subsystem

This patch implements the check generation id as provided by nfnetlink.
This allows us to reject ruleset updates against stale baseline, so
userspace can retry update with a fresh ruleset cache.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
7 years agonetfilter: nfnetlink: allow to check for generation ID
Pablo Neira Ayuso [Fri, 10 Feb 2017 11:08:17 +0000 (12:08 +0100)]
netfilter: nfnetlink: allow to check for generation ID

This patch allows userspace to specify the generation ID that has been
used to build an incremental batch update.

If userspace specifies the generation ID in the batch message as
attribute, then nfnetlink compares it to the current generation ID so
you make sure that you work against the right baseline. Otherwise, bail
out with ERESTART so userspace knows that its changeset is stale and
needs to respin. Userspace can do this transparently at the cost of
taking slightly more time to refresh caches and rework the changeset.

This check is optional, if there is no NFNL_BATCH_GENID attribute in the
batch begin message, then no check is performed.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
7 years agonetfilter: nfnetlink: add nfnetlink_rcv_skb_batch()
Pablo Neira Ayuso [Fri, 10 Feb 2017 11:08:14 +0000 (12:08 +0100)]
netfilter: nfnetlink: add nfnetlink_rcv_skb_batch()

Add new nfnetlink_rcv_skb_batch() to wrap initial nfnetlink batch
handling.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
7 years agonetfilter: nfnetlink: get rid of u_intX_t types
Pablo Neira Ayuso [Fri, 10 Feb 2017 11:08:08 +0000 (12:08 +0100)]
netfilter: nfnetlink: get rid of u_intX_t types

Use uX types instead.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>