openwrt/staging/blogic.git
5 years agodrop_monitor: Move per-CPU data init/fini to separate functions
Ido Schimmel [Sat, 17 Aug 2019 13:28:10 +0000 (16:28 +0300)]
drop_monitor: Move per-CPU data init/fini to separate functions

Currently drop monitor only reports software drops to user space, but
subsequent patches are going to add support for hardware drops.

Like software drops, the per-CPU data of hardware drops needs to be
initialized and de-initialized upon module initialization and exit. To
avoid code duplication, break this code into separate functions, so that
these could be re-used for hardware drops.

No functional changes intended.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'bridge-mdb'
David S. Miller [Sat, 17 Aug 2019 19:36:57 +0000 (12:36 -0700)]
Merge branch 'bridge-mdb'

Nikolay Aleksandrov says:

====================
net: bridge: mdb: allow dump/add/del of host-joined entries

This set makes the bridge dump host-joined mdb entries, they should be
treated as normal entries since they take a slot and are aging out.
We already have notifications for them but we couldn't dump them until
now so they remained hidden. We dump them similar to how they're
notified, in order to keep user-space compatibility with the dumped
objects (e.g. iproute2 dumps mdbs in a format which can be fed into
add/del commands) we allow host-joined groups also to be added/deleted via
mdb commands. That can later be used for L2 mcast MAC manipulation as
was recently discussed. Note that iproute2 changes are not necessary,
this set will work with the current user-space mdb code.

Patch 01 - a trivial comment move
Patch 02 - factors out the mdb filling code so it can be
           re-used for the host-joined entries
Patch 03 - dumps host-joined entries
Patch 04 - allows manipulation of host-joined entries via standard mdb
           calls

v3: fix compiler warning in patch 04 (DaveM)
v2: change patch 04 to avoid double notification and improve host group
    manual removal if no ports are present in the group
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: bridge: mdb: allow add/delete for host-joined groups
Nikolay Aleksandrov [Sat, 17 Aug 2019 11:22:13 +0000 (14:22 +0300)]
net: bridge: mdb: allow add/delete for host-joined groups

Currently this is needed only for user-space compatibility, so similar
object adds/deletes as the dumped ones would succeed. Later it can be
used for L2 mcast MAC add/delete.

v3: fix compiler warning (DaveM)
v2: don't send a notification when used from user-space, arm the group
    timer if no ports are left after host entry del

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: bridge: mdb: dump host-joined entries as well
Nikolay Aleksandrov [Sat, 17 Aug 2019 11:22:12 +0000 (14:22 +0300)]
net: bridge: mdb: dump host-joined entries as well

Currently we dump only the port mdb entries but we can have host-joined
entries on the bridge itself and they should be treated as normal temp
mdbs, they're already notified:
$ bridge monitor all
[MDB]dev br0 port br0 grp ff02::8 temp

The group will not be shown in the bridge mdb output, but it takes 1 slot
and it's timing out. If it's only host-joined then the mdb show output
can even be empty.

After this patch we show the host-joined groups:
$ bridge mdb show
dev br0 port br0 grp ff02::8 temp

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: bridge: mdb: factor out mdb filling
Nikolay Aleksandrov [Sat, 17 Aug 2019 11:22:11 +0000 (14:22 +0300)]
net: bridge: mdb: factor out mdb filling

We have to factor out the mdb fill portion in order to re-use it later for
the bridge mdb entries. No functional changes intended.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: bridge: mdb: move vlan comments
Nikolay Aleksandrov [Sat, 17 Aug 2019 11:22:10 +0000 (14:22 +0300)]
net: bridge: mdb: move vlan comments

Trivial patch to move the vlan comments in their proper places above the
vid 0 checks.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'net-phy-remove-genphy_config_init'
David S. Miller [Sat, 17 Aug 2019 19:34:50 +0000 (12:34 -0700)]
Merge branch 'net-phy-remove-genphy_config_init'

Heiner Kallweit says:

====================
net: phy: remove genphy_config_init

Supported PHY features are either auto-detected or explicitly set.
In both cases calling genphy_config_init isn't needed. All that
genphy_config_init does is removing features that are set as
supported but can't be auto-detected. Basically it duplicates the
code in genphy_read_abilities. Therefore remove genphy_config_init.

v2:
- remove call also from new adin driver
v3:
- pass NULL as config_init function pointer for dp83848
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: remove genphy_config_init
Heiner Kallweit [Sat, 17 Aug 2019 10:30:39 +0000 (12:30 +0200)]
net: phy: remove genphy_config_init

Now that all users have been removed we can remove genphy_config_init.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: dsa: remove calls to genphy_config_init
Heiner Kallweit [Sat, 17 Aug 2019 10:29:54 +0000 (12:29 +0200)]
net: dsa: remove calls to genphy_config_init

Supported PHY features are either auto-detected or explicitly set.
In both cases calling genphy_config_init isn't needed.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: remove calls to genphy_config_init
Heiner Kallweit [Sat, 17 Aug 2019 10:29:25 +0000 (12:29 +0200)]
net: phy: remove calls to genphy_config_init

Supported PHY features are either auto-detected or explicitly set.
In both cases calling genphy_config_init isn't needed. All that
genphy_config_init does is removing features that are set as
supported but can't be auto-detected. Basically it duplicates the
code in genphy_read_abilities. Therefore remove such calls from
all PHY drivers.

v2:
- remove call also from new adin PHY driver
v3:
- pass NULL as config_init function pointer for dp83848

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoipvlan: set hw_enc_features like macvlan
Bill Sommerfeld [Thu, 15 Aug 2019 00:10:43 +0000 (17:10 -0700)]
ipvlan: set hw_enc_features like macvlan

Allow encapsulated packets sent to tunnels layered over ipvlan to use
offloads rather than forcing SW fallbacks.

Since commit f21e5077010acda73a60 ("macvlan: add offload features for
encapsulation"), macvlan has set dev->hw_enc_features to include
everything in dev->features; do likewise in ipvlan.

Signed-off-by: Bill Sommerfeld <wsommerfeld@google.com>
Acked-by: Mahesh Bandewar <maheshb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoselftests: Fix get_ifidx and callers in nettest.c
David Ahern [Wed, 14 Aug 2019 17:11:51 +0000 (10:11 -0700)]
selftests: Fix get_ifidx and callers in nettest.c

Dan reported:

    The patch acda655fefae: "selftests: Add nettest" from Aug 1, 2019,
    leads to the following static checker warning:

            ./tools/testing/selftests/net/nettest.c:1690 main()
            warn: unsigned 'tmp' is never less than zero.

    ./tools/testing/selftests/net/nettest.c
      1680                  case '1':
      1681                          args.has_expected_raddr = 1;
      1682                          if (convert_addr(&args, optarg,
      1683                                           ADDR_TYPE_EXPECTED_REMOTE))
      1684                                  return 1;
      1685
      1686                          break;
      1687                  case '2':
      1688                          if (str_to_uint(optarg, 0, 0x7ffffff, &tmp) != 0) {
      1689                                  tmp = get_ifidx(optarg);
      1690                                  if (tmp < 0) {

    "tmp" is unsigned so it can't be negative.  Also all the callers assume
    that get_ifidx() returns negatives on error but it looks like it really
    returns zero on error so it's a bit unclear to me.

Update get_ifidx to return -1 on errors and cleanup callers of it.

Fixes: acda655fefae ("selftests: Add nettest")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: dsa: mv88e6xxx: check for mode change in port_setup_mac
Marek Behún [Wed, 14 Aug 2019 14:40:24 +0000 (16:40 +0200)]
net: dsa: mv88e6xxx: check for mode change in port_setup_mac

The mv88e6xxx_port_setup_mac checks if the requested MAC settings are
different from the current ones, and if not, does nothing (since chaning
them requires putting the link down).

In this check it only looks if the triplet [link, speed, duplex] is
being changed.

This patch adds support to also check if the mode parameter (of type
phy_interface_t) is requested to be changed. The current mode is
computed by the ->port_link_state() method, and if it is different from
PHY_INTERFACE_MODE_NA, we check for equality with the requested mode.

In the implementations of the mv88e6250_port_link_state() method we set
the current mode to PHY_INTERFACE_MODE_NA - so the code does not check
for mode change on 6250.

In the mv88e6352_port_link_state() method, we use the cached cmode of
the port to determine the mode as phy_interface_t (and if it is not
enough, eg. for RGMII, we also look at the port control register for
RX/TX timings).

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'net-phy-adin-add-support-for-Analog-Devices-PHYs'
David S. Miller [Fri, 16 Aug 2019 18:56:26 +0000 (11:56 -0700)]
Merge branch 'net-phy-adin-add-support-for-Analog-Devices-PHYs'

Alexandru Ardelean says:

====================
net: phy: adin: add support for Analog Devices PHYs

This changeset adds support for Analog Devices Industrial Ethernet PHYs.
Particularly the PHYs this driver adds support for:
 * ADIN1200 - Robust, Industrial, Low Power 10/100 Ethernet PHY
 * ADIN1300 - Robust, Industrial, Low Latency 10/100/1000 Gigabit
   Ethernet PHY

The 2 chips are register compatible with one another. The main
difference being that ADIN1200 doesn't operate in gigabit mode.

The chips can be operated by the Generic PHY driver as well via the
standard IEEE PHY registers (0x0000 - 0x000F) which are supported by the
kernel as well. This assumes that configuration of the PHY has been done
completely in HW, according to spec, i.e. no extra SW configuration
required.

This changeset also implements the ability to configure the chips via SW
registers.

Datasheets:
  https://www.analog.com/media/en/technical-documentation/data-sheets/ADIN1300.pdf
  https://www.analog.com/media/en/technical-documentation/data-sheets/ADIN1200.pdf
====================

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agodt-bindings: net: add bindings for ADIN PHY driver
Alexandru Ardelean [Fri, 16 Aug 2019 13:10:11 +0000 (16:10 +0300)]
dt-bindings: net: add bindings for ADIN PHY driver

This change adds bindings for the Analog Devices ADIN PHY driver, detailing
all the properties implemented by the driver.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: adin: add ethtool get_stats support
Alexandru Ardelean [Fri, 16 Aug 2019 13:10:10 +0000 (16:10 +0300)]
net: phy: adin: add ethtool get_stats support

This change implements retrieving all the error counters from the PHY.

The counters require that the RxErrCnt register (0x0014) be read first,
after which copies of the counters are latched into the registers. This
ensures that all registers read after RxErrCnt are synchronized at the
moment that they are read.

The counter values need to be accumulated by the driver, as each time that
RxErrCnt is read, the values that are latched are the ones that have
incremented from the last read.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: adin: implement downshift configuration via phy-tunable
Alexandru Ardelean [Fri, 16 Aug 2019 13:10:09 +0000 (16:10 +0300)]
net: phy: adin: implement downshift configuration via phy-tunable

Down-speed auto-negotiation may not always be enabled, in which case the
PHY won't down-shift to 100 or 10 during auto-negotiation.

This change enables downshift and configures the number of retries to
default 4 (which is also in the datasheet

The downshift control mechanism can also be controlled via the phy-tunable
interface (ETHTOOL_PHY_DOWNSHIFT control).

The change has been adapted from the Aquantia PHY driver.

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: adin: implement PHY subsystem software reset
Alexandru Ardelean [Fri, 16 Aug 2019 13:10:08 +0000 (16:10 +0300)]
net: phy: adin: implement PHY subsystem software reset

The ADIN PHYs supports 4 types of reset:
1. The standard PHY reset via BMCR_RESET bit in MII_BMCR reg
2. Reset via GPIO
3. Reset via reg GeSftRst (0xff0c) & reload previous pin configs
4. Reset via reg GeSftRst (0xff0c) & request new pin configs

Resets 2, 3 & 4 are almost identical, with the exception that the crystal
oscillator is available during reset for 2.

This change implements subsystem software reset via the GeSftRst and
reloading the previous pin configuration (so reset number 3).
This will also reset the PHY core regs (similar to reset 1).

Since writing bit 1 to reg GeSftRst is self-clearing, the only thing that
can be done, is to write to that register, wait a specific amount of time
(10 milliseconds should be enough) and try to read back and check if there
are no errors on read. A busy-wait-read won't work well, and may sometimes
work or not work.

In case phylib is configured to also do a reset via GPIO, the ADIN PHY may
be reset twice when the PHY device registers, but that isn't a problem,
since it's being done on boot (or PHY device register).

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: adin: add EEE translation layer from Clause 45 to Clause 22
Alexandru Ardelean [Fri, 16 Aug 2019 13:10:07 +0000 (16:10 +0300)]
net: phy: adin: add EEE translation layer from Clause 45 to Clause 22

The ADIN1200 & ADIN1300 PHYs support EEE by using standard Clause 45 access
to access MMD registers for EEE.

The EEE register addresses (when using Clause 22) are available at
different addresses (than Clause 45), and since accessing these regs (via
Clause 22) needs a special mechanism, a translation table is required to
convert these addresses.

For Clause 45, this is not needed since the driver will likely never use
this access mode.

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: adin: add support MDI/MDIX/Auto-MDI selection
Alexandru Ardelean [Fri, 16 Aug 2019 13:10:06 +0000 (16:10 +0300)]
net: phy: adin: add support MDI/MDIX/Auto-MDI selection

The ADIN PHYs support automatic MDI/MDIX negotiation. By default this is
disabled, so this is enabled at `config_init`.

This is controlled via the PHY Control 1 register.
The supported modes are:
  1. Manual MDI
  2. Manual MDIX
  3. Auto MDIX - prefer MDIX
  4. Auto MDIX - prefer MDI

The phydev mdix & mdix_ctrl fields include modes 3 & 4 into a single
auto-mode. So, the default mode this driver enables is 4 when Auto-MDI mode
is used.

When detecting MDI/MDIX mode, a combination of the PHY Control 1 register
and PHY Status 1 register is used to determine the correct MDI/MDIX mode.

If Auto-MDI mode is not set, then the manual MDI/MDIX mode is returned.
If Auto-MDI mode is set, then MDIX mode is returned differs from the
preferred MDI/MDIX mode.
This covers all cases where:
  1. MDI preferred  & Pair01Swapped   == MDIX
  2. MDIX preferred & Pair01Swapped   == MDI
  3. MDI preferred  & ! Pair01Swapped == MDIX
  4. MDIX preferred & ! Pair01Swapped == MDI

The preferred MDI/MDIX mode is not configured via SW, but can be configured
via HW pins. Note that the `Pair01Swapped` is the Green-Yellow physical
pairs.

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: adin: make RMII fifo depth configurable
Alexandru Ardelean [Fri, 16 Aug 2019 13:10:05 +0000 (16:10 +0300)]
net: phy: adin: make RMII fifo depth configurable

The FIFO depth can be configured for the RMII mode. This change adds
support for doing this via device-tree (or ACPI).

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: adin: make RGMII internal delays configurable
Alexandru Ardelean [Fri, 16 Aug 2019 13:10:04 +0000 (16:10 +0300)]
net: phy: adin: make RGMII internal delays configurable

The internal delays for the RGMII are configurable for both RX & TX. This
change adds support for configuring them via device-tree (or ACPI).

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: adin: configure RGMII/RMII/MII modes on config
Alexandru Ardelean [Fri, 16 Aug 2019 13:10:03 +0000 (16:10 +0300)]
net: phy: adin: configure RGMII/RMII/MII modes on config

The ADIN1300 chip supports RGMII, RMII & MII modes. Default (if
unconfigured) is RGMII.
This change adds support for configuring these modes via the device
registers.

For RGMII with internal delays (modes RGMII_ID,RGMII_TXID, RGMII_RXID),
the default delay is 2 ns. This can be configurable and will be done in
a subsequent change.

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: adin: add {write,read}_mmd hooks
Alexandru Ardelean [Fri, 16 Aug 2019 13:10:02 +0000 (16:10 +0300)]
net: phy: adin: add {write,read}_mmd hooks

Both ADIN1200 & ADIN1300 support Clause 45 access for some registers.
The Extended Management Interface (EMI) registers are accessible via both
Clause 45 (at register MDIO_MMD_VEND1) and using Clause 22.

The Clause 22 access for MMD regs differs from the standard one defined by
802.3. The ADIN PHYs  use registers ExtRegPtr (0x0010) and ExtRegData
(0x0011) to access Clause 45 & EMI registers.

The indirect access is done via the following mechanism (for both R/W):
1. Write the address of the register in the ExtRegPtr
2. Read/write the value of the register via reg ExtRegData

This mechanism is needed to manage configuration of chip settings and to
access EEE registers via Clause 22.

Since Clause 45 access will likely never be used, it is not implemented via
this hook.

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: adin: add support for interrupts
Alexandru Ardelean [Fri, 16 Aug 2019 13:10:01 +0000 (16:10 +0300)]
net: phy: adin: add support for interrupts

This change hooks link-status-change interrupts to phylib.

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: adin: hook genphy_{suspend, resume} into the driver
Alexandru Ardelean [Fri, 16 Aug 2019 13:10:00 +0000 (16:10 +0300)]
net: phy: adin: hook genphy_{suspend, resume} into the driver

The chip supports standard suspend/resume via BMCR reg.
Hook these functions into the `adin` driver.

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: adin: add support for Analog Devices PHYs
Alexandru Ardelean [Fri, 16 Aug 2019 13:09:59 +0000 (16:09 +0300)]
net: phy: adin: add support for Analog Devices PHYs

This change adds support for Analog Devices Industrial Ethernet PHYs.
Particularly the PHYs this driver adds support for:
 * ADIN1200 - Robust, Industrial, Low Power 10/100 Ethernet PHY
 * ADIN1300 - Robust, Industrial, Low Latency 10/100/1000 Gigabit
   Ethernet PHY

The 2 chips are register compatible with one another. The main difference
being that ADIN1200 doesn't operate in gigabit mode.

The chips can be operated by the Generic PHY driver as well via the
standard IEEE PHY registers (0x0000 - 0x000F) which are supported by the
kernel as well. This assumes that configuration of the PHY has been done
completely in HW, according to spec.

Configuration can also be done via registers, which will be supported by
this driver.

Datasheets:
  https://www.analog.com/media/en/technical-documentation/data-sheets/ADIN1300.pdf
  https://www.analog.com/media/en/technical-documentation/data-sheets/ADIN1200.pdf

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'mscc-PTP-support'
David S. Miller [Thu, 15 Aug 2019 23:31:12 +0000 (16:31 -0700)]
Merge branch 'mscc-PTP-support'

Antoine Tenart says:

====================
net: mscc: PTP Hardware Clock (PHC) support

This series introduces the PTP Hardware Clock (PHC) support to the Mscc
Ocelot switch driver. In order to make use of this, a new register bank
is added and described in the device tree, as well as a new interrupt.
The use this bank and interrupt was made optional in the driver for dt
compatibility reasons.

Thanks!
Antoine

Since v5:
  - Made sure both the PTP interrupt and register bank were available to
    enable supporting h/w timestamping.
  - Added a check after a kzalloc.
  - Add Reviewed-by tags from Andrew.

Since v4:
  - Added SKBTX_IN_PROGRESS.
  - Fixed two xmas trees.
  - Rework the loop condition in ocelot_ptp_rdy_irq_handler.

Since v3:
  - Fixed a spin_unlock_irqrestore issue.

Since v2:
  - Prevented from a possible infinite loop when reading the h/w
    timestamps.
  - s/GFP_KERNEL/GFP_ATOMIC/ in the Tx path.
  - Set rx_filter to HWTSTAMP_FILTER_PTP_V2_EVENT at probe.
  - Fixed s/w timestamping dependencies.
  - Added Paul Burton's Acked-by on patches 2 and 4.

Since v1:
  - Used list_for_each_safe() in ocelot_deinit().
  - Fixed a memory leak in ocelot_deinit() by calling
    dev_kfree_skb_any().
  - Fixed a locking issue in get_hwtimestamp().
  - Handled the NULL case of ptp_clock_register().
  - Added comments on optional dt properties.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: mscc: PTP Hardware Clock (PHC) support
Antoine Tenart [Mon, 12 Aug 2019 14:45:37 +0000 (16:45 +0200)]
net: mscc: PTP Hardware Clock (PHC) support

This patch adds support for PTP Hardware Clock (PHC) to the Ocelot
switch for both PTP 1-step and 2-step modes.

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: mscc: remove the frame_info cpuq member
Antoine Tenart [Mon, 12 Aug 2019 14:45:36 +0000 (16:45 +0200)]
net: mscc: remove the frame_info cpuq member

In struct frame_info, the cpuq member is never used. This cosmetic patch
removes it from the structure, and from the parsing of the frame header
as it's only set but never used.

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: mscc: improve the frame header parsing readability
Antoine Tenart [Mon, 12 Aug 2019 14:45:35 +0000 (16:45 +0200)]
net: mscc: improve the frame header parsing readability

This cosmetic patch improves the frame header parsing readability by
introducing a new macro to access and mask its fields.

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: mscc: describe the PTP register range
Antoine Tenart [Mon, 12 Aug 2019 14:45:34 +0000 (16:45 +0200)]
net: mscc: describe the PTP register range

This patch adds support for using the PTP register range, and adds a
description of its registers. This bank is used when configuring PTP.

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoDocumentation/bindings: net: ocelot: document the PTP ready IRQ
Antoine Tenart [Mon, 12 Aug 2019 14:45:33 +0000 (16:45 +0200)]
Documentation/bindings: net: ocelot: document the PTP ready IRQ

One additional interrupt needs to be described within the Ocelot device
tree node: the PTP ready one. This patch documents the binding needed to
do so.

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoDocumentation/bindings: net: ocelot: document the PTP bank
Antoine Tenart [Mon, 12 Aug 2019 14:45:32 +0000 (16:45 +0200)]
Documentation/bindings: net: ocelot: document the PTP bank

One additional register range needs to be described within the Ocelot
device tree node: the PTP. This patch documents the binding needed to do
so.

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'qed-NVM'
David S. Miller [Thu, 15 Aug 2019 19:54:45 +0000 (12:54 -0700)]
Merge branch 'qed-NVM'

Sudarsana Reddy Kalluru says:

====================
qed*: Support for NVM config attributes.

The patch series adds support for managing the NVM config attributes.
Patch (1) adds functionality to update config attributes via MFW.
Patch (2) adds driver interface for updating the config attributes.

Changes from previous versions:
-------------------------------
v4: Added more details on the functionality and its usage.
v3: Removed unused variable.
v2: Removed unused API.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoqed: Add driver API for flashing the config attributes.
Sudarsana Reddy Kalluru [Wed, 14 Aug 2019 08:11:53 +0000 (01:11 -0700)]
qed: Add driver API for flashing the config attributes.

The patch adds driver interface for reading the config attributes from user
provided buffer, and updates these values on nvm config flash partition.

This is basically an expansion of our existing ethtool -f implementation.
The management FW has exposed an additional method of configuring some of
the nvram options, and this makes use of that. This implementation will
come into use when newer FW files which contain configuration directives
employing this API will be provided to ethtool -f.

Signed-off-by: Sudarsana Reddy Kalluru <skalluru@marvell.com>
Signed-off-by: Ariel Elior <aelior@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoqed: Add API for configuring NVM attributes.
Sudarsana Reddy Kalluru [Wed, 14 Aug 2019 08:11:52 +0000 (01:11 -0700)]
qed: Add API for configuring NVM attributes.

The patch adds API for configuring the NVM config attributes using
Management FW (MFW) interfaces.

Signed-off-by: Sudarsana Reddy Kalluru <skalluru@marvell.com>
Signed-off-by: Ariel Elior <aelior@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge tag 'linux-can-next-for-5.4-20190814' of git://git.kernel.org/pub/scm/linux...
David S. Miller [Thu, 15 Aug 2019 19:43:22 +0000 (12:43 -0700)]
Merge tag 'linux-can-next-for-5.4-20190814' of git://git./linux/kernel/git/mkl/linux-can-next

Marc Kleine-Budde says:

====================
pull-request: can-next 2019-08-14

this is a pull request for net-next/master consisting of 41 patches.

The first two patches are for the kvaser_pciefd driver: Christer Beskow
removes unnecessary code in the kvaser_pciefd_pwm_stop() function,
YueHaibing removes the unused including of <linux/version.h>.

In the next patch YueHaibing also removes the unused including of
<linux/version.h> in the f81601 driver.

In the ti_hecc driver the next 6 patches are by me and fix checkpatch
warnings. YueHaibing's patch removes an unused variable in the
ti_hecc_mailbox_read() function.

The next 6 patches all target the xilinx_can driver. Anssi Hannula's
patch fixes a chip start failure with an invalid bus. The patch by
Venkatesh Yadav Abbarapu skips an error message in case of a deferred
probe. The 3 patches by Appana Durga Kedareswara rao fix the RX and TX
path for CAN-FD frames. Srinivas Neeli's patch fixes the bit timing
calculations for CAN-FD.

The next 12 patches are by me and several checkpatch warnings in the
af_can, raw and bcm components.

Thomas Gleixner provides a patch for the bcm, which switches the timer
to HRTIMER_MODE_SOFT and removes the hrtimer_tasklet.

Then 6 more patches by me for the gw component, which fix checkpatch
warnings, followed by 2 patches by Oliver Hartkopp to add CAN-FD
support.

The vcan driver gets 3 patches by me, fixing checkpatch warnings.

And finally a patch by Andre Hartmann to fix typos in CAN's netlink
header.
====================

5 years agopage_pool: fix logic in __page_pool_get_cached
Jonathan Lemon [Tue, 13 Aug 2019 17:45:09 +0000 (10:45 -0700)]
page_pool: fix logic in __page_pool_get_cached

__page_pool_get_cached() will return NULL when the ring is
empty, even if there are pages present in the lookaside cache.

It is also possible to refill the cache, and then return a
NULL page.

Restructure the logic so eliminate both cases.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'rds-next'
David S. Miller [Thu, 15 Aug 2019 19:04:24 +0000 (12:04 -0700)]
Merge branch 'rds-next'

Gerd Rausch says:

====================
net/rds: Fixes from internal Oracle repo

This is the first set of (mostly old) patches from our internal repository
in an effort to synchronize what Oracle had been using internally
with what is shipped with the Linux kernel.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agords: check for excessive looping in rds_send_xmit
Andy Grover [Thu, 13 Jan 2011 19:40:31 +0000 (11:40 -0800)]
rds: check for excessive looping in rds_send_xmit

Original commit from 2011 updated to include a change by
Yuval Shaia <yuval.shaia@oracle.com>
that adds a new statistic counter "send_stuck_rm"
to capture the messages looping exessively
in the send path.

Signed-off-by: Gerd Rausch <gerd.rausch@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/rds: Add a few missing rds_stat_names entries
Gerd Rausch [Thu, 11 Jul 2019 19:15:50 +0000 (12:15 -0700)]
net/rds: Add a few missing rds_stat_names entries

In a previous commit, fields were added to "struct rds_statistics"
but array "rds_stat_names" was not updated accordingly.

Please note the inconsistent naming of the string representations
that is done in the name of compatibility
with the Oracle internal code-base.

s_recv_bytes_added_to_socket     -> "recv_bytes_added_to_sock"
s_recv_bytes_removed_from_socket -> "recv_bytes_freed_fromsock"

Fixes: 192a798f5299 ("RDS: add stat for socket recv memory usage")
Signed-off-by: Gerd Rausch <gerd.rausch@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoRDS: don't use GFP_ATOMIC for sk_alloc in rds_create
Chris Mason [Fri, 3 Feb 2012 16:08:51 +0000 (11:08 -0500)]
RDS: don't use GFP_ATOMIC for sk_alloc in rds_create

Signed-off-by: Chris Mason <chris.mason@oracle.com>
Signed-off-by: Bang Nguyen <bang.nguyen@oracle.com>
Signed-off-by: Gerd Rausch <gerd.rausch@oracle.com>
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoRDS: limit the number of times we loop in rds_send_xmit
Chris Mason [Fri, 3 Feb 2012 16:07:54 +0000 (11:07 -0500)]
RDS: limit the number of times we loop in rds_send_xmit

This will kick the RDS worker thread if we have been looping
too long.

Original commit from 2012 updated to include a change by
Venkat Venkatsubra <venkat.x.venkatsubra@oracle.com>
that triggers "must_wake" if "rds_ib_recv_refill_one" fails.

Signed-off-by: Gerd Rausch <gerd.rausch@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'netdevsim-implement-support-for-devlink-region-and-snapshots'
David S. Miller [Thu, 15 Aug 2019 19:02:44 +0000 (12:02 -0700)]
Merge branch 'netdevsim-implement-support-for-devlink-region-and-snapshots'

Jiri Pirko says:

====================
netdevsim: implement support for devlink region and snapshots

Implement devlink region support for netdevsim and test it.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoselftests: netdevsim: add devlink regions tests
Jiri Pirko [Thu, 15 Aug 2019 13:46:34 +0000 (15:46 +0200)]
selftests: netdevsim: add devlink regions tests

Test netdevsim devlink region implementation.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Tested-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonetdevsim: implement support for devlink region and snapshots
Jiri Pirko [Thu, 15 Aug 2019 13:46:33 +0000 (15:46 +0200)]
netdevsim: implement support for devlink region and snapshots

Implement dummy region of size 32K and allow user to create snapshots
or random data using debugfs file trigger.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'selftests-netdevsim-add-devlink-paramstests'
David S. Miller [Thu, 15 Aug 2019 19:01:22 +0000 (12:01 -0700)]
Merge branch 'selftests-netdevsim-add-devlink-paramstests'

Jiri Pirko says:

====================
selftests: netdevsim: add devlink paramstests

The first patch is just a helper addition as a dependency of the actual
test in patch number two.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoselftests: netdevsim: add devlink params tests
Jiri Pirko [Thu, 15 Aug 2019 13:42:29 +0000 (15:42 +0200)]
selftests: netdevsim: add devlink params tests

Test recently added netdevsim devlink param implementation.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Tested-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoselftests: net: push jq workaround into separate helper
Jiri Pirko [Thu, 15 Aug 2019 13:42:28 +0000 (15:42 +0200)]
selftests: net: push jq workaround into separate helper

Push the jq return value workaround code into a separate helper so it
could be used by the rest of the code.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agopage_pool: remove unnecessary variable init
Yunsheng Lin [Thu, 15 Aug 2019 12:41:00 +0000 (20:41 +0800)]
page_pool: remove unnecessary variable init

Remove variable initializations in functions that
are followed by assignments before use

Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agor8169: sync EEE handling for RTL8168h with vendor driver
Heiner Kallweit [Thu, 15 Aug 2019 12:21:30 +0000 (14:21 +0200)]
r8169: sync EEE handling for RTL8168h with vendor driver

Sync EEE init for RTL8168h with vendor driver and add two writes to
vendor-specific registers.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'realtek-EEE'
David S. Miller [Thu, 15 Aug 2019 18:48:30 +0000 (11:48 -0700)]
Merge branch 'realtek-EEE'

Heiner Kallweit says:

====================
net: phy: realtek: map vendor-specific EEE registers to standard MMD registers

EEE-related registers on newer integrated PHY's have the standard
layout, but are accessible not via MMD but via vendor-specific
registers. Emulating the standard MMD registers allows to use the
generic functions for EEE control and to significantly simplify
the r8169 driver.

v2:
- rebase patch 2
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agor8169: use the generic EEE management functions
Heiner Kallweit [Thu, 15 Aug 2019 12:14:18 +0000 (14:14 +0200)]
r8169: use the generic EEE management functions

Now that the Realtek PHY driver maps the vendor-specific EEE registers
to the standard MMD registers, we can remove all special handling and
use the generic functions phy_ethtool_get/set_eee.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: realtek: add support for EEE registers on integrated PHY's
Heiner Kallweit [Thu, 15 Aug 2019 12:12:55 +0000 (14:12 +0200)]
net: phy: realtek: add support for EEE registers on integrated PHY's

EEE-related registers on newer integrated PHY's have the standard
layout, but are accessible not via MMD but via vendor-specific
registers. Emulating the standard MMD registers allows to use the
generic functions for EEE control.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: swphy: emulate register MII_ESTATUS
Heiner Kallweit [Thu, 15 Aug 2019 11:19:22 +0000 (13:19 +0200)]
net: phy: swphy: emulate register MII_ESTATUS

When the genphy driver binds to a swphy it will call
genphy_read_abilites that will try to read MII_ESTATUS if BMSR_ESTATEN
is set in MII_BMSR. So far this would read the default value 0xffff
and 1000FD and 1000HD are reported as supported just by chance.
Better add explicit support for emulating MII_ESTATUS.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: read MII_CTRL1000 in genphy_read_status only if needed
Heiner Kallweit [Thu, 15 Aug 2019 11:15:19 +0000 (13:15 +0200)]
net: phy: read MII_CTRL1000 in genphy_read_status only if needed

Value of MII_CTRL1000 is needed only if LPA_1000MSFAIL is set.
Therefore move reading this register.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/rds: Add RDS6_INFO_SOCKETS and RDS6_INFO_RECV_MESSAGES options
Ka-Cheong Poon [Thu, 15 Aug 2019 09:36:43 +0000 (02:36 -0700)]
net/rds: Add RDS6_INFO_SOCKETS and RDS6_INFO_RECV_MESSAGES options

Add support of the socket options RDS6_INFO_SOCKETS and
RDS6_INFO_RECV_MESSAGES which update the RDS_INFO_SOCKETS and
RDS_INFO_RECV_MESSAGES options respectively.  The old options work
for IPv4 sockets only.

Signed-off-by: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/mvpp2: Replace tasklet with softirq hrtimer
Thomas Gleixner [Tue, 13 Aug 2019 08:00:25 +0000 (10:00 +0200)]
net/mvpp2: Replace tasklet with softirq hrtimer

The tx_done_tasklet tasklet is used in invoke the hrtimer
(mvpp2_hr_timer_cb) in softirq context. This can be also achieved without
the tasklet but with HRTIMER_MODE_SOFT as hrtimer mode.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next
David S. Miller [Thu, 15 Aug 2019 02:59:00 +0000 (19:59 -0700)]
Merge git://git./linux/kernel/git/pablo/nf-next

Pablo Neira Ayuso says:

====================
Netfilter updates for net-next

The following patchset contains Netfilter updates for net-next.
This round addresses fallout from previous pull request:

1) Remove #warning from ipt_LOG.h and ip6t_LOG.h headers,
   from Jeremy Sowden.

2) Incorrect parens in memcmp() in nft_bitwise, from Nathan Chancellor.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonetfilter: nft_bitwise: Adjust parentheses to fix memcmp size argument
Nathan Chancellor [Wed, 14 Aug 2019 16:58:09 +0000 (09:58 -0700)]
netfilter: nft_bitwise: Adjust parentheses to fix memcmp size argument

clang warns:

net/netfilter/nft_bitwise.c:138:50: error: size argument in 'memcmp'
call is a comparison [-Werror,-Wmemsize-comparison]
        if (memcmp(&priv->xor, &zero, sizeof(priv->xor) ||
                                      ~~~~~~~~~~~~~~~~~~^~
net/netfilter/nft_bitwise.c:138:6: note: did you mean to compare the
result of 'memcmp' instead?
        if (memcmp(&priv->xor, &zero, sizeof(priv->xor) ||
            ^
                                                       )
net/netfilter/nft_bitwise.c:138:32: note: explicitly cast the argument
to size_t to silence this warning
        if (memcmp(&priv->xor, &zero, sizeof(priv->xor) ||
                                      ^
                                      (size_t)(
1 error generated.

Adjust the parentheses so that the result of the sizeof is used for the
size argument in memcmp, rather than the result of the comparison (which
would always be true because sizeof is a non-zero number).

Fixes: bd8699e9e292 ("netfilter: nft_bitwise: add offload support")
Link: https://github.com/ClangBuiltLinux/linux/issues/638
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
5 years agonetfilter: remove deprecation warnings from uapi headers.
Jeremy Sowden [Wed, 14 Aug 2019 08:01:28 +0000 (09:01 +0100)]
netfilter: remove deprecation warnings from uapi headers.

There are two netfilter userspace headers which contain deprecation
warnings.  While these headers are not used within the kernel, they are
compiled stand-alone for header-testing.

Pablo informs me that userspace iptables still refer to these headers,
and the intention was to use xt_LOG.h instead and remove these, but
userspace was never updated.

Remove the warnings.

Fixes: 2a475c409fe8 ("kbuild: remove all netfilter headers from header-test blacklist.")
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
5 years agonet: phy: realtek: add NBase-T PHY auto-detection
Heiner Kallweit [Tue, 13 Aug 2019 06:09:32 +0000 (08:09 +0200)]
net: phy: realtek: add NBase-T PHY auto-detection

Realtek provided information on how the new NIC-integrated PHY's
expose whether they support 2.5G/5G/10G. This allows to automatically
differentiate 1Gbps and 2.5Gbps PHY's, and therefore allows to
remove the fake PHY ID mechanism for RTL8125.
So far RTL8125 supports 2.5Gbps only, but register layout for faster
modes has been defined already, so let's use this information to be
future-proof.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agor8169: fix sporadic transmit timeout issue
Heiner Kallweit [Mon, 12 Aug 2019 18:47:40 +0000 (20:47 +0200)]
r8169: fix sporadic transmit timeout issue

Holger reported sporadic transmit timeouts and it turned out that one
path misses ringing the doorbell. Fix was suggested by Eric.

Fixes: ef14358546b1 ("r8169: make use of xmit_more")
Suggested-by: Eric Dumazet <edumazet@google.com>
Tested-by: Holger Hoffstätte <holger@applied-asynchrony.com>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next
Jakub Kicinski [Wed, 14 Aug 2019 01:22:57 +0000 (18:22 -0700)]
Merge git://git./linux/kernel/git/pablo/nf-next

Pablo Neira Ayuso says:

====================
Netfilter/IPVS updates for net-next

The following patchset contains Netfilter/IPVS updates for net-next:

1) Rename mss field to mss_option field in synproxy, from Fernando Mancera.

2) Use SYSCTL_{ZERO,ONE} definitions in conntrack, from Matteo Croce.

3) More strict validation of IPVS sysctl values, from Junwei Hu.

4) Remove unnecessary spaces after on the right hand side of assignments,
   from yangxingwu.

5) Add offload support for bitwise operation.

6) Extend the nft_offload_reg structure to store immediate date.

7) Collapse several ip_set header files into ip_set.h, from
   Jeremy Sowden.

8) Make netfilter headers compile with CONFIG_KERNEL_HEADER_TEST=y,
   from Jeremy Sowden.

9) Fix several sparse warnings due to missing prototypes, from
   Valdis Kletnieks.

10) Use static lock initialiser to ensure connlabel spinlock is
    initialized on boot time to fix sched/act_ct.c, patch
    from Florian Westphal.
====================

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
5 years agoMerge branch 'r8152-RX-improve'
Jakub Kicinski [Wed, 14 Aug 2019 01:12:45 +0000 (18:12 -0700)]
Merge branch 'r8152-RX-improve'

Hayes says:

====================
v2:
For patch #2, replace list_for_each_safe with list_for_each_entry_safe.
Remove unlikely in WARN_ON. Adjust the coding style.

For patch #4, replace list_for_each_safe with list_for_each_entry_safe.
Remove "else" after "continue".

For patch #5. replace sysfs with ethtool to modify rx_copybreak and
rx_pending.

v1:
The different chips use different rx buffer size.

Use skb_add_rx_frag() to reduce memory copy for RX.
====================

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
5 years agor8152: change rx_copybreak and rx_pending through ethtool
Hayes Wang [Tue, 13 Aug 2019 03:42:09 +0000 (11:42 +0800)]
r8152: change rx_copybreak and rx_pending through ethtool

Let the rx_copybreak and rx_pending could be modified by
ethtool.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
5 years agor8152: support skb_add_rx_frag
Hayes Wang [Tue, 13 Aug 2019 03:42:08 +0000 (11:42 +0800)]
r8152: support skb_add_rx_frag

Use skb_add_rx_frag() to reduce the memory copy for rx data.

Use a new list of rx_used to store the rx buffer which couldn't be
reused yet.

Besides, the total number of rx buffer may be increased or decreased
dynamically. And it is limited by RTL8152_MAX_RX_AGG.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
5 years agor8152: use alloc_pages for rx buffer
Hayes Wang [Tue, 13 Aug 2019 03:42:07 +0000 (11:42 +0800)]
r8152: use alloc_pages for rx buffer

Replace kmalloc_node() with alloc_pages() for rx buffer.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
5 years agor8152: replace array with linking list for rx information
Hayes Wang [Tue, 13 Aug 2019 03:42:06 +0000 (11:42 +0800)]
r8152: replace array with linking list for rx information

The original method uses an array to store the rx information. The
new one uses a list to link each rx structure. Then, it is possible
to increase/decrease the number of rx structure dynamically.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
5 years agor8152: separate the rx buffer size
Hayes Wang [Tue, 13 Aug 2019 03:42:05 +0000 (11:42 +0800)]
r8152: separate the rx buffer size

The different chips may accept different rx buffer sizes. The RTL8152
supports 16K bytes, and RTL8153 support 32K bytes.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
5 years agoMerge branch 'net-phy-let-phy_speed_down-up-support-speeds-1Gbps'
Jakub Kicinski [Wed, 14 Aug 2019 00:16:11 +0000 (17:16 -0700)]
Merge branch 'net-phy-let-phy_speed_down-up-support-speeds-1Gbps'

Heiner says:

====================
So far phy_speed_down/up can be used up to 1Gbps only. Remove this
restriction and add needed helpers to phy-core.c

v2:
- remove unused parameter in patch 1
- rename __phy_speed_down to phy_speed_down_core in patch 2
====================

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
5 years agonet: phy: let phy_speed_down/up support speeds >1Gbps
Heiner Kallweit [Mon, 12 Aug 2019 21:52:19 +0000 (23:52 +0200)]
net: phy: let phy_speed_down/up support speeds >1Gbps

So far phy_speed_down/up can be used up to 1Gbps only. Remove this
restriction by using new helper __phy_speed_down. New member adv_old
in struct phy_device is used by phy_speed_up to restore the advertised
modes before calling phy_speed_down. Don't simply advertise what is
supported because a user may have intentionally removed modes from
advertisement.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
5 years agonet: phy: add phy_speed_down_core and phy_resolve_min_speed
Heiner Kallweit [Mon, 12 Aug 2019 21:51:27 +0000 (23:51 +0200)]
net: phy: add phy_speed_down_core and phy_resolve_min_speed

phy_speed_down_core provides most of the functionality for
phy_speed_down. It makes use of new helper phy_resolve_min_speed that is
based on the sorting of the settings[] array. In certain cases it may be
helpful to be able to exclude legacy half duplex modes, therefore
prepare phy_resolve_min_speed() for it.

v2:
- rename __phy_speed_down to phy_speed_down_core

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
5 years agonet: phy: add __set_linkmode_max_speed
Heiner Kallweit [Mon, 12 Aug 2019 21:50:30 +0000 (23:50 +0200)]
net: phy: add __set_linkmode_max_speed

We will need the functionality of __set_linkmode_max_speed also for
linkmode bitmaps other than phydev->supported. Therefore split it.

v2:
- remove unused parameter from __set_linkmode_max_speed

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
5 years agonet: devlink: remove redundant rtnl lock assert
Vlad Buslov [Mon, 12 Aug 2019 17:02:02 +0000 (20:02 +0300)]
net: devlink: remove redundant rtnl lock assert

It is enough for caller of devlink_compat_switch_id_get() to hold the net
device to guarantee that devlink port is not destroyed concurrently. Remove
rtnl lock assertion and modify comment to warn user that they must hold
either rtnl lock or reference to net device. This is necessary to
accommodate future implementation of rtnl-unlocked TC offloads driver
callbacks.

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
5 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next
Jakub Kicinski [Tue, 13 Aug 2019 23:24:57 +0000 (16:24 -0700)]
Merge git://git./linux/kernel/git/bpf/bpf-next

Daniel Borkmann says:

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

There is a small merge conflict in libbpf (Cc Andrii so he's in the loop
as well):

        for (i = 1; i <= btf__get_nr_types(btf); i++) {
                t = (struct btf_type *)btf__type_by_id(btf, i);

                if (!has_datasec && btf_is_var(t)) {
                        /* replace VAR with INT */
                        t->info = BTF_INFO_ENC(BTF_KIND_INT, 0, 0);
  <<<<<<< HEAD
                        /*
                         * using size = 1 is the safest choice, 4 will be too
                         * big and cause kernel BTF validation failure if
                         * original variable took less than 4 bytes
                         */
                        t->size = 1;
                        *(int *)(t+1) = BTF_INT_ENC(0, 0, 8);
                } else if (!has_datasec && kind == BTF_KIND_DATASEC) {
  =======
                        t->size = sizeof(int);
                        *(int *)(t + 1) = BTF_INT_ENC(0, 0, 32);
                } else if (!has_datasec && btf_is_datasec(t)) {
  >>>>>>> 72ef80b5ee131e96172f19e74b4f98fa3404efe8
                        /* replace DATASEC with STRUCT */

Conflict is between the two commits 1d4126c4e119 ("libbpf: sanitize VAR to
conservative 1-byte INT") and b03bc6853c0e ("libbpf: convert libbpf code to
use new btf helpers"), so we need to pick the sanitation fixup as well as
use the new btf_is_datasec() helper and the whitespace cleanup. Looks like
the following:

  [...]
                if (!has_datasec && btf_is_var(t)) {
                        /* replace VAR with INT */
                        t->info = BTF_INFO_ENC(BTF_KIND_INT, 0, 0);
                        /*
                         * using size = 1 is the safest choice, 4 will be too
                         * big and cause kernel BTF validation failure if
                         * original variable took less than 4 bytes
                         */
                        t->size = 1;
                        *(int *)(t + 1) = BTF_INT_ENC(0, 0, 8);
                } else if (!has_datasec && btf_is_datasec(t)) {
                        /* replace DATASEC with STRUCT */
  [...]

The main changes are:

1) Addition of core parts of compile once - run everywhere (co-re) effort,
   that is, relocation of fields offsets in libbpf as well as exposure of
   kernel's own BTF via sysfs and loading through libbpf, from Andrii.

   More info on co-re: http://vger.kernel.org/bpfconf2019.html#session-2
   and http://vger.kernel.org/lpc-bpf2018.html#session-2

2) Enable passing input flags to the BPF flow dissector to customize parsing
   and allowing it to stop early similar to the C based one, from Stanislav.

3) Add a BPF helper function that allows generating SYN cookies from XDP and
   tc BPF, from Petar.

4) Add devmap hash-based map type for more flexibility in device lookup for
   redirects, from Toke.

5) Improvements to XDP forwarding sample code now utilizing recently enabled
   devmap lookups, from Jesper.

6) Add support for reporting the effective cgroup progs in bpftool, from Jakub
   and Takshak.

7) Fix reading kernel config from bpftool via /proc/config.gz, from Peter.

8) Fix AF_XDP umem pages mapping for 32 bit architectures, from Ivan.

9) Follow-up to add two more BPF loop tests for the selftest suite, from Alexei.

10) Add perf event output helper also for other skb-based program types, from Allan.

11) Fix a co-re related compilation error in selftests, from Yonghong.
====================

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
5 years agonet: hns3: Make hclge_func_reset_sync_vf static
YueHaibing [Mon, 12 Aug 2019 14:41:56 +0000 (22:41 +0800)]
net: hns3: Make hclge_func_reset_sync_vf static

Fix sparse warning:

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c:3190:5:
 warning: symbol 'hclge_func_reset_sync_vf' was not declared. Should it be static?

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
5 years agodevlink: send notifications for deleted snapshots on region destroy
Jiri Pirko [Mon, 12 Aug 2019 12:28:31 +0000 (14:28 +0200)]
devlink: send notifications for deleted snapshots on region destroy

Currently the notifications for deleted snapshots are sent only in case
user deletes a snapshot manually. Send the notifications in case region
is destroyed too.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
5 years agoMerge branch 'bpf-libbpf-read-sysfs-btf'
Daniel Borkmann [Tue, 13 Aug 2019 21:19:42 +0000 (23:19 +0200)]
Merge branch 'bpf-libbpf-read-sysfs-btf'

Andrii Nakryiko says:

====================
Now that kernel's BTF is exposed through sysfs at well-known location, attempt
to load it first as a target BTF for the purpose of BPF CO-RE relocations.

Patch #1 is a follow-up patch to rename /sys/kernel/btf/kernel into
/sys/kernel/btf/vmlinux.

Patch #2 adds ability to load raw BTF contents from sysfs and expands the list
of locations libbpf attempts to load vmlinux BTF from.
====================

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
5 years agolibbpf: attempt to load kernel BTF from sysfs first
Andrii Nakryiko [Tue, 13 Aug 2019 18:54:43 +0000 (11:54 -0700)]
libbpf: attempt to load kernel BTF from sysfs first

Add support for loading kernel BTF from sysfs (/sys/kernel/btf/vmlinux)
as a target BTF. Also extend the list of on disk search paths for
vmlinux ELF image with entries that perf is searching for.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
5 years agobtf: rename /sys/kernel/btf/kernel into /sys/kernel/btf/vmlinux
Andrii Nakryiko [Tue, 13 Aug 2019 18:54:42 +0000 (11:54 -0700)]
btf: rename /sys/kernel/btf/kernel into /sys/kernel/btf/vmlinux

Expose kernel's BTF under the name vmlinux to be more uniform with using
kernel module names as file names in the future.

Fixes: 341dfcf8d78e ("btf: expose BTF info through sysfs")
Suggested-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
5 years agocan: netlink: fix documentation typos
Andre Hartmann [Sat, 23 Mar 2019 15:04:19 +0000 (16:04 +0100)]
can: netlink: fix documentation typos

This patch fixes some documentation typos in struct can_bittiming_const.

Signed-off-by: Andre Hartmann <aha_1980@gmx.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: vcan: introduce pr_fmt and make use of it
Marc Kleine-Budde [Fri, 26 Jul 2019 07:35:43 +0000 (09:35 +0200)]
can: vcan: introduce pr_fmt and make use of it

This patch introduces pr_fmt and makes use of it, also it converts a
printk() to pr_info().

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: vcan: remove unnecessary blank lines
Marc Kleine-Budde [Wed, 24 Jul 2019 12:28:21 +0000 (14:28 +0200)]
can: vcan: remove unnecessary blank lines

This patch removes unnecessary blank lines, so that checkpatch doesn't
complain anymore.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: vcan: convert block comments to network style comments
Marc Kleine-Budde [Wed, 24 Jul 2019 12:16:29 +0000 (14:16 +0200)]
can: vcan: convert block comments to network style comments

This patch converts all block comments to network subsystem style block
comments.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: gw: add support for CAN FD frames
Oliver Hartkopp [Sat, 10 Aug 2019 19:18:10 +0000 (21:18 +0200)]
can: gw: add support for CAN FD frames

Introduce CAN FD support which needs an extension of the netlink API to
pass CAN FD type content to the kernel which has a different size to
Classic CAN. Additionally the struct canfd_frame has a new 'flags' element
that can now be modified with can-gw.

The new CGW_FLAGS_CAN_FD option flag defines whether the routing job
handles Classic CAN or CAN FD frames. This setting is very strict at
reception time and enables the new possibilities, e.g. CGW_FDMOD_* and
modifying the flags element of struct canfd_frame, only when
CGW_FLAGS_CAN_FD is set.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: gw: use struct canfd_frame as internal data structure
Oliver Hartkopp [Sat, 10 Aug 2019 19:18:09 +0000 (21:18 +0200)]
can: gw: use struct canfd_frame as internal data structure

To prepare the CAN FD support this patch implements the first adaptions in
data structures for CAN FD without changing the current functionality.

Additionally some code at the end of this patch is moved or indented to
simplify the review of the next implementation step.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: gw: cgw_parse_attr(): remove unnecessary braces for single statement block
Marc Kleine-Budde [Wed, 24 Jul 2019 12:48:14 +0000 (14:48 +0200)]
can: gw: cgw_parse_attr(): remove unnecessary braces for single statement block

This patch removes some unnecessary braces for a single statement block.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: gw: cgw_dump_jobs(): avoid long lines
Marc Kleine-Budde [Wed, 24 Jul 2019 12:34:42 +0000 (14:34 +0200)]
can: gw: cgw_dump_jobs(): avoid long lines

This patch rewraps the arguments of cgw_put_job() to avoid long lines,
which also fixes the indention.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: gw: can_can_gw_rcv(): remove return at end of void function
Marc Kleine-Budde [Wed, 24 Jul 2019 12:33:13 +0000 (14:33 +0200)]
can: gw: can_can_gw_rcv(): remove return at end of void function

This patch remove the return at the end of the void function
can_can_gw_rcv().

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: gw: add missing spaces around operators
Marc Kleine-Budde [Wed, 24 Jul 2019 12:31:48 +0000 (14:31 +0200)]
can: gw: add missing spaces around operators

This patch add missing spaces around the '^' and '+' operators.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: gw: remove unnecessary blank lines, add suggested blank lines
Marc Kleine-Budde [Wed, 24 Jul 2019 12:28:21 +0000 (14:28 +0200)]
can: gw: remove unnecessary blank lines, add suggested blank lines

This patch removes unnecessary blank lines, and adds suggested ones, so
that checkpatch doesn't complain anymore.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: gw: convert block comments to network style comments
Marc Kleine-Budde [Wed, 24 Jul 2019 12:16:29 +0000 (14:16 +0200)]
can: gw: convert block comments to network style comments

This patch converts all block comments to network subsystem style block
comments.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: bcm: switch timer to HRTIMER_MODE_SOFT and remove hrtimer_tasklet
Thomas Gleixner [Mon, 12 Aug 2019 12:57:14 +0000 (14:57 +0200)]
can: bcm: switch timer to HRTIMER_MODE_SOFT and remove hrtimer_tasklet

This patch switches the timer to HRTIMER_MODE_SOFT, which executed the
timer callback in softirq context and removes the hrtimer_tasklet.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: bcm: bcm_sock_no_ioctlcmd(): mark function as static
Marc Kleine-Budde [Mon, 12 Aug 2019 13:49:04 +0000 (15:49 +0200)]
can: bcm: bcm_sock_no_ioctlcmd(): mark function as static

This patch marks the bcm_sock_no_ioctlcmd() function as static as it's
only used in this source file.

Fixes: 473d924d7d46 ("can: fix ioctl function removal")
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: raw: raw_sock_no_ioctlcmd(): mark function as static
Marc Kleine-Budde [Mon, 12 Aug 2019 13:49:04 +0000 (15:49 +0200)]
can: raw: raw_sock_no_ioctlcmd(): mark function as static

This patch marks the raw_sock_no_ioctlcmd() function as static as it's
only used in this source file.

Fixes: 473d924d7d46 ("can: fix ioctl function removal")
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: raw: raw_module_init(): use pr_err() instead of printk(KERN_ERR, ...)
Marc Kleine-Budde [Tue, 13 Aug 2019 07:07:14 +0000 (09:07 +0200)]
can: raw: raw_module_init(): use pr_err() instead of printk(KERN_ERR, ...)

This patch converts a printk(KERN_ERR, ...) to a pr_err().

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: raw: balance braces around else statements
Marc Kleine-Budde [Tue, 13 Aug 2019 07:03:55 +0000 (09:03 +0200)]
can: raw: balance braces around else statements

This patch balances the braces around else statements, so that
checkpatch doesn't complain anymore.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5 years agocan: raw: remove unnecessary blank lines, add suggested blank lines
Marc Kleine-Budde [Wed, 24 Jul 2019 12:28:21 +0000 (14:28 +0200)]
can: raw: remove unnecessary blank lines, add suggested blank lines

This patch removes unnecessary blank lines, and adds suggested ones, so
that checkpatch doesn't complain anymore.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>