]> Git Repo - linux.git/log
linux.git
8 years agoenic: add udp_tunnel ndo for vxlan offload
Govindarajulu Varadarajan [Thu, 9 Feb 2017 00:43:08 +0000 (16:43 -0800)]
enic: add udp_tunnel ndo for vxlan offload

Defines enic_udp_tunnel_add/del for configuring vxlan tunnel offload.
enic supports offload of only one ipv4/udp port.

There are two modes that fw supports for vxlan offload.

mode 0: fcoe bit is set for encapsulated packet. fcoe_fc_crc_ok is set
if checksum of csum is ok. This bit is or of ip_csum_ok and
tcp_udp_csum_ok

mode 2: BIT(0) in rss_hash is set if it is encapsulated packet.
BIT(1) is set if outer_ip_csum_ok/
BIT(2) is set if outer_tcp_csum_ok

tcp_udp_csum_ok/ipv4_csum_ok is set if inner csum is OK.

Signed-off-by: Govindarajulu Varadarajan <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agoenic: add devcmds for vxlan offload
Govindarajulu Varadarajan [Thu, 9 Feb 2017 00:43:07 +0000 (16:43 -0800)]
enic: add devcmds for vxlan offload

This patch adds devcmds needed for vxlan offload. Implement 3 new devcmd

overlay_offload_ctrl: enable/disable offload
overlay_offload_cfg: update offload udp port number
get_supported_feature_ver: get hw supported offload version. Each
   version has different bitmap for csum_ok/encap

Signed-off-by: Govindarajulu Varadarajan <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agonet: dsa: mv88e6xxx: Move forward declaration to where it is needed
Andrew Lunn [Wed, 8 Feb 2017 23:00:43 +0000 (00:00 +0100)]
net: dsa: mv88e6xxx: Move forward declaration to where it is needed

Move it out from the middle for the #defines to just before it is
needed.

Signed-off-by: Andrew Lunn <[email protected]>
Reviewed-by: Vivien Didelot <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agonet: dsa: Fix duplicate object rule
Florian Fainelli [Wed, 8 Feb 2017 22:40:04 +0000 (14:40 -0800)]
net: dsa: Fix duplicate object rule

While adding switch.o to the list of DSA object files, we essentially
duplicated the previous obj-y line and just added switch.o, remove the
duplicate.

Fixes: f515f192ab4f ("net: dsa: add switch notifier")
Signed-off-by: Florian Fainelli <[email protected]>
Reviewed-by: Vivien Didelot <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agoMerge branch 'qcom-emac-more-ethtool'
David S. Miller [Thu, 9 Feb 2017 22:09:20 +0000 (17:09 -0500)]
Merge branch 'qcom-emac-more-ethtool'

Timur Tabi says:

====================
net: qcom/emac: add the last ethtool functions

These two patches implement the remaining two ethtool functions that
are of interest to the Qualcomm EMAC driver.  These are the last
patches that will be submitted for the 4.11 merge window.
====================

Signed-off-by: David S. Miller <[email protected]>
8 years agonet: qcom/emac: add ethtool support for setting ring parameters
Timur Tabi [Wed, 8 Feb 2017 21:49:28 +0000 (15:49 -0600)]
net: qcom/emac: add ethtool support for setting ring parameters

Implement the set_ringparam method, which allows the user to specify
the size of the TX and RX descriptor rings.  The values are constrained
to the limits of the hardware.

Since the driver does not use separate queues for mini or jumbo frames,
attempts to set those values are rejected.

If the interface is already running when the setting is changed, then
the interface is reset.

Signed-off-by: Timur Tabi <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agonet: qcom/emac: add ethtool support for reading hardware registers
Timur Tabi [Wed, 8 Feb 2017 21:49:27 +0000 (15:49 -0600)]
net: qcom/emac: add ethtool support for reading hardware registers

Implement the get_regs_len and get_regs ethtool methods.  The driver
returns the values of selected hardware registers.

The make the register offsets known to emac_ethtool, the the register
offset macros are all combined into one header file.  They were
inexplicably and arbitrarily split between two files.

Signed-off-by: Timur Tabi <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agoARM: orion: remove unused wnr854t_switch_plat_data
Arnd Bergmann [Wed, 8 Feb 2017 21:24:19 +0000 (22:24 +0100)]
ARM: orion: remove unused wnr854t_switch_plat_data

The other instances of this structure got removed along with the MDIO
device change, but this one was left behind and needs to be removed
as well:

arch/arm/mach-orion5x/wnr854t-setup.c:109:44: error: 'wnr854t_switch_plat_data' defined but not used [-Werror=unused-variable]
 static struct dsa_platform_data __initdata wnr854t_switch_plat_data = {

Fixes: 575e93f7b5e6 ("ARM: orion: Register DSA switch as a MDIO device")
Signed-off-by: Arnd Bergmann <[email protected]>
Acked-by: Florian Fainelli <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agoMerge branch 'sctp-sender-stream-reconf-reset-add-streams'
David S. Miller [Thu, 9 Feb 2017 21:57:39 +0000 (16:57 -0500)]
Merge branch 'sctp-sender-stream-reconf-reset-add-streams'

Xin Long says:

====================
sctp: add sender-side procedures for stream reconf asoc reset and add streams

Patch 4/6 is to implement sender-side procedures for the SSN/TSN Reset
Request Parameter described in rfc6525 section 5.1.4, patch 3/6 is
ahead of it to define a function to make the request chunk for it.

Patch 6/6 is to implement sender-side procedures for the Add Incoming
and Outgoing Streams Request Parameter Request Parameter described in
rfc6525 section 5.1.5 and 5.1.6, patch 5/6 is ahead of it to define a
function to make the request chunk for it.

Patch 2/6 is a fix to recover streams states when it fails to send
request and Patch 1/6 is to drop some unncessary __packed from some
old structures.

v1->v2:
  - put these into a smaller group.
  - rename some temporary variables in the codes.
  - rename the titles of the commits and improve some changelogs.
v2->v3:
  - re-split the patchset and make sure it has no dead codes for review.
  - move some codes into stream.c from socket.c.
v3->v4:
  - add one more patch to fix a send reset stream request issue.
  - doing actual work only when request is sent successfully.
  - reduce some indents in sctp_send_add_streams.
v4->v5:
  - close streams before sending request and recover them when sending
    fails in patch 1/5 and patch 3/5
v5->v6:
  - add patch 1/6 to drop some unncessary __packed from some old structures.
  - remove __packed from some new structures in patch 3/6 and 5/6.
  - define unsigned int outcnt and incnt to make codes smaller in patch 6/6.
  - use krealloc instead of kcalloc and remove ksize check in patch 6/6, as
    ksize check is acutally used in krealloc already.
====================

Signed-off-by: David S. Miller <[email protected]>
8 years agosctp: implement sender-side procedures for Add Incoming/Outgoing Streams Request...
Xin Long [Wed, 8 Feb 2017 17:18:20 +0000 (01:18 +0800)]
sctp: implement sender-side procedures for Add Incoming/Outgoing Streams Request Parameter

This patch is to implement Sender-Side Procedures for the Add
Outgoing and Incoming Streams Request Parameter described in
rfc6525 section 5.1.5-5.1.6.

It is also to add sockopt SCTP_ADD_STREAMS in rfc6525 section
6.3.4 for users.

Signed-off-by: Xin Long <[email protected]>
Acked-by: Marcelo Ricardo Leitner <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agosctp: add support for generating stream reconf add incoming/outgoing streams request...
Xin Long [Wed, 8 Feb 2017 17:18:19 +0000 (01:18 +0800)]
sctp: add support for generating stream reconf add incoming/outgoing streams request chunk

This patch is to define Add Incoming/Outgoing Streams Request
Parameter described in rfc6525 section 4.5 and 4.6. They can
be in one same chunk trunk as rfc6525 section 3.1-7 describes,
so make them in one function.

Signed-off-by: Xin Long <[email protected]>
Acked-by: Marcelo Ricardo Leitner <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agosctp: implement sender-side procedures for SSN/TSN Reset Request Parameter
Xin Long [Wed, 8 Feb 2017 17:18:18 +0000 (01:18 +0800)]
sctp: implement sender-side procedures for SSN/TSN Reset Request Parameter

This patch is to implement Sender-Side Procedures for the SSN/TSN
Reset Request Parameter descibed in rfc6525 section 5.1.4.

It is also to add sockopt SCTP_RESET_ASSOC in rfc6525 section 6.3.3
for users.

Signed-off-by: Xin Long <[email protected]>
Acked-by: Marcelo Ricardo Leitner <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agosctp: add support for generating stream reconf ssn/tsn reset request chunk
Xin Long [Wed, 8 Feb 2017 17:18:17 +0000 (01:18 +0800)]
sctp: add support for generating stream reconf ssn/tsn reset request chunk

This patch is to define SSN/TSN Reset Request Parameter described
in rfc6525 section 4.3.

Signed-off-by: Xin Long <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agosctp: streams should be recovered when it fails to send request.
Xin Long [Wed, 8 Feb 2017 17:18:16 +0000 (01:18 +0800)]
sctp: streams should be recovered when it fails to send request.

Now when sending stream reset request, it closes the streams to
block further xmit of data until this request is completed, then
calls sctp_send_reconf to send the chunk.

But if sctp_send_reconf returns err, and it doesn't recover the
streams' states back,  which means the request chunk would not be
queued and sent, so the asoc will get stuck, streams are closed
and no packet is even queued.

This patch is to fix it by recovering the streams' states when
it fails to send the request, it is also to fix a return value.

Fixes: 7f9d68ac944e ("sctp: implement sender-side procedures for SSN Reset Request Parameter")
Signed-off-by: Xin Long <[email protected]>
Acked-by: Marcelo Ricardo Leitner <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agosctp: drop unnecessary __packed from some stream reconf structures
Xin Long [Wed, 8 Feb 2017 17:18:15 +0000 (01:18 +0800)]
sctp: drop unnecessary __packed from some stream reconf structures

commit 85c727b59483 ("sctp: drop __packed from almost all SCTP structures")
has removed __packed from almost all SCTP structures. But there still are
three structures where it should be dropped.

This patch is to remove it from some stream reconf structures.

Signed-off-by: Xin Long <[email protected]>
Acked-by: Marcelo Ricardo Leitner <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agoMerge branch 'sfc-more-encap-offloads'
David S. Miller [Thu, 9 Feb 2017 21:47:54 +0000 (16:47 -0500)]
Merge branch 'sfc-more-encap-offloads'

Edward Cree says:

====================
sfc: more encap offloads

This patch series adds support for RX checksum offload of encapsulated packets.
It also adds support for configuring the hardware's lists of UDP ports used for
VXLAN and GENEVE encapsulation offloads.  Since changing these lists causes the
MC to reboot, the driver has been hardened against reboots, which used to be
considered an exceptional occurrence but are now normal.
====================

Signed-off-by: David S. Miller <[email protected]>
8 years agosfc: configure UDP tunnel offload ports
Jon Cooper [Wed, 8 Feb 2017 16:52:10 +0000 (16:52 +0000)]
sfc: configure UDP tunnel offload ports

Implement ndo_udp_tunnel_{add,del} to update the NIC's list of VXLAN and
 GENEVE UDP ports.  Also reset the port list to empty on driver load and
 on driver unload, with appropriate flag set on the unload case.
These port numbers are used for RX inner checksum offload, and in future
 will also be used for TX inner checksum offload and encapsulated TSO.

Signed-off-by: Edward Cree <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agosfc: update mcdi_pcol definitions for MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS
Matthew Slattery [Wed, 8 Feb 2017 16:51:50 +0000 (16:51 +0000)]
sfc: update mcdi_pcol definitions for MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS

Signed-off-by: Edward Cree <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agosfc: call mcdi_reboot_detected() when MC reboots during an MCDI command
Jon Cooper [Wed, 8 Feb 2017 16:51:33 +0000 (16:51 +0000)]
sfc: call mcdi_reboot_detected() when MC reboots during an MCDI command

This function wasn't being called in this particular case when the MC
 reboots. This caused resource reallocations to not be handled properly
 and often ended up disabling the interface.

Signed-off-by: Edward Cree <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agosfc: harden driver against MC resets during initial probe
Jon Cooper [Wed, 8 Feb 2017 16:51:18 +0000 (16:51 +0000)]
sfc: harden driver against MC resets during initial probe

This is mainly to prepare for a future overlay networking patch that
 could cause an MC reset at probe time if the UDP tunnel port list is
 set immediately upon driver load.

Signed-off-by: Edward Cree <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agosfc: set csum_level for encapsulated packets
Jon Cooper [Wed, 8 Feb 2017 16:51:02 +0000 (16:51 +0000)]
sfc: set csum_level for encapsulated packets

Set the csum_level for encapsulated packets where the encapsulation
 type, l3 class and l4 class are sets that need it.

Signed-off-by: Edward Cree <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agosfc: process RX event inner checksum flags
Jon Cooper [Wed, 8 Feb 2017 16:50:40 +0000 (16:50 +0000)]
sfc: process RX event inner checksum flags

Add support for RX checksum offload of encapsulated packets. This
 essentially just means paying attention to the inner checksum flags
 in the RX event, and if *either* checksum flag indicates a fail then
 don't tell the kernel that checksum offload was successful.
Also, count these checksum errors and export the counts to ethtool -S.

Test the most common "good" case of RX events with a single bitmask
 instead of a series of ifs.  Move the more specific error checking
 in to a separate function for clarity, and don't use unlikely() there
 since we know at least one of the bits is bad.

Signed-off-by: Edward Cree <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agomac80211: fix CSA in IBSS mode
Koen Vandeputte [Wed, 8 Feb 2017 14:32:05 +0000 (15:32 +0100)]
mac80211: fix CSA in IBSS mode

Add the missing IBSS capability flag during capability init as it needs
to be inserted into the generated beacon in order for CSA to work.

Fixes: cd7760e62c2ac ("mac80211: add support for CSA in IBSS mode")
Signed-off-by: Piotr Gawlowicz <[email protected]>
Signed-off-by: Mikołaj Chwalisz <[email protected]>
Tested-by: Koen Vandeputte <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
8 years agocfg80211: fix NAN bands definition
Luca Coelho [Wed, 8 Feb 2017 13:00:34 +0000 (15:00 +0200)]
cfg80211: fix NAN bands definition

The nl80211_nan_dual_band_conf enumeration doesn't make much sense.
The default value is assigned to a bit, which makes it weird if the
default bit and other bits are set at the same time.

To improve this, get rid of NL80211_NAN_BAND_DEFAULT and add a wiphy
configuration to let the drivers define which bands are supported.
This is exposed to the userspace, which then can make a decision on
which band(s) to use.  Additionally, rename all "dual_band" elements
to "bands", to make things clearer.

Signed-off-by: Luca Coelho <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
8 years agomlxsw: spectrum_router: Don't reflect LINKDOWN nexthops
Ido Schimmel [Wed, 8 Feb 2017 13:36:49 +0000 (14:36 +0100)]
mlxsw: spectrum_router: Don't reflect LINKDOWN nexthops

The kernel resolves the nexthops for a given route using
FIB_LOOKUP_IGNORE_LINKSTATE which means a notification can be sent for a
route with one of its nexthops being LINKDOWN.

In case IGNORE_ROUTES_WITH_LINKDOWN is set for the nexthop netdev, then
we shouldn't reflect the nexthop to the device's table.

Once the nexthop netdev's carrier goes up we'll be notified using NH_ADD
and reflect it to the device.

Signed-off-by: Ido Schimmel <[email protected]>
Signed-off-by: Jiri Pirko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agoMerge branch 'mlxsw-Reflect-nexthop-status-changes'
David S. Miller [Wed, 8 Feb 2017 20:25:19 +0000 (15:25 -0500)]
Merge branch 'mlxsw-Reflect-nexthop-status-changes'

Jiri Pirko says:

====================
mlxsw: Reflect nexthop status changes

Ido says:

When the kernel forwards IPv4 packets via multipath routes it doesn't
consider nexthops that are dead or linkdown. For example, if the nexthop
netdev is administratively down or doesn't have a carrier.

Devices capable of offloading such multipath routes need to be made
aware of changes in the reflected nexthops' status. Otherwise, the
device might forward packets via non-functional nexthops, resulting in
packet loss. This patchset aims to fix that.

The first 11 patches deal with the necessary restructuring in the
mlxsw driver, so that it's able to correctly add and remove nexthops
from the device's adjacency table.

The 12th patch adds the NH_{ADD,DEL} events to the FIB notification
chain. These notifications are sent whenever the kernel decides to add
or remove a nexthop from the forwarding plane.

Finally, the last three patches add support for these events in the
mlxsw driver, which is currently the only driver capable of offloading
multipath routes.
====================

Signed-off-by: David S. Miller <[email protected]>
8 years agomlxsw: spectrum_router: Flush resources when RIF is deleted
Ido Schimmel [Wed, 8 Feb 2017 10:16:42 +0000 (11:16 +0100)]
mlxsw: spectrum_router: Flush resources when RIF is deleted

When the last IP address is removed from a netdev, its RIF is deleted.
However, if user didn't first remove neighbours and nexthops using this
interface, then they would still be present in the device's tables.

Therefore, whenever a RIF is deleted, make sure all the neighbours and
nexthops (adjacency entries) using it are removed from the relevant
tables as well.

The action associated with any route using this RIF would be refreshed,
most likely to trap. If the kernel decides to remove the route (f.e.,
because all the nexthops are now DEAD), then an event would be sent,
causing the route to be removed from the device.

Signed-off-by: Ido Schimmel <[email protected]>
Signed-off-by: Jiri Pirko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agomlxsw: spectrum_router: Reflect nexthop status changes
Ido Schimmel [Wed, 8 Feb 2017 10:16:40 +0000 (11:16 +0100)]
mlxsw: spectrum_router: Reflect nexthop status changes

When a packet hits a multipath route in the device's routing table, a
hash is computed over its headers, which is then used to select the
appropriate nexthop from the device's adjacency table.

There are situations in which the kernel removes a nexthop from a
multipath route (e.g., no carrier) and the device should do the same.

Upon the reception of NH_{ADD,DEL} events, add or remove a nexthop from
the device's adjacency table and refresh all the routes using the
nexthop group. If all the nexthops of a multipath route are invalid,
then any packet hitting the route would be trapped to the CPU for
forwarding.

If all the nexthops are DEAD, then the kernel would remove the route
entirely. On the other hand, if all the nexthops are merely LINKDOWN,
then the kernel would keep the route and forward any incoming packet
using a different route.

While the last case might sound like a problem, it's expected that a
routing daemon running in user space would remove such a route from the
FIB as it's dumped with the DEAD flag set.

Signed-off-by: Ido Schimmel <[email protected]>
Signed-off-by: Jiri Pirko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agoipv4: fib: Notify about nexthop status changes
Ido Schimmel [Wed, 8 Feb 2017 10:16:39 +0000 (11:16 +0100)]
ipv4: fib: Notify about nexthop status changes

When a multipath route is hit the kernel doesn't consider nexthops that
are DEAD or LINKDOWN when IN_DEV_IGNORE_ROUTES_WITH_LINKDOWN is set.
Devices that offload multipath routes need to be made aware of nexthop
status changes. Otherwise, the device will keep forwarding packets to
non-functional nexthops.

Add the FIB_EVENT_NH_{ADD,DEL} events to the fib notification chain,
which notify capable devices when they should add or delete a nexthop
from their tables.

Cc: Roopa Prabhu <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Andy Gospodarek <[email protected]>
Signed-off-by: Ido Schimmel <[email protected]>
Signed-off-by: Jiri Pirko <[email protected]>
Reviewed-by: Andy Gospodarek <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agomlxsw: spectrum_router: Use trap action only for some route types
Ido Schimmel [Wed, 8 Feb 2017 10:16:38 +0000 (11:16 +0100)]
mlxsw: spectrum_router: Use trap action only for some route types

The device can have one of three actions associated with a route:

1) Remote - packets continue to the adjacency table
2) Local - packets continue to the neighbour table
3) Trap - packets continue to the CPU

The first two actions can also trap packets to the CPU, but they do so
using a different trap ID, which has a lower traffic class and less
allotted bandwidth.

We currently use the third action for both RTN_{LOCAL,BROADCAST} routes
and RTN_UNICAST routes not pointing to the switch ports.

However, packets that merely need to be forwarded by the switch are
likely not control packets and can be therefore scheduled towards the
CPU using a lower traffic class.

Achieve the above by assigning the third action only to local and
broadcast routes and have any other route use either of the first two
actions, based on whether the route is gatewayed or not.

This will also allow us to refresh routes using the local action and
have them trap packets when their RIF is no longer valid following a
NH_DEL event.

One side effect of this patch is that we no longer give special
treatment to multipath routes using both switch and non-switch ports
towards their nexthops. If at least one of the nexthops can be resolved,
then the device will forward the packets instead of trapping them.

Signed-off-by: Ido Schimmel <[email protected]>
Signed-off-by: Jiri Pirko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agomlxsw: spectrum_router: Determine offload status using generic function
Ido Schimmel [Wed, 8 Feb 2017 10:16:37 +0000 (11:16 +0100)]
mlxsw: spectrum_router: Determine offload status using generic function

The previous patch introduced a generic function to determine whether a
route should be offloaded or not. Make use of it here.

In the future we're going to add more conditions to this test (e.g.,
whether TOS is non-zero), so it makes sense to centralize it instead of
open coding it in a few places.

Signed-off-by: Ido Schimmel <[email protected]>
Signed-off-by: Jiri Pirko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agomlxsw: spectrum_router: More accurately set offload flag
Ido Schimmel [Wed, 8 Feb 2017 10:16:36 +0000 (11:16 +0100)]
mlxsw: spectrum_router: More accurately set offload flag

We currently set the RTNH_F_OFFLOAD flag for all routes using remote
action, but this isn't always correct. If none of the nexthops
associated with a gatewayed route can be offloaded into the device, then
any packet hitting it would be trapped to the CPU and forwarded by the
kernel.

Solve this by pushing the setting of the offload flag to after the route
was programmed into the device, thereby allowing us to take all the
parameters into account.

This change will also help us further in the patchset, when we refresh
routes following the reception of NH_{ADD,DEL} events.

Signed-off-by: Ido Schimmel <[email protected]>
Signed-off-by: Jiri Pirko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agomlxsw: spectrum_router: Refactor nexthop init routine
Ido Schimmel [Wed, 8 Feb 2017 10:16:35 +0000 (11:16 +0100)]
mlxsw: spectrum_router: Refactor nexthop init routine

The nexthop init and de-init functions both have symmetric parts
concerned with the reflection of the neighbour entry into the device's
adjacency table, in case it's used by a gatewayed route.

These sections of code also need to be called when a nexthop is marked
as valid / invalid following NH_{ADD,DEL} events. Break these out into
appropriate functions, so that they could be invoked following the
reception of above events.

Signed-off-by: Ido Schimmel <[email protected]>
Signed-off-by: Jiri Pirko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agomlxsw: spectrum_router: Remove FIB info from FIB entry struct
Ido Schimmel [Wed, 8 Feb 2017 10:16:34 +0000 (11:16 +0100)]
mlxsw: spectrum_router: Remove FIB info from FIB entry struct

After the previous changes, the FIB info is embedded in every nexthop
group struct, which in turn is embedded in every FIB entry struct.

We can therefore safely remove the FIB info from the entry struct. This
has the added advantage of making the router-related structs more
generic and suitable for use with IPv6 offloads.

Signed-off-by: Ido Schimmel <[email protected]>
Signed-off-by: Jiri Pirko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agomlxsw: spectrum_router: Store routes in a more generic way
Ido Schimmel [Wed, 8 Feb 2017 10:16:33 +0000 (11:16 +0100)]
mlxsw: spectrum_router: Store routes in a more generic way

Up until now, the only FIB entries that were associated with a nexthop
group were routes to remote networks where all the nexthop devices had a
valid router interface (RIF). This is in contrast to the FIB code,
where all the routes are associated with a FIB info. The same design
choice needs to be applied to the driver's cache.

Based on the NH_{ADD,DEL} events which will be added later in the
patchset, we need to be able to change the action (forward / trap)
associated with all the routes using the nexthop group. However, if we
can't link between the nexthop and the routes using it, then the above
is impossible.

Signed-off-by: Ido Schimmel <[email protected]>
Signed-off-by: Jiri Pirko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agomlxsw: spectrum_router: Add gateway indication to nexthop group
Ido Schimmel [Wed, 8 Feb 2017 10:16:32 +0000 (11:16 +0100)]
mlxsw: spectrum_router: Add gateway indication to nexthop group

The next patch is going to generalize the way in which we store routes.
Instead of attaching a nexthop group only to gatewayed routes, one will
be attached to each route, in a similar way to the way the FIB code
stores its routes.

The above means that any function operating on a nexthop group cannot
assume the group represents only gatewayed nexthops. One such function
is the one that refreshes a nexthop group and updates the adjacency
table following nexthop changes.

For a nexthop group that doesn't represent any gateways this function
would essentially be a NOP, but it would be useful if it did update the
action associated with any route using it. This will allow us to later
consolidate code paths when a nexthop changes following NH_{ADD,DEL}
events.

Signed-off-by: Ido Schimmel <[email protected]>
Signed-off-by: Jiri Pirko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agomlxsw: spectrum_router: Use nexthop's scope to set action type
Ido Schimmel [Wed, 8 Feb 2017 10:16:31 +0000 (11:16 +0100)]
mlxsw: spectrum_router: Use nexthop's scope to set action type

We currently use the scope of the FIB info to distinguish between a
direct unicast route and a gatewayed one. However, the kernel is
perfectly happy to configure a route with scope UNIVERSE to a directly
connected network.

Instead, we can rely on the first nexthop's scope to check if the route
is gatewayed or not.

Signed-off-by: Ido Schimmel <[email protected]>
Signed-off-by: Jiri Pirko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agomlxsw: spectrum_router: Store nexthops in a hash table
Ido Schimmel [Wed, 8 Feb 2017 10:16:30 +0000 (11:16 +0100)]
mlxsw: spectrum_router: Store nexthops in a hash table

Later in the patchset we'll add the NH_{ADD,DEL} events which will let
us know when a nexthop is considered to be dead. Based on these events
we need to be able to add or remove the nexthop from the device's
tables.

Therefore, store the private nexthop structs in a hash table and use the
kernel's fib_nh struct as the key, so that we'll be able to easily find
them when the events are received.

Signed-off-by: Ido Schimmel <[email protected]>
Signed-off-by: Jiri Pirko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agomlxsw: spectrum_router: Store nexthop groups in a hash table
Ido Schimmel [Wed, 8 Feb 2017 10:16:29 +0000 (11:16 +0100)]
mlxsw: spectrum_router: Store nexthop groups in a hash table

Currently, when we're notified about a new RTN_UNICAST route we perform
a lookup on the nexthop group list looking for a group with a matching
configuration to that found in the FIB info. This is quite inefficient.

Instead, we can simply rely on the kernel to consolidate several FIB
configurations into the same FIB info and use the FIB info as the key
for our private nexthop group struct.

Signed-off-by: Ido Schimmel <[email protected]>
Signed-off-by: Jiri Pirko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agomlxsw: spectrum_router: Nullify nexthop's neigh pointer
Ido Schimmel [Wed, 8 Feb 2017 10:16:28 +0000 (11:16 +0100)]
mlxsw: spectrum_router: Nullify nexthop's neigh pointer

When we invalidate a nexthop we should also invalidate its neighbour
entry pointer as it might be destroyed later on. This makes the nexthop
de-init function symmetric with its init and also ensures nobody will
try to access the neighbour entry.

Signed-off-by: Ido Schimmel <[email protected]>
Signed-off-by: Jiri Pirko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agomlxsw: acl: Fix mlxsw_afa_block_commit error path
Jiri Pirko [Wed, 8 Feb 2017 09:39:16 +0000 (10:39 +0100)]
mlxsw: acl: Fix mlxsw_afa_block_commit error path

No rollback is needed since the chain is in consistent state and
mlxsw_afa_block_destroy() will take care of putting it away. So remove
the one we have now which is wrong. Also move the set of 'finished' flag
to the beginning of the function, because the block is certainly unusable
for future action addition no matter if the function succeeds or not.

Reported-by: Dan Carpenter <[email protected]>
Fixes: 4cda7d8d7098 ("mlxsw: core: Introduce flexible actions support")
Signed-off-by: Jiri Pirko <[email protected]>
Acked-by: Ido Schimmel <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agoMerge branch 'stmmac-cleanups'
David S. Miller [Wed, 8 Feb 2017 20:11:28 +0000 (15:11 -0500)]
Merge branch 'stmmac-cleanups'

Corentin Labbe says:

====================
net: stmmac: misc fix

I am currently working on dwmac-sun8i glue driver for Allwinner H3/A83T/A64.
This series is the result of all minor problem found in the stmmac driver.

All patch are tested on cubieboard2 via dwmac-sunxi and on pine64/orangepis via dwmac-sun8i.

Changes since v1:
- Removed netdev_dbg() in "net: stmmac: print phy information"
- Removed patch "net: stmmac: Implement NAPI for TX", it will be reworked
- Changed error message in "Correct the error message about invalid speed"
- Added some acked-by
====================

Signed-off-by: David S. Miller <[email protected]>
8 years agonet: stmmac: replace unsigned by u32
LABBE Corentin [Wed, 8 Feb 2017 08:31:21 +0000 (09:31 +0100)]
net: stmmac: replace unsigned by u32

checkpatch complains about two unsigned without type after.
Since the value return is u32, it is simpler to replace it by u32 instead
of "unsigned int"

Signed-off-by: Corentin Labbe <[email protected]>
Acked-by: Giuseppe Cavallaro <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agonet: stmmac: remove unused variable in sysfs_display_ring
LABBE Corentin [Wed, 8 Feb 2017 08:31:20 +0000 (09:31 +0100)]
net: stmmac: remove unused variable in sysfs_display_ring

The u64 x variable in sysfs_display_ring is unused.
This patch remove it.

Signed-off-by: Corentin Labbe <[email protected]>
Acked-by: Giuseppe Cavallaro <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agonet: stmmac: remove dead code in stmmac_tx_clean
LABBE Corentin [Wed, 8 Feb 2017 08:31:19 +0000 (09:31 +0100)]
net: stmmac: remove dead code in stmmac_tx_clean

Since commit cf32deec16e4 ("stmmac: add tx_skbuff_dma to save descriptors used by PTP"),
the struct dma_desc *p in stmmac_tx_clean was not used at all.

This patch remove this dead code.

Signed-off-by: Corentin Labbe <[email protected]>
Acked-by: Giuseppe Cavallaro <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agonet: stmmac: print phy information
LABBE Corentin [Wed, 8 Feb 2017 08:31:18 +0000 (09:31 +0100)]
net: stmmac: print phy information

When a PHY is found, printing which one was found (and which type/model) is
a good information to know.

Signed-off-by: Corentin Labbe <[email protected]>
Acked-by: Giuseppe Cavallaro <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agonet: stmmac: rename rx_crc to rx_crc_errors
LABBE Corentin [Wed, 8 Feb 2017 08:31:17 +0000 (09:31 +0100)]
net: stmmac: rename rx_crc to rx_crc_errors

The ethtool stat counter rx_crc from stmmac is mis-named, the name
seems to speak about the number of RX CRC done, but in fact it is about
errors.

This patch rename it to rx_crc_errors, just like the same ifconfig
counter.

Signed-off-by: Corentin Labbe <[email protected]>
Acked-by: Giuseppe Cavallaro <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agonet: stmmac: Rewrite two test against NULL value
LABBE Corentin [Wed, 8 Feb 2017 08:31:16 +0000 (09:31 +0100)]
net: stmmac: Rewrite two test against NULL value

This patch rewrite two test against NULL value with correct style.

Signed-off-by: Corentin Labbe <[email protected]>
Acked-by: Giuseppe Cavallaro <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agonet: stmmac: Correct the error message about invalid speed
LABBE Corentin [Wed, 8 Feb 2017 08:31:15 +0000 (09:31 +0100)]
net: stmmac: Correct the error message about invalid speed

The message about invalid speed does not state 1000 as a valid speed.
It is much simpler to said that the speed is invalid.

Signed-off-by: Corentin Labbe <[email protected]>
Acked-by: Giuseppe Cavallaro <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agonet: stmmac: replace ENOSYS by EINVAL
LABBE Corentin [Wed, 8 Feb 2017 08:31:14 +0000 (09:31 +0100)]
net: stmmac: replace ENOSYS by EINVAL

As said by checkpatch ENOSYS means 'invalid syscall nr' and nothing
else.
This patch replace ENOSYS by the more appropriate value EINVAL.

Signed-off-by: Corentin Labbe <[email protected]>
Acked-by: Giuseppe Cavallaro <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agonet: stmmac: Use readl_poll_timeout
LABBE Corentin [Wed, 8 Feb 2017 08:31:13 +0000 (09:31 +0100)]
net: stmmac: Use readl_poll_timeout

The dwmac_dma_reset function use an open coded of readl_poll_timeout().
Replace the open coded handling with the proper function.

Signed-off-by: Corentin Labbe <[email protected]>
Acked-by: Giuseppe Cavallaro <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agonet: stmmac: replace stmmac_mdio_busy_wait by readl_poll_timeout
LABBE Corentin [Wed, 8 Feb 2017 08:31:12 +0000 (09:31 +0100)]
net: stmmac: replace stmmac_mdio_busy_wait by readl_poll_timeout

The stmmac_mdio_busy_wait() function do the same job than
readl_poll_timeout().
So is is better to replace it.

Signed-off-by: Corentin Labbe <[email protected]>
Acked-by: Giuseppe Cavallaro <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agonet: stmmac: fix some code style problem
LABBE Corentin [Wed, 8 Feb 2017 08:31:11 +0000 (09:31 +0100)]
net: stmmac: fix some code style problem

Checkpatch complains about some code style problem on stmmac_mdio.c.
This patch fix them.

Signed-off-by: Corentin Labbe <[email protected]>
Acked-by: Giuseppe Cavallaro <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agonet: stmmac: remplace asm/io.h by linux/io.h
LABBE Corentin [Wed, 8 Feb 2017 08:31:10 +0000 (09:31 +0100)]
net: stmmac: remplace asm/io.h by linux/io.h

This patch fix the checkpatch warning about asm/io.h.
Sorting all includes in the process.

Signed-off-by: Corentin Labbe <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agonet: stmmac: remove freesoftware address
LABBE Corentin [Wed, 8 Feb 2017 08:31:09 +0000 (09:31 +0100)]
net: stmmac: remove freesoftware address

This patch fix the checkpatch warning about free software address.

Signed-off-by: Corentin Labbe <[email protected]>
Acked-by: Giuseppe Cavallaro <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agonet: stmmac: fix some typos in comments
LABBE Corentin [Wed, 8 Feb 2017 08:31:08 +0000 (09:31 +0100)]
net: stmmac: fix some typos in comments

This patch fix some typos in comments.

Signed-off-by: Corentin Labbe <[email protected]>
Acked-by: Giuseppe Cavallaro <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agonet: stmmac: Remove the bus_setup function pointer
LABBE Corentin [Wed, 8 Feb 2017 08:31:07 +0000 (09:31 +0100)]
net: stmmac: Remove the bus_setup function pointer

The bus_setup function pointer is not used at all, this patch remove it.

Signed-off-by: Corentin Labbe <[email protected]>
Acked-by: Giuseppe Cavallaro <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agonet: stmmac: fix the typo on MAC_RNABLE_RX
LABBE Corentin [Wed, 8 Feb 2017 08:31:06 +0000 (09:31 +0100)]
net: stmmac: fix the typo on MAC_RNABLE_RX

the define MAC_RNABLE_RX have a typo, rename it to MAC_ENABLE_RX

Signed-off-by: Corentin Labbe <[email protected]>
Acked-by: Giuseppe Cavallaro <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agobpf, lpm: fix overflows in trie_alloc checks
Daniel Borkmann [Wed, 8 Feb 2017 00:19:43 +0000 (01:19 +0100)]
bpf, lpm: fix overflows in trie_alloc checks

Cap the maximum (total) value size and bail out if larger than KMALLOC_MAX_SIZE
as otherwise it doesn't make any sense to proceed further, since we're
guaranteed to fail to allocate elements anyway in lpm_trie_node_alloc();
likleyhood of failure is still high for large values, though, similarly
as with htab case in non-prealloc.

Next, make sure that cost vars are really u64 instead of size_t, so that we
don't overflow on 32 bit and charge only tiny map.pages against memlock while
allowing huge max_entries; cap also the max cost like we do with other map
types.

Fixes: b95a5c4db09b ("bpf: add a longest prefix match trie map implementation")
Signed-off-by: Daniel Borkmann <[email protected]>
Acked-by: Alexei Starovoitov <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agobridge: vlan tunnel id info range fill size calc cleanups
Roopa Prabhu [Wed, 8 Feb 2017 00:12:00 +0000 (16:12 -0800)]
bridge: vlan tunnel id info range fill size calc cleanups

This fixes a bug and cleans up tunnelid range size
calculation code by using consistent variable names
and checks in size calculation and fill functions.

tested for a few cases of vlan-vni range mappings:
(output from patched iproute2):
$bridge vlan showtunnel
port     vid        tunid
vxlan0   100-105    1000-1005
         200        2000
         210        2100
         211-213    2100-2102
         214        2104
         216-217    2108-2109
         219        2119

Fixes: efa5356b0d97 ("bridge: per vlan dst_metadata netlink support")
Reported-by: Colin Ian King <[email protected]>
Signed-off-by: Roopa Prabhu <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agogro_cells: move to net/core/gro_cells.c
Eric Dumazet [Tue, 7 Feb 2017 23:37:15 +0000 (15:37 -0800)]
gro_cells: move to net/core/gro_cells.c

We have many gro cells users, so lets move the code to avoid
duplication.

This creates a CONFIG_GRO_CELLS option.

Signed-off-by: Eric Dumazet <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agonet: mellanox: switchx2: use new api ethtool_{get|set}_link_ksettings
Philippe Reynes [Tue, 7 Feb 2017 23:07:33 +0000 (00:07 +0100)]
net: mellanox: switchx2: 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 <[email protected]>
Reviewed-by: Ido Schimmel <[email protected]>
Tested-by: Ido Schimmel <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agoMerge tag 'iwlwifi-next-for-kalle-2017-02-08' of git://git.kernel.org/pub/scm/linux...
Kalle Valo [Wed, 8 Feb 2017 19:28:36 +0000 (21:28 +0200)]
Merge tag 'iwlwifi-next-for-kalle-2017-02-08' of git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next

Some patches focusing on bugfixes for v4.11:

  * Fix 802.11w, which was failing to due an IGTK bug;
  * A few more bugzilla bug fixes;
  * A channel-switch race condition fix;
  * Some fixes related to suspend/resume with new HW;
  * The RF-kill saga continues;
  * And some other fixes here and there...

8 years agonet: qcom/emac: fix semicolon.cocci warnings
Wu Fengguang [Tue, 7 Feb 2017 19:42:05 +0000 (03:42 +0800)]
net: qcom/emac: fix semicolon.cocci warnings

drivers/net/ethernet/qualcomm/emac/emac-ethtool.c:155:49-50: Unneeded semicolon

 Remove unneeded semicolon.

Generated by: scripts/coccinelle/misc/semicolon.cocci

CC: Timur Tabi <[email protected]>
Signed-off-by: Fengguang Wu <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agonet: phy: Add LED mode driver for Microsemi PHYs.
Raju Lakkaraju [Tue, 7 Feb 2017 13:40:26 +0000 (19:10 +0530)]
net: phy: Add LED mode driver for Microsemi PHYs.

LED Mode:
Microsemi PHY support 2 LEDs (LED[0] and LED[1]) to display different
status information that can be selected by setting LED mode.

LED Mode parameter (vsc8531, led-0-mode) and (vsc8531, led-1-mode) get
from Device Tree.

Signed-off-by: Raju Lakkaraju <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agonet: dsa: bcm_sf2: cleanup bcm_sf2_cfp_rule_get() a little
Dan Carpenter [Tue, 7 Feb 2017 13:15:27 +0000 (16:15 +0300)]
net: dsa: bcm_sf2: cleanup bcm_sf2_cfp_rule_get() a little

This patch doesn't affect how the code works.

My static checker complains that the mask and shift doesn't make sense
because 0xffffff << 16 goes beyond the end of 32 bits.  It should be
0xffff instead but the existing code won't cause runtime bugs.

Also the casting here is not needed and not consistent with the rest of
the code.

Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
8 years agoiwlwifi: mvm: avoid exceeding the allowed print length
Golan Ben-Ami [Wed, 25 Jan 2017 13:11:30 +0000 (15:11 +0200)]
iwlwifi: mvm: avoid exceeding the allowed print length

Divide a mfuart related print so it won't exceed the allowed
MAX_MSG_LEN (110 bytes) per print.

Fixes: 19f63c531b85 ("iwlwifi: mvm: support v2 of mfuart load notification")
Signed-off-by: Golan Ben-Ami <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
8 years agoiwlwifi: mvm: Fix removal of IGTK
Ilan Peer [Mon, 16 Jan 2017 13:07:03 +0000 (15:07 +0200)]
iwlwifi: mvm: Fix removal of IGTK

When removing an IGTK, iwl_mvm_send_sta_igtk() was
called before station ID was retrieved, so the function
was invoked with an invalid station ID. Fix this by first
getting the station ID.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=192411
Signed-off-by: Ilan Peer <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
8 years agoiwlwifi: mvm: avoid race condition in ADD_STA.
Goodstein, Mordechay [Sun, 15 Jan 2017 14:00:12 +0000 (16:00 +0200)]
iwlwifi: mvm: avoid race condition in ADD_STA.

The race happens when we send ADD_STA(auth->assoc) -> LQ_CMD
between the commands the FW sometimes loses the medium for AUX, and
sends a ndp to the AP and the flow becomes, ADD_STA -> send ndp -> LQ_CMD
the problem is that there's no rates yet defined for sending the ndp and
FW generates an assert.

The fix: change the order of the commands to LQ_CMD -> ADD_STA

Signed-off-by: Mordechay Goodstein <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
8 years agoiwlwifi: mvm: Fix CSA received immediately after association
Avraham Stern [Mon, 9 Jan 2017 13:39:15 +0000 (15:39 +0200)]
iwlwifi: mvm: Fix CSA received immediately after association

The session protection set for association is only removed when
BSS_CHANGED_BEACON_INFO is set and BSS_CHANGED_ASSOC is not set.

However, mac80211 may set both on association (in case a beacon was
already received). In this case, mac80211 will not set
BSS_CHANGED_BEACON_INFO on the next beacons because it has already
notified the beacon change, so the session protection is never removed
(until the session protection ends).

When a CSA is received within this time, the station will fail to
folllow the channel switch because it cannot schedule the time event.

Fix this by removing the session protection when
BSS_CHANGED_BEACON_INFO and BSS_CHANGED_ASSOC are both set.

Signed-off-by: Avraham Stern <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
8 years agoiwlwifi: pcie: set STATUS_RFKILL immediately after interrupt
Golan Ben Ami [Sun, 11 Dec 2016 15:12:47 +0000 (17:12 +0200)]
iwlwifi: pcie: set STATUS_RFKILL immediately after interrupt

Currently, when getting a RFKILL interrupt, the transport enters a flow
in which it stops the device, disables other interrupts, etc. After
stopping the device, the transport resets the hw, and sleeps. During
the sleep, a context switch occurs and host commands are sent by upper
layers (e.g. mvm) to the fw. This is possible since the op_mode layer
and the transport layer hold different mutexes.

Since the STATUS_RFKILL bit isn't set, the transport layer doesn't
recognize that RFKILL was toggled on, and no commands can actually be
sent, so it enqueues the command to the tx queue and sets a timer on
the queue.

After switching context back to stopping the device, STATUS_RFKILL is
set, and then the transport can't send the command to the fw.
This eventually results in a queue hang.

Fix this by setting STATUS_RFKILL immediately when
the interrupt is fired.

Signed-off-by: Golan Ben-Ami <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
8 years agoiwlwifi: mvm: don't call << operator with a negative value
Emmanuel Grumbach [Sat, 7 Jan 2017 17:57:46 +0000 (19:57 +0200)]
iwlwifi: mvm: don't call << operator with a negative value

In https://bugzilla.kernel.org/show_bug.cgi?id=177341 Bob
reported a UBSAN WARNING on rs.c in iwldvm.
Fix the same bug in iwlmvm.

This because
i = index - 1;
for (mask = (1 << i); i >= 0; i--, mask >>= 1)

is unsafe: i could be negative and hence we can call <<
on a negative value.
This bug doesn't have any real impact since the condition
of the for loop will prevent any usage of mask.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=177341
Signed-off-by: Emmanuel Grumbach <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
8 years agoiwlwifi: dvm: don't call << operator with a negative value
Emmanuel Grumbach [Sat, 7 Jan 2017 17:57:46 +0000 (19:57 +0200)]
iwlwifi: dvm: don't call << operator with a negative value

In https://bugzilla.kernel.org/show_bug.cgi?id=177341 Bob
reported a UBSAN WARNING on rs.c.

Undefined behaviour in drivers/net/wireless/intel/iwlwifi/dvm/rs.c:746:18

This because
i = index - 1;
for (mask = (1 << i); i >= 0; i--, mask >>= 1)

is unsafe: i could be negative and hence we can call <<
on a negative value.
This bug doesn't have any real impact since the condition
of the for loop will prevent any usage of mask.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=177341
Signed-off-by: Emmanuel Grumbach <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
8 years agoiwlwifi: make RTPM depend on EXPERT
Emmanuel Grumbach [Sat, 7 Jan 2017 21:03:40 +0000 (23:03 +0200)]
iwlwifi: make RTPM depend on EXPERT

Enabling the RTPM Kconfig option can be fairly risky.
Runtime PM must be validated against a specific platform
before it can be safely enabled. Hence, it makes no sense
for distros and other big OS vendors to enable it since
they ship code to various systems and unknown platform.

Make sure that this is hinted properly by making the
IWLWIFI_PCIE_RTPM Kconfig option depend on EXPERT.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=172411
Signed-off-by: Emmanuel Grumbach <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
8 years agoiwlwifi: pcie: don't increment / decrement a bool
Emmanuel Grumbach [Sat, 7 Jan 2017 18:11:47 +0000 (20:11 +0200)]
iwlwifi: pcie: don't increment / decrement a bool

David reported that the code I added uses the decrement
and increment operator on a boolean variable.

Fix that.

Fixes: 0cd58eaab148 ("iwlwifi: pcie: allow the op_mode to block the tx queues")
Reported-by: David Binderman <[email protected]>
Signed-off-by: Emmanuel Grumbach <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
8 years agoMerge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
Kalle Valo [Wed, 8 Feb 2017 15:46:02 +0000 (17:46 +0200)]
Merge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git

ath.git patches for 4.11. Major changes:

ath10k

* add debugfs file peer_debug_trigger for debugging firmware

8 years agort2x00: remove queue_entry from skbdesc
Stanislaw Gruszka [Wed, 8 Feb 2017 12:51:31 +0000 (13:51 +0100)]
rt2x00: remove queue_entry from skbdesc

queue_entry field of skbdesc is not read any more, remove it to allow
skbdesc contain other data.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
8 years agort2x00: call entry directly in rt2x00_dump_frame
Stanislaw Gruszka [Wed, 8 Feb 2017 12:51:30 +0000 (13:51 +0100)]
rt2x00: call entry directly in rt2x00_dump_frame

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
8 years agort61pci: use entry directly
Stanislaw Gruszka [Wed, 8 Feb 2017 12:51:29 +0000 (13:51 +0100)]
rt61pci: use entry directly

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
8 years agort2x00usb: fix anchor initialization
Stanislaw Gruszka [Wed, 8 Feb 2017 11:18:10 +0000 (12:18 +0100)]
rt2x00usb: fix anchor initialization

If device fail to initialize we can OOPS in rt2x00lib_remove_dev(), due
to using uninitialized usb_anchor structure:

[  855.435820] ieee80211 phy3: rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x1000 with error -19
[  855.435826] ieee80211 phy3: rt2800_probe_rt: Error - Invalid RT chipset 0x0000, rev 0000 detected
[  855.435829] ieee80211 phy3: rt2x00lib_probe_dev: Error - Failed to allocate device
[  855.435845] BUG: unable to handle kernel NULL pointer dereference at 0000000000000028
[  855.435900] IP: _raw_spin_lock_irq+0xd/0x30
[  855.435926] PGD 0
[  855.435953] Oops: 0002 [#1] SMP
<snip>
[  855.437011] Call Trace:
[  855.437029]  ? usb_kill_anchored_urbs+0x27/0xc0
[  855.437061]  rt2x00lib_remove_dev+0x190/0x1c0 [rt2x00lib]
[  855.437097]  rt2x00lib_probe_dev+0x246/0x7a0 [rt2x00lib]
[  855.437149]  ? ieee80211_roc_setup+0x9e/0xd0 [mac80211]
[  855.437183]  ? __kmalloc+0x1af/0x1f0
[  855.437207]  ? rt2x00usb_probe+0x13d/0xc50 [rt2x00usb]
[  855.437240]  rt2x00usb_probe+0x155/0xc50 [rt2x00usb]
[  855.437273]  rt2800usb_probe+0x15/0x20 [rt2800usb]
[  855.437304]  usb_probe_interface+0x159/0x2d0
[  855.437333]  driver_probe_device+0x2bb/0x460

Patch changes initialization sequence to fix the problem.

Cc: Vishal Thanki <[email protected]>
Fixes: 8b4c0009313f ("rt2x00usb: Use usb anchor to manage URB")
Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
8 years agort2x00usb: do not anchor rx and tx urb's
Stanislaw Gruszka [Wed, 8 Feb 2017 11:18:09 +0000 (12:18 +0100)]
rt2x00usb: do not anchor rx and tx urb's

We might kill TX or RX urb during rt2x00usb_flush_entry(), what can
cause anchor list corruption like shown below:

[ 2074.035633] WARNING: CPU: 2 PID: 14480 at lib/list_debug.c:33 __list_add+0xac/0xc0
[ 2074.035634] list_add corruption. prev->next should be next (ffff88020f362c28), but was dead000000000100. (prev=ffff8801d161bb70).
<snip>
[ 2074.035670] Call Trace:
[ 2074.035672]  [<ffffffff813bde47>] dump_stack+0x63/0x8c
[ 2074.035674]  [<ffffffff810a2231>] __warn+0xd1/0xf0
[ 2074.035676]  [<ffffffff810a22af>] warn_slowpath_fmt+0x5f/0x80
[ 2074.035678]  [<ffffffffa073855d>] ? rt2x00usb_register_write_lock+0x3d/0x60 [rt2800usb]
[ 2074.035679]  [<ffffffff813dbe4c>] __list_add+0xac/0xc0
[ 2074.035681]  [<ffffffff81591c6c>] usb_anchor_urb+0x4c/0xa0
[ 2074.035683]  [<ffffffffa07322af>] rt2x00usb_kick_rx_entry+0xaf/0x100 [rt2x00usb]
[ 2074.035684]  [<ffffffffa0732322>] rt2x00usb_clear_entry+0x22/0x30 [rt2x00usb]

To fix do not anchor TX and RX urb's, it is not needed as during
shutdown we kill those urbs in rt2x00usb_free_entries().

Cc: Vishal Thanki <[email protected]>
Fixes: 8b4c0009313f ("rt2x00usb: Use usb anchor to manage URB")
Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
8 years agortlwifi: Move items out of rtl_pci_priv and rtl_usb_priv
Larry Finger [Tue, 7 Feb 2017 15:14:21 +0000 (09:14 -0600)]
rtlwifi: Move items out of rtl_pci_priv and rtl_usb_priv

In commit 6773386f977c ("rtlwifi: rtl8192c-common: Fix "BUG: KASAN:"),
a BUG detected when CONFIG_KASAN=y was fixed by reordering the layouts
of struct rtl_pci_priv, and struct rtl_usb_priv so that the variables
used by both PCI and USB drivers have the same offsets in both structs.
The better fix of relocating the critical variables into struct rtl_priv
was deferred as these changes do not have to be applied to stable
kernels.

This change also removes CamelCase variables with pLed0 => pled0.

Signed-off-by: Larry Finger <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
8 years agobrcmfmac: merge two remaining brcmf_err macros
Rafał Miłecki [Thu, 2 Feb 2017 21:33:15 +0000 (22:33 +0100)]
brcmfmac: merge two remaining brcmf_err macros

Now we always have __brcmf_err function we can do perfectly fine with
just one macro.

Signed-off-by: Rafał Miłecki <[email protected]>
Acked-by: Arend van Spriel <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
8 years agobrcmfmac: switch to C function (__brcmf_err) for printing errors
Rafał Miłecki [Thu, 2 Feb 2017 21:33:14 +0000 (22:33 +0100)]
brcmfmac: switch to C function (__brcmf_err) for printing errors

This will allow extending code and using more detailed messages e.g.
with the help of dev_err.

Signed-off-by: Rafał Miłecki <[email protected]>
Acked-by: Arend van Spriel <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
8 years agobrcmfmac: merge two brcmf_err macros into one
Rafał Miłecki [Thu, 2 Feb 2017 21:33:13 +0000 (22:33 +0100)]
brcmfmac: merge two brcmf_err macros into one

This allows simplifying the code by adding a simple IS_ENABLED check for
CONFIG_BRCMDB symbol.

Signed-off-by: Rafał Miłecki <[email protected]>
Acked-by: Arend van Spriel <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
8 years agoath10k: select WANT_DEV_COREDUMP
Johannes Berg [Tue, 7 Feb 2017 22:29:33 +0000 (23:29 +0100)]
ath10k: select WANT_DEV_COREDUMP

This is necessary so that - if ath10k is the only driver using
dev_coredump*() - the functionality is built into the kernel.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
8 years agowil6210: include moduleparam.h
Johannes Berg [Tue, 7 Feb 2017 14:33:28 +0000 (15:33 +0100)]
wil6210: include moduleparam.h

This now declares a module parameter, so include the necessary
header file for that.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
8 years agoath10k: remove unneeded semicolon
Waldemar Rymarkiewicz [Thu, 2 Feb 2017 17:53:42 +0000 (18:53 +0100)]
ath10k: remove unneeded semicolon

Remove redundant semicolon after switch statement.

Signed-off-by: Waldemar Rymarkiewicz <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
8 years agoiwlwifi: mvm: use the PROBE_RESP_QUEUE to send deauth to unknown station
Emmanuel Grumbach [Wed, 28 Dec 2016 08:43:02 +0000 (10:43 +0200)]
iwlwifi: mvm: use the PROBE_RESP_QUEUE to send deauth to unknown station

When we send a deauth to a station we don't know about, we
need to use the PROBE_RESP queue. This can happen when we
send a deauth to a station that is not associated to us.

Signed-off-by: Emmanuel Grumbach <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
8 years agoiwlwifi: mvm: fix reorder timer re-arming
Sara Sharon [Tue, 3 Jan 2017 19:03:35 +0000 (21:03 +0200)]
iwlwifi: mvm: fix reorder timer re-arming

When NSSN is behind the reorder buffer due to timeout
the reorder timer isn't getting re-armed until NSSN
catches up. Fix it.

Fixes: 0690405fef29 ("iwlwifi: mvm: add reorder timeout per frame")
Signed-off-by: Sara Sharon <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
8 years agoiwlwifi: mvm: fix references to first_agg_queue in DQA mode
Sara Sharon [Sun, 1 Jan 2017 16:42:23 +0000 (18:42 +0200)]
iwlwifi: mvm: fix references to first_agg_queue in DQA mode

In DQA mode, first_agg_queue is initialized to
IWL_MVM_DQA_MIN_DATA_QUEUE. This causes two bugs in the tx response
flow:

1. When TX fails, we set IEEE80211_TX_STAT_AMPDU_NO_BACK regardless
   if we actually have aggregation open on the queue. This causes
   mac80211 to send a BAR frame even though there is no aggregation
   open.
   Fix that by simply checking the AMPDU flag that is set on by
   mac80211 for AMPDU packets.

2. When reclaiming frames in aggregation mode, we reclaim based on
   scheduler ssn and not the SN.
   The reason is that scheduler ssn may be ahead of SN due to a hole
   in the BA window that was filled.
   However, if we have aggregations open on IWL_MVM_DQA_BSS_CLIENT_QUEUE
   the reclaim flow will still go to the code of non-aggregation
   instead of the aggregation code since IWL_MVM_DQA_BSS_CLIENT_QUEUE
   is smaller than IWL_MVM_DQA_MIN_DATA_QUEUE, although it is a valid
   aggregation queue.
   Fix that by always using the aggregation reclaim code by default in
   DQA mode (currently it is implicitly used by default for all queues
   except the reserved BSS queue).

Fixes: cf961e16620f ("iwlwifi: mvm: support dqa-mode agg on non-shared queue")
Signed-off-by: Sara Sharon <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
8 years agoiwlwifi: mvm: fix a print of NSS for HT rate
Gregory Greenman [Wed, 21 Dec 2016 14:18:44 +0000 (16:18 +0200)]
iwlwifi: mvm: fix a print of NSS for HT rate

Handling of the number of space time streams was missing for HT rate in
rate printing function. Fix it.

Signed-off-by: Gregory Greenman <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
8 years agoiwlwifi: pcie: Re-configure IVAR table after stop device
Golan Ben Ami [Thu, 15 Dec 2016 08:22:36 +0000 (10:22 +0200)]
iwlwifi: pcie: Re-configure IVAR table after stop device

When getting RF_KILL and disabling radio, the device gets stopped
and reset. This erases the IVAR table that matches the interrupt
to its cause, and is essential for MSIX proper functionality.
Till now, the table wasn't re-configured after the reset, and
therefore the interrupt that enabled radio didn't fire on the
right irq, and the driver didn't handle it correctly.

To fix this, configure the IVAR table again after resetting the
device.

Signed-off-by: Golan Ben-Ami <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
8 years agoiwlwifi: pcie: re-configure IVAR table after suspend-resume
Haim Dreyfuss [Mon, 12 Dec 2016 12:09:49 +0000 (14:09 +0200)]
iwlwifi: pcie: re-configure IVAR table after suspend-resume

During the suspend/resume flow some HW blocks are reset.  This causes
the IVAR table to be completely erased.  This table is where interrupt
causes are bound to specific IRQs.  When the table is empty the
interrupt handlers are not called correctly.  Fix this by reconfiguring
the IVAR table after resume.

Fixes: 2e5d4a8f61dc ("iwlwifi: pcie: Add new configuration to enable MSIX")
Signed-off-by: Haim Dreyfuss <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
8 years agoiwlwifi: pcie: separate between SW and HW MSIX configuration
Haim Dreyfuss [Tue, 13 Dec 2016 10:40:34 +0000 (12:40 +0200)]
iwlwifi: pcie: separate between SW and HW MSIX configuration

The MSIX configuration flow includes two different stages:
configuring the HW by writing to the IVAR table and configuring the SW
to reflect the HW configuration.
The HW configuration is needed on each HW reset,
whereas the SW configuration is only needed during the init flow.

Signed-off-by: Haim Dreyfuss <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
8 years agocfg80211: Pass new RSSI level in CQM RSSI notification
Andrzej Zaborowski [Wed, 25 Jan 2017 11:43:41 +0000 (12:43 +0100)]
cfg80211: Pass new RSSI level in CQM RSSI notification

Update the drivers to pass the RSSI level as a cfg80211_cqm_rssi_notify
parameter and pass this value to userspace in a new nl80211 attribute.
This helps both userspace and also helps in the implementation of the
multiple RSSI thresholds CQM mechanism.

Note for marvell/mwifiex I pass 0 for the RSSI value because the new
RSSI value is not available to the driver at the time of the
cfg80211_cqm_rssi_notify call, but the driver queries the new value
immediately after that, so it is actually available just a moment later
if we wanted to defer caling cfg80211_cqm_rssi_notify until that moment.
Without this, the new cfg80211 code (patch 3) will call .get_station
which will send a duplicate HostCmd_CMD_RSSI_INFO command to the hardware.

Signed-off-by: Andrew Zaborowski <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
8 years agomac80211: Pass new RSSI level in CQM RSSI notification
Andrzej Zaborowski [Wed, 25 Jan 2017 11:43:40 +0000 (12:43 +0100)]
mac80211: Pass new RSSI level in CQM RSSI notification

Extend ieee80211_cqm_rssi_notify with a rssi_level parameter so that
this information can be passed to netlink clients in the next patch, if
available.  Most drivers will have this value at hand.  wl1251 receives
events from the firmware that only tell it whether latest measurement
is above or below threshold so we don't pass any value at this time
(parameter is 0).

Signed-off-by: Andrew Zaborowski <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
8 years agonl80211: fix validation of scheduled scan info for wowlan netdetect
Arend Van Spriel [Fri, 27 Jan 2017 12:27:44 +0000 (12:27 +0000)]
nl80211: fix validation of scheduled scan info for wowlan netdetect

For wowlan netdetect a separate limit is defined for the number of
matchsets. Currently, this limit is ignored and the regular limit
for scheduled scan matchsets, ie. struct wiphy::max_match_sets, is
used for the net-detect case as well.

Cc: Johannes Berg <[email protected]>
Reviewed-by: Hante Meuleman <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Reviewed-by: Franky Lin <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
8 years agonl80211: add HT/VHT capabilities to AP parameters
Johannes Berg [Tue, 7 Feb 2017 20:40:44 +0000 (22:40 +0200)]
nl80211: add HT/VHT capabilities to AP parameters

For the benefit of drivers that rebuild IEs in firmware, parse the
IEs for HT/VHT capabilities and the respective membership selector
in the (extended) supported rates. This avoids duplicating the same
code into all drivers that need this information.

Signed-off-by: Johannes Berg <[email protected]>
8 years agocfg80211: make rdev assignment clearer in nl80211_testmode_dump()
Luca Coelho [Tue, 7 Feb 2017 20:13:56 +0000 (22:13 +0200)]
cfg80211: make rdev assignment clearer in nl80211_testmode_dump()

Avoid assigning rdev to NULL when we already have it and getting it
again from the wiphy index, by moving this code to relevant if block.

Signed-off-by: Luca Coelho <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
This page took 0.120569 seconds and 4 git commands to generate.