linux-2.6-microblaze.git
3 years agocan: flexcan: quirks: get rid of long lines
Marc Kleine-Budde [Tue, 22 Sep 2020 14:44:14 +0000 (16:44 +0200)]
can: flexcan: quirks: get rid of long lines

This patch reformats the quirks to get rid of long lines.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Link: https://lore.kernel.org/r/20200922144429.2613631-6-mkl@pengutronix.de
3 years agocan: flexcan: struct flexcan_regs: document registers not affected by soft reset
Marc Kleine-Budde [Tue, 22 Sep 2020 14:44:13 +0000 (16:44 +0200)]
can: flexcan: struct flexcan_regs: document registers not affected by soft reset

This patch documents which registers are not affected by a soft reset of the
flexcan IP core.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Link: https://lore.kernel.org/r/20200922144429.2613631-5-mkl@pengutronix.de
3 years agocan: flexcan: more register names
Marc Kleine-Budde [Tue, 22 Sep 2020 14:44:12 +0000 (16:44 +0200)]
can: flexcan: more register names

This patch adds some new register names and tries to ensure with a
static_assert that the documented offset is correct.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Link: https://lore.kernel.org/r/20200922144429.2613631-4-mkl@pengutronix.de
3 years agocan: flexcan: flexcan_exit_stop_mode(): remove stray empty line
Marc Kleine-Budde [Tue, 22 Sep 2020 14:44:11 +0000 (16:44 +0200)]
can: flexcan: flexcan_exit_stop_mode(): remove stray empty line

This patch removes a stray empty line from the flexcan_exit_stop_mode()
function.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Link: https://lore.kernel.org/r/20200922144429.2613631-3-mkl@pengutronix.de
3 years agocan: flexcan: sort include files alphabetically
Marc Kleine-Budde [Tue, 22 Sep 2020 14:44:10 +0000 (16:44 +0200)]
can: flexcan: sort include files alphabetically

This patch sorts the include files alphabetically.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Link: https://lore.kernel.org/r/20200922144429.2613631-2-mkl@pengutronix.de
3 years agonet: phy: bcm7xxx: Add an entry for BCM72113
Florian Fainelli [Mon, 21 Sep 2020 22:10:53 +0000 (15:10 -0700)]
net: phy: bcm7xxx: Add an entry for BCM72113

BCM72113 features a 28nm integrated EPHY, add an entry to the driver for
it.

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>
3 years agoMerge tag 'linux-can-next-for-5.10-20200921' of git://git.kernel.org/pub/scm/linux...
David S. Miller [Mon, 21 Sep 2020 21:57:05 +0000 (14:57 -0700)]
Merge tag 'linux-can-next-for-5.10-20200921' of git://git./linux/kernel/git/mkl/linux-can-next

Marc Kleine-Budde says:

====================
pull-request: can-next 2020-09-21

this is a pull request of 38 patches for net-next.

the first 5 patches are by Colin Ian King, Alexandre Belloni and me and they
fix various spelling mistakes.

The next patch is by me and fixes the indention in the CAN raw protocol
according to the kernel coding style.

Diego Elio Pettenò contributes two patches to fix dead links in CAN's Kconfig.

Masahiro Yamada's patch removes the "WITH Linux-syscall-note" from SPDX tag of
C files.

AThe next 4 patches are by me and target the CAN device infrastructure and add
error propagation and improve the output of various messages to ease driver
development and debugging.

YueHaibing's patch for the c_can driver removes an unused inline function.

Next follows another patch by Colin Ian King, which removes the unneeded
initialization of a variable in the mcba_usb driver.

A patch by me annotates a fallthrough in the mscan driver.

The ti_hecc driver is converted to use devm_platform_ioremap_resource_byname()
in a patch by Dejin Zheng.

Liu Shixin's patch converts the pcan_usb_pro driver to make use of
le32_add_cpu() instead of open coding it.

Wang Hai's patch for the peak_pciefd_main driver removes an unused makro.

Vaibhav Gupta's patch converts the pch_can driver to generic power management.

Stephane Grosjean improves the pcan_usb usb driver by first documenting the
commands sent to the device and by adding support of rxerr/txerr counters.

The next patch is by me and cleans up the Kconfig of the CAN SPI drivers.

The next 6 patches all target the mcp251x driver, they are by Timo Schlüßler,
Andy Shevchenko, Tim Harvey and me. They update the DT bindings documentation,
sort the include files alphabetically, add GPIO support, make use of the
readx_poll_timeout() helper, and add support for half duplex SPI-controllers.

Wolfram Sang contributes a patch to update the contact email address in the
mscan driver, while Zhang Changzhong updates the clock handling.

The next patch is by and updates the rx-offload infrastructure to support
callback less usage.

The last 6 patches add support for the mcp25xxfd CAN SPI driver. First the
dt-bindings are added by Oleksij Rempel, the regmap infrastructure and the main
driver is contributed by me. Kurt Van Dijck adds listen-only support,
Manivannan Sadhasivam adds himself as maintainer, and Thomas Kopp himself as a
reviewer.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge tag 'mac80211-next-for-net-next-2020-09-21' of git://git.kernel.org/pub/scm...
David S. Miller [Mon, 21 Sep 2020 21:55:09 +0000 (14:55 -0700)]
Merge tag 'mac80211-next-for-net-next-2020-09-21' of git://git./linux/kernel/git/jberg/mac80211-next

Johannes Berg says:

====================
This time we have:
 * some AP-side infrastructure for FILS discovery and
   unsolicited probe resonses
 * a major rework of the encapsulation/header conversion
   offload from Felix, to fit better with e.g. AP_VLAN
   interfaces
 * performance fix for VHT A-MPDU size, don't limit to HT
 * some initial patches for S1G (sub 1 GHz) support, more
   will come in this area
 * minor cleanups
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: natsemi: Remove set but not used variable
Zheng Yongjun [Mon, 21 Sep 2020 12:18:41 +0000 (20:18 +0800)]
net: natsemi: Remove set but not used variable

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

drivers/net/ethernet/natsemi/ns83820.c: In function ns83820_get_link_ksettings:
drivers/net/ethernet/natsemi/ns83820.c:1210:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]

`tanar` is never used, so remove it.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: unix: remove redundant assignment to variable 'err'
Jing Xiangfeng [Mon, 21 Sep 2020 03:29:52 +0000 (11:29 +0800)]
net: unix: remove redundant assignment to variable 'err'

After commit 37ab4fa7844a ("net: unix: allow bind to fail on mutex lock"),
the assignment to err is redundant. So remove it.

Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: phy: realtek: enable ALDPS to save power for RTL8211F
Jisheng Zhang [Mon, 21 Sep 2020 01:13:54 +0000 (09:13 +0800)]
net: phy: realtek: enable ALDPS to save power for RTL8211F

Enable ALDPS(Advanced Link Down Power Saving) to save power when
link down.

Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: dsa: rtl8366rb: Support all 4096 VLANs
Linus Walleij [Sun, 20 Sep 2020 20:37:33 +0000 (22:37 +0200)]
net: dsa: rtl8366rb: Support all 4096 VLANs

There is an off-by-one error in rtl8366rb_is_vlan_valid()
making VLANs 0..4094 valid while it should be 1..4095.
Fix it.

Fixes: d8652956cf37 ("net: dsa: realtek-smi: Add Realtek SMI driver")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: dsa: mt7530: Add some return-value checks
Alex Dewar [Sat, 19 Sep 2020 19:28:10 +0000 (20:28 +0100)]
net: dsa: mt7530: Add some return-value checks

In mt7531_cpu_port_config(), if the variable port is neither 5 nor 6,
then variable interface will be used uninitialised. Change the function
to return -EINVAL in this case.

As the return value of mt7531_cpu_port_config() is never checked
(even though it returns an int) add a check in the correct place so that
the error can be passed up the call stack. Now that we correctly handle
errors thrown in this function, also check the return value of
mt7531_mac_config() in case an error occurs here. Also add misisng
checks to mt7530_setup() and mt7531_setup(), which are another level
further up the call stack.

Fixes: c288575f7810 ("net: dsa: mt7530: Add the support of MT7531 switch")
Addresses-Coverity: 1496993 ("Uninitialized variables")
Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet-sysfs: add backlog len and CPU id to softnet data
Paolo Abeni [Fri, 18 Sep 2020 16:00:46 +0000 (18:00 +0200)]
net-sysfs: add backlog len and CPU id to softnet data

Currently the backlog status in not exposed to user-space.
Since long backlogs (or simply not empty ones) can be a
source of noticeable latency, -RT deployments need some way
to inspect it.

Additionally, there isn't a direct match between 'softnet_stat'
lines and the related CPU - sd for offline CPUs are not dumped -
so this patch also includes the CPU id into such entry.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge branch 'Update-license-and-polish-ENA-driver-code'
David S. Miller [Mon, 21 Sep 2020 20:54:23 +0000 (13:54 -0700)]
Merge branch 'Update-license-and-polish-ENA-driver-code'

Shay Agroskin says:

====================
Update license and polish ENA driver code

This series adds the following:
- Change driver's license into SPDX format
- Capitalize all log prints in ENA driver
- Fix issues raised by static checkers
- Improve code readability by adding functions, fix spelling
  mistakes etc.
- Update driver's documentation

Changed from previous version:
v1->v2: dropped patch that transforms pr_* log prints into dev_* prints
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: ena: update ena documentation
Shay Agroskin [Mon, 21 Sep 2020 08:37:42 +0000 (11:37 +0300)]
net: ena: update ena documentation

The PCI vendor IDs in the documentation inaccurately describe the ENA
devices. For example, the 1d0f:ec20 can have LLQ support. The driver
loads in LLQ mode by default, and a message is printed to the kernel
ring if the mode isn't supported by the device, so the device table
isn't needed.

Also, LLQ can support various entry sizes, so the documentation is
updated to reflect that.

Interrupt moderation description is also updated to be more accurate.

Signed-off-by: Shay Agroskin <shayagr@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: ena: Fix all static chekers' warnings
Shay Agroskin [Mon, 21 Sep 2020 08:37:41 +0000 (11:37 +0300)]
net: ena: Fix all static chekers' warnings

After running Sparse checker on the driver using
    make C=1 M=drivers/net/ethernet/amazon/ena

the only error that is thrown is:
    sparse: sparse: Using plain integer as NULL pointer
about the line
    struct ena_calc_queue_size_ctx calc_queue_ctx = { 0 };

This patch fixes this warning, thus making our driver free (for now) of
Sparse errors/warnings.

To make a more complete work, this patch also fixes all static warnings
that were found using an internal static checker.

Signed-off-by: Ido Segev <idose@amazon.com>
Signed-off-by: Shay Agroskin <shayagr@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: ena: Change RSS related macros and variables names
Shay Agroskin [Mon, 21 Sep 2020 08:37:40 +0000 (11:37 +0300)]
net: ena: Change RSS related macros and variables names

The formal name changes to "ENA_ADMIN_RSS_INDIRECTION_TABLE_CONFIG".
Indirection is the ability to reference "something" using "something else"
instead of the value itself.
Indirection table, as the name implies, is the ability to reference
CPU/Queue value using hash-to-CPU table instead of CPU/Queue itself.

This patch renames the variable keys_num, which describes the number of
words in the RSS hash key, to key_parts which makes its purpose clearer
in RSS context.

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>
3 years agonet: ena: Remove redundant print of placement policy
Shay Agroskin [Mon, 21 Sep 2020 08:37:39 +0000 (11:37 +0300)]
net: ena: Remove redundant print of placement policy

The placement policy is printed in the process of queue creation in
ena_up(). No need to print it in ena_probe().

Signed-off-by: Arthur Kiyanovski <akiyano@amazon.com>
Signed-off-by: Shay Agroskin <shayagr@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 years agoMAINTAINERS: Add reviewer entry for microchip mcp25xxfd SPI-CAN network driver
Thomas Kopp [Fri, 18 Sep 2020 17:25:36 +0000 (19:25 +0200)]
MAINTAINERS: Add reviewer entry for microchip mcp25xxfd SPI-CAN network driver

This patch adds Thomas Kopp as a reviewer for the mcp25xxfd CAN driver.

Signed-off-by: Thomas Kopp <thomas.kopp@microchip.com>
Link: https://lore.kernel.org/r/20200916101334.1277-1-thomas.kopp@microchip.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agoMAINTAINERS: Add entry for Microchip MCP25XXFD SPI-CAN network driver
Manivannan Sadhasivam [Fri, 18 Sep 2020 17:25:35 +0000 (19:25 +0200)]
MAINTAINERS: Add entry for Microchip MCP25XXFD SPI-CAN network driver

Add MAINTAINERS entry for Microchip MCP25XXFD SPI-CAN network driver.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20200910133806.25077-7-manivannan.sadhasivam@linaro.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: mcp25xxfd: add listen-only mode
Kurt Van Dijck [Fri, 18 Sep 2020 17:25:34 +0000 (19:25 +0200)]
can: mcp25xxfd: add listen-only mode

This commit enables listen-only mode, which works internally like CANFD mode.

Signed-off-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Link: https://lore.kernel.org/r/20200918172536.2074504-5-mkl@pengutronix.de
3 years agocan: mcp25xxfd: add driver for Microchip MCP25xxFD SPI CAN
Marc Kleine-Budde [Fri, 18 Sep 2020 17:25:33 +0000 (19:25 +0200)]
can: mcp25xxfd: add driver for Microchip MCP25xxFD SPI CAN

This patch adds support for the Microchip MCP25xxFD SPI CAN controller family.

Tested-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
Tested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Link: https://lore.kernel.org/r/20200918172536.2074504-4-mkl@pengutronix.de
3 years agocan: mcp25xxfd: add regmap infrastructure
Marc Kleine-Budde [Fri, 18 Sep 2020 17:25:32 +0000 (19:25 +0200)]
can: mcp25xxfd: add regmap infrastructure

This patch adds the regmap infrastructure for the Microchip MCP25xxFD SPI CAN
controller family. The actual driver is added in the next commit.

Tested-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
Tested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Link: https://lore.kernel.org/r/20200918172536.2074504-3-mkl@pengutronix.de
3 years agodt-binding: can: mcp25xxfd: document device tree bindings
Oleksij Rempel [Fri, 18 Sep 2020 17:25:31 +0000 (19:25 +0200)]
dt-binding: can: mcp25xxfd: document device tree bindings

This patch adds the device-tree binding documentation for the Microchip
MCP25xxFD SPI CAN controller family.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Link: https://lore.kernel.org/r/20200918172536.2074504-2-mkl@pengutronix.de
3 years agocan: rx-offload: can_rx_offload_add_manual(): add new initialization function
Marc Kleine-Budde [Tue, 15 Sep 2020 22:35:22 +0000 (00:35 +0200)]
can: rx-offload: can_rx_offload_add_manual(): add new initialization function

This patch adds a new initialization function:
can_rx_offload_add_manual()

It should be used to add support rx-offload to a driver, if the callback
mechanism should not be used. Use e.g. can_rx_offload_queue_sorted() to queue
skbs into rx-offload.

Link: https://lore.kernel.org/r/20200915223527.1417033-33-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: mscan: simplify clock enable/disable
Zhang Changzhong [Fri, 17 Jul 2020 08:01:15 +0000 (16:01 +0800)]
can: mscan: simplify clock enable/disable

All the NULL checks are pointless, clk_*() routines already deal with
NULL just fine.

Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
Link: https://lore.kernel.org/r/1594972875-27631-1-git-send-email-zhangchangzhong@huawei.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: mscan: mpc5xxx_can: update contact email
Wolfram Sang [Sat, 2 May 2020 14:26:56 +0000 (16:26 +0200)]
can: mscan: mpc5xxx_can: update contact email

The 'pengutronix' address is defunct for years. Use the proper contact
address.

Signed-off-by: Wolfram Sang <wsa@kernel.org>
Link: https://lore.kernel.org/r/20200502142657.19199-1-wsa@kernel.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: mcp251x: add support for half duplex controllers
Tim Harvey [Thu, 23 Jul 2020 14:57:55 +0000 (07:57 -0700)]
can: mcp251x: add support for half duplex controllers

Some SPI host controllers do not support full-duplex SPI and are
marked as such via the SPI_CONTROLLER_HALF_DUPLEX controller flag.

For such controllers use half duplex transactions but retain full
duplex transactions for the controllers that can handle those.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Link: https://lore.kernel.org/r/1595516275-1179-1-git-send-email-tharvey@gateworks.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: mcp251x: Use readx_poll_timeout() helper
Andy Shevchenko [Mon, 17 Feb 2020 16:10:38 +0000 (18:10 +0200)]
can: mcp251x: Use readx_poll_timeout() helper

We may use special helper macro to poll IO till condition or timeout occurs.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200217161038.25009-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: mcp251x: add GPIO support
Timo Schlüßler [Fri, 11 Oct 2019 13:38:21 +0000 (15:38 +0200)]
can: mcp251x: add GPIO support

The mcp251x variants feature 3 general purpose digital inputs and 2
outputs. With this patch they are accessible through the gpio framework.

Signed-off-by: Timo Schlüßler <schluessler@krause.de>
Tested-by: Timo Schlüßler <schluessler@krause.de>
Link: https://lore.kernel.org/r/20200915223527.1417033-28-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: mcp251x: sort include files alphabetically
Marc Kleine-Budde [Tue, 15 Sep 2020 22:35:16 +0000 (00:35 +0200)]
can: mcp251x: sort include files alphabetically

This patch sorts the include files alphabetically.

Link: https://lore.kernel.org/r/20200915223527.1417033-27-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agodt-bindings: can: mcp251x: document GPIO support
Marc Kleine-Budde [Tue, 15 Sep 2020 22:35:15 +0000 (00:35 +0200)]
dt-bindings: can: mcp251x: document GPIO support

The next patch adds gpio controller support to the mcp251x driver. This
patch updates the binding accordingly.

Cc: Timo Schlüßler <schluessler@krause.de>
Link: https://lore.kernel.org/r/20200915223527.1417033-26-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agodt-bindings: can: mcp251x: change example interrupt type to IRQ_TYPE_LEVEL_LOW
Marc Kleine-Budde [Tue, 15 Sep 2020 22:35:14 +0000 (00:35 +0200)]
dt-bindings: can: mcp251x: change example interrupt type to IRQ_TYPE_LEVEL_LOW

The MCP2515 datasheet clearly describes a level-triggered interrupt pin.
Change example bindings accordingly.

Link: https://lore.kernel.org/r/20200915223527.1417033-25-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: spi: Kconfig: remove unneeded dependencies form Kconfig symbols
Marc Kleine-Budde [Tue, 15 Sep 2020 22:35:13 +0000 (00:35 +0200)]
can: spi: Kconfig: remove unneeded dependencies form Kconfig symbols

Since commits

    653ee35ce6d5 ("can: hi311x: remove custom DMA mapped buffer")
    Fixes: df58525df395 ("can: mcp251x: remove custom DMA mapped buffer")

both the hi3111x and the mcp251x driver don't make use of the DMA API
any more. So we can safely remove the HAS_DMA dependency.

While we're here, remove the unneeded CAN_DEV and SPI dependencies from
the CAN_HI311X symbol, as the parent menus already have these
dependencies.

Link: https://lore.kernel.org/r/20200915223527.1417033-24-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: pcan_usb: add support of rxerr/txerr counters
Stephane Grosjean [Fri, 6 Dec 2019 15:38:03 +0000 (16:38 +0100)]
can: pcan_usb: add support of rxerr/txerr counters

This patch adds the support of the rx/tx errors CAN counters to the
driver of the PCAN-USB PC-CAN interface from PEAK-System GmbH.

The PCAN-USB is capable of giving back the values of the rx/tx errors
counters, to provide more details and statistics to the linux-can layer.
Getting these values allows the driver to better tune CAN_ERR_CRTL_TX_xxx
and CAN_ERR_CRTL_RX_xxx bits in case of the interface enters any
CAN_STATE_ERROR_xxx state.

Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
Link: https://lore.kernel.org/r/20191206153803.17725-3-s.grosjean@peak-system.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: pcan_usb: Document the commands sent to the device
Stephane Grosjean [Fri, 6 Dec 2019 15:38:02 +0000 (16:38 +0100)]
can: pcan_usb: Document the commands sent to the device

This patch documents the functions and numbers of the commands sent by the
driver to the PCAN-USB CAN device from PEAK-System GmbH.

Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
Link: https://lore.kernel.org/r/20191206153803.17725-2-s.grosjean@peak-system.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: pch_can: use generic power management
Vaibhav Gupta [Tue, 28 Jul 2020 08:57:57 +0000 (14:27 +0530)]
can: pch_can: use generic power management

Drivers using legacy power management .suspen()/.resume() callbacks have to
manage PCI states and device's PM states themselves. They also need to take
care of standard configuration registers.

Switch to generic power management framework using a single "struct dev_pm_ops"
variable to take the unnecessary load from the driver. This also avoids the
need for the driver to directly call most of the PCI helper functions and
device power state control functions, as through the generic framework PCI Core
takes care of the necessary operations, and drivers are required to do only
device-specific jobs.

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Link: https://lore.kernel.org/r/20200728085757.888620-1-vaibhavgupta40@gmail.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: peak_canfd: Remove unused macros
Wang Hai [Fri, 4 Sep 2020 13:12:47 +0000 (21:12 +0800)]
can: peak_canfd: Remove unused macros

CANFD_CLK_SEL_DIV_MASK and CANFD_OPTIONS_SET are
never used after they were introduced. Remove them.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Hai <wanghai38@huawei.com>
Link: https://lore.kernel.org/r/20200904131247.23021-1-wanghai38@huawei.com
[mkl: keep CANFD_CLK_SEL_DIV_MASK for documentation purpose]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: peak_usb: convert to use le32_add_cpu()
Liu Shixin [Mon, 14 Sep 2020 04:17:44 +0000 (12:17 +0800)]
can: peak_usb: convert to use le32_add_cpu()

Convert cpu_to_le32(le32_to_cpu(E1) + E2) to use le32_add_cpu().

Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Link: https://lore.kernel.org/r/20200914041744.3701840-1-liushixin2@huawei.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: ti_hecc: convert to devm_platform_ioremap_resource_byname()
Dejin Zheng [Mon, 20 Apr 2020 13:22:07 +0000 (21:22 +0800)]
can: ti_hecc: convert to devm_platform_ioremap_resource_byname()

Use the function devm_platform_ioremap_resource_byname() to simplify
source code which calls the functions platform_get_resource_byname()
and devm_ioremap_resource(). Remove also a few error messages which
became unnecessary with this software refactoring.

Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
Link: https://lore.kernel.org/r/20200420132207.8536-1-zhengdejin5@gmail.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: mscan: mark expected switch fall-through
Marc Kleine-Budde [Tue, 15 Sep 2020 22:35:06 +0000 (00:35 +0200)]
can: mscan: mark expected switch fall-through

As -Wimplicit-fallthrough is now enabled the mscan driver shows this warning,
which is fixed by this patch:

drivers/net/can/mscan/mscan.c: In function ‘mscan_start_xmit’:
drivers/net/can/mscan/mscan.c:211:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
  211 |   netif_stop_queue(dev);
      |   ^~~~~~~~~~~~~~~~~~~~~
drivers/net/can/mscan/mscan.c:212:2: note: here
  212 |  case 2:
      |  ^~~~

Link: https://lore.kernel.org/r/20200915223527.1417033-17-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: mcba_usb: remove redundant initialization of variable err
Colin Ian King [Mon, 6 Jul 2020 16:42:40 +0000 (17:42 +0100)]
can: mcba_usb: remove redundant initialization of variable err

The variable err is being initialized with a value that is never read
and it is being updated later with a new value.  The initialization is
redundant and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20200706164240.518623-1-colin.king@canonical.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: c_can: Remove unused inline function
YueHaibing [Tue, 5 May 2020 08:41:49 +0000 (16:41 +0800)]
can: c_can: Remove unused inline function

commit 524369e2391f ("can: c_can: remove obsolete STRICT_FRAME_ORDERING Kconfig option")
left behind this, remove it.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20200505084149.23848-1-yuehaibing@huawei.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: dev: can_bus_off(): print scheduling of restart if activated
Marc Kleine-Budde [Tue, 15 Sep 2020 22:35:03 +0000 (00:35 +0200)]
can: dev: can_bus_off(): print scheduling of restart if activated

If a CAN device goes into bus-off and has automatic restart enabled, inform
user that a automatic restart is scheduled after the configured delay.

Link: https://lore.kernel.org/r/20200915223527.1417033-14-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: dev: can_change_state(): print human readable state change messages
Marc Kleine-Budde [Tue, 15 Sep 2020 22:35:02 +0000 (00:35 +0200)]
can: dev: can_change_state(): print human readable state change messages

In order to ease debugging let can_change_state() print the human readable
state change messages. Also print the old and new state.

Link: https://lore.kernel.org/r/20200915223527.1417033-13-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: dev: can_put_echo_skb(): propagate error in case of errors
Marc Kleine-Budde [Tue, 15 Sep 2020 22:35:01 +0000 (00:35 +0200)]
can: dev: can_put_echo_skb(): propagate error in case of errors

The function can_put_echo_skb() can fail for several reasons. It may
fail due to OOM, but when it fails it's usually due to locking problems
in the driver.

In order to help developing and debugging of new drivers propagate error
value in case of errors.

Link: https://lore.kernel.org/r/20200915223527.1417033-12-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: dev: can_put_echo_skb(): print number of echo_skb that is occupied
Marc Kleine-Budde [Tue, 15 Sep 2020 22:35:00 +0000 (00:35 +0200)]
can: dev: can_put_echo_skb(): print number of echo_skb that is occupied

This patch prints the number of the occupied echo_skb, to ease
implementing and debugging of new drivers.

Link: https://lore.kernel.org/r/20200915223527.1417033-11-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: remove "WITH Linux-syscall-note" from SPDX tag of C files
Masahiro Yamada [Fri, 3 Apr 2020 07:37:41 +0000 (16:37 +0900)]
can: remove "WITH Linux-syscall-note" from SPDX tag of C files

The "WITH Linux-syscall-note" exception is intended for UAPI headers.

See LICENSES/exceptions/Linux-syscall-note

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Link: https://lore.kernel.org/r/20200403073741.18352-1-masahiroy@kernel.org
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: softing: update dead link
Diego Elio Pettenò [Mon, 13 Apr 2020 17:02:41 +0000 (18:02 +0100)]
can: softing: update dead link

BerliOS has not been operating for more than five years. linux-can moved to
GitHub.

Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.com>
Link: https://lore.kernel.org/r/20200413170241.13207-1-flameeyes@flameeyes.com
[mkl: split into two patches - handle softing part here]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: slcan: update dead link
Diego Elio Pettenò [Mon, 13 Apr 2020 17:02:41 +0000 (18:02 +0100)]
can: slcan: update dead link

BerliOS has not been operating for more than five years. linux-can moved to
GitHub.

Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.com>
Link: https://lore.kernel.org/r/20200413170241.13207-1-flameeyes@flameeyes.com
[mkl: split into two patches - handle slcan part here]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: raw: fix indention
Marc Kleine-Budde [Tue, 15 Sep 2020 22:34:56 +0000 (00:34 +0200)]
can: raw: fix indention

This patch fixes the indention to follow kernel coding style.

Link: https://lore.kernel.org/r/20200915223527.1417033-7-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: drivers: fix spelling mistakes
Marc Kleine-Budde [Tue, 15 Sep 2020 22:34:55 +0000 (00:34 +0200)]
can: drivers: fix spelling mistakes

This patch fixes spelling erros found by "codespell" in the
drivers/net/can subtree.

Link: https://lore.kernel.org/r/20200915223527.1417033-6-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: net: fix spelling mistakes
Marc Kleine-Budde [Tue, 15 Sep 2020 22:34:54 +0000 (00:34 +0200)]
can: net: fix spelling mistakes

This patch fixes spelling erros found by "codespell" in the net/can
subtree.

Link: https://lore.kernel.org/r/20200915223527.1417033-5-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: include: fix spelling mistakes
Marc Kleine-Budde [Tue, 15 Sep 2020 22:34:53 +0000 (00:34 +0200)]
can: include: fix spelling mistakes

This patch fixes spelling erros found by "codespell" in the
include/linux/can subtree.

Link: https://lore.kernel.org/r/20200915223527.1417033-4-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: flexcan: fix spelling mistake "reserverd" -> "reserved"
Alexandre Belloni [Fri, 14 Feb 2020 14:17:51 +0000 (15:17 +0100)]
can: flexcan: fix spelling mistake "reserverd" -> "reserved"

Fix a mistake in a register layout description.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20200214141751.21168-1-alexandre.belloni@bootlin.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agocan: grcan: fix spelling mistake "buss" -> "bus"
Colin Ian King [Thu, 6 Aug 2020 10:56:16 +0000 (11:56 +0100)]
can: grcan: fix spelling mistake "buss" -> "bus"

There is a spelling mistake in a netdev_err error message. Fix it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20200806105616.46790-1-colin.king@canonical.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>