platform/kernel/linux-starfive.git
5 years agonet: phy: icplus: rename IP101A_G_NO_IRQ to IP101A_G_IRQ_ALL_MASK
Martin Blumenstingl [Sun, 18 Nov 2018 21:23:57 +0000 (22:23 +0100)]
net: phy: icplus: rename IP101A_G_NO_IRQ to IP101A_G_IRQ_ALL_MASK

The datasheet uses the name "All Mask" for this bit. Change the name of
our #define to be consistent with the datasheet. While here also replace
the tab between the #define and IP101A_G_IRQ_ALL_MASK with a space.
No functional changes.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: icplus: use the BIT macro where possible
Martin Blumenstingl [Sun, 18 Nov 2018 21:23:56 +0000 (22:23 +0100)]
net: phy: icplus: use the BIT macro where possible

This makes the code consistent by using the BIT() macro instead of
manual bit-shifting for some of the fields. No functional changes.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: icplus: keep all ip101a_g functions together
Martin Blumenstingl [Sun, 18 Nov 2018 21:23:55 +0000 (22:23 +0100)]
net: phy: icplus: keep all ip101a_g functions together

This simply moves ip101a_g_config_init right above
ip101a_g_config_intr so all functions for the ICPlus IP101A/G PHYs are
grouped together.
No functional changes.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agodt-bindings: net: phy: add bindings for the IC Plus Corp. IP101A/G PHYs
Martin Blumenstingl [Sun, 18 Nov 2018 21:23:54 +0000 (22:23 +0100)]
dt-bindings: net: phy: add bindings for the IC Plus Corp. IP101A/G PHYs

The IP101A and IP101G series both have various models. Depending on the
board implementation we need a special property for the IP101GR (32-pin
LQFP package) PHY:
pin 21 ("RXER/INTR_32") outputs the "receive error" signal by default
(LOW means "normal operation", HIGH means that there's either a decoding
error of the received signal or that the PHY is receiving LPI). This pin
can also be switched to INTR32 mode, where the interrupt signal is
routed to this pin. The other PHYs don't need this special handling
because they have more pins available so the interrupt function gets a
dedicated pin.

This adds two properties to either select the "receive error" or
"interrupt" function of pin 21. Not specifying any function means that
the default set by the bootloader is used. This is required because the
IP101GR cannot be differentiated between other IP101 PHYs as the PHY
identification registers on all of these is 0x02430c54.

The IP101G (sold as die only, without package) may suffer from the same
issue depending on how it's integrated into a multi chip package by
another manufacturer. If only the RXER/INTR_32 pin is routed then the
users of the die-only variant may also have to explicitly configure the
mode of hte RXER/INTR_32 pin. This is the reason why no "is-ip101gr"
property was added. I have no evidence though which would confirm this
theory - so the binding itself is independent of that.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agodt-bindings: vendor-prefix: add prefix for IC Plus Corp.
Martin Blumenstingl [Sun, 18 Nov 2018 21:23:53 +0000 (22:23 +0100)]
dt-bindings: vendor-prefix: add prefix for IC Plus Corp.

IC Plus Corp. has various Ethernet related products such as Ethernet
transceivers, Ethernet controllers, Ethernet switches, etc.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agotg3: optionally use eth_platform_get_mac_address() to get mac address
thesven73@gmail.com [Sat, 17 Nov 2018 15:56:18 +0000 (10:56 -0500)]
tg3: optionally use eth_platform_get_mac_address() to get mac address

This function will try to determine the mac address via the devicetree,
or via an architecture-specific method (e.g. a PROM on SPARC).

The SPARC-specific code in this driver (#ifdef SPARC) did exactly this,
and is therefore removed.

Note that you can now specify the tg3 mac address via the devicetree,
on any platform, not just SPARC:

Devicetree example:
(see Documentation/devicetree/bindings/pci/pci.txt)

&pcie {
host@0 {
#address-cells = <3>;
#size-cells = <2>;
reg = <0 0 0 0 0>;
bcm5778: bcm5778@0 {
reg = <0 0 0 0 0>;
mac-address = [CA 11 AB 1E 10 01];
};
};
};

Signed-off-by: Sven Van Asbroeck <svendev@arcx.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: Add part of TCP counts explanations in snmp_counters.rst
yupeng [Fri, 16 Nov 2018 19:17:40 +0000 (11:17 -0800)]
net: Add part of TCP counts explanations in snmp_counters.rst

Add explanations of some generic TCP counters, fast open
related counters and TCP abort related counters and several
examples.

Signed-off-by: yupeng <yupeng0921@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'bcmgenet-fix-aborted-suspend'
David S. Miller [Sun, 18 Nov 2018 06:04:39 +0000 (22:04 -0800)]
Merge branch 'bcmgenet-fix-aborted-suspend'

Doug Berger says:

====================
net: bcmgenet: fix aborted suspend

It is not enough to return an error code from the driver suspend
routine. The driver must also restore the device functionality.

This commit corrects the issue introduced by commit 0db55093b566
("net: bcmgenet: return correct value 'ret' from bcmgenet_power_down")
by calling the driver resume function if the suspend function returns
an error.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: bcmgenet: abort suspend on error
Doug Berger [Sat, 17 Nov 2018 02:00:22 +0000 (18:00 -0800)]
net: bcmgenet: abort suspend on error

If an error occurs during suspension of the driver the driver should
restore the hardware configuration and return an error to force the
system to resume.

Fixes: 0db55093b566 ("net: bcmgenet: return correct value 'ret' from bcmgenet_power_down")
Signed-off-by: Doug Berger <opendmb@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: bcmgenet: code movement
Doug Berger [Sat, 17 Nov 2018 02:00:21 +0000 (18:00 -0800)]
net: bcmgenet: code movement

This commit switches the order of bcmgenet_suspend and bcmgenet_resume
in the file to prevent the need for a forward declaration in the next
commit and to make the review of that commit easier.

Signed-off-by: Doug Berger <opendmb@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agogeneve: Initialize addr6 with memset
Nathan Chancellor [Sat, 17 Nov 2018 01:36:27 +0000 (18:36 -0700)]
geneve: Initialize addr6 with memset

Clang warns:

drivers/net/geneve.c:428:29: error: suggest braces around initialization
of subobject [-Werror,-Wmissing-braces]
                struct in6_addr addr6 = { 0 };
                                          ^
                                          {}

Rather than trying to appease the various compilers that support the
kernel, use memset, which is unambiguous.

Fixes: a07966447f39 ("geneve: ICMP error lookup handler")
Suggested-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'net-hns3-Add-vf-mtu-support'
David S. Miller [Sun, 18 Nov 2018 05:57:30 +0000 (21:57 -0800)]
Merge branch 'net-hns3-Add-vf-mtu-support'

Salil Mehta says:

====================
net: hns3: Add vf mtu support

This patchset adds vf mtu support to HNS3 driver.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: hns3: up/down netdev in hclge module when setting mtu
Yunsheng Lin [Sun, 18 Nov 2018 03:19:14 +0000 (03:19 +0000)]
net: hns3: up/down netdev in hclge module when setting mtu

Currently netdev is down in enet module, and it is before
mtu range checking in hclge module, which may be cause
netdev being down unnecessarily.

Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: hns3: Add mtu setting support for vf
Yunsheng Lin [Sun, 18 Nov 2018 03:19:13 +0000 (03:19 +0000)]
net: hns3: Add mtu setting support for vf

The patch adds mtu setting support for vf, currently
vf and pf share the same hardware mtu setting. Mtu set
by vf must be less than or equal to pf' mtu, and mtu
set by pf must be greater than or equal to vf' mtu.

Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: hns3: Add vport alive state checking support
Yunsheng Lin [Sun, 18 Nov 2018 03:19:12 +0000 (03:19 +0000)]
net: hns3: Add vport alive state checking support

Currently there is no way for pf to know if a vf device is
alive or not, so PF does not know which vf to notify when
reset happens, or which vf's mtu is invalid when vf and pf
share the same hardware mtu setting.

This patch adds vport alive state checking support, in order
to support the above scenario.

Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: hns3: Refactor mac mtu setting related functions
Yunsheng Lin [Sun, 18 Nov 2018 03:19:11 +0000 (03:19 +0000)]
net: hns3: Refactor mac mtu setting related functions

This patch refactors mac mtu setting related functions,
normalizes the use of mps and mtu.

Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: hns3: Support two vlan header when setting mtu
Yunsheng Lin [Sun, 18 Nov 2018 03:19:10 +0000 (03:19 +0000)]
net: hns3: Support two vlan header when setting mtu

This patch adds supports for two vlan header when setting mtu.

Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: fsl: Use device_type helpers to access the node type
Rob Herring [Fri, 16 Nov 2018 22:11:03 +0000 (16:11 -0600)]
net: fsl: Use device_type helpers to access the node type

Remove directly accessing device_node.type pointer and use the accessors
instead. This will eventually allow removing the type pointer.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoatm: Convert to using %pOFn instead of device_node.name
Rob Herring [Fri, 16 Nov 2018 22:05:37 +0000 (16:05 -0600)]
atm: Convert to using %pOFn instead of device_node.name

In preparation to remove the node name pointer from struct device_node,
convert printf users to use the %pOFn format specifier.

Cc: Chas Williams <3chas3@gmail.com>
Cc: linux-atm-general@lists.sourceforge.net
Cc: netdev@vger.kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: align gnet_stats_basic_cpu struct
Eric Dumazet [Fri, 16 Nov 2018 15:43:29 +0000 (07:43 -0800)]
net: align gnet_stats_basic_cpu struct

This structure is small (12 or 16 bytes depending on 64bit
or 32bit kernels), but we do not want it spanning two cache lines.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: align pcpu_sw_netstats and pcpu_lstats structs
Eric Dumazet [Fri, 16 Nov 2018 15:24:24 +0000 (07:24 -0800)]
net: align pcpu_sw_netstats and pcpu_lstats structs

Do not risk spanning these small structures on two cache lines,
it is absolutely not worth it.

For 32bit arches, the hint might not be enough, but we do not
really care anymore.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: aquantia: fix spelling mistake "specfield" -> "specified"
Colin Ian King [Fri, 16 Nov 2018 13:36:36 +0000 (13:36 +0000)]
net: aquantia: fix spelling mistake "specfield" -> "specified"

There is a spelling mistake in a netdev_err message. Fix this.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: aquantia: cleanup err handing in hw_atl_utils_fw_rpc_wait
YueHaibing [Fri, 16 Nov 2018 10:25:27 +0000 (18:25 +0800)]
net: aquantia: cleanup err handing in hw_atl_utils_fw_rpc_wait

'err' always be 0 in the two places.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'ncsi-Allow-enabling-multiple-packages-and-channels'
David S. Miller [Sun, 18 Nov 2018 05:09:50 +0000 (21:09 -0800)]
Merge branch 'ncsi-Allow-enabling-multiple-packages-and-channels'

Samuel Mendoza-Jonas says:

====================
net/ncsi: Allow enabling multiple packages & channels

This series extends the NCSI driver to configure multiple packages
and/or channels simultaneously. Since the RFC series this includes a few
extra changes to fix areas in the driver that either made this harder or
were roadblocks due to deviations from the NCSI specification.

Patches 1 & 2 fix two issues where the driver made assumptions about the
capabilities of the NCSI topology.
Patches 3 & 4 change some internal semantics slightly to make multi-mode
easier.
Patch 5 introduces a cleaner way of reconfiguring the NCSI configuration
and keeping track of channel states.
Patch 6 implements the main multi-package/multi-channel configuration,
configured via the Netlink interface.

Readers who have an interesting NCSI setup - especially multi-package
with HWA - please test! I think I've covered all permutations but I
don't have infinite hardware to test on.

Changes in v2:
- Updated use of the channel lock in ncsi_reset_dev(), making the
channel invisible and leaving the monitor check to
ncsi_stop_channel_monitor().
- Fixed ncsi_channel_is_tx() to consider the state of channels in other
packages.
Changes in v3:
- Fixed bisectability bug in patch 1
- Consider channels on all packages in a few places when multi-package
is enabled.
- Avoid doubling up reset operations, and check the current driver state
before reset to let any running operations complete.
- Reorganise the LSC handler slightly to avoid enabling Tx twice.
Changes in v4:
- Fix failover in the single-channel case
- Better handle ncsi_reset_dev() entry during a current config/suspend
operation.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/ncsi: Configure multi-package, multi-channel modes with failover
Samuel Mendoza-Jonas [Fri, 16 Nov 2018 04:51:59 +0000 (15:51 +1100)]
net/ncsi: Configure multi-package, multi-channel modes with failover

This patch extends the ncsi-netlink interface with two new commands and
three new attributes to configure multiple packages and/or channels at
once, and configure specific failover modes.

NCSI_CMD_SET_PACKAGE mask and NCSI_CMD_SET_CHANNEL_MASK set a whitelist
of packages or channels allowed to be configured with the
NCSI_ATTR_PACKAGE_MASK and NCSI_ATTR_CHANNEL_MASK attributes
respectively. If one of these whitelists is set only packages or
channels matching the whitelist are considered for the channel queue in
ncsi_choose_active_channel().

These commands may also use the NCSI_ATTR_MULTI_FLAG to signal that
multiple packages or channels may be configured simultaneously. NCSI
hardware arbitration (HWA) must be available in order to enable
multi-package mode. Multi-channel mode is always available.

If the NCSI_ATTR_CHANNEL_ID attribute is present in the
NCSI_CMD_SET_CHANNEL_MASK command the it sets the preferred channel as
with the NCSI_CMD_SET_INTERFACE command. The combination of preferred
channel and channel whitelist defines a primary channel and the allowed
failover channels.
If the NCSI_ATTR_MULTI_FLAG attribute is also present then the preferred
channel is configured for Tx/Rx and the other channels are enabled only
for Rx.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/ncsi: Reset channel state in ncsi_start_dev()
Samuel Mendoza-Jonas [Fri, 16 Nov 2018 04:51:58 +0000 (15:51 +1100)]
net/ncsi: Reset channel state in ncsi_start_dev()

When the NCSI driver is stopped with ncsi_stop_dev() the channel
monitors are stopped and the state set to "inactive". However the
channels are still configured and active from the perspective of the
network controller. We should suspend each active channel but in the
context of ncsi_stop_dev() the transmit queue has been or is about to be
stopped so we won't have time to do so.

Instead when ncsi_start_dev() is called if the NCSI topology has already
been probed then call ncsi_reset_dev() to suspend any channels that were
previously active. This resets the network controller to a known state,
provides an up to date view of channel link state, and makes sure that
mode flags such as NCSI_MODE_TX_ENABLE are properly reset.

In addition to ncsi_start_dev() use ncsi_reset_dev() in ncsi-netlink.c
to update the channel configuration more cleanly.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/ncsi: Don't mark configured channels inactive
Samuel Mendoza-Jonas [Fri, 16 Nov 2018 04:51:57 +0000 (15:51 +1100)]
net/ncsi: Don't mark configured channels inactive

The concepts of a channel being 'active' and it having link are slightly
muddled in the NCSI driver. Tweak this slightly so that
NCSI_CHANNEL_ACTIVE represents a channel that has been configured and
enabled, and NCSI_CHANNEL_INACTIVE represents a de-configured channel.
This distinction is important because a channel can be 'active' but have
its link down; in this case the channel may still need to be configured
so that it may receive AEN link-state-change packets.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/ncsi: Don't deselect package in suspend if active
Samuel Mendoza-Jonas [Fri, 16 Nov 2018 04:51:56 +0000 (15:51 +1100)]
net/ncsi: Don't deselect package in suspend if active

When a package is deselected all channels of that package cease
communication. If there are other channels active on the package of the
suspended channel this will disable them as well, so only send a
deselect-package command if no other channels are active.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/ncsi: Probe single packages to avoid conflict
Samuel Mendoza-Jonas [Fri, 16 Nov 2018 04:51:55 +0000 (15:51 +1100)]
net/ncsi: Probe single packages to avoid conflict

Currently the NCSI driver sends a select-package command to all possible
packages simultaneously to discover what packages are available. However
at this stage in the probe process the driver does not know if
hardware arbitration is available: if it isn't then this process could
cause collisions on the RMII bus when packages try to respond.

Update the probe loop to probe each package one by one, and once
complete check if HWA is universally supported.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/ncsi: Don't enable all channels when HWA available
Samuel Mendoza-Jonas [Fri, 16 Nov 2018 04:51:54 +0000 (15:51 +1100)]
net/ncsi: Don't enable all channels when HWA available

NCSI hardware arbitration allows multiple packages to be enabled at once
and share the same wiring. If the NCSI driver recognises that HWA is
available it unconditionally enables all packages and channels; but that
is a configuration decision rather than something required by HWA.
Additionally the current implementation will not failover on link events
which can cause connectivity to be lost unless the interface is manually
bounced.

Retain basic HWA support but remove the separate configuration path to
enable all channels, leaving this to be handled by a later
implementation.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agocxgb4: Remove SGE_HOST_PAGE_SIZE dependency on page size
Arjun Vynipadath [Fri, 16 Nov 2018 03:45:42 +0000 (09:15 +0530)]
cxgb4: Remove SGE_HOST_PAGE_SIZE dependency on page size

The SGE Host Page Size has nothing to do with the actual
Host Page Size. It's the SGE's BAR2 Doorbell/GTS Page Size
for interpreting the SGE Ingress/Egress Queue per Page values.
Firmware reads all of these things and makes all the
subsequent changes necessary. The Host Driver uses the SGE
Host Page Size in order to properly calculate BAR2 Offsets.

Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: Arjun Vynipadath <arjun@chelsio.com>
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agotcp: add SRTT to SCM_TIMESTAMPING_OPT_STATS
Yousuk Seung [Fri, 16 Nov 2018 00:44:12 +0000 (16:44 -0800)]
tcp: add SRTT to SCM_TIMESTAMPING_OPT_STATS

Add TCP_NLA_SRTT to SCM_TIMESTAMPING_OPT_STATS that reports the smoothed
round trip time in microseconds (tcp_sock.srtt_us >> 3).

Signed-off-by: Yousuk Seung <ysseung@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agouapi/ethtool: fix spelling errors
Stephen Hemminger [Thu, 15 Nov 2018 23:26:51 +0000 (15:26 -0800)]
uapi/ethtool: fix spelling errors

Trivial spelling errors found by codespell.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agotun: Adjust on-stack tun_page initialization.
David S. Miller [Sun, 18 Nov 2018 00:53:46 +0000 (16:53 -0800)]
tun: Adjust on-stack tun_page initialization.

Instead of constantly playing with the struct initializer
syntax trying to make gcc and CLang both happy, just clear
it out using memset().

>> drivers/net/tun.c:2503:42: warning: Using plain integer as NULL pointer

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agotuntap: free XDP dropped packets in a batch
Jason Wang [Thu, 15 Nov 2018 09:43:10 +0000 (17:43 +0800)]
tuntap: free XDP dropped packets in a batch

Thanks to the batched XDP buffs through msg_control. Instead of
calling put_page() for each page which involves a atomic operation,
let's batch them by record the last page that needs to be freed and
its refcnt count and free them in a batch.

Testpmd(virtio-user + vhost_net) + XDP_DROP shows 3.8% improvement.

Before: 4.71Mpps
After : 4.89Mpps

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agovhost_net: mitigate page reference counting during page frag refill
Jason Wang [Thu, 15 Nov 2018 09:43:09 +0000 (17:43 +0800)]
vhost_net: mitigate page reference counting during page frag refill

We do a get_page() which involves a atomic operation. This patch tries
to mitigate a per packet atomic operation by maintaining a reference
bias which is initially USHRT_MAX. Each time a page is got, instead of
calling get_page() we decrease the bias and when we find it's time to
use a new page we will decrease the bias at one time through
__page_cache_drain_cache().

Testpmd(virtio_user + vhost_net) + XDP_DROP on TAP shows about 1.6%
improvement.

Before: 4.63Mpps
After:  4.71Mpps

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'net-sched-gred-introduce-per-virtual-queue-attributes'
David S. Miller [Sat, 17 Nov 2018 07:08:52 +0000 (23:08 -0800)]
Merge branch 'net-sched-gred-introduce-per-virtual-queue-attributes'

Jakub Kicinski says:

====================
net: sched: gred: introduce per-virtual queue attributes

This series updates the GRED Qdisc.  The Qdisc matches nfp offload very
well, but before we can offload it there are a number of improvements
to make.

First few patches add extack messages to the Qdisc and pass extack
to netlink validation.

Next a new netlink attribute group is added, to allow GRED to be
extended more easily.  Currently GRED passes C structures as attributes,
and even an array of C structs for virtual queue configuration.  User
space has hard coded the expected length of that array, so adding new
fields is not possible.

New two-level attribute group is added:

  [TCA_GRED_VQ_LIST]
    [TCA_GRED_VQ_ENTRY]
      [TCA_GRED_VQ_DP]
      [TCA_GRED_VQ_FLAGS]
      [TCA_GRED_VQ_STAT_*]
    [TCA_GRED_VQ_ENTRY]
      [TCA_GRED_VQ_DP]
      [TCA_GRED_VQ_FLAGS]
      [TCA_GRED_VQ_STAT_*]
    [TCA_GRED_VQ_ENTRY]
       ...

Statistics are dump only. Patch 4 switches the byte counts to be 64 bit,
and patch 5 introduces the new stats attributes for dump.  Patch 6
switches RED flags to be per-virtual queue, and patch 7 allows them
to be dumped and set at virtual queue granularity.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: sched: gred: allow manipulating per-DP RED flags
Jakub Kicinski [Thu, 15 Nov 2018 06:23:51 +0000 (22:23 -0800)]
net: sched: gred: allow manipulating per-DP RED flags

Allow users to set and dump RED flags (ECN enabled and harddrop)
on per-virtual queue basis.  Validation of attributes is split
from changes to make sure we won't have to undo previous operations
when we find out configuration is invalid.

The objective is to allow changing per-Qdisc parameters without
overwriting the per-vq configured flags.

Old user space will not pass the TCA_GRED_VQ_FLAGS attribute and
per-Qdisc flags will always get propagated to the virtual queues.

New user space which wants to make use of per-vq flags should set
per-Qdisc flags to 0 and then configure per-vq flags as it
sees fit.  Once per-vq flags are set per-Qdisc flags can't be
changed to non-zero.  Vice versa - if the per-Qdisc flags are
non-zero the TCA_GRED_VQ_FLAGS attribute has to either be omitted
or set to the same value as per-Qdisc flags.

Update per-Qdisc parameters:
per-Qdisc | per-VQ | result
        0 |      0 | all vq flags updated
0 |  non-0 | error (vq flags in use)
    non-0 |      0 | -- impossible --
    non-0 |  non-0 | all vq flags updated

Update per-VQ state (flags parameter not specified):
   no change to flags

Update per-VQ state (flags parameter set):
per-Qdisc | per-VQ | result
        0 |   any  | per-vq flags updated
    non-0 |      0 | -- impossible --
    non-0 |  non-0 | error (per-Qdisc flags in use)

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: John Hurley <john.hurley@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: sched: gred: store red flags per virtual queue
Jakub Kicinski [Thu, 15 Nov 2018 06:23:50 +0000 (22:23 -0800)]
net: sched: gred: store red flags per virtual queue

Right now ECN marking and HARD drop (the common RED flags) can only
be configured for the entire Qdisc.  In preparation for per-vq flags
store the values in the virtual queue structure.  Setting per-vq
flags will only be allowed when no flags are set for the entire Qdisc.
For the new flags we will also make sure undefined bits are 0.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: John Hurley <john.hurley@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: sched: gred: provide a better structured dump and expose stats
Jakub Kicinski [Thu, 15 Nov 2018 06:23:49 +0000 (22:23 -0800)]
net: sched: gred: provide a better structured dump and expose stats

Currently all GRED's virtual queue data is dumped in a single
array in a single attribute.  This makes it pretty much impossible
to add new fields.  In order to expose more detailed stats add a
new set of attributes.  We can now expose the 64 bit value of bytesin
and all the mark stats which were not part of the original design.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: John Hurley <john.hurley@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: sched: gred: store bytesin as a 64 bit value
Jakub Kicinski [Thu, 15 Nov 2018 06:23:48 +0000 (22:23 -0800)]
net: sched: gred: store bytesin as a 64 bit value

32 bit counters for bytes are not really going to last long in modern
world.  Make sch_gred count bytes on a 64 bit counter.  It will still
get truncated during dump but follow up patch will add set of new
stat dump attributes.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: John Hurley <john.hurley@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: sched: gred: use extack to provide more details on configuration errors
Jakub Kicinski [Thu, 15 Nov 2018 06:23:47 +0000 (22:23 -0800)]
net: sched: gred: use extack to provide more details on configuration errors

Add extack messages to -EINVAL errors, to help users identify
their mistakes.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: John Hurley <john.hurley@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: sched: gred: pass extack to nla_parse_nested()
Jakub Kicinski [Thu, 15 Nov 2018 06:23:46 +0000 (22:23 -0800)]
net: sched: gred: pass extack to nla_parse_nested()

In case netlink wants to provide parsing error pass extack
to nla_parse_nested().

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: John Hurley <john.hurley@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: sched: gred: separate error and non-error path in gred_change()
Jakub Kicinski [Thu, 15 Nov 2018 06:23:45 +0000 (22:23 -0800)]
net: sched: gred: separate error and non-error path in gred_change()

We will soon want to add more code to the non-error path, separate
it from the error handling flow.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: John Hurley <john.hurley@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoselftests: add explicit test for multiple concurrent GRO sockets
Paolo Abeni [Thu, 15 Nov 2018 02:24:05 +0000 (03:24 +0100)]
selftests: add explicit test for multiple concurrent GRO sockets

This covers for proper accounting of encap needed static keys

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoisdn/hisax: remove set but not used variable 'total'
YueHaibing [Thu, 15 Nov 2018 02:23:03 +0000 (10:23 +0800)]
isdn/hisax: remove set but not used variable 'total'

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

drivers/isdn/hisax/hfc_pci.c:277:6: warning:
 variable ‘total’ set but not used [-Wunused-but-set-variable]

It never used since git history start.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoudp: fix jump label misuse
Paolo Abeni [Thu, 15 Nov 2018 01:34:50 +0000 (02:34 +0100)]
udp: fix jump label misuse

The commit 60fb9567bf30 ("udp: implement complete book-keeping for
encap_needed") introduced a severe misuse of jump label APIs, which
syzbot, as reported by Eric, was able to exploit.

When multiple sockets/process can concurrently request (and than
disable) the udp encap, we need to track the activation counter with
*_inc()/*_dec() jump label variants, or we can experience bad things
at disable time.

Fixes: 60fb9567bf30 ("udp: implement complete book-keeping for encap_needed")
Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoetf: Drop all expired packets
Jesus Sanchez-Palencia [Thu, 15 Nov 2018 01:26:35 +0000 (17:26 -0800)]
etf: Drop all expired packets

Currently on dequeue() ETF only drops the first expired packet, which
causes a problem if the next packet is already expired. When this
happens, the watchdog will be configured with a time in the past, fire
straight way and the packet will finally be dropped once the dequeue()
function of the qdisc is called again.

We can save quite a few cycles and improve the overall behavior of the
qdisc if we drop all expired packets if the next packet is expired.
This should allow ETF to recover faster from bad situations. But
packet drops are still a very serious warning that the requirements
imposed on the system aren't reasonable.

This was inspired by how the implementation of hrtimers use the
rb_tree inside the kernel.

Signed-off-by: Jesus Sanchez-Palencia <jesus.s.palencia@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoetf: Split timersortedlist_erase()
Jesus Sanchez-Palencia [Thu, 15 Nov 2018 01:26:34 +0000 (17:26 -0800)]
etf: Split timersortedlist_erase()

This is just a refactor that will simplify the implementation of the
next patch in this series which will drop all expired packets on the
dequeue flow.

Signed-off-by: Jesus Sanchez-Palencia <jesus.s.palencia@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoetf: Use cached rb_root
Jesus Sanchez-Palencia [Thu, 15 Nov 2018 01:26:33 +0000 (17:26 -0800)]
etf: Use cached rb_root

ETF's peek() operation is heavily used so use an rb_root_cached instead
and leverage rb_first_cached() which will run in O(1) instead of
O(log n).

Even if on 'timesortedlist_clear()' we could be using rb_erase(), we
choose to use rb_erase_cached(), because if in the future we allow
runtime changes to ETF parameters, and need to do a '_clear()', this
might cause some hard to debug issues.

Signed-off-by: Jesus Sanchez-Palencia <jesus.s.palencia@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoetf: Cancel timer if there are no pending skbs
Jesus Sanchez-Palencia [Thu, 15 Nov 2018 01:26:32 +0000 (17:26 -0800)]
etf: Cancel timer if there are no pending skbs

There is no point in firing the qdisc watchdog if there are no future
skbs pending in the queue and the watchdog had been set previously.

Signed-off-by: Jesus Sanchez-Palencia <jesus.s.palencia@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agotcp: clean up STATE_TRACE
Yafang Shao [Wed, 14 Nov 2018 14:26:17 +0000 (22:26 +0800)]
tcp: clean up STATE_TRACE

Currently we can use bpf or tcp tracepoint to conveniently trace the tcp
state transition at the run time.
So we don't need to do this stuff at the compile time anymore.

Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'SMSC95xx-driver-updates'
David S. Miller [Sat, 17 Nov 2018 04:16:20 +0000 (20:16 -0800)]
Merge branch 'SMSC95xx-driver-updates'

Ben Dooks says:

====================
SMSC95xx driver updates (round 1)

This is a series of a few driver cleanups and some fixups of the code
for the SMSC95XX driver. There have been a few reviews, and the issues
have been fixed so this should be ready for merging.

I will work on the tx-alignment and the other bits of usbnet changes
and produce at least two more patch series for this later.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agousbnet: smsc95xx: check for csum being in last four bytes
Ben Dooks [Wed, 14 Nov 2018 11:50:22 +0000 (11:50 +0000)]
usbnet: smsc95xx: check for csum being in last four bytes

The manual states that the checksum cannot lie in the last DWORD of the
transmission, so add a basic check for this and fall back to software
checksumming the packet.

This only seems to trigger for ACK packets with no options or data to
return to the other end, and the use of the tx-alignment option makes
it more likely to happen.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agousbnet: smsc95xx: fix memcpy for accessing rx-data
Ben Dooks [Wed, 14 Nov 2018 11:50:21 +0000 (11:50 +0000)]
usbnet: smsc95xx: fix memcpy for accessing rx-data

Change the RX code to use get_unaligned_le32() instead of the combo
of memcpy and cpu_to_le32s(&var).

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agousbnet: smsc95xx: simplify tx_fixup code
Ben Dooks [Wed, 14 Nov 2018 11:50:20 +0000 (11:50 +0000)]
usbnet: smsc95xx: simplify tx_fixup code

The smsc95xx_tx_fixup is doing multiple calls to skb_push() to
put an 8-byte command header onto the packet. It would be easier
to do one skb_push() and then copy the data in once the push is
done.

We also make the code smaller by using proper unaligned puts for
the header. This merges in the CPU to LE32 conversion as well and
makes the whole sequence easier to understand hopefully.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agousbnet: smsc95xx: fix rx packet alignment
Ben Dooks [Wed, 14 Nov 2018 11:50:19 +0000 (11:50 +0000)]
usbnet: smsc95xx: fix rx packet alignment

The smsc95xx driver already takes into account the NET_IP_ALIGN
parameter when setting up the receive packet data, which means
we do not need to worry about aligning the packets in the usbnet
driver.

Adding the EVENT_NO_IP_ALIGN means that the IPv4 header is now
passed to the ip_rcv() routine with the start on an aligned address.

Tested on Raspberry Pi B3.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'dpaa2-eth-add-bql-support'
David S. Miller [Sat, 17 Nov 2018 04:12:31 +0000 (20:12 -0800)]
Merge branch 'dpaa2-eth-add-bql-support'

Ioana Ciocoi Radulescu says:

====================
dpaa2-eth: add bql support

The first two patches make minor tweaks to the driver to
simplify bql implementation. The third patch adds the actual
bql support.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agodpaa2-eth: bql support
Ioana Ciocoi Radulescu [Wed, 14 Nov 2018 11:48:36 +0000 (11:48 +0000)]
dpaa2-eth: bql support

Add support for byte queue limit.

On NAPI poll, we save the total number of Tx confirmed frames/bytes
and register them with bql at the end of the poll function.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agodpaa2-eth: Update callback signature
Ioana Ciocoi Radulescu [Wed, 14 Nov 2018 11:48:35 +0000 (11:48 +0000)]
dpaa2-eth: Update callback signature

Change the frame consume callback signature:
* the entire FQ structure is passed to the callback instead
of just the queue index
* the NAPI structure can be easily obtained from the channel
it is associated to, so we don't need to pass it explicitly

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agodpaa2-eth: Don't use multiple queues per channel
Ioana Ciocoi Radulescu [Wed, 14 Nov 2018 11:48:35 +0000 (11:48 +0000)]
dpaa2-eth: Don't use multiple queues per channel

The DPNI object on which we build a network interface has a
certain number of {Rx, Tx, Tx confirmation} frame queues as
resources. The default hardware setup offers one queue of each
type, as well as one DPCON channel, for each core available
in the system.

There are however cases where the number of queues is greater
than the number of cores or channels. Until now, we configured
and used all the frame queues associated with a DPNI, even if it
meant assigning multiple queues of one type to the same channel.

Update the driver to only use a number of queues equal to the
number of channels, ensuring each channel will contain exactly
one Rx and one Tx confirmation queue.

>From the user viewpoint, this change is completely transparent.
Performance wise there is no impact in most scenarios. In case
the number of queues is larger than and not a multiple of the
number of channels, Rx hash distribution offers now better load
balancing between cores, which can have a positive impact on
overall system performance.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: 8021q: move vlan offload registrations into vlan_core
Jiri Pirko [Tue, 13 Nov 2018 22:22:48 +0000 (23:22 +0100)]
net: 8021q: move vlan offload registrations into vlan_core

Currently, the vlan packet offloads are registered only upon 8021q module
load. However, even without this module loaded, the offloads could be
utilized, for example by openvswitch datapath. As reported by Michael,
that causes 2x to 5x performance improvement, depending on a testcase.

So move the vlan offload registrations into vlan_core and make this
available even without 8021q module loaded.

Reported-by: Michael Shteinbok <michaelsh86@gmail.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Tested-by: Michael Shteinbok <michaelsh86@gmail.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/decnet: add missing indentation
Colin Ian King [Tue, 13 Nov 2018 14:18:17 +0000 (14:18 +0000)]
net/decnet: add missing indentation

There is a missing indentation before the declaration of port. Add
it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: hns3: fix spelling mistake "failded" -> "failed"
Colin Ian King [Tue, 13 Nov 2018 11:50:57 +0000 (11:50 +0000)]
net: hns3: fix spelling mistake "failded" -> "failed"

Trivial fix, the spelling of "failded" is incorrect in dev_err and
dev_warn messages. Fix this.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: remove unused skb_send_sock()
Cong Wang [Tue, 13 Nov 2018 02:05:24 +0000 (18:05 -0800)]
net: remove unused skb_send_sock()

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: check for implementation of both callbacks in phy_drv_supports_irq
Heiner Kallweit [Mon, 12 Nov 2018 20:16:06 +0000 (21:16 +0100)]
net: phy: check for implementation of both callbacks in phy_drv_supports_irq

Now that the icplus driver has been fixed all PHY drivers supporting
interrupts have both callbacks (config_intr and ack_interrupt)
implemented - as it should be. Therefore phy_drv_supports_irq()
can be changed now to check for both callbacks being implemented.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'Remove-VLAN-CFI-overload'
David S. Miller [Sat, 17 Nov 2018 03:25:29 +0000 (19:25 -0800)]
Merge branch 'Remove-VLAN-CFI-overload'

Michał Mirosław says:

====================
Remove VLAN.CFI overload

Fix BPF code/JITs to allow for separate VLAN_PRESENT flag
storage and finally move the flag to separate storage in skbuff.

This is final step to make CLAN.CFI transparent to core Linux
networking stack.

An #ifdef is introduced temporarily to mark fragments masking
VLAN_TAG_PRESENT. This is removed altogether in the final patch.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: remove VLAN_TAG_PRESENT
Michał Mirosław [Sat, 10 Nov 2018 18:58:36 +0000 (19:58 +0100)]
net: remove VLAN_TAG_PRESENT

Replace VLAN_TAG_PRESENT with single bit flag and free up
VLAN.CFI overload. Now VLAN.CFI is visible in networking stack
and can be passed around intact.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/bpf_jit: SPARC: split VLAN_PRESENT bit handling from VLAN_TCI
Michał Mirosław [Sat, 10 Nov 2018 18:58:36 +0000 (19:58 +0100)]
net/bpf_jit: SPARC: split VLAN_PRESENT bit handling from VLAN_TCI

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/bpf_jit: MIPS: split VLAN_PRESENT bit handling from VLAN_TCI
Michał Mirosław [Sat, 10 Nov 2018 18:58:35 +0000 (19:58 +0100)]
net/bpf_jit: MIPS: split VLAN_PRESENT bit handling from VLAN_TCI

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/bpf_jit: PPC: split VLAN_PRESENT bit handling from VLAN_TCI
Michał Mirosław [Sat, 10 Nov 2018 18:58:35 +0000 (19:58 +0100)]
net/bpf_jit: PPC: split VLAN_PRESENT bit handling from VLAN_TCI

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/bpf: split VLAN_PRESENT bit handling from VLAN_TCI
Michał Mirosław [Sat, 10 Nov 2018 18:58:35 +0000 (19:58 +0100)]
net/bpf: split VLAN_PRESENT bit handling from VLAN_TCI

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/skbuff: add macros for VLAN_PRESENT bit
Michał Mirosław [Sat, 10 Nov 2018 18:58:34 +0000 (19:58 +0100)]
net/skbuff: add macros for VLAN_PRESENT bit

Wrap VLAN_PRESENT bit using macro like PKT_TYPE_* and CLONED_*,
as used by BPF code.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge tag 'batadv-next-for-davem-20181114' of git://git.open-mesh.org/linux-merge
David S. Miller [Fri, 16 Nov 2018 00:12:19 +0000 (16:12 -0800)]
Merge tag 'batadv-next-for-davem-20181114' of git://git.open-mesh.org/linux-merge

Simon Wunderlich says:

====================
This feature/cleanup patchset includes the following patches:

 - Bump version strings, by Simon Wunderlich

 - Fixup includes, by Sven Eckelmann (3 patches)

 - Separate BATMAN_ADV_DEBUG from DEBUGFS, by Sven Eckelmann

 - Fixup tracing log documentation, by Sven Eckelmann

 - Use exclusive locks to secure netlink information dump transfers,
   by Sven Eckelmann (8 patches)

 - Move CRC16 dependency, by Sven Eckelmann

 - Enable MCAST by default, by Linus Luessing
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: slightly optimize eth_type_trans
Li RongQing [Tue, 13 Nov 2018 01:34:31 +0000 (09:34 +0800)]
net: slightly optimize eth_type_trans

netperf udp stream shows that eth_type_trans takes certain cpu,
so adjust the mac address check order, and firstly check if it
is device address, and only check if it is multicast address
only if not the device address.

After this change:
To unicast, and skb dst mac is device mac, this is most of time
reduce a comparision
To unicast, and skb dst mac is not device mac, nothing change
To multicast, increase a comparision

Before:
1.03%  [kernel]          [k] eth_type_trans

After:
0.78%  [kernel]          [k] eth_type_trans

Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: remove BUG_ON from __pskb_pull_tail
Li RongQing [Tue, 13 Nov 2018 01:16:52 +0000 (09:16 +0800)]
net: remove BUG_ON from __pskb_pull_tail

if list is NULL pointer, and the following access of list
will trigger panic, which is same as BUG_ON

Signed-off-by: Li RongQing <lirongqing@baidu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next...
David S. Miller [Thu, 15 Nov 2018 23:05:11 +0000 (15:05 -0800)]
Merge branch '40GbE' of git://git./linux/kernel/git/jkirsher/next-queue

Jeff Kirsher says:

====================
40GbE Intel Wired LAN Driver Updates 2018-11-14

This series contains updates to i40e and virtchnl.

Lance Roy updates i40e to use lockdep_assert_held() instead of
spin_is_locked(), since it is better suited to check locking
requirements.

Jan improves the code readability in XDP by adding the use of a local
variable.  Provides protection on methods that create/modify/destroy
VF's via locking mechanism to prevent unstable behaviour and potential
kernel panics.

Krzysztof adds a hardware capability flag to indicate whether firmware
supports stopping the LLDP agent.

Patryk replaces the use of strncpy() with strlcpy() to ensure the buffer
is NULL terminated.

Mitch fixes the issue of trying to start nway on devices that do not
support auto-negotiation, by checking the autoneg state before
attempting to restart nway.

Alice updates virtchnl to keep the checks all together for ease of
readability and consistency.  Also fixed a "off by one" error in the
number of traffic classes being calculated.

Richard fixed VF port VLANs, where the priority bits were incorrectly
set because the incorrect shift and mask bits were being used.

Alan adds a bit to set and check if a timeout recovery is already
pending to prevent overlapping transmit timeout recovery.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agotest_objagg: Fix warning.
David S. Miller [Thu, 15 Nov 2018 22:57:09 +0000 (14:57 -0800)]
test_objagg: Fix warning.

lib/test_objagg.c: In function ‘test_delta_action_item’:
./include/linux/printk.h:308:2: warning: ‘errmsg’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'mlxsw-ERP-sharing-multiple-masks'
David S. Miller [Thu, 15 Nov 2018 22:43:44 +0000 (14:43 -0800)]
Merge branch 'mlxsw-ERP-sharing-multiple-masks'

Ido Schimmel says:

====================
mlxsw: spectrum: acl: Introduce ERP sharing by multiple masks

Jiri says:

The Spectrum-2 hardware has limitation number of ERPs per-region. In
order to accommodate more masks than number of ERPs, the hardware
supports to insert rules with delta bits. By that, the rules with masks
that differ in up-to 8 consecutive bits can share the same ERP.

Patches 1 and 2 fix couple of issues that would appear in existing
selftests after adding delta support

Patch 3 introduces a generic object aggregation library. Now it is
static, but it will get extended for recalculation of aggregations in
the future in order to reach more optimal aggregation.

Patch 4 just simply converts existing ERP code to use the objagg library
instead of a rhashtable.

Patches 5-9 do more or less small changes to prepare ground for the last
patch.

Patch 10 fills-up delta callbacks of objagg library and utilizes the
delta bits for rule insertion.

The last patch adds selftest to test the mlxsw Spectrum-2 delta flows.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoselftests: mlxsw: spectrum-2: Add simple delta test
Jiri Pirko [Wed, 14 Nov 2018 08:22:36 +0000 (08:22 +0000)]
selftests: mlxsw: spectrum-2: Add simple delta test

Track the basic codepaths of delta handling, using objagg tracepoints.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomlxsw: spectrum: acl: Implement delta for ERP
Jiri Pirko [Wed, 14 Nov 2018 08:22:35 +0000 (08:22 +0000)]
mlxsw: spectrum: acl: Implement delta for ERP

Allow ERP sharing for multiple mask. Do it by properly implementing
delta_create() objagg object. Use the computed delta info for inserting
rules in A-TCAM.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomlxsw: spectrum: acl: Push code related to num_ctcam_erps inc/dec into separate helpers
Jiri Pirko [Wed, 14 Nov 2018 08:22:34 +0000 (08:22 +0000)]
mlxsw: spectrum: acl: Push code related to num_ctcam_erps inc/dec into separate helpers

Later on the same code is going to be needed for deltas as well. So push
the procedures related to increment and decrement of num_ctcam_erps
into a separate helpers.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomlxsw: spectrum: acl: Remove mlxsw_afk_encode() block range args and key/mask check
Jiri Pirko [Wed, 14 Nov 2018 08:22:33 +0000 (08:22 +0000)]
mlxsw: spectrum: acl: Remove mlxsw_afk_encode() block range args and key/mask check

Since two remaining users of mlxsw_afk_encode() do not specify
block ranges to work on, remove the args. Also, key/mask is always
non-NULL now, so skip the checks.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomlxsw: spectrum: acl: Don't encode the key again in mlxsw_sp_acl_atcam_12kb_lkey_id_get()
Jiri Pirko [Wed, 14 Nov 2018 08:22:32 +0000 (08:22 +0000)]
mlxsw: spectrum: acl: Don't encode the key again in mlxsw_sp_acl_atcam_12kb_lkey_id_get()

No need to do key encoding again in
mlxsw_sp_acl_atcam_12kb_lkey_id_get(). Instead of that, introduce
a new helper that would just clear unused blocks.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomlxsw: core_acl: Change order of args of ops->encode_block()
Jiri Pirko [Wed, 14 Nov 2018 08:22:31 +0000 (08:22 +0000)]
mlxsw: core_acl: Change order of args of ops->encode_block()

Change order so it is aligned with the usual case where the "write_to"
buffer comes as the first arg.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomlxsw: spectrum: acl: Pass key pointer to master_mask_set/clear
Jiri Pirko [Wed, 14 Nov 2018 08:22:30 +0000 (08:22 +0000)]
mlxsw: spectrum: acl: Pass key pointer to master_mask_set/clear

The device requires that the master mask of each region will be
composed from a logical OR between all the unmasked bits in the region.
Currently, this is just a logical OR between all the eRPs used in the
region, but the next patch is going to introduce delta bits support
which need to be taken into account as well.

Since the eRP does not include the delta bits, pass the key pointer to
mlxsw_sp_acl_erp_master_mask_set/clear instead. Convert key->mask to
the bitmap on fly.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomlxsw: spectrum: acl_erp: Convert to use objagg for tracking ERPs
Jiri Pirko [Wed, 14 Nov 2018 08:22:29 +0000 (08:22 +0000)]
mlxsw: spectrum: acl_erp: Convert to use objagg for tracking ERPs

Currently the ERPs are tracked internally in a hashtable. Benefit from
the newly introduced objagg library and use it to track ERPs. At this
point, there is no nesting of objects done, as the delta_create callback
always returns -EOPNOTSUPP. On the way, add "mask" into ERP mask get and
set functions and struct names.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agolib: introduce initial implementation of object aggregation manager
Jiri Pirko [Wed, 14 Nov 2018 08:22:28 +0000 (08:22 +0000)]
lib: introduce initial implementation of object aggregation manager

This lib tracks objects which could be of two types:
1) root object
2) nested object - with a "delta" which differentiates it from
                   the associated root object
The objects are tracked by a hashtable and reference-counted. User is
responsible of implementing callbacks to create/destroy root entity
related to each root object and callback to create/destroy nested object
delta.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoselftests: Adjust spectrum-2 ctcam_two_atcam_masks_test
Jiri Pirko [Wed, 14 Nov 2018 08:22:27 +0000 (08:22 +0000)]
selftests: Adjust spectrum-2 ctcam_two_atcam_masks_test

In order for this to behave as required with delta bits, change the mask
for rule with handle 103.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoselftests: Adjust spectrum-2 two_mask_test
Jiri Pirko [Wed, 14 Nov 2018 08:22:26 +0000 (08:22 +0000)]
selftests: Adjust spectrum-2 two_mask_test

In order for this to behave as required with delta bits, change the mask
for rule with handle 103.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: get rid of __tcp_checksum_complete()
Cong Wang [Tue, 13 Nov 2018 00:17:00 +0000 (16:17 -0800)]
net: get rid of __tcp_checksum_complete()

__tcp_checksum_complete() is 100% same with __skb_checksum_complete()
and there is no other caller except tcp_checksum_complete().
So, just use __skb_checksum_complete() there.

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: sched: cls_flower: Classify packets using port ranges
Amritha Nambiar [Tue, 13 Nov 2018 00:15:55 +0000 (16:15 -0800)]
net: sched: cls_flower: Classify packets using port ranges

Added support in tc flower for filtering based on port ranges.

Example:
1. Match on a port range:
-------------------------
$ tc filter add dev enp4s0 protocol ip parent ffff:\
  prio 1 flower ip_proto tcp dst_port range 20-30 skip_hw\
  action drop

$ tc -s filter show dev enp4s0 parent ffff:
filter protocol ip pref 1 flower chain 0
filter protocol ip pref 1 flower chain 0 handle 0x1
  eth_type ipv4
  ip_proto tcp
  dst_port range 20-30
  skip_hw
  not_in_hw
        action order 1: gact action drop
         random type none pass val 0
         index 1 ref 1 bind 1 installed 85 sec used 3 sec
        Action statistics:
        Sent 460 bytes 10 pkt (dropped 10, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0

2. Match on IP address and port range:
--------------------------------------
$ tc filter add dev enp4s0 protocol ip parent ffff:\
  prio 1 flower dst_ip 192.168.1.1 ip_proto tcp dst_port range 100-200\
  skip_hw action drop

$ tc -s filter show dev enp4s0 parent ffff:
filter protocol ip pref 1 flower chain 0 handle 0x2
  eth_type ipv4
  ip_proto tcp
  dst_ip 192.168.1.1
  dst_port range 100-200
  skip_hw
  not_in_hw
        action order 1: gact action drop
         random type none pass val 0
         index 2 ref 1 bind 1 installed 58 sec used 2 sec
        Action statistics:
        Sent 920 bytes 20 pkt (dropped 20, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0

v4:
1. Added condition before setting port key.
2. Organized setting and dumping port range keys into functions
   and added validation of input range.

v3:
1. Moved new fields in UAPI enum to the end of enum.
2. Removed couple of empty lines.

v2:
Addressed Jiri's comments:
1. Added separate functions for dst and src comparisons.
2. Removed endpoint enum.
3. Added new bit TCA_FLOWER_FLAGS_RANGE to decide normal/range
  lookup.
4. Cleaned up fl_lookup function.

Signed-off-by: Amritha Nambiar <amritha.nambiar@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: dump more useful information in netdev_rx_csum_fault()
Cong Wang [Mon, 12 Nov 2018 22:47:18 +0000 (14:47 -0800)]
net: dump more useful information in netdev_rx_csum_fault()

Currently netdev_rx_csum_fault() only shows a device name,
we need more information about the skb for debugging csum
failures.

Sample output:

 ens3: hw csum failure
 dev features: 0x0000000000014b89
 skb len=84 data_len=0 pkt_type=0 gso_size=0 gso_type=0 nr_frags=0 ip_summed=0 csum=0 csum_complete_sw=0 csum_valid=0 csum_level=0

Note, I use pr_err() just to be consistent with the existing one.

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: dsa: mv88e6xxx: Work around mv886e6161 SERDES missing MII_PHYSID2
Andrew Lunn [Mon, 12 Nov 2018 17:51:01 +0000 (18:51 +0100)]
net: dsa: mv88e6xxx: Work around mv886e6161 SERDES missing MII_PHYSID2

We already have a workaround for a couple of switches whose internal
PHYs only have the Marvel OUI, but no model number. We detect such
PHYs and give them the 6390 ID as the model number. However the
mv88e6161 has two SERDES interfaces in the same address range as its
internal PHYs. These suffer from the same problem, the Marvell OUI,
but no model number. As a result, these SERDES interfaces were getting
the same PHY ID as the mv88e6390, even though they are not PHYs, and
the Marvell PHY driver was trying to drive them.

Add a special case to stop this from happen.

Reported-by: Chris Healy <Chris.Healy@zii.aero>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next...
David S. Miller [Thu, 15 Nov 2018 19:23:30 +0000 (11:23 -0800)]
Merge branch '100GbE' of git://git./linux/kernel/git/jkirsher/next-queue

Jeff Kirsher says:

====================
100GbE Intel Wired LAN Driver Updates 2018-11-13

This series contains updates to the ice driver only.

Brett cleans up debug print messages by removing useless or duplicate
messages, and make sure we assign the hardware head pointer to head
instead of the software head pointer.  Resolved an issue when disabling
SRIOV we were trying to stop queues multiple times, so make sure we
disable SRIOV before stopping transmit and receive queues for VF.

Tony fixes a potential NULL pointer dereference during a VF reset.

Anirudh resolves an issue where we were releasing the VSI before
removing the VSI scheduler node, which was resulting in an error "Failed
to set LAN Tx queue context, error: -1".  Also fixed the guaranteed
number of VSIs available and used by discovering the device
capabilities to determine the 'guar_num_vsi' per function, rather than
always using the theoretical max number of VSIs every time.

Dave avoids a deadlock by nesting RTNL locking, so added a boolean to
determine if the RTNL lock is already held.

Lev fixes bad mask values which would break compilation.

Piotr increases the receive queue disable timeout since it can take
additional time to finish all pending queue requests.

Usha resolves an issue of VLAN priority tagged traffic not appearing on
all traffic classes, which was causing ETS bandwidth shaping to not work
as expected.

Henry fixes the reset path to cleanup the old scheduler tree before
rebuilding it.

Md Fahad removes a unnecessary check which was causing a driver load
error on platforms with more than 128 cores.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'hns3-hwgro'
David S. Miller [Thu, 15 Nov 2018 17:44:46 +0000 (09:44 -0800)]
Merge branch 'hns3-hwgro'

Salil Mehta says:

====================
net: hns3: Add support of hardware GRO to HNS3 Driver

This patch-set adds support of hardware assisted GRO feature to
HNS3 driver on Rev B(=0x21) platform. Current hardware only
supports TCP/IPv{4|6} flows.

Change Log:
V1->V2:
1. Remove redundant print reported by Leon Romanovsky.
Link: https://lkml.org/lkml/2018/11/13/715
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: hns3: Adds GRO params to SKB for the stack
Peng Li [Thu, 15 Nov 2018 09:29:25 +0000 (09:29 +0000)]
net: hns3: Adds GRO params to SKB for the stack

When HW GRO enable, protocol stack will not do GRO again,
driver should add gro param to the skb for the protocol
stack..

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 agonet: hns3: Add skb chain when num of RX buf exceeds MAX_SKB_FRAGS
Peng Li [Thu, 15 Nov 2018 09:29:24 +0000 (09:29 +0000)]
net: hns3: Add skb chain when num of RX buf exceeds MAX_SKB_FRAGS

MAX_SKB_FRAGS in protocol stack is defined as:

MAX_SKB_FRAGS is 17 when PAGE_SIZE is 4K. If HW enable GRO, it may
merge small packets and the rx buffer may be more than
MAX_SKB_FRAGS. So driver will add skb chain when RX buffer num.
more than MAX_SKB_FRAGS.

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 agonet: hns3: Add support for ethtool -K to enable/disable HW GRO
Peng Li [Thu, 15 Nov 2018 09:29:23 +0000 (09:29 +0000)]
net: hns3: Add support for ethtool -K to enable/disable HW GRO

This patch adds support of ethtool -K to enable/disable
hardware GRO in HNS3 PF/VF driver.

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 agonet: hns3: Add handling of GRO Pkts not fully RX'ed in NAPI poll
Peng Li [Thu, 15 Nov 2018 09:29:22 +0000 (09:29 +0000)]
net: hns3: Add handling of GRO Pkts not fully RX'ed in NAPI poll

The "FE bit" in the description means the last description for
a packets. When HW GRO enable, HW write data to ring every
packet/buffer, there is greater probability that driver handle
with the describtion but HW still not set the "FE bit".

When drier handle the packet and HW still not set "FE bit",
driver stores skb and bd_num in rx ring, and continue to use the
skb and bd_num in next napi.

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>