]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/log
mirror_ubuntu-hirsute-kernel.git
6 years agonet: ethernet: Add helper to remove a supported link mode
Andrew Lunn [Tue, 11 Sep 2018 23:53:14 +0000 (01:53 +0200)]
net: ethernet: Add helper to remove a supported link mode

Some MAC hardware cannot support a subset of link modes. e.g. often
1Gbps Full duplex is supported, but Half duplex is not. Add a helper
to remove such a link mode.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: ethernet: Fix up drivers masking pause support
Andrew Lunn [Tue, 11 Sep 2018 23:53:13 +0000 (01:53 +0200)]
net: ethernet: Fix up drivers masking pause support

PHY drivers don't indicate they support pause. They expect MAC drivers
to enable its support if the MAC has the needed hardware. Thus MAC
drivers should not mask Pause support, but enable it.

Change a few ANDs to ORs.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: bcmgenet: Fix speed selection for reverse MII
Andrew Lunn [Tue, 11 Sep 2018 23:53:12 +0000 (01:53 +0200)]
net: bcmgenet: Fix speed selection for reverse MII

The phy supported speed is being used to determine if the MAC should
be configured to 100 or 1G. The masking logic is broken. Instead, look
at 1G supported speeds to enable 1G MAC support.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: ethernet: Use phy_set_max_speed() to limit advertised speed
Andrew Lunn [Tue, 11 Sep 2018 23:53:11 +0000 (01:53 +0200)]
net: ethernet: Use phy_set_max_speed() to limit advertised speed

Many Ethernet MAC drivers want to limit the PHY to only advertise a
maximum speed of 100Mbs or 1Gbps. Rather than using a mask, make use
of the helper function phy_set_max_speed().

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: phy: bcm63xx: Allow to be built with COMPILE_TEST
Andrew Lunn [Tue, 11 Sep 2018 23:53:10 +0000 (01:53 +0200)]
net: phy: bcm63xx: Allow to be built with COMPILE_TEST

There is nothing in this driver which prevents it to be compiled for
other architectures. Add COMPILE_TEST so we get better compile test
coverage.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: phy: et1011c: Remove incorrect missing 1000 Half
Andrew Lunn [Tue, 11 Sep 2018 23:53:09 +0000 (01:53 +0200)]
net: phy: et1011c: Remove incorrect missing 1000 Half

The driver indicates it can do 10/100 full and half duplex, plus 1G
Full. The datasheet indicates 1G half is also supported. So make use
of the standard PHY_GBIT_FEATURES.

It could be, this was added because there is a MAC which does not
support 1G half. Bit this is the wrong place to enforce this.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: phy: ste10Xp: Remove wrong SUPPORTED_Pause
Andrew Lunn [Tue, 11 Sep 2018 23:53:08 +0000 (01:53 +0200)]
net: phy: ste10Xp: Remove wrong SUPPORTED_Pause

The PHY driver should not indicate that Pause is supported. It is upto
the MAC drive enable it, if it supports Pause frames. So remove it
from the ste10Xp driver.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonfp: report FW vNIC stats in interface stats
Jakub Kicinski [Tue, 11 Sep 2018 13:44:08 +0000 (06:44 -0700)]
nfp: report FW vNIC stats in interface stats

Report in standard netdev stats drops and errors as well as
RX multicast from the FW vNIC counters.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonetlink: remove hash::nelems check in netlink_insert
Li RongQing [Tue, 11 Sep 2018 01:05:01 +0000 (09:05 +0800)]
netlink: remove hash::nelems check in netlink_insert

The type of hash::nelems has been changed from size_t to atom_t
which in fact is int, so not need to check if BITS_PER_LONG, that
is bit number of size_t, is bigger than 32

and rht_grow_above_max() will be called to check if hashtable is
too big, ensure it can not bigger than 1<<31

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>
6 years agoscsi: libcxgbi: fib6_ino reference in rt6_info is rcu protected
David Ahern [Tue, 11 Sep 2018 00:21:42 +0000 (17:21 -0700)]
scsi: libcxgbi: fib6_ino reference in rt6_info is rcu protected

The fib6_info reference in rt6_info is rcu protected. Add a helper
to extract prefsrc from and update cxgbi_check_route6 to use it.

Fixes: 0153167aebd0 ("net/ipv6: Remove rt6i_prefsrc")
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: b53: Only call b53_port_event() for SGMII ports
Florian Fainelli [Mon, 10 Sep 2018 23:47:07 +0000 (16:47 -0700)]
net: dsa: b53: Only call b53_port_event() for SGMII ports

Built-in PHY ports are still being polled, avoid generating spurious
and duplicate events which the PHY library resolves through polling
anyways.

Fixes: 0e01491de646 ("net: dsa: b53: Add SerDes support")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet/tls: Fixed return value when tls_complete_pending_work() fails
Vakul Garg [Mon, 10 Sep 2018 17:23:46 +0000 (22:53 +0530)]
net/tls: Fixed return value when tls_complete_pending_work() fails

In tls_sw_sendmsg() and tls_sw_sendpage(), the variable 'ret' has
been set to return value of tls_complete_pending_work(). This allows
return of proper error code if tls_complete_pending_work() fails.

Fixes: 3c4d7559159b ("tls: kernel TLS support")
Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'aquantia-implement-WOL-and-EEE-support'
David S. Miller [Wed, 12 Sep 2018 06:41:03 +0000 (23:41 -0700)]
Merge branch 'aquantia-implement-WOL-and-EEE-support'

Igor Russkikh says:

====================
net: aquantia: implement WOL and EEE support

This is v3 of WOL/EEE functionality patch for atlantic driver.

In this patchset Yana Esina and Nikita Danilov implemented:

- Upload function to interact with FW memory
- Definitions and structures necessary for the correct operation of Wake ON Lan
- The functionality Wake On Lan via ethtool (Magic packet is supported)
- The functionality for Energy-Efficient Ethernet configuration via ethtool

Version 3:
- use ETH_ALEN instead of raw number

Version 2 has the following fixes:
- patchset reorganized to extract renaming and whitespace fixes into separate
  patches
- some of magic numbers replaced with defines
- reverse christmas tree applied
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: aquantia: bump driver version
Igor Russkikh [Mon, 10 Sep 2018 09:39:34 +0000 (12:39 +0300)]
net: aquantia: bump driver version

Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: aquantia: renaming for better visibility
Nikita Danilov [Mon, 10 Sep 2018 09:39:33 +0000 (12:39 +0300)]
net: aquantia: renaming for better visibility

Removed extra characters from the names of structures to unify prefixes
used through the driver code (we normally use hw_atl for hw specifics).
HW_ATL_B0_ and HW_ATL_A0_ are the same and useless copies.

Signed-off-by: Nikita Danilov <nikita.danilov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: aquantia: whitespace changes
Nikita Danilov [Mon, 10 Sep 2018 09:39:32 +0000 (12:39 +0300)]
net: aquantia: whitespace changes

Removed extra spaces, corrected alignment.

Signed-off-by: Nikita Danilov <nikita.danilov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: aquantia: implement EEE support
Yana Esina [Mon, 10 Sep 2018 09:39:31 +0000 (12:39 +0300)]
net: aquantia: implement EEE support

Support of Energy-Efficient Ethernet to aQuantia NIC's via ethtool
(according to the IEEE 802.3az specifications)

Signed-off-by: Yana Esina <yana.esina@aquantia.com>
Signed-off-by: Nikita Danilov <nikita.danilov@aquantia.com>
Tested-by: Nikita Danilov <nikita.danilov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: aquantia: implement WOL support
Yana Esina [Mon, 10 Sep 2018 09:39:30 +0000 (12:39 +0300)]
net: aquantia: implement WOL support

Add WOL support. Currently only magic packet
(ethtool -s <ethX> wol g) feature is implemented.

Remove hw_set_power and move that to FW_OPS set_power:
because WOL configuration behaves differently on 1x and 2x
firmwares

Signed-off-by: Yana Esina <yana.esina@aquantia.com>
Signed-off-by: Nikita Danilov <nikita.danilov@aquantia.com>
Tested-by: Nikita Danilov <nikita.danilov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: aquantia: definitions for WOL
Yana Esina [Mon, 10 Sep 2018 09:39:29 +0000 (12:39 +0300)]
net: aquantia: definitions for WOL

Added definitions and structures needed to support WOL.

Signed-off-by: Yana Esina <yana.esina@aquantia.com>
Signed-off-by: Nikita Danilov <nikita.danilov@aquantia.com>
Tested-by: Nikita Danilov <nikita.danilov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: aquantia: fix hw_atl_utils_fw_upload_dwords
Yana Esina [Mon, 10 Sep 2018 09:39:28 +0000 (12:39 +0300)]
net: aquantia: fix hw_atl_utils_fw_upload_dwords

This patch fixes the upload function, which worked incorrectly with
some chips.

Signed-off-by: Yana Esina <yana.esina@aquantia.com>
Signed-off-by: Nikita Danilov <nikita.danilov@aquantia.com>
Tested-by: Nikita Danilov <nikita.danilov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'liquidio-Removed-droq-lock-from-Rx-path'
David S. Miller [Wed, 12 Sep 2018 06:37:06 +0000 (23:37 -0700)]
Merge branch 'liquidio-Removed-droq-lock-from-Rx-path'

Intiyaz Basha says:

====================
liquidio: Removed droq lock from Rx path

Series of patches for removing droq lock from Rx Path.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoliquidio: Removed droq lock
Intiyaz Basha [Mon, 10 Sep 2018 06:34:26 +0000 (23:34 -0700)]
liquidio: Removed droq lock

With the changes in patch 1 and 2, droq lock is not required.
So removing droq lock.

Signed-off-by: Intiyaz Basha <intiyaz.basha@cavium.com>
Acked-by: Derek Chickles <derek.chickles@cavium.com>
Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoliquidio: Per queue oom work queue
Intiyaz Basha [Mon, 10 Sep 2018 06:34:21 +0000 (23:34 -0700)]
liquidio: Per queue oom work queue

Removed oom task unconditional rescheduling every 250ms and created per
queue oom work queue for refilling buffers.

The oom task refills only if the available descriptors is fallen to 64.
There will be no packets coming in after hitting this level. So NAPI will
not run until oom task refills the buffers.

Signed-off-by: Intiyaz Basha <intiyaz.basha@cavium.com>
Acked-by: Derek Chickles <derek.chickles@cavium.com>
Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoliquidio: Disabling tasklet when NAPI is active
Intiyaz Basha [Mon, 10 Sep 2018 06:34:16 +0000 (23:34 -0700)]
liquidio: Disabling tasklet when NAPI is active

Control packets are processed in tasklet when interface is down and in
NAPI when interface is up. So tasklet can be disabled when interface up
and re-enabled when interface is down.

Signed-off-by: Intiyaz Basha <intiyaz.basha@cavium.com>
Acked-by: Derek Chickles <derek.chickles@cavium.com>
Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoxen-netback: remove unecessary condition check before debugfs_remove_recursive
zhong jiang [Sat, 8 Sep 2018 13:53:42 +0000 (21:53 +0800)]
xen-netback: remove unecessary condition check before debugfs_remove_recursive

debugfs_remove_recursive has taken IS_ERR_OR_NULL into account. So just
remove the condition check before debugfs_remove_recursive.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: xenbus: remove redundant condition check before debugfs_remove_recursive
zhong jiang [Sat, 8 Sep 2018 13:35:06 +0000 (21:35 +0800)]
net: xenbus: remove redundant condition check before debugfs_remove_recursive

debugfs_remove_recursive has taken the IS_ERR_OR_NULL into account. Just
remove the unnecessary condition check.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: b53: Uninitialized variable in b53_adjust_link()
Dan Carpenter [Sat, 8 Sep 2018 08:39:25 +0000 (11:39 +0300)]
net: dsa: b53: Uninitialized variable in b53_adjust_link()

The "pause" variable is only initialized on BCM5301x.

Fixes: 5e004460f874 ("net: dsa: b53: Add helper to set link parameters")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agohtb: use anonymous union for simplicity
Cong Wang [Fri, 7 Sep 2018 20:29:14 +0000 (13:29 -0700)]
htb: use anonymous union for simplicity

cl->leaf.q is slightly more readable than cl->un.leaf.q.

Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet_sched: remove redundant qdisc lock classes
Cong Wang [Fri, 7 Sep 2018 20:29:13 +0000 (13:29 -0700)]
net_sched: remove redundant qdisc lock classes

We no longer take any spinlock on RX path for ingress qdisc,
so this lockdep annotation is no longer needed.

Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: sched: cls_flower: dump offload count value
Vlad Buslov [Fri, 7 Sep 2018 14:22:21 +0000 (17:22 +0300)]
net: sched: cls_flower: dump offload count value

Change flower in_hw_count type to fixed-size u32 and dump it as
TCA_FLOWER_IN_HW_COUNT. This change is necessary to properly test shared
blocks and re-offload functionality.

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'skb_list_cleanups'
David S. Miller [Mon, 10 Sep 2018 17:07:01 +0000 (10:07 -0700)]
Merge branch 'skb_list_cleanups'

David Miller says:

====================
SKB list handling cleanups

This is a preparatory patch series which cleans up various forms of
sloppy SKB list handling, and makes certain semantics explicit.

We are trying to eliminate code that directly accesses the SKB
list and SKB queue head next/prev members in any way.  It is
impossible to convert SKB queue head over the struct list_head
while such code exists.

This patch series does not eliminate all such code, only the simplest
cases.  A latter series will tackle the complicated ones.

A helper is added to make the "skb->next == NULL means not on a list"
rule explicit, and another is added to combine this with list_del().
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agortl818x: Remove SKB list assumptions.
David S. Miller [Wed, 22 Aug 2018 23:50:17 +0000 (16:50 -0700)]
rtl818x: Remove SKB list assumptions.

Eliminate the assumption that SKBs and SKB list heads can
be cast to eachother in SKB list handling code.

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agocan: Remove SKB list assumptions in rx-offload.c
David S. Miller [Wed, 22 Aug 2018 23:43:34 +0000 (16:43 -0700)]
can: Remove SKB list assumptions in rx-offload.c

Eliminate code which assumes that SKBs and skb_queue_head objects
can be cast to eachother during list processing.

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: Add and use skb_list_del_init().
David S. Miller [Tue, 31 Jul 2018 22:27:56 +0000 (15:27 -0700)]
net: Add and use skb_list_del_init().

It documents what is happening, and eliminates the spurious list
pointer poisoning.

In the long term, in order to get proper list head debugging, we
might want to use the list poison value as the indicator that
an SKB is a singleton and not on a list.

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: Add and use skb_mark_not_on_list().
David S. Miller [Mon, 30 Jul 2018 03:42:53 +0000 (20:42 -0700)]
net: Add and use skb_mark_not_on_list().

An SKB is not on a list if skb->next is NULL.

Codify this convention into a helper function and use it
where we are dequeueing an SKB and need to mark it as such.

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agobrcmfmac: Use __skb_peek().
David S. Miller [Sun, 12 Aug 2018 04:19:19 +0000 (21:19 -0700)]
brcmfmac: Use __skb_peek().

Instead of direct SKB list pointer accesses.

In these situations, we absolutely know that the SKB queue in question
is non-empty.

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agostaging: rtl8192e: Use __skb_peek().
David S. Miller [Wed, 8 Aug 2018 06:45:01 +0000 (23:45 -0700)]
staging: rtl8192e: Use __skb_peek().

Instead of direct list head pointer accesses.

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agobnx2fc_fcoe: Use skb_queue_walk_safe().
David S. Miller [Wed, 8 Aug 2018 06:43:51 +0000 (23:43 -0700)]
bnx2fc_fcoe: Use skb_queue_walk_safe().

Instead of direct list pointer accesses.

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agop54: Use skb_peek_tail() instead of direct head pointer accesses.
David S. Miller [Wed, 8 Aug 2018 06:42:03 +0000 (23:42 -0700)]
p54: Use skb_peek_tail() instead of direct head pointer accesses.

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agosctp: Use skb_queue_is_first().
David S. Miller [Tue, 7 Aug 2018 06:25:13 +0000 (23:25 -0700)]
sctp: Use skb_queue_is_first().

Instead of direct skb_queue_head pointer accesses.

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agolan78xx: Do not access skb_queue_head list pointers directly.
David S. Miller [Tue, 7 Aug 2018 06:12:17 +0000 (23:12 -0700)]
lan78xx: Do not access skb_queue_head list pointers directly.

Use skb_queue_walk() instead.

Adjust inner loop test to utilize and skb_queue_is_first().
Unfortunately we have to keep pkt_cnt around because it is
used by a latter loop in this function.

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agomac80211: Don't access sk_queue_head->next directly.
David S. Miller [Tue, 7 Aug 2018 05:49:13 +0000 (22:49 -0700)]
mac80211: Don't access sk_queue_head->next directly.

Use __skb_peek() instead.

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoppp: Remove direct skb_queue_head list pointer access.
David S. Miller [Sun, 12 Aug 2018 01:43:38 +0000 (18:43 -0700)]
ppp: Remove direct skb_queue_head list pointer access.

Add a helper, __skb_peek(), and use it in ppp_mp_reconstruct().

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoinfiniband: nes: Use skb_peek_next() and skb_queue_walk().
David S. Miller [Sun, 5 Aug 2018 19:57:30 +0000 (12:57 -0700)]
infiniband: nes: Use skb_peek_next() and skb_queue_walk().

Instead of direct SKB list accesses.

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agosch_netem: Move private queue handler to generic location.
David S. Miller [Sun, 29 Jul 2018 23:33:28 +0000 (16:33 -0700)]
sch_netem: Move private queue handler to generic location.

By hand copies of SKB list handlers do not belong in individual packet
schedulers.

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agosch_htb: Remove local SKB queue handling code.
David S. Miller [Sun, 29 Jul 2018 23:22:13 +0000 (16:22 -0700)]
sch_htb: Remove local SKB queue handling code.

Instead, adjust __qdisc_enqueue_tail() such that HTB can use it
instead.

The only other caller of __qdisc_enqueue_tail() is
qdisc_enqueue_tail() so we can move the backlog and return value
handling (which HTB doesn't need/want) to the latter.

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet/ipv6: Remove rt6i_prefsrc
David Ahern [Mon, 10 Sep 2018 16:11:28 +0000 (09:11 -0700)]
net/ipv6: Remove rt6i_prefsrc

After the conversion to fib6_info, rt6i_prefsrc has a single user that
reads the value and otherwise it is only set. The one reader can be
converted to use rt->from so rt6i_prefsrc can be removed, reducing
rt6_info by another 20 bytes.

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agocxgb4: remove redundant assignment to vlan_cmd.dropnovlan_fm
Colin Ian King [Mon, 10 Sep 2018 12:17:22 +0000 (13:17 +0100)]
cxgb4: remove redundant assignment to vlan_cmd.dropnovlan_fm

A recent commit updated vlan_cmd.dropnovlan_fm but failed to remove
the older assignment.  Fix this by removing the former redundant
assignment.

Detected by CoverityScan, CID#1473290 ("Unused value")

Fixes: a89cdd8e7c74 ("cxgb4: impose mandatory VLAN usage when non-zero TAG ID")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agofailover: Fix error return code in net_failover_create
YueHaibing [Thu, 6 Sep 2018 13:04:12 +0000 (21:04 +0800)]
failover: Fix error return code in net_failover_create

if failover_register failed, 'err' code should be set correctly

Fixes: cfc80d9a1163 ("net: Introduce net_failover driver")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: stmmac: Enable TC Ops for GMAC >= 4
Jose Abreu [Thu, 6 Sep 2018 12:29:30 +0000 (13:29 +0100)]
net: stmmac: Enable TC Ops for GMAC >= 4

GMAC >= 4 also supports CBS. Lets enable the TC Ops for these versions.

Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Joao Pinto <jpinto@synopsys.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: sched: act_nat: remove dependency on rtnl lock
Vlad Buslov [Mon, 3 Sep 2018 07:09:20 +0000 (10:09 +0300)]
net: sched: act_nat: remove dependency on rtnl lock

According to the new locking rule, we have to take tcf_lock for both
->init() and ->dump(), as RTNL will be removed.

Use tcf spinlock to protect private nat action data from concurrent
modification during dump. (nat init already uses tcf spinlock when changing
action state)

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: sched: act_skbedit: remove dependency on rtnl lock
Vlad Buslov [Mon, 3 Sep 2018 07:07:15 +0000 (10:07 +0300)]
net: sched: act_skbedit: remove dependency on rtnl lock

According to the new locking rule, we have to take tcf_lock for both
->init() and ->dump(), as RTNL will be removed.

Use tcf lock to protect skbedit action struct private data from concurrent
modification in init and dump. Use rcu swap operation to reassign params
pointer under protection of tcf lock. (old params value is not used by
init, so there is no need of standalone rcu dereference step)

Remove rtnl lock assertion that is no longer required.

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoi40e(vf): remove i40e_ethtool_stats.h header file
Jacob Keller [Fri, 7 Sep 2018 21:55:44 +0000 (14:55 -0700)]
i40e(vf): remove i40e_ethtool_stats.h header file

Essentially reverts commit 8fd75c58a09a ("i40e: move ethtool
stats boiler plate code to i40e_ethtool_stats.h", 2018-08-30), and
additionally moves the similar code in i40evf into i40evf_ethtool.c.

The code was intially moved from i40e_ethtool.c into i40e_ethtool_stats.h
as a way of better logically organizing the code. This has two problems.
First, we can't have an inline function with variadic arguments on all
platforms. Second, it gave the appearance that we had plans to share
code between the i40e and i40evf drivers, due to having a near copy of
the contents in the i40evf/i40e_ethtool_stats.h file.

Patches which actually attempt to combine or share code between the i40e
and i40evf drivers have not materialized, and are likely a ways off.

Rather than fixing the one function which causes build issues, just move
this code back into the i40e_ethtool.c and i40evf_ethtool.c files. Note
that we also change these functions back from static inlines to just
statics, since they're no longer in a header file.

We can revisit this if/when work is done to actually attempt to share
code between drivers. Alternatively, this stats code could be made more
generic so that it can be shared across drivers as part of ethtool
kernel work.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: b53: Fix build with B53_SRAB enabled and not B53_SERDES
Florian Fainelli [Thu, 6 Sep 2018 18:42:45 +0000 (11:42 -0700)]
net: dsa: b53: Fix build with B53_SRAB enabled and not B53_SERDES

In case B53_SRAB is enabled, but not B53_SERDES, we can get the
following linking error:

ERROR: "b53_serdes_init" [drivers/net/dsa/b53/b53_srab.ko] undefined!

We also need to ifdef the body of b53_srab_serdes_map_lane() since it
would not be used when B53_SERDES is disabled and that would produce a
warning.

Fixes: 0e01491de646 ("net: dsa: b53: Add SerDes support")
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agocxgb4: impose mandatory VLAN usage when non-zero TAG ID
Casey Leedom [Fri, 7 Sep 2018 10:29:33 +0000 (15:59 +0530)]
cxgb4: impose mandatory VLAN usage when non-zero TAG ID

When a non-zero VLAN Tag ID is passed to t4_set_vlan_acl()
then impose mandatory VLAN Usage with that VLAN ID.
I.e any other VLAN ID should result in packets getting
dropped.

Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoliquidio: lio_fetch_vf_stats() can be static
kbuild test robot [Fri, 7 Sep 2018 01:41:08 +0000 (09:41 +0800)]
liquidio: lio_fetch_vf_stats() can be static

Fixes: 488752220b4a ("liquidio: Add spoof checking on a VF MAC address")
Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonfp: replace spin_lock_bh with spin_lock in tasklet callback
jun qian [Fri, 7 Sep 2018 17:01:09 +0000 (10:01 -0700)]
nfp: replace spin_lock_bh with spin_lock in tasklet callback

As you are already in a tasklet, it is unnecessary to call spin_lock_bh.

Signed-off-by: jun qian <hangdianqj@163.com>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: Expose tagging protocol to user-space
Florian Fainelli [Fri, 7 Sep 2018 18:09:02 +0000 (11:09 -0700)]
net: dsa: Expose tagging protocol to user-space

There is no way for user-space to know what a given DSA network device's
tagging protocol is. Expose this information through a dsa/tagging
attribute which reflects the tagging protocol currently in use.

This is helpful for configuration (e.g: none behaves dramatically
different wrt. bridges) as well as for packet capture tools when there
is not a proper Ethernet type available.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agofreescale: ethernet: remove unnecessary unlikely()
Igor Stoppa [Fri, 7 Sep 2018 17:23:18 +0000 (20:23 +0300)]
freescale: ethernet: remove unnecessary unlikely()

Both WARN_ON() and WARN_ONCE() already contain an unlikely(), so it's not
necessary to wrap it into another.

Signed-off-by: Igor Stoppa <igor.stoppa@huawei.com>
Cc: Madalin Bucur <madalin.bucur@nxp.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agobnxt_en: remove set but not used variable 'addr_type'
YueHaibing [Wed, 5 Sep 2018 11:44:10 +0000 (11:44 +0000)]
bnxt_en: remove set but not used variable 'addr_type'

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

drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c: In function 'bnxt_tc_parse_flow':
drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:186:6: warning:
 variable 'addr_type' set but not used [-Wunused-but-set-variable]

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoopenvswitch: Derive IP protocol number for IPv6 later frags
Yi-Hung Wei [Tue, 4 Sep 2018 22:33:41 +0000 (15:33 -0700)]
openvswitch: Derive IP protocol number for IPv6 later frags

Currently, OVS only parses the IP protocol number for the first
IPv6 fragment, but sets the IP protocol number for the later fragments
to be NEXTHDF_FRAGMENT.  This patch tries to derive the IP protocol
number for the IPV6 later frags so that we can match that.

Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoliquidio CN23XX: Remove set but not used variable 'ring_flag'
YueHaibing [Thu, 6 Sep 2018 11:22:09 +0000 (11:22 +0000)]
liquidio CN23XX: Remove set but not used variable 'ring_flag'

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

drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c: In function 'cn23xx_setup_octeon_vf_device':
drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c:619:20: warning:
 variable 'ring_flag' set but not used [-Wunused-but-set-variable]

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoliquidio: Add spoof checking on a VF MAC address
Weilin Chang [Thu, 6 Sep 2018 01:40:56 +0000 (18:40 -0700)]
liquidio: Add spoof checking on a VF MAC address

1. Provide the API to set/unset the spoof checking feature.
2. Add a function to periodically provide the count of found
   packets with spoof VF MAC address.
3. Prevent VF MAC address changing while the spoofchk of the VF is
   on unless the changing MAC address is issued from PF.

Signed-off-by: Weilin Chang <weilin.chang@cavium.com>
Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge tag 'mlx5e-updates-2018-09-05' of git://git.kernel.org/pub/scm/linux/kernel...
David S. Miller [Thu, 6 Sep 2018 22:42:04 +0000 (15:42 -0700)]
Merge tag 'mlx5e-updates-2018-09-05' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux

Saeed Mahameed says:

====================
mlx5e-updates-2018-09-05

This series provides updates to mlx5 ethernet driver.

1) Starting with a four patches series to optimize flow counters updates,
From Vlad Buslov:
==============================================

By default mlx5 driver updates cached counters each second. Update function
consumes noticeable amount of CPU resources. The goal of this patch series
is to optimize update function.

Investigation revealed following bottlenecks in fs counters
implementation:
 1) Update code(scheduled each second) iterates over all counters twice.
 (first for finding and deleting counters that are marked for deletion,
 second iteration is for actually updating the counters)
 2) Counters are stored in rb tree. Linear iteration over all rb tree
 elements(rb_next in profiling data) consumed ~65% of time spent in
 update function.

Following optimizations were implemented:
 1) Instead of just marking counters for deletion, store them in
 standalone list. This removes first iteration over whole counters tree.
 2) Store counters in sorted list to optimize traversing them and remove
 calls to rb_next.

First implementation of these changes caused degradation of performance,
instead of improving it. Investigation revealed that there first cache
line of struct mlx5_fc is full and adding anything to it causes amount
of cache misses to double. To mitigate that, following refactorings were
implemented:
 - Change 'addlist' list type from double linked to single linked. This
 allowes to get free space for one additional pointer that is used to
 store deletion list(optimization 1)
 - Substitute rb tree with idr. Idr is non-intrusive data structure and
 doesn't require adding any new members to struct mlx5_fc. Use free
 space that became available for double linked sorted list that is used
 for traversing all counters. (optimization 2)

Described changes reduced CPU time spent in mlx5_fc_stats_work from 70%
to 44%. (global perf profile mode)
============================================

The rest of the series are misc updates:

2) From Kamal, Move mlx5e_priv_flags into en_ethtool.c, to avoid a
compilation warning.

3) From Roi Dayan, Move Q counters allocation and drop RQ to init_rx profile
function to avoid allocating Q counters when not required.

4) From Shay Agroskin, Replace PTP clock lock from RW lock to seq lock.
Almost double the packet rate when timestamping is active on multiple TX
queues.

5) From: Natali Shechtman, set ECN for received packets using CQE indication.

6) From: Alaa Hleihel, don't set CHECKSUM_COMPLETE on SCTP packets.
CHECKSUM_COMPLETE is not applicable to SCTP protocol.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'dsa-b53-SerDes-support'
David S. Miller [Thu, 6 Sep 2018 14:48:34 +0000 (07:48 -0700)]
Merge branch 'dsa-b53-SerDes-support'

Florian Fainelli says:

====================
net: dsa: b53: SerDes support

This patch series adds support for the SerDes found on NorthStar Plus
(NSP) which allows us to use the SFP port on the BCM958625HR board (and
other similar designs).

Changes in v3:

- properly hunk the request_threaded_irq() bits into patch #2

Changes in v2:

- migrate to threaded interrupt (Andrew)
- fixed a case where MLO_AN_FIXED's mac_config would still call into
  the serdes_config callback
- added an additional check on the phylink interface in mac_config
- default to ARCH_BCM_NSP instead of ARCH_BCM_IPROC which is really
  the NSP Kconfig bit we want
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: b53: Add SerDes support
Florian Fainelli [Wed, 5 Sep 2018 19:42:15 +0000 (12:42 -0700)]
net: dsa: b53: Add SerDes support

Add support for the Northstar Plus SerDes which is accessed through a
special page of the switch. Since this is something that most people
probably will not want to use, make it a configurable option with a
default on ARCH_BCM_NSP where it is the most useful currently.

The SerDes supports both SGMII and 1000baseX modes for both lanes, and
2500baseX for one of the lanes, and is internally looking like a
seemingly standard MII PHY, except for the few bits that got repurposed.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: b53: Add PHYLINK support
Florian Fainelli [Wed, 5 Sep 2018 19:42:14 +0000 (12:42 -0700)]
net: dsa: b53: Add PHYLINK support

Add support for PHYLINK, things are reasonably straight forward since we
do not yet support SerDes interfaces, that leaves us with just
MLO_AN_PHY and MLO_AN_FIXED to deal with.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: b53: Add helper to set link parameters
Florian Fainelli [Wed, 5 Sep 2018 19:42:13 +0000 (12:42 -0700)]
net: dsa: b53: Add helper to set link parameters

Extract the logic from b53_adjust_link() responsible for overriding a
given port's link, speed, duplex and pause settings and make two helper
functions to set the port's configuration and the port's link settings.
We will make use of both, as separate functions while adding PHYLINK
support next.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: b53: Make SRAB driver manage port interrupts
Florian Fainelli [Wed, 5 Sep 2018 19:42:12 +0000 (12:42 -0700)]
net: dsa: b53: Make SRAB driver manage port interrupts

Update the SRAB driver to manage per-port interrupts. Since we cannot
sleep during b53_io_ops, schedule a workqueue whenever we get a port
specific interrupt. We will later make use of this to call back into
PHYLINK when there is e.g: a link state change.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: b53: Add ability to enable/disable port interrupts
Florian Fainelli [Wed, 5 Sep 2018 19:42:11 +0000 (12:42 -0700)]
net: dsa: b53: Add ability to enable/disable port interrupts

Some switches expose individual interrupt line(s) for port specific
event(s), allow configuring these interrupts at an appropriate time
during port_enable/disable callbacks where all port specific resources
are known to be set-up and ready for use.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoqed*: Utilize FW 8.37.7.0
Denis Bolotin [Wed, 5 Sep 2018 15:35:55 +0000 (18:35 +0300)]
qed*: Utilize FW 8.37.7.0

This patch adds a new qed firmware with fixes and support for new features.

Fixes:
- Fix a rare case of device crash with iWARP, iSCSI or FCoE offload.
- Fix GRE tunneled traffic when iWARP offload is enabled.
- Fix RoCE failure in ib_send_bw when using inline data.
- Fix latency optimization flow for inline WQEs.
- BigBear 100G fix

RDMA:
- Reduce task context size.
- Application page sizes above 2GB support.
- Performance improvements.

ETH:
- Tenant DCB support.
- Replace RSS indirection table update interface.

Misc:
- Debug Tools changes.

Signed-off-by: Denis Bolotin <denis.bolotin@cavium.com>
Signed-off-by: Ariel Elior <ariel.elior@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'rtnetlink-add-IFA_TARGET_NETNSID-for-RTM_GETADDR'
David S. Miller [Thu, 6 Sep 2018 05:27:12 +0000 (22:27 -0700)]
Merge branch 'rtnetlink-add-IFA_TARGET_NETNSID-for-RTM_GETADDR'

Christian Brauner says:

====================
rtnetlink: add IFA_TARGET_NETNSID for RTM_GETADDR

This iteration should mainly addresses the suggestion to use
IFA_TARGET_NETNSID as the property name. Additionally, an an alias for
the already existing IFLA_IF_NETNSID property is added.

Note that two additional cleanup patches (8\9 and 9\9) were added to
address concerns raised that passing more than 6 arguments to a function
will cause additional variables to be pushed onto the stack instead of
being placed into registers. The way I addressed this is by introducing
two new struct inet{6}_fill_args that are used to pass common
information down to inet{6}_fill_if*() functions shortening all those
functions to three pointer arguments.
If this is something more people than Kirill find useful they can be
kept if not they can simply be dropped in later iterations of this
series or when merging.

Here is a short overview:
1. Rename from IFA_IF_NETNSID to IFA_TARGET_NETNSID.
2. Add IFLA_TARGET_NETNSID as an alias for IFA_IFLA_NETNSID and switch
   all occurrences over to the new alias.
3. Add inet4_fill_args struct to avoid passing more than 6 arguments in
   inet_fill_if*() functions.
4. Add inet6_fill_args struct to avoid passing more than 6 arguments in
   inet_fill_if*() functions.

The only functional change is the export of rtnl_get_net_ns_capable()
which is needed in case ipv6 is built as a module.

Note, I did not change the property name to IFA_TARGET_NSID as there was
no clear agreement what would be preferred. My personal preference is to
keep the IFA_IF_NETNSID name because it aligns naturally with the
IFLA_IF_NETNSID property for RTM_*LINK requests. Jiri seems to prefer
this name too.
However, if there is agreement that another property name makes more
sense I'm happy to send a v2 that changes this.

To test this patchset I performed 1 million getifaddrs() requests
against a network namespace containing 5 interfaces (lo, eth{0-4}). The
first test used a network namespace aware getifaddrs() implementation I
wrote and the second test used the traditional setns() + getifaddrs()
method. The results show that this patchsets allows userspace to cut
retrieval time in half:
1. netns_getifaddrs():      82 microseconds
2. setns() + getifaddrs(): 162 microseconds

A while back we introduced and enabled IFLA_IF_NETNSID in
RTM_{DEL,GET,NEW}LINK requests (cf. [1], [2], [3], [4], [5]). This has led
to signficant performance increases since it allows userspace to avoid
taking the hit of a setns(netns_fd, CLONE_NEWNET), then getting the
interfaces from the netns associated with the netns_fd. Especially when a
lot of network namespaces are in use, using setns() becomes increasingly
problematic when performance matters.
Usually, RTML_GETLINK requests are followed by RTM_GETADDR requests (cf.
getifaddrs() style functions and friends). But currently, RTM_GETADDR
requests do not support a similar property like IFLA_IF_NETNSID for
RTM_*LINK requests.
This is problematic since userspace can retrieve interfaces from another
network namespace by sending a IFLA_IF_NETNSID property along but
RTM_GETLINK request but is still forced to use the legacy setns() style of
retrieving interfaces in RTM_GETADDR requests.

The goal of this series is to make it possible to perform RTM_GETADDR
requests on different network namespaces. To this end a new IFA_IF_NETNSID
property for RTM_*ADDR requests is introduced. It can be used to send a
network namespace identifier along in RTM_*ADDR requests.  The network
namespace identifier will be used to retrieve the target network namespace
in which the request is supposed to be fulfilled.  This aligns the behavior
of RTM_*ADDR requests with the behavior of RTM_*LINK requests.

- The caller must have assigned a valid network namespace identifier for
  the target network namespace.
- The caller must have CAP_NET_ADMIN in the owning user namespace of the
  target network namespace.

[1]: commit 7973bfd8758d ("rtnetlink: remove check for IFLA_IF_NETNSID")
[2]: commit 5bb8ed075428 ("rtnetlink: enable IFLA_IF_NETNSID for RTM_NEWLINK")
[3]: commit b61ad68a9fe8 ("rtnetlink: enable IFLA_IF_NETNSID for RTM_DELLINK")
[4]: commit c310bfcb6e1b ("rtnetlink: enable IFLA_IF_NETNSID for RTM_SETLINK")
[5]: commit 7c4f63ba8243 ("rtnetlink: enable IFLA_IF_NETNSID in do_setlink()")
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoipv6: add inet6_fill_args
Christian Brauner [Tue, 4 Sep 2018 19:53:55 +0000 (21:53 +0200)]
ipv6: add inet6_fill_args

inet6_fill_if{addr,mcaddr, acaddr}() already took 6 arguments which
meant the 7th argument would need to be pushed onto the stack on x86.
Add a new struct inet6_fill_args which holds common information passed
to inet6_fill_if{addr,mcaddr, acaddr}() and shortens the functions to
three pointer arguments.

Signed-off-by: Christian Brauner <christian@brauner.io>
Cc: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoipv4: add inet_fill_args
Christian Brauner [Tue, 4 Sep 2018 19:53:54 +0000 (21:53 +0200)]
ipv4: add inet_fill_args

inet_fill_ifaddr() already took 6 arguments which meant the 7th argument
would need to be pushed onto the stack on x86.
Add a new struct inet_fill_args which holds common information passed
to inet_fill_ifaddr() and shortens the function to three pointer arguments.

Signed-off-by: Christian Brauner <christian@brauner.io>
Cc: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agortnetlink: s/IFLA_IF_NETNSID/IFLA_TARGET_NETNSID/g
Christian Brauner [Tue, 4 Sep 2018 19:53:53 +0000 (21:53 +0200)]
rtnetlink: s/IFLA_IF_NETNSID/IFLA_TARGET_NETNSID/g

IFLA_TARGET_NETNSID is the new alias for IFLA_IF_NETNSID. This commit
replaces all occurrences of IFLA_IF_NETNSID with the new alias to
indicate that this identifier is the preferred one.

Signed-off-by: Christian Brauner <christian@brauner.io>
Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Cc: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoif_link: add IFLA_TARGET_NETNSID alias
Christian Brauner [Tue, 4 Sep 2018 19:53:52 +0000 (21:53 +0200)]
if_link: add IFLA_TARGET_NETNSID alias

This adds IFLA_TARGET_NETNSID as an alias for IFLA_IF_NETNSID for
RTM_*LINK requests.
The new name is clearer and also aligns with the newly introduced
IFA_TARGET_NETNSID propert for RTM_*ADDR requests.

Signed-off-by: Christian Brauner <christian@brauner.io>
Suggested-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Cc: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agortnetlink: move type calculation out of loop
Christian Brauner [Tue, 4 Sep 2018 19:53:51 +0000 (21:53 +0200)]
rtnetlink: move type calculation out of loop

I don't see how the type - which is one of
RTM_{GETADDR,GETROUTE,GETNETCONF} - can change. So do the message type
calculation once before entering the for loop.

Signed-off-by: Christian Brauner <christian@brauner.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoipv6: enable IFA_TARGET_NETNSID for RTM_GETADDR
Christian Brauner [Tue, 4 Sep 2018 19:53:50 +0000 (21:53 +0200)]
ipv6: enable IFA_TARGET_NETNSID for RTM_GETADDR

- Backwards Compatibility:
  If userspace wants to determine whether ipv6 RTM_GETADDR requests
  support the new IFA_TARGET_NETNSID property it should verify that the
  reply includes the IFA_TARGET_NETNSID property. If it does not
  userspace should assume that IFA_TARGET_NETNSID is not supported for
  ipv6 RTM_GETADDR requests on this kernel.
- From what I gather from current userspace tools that make use of
  RTM_GETADDR requests some of them pass down struct ifinfomsg when they
  should actually pass down struct ifaddrmsg. To not break existing
  tools that pass down the wrong struct we will do the same as for
  RTM_GETLINK | NLM_F_DUMP requests and not error out when the
  nlmsg_parse() fails.

- Security:
  Callers must have CAP_NET_ADMIN in the owning user namespace of the
  target network namespace.

Signed-off-by: Christian Brauner <christian@brauner.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoipv4: enable IFA_TARGET_NETNSID for RTM_GETADDR
Christian Brauner [Tue, 4 Sep 2018 19:53:49 +0000 (21:53 +0200)]
ipv4: enable IFA_TARGET_NETNSID for RTM_GETADDR

- Backwards Compatibility:
  If userspace wants to determine whether ipv4 RTM_GETADDR requests
  support the new IFA_TARGET_NETNSID property it should verify that the
  reply includes the IFA_TARGET_NETNSID property. If it does not
  userspace should assume that IFA_TARGET_NETNSID is not supported for
  ipv4 RTM_GETADDR requests on this kernel.
- From what I gather from current userspace tools that make use of
  RTM_GETADDR requests some of them pass down struct ifinfomsg when they
  should actually pass down struct ifaddrmsg. To not break existing
  tools that pass down the wrong struct we will do the same as for
  RTM_GETLINK | NLM_F_DUMP requests and not error out when the
  nlmsg_parse() fails.

- Security:
  Callers must have CAP_NET_ADMIN in the owning user namespace of the
  target network namespace.

Signed-off-by: Christian Brauner <christian@brauner.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoif_addr: add IFA_TARGET_NETNSID
Christian Brauner [Tue, 4 Sep 2018 19:53:48 +0000 (21:53 +0200)]
if_addr: add IFA_TARGET_NETNSID

This adds a new IFA_TARGET_NETNSID property to be used by address
families such as PF_INET and PF_INET6.
The IFA_TARGET_NETNSID property can be used to send a network namespace
identifier as part of a request. If a IFA_TARGET_NETNSID property is
identified it will be used to retrieve the target network namespace in
which the request is to be made.

Signed-off-by: Christian Brauner <christian@brauner.io>
Cc: Jiri Benc <jbenc@redhat.com>
Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agortnetlink: add rtnl_get_net_ns_capable()
Christian Brauner [Tue, 4 Sep 2018 19:53:47 +0000 (21:53 +0200)]
rtnetlink: add rtnl_get_net_ns_capable()

get_target_net() will be used in follow-up patches in ipv{4,6} codepaths to
retrieve network namespaces based on network namespace identifiers. So
remove the static declaration and export in the rtnetlink header. Also,
rename it to rtnl_get_net_ns_capable() to make it obvious what this
function is doing.
Export rtnl_get_net_ns_capable() so it can be used when ipv6 is built as
a module.

Signed-off-by: Christian Brauner <christian@brauner.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'net-lan78xx-Minor-improvements'
David S. Miller [Thu, 6 Sep 2018 05:20:45 +0000 (22:20 -0700)]
Merge branch 'net-lan78xx-Minor-improvements'

Stefan Wahren says:

====================
net: lan78xx: Minor improvements

This patch series contains some minor improvements for the lan78xx
driver.

Changes in V2:
- Keep Copyright comment as multi-line
- Add Raghuram's Reviewed-by
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: lan78xx: Make declaration style consistent
Stefan Wahren [Tue, 4 Sep 2018 17:29:12 +0000 (19:29 +0200)]
net: lan78xx: Make declaration style consistent

This patch makes some declaration more consistent.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Raghuram Chary Jallipalli <raghuramchary.jallipalli@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: lan78xx: Switch to SPDX identifier
Stefan Wahren [Tue, 4 Sep 2018 17:29:11 +0000 (19:29 +0200)]
net: lan78xx: Switch to SPDX identifier

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

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: lan78xx: Drop unnecessary strcpy in lan78xx_probe
Stefan Wahren [Tue, 4 Sep 2018 17:29:10 +0000 (19:29 +0200)]
net: lan78xx: Drop unnecessary strcpy in lan78xx_probe

There is no need for this strcpy because alloc_etherdev() already
does this job.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Raghuram Chary Jallipalli <raghuramchary.jallipalli@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: lan78xx: Bail out if lan78xx_get_endpoints fails
Stefan Wahren [Tue, 4 Sep 2018 17:29:09 +0000 (19:29 +0200)]
net: lan78xx: Bail out if lan78xx_get_endpoints fails

We need to bail out if lan78xx_get_endpoints() fails, otherwise the
result is overwritten.

Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet")
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Raghuram Chary Jallipalli <raghuramchary.jallipalli@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonfp: separate VXLAN and GRE feature handling
Jakub Kicinski [Tue, 4 Sep 2018 15:28:33 +0000 (08:28 -0700)]
nfp: separate VXLAN and GRE feature handling

VXLAN and GRE FW features have to currently be both advertised
for the driver to enable them.  Separate the handling.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'nfp-improve-the-new-rtsym-helpers'
David S. Miller [Thu, 6 Sep 2018 05:17:07 +0000 (22:17 -0700)]
Merge branch 'nfp-improve-the-new-rtsym-helpers'

Jakub Kicinski says:

====================
nfp: improve the new rtsym helpers

This set fixes a bug in ABS rtsym handling I added in net-next,
it expands the error checking and reporting on the rtsym accesses.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonfp: validate rtsym accesses fall within the symbol
Jakub Kicinski [Tue, 4 Sep 2018 14:37:33 +0000 (07:37 -0700)]
nfp: validate rtsym accesses fall within the symbol

With the accesses to rtsyms now all going via special helpers
we can easily make sure the driver is not reading past the
end of the symbol.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Francois H. Theron <francois.theron@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonfp: prefix rtsym error messages with symbol name
Jakub Kicinski [Tue, 4 Sep 2018 14:37:32 +0000 (07:37 -0700)]
nfp: prefix rtsym error messages with symbol name

For ease of debug preface all error messages with the name
of the symbol which caused them.  Use the same message format
for existing messages while at it.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Francois H. Theron <francois.theron@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonfp: fix readq on absolute RTsyms
Jakub Kicinski [Tue, 4 Sep 2018 14:37:31 +0000 (07:37 -0700)]
nfp: fix readq on absolute RTsyms

Return the error and report value through the output param.

Fixes: 640917dd81b6 ("nfp: support access to absolute RTsyms")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Francois H. Theron <francois.theron@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agofailover: Add missing check to validate 'slave_dev' in net_failover_slave_unregister
YueHaibing [Tue, 4 Sep 2018 02:56:26 +0000 (02:56 +0000)]
failover: Add missing check to validate 'slave_dev' in net_failover_slave_unregister

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

drivers/net/net_failover.c: In function 'net_failover_slave_unregister':
drivers/net/net_failover.c:598:35: warning:
 variable 'primary_dev' set but not used [-Wunused-but-set-variable]

There should check the validity of 'slave_dev'.

Fixes: cfc80d9a1163 ("net: Introduce net_failover driver")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Sridhar Samudrala <sridhar.samudrala@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonetlink: Make groups check less stupid in netlink_bind()
Dmitry Safonov [Mon, 3 Sep 2018 21:40:51 +0000 (22:40 +0100)]
netlink: Make groups check less stupid in netlink_bind()

As Linus noted, the test for 0 is needless, groups type can follow the
usual kernel style and 8*sizeof(unsigned long) is BITS_PER_LONG:

> The code [..] isn't technically incorrect...
> But it is stupid.
> Why stupid? Because the test for 0 is pointless.
>
> Just doing
>        if (nlk->ngroups < 8*sizeof(groups))
>                groups &= (1UL << nlk->ngroups) - 1;
>
> would have been fine and more understandable, since the "mask by shift
> count" already does the right thing for a ngroups value of 0. Now that
> test for zero makes me go "what's special about zero?". It turns out
> that the answer to that is "nothing".
[..]
> The type of "groups" is kind of silly too.
>
> Yeah, "long unsigned int" isn't _technically_ wrong. But we normally
> call that type "unsigned long".

Cleanup my piece of pointlessness.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Cc: netdev@vger.kernel.org
Fairly-blamed-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agopacket: add sockopt to ignore outgoing packets
Vincent Whitchurch [Mon, 3 Sep 2018 14:23:36 +0000 (16:23 +0200)]
packet: add sockopt to ignore outgoing packets

Currently, the only way to ignore outgoing packets on a packet socket is
via the BPF filter.  With MSG_ZEROCOPY, packets that are looped into
AF_PACKET are copied in dev_queue_xmit_nit(), and this copy happens even
if the filter run from packet_rcv() would reject them.  So the presence
of a packet socket on the interface takes away the benefits of
MSG_ZEROCOPY, even if the packet socket is not interested in outgoing
packets.  (Even when MSG_ZEROCOPY is not used, the skb is unnecessarily
cloned, but the cost for that is much lower.)

Add a socket option to allow AF_PACKET sockets to ignore outgoing
packets to solve this.  Note that the *BSDs already have something
similar: BIOCSSEESENT/BIOCSDIRECTION and BIOCSDIRFILT.

The first intended user is lldpd.

Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet/mlx5e: don't set CHECKSUM_COMPLETE on SCTP packets
Alaa Hleihel [Tue, 10 Jul 2018 10:34:06 +0000 (13:34 +0300)]
net/mlx5e: don't set CHECKSUM_COMPLETE on SCTP packets

CHECKSUM_COMPLETE is not applicable to SCTP protocol.
Setting it for SCTP packets leads to CRC32c validation failure.

Fixes: bbceefce9adf ("net/mlx5e: Support RX CHECKSUM_COMPLETE")
Signed-off-by: Alaa Hleihel <alaa@mellanox.com>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
6 years agonet/mlx5e: Set ECN for received packets using CQE indication
Natali Shechtman [Tue, 20 Mar 2018 15:15:31 +0000 (17:15 +0200)]
net/mlx5e: Set ECN for received packets using CQE indication

In multi-host (MH) NIC scheme, a single HW port serves multiple hosts
or sockets on the same host.
The HW uses a mechanism in the PCIe buffer which monitors
the amount of consumed PCIe buffers per host.
On a certain configuration, under congestion,
the HW emulates a switch doing ECN marking on packets using ECN
indication on the completion descriptor (CQE).

The driver needs to set the ECN bits on the packet SKB,
such that the network stack can react on that, this commit does that.

Signed-off-by: Natali Shechtman <natali@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
6 years agonet/mlx5e: Replace PTP clock lock from RW lock to seq lock
Shay Agroskin [Tue, 5 Jun 2018 06:22:18 +0000 (09:22 +0300)]
net/mlx5e: Replace PTP clock lock from RW lock to seq lock

Changed "priv.clock.lock" lock from 'rw_lock' to 'seq_lock'
in order to improve packet rate performance.

Tested on Intel(R) Xeon(R) CPU E5-2660 v2 @ 2.20GHz.
Sent 64b packets between two peers connected by ConnectX-5,
and measured packet rate for the receiver in three modes:
no time-stamping (base rate)
time-stamping using rw_lock (old lock) for critical region
time-stamping using seq_lock (new lock) for critical region
Only the receiver time stamped its packets.

The measured packet rate improvements are:

Single flow (multiple TX rings to single RX ring):
without timestamping:   4.26 (M packets)/sec
with rw-lock (old lock):  4.1  (M packets)/sec
with seq-lock (new lock): 4.16 (M packets)/sec
1.46% improvement

Multiple flows (multiple TX rings to six RX rings):
without timestamping:    22   (M packets)/sec
with rw-lock (old lock):  11.7 (M packets)/sec
with seq-lock (new lock): 21.3 (M packets)/sec
82.05% improvement

The packet rate improvement is due to the lack of atomic operations
for the 'readers' by the seq-lock.
Since there are much more 'readers' than 'writers' contention
on this lock, almost all atomic operations are saved.
this results in a dramatic decrease in overall
cache misses.

Signed-off-by: Shay Agroskin <shayag@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
6 years agonet/mlx5e: Move Q counters allocation and drop RQ to init_rx
Roi Dayan [Sun, 5 Aug 2018 03:58:05 +0000 (06:58 +0300)]
net/mlx5e: Move Q counters allocation and drop RQ to init_rx

Not all profiles query the HW Q counters in update_stats() callback.
HW Q couners are limited per device and in case of representors all
their Q counters are allocated on the parent PF device.
Avoid reundant allocation of HW Q counters by moving the allocation
to init_rx profile callback.

Signed-off-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
6 years agonet/mlx5e: Move mlx5e_priv_flags into en_ethtool.c
Kamal Heib [Sun, 15 Jul 2018 19:06:28 +0000 (22:06 +0300)]
net/mlx5e: Move mlx5e_priv_flags into en_ethtool.c

Move the definition of mlx5e_priv_flags into en_ethtool.c because it's
only used there.

Fixes: 4e59e2888139 ("net/mlx5e: Introduce net device priv flags infrastructure")
Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
6 years agonet/mlx5: Add flow counters idr
Vlad Buslov [Tue, 24 Jul 2018 13:37:40 +0000 (16:37 +0300)]
net/mlx5: Add flow counters idr

Previous patch in series changed flow counter storage structure from
rb_tree to linked list in order to improve flow counter traversal
performance. The drawback of such solution is that flow counter lookup by
id becomes linear in complexity.

Store pointers to flow counters in idr in order to improve lookup
performance to logarithmic again. Idr is non-intrusive data structure and
doesn't require extending flow counter struct with new elements. This means
that idr can be used for lookup, while linked list from previous patch is
used for traversal, and struct mlx5_fc size is <= 2 cache lines.

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Acked-by: Amir Vadai <amir@vadai.me>
Reviewed-by: Paul Blakey <paulb@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>