]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/log
mirror_ubuntu-eoan-kernel.git
5 years agocan: flexcan: split the Message Buffer RAM area
Pankaj Bansal [Tue, 28 Aug 2018 17:49:12 +0000 (23:19 +0530)]
can: flexcan: split the Message Buffer RAM area

The message buffer RAM area is not a contiguous 1KB area but 2 partitions
of 512 bytes each. Till now, we used Message buffers with payload size 8
bytes, which translates to 32 MBs per partition and no spare space is left
in any partition.
However, in upcoming SOC LX2160A the message buffers can have payload size
64 bytes. This results in less than 32 MBs per partition and some empty
area is left at the end of each partition.This empty area should not be
accessed.
Therefore, split the Message Buffer RAM area into two partitions.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: flexcan: Add provision for variable payload size
Pankaj Bansal [Fri, 23 Nov 2018 21:18:44 +0000 (22:18 +0100)]
can: flexcan: Add provision for variable payload size

Till now the flexcan module supported 8 byte payload size as per CAN 2.0
specifications. But now upcoming flexcan module in NXP LX2160A SOC
supports CAN FD protocol too. The Message buffers need to be configured
to have payload size 64 bytes.

Therefore, added provision in the driver for payload size to be 64 bytes.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: flexcan: move rx_offload_add() from flexcan_probe() to flexcan_open()
Pankaj Bansal [Mon, 13 Aug 2018 18:20:49 +0000 (23:50 +0530)]
can: flexcan: move rx_offload_add() from flexcan_probe() to flexcan_open()

rx offload depends on number of message buffers, which in turn depends
on messgae buffer size. with the upcoming LX2160A SOC the message buffer
size can be configured to 72 bytes if it were to be used in CAN FD mode.

The current mode in which the flexcan is being operated is known at the
time of flexcan_open() but not at the time of flexcan_probe().

Therefore, move the rx_offload_add() from flexcan_probe() to
flexcan_open(). correspondingly, move rx_offload_delete() from
flexcan_remove() to flexcan_close().

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: flexcan: flexcan_chip_start(): enable loopback mode in flexcan
Pankaj Bansal [Mon, 13 Aug 2018 18:20:48 +0000 (23:50 +0530)]
can: flexcan: flexcan_chip_start(): enable loopback mode in flexcan

Self reception disable bit needs to be cleared for loopback mode to work
in flexcan.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: flexcan: add self wakeup support
Aisheng Dong [Fri, 23 Nov 2018 08:35:33 +0000 (08:35 +0000)]
can: flexcan: add self wakeup support

If wakeup is enabled, enter stop mode, else enter disabled mode. Self wake
can only work on stop mode.

Starting from IMX6, the flexcan stop mode control bits is SoC specific,
move it out of IP driver and parse it from devicetree.

Signed-off-by: Aisheng Dong <aisheng.dong@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agodt-bindings: can: flexcan: add stop mode property to device tree
Aisheng Dong [Fri, 23 Nov 2018 08:35:29 +0000 (08:35 +0000)]
dt-bindings: can: flexcan: add stop mode property to device tree

The FlexCAN controller can parse the stop mode property to enable CAN
self wakeup feature.

Signed-off-by: Aisheng Dong <aisheng.dong@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: flexcan: flexcan_chip_start(): adjust comment to match the code
Marc Kleine-Budde [Fri, 17 Aug 2018 12:52:58 +0000 (14:52 +0200)]
can: flexcan: flexcan_chip_start(): adjust comment to match the code

With the conversion of the flexcan driver to support both timestamp and
FIFO mode the setup of the MCR register ("enable fifo") has been moved.

This patch moves the comment too, in order to match the code again.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: flexcan: FLEXCAN_IFLAG_MB: add () around macro argument
Marc Kleine-Budde [Wed, 28 Nov 2018 14:31:37 +0000 (15:31 +0100)]
can: flexcan: FLEXCAN_IFLAG_MB: add () around macro argument

This patch fixes the following checkpatch warning:

| Macro argument 'x' may be better as '(x)' to avoid precedence issues

Fixes: cbffaf7aa09e ("can: flexcan: Always use last mailbox for TX")
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: flexcan: flexcan_irq(): fix indention
Marc Kleine-Budde [Wed, 28 Nov 2018 14:45:27 +0000 (15:45 +0100)]
can: flexcan: flexcan_irq(): fix indention

The patch fixes the indention by replacing space by tabs, as noted by
checkpatch:

| ERROR: code indent should use tabs where possible
| #980: FILE: drivers/net/can/flexcan.c:980:

Fixes: da49a8075c00 ("can: flexcan: implement error passive state quirk")
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: flexcan: flexcan_start_xmit(): fix indention
Marc Kleine-Budde [Mon, 12 Nov 2018 14:33:57 +0000 (15:33 +0100)]
can: flexcan: flexcan_start_xmit(): fix indention

This patch fixes the indentio nin flexcan_start_xmit() by alligning the
code to the opening parenthesis.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: flexcan: enable flexcan for all architectures
Pankaj Bansal [Wed, 1 Aug 2018 14:06:45 +0000 (19:36 +0530)]
can: flexcan: enable flexcan for all architectures

flexcan is an IP module independent of the SOC architecture.
Therefore, enable it for all architectures.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: rcar: add SPDX identifiers to Kconfig and Makefile
Kuninori Morimoto [Wed, 26 Sep 2018 01:41:53 +0000 (01:41 +0000)]
can: rcar: add SPDX identifiers to Kconfig and Makefile

This patch adds SPDX-License-Identifier to Kconfig and Makefile.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Acked-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: rcar: use SPDX identifier for Renesas drivers
Wolfram Sang [Thu, 23 Aug 2018 13:34:55 +0000 (15:34 +0200)]
can: rcar: use SPDX identifier for Renesas drivers

Adopt the SPDX license identifier headers to ease license compliance
management.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: sja1000: plx_pci: add support for ASEM CAN raw device
Flavio Suligoi [Tue, 7 Aug 2018 07:17:19 +0000 (09:17 +0200)]
can: sja1000: plx_pci: add support for ASEM CAN raw device

This patch adds support for ASEM opto-isolated dual channels
CAN raw device (http://www.asem.it)

Signed-off-by: Flavio Suligoi <f.suligoi@asem.it>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: xilinx: add can 2.0 support
Shubhrajyoti Datta [Fri, 12 Oct 2018 04:25:08 +0000 (09:55 +0530)]
can: xilinx: add can 2.0 support

Add support for can 2.0.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agodt-bindings: can: xilinx_can: add Xilinx CAN FD 2.0 bindings
Shubhrajyoti Datta [Fri, 12 Oct 2018 04:25:09 +0000 (09:55 +0530)]
dt-bindings: can: xilinx_can: add Xilinx CAN FD 2.0 bindings

Add compatible string and new attributes to support the Xilinx CAN
FD 2.0.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: xilinx: fix return type of ndo_start_xmit function
YueHaibing [Wed, 26 Sep 2018 10:32:29 +0000 (18:32 +0800)]
can: xilinx: fix return type of ndo_start_xmit function

The method ndo_start_xmit() is defined as returning an 'netdev_tx_t',
which is a typedef for an enum type, so make sure the implementation in
this driver has returns 'netdev_tx_t' value, and change the function
return type to netdev_tx_t.

Found by coccinelle.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: ucan: fix spelling mistake: "resumbmitting" -> "resubmitting"
Colin Ian King [Mon, 30 Jul 2018 13:40:37 +0000 (14:40 +0100)]
can: ucan: fix spelling mistake: "resumbmitting" -> "resubmitting"

Trivial fix to spelling mistake in netdev_dbg error message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agonet/ipv4: Fix missing raw_init when CONFIG_PROC_FS is disabled
David Ahern [Wed, 28 Nov 2018 04:52:24 +0000 (20:52 -0800)]
net/ipv4: Fix missing raw_init when CONFIG_PROC_FS is disabled

Randy reported when CONFIG_PROC_FS is not enabled:
    ld: net/ipv4/af_inet.o: in function `inet_init':
    af_inet.c:(.init.text+0x42d): undefined reference to `raw_init'

Fix by moving the endif up to the end of the proc entries

Fixes: 6897445fb194c ("net: provide a sysctl raw_l3mdev_accept for raw socket lookup with VRFs")
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Mike Manning <mmanning@vyatta.att-mail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'bnx2x-Popoulate-firmware-versions-in-driver-info-query'
David S. Miller [Wed, 28 Nov 2018 00:41:19 +0000 (16:41 -0800)]
Merge branch 'bnx2x-Popoulate-firmware-versions-in-driver-info-query'

Sudarsana Reddy Kalluru says:

====================
bnx2x: Popoulate firmware versions in driver info query.

The patch series populates MBI and storm firware versions in the ethtool
driver info query.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agobnx2x: Add storm FW version to ethtool driver query output.
Sudarsana Reddy Kalluru [Tue, 27 Nov 2018 06:25:57 +0000 (22:25 -0800)]
bnx2x: Add storm FW version to ethtool driver query output.

The patch populates the Storm FW version in the ethtool driver query data.

Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Ariel Elior <Ariel.Elior@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agobnx2x: Add MBI version to ethtool driver query output.
Sudarsana Reddy Kalluru [Tue, 27 Nov 2018 06:25:56 +0000 (22:25 -0800)]
bnx2x: Add MBI version to ethtool driver query output.

The patch populates the MBI version in the ethtool driver query data.
Adding 'extended_dev_info_shared_cfg' structure describing the nvram
structure, this is required to access the mbi version string.

Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Ariel Elior <Ariel.Elior@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agotcp: remove hdrlen argument from tcp_queue_rcv()
Eric Dumazet [Mon, 26 Nov 2018 22:49:12 +0000 (14:49 -0800)]
tcp: remove hdrlen argument from tcp_queue_rcv()

Only one caller needs to pull TCP headers, so lets
move __skb_pull() to the caller side.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/ncsi: Add NCSI Mellanox OEM command
Vijay Khemka [Mon, 26 Nov 2018 21:49:04 +0000 (13:49 -0800)]
net/ncsi: Add NCSI Mellanox OEM command

This patch adds OEM Mellanox commands and response handling. It also
defines OEM Get MAC Address handler to get and configure the device.

ncsi_oem_gma_handler_mlx: This handler send NCSI mellanox command for
getting mac address.
ncsi_rsp_handler_oem_mlx: This handles response received for all
mellanox OEM commands.
ncsi_rsp_handler_oem_mlx_gma: This handles get mac address response and
set it to device.

Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agor8169: remove unneeded mmiowb barriers
Heiner Kallweit [Mon, 26 Nov 2018 19:24:16 +0000 (20:24 +0100)]
r8169: remove unneeded mmiowb barriers

writex() has implicit barriers, that's what makes it different from
writex_relaxed(). Therefore these calls to mmiowb() can be removed.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: hns3: Config NIC port speed same as that of optical module
Peng Li [Mon, 26 Nov 2018 18:43:00 +0000 (18:43 +0000)]
net: hns3: Config NIC port speed same as that of optical module

Port 0/1 of HiP08 supports 10G and 25G. This patch adds a
change to configure NIC port speed same as that of  optical
module(SFP/QFSP). Driver gets the optical module speed and
sets NIC port speed accordingly.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'net-nsid-interpretation'
David S. Miller [Wed, 28 Nov 2018 00:20:20 +0000 (16:20 -0800)]
Merge branch 'net-nsid-interpretation'

Nicolas Dichtel says:

====================
Ease to interpret net-nsid

The goal of this series is to ease the interpretation of nsid received in
netlink messages from other netns (when the user uses
NETLINK_F_LISTEN_ALL_NSID).

After this series, with a patched iproute2:

$ ip netns add foo
$ ip netns add bar
$ touch /var/run/netns/init_net
$ mount --bind /proc/1/ns/net /var/run/netns/init_net
$ ip netns set init_net 11
$ ip netns set foo 12
$ ip netns set bar 13
$ ip netns
init_net (id: 11)
bar (id: 13)
foo (id: 12)
$ ip -n foo netns set init_net 21
$ ip -n foo netns set foo 22
$ ip -n foo netns set bar 23
$ ip -n foo netns
init_net (id: 21)
bar (id: 23)
foo (id: 22)
$ ip -n bar netns set init_net 31
$ ip -n bar netns set foo 32
$ ip -n bar netns set bar 33
$ ip -n bar netns
init_net (id: 31)
bar (id: 33)
foo (id: 32)
$ ip netns list-id target-nsid 12
nsid 21 current-nsid 11 (iproute2 netns name: init_net)
nsid 22 current-nsid 12 (iproute2 netns name: foo)
nsid 23 current-nsid 13 (iproute2 netns name: bar)
$ ip -n bar netns list-id target-nsid 32 nsid 31
nsid 21 current-nsid 31 (iproute2 netns name: init_net)

v3 -> v4:
  - patch 5/5: fix imbalance lock in error path

v2 -> v3:
  - patch 5/5: account NETNSA_CURRENT_NSID in rtnl_net_get_size()

v1 -> v2:
  - patch 1/5: remove net from struct rtnl_net_dump_cb
  - patch 2/5: new in this version
  - patch 3/5: use a bool to know if rtnl_get_net_ns_capable() was called
  - patch 5/5: use struct net_fill_args
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonetns: enable to dump full nsid translation table
Nicolas Dichtel [Mon, 26 Nov 2018 14:42:06 +0000 (15:42 +0100)]
netns: enable to dump full nsid translation table

Like the previous patch, the goal is to ease to convert nsids from one
netns to another netns.
A new attribute (NETNSA_CURRENT_NSID) is added to the kernel answer when
NETNSA_TARGET_NSID is provided, thus the user can easily convert nsids.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonetns: enable to specify a nsid for a get request
Nicolas Dichtel [Mon, 26 Nov 2018 14:42:05 +0000 (15:42 +0100)]
netns: enable to specify a nsid for a get request

Combined with NETNSA_TARGET_NSID, it enables to "translate" a nsid from one
netns to a nsid of another netns.
This is useful when using NETLINK_F_LISTEN_ALL_NSID because it helps the
user to interpret a nsid received from an other netns.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonetns: add support of NETNSA_TARGET_NSID
Nicolas Dichtel [Mon, 26 Nov 2018 14:42:04 +0000 (15:42 +0100)]
netns: add support of NETNSA_TARGET_NSID

Like it was done for link and address, add the ability to perform get/dump
in another netns by specifying a target nsid attribute.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonetns: introduce 'struct net_fill_args'
Nicolas Dichtel [Mon, 26 Nov 2018 14:42:03 +0000 (15:42 +0100)]
netns: introduce 'struct net_fill_args'

This is a preparatory work. To avoid having to much arguments for the
function rtnl_net_fill(), a new structure is defined.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonetns: remove net arg from rtnl_net_fill()
Nicolas Dichtel [Mon, 26 Nov 2018 14:42:02 +0000 (15:42 +0100)]
netns: remove net arg from rtnl_net_fill()

This argument is not used anymore.

Fixes: cab3c8ec8d57 ("netns: always provide the id to rtnl_net_fill()")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'qed-enhancements-series'
David S. Miller [Wed, 28 Nov 2018 00:17:20 +0000 (16:17 -0800)]
Merge branch 'qed-enhancements-series'

Sudarsana Reddy Kalluru says:

====================
qed* enhancements series

The patch series add few enhancements to qed/qede drivers.

Changes from previous versions:
-------------------------------
v3: Revert v2 changes as the other paths (i.e. ptp) access the same data in
    atomic context.
v2: Use __set_bit()/__clear_bit() where data access doesn't need to be
    atomic.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoqed: Add support for MBI upgrade over MFW.
Sudarsana Reddy Kalluru [Mon, 26 Nov 2018 10:27:00 +0000 (02:27 -0800)]
qed: Add support for MBI upgrade over MFW.

The patch adds driver support for MBI image update through MFW.

Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Ariel Elior <Ariel.Elior@cavium.com>
Signed-off-by: Michal Kalderon <Michal.Kalderon@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoqede: Update link status only when interface is ready.
Sudarsana Reddy Kalluru [Mon, 26 Nov 2018 10:26:59 +0000 (02:26 -0800)]
qede: Update link status only when interface is ready.

In the case of internal reload (e.g., mtu change), there could be a race
between link-up notification from mfw and the driver unload processing. In
such case kernel assumes the link is up and starts using the queues which
leads to the server crash.

Send link notification to the kernel only when driver has already requested
MFW for the link.

Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Ariel Elior <Ariel.Elior@cavium.com>
Signed-off-by: Michal Kalderon <Michal.Kalderon@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoqede: Simplify the usage of qede-flags.
Sudarsana Reddy Kalluru [Mon, 26 Nov 2018 10:26:58 +0000 (02:26 -0800)]
qede: Simplify the usage of qede-flags.

The values represented by qede->flags is being used in mixed ways:
  1. As 'value' at some places e.g., QEDE_FLAGS_IS_VF usage
  2. As bit-mask(value) at some places e.g., QEDE_FLAGS_PTP_TX_IN_PRORGESS
     usage.
This implementation pose problems in future when we want to add more flag
values e.g., overlap of the values, overflow of 64-bit storage.

Updated the implementation to go with approach (2) for qede->flags.

Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Ariel Elior <Ariel.Elior@cavium.com>
Signed-off-by: Michal Kalderon <Michal.Kalderon@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoqed: Display port_id in the UFP debug messages.
Sudarsana Reddy Kalluru [Mon, 26 Nov 2018 10:26:57 +0000 (02:26 -0800)]
qed: Display port_id in the UFP debug messages.

MFW sends UFP notifications mostly during the device init phase and PFs
might not be assigned with a name by this time. Hence capturing port-id in
the debug messages would help in finding which PF the ufp notification was
sent to.

Also, fixed a minor scemantic issue in a debug print.

Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Ariel Elior <Ariel.Elior@cavium.com>
Signed-off-by: Michal Kalderon <Michal.Kalderon@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'aquantia-usb'
David S. Miller [Tue, 27 Nov 2018 23:46:08 +0000 (15:46 -0800)]
Merge branch 'aquantia-usb'

Igor Russkikh says:

====================
Add support for Aquantia AQtion USB to 5/2.5GbE devices

This patchset introduces support for new multigig ethernet to USB dongle,
developed jointly by Aquantia (Phy) and ASIX (USB MAC).

The driver has similar structure with other ASIX MAC drivers (AX88179), but
with a number of important differences:
- Driver supports both direct Phy and custom firmware interface for Phy
  programming. This is due to different firmware modules available with
  this product.
- Driver handles new 2.5G/5G link speed configuration and reporting.
- Device support all speeds from 100M up to 5G.
- Device supports MTU up to 16K.

Device supports various standard networking features, like
checksum offloads, vlan tagging/filtering, TSO.

The code of this driver is based on original ASIX sources and was extended
by Aquantia for 5G multigig support.

Patchset v2 includes following changes:
- Function variables declarions fixed to reverse xmass tree
- Improve patch layout structure
- Remove unnecessary curly braces in switch/case statements
- Use 'packed' attribute for HW structures only
- Use eth_mac_addr function in set_mac_addr callback
- Remove unnecessary 'memset' calls.
- Read MAC address from EEPROM function has now better name
- Use driver_priv field to store context. It avoids ugly cast.
- Set max_mtu field. Remove check for MTU size
- Rewrite read/write functions. Add helpers for read/write 16/32 bit values
- Use mask and shifts instead of bitfields to support BE platforms.
- Use stack allocated buffer for configuring mcast filters
- Use AUTONEG_ENABLE when go to suspend state
- Pad out wol_cfg field from context structure. Use stack allocated instead
- Remove driver version
- Check field 'duplex' in set_link_ksetting callback as well
- Use already created defines in usb matching macro
- Rename phy_ops struct to phy_cfg
- Use ether_addr_copy for copying mac address
- Add fall-through comment in switch/case for avoid checkpatch warning
- Remove match for CDC ether device
- Add ASIX's HW id-s to match this driver
- Add all HW id-s with which driver can work to blacklist of cdc_ether driver

Patchset v3 includes following changes:
- Use linkmode_copy instead of bitmap_copy
- Remove Direct PHY access code since production HW will not have this
    mode anymore
- Fix line over 80 symbols and alignments in cdc_ether patch
- Add match for ECM configuration
    On start our HW reports both ECM and vendor configs.
    Linux prefers to use ECM driver and chooses active configuration
    which is for ecm driver (not for vendor specific).
    We need to match this configuration and forcibly switch configuration
    to vendor specific.

Patchset v4 includes following changes:
- Set gso_max_size.
- Optimize accessing to descriptors
- Use SKB_TRUESIZE macro.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: usb: aqc111: Extend cdc_ether blacklist
Dmitry Bezrukov [Mon, 26 Nov 2018 09:33:50 +0000 (09:33 +0000)]
net: usb: aqc111: Extend cdc_ether blacklist

Added Aquantia and ASIX device IDs to prevent loading cdc_ether for
these devices. Our firmware reports CDC configuration simultaneously
with vendor specific.

Signed-off-by: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: usb: aqc111: Add ASIX's HW ids
Dmitry Bezrukov [Mon, 26 Nov 2018 09:33:47 +0000 (09:33 +0000)]
net: usb: aqc111: Add ASIX's HW ids

It enables driver for ASIX products which are also based on
aqc111/112U chips.

Signed-off-by: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: usb: aqc111: Add support for wake on LAN by MAGIC packet
Dmitry Bezrukov [Mon, 26 Nov 2018 09:33:45 +0000 (09:33 +0000)]
net: usb: aqc111: Add support for wake on LAN by MAGIC packet

Signed-off-by: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: usb: aqc111: Implement get/set_link_ksettings callbacks
Dmitry Bezrukov [Mon, 26 Nov 2018 09:33:42 +0000 (09:33 +0000)]
net: usb: aqc111: Implement get/set_link_ksettings callbacks

Signed-off-by: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: usb: aqc111: Initialize ethtool_ops structure
Dmitry Bezrukov [Mon, 26 Nov 2018 09:33:38 +0000 (09:33 +0000)]
net: usb: aqc111: Initialize ethtool_ops structure

Implement get_drvinfo, set/get_msglevel, get_link callbacks

Signed-off-by: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: usb: aqc111: Add RX VLAN filtering support
Dmitry Bezrukov [Mon, 26 Nov 2018 09:33:35 +0000 (09:33 +0000)]
net: usb: aqc111: Add RX VLAN filtering support

Signed-off-by: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: usb: aqc111: Add support for VLAN_CTAG_TX/RX offload
Dmitry Bezrukov [Mon, 26 Nov 2018 09:33:33 +0000 (09:33 +0000)]
net: usb: aqc111: Add support for VLAN_CTAG_TX/RX offload

Signed-off-by: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: usb: aqc111: Implement set_rx_mode callback
Dmitry Bezrukov [Mon, 26 Nov 2018 09:33:31 +0000 (09:33 +0000)]
net: usb: aqc111: Implement set_rx_mode callback

Signed-off-by: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: usb: aqc111: Add support for TSO
Dmitry Bezrukov [Mon, 26 Nov 2018 09:33:28 +0000 (09:33 +0000)]
net: usb: aqc111: Add support for TSO

Signed-off-by: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: usb: aqc111: Add support for enable/disable checksum offload
Dmitry Bezrukov [Mon, 26 Nov 2018 09:33:26 +0000 (09:33 +0000)]
net: usb: aqc111: Add support for enable/disable checksum offload

Signed-off-by: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: usb: aqc111: Add support for changing MTU
Dmitry Bezrukov [Mon, 26 Nov 2018 09:33:23 +0000 (09:33 +0000)]
net: usb: aqc111: Add support for changing MTU

Signed-off-by: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: usb: aqc111: Add checksum offload support
Dmitry Bezrukov [Mon, 26 Nov 2018 09:33:21 +0000 (09:33 +0000)]
net: usb: aqc111: Add checksum offload support

Signed-off-by: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: usb: aqc111: Implement RX data path
Dmitry Bezrukov [Mon, 26 Nov 2018 09:33:19 +0000 (09:33 +0000)]
net: usb: aqc111: Implement RX data path

Signed-off-by: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: usb: aqc111: Implement TX data path
Dmitry Bezrukov [Mon, 26 Nov 2018 09:33:16 +0000 (09:33 +0000)]
net: usb: aqc111: Implement TX data path

Signed-off-by: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: usb: aqc111: Add support for getting and setting of MAC address
Dmitry Bezrukov [Mon, 26 Nov 2018 09:33:14 +0000 (09:33 +0000)]
net: usb: aqc111: Add support for getting and setting of MAC address

Signed-off-by: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: usb: aqc111: Introduce link management
Dmitry Bezrukov [Mon, 26 Nov 2018 09:33:12 +0000 (09:33 +0000)]
net: usb: aqc111: Introduce link management

Add full hardware initialization sequence and link configuration logic

Signed-off-by: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: usb: aqc111: Introduce PHY access
Dmitry Bezrukov [Mon, 26 Nov 2018 09:33:09 +0000 (09:33 +0000)]
net: usb: aqc111: Introduce PHY access

Add helpers to write 32bit values.
Implement PHY power up/down sequences.
AQC111, PHY is being controlled via vendor command interface.

Signed-off-by: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: usb: aqc111: Various callbacks implementation
Dmitry Bezrukov [Mon, 26 Nov 2018 09:33:07 +0000 (09:33 +0000)]
net: usb: aqc111: Various callbacks implementation

Reset, stop callbacks, driver unbind callback.
More register defines required for these callbacks.
Add helpers to read/write 16bit values

Signed-off-by: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: usb: aqc111: Add implementation of read and write commands
Dmitry Bezrukov [Mon, 26 Nov 2018 09:33:04 +0000 (09:33 +0000)]
net: usb: aqc111: Add implementation of read and write commands

Read/write command register defines and functions

Signed-off-by: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: usb: aqc111: Add bind and empty unbind callbacks
Dmitry Bezrukov [Mon, 26 Nov 2018 09:33:02 +0000 (09:33 +0000)]
net: usb: aqc111: Add bind and empty unbind callbacks

Initialize net_device_ops structure

Signed-off-by: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: usb: aqc111: Driver skeleton for Aquantia AQtion USB to 5GbE
Dmitry Bezrukov [Mon, 26 Nov 2018 09:32:59 +0000 (09:32 +0000)]
net: usb: aqc111: Driver skeleton for Aquantia AQtion USB to 5GbE

Initialize usb_driver structure skeleton

Signed-off-by: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoadd documents for snmp counters
yupeng [Mon, 26 Nov 2018 07:35:46 +0000 (23:35 -0800)]
add documents for snmp counters

Add explaination of below counters:
TcpExtTCPRcvCoalesce
TcpExtTCPAutoCorking
TcpExtTCPOrigDataSent
TCPSynRetrans
TCPFastOpenActiveFail
TcpExtListenOverflows
TcpExtListenDrops
TcpExtTCPHystartTrainDetect
TcpExtTCPHystartTrainCwnd
TcpExtTCPHystartDelayDetect
TcpExtTCPHystartDelayCwnd

Signed-off-by: yupeng <yupeng0921@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'mlxsw-Prepare-for-VLAN-aware-bridge-w-VxLAN'
David S. Miller [Tue, 27 Nov 2018 23:27:08 +0000 (15:27 -0800)]
Merge branch 'mlxsw-Prepare-for-VLAN-aware-bridge-w-VxLAN'

Ido Schimmel says:

====================
mlxsw: Prepare for VLAN-aware bridge w/VxLAN

The driver is using 802.1Q filtering identifiers (FIDs) to represent the
different VLANs in the VLAN-aware bridge (only one is supported).

However, the device cannot assign a VNI to such FIDs, which prevents the
driver from supporting the enslavement of VxLAN devices to the
VLAN-aware bridge.

This patchset works around this limitation by emulating 802.1Q FIDs
using 802.1D FIDs, which can be assigned a VNI and so far have only been
used in conjunction with VLAN-unaware bridges.

The downside of this approach is that multiple {Port,VID}->FID entries
are required, whereas a single VID->FID entry is required with "true"
802.1Q FIDs.

First four patches introduce the new FID family of emulated 802.1Q FIDs
and the associated type of router interfaces (RIFs). Last patch flips
the driver to use this new FID family.

The diff is relatively small because the internal implementation of each
FID family is contained and hidden in spectrum_fid.c. Different internal
users (e.g., bridge, router) are aware of the different FID types, but
do not care about their internal implementation. This makes it trivial
to swap the current implementation of 802.1Q FIDs with the new one,
using 802.1D FIDs.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomlxsw: spectrum: Flip driver to use emulated 802.1Q FIDs
Ido Schimmel [Sun, 25 Nov 2018 09:43:59 +0000 (09:43 +0000)]
mlxsw: spectrum: Flip driver to use emulated 802.1Q FIDs

Replace 802.1Q FIDs and VLAN RIFs with their emulated counterparts.

The emulated 802.1Q FIDs are actually 802.1D FIDs and thus use the same
flood tables, of per-FID type. Therefore, add 4K-1 entries to the
per-FID flood tables for the new FIDs and get rid of the FID-offset
flood tables that were used by the old 802.1Q FIDs.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomlxsw: spectrum_router: Introduce emulated VLAN RIFs
Ido Schimmel [Sun, 25 Nov 2018 09:43:58 +0000 (09:43 +0000)]
mlxsw: spectrum_router: Introduce emulated VLAN RIFs

Router interfaces (RIFs) constructed on top of VLAN-aware bridges are of
"VLAN" type, whereas RIFs constructed on top of VLAN-unaware bridges of
"FID" type.

In other words, the RIF type is derived from the underlying FID type.
VLAN RIFs are used on top of 802.1Q FIDs, whereas FID RIFs are used on
top of 802.1D FIDs.

Since the previous patch emulated 802.1Q FIDs using 802.1D FIDs, this
patch emulates VLAN RIFs using FID RIFs.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomlxsw: spectrum_fid: Introduce emulated 802.1Q FIDs
Ido Schimmel [Sun, 25 Nov 2018 09:43:57 +0000 (09:43 +0000)]
mlxsw: spectrum_fid: Introduce emulated 802.1Q FIDs

The driver uses 802.1Q FIDs when offloading a VLAN-aware bridge.
Unfortunately, it is not possible to assign a VNI to such FIDs, which
prompts the driver to forbid the enslavement of VxLAN devices to a
VLAN-aware bridge.

Workaround this hardware limitation by creating a new family of FIDs,
emulated 802.1Q FIDs. These FIDs are emulated using 802.1D FIDs, which
can be assigned a VNI.

The downside of this approach is that multiple {Port, VID}->FID entries
are required, whereas only a single VID->FID is required with "true"
802.1Q FIDs.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomlxsw: spectrum_fid: Make flood index calculation more robust
Ido Schimmel [Sun, 25 Nov 2018 09:43:55 +0000 (09:43 +0000)]
mlxsw: spectrum_fid: Make flood index calculation more robust

802.1D FIDs use a per-FID flood table, where the flood index into the
table is calculated by subtracting 4K from the FID's index.

Currently, 802.1D FIDs start at 4K, so the calculation is correct, but
if it was ever to change, the calculation will no longer be correct.

In addition, this change will allow us to reuse the flood index
calculation function in the next patch, where we are going to emulate
802.1Q FIDs using 802.1D FIDs.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomlxsw: spectrum_switchdev: Do not set field when it is reserved
Ido Schimmel [Sun, 25 Nov 2018 09:43:54 +0000 (09:43 +0000)]
mlxsw: spectrum_switchdev: Do not set field when it is reserved

When configuring an FDB entry pointing to a LAG netdev (or its upper),
the driver should only set the 'lag_vid' field when the FID (filtering
identifier) is of 802.1D type.

Extend the 802.1D FID family with an attribute indicating whether this
field should be set and based on its value set the field or leave it
blank.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: aquantia: return 'err' if set MPI_DEINIT state fails
YueHaibing [Sat, 24 Nov 2018 10:16:41 +0000 (18:16 +0800)]
net: aquantia: return 'err' if set MPI_DEINIT state fails

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

drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c:260:7:
 warning: variable 'err' set but not used [-Wunused-but-set-variable]

'err' should be returned while set MPI_DEINIT state fails
in hw_atl_utils_soft_reset.

Fixes: cce96d1883da ("net: aquantia: Regression on reset with 1.x firmware")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'bridge-bools'
David S. Miller [Tue, 27 Nov 2018 23:04:16 +0000 (15:04 -0800)]
Merge branch 'bridge-bools'

Nikolay Aleksandrov says:

====================
net: bridge: add an option to disabe linklocal learning

This set adds a new bridge option which can control learning from
link-local packets, by default learning is on to be consistent and avoid
breaking users expectations. If the new no_linklocal_learn option is
enabled then the bridge will stop learning from link-local packets.

In order to save space for future boolean options, patch 01 adds a new
bool option API that uses a bitmask to control boolean options. The
bridge is by far the largest netlink attr user and we keep adding simple
boolean options which waste nl attr ids and space. We're not directly
mapping these to the in-kernel bridge flags because some might require
more complex configuration changes (e.g. if we were to add the per port
vlan stats now, it'd require multiple checks before changing value).
Any new bool option needs to be handled by both br_boolopt_toggle and get
in order to be able to retrieve its state later. All such options are
automatically exported via netlink. The behaviour of setting such
options is consistent with netlink option handling when a missing
option is being set (silently ignored), e.g. when a newer iproute2 is used
on older kernel. All supported options are exported via bm's optmask
when dumping the new attribute.

v2: address Andrew Lunn's comments, squash a minor change into patch 01,
    export all supported options via optmask when dumping, add patch 03,
    pass down extack so options can return meaningful errors, add
    WARN_ON on unsupported options (should not happen)
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: bridge: export supported boolopts
Nikolay Aleksandrov [Sat, 24 Nov 2018 02:34:22 +0000 (04:34 +0200)]
net: bridge: export supported boolopts

Now that we have at least one bool option, we can export all of the
supported bool options via optmask when dumping them.

v2: new patch

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: bridge: add no_linklocal_learn bool option
Nikolay Aleksandrov [Sat, 24 Nov 2018 02:34:21 +0000 (04:34 +0200)]
net: bridge: add no_linklocal_learn bool option

Use the new boolopt API to add an option which disables learning from
link-local packets. The default is kept as before and learning is
enabled. This is a simple map from a boolopt bit to a bridge private
flag that is tested before learning.

v2: pass NULL for extack via sysfs

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: bridge: add support for user-controlled bool options
Nikolay Aleksandrov [Sat, 24 Nov 2018 02:34:20 +0000 (04:34 +0200)]
net: bridge: add support for user-controlled bool options

We have been adding many new bridge options, a big number of which are
boolean but still take up netlink attribute ids and waste space in the skb.
Recently we discussed learning from link-local packets[1] and decided
yet another new boolean option will be needed, thus introducing this API
to save some bridge nl space.
The API supports changing the value of multiple boolean options at once
via the br_boolopt_multi struct which has an optmask (which options to
set, bit per opt) and optval (options' new values). Future boolean
options will only be added to the br_boolopt_id enum and then will have
to be handled in br_boolopt_toggle/get. The API will automatically
add the ability to change and export them via netlink, sysfs can use the
single boolopt function versions to do the same. The behaviour with
failing/succeeding is the same as with normal netlink option changing.

If an option requires mapping to internal kernel flag or needs special
configuration to be enabled then it should be handled in
br_boolopt_toggle. It should also be able to retrieve an option's current
state via br_boolopt_get.

v2: WARN_ON() on unsupported option as that shouldn't be possible and
    also will help catch people who add new options without handling
    them for both set and get. Pass down extack so if an option desires
    it could set it on error and be more user-friendly.

[1] https://www.spinics.net/lists/netdev/msg532698.html

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'virtio-support-packed-ring'
David S. Miller [Tue, 27 Nov 2018 06:17:40 +0000 (22:17 -0800)]
Merge branch 'virtio-support-packed-ring'

Tiwei Bie says:

====================
virtio: support packed ring

This patch set implements packed ring support in virtio driver.

A performance test between pktgen (pktgen_sample03_burst_single_flow.sh)
and DPDK vhost (testpmd/rxonly/vhost-PMD) has been done, I saw
~30% performance gain in packed ring in this case.

To make this patch set work with below patch set for vhost,
some hacks are needed to set the _F_NEXT flag in indirect
descriptors (this should be fixed in vhost):

https://lkml.org/lkml/2018/7/3/33

v2 -> v3:
- Use leXX instead of virtioXX (MST);
- Refactor split ring first (MST);
- Add debug helpers (MST);
- Put split/packed ring specific fields in sub structures (MST);
- Handle normal descriptors and indirect descriptors differently (MST);
- Track the DMA addr/len related info in a separate structure (MST);
- Calculate AVAIL/USED flags only when wrap counter wraps (MST);
- Define a struct/union to read event structure (MST);
- Define a macro for wrap counter bit in uapi (MST);
- Define the AVAIL/USED bits as shifts instead of values (MST);
- s/_F_/_FLAG_/ in VRING_PACKED_EVENT_* as they are values (MST);
- Drop the notify workaround for QEMU's tx-timer in packed ring (MST);

v1 -> v2:
- Use READ_ONCE() to read event off_wrap and flags together (Jason);
- Add comments related to ccw (Jason);

RFC v6 -> v1:
- Avoid extra virtio_wmb() in virtqueue_enable_cb_delayed_packed()
  when event idx is off (Jason);
- Fix bufs calculation in virtqueue_enable_cb_delayed_packed() (Jason);
- Test the state of the desc at used_idx instead of last_used_idx
  in virtqueue_enable_cb_delayed_packed() (Jason);
- Save wrap counter (as part of queue state) in the return value
  of virtqueue_enable_cb_prepare_packed();
- Refine the packed ring definitions in uapi;
- Rebase on the net-next tree;

RFC v5 -> RFC v6:
- Avoid tracking addr/len/flags when DMA API isn't used (MST/Jason);
- Define wrap counter as bool (Jason);
- Use ALIGN() in vring_init_packed() (Jason);
- Avoid using pointer to track `next` in detach_buf_packed() (Jason);
- Add comments for barriers (Jason);
- Don't enable RING_PACKED on ccw for now (noticed by Jason);
- Refine the memory barrier in virtqueue_poll();
- Add a missing memory barrier in virtqueue_enable_cb_delayed_packed();
- Remove the hacks in virtqueue_enable_cb_prepare_packed();

RFC v4 -> RFC v5:
- Save DMA addr, etc in desc state (Jason);
- Track used wrap counter;

RFC v3 -> RFC v4:
- Make ID allocation support out-of-order (Jason);
- Various fixes for EVENT_IDX support;

RFC v2 -> RFC v3:
- Split into small patches (Jason);
- Add helper virtqueue_use_indirect() (Jason);
- Just set id for the last descriptor of a list (Jason);
- Calculate the prev in virtqueue_add_packed() (Jason);
- Fix/improve desc suppression code (Jason/MST);
- Refine the code layout for XXX_split/packed and wrappers (MST);
- Fix the comments and API in uapi (MST);
- Remove the BUG_ON() for indirect (Jason);
- Some other refinements and bug fixes;

RFC v1 -> RFC v2:
- Add indirect descriptor support - compile test only;
- Add event suppression supprt - compile test only;
- Move vring_packed_init() out of uapi (Jason, MST);
- Merge two loops into one in virtqueue_add_packed() (Jason);
- Split vring_unmap_one() for packed ring and split ring (Jason);
- Avoid using '%' operator (Jason);
- Rename free_head -> next_avail_idx (Jason);
- Add comments for virtio_wmb() in virtqueue_add_packed() (Jason);
- Some other refinements and bug fixes;
====================

Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agovirtio_ring: advertize packed ring layout
Tiwei Bie [Wed, 21 Nov 2018 10:03:30 +0000 (18:03 +0800)]
virtio_ring: advertize packed ring layout

Advertize the packed ring layout support.

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agovirtio_ring: disable packed ring on unsupported transports
Tiwei Bie [Wed, 21 Nov 2018 10:03:29 +0000 (18:03 +0800)]
virtio_ring: disable packed ring on unsupported transports

Currently, ccw, vop and remoteproc need some legacy virtio
APIs to create or access virtio rings, which are not supported
by packed ring. So disable packed ring on these transports
for now.

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agovirtio_ring: leverage event idx in packed ring
Tiwei Bie [Wed, 21 Nov 2018 10:03:28 +0000 (18:03 +0800)]
virtio_ring: leverage event idx in packed ring

Leverage the EVENT_IDX feature in packed ring to suppress
events when it's available.

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agovirtio_ring: introduce packed ring support
Tiwei Bie [Wed, 21 Nov 2018 10:03:27 +0000 (18:03 +0800)]
virtio_ring: introduce packed ring support

Introduce the packed ring support. Packed ring can only be
created by vring_create_virtqueue() and each chunk of packed
ring will be allocated individually. Packed ring can not be
created on preallocated memory by vring_new_virtqueue() or
the likes currently.

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agovirtio_ring: cache whether we will use DMA API
Tiwei Bie [Wed, 21 Nov 2018 10:03:26 +0000 (18:03 +0800)]
virtio_ring: cache whether we will use DMA API

Cache whether we will use DMA API, instead of doing the
check every time. We are going to check whether DMA API
is used more often in packed ring.

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agovirtio_ring: extract split ring handling from ring creation
Tiwei Bie [Wed, 21 Nov 2018 10:03:25 +0000 (18:03 +0800)]
virtio_ring: extract split ring handling from ring creation

Introduce a specific function to create the split ring.
And also move the DMA allocation and size information to
the .split sub-structure.

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agovirtio_ring: allocate desc state for split ring separately
Tiwei Bie [Wed, 21 Nov 2018 10:03:24 +0000 (18:03 +0800)]
virtio_ring: allocate desc state for split ring separately

Put the split ring's desc state into the .split sub-structure,
and allocate desc state for split ring separately, this makes
the code more readable and more consistent with what we will
do for packed ring.

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agovirtio_ring: introduce helper for indirect feature
Tiwei Bie [Wed, 21 Nov 2018 10:03:23 +0000 (18:03 +0800)]
virtio_ring: introduce helper for indirect feature

Introduce a helper to check whether we will use indirect
feature. It will be used by packed ring too.

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agovirtio_ring: introduce debug helpers
Tiwei Bie [Wed, 21 Nov 2018 10:03:22 +0000 (18:03 +0800)]
virtio_ring: introduce debug helpers

Introduce debug helpers for last_add_time update, check and
invalid. They will be used by packed ring too.

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agovirtio_ring: put split ring fields in a sub struct
Tiwei Bie [Wed, 21 Nov 2018 10:03:21 +0000 (18:03 +0800)]
virtio_ring: put split ring fields in a sub struct

Put the split ring specific fields in a sub-struct named
as "split" to avoid misuse after introducing packed ring.
There is no functional change.

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agovirtio_ring: put split ring functions together
Tiwei Bie [Wed, 21 Nov 2018 10:03:20 +0000 (18:03 +0800)]
virtio_ring: put split ring functions together

Put the xxx_split() functions together to make the
code more readable and avoid misuse after introducing
the packed ring. There is no functional change.

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agovirtio_ring: add _split suffix for split ring functions
Tiwei Bie [Wed, 21 Nov 2018 10:03:19 +0000 (18:03 +0800)]
virtio_ring: add _split suffix for split ring functions

Add _split suffix for split ring specific functions. This
is a preparation for introducing the packed ring support.
There is no functional change.

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agovirtio: add packed ring types and macros
Tiwei Bie [Wed, 21 Nov 2018 10:03:18 +0000 (18:03 +0800)]
virtio: add packed ring types and macros

Add types and macros for packed ring.

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next
David S. Miller [Mon, 26 Nov 2018 21:08:17 +0000 (13:08 -0800)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next

Daniel Borkmann says:

====================
pull-request: bpf-next 2018-11-26

The following pull-request contains BPF updates for your *net-next* tree.

The main changes are:

1) Extend BTF to support function call types and improve the BPF
   symbol handling with this info for kallsyms and bpftool program
   dump to make debugging easier, from Martin and Yonghong.

2) Optimize LPM lookups by making longest_prefix_match() handle
   multiple bytes at a time, from Eric.

3) Adds support for loading and attaching flow dissector BPF progs
   from bpftool, from Stanislav.

4) Extend the sk_lookup() helper to be supported from XDP, from Nitin.

5) Enable verifier to support narrow context loads with offset > 0
   to adapt to LLVM code generation (currently only offset of 0 was
   supported). Add test cases as well, from Andrey.

6) Simplify passing device functions for offloaded BPF progs by
   adding callbacks to bpf_prog_offload_ops instead of ndo_bpf.
   Also convert nfp and netdevsim to make use of them, from Quentin.

7) Add support for sock_ops based BPF programs to send events to
   the perf ring-buffer through perf_event_output helper, from
   Sowmini and Daniel.

8) Add read / write support for skb->tstamp from tc BPF and cg BPF
   programs to allow for supporting rate-limiting in EDT qdiscs
   like fq from BPF side, from Vlad.

9) Extend libbpf API to support map in map types and add test cases
   for it as well to BPF kselftests, from Nikita.

10) Account the maximum packet offset accessed by a BPF program in
    the verifier and use it for optimizing nfp JIT, from Jiong.

11) Fix error handling regarding kprobe_events in BPF sample loader,
    from Daniel T.

12) Add support for queue and stack map type in bpftool, from David.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agobpf: align map type names formatting.
David Calavera [Fri, 23 Nov 2018 23:58:39 +0000 (15:58 -0800)]
bpf: align map type names formatting.

Make the formatting for map_type_name array consistent.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
6 years agobpf: btf: fix spelling mistake "Memmber" -> "Member"
Colin Ian King [Sun, 25 Nov 2018 23:32:51 +0000 (23:32 +0000)]
bpf: btf: fix spelling mistake "Memmber" -> "Member"

There is a spelling mistake in a btf_verifier_log_member message,
fix it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
6 years agobpf, tags: Fix DEFINE_PER_CPU expansion
Rustam Kovhaev [Fri, 23 Nov 2018 23:48:16 +0000 (15:48 -0800)]
bpf, tags: Fix DEFINE_PER_CPU expansion

Building tags produces warning:

  ctags: Warning: kernel/bpf/local_storage.c:10: null expansion of name pattern "\1"

Let's use the same fix as in commit 25528213fe9f ("tags: Fix DEFINE_PER_CPU
expansions"), even though it violates the usual code style.

Signed-off-by: Rustam Kovhaev <rkovhaev@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
6 years agonet: remove unsafe skb_insert()
Eric Dumazet [Sun, 25 Nov 2018 16:26:23 +0000 (08:26 -0800)]
net: remove unsafe skb_insert()

I do not see how one can effectively use skb_insert() without holding
some kind of lock. Otherwise other cpus could have changed the list
right before we have a chance of acquiring list->lock.

Only existing user is in drivers/infiniband/hw/nes/nes_mgt.c and this
one probably meant to use __skb_insert() since it appears nesqp->pau_list
is protected by nesqp->pau_lock. This looks like nesqp->pau_lock
could be removed, since nesqp->pau_list.lock could be used instead.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Faisal Latif <faisal.latif@intel.com>
Cc: Doug Ledford <dledford@redhat.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: linux-rdma <linux-rdma@vger.kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: bridge: remove redundant checks for null p->dev and p->br
Colin Ian King [Sun, 25 Nov 2018 16:08:51 +0000 (16:08 +0000)]
net: bridge: remove redundant checks for null p->dev and p->br

A recent change added a null check on p->dev after p->dev was being
dereferenced by the ns_capable check on p->dev. It turns out that
neither the p->dev and p->br null checks are necessary, and can be
removed, which cleans up a static analyis warning.

As Nikolay Aleksandrov noted, these checks can be removed because:

"My reasoning of why it shouldn't be possible:
- On port add new_nbp() sets both p->dev and p->br before creating
  kobj/sysfs

- On port del (trickier) del_nbp() calls kobject_del() before call_rcu()
  to destroy the port which in turn calls sysfs_remove_dir() which uses
  kernfs_remove() which deactivates (shouldn't be able to open new
  files) and calls kernfs_drain() to drain current open/mmaped files in
  the respective dir before continuing, thus making it impossible to
  open a bridge port sysfs file with p->dev and p->br equal to NULL.

So I think it's safe to remove those checks altogether. It'd be nice to
get a second look over my reasoning as I might be missing something in
sysfs/kernfs call path."

Thanks to Nikolay Aleksandrov's suggestion to remove the check and
David Miller for sanity checking this.

Detected by CoverityScan, CID#751490 ("Dereference before null check")

Fixes: a5f3ea54f3cc ("net: bridge: add support for raw sysfs port options")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'r8169-xmit_more'
David S. Miller [Sun, 25 Nov 2018 18:18:14 +0000 (10:18 -0800)]
Merge branch 'r8169-xmit_more'

Heiner Kallweit says:

====================
r8169: make use of xmit_more and __netdev_sent_queue

This series adds helper __netdev_sent_queue to the core and makes use
of it in the r8169 driver.

Heiner Kallweit (2):
  net: core: add __netdev_sent_queue as variant of __netdev_tx_sent_queue
  r8169: make use of xmit_more and __netdev_sent_queue

v2:
- fix minor style issue
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agor8169: make use of xmit_more and __netdev_sent_queue
Heiner Kallweit [Sun, 25 Nov 2018 13:31:54 +0000 (14:31 +0100)]
r8169: make use of xmit_more and __netdev_sent_queue

Make use of xmit_more and add the functionality introduced with
3e59020abf0f ("net: bql: add __netdev_tx_sent_queue()").
I used the mlx4 driver as template.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: core: add __netdev_sent_queue as variant of __netdev_tx_sent_queue
Heiner Kallweit [Sun, 25 Nov 2018 13:30:29 +0000 (14:30 +0100)]
net: core: add __netdev_sent_queue as variant of __netdev_tx_sent_queue

Similar to netdev_sent_queue add helper __netdev_sent_queue as variant
of __netdev_tx_sent_queue.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoselftests/net: add txring_overwrite
Willem de Bruijn [Sun, 25 Nov 2018 02:09:26 +0000 (21:09 -0500)]
selftests/net: add txring_overwrite

Packet sockets with PACKET_TX_RING send skbs with user data in frags.

Before commit 5cd8d46ea156 ("packet: copy user buffers before orphan
or clone") ring slots could be released prematurely, possibly allowing
a process to overwrite data still in flight.

This test opens two packet sockets, one to send and one to read.
The sender has a tx ring of one slot. It sends two packets with
different payload, then reads both and verifies their payload.

Before the above commit, both receive calls return the same data as
the send calls use the same buffer. From the commit, the clone
needed for looping onto a packet socket triggers an skb_copy_ubufs
to create a private copy. The separate sends each arrive correctly.

Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: qualcomm: rmnet: move null check on dev before dereferecing it
Colin Ian King [Sat, 24 Nov 2018 15:03:02 +0000 (15:03 +0000)]
net: qualcomm: rmnet: move null check on dev before dereferecing it

Currently dev is dereferenced by the call dev_net(dev) before dev is null
checked.  Fix this by null checking dev before the potential null
pointer dereference.

Detected by CoverityScan, CID#1462955 ("Dereference before null check")

Fixes: 23790ef12082 ("net: qualcomm: rmnet: Allow to configure flags for existing devices")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agocxgb4: remove set but not used variables 'multitrc, speed'
YueHaibing [Sat, 24 Nov 2018 10:36:21 +0000 (18:36 +0800)]
cxgb4: remove set but not used variables 'multitrc, speed'

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

drivers/net/ethernet/chelsio/cxgb4/t4_hw.c:5883:6:
 warning: variable 'multitrc' set but not used [-Wunused-but-set-variable]

drivers/net/ethernet/chelsio/cxgb4/t4_hw.c:8585:32:
 warning: variable 'speed' set but not used [-Wunused-but-set-variable]

'multitrc' never used since introduction in
commit 8e3d04fd7d70 ("cxgb4: Add MPS tracing support")

'speed' never used since introduction in
commit c3168cabe1af ("cxgb4/cxgbvf: Handle 32-bit fw port capabilities")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: fixup type in netdev_start_xmit()
Alexey Dobriyan [Sat, 24 Nov 2018 09:01:41 +0000 (12:01 +0300)]
net: fixup type in netdev_start_xmit()

Return code should be formally "netdev_tx_t".

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
David S. Miller [Sun, 25 Nov 2018 01:01:43 +0000 (17:01 -0800)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

6 years agoMerge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Linus Torvalds [Sat, 24 Nov 2018 17:42:32 +0000 (09:42 -0800)]
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux

Pull arm64 fixes from Catalin Marinas::

 - Fix wrong conflict resolution around CONFIG_ARM64_SSBD

 - Fix sparse warning on unsigned long constant

* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
  arm64: cpufeature: Fix mismerge of CONFIG_ARM64_SSBD block
  arm64: sysreg: fix sparse warnings