platform/kernel/linux-rpi.git
4 years agonet: ena: Capitalize all log strings and improve code readability
Shay Agroskin [Mon, 21 Sep 2020 08:37:38 +0000 (11:37 +0300)]
net: ena: Capitalize all log strings and improve code readability

Capitalize all log strings printed by the ena driver to make their
format uniform across it.

Also fix indentation, spelling mistakes and comments to improve code
readability. This also includes adding comments to macros/enums whose
purpose might be difficult to understand.
Separate some code into functions to make it easier to understand the
purpose of these lines.

Signed-off-by: Amit Bernstein <amitbern@amazon.com>
Signed-off-by: Shay Agroskin <shayagr@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ena: Change log message to netif/dev function
Shay Agroskin [Mon, 21 Sep 2020 08:37:37 +0000 (11:37 +0300)]
net: ena: Change log message to netif/dev function

Make log prints in ena_netdev use the same log functions as the rest of
the driver.

For the sake of consistency, all prints in ena_netdev file were
converted into netif_* format except where netdev struct isn't yet
defined. For these places, dev_* log functions are used (similar to
the patch for ena_com files).

This commit leaves some corner cases which would be changed in a
future patch.

Signed-off-by: Amit Bernstein <amitbern@amazon.com>
Signed-off-by: Shay Agroskin <shayagr@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ena: Change license into format to SPDX in all files
Shay Agroskin [Mon, 21 Sep 2020 08:37:36 +0000 (11:37 +0300)]
net: ena: Change license into format to SPDX in all files

All ena files should now use SPDX format in their license string. This
doesn't change the license of the files, but rather states the same
license in fewer words.

Also update the license years in some of the files.

Signed-off-by: Shay Agroskin <shayagr@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agochelsio: simplify the return expression of t3_ael2020_phy_prep()
Qinglang Miao [Mon, 21 Sep 2020 13:10:05 +0000 (21:10 +0800)]
chelsio: simplify the return expression of t3_ael2020_phy_prep()

Simplify the return expression.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoconnector: simplify the return expression of cn_add_callback()
Qinglang Miao [Mon, 21 Sep 2020 13:10:06 +0000 (21:10 +0800)]
connector: simplify the return expression of cn_add_callback()

Simplify the return expression.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoenetc: simplify the return expression of enetc_vf_set_mac_addr()
Qinglang Miao [Mon, 21 Sep 2020 13:10:26 +0000 (21:10 +0800)]
enetc: simplify the return expression of enetc_vf_set_mac_addr()

Simplify the return expression.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoice: simplify the return expression of ice_finalize_update()
Qinglang Miao [Mon, 21 Sep 2020 13:10:34 +0000 (21:10 +0800)]
ice: simplify the return expression of ice_finalize_update()

Simplify the return expression.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: spectrum_router: simplify the return expression of __mlxsw_sp_router_init()
Qinglang Miao [Mon, 21 Sep 2020 13:10:41 +0000 (21:10 +0800)]
mlxsw: spectrum_router: simplify the return expression of __mlxsw_sp_router_init()

Simplify the return expression.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: simplify the return expression of hclgevf_client_start()
Qinglang Miao [Mon, 21 Sep 2020 13:10:43 +0000 (21:10 +0800)]
net: hns3: simplify the return expression of hclgevf_client_start()

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: qlcnic: simplify the return expression of qlcnic_83xx_shutdown
Qinglang Miao [Mon, 21 Sep 2020 13:10:46 +0000 (21:10 +0800)]
net: qlcnic: simplify the return expression of qlcnic_83xx_shutdown

Simplify the return expression.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoRDS: drop double zeroing
Julia Lawall [Sun, 20 Sep 2020 11:26:19 +0000 (13:26 +0200)]
RDS: drop double zeroing

sg_init_table zeroes its first argument, so the allocation of that argument
doesn't have to.

the semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,n,flags;
@@

x =
- kcalloc
+ kmalloc_array
  (n,sizeof(*x),flags)
...
sg_init_table(x,n)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodpaa2-eth: drop double zeroing
Julia Lawall [Sun, 20 Sep 2020 11:26:15 +0000 (13:26 +0200)]
dpaa2-eth: drop double zeroing

sg_init_table zeroes its first argument, so the allocation of that argument
doesn't have to.

the semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,n,flags;
@@

x =
- kcalloc
+ kmalloc_array
  (n,sizeof(struct scatterlist),flags)
...
sg_init_table(x,n)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'DSA-with-VLAN-filtering-and-offloading-masters'
David S. Miller [Mon, 21 Sep 2020 02:01:34 +0000 (19:01 -0700)]
Merge branch 'DSA-with-VLAN-filtering-and-offloading-masters'

Vladimir Oltean says:

====================
DSA with VLAN filtering and offloading masters

This series attempts to make DSA VLANs work in the presence of a master
interface that is:
- filtering, so it drops VLANs that aren't explicitly added to its
  filter list
- offloading, so the old assumptions in the tagging code about there
  being a VLAN tag in the skb are not necessarily true anymore.

For more context:
https://lore.kernel.org/netdev/20200910150738.mwhh2i6j2qgacqev@skbuf/

This probably marks the beginning of a series of patches in which DSA
starts paying much more attention to its upper interfaces, not only for
VLAN purposes but also for address filtering and for management of the
CPU flooding domain. There was a comment from Florian on whether we
could factor some of the mlxsw logic into some common functionality, but
it doesn't look so. This seems bound to be open-coded, but frankly there
isn't a lot to it.

Changes in v2:
Applied Florian's cosmetic suggestion in patch 4/9.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: tag_sja1105: add compatibility with hwaccel VLAN tags
Vladimir Oltean [Mon, 21 Sep 2020 00:10:31 +0000 (03:10 +0300)]
net: dsa: tag_sja1105: add compatibility with hwaccel VLAN tags

Check whether there is any hwaccel VLAN tag on RX, and if there is,
treat it as the tag_8021q header.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: tag_8021q: add VLANs to the master interface too
Vladimir Oltean [Mon, 21 Sep 2020 00:10:30 +0000 (03:10 +0300)]
net: dsa: tag_8021q: add VLANs to the master interface too

The whole purpose of tag_8021q is to send VLAN-tagged traffic to the
CPU, from which the driver can decode the source port and switch id.

Currently this only works if the VLAN filtering on the master is
disabled. Change that by explicitly adding code to tag_8021q.c to add
the VLANs corresponding to the tags to the filter of the master
interface.

Because we now need to call vlan_vid_add, then we also need to hold the
RTNL mutex. Propagate that requirement to the callers of dsa_8021q_setup
and modify the existing call sites as appropriate. Note that one call
path, sja1105_best_effort_vlan_filtering_set -> sja1105_vlan_filtering
-> sja1105_setup_8021q_tagging, was already holding this lock.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: install VLANs into the master's RX filter too
Vladimir Oltean [Mon, 21 Sep 2020 00:10:29 +0000 (03:10 +0300)]
net: dsa: install VLANs into the master's RX filter too

Most DSA switch tags shift the EtherType to the right, causing the
master to not parse the VLAN as VLAN.
However, not all switches do that (example: tail tags, tag_8021q etc),
and if the DSA master has "rx-vlan-filter: on" in ethtool -k, then we
have a problem.

Therefore, we could populate the VLAN table of the master, just in case
(for some switches it will not make a difference), so that network I/O
can work even with a VLAN filtering master.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: allow 8021q uppers while the bridge has vlan_filtering=0
Vladimir Oltean [Mon, 21 Sep 2020 00:10:28 +0000 (03:10 +0300)]
net: dsa: allow 8021q uppers while the bridge has vlan_filtering=0

When the bridge has VLAN awareness disabled there isn't any duplication
of functionality, since the bridge does not process VLAN. Don't deny
adding 8021q uppers to DSA switch ports in that case. The switch is
supposed to simply pass traffic leaving the VLAN tag as-is, and the
stack will happily strip the VLAN tag for all 8021q uppers that exist.

We need to ensure that there are no 8021q uppers when the user attempts
to enable bridge vlan_filtering.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: refuse configuration in prepare phase of dsa_port_vlan_filtering()
Vladimir Oltean [Mon, 21 Sep 2020 00:10:27 +0000 (03:10 +0300)]
net: dsa: refuse configuration in prepare phase of dsa_port_vlan_filtering()

The current logic beats me a little bit. The comment that "bridge skips
-EOPNOTSUPP, so skip the prepare phase" was introduced in commit
fb2dabad69f0 ("net: dsa: support VLAN filtering switchdev attr").

I'm not sure:
(a) ok, the bridge skips -EOPNOTSUPP, but, so what, where are we
    returning -EOPNOTSUPP?
(b) even if we are, and I'm just not seeing it, what is the causality
    relationship between the bridge skipping -EOPNOTSUPP and DSA
    skipping the prepare phase, and just returning zero?

One thing is certain beyond doubt though, and that is that DSA currently
refuses VLAN filtering from the "commit" phase instead of "prepare", and
that this is not a good thing:

ip link add br0 type bridge
ip link add br1 type bridge vlan_filtering 1
ip link set swp2 master br0
ip link set swp3 master br1
[ 3790.379389] 001: sja1105 spi0.1: VLAN filtering is a global setting
[ 3790.379399] 001: ------------[ cut here ]------------
[ 3790.379403] 001: WARNING: CPU: 1 PID: 515 at net/switchdev/switchdev.c:157 switchdev_port_attr_set_now+0x9c/0xa4
[ 3790.379420] 001: swp3: Commit of attribute (id=6) failed.
[ 3790.379533] 001: [<c11ff588>] (switchdev_port_attr_set_now) from [<c11b62e4>] (nbp_vlan_init+0x84/0x148)
[ 3790.379544] 001: [<c11b62e4>] (nbp_vlan_init) from [<c11a2ff0>] (br_add_if+0x514/0x670)
[ 3790.379554] 001: [<c11a2ff0>] (br_add_if) from [<c1031b5c>] (do_setlink+0x38c/0xab0)
[ 3790.379565] 001: [<c1031b5c>] (do_setlink) from [<c1036fe8>] (__rtnl_newlink+0x44c/0x748)
[ 3790.379573] 001: [<c1036fe8>] (__rtnl_newlink) from [<c1037328>] (rtnl_newlink+0x44/0x60)
[ 3790.379580] 001: [<c1037328>] (rtnl_newlink) from [<c10315fc>] (rtnetlink_rcv_msg+0x124/0x2f8)
[ 3790.379590] 001: [<c10315fc>] (rtnetlink_rcv_msg) from [<c10926b8>] (netlink_rcv_skb+0xb8/0x110)
[ 3790.379806] 001: ---[ end trace 0000000000000002 ]---
[ 3790.379819] 001: sja1105 spi0.1 swp3: failed to initialize vlan filtering on this port

So move the current logic that may fail (except ds->ops->port_vlan_filtering,
that is way harder) into the prepare stage of the switchdev transaction.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: convert denying bridge VLAN with existing 8021q upper to PRECHANGEUPPER
Vladimir Oltean [Mon, 21 Sep 2020 00:10:26 +0000 (03:10 +0300)]
net: dsa: convert denying bridge VLAN with existing 8021q upper to PRECHANGEUPPER

This is checking for the following order of operations, and makes sure
to deny that configuration:

ip link add link swp2 name swp2.100 type vlan id 100
ip link add br0 type bridge vlan_filtering 1
ip link set swp2 master br0
bridge vlan add dev swp2 vid 100

Instead of using vlan_for_each(), which looks at the VLAN filters
installed with vlan_vid_add(), just track the 8021q uppers. This has the
advantage of freeing up the vlan_vid_add() call for actual VLAN
filtering.

There is another change in this patch. The check is moved in slave.c,
from switch.c. I don't think it makes sense to have this 8021q upper
check for each switch port that gets notified of that VLAN addition
(these include DSA links and CPU ports, we know those can't have 8021q
uppers because they don't have a net_device registered for them), so
just do it in slave.c, for that one slave interface.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: convert check for 802.1Q upper when bridged into PRECHANGEUPPER
Vladimir Oltean [Mon, 21 Sep 2020 00:10:25 +0000 (03:10 +0300)]
net: dsa: convert check for 802.1Q upper when bridged into PRECHANGEUPPER

DSA tries to prevent having a VLAN added by a bridge and by an 802.1Q
upper at the same time. It does that by checking the VID in
.ndo_vlan_rx_add_vid(), since that's something that the 8021q module
calls, via vlan_vid_add(). When a VLAN matches in both subsystems, this
check returns -EBUSY.

However the vlan_vid_add() function isn't specific to the 8021q module
in any way at all. It is simply the kernel's way to tell an interface to
add a VLAN to its RX filter and not drop that VLAN. So there's no reason
to return -EBUSY when somebody tries to call vlan_vid_add() for a VLAN
that was installed by the bridge. The proper behavior is to accept that
configuration.

So what's wrong is how DSA checks that it has an 8021q upper. It should
look at the actual uppers for that, not just assume that the 8021q
module was somewhere in the call stack of .ndo_vlan_rx_add_vid().

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: rename dsa_slave_upper_vlan_check to something more suggestive
Vladimir Oltean [Mon, 21 Sep 2020 00:10:24 +0000 (03:10 +0300)]
net: dsa: rename dsa_slave_upper_vlan_check to something more suggestive

We'll be adding a new check in the PRECHANGEUPPER notifier, where we'll
need to check some VLAN uppers. It is hard to do that when there is
already a function named dsa_slave_upper_vlan_check. So rename this one.

Not to mention that this function probably shouldn't have started with
"dsa_slave_" in the first place, since the struct net_device argument
isn't a DSA slave, but an 8021q upper of one.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: deny enslaving 802.1Q upper to VLAN-aware bridge from PRECHANGEUPPER
Vladimir Oltean [Mon, 21 Sep 2020 00:10:23 +0000 (03:10 +0300)]
net: dsa: deny enslaving 802.1Q upper to VLAN-aware bridge from PRECHANGEUPPER

There doesn't seem to be any strong technical reason for doing it this
way, but we'll be adding more checks for invalid upper device
configurations, and it will be easier to have them all grouped under
PRECHANGEUPPER.

Tested that it still works:
ip link set br0 type bridge vlan_filtering 1
ip link add link swp2 name swp2.100 type vlan id 100
ip link set swp2.100 master br0
[   20.321312] br0: port 5(swp2.100) entered blocking state
[   20.326711] br0: port 5(swp2.100) entered disabled state
Error: dsa_core: Cannot enslave VLAN device into VLAN aware bridge.
[   20.346549] br0: port 5(swp2.100) entered blocking state
[   20.351957] br0: port 5(swp2.100) entered disabled state

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: mventa: remove unused variable 'dummy' in mvneta_mib_counters_clear()
Zhang Changzhong [Sat, 19 Sep 2020 02:26:51 +0000 (10:26 +0800)]
net: mventa: remove unused variable 'dummy' in mvneta_mib_counters_clear()

Fixes the following W=1 kernel build warning(s):

drivers/net/ethernet/marvell/mvneta.c:754:6: warning:
 variable 'dummy' set but not used [-Wunused-but-set-variable]
  754 |  u32 dummy;
      |      ^~~~~

This variable is not used in function mvneta_mib_counters_clear(), so
remove it to avoid build warning.

Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: remove unnecessary NULL checking in napi_consume_skb()
Yunsheng Lin [Sat, 19 Sep 2020 02:24:47 +0000 (10:24 +0800)]
net: remove unnecessary NULL checking in napi_consume_skb()

When budget is non-zero, skb_unref() has already handled the
NULL checking.

When budget is zero, the dev_consume_skb_any() has handled NULL
checking in __dev_kfree_skb_irq(), or dev_kfree_skb() which also
ultimately call skb_unref().

So remove the unnecessary checking in napi_consume_skb().

Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: mvneta: avoid copying shared_info frags in mvneta_swbm_build_skb
Lorenzo Bianconi [Sat, 19 Sep 2020 00:03:26 +0000 (02:03 +0200)]
net: mvneta: avoid copying shared_info frags in mvneta_swbm_build_skb

Avoid copying skb_shared_info frags array in mvneta_swbm_build_skb() since
__build_skb_around() does not overwrite it

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: rtl8366: Skip PVID setting if not requested
Linus Walleij [Fri, 18 Sep 2020 22:29:54 +0000 (00:29 +0200)]
net: dsa: rtl8366: Skip PVID setting if not requested

We go to lengths to determine whether the PVID should be set
for this port or not, and then fail to take it into account.
Fix this oversight.

Fixes: d8652956cf37 ("net: dsa: realtek-smi: Add Realtek SMI driver")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch '100base-Fx-link-modes'
David S. Miller [Sat, 19 Sep 2020 23:54:35 +0000 (16:54 -0700)]
Merge branch '100base-Fx-link-modes'

Dan Murphy says:

====================
100base Fx link modes

As per patch https://lore.kernel.org/patchwork/patch/1300241/ the link
modes for 100base FX full and half duplex modes did not exist.  Adding
these link modes to the core and ethtool allow devices like the
DP83822, DP83869 and Broadcomm PHYs to properly advertise the correct
mode for Fiber 100Mbps.

Corresponding user land ethtool patches are available but rely on
these patches to be applied first.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: dp83822: Update the fiber advertisement for speed
Dan Murphy [Fri, 18 Sep 2020 19:14:53 +0000 (14:14 -0500)]
net: phy: dp83822: Update the fiber advertisement for speed

Update the fiber advertisement for speed and duplex modes with the
100base-FX full and half linkmode entries.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dp83869: Add ability to advertise Fiber connection
Dan Murphy [Fri, 18 Sep 2020 19:14:52 +0000 (14:14 -0500)]
net: dp83869: Add ability to advertise Fiber connection

Add the ability to advertise the Fiber connection if the strap or the
op-mode is configured for 100Base-FX.

Auto negotiation is not supported on this PHY when in fiber mode.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoethtool: Add 100base-FX link mode entries
Dan Murphy [Fri, 18 Sep 2020 19:14:51 +0000 (14:14 -0500)]
ethtool: Add 100base-FX link mode entries

Add entries for the 100base-FX full and half duplex supported modes.

$ ethtool eth0
        Supported ports: [ FIBRE ]
        Supported link modes:  100baseFX/Half 100baseFX/Full
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: No
        Supported FEC modes: Not reported
        Advertised link modes: 100baseFX/Half 100baseFX/Full
        Advertised pause frame use: No
        Advertised auto-negotiation: No
        Advertised FEC modes: Not reported
        Speed: 100Mb/s
        Duplex: Full
        Auto-negotiation: off
        Port: MII
        PHYAD: 1
        Transceiver: external
        Supports Wake-on: gs
        Wake-on: d
        SecureOn password: 00:00:00:00:00:00
        Current message level: 0x00000000 (0)

        Link detected: yes

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/packet: Fix a comment about network_header
Xie He [Fri, 18 Sep 2020 13:56:16 +0000 (06:56 -0700)]
net/packet: Fix a comment about network_header

skb->nh.raw has been renamed as skb->network_header in 2007, in
commit b0e380b1d8a8 ("[SK_BUFF]: unions of just one member don't get
                      anything done, kill them")

So here we change it to the new name.

Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Signed-off-by: Xie He <xie.he.0141@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ethernet: ti: cpsw: use true,false for bool variables
Jason Yan [Sat, 19 Sep 2020 07:46:17 +0000 (15:46 +0800)]
net: ethernet: ti: cpsw: use true,false for bool variables

This addresses the following coccinelle warning:

drivers/net/ethernet/ti/cpsw.c:1599:2-17: WARNING: Assignment of 0/1 to
bool variable
drivers/net/ethernet/ti/cpsw.c:1300:2-17: WARNING: Assignment of 0/1 to
bool variable

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years ago8139too: use true,false for bool variables
Jason Yan [Sat, 19 Sep 2020 07:46:09 +0000 (15:46 +0800)]
8139too: use true,false for bool variables

This addresses the following coccinelle warning:

drivers/net/ethernet/realtek/8139too.c:981:2-8: WARNING: Assignment of
0/1 to bool variable

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agobnx2x: use true,false for bool variables
Jason Yan [Sat, 19 Sep 2020 07:45:56 +0000 (15:45 +0800)]
bnx2x: use true,false for bool variables

This addresses the following coccinelle warning:

drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c:15415:1-26: WARNING:
Assignment of 0/1 to bool variable
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c:12393:2-17: WARNING:
Assignment of 0/1 to bool variable
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c:15497:2-27: WARNING:
Assignment of 0/1 to bool variable

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: qed: use true,false for bool variables
Jason Yan [Sat, 19 Sep 2020 07:45:43 +0000 (15:45 +0800)]
net: qed: use true,false for bool variables

This addresses the following coccinelle warning:

drivers/net/ethernet/qlogic/qed/qed_rdma.c:1465:2-13: WARNING:
Assignment of 0/1 to bool variable
drivers/net/ethernet/qlogic/qed/qed_rdma.c:1468:2-14: WARNING:
Assignment of 0/1 to bool variable
drivers/net/ethernet/qlogic/qed/qed_rdma.c:1471:2-13: WARNING:
Assignment of 0/1 to bool variable
drivers/net/ethernet/qlogic/qed/qed_rdma.c:1472:2-14: WARNING:
Assignment of 0/1 to bool variable

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: b44: use true,false for bool variables
Jason Yan [Sat, 19 Sep 2020 07:45:27 +0000 (15:45 +0800)]
net: b44: use true,false for bool variables

This addresses the following coccinelle warning:

drivers/net/ethernet/broadcom/b44.c:2213:6-20: WARNING: Assignment of
0/1 to bool variable
drivers/net/ethernet/broadcom/b44.c:2218:2-16: WARNING: Assignment of
0/1 to bool variable
drivers/net/ethernet/broadcom/b44.c:2226:3-17: WARNING: Assignment of
0/1 to bool variable
drivers/net/ethernet/broadcom/b44.c:2230:3-17: WARNING: Assignment of
0/1 to bool variable

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: micrel: Remove set but not used variable
Zheng Yongjun [Sat, 19 Sep 2020 02:32:35 +0000 (10:32 +0800)]
net: micrel: Remove set but not used variable

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/net/ethernet/micrel/ksz884x.c: In function rx_proc:
drivers/net/ethernet/micrel/ksz884x.c:4981:6: warning: variable ‘rx_status’ set but not used [-Wunused-but-set-variable]

drivers/net/ethernet/micrel/ksz884x.c: In function netdev_get_ethtool_stats:
drivers/net/ethernet/micrel/ksz884x.c:6512:6: warning: variable ‘rc’ set but not used [-Wunused-but-set-variable]

these variable is never used, so remove it.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: e1000: Remove set but not used variable
Zheng Yongjun [Sat, 19 Sep 2020 01:50:20 +0000 (09:50 +0800)]
net: e1000: Remove set but not used variable

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/net/ethernet/intel/e1000/e1000_hw.c: In function e1000_phy_init_script:
drivers/net/ethernet/intel/e1000/e1000_hw.c:132:6: warning: variable ‘ret_val’ set but not used [-Wunused-but-set-variable]

`ret_val` is never used, so remove it.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: liquidio: Remove set but not used variable
Zheng Yongjun [Sat, 19 Sep 2020 01:31:23 +0000 (09:31 +0800)]
net: liquidio: Remove set but not used variable

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/net/ethernet/cavium/liquidio/octeon_device.c: In function lio_pci_readq:
drivers/net/ethernet/cavium/liquidio/octeon_device.c:1327:6: warning: variable ‘val32’ set but not used [-Wunused-but-set-variable]

drivers/net/ethernet/cavium/liquidio/octeon_device.c: In function lio_pci_writeq:
drivers/net/ethernet/cavium/liquidio/octeon_device.c:1358:6: warning: variable ‘val32’ set but not used [-Wunused-but-set-variable]

these variable is never used, so remove it.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'mv88e6xxx-Add-devlink-regions-support'
David S. Miller [Sat, 19 Sep 2020 01:19:42 +0000 (18:19 -0700)]
Merge branch 'mv88e6xxx-Add-devlink-regions-support'

Andrew Lunn says:

====================
mv88e6xxx: Add devlink regions support

Make use of devlink regions to allow read access to some of the
internal of the switches. Currently access to global1, global2 and the
ATU is provided.

The switch itself will never trigger a region snapshot, it is assumed
it is performed from user space as needed.

v2:
Remove left of debug print
Comment ATU format is generic to mv88e6xxx
Combine declaration and the assignment on a single line.

v3:
Drop support for port regions
Improve the devlink API with a priv member and passing the region to
the snapshot function
Make the helper to convert from devlink to ds an inline function

v4:
Add missing kerneldoc in ICE driver
Fix typo for global2 reading global1 registers
Make use of enum to make code more readable
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: mv88e6xxx: Implement devlink info get callback
Andrew Lunn [Fri, 18 Sep 2020 19:11:09 +0000 (21:11 +0200)]
net: dsa: mv88e6xxx: Implement devlink info get callback

Return the driver name and the asic.id with the switch name.

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: wire up devlink info get
Andrew Lunn [Fri, 18 Sep 2020 19:11:08 +0000 (21:11 +0200)]
net: dsa: wire up devlink info get

Allow the DSA drivers to implement the devlink call to get info info,
e.g. driver name, firmware version, ASIC ID, etc.

v2:
Combine declaration and the assignment on a single line.

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: mv88e6xxx: Add devlink regions
Andrew Lunn [Fri, 18 Sep 2020 19:11:07 +0000 (21:11 +0200)]
net: dsa: mv88e6xxx: Add devlink regions

Allow the global registers, and the ATU to be snapshot via devlink
regions. It is later planned to add support for the port registers.

v2:
Remove left over debug prints
Comment ATU format is generic for mv88e6xxx, not wider

v3:
Make use of ops structure passed to snapshot function
Remove port regions

v4:
Make use of enum mv88e6xxx_region_id
Fix global2/global1 read typ0

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: mv88e6xxx: Create helper for FIDs in use
Andrew Lunn [Fri, 18 Sep 2020 19:11:06 +0000 (21:11 +0200)]
net: dsa: mv88e6xxx: Create helper for FIDs in use

Refactor the code in mv88e6xxx_atu_new() which builds a bitmaps of
FIDs in use into a helper function. This will be reused by the devlink
code when dumping the ATU.

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: mv88e6xxx: Move devlink code into its own file
Andrew Lunn [Fri, 18 Sep 2020 19:11:05 +0000 (21:11 +0200)]
net: dsa: mv88e6xxx: Move devlink code into its own file

There will soon be more devlink code. Move the existing code into a
file of its own, before we start adding this new code.

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: Add devlink regions support to DSA
Andrew Lunn [Fri, 18 Sep 2020 19:11:04 +0000 (21:11 +0200)]
net: dsa: Add devlink regions support to DSA

Allow DSA drivers to make use of devlink regions, via simple wrappers.

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: Add helper to convert from devlink to ds
Andrew Lunn [Fri, 18 Sep 2020 19:11:03 +0000 (21:11 +0200)]
net: dsa: Add helper to convert from devlink to ds

Given a devlink instance, return the dsa switch it is associated to.

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: devlink: region: Pass the region ops to the snapshot function
Andrew Lunn [Fri, 18 Sep 2020 19:11:02 +0000 (21:11 +0200)]
net: devlink: region: Pass the region ops to the snapshot function

Pass the region to be snapshotted to the function performing the
snapshot. This allows one function to operate on numerous regions.

v4:
Add missing kerneldoc for ICE

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: devlink: regions: Add a priv member to the regions ops struct
Andrew Lunn [Fri, 18 Sep 2020 19:11:01 +0000 (21:11 +0200)]
net: devlink: regions: Add a priv member to the regions ops struct

The driver may have multiple regions which can be dumped using one
function. However, for this to work, additional information is
needed. Add a priv member to the ops structure for the driver to use
however it likes.

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'Felix-DSA-driver-cleanup-build-Seville-separately'
David S. Miller [Sat, 19 Sep 2020 00:53:05 +0000 (17:53 -0700)]
Merge branch 'Felix-DSA-driver-cleanup-build-Seville-separately'

Vladimir Oltean says:

====================
Felix DSA driver cleanup: build Seville separately

When introducing the Seville switch support to the Felix driver, some
technical debt was created. Since both VSC9959 and VSC9953 are embedded
switches (one on an arm64 SoC and the other on a powerpc SoC), there is
no use case for having the code for both be present in the same module.

This was necessary at the time due to the common SERDES PCS code that
they were using, but that has been since refactored into
drivers/net/pcs/pcs-lynx.c.

This makes the Seville driver stop uselessly depending upon PCI and
FSL_ENETC_MDIO, which were only dependencies of Felix in fact.

Some whitespace/tab conversions are also present in this series as part
of the cleanup process.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: seville: build as separate module
Vladimir Oltean [Fri, 18 Sep 2020 10:57:53 +0000 (13:57 +0300)]
net: dsa: seville: build as separate module

Seville does not need to depend on PCI or on the ENETC MDIO controller.
There will also be other compile-time differences in the future.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: felix: move the PTP clock structure to felix_vsc9959.c
Vladimir Oltean [Fri, 18 Sep 2020 10:57:52 +0000 (13:57 +0300)]
net: dsa: felix: move the PTP clock structure to felix_vsc9959.c

Not only does Sevile not have a PTP clock, but with separate modules,
this structure cannot even live in felix.c, due to the .owner =
THIS_MODULE assignment causing this link time error:

drivers/net/dsa/ocelot/felix.o:(.data+0x0): undefined reference to `__this_module'

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: mscc: ocelot: make ocelot_init_timestamp take a const struct ptp_clock_info
Vladimir Oltean [Fri, 18 Sep 2020 10:57:51 +0000 (13:57 +0300)]
net: mscc: ocelot: make ocelot_init_timestamp take a const struct ptp_clock_info

It is a good measure to ensure correctness if the structures that are
meant to remain constant are only processed by functions that thake
constant arguments.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: seville: duplicate vsc9959_mdio_bus_free
Vladimir Oltean [Fri, 18 Sep 2020 10:57:50 +0000 (13:57 +0300)]
net: dsa: seville: duplicate vsc9959_mdio_bus_free

While we don't plan on making any changes to this function, currently
this is the only remaining dependency between felix and seville, after
the PCS has been refactored out into pcs-lynx.c.

Duplicate this function in seville to break the dependency completely.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: felix: replace tabs with spaces
Vladimir Oltean [Fri, 18 Sep 2020 10:57:49 +0000 (13:57 +0300)]
net: dsa: felix: replace tabs with spaces

Over the time, some patches have introduced structures aligned with
spaces, near structures aligned with tabs. Fix the inconsistencies.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: seville: reindent defines for MDIO controller
Vladimir Oltean [Fri, 18 Sep 2020 10:57:48 +0000 (13:57 +0300)]
net: dsa: seville: reindent defines for MDIO controller

Reindent these definitions to be in line with the rest of the driver.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: seville: remove unused defines for the mdio controller
Vladimir Oltean [Fri, 18 Sep 2020 10:57:47 +0000 (13:57 +0300)]
net: dsa: seville: remove unused defines for the mdio controller

Some definitions were likely copied from
drivers/net/mdio/mdio-mscc-miim.c.

They are not necessary, remove them.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: ocelot: document why reset procedure is different for felix/seville
Vladimir Oltean [Fri, 18 Sep 2020 10:57:46 +0000 (13:57 +0300)]
net: dsa: ocelot: document why reset procedure is different for felix/seville

The overall idea (issue soft reset, enable memories, initialize
memories, enable core) is the same, so it would make sense that an
attempt is made to unify the procedures.

It is not immediately obvious that the fields are not part of the same
register targets, though. So add a comment.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: seville: first enable memories, then initialize them
Vladimir Oltean [Fri, 18 Sep 2020 10:57:45 +0000 (13:57 +0300)]
net: dsa: seville: first enable memories, then initialize them

As per documentation, proper startup sequence is:
* Enable memories
* Initialize memories
* Enable core

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: seville: don't write to MEM_ENA twice
Vladimir Oltean [Fri, 18 Sep 2020 10:57:44 +0000 (13:57 +0300)]
net: dsa: seville: don't write to MEM_ENA twice

There is another one of these right above the readx_poll_status.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: felix: use ocelot_field_{read,write} helpers consistently
Vladimir Oltean [Fri, 18 Sep 2020 10:57:43 +0000 (13:57 +0300)]
net: dsa: felix: use ocelot_field_{read,write} helpers consistently

Since these helpers for regmap fields are available, use them.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'ptp_qoriq-support-FIPER3'
David S. Miller [Sat, 19 Sep 2020 00:49:20 +0000 (17:49 -0700)]
Merge branch 'ptp_qoriq-support-FIPER3'

Yangbo Lu says:

====================
ptp_qoriq: support FIPER3

The FIPER3 (fixed interval period pulse generator) is supported on
DPAA2 and ENETC network controller hardware. This patch-set is to
support it in ptp_qoriq driver and dt-binding.

Changes for v2:
- Some improvement in code.
- Added ACK from Vladimir.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoptp_qoriq: support FIPER3
Yangbo Lu [Fri, 18 Sep 2020 09:48:01 +0000 (17:48 +0800)]
ptp_qoriq: support FIPER3

The FIPER3 (fixed interval period pulse generator) is supported on
DPAA2 and ENETC network controller hardware. This patch is to support
it in ptp_qoriq driver.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Acked-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodt-binding: ptp_qoriq: support fsl,tmr-fiper3 property
Yangbo Lu [Fri, 18 Sep 2020 09:48:00 +0000 (17:48 +0800)]
dt-binding: ptp_qoriq: support fsl,tmr-fiper3 property

Add fsl,tmr-fiper3 property definition which is supported only
on DPAA2 and ENETC network controller hardware.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-ipa-wake-up-system-on-RX-available'
David S. Miller [Sat, 19 Sep 2020 00:47:07 +0000 (17:47 -0700)]
Merge branch 'net-ipa-wake-up-system-on-RX-available'

Alex Elder says:

====================
net: ipa: wake up system on RX available

This series arranges for the IPA driver to wake up a suspended
system if the IPA hardware has a packet to deliver to the AP.

Version 2 replaced the first patch from version 1 with three
patches, in response to David Miller's feedback.  And based on
Bjorn Andersson's feedback on version 2, this version reworks
the tracking of IPA clock references.  As a result, we no
longer need a flag to determine whether a "don't' suspend" clock
reference is held (though an bit in a bitmask is still used for
a different purpose).

In summary:
    - A refcount_t is used to track IPA clock references where an
      atomic_t was previously used.  (This may go away soon as well,
      with upcoming work to implement runtime PM.)
    - We no longer track whether a special reference has been taken
      to avoid suspending IPA.
    - A bit in a bitmask is used to ensure we only trigger a system
      resume once per system suspend.
And from the original series:
    - Suspending endpoints only occurs when suspending the driver,
      not when dropping the last clock reference.  Resuming
      endpoints is also disconnected from starting the clock.
    - The IPA SUSPEND interrupt is now a wakeup interrupt.  If it
      fires, it schedules a system resume operation.
    - The GSI interrupt is no longer a wakeup interrupt.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: do not enable GSI interrupt for wakeup
Alex Elder [Thu, 17 Sep 2020 17:39:26 +0000 (12:39 -0500)]
net: ipa: do not enable GSI interrupt for wakeup

We now trigger a system resume when we receive an IPA SUSPEND
interrupt.  We should *not* wake up on GSI interrupts.

Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: enable wakeup on IPA interrupt
Alex Elder [Thu, 17 Sep 2020 17:39:25 +0000 (12:39 -0500)]
net: ipa: enable wakeup on IPA interrupt

Now that we handle wakeup interrupts properly, arrange for the IPA
interrupt to be treated as a wakeup interrupt.

Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: repurpose CLOCK_HELD flag
Alex Elder [Thu, 17 Sep 2020 17:39:24 +0000 (12:39 -0500)]
net: ipa: repurpose CLOCK_HELD flag

The previous patch causes a system resume to be triggered when a
packet is available for receipt on a suspended RX endpoint.

The CLOCK_HELD flag was previously used to indicate that an extra
clock reference was held, preventing suspend.  But we no longer need
such a flag:
  - We take an initial reference in ipa_config().
  - That reference is held until ipa_suspend() releases it.
  - A subsequent system resume leads to a reference getting
    re-acquired in ipa_resume().
  - This can repeat until ultimately the module is removed, where
    ipa_remove() releases the reference.
We no longer need a special flag to determine whether this extra
reference is held--it is, provided probe has completed successfully
and the driver is not suspended (or removed).

On the other hand, once suspended, it's possible for more than one
endpoint to trip the IPA SUSPEND interrupt, and we only want to
trigger the system resume once.  So repurpose the Boolean CLOCK_HELD
flag to record whether the IPA SUSPEND handler should initiate a
system resume.

The flag will be be cleared each time ipa_suspend() is called,
*before* any endpoints are suspended.  And it will be set inside the
IPA SUSPEND interrupt handler exactly once per suspend.

Rename the flag IPA_FLAG_RESUMED to reflect its new purpose.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: use device_init_wakeup()
Alex Elder [Thu, 17 Sep 2020 17:39:23 +0000 (12:39 -0500)]
net: ipa: use device_init_wakeup()

The call to wakeup_source_register() in ipa_probe() does not do what
it was intended to do.  Call device_init_wakeup() in ipa_setup()
instead, to set the IPA device as wakeup-capable and to initially
enable wakeup capability.

When we receive a SUSPEND interrupt, call pm_wakeup_dev_event()
with a zero processing time, to simply call for a resume without
any other processing.  The ipa_resume() call will take care of
waking things up again, and will handle receiving the packet.

Note that this gets rid of a clock reference counting bug that
occurred when handling an IPA SUSPEND interrupt.  Specifically,
ipa_suspend_handler() took an IPA clock reference *in addition*
to the one taken by ipa_resume().  There is no need to back-port
this fix however, because it only affects code that was not
previously working (this patch is part of fixing that).

Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: manage endpoints separate from clock
Alex Elder [Thu, 17 Sep 2020 17:39:22 +0000 (12:39 -0500)]
net: ipa: manage endpoints separate from clock

Currently, when (before) the last IPA clock reference is dropped,
all endpoints are suspended.  And whenever the first IPA clock
reference is taken, all endpoints are resumed (or started).

In most cases there's no need to start endpoints when the clock
starts.  So move the calls to ipa_endpoint_suspend() and
ipa_endpoint_resume() out of ipa_clock_put() and ipa_clock_get(),
respectiely.  Instead, only suspend endpoints when handling a system
suspend, and only resume endpoints when handling a system resume.

Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: replace ipa->suspend_ref with a flag bit
Alex Elder [Thu, 17 Sep 2020 17:39:21 +0000 (12:39 -0500)]
net: ipa: replace ipa->suspend_ref with a flag bit

We take a clock reference in ipa_config() in order to prevent the
the IPA clock from being shutdown until a power management suspend
request arrives.  An atomic field in the IPA structure records
whether that extra reference had been taken.

Rather than using an atomic to represent a Boolean value, define
a new flags bitmap, and define a "clock held" flag to represent
whether the extra clock reference has been taken.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: use refcount_t for IPA clock reference count
Alex Elder [Thu, 17 Sep 2020 17:39:20 +0000 (12:39 -0500)]
net: ipa: use refcount_t for IPA clock reference count

Take advantage of the checking provided by refcount_t, rather than
using a plain atomic to represent the IPA clock reference count.

Note that we need to *set* the value to 1 in ipa_clock_get() rather
than incrementing it from 0 (because doing that is considered an
error for a refcount_t).

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: bcm7xxx: request and manage GPHY clock
Florian Fainelli [Thu, 17 Sep 2020 02:04:13 +0000 (19:04 -0700)]
net: phy: bcm7xxx: request and manage GPHY clock

The internal Gigabit PHY on Broadcom STB chips has a digital clock which
drives its MDIO interface among other things, the driver now requests
and manage that clock during .probe() and .remove() accordingly.

Because the PHY driver can be probed with the clocks turned off we need
to apply the dummy BMSR workaround during the driver probe function to
ensure subsequent MDIO read or write towards the PHY will succeed.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: tipc: Supply missing udp_media.h include file
Wang Hai [Fri, 18 Sep 2020 13:18:19 +0000 (21:18 +0800)]
net: tipc: Supply missing udp_media.h include file

If the header file containing a function's prototype isn't included by
the sourcefile containing the associated function, the build system
complains of missing prototypes.

Fixes the following W=1 kernel build warning(s):

net/tipc/udp_media.c:446:5: warning: no previous prototype for ‘tipc_udp_nl_dump_remoteip’ [-Wmissing-prototypes]
net/tipc/udp_media.c:532:5: warning: no previous prototype for ‘tipc_udp_nl_add_bearer_data’ [-Wmissing-prototypes]
net/tipc/udp_media.c:614:5: warning: no previous prototype for ‘tipc_udp_nl_bearer_add’ [-Wmissing-prototypes]

Signed-off-by: Wang Hai <wanghai38@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotipc: Remove unused macro CF_SERVER
YueHaibing [Fri, 18 Sep 2020 13:16:15 +0000 (21:16 +0800)]
tipc: Remove unused macro CF_SERVER

It is no used any more, so can remove it.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: Supply missing hclge_dcb.h include file
Wang Hai [Fri, 18 Sep 2020 13:06:53 +0000 (21:06 +0800)]
net: hns3: Supply missing hclge_dcb.h include file

If the header file containing a function's prototype isn't included by
the sourcefile containing the associated function, the build system
complains of missing prototypes.

Fixes the following W=1 kernel build warning(s):

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c:453:6: warning: no previous prototype for ‘hclge_dcb_ops_set’ [-Wmissing-prototypes]

Signed-off-by: Wang Hai <wanghai38@huawei.com>
Reviewed-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/appletalk: Supply missing net/Space.h include file
Wang Hai [Fri, 18 Sep 2020 12:55:51 +0000 (20:55 +0800)]
net/appletalk: Supply missing net/Space.h include file

If the header file containing a function's prototype isn't included by
the sourcefile containing the associated function, the build system
complains of missing prototypes.

Fixes the following W=1 kernel build warning(s):

drivers/net/appletalk/cops.c:213:28: warning: no previous prototype for ‘cops_probe’ [-Wmissing-prototypes]
drivers/net/appletalk/ltpc.c:1014:28: warning: no previous prototype for ‘ltpc_probe’ [-Wmissing-prototypes]

Signed-off-by: Wang Hai <wanghai38@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoliquidio: Fix -Wmissing-prototypes warnings for liquidio
Wang Hai [Fri, 18 Sep 2020 13:02:10 +0000 (21:02 +0800)]
liquidio: Fix -Wmissing-prototypes warnings for liquidio

If the header file containing a function's prototype isn't included by
the sourcefile containing the associated function, the build system
complains of missing prototypes.

Fixes the following W=1 kernel build warning(s):

drivers/net/ethernet/cavium/liquidio/cn68xx_device.c:124:5: warning: no previous prototype for ‘lio_setup_cn68xx_octeon_device’ [-Wmissing-prototypes]
drivers/net/ethernet/cavium/liquidio/octeon_mem_ops.c:159:1: warning: no previous prototype for ‘octeon_pci_read_core_mem’ [-Wmissing-prototypes]
drivers/net/ethernet/cavium/liquidio/octeon_mem_ops.c:168:1: warning: no previous prototype for ‘octeon_pci_write_core_mem’ [-Wmissing-prototypes]
drivers/net/ethernet/cavium/liquidio/octeon_mem_ops.c:176:5: warning: no previous prototype for ‘octeon_read_device_mem64’ [-Wmissing-prototypes]
drivers/net/ethernet/cavium/liquidio/octeon_mem_ops.c:185:5: warning: no previous prototype for ‘octeon_read_device_mem32’ [-Wmissing-prototypes]
drivers/net/ethernet/cavium/liquidio/octeon_mem_ops.c:194:6: warning: no previous prototype for ‘octeon_write_device_mem32’ [-Wmissing-prototypes]

Signed-off-by: Wang Hai <wanghai38@huawei.com>
Reviewed-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agol2tp: fix up inconsistent rx/tx statistics
Tom Parkin [Fri, 18 Sep 2020 10:23:21 +0000 (11:23 +0100)]
l2tp: fix up inconsistent rx/tx statistics

Historically L2TP core statistics count the L2TP header in the
per-session and per-tunnel byte counts tracked for transmission and
receipt.

Now that l2tp_xmit_skb updates tx stats, it is necessary for
l2tp_xmit_core to pass out the length of the transmitted packet so that
the statistics can be updated correctly.

Signed-off-by: Tom Parkin <tparkin@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agohinic: modify irq name
Luo bin [Fri, 18 Sep 2020 09:23:22 +0000 (17:23 +0800)]
hinic: modify irq name

Make a distinction between different irqs by netdev name or pci name.

Signed-off-by: Luo bin <luobin9@huawei.com>
Reviewed-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: cortina: Remove set but not used variable
Zheng Yongjun [Fri, 18 Sep 2020 08:49:51 +0000 (16:49 +0800)]
net: cortina: Remove set but not used variable

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/net/ethernet/cortina/gemini.c: In function gmac_get_ringparam:
drivers/net/ethernet/cortina/gemini.c:2125:21: warning: variable ‘config0’ set but not used [-Wunused-but-set-variable]

drivers/net/ethernet/cortina/gemini.c: In function gmac_init:
drivers/net/ethernet/cortina/gemini.c:512:6: warning: variable ‘val’ set but not used [-Wunused-but-set-variable]

these variable is never used, so remove it.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'dpaa2_eth-support-1588-one-step-timestamping'
David S. Miller [Fri, 18 Sep 2020 21:32:48 +0000 (14:32 -0700)]
Merge branch 'dpaa2_eth-support-1588-one-step-timestamping'

Yangbo Lu says:

====================
dpaa2_eth: support 1588 one-step timestamping

This patch-set is to add MC APIs of 1588 one-step timestamping, and
support one-step timestamping for PTP Sync packet on DPAA2.

Before egress, one-step timestamping enablement needs,

- Enabling timestamp and FAS (Frame Annotation Status) in
  dpni buffer layout.

- Write timestamp to frame annotation and set PTP bit in
  FAS to mark as one-step timestamping event.

- Enabling one-step timestamping by dpni_set_single_step_cfg()
  API, with offset provided to insert correction time on frame.
  The offset must respect all MAC headers, VLAN tags and other
  protocol headers accordingly. The correction field update can
  consider delays up to one second. So PTP frame needs to be
  filtered and parsed, and written timestamp into Sync frame
  originTimestamp field.

The operation of API dpni_set_single_step_cfg() has to be done
when no one-step timestamping frames are in flight. So we have
to make sure the last one-step timestamping frame has already
been transmitted on hardware before starting to send the current
one. The resolution is,

- Utilize skb->cb[0] to mark timestamping request per packet.
  If it is one-step timestamping PTP sync packet, queue to skb queue.
  If not, transmit immediately.

- Schedule a work to transmit skbs in skb queue.

- mutex lock is used to ensure the last one-step timestamping packet
  has already been transmitted on hardware through TX confirmation queue
  before transmitting current packet.

Changes for v2:
- Removed unused variable priv in dpaa2_eth_xdp_create_fd().
Changes for v3:
- Fixed sparse warnings.
- Fix build issue on 32-bit.
- Converted to use ptp_parse_header.
Changes for v4:
- Used WARN_ONCE instead of netdev_err in data path.
- Enabled timestamping only when PTP driver is ready.
- Added comments in using onestep_tstamp_lock.
- Dropped dpmac.c sparse warning fix-up patch.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodpaa2-eth: support PTP Sync packet one-step timestamping
Yangbo Lu [Fri, 18 Sep 2020 09:08:02 +0000 (17:08 +0800)]
dpaa2-eth: support PTP Sync packet one-step timestamping

This patch is to add PTP sync packet one-step timestamping support.
Before egress, one-step timestamping enablement needs,

- Enabling timestamp and FAS (Frame Annotation Status) in
  dpni buffer layout.

- Write timestamp to frame annotation and set PTP bit in
  FAS to mark as one-step timestamping event.

- Enabling one-step timestamping by dpni_set_single_step_cfg()
  API, with offset provided to insert correction time on frame.
  The offset must respect all MAC headers, VLAN tags and other
  protocol headers accordingly. The correction field update can
  consider delays up to one second. So PTP frame needs to be
  filtered and parsed, and written timestamp into Sync frame
  originTimestamp field.

The operation of API dpni_set_single_step_cfg() has to be done
when no one-step timestamping frames are in flight. So we have
to make sure the last one-step timestamping frame has already
been transmitted on hardware before starting to send the current
one. The resolution is,

- Utilize skb->cb[0] to mark timestamping request per packet.
  If it is one-step timestamping PTP sync packet, queue to skb queue.
  If not, transmit immediately.

- Schedule a work to transmit skbs in skb queue.

- mutex lock is used to ensure the last one-step timestamping packet
  has already been transmitted on hardware through TX confirmation queue
  before transmitting current packet.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodpaa2-eth: utilize skb->cb[0] for hardware timestamping
Yangbo Lu [Fri, 18 Sep 2020 09:08:01 +0000 (17:08 +0800)]
dpaa2-eth: utilize skb->cb[0] for hardware timestamping

This patch is a preparation for next hardware one-step timestamping
support. For DPAA2, the one step timestamping configuration on
hardware registers has to be done when there is no one-step timestamping
packet in flight. So we will have to use workqueue and skb queue
for such packets transmitting, to make sure waiting the last packet has
already been sent on hardware, and starting to transmit the current one.

So the tx timestamping flag in private data may not reflect the actual
request for the one-step timestamping packets of skb queue. This also
affects skb headroom allocation. Let's use skb->cb[0] to mark the
timestamping request for each skb.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodpaa2-eth: invoke dpaa2_eth_enable_tx_tstamp() once in code
Yangbo Lu [Fri, 18 Sep 2020 09:08:00 +0000 (17:08 +0800)]
dpaa2-eth: invoke dpaa2_eth_enable_tx_tstamp() once in code

Invoke dpaa2_eth_enable_tx_tstamp() once in code after building FD,
rather than calling it in dpaa2_eth_build_single_fd(),
dpaa2_eth_build_sg_fd_single_buf(), and dpaa2_eth_build_sg_fd().

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodpaa2-eth: define a global ptp_qoriq structure pointer
Yangbo Lu [Fri, 18 Sep 2020 09:07:59 +0000 (17:07 +0800)]
dpaa2-eth: define a global ptp_qoriq structure pointer

Define a global ptp_qoriq structure pointer, and export to use.
The ptp clock operations will be used in dpaa2-eth driver.
For example, supporting one step timestamping needs to write
current time to hardware frame annotation before sending and
then hardware inserts the delay time on frame during sending.
So in driver, at least clock gettime operation will be needed
to make sure right time is written to hardware frame annotation
for one step timestamping.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodpaa2-eth: add APIs of 1588 single step timestamping
Yangbo Lu [Fri, 18 Sep 2020 09:07:58 +0000 (17:07 +0800)]
dpaa2-eth: add APIs of 1588 single step timestamping

This patch is to add APIs of 1588 single step timestamping.

- dpni_set_single_step_cfg
- dpni_get_single_step_cfg

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: openswitch: reuse the helper variable to improve the code readablity
Zeng Tao [Fri, 18 Sep 2020 07:14:30 +0000 (15:14 +0800)]
net: openswitch: reuse the helper variable to improve the code readablity

In the function ovs_ct_limit_exit, there is already a helper vaibale
which could be reused to improve the readability, so i fix it in this
patch.

Signed-off-by: Zeng Tao <prime.zeng@hisilicon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: fix build without CONFIG_SYSCTL definition
Mahesh Bandewar [Fri, 18 Sep 2020 05:08:32 +0000 (22:08 -0700)]
net: fix build without CONFIG_SYSCTL definition

Earlier commit 316cdaa1158a ("net: add option to not create fall-back
tunnels in root-ns as well") removed the CONFIG_SYSCTL to enable the
kernel-commandline to work. However, this variable gets defined only
when CONFIG_SYSCTL option is selected.

With this change the behavior would default to creating fall-back
tunnels in all namespaces when CONFIG_SYSCTL is not selected and
the kernel commandline option will be ignored.

Fixes: 316cdaa1158a ("net: add option to not create fall-back tunnels in root-ns as well")
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: kernel test robot <lkp@intel.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-various-delete-duplicated-words'
David S. Miller [Fri, 18 Sep 2020 21:12:43 +0000 (14:12 -0700)]
Merge branch 'net-various-delete-duplicated-words'

Randy Dunlap says:

====================
net: various: delete duplicated words

[PATCH 1/7 net-next] net: core: delete duplicated words
[PATCH 2/7 net-next] net: rds: delete duplicated words
[PATCH 3/7 net-next] net: ipv6: delete duplicated words
[PATCH 4/7 net-next] net: bluetooth: delete duplicated words
[PATCH 5/7 net-next] net: tipc: delete duplicated words
[PATCH 6/7 net-next] net: atm: delete duplicated words
[PATCH 7/7 net-next] net: bridge: delete duplicated words
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: bridge: delete duplicated words
Randy Dunlap [Fri, 18 Sep 2020 04:35:21 +0000 (21:35 -0700)]
net: bridge: delete duplicated words

Drop repeated words in net/bridge/.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Roopa Prabhu <roopa@nvidia.com>
Cc: Nikolay Aleksandrov <nikolay@nvidia.com>
Cc: bridge@lists.linux-foundation.org
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: atm: delete duplicated words
Randy Dunlap [Fri, 18 Sep 2020 04:35:20 +0000 (21:35 -0700)]
net: atm: delete duplicated words

Drop repeated words in net/atm/.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Chas Williams <3chas3@gmail.com>
Cc: linux-atm-general@lists.sourceforge.net
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: tipc: delete duplicated words
Randy Dunlap [Fri, 18 Sep 2020 04:35:19 +0000 (21:35 -0700)]
net: tipc: delete duplicated words

Drop repeated words in net/tipc/.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Jon Maloy <jmaloy@redhat.com>
Cc: Ying Xue <ying.xue@windriver.com>
Cc: tipc-discussion@lists.sourceforge.net
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: bluetooth: delete duplicated words
Randy Dunlap [Fri, 18 Sep 2020 04:35:18 +0000 (21:35 -0700)]
net: bluetooth: delete duplicated words

Drop repeated words in net/bluetooth/.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipv6: delete duplicated words
Randy Dunlap [Fri, 18 Sep 2020 04:35:17 +0000 (21:35 -0700)]
net: ipv6: delete duplicated words

Drop repeated words in net/ipv6/.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: rds: delete duplicated words
Randy Dunlap [Fri, 18 Sep 2020 04:35:16 +0000 (21:35 -0700)]
net: rds: delete duplicated words

Drop repeated words in net/rds/.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Cc: linux-rdma@vger.kernel.org
Cc: rds-devel@oss.oracle.com
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: core: delete duplicated words
Randy Dunlap [Fri, 18 Sep 2020 04:35:15 +0000 (21:35 -0700)]
net: core: delete duplicated words

Drop repeated words in net/core/.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoRevert "ibmvnic: remove never executed if statement"
Lijun Pan [Fri, 18 Sep 2020 02:12:46 +0000 (21:12 -0500)]
Revert "ibmvnic: remove never executed if statement"

This reverts commit 550f4d46aff6fe57c9b1c6719c3c9de2237d7ac2.

adapter->from_passive_init may be changed in ibmvnic_handle_crq
while ibmvnic_reset_init is waiting for the completion of
adapter->init_done.

Signed-off-by: Lijun Pan <ljp@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'tipc-add-more-features-to-TIPC-encryption'
David S. Miller [Fri, 18 Sep 2020 20:58:37 +0000 (13:58 -0700)]
Merge branch 'tipc-add-more-features-to-TIPC-encryption'

Tuong Lien says:

====================
tipc: add more features to TIPC encryption

This series adds some new features to TIPC encryption:

- Patch 1 ("tipc: optimize key switching time and logic") optimizes the
code and logic in preparation for the following commits.

- Patch 2 ("tipc: introduce encryption master key") introduces support
of 'master key' for authentication of new nodes and key exchange. A
master key can be set/changed by user via netlink (eg. using the same
'tipc node set key' command in iproute2/tipc).

- Patch 3 ("tipc: add automatic session key exchange") allows a session
key to be securely exchanged between nodes as needed.

- Patch 4 ("tipc: add automatic rekeying for encryption key") adds
automatic 'rekeying' of session keys a specific interval. The new key
will be distributed automatically to peer nodes, so become active then.
The rekeying interval is configurable via netlink as well.

v2: update the "tipc: add automatic session key exchange" patch to fix
"implicit declaration" issue when built without "CONFIG_TIPC_CRYPTO".

v3: update the patches according to David comments by using the
"genl_info->extack" for messages in response to netlink user config
requests.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotipc: add automatic rekeying for encryption key
Tuong Lien [Fri, 18 Sep 2020 01:17:29 +0000 (08:17 +0700)]
tipc: add automatic rekeying for encryption key

Rekeying is required for security since a key is less secure when using
for a long time. Also, key will be detached when its nonce value (or
seqno ...) is exhausted. We now make the rekeying process automatic and
configurable by user.

Basically, TIPC will at a specific interval generate a new key by using
the kernel 'Random Number Generator' cipher, then attach it as the node
TX key and securely distribute to others in the cluster as RX keys (-
the key exchange). The automatic key switching will then take over, and
make the new key active shortly. Afterwards, the traffic from this node
will be encrypted with the new session key. The same can happen in peer
nodes but not necessarily at the same time.

For simplicity, the automatically generated key will be initiated as a
per node key. It is not too hard to also support a cluster key rekeying
(e.g. a given node will generate a unique cluster key and update to the
others in the cluster...), but that doesn't bring much benefit, while a
per-node key is even more secure.

We also enable user to force a rekeying or change the rekeying interval
via netlink, the new 'set key' command option: 'TIPC_NLA_NODE_REKEYING'
is added for these purposes as follows:
- A value >= 1 will be set as the rekeying interval (in minutes);
- A value of 0 will disable the rekeying;
- A value of 'TIPC_REKEYING_NOW' (~0) will force an immediate rekeying;

The default rekeying interval is (60 * 24) minutes i.e. done every day.
There isn't any restriction for the value but user shouldn't set it too
small or too large which results in an "ineffective" rekeying (thats ok
for testing though).

Acked-by: Jon Maloy <jmaloy@redhat.com>
Signed-off-by: Tuong Lien <tuong.t.lien@dektech.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>