linux-2.6-block.git
5 years agoMerge tag 'mac80211-next-for-davem-2018-12-19' of git://git.kernel.org/pub/scm/linux...
David S. Miller [Wed, 19 Dec 2018 16:36:18 +0000 (08:36 -0800)]
Merge tag 'mac80211-next-for-davem-2018-12-19' of git://git./linux/kernel/git/jberg/mac80211-next

Johannes Berg says:

====================
This time we have too many changes to list, highlights:
 * virt_wifi - wireless control simulation on top of
   another network interface
 * hwsim configurability to test capabilities similar
   to real hardware
 * various mesh improvements
 * various radiotap vendor data fixes in mac80211
 * finally the nl_set_extack_cookie_u64() we talked
   about previously, used for
 * peer measurement APIs, right now only with FTM
   (flight time measurement) for location
 * made nl80211 radio/interface announcements more complete
 * various new HE (802.11ax) things:
   updates, TWT support, ...
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomac80211: Properly access radiotap vendor data
Ilan Peer [Sat, 15 Dec 2018 09:03:25 +0000 (11:03 +0200)]
mac80211: Properly access radiotap vendor data

The radiotap vendor data might be placed after some other
radiotap elements, and thus when accessing it, need to access
the correct offset in the skb data. Fix the code accordingly.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agocfg80211: fix ieee80211_get_vht_max_nss()
Johannes Berg [Sat, 15 Dec 2018 09:03:16 +0000 (11:03 +0200)]
cfg80211: fix ieee80211_get_vht_max_nss()

Fix two bugs in ieee80211_get_vht_max_nss():
 * the spec says we should round down
   (reported by Nissim)
 * there's a double condition, the first one is wrong,
   supp_width == 0 / ext_nss_bw == 2 is valid in 80+80
   (found by smatch)

Fixes: b0aa75f0b1b2 ("ieee80211: add new VHT capability fields/parsing")
Reported-by: Nissim Bendanan <nissimx.bendanan@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agomac80211: fix radiotap vendor presence bitmap handling
Johannes Berg [Sat, 15 Dec 2018 09:03:12 +0000 (11:03 +0200)]
mac80211: fix radiotap vendor presence bitmap handling

Due to the alignment handling, it actually matters where in the code
we add the 4 bytes for the presence bitmap to the length; the first
field is the timestamp with 8 byte alignment so we need to add the
space for the extra vendor namespace presence bitmap *before* we do
any alignment for the fields.

Move the presence bitmap length accounting to the right place to fix
the alignment for the data properly.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agonet: ethernet: don't set phylib state CHANGELINK in drivers
Heiner Kallweit [Tue, 18 Dec 2018 23:43:58 +0000 (00:43 +0100)]
net: ethernet: don't set phylib state CHANGELINK in drivers

After phy_start() phylib takes care of all needed actions, including
aneg settings and checking link state. There's no need to set state
PHY_CHANGELINK in drivers.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMAINTAINERS: Add a maintainer for Microsemi switches
Alexandre Belloni [Tue, 18 Dec 2018 14:25:39 +0000 (15:25 +0100)]
MAINTAINERS: Add a maintainer for Microsemi switches

Microsemi has been bought by Microchip and Microchip is supporting those
switches.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Acked-by: Woojung Huh <Woojung.Huh@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agotipc: handle broadcast NAME_DISTRIBUTOR packet when receiving it
Zhenbo Gao [Tue, 18 Dec 2018 09:43:52 +0000 (17:43 +0800)]
tipc: handle broadcast NAME_DISTRIBUTOR packet when receiving it

NAME_DISTRIBUTOR messages are transmitted through unicast link on TIPC
2.0, by contrast, the messages are delivered through broadcast link on
TIPC 1.7. But at present, NAME_DISTRIBUTOR messages received by
broadcast link cannot be handled in tipc_rcv() until an unicast message
arrives, which may lead to a significant delay to update name table.

To avoid this delay, we will also deal with broadcast NAME_DISTRIBUTOR
message on broadcast receive path.

Signed-off-by: Zhenbo Gao <zhenbo.gao@windriver.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: remove unused code in phy_probe
Heiner Kallweit [Mon, 17 Dec 2018 22:43:25 +0000 (23:43 +0100)]
net: phy: remove unused code in phy_probe

3c1bcc8614db ("net: ethernet: Convert phydev advertize and supported
from u32 to link mode") left some unused code in phy_probe(), remove it.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge tag 'mlx5-uplink-rep-2018-12-15' of git://git.kernel.org/pub/scm/linux/kernel...
David S. Miller [Wed, 19 Dec 2018 00:44:45 +0000 (16:44 -0800)]
Merge tag 'mlx5-uplink-rep-2018-12-15' of git://git./linux/kernel/git/saeed/linux

Saeed Mahameed:

====================
mlx5-uplink-rep-2018-12-15

Or Gerlitz says:

This series is essentially a cleanup to align with the rest of the NIC
switchdev drivers and make us
more robust and clear/n: currently the PF netdev serves as the mlx5
e-switch uplink netdev
representor when going into switchdev mode and back as plain NIC
netdev when going out.
This causes some irregularities and misc troubles.

Move to use dedicated uplink rep, as we have for the VF vports.

The uplink rep netdev does has sysfs link and supports the sriov vf
mac ndo, these two are in
use by libvirt and other orchestrators, It also has richer ethtool
support to allow controlling the
port link & mtu along with supporting dcb and plugging into the mlx5
lag logic.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: bridge: remove unneeded variable 'err'
YueHaibing [Mon, 17 Dec 2018 09:46:23 +0000 (17:46 +0800)]
net: bridge: remove unneeded variable 'err'

function br_multicast_toggle now always return 0,
so the variable 'err' is unneeded.
Also cleanup dead branch in br_changelink.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoqlcnic: remove set but not used variables 'op, cmd_op'
YueHaibing [Mon, 17 Dec 2018 09:27:16 +0000 (17:27 +0800)]
qlcnic: remove set but not used variables 'op, cmd_op'

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

drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c:1070:5: warning:
 variable 'op' set but not used [-Wunused-but-set-variable]
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c:1342:5: warning:
 variable 'cmd_op' set but not used [-Wunused-but-set-variable]

'op' never used since introduction in commit 7cb03b2347d5 ("qlcnic:
Support VF-PF communication channel commands.")
'cmd_op' not used since commit 6226204bcf20 ("qlcnic: Fix operation
type and command type.")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agotest_rhashtable: remove semaphore usage
Arnd Bergmann [Sun, 16 Dec 2018 19:48:21 +0000 (20:48 +0100)]
test_rhashtable: remove semaphore usage

This is one of only two files that initialize a semaphore to a negative
value. We don't really need the two semaphores here at all, but can do
the same thing in more conventional and more effient way, by using a
single waitqueue and an atomic thread counter.

This gets us a little bit closer to eliminating classic semaphores from
the kernel. It also fixes a corner case where we fail to continue after
one of the threads fails to start up.

An alternative would be to use a split kthread_create()+wake_up_process()
and completely eliminate the separate synchronization.

Acked-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: print stack trace in phy_error
Heiner Kallweit [Sun, 16 Dec 2018 18:18:26 +0000 (19:18 +0100)]
net: phy: print stack trace in phy_error

So far phy_error() silently stops the PHY state machine. If the network
driver doesn't inform about a  MDIO error then the user may wonder why
his network is down. Let's print the stack trace to facilitate search
for the root cause of the error.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: improve phy state checking
Heiner Kallweit [Sun, 16 Dec 2018 17:30:14 +0000 (18:30 +0100)]
net: phy: improve phy state checking

Add helpers phy_is_started() and __phy_is_started() to avoid open-coded
checks whether PHY has been started. To make the check easier move
PHY_HALTED before PHY_UP in enum phy_state. Further improvements:

phy_start_aneg():
Return -EBUSY and print warning if function is called from a non-started
state (DOWN, READY, HALTED). Better check because function is exported
and drivers may use it incorrectly.

phy_interrupt():
Return IRQ_NONE also if state is DOWN or READY. We should never receive
an interrupt in one of these states, but better play safe.

phy_stop():
Just return and print a warning if PHY is in a non-started state.
This warning should help to identify drivers with unbalanced calls to
phy_start() / phy_stop().

phy_state_machine():
Schedule state machine run only if PHY is in a started state.
E.g. if state is READY we don't need the state machine, it will be
started by phy_start().

v2:
- don't use __func__ within phy_warn_state
v3:
- use WARN() instead of printing error message to facilitate debugging

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: fec: remove workaround to restart phylib state machine on MDIO timeout
Heiner Kallweit [Sun, 16 Dec 2018 14:00:40 +0000 (15:00 +0100)]
net: fec: remove workaround to restart phylib state machine on MDIO timeout

There's a workaround to restart the phylib state machine in case of a
MDIO access timeout. Seems it was introduced to deal with the
consequences of a too small MDIO timeout. See also commit message of
c3b084c24c8a ("net: fec: Adjust ENET MDIO timeouts") which increased
the timeout value later. Due to the later timeout value fix it seems
to be safe to remove the workaround.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agobonding: fix indentation issues, remove extra spaces
Colin Ian King [Sun, 16 Dec 2018 13:33:15 +0000 (13:33 +0000)]
bonding: fix indentation issues, remove extra spaces

There are two statements that are indented too much by one space each,
fix these.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'hns3-next'
David S. Miller [Tue, 18 Dec 2018 20:01:02 +0000 (12:01 -0800)]
Merge branch 'hns3-next'

Peng Li says:

====================
net: hns3: code optimizations & bugfixes for HNS3 driver

This patchset includes bugfixes and code optimizations for the HNS3
ethernet controller driver
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: hns3: fix a SSU buffer checking bug
Yunsheng Lin [Tue, 18 Dec 2018 11:37:59 +0000 (19:37 +0800)]
net: hns3: fix a SSU buffer checking bug

When caculating the SSU buffer, it first allocate tx and
rx private buffer, then the remaining buffer is for rx
shared buffer. The remaining buffer size should be at
least bigger than or equal to the shared_std, which is the
minimum shared buffer size required by the driver, but
currently if the remaining buffer size is equal to the
shared_std, it returns failure, which causes SSU buffer
allocation failure problem.

This patch fixes this problem by rounding up shared_std before
checking the the remaining buffer size bigger than or equal to
the shared_std.

Fixes: 46a3df9f9718 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support")
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: hns3: aligning buffer size in SSU to 256 bytes
Yunsheng Lin [Tue, 18 Dec 2018 11:37:58 +0000 (19:37 +0800)]
net: hns3: aligning buffer size in SSU to 256 bytes

The hardware expects the buffer size set to SSU is aligned to
256 bytes, this patch aligns the buffer size to 256 byte using
roundup or rounddown function.

Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: hns3: getting tx and dv buffer size through firmware
Yunsheng Lin [Tue, 18 Dec 2018 11:37:57 +0000 (19:37 +0800)]
net: hns3: getting tx and dv buffer size through firmware

This patch adds support of getting tx and dv buffer size through
firmware, because different version of hardware requires different
size of tx and dv buffer.

This patch also add dv_buf_size to tc' private buffer size even if
pfc is not enable for the tc.

Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: hns3: synchronize speed and duplex from phy when phy link up
Peng Li [Tue, 18 Dec 2018 11:37:56 +0000 (19:37 +0800)]
net: hns3: synchronize speed and duplex from phy when phy link up

Driver calls phy_connect_direct and registers hclge_mac_adjust_link
to synchronize mac speed and duplex from phy. It is better to
synchronize mac speed and duplex from phy when phy link up.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: hns3: remove 1000M/half support of phy
Fuyun Liang [Tue, 18 Dec 2018 11:37:55 +0000 (19:37 +0800)]
net: hns3: remove 1000M/half support of phy

Our phy does not support 1000M/half, this patch removes 1000M/half from
PHY_SUPPORTED_FEATURES.

Signed-off-by: Fuyun Liang <liangfuyun1@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: hns3: update coalesce param per second
Peng Li [Tue, 18 Dec 2018 11:37:54 +0000 (19:37 +0800)]
net: hns3: update coalesce param per second

coalesce param updates every 100 napi times, it may update a little
late if ping test after a high rate flow, may over napi poll is called
100 times as ping test sends packets every second.

This patch updates coalesce param every second, instead with every
100 napi times. It can not update the param 100% in time, but the
lag time is very short.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: hns3: fix incomplete uninitialization of IRQ in the hns3_nic_uninit_vector_data()
Huazhong Tan [Tue, 18 Dec 2018 11:37:53 +0000 (19:37 +0800)]
net: hns3: fix incomplete uninitialization of IRQ in the hns3_nic_uninit_vector_data()

In the hns3_nic_uninit_vector_data(), the procedure of uninitializing
the tqp_vector's IRQ has not set affinity_notify to NULL and changes
its init flag. This patch fixes it. And for simplificaton, local
variable tqp_vector is used instead of priv->tqp_vector[i].

Fixes: 424eb834a9be ("net: hns3: Unified HNS3 {VF|PF} Ethernet Driver for hip08 SoC")
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: hns3: remove unnecessary configuration recapture while resetting
Huazhong Tan [Tue, 18 Dec 2018 11:37:52 +0000 (19:37 +0800)]
net: hns3: remove unnecessary configuration recapture while resetting

When doing reset, it is unnecessary to get the hardware's default
configuration again, otherwise, the user's configuration will be
overwritten.

Fixes: 4ed340ab8f49 ("net: hns3: Add reset process in hclge_main")
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: hns3: update some variables while hclge_reset()/hclgevf_reset() done
Huazhong Tan [Tue, 18 Dec 2018 11:37:51 +0000 (19:37 +0800)]
net: hns3: update some variables while hclge_reset()/hclgevf_reset() done

When hclge_reset() completes successfully, it should update the
last_reset_time, set reset_fail_cnt to 0, and set reset_type of
hnae3_ae_dev to HNAE3_NONE_RESET.

Also when hclgevf_reset() completes successfully, it should update
the last_reset_time, and set reset_type of hnae3_ae_dev to
HNAE3_NONE_RESET.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: hns3: fix napi_disable not return problem
Huazhong Tan [Tue, 18 Dec 2018 11:37:50 +0000 (19:37 +0800)]
net: hns3: fix napi_disable not return problem

While doing DOWN, the calling of napi_disable() may not return, since the
napi_complete() in the hns3_nic_common_poll() will never be called when
HNS3_NIC_STATE_DOWN is set. So we need to call napi_complete() before
checking HNS3_NIC_STETE_DOWN.

Fixes: ff0699e04b97 ("net: hns3: stop napi polling when HNS3_NIC_STATE_DOWN is set")
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: hns3: uninitialize pci in the hclgevf_uninit
Huazhong Tan [Tue, 18 Dec 2018 11:37:49 +0000 (19:37 +0800)]
net: hns3: uninitialize pci in the hclgevf_uninit

In the hclgevf_pci_reset(), it only uninitialize and initialize
the msi, so if the initialization fails, hclgevf_uninit_hdev()
does not need to uninitialize the msi, but needs to uninitialize
the pci, otherwise it will cause pci resource not free.

Fixes: 862d969a3a4d ("net: hns3: do VF's pci re-initialization while PF doing FLR")
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: hns3: fix error handling int the hns3_get_vector_ring_chain
Huazhong Tan [Tue, 18 Dec 2018 11:37:48 +0000 (19:37 +0800)]
net: hns3: fix error handling int the hns3_get_vector_ring_chain

When hns3_get_vector_ring_chain() failed in the
hns3_nic_init_vector_data(), it should do the error handling instead
of return directly.

Also, cur_chain should be freed instead of chain and head->next should
be set to NULL in error handling of hns3_get_vector_ring_chain.

This patch fixes them.

Fixes: 73b907a083b8 ("net: hns3: bugfix for buffer not free problem during resetting")
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec...
David S. Miller [Tue, 18 Dec 2018 16:49:48 +0000 (08:49 -0800)]
Merge branch 'master' of git://git./linux/kernel/git/klassert/ipsec-next

Steffen Klassert says:

====================
pull request (net-next): ipsec-next 2018-12-18

1) Add xfrm policy selftest scripts.
   From Florian Westphal.

2) Split inexact policies into four different search list
   classes and use the rbtree infrastructure to store/lookup
   the policies. This is to improve the policy lookup
   performance after the flowcache removal.
   Patches from Florian Westphal.

3) Various coding style fixes, from Colin Ian King.

4) Fix policy lookup logic after adding the inexact policy
   search tree infrastructure. From Florian Westphal.

5) Remove a useless remove BUG_ON from xfrm6_dst_ifdown.
   From Li RongQing.

6) Use the correct policy direction for lookups on hash
   rebuilding. From Florian Westphal.

Please pull or let me know if there are problems.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomac80211: do not advertise HE cap IE if HE disabled
Shaul Triebitz [Sat, 15 Dec 2018 09:03:20 +0000 (11:03 +0200)]
mac80211: do not advertise HE cap IE if HE disabled

When disabling HE due to the lack of HT/VHT, do it
at an earlier stage to avoid advertising HE capabilities IE.
Also, at this point, no need to check if AP supports HE, since
it is already checked earlier (in ieee80211_prep_channel).

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agomac80211: set STA flag DISABLE_HE if HE is not supported
Shaul Triebitz [Sat, 15 Dec 2018 09:03:19 +0000 (11:03 +0200)]
mac80211: set STA flag DISABLE_HE if HE is not supported

Up until now, the IEEE80211_STA_DISABLE_HE flag was set only based
on whether the AP has advertised HE capabilities.
This flag should be set also if STA does not support HE
(regardless of the AP support).

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agomac80211: update driver when MU EDCA params change
Shaul Triebitz [Sat, 15 Dec 2018 09:03:15 +0000 (11:03 +0200)]
mac80211: update driver when MU EDCA params change

Similar to WMM IE, if MU_EDCA IE parameters changed (or ceased to exist)
tell the Driver about it.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agomac80211: update HE operation fields to D3.0
Shaul Triebitz [Sat, 15 Dec 2018 09:03:05 +0000 (11:03 +0200)]
mac80211: update HE operation fields to D3.0

HE Operation element has changed in 11ax D3.0.  Update the fields
accordingly.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agomac80211: propagate the support for TWT to the driver
Emmanuel Grumbach [Sat, 15 Dec 2018 09:03:04 +0000 (11:03 +0200)]
mac80211: propagate the support for TWT to the driver

TWT is a feature that was added in 11ah and enhanced in
11ax. There are two bits that need to be set if we want
to use the feature in 11ax: one in the HE Capability IE
and one in the Extended Capability IE. This is because
of backward compatibility between 11ah and 11ax.

In order to simplify the flow for the low level driver
in managed mode, aggregate the two bits and add a boolean
that tells whether TWT is supported or not, but only if
11ax is supported.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agoieee80211: add bits for TWT in Extended Capabilities IE
Emmanuel Grumbach [Sat, 15 Dec 2018 09:03:03 +0000 (11:03 +0200)]
ieee80211: add bits for TWT in Extended Capabilities IE

These bits are defined in ieee802.11ax to advertise support
for TWT in addition to the bits in the HE IE.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agonl80211: Add support to notify radar event info received from STA
Sriram R [Tue, 4 Dec 2018 12:16:52 +0000 (17:46 +0530)]
nl80211: Add support to notify radar event info received from STA

Currently radar detection and corresponding channel switch is handled
at the AP device. STA ignores these detected radar events since the
radar signal can be seen mostly by the AP as well. But in scenarios where
a radar signal is seen only at STA, notifying this event to the AP which
can trigger a channel switch can be useful.
Stations can report such radar events autonomously through Spectrum
management (Measurement Report) action frame to its AP. The userspace on
processing the report can notify the kernel with the use of the added
NL80211_CMD_NOTIFY_RADAR to indicate the detected event and inturn adding
the reported channel to NOL.

Signed-off-by: Sriram R <srirrama@codeaurora.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agomac80211: don't build AMSDU from GSO packets
Sara Sharon [Sat, 15 Dec 2018 09:03:07 +0000 (11:03 +0200)]
mac80211: don't build AMSDU from GSO packets

If we build AMSDU from GSO packets, it can lead to
bad results if anyone tries to call skb_gso_segment
on the packets.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agomac80211: document RCU requirements for ieee80211_tx_dequeue()
Johannes Berg [Sat, 15 Dec 2018 09:03:08 +0000 (11:03 +0200)]
mac80211: document RCU requirements for ieee80211_tx_dequeue()

In the iwlwifi conversion, we sometimes call this from outside
of the wake_tx_queue() method, and in those cases must be in an
RCU critical section. Document this requirement.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agomac80211: remove superfluous NULL check
Johannes Berg [Sat, 15 Dec 2018 09:03:09 +0000 (11:03 +0200)]
mac80211: remove superfluous NULL check

At the place where this code lives now, the skb can never be
NULL, so we can remove the pointless NULL check.

It seems to exist because this code was moved around a few times
and originally came from a place where it could in fact be NULL.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agomac80211: never pass NULL params to ieee80211_if_add()
Johannes Berg [Sat, 15 Dec 2018 09:03:11 +0000 (11:03 +0200)]
mac80211: never pass NULL params to ieee80211_if_add()

This isn't really a problem now, but it means that the function
has a few NULL checks that are only relevant when coming from
the initial interface added in mac80211, and that's confusing.
Just pass non-NULL (but equivalently empty) in that case and
remove all the NULL checks.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agomac80211: Properly handle SKB with radiotap only
Ilan Peer [Sat, 15 Dec 2018 09:03:17 +0000 (11:03 +0200)]
mac80211: Properly handle SKB with radiotap only

The monitor interface Rx handling of SKBs that contain only
radiotap information was buggy as it tried to access the
SKB assuming it contains a frame.

To fix this, check the RX_FLAG_NO_PSDU flag in the Rx status
(indicting that the SKB contains only radiotap information),
and do not perform data path specific processing when the flag
is set.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agocfg80211: add some missing fall through annotations
Luca Coelho [Sat, 15 Dec 2018 09:03:21 +0000 (11:03 +0200)]
cfg80211: add some missing fall through annotations

There are talks about enabling -Wimplicit-fallthrough warnings in the
mainline and it is already enabled in linux-next.  Add all the
missing annotations to prevent warnings when this happens.

And in one case, remove the extra text from the annotation so that the
compiler recognizes it.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agocfg80211: clarify LCI/civic location documentation
Johannes Berg [Sat, 15 Dec 2018 09:03:23 +0000 (11:03 +0200)]
cfg80211: clarify LCI/civic location documentation

The older code and current userspace assumed that this data
is the content of the Measurement Report element, starting
with the Measurement Token. Clarify this in the documentation.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agomac80211: ftm responder: remove pointless defensive coding
Johannes Berg [Sat, 15 Dec 2018 09:03:24 +0000 (11:03 +0200)]
mac80211: ftm responder: remove pointless defensive coding

The pointer and corresponding length is always set in pairs
in cfg80211, so no need to have this strange defensive check
that also confuses static checkers. Clean it up.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agowireless: FTM: fix kernel-doc "cannot understand" warnings
Randy Dunlap [Thu, 6 Dec 2018 20:58:30 +0000 (12:58 -0800)]
wireless: FTM: fix kernel-doc "cannot understand" warnings

Fix kernel-doc warnings in FTM due to missing "struct" keyword.

Fixes 109 warnings from <net/cfg80211.h>:
../include/net/cfg80211.h:2838: warning: cannot understand function prototype: 'struct cfg80211_ftm_responder_stats '

and fixes 88 warnings from <net/mac80211.h>:
../include/net/mac80211.h:477: warning: cannot understand function prototype: 'struct ieee80211_ftm_responder_params '

Fixes: 81e54d08d9d8 ("cfg80211: support FTM responder configuration/statistics")
Fixes: bc847970f432 ("mac80211: support FTM responder configuration/statistics")

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
Cc: Johannes Berg <johannes.berg@intel.com>
Cc: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agorfkill: gpio: Remove unused include
Linus Walleij [Wed, 12 Dec 2018 09:19:50 +0000 (10:19 +0100)]
rfkill: gpio: Remove unused include

The legacy <linux/gpio.h> header is no longer in use by the
rfkill driver, so drop this include.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agomac80211_hwsim: fix overwriting of if_combination
James Prestwood [Wed, 12 Dec 2018 00:52:14 +0000 (16:52 -0800)]
mac80211_hwsim: fix overwriting of if_combination

Moved setting if_combination.num_different_channels/radar_detect_widths
into an else after use_chanctx. In the case of use_chanctx, these two
settings were getting overwritten.

Signed-off-by: James Prestwood <james.prestwood@linux.intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agonfp: flower: fix cb_ident duplicate in indirect block register
John Hurley [Tue, 18 Dec 2018 03:18:39 +0000 (19:18 -0800)]
nfp: flower: fix cb_ident duplicate in indirect block register

Previously the identifier used for indirect block callback registry and
for block rule cb registry (when done via indirect blocks) was the pointer
to the netdev we were interested in receiving updates on. This worked fine
if a single app existed that registered one callback per netdev of
interest. However, if multiple cards are in place and, in turn, multiple
apps, then each app may register the same callback with the same
identifier to both the netdev's indirect block cb list and to a block's cb
list. This can lead to EEXIST errors and/or incorrect cb deletions.

Prevent this conflict by using the app pointer as the identifier for
netdev indirect block cb registry, allowing each app to register a unique
callback per netdev. For block cb registry, the same app may register
multiple cbs to the same block if using TC shared blocks. Instead of the
app, use the pointer to the allocated cb_priv data as the identifier here.
This means that there can be a unique block callback for each app/netdev
combo.

Fixes: 3166dd07a9cb ("nfp: flower: offload tunnel decap rules via indirect TC blocks")
Reported-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: John Hurley <john.hurley@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomlxsw: spectrum: Update the supported firmware to version 13.1910.622
Shalom Toledo [Tue, 18 Dec 2018 07:31:31 +0000 (07:31 +0000)]
mlxsw: spectrum: Update the supported firmware to version 13.1910.622

This new firmware contains:
 * New packet traps for discarded packets
 * Secure firmware flash bug fix
 * Fence mechanism bug fix
 * TCAM RMA bug fix

Signed-off-by: Shalom Toledo <shalomt@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoip6mr: Drop mfc6_cache argument to ip6mr_forward2
David Ahern [Mon, 17 Dec 2018 23:36:11 +0000 (15:36 -0800)]
ip6mr: Drop mfc6_cache argument to ip6mr_forward2

mfc6_cache is not needed by ip6mr_forward2 so drop it from the input
argument list.

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoipmr: Drop mfc_cache argument to ipmr_queue_xmit
David Ahern [Mon, 17 Dec 2018 23:34:48 +0000 (15:34 -0800)]
ipmr: Drop mfc_cache argument to ipmr_queue_xmit

mfc_cache is not needed by ipmr_queue_xmit so drop it from the input
argument list.

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: dccp: initialize (addr,port) listening hashtable
Peter Oskolkov [Sun, 16 Dec 2018 23:42:48 +0000 (15:42 -0800)]
net: dccp: initialize (addr,port) listening hashtable

Commit d9fbc7f6431f "net: tcp: prefer listeners bound to an address"
removes port-only listener lookups. This caused segfaults in DCCP
lookups because DCCP did not initialize the (addr,port) hashtable.

This patch adds said initialization.

The only non-trivial issue here is the size of the new hashtable.
It seemed reasonable to make it match the size of the port-only
hashtable (= INET_LHTABLE_SIZE) that was used previously. Other
parameters to inet_hashinfo2_init() match those used in TCP.

V2 changes: marked inet_hashinfo2_init as an exported symbol
so that DCCP compiles when configured as a module.

Tested: syzcaller issues fixed; the second patch in the patchset
        tests that DCCP lookups work correctly.

Fixes: d9fbc7f6431f "net: tcp: prefer listeners bound to an address"
Reported-by: syzcaller <syzkaller@googlegroups.com>
Signed-off-by: Peter Oskolkov <posk@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'bnxt_en-next'
David S. Miller [Tue, 18 Dec 2018 07:08:54 +0000 (23:08 -0800)]
Merge branch 'bnxt_en-next'

Michael Chan says:

====================
bnxt_en: Updates for net-next.

Two main changes in this seris plus some miscellaneous changes.

1. Improvements and fixes for resource accounting which are required
for enabling SR-IOV and RDMA on the new 57500 chips.  Only SR-IOV
for 57500 chips is enabled in this series.

2. New statistics counters and improvements to keep the basic
counters and port counters during IFDOWN.

3. Msic. small changes for ETS, returning proper error codes
when flashing NVRAM, and a link speed related fix for ethtool
loopback selftest.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agobnxt_en: query force speeds before disabling autoneg mode.
Vasundhara Volam [Sun, 16 Dec 2018 23:46:31 +0000 (18:46 -0500)]
bnxt_en: query force speeds before disabling autoneg mode.

With autoneg enabled, PHY loopback test fails. To disable autoneg,
driver needs to send a valid forced speed to FW. FW is not sending
async event for invalid speeds. To fix this, query forced speeds
and send the correct speed when disabling autoneg mode.

Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agobnxt_en: Do not free port statistics buffer when device is down.
Michael Chan [Sun, 16 Dec 2018 23:46:30 +0000 (18:46 -0500)]
bnxt_en: Do not free port statistics buffer when device is down.

Port statistics which include RDMA counters are useful even when the
netdevice is down.  Do not free the port statistics DMA buffers
when the netdevice is down.  This is keep the snapshot of the port
statistics and counters will just continue counting when the
netdevice goes back up.

Split the bnxt_free_stats() function into 2 functions.  The port
statistics buffers will only be freed when the netdevice is
removed.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agobnxt_en: Save ring statistics before reset.
Michael Chan [Sun, 16 Dec 2018 23:46:29 +0000 (18:46 -0500)]
bnxt_en: Save ring statistics before reset.

With the current driver, the statistics reported by .ndo_get_stats64()
are reset when the device goes down.  Store a snapshot of the
rtnl_link_stats64 before shutdown.  This snapshot is added to the
current counters in .ndo_get_stats64() so that the counters will not
get reset when the device is down.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agobnxt_en: Return linux standard errors in bnxt_ethtool.c
Vasundhara Volam [Sun, 16 Dec 2018 23:46:28 +0000 (18:46 -0500)]
bnxt_en: Return linux standard errors in bnxt_ethtool.c

Currently firmware specific errors are returned directly in flash_device
and reset ethtool hooks. Modify it to return linux standard errors
to userspace when flashing operations fail.

Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agobnxt_en: Don't set ETS on unused TCs.
Michael Chan [Sun, 16 Dec 2018 23:46:27 +0000 (18:46 -0500)]
bnxt_en: Don't set ETS on unused TCs.

Currently, the code allows ETS bandwidth weight 0 to be set on unused TCs.
We should not set any DCB parameters on unused TCs at all.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agobnxt_en: Add ethtool -S priority counters.
Michael Chan [Sun, 16 Dec 2018 23:46:26 +0000 (18:46 -0500)]
bnxt_en: Add ethtool -S priority counters.

Display the CoS counters as additional priority counters by looking up
the priority to CoS queue mapping.  If the TX extended port statistics
block size returned by firmware is big enough to cover the CoS counters,
then we will display the new priority counters.  We call firmware to get
the up-to-date pri2cos mapping to convert the CoS counters to
priority counters.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agobnxt_en: Add SR-IOV support for 57500 chips.
Michael Chan [Sun, 16 Dec 2018 23:46:25 +0000 (18:46 -0500)]
bnxt_en: Add SR-IOV support for 57500 chips.

There are some minor differences when assigning VF resources on the
new chips.  The MSIX (NQ) resource has to be assigned and ring group
is not needed on the new chips.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agobnxt_en: Disable MSIX before re-reserving NQs/CMPL rings.
Michael Chan [Sun, 16 Dec 2018 23:46:24 +0000 (18:46 -0500)]
bnxt_en: Disable MSIX before re-reserving NQs/CMPL rings.

When bringing up a device, the code checks to see if the number of
MSIX has changed.  pci_disable_msix() should be called first before
changing the number of reserved NQs/CMPL rings.  This ensures that
the MSIX vectors associated with the NQs/CMPL rings are still
properly mapped when pci_disable_msix() masks the vectors.

This patch will prevent errors when RDMA support is added for the new
57500 chips.  When the RDMA driver shuts down, the number of NQs is
decreased and we must use the new sequence to prevent MSIX errors.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agobnxt_en: Reserve 1 stat_ctx for RDMA driver.
Vasundhara Volam [Sun, 16 Dec 2018 23:46:23 +0000 (18:46 -0500)]
bnxt_en: Reserve 1 stat_ctx for RDMA driver.

bnxt_en requires same number of stat_ctxs as CP rings but RDMA
requires only 1 stat_ctx.  Also add a new parameter resv_stat_ctxs
to better keep track of stat_ctxs reserved including resources used
by RDMA.  Add a stat_ctxs parameter to all the relevant resource
reservation functions so we can reserve the correct number of
stat_ctxs.

Prior to this patch, we were not reserving the extra stat_ctx for
RDMA and RDMA would not work on the new 57500 chips.

Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agobnxt_en: Do not modify max_stat_ctxs after RDMA driver requests/frees stat_ctxs
Vasundhara Volam [Sun, 16 Dec 2018 23:46:22 +0000 (18:46 -0500)]
bnxt_en: Do not modify max_stat_ctxs after RDMA driver requests/frees stat_ctxs

Calling bnxt_set_max_func_stat_ctxs() to modify max stat_ctxs requested
or freed by the RDMA driver is wrong. After introducing reservation of
resources recently, the driver has to keep track of all stat_ctxs
including the ones used by the RDMA driver.  This will provide a better
foundation for accurate accounting of the stat_ctxs.

Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agobnxt_en: get rid of num_stat_ctxs variable
Vasundhara Volam [Sun, 16 Dec 2018 23:46:21 +0000 (18:46 -0500)]
bnxt_en: get rid of num_stat_ctxs variable

For bnxt_en driver, stat_ctxs created will always be same as
cp_nr_rings. Remove extra variable that duplicates the value.
Also introduce bnxt_get_avail_stat_ctxs_for_en() helper to get
available stat_ctxs and bnxt_get_ulp_stat_ctxs() helper to return
number of stat_ctxs used by RDMA.

Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agobnxt_en: Add bnxt_get_avail_cp_rings_for_en() helper function.
Michael Chan [Sun, 16 Dec 2018 23:46:20 +0000 (18:46 -0500)]
bnxt_en: Add bnxt_get_avail_cp_rings_for_en() helper function.

The available CP rings are calculated differently on the new 57500
chips, so add this helper to do this calculation correctly.  The
VFs will be assigned these available CP rings.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agobnxt_en: Store the maximum NQs available on the PF.
Michael Chan [Sun, 16 Dec 2018 23:46:19 +0000 (18:46 -0500)]
bnxt_en: Store the maximum NQs available on the PF.

The PF has a pool of NQs and MSIX vectors assigned to it based on
NVRAM configurations.  The number of usable MSIX vectors on the PF
is the minimum of the NQs and MSIX vectors.  Any excess NQs without
associated MSIX may be used for the VFs, so we need to store this
max_nqs value.  max_nqs minus the NQs used by the PF will be the
available NQs for the VFs.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agofou: Prevent unbounded recursion in GUE error handler
Stefano Brivio [Mon, 17 Dec 2018 23:13:17 +0000 (00:13 +0100)]
fou: Prevent unbounded recursion in GUE error handler

Handling exceptions for direct UDP encapsulation in GUE (that is,
UDP-in-UDP) leads to unbounded recursion in the GUE exception handler,
syzbot reported.

While draft-ietf-intarea-gue-06 doesn't explicitly forbid direct
encapsulation of UDP in GUE, it probably doesn't make sense to set up GUE
this way, and it's currently not even possible to configure this.

Skip exception handling if the GUE proto/ctype field is set to the UDP
protocol number. Should we need to handle exceptions for UDP-in-GUE one
day, we might need to either explicitly set a bound for recursion, or
implement a special iterative handling for these cases.

Reported-and-tested-by: syzbot+43f6755d1c2e62743468@syzkaller.appspotmail.com
Fixes: b8a51b38e4d4 ("fou, fou6: ICMP error handlers for FoU and GUE")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoucc_geth: Add change_carrier() for Fixed PHYs
Joakim Tjernlund [Fri, 14 Dec 2018 14:17:08 +0000 (15:17 +0100)]
ucc_geth: Add change_carrier() for Fixed PHYs

This allows to control carrier from /sys/class/net/ethX/carrier
for Fixed PHYs.

Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agogianfar: Add change_carrier() for Fixed PHYs
Joakim Tjernlund [Fri, 14 Dec 2018 14:17:07 +0000 (15:17 +0100)]
gianfar: Add change_carrier() for Fixed PHYs

This allows to control carrier from /sys/class/net/ethX/carrier
for Fixed PHYs.

Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agodpaa_eth: Add change_carrier() for Fixed PHYs
Joakim Tjernlund [Fri, 14 Dec 2018 14:17:06 +0000 (15:17 +0100)]
dpaa_eth: Add change_carrier() for Fixed PHYs

This allows to control carrier from /sys/class/net/ethX/carrier
for Fixed PHYs.

Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoFixed PHY: Add fixed_phy_change_carrier()
Joakim Tjernlund [Fri, 14 Dec 2018 14:17:05 +0000 (15:17 +0100)]
Fixed PHY: Add fixed_phy_change_carrier()

Drivers can use this as .ndo_change_carrier() to change carrier
via /sys/class/net/ethX/carrier.

Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/mlx4_en: remove fallback after kzalloc_node()
Eric Dumazet [Thu, 13 Dec 2018 11:03:37 +0000 (03:03 -0800)]
net/mlx4_en: remove fallback after kzalloc_node()

kzalloc_node(..., GFP_KERNEL, node) will attempt to allocate
memory as close as possible to the node.

There is no need to fallback to kzalloc() if this has failed.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/mlx5e: Add some ethtool port control entries to the uplink rep netdev
Or Gerlitz [Tue, 6 Nov 2018 17:49:22 +0000 (19:49 +0200)]
net/mlx5e: Add some ethtool port control entries to the uplink rep netdev

Some of the ethtool entries to control the port should be supported by
the uplink rep netdev in switchdev mode, add them.

While here, add also the get/set coalesce entries for all reps.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
5 years agonet/mlx5e: Expose ethtool pause and link functions to mlx5e callers
Or Gerlitz [Tue, 6 Nov 2018 17:31:10 +0000 (19:31 +0200)]
net/mlx5e: Expose ethtool pause and link functions to mlx5e callers

Towards supporting set/get of global pause for the port
and get of the port link ksetting from the uplink representor,
expose the relevant entries to other mlx5 callers.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
5 years agonet/mlx5e: Add sriov and udp tunnel ndo support for the uplink rep
Or Gerlitz [Thu, 1 Nov 2018 17:14:21 +0000 (19:14 +0200)]
net/mlx5e: Add sriov and udp tunnel ndo support for the uplink rep

Some of the sriov ndo calls are needed also on the switchdev mode -
e.g setup VF mac and reading vport stats. Add them to the uplink rep
netdev ops. Same for the UDP tunnel ones, need them there to identify
offloaded udp tunnel ports.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
5 years agonet/mlx5e: Handle port mtu/link, dcb and lag for uplink reps
Or Gerlitz [Thu, 8 Nov 2018 18:42:55 +0000 (20:42 +0200)]
net/mlx5e: Handle port mtu/link, dcb and lag for uplink reps

Take care of setup/teardown for the port link, dcb, lag as well as
dealing with port mtu and carrier for e-switch uplink representors.

This is achieved by adding a dedicated profile instance for uplink
representors which includes the enable/disable and more profile routines
which are invoked by the general mlx5e code for netdev attach/detach.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
5 years agonet/mlx5e: Uninstantiate esw manager vport netdev on switchdev mode
Or Gerlitz [Wed, 7 Nov 2018 14:34:52 +0000 (16:34 +0200)]
net/mlx5e: Uninstantiate esw manager vport netdev on switchdev mode

Now, when we have a dedicated uplink representor, the netdev instance
set over the esw manager vport (PF) is of no-use. As such, remove it
once we're on switchdev mode and get it back to life when off switchdev.

This is done by reloading the Ethernet interface as well (we already
do that for the IB interface) from the eswitch code while going in/out
of switchdev mode.

The Eth add/remove entries are modified to act differently when called in
switchdev mode. In this case we only deal with registration of the eth
vport representors. The rep netdevices are created from the eswitch call
to load the registered eth representors.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
5 years agonet/mlx5e: Remove leftover code from the PF netdev being uplink rep
Or Gerlitz [Tue, 13 Feb 2018 16:14:42 +0000 (18:14 +0200)]
net/mlx5e: Remove leftover code from the PF netdev being uplink rep

Remove some last leftovers from using the PF netdev as
the e-switch uplink representor.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
5 years agonet/mlx5e: Use dedicated uplink vport netdev representor
Or Gerlitz [Tue, 13 Feb 2018 13:48:30 +0000 (15:48 +0200)]
net/mlx5e: Use dedicated uplink vport netdev representor

Currently, when running in sriov switchdev mode, we are using the PF
netdevice as the uplink representor, this is problematic from few aspects:

- will break when the PF isn't eswitch manager (e.g smart NIC env)
- misalignment with other NIC switchdev drivers
- makes us have and maintain special code, hurts the driver quality/robustness
- which in turn opens the door for future bugs

As of each and all of the above, we move to have a dedicated netdev representor
for the uplink vport in a similar manner done for for the VF vports.

This includes the following:

1. have an uplink rep netdev as we have for VF reps
2. all reps use same load/unload functions
3. HW stats for uplink based on physical port counters and not vport counters
4. link state for the uplink managed through PAOS and not vport state
5. the uplink rep has sysfs link to the PF PCI function && uses the PF MAC address

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
5 years agonet/mlx5e: Use single argument for the esw representor build params helper
Or Gerlitz [Wed, 28 Nov 2018 16:56:41 +0000 (18:56 +0200)]
net/mlx5e: Use single argument for the esw representor build params helper

This is prep step towards adding dedicated uplink representor.

The patch doesn't change any functionality.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
5 years agonet/mlx5: E-Switch, Remove redundant reloading of the IB interface
Or Gerlitz [Tue, 13 Nov 2018 09:09:30 +0000 (11:09 +0200)]
net/mlx5: E-Switch, Remove redundant reloading of the IB interface

The reload of the IB interface done on the offloads stop call is
redundant b/c we do that on mlx5_eswitch_disable_sriov(), remove it.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
5 years agonet: unbreak CONFIG_RETPOLINE=n builds
Paolo Abeni [Mon, 17 Dec 2018 11:39:02 +0000 (12:39 +0100)]
net: unbreak CONFIG_RETPOLINE=n builds

The kbuild bot reported a build breakage with CONFIG_RETPOLINE=n
due to commit aaa5d90b395a ("net: use indirect call wrappers at
GRO network layer").
I screwed the wrapper implementation for such config.
Fix the issue properly ignoring the builtin symbols arguments,
when retpoline is not enabled.

Reported-by: kbuild test robot <lkp@intel.com>
Fixes: aaa5d90b395a ("net: use indirect call wrappers at GRO network layer")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'mlxsw-spectrum_acl-Add-Bloom-filter-support'
David S. Miller [Sun, 16 Dec 2018 23:20:35 +0000 (15:20 -0800)]
Merge branch 'mlxsw-spectrum_acl-Add-Bloom-filter-support'

Ido Schimmel says:

====================
mlxsw: spectrum_acl: Add Bloom filter support

Nir says:

Spectrum-2 uses Bloom filter to reduce the number of lookups in the
algorithmic TCAM (A-TCAM). HW performs multiple exact match lookups in a
given region using a key composed of { packet & mask, mask ID, region ID }.
The masks which are used in a region are called rule patterns or RP.
When such multiple masks are used, the A-TCAM region uses an eRP
(extended RP) table that describes which rule patterns are in use and
defines the order of the lookup. When eRP table is used in a region, one
way to reduce the number of the lookups is to consult a Bloom filter
before doing the lookup.

A Bloom filter is a space-efficient probabilistic data structure, on
which a query returns either "possibly in set" or "definitely not in
set". HW can skip a lookup if a query on the Bloom filter results a
"definitely not set" response. The mlxsw driver implements a "counting
filter" and when either a new entry is marked or the last entry is
removed it will update the HW. Update of this counting filter occurs
when rule is configured or deleted from a region.

Patch #1 adds PEABFE register which is used for setting Bloom filter
entries.

Patch #2 adds Bloom filter resources.

Patch #3 and patch #4 provide Bloom filter handling within mlxsw, by
adding initialization and logic for updating the Bloom bit vector in HW.

Patch #5 and patch #6 add required calls for Bloom filter update as part
of rule configuration flow.

Patch #7 handles transitions to and from eRP table. It uses a list to
keep A-TCAM rules in order to update rules in Bloom filter, in cases of
transitions from master mask based A-TCAM region to an eRP table based
region and vice versa.

Patch #8 removes a trick done on master RP index to a remaining RP,
since Bloom filter is updated on eRP transitions.

Finally, patch #9 activates Bloom filter mechanism in HW, by cancelling
the bypass that was configured before and the remaining three patches
are selftests that exercise the new code.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoselftests: mlxsw: Add Bloom delta test
Nir Dotan [Sun, 16 Dec 2018 08:49:37 +0000 (08:49 +0000)]
selftests: mlxsw: Add Bloom delta test

The eRP table is active when there is more than a single rule
pattern. It may be that the patterns are close enough and use delta
mechanism. Bloom filter index computation is based on the values of
{rule & mask, mask ID, region ID} where the rule delta bits must be
cleared.

Add a test that exercises Bloom filter with delta mechanism.
Configure rules within delta range and pass a packet which is
supposed to hit the correct rule.

Signed-off-by: Nir Dotan <nird@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoselftests: mlxsw: Add Bloom filter complex test
Nir Dotan [Sun, 16 Dec 2018 08:49:36 +0000 (08:49 +0000)]
selftests: mlxsw: Add Bloom filter complex test

Bloom filter index computation is based on the values of
{rule & mask, mask ID, region ID} and the computation also varies
according to the region key size.

Add a test that exercises the possible combinations by creating
multiple chains using different key sizes and then pass a frame that
is supposed to to produce a hit on all of the regions.

Signed-off-by: Nir Dotan <nird@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoselftests: mlxsw: Add Bloom filter simple test
Nir Dotan [Sun, 16 Dec 2018 08:49:35 +0000 (08:49 +0000)]
selftests: mlxsw: Add Bloom filter simple test

Add a test that exercises Bloom filter code.
Activate eRP table in the region by adding multiple rule patterns which
with very high probability use different entries in the Bloom filter.
Then send packets in order to check lookup hits on all relevant rules.

Signed-off-by: Nir Dotan <nird@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomlxsw: reg: Activate Bloom filter
Nir Dotan [Sun, 16 Dec 2018 08:49:34 +0000 (08:49 +0000)]
mlxsw: reg: Activate Bloom filter

Now that mlxsw driver handles all aspects of updating
the Bloom filter mechanism, set bf_bypass value to false
and allow HW to use Bloom filter.

Signed-off-by: Nir Dotan <nird@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomlxsw: spectrum_acl: Set master RP index on transition to eRP
Nir Dotan [Sun, 16 Dec 2018 08:49:33 +0000 (08:49 +0000)]
mlxsw: spectrum_acl: Set master RP index on transition to eRP

Bloom filter is updated on transitions from a single rule pattern,
also called master RP, to eRP table and vice versa. Since rules are
being written to or deleted from the Bloom filter on such transitions,
it is not required to keep the same eRP bank ID for the master RP.

Change master RP index assignment so it will be assigned with zero.
This is consistent with the assignment of the first available spot
that is used for allocating eRP's indices.

Signed-off-by: Nir Dotan <nird@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomlxsw: spectrum_acl: Update Bloom filter on eRP transitions
Nir Dotan [Sun, 16 Dec 2018 08:49:32 +0000 (08:49 +0000)]
mlxsw: spectrum_acl: Update Bloom filter on eRP transitions

Bloom filter update is required only for rules which reside on an
eRP. When the region has only a single rule pattern then eRP table
is not used, however insertion of another pattern would trigger a
move to an active eRP table so it is imperative to update the Bloom
filter with all previously configured rules.

Add a method that updates Bloom filter entries for all rules
currently configured in the region, on the event of a transition
from master mask to eRP, or vice versa. For that purpose, maintain
a list of all A-TCAM rules within mlxsw_sp_acl_atcam_region.

Signed-off-by: Nir Dotan <nird@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomlxsw: spectrum_acl: Set A-TCAM rules in Bloom filter
Nir Dotan [Sun, 16 Dec 2018 08:49:30 +0000 (08:49 +0000)]
mlxsw: spectrum_acl: Set A-TCAM rules in Bloom filter

Add calls to eRP module for updating Bloom filter when a rule is
added or removed from the A-TCAM. eRP module will update the Bloom
filter only for cases in which the region has an active eRP table.

Signed-off-by: Nir Dotan <nird@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomlxsw: spectrum_acl: Add Bloom filter update
Nir Dotan [Sun, 16 Dec 2018 08:49:29 +0000 (08:49 +0000)]
mlxsw: spectrum_acl: Add Bloom filter update

Add Bloom filter update for rule insertion and rule removal scenarios.
This is done within eRP module in order to assure that Bloom filter
updates are done only for rules which are part of an eRP, as HW does not
consult Bloom filter for entries when there is a single (master) mask in
the region.

Signed-off-by: Nir Dotan <nird@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomlxsw: spectrum_acl: Add Bloom filter handling
Nir Dotan [Sun, 16 Dec 2018 08:49:28 +0000 (08:49 +0000)]
mlxsw: spectrum_acl: Add Bloom filter handling

Spectrum-2 HW uses Bloom filter in order to skip lookups on specific
eRPs. It uses crc-16-Msbit-first calculation over a specific layout
of a rule's key fields combined with eRP ID as well as region ID.
Per potential lookup, iff the Bloom filter entry of the calculated
index is empty, then the lookup can be skipped. Hence, the mlxsw
driver should update the Bloom filter entry per each rule insertion
or deletion when rules are part of an eRP.

Add functions for adding and deleting entries in the Bloom filter.
In order to do so also add crc-16 computation based on the specific
Spectrum-2 polynomial and a function for encoding the crc-16 input
in the manner dictated by HW implementation.

Signed-off-by: Nir Dotan <nird@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomlxsw: spectrum_acl: Introduce Bloom filter
Nir Dotan [Sun, 16 Dec 2018 08:49:26 +0000 (08:49 +0000)]
mlxsw: spectrum_acl: Introduce Bloom filter

Lay the foundations for Bloom filter handling. Introduce a new file for
Bloom filter actions.

Add struct mlxsw_sp_acl_bf to struct mlxsw_sp_acl_erp_core and initialize
the Bloom filter data structure. Also take care of proper destruction when
terminating.

Signed-off-by: Nir Dotan <nird@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomlxsw: resources: Add Spectrum-2 Bloom filter resource
Nir Dotan [Sun, 16 Dec 2018 08:49:25 +0000 (08:49 +0000)]
mlxsw: resources: Add Spectrum-2 Bloom filter resource

Add the maximum Bloom filter logarithmic size per eRP table bank.

Signed-off-by: Nir Dotan <nird@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomlxsw: reg: Add Policy Engine Algorithmic Bloom Filter Entries Register
Nir Dotan [Sun, 16 Dec 2018 08:49:24 +0000 (08:49 +0000)]
mlxsw: reg: Add Policy Engine Algorithmic Bloom Filter Entries Register

Bloom filter is a bit vector which allows the HW a fast lookup on a
small size bit vector, that may reduce the number of lookups on the
A-TCAM memory. PEABFE register allows setting values to the bits of
the bit vector mentioned above.
Add the register to be later used in A-TCAM optimizations.

Signed-off-by: Nir Dotan <nird@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'rtnl-fdb-get'
David S. Miller [Sun, 16 Dec 2018 22:42:35 +0000 (14:42 -0800)]
Merge branch 'rtnl-fdb-get'

Roopa Prabhu says:

====================
rtnl fdb get

This series adds support for rtnl fdb get similar to
route get.

v2: add nda_policy, fixes to exact msgs, strict nlmsg parsing

v3: remove unnecessary attribute length checks + simplify code
as pointed out by david
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoselftests: net: rtnetlink.sh: add fdb get test
Roopa Prabhu [Sun, 16 Dec 2018 06:35:11 +0000 (22:35 -0800)]
selftests: net: rtnetlink.sh: add fdb get test

tests the below three cases of bridge fdb get:
[bridge, mac, vlan]
[bridge_port, mac, vlan, flags=[NTF_MASTER]]
[vxlandev, mac, flags=NTF_SELF]

depends on iproute2 support for bridge fdb get.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agovxlan: support for ndo_fdb_get
Roopa Prabhu [Sun, 16 Dec 2018 06:35:10 +0000 (22:35 -0800)]
vxlan: support for ndo_fdb_get

This patch implements ndo_fdb_get for a vxlan device.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Reviewed-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agobridge: support for ndo_fdb_get
Roopa Prabhu [Sun, 16 Dec 2018 06:35:09 +0000 (22:35 -0800)]
bridge: support for ndo_fdb_get

This patch implements ndo_fdb_get for the bridge
fdb.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Reviewed-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>