Commit graph

721948 commits

Author SHA1 Message Date
Martin KaFai Lau
f0b1e64c13 udp: Move udp[46]_portaddr_hash() to net/ip[v6].h
This patch moves the udp[46]_portaddr_hash()
to net/ip[v6].h.  The function name is renamed to
ipv[46]_portaddr_hash().

It will be used by a later patch which adds a second listener
hashtable hashed by the address and port.

Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-03 10:18:28 -05:00
Martin KaFai Lau
76d013b20b inet: Add a count to struct inet_listen_hashbucket
This patch adds a count to the 'struct inet_listen_hashbucket'.
It counts how many sk is hashed to a bucket.  It will be
used to decide if the (to-be-added) portaddr listener's hashtable
should be used during inet[6]_lookup_listener().

Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-03 10:18:27 -05:00
Govindarajulu Varadarajan
fb7516d424 enic: add sw timestamp support
Add ethtool ops to advertise sw timestamping.
Call skb_tx_timestamp() just before ringing the wq doorbell.

Signed-off-by: Govindarajulu Varadarajan <gvaradar@cisco.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-03 10:15:34 -05:00
David S. Miller
b8278f2c12 Merge branch 'hv_netvsc-minor-optimizations'
Stephen Hemminger says:

====================
hv_netvsc: minor optimizations

These are a set of local optimizations the Hyper-V networking driver.
Also include a vmbus patch in this set, because it depends on the
netvsc that last used that function.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-03 10:10:03 -05:00
Stephen Hemminger
0487426fed vmbus: make hv_get_ringbuffer_availbytes local
The last use of hv_get_ringbuffer_availbytes in drivers is now
gone. Only used by the debug info routine so make it static. Also, add
READ_ONCE() to avoid any possible issues with potentially volatile
index values.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-03 10:10:02 -05:00
Stephen Hemminger
f5a2255010 hv_netvsc: optimize initialization of RNDIS header
The memset of the whole maximum possible RNDIS header is unnecessary.
For the main part of the header use a structure assignment.

No need to memset the whole per packet info. Instead rely on caller to
set what it wants. Also get rid of cast to void and signed/unsigned
conversion. Now return pointer to per packet data (rather than the
header) which simplifies use by code setting up the packet data.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-03 10:10:02 -05:00
Stephen Hemminger
a7f99d0f2b hv_netvsc: use reciprocal divide to speed up percent calculation
Every packet sent checks the available ring space. The calculation
can be sped up by using reciprocal divide which is multiplication.

Since ring_size can only be configured by module parameter, so it doesn't
have to be passed around everywhere. Also it should be unsigned
since it is number of pages.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-03 10:10:02 -05:00
Stephen Hemminger
b85e06f7bb hv_netvsc: replace divide with mask when computing padding
Packet alignment is always a power of 2 therefore modulus can
be replaced with a faster and operation

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-03 10:10:02 -05:00
Stephen Hemminger
200a569990 hv_netvsc: don't need local xmit_more
Since skb is always non-NULL in the copy portion of netvsc_send
do not need local variable.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-03 10:10:02 -05:00
Stephen Hemminger
07a7c494b7 hv_netvsc: drop unused macros
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-03 10:10:02 -05:00
Gao Feng
5e51fe6f44 ipvlan: Add new func ipvlan_is_valid_dev instead of duplicated codes
There are multiple duplicated condition checks in the current codes, so
I add the new func ipvlan_is_valid_dev instead of the duplicated codes to
check if the netdev is real ipvlan dev.

Signed-off-by: Gao Feng <gfree.wind@vip.163.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-03 09:46:42 -05:00
David S. Miller
0653cb2e1d Merge branch 'realtek-phy-improvements'
Martin Blumenstingl says:

====================
Realtek Ethernet PHY driver improvements

This series provides some small improvements and cleanups for the
Realtek Ethernet PHY driver.
None of the patches in this series should change any functionality.
The goal is to make the code a bit easier to read by:
- re-using the BIT and GENMASK macros (which makes it easier to compare
  the #defines in the kernel with the values from the datasheets)
- rename a #define from a generic name to a PHY-specific name since it's
  only used for one specific PHY
- logically group the register #defines and their register bit #defines
  together
- indentation cleanups
- removed some code duplicating for reading/writing registers on a
  Realtek specific "page"
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-03 09:38:17 -05:00
Martin Blumenstingl
136819a6e8 net: phy: realtek: add utility functions to read/write page addresses
Realtek PHYs implement the concept of so-called "extension pages". The
reason for this is probably because these PHYs expose more registers
than available in the standard address range.
After all read/write operations on such a page are done the driver
should switch back to page 0 where the standard MII registers (such as
MII_BMCR) are available.

When referring to such a register the datasheets of RTL8211E and
RTL8211F always specify:
- the page / "ext. page" which has to be written to RTL821x_PAGE_SELECT
- an address (sometimes also called reg)

These new utility functions make the existing code easier to read since
it removes some duplication (switching back to page 0 is done within the
new helpers for example).

No functional changes are intended.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-03 09:38:17 -05:00
Martin Blumenstingl
f609ab0ed8 net: phy: realtek: use the same indentation for all #defines
This simply makes the code easier to read. No functional changes.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-03 09:38:17 -05:00
Martin Blumenstingl
a82f266d24 net: phy: realtek: group all register bit #defines for RTL821x_INER
This simply moves all register bit #defines which describe the (PHY
specific) bits in the RTL821x_INER right below the RTL821x_INER register
definition. This makes it easier to spot which registers and bits belong
together.
No functional changes.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-03 09:38:17 -05:00
Martin Blumenstingl
69021e32ec net: phy: realtek: rename RTL821x_INER_INIT to RTL8211B_INER_INIT
This macro is only used by the RTL8211B code. RTL8211E and RTL8211F both
use other bits to initialize the RTL821x_INER register.
No functional changes.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-03 09:38:17 -05:00
Martin Blumenstingl
8cc5baefbc net: phy: realtek: use the BIT and GENMASK macros
This makes it easier to compare the #defines with the datasheets.
No functional changes.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-03 09:38:16 -05:00
David S. Miller
75d0de8c7e Merge branch 'dsa-cross-chip-FDB-support'
Vivien Didelot says:

====================
net: dsa: cross-chip FDB support

DSA can have interconnected switches. For instance, the ZII Dev Rev B
board described in arch/arm/boot/dts/vf610-zii-dev-rev-b.dts has a
switch fabric composed of 3 switch devices like this:

                          lan4                 lan6
        CPU (eth1)            |  lan5         |  lan7
                  |           | |             | |
       [0 1 2 3 4 6 5]---[6 0 1 2 3 4 5]---[9 0 1 2 3 4 5 6 7 8]
        | | |               |                     | | |
    lan0  |  lan2       lan3                  lan8  |  optical4
           lan1                                      optical3

One current issue with DSA is cross-chip FDB. If we add a static MAC
address on lan3, only its parent switch 1 (the one in the middle) will
be programmed. That is not correct in a cross-chip environment, because
the DSA ports connecting to switch 1 of adjacent switch 0 (on the left)
and switch 2 (on the right) must be programmed too.

Without this patchset, a dump of the hardware FDB of switches 0, 1 and 2
after programming a MAC address on lan3 looks like this (*):

    # bridge fdb add 11:22:33:44:55:66 dev lan3
    # cat /sys/kernel/debug/mv88e6xxx/sw*/atu/0 | grep -v FID
       0  ff:ff:ff:ff:ff:ff            MC_STATIC       n  0 1 2 3 4 5 6
       0  11:22:33:44:55:66    MC_STATIC_MGMT_PO       n  0 - - - - - -
       0  ff:ff:ff:ff:ff:ff            MC_STATIC       n  0 1 2 3 4 5 6
       0  ff:ff:ff:ff:ff:ff            MC_STATIC       n  0 1 2 3 4 5 6 7 8 9

With this patchset applied, adjacent DSA ports get programmed too:

    # bridge fdb add 11:22:33:44:55:66 dev lan3
    # cat /sys/kernel/debug/mv88e6xxx/sw*/atu/0 | grep -v FID
       0  11:22:33:44:55:66    MC_STATIC_MGMT_PO       n  - - - - - 5 -
       0  ff:ff:ff:ff:ff:ff            MC_STATIC       n  0 1 2 3 4 5 6
       0  11:22:33:44:55:66    MC_STATIC_MGMT_PO       n  0 - - - - - -
       0  ff:ff:ff:ff:ff:ff            MC_STATIC       n  0 1 2 3 4 5 6
       0  11:22:33:44:55:66    MC_STATIC_MGMT_PO       n  - - - - - - - - - 9
       0  ff:ff:ff:ff:ff:ff            MC_STATIC       n  0 1 2 3 4 5 6 7 8 9

In order to do that, the first commit introduces a dsa_towards_port()
helper which returns the local port of a switch which must be used to
reach an arbitrary switch port (local or from an adjacent switch.)

The second patch uses this helper to configure the port reaching the
target port for every switches of the fabric.

(*) a patch for squashed debugfs interface which applies on top of this
patchset is available here:

    f8e6ba34c6.patch
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-02 21:21:29 -05:00
Vivien Didelot
3169241f55 net: dsa: support cross-chip FDB operations
When a MAC address is added to or removed from a switch port in the
fabric, the target switch must program its port and adjacent switches
must program their local DSA port used to reach the target switch.

For this purpose, use the dsa_towards_port() helper to identify the
local switch port which must be programmed.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-02 21:21:17 -05:00
Vivien Didelot
3b8fac5d90 net: dsa: introduce dsa_towards_port helper
Add a new helper returning the local port used to reach an arbitrary
switch port in the fabric.

Its only user at the moment is the dsa_upstream_port helper, which
returns the local port reaching the dedicated CPU port, but it will be
used in cross-chip FDB operations.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-02 21:20:59 -05:00
David S. Miller
5420683ae3 Merge branch 'dsa-simplify-switchdev-prepare-phase'
Vivien Didelot says:

====================
net: dsa: simplify switchdev prepare phase

This patch series brings no functional changes.

It removes the unused switchdev_trans arguments from the dsa_switch_ops
for both MDB and VLAN operations, and provides functions to prepare and
add these objects for a given bitmap of ports.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-02 21:18:57 -05:00
Vivien Didelot
e6db98db8a net: dsa: add switch mdb bitmap functions
This patch brings no functional changes.
It moves out the MDB code iterating on a multicast group into new
dsa_switch_mdb_{prepare,add}_bitmap() functions.

This gives us a better isolation of the two switchdev phases.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-02 21:18:56 -05:00
Vivien Didelot
9c428c593f net: dsa: add switch vlan bitmap functions
This patch brings no functional changes.
It moves out the VLAN code iterating on a list of VLAN members into new
dsa_switch_vlan_{prepare,add}_bitmap() functions.

This gives us a better isolation of the two switchdev phases.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-02 21:18:56 -05:00
Vivien Didelot
3709aadc83 net: dsa: remove trans argument from mdb ops
The DSA switch MDB ops pass the switchdev_trans structure down to the
drivers, but no one is using them and they aren't supposed to anyway.

Remove the trans argument from MDB prepare and add operations.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-02 21:18:56 -05:00
Vivien Didelot
80e0236079 net: dsa: remove trans argument from vlan ops
The DSA switch VLAN ops pass the switchdev_trans structure down to the
drivers, but no one is using them and they aren't supposed to anyway.

Remove the trans argument from VLAN prepare and add operations.

At the same time, fix the following checkpatch warning:

    WARNING: line over 80 characters
    #74: FILE: drivers/net/dsa/dsa_loop.c:177:
    +				      const struct switchdev_obj_port_vlan *vlan)

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-02 21:18:55 -05:00
Paolo Abeni
183dea5818 openvswitch: do not propagate headroom updates to internal port
After commit 3a927bc7cf ("ovs: propagate per dp max headroom to
all vports") the need_headroom for the internal vport is updated
accordingly to the max needed headroom in its datapath.

That avoids the pskb_expand_head() costs when sending/forwarding
packets towards tunnel devices, at least for some scenarios.

We still require such copy when using the ovs-preferred configuration
for vxlan tunnels:

    br_int
  /       \
tap      vxlan
           (remote_ip:X)

br_phy
     \
    NIC

where the route towards the IP 'X' is via 'br_phy'.

When forwarding traffic from the tap towards the vxlan device, we
will call pskb_expand_head() in vxlan_build_skb() because
br-phy->needed_headroom is equal to tun->needed_headroom.

With this change we avoid updating the internal vport needed_headroom,
so that in the above scenario no head copy is needed, giving 5%
performance improvement in UDP throughput test.

As a trade-off, packets sent from the internal port towards a tunnel
device will now experience the head copy overhead. The rationale is
that the latter use-case is less relevant performance-wise.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-02 21:14:59 -05:00
David S. Miller
c5f66a8589 Merge branch 'cpsw-ale-cleanups'
Grygorii Strashko says:

====================
net: ethernet: ti: cpsw/ale clean up and optimization

This is set of non critical clean ups and optimizations for TI
CPSW and ALE drivers.

Rebased on top on net-next.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-01 16:36:33 -05:00
Grygorii Strashko
97193601bb net: ethernet: ti: ale: fix port check in cpsw_ale_control_set/get
ALE ports number includes the Host port and ext Ports, and
ALE ports numbering starts from 0, so correct corresponding port
checks in cpsw_ale_control_set/get().

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-01 16:36:33 -05:00
Grygorii Strashko
1971ab587b net: ethernet: ti: ale: use devm_kzalloc in cpsw_ale_create()
Use cpsw_ale_create in cpsw_ale_create(). This also makes
cpsw_ale_destroy() function nop, so remove it.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-01 16:36:32 -05:00
Grygorii Strashko
fb1a732dd5 net: ethernet: ti: ale: move static initialization in cpsw_ale_create()
Move static initialization from cpsw_ale_start() to cpsw_ale_create() as it
does not make much sence to perform static initializtion in
cpsw_ale_start() which is called everytime netif[s] is opened.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-01 16:36:32 -05:00
Grygorii Strashko
b5d31f2940 net: ethernet: ti: ale: optimize ale entry mask bits configuartion
The ale->params.ale_ports parameter can be used to deriver values for all
ale entry mask bits: port_mask_bits, port_mask_bits, port_num_bits.
Hence, calculate above values and drop all hardcoded values. For
port_num_bits calcualtion use order_base_2() API.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-01 16:36:32 -05:00
Grygorii Strashko
d0aef029b5 net: ethernet: ti: ale: disable ale from stop()
ALE is enabled from cpsw_ale_start() now, but disabled only from
cpsw_ale_destroy() which introduces inconsitance as cpsw_ale_start() is
called when netif[s] is opened, but cpsw_ale_destroy() is called when
driver is removed. Hence, move ALE disabling in cpsw_ale_stop().

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-01 16:36:32 -05:00
Grygorii Strashko
4ff2c4bd11 net: ethernet: ti: ale: use proper io apis
Switch to use writel_relaxed/readl_relaxed() IO API instead of raw version
as it is recommended.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-01 16:36:32 -05:00
Grygorii Strashko
c6395f1258 net: ethernet: ti: cpsw: fix ale port numbers
TI OMAP/Sitara SoCs have fixed number of ALE ports 3, which includes Host
port also.

Hence, use fixed value instead of value calcualted from DT, which can be
set by user and might not reflect actual HW configuration.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-01 16:36:32 -05:00
Grygorii Strashko
2733d7b89c net: ethernet: ti: cpsw: move mac_hi/lo defines in cpsw.h
Move mac_hi/lo defines in common header cpsw.h and re-use
them for netcp_ethss.c.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-01 16:36:32 -05:00
Grygorii Strashko
2c8a14d626 net: ethernet: ti: cpsw: move platform data struct to .c file
CPSW platform data struct cpsw_platform_data and struct cpsw_slave_data are
used only incide cpsw.c module, so move these definitions there.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-01 16:36:32 -05:00
Grygorii Strashko
dda5f5fe74 net: ethernet: ti: cpsw: use proper io apis
Switch to use writel_relaxed/readl_relaxed() IO API instead of raw version
as it is recommended.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-01 16:36:32 -05:00
Grygorii Strashko
fc49be85f6 net: ethernet: ti: cpsw: drop unused var poll from cpsw_update_channels_res
Drop unused variable "poll" from cpsw_update_channels_res().

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-01 16:36:32 -05:00
Heiner Kallweit
80274abafc net: phy: remove generic settings for callbacks config_aneg and read_status from drivers
Remove generic settings for callbacks config_aneg and read_status
from drivers.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-01 15:42:21 -05:00
Heiner Kallweit
00fde79532 net: phy: core: use genphy version of callbacks read_status and config_aneg per default
read_status and config_aneg are the only mandatory callbacks and most
of the time the generic implementation is used by drivers.
So make the core fall back to the generic version if a driver doesn't
implement the respective callback.

Also currently the core doesn't seem to verify that drivers implement
the mandatory calls. If a driver doesn't do so we'd just get a NPE.
With this patch this potential issue doesn't exit any longer.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-01 15:42:21 -05:00
David S. Miller
efbae71643 Merge branch 'ip6_gre-add-erspan-native-tunnel-for-ipv6'
William Tu says:

====================
ip6_gre: add erspan native tunnel for ipv6

The patch series add support for ERSPAN tunnel over ipv6.  The first patch
refectors the existing ipv4 gre implementation and the second refactors the
ipv6 gre's xmit code.  Finally the last patch introduces erspan protocol.

change in v5:
  - add cover-letter description

change in v4:
  - rebase on top of net-next
  - use log_ecn_error in ip6_tnl_rcv

change in v3:
  - add inline for functions in header
  - rebase on top of net-next

change in v2:
  - remove inline
  - fix some indent
  - fix errors reports by clang and scan-build
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-01 15:33:27 -05:00
William Tu
5a963eb61b ip6_gre: Add ERSPAN native tunnel support
The patch adds support for ERSPAN tunnel over ipv6.

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-01 15:33:27 -05:00
William Tu
898b29798e ip6_gre: Refactor ip6gre xmit codes
This patch refactors the ip6gre_xmit_{ipv4, ipv6}.
It is a prep work to add the ip6erspan tunnel.

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-01 15:33:26 -05:00
William Tu
a3222dc95c ip_gre: Refector the erpsan tunnel code.
Move two erspan functions to header file, erspan.h, so ipv6
erspan implementation can use it.

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-01 15:33:26 -05:00
David S. Miller
50e0f5c038 Merge branch 'ethtool-reset-AP'
Scott Branden says:

====================
net: ethtool: add support for ETH_RESET_AP

Add support to reset appplication processors inside SmartNICs by
defining new ETH_RESET_AP bit.

And use new ETH_RESET_AP bit in bnxt ethernet driver.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-01 15:29:40 -05:00
Scott Branden
6502ad5963 bnxt_en: Add ETH_RESET_AP support
Add ETH_RESET_AP support handling to reset the internal
Application Processor(s) of the SmartNIC card.

Signed-off-by: Scott Branden <scott.branden@broadcom.com>
Acked-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-01 15:29:40 -05:00
Scott Branden
40e44a1e66 net: ethtool: add support for reset of AP inside NIC interface.
Add ETH_RESET_AP to reset the application processor(s) inside the NIC
interface.

Current ETH_RESET_MGMT supports a management processor inside this NIC.
This is typically used for remote NIC management purposes.

Application processors exist inside some SmartNICs to run various
applications inside the NIC processor - be it a simple algorithm without
an OS to as complex as hosting multiple VMs.

Signed-off-by: Scott Branden <scott.branden@broadcom.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-01 15:29:40 -05:00
David S. Miller
68bf33f413 Merge branch 'rds-tcp-netns-delete-related-fixes'
Sowmini Varadhan says:

====================
rds-tcp netns delete related fixes

Patchset contains cleanup and bug fixes. Patch 1 is the removal
of some redundant code/functions. Patch 2 and 3 are fixes for
corner cases identified by syzkaller. I've not been able to
reproduce the actual use-after-free race flagged in the syzkaller
reports, thus these fixes are based on code inspection plus
manual testing to make sure the modified code paths are executed
without problems in the commonly encountered timing cases.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-01 15:25:15 -05:00
Sowmini Varadhan
f10b4cff98 rds: tcp: atomically purge entries from rds_tcp_conn_list during netns delete
The rds_tcp_kill_sock() function parses the rds_tcp_conn_list
to find the rds_connection entries marked for deletion as part
of the netns deletion under the protection of the rds_tcp_conn_lock.
Since the rds_tcp_conn_list tracks rds_tcp_connections (which
have a 1:1 mapping with rds_conn_path), multiple tc entries in
the rds_tcp_conn_list will map to a single rds_connection, and will
be deleted as part of the rds_conn_destroy() operation that is
done outside the rds_tcp_conn_lock.

The rds_tcp_conn_list traversal done under the protection of
rds_tcp_conn_lock should not leave any doomed tc entries in
the list after the rds_tcp_conn_lock is released, else another
concurrently executiong netns delete (for a differnt netns) thread
may trip on these entries.

Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-01 15:25:15 -05:00
Sowmini Varadhan
681648e67d rds: tcp: correctly sequence cleanup on netns deletion.
Commit 8edc3affc0 ("rds: tcp: Take explicit refcounts on struct net")
introduces a regression in rds-tcp netns cleanup. The cleanup_net(),
(and thus rds_tcp_dev_event notification) is only called from put_net()
when all netns refcounts go to 0, but this cannot happen if the
rds_connection itself is holding a c_net ref that it expects to
release in rds_tcp_kill_sock.

Instead, the rds_tcp_kill_sock callback should make sure to
tear down state carefully, ensuring that the socket teardown
is only done after all data-structures and workqs that depend
on it are quiesced.

The original motivation for commit 8edc3affc0 ("rds: tcp: Take explicit
refcounts on struct net") was to resolve a race condition reported by
syzkaller where workqs for tx/rx/connect were triggered after the
namespace was deleted. Those worker threads should have been
cancelled/flushed before socket tear-down and indeed,
rds_conn_path_destroy() does try to sequence this by doing
     /* cancel cp_send_w */
     /* cancel cp_recv_w */
     /* flush cp_down_w */
     /* free data structures */
Here the "flush cp_down_w" will trigger rds_conn_shutdown and thus
invoke rds_tcp_conn_path_shutdown() to close the tcp socket, so that
we ought to have satisfied the requirement that "socket-close is
done after all other dependent state is quiesced". However,
rds_conn_shutdown has a bug in that it *always* triggers the reconnect
workq (and if connection is successful, we always restart tx/rx
workqs so with the right timing, we risk the race conditions reported
by syzkaller).

Netns deletion is like module teardown- no need to restart a
reconnect in this case. We can use the c_destroy_in_prog bit
to avoid restarting the reconnect.

Fixes: 8edc3affc0 ("rds: tcp: Take explicit refcounts on struct net")
Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-01 15:25:15 -05:00