openwrt/staging/blogic.git
8 years agonet: hns: fix return value check in hns_dsaf_get_cfg()
Wei Yongjun [Tue, 5 Jul 2016 07:56:52 +0000 (07:56 +0000)]
net: hns: fix return value check in hns_dsaf_get_cfg()

In case of error, function devm_ioremap_resource() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check should
be replaced with IS_ERR().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'mlxsw-ipv4-unicast-routing'
David S. Miller [Tue, 5 Jul 2016 16:06:31 +0000 (09:06 -0700)]
Merge branch 'mlxsw-ipv4-unicast-routing'

Jiri Pirko says:

====================
mlxsw: Implement IPV4 unicast routing

This patchset enables IPv4 unicast routing in the Mellanox Spectrum ASIC
switch driver. This builds upon the work that was done by a couple of
previous patchsets.

Patches 1,2,6 add a couple of dependencies outside the driver. Namely, the
ability to propagate ndo_neigh_construct()/destroy() through stacked devices and
a notification whenever DELAY_PROBE_TIME changes. When propagated down, the
ndos allow drivers to add and remove neighbour entries from their private
neighbour table. The DELAY_PROBE_TIME notification gives drivers the ability to
correctly configure their polling interval for neighbour activity, so that
active neighbour won't be marked as STALE.

Patches 3-5,7-8 add the neighbour offloading infrastructure, where patch 7 uses
the DELAY_PROBE_TIME notification in order to correctly configure the device's
polling interval. Patch 8 finally programs neighbours to the device's table
based on NEIGH_UPDATE notifications, so that directly connected routes can
be used.

Patches 9-16 build upon the previous patches and extend the router with
remote routes (nexthop) support.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: Add the unresolved next-hops probes
Yotam Gigi [Tue, 5 Jul 2016 09:27:52 +0000 (11:27 +0200)]
mlxsw: Add the unresolved next-hops probes

Now, the driver sends arp probes for all unresolved neighbours that are
currently a nexthop for some route on the system. The job is set
periodically every 5 seconds.

Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: spectrum_router: Add the nexthop neigh activity update
Yotam Gigi [Tue, 5 Jul 2016 09:27:51 +0000 (11:27 +0200)]
mlxsw: spectrum_router: Add the nexthop neigh activity update

For nexthop neighbours we need to make kernel to think there is a traffic
flowing to them preventing it from going to stale state. Otherwise
kernel would stale it and eventually the neigh would be removed from HW
and nexthop as well. That would reduce ECMP group in HW.

Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: spectrum_router: Implement next-hop routing
Jiri Pirko [Tue, 5 Jul 2016 09:27:50 +0000 (11:27 +0200)]
mlxsw: spectrum_router: Implement next-hop routing

Implement next-hop routing offload including ECMP. To make it possible,
introduce next-hop group entity. This entity keeps track of resolved
neighbours and updates HW adjacency table accordingly. Note that HW
next-hops are stored in this adjacency table, in form of MAC.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: reg: Add Router Algorithmic LPM ECMP Update Register
Jiri Pirko [Tue, 5 Jul 2016 09:27:49 +0000 (11:27 +0200)]
mlxsw: reg: Add Router Algorithmic LPM ECMP Update Register

The RALEU register is used to mass update remote action adjacency index
and ecmp size.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: reg: Add Router Adjacency Table register
Yotam Gigi [Tue, 5 Jul 2016 09:27:48 +0000 (11:27 +0200)]
mlxsw: reg: Add Router Adjacency Table register

The RATR register is used to configure the Router Adjacency (next-hop)
Table.

Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: Introduce simplistic KVD linear area manager
Jiri Pirko [Tue, 5 Jul 2016 09:27:47 +0000 (11:27 +0200)]
mlxsw: Introduce simplistic KVD linear area manager

This is a very simple manager for KVD linear area. Currently, the
allocator will either allocate a single entry from pre-defined sub-area,
or in case more than one entry is needed, it will allocate 32-entry chunk
in other pre-defined sub-area.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: spectrum: Define sizes of KVD areas
Jiri Pirko [Tue, 5 Jul 2016 09:27:46 +0000 (11:27 +0200)]
mlxsw: spectrum: Define sizes of KVD areas

Override the defaults and define the area sizes ourselves.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: Add KVD sizes configuration into profile
Jiri Pirko [Tue, 5 Jul 2016 09:27:45 +0000 (11:27 +0200)]
mlxsw: Add KVD sizes configuration into profile

Up until now we only used hash-based tables in the device, but we are
going to use the linear table for remote routes adjacency lists.

Add the configuration fields that control the size of the linear table.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: spectrum_router: Offload neighbours based on NUD state change
Yotam Gigi [Tue, 5 Jul 2016 09:27:44 +0000 (11:27 +0200)]
mlxsw: spectrum_router: Offload neighbours based on NUD state change

Listen to any NEIGH_UPDATE events sent and program the device
accordingly. If NUD state is VALID and neighbour isn't yet offloaded,
then program it into the device's table. Otherwise, just edit its
parameters.

If NUD state machine transitioned neighbour out of VALID state and it's
present in the device's table, then remove it.

Note that the device is programmed in delayed work, as the netevent
notification chain is atomic and prevents us from going to sleep.

Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: spectrum_router: Periodically update the kernel's neigh table
Yotam Gigi [Tue, 5 Jul 2016 09:27:43 +0000 (11:27 +0200)]
mlxsw: spectrum_router: Periodically update the kernel's neigh table

As previously explained, the driver should periodically poll the device
for neighbours activity according to the configured DELAY_PROBE_TIME.
This will prevent active neighbours from staying in STALE state for long
periods of time.

During init configure the polling interval according to the
DELAY_PROBE_TIME used in the default table. In addition, register a
netevent notification block, so that the interval is updated whenever
DELAY_PROBE_TIME changes.

Using the computed interval schedule a delayed work, which will update
the kernel via neigh_event_send() on any active neighbour since the last
delayed work.

Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoneigh: Send a notification when DELAY_PROBE_TIME changes
Ido Schimmel [Tue, 5 Jul 2016 09:27:42 +0000 (11:27 +0200)]
neigh: Send a notification when DELAY_PROBE_TIME changes

When the data plane is offloaded the traffic doesn't go through the
networking stack. Therefore, after first resolving a neighbour the NUD
state machine will transition it from REACHABLE to STALE until it's
finally deleted by the garbage collector.

To prevent such situations the offloading driver should notify the NUD
state machine on any neighbours that were recently used. The driver's
polling interval should be set so that the NUD state machine can
function as if the traffic wasn't offloaded.

Currently, there are no in-tree drivers that can report confirmation for
a neighbour, but only 'used' indication. Therefore, the polling interval
should be set according to DELAY_FIRST_PROBE_TIME, as a neighbour will
transition from REACHABLE state to DELAY (instead of STALE) if "a packet
was sent within the last DELAY_FIRST_PROBE_TIME seconds" (RFC 4861).

Send a netevent whenever the DELAY_FIRST_PROBE_TIME changes - either via
netlink or sysctl - so that offloading drivers can correctly set their
polling interval.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: reg: Add Router Algorithmic LPM Unicast Host Table Dump register
Yotam Gigi [Tue, 5 Jul 2016 09:27:41 +0000 (11:27 +0200)]
mlxsw: reg: Add Router Algorithmic LPM Unicast Host Table Dump register

The RAUHTD register allows dumping entries from the Router Unicast Host
Table.

Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: reg: Add Router Algorithmic LPM Unicast Host Table register
Yotam Gigi [Tue, 5 Jul 2016 09:27:40 +0000 (11:27 +0200)]
mlxsw: reg: Add Router Algorithmic LPM Unicast Host Table register

The RAUHT register is used to configure and query the Unicast Host Table
in devices that implement the Algorithmic LPM. In other words, it is
used to configure neighbour entries in the device.

Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: spectrum_router: Add private neigh table
Jiri Pirko [Tue, 5 Jul 2016 09:27:39 +0000 (11:27 +0200)]
mlxsw: spectrum_router: Add private neigh table

We need to hold some private data for every neigh entry. It would be
possible to do it using neigh_priv_len/ndo_neigh_construct/
ndo_neigh_destroy however only for the port device itself. That would not
work for stacked devices like bridge/team/bond. So introduce a private
neigh table. Hook onto ndos neigh_construct/destroy and add/remove
table entry according to that.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: introduce default neigh_construct/destroy ndo calls for L2 upper devices
Jiri Pirko [Tue, 5 Jul 2016 09:27:38 +0000 (11:27 +0200)]
net: introduce default neigh_construct/destroy ndo calls for L2 upper devices

L2 upper device needs to propagate neigh_construct/destroy calls down to
lower devices. Do this by defining default ndo functions and use them in
team, bond, bridge and vlan.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: add dev arg to ndo_neigh_construct/destroy
Jiri Pirko [Tue, 5 Jul 2016 09:27:37 +0000 (11:27 +0200)]
net: add dev arg to ndo_neigh_construct/destroy

As the following patch will allow upper devices to follow the call down
lower devices, we need to add dev here and not rely on n->dev.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'r6040-next'
David S. Miller [Tue, 5 Jul 2016 07:10:30 +0000 (00:10 -0700)]
Merge branch 'r6040-next'

Florian Fainelli says:

====================
net: r6040: Misc updates

Here are some various updates for the r6040 driver, mostly to make it more
modern and catch up with the latest API improvements.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: r6040: Bump version and date
Florian Fainelli [Mon, 4 Jul 2016 21:36:09 +0000 (14:36 -0700)]
net: r6040: Bump version and date

Bump version to 0.28 and date to 4th of July 2016.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: r6040: Update my email
Florian Fainelli [Mon, 4 Jul 2016 21:36:08 +0000 (14:36 -0700)]
net: r6040: Update my email

Update my email address in the driver and MAINTAINERS file.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: r6040: Utilize napi_complete_done()
Florian Fainelli [Mon, 4 Jul 2016 21:36:07 +0000 (14:36 -0700)]
net: r6040: Utilize napi_complete_done()

We maintain how much work we did in NAPI context, so provide that with
napi_complete_done().

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: r6040: Utilize __napi_schedule_irqoff
Florian Fainelli [Mon, 4 Jul 2016 21:36:06 +0000 (14:36 -0700)]
net: r6040: Utilize __napi_schedule_irqoff

We are already in hard IRQ context, so we can use
__napi_schedule_irqoff() to save a few operations.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: r6040: Check for skb->xmit_more
Florian Fainelli [Mon, 4 Jul 2016 21:36:05 +0000 (14:36 -0700)]
net: r6040: Check for skb->xmit_more

Kick the transmission only if this is the last SKB to transmit or the
queue is not already stopped.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: r6040: Reclaim transmitted buffers in NAPI
Florian Fainelli [Mon, 4 Jul 2016 21:36:04 +0000 (14:36 -0700)]
net: r6040: Reclaim transmitted buffers in NAPI

Instead of taking one interrupt per packet transmitted, re-use the same
NAPI context to free transmitted buffers. Since we are no longer in hard
IRQ context replace dev_kfree_skb_irq() by dev_kfree_skb().

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: r6040: Utilize skb_put_padto()
Florian Fainelli [Mon, 4 Jul 2016 21:36:03 +0000 (14:36 -0700)]
net: r6040: Utilize skb_put_padto()

Pad the SKB to the minimum length of ETH_ZLEN by using skb_put_padto()
and take this operation out of the critical section since there is no
need to check any HW resources before doing that.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: r6040: Increase statistics upon transmit completion
Florian Fainelli [Mon, 4 Jul 2016 21:36:02 +0000 (14:36 -0700)]
net: r6040: Increase statistics upon transmit completion

r6040_xmit() is increasing transmit statistics during transmission while
this may still fail, do this in r6040_tx() where we complete transmitted
buffers instead.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: r6040: Utilize phy_print_status
Florian Fainelli [Mon, 4 Jul 2016 21:36:01 +0000 (14:36 -0700)]
net: r6040: Utilize phy_print_status

Instead of open coding our own version utilize the library provided
function.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agodwc_eth_qos: remove unused including <linux/version.h>
Wei Yongjun [Mon, 4 Jul 2016 15:24:50 +0000 (15:24 +0000)]
dwc_eth_qos: remove unused including <linux/version.h>

Remove including <linux/version.h> that don't need it.

Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'mlx5-ntuple-steering'
David S. Miller [Tue, 5 Jul 2016 07:06:03 +0000 (00:06 -0700)]
Merge branch 'mlx5-ntuple-steering'

Saeed Mahameed says:

====================
Mellanox 100G mlx5 ethtool ntuple steering

This series adds Ethernet ethtool ntuple steering 'ethtool -N|U' and exposes two more
counter sets to Ethtool statistics, RDMA vport and global flow control statistics.

We start from three refactoring patches of the flow steering infrastructure
    - mlx5_add_flow_rule will now receive mlx5 flow spec to simplify and reduce
      number of parameters
    - All low level steering objects are now wrapped in mlx5_flow_steering structure
      for better encapsulation
    - Flow steering object will now be removed properly and generically rather than
      traversing on a well-known steering tree objects

Patch#4 adds the infrastructure and the data structures needed for the ethtool ntuple
steering, all implemented in a new file 'en_fs_ethtool.c'.  Add the support for set_rxnfc
ethtool callback to add/remove/replace a flow spec of ethter type L2.

Patch#5 adds the support for L3/L4 flow specs and a higher priority in favor for L3/L4
rules when interleaving with L2 rules.

Patch#6 adds the support for get_rxnfc ethtool callback.

Patch#7,8 adds RDMA vport and global flow control statistics.

Applied on top: 8186f6e382d8 ('net-next: mediatek: fix compile error inside mtk_poll_controller()')
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/mlx5e: Expose flow control counters to ethtool
Gal Pressman [Mon, 4 Jul 2016 14:23:12 +0000 (17:23 +0300)]
net/mlx5e: Expose flow control counters to ethtool

Just like per prio counters, the global flow counters are queried from
per priority counters register.
Global flow control counters are stored in priority 0 PFC 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: Expose RDMA VPort counters to ethtool
Gal Pressman [Mon, 4 Jul 2016 14:23:11 +0000 (17:23 +0300)]
net/mlx5e: Expose RDMA VPort counters to ethtool

Add the needed descriptors to expose RoCE RDMA 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: Add support to get ethtool flow rules
Maor Gottlieb [Mon, 4 Jul 2016 14:23:10 +0000 (17:23 +0300)]
net/mlx5e: Add support to get ethtool flow rules

Enhance the existing get_rxnfc callback:
1. Get flow rule of specific ID.
2. Get all flow rules.
3. Get number of rules.

Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/mlx5e: Support l3/l4 flow type specs in ethtool flow steering
Maor Gottlieb [Mon, 4 Jul 2016 14:23:09 +0000 (17:23 +0300)]
net/mlx5e: Support l3/l4 flow type specs in ethtool flow steering

Add support to add flow steering rules with ethtool
of L3/L4 flow types (ip4/tcp4/udp4).
Those rules will be in higher priority than l2 flow rules, in order
to prefer more specific rules.

Mask is not supported for l3/l4 flow types.

Signed-off-by: Maor Gottlieb <maorg@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 flow steering support
Maor Gottlieb [Mon, 4 Jul 2016 14:23:08 +0000 (17:23 +0300)]
net/mlx5e: Add ethtool flow steering support

Implement etrhtool set_rxnfc callback to support ethtool flow spec
direct steering. This patch adds only the support of ether flow type
spec. L3/L4 flow specs support will be added in downstream patches.

Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/mlx5: Properly remove all steering objects
Maor Gottlieb [Mon, 4 Jul 2016 14:23:07 +0000 (17:23 +0300)]
net/mlx5: Properly remove all steering objects

Instead of explicitly cleaning up the well known parts of the steering
tree, we use the generic tree structure to traverse for cleanup.
No functional changes.

Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/mlx5: Introduce mlx5_flow_steering structure
Maor Gottlieb [Mon, 4 Jul 2016 14:23:06 +0000 (17:23 +0300)]
net/mlx5: Introduce mlx5_flow_steering structure

Instead of having all steering private name spaces and
steering module fields flat in mlx5_core_priv, we wrap
them in mlx5_flow_steering for better modularity and
API exposure.

Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/mlx5: Refactor mlx5_add_flow_rule
Maor Gottlieb [Mon, 4 Jul 2016 14:23:05 +0000 (17:23 +0300)]
net/mlx5: Refactor mlx5_add_flow_rule

Reduce the set of arguments passed to mlx5_add_flow_rule
by introducing flow_spec structure.

Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet-next: mediatek: remove superfluous free_irq() call
John Crispin [Mon, 4 Jul 2016 13:37:10 +0000 (15:37 +0200)]
net-next: mediatek: remove superfluous free_irq() call

Commit 8067302973a1 ("net-next: mediatek: add support for IRQ grouping")
adds handling for irq 1 and 2 to the uninit function but did not remove
irq 0 which is not used since irq grouping was introduced. Fix this by
removing the superfluous call to free_irq().

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: John Crispin <john@phrozen.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: lpc_eth: Remove unused 'pldat' variable
Fabio Estevam [Mon, 4 Jul 2016 13:13:21 +0000 (10:13 -0300)]
net: lpc_eth: Remove unused 'pldat' variable

Since commit f786f3564c4f02d5026 ("net: ethernet: lpc_eth: use phydev
from struct net_device") the 'pldat' variable became unused, so
just remove it.

Reported-by: Olof's autobuilder <build@lixom.net>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge tag 'batadv-next-for-davem-20160704' of git://git.open-mesh.org/linux-merge
David S. Miller [Tue, 5 Jul 2016 06:33:59 +0000 (23:33 -0700)]
Merge tag 'batadv-next-for-davem-20160704' of git://git.open-mesh.org/linux-merge

Simon Wunderlich says:

====================
This feature patchset includes the following changes:

 - Cleanup work by Markus Pargmann and Sven Eckelmann (six patches)

 - Initial Netlink support by Matthias Schiffer (two patches)

 - Throughput Meter implementation by Antonio Quartulli, a kernel-space
   traffic generator to estimate link speeds. This feature is useful on
   low-end WiFi APs where running iperf or netperf from userspace
   gives wrong results due to heavy userspace/kernelspace overhead.
   (two patches)

 - API clean-up work by Antonio Quartulli (one patch)
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'mlxsw-fib-offload'
David S. Miller [Tue, 5 Jul 2016 01:25:16 +0000 (18:25 -0700)]
Merge branch 'mlxsw-fib-offload'

Jiri Pirko says:

====================
mlxsw: Implement basic FIB offload and router interfaces

Introduce LPM trees management including virtual router management for HW.
Implement basic FIB offloading using switchdev FIB objects. For now only support
local routes and direct routes (next-hop support will be introduced in
a follow-up patchset).

Introduce router interfaces in patches 10-14.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: spectrum: Enable L3 interfaces on top of bridge devices
Ido Schimmel [Mon, 4 Jul 2016 06:23:17 +0000 (08:23 +0200)]
mlxsw: spectrum: Enable L3 interfaces on top of bridge devices

As with the previously introduced L3 interfaces, listen to 'inetaddr'
notifications sent for bridges devices configured on top of the port
netdevs and create / destroy router interfaces (RIFs) accordingly.
This also includes VLAN devices configured on top of the VLAN-aware
bridge.

The RIFs will be destroyed either when the last IP address is removed or
when the underlying FID is is destroyed.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: spectrum: Configure FIDs based on bridge events
Ido Schimmel [Mon, 4 Jul 2016 06:23:16 +0000 (08:23 +0200)]
mlxsw: spectrum: Configure FIDs based on bridge events

Before introducing support for L3 interfaces on top of the VLAN-aware
bridge we need to add some missing infrastructure.

Such an interface can either be the bridge device itself or a VLAN
device on top of it. In the first case the router interface (RIF) is
associated with FID 1, which is created whenever the first port netdev
joins the bridge. We currently assume the default PVID is 1 and that
it's already created, as it seems reasonable. This can be extended in
the future.

However, in the second case it's entirely possible we've yet to create a
matching FID. This can happen if the VLAN device was configured before
making any bridge port member in the VLAN.

Prevent such ordering problems by using the VLAN device's CHANGEUPPER
event to configure the FID. Make the VLAN device hold a reference to the
FID and prevent it from being destroyed even if none of the port netdevs
is using it.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: spectrum: Unsplit the vFID range
Ido Schimmel [Mon, 4 Jul 2016 06:23:15 +0000 (08:23 +0200)]
mlxsw: spectrum: Unsplit the vFID range

Previous commit deprecated the vFIDs used to get traffic to the CPU
('port_vfids'). Thus, we now use the vFIDs as god intended and the
artificial split is no longer needed.

Rename functions and variables to reflect that.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: spectrum: Introduce support for router interfaces
Ido Schimmel [Mon, 4 Jul 2016 06:23:14 +0000 (08:23 +0200)]
mlxsw: spectrum: Introduce support for router interfaces

Up until now we only supported bridged interfaces. Packets ingressing
through the switch ports were either classified to FIDs (in the case of
the VLAN-aware bridge) or vFIDs (in the case of VLAN-unaware bridges).
The packets were then forwarded according to the FDB. Routing was done
entirely in slowpath, by splitting the vFID range in two and using the
lower 0.5K vFIDs as dummy bridges that simply flooded all incoming
traffic to the CPU.

Instead, allow packets to be routed in the device by creating router
interfaces (RIFs) that will direct them to the router block.
Specifically, the RIFs introduced here are Sub-port RIFs used for VLAN
devices and port netdevs. Packets ingressing from the {Port / LAG ID, VID}
with which the RIF was programmed with will be assigned to a special
kind of FIDs called rFIDs and from there directed to the router.

Create a RIF whenever the first IPv4 address was programmed on a VLAN /
LAG / port netdev. Destroy it upon removal of the last IPv4 address.
Receive these notifications by registering for the 'inetaddr'
notification chain. A non-zero (10) priority is used for the
notification block, so that RIFs will be created before routes are
offloaded via FIB code.

Note that another trigger for RIF destruction are CHANGEUPPER
notifications causing the underlying FID's reference count to go down to
zero. This can happen, for example, when a VLAN netdev with an IP address
is put under bridge. While this configuration doesn't make sense it does
cause the device and the kernel to get out of sync when the netdev is
unbridged. We intend to address this in the future, hopefully in current
cycle.

Finally, Remove the lower 0.5K vFIDs, as they are deprecated by the RIFs,
which will trap packets according to their DIP.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: spectrum: Edit RIF properties based on netdev events
Ido Schimmel [Mon, 4 Jul 2016 06:23:13 +0000 (08:23 +0200)]
mlxsw: spectrum: Edit RIF properties based on netdev events

We are just about to introduce router interfaces (RIFs), but before that
we need to be able update the device with the correct RIF attributes
whenever they change for the netdev the RIF is backing. Two such
attributes are MTU and MAC.

The MAC is used both to set the source MAC of packets egressing from the
RIF and also to program an FDB rule that will direct packets to the
router block.

Use the existing netdevice notification block and respond to CHANGEADDR
and CHANGEMTU accordingly. Store both attributes in the RIF struct
in case we need to revert to old attributes following a failed update.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: spectrum: Add couple of lower device helper functions
Jiri Pirko [Mon, 4 Jul 2016 06:23:12 +0000 (08:23 +0200)]
mlxsw: spectrum: Add couple of lower device helper functions

Add functions that iterate over lower devices and find port device.
As a dependency add netdev_for_each_all_lower_dev and
netdev_for_each_all_lower_dev_rcu macro with
netdev_all_lower_get_next and netdev_all_lower_get_next_rcu shelpers.

Also, add functions to return mlxsw struct according to lower device
found and mlxsw_port struct with a reference to lower device.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: spectrum_router: Implement fib4 add/del switchdev obj ops
Jiri Pirko [Mon, 4 Jul 2016 06:23:11 +0000 (08:23 +0200)]
mlxsw: spectrum_router: Implement fib4 add/del switchdev obj ops

Implement ipv4 FIB entries addition and removal. Initially, we support
local and broadcast routes using "ip2me" trap action.
Also, unicast routes without nexthop are supported using "local" action.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: reg: Add Router Algorithmic LPM Unicast Entry Register definition
Jiri Pirko [Mon, 4 Jul 2016 06:23:10 +0000 (08:23 +0200)]
mlxsw: reg: Add Router Algorithmic LPM Unicast Entry Register definition

Serves for adding, updating and removing fib entries.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: spectrum_router: Add virtual router management
Jiri Pirko [Mon, 4 Jul 2016 06:23:09 +0000 (08:23 +0200)]
mlxsw: spectrum_router: Add virtual router management

Virtual router is a construct used inside HW. In this implementation
we map kernel tables to virtual routers one to one. Introduce management
logic to create virtual routers when needed and destroy in case they are
no longer in use. According to that, call into LPM tree management.
Each virtual router is always bound to one LPM tree.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: spectrum_router: Implement LPM trees management
Jiri Pirko [Mon, 4 Jul 2016 06:23:08 +0000 (08:23 +0200)]
mlxsw: spectrum_router: Implement LPM trees management

Introduce basic LPM tree management allowing to share the trees in
between tables if the used prefixes in the tables are the same.
Build the tree structure according to the used prefixes. Although it is
not optimal for many use cases, this initial implementation does only
simple linear left-tree. More advanced structures will be introduced
later on, possibly including mechanisms to change trees on the fly.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: reg: Add Router Algorithmic LPM Tree Binding Register definition
Jiri Pirko [Mon, 4 Jul 2016 06:23:07 +0000 (08:23 +0200)]
mlxsw: reg: Add Router Algorithmic LPM Tree Binding Register definition

This register is used to bind virtual router and protocol to an
allocated LPM tree.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: reg: Add Router Algorithmic LPM Structure Tree Register definition
Jiri Pirko [Mon, 4 Jul 2016 06:23:06 +0000 (08:23 +0200)]
mlxsw: reg: Add Router Algorithmic LPM Structure Tree Register definition

Serves to build LPM tree structure.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: reg: Add Router Algorithmic LPM Tree Allocation Register definition
Jiri Pirko [Mon, 4 Jul 2016 06:23:05 +0000 (08:23 +0200)]
mlxsw: reg: Add Router Algorithmic LPM Tree Allocation Register definition

Register serves for allocation and deallocation of LPM search tree.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: spectrum_router: Implement private fib
Jiri Pirko [Mon, 4 Jul 2016 06:23:04 +0000 (08:23 +0200)]
mlxsw: spectrum_router: Implement private fib

Shadow FIB is needed in order to hold additional information for FIB
entries and keep track of used prefixes. That is needed for the LPM tree
construction to be introduced later on in this set.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agotun: fix build warnings
Jason Wang [Mon, 4 Jul 2016 05:53:38 +0000 (13:53 +0800)]
tun: fix build warnings

Stephen Rothwell reports a build warnings(powerpc ppc64_defconfig)

drivers/net/tun.c: In function 'tun_do_read.part.5':
/home/sfr/next/next/drivers/net/tun.c:1491:6: warning: 'err' may be
used uninitialized in this function [-Wmaybe-uninitialized]
   int err;

This is because tun_ring_recv() may return an uninitialized err, fix this.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'liquidio-next'
David S. Miller [Mon, 4 Jul 2016 23:15:32 +0000 (16:15 -0700)]
Merge branch 'liquidio-next'

Raghu Vatsavayi says:

====================
liquidio updates and bug fixes

Following V2 patchset contains updates and bug fixes for
liquidio driver. This patchset also has changes that you
suggested in vxlan code. Please apply the patches in following
order as some of the patches depend on earlier patches in the
series.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoliquidio: Response header changes
Raghu Vatsavayi [Sun, 3 Jul 2016 20:56:56 +0000 (13:56 -0700)]
liquidio: Response header changes

This patch changes response header to be able to communicate
with new firmware interface.

Signed-off-by: Derek Chickles <derek.chickles@caviumnetworks.com>
Signed-off-by: Satanand Burla <satananda.burla@caviumnetworks.com>
Signed-off-by: Felix Manlunas <felix.manlunas@caviumnetworks.com>
Signed-off-by: Raghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoliquidio: Remove redundant code
Raghu Vatsavayi [Sun, 3 Jul 2016 20:56:55 +0000 (13:56 -0700)]
liquidio: Remove redundant code

This patch removes redundant file includes and conditions.
Provides some meaningful comments and code alignment.

Signed-off-by: Derek Chickles <derek.chickles@caviumnetworks.com>
Signed-off-by: Satanand Burla <satananda.burla@caviumnetworks.com>
Signed-off-by: Felix Manlunas <felix.manlunas@caviumnetworks.com>
Signed-off-by: Raghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoliquidio: Droq validation
Raghu Vatsavayi [Sun, 3 Jul 2016 20:56:54 +0000 (13:56 -0700)]
liquidio: Droq validation

This patch removes redudant droq num validation.

Signed-off-by: Derek Chickles <derek.chickles@caviumnetworks.com>
Signed-off-by: Satanand Burla <satananda.burla@caviumnetworks.com>
Signed-off-by: Felix Manlunas <felix.manlunas@caviumnetworks.com>
Signed-off-by: Raghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoliquidio: MTU limits
Raghu Vatsavayi [Sun, 3 Jul 2016 20:56:53 +0000 (13:56 -0700)]
liquidio: MTU limits

This patch limits the MTU  between 68 bytes and 16000 bytes.

Signed-off-by: Derek Chickles <derek.chickles@caviumnetworks.com>
Signed-off-by: Satanand Burla <satananda.burla@caviumnetworks.com>
Signed-off-by: Felix Manlunas <felix.manlunas@caviumnetworks.com>
Signed-off-by: Raghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoliquidio: free resources during shutdown
Raghu Vatsavayi [Sun, 3 Jul 2016 20:56:52 +0000 (13:56 -0700)]
liquidio: free resources during shutdown

This patch fixes the issue of proper freeing of queue
memory resources during free device. It also has fix for
correct pcie error reporting.

Signed-off-by: Derek Chickles <derek.chickles@caviumnetworks.com>
Signed-off-by: Satanand Burla <satananda.burla@caviumnetworks.com>
Signed-off-by: Felix Manlunas <felix.manlunas@caviumnetworks.com>
Signed-off-by: Raghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoliquidio: iq/oq limits
Raghu Vatsavayi [Sun, 3 Jul 2016 20:56:51 +0000 (13:56 -0700)]
liquidio: iq/oq limits

This patch removes the dependency of number of iq/oq's on
number of cpus.

Signed-off-by: Derek Chickles <derek.chickles@caviumnetworks.com>
Signed-off-by: Satanand Burla <satananda.burla@caviumnetworks.com>
Signed-off-by: Felix Manlunas <felix.manlunas@caviumnetworks.com>
Signed-off-by: Raghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoliquidio: softcommand delay
Raghu Vatsavayi [Sun, 3 Jul 2016 20:56:50 +0000 (13:56 -0700)]
liquidio: softcommand delay

This patch updates the delay constant for softcommands in
accrodance with new requirements.

Signed-off-by: Derek Chickles <derek.chickles@caviumnetworks.com>
Signed-off-by: Satanand Burla <satananda.burla@caviumnetworks.com>
Signed-off-by: Felix Manlunas <felix.manlunas@caviumnetworks.com>
Signed-off-by: Raghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoliquidio: IQ synchronization
Raghu Vatsavayi [Sun, 3 Jul 2016 20:56:49 +0000 (13:56 -0700)]
liquidio: IQ synchronization

This patch tries to protect against bh preemption with
sc_buf_pool. It also modifies the syncronization primitives
during input queue processing.

Signed-off-by: Derek Chickles <derek.chickles@caviumnetworks.com>
Signed-off-by: Satanand Burla <satananda.burla@caviumnetworks.com>
Signed-off-by: Felix Manlunas <felix.manlunas@caviumnetworks.com>
Signed-off-by: Raghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoliquidio: Macro replacements
Raghu Vatsavayi [Sun, 3 Jul 2016 20:56:48 +0000 (13:56 -0700)]
liquidio: Macro replacements

This patch has minor replacements of ACCESS_ONCE macros with
WRITE_ONCE and replacement of BUG_ON with polite version WARN_ON.

Signed-off-by: Derek Chickles <derek.chickles@caviumnetworks.com>
Signed-off-by: Satanand Burla <satananda.burla@caviumnetworks.com>
Signed-off-by: Felix Manlunas <felix.manlunas@caviumnetworks.com>
Signed-off-by: Raghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoliquidio: Vxlan support
Raghu Vatsavayi [Sun, 3 Jul 2016 20:56:47 +0000 (13:56 -0700)]
liquidio: Vxlan support

This patch adds support for Vxaln offloads in liquidio driver.

Signed-off-by: Derek Chickles <derek.chickles@caviumnetworks.com>
Signed-off-by: Satanand Burla <satananda.burla@caviumnetworks.com>
Signed-off-by: Felix Manlunas <felix.manlunas@caviumnetworks.com>
Signed-off-by: Raghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agobpf: add bpf_get_hash_recalc helper
Daniel Borkmann [Sat, 2 Jul 2016 23:28:47 +0000 (01:28 +0200)]
bpf: add bpf_get_hash_recalc helper

If skb_clear_hash() was invoked due to mangling of relevant headers and
BPF program needs skb->hash later on, we can add a helper to trigger hash
recalculation via bpf_get_hash_recalc().

The helper will return the newly retrieved hash directly, but later access
can also be done via skb context again through skb->hash directly (inline)
without needing to call the helper once more.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: samples: pktgen mode samples/tests for qdisc layer
John Fastabend [Sat, 2 Jul 2016 21:13:13 +0000 (14:13 -0700)]
net: samples: pktgen mode samples/tests for qdisc layer

This adds samples for pktgen to use with new mode to inject pkts into
the qdisc layer. This also doubles as nice test cases to test any
patches against qdisc layer.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: pktgen: support injecting packets for qdisc testing
John Fastabend [Sat, 2 Jul 2016 21:12:54 +0000 (14:12 -0700)]
net: pktgen: support injecting packets for qdisc testing

Add another xmit_mode to pktgen to allow testing xmit functionality
of qdiscs. The new mode "queue_xmit" injects packets at
__dev_queue_xmit() so that qdisc is called.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: ethernet: bcmgenet: use phy_ethtool_{get|set}_link_ksettings
Philippe Reynes [Sun, 3 Jul 2016 15:33:57 +0000 (17:33 +0200)]
net: ethernet: bcmgenet: use phy_ethtool_{get|set}_link_ksettings

There are two generics functions phy_ethtool_{get|set}_link_ksettings,
so we can use them instead of defining the same code in the driver.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: ethernet: bcmgenet: use phydev from struct net_device
Philippe Reynes [Sun, 3 Jul 2016 15:33:56 +0000 (17:33 +0200)]
net: ethernet: bcmgenet: use phydev from struct net_device

The private structure contain a pointer to phydev, but the structure
net_device already contain such pointer. So we can remove the pointer
phy in the private structure, and update the driver to use the
one contained in struct net_device.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: ethernet: arc: emac: use phy_ethtool_{get|set}_link_ksettings
Philippe Reynes [Sat, 2 Jul 2016 18:06:52 +0000 (20:06 +0200)]
net: ethernet: arc: emac: use phy_ethtool_{get|set}_link_ksettings

There are two generics functions phy_ethtool_{get|set}_link_ksettings,
so we can use them instead of defining the same code in the driver.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: ethernet: arc: emac: use phydev from struct net_device
Philippe Reynes [Sat, 2 Jul 2016 18:06:51 +0000 (20:06 +0200)]
net: ethernet: arc: emac: use phydev from struct net_device

The private structure contain a pointer to phydev, but the structure
net_device already contain such pointer. So we can remove the pointer
phy in the private structure, and update the driver to use the
one contained in struct net_device.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: ethernet: ixp4xx_eth: use phy_ethtool_{get|set}_link_ksettings
Philippe Reynes [Sat, 2 Jul 2016 12:06:15 +0000 (14:06 +0200)]
net: ethernet: ixp4xx_eth: use phy_ethtool_{get|set}_link_ksettings

There are two generics functions phy_ethtool_{get|set}_link_ksettings,
so we can use them instead of defining the same code in the driver.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: ethernet: ixp4xx_eth: use phydev from struct net_device
Philippe Reynes [Sat, 2 Jul 2016 12:06:14 +0000 (14:06 +0200)]
net: ethernet: ixp4xx_eth: use phydev from struct net_device

The private structure contain a pointer to phydev, but the structure
net_device already contain such pointer. So we can remove the pointer
phy in the private structure, and update the driver to use the
one contained in struct net_device.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: ethernet: smsc: smsc911x: use phy_ethtool_{get|set}_link_ksettings
Philippe Reynes [Sat, 2 Jul 2016 23:14:21 +0000 (01:14 +0200)]
net: ethernet: smsc: smsc911x: use phy_ethtool_{get|set}_link_ksettings

There are two generics functions phy_ethtool_{get|set}_link_ksettings,
so we can use them instead of defining the same code in the driver.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: ethernet: smsc: smsc911x: use phydev from struct net_device
Philippe Reynes [Sat, 2 Jul 2016 23:14:20 +0000 (01:14 +0200)]
net: ethernet: smsc: smsc911x: use phydev from struct net_device

The private structure contain a pointer to phydev, but the structure
net_device already contain such pointer. So we can remove the pointer
phy in the private structure, and update the driver to use the
one contained in struct net_device.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: ethernet: lantiq_etop: use phy_ethtool_{get|set}_link_ksettings
Philippe Reynes [Sat, 2 Jul 2016 22:05:05 +0000 (00:05 +0200)]
net: ethernet: lantiq_etop: use phy_ethtool_{get|set}_link_ksettings

There are two generics functions phy_ethtool_{get|set}_link_ksettings,
so we can use them instead of defining the same code in the driver.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: ethernet: lantiq_etop: use phydev from struct net_device
Philippe Reynes [Sat, 2 Jul 2016 22:05:04 +0000 (00:05 +0200)]
net: ethernet: lantiq_etop: use phydev from struct net_device

The private structure contain a pointer to phydev, but the structure
net_device already contain such pointer. So we can remove the pointer
phy in the private structure, and update the driver to use the
one contained in struct net_device.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: ethernet: cavium: octeon: use phy_ethtool_{get|set}_link_ksettings
Philippe Reynes [Sat, 2 Jul 2016 21:37:00 +0000 (23:37 +0200)]
net: ethernet: cavium: octeon: use phy_ethtool_{get|set}_link_ksettings

There are two generics functions phy_ethtool_{get|set}_link_ksettings,
so we can use them instead of defining the same code in the driver.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: ethernet: cavium: octeon: use phydev from struct net_device
Philippe Reynes [Sat, 2 Jul 2016 21:36:59 +0000 (23:36 +0200)]
net: ethernet: cavium: octeon: use phydev from struct net_device

The private structure contain a pointer to phydev, but the structure
net_device already contain such pointer. So we can remove the pointer
phy in the private structure, and update the driver to use the
one contained in struct net_device.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/mlx4: Fix some indent inconsistancy
Christophe Jaillet [Sat, 2 Jul 2016 12:31:05 +0000 (14:31 +0200)]
net/mlx4: Fix some indent inconsistancy

Silent a few smatch warnings about indentation.
This include the removal of a 'return' statement in 'resource_tracker.c'.
This 'return' will still be performed when breaking out of the
corresponding 'switch' block.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet sched actions: skbedit convert to use more modern nla_put_xxx
Jamal Hadi Salim [Sat, 2 Jul 2016 10:43:16 +0000 (06:43 -0400)]
net sched actions: skbedit convert to use more modern nla_put_xxx

Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet sched actions: skbedit add support for mod-ing skb pkt_type
Jamal Hadi Salim [Sat, 2 Jul 2016 10:43:15 +0000 (06:43 -0400)]
net sched actions: skbedit add support for mod-ing skb pkt_type

Extremely useful for setting packet type to host so i dont
have to modify the dst mac address using pedit (which requires
that i know the mac address)

Example usage:
tc filter add dev eth0 parent ffff: protocol ip pref 9 u32 \
match ip src 5.5.5.5/32 \
flowid 1:5 action skbedit ptype host

This will tag all packets incoming from 5.5.5.5 with type
PACKET_HOST

Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: simplify and make pkt_type_ok() available for other users
Jamal Hadi Salim [Sat, 2 Jul 2016 10:43:14 +0000 (06:43 -0400)]
net: simplify and make pkt_type_ok() available for other users

Suggested-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agobatman-adv: split routing API data structure in subobjects
Antonio Quartulli [Wed, 25 May 2016 15:27:31 +0000 (23:27 +0800)]
batman-adv: split routing API data structure in subobjects

The routing API data structure contains several function
pointers that can easily be grouped together based on the
component they work with.

Split the API in subobjects in order to improve definition readability.

At the same time, remove the "bat_" prefix from the API object and
its fields names. These are batman-adv private structs and there is no
need to always prepend such prefix, which only makes function invocations
much much longer.

Signed-off-by: Antonio Quartulli <a@unstable.cc>
Reviewed-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
8 years agobatman-adv: throughput meter implementation
Antonio Quartulli [Thu, 5 May 2016 11:09:43 +0000 (13:09 +0200)]
batman-adv: throughput meter implementation

The throughput meter module is a simple, kernel-space replacement for
throughtput measurements tool like iperf and netperf. It is intended to
approximate TCP behaviour.

It is invoked through batctl: the protocol is connection oriented, with
cumulative acknowledgment and a dynamic-size sliding window.

The test *can* be interrupted by batctl. A receiver side timeout avoids
unlimited waitings for sender packets: after one second of inactivity, the
receiver abort the ongoing test.

Based on a prototype from Edo Monticelli <montik@autistici.org>

Signed-off-by: Antonio Quartulli <antonio.quartulli@open-mesh.com>
Signed-off-by: Sven Eckelmann <sven.eckelmann@open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
8 years agobatman-adv: return netdev status in the TX path
Antonio Quartulli [Wed, 18 May 2016 09:38:48 +0000 (11:38 +0200)]
batman-adv: return netdev status in the TX path

Return the proper netdev TX status along the TX path so that the tp_meter
can understand when the queue is full and should stop sending packets.

Signed-off-by: Antonio Quartulli <antonio.quartulli@open-mesh.com>
Signed-off-by: Sven Eckelmann <sven.eckelmann@open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
8 years agobatman-adv: add netlink command to query generic mesh information files
Matthias Schiffer [Mon, 9 May 2016 16:41:09 +0000 (18:41 +0200)]
batman-adv: add netlink command to query generic mesh information files

BATADV_CMD_GET_MESH_INFO is used to query basic information about a
batman-adv softif (name, index and MAC address for both the softif and
the primary hardif; routing algorithm; batman-adv version).

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
[sven.eckelmann@open-mesh.com: Reduce the number of changes to
BATADV_CMD_GET_MESH_INFO, add missing kerneldoc, add policy for attributes]
Signed-off-by: Sven Eckelmann <sven.eckelmann@open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
8 years agobatman-adv: add generic netlink family for batman-adv
Matthias Schiffer [Mon, 9 May 2016 16:41:08 +0000 (18:41 +0200)]
batman-adv: add generic netlink family for batman-adv

debugfs is currently severely broken virtually everywhere in the kernel
where files are dynamically added and removed (see
http://lkml.iu.edu/hypermail/linux/kernel/1506.1/02196.html for some
details). In addition to that, debugfs is not namespace-aware.

Instead of adding new debugfs entries, the whole infrastructure should be
moved to netlink. This will fix the long standing problem of large buffers
for debug tables and hard to parse text files.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
[sven.eckelmann@open-mesh.com: Strip down patch to only add genl family,
add missing kerneldoc]
Signed-off-by: Sven Eckelmann <sven.eckelmann@open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
8 years agonet-next: mediatek: fix compile error inside mtk_poll_controller()
John Crispin [Sat, 2 Jul 2016 06:00:50 +0000 (08:00 +0200)]
net-next: mediatek: fix compile error inside mtk_poll_controller()

commit 8067302973a1 ("net-next: mediatek: add support for IRQ grouping")
failed to properly update the irq handling inside mtk_poll_controller()
causing compile errors if netconsole was enabled. Fix this by updating
the code to use the new separated irq handler function for RX.

Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'mlxsw-router-interfaces-groundwork'
David S. Miller [Sat, 2 Jul 2016 19:21:22 +0000 (15:21 -0400)]
Merge branch 'mlxsw-router-interfaces-groundwork'

Jiri Pirko says:

====================
mlxsw: Lay the groundwork for the introduction of router interfaces

This is first patchset on a way to introduce ipv4 routing offload support
in mlxsw driver. Does preparations before router interfaces will
be introduced in mlxsw.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: spectrum: Add traps needed for router implementation
Jiri Pirko [Sat, 2 Jul 2016 09:00:20 +0000 (11:00 +0200)]
mlxsw: spectrum: Add traps needed for router implementation

ip2me:
To instruct HW to send trapped ip2me traffic to kernel, we have to add
this trap. Selection ip2me traffic is introduced later on in this set.

ARPs:
We are going to stop flooding to CPU port when netdev isn't bridged and
only get packets destined to the netdev's IP address and certain control
packets.

Add traps for ARP request (broadcast) and response (unicast) in order to
get these to the CPU and resolve neighbours.

host miss:
If a packet is routed through a directly connected route and its
destination IP is not in the device's neighbour table, then we need to
trap it to CPU. This will cause the host to resolve the MAC of the
neighbour, which will be eventually programmed to the device's table.

router ingress:
In order to trap packets in router part.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: spectrum: Use action 'discard' when removing traps
Ido Schimmel [Sat, 2 Jul 2016 09:00:19 +0000 (11:00 +0200)]
mlxsw: spectrum: Use action 'discard' when removing traps

When removing packet traps we should use action 'discard' instead of
'forward', as some trap IDs we'll add cannot be configured with the
later. However, result is the same, as packets are not trapped to the
CPU.

In the future we will be able to reverse the operation properly by
detaching the trap group from the CPU.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: reg: Add Router Interface Table Register
Ido Schimmel [Sat, 2 Jul 2016 09:00:18 +0000 (11:00 +0200)]
mlxsw: reg: Add Router Interface Table Register

Add the Router Interface Table Register (RITR), which allows us to
create and configure router interfaces (RIFs).

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: reg: Add FDB action to forward to router
Ido Schimmel [Sat, 2 Jul 2016 09:00:17 +0000 (11:00 +0200)]
mlxsw: reg: Add FDB action to forward to router

Incoming packets are directed to the router when they match an FDB
entry with action forward to IP router.

Add this action, which was mistakenly named "TRAP".

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: spectrum: Add router interface struct
Ido Schimmel [Sat, 2 Jul 2016 09:00:16 +0000 (11:00 +0200)]
mlxsw: spectrum: Add router interface struct

When enabling the router in the device we will represent L3 netdevs
using router interfaces (RIFs). These will be specified whenever
programming routes or neighbours on the netdev.

Introduce the basic RIF infrastructure which allows one to lookup a RIF
by its netdev. Later patches in the series will extend this, but the
basic routines are needed now in order to direct traffic to CPU.

Pointers to the RIF structs are stored in an array indexed by the RIF's
number. This will allow us to efficiently update the kernel's neighbour
table when regularly dumping the device's table.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agomlxsw: spectrum_router: Add basic ipv4 router initialization
Ido Schimmel [Sat, 2 Jul 2016 09:00:15 +0000 (11:00 +0200)]
mlxsw: spectrum_router: Add basic ipv4 router initialization

Create a skeleton router file and do basic HW initialization of router.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>