GitHub/moto-9609/android_kernel_motorola_exynos9610.git
8 years agonet: ipv6: Use passed in table for nexthop lookups
David Ahern [Mon, 25 Apr 2016 04:26:04 +0000 (21:26 -0700)]
net: ipv6: Use passed in table for nexthop lookups

Similar to 3bfd847203c6 ("net: Use passed in table for nexthop lookups")
for IPv4, if the route spec contains a table id use that to lookup the
next hop first and fall back to a full lookup if it fails (per the fix
4c9bcd117918b ("net: Fix nexthop lookups")).

Example:

    root@kenny:~# ip -6 ro ls table red
    local 2100:1::1 dev lo  proto none  metric 0  pref medium
    2100:1::/120 dev eth1  proto kernel  metric 256  pref medium
    local 2100:2::1 dev lo  proto none  metric 0  pref medium
    2100:2::/120 dev eth2  proto kernel  metric 256  pref medium
    local fe80::e0:f9ff:fe09:3cac dev lo  proto none  metric 0  pref medium
    local fe80::e0:f9ff:fe1c:b974 dev lo  proto none  metric 0  pref medium
    fe80::/64 dev eth1  proto kernel  metric 256  pref medium
    fe80::/64 dev eth2  proto kernel  metric 256  pref medium
    ff00::/8 dev red  metric 256  pref medium
    ff00::/8 dev eth1  metric 256  pref medium
    ff00::/8 dev eth2  metric 256  pref medium
    unreachable default dev lo  metric 240  error -113 pref medium

    root@kenny:~# ip -6 ro add table red 2100:3::/64 via 2100:1::64
    RTNETLINK answers: No route to host

Route add fails even though 2100:1::64 is a reachable next hop:
    root@kenny:~# ping6 -I red  2100:1::64
    ping6: Warning: source address might be selected on device other than red.
    PING 2100:1::64(2100:1::64) from 2100:1::1 red: 56 data bytes
    64 bytes from 2100:1::64: icmp_seq=1 ttl=64 time=1.33 ms

With this patch:
    root@kenny:~# ip -6 ro add table red 2100:3::/64 via 2100:1::64
    root@kenny:~# ip -6 ro ls table red
    local 2100:1::1 dev lo  proto none  metric 0  pref medium
    2100:1::/120 dev eth1  proto kernel  metric 256  pref medium
    local 2100:2::1 dev lo  proto none  metric 0  pref medium
    2100:2::/120 dev eth2  proto kernel  metric 256  pref medium
    2100:3::/64 via 2100:1::64 dev eth1  metric 1024  pref medium
    local fe80::e0:f9ff:fe09:3cac dev lo  proto none  metric 0  pref medium
    local fe80::e0:f9ff:fe1c:b974 dev lo  proto none  metric 0  pref medium
    fe80::/64 dev eth1  proto kernel  metric 256  pref medium
    fe80::/64 dev eth2  proto kernel  metric 256  pref medium
    ff00::/8 dev red  metric 256  pref medium
    ff00::/8 dev eth1  metric 256  pref medium
    ff00::/8 dev eth2  metric 256  pref medium
    unreachable default dev lo  metric 240  error -113 pref medium

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agotaskstats: fix nl parsing in accounting/getdelays.c
Nicolas Dichtel [Wed, 27 Apr 2016 15:53:08 +0000 (17:53 +0200)]
taskstats: fix nl parsing in accounting/getdelays.c

The type TASKSTATS_TYPE_NULL should always be ignored.

When jumping to the next attribute, only the length of the current
attribute should be added, not the length of all nested attributes.
This last bug was not visible before commit 80df554275c2, because the
kernel didn't put more than two nested attributes.

Fixes: a3baf649ca9c ("[PATCH] per-task-delay-accounting: documentation")
Fixes: 80df554275c2 ("taskstats: use the libnl API to align nlattr on 64-bit")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agopch_gbe: fix bogus trylock conversion
Florian Westphal [Tue, 26 Apr 2016 21:14:30 +0000 (23:14 +0200)]
pch_gbe: fix bogus trylock conversion

Should have converted 'if (trylock)' to 'lock'.

Fixes: a6086a893718db ("drivers: net: remove NETDEV_TX_LOCKED")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'sh_eth-next'
David S. Miller [Tue, 26 Apr 2016 20:07:21 +0000 (16:07 -0400)]
Merge branch 'sh_eth-next'

Sergei Shtylyov says:

====================
sh_eth: couple of software reset bit cleanups

   Here's a set of 2 patches against DaveM's 'net-next.git' repo. We clean up
the use of the software reset bits...
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agosh_eth: rename ARSTR register bit
Sergei Shtylyov [Sun, 24 Apr 2016 20:46:15 +0000 (23:46 +0300)]
sh_eth: rename ARSTR register bit

The Renesas RZ/A1H manual names the software reset bit in the software reset
register (ARSTR) ARST which makes a bit more sense than the ARSTR_ARSTR name
used now  by the driver -- rename the latter to ARSTR_ARST.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agosh_eth: use EDMR_SRST_GETHER in sh_eth_check_reset()
Sergei Shtylyov [Sun, 24 Apr 2016 20:45:23 +0000 (23:45 +0300)]
sh_eth: use EDMR_SRST_GETHER in sh_eth_check_reset()

sh_eth_check_reset() uses a bare number where EDMR_SRST_GETHER would fit,
i.e. the receive/trasmit software reset bits that comprise EDMR_SRST_GETHER
read as 1  while the corresponding reset is in progress and thus, when both
are 0, the reset is complete.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'mlx5-next'
David S. Miller [Tue, 26 Apr 2016 19:58:03 +0000 (15:58 -0400)]
Merge branch 'mlx5-next'

Saeed Mahameed says:

====================
Mellanox 100G extending mlx5 ethtool support

Changes from V0:
- Dropped: net/mlx5e: Disable link up on INIT HCA command
  Due to Ido's and Or's requests we will submit this patch to net and will need it for -stable.
- Rebased to: 11afbff86168 ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next")

This series is centralized around extending and improving mlx5 ethernet driver ethtool
support. We've done some code refactoring for ethtool statistics reporting, making it
more scalable and robust, now each reported ethtool counter belongs to a group and has
its own descriptor within that group, the descriptor holds the counter name and offset
in memory in that group memory block.

Added new counters:
- Reporting more error and drop counter in ifconig/ip tool.
- Per priority pause and traffic counter in ethtool.
- link down events counter in ethtool.

Set features handling was also refactored a little bit to be more resilient and generic,
now setting more than one feature will not stop on the first failed one, but instead
it will try to continue setting others. We made it generic to make it simpler for adding
more features support, it is now done easily by only introducing a handler function of
the new supported netdev feature, and let the generic handler do the job.

New netdev features and ethtool support:
- Netdev feature RXALL, set on/off FCS check offload.
- Netdev feature HW_VLAN_CTAG_RX, set on/off rx-vlan stripping offload.
- Ethtool interface identify.
- Ethtool dump module EEPROM.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/mlx5e: Fix checksum handling for non-stripped vlan packets
Saeed Mahameed [Sun, 24 Apr 2016 19:51:56 +0000 (22:51 +0300)]
net/mlx5e: Fix checksum handling for non-stripped vlan packets

Now as rx-vlan offload can be disabled, packets can be received
with vlan tag not stripped, which means is_first_ethertype_ip will
return false, for that we need to check if the hardware reported
csum OK so we will report CHECKSUM_UNNECESSARY for those packets.

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/mlx5e: Add ethtool support for rxvlan-offload (vlan stripping)
Gal Pressman [Sun, 24 Apr 2016 19:51:55 +0000 (22:51 +0300)]
net/mlx5e: Add ethtool support for rxvlan-offload (vlan stripping)

Use ethtool -K <interface> rxvlan <on/off> to enable/disable
C-TAG vlan stripping by hardware.

Signed-off-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/mlx5e: Add ethtool support for dump module EEPROM
Gal Pressman [Sun, 24 Apr 2016 19:51:54 +0000 (22:51 +0300)]
net/mlx5e: Add ethtool support for dump module EEPROM

Add query MCIA, PMLP registers infrastructure and commands.
Add ethtool support for get_module_info() and get_module_eeprom()
callbacks.

Signed-off-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/mlx5e: Add ethtool support for interface identify (LED blinking)
Gal Pressman [Sun, 24 Apr 2016 19:51:53 +0000 (22:51 +0300)]
net/mlx5e: Add ethtool support for interface identify (LED blinking)

Add the needed hardware command and mlx5_ifc structs for managing LED
control.
Add set_phys_id ethtool callback to support ethtool -p flag.

Signed-off-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Eugenia Emantayev <eugenia@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/mlx5e: Add support for RXALL netdev feature
Eran Ben Elisha [Sun, 24 Apr 2016 19:51:52 +0000 (22:51 +0300)]
net/mlx5e: Add support for RXALL netdev feature

Introduce new access register named Ports Check Mask Register (PCMR) to
control all HW checks on port. With this register, the driver can
enable/disable Hardware FCS validation.

When RXALL is enabled/disabled using ndo_set_features, enable/disable
fcs check at HW.
User can change HW configuration using rx-all flag at ethtool.

Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/mlx5e: Improve set features ndo resiliency
Gal Pressman [Sun, 24 Apr 2016 19:51:51 +0000 (22:51 +0300)]
net/mlx5e: Improve set features ndo resiliency

In current mlx5e ndo_set_features implementation, setting some features
can success while others can fail. Today, we return one error code which
doesn't reflect the current features status of the netdev at the end of
the ndo callback.

Set netdev->features with features which were successfully set in order
to keep the current status in case of failure. For this purpose, define
new Macro to set/unset specific feature in netdev->features.

This patch introduces a mechanism that uses feature handlers for each
feature.
Set features will call a generic handler, which will then call a specific
handler in his turn and update netdev->features according to it's return
value. Each specific handler is responsible to perform driver specific
actions, and updating params if needed.

Signed-off-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/mlx5e: Add link down events counter
Gal Pressman [Sun, 24 Apr 2016 19:51:50 +0000 (22:51 +0300)]
net/mlx5e: Add link down events counter

Expose link_down_events counter through ethtool -S.
This counter is read from PPort statistics, then proccessed and stored as
a special handling software counter.
This counter is stored along software counters since it is the only PPort
counter that it's size is not 64 bits.

Signed-off-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/mlx5e: Add per priority group to PPort counters
Gal Pressman [Sun, 24 Apr 2016 19:51:49 +0000 (22:51 +0300)]
net/mlx5e: Add per priority group to PPort counters

Expose counters providing information for each priority level (PCP) through
ethtool -S option and DCBNL.
This includes rx/tx bytes, frames, and pause counters.

Signed-off-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/mlx5e: Rename VPort counters
Gal Pressman [Sun, 24 Apr 2016 19:51:48 +0000 (22:51 +0300)]
net/mlx5e: Rename VPort counters

VPort and software counters names are confusing and may be unclear, all
VPort counters now have a prefix of rx/tx_vport_*.

Signed-off-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/mlx5e: Statistics handling refactoring
Gal Pressman [Sun, 24 Apr 2016 19:51:47 +0000 (22:51 +0300)]
net/mlx5e: Statistics handling refactoring

Redesign ethtool statistics handling and reporting in the driver:
1. Move counters to a separate file (en_stats.h).
2. Remove unnecessary dependencies between stats and strings.
3. Use counter descriptors which hold a name and offset for each counter,
   and will be used to decide which counters will be exposed.

For example when adding a new software counter to ethtool, instead of:
1. Add to stats struct.
2. Add to strings struct in the same order.
3. Change macro defining number of software counters.
The only thing needed is to link the new counter to a counter descriptor.

VPort counters are a set of hardware traffic counters created automatically
for each virtual port opened.
PPort counters are a set of counters describing per physical port
performance statistics.
These counters are gathered from hardware register and divided to groups
according to different protocols.

Signed-off-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/mlx5e: Report additional error statistics in get stats ndo
Gal Pressman [Sun, 24 Apr 2016 19:51:46 +0000 (22:51 +0300)]
net/mlx5e: Report additional error statistics in get stats ndo

Provide rtnl_link_stats64 with information regarding physical errors to be
seen in ifconfig and ip tool.

Signed-off-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoinfiniband: nes: Kill unused variable in nes_netdev_start_xmit()
David S. Miller [Tue, 26 Apr 2016 19:57:19 +0000 (15:57 -0400)]
infiniband: nes: Kill unused variable in nes_netdev_start_xmit()

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'netdev_tx_locked-removal'
David S. Miller [Tue, 26 Apr 2016 19:53:06 +0000 (15:53 -0400)]
Merge branch 'netdev_tx_locked-removal'

Florian Westphal says:

====================
net: core: remove TX_LOCKED support

Not that many users left, lets kill it.

TX_LOCKED was meant to be used by LLTX drivers when spin_trylock()
failed.  Stack then re-queued if collisions happened on different
cpus or free'd the skb to prevent deadlocks.

Most of the driver removal patches fall into one of three categories:
1. remove the driver-private tx lock (and LLTX flag), or...
2. convert spin_trylock to plain spin_lock, or...
3. convert TX_LOCKED to free+TX_OK

Patches are grouped by these categories, last patch is the actual removal.
All driver changes were compile tested only with exception of atl1e.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: remove NETDEV_TX_LOCKED support
Florian Westphal [Sun, 24 Apr 2016 19:38:14 +0000 (21:38 +0200)]
net: remove NETDEV_TX_LOCKED support

No more users in the tree, remove NETDEV_TX_LOCKED support.
Adds another hole in softnet_stats struct, but better than keeping
the unused collision counter around.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agodrivers: net: remove NETDEV_TX_LOCKED
Florian Westphal [Sun, 24 Apr 2016 19:38:13 +0000 (21:38 +0200)]
drivers: net: remove NETDEV_TX_LOCKED

replace the trylock by a full spin_lock and remove TX_LOCKED return value.
Followup patch will remove TX_LOCKED from the kernel.

Cc: Jon Mason <jdmason@kudzu.us>
Cc: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agodrivers: net: use NETDEV_TX_OK instead of NETDEV_TX_LOCKED
Florian Westphal [Sun, 24 Apr 2016 19:38:12 +0000 (21:38 +0200)]
drivers: net: use NETDEV_TX_OK instead of NETDEV_TX_LOCKED

These drivers already call netif_stop_queue() so we should not be called
unless tx space is available.  Just free the skb and return TX_OK.

Followup patch will remove NETDEV_TX_LOCKED from the kernel.

Cc: linux-parisc@vger.kernel.org
Cc: linux-hams@vger.kernel.org
Cc: Thomas Sailer <t.sailer@alumni.ethz.ch>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoatle1: remove LLTX support and TX_UNLOCKED
Florian Westphal [Sun, 24 Apr 2016 19:38:11 +0000 (21:38 +0200)]
atle1: remove LLTX support and TX_UNLOCKED

similar to atl1c: lock is only used in ndo_start_xmit, but we also
advertised LLTX, so remove that as well and let core stack handle
tx locking.

Allows to remove the TX_LOCKED return value from the driver.

Cc: Jay Cliburn <jcliburn@gmail.com>
Cc: Chris Snook <chris.snook@gmail.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoatl1c: remove private tx lock
Florian Westphal [Sun, 24 Apr 2016 19:38:10 +0000 (21:38 +0200)]
atl1c: remove private tx lock

AFAICS this is safe: the lock is only used in the .ndo_start_xmit
function and this driver does not set LLTX.

Gets rid of TX_LOCKED return value, followup patches will remove it.

Cc: Jay Cliburn <jcliburn@gmail.com>
Cc: Chris Snook <chris.snook@gmail.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoRDMA/nes: remove use of NETDEV_TX_LOCKED
Florian Westphal [Sun, 24 Apr 2016 19:38:09 +0000 (21:38 +0200)]
RDMA/nes: remove use of NETDEV_TX_LOCKED

ndo_start_xmit never returns it to stack, but nes_nic_send helper used it if
skb could not be queued to hardware.  Switch to bool instead.

Cc: <linux-rdma@vger.kernel.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'get_phy_device-retval'
David S. Miller [Tue, 26 Apr 2016 19:41:21 +0000 (15:41 -0400)]
Merge branch 'get_phy_device-retval'

Sergei Shtylyov says:

====================
Don't return NULL from get_phy_device() anymore

   Here's the set of 5 patches against DaveM's 'net-next.git' repo. The first
patch makes get_phy_device() return only error values on error, the rest of
the patches clean up the callers of that function...
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoof_mdio: get_phy_device() doesn't return NULL anymore
Sergei Shtylyov [Sun, 24 Apr 2016 17:31:42 +0000 (20:31 +0300)]
of_mdio: get_phy_device() doesn't return NULL anymore

Now that get_phy_device() no longer returns NULL on error, we don't need
to check for it...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomdio_bus: get_phy_device() doesn't return NULL anymore
Sergei Shtylyov [Sun, 24 Apr 2016 17:30:53 +0000 (20:30 +0300)]
mdio_bus: get_phy_device() doesn't return NULL anymore

Now that get_phy_device() no longer returns NULL on error, we don't need
to check for it...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agofixed_phy: get_phy_device() doesn't return NULL anymore
Sergei Shtylyov [Sun, 24 Apr 2016 17:29:23 +0000 (20:29 +0300)]
fixed_phy: get_phy_device() doesn't return NULL anymore

Now that get_phy_device() no longer returns NULL on error, we don't need
to check for it...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoxgene: get_phy_device() doesn't return NULL anymore
Sergei Shtylyov [Sun, 24 Apr 2016 17:27:49 +0000 (20:27 +0300)]
xgene: get_phy_device() doesn't return NULL anymore

Now that get_phy_device() no longer returns NULL on error, we don't need
to check for it...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agophylib: don't return NULL from get_phy_device()
Sergei Shtylyov [Sun, 24 Apr 2016 17:25:23 +0000 (20:25 +0300)]
phylib: don't return NULL from get_phy_device()

Arnd Bergmann asked that get_phy_device() returns either NULL or the error
value,  not both on error.  Do as he said, return ERR_PTR(-ENODEV) instead
of NULL when the PHY ID registers read as  all ones.

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agosh_eth: get rid of the 2nd parameter to sh_eth_dev_init()
Sergei Shtylyov [Sun, 24 Apr 2016 16:11:07 +0000 (19:11 +0300)]
sh_eth: get rid of the 2nd parameter to sh_eth_dev_init()

sh_eth_dev_init()  is now always called with  'true' as the  2nd argument,
so that there's no more sense in having 2 parameters to this function...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agosctp: sctp_diag should fill RMEM_ALLOC with asoc->rmem_alloc when rcvbuf_policy is set
Xin Long [Sun, 24 Apr 2016 15:21:22 +0000 (23:21 +0800)]
sctp: sctp_diag should fill RMEM_ALLOC with asoc->rmem_alloc when rcvbuf_policy is set

For sctp assoc, when rcvbuf_policy is set, it will has it's own
rmem_alloc, when we dump asoc info in sctp_diag, we should use that
value on RMEM_ALLOC as well, just like WMEM_ALLOC.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomacvtap: check minor when unregistering
Francesco Ruggeri [Sat, 23 Apr 2016 22:04:31 +0000 (15:04 -0700)]
macvtap: check minor when unregistering

macvtap_device_event(NETDEV_UNREGISTER) should check vlan->minor to
determine if it is being invoked in the context of a macvtap_newlink
that failed, for example in this code sequence:

macvtap_newlink
  macvlan_common_newlink
    register_netdevice
      call_netdevice_notifiers(NETDEV_REGISTER, dev)
        macvtap_device_event(NETDEV_REGISTER)
          <fail here, vlan->minor = 0>
      rollback_registered(dev);
        rollback_registered_many
          call_netdevice_notifiers(NETDEV_UNREGISTER, dev);
            macvtap_device_event(NETDEV_UNREGISTER)
              <nothing to clean up here>

Signed-off-by: Francesco Ruggeri <fruggeri@arista.com>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomacvlan: fix failure during registration v3
Francesco Ruggeri [Sat, 23 Apr 2016 22:03:32 +0000 (15:03 -0700)]
macvlan: fix failure during registration v3

If macvlan_common_newlink fails in register_netdevice after macvlan_init
then it decrements port->count twice, first in macvlan_uninit (from
register_netdevice or rollback_registered) and then again in
macvlan_common_newlink.
A similar problem may exist in the ipvlan driver.
This patch consolidates modifications to port->count into macvlan_init
and macvlan_uninit (thanks to Eric Biederman for suggesting this approach).

v3: remove macvtap specific bits.

Signed-off-by: Francesco Ruggeri <fruggeri@arista.com>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'qed-bandwidth-config'
David S. Miller [Tue, 26 Apr 2016 17:56:27 +0000 (13:56 -0400)]
Merge branch 'qed-bandwidth-config'

Manish Chopra says:

====================
qed: Bandwidth configuration support

This series adds support in driver for min/max bandwidth configuration
for the PF on the link change notification or on explicit request of
bandwidth update from the MFW [management firmware].

The same infrastructure would later be used by user based flows
[for example, rate shaping for the VFs]

Please consider applying this series to "net-next"
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoqed: Add PF min bandwidth configuration support
Manish Chopra [Tue, 26 Apr 2016 14:56:10 +0000 (10:56 -0400)]
qed: Add PF min bandwidth configuration support

This patch adds support for PF minimum bandwidth update
or configuration notified by management firmware.

Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoqed: Add PF max bandwidth configuration support
Manish Chopra [Tue, 26 Apr 2016 14:56:09 +0000 (10:56 -0400)]
qed: Add PF max bandwidth configuration support

This patch adds support for PF maximum bandwidth update
or configuration notified by management firmware.

Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoqed: Add vport WFQ configuration APIs
Manish Chopra [Tue, 26 Apr 2016 14:56:08 +0000 (10:56 -0400)]
qed: Add vport WFQ configuration APIs

This patch adds relevant APIs needed to configure WFQ
(Weighted fair queueing) values for the vports. WFQ configuration
is used per vport basis when minimum bandwidth update/configuration
is notified to the PF by the management firmware.

Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'cxgb4-next'
David S. Miller [Tue, 26 Apr 2016 17:23:58 +0000 (13:23 -0400)]
Merge branch 'cxgb4-next'

Hariprasad Shenai says:

====================
cxgb4: minor fixes, decode msgs and code refactor for few functions

This patch series adds new routine to get adapter information and removes
some redundant messages logged in dmesg. Fixes race while freeing tx
descriptors. Decodes module type and link down reason codes obtained from
firmware. Refactor port initialization and FW_PORT_CMD handling. Pass
correct port id in DCB message handler to obtain netdev associated.

This patch series has been created against net-next tree and includes
patches on cxgb4 driver.

We have included all the maintainers of respective drivers. Kindly review
the change and let us know in case of any review comments.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agocxgb4: Decode link down reason code obtained from firmware
Hariprasad Shenai [Tue, 26 Apr 2016 14:40:29 +0000 (20:10 +0530)]
cxgb4: Decode link down reason code obtained from firmware

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agocxgb4: Don't assume FW_PORT_CMD reply is always port info msg
Hariprasad Shenai [Tue, 26 Apr 2016 14:40:28 +0000 (20:10 +0530)]
cxgb4: Don't assume FW_PORT_CMD reply is always port info msg

The firmware can send a set of asynchronous replies through FW_PORT_CMD
with DCBX information when that's negotiated with the Link Peer. The old
code always assumed that a FW_PORT_CMD reply was always a Get Port
Information message. This change conditionalizes the code to only handle
the Get Port Information messages and throws a warning if we don't
understand what we've been given.

Also refactor t4_handle_fw_rpl() so that core functionality performed by
t4_handle_get_port_info() for a specified port.

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agocxgb4: DCB message handler needs to use correct portid to netdev mapping
Hariprasad Shenai [Tue, 26 Apr 2016 14:40:27 +0000 (20:10 +0530)]
cxgb4: DCB message handler needs to use correct portid to netdev mapping

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agocxgb4: Refactor t4_port_init function
Hariprasad Shenai [Tue, 26 Apr 2016 14:40:26 +0000 (20:10 +0530)]
cxgb4: Refactor t4_port_init function

Refactor t4_port_init() so that the core functionality is done by
t4_init_portinfo() for a particular port. Also rename variables to
sensible ones.

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agocxgb4: Properly decode port module type
Hariprasad Shenai [Tue, 26 Apr 2016 14:40:25 +0000 (20:10 +0530)]
cxgb4: Properly decode port module type

Decode and log port module error, unknown modules and unsupported
modules.

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agocxgb4: Avoids race and deadlock while freeing tx descriptor
Hariprasad Shenai [Tue, 26 Apr 2016 14:40:24 +0000 (20:10 +0530)]
cxgb4: Avoids race and deadlock while freeing tx descriptor

There could be race between t4_eth_xmit() and t4_free_sge_resources() while
freeing tx descriptors, take txq lock in t4_free_sge_resources(). We need
to stop the xmit frame path which runs in bottom half context while
unloading the driver using _bh variant of the lock. This is to prevent
the deadlock between xmit and driver unload.

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agocxgb4: Add llseek operation for flash debugfs entry
Hariprasad Shenai [Tue, 26 Apr 2016 14:40:23 +0000 (20:10 +0530)]
cxgb4: Add llseek operation for flash debugfs entry

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agocxgb4: add new routine to get adapter info
Hariprasad Shenai [Tue, 26 Apr 2016 14:40:22 +0000 (20:10 +0530)]
cxgb4: add new routine to get adapter info

Add new routine to print out general adapter information (various version
numbers, adapter name, part number, serial number, etc.) and remove
redundant information dumped in the Port Information.

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetoot...
David S. Miller [Tue, 26 Apr 2016 17:15:56 +0000 (13:15 -0400)]
Merge branch 'for-upstream' of git://git./linux/kernel/git/bluetooth/bluetooth-next

Johan Hedberg says:

====================
pull request: bluetooth-next 2016-04-26

Here's another set of Bluetooth & 802.15.4 patches for the 4.7 kernel:

 - Cleanups & refactoring of ieee802154 & 6lowpan code
 - Security related additions to ieee802154 and mrf24j40 driver
 - Memory corruption fix to Bluetooth 6lowpan code
 - Race condition fix in vhci driver
 - Enhancements to the atusb 802.15.4 driver

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

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'nla_align-set-4'
David S. Miller [Tue, 26 Apr 2016 16:00:50 +0000 (12:00 -0400)]
Merge branch 'nla_align-set-4'

Nicolas Dichtel says:

====================
netlink: align attributes when needed (patchset #3)

This is the continuation (series #3) of the work done to align netlink
attributes when these attributes contain some 64-bit fields.

It's the last patchset from what I've seen.

The last user of nla_put_u64() is block/drbd. This module does not use
standard netlink API (see all the stuff in include/linux/genl_magic_struct.h
and include/linux/genl_magic_func.h). I didn't modify it because it's seems
hard to do it whithout testing and fully understanding the context (for
example, why include/linux/drbd_genl.h is not part of uapi?).
Any thoughts?
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agosched: align nlattr properly when needed
Nicolas Dichtel [Tue, 26 Apr 2016 08:06:18 +0000 (10:06 +0200)]
sched: align nlattr properly when needed

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoneigh: align nlattr properly when needed
Nicolas Dichtel [Tue, 26 Apr 2016 08:06:17 +0000 (10:06 +0200)]
neigh: align nlattr properly when needed

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agortnl: align nlattr properly when needed
Nicolas Dichtel [Tue, 26 Apr 2016 08:06:16 +0000 (10:06 +0200)]
rtnl: align nlattr properly when needed

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoovs: align nlattr properly when needed
Nicolas Dichtel [Tue, 26 Apr 2016 08:06:15 +0000 (10:06 +0200)]
ovs: align nlattr properly when needed

I also fix commit 8b32ab9e6ef1: use nla_total_size_64bit() for
OVS_FLOW_ATTR_USED in ovs_flow_cmd_msg_size().

Fixes: 8b32ab9e6ef1 ("ovs: use nla_put_u64_64bit()")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agosock_diag: align nlattr properly when needed
Nicolas Dichtel [Tue, 26 Apr 2016 08:06:14 +0000 (10:06 +0200)]
sock_diag: align nlattr properly when needed

I also fix the value of INET_DIAG_MAX. It's wrong since commit 8f840e47f190
which is only in net-next right now, thus I didn't make a separate patch.

Fixes: 8f840e47f190 ("sctp: add the sctp_diag.c file")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agofs/quota: use nla_put_u64_64bit()
Nicolas Dichtel [Tue, 26 Apr 2016 08:06:13 +0000 (10:06 +0200)]
fs/quota: use nla_put_u64_64bit()

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Jan Kara <jack@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agodrivers/wireless: use nla_put_u64_64bit()
Nicolas Dichtel [Tue, 26 Apr 2016 08:06:12 +0000 (10:06 +0200)]
drivers/wireless: use nla_put_u64_64bit()

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomacsec: use nla_put_u64_64bit()
Nicolas Dichtel [Tue, 26 Apr 2016 08:06:11 +0000 (10:06 +0200)]
macsec: use nla_put_u64_64bit()

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'ila-csum-neutral'
David S. Miller [Tue, 26 Apr 2016 05:32:01 +0000 (01:32 -0400)]
Merge branch 'ila-csum-neutral'

Tom Herbert says:

====================
ila: Support for checksum neutral translations

This patch set updates ILA to support draft-herbert-nvo3-ila-02. The
primary addition is support checksum neutral ILA translation.
This allows address to be performed and still keep any transport
layer checksums that include the addresses in their pseudo header to
still be correct without the translator needing to parse L4.

Other items are:
   - Structures for ILA addresses, identifiers, locators
   - Disallow translation on non-ILA addresses (check by
     type in identifier).
   - Change xlat (nf_input) to translates solely based
     on matching locators not identifiers (since identifiers
     are not obfuscated by checksum neutral).
   - Side effect if above is that multiple ILA domains are
     supported. Each local locator can map to a different
     SIR address (ILA domain), and each domain defines its
     own identifier space.

Tested: Ran TCP_RR with 200 cnxs. ILA performance is slightly better
than previously since we are not longer parsing L4 for checksum
handling. I amd seeing about 1% performance overhead. Also ran
TCP_STREAM and tested non-ILA address (type=0) are not translated.

v2: Fix compilation errors
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoila: add checksum neutral ILA translations
Tom Herbert [Sat, 23 Apr 2016 18:46:57 +0000 (11:46 -0700)]
ila: add checksum neutral ILA translations

Support checksum neutral ILA as described in the ILA draft. The low
order 16 bits of the identifier are used to contain the checksum
adjustment value.

The csum-mode parameter is added to described checksum processing. There
are three values:
 - adjust transport checksum (previous behavior)
 - do checksum neutral mapping
 - do nothing

On output the csum-mode in the ila_params is checked and acted on. If
mode is checksum neutral mapping then to mapping and set C-bit.

On input, C-bit is checked. If it is set checksum-netural mapping is
done (regardless of csum-mode in ila params) and C-bit will be cleared.
If it is not set then action in csum-mode is taken.

Signed-off-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoila: xlat changes
Tom Herbert [Sat, 23 Apr 2016 18:46:56 +0000 (11:46 -0700)]
ila: xlat changes

Change model of xlat to be used only for input where lookup is done on
the locator part of an address (comparing to locator_match as key
in rhashtable). This is needed for checksum neutral translation
which obfuscates the low order 16 bits of the identifier. It also
permits hosts to be in muliple ILA domains (each locator can map
to a different SIR address). A check is also added to disallow
translating non-ILA addresses (check of type in identifier).

Signed-off-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoila: Add struct definitions and helpers
Tom Herbert [Sat, 23 Apr 2016 18:46:55 +0000 (11:46 -0700)]
ila: Add struct definitions and helpers

Add structures for identifiers, locators, and an ila address which
is composed of a locator and identifier and in6_addr can be cast to
it. This includes a three bit type field and enums for the types defined
in ILA I-D.

In ILA lwt don't allow user to set a translation for a non-ILA
address (type of identifier is zero meaning it is an IID). This also
requires that the destination prefix is at least 65 bytes (64
bit locator and first byte of identifier).

Signed-off-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: tsi108: use NULL for pointer-typed argument
Julia Lawall [Sat, 23 Apr 2016 09:07:02 +0000 (11:07 +0200)]
net: tsi108: use NULL for pointer-typed argument

The first argument of pci_free_consistent has type struct pci_dev *, so use
NULL instead of 0.

The semantic patch that performs this transformation is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
@@
pci_free_consistent(
- 0
+ NULL
  , ...)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'hns-debug-dsaf'
David S. Miller [Tue, 26 Apr 2016 05:09:18 +0000 (01:09 -0400)]
Merge branch 'hns-debug-dsaf'

Yisen Zhuang says:

====================
net: hns: add support of debug dsaf device

There are two kinds of dsaf device in hns, one is for service ports,
contains crossbar in it, can work under different mode. Another is for
debug port, only can work under single port mode. The current code only
declares a dsaf device for both service ports and debug ports.It is not so
readability. This patch separates it to three platform devices to make the
code more simple and readability.

The diagram of all port in one platform device(old):
                                        CPU
                                         |
                                         |        DSAF(one platform device)
    --------------------------------------------------------------      /
    |                           |                  |      |      |     /
    |                          PPE                PPE    PPE     |    /
    |                           |                  |      |      |   /
    |                           |                  |      |      |  /
    |                        crossbar              |      |      | /
    |                           |                  |      |      |/
    |    -----------------------------------       |      |      |
    |    |      |      |      |      |      |      |      |      |
    |    |      |      |      |      |      |      |      |      |
    |   MAC    MAC    MAC    MAC    MAC    MAC    MAC    MAC     |
    |    |      |      |      |      |      |      |      |      |
    --------------------------------------------------------------
         |      |      |      |      |      |      |      |
        PHY    PHY    PHY    PHY    PHY    PHY    PHY    PHY

The diagram of separating ports to three platform(new):
                                                         CPU
                                                          |
                                    -----------------------------------
                                    |                     |           |
    ----------------------------------------------    ---------   ---------
    |                         |                  |    |       |   |   |   |
    |                        PPE                 |    |  PPE  |   |  PPE  |
    |                         |                  |    |   |   |   |   |   |
    |                         |                  |    |   |   |   |   |   |
    |                      crossbar              |    |   |   |   |   |   |
    |                         |                  |    |   |   |   |   |   |
    |   ----------------------------------       |    |   |   |   |   |   |
    |   |     |     |      |      |      |       |    |   |   |   |   |   |
    |   |     |     |      |      |      |       |    |   |   |   |   |   |
    |  MAC   MAC   MAC    MAC    MAC    MAC      |    |  MAC  |   |  MAC  |
    |   |     |     |      |      |      |       |    |   |   |   |   |   |
    ----------------------------------------------    ---------   ---------
        |     |     |      |      |      |    \        /  |        /  |
       PHY   PHY   PHY    PHY    PHY    PHY    \      /  PHY      /  PHY
                                                \    /           /
                                                 \  /           /
                                             DSAF(three platform device)

We take the compatibility into consideration, and it works well by using the
old dts file(tested on d02 board).

For more details, please see individual patches.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agodts: hisi: update hns dst for separating dsaf dev support
Yisen.Zhuang\(Zhuangyuzeng\) [Sat, 23 Apr 2016 09:05:17 +0000 (17:05 +0800)]
dts: hisi: update hns dst for separating dsaf dev support

Because debug dsaf port was separated from service dsaf port, this patch
updates the related configurations of hns dts, changes it to match with
the new binding files. This also removes enet nodes which don't exist in
d02 board.

Signed-off-by: Yisen Zhuang <yisen.zhuang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoDocumentation: Bindings: add port-idx-in-ae for enet node
Yisen.Zhuang\(Zhuangyuzeng\) [Sat, 23 Apr 2016 09:05:16 +0000 (17:05 +0800)]
Documentation: Bindings: add port-idx-in-ae for enet node

This patch adds description for port-idx-in-ae attribute.

Signed-off-by: Yisen Zhuang <yisen.zhuang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoDocumentation: Bindings: Update DT binding for separating dsaf dev support
Yisen.Zhuang\(Zhuangyuzeng\) [Sat, 23 Apr 2016 09:05:15 +0000 (17:05 +0800)]
Documentation: Bindings: Update DT binding for separating dsaf dev support

Because debug dsaf port was separated from service dsaf port, this patch
updates the related information of DT binding.

Signed-off-by: Yisen Zhuang <yisen.zhuang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: hns: add attribute port-mode-offset for dsaf port node
Yisen.Zhuang\(Zhuangyuzeng\) [Sat, 23 Apr 2016 09:05:14 +0000 (17:05 +0800)]
net: hns: add attribute port-mode-offset for dsaf port node

Port mode offset for each dsaf port is different. The current code is not
so readability. This patch adds configuration named port-mode-offset to
make the code simple and more readability. If port-mode-offset isn't
exists, default value 0 will be used.

Signed-off-by: Daode Huang <huangdaode@hisilicon.com>
Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: hns: add attribute port-rst-offset for dsaf port node
Yisen.Zhuang\(Zhuangyuzeng\) [Sat, 23 Apr 2016 09:05:13 +0000 (17:05 +0800)]
net: hns: add attribute port-rst-offset for dsaf port node

The reset offset for each port in a dsaf is different. The current code is
not so readability. This patch adds configuration named port-rst-offset to
make the code simple and more readability. If this attribute doesn't exist,
default value of this attribute is equal to its port index.

Signed-off-by: Yisen Zhuang <yisen.zhuang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: hns: add attribute cpld_ctrl for dsaf port node
Yisen.Zhuang\(Zhuangyuzeng\) [Sat, 23 Apr 2016 09:05:12 +0000 (17:05 +0800)]
net: hns: add attribute cpld_ctrl for dsaf port node

This patch adds attribute cpld_ctrl for dsaf port node, parses the syscon
for mac_cb from dts, and changes the method of access the cpld related
registers through syscon.

Signed-off-by: Daode Huang <huangdaode@hisilicon.com>
Signed-off-by: Yisen Zhuang <yisen.zhuang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: hns: separate debug dsaf device from service dsaf device
Yisen.Zhuang\(Zhuangyuzeng\) [Sat, 23 Apr 2016 09:05:11 +0000 (17:05 +0800)]
net: hns: separate debug dsaf device from service dsaf device

There are two kinds of dsaf device in hns, one is for service ports,
contains crossbar in it, can work under different mode. Another is for
debug port, only can work under "single-port" mode. The current code only
declared a dsaf device for both service ports and debug ports. This patch
separate it to three platform devices.

Here is the diagram of all port in one platform device(old):
                                        CPU
                                         |
                                         |        DSAF(one platform device)
    --------------------------------------------------------------      /
    |                           |                  |      |      |     /
    |                          PPE                PPE    PPE     |    /
    |                           |                  |      |      |   /
    |                           |                  |      |      |  /
    |                        crossbar              |      |      | /
    |                           |                  |      |      |/
    |    -----------------------------------       |      |      |
    |    |      |      |      |      |      |      |      |      |
    |    |      |      |      |      |      |      |      |      |
    |   MAC    MAC    MAC    MAC    MAC    MAC    MAC    MAC     |
    |    |      |      |      |      |      |      |      |      |
    --------------------------------------------------------------
         |      |      |      |      |      |      |      |
        PHY    PHY    PHY    PHY    PHY    PHY    PHY    PHY

Here is the diagram of separate all ports to three platform(new):
                                                         CPU
                                                          |
                                    -----------------------------------
                                    |                     |           |
    ----------------------------------------------    ---------   ---------
    |                         |                  |    |       |   |   |   |
    |                        PPE                 |    |  PPE  |   |  PPE  |
    |                         |                  |    |   |   |   |   |   |
    |                         |                  |    |   |   |   |   |   |
    |                      crossbar              |    |   |   |   |   |   |
    |                         |                  |    |   |   |   |   |   |
    |   ----------------------------------       |    |   |   |   |   |   |
    |   |     |     |      |      |      |       |    |   |   |   |   |   |
    |   |     |     |      |      |      |       |    |   |   |   |   |   |
    |  MAC   MAC   MAC    MAC    MAC    MAC      |    |  MAC  |   |  MAC  |
    |   |     |     |      |      |      |       |    |   |   |   |   |   |
    ----------------------------------------------    ---------   ---------
        |     |     |      |      |      |    \        /  |        /  |
       PHY   PHY   PHY    PHY    PHY    PHY    \      /  PHY      /  PHY
                                                \    /           /
                                                 \  /           /
                                             DSAF(three platform device)

Signed-off-by: Daode Huang <huangdaode@hisilicon.com>
Signed-off-by: Yisen Zhuang <yisen.zhuang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: hns: sort the header file by alphabetical order
Daode Huang [Sat, 23 Apr 2016 09:05:10 +0000 (17:05 +0800)]
net: hns: sort the header file by alphabetical order

This patch tunes the header file by the alphabetical order.

Signed-off-by: Daode Huang <huangdaode@hisilicon.com>
Signed-off-by: Yisen Zhuang <yisen.zhuang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: hns: add syscon operation for dsaf
Yisen.Zhuang\(Zhuangyuzeng\) [Sat, 23 Apr 2016 09:05:09 +0000 (17:05 +0800)]
net: hns: add syscon operation for dsaf

This patch provides the read/write function for dsaf to
access the registers through syscon methods.

Signed-off-by: Daode Huang <huangdaode@hisilicon.com>
Signed-off-by: Yisen Zhuang <yisen.zhuang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: hns: add attribute reset-field-offset for dsaf node
Yisen.Zhuang\(Zhuangyuzeng\) [Sat, 23 Apr 2016 09:05:08 +0000 (17:05 +0800)]
net: hns: add attribute reset-field-offset for dsaf node

Add the subctrl reset offset for dsaf, this property is used to reset
xge/ge ports for different dsaf. If this attribute is not present,
default value 0 will be used.

Signed-off-by: Daode Huang <huangdaode@hisilicon.com>
Signed-off-by: Yisen Zhuang <yisen.zhuang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: hns: add attribute port-idx-in-ae in enet node.
Yisen.Zhuang\(Zhuangyuzeng\) [Sat, 23 Apr 2016 09:05:07 +0000 (17:05 +0800)]
net: hns: add attribute port-idx-in-ae in enet node.

This patch parse port-idx-in-ae in enet node. In NIC mode of DSAF, all 6
PHYs of service DSAF are taken as ethernet ports to the CPU. The
port-idx-in-ae can be 0 to 5. Here is the diagram:
            +-----+---------------+
            |            CPU      |
            +-+-+-+---+-+-+-+-+-+-+
              |    |   | | | | | |
           debug debug   service
           port  port     port
           (0)   (0)     (0-5)

In Switch mode of DSAF, all 6 PHYs of service DSAF are taken as physical
ports connect to a LAN Switch while the CPU side assume itself have one
single NIC connect to this switch. In this case, the port-idx-in-ae will
be 0 only.
            +-----+-----+------+------+
            |                CPU      |
            +-+-+-+-+-+-+-+-+-+-+-+-+-+
              |    |     service| port(0)
            debug debug  +------------+
            port  port   |   switch   |
            (0)   (0)    +-+-+-+-+-+-++
                          | | | | | |
                         external port

when port-idx-in-ae is not exists, old attribute port-id will be used
(only for compatible purpose, not recommended to use port-id in new code).

Signed-off-by: Daode Huang <huangdaode@hisilicon.com>
Signed-off-by: Yisen Zhuang <yisen.zhuang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: hns: set debug port irq index to 0
Daode Huang [Sat, 23 Apr 2016 09:05:06 +0000 (17:05 +0800)]
net: hns: set debug port irq index to 0

As debug ports are moved from service dsaf to debug dsaf,
the interrupts offset should start from 0, So this patch
re-defines the offset index of debug ports.

Signed-off-by: Daode Huang <huangdaode@hisilicon.com>
Signed-off-by: Yisen Zhuang <yisen.zhuang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: hns: add a new dsaf mode for debug port
Yisen.Zhuang\(Zhuangyuzeng\) [Sat, 23 Apr 2016 09:05:05 +0000 (17:05 +0800)]
net: hns: add a new dsaf mode for debug port

This patch adds a new dsaf mode named "single-port" mode for debug port.
This mode only contains one debug port. This patch also changes the
method of distinguishing the port type.

Signed-off-by: Daode Huang <huangdaode@hisilicon.com>
Signed-off-by: Yisen Zhuang <yisen.zhuang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoBluetooth: 6lowpan: Fix memory corruption of ipv6 destination address
Glenn Ruben Bakke [Fri, 22 Apr 2016 16:06:11 +0000 (18:06 +0200)]
Bluetooth: 6lowpan: Fix memory corruption of ipv6 destination address

The memcpy of ipv6 header destination address to the skb control block
(sbk->cb) in header_create() results in currupted memory when bt_xmit()
is issued. The skb->cb is "released" in the return of header_create()
making room for lower layer to minipulate the skb->cb.

The value retrieved in bt_xmit is not persistent across header creation
and sending, and the lower layer will overwrite portions of skb->cb,
making the copied destination address wrong.

The memory corruption will lead to non-working multicast as the first 4
bytes of the copied destination address is replaced by a value that
resolves into a non-multicast prefix.

This fix removes the dependency on the skb control block between header
creation and send, by moving the destination address memcpy to the send
function path (setup_create, which is called from bt_xmit).

Signed-off-by: Glenn Ruben Bakke <glenn.ruben.bakke@nordicsemi.no>
Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Cc: stable@vger.kernel.org # 4.5+
8 years agoMerge branch 'pskb_extract'
David S. Miller [Mon, 25 Apr 2016 20:54:15 +0000 (16:54 -0400)]
Merge branch 'pskb_extract'

Sowmini Varadhan says:

====================
pskb_extract() helper function.

This patchset follows up on the discussion in
 https://www.mail-archive.com/netdev@vger.kernel.org/msg105090.html

For RDS-TCP, we have to deal with the full gamut of
nonlinear sk_buffs, including all the frag_list variants.
Also, the parent skb has to remain unchanged, while the clone
is queued for Rx on the PF_RDS socket.

Patch 1 of this patchset adds a pskb_extract() function that
does all this without the redundant memcpy's in pskb_expand_head()
and __pskb_pull_tail().

v2: Marcelo Leitner review comments
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoRDS: TCP: Call pskb_extract() helper function
Sowmini Varadhan [Sat, 23 Apr 2016 01:36:36 +0000 (18:36 -0700)]
RDS: TCP: Call pskb_extract() helper function

rds-stress experiments with request size 256 bytes, 8K acks,
using 16 threads show a 40% improvment when pskb_extract()
replaces the {skb_clone(..); pskb_pull(..); pskb_trim(..);}
pattern in the Rx path, so we leverage the perf gain with
this commit.

Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoskbuff: Add pskb_extract() helper function
Sowmini Varadhan [Sat, 23 Apr 2016 01:36:35 +0000 (18:36 -0700)]
skbuff: Add pskb_extract() helper function

A pattern of skb usage seen in modules such as RDS-TCP is to
extract `to_copy' bytes from the received TCP segment, starting
at some offset `off' into a new skb `clone'. This is done in
the ->data_ready callback, where the clone skb is queued up for rx on
the PF_RDS socket, while the parent TCP segment is returned unchanged
back to the TCP engine.

The existing code uses the sequence
clone = skb_clone(..);
pskb_pull(clone, off, ..);
pskb_trim(clone, to_copy, ..);
with the intention of discarding the first `off' bytes. However,
skb_clone() + pskb_pull() implies pksb_expand_head(), which ends
up doing a redundant memcpy of bytes that will then get discarded
in __pskb_pull_tail().

To avoid this inefficiency, this commit adds pskb_extract() that
creates the clone, and memcpy's only the relevant header/frag/frag_list
to the start of `clone'. pskb_trim() is then invoked to trim clone
down to the requested to_copy bytes.

Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agofq: add fair queuing framework
Michal Kazior [Fri, 22 Apr 2016 12:20:13 +0000 (14:20 +0200)]
fq: add fair queuing framework

This works on the same implementation principle as
codel*.h, i.e. there's a generic header with
structures and macros and a implementation header
carrying function definitions to include in given,
e.g. driver or module.

The fairness logic comes from
net/sched/sch_fq_codel.c but is generalized so it
is more flexible and easier to re-use.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'reusable-codel'
David S. Miller [Mon, 25 Apr 2016 20:44:28 +0000 (16:44 -0400)]
Merge branch 'reusable-codel'

Michal Kazior says:

====================
codel: make it reuseable beyond qdiscs

There's an ongoing effort in fixing wireless
bufferbloat. As part of that fq_codel is being
ported into mac80211. To prevent code duplication
codel.h needs to be slightly modified before it
can be used in mac80211 (or other drivers FWIW).

For more background please see:

  https://www.spinics.net/lists/linux-wireless/msg149976.html
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agocodel: split into multiple files
Michal Kazior [Fri, 22 Apr 2016 12:15:59 +0000 (14:15 +0200)]
codel: split into multiple files

It was impossible to include codel.h for the
purpose of having access to codel_params or
codel_vars structure definitions and using them
for embedding in other more complex structures.

This splits allows codel.h itself to be treated
like any other header file while codel_qdisc.h and
codel_impl.h contain function definitions with
logic that was previously in codel.h.

This copies over copyrights and doesn't involve
code changes other than adding a few additional
include directives to net/sched/sch*codel.c.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agocodel: generalize the implementation
Michal Kazior [Fri, 22 Apr 2016 12:15:58 +0000 (14:15 +0200)]
codel: generalize the implementation

This strips out qdisc specific bits from the code
and makes it slightly more reusable. Codel will be
used by wireless/mac80211 in the future.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomacsec: Convert to using IFF_NO_QUEUE
Phil Sutter [Fri, 22 Apr 2016 12:02:42 +0000 (14:02 +0200)]
macsec: Convert to using IFF_NO_QUEUE

Signed-off-by: Phil Sutter <phil@nwl.cc>
Acked-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoroute: move lwtunnel state to a single place
Jiri Benc [Fri, 22 Apr 2016 10:40:02 +0000 (12:40 +0200)]
route: move lwtunnel state to a single place

Commit 751a587ac9f9 ("route: fix breakage after moving lwtunnel state")
moved lwtstate to the end of dst_entry for 32bit archs. This makes it share
the cacheline with __refcnt which had an unkown effect on performance. For
this reason, the pointer was kept in place for 64bit archs.

However, later performance measurements showed this is of no concern. It
turns out that every performance sensitive path that accesses lwtstate
accesses also struct rtable or struct rt6_info which share the same cache
line.

Thus, to get rid of a few #ifdefs, move the field to the end of the struct
also for 64bit.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'qed-next'
David S. Miller [Mon, 25 Apr 2016 19:59:17 +0000 (15:59 -0400)]
Merge branch 'qed-next'

Yuval Mintz says:

====================
qed*: driver updates

[Was previous termed 'eeprom access et al.', but seemed a bit
inappropriate given we've dropped the eeprom patch for now.
Still waiting for some inputs on that one, BTW]

This patch series contains some ethtool-related enhancements.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoqed: add support for link pause configuration.
Sudarsana Reddy Kalluru [Fri, 22 Apr 2016 05:41:04 +0000 (08:41 +0300)]
qed: add support for link pause configuration.

The APIs for making this sort of configuration [e.g., via ethtool] are
already present in qede, but the current configuration flow in qed doesn't
respect it.

Signed-off-by: Sudarsana Reddy Kalluru <sudarsana.kalluru@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoqed*: Conditions for changing link
Yuval Mintz [Fri, 22 Apr 2016 05:41:03 +0000 (08:41 +0300)]
qed*: Conditions for changing link

There's some inconsistency in current logic determining whether the
link settings of a given interface can be changed; I.e., in all modes
other than the so-called `deault' mode the interfaces are forbidden from
changing the configuration - but even this rule is not applied to all
user APIs that may change the configuration.

Instead, let the core-module [qed] decide whether an interface can change
the configuration by supporting a new API function. We also revise the
current rule, allowing all interfaces to change their configurations while
laying the infrastructure for future modes where an interface would be
blocked from making such a configuration.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoqede: Add support for ethtool private flags
Yuval Mintz [Fri, 22 Apr 2016 05:41:02 +0000 (08:41 +0300)]
qede: Add support for ethtool private flags

Adds a getter for the interfaces private flags.
The only parameter currently supported is whether the interface is a
coupled function [required for supporting 100g].

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoqed*: Align statistics names
Yuval Mintz [Fri, 22 Apr 2016 05:41:01 +0000 (08:41 +0300)]
qed*: Align statistics names

There's a difference in statsitics' names starting at qed and
propagating to qede, where egress counters indicate ranges while ingress
counters indiciate high-end.
Align all statistcs to follow the same conventions - name indicates range.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: better drop monitoring in ip{6}_recv_error()
Eric Dumazet [Fri, 22 Apr 2016 05:27:32 +0000 (22:27 -0700)]
net: better drop monitoring in ip{6}_recv_error()

We should call consume_skb(skb) when skb is properly consumed,
or kfree_skb(skb) when skb must be dropped in error case.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agotcp: SYN packets are now simply consumed
Eric Dumazet [Fri, 22 Apr 2016 05:13:01 +0000 (22:13 -0700)]
tcp: SYN packets are now simply consumed

We now have proper per-listener but also per network namespace counters
for SYN packets that might be dropped.

We replace the kfree_skb() by consume_skb() to be drop monitor [1]
friendly, and remove an obsolete comment.
FastOpen SYN packets can carry payload in them just fine.

[1] perf record -a -g -e skb:kfree_skb sleep 1; perf report

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch '10GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next...
David S. Miller [Mon, 25 Apr 2016 19:12:06 +0000 (15:12 -0400)]
Merge branch '10GbE' of git://git./linux/kernel/git/jkirsher/next-queue

Jeff Kirsher says:

====================
10GbE Intel Wired LAN Driver Updates 2016-04-25

This series contains updates to ixgbe and ixgbevf.

Emil provides several patches, starting with the consolidation of the
logic behind configuring spoof checking.  Fixed an issue which was
causing link issues for backplane devices because x550em_a/x devices
did not have a default value for mac->ops.setup_link.  Refactored the
ethtool stats to bring the logic closer to how ixgbe handles stats and
sets up per-queue stats for ixgbevf.

Mark adds a new register to wait for previous register writes to complete
before issuing a register read, which is needed when slower links are
in use.  Fixed the flow control setup for x550em_a, the incorrect
fc_setup function was being used.

Don added a workaround for empty SFP+ cage crosstalk, since on some
systems the crosstalk could lead to link flap on empty SFP+ cages.

Jake converts ixgbe and ixgbevf to use the BIT() macro.

Alex Duyck adds support for partial GSO segmentation in the case of
tunnels for ixgbe and ixgbevf.  Then preps for HyperV by moving the API
negotiation into mac_ops.

Arnd Bergmann provides a fix for the ARM compile warnings in linux-next
by converting the use of a udelay() to msleep().
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'nla_align-set-2'
David S. Miller [Mon, 25 Apr 2016 19:09:12 +0000 (15:09 -0400)]
Merge branch 'nla_align-set-2'

Nicolas Dichtel says:

====================
netlink: align attributes when needed (patchset #2)

This is the continuation (series #2) of the work done to align netlink
attributes when these attributes contain some 64-bit fields.

In patch #3, I didn't modify the function ila_encap_nlsize(). I was waiting
feedback for this patch: http://patchwork.ozlabs.org/patch/613766/
If it's approved, there will be an update to switch nla_total_size() to
nla_total_size_64bit() after the merge of net in net-next.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agowireless: use nla_put_u64_64bit()
Nicolas Dichtel [Mon, 25 Apr 2016 08:25:22 +0000 (10:25 +0200)]
wireless: use nla_put_u64_64bit()

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonetfilter/ipvs: use nla_put_u64_64bit()
Nicolas Dichtel [Mon, 25 Apr 2016 08:25:21 +0000 (10:25 +0200)]
netfilter/ipvs: use nla_put_u64_64bit()

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoieee802154: use nla_put_u64_64bit()
Nicolas Dichtel [Mon, 25 Apr 2016 08:25:20 +0000 (10:25 +0200)]
ieee802154: use nla_put_u64_64bit()

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>