platform/kernel/linux-starfive.git
4 years agoMerge tag 'wireless-drivers-next-2020-03-27' of git://git.kernel.org/pub/scm/linux...
David S. Miller [Fri, 27 Mar 2020 22:40:24 +0000 (15:40 -0700)]
Merge tag 'wireless-drivers-next-2020-03-27' of git://git./linux/kernel/git/kvalo/wireless-drivers-next

Kalle Valo says:

====================
wireless-drivers-next patches for v5.7

Third set of patches for v5.7. Nothing really special this time,
business as usual.

When pulling this to net-next there's again a conflict in:

drivers/net/wireless/intel/iwlwifi/pcie/drv.c

To solve this drop these three lines from the conflict (the first hunk
from "HEAD") as the whole AX200 block was moved above in the same
file:

IWL_DEV_INFO(0x2723, 0x1653, iwl_ax200_cfg_cc, iwl_ax200_killer_1650w_name),
IWL_DEV_INFO(0x2723, 0x1654, iwl_ax200_cfg_cc, iwl_ax200_killer_1650x_name),
IWL_DEV_INFO(0x2723, IWL_CFG_ANY, iwl_ax200_cfg_cc, iwl_ax200_name),

And keep all the __IWL_DEV_INFO() entries (the second hunk). In other
words, take everything from wireless-drivers-next. When running 'git
diff' after the resolution the output should be empty.

Major changes:

brcmfmac

* add USB autosuspend support

ath11k

* handle RX fragments

* enable PN offload

* add support for HE BSS color

iwlwifi

* support new FW API version

* support for EDCA measurements

* new scan API features

* enable new firmware debugging code
====================

Kalle gave me directions on how to resolve the iwlwifi conflict
as follows:

====================
When pulling this to net-next there's again a conflict in:

drivers/net/wireless/intel/iwlwifi/pcie/drv.c

To solve this drop these three lines from the conflict (the first hunk
from "HEAD") as the whole AX200 block was moved above in the same
file:

IWL_DEV_INFO(0x2723, 0x1653, iwl_ax200_cfg_cc, iwl_ax200_killer_1650w_name),
IWL_DEV_INFO(0x2723, 0x1654, iwl_ax200_cfg_cc, iwl_ax200_killer_1650x_name),
IWL_DEV_INFO(0x2723, IWL_CFG_ANY, iwl_ax200_cfg_cc, iwl_ax200_name),

And keep all the __IWL_DEV_INFO() entries (the second hunk). In other
words, take everything from wireless-drivers-next. When running 'git
diff' after the resolution the output should be empty.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 's390-qeth-next'
David S. Miller [Fri, 27 Mar 2020 22:36:57 +0000 (15:36 -0700)]
Merge branch 's390-qeth-next'

Julian Wiedmann says:

====================
s390/qeth: updates 2020-03-27

please apply the following patch series for qeth to netdev's net-next
tree.

Spring clean edition:
- remove one sysfs attribute that was never put in use,
- make support for OSN and OSX devices optional, and
- probe for removal of the obsolete OSN support.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agos390/qeth: phase out OSN support
Julian Wiedmann [Fri, 27 Mar 2020 10:19:34 +0000 (11:19 +0100)]
s390/qeth: phase out OSN support

OSN devices currently spend an awful long time in qeth_l2_set_online()
until various unsupported HW cmds time out. This has been broken for
over two years, ever since
commit d22ffb5a712f ("s390/qeth: fix IPA command submission race")
triggered a FW bug in cmd processing.
Prior to commit 782e4a792147 ("s390/qeth: don't poll for cmd IO completion"),
this wait for timeout would have even been spent busy-polling.

The offending patch was picked up by stable and all relevant distros,
and yet noone noticed.
OSN setups only ever worked in combination with an out-of-tree blob, and
the last machine that even offered HW with OSN support was released back
in 2015.

Rather than attempting to work-around this FW issue for no actual gain,
add a deprecation warning so anyone who still wants to maintain this
part of the code can speak up. Else rip it all out in 2021.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agos390/qeth: make OSN / OSX support configurable
Julian Wiedmann [Fri, 27 Mar 2020 10:19:33 +0000 (11:19 +0100)]
s390/qeth: make OSN / OSX support configurable

The last machine generation that supports OSN is z13, and OSX is only
supported up to z14. Allow users and distros to decide whether they
still need support for these device types.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agos390/qeth: remove fake_broadcast attribute
Julian Wiedmann [Fri, 27 Mar 2020 10:19:32 +0000 (11:19 +0100)]
s390/qeth: remove fake_broadcast attribute

Ever since commit 4a71df50047f ("qeth: new qeth device driver") introduced
this attribute, it can be read & written but has no actual effect.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'bnxt_en-Updates-to-devlink-info_get-cb'
David S. Miller [Fri, 27 Mar 2020 22:34:43 +0000 (15:34 -0700)]
Merge branch 'bnxt_en-Updates-to-devlink-info_get-cb'

Vasundhara Volam says:

====================
bnxt_en: Updates to devlink info_get cb

This series adds support for a generic macro to devlink info_get cb.
Adds support for fw.mgmt.api and board.id info to bnxt_en driver info_get
cb. Also, updates the devlink-info.rst and bnxt.rst documentation
accordingly.

This series adds a patch to fix few macro names that maps to bnxt_en
firmware versions.

v1->v2: Remove ECN dev param, base_mh_addr and serial number info support
in this series.
Rename drv.spec macro to fw.api.
---
v2->v3: Remove hw.addr info as it is per netdev but not per device info.
---
v3->v4: Rename "fw.api" to "fw.mgmt.api".
Also, add a patch that modifies few macro names in info_get command,
to match the devlink documentation.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agobnxt_en: Fix "fw.mgmt" and "fw.nsci" info via devlink info_get cb
Vasundhara Volam [Fri, 27 Mar 2020 09:35:51 +0000 (15:05 +0530)]
bnxt_en: Fix "fw.mgmt" and "fw.nsci" info via devlink info_get cb

Fix macro names to report fw.mgmt and fw.ncsi versions to match the
devlink documentation.

Example display after fixes:

$ devlink dev info pci/0000:af:00.0
pci/0000:af:00.0:
  driver bnxt_en
  serial_number B0-26-28-FF-FE-25-84-20
  versions:
      fixed:
        board.id BCM957454A4540
        asic.id C454
        asic.rev 1
      running:
        fw 216.1.154.0
        fw.psid 0.0.0
        fw.mgmt 216.1.146.0
        fw.mgmt.api 1.10.1
        fw.ncsi 864.0.44.0
        fw.roce 216.1.16.0

Fixes: 9599e036b161 ("bnxt_en: Add support for devlink info command")
Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agobnxt_en: Add partno to devlink info_get cb
Vasundhara Volam [Fri, 27 Mar 2020 09:35:50 +0000 (15:05 +0530)]
bnxt_en: Add partno to devlink info_get cb

Add part number info from the vital product data to info_get command
via devlink tool. Update bnxt.rst documentation as well.

Cc: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agobnxt_en: Read partno and serialno of the board from VPD
Vasundhara Volam [Fri, 27 Mar 2020 09:35:49 +0000 (15:05 +0530)]
bnxt_en: Read partno and serialno of the board from VPD

Store the part number and serial number information from VPD in
the bnxt structure. Follow up patch will add the support to display
the information via devlink command.

Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoPCI: Add new PCI_VPD_RO_KEYWORD_SERIALNO macro
Vasundhara Volam [Fri, 27 Mar 2020 09:35:32 +0000 (15:05 +0530)]
PCI: Add new PCI_VPD_RO_KEYWORD_SERIALNO macro

This patch adds a new macro for serial number keyword.

Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agobnxt_en: Add fw.mgmt.api version to devlink info_get cb.
Vasundhara Volam [Fri, 27 Mar 2020 09:34:52 +0000 (15:04 +0530)]
bnxt_en: Add fw.mgmt.api version to devlink info_get cb.

Display the minimum version of firmware interface spec supported
between driver and firmware. Also update bnxt.rst documentation file.

Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: Add macro for "fw.mgmt.api" to info_get cb.
Vasundhara Volam [Fri, 27 Mar 2020 09:34:51 +0000 (15:04 +0530)]
devlink: Add macro for "fw.mgmt.api" to info_get cb.

Add definition and documentation for the new generic info
"fw.mgmt.api". This macro specifies the version of the software
interfaces between driver and firmware.

Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Jacob Keller <jacob.e.keller@intel.com>
Cc: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'mlxsw-Various-static-checkers-fixes'
David S. Miller [Fri, 27 Mar 2020 22:06:50 +0000 (15:06 -0700)]
Merge branch 'mlxsw-Various-static-checkers-fixes'

Ido Schimmel says:

====================
mlxsw: Various static checkers fixes

Jakub told me he gets some warnings with W=1, so I decided to check with
sparse, smatch and coccinelle as well. This patch set fixes all the
issues found. None are actual bugs / regressions and therefore not
targeted at net.

Patches #1-#2 add missing kernel-doc comments.

Patch #3 removes dead code.

Patch #4 reworks the ACL code to avoid defining a static variable in a
header file.

Patch #5 removes unnecessary conversion to bool that coccinelle warns
about.

Patch #6 avoids false-positive uninitialized symbol errors emitted by
smatch.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: spectrum_router: Avoid uninitialized symbol errors
Ido Schimmel [Fri, 27 Mar 2020 08:55:25 +0000 (11:55 +0300)]
mlxsw: spectrum_router: Avoid uninitialized symbol errors

Suppress the following smatch errors. None of these are actually
possible with current code paths.

drivers/net/ethernet/mellanox/mlxsw//spectrum_router.c:1220
mlxsw_sp_ipip_entry_find_decap() error: uninitialized symbol 'saddrp'.
drivers/net/ethernet/mellanox/mlxsw//spectrum_router.c:1220
mlxsw_sp_ipip_entry_find_decap() error: uninitialized symbol
'saddr_len'.
drivers/net/ethernet/mellanox/mlxsw//spectrum_router.c:1221
mlxsw_sp_ipip_entry_find_decap() error: uninitialized symbol
'saddr_prefix_len'.

drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:1390
mlxsw_sp_netdevice_ipip_ol_reg_event() error: uninitialized symbol
'ipipt'.

drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:3255
mlxsw_sp_nexthop_group_update() error: uninitialized symbol 'err'.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: switchx2: Remove unnecessary conversion to bool
Ido Schimmel [Fri, 27 Mar 2020 08:55:24 +0000 (11:55 +0300)]
mlxsw: switchx2: Remove unnecessary conversion to bool

Suppress following warning from coccinelle:

drivers/net/ethernet/mellanox/mlxsw//switchx2.c:183:63-68: WARNING:
conversion to bool not needed here

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: core_acl: Avoid defining static variable in header file
Ido Schimmel [Fri, 27 Mar 2020 08:55:23 +0000 (11:55 +0300)]
mlxsw: core_acl: Avoid defining static variable in header file

The static array 'mlxsw_afk_element_infos' in 'core_acl_flex_keys.h' is
copied to each file that includes the header, but not all use it. This
results in the following warnings when compiling with W=1:

drivers/net/ethernet/mellanox/mlxsw//core_acl_flex_keys.h:76:44:
warning: ‘mlxsw_afk_element_infos’ defined but not used
[-Wunused-const-variable=]

One way to suppress the warning is to mark the array with
'__maybe_unused', but another option is to remove it from the header
file entirely.

Change 'struct mlxsw_afk_element_inst' to store the key to the array
('element') instead of the array value keyed by 'element'. Adjust the
different users accordingly.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: spectrum: Remove unused RIF and FID families
Ido Schimmel [Fri, 27 Mar 2020 08:55:22 +0000 (11:55 +0300)]
mlxsw: spectrum: Remove unused RIF and FID families

In merge commit 50853808ff4a ("Merge branch
'mlxsw-Prepare-for-VLAN-aware-bridge-w-VxLAN'") I flipped mlxsw to use
emulated 802.1Q FIDs and correspondingly emulated VLAN RIFs. This means
that the non-emulated variants are no longer used. Remove them and
suppress the following warnings when compiling with W=1:

drivers/net/ethernet/mellanox/mlxsw//spectrum_router.c:7572:38: warning:
‘mlxsw_sp_rif_vlan_ops’ defined but not used [-Wunused-const-variable=]

drivers/net/ethernet/mellanox/mlxsw//spectrum_fid.c:584:41: warning:
‘mlxsw_sp_fid_8021q_family’ defined but not used
[-Wunused-const-variable=]

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: spectrum_router: Add proper function documentation
Ido Schimmel [Fri, 27 Mar 2020 08:55:21 +0000 (11:55 +0300)]
mlxsw: spectrum_router: Add proper function documentation

Suppress following warnings when compiling with W=1:

drivers/net/ethernet/mellanox/mlxsw//spectrum_router.c:1552: warning:
Function parameter or member 'mlxsw_sp' not described in
'__mlxsw_sp_ipip_entry_update_tunnel'
drivers/net/ethernet/mellanox/mlxsw//spectrum_router.c:1552: warning:
Function parameter or member 'ipip_entry' not described in
'__mlxsw_sp_ipip_entry_update_tunnel'
drivers/net/ethernet/mellanox/mlxsw//spectrum_router.c:1552: warning:
Function parameter or member 'extack' not described in
'__mlxsw_sp_ipip_entry_update_tunnel'

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: i2c: Add missing field documentation
Ido Schimmel [Fri, 27 Mar 2020 08:55:20 +0000 (11:55 +0300)]
mlxsw: i2c: Add missing field documentation

Suppress following warning when compiling with W=1:

drivers/net/ethernet/mellanox/mlxsw//i2c.c:78: warning: Function
parameter or member 'cmd' not described in 'mlxsw_i2c'

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge tag 'iwlwifi-next-for-kalle-2020-03-27' of git://git.kernel.org/pub/scm/linux...
Kalle Valo [Fri, 27 Mar 2020 07:20:48 +0000 (09:20 +0200)]
Merge tag 'iwlwifi-next-for-kalle-2020-03-27' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

Second set of iwlwifi patches intended for v5.7

* Refactoring of the device selection algorithms continues;
* Improvement in the initialization fo SoC-based devices;
* Support for FW scan API;
* Some additions to our FW debuggging capabilities;
* More refactoring of the device selection algorithms;
* Support new FW API version;
* Support for EDCA measurements;
* New scan API features;
* Enable new debugging code;
* Some other small fixes and clean-ups;

4 years agoiwlwifi: mvm: remove newline from rs_pretty_print_rate()
Johannes Berg [Tue, 26 Nov 2019 10:25:28 +0000 (11:25 +0100)]
iwlwifi: mvm: remove newline from rs_pretty_print_rate()

Some of the places using this want the newline, but not all,
so remove the newline from it and generate it in the debugfs
files where it's desired.

The effect of this is not printing double newlines in debug
log messages.

Change-Id: Ia59b0abbef16b6783fcabc095c5fde16bd047a26
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: pcie: make iwl_pcie_cmdq_reclaim static
Johannes Berg [Sat, 16 Nov 2019 16:05:00 +0000 (17:05 +0100)]
iwlwifi: pcie: make iwl_pcie_cmdq_reclaim static

There's no need for this to be exposed outside of the tx.c
file, make it static.

Change-Id: I41d40008311b108d0578bd2ec73c5477e700a839
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: bump FW API to 53 for 22000 series
Luca Coelho [Tue, 1 Oct 2019 06:38:08 +0000 (09:38 +0300)]
iwlwifi: bump FW API to 53 for 22000 series

Start supporting API version 53 for 22000 series.

Change-Id: I5725e46394f3f53c3069723fd513cc53c7df383d
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: remove IWL_FW_DBG_DOMAIN macro
Johannes Berg [Wed, 20 Nov 2019 12:48:15 +0000 (13:48 +0100)]
iwlwifi: remove IWL_FW_DBG_DOMAIN macro

This is used to initialize the default value, but refers back
to the value itself, essentially leading to a
val = val
assignment at init time ... that's useless, remove it and use
_NODEF.

Change-Id: I725923016563c34ce2fa057bf7c12984e1041c49
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: yoyo: enable yoyo by default
Luca Coelho [Thu, 7 Nov 2019 13:59:43 +0000 (15:59 +0200)]
iwlwifi: yoyo: enable yoyo by default

Now that YoYo is more mature, we can enable it by default, so we
collect data in the new way.

Change-Id: Ic1a147f935286b085ca8bdb248a7493b7c6341ea
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: scan: support FW APIs with variable number of profiles
Tova Mussai [Tue, 5 Nov 2019 10:56:14 +0000 (12:56 +0200)]
iwlwifi: scan: support FW APIs with variable number of profiles

The FW changed the maximum number of scan offload profiles to 8 in new
APIs.  Support it by changing the scan_offload_profile_cfg struct to be
more dynamic, so we can reuse most of the code and only change size of
the profiles array.

Change-Id: I65210cf541af46e2675a8c764d5871f7f5b070d6
Signed-off-by: Tova Mussai <tova.mussai@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: yoyo: don't block dumping internal memory when not in SRAM mode
rotem saado [Wed, 13 Nov 2019 12:20:11 +0000 (14:20 +0200)]
iwlwifi: yoyo: don't block dumping internal memory when not in SRAM mode

When we have an assert during D3 we want to dump the internal
buffer memory even if are we working in DRAM debug mode.  We should not
block dumping it.

Change-Id: I69aad2d4904c4f8bb653c61e8781a2e07780054f
Signed-off-by: Rotem Saado <rotem.saado@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: remove support for QnJ HR FPGA
Luca Coelho [Mon, 11 Nov 2019 15:32:08 +0000 (17:32 +0200)]
iwlwifi: remove support for QnJ HR FPGA

We don't support the FPGA versions of this card combination anymore.
Remove the cfg mangling that tries to load it and all the relevant
structures.

Change-Id: I190652101afcab682cfba873d062992f11efca32
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: remove support for QnJ Hr STEP A
Luca Coelho [Mon, 11 Nov 2019 15:22:59 +0000 (17:22 +0200)]
iwlwifi: remove support for QnJ Hr STEP A

We don't support QnJ HR STEP A anymore.  Remove the structures we used
for it.

Change-Id: I0dfd88232bdc8ff2dd9c4368b8ed9a0c40c86bc8
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: add trans_cfg for devices with long latency
Luca Coelho [Mon, 4 Nov 2019 20:51:54 +0000 (22:51 +0200)]
iwlwifi: add trans_cfg for devices with long latency

A couple of SoCs, which can be recognized by PCI device IDs 0xA0F0 and
0x43F0, need a longer wait for the xtal to stabilize.  To handle this,
add a new trans_cfg structure for Qu devices with a larger
xtal_latency value and apply them to the devices recognized by these
IDs.  Also add a flag that allows us to inform the FW that the low
latency xtal should be used.

Change-Id: I8a14c6af45ea14d8e7f1ef38a589158f38d0c0ea
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: add support for version 2 of SOC_CONFIGURATION_CMD
Luca Coelho [Wed, 6 Nov 2019 07:27:51 +0000 (09:27 +0200)]
iwlwifi: add support for version 2 of SOC_CONFIGURATION_CMD

This new command is mostly backwards compatible, with the exception
that the device_type element was changed into a bitmask.  The device
type bit remains the same (because we only had 0 and 1 anyway), but
when using v1 we can't set any other bits, because that would change
the integer.

Other than that, the struct remains the same and the driver can set
the device_type bit in both cases, but it can only set the low_latency
bit if VER_2 is used.

Change-Id: Ib68d4c821ebcce253b42ed0ea15881fb4e3e01da
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: mvm: add support for non EDCA based measurements
Avraham Stern [Sun, 6 Oct 2019 09:28:47 +0000 (12:28 +0300)]
iwlwifi: mvm: add support for non EDCA based measurements

Add support for requesting trigger-based / non trigger-based
measurements.

Change-Id: Ib4d0c471da9c50d9981541a7f5926db384a0f7ce
Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: remove unnecessary cfg mangling for Qu C and QuZ with Jf
Luca Coelho [Mon, 4 Nov 2019 19:38:33 +0000 (21:38 +0200)]
iwlwifi: remove unnecessary cfg mangling for Qu C and QuZ with Jf

Now that we identify the correct cfgs with the new tables for Qu step
C and QuZ with Jf, we can remove the mangling we do later on.

Change-Id: Ic01ce67db147e897ad2424f0e05a70a00d2c620e
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: convert QnJ with Jf devices to new config table
Luca Coelho [Mon, 4 Nov 2019 19:29:55 +0000 (21:29 +0200)]
iwlwifi: convert QnJ with Jf devices to new config table

All the QnJ devices have a similar matching to the other Qu devices,
but needs a different configuration.  Convert the QnJ devices to the
new table accordingly.

Change-Id: If236ef3d0da3e605a3379922818f5897e0affd7e
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: convert all Qu with Jf devices to the new config table
Luca Coelho [Mon, 4 Nov 2019 19:02:47 +0000 (21:02 +0200)]
iwlwifi: convert all Qu with Jf devices to the new config table

Add new generic iwl_trans structures for these devices and apply the
correct cfg depending on the device characteristics.

Since we have to match Qu with IWL_CONFIG_ANY, we also need to move
the Hr devices to the new table, but for now we keep matching on PCI
device and subsystem device IDs.

Change-Id: I14e9146a99621ff11ce50bc746a4b88af508fee0
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: add HW step to new cfg device table
Luca Coelho [Mon, 4 Nov 2019 15:29:55 +0000 (17:29 +0200)]
iwlwifi: add HW step to new cfg device table

We need to use different firmware versions for different HW steps with
certain devices.  Prepare for this differentiation by adding HW step
to the new device table.

Change-Id: Ib1afb7b0c89e9dc2d26e6d32ea19e978c17ba1dd
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: remove some unused extern declarations from iwl-config.h
Luca Coelho [Mon, 4 Nov 2019 10:40:13 +0000 (12:40 +0200)]
iwlwifi: remove some unused extern declarations from iwl-config.h

After the refactoring, a few extern declarations were accidentally
left in the iwl-config.h file.  Remove them

Change-Id: I79745e440ed5a0a90db61b0daaae374ecef09e86
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: move integrated, extra_phy and soc_latency to trans_cfg
Luca Coelho [Mon, 4 Nov 2019 10:31:22 +0000 (12:31 +0200)]
iwlwifi: move integrated, extra_phy and soc_latency to trans_cfg

These values are selected based on the PCI device ID, so the decision
to use them can be made early.  By moving them to the trans_cfg, we
avoid duplicating the large cfg structs for small pieces of
data (sometimes a single boolean).  This will also allow us to make
more decisions based on, for instance, the SoC type in used.

The trans_cfg concept changes a bit, because previously it was used
only to boot the device before reading further characteristics and now
it also contains more data that is associated with the device ID.

Change-Id: Ib71b07ea9e322eb74571dc5e8aa58f17eece5c9c
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: mvm: enable SF also when we have HE
Johannes Berg [Thu, 7 Nov 2019 11:04:45 +0000 (12:04 +0100)]
iwlwifi: mvm: enable SF also when we have HE

We shouldn't do this just for HT/VHT, but be future-proof
and also check for HE.

Change-Id: Icaeff714c00a773681dbfee72558afd1c7121c5d
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: remove redundant iwl9560_2ac_cfg struct
Luca Coelho [Mon, 4 Nov 2019 09:53:41 +0000 (11:53 +0200)]
iwlwifi: remove redundant iwl9560_2ac_cfg struct

The iwl9560_2ac_cfg struct is used for PNJ devices and the
configuration is the same as iwl9260_2ac_cfg, so we can remove the
former to avoid redundancy.

Change-Id: I17ac1802f00bd80006930b922a9fc21df60e3c16
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: mvm: rs-fw: fix some indentation
Johannes Berg [Thu, 7 Nov 2019 10:50:55 +0000 (11:50 +0100)]
iwlwifi: mvm: rs-fw: fix some indentation

That closing brace for the switch statement is misplaced, fix it.

Change-Id: I39af135a9e3fc64337d2cced43a70cb48fe3b9c1
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: scan: support scan req cmd ver 14
Shahar S Matityahu [Sun, 29 Sep 2019 09:48:42 +0000 (12:48 +0300)]
iwlwifi: scan: support scan req cmd ver 14

Modify adaptive dwell number of APs override API
Instead of using channel to index mapping, add the adaptive dwell
override parameters as part of the configuration per channel in the scan
request command.

Support 2 different override values and use them as follows:
1. 10 APs for friendly GO channels in p2p scan.
2. 2 APs for social channels in p2p scan.

Change-Id: I3b461108abf2306c3d054099112f2c3afce1cc92
Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: pass trans and NVM data to HE capability parsing
Johannes Berg [Tue, 5 Nov 2019 11:22:06 +0000 (12:22 +0100)]
iwlwifi: pass trans and NVM data to HE capability parsing

We'll need this data in the future, pass the values.

Change-Id: Iaeff50716e783f5c0bcea86ca1c93ada1560525e
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: pcie: implement read_config32
Luca Coelho [Fri, 1 Nov 2019 14:13:33 +0000 (16:13 +0200)]
iwlwifi: pcie: implement read_config32

Add the read_config32 op to allow dumping the config space when
needed.

Change-Id: Ib2d254a38a4bfb95dcc3d04eec91781827a0c623
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: yoyo: add PCI config space region type
Luca Coelho [Fri, 1 Nov 2019 13:31:02 +0000 (15:31 +0200)]
iwlwifi: yoyo: add PCI config space region type

Add a new region type that allows us to dump the PCI config space.
This is mostly the same as dumping a memory region, but reading from
the device's config space instead.

In order to make this generic and independent of the trans type, we
make a function called iwl_dump_ini_config_iter() that calls a new op
in the transport to read its config space.

Change-Id: I15151bddf589f13b0e0a45c28b96bbcd73bcfdeb
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: mvm: add soc latency support
Shahar S Matityahu [Tue, 20 Sep 2016 14:48:25 +0000 (17:48 +0300)]
iwlwifi: mvm: add soc latency support

Some devices require longer time to stabilize the power and XTAL.
This is especially true for devices integrated in the SoC.  Add
support for a new firmware API that allows the driver to set the
latency value accordingly.

Change-Id: I6829a46b89e4e701f80a0e4033f4dd41ee44ed12
Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agonet: phy: don't touch suspended flag if there's no suspend/resume callback
Heiner Kallweit [Thu, 26 Mar 2020 17:58:24 +0000 (18:58 +0100)]
net: phy: don't touch suspended flag if there's no suspend/resume callback

So far we set phydev->suspended to true in phy_suspend() even if the
PHY driver doesn't implement the suspend callback. This applies
accordingly for the resume path. The current behavior doesn't cause
any issue I'd be aware of, but it's not logical and misleading,
especially considering the description of the flag:
"suspended: Set to true if this phy has been suspended successfully"

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.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 agoMerge branch 'net-atlantic-MACSec-support-for-AQC-devices'
David S. Miller [Fri, 27 Mar 2020 03:17:37 +0000 (20:17 -0700)]
Merge branch 'net-atlantic-MACSec-support-for-AQC-devices'

Igor Russkikh says:

====================
net: atlantic: MACSec support for AQC devices

This patchset introduces MACSec HW offloading support in
Marvell(Aquantia) AQC atlantic driver.

This implementation is a joint effort of Marvell developers on top of
the work started by Antoine Tenart.

v2:
 * clean up the generated code (removed useless bit operations);
 * use WARN_ONCE to avoid log spam;
 * use put_unaligned_be64;
 * removed trailing \0 and length limit for format strings;

v1: https://patchwork.ozlabs.org/cover/1259998/

RFC v2: https://patchwork.ozlabs.org/cover/1252204/

RFC v1: https://patchwork.ozlabs.org/cover/1238082/

Several patches introduce backward-incompatible changes and are
subject for discussion/drop:

1) patch 0007:
  multicast/broadcast when offloading is needed to handle ARP requests,
  because they have broadcast destination address;
  With this patch we also match and encrypt/decrypt packets between macsec
  hw and realdev based on device's mac address.
  This can potentially be used to support multiple macsec offloaded
  interfaces on top of one realdev.
  However in some environments this could lead to problems, e.g. the
  'bridge over macsec' configuration will expect the packets with unknown
  src MAC should come through macsec.
  The patch is questionable, we've used it because our current hw setup
  and requirements both assume that the decryption is done based on mac
  address match only.
  This could be changed by encrypting/decripting all the traffic (except
  control).

2) patch 0009:
  real_dev features are now propagated to macsec device (when HW
  offloading is enabled), otherwise feature set might lead to HW
  reconfiguration during MACSec configuration.
  Also, HW offloaded macsec should be able to keep LRO LSO features,
  since they are transparent for macsec engine (at least in our hardware).
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: atlantic: add XPN handling
Mark Starovoytov [Wed, 25 Mar 2020 12:52:46 +0000 (15:52 +0300)]
net: atlantic: add XPN handling

This patch adds XPN handling.
Our driver doesn't support XPN, but we should still update a couple
of places in the code, because the size of 'next_pn' field has
changed.

Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: atlantic: MACSec offload statistics implementation
Dmitry Bogdanov [Wed, 25 Mar 2020 12:52:45 +0000 (15:52 +0300)]
net: atlantic: MACSec offload statistics implementation

This patch adds support for MACSec statistics on Atlantic network cards.

Signed-off-by: Dmitry Bogdanov <dbogdanov@marvell.com>
Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: atlantic: MACSec offload statistics HW bindings
Dmitry Bogdanov [Wed, 25 Mar 2020 12:52:44 +0000 (15:52 +0300)]
net: atlantic: MACSec offload statistics HW bindings

This patch adds the Atlantic HW-specific bindings for MACSec statistics,
e.g. register addresses / structs, helper function, etc, which will be
used by actual callback implementations.

Signed-off-by: Dmitry Bogdanov <dbogdanov@marvell.com>
Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: atlantic: MACSec ingress offload implementation
Mark Starovoytov [Wed, 25 Mar 2020 12:52:43 +0000 (15:52 +0300)]
net: atlantic: MACSec ingress offload implementation

This patch adds support for MACSec ingress HW offloading on Atlantic
network cards.

Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: atlantic: MACSec ingress offload HW bindings
Mark Starovoytov [Wed, 25 Mar 2020 12:52:42 +0000 (15:52 +0300)]
net: atlantic: MACSec ingress offload HW bindings

This patch adds the Atlantic HW-specific bindings for MACSec ingress, e.g.
register addresses / structs, helper function, etc, which will be used by
actual callback implementations.

Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: atlantic: MACSec egress offload implementation
Dmitry Bogdanov [Wed, 25 Mar 2020 12:52:41 +0000 (15:52 +0300)]
net: atlantic: MACSec egress offload implementation

This patch adds support for MACSec egress HW offloading on Atlantic
network cards.

Signed-off-by: Dmitry Bogdanov <dbogdanov@marvell.com>
Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: atlantic: MACSec egress offload HW bindings
Dmitry Bogdanov [Wed, 25 Mar 2020 12:52:40 +0000 (15:52 +0300)]
net: atlantic: MACSec egress offload HW bindings

This patch adds the Atlantic HW-specific bindings for MACSec egress, e.g.
register addresses / structs, helper function, etc, which will be used by
actual callback implementations.

Signed-off-by: Dmitry Bogdanov <dbogdanov@marvell.com>
Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: atlantic: MACSec offload skeleton
Dmitry Bogdanov [Wed, 25 Mar 2020 12:52:39 +0000 (15:52 +0300)]
net: atlantic: MACSec offload skeleton

This patch adds basic functionality for MACSec offloading for Atlantic
NICs.

MACSec offloading functionality is enabled if network card has
appropriate FW that has MACSec offloading enabled in config.

Actual functionality (ingress, egress, etc) will be added in follow-up
patches.

Signed-off-by: Dmitry Bogdanov <dbogdanov@marvell.com>
Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: macsec: report real_dev features when HW offloading is enabled
Mark Starovoytov [Wed, 25 Mar 2020 12:52:38 +0000 (15:52 +0300)]
net: macsec: report real_dev features when HW offloading is enabled

This patch makes real_dev_feature propagation by MACSec offloaded device.

Issue description:
real_dev features are disabled upon macsec creation.

Root cause:
Features limitation (specific to SW MACSec limitation) is being applied
to HW offloaded case as well.
This causes 'set_features' request on the real_dev with reduced feature
set due to chain propagation.

Proposed solution:
Report real_dev features when HW offloading is enabled.
NB! MACSec offloaded device does not propagate VLAN offload features at
the moment. This can potentially be added later on as a separate patch.

Note: this patch requires HW offloading to be enabled by default in order
to function properly.

Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: macsec: add support for getting offloaded stats
Dmitry Bogdanov [Wed, 25 Mar 2020 12:52:37 +0000 (15:52 +0300)]
net: macsec: add support for getting offloaded stats

When HW offloading is enabled, offloaded stats should be used, because
s/w stats are wrong and out of sync with the HW in this case.

Signed-off-by: Dmitry Bogdanov <dbogdanov@marvell.com>
Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: macsec: support multicast/broadcast when offloading
Mark Starovoytov [Wed, 25 Mar 2020 12:52:36 +0000 (15:52 +0300)]
net: macsec: support multicast/broadcast when offloading

The idea is simple. If the frame is an exact match for the controlled port
(based on DA comparison), then we simply divert this skb to matching port.

Multicast/broadcast messages are delivered to all ports.

Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: macsec: allow multiple macsec devices with offload
Dmitry Bogdanov [Wed, 25 Mar 2020 12:52:35 +0000 (15:52 +0300)]
net: macsec: allow multiple macsec devices with offload

Offload engine can setup several SecY. Each macsec interface shall have
its own mac address. It will filter a traffic by dest mac address.

Signed-off-by: Dmitry Bogdanov <dbogdanov@marvell.com>
Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: macsec: init secy pointer in macsec_context
Dmitry Bogdanov [Wed, 25 Mar 2020 12:52:34 +0000 (15:52 +0300)]
net: macsec: init secy pointer in macsec_context

This patch adds secy pointer initialization in the macsec_context.
It will be used by MAC drivers in offloading operations.

Signed-off-by: Dmitry Bogdanov <dbogdanov@marvell.com>
Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: macsec: add support for offloading to the MAC
Antoine Tenart [Wed, 25 Mar 2020 12:52:33 +0000 (15:52 +0300)]
net: macsec: add support for offloading to the MAC

This patch adds a new MACsec offloading option, MACSEC_OFFLOAD_MAC,
allowing a user to select a MAC as a provider for MACsec offloading
operations.

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: macsec: allow to reference a netdev from a MACsec context
Antoine Tenart [Wed, 25 Mar 2020 12:52:32 +0000 (15:52 +0300)]
net: macsec: allow to reference a netdev from a MACsec context

This patch allows to reference a net_device from a MACsec context. This
is needed to allow implementing MACsec operations in net device drivers.

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: add a reference to MACsec ops in net_device
Antoine Tenart [Wed, 25 Mar 2020 12:52:31 +0000 (15:52 +0300)]
net: add a reference to MACsec ops in net_device

This patch adds a reference to MACsec ops to the net_device structure,
allowing net device drivers to implement offloading operations for
MACsec.

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: introduce the MACSEC netdev feature
Antoine Tenart [Wed, 25 Mar 2020 12:52:30 +0000 (15:52 +0300)]
net: introduce the MACSEC netdev feature

This patch introduce a new netdev feature, which will be used by drivers
to state they can perform MACsec transformations in hardware.

The patchset was gathered by Mark, macsec functinality itself
was implemented by Dmitry, Mark and Pavel Belous.

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotaprio: do not use BIT() in TCA_TAPRIO_ATTR_FLAG_* definitions
Eugene Syromiatnikov [Tue, 24 Mar 2020 04:19:20 +0000 (05:19 +0100)]
taprio: do not use BIT() in TCA_TAPRIO_ATTR_FLAG_* definitions

BIT() macro definition is internal to the Linux kernel and is not
to be used in UAPI headers; replace its usage with the _BITUL() macro
that is already used elsewhere in the header.

Fixes: 9c66d1564676 ("taprio: Add support for hardware offloading")
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
Acked-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoipv6: ndisc: add support for 'PREF64' dns64 prefix identifier
Maciej Żenczykowski [Tue, 24 Mar 2020 01:10:19 +0000 (18:10 -0700)]
ipv6: ndisc: add support for 'PREF64' dns64 prefix identifier

This is trivial since we already have support for the entirely
identical (from the kernel's point of view) RDNSS, DNSSL, etc. that
also contain opaque data that needs to be passed down to userspace
for further processing.

As specified in draft-ietf-6man-ra-pref64-09 (while it is still a draft,
it is purely waiting on the RFC Editor for cleanups and publishing):
  PREF64 option contains lifetime and a (up to) 96-bit IPv6 prefix.

The 8-bit identifier of the option type as assigned by the IANA is 38.

Since we lack DNS64/NAT64/CLAT support in kernel at the moment,
thus this option should also be passed on to userland.

See:
  https://tools.ietf.org/html/draft-ietf-6man-ra-pref64-09
  https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml#icmpv6-parameters-5

Cc: Erik Kline <ek@google.com>
Cc: Jen Linkova <furry@google.com>
Cc: Lorenzo Colitti <lorenzo@google.com>
Cc: Michael Haro <mharo@google.com>
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Acked-By: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-ethernet-ti-add-networking-support-for-k3-am65x-j721e-soc'
David S. Miller [Fri, 27 Mar 2020 03:01:14 +0000 (20:01 -0700)]
Merge branch 'net-ethernet-ti-add-networking-support-for-k3-am65x-j721e-soc'

Grygorii Strashko says:

====================
net: ethernet: ti: add networking support for k3 am65x/j721e soc

This v6 series adds basic networking support support TI K3 AM654x/J721E SoC which
have integrated Gigabit Ethernet MAC (Media Access Controller) into device MCU
domain and named MCU_CPSW0 (CPSW2G NUSS).

Formally TRMs refer CPSW2G NUSS as two-port Gigabit Ethernet Switch subsystem
with port 0 being the CPPI DMA host port and port 1 being the external Ethernet
port, but for 1 external port device it's just Port 0 <-> ALE <-> Port 1 and it's
rather device with HW filtering capabilities then actually switching device.
It's expected to have similar devices, but with more external ports.

The new Host port 0 Communications Port Programming Interface (CPPI5) is
operating by TI AM654x/J721E NAVSS Unified DMA Peripheral Root Complex (UDMA-P)
controller [1].

The CPSW2G contains below modules for which existing code is re-used:
 - MAC SL: cpsw_sl.c
 - Address Lookup Engine (ALE): cpsw_ale.c, basically compatible with K2 66AK2E/G
 - Management Data Input/Output interface (MDIO): davinci_mdio.c, fully
   compatible with TI AM3/4/5 devices

Basic features supported by CPSW2G NUSS driver:
 - VLAN support, 802.1Q compliant, Auto add port VLAN for untagged frames on
   ingress, Auto VLAN removal on egress and auto pad to minimum frame size.
 - multicast filtering
 - promisc mode
 - TX multiq support in Round Robin or Fixed priority modes
 - RX checksum offload for non-fragmented IPv4/IPv6 TCP/UDP packets
 - TX checksum offload support for IPv4/IPv6 TCP/UDP packets (J721E only).

Features under development:
 - Support for IEEE 1588 Clock Synchronization. The CPSW2G NUSS includes new
   version of Common Platform Time Sync (CPTS)
 - tc-mqprio: priority level Quality Of Service (QOS) support (802.1p)
 - tc-cbs: Support for Audio/Video Bridging (P802.1Qav/D6.0) HW shapers
 - tc-taprio: IEEE 802.1Qbv/D2.2 Enhancements for Scheduled Traffic
 - frame preemption: IEEE P902.3br/D2.0 Interspersing Express Traffic, 802.1Qbu
 - extended ALE features: classifier/policers, auto-aging

Patches 1-6 are intended for netdev, Patches 7-11 are intended for K3 Platform
tree and provided here for testing purposes.

Changes in v6:
 - fixed comments from Rob Herring <robh@kernel.org> and added his Reviewed-by.
 - added Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

Changes in v5:
 - renamed files k3-udma-desc-pool.*  k3-udma-desc-pool to k3-cppi-desc-pool.*,
   and API to k3_cppi_desc_pool_* as requested by Peter Ujfalusi <peter.ujfalusi@ti.com>
 - fixed copy-paste err in am65_cpsw_nuss_ndo_slave_set_rx_mode() which blocked
   recieving of mcast frames.
 - added Tested-by: Murali Karicheri <m-karicheri2@ti.com>

Changes in v4:
 - fixed minor comments from Jakub Kicinski <kuba@kernel.org>
 - dependencies resolved: required phy-rmii-sel changes [2] queued for merge
   except one [3] which is included in this series with Kishon's ask.

Changes in v3:
 - add ARM64 defconfig changes for testing purposes
 - fixed DT yaml definition
 - fixed comments from Jakub Kicinski <kuba@kernel.org>

Changes in v2:
 - fixed DT yaml definition
 - fixed comments from David Miller

v5: https://patchwork.ozlabs.org/cover/1258295/
v4: https://patchwork.ozlabs.org/cover/1256092/
v3: https://patchwork.ozlabs.org/cover/1254568/
v2: https://patchwork.ozlabs.org/cover/1250674/
v1: https://lwn.net/Articles/813087/

TRMs:
 AM654: http://www.ti.com/lit/ug/spruid7e/spruid7e.pdf
 J721E: http://www.ti.com/lit/ug/spruil1a/spruil1a.pdf

Preliminary documentation can be found at:
 http://software-dl.ti.com/processor-sdk-linux/esd/docs/latest/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/K3_CPSW2g.html

[1] https://lwn.net/Articles/808030/
[2] https://lkml.org/lkml/2020/2/22/100
[3] https://lkml.org/lkml/2020/3/3/724
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoarm64: defconfig: ti: k3: enable dma and networking
Grygorii Strashko [Mon, 23 Mar 2020 22:52:54 +0000 (00:52 +0200)]
arm64: defconfig: ti: k3: enable dma and networking

Enable TI K3 AM654x/J721E DMA and networking options.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Murali Karicheri <m-karicheri2@ti.com>
Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoarm64: dts: ti: k3-j721e-common-proc-board: add mcu cpsw nuss pinmux and phy defs
Grygorii Strashko [Mon, 23 Mar 2020 22:52:53 +0000 (00:52 +0200)]
arm64: dts: ti: k3-j721e-common-proc-board: add mcu cpsw nuss pinmux and phy defs

The TI J721E EVM base board has TI DP83867 PHY connected to external CPSW
NUSS Port 1 in rgmii-rxid mode.

Hence, add pinmux and Ethernet PHY configuration for TI j721e SoC MCU
Gigabit Ethernet two ports Switch subsystem (CPSW NUSS).

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Murali Karicheri <m-karicheri2@ti.com>
Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoarm64: dts: ti: k3-j721e-mcu: add mcu cpsw nuss node
Grygorii Strashko [Mon, 23 Mar 2020 22:52:52 +0000 (00:52 +0200)]
arm64: dts: ti: k3-j721e-mcu: add mcu cpsw nuss node

Add DT node for The TI J721E MCU SoC Gigabit Ethernet
subsystem (MCU CPSW NUSS).

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Murali Karicheri <m-karicheri2@ti.com>
Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoarm64: dts: k3-am654-base-board: add mcu cpsw nuss pinmux and phy defs
Grygorii Strashko [Mon, 23 Mar 2020 22:52:51 +0000 (00:52 +0200)]
arm64: dts: k3-am654-base-board: add mcu cpsw nuss pinmux and phy defs

AM654 EVM base board has TI DP83867 PHY connected to external CPSW NUSS
Port 1 in rgmii-rxid mode.

Hence, add pinmux and Ethernet PHY configuration for TI am654 SoC Gigabit
Ethernet two ports Switch subsystem (CPSW NUSS).

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Murali Karicheri <m-karicheri2@ti.com>
Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoarm64: dts: ti: k3-am65-mcu: add cpsw nuss node
Grygorii Strashko [Mon, 23 Mar 2020 22:52:50 +0000 (00:52 +0200)]
arm64: dts: ti: k3-am65-mcu: add cpsw nuss node

Add DT node for the TI AM65x SoC Gigabit Ethernet two ports Switch
subsystem (CPSW NUSS).

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Murali Karicheri <m-karicheri2@ti.com>
Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ethernet: ti: introduce am65x/j721e gigabit eth subsystem driver
Grygorii Strashko [Mon, 23 Mar 2020 22:52:49 +0000 (00:52 +0200)]
net: ethernet: ti: introduce am65x/j721e gigabit eth subsystem driver

The TI AM65x/J721E SoCs Gigabit Ethernet Switch subsystem (CPSW2G NUSS) has
two ports - One Ethernet port (port 1) with selectable RGMII and RMII
interfaces and an internal Communications Port Programming Interface (CPPI)
port (Host port 0) and with ALE in between. It also contains
 - Management Data Input/Output (MDIO) interface for physical layer device
(PHY) management;
 - Updated Address Lookup Engine (ALE) module;
 - (TBD) New version of Common platform time sync (CPTS) module.

On the TI am65x/J721E SoCs CPSW NUSS Ethernet subsystem into device MCU
domain named MCU_CPSW0.

Host Port 0 CPPI Packet Streaming Interface interface supports 8 TX
channels and one RX channels operating by TI am654 NAVSS Unified DMA
Peripheral Root Complex (UDMA-P) controller.

Introduced driver provides standard Linux net_device to user space and supports:
 - ifconfig up/down
 - MAC address configuration
 - ethtool operation:
   --driver
   --change
   --register-dump
   --negotiate phy
   --statistics
   --set-eee phy
   --show-ring
   --show-channels
   --set-channels
 - net_device ioctl mii-control
 - promisc mode

 - rx checksum offload for non-fragmented IPv4/IPv6 TCP/UDP packets.
   The CPSW NUSS can verify IPv4/IPv6 TCP/UDP packets checksum and fills
   csum information for each packet in psdata[2] word:
   - BIT(16) CHECKSUM_ERROR - indicates csum error
   - BIT(17) FRAGMENT -  indicates fragmented packet
   - BIT(18) TCP_UDP_N -  Indicates TCP packet was detected
   - BIT(19) IPV6_VALID,  BIT(20) IPV4_VALID - indicates IPv6/IPv4 packet
   - BIT(15, 0) CHECKSUM_ADD - This is the value that was summed
   during the checksum computation. This value is FFFFh for non fragmented
   IPV4/6 UDP/TCP packets with no checksum error.

   RX csum offload can be disabled:
 ethtool -K <dev> rx-checksum on|off

 - tx checksum offload support for IPv4/IPv6 TCP/UDP packets (J721E only).
   TX csum HW offload  can be enabled/disabled:
 ethtool -K <dev> tx-checksum-ip-generic on|off

 - multiq and switch between round robin/prio modes for cppi tx queues by
   using Netdev private flag "p0-rx-ptype-rrobin" to switch between
   Round Robin and Fixed priority modes:
 # ethtool --show-priv-flags eth0
 Private flags for eth0:
 p0-rx-ptype-rrobin: on
 # ethtool --set-priv-flags eth0 p0-rx-ptype-rrobin off

   Number of TX DMA channels can be changed using "ethtool -L eth0 tx <N>".

 - GRO support: the napi_gro_receive() and napi_complete_done() are used.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Murali Karicheri <m-karicheri2@ti.com>
Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodt-binding: ti: am65x: document mcu cpsw nuss
Grygorii Strashko [Mon, 23 Mar 2020 22:52:48 +0000 (00:52 +0200)]
dt-binding: ti: am65x: document mcu cpsw nuss

Document device tree bindings for The TI AM654x/J721E SoC Gigabit Ethernet MAC
(Media Access Controller - CPSW2G NUSS). The CPSW NUSS provides Ethernet packet
communication for the device.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Tested-by: Murali Karicheri <m-karicheri2@ti.com>
Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ethernet: ti: ale: am65: add support for default thread cfg
Grygorii Strashko [Mon, 23 Mar 2020 22:52:47 +0000 (00:52 +0200)]
net: ethernet: ti: ale: am65: add support for default thread cfg

Add support for default thread configuration for AM65x CPSW NUSS ALE to
allow route all ingress packets to one default RX UDMA flow.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Murali Karicheri <m-karicheri2@ti.com>
Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ethernet: ti: ale: add support for mac-only mode
Grygorii Strashko [Mon, 23 Mar 2020 22:52:46 +0000 (00:52 +0200)]
net: ethernet: ti: ale: add support for mac-only mode

The new CPSW ALE version, available on TI K3 AM654/J721E SoCs family,
allows to switch any external port to MAC only mode. When MAC only mode
enabled this port be treated like a MAC port for the host. All traffic
received is only sent to the host. The host must direct traffic to this
port as the lookup engine will not send traffic to the ports with the
p0_maconly bit set and the p0_no_learn also set. If p0_maconly bit is set
and the p0_no_learn is not set, the host can send non-directed packets that
can be sent to the destination of a MacOnly port. It is also possible that
The host can broadcast to all ports including MacOnly ports in this mode.

This patch add ALE supprt for MAC only mode.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Murali Karicheri <m-karicheri2@ti.com>
Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ethernet: ti: ale: fix seeing unreg mcast packets with promisc and allmulti...
Grygorii Strashko [Mon, 23 Mar 2020 22:52:45 +0000 (00:52 +0200)]
net: ethernet: ti: ale: fix seeing unreg mcast packets with promisc and allmulti disabled

On AM65xx MCU CPSW2G NUSS and 66AK2E/L NUSS the unregistered multicast
packets are still can be received with promisc and allmulti disabled.

This happens, because ALE VLAN entries on these SoCs do not contain port
masks for reg/unreg mcast packets, but instead store indexes of
ALE_VLAN_MASK_MUXx_REG registers which intended for store port masks for
reg/unreg mcast packets.

ALE VLAN entry:UNREG_MCAST_FLOOD_INDEX -> ALE_VLAN_MASK_MUXx
ALE VLAN entry:REG_MCAST_FLOOD_INDEX -> ALE_VLAN_MASK_MUXy

The commit b361da837392 ("net: netcp: ale: add proper ale entry mask bits
for netcp switch ALE") update ALE code to support such ALE entries, it is
always used ALE_VLAN_MASK_MUX0_REG index in ALE VLAN entry for unreg mcast
packets mask configuration, which is read-only, at least for AM65xx MCU
CPSW2G NUSS and 66AK2E/L NUSS. As result unreg mcast packets are allowed
always.

Hence, update ALE code to use ALE_VLAN_MASK_MUX1_REG index for ALE VLAN
entries to configure unreg mcast port mask.

Fixes: b361da837392 ("net: netcp: ale: add proper ale entry mask bits for netcp switch ALE")
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Murali Karicheri <m-karicheri2@ti.com>
Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agophy: ti: gmii-sel: simplify config dependencies between net drivers and gmii phy
Grygorii Strashko [Mon, 23 Mar 2020 22:52:44 +0000 (00:52 +0200)]
phy: ti: gmii-sel: simplify config dependencies between net drivers and gmii phy

The phy-gmii-sel can be only auto selected in Kconfig and now the pretty
complex Kconfig dependencies are defined for phy-gmii-sel driver, which
also need to be updated every time phy-gmii-sel is re-used for any new
networking driver.

Simplify Kconfig definition for phy-gmii-sel PHY driver - drop all
dependencies and from networking drivers and rely on using 'imply
PHY_TI_GMII_SEL' in Kconfig definitions for networking drivers instead.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Tested-by: Murali Karicheri <m-karicheri2@ti.com>
Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'cls_flower-Use-extack-in-fl_set_key'
David S. Miller [Fri, 27 Mar 2020 02:52:31 +0000 (19:52 -0700)]
Merge branch 'cls_flower-Use-extack-in-fl_set_key'

Guillaume Nault says:

====================
cls_flower: Use extack in fl_set_key()

Add missing extack messages in fl_set_key(), so that users can get more
meaningfull error messages when netlink attributes are rejected.

Patch 1 also extends extack in tcf_change_indev() (in pkt_cls.h) since
this function is used by fl_set_key().
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agocls_flower: Add extack support for flags key
Guillaume Nault [Mon, 23 Mar 2020 20:48:53 +0000 (21:48 +0100)]
cls_flower: Add extack support for flags key

Pass extack down to fl_set_key_flags() and set message on error.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agocls_flower: Add extack support for src and dst port range options
Guillaume Nault [Mon, 23 Mar 2020 20:48:51 +0000 (21:48 +0100)]
cls_flower: Add extack support for src and dst port range options

Pass extack down to fl_set_key_port_range() and set message on error.

Both the min and max ports would qualify as invalid attributes here.
Report the min one as invalid, as it's probably what makes the most
sense from a user point of view.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agocls_flower: Add extack support for mpls options
Guillaume Nault [Mon, 23 Mar 2020 20:48:49 +0000 (21:48 +0100)]
cls_flower: Add extack support for mpls options

Pass extack down to fl_set_key_mpls() and set message on error.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: sched: refine extack messages in tcf_change_indev
Guillaume Nault [Mon, 23 Mar 2020 20:48:47 +0000 (21:48 +0100)]
net: sched: refine extack messages in tcf_change_indev

Add an error message when device wasn't found.
While there, also set the bad attribute's offset in extack.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-phy-marvell-usb-to-mdio-controller'
David S. Miller [Fri, 27 Mar 2020 02:49:34 +0000 (19:49 -0700)]
Merge branch 'net-phy-marvell-usb-to-mdio-controller'

Tobias Waldekranz says:

====================
net: phy: marvell usb to mdio controller

Support for an MDIO controller present on development boards for
Marvell switches from the Link Street (88E6xxx) family.

v3->v4:
- Remove unnecessary dependency on OF_MDIO.

v2->v3:
- Rename driver smi2usb -> mvusb.
- Clean up unused USB references.

v1->v2:
- Reverse christmas tree ordering of local variables.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: add marvell usb to mdio controller
Tobias Waldekranz [Mon, 23 Mar 2020 10:14:14 +0000 (11:14 +0100)]
net: phy: add marvell usb to mdio controller

An MDIO controller present on development boards for Marvell switches
from the Link Street (88E6xxx) family.

Using this module, you can use the following setup as a development
platform for switchdev and DSA related work.

   .-------.      .-----------------.
   |      USB----USB                |
   |  SoC  |      |  88E6390X-DB  ETH1-10
   |      ETH----ETH0               |
   '-------'      '-----------------'

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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 agodt-bindings: net: add marvell usb to mdio bindings
Tobias Waldekranz [Mon, 23 Mar 2020 10:14:13 +0000 (11:14 +0100)]
dt-bindings: net: add marvell usb to mdio bindings

Describe how the USB to MDIO controller can optionally use device tree
bindings to reference attached devices such as switches.

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.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: phy: probe PHY drivers synchronously
Heiner Kallweit [Fri, 27 Mar 2020 00:00:22 +0000 (01:00 +0100)]
net: phy: probe PHY drivers synchronously

If we have scenarios like

mdiobus_register()
-> loads PHY driver module(s)
-> registers PHY driver(s)
-> may schedule async probe
phydev = mdiobus_get_phy()
<phydev action involving PHY driver>

or

phydev = phy_device_create()
-> loads PHY driver module
-> registers PHY driver
-> may schedule async probe
<phydev action involving PHY driver>

then we expect the PHY driver to be bound to the phydev when triggering
the action. This may not be the case in case of asynchronous probing.
Therefore ensure that PHY drivers are probed synchronously.

Default still is sync probing, except async probing is explicitly
requested. I saw some comments that the intention is to promote
async probing for more parallelism in boot process and want to be
prepared for the case that the default is changed to async probing.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-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 agoMerge branch 'implement-DEVLINK_CMD_REGION_NEW'
David S. Miller [Fri, 27 Mar 2020 02:39:27 +0000 (19:39 -0700)]
Merge branch 'implement-DEVLINK_CMD_REGION_NEW'

Jacob Keller says:

====================
implement DEVLINK_CMD_REGION_NEW

This series adds support for the DEVLINK_CMD_REGION_NEW operation, used to
enable userspace requesting a snapshot of a region on demand.

This can be useful to enable adding regions for a driver for which there is
no trigger to create snapshots. By making this a core part of devlink, there
is no need for the drivers to use a separate channel such as debugfs.

The primary intent for this kind of region is to expose device information
that might be useful for diagnostics and information gathering.

The first few patches refactor regions to support a new ops structure for
extending the available operations that regions can perform. This includes
converting the destructor into an op from a function argument.

Next, patches refactor the snapshot id allocation to use an xarray which
tracks the number of current snapshots using a given id. This is done so
that id lifetime can be determined, and ids can be released when no longer
in use.

Without this change, snapshot ids remain used forever, until the snapshot_id
count rolled over UINT_MAX.

Finally, code to enable the previously unused DEVLINK_CMD_REGION_NEW is
added. This code enforces that the snapshot id is always provided, unlike
previous revisions of this series.

Finally, a patch is added to enable using this new command via the .snapshot
callback in both netdevsim and the ice driver.

For the ice driver, a new "nvm-flash" region is added, which will enable
read access to the NVM flash contents. The intention for this is to allow
diagnostics tools to gather information about the device. By using a
snapshot and gathering the NVM contents all at once, the contents can be
atomic.

Links to previous discussions:
1st RFC - https://lore.kernel.org/netdev/20200130225913.1671982-1-jacob.e.keller@intel.com/
2nd RFC - https://lore.kernel.org/netdev/20200214232223.3442651-1-jacob.e.keller@intel.com/
v1 - https://lore.kernel.org/netdev/20200324223445.2077900-1-jacob.e.keller@intel.com/
v2 - https://lore.kernel.org/netdev/20200326035157.2211090-1-jacob.e.keller@intel.com/

Major changes since RFC:
* use an xarray for tracking snapshot ids, rather than an IDR
* remove support for auto-generated snapshot ids in DEVLINK_CMD_REGION_NEW

See each patch for an individual changelog per-patch
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoice: add a devlink region for dumping NVM contents
Jacob Keller [Thu, 26 Mar 2020 18:37:18 +0000 (11:37 -0700)]
ice: add a devlink region for dumping NVM contents

Add a devlink region for exposing the device's Non Volatime Memory flash
contents.

Support the recently added .snapshot operation, enabling userspace to
request a snapshot of the NVM contents via DEVLINK_CMD_REGION_NEW.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonetdevsim: support taking immediate snapshot via devlink
Jacob Keller [Thu, 26 Mar 2020 18:37:17 +0000 (11:37 -0700)]
netdevsim: support taking immediate snapshot via devlink

Implement the .snapshot region operation for the dummy data region. This
enables a region snapshot to be taken upon request via the new
DEVLINK_CMD_REGION_SNAPSHOT command.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: implement DEVLINK_CMD_REGION_NEW
Jacob Keller [Thu, 26 Mar 2020 18:37:16 +0000 (11:37 -0700)]
devlink: implement DEVLINK_CMD_REGION_NEW

Implement support for the DEVLINK_CMD_REGION_NEW command for creating
snapshots. This new command parallels the existing
DEVLINK_CMD_REGION_DEL.

In order for DEVLINK_CMD_REGION_NEW to work for a region, the new
".snapshot" operation must be implemented in the region's ops structure.

The desired snapshot id must be provided. This helps avoid confusion on
the purpose of DEVLINK_CMD_REGION_NEW, and keeps the API simpler.

The requested id will be inserted into the xarray tracking the number of
snapshots using each id. If this id is already used by another snapshot
on any region, an error will be returned.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: track snapshot id usage count using an xarray
Jacob Keller [Thu, 26 Mar 2020 18:37:15 +0000 (11:37 -0700)]
devlink: track snapshot id usage count using an xarray

Each snapshot created for a devlink region must have an id. These ids
are supposed to be unique per "event" that caused the snapshot to be
created. Drivers call devlink_region_snapshot_id_get to obtain a new id
to use for a new event trigger. The id values are tracked per devlink,
so that the same id number can be used if a triggering event creates
multiple snapshots on different regions.

There is no mechanism for snapshot ids to ever be reused. Introduce an
xarray to store the count of how many snapshots are using a given id,
replacing the snapshot_id field previously used for picking the next id.

The devlink_region_snapshot_id_get() function will use xa_alloc to
insert an initial value of 1 value at an available slot between 0 and
U32_MAX.

The new __devlink_snapshot_id_increment() and
__devlink_snapshot_id_decrement() functions will be used to track how
many snapshots currently use an id.

Drivers must now call devlink_snapshot_id_put() in order to release
their reference of the snapshot id after adding region snapshots.

By tracking the total number of snapshots using a given id, it is
possible for the decrement() function to erase the id from the xarray
when it is not in use.

With this method, a snapshot id can become reused again once all
snapshots that referred to it have been deleted via
DEVLINK_CMD_REGION_DEL, and the driver has finished adding snapshots.

This work also paves the way to introduce a mechanism for userspace to
request a snapshot.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: report error once U32_MAX snapshot ids have been used
Jacob Keller [Thu, 26 Mar 2020 18:37:14 +0000 (11:37 -0700)]
devlink: report error once U32_MAX snapshot ids have been used

The devlink_snapshot_id_get() function returns a snapshot id. The
snapshot id is a u32, so there is no way to indicate an error code.

A future change is going to possibly add additional cases where this
function could fail. Refactor the function to return the snapshot id in
an argument, so that it can return zero or an error value.

This ensures that snapshot ids cannot be confused with error values, and
aids in the future refactor of snapshot id allocation management.

Because there is no current way to release previously used snapshot ids,
add a simple check ensuring that an error is reported in case the
snapshot_id would over flow.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: extract snapshot id allocation to helper function
Jacob Keller [Thu, 26 Mar 2020 18:37:13 +0000 (11:37 -0700)]
devlink: extract snapshot id allocation to helper function

A future change is going to implement a new devlink command to request
a snapshot on demand. As part of this, the logic for handling the
snapshot ids will be refactored. To simplify the snapshot id allocation
function, move it to a separate function prefixed by `__`. This helper
function will assume the lock is held.

While no other callers will exist, it simplifies refactoring the logic
because there is no need to complicate the function with gotos to handle
unlocking on failure.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: use -ENOSPC to indicate no more room for snapshots
Jacob Keller [Thu, 26 Mar 2020 18:37:12 +0000 (11:37 -0700)]
devlink: use -ENOSPC to indicate no more room for snapshots

The devlink_region_snapshot_create function returns -ENOMEM when the
maximum number of snapshots has been reached. This is confusing because
it is not an issue of being out of memory. Change this to use -ENOSPC
instead.

Reported-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: add function to take snapshot while locked
Jacob Keller [Thu, 26 Mar 2020 18:37:11 +0000 (11:37 -0700)]
devlink: add function to take snapshot while locked

A future change is going to add a new devlink command to request
a snapshot on demand. This function will want to call the
devlink_region_snapshot_create function while already holding the
devlink instance lock.

Extract the logic of this function into a static function prefixed by
`__` to indicate that it is an internal helper function. Modify the
original function to be implemented in terms of the new locked
function.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: trivial: fix tab in function documentation
Jacob Keller [Thu, 26 Mar 2020 18:37:10 +0000 (11:37 -0700)]
devlink: trivial: fix tab in function documentation

The function documentation comment for devlink_region_snapshot_create
included a literal tab character between 'future analyses' that was
difficult to spot as it happened to only display as one space wide.

Fix the comment to use a space here instead of a stray tab appearing in
the middle of a sentence.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: convert snapshot destructor callback to region op
Jacob Keller [Thu, 26 Mar 2020 18:37:09 +0000 (11:37 -0700)]
devlink: convert snapshot destructor callback to region op

It does not makes sense that two snapshots for a given region would use
different destructors. Simplify snapshot creation by adding
a .destructor op for regions.

This operation will replace the data_destructor for the snapshot
creation, and makes snapshot creation easier.

Noticed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: prepare to support region operations
Jacob Keller [Thu, 26 Mar 2020 18:37:08 +0000 (11:37 -0700)]
devlink: prepare to support region operations

Modify the devlink region code in preparation for adding new operations
on regions.

Create a devlink_region_ops structure, and move the name pointer from
within the devlink_region structure into the ops structure (similar to
the devlink_health_reporter_ops).

This prepares the regions to enable support of additional operations in
the future such as requesting snapshots, or accessing the region
directly without a snapshot.

In order to re-use the constant strings in the mlx4 driver their
declaration must be changed to 'const char * const' to ensure the
compiler realizes that both the data and the pointer cannot change.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>