openwrt/staging/blogic.git
4 years agortw88: use shorter delay time to poll PS state
Yan-Hsuan Chuang [Tue, 7 Jan 2020 14:27:29 +0000 (22:27 +0800)]
rtw88: use shorter delay time to poll PS state

When TX packet arrives, driver should leave deep PS state to make
sure the DMA is working. After requested to leave deep PS state,
driver needs to poll the PS state to check if the mode has been
changed successfully. The driver used to check the state of the
hardware every 20 msecs, which means upon the first failure of
state check, the CPU is delayed 20 msecs for next check. This is
harmful for some time-sensitive applications such as media players.

So, use shorter delay time each check from 20 msecs to 100 usecs.
The state should be changed in several tries. But we still need
to reserve ~15 msecs in total in case of the state just took too
long to be changed successfully. If the states of driver and the
hardware is not synchronized, the power state could be locked
forever, which mean we could never enter/leave the PS state.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Reviewed-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: fix potential NULL skb access in TX ISR
Yan-Hsuan Chuang [Tue, 7 Jan 2020 08:08:07 +0000 (16:08 +0800)]
rtw88: fix potential NULL skb access in TX ISR

Sometimes the TX queue may be empty and we could possible
dequeue a NULL pointer, crash the kernel. If the skb is NULL
then there is nothing to do, just leave the ISR.

And the TX queue should not be empty here, so print an error
to see if there is anything wrong for DMA ring.

Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver")
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agobrcmfmac: add initial support for monitor mode
Rafał Miłecki [Thu, 26 Dec 2019 13:30:50 +0000 (14:30 +0100)]
brcmfmac: add initial support for monitor mode

Report monitor interface availability using cfg80211 and support it in
the add_virtual_intf() and del_virtual_intf() callbacks. This new
feature is conditional and depends on firmware flagging monitor packets.
Receiving monitor frames is already handled by the brcmf_netif_mon_rx().

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agobrcmfmac: simplify building interface combinations
Rafał Miłecki [Thu, 26 Dec 2019 13:30:49 +0000 (14:30 +0100)]
brcmfmac: simplify building interface combinations

Move similar/duplicated code out of combination specific code blocks.
This simplifies code a bit and allows adding more combinations later.
A list of combinations remains unchanged.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agobrcmfmac: sdio: Fix OOB interrupt initialization on brcm43362
Jean-Philippe Brucker [Thu, 26 Dec 2019 09:20:33 +0000 (10:20 +0100)]
brcmfmac: sdio: Fix OOB interrupt initialization on brcm43362

Commit 262f2b53f679 ("brcmfmac: call brcmf_attach() just before calling
brcmf_bus_started()") changed the initialization order of the brcmfmac
SDIO driver. Unfortunately since brcmf_sdiod_intr_register() is now
called before the sdiodev->bus_if initialization, it reads the wrong
chip ID and fails to initialize the GPIO on brcm43362. Thus the chip
cannot send interrupts and fails to probe:

[   12.517023] brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout
[   12.531214] ieee80211 phy0: brcmf_bus_started: failed: -110
[   12.536976] ieee80211 phy0: brcmf_attach: dongle is not responding: err=-110
[   12.566467] brcmfmac: brcmf_sdio_firmware_callback: brcmf_attach failed

Initialize the bus interface earlier to ensure that
brcmf_sdiod_intr_register() properly sets up the OOB interrupt.

BugLink: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=908438
Fixes: 262f2b53f679 ("brcmfmac: call brcmf_attach() just before calling brcmf_bus_started()")
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agobrcmfmac: use true,false for bool variable
zhengbin [Tue, 24 Dec 2019 14:16:06 +0000 (22:16 +0800)]
brcmfmac: use true,false for bool variable

Fixes coccicheck warning:

drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c:911:2-24: WARNING: Assignment of 0/1 to bool variable

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agocw1200: use true,false for bool variable
zhengbin [Tue, 24 Dec 2019 14:16:02 +0000 (22:16 +0800)]
cw1200: use true,false for bool variable

Fixes coccicheck warning:

drivers/net/wireless/st/cw1200/txrx.c:718:6-16: WARNING: Assignment of 0/1 to bool variable

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: use true,false for bool variable
zhengbin [Tue, 24 Dec 2019 14:16:01 +0000 (22:16 +0800)]
rtw88: use true,false for bool variable

Fixes coccicheck warning:

drivers/net/wireless/realtek/rtw88/phy.c:1437:1-24: WARNING: Assignment of 0/1 to bool variable

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortlwifi: rtl8821ae: Make functions static & rm sw.h
Amadeusz Sławiński [Mon, 23 Dec 2019 12:37:15 +0000 (13:37 +0100)]
rtlwifi: rtl8821ae: Make functions static & rm sw.h

Some of functions which were exposed in sw.h, are only used in sw.c, so
just make them static. This makes sw.h unnecessary, so remove it.

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortlwifi: rtl8723be: Make functions static & rm sw.h
Amadeusz Sławiński [Mon, 23 Dec 2019 12:37:14 +0000 (13:37 +0100)]
rtlwifi: rtl8723be: Make functions static & rm sw.h

Some of functions which were exposed in sw.h, are only used in sw.c, so
just make them static. This makes sw.h unnecessary, so remove it.

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortlwifi: rtl8723ae: Make functions static & rm sw.h
Amadeusz Sławiński [Mon, 23 Dec 2019 12:37:13 +0000 (13:37 +0100)]
rtlwifi: rtl8723ae: Make functions static & rm sw.h

Some of functions which were exposed in sw.h, are only used in sw.c, so
just make them static. This makes sw.h unnecessary, so remove it.

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortlwifi: rtl8192se: Remove sw.h header
Amadeusz Sławiński [Mon, 23 Dec 2019 12:37:12 +0000 (13:37 +0100)]
rtlwifi: rtl8192se: Remove sw.h header

It has one define, which is already defined in include from reg.h.
All the declared functions are not implemented anywhere, sw.c has
ones with similar names which are already static.

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortlwifi: rtl8192ee: Make functions static & rm sw.h
Amadeusz Sławiński [Mon, 23 Dec 2019 12:37:11 +0000 (13:37 +0100)]
rtlwifi: rtl8192ee: Make functions static & rm sw.h

Some of functions which were exposed in sw.h, are only used in sw.c, so
just make them static. This makes sw.h unnecessary, so remove it.

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortlwifi: rtl8192cu: Remove sw.h header
Amadeusz Sławiński [Mon, 23 Dec 2019 12:37:10 +0000 (13:37 +0100)]
rtlwifi: rtl8192cu: Remove sw.h header

It has one define, which is already defined in include from reg.h.
All functions are declared in their own headers and included in *.c
files belonging to them.
This makes sw.h unnecessary, so we can remove it.

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortlwifi: rtl8192ce: Make functions static & rm sw.h
Amadeusz Sławiński [Mon, 23 Dec 2019 12:37:09 +0000 (13:37 +0100)]
rtlwifi: rtl8192ce: Make functions static & rm sw.h

Some of functions which were exposed in sw.h, are only used in sw.c, so
just make them static. The rtl92c_init_var_map function is not defined
anywhere, while declared in sw.h. Two other functions are also declared
in phy.h (which is included in sw.c) and their definitions are in phy.c
Overall sw.h is unnecessary and can be removed.

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortlwifi: rtl8188ee: Make functions static & rm sw.h
Amadeusz Sławiński [Mon, 23 Dec 2019 12:37:08 +0000 (13:37 +0100)]
rtlwifi: rtl8188ee: Make functions static & rm sw.h

Some of functions which were exposed in sw.h, are only used in sw.c, so
just make them static. This makes sw.h unnecessary, so remove it.

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortlwifi: rtl8192cu: Fix typo
Amadeusz Sławiński [Mon, 23 Dec 2019 12:37:07 +0000 (13:37 +0100)]
rtlwifi: rtl8192cu: Fix typo

Replace USB_VENDER_ID_REALTEK with USB_VENDOR_ID_REALTEK.

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: change max_num_of_tx_queue() definition to inline in pci.h
Zong-Zhe Yang [Fri, 20 Dec 2019 09:21:56 +0000 (17:21 +0800)]
rtw88: change max_num_of_tx_queue() definition to inline in pci.h

It's more reasonable to define max_num_of_tx_queue() as an inline function.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: assign NULL to skb after being kfree()'ed
Yan-Hsuan Chuang [Fri, 20 Dec 2019 09:21:55 +0000 (17:21 +0800)]
rtw88: assign NULL to skb after being kfree()'ed

Should assign NULL to skb after kfree(), in case of driver
trying to free the same skb again.

This could happen if driver failed to allocate an skb when
building reserved page.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: use rtw_hci_stop() instead of rtwdev->hci.ops->stop()
Chin-Yen Lee [Fri, 20 Dec 2019 09:21:54 +0000 (17:21 +0800)]
rtw88: use rtw_hci_stop() instead of rtwdev->hci.ops->stop()

Fix typo, should use rtw_hci_stop()

Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: remove unused vif pointer in struct rtw_vif
Yan-Hsuan Chuang [Fri, 20 Dec 2019 09:21:53 +0000 (17:21 +0800)]
rtw88: remove unused vif pointer in struct rtw_vif

As driver can easily get vif with container_of(), we can
just remove it.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: remove unused variable 'in_lps'
Yan-Hsuan Chuang [Fri, 20 Dec 2019 09:21:52 +0000 (17:21 +0800)]
rtw88: remove unused variable 'in_lps'

Unused, will not be used neither, because the hardware/firmware
can only support one vif for LPS currnetly. If there's more than
one vif, than driver will never enter LPS. So remove it.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: remove unused spinlock
Tzu-En Huang [Fri, 20 Dec 2019 09:21:51 +0000 (17:21 +0800)]
rtw88: remove unused spinlock

dm_lock is never used. Thus, remove this redundant spinlock.

Signed-off-by: Tzu-En Huang <tehuang@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: 8822c: update power sequence to v15
Tzu-En Huang [Fri, 20 Dec 2019 09:21:49 +0000 (17:21 +0800)]
rtw88: 8822c: update power sequence to v15

Update card enable power sequence flow, to fix CMD11 fail after
reboot and wrong PLL clock.

Signed-off-by: Tzu-En Huang <tehuang@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: fix TX secondary channel offset of 40M if current bw is 20M or 40M
Ping-Ke Shih [Fri, 20 Dec 2019 09:21:47 +0000 (17:21 +0800)]
rtw88: fix TX secondary channel offset of 40M if current bw is 20M or 40M

TX secondary channel offset is valid only if current bandwidth is 80M,
otherwise leave this value as zero. The wrong value of txsc40 causes
MAC unpredictable behavior.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: fix rate mask for 1SS chip
Ping-Ke Shih [Fri, 20 Dec 2019 09:21:46 +0000 (17:21 +0800)]
rtw88: fix rate mask for 1SS chip

The rate mask is used to tell firmware the supported rate depends on
negotiation. We loop 2 times for all VHT/HT 2SS rate mask first, and then
only keep the part according to chip's NSS.

This commit fixes the logic error of '&' operations for VHT/HT rate, and
we should run this logic before adding legacy rate.

To access HT MCS map, index 0/1 represent MCS 0-7/8-15 respectively. Use
NL80211_BAND_xxx is incorrect, so fix it as well.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Reviewed-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: Add wowlan net-detect support
Chin-Yen Lee [Thu, 19 Dec 2019 08:58:16 +0000 (16:58 +0800)]
rtw88: Add wowlan net-detect support

Net-detect is an option of wowlan to allow the device to
be woken up from suspend mode when configured network is detected.

When user enables net-detect and lets the device enter suspend
state, wowlan firmware will periodically scan until beacon or
probe response of configured networks are received.
Between two scans, wowlan firmware keeps wifi chip in idle mode
to reduce power consumption. If configured networks are detected,
wowlan firmware will trigger resume process.

Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: Add wowlan pattern match support
Chin-Yen Lee [Thu, 19 Dec 2019 08:58:15 +0000 (16:58 +0800)]
rtw88: Add wowlan pattern match support

Pattern match is an option of wowlan to allow the device
to be woken up from suspend mode when receiving packets
matched user-designed patterns.

The patterns are written into hardware cam in suspend flow
if users have set up them. If packets matched designed
pattern are received, wowlan firmware will get an interrupt
and then wake up the device.

Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: support wowlan feature for 8822c
Chin-Yen Lee [Thu, 19 Dec 2019 08:58:14 +0000 (16:58 +0800)]
rtw88: support wowlan feature for 8822c

Wake on WLAN(wowlan) is a feature which allows devices
to be woken up from suspend state through wlan events.

When user enables wowlan feature and then let the device
enter suspend state, wowlan firmware will be loaded by
the driver and periodically monitors wifi packets.
Power consumption of wifi chip will be reduced in this
state.

If wowlan firmware detects that specific wlan event
happens, it will issue wakeup signal to trigger resume
process. Driver will load normal firmware and let wifi
chip return to the original state.

Currently supported wlan events include receiving magic packet,
rekey packet and deauth packet, and disconnecting from AP.

Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: load wowlan firmware if wowlan is supported
Chin-Yen Lee [Thu, 19 Dec 2019 08:58:13 +0000 (16:58 +0800)]
rtw88: load wowlan firmware if wowlan is supported

Driver used to download normal firmware only,
but some devices support wowlan and require to
download wowlan firmware when system suspends.
So modify rtw_load_firmware() and its callback to
allow driver to download both normal and wowlan firmware.

Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: add interface config for 8822c
Yan-Hsuan Chuang [Thu, 19 Dec 2019 08:58:12 +0000 (16:58 +0800)]
rtw88: add interface config for 8822c

Some devices need to configure interface/HCI related reigsters
in power on flow. Add interface_cfg for HCI for the settings.

The driver only supports RTL8822BE/RTL8822CE now, and since
RTL8822BE does not need to configure PCIE, the configuration
is only added for RTL8822CE. Without it, some of the RTL8822CE
device can crash and disconnected to host in suspend/wowlan mode.

Signed-off-by: Tzu-En Huang <tehuang@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: pci: reset dma when reset pci trx ring
Chin-Yen Lee [Thu, 19 Dec 2019 08:58:11 +0000 (16:58 +0800)]
rtw88: pci: reset dma when reset pci trx ring

When PCI trx rings are reset, the DMA engine should also be reset.
Otherswise, the rx_tag of rx flow is not synchronous to hw.

Remove DMA reset when rtw_pci_start() as we added it in
rtw_pci_setup().

Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Reviewed-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: pci: reset ring index when release skbs in tx ring
Chin-Yen Lee [Thu, 19 Dec 2019 08:58:10 +0000 (16:58 +0800)]
rtw88: pci: reset ring index when release skbs in tx ring

When skbs queued for each TX ring are relased in PCI stop flow,
the ring index should be reset at the same time.

Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agohostap: Adjust indentation in prism2_hostapd_add_sta
Nathan Chancellor [Wed, 18 Dec 2019 01:15:46 +0000 (18:15 -0700)]
hostap: Adjust indentation in prism2_hostapd_add_sta

Clang warns:

../drivers/net/wireless/intersil/hostap/hostap_ap.c:2511:3: warning:
misleading indentation; statement is not part of the previous 'if'
[-Wmisleading-indentation]
        if (sta->tx_supp_rates & WLAN_RATE_5M5)
        ^
../drivers/net/wireless/intersil/hostap/hostap_ap.c:2509:2: note:
previous statement is here
        if (sta->tx_supp_rates & WLAN_RATE_2M)
        ^
1 warning generated.

This warning occurs because there is a space before the tab on this
line. Remove it so that the indentation is consistent with the Linux
kernel coding style and clang no longer warns.

Fixes: ff1d2767d5a4 ("Add HostAP wireless driver.")
Link: https://github.com/ClangBuiltLinux/linux/issues/813
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agowlcore: mesh: Add support for RX Broadcast Key
Maital Hahn [Thu, 16 Jan 2020 14:33:53 +0000 (08:33 -0600)]
wlcore: mesh: Add support for RX Broadcast Key

In order to support authentication of equals peers,
need to save RX Broadcast key per peer (on top of 1 TX broadcast key
and unicast key per peer).

Signed-off-by: Maital Hahn <maitalm@ti.com>
Acked-by: Guy Mishol <guym@ti.com>
Signed-off-by: Hari Nagalla <hnagalla@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agoMAINTAINERS: update for mwifiex driver maintainers
Ganapathi Bhat [Mon, 13 Jan 2020 10:42:46 +0000 (10:42 +0000)]
MAINTAINERS: update for mwifiex driver maintainers

Remove Nishant Sarmukadam from Maintainer list, as he is no
longer working in NXP.

Signed-off-by: Ganapathi Bhat <ganapathi.bhat@nxp.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agomwifiex: drop most magic numbers from mwifiex_process_tdls_action_frame()
Brian Norris [Fri, 6 Dec 2019 19:45:35 +0000 (11:45 -0800)]
mwifiex: drop most magic numbers from mwifiex_process_tdls_action_frame()

Before commit 1e58252e334d ("mwifiex: Fix heap overflow in
mmwifiex_process_tdls_action_frame()"),
mwifiex_process_tdls_action_frame() already had too many magic numbers.
But this commit just added a ton more, in the name of checking for
buffer overflows. That seems like a really bad idea.

Let's make these magic numbers a little less magic, by
(a) factoring out 'pos[1]' as 'ie_len'
(b) using 'sizeof' on the appropriate source or destination fields where
    possible, instead of bare numbers
(c) dropping redundant checks, per below.

Regarding redundant checks: the beginning of the loop has this:

                if (pos + 2 + pos[1] > end)
                        break;

but then individual 'case's include stuff like this:

  if (pos > end - 3)
  return;
  if (pos[1] != 1)
return;

Note that the second 'return' (validating the length, pos[1]) combined
with the above condition (ensuring 'pos + 2 + length' doesn't exceed
'end'), makes the first 'return' (whose 'if' can be reworded as 'pos >
end - pos[1] - 2') redundant. Rather than unwind the magic numbers
there, just drop those conditions.

Fixes: 1e58252e334d ("mwifiex: Fix heap overflow in mmwifiex_process_tdls_action_frame()")
Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agoMerge tag 'iwlwifi-next-for-kalle-2020-01-11' of git://git.kernel.org/pub/scm/linux...
Kalle Valo [Sun, 26 Jan 2020 10:10:02 +0000 (12:10 +0200)]
Merge tag 'iwlwifi-next-for-kalle-2020-01-11' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

First set of patches intended for v5.6

* Support new versions of the FTM FW APIs;
* Fix an old bug in D3 (WoWLAN);
* A couple of fixes/improvements in the receive-buffers code;
* Fix in the debugging where we were skipping one TXQ;
* Support new version of the beacon template FW API;
* Print some extra information when the driver is loaded;
* Some debugging infrastructure (aka. yoyo) updates;
* Support for a new HW version;
* Second phase of device configuration work started;
* Some clean-ups;

4 years agonet: amd: a2065: Use print_hex_dump_debug() helper
Geert Uytterhoeven [Sun, 12 Jan 2020 16:33:54 +0000 (17:33 +0100)]
net: amd: a2065: Use print_hex_dump_debug() helper

Use the print_hex_dump_debug() helper, instead of open-coding the same
operations.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
4 years agonet: amd: a2065: Kill Sun LANCE relics
Geert Uytterhoeven [Sun, 12 Jan 2020 16:32:11 +0000 (17:32 +0100)]
net: amd: a2065: Kill Sun LANCE relics

Remove unused fields, copied from the Sun LANCE driver eons ago.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
4 years agoMerge branch 'IXP4xx-networking-cleanups'
Jakub Kicinski [Sun, 12 Jan 2020 21:05:14 +0000 (13:05 -0800)]
Merge branch 'IXP4xx-networking-cleanups'

Linus Walleij says:

====================
IXP4xx networking cleanups

This is a patch series which jams together Arnds and mine
cleanups for the IXP4xx networking.

I also have patches for device tree support but that
requires more elaborate work, this series is some of
mine and some of Arnds patches that is a good foundation
for his multiplatform work and my device tree work.

These are for application to the networking tree so
that can be taken in one separate sweep.

I have tested the patches for a bit using zeroday builds
and some boots on misc IXP4xx devices and haven't run
into any major problems. We might find some new stuff
as a result from the new compiler coverage.

I had to depromote enabling compiler coverage at one
point in the v2 set because it depended on other patches
making the code more generic.

The change in v3 was simply dropping one offending
patch hardcoding base addresses into the driver.

The change in v4 drops a stable@ tag that was
unnecessary.

This v5 is a rebase of the v4 patch set on top of
net-next.
====================

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
4 years agonet: ethernet: ixp4xx: Use parent dev for DMA pool
Linus Walleij [Sun, 12 Jan 2020 12:04:50 +0000 (13:04 +0100)]
net: ethernet: ixp4xx: Use parent dev for DMA pool

Use the netdevice struct device .parent field when calling
dma_pool_create(): the .dma_coherent_mask and .dma_mask
pertains to the bus device on the hardware (platform)
bus in this case, not the struct device inside the network
device. This makes the pool allocation work.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
4 years agoARM/net: ixp4xx: Pass ethernet physical base as resource
Linus Walleij [Sun, 12 Jan 2020 12:04:49 +0000 (13:04 +0100)]
ARM/net: ixp4xx: Pass ethernet physical base as resource

In order to probe this ethernet interface from the device tree
all physical MMIO regions must be passed as resources. Begin
this rewrite by first passing the port base address as a
resource for all platforms using this driver, remap it in
the driver and avoid using any reference of the statically
mapped virtual address in the driver.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
4 years agonet: ehernet: ixp4xx: Use netdev_* messages
Linus Walleij [Sun, 12 Jan 2020 12:04:48 +0000 (13:04 +0100)]
net: ehernet: ixp4xx: Use netdev_* messages

Simplify and correct a bunch of messages using printk
directly to use the netdev_* macros. I have not changed
all of them, just the low-hanging fruit.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
4 years agonet: ethernet: ixp4xx: Use distinct local variable
Linus Walleij [Sun, 12 Jan 2020 12:04:47 +0000 (13:04 +0100)]
net: ethernet: ixp4xx: Use distinct local variable

Use "ndev" for the struct net_device and "dev" for the
struct device in probe() and remove(). Add the local
"dev" pointer for later use in refactoring.

Take this opportunity to fix inverse christmas tree
coding style.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
4 years agonet: ethernet: ixp4xx: Standard module init
Linus Walleij [Sun, 12 Jan 2020 12:04:46 +0000 (13:04 +0100)]
net: ethernet: ixp4xx: Standard module init

The IXP4xx driver was initializing the MDIO bus before even
probing, in the callbacks supposed to be used for setting up
the module itself, and with the side effect of trying to
register the MDIO bus as soon as this module was loaded or
compiled into the kernel whether the device was discovered
or not.

This does not work with multiplatform environments.

To get rid of this: set up the MDIO bus from the probe()
callback and remove it in the remove() callback. Rename
the probe() and remove() calls to reflect the most common
conventions.

Since there is a bit of checking for the ethernet feature
to be present in the MDIO registering function, making the
whole module not even be registered if we can't find an
MDIO bus, we need something similar: register the MDIO
bus when the corresponding ethernet is probed, and
return -EPROBE_DEFER on the other interfaces until this
happens. If no MDIO bus is present on any of the
registered interfaces we will eventually bail out.

None of the platforms I've seen has e.g. MDIO on EthB
and only uses EthC, there is always a Ethernet hardware
on the NPE (B, C) that has the MDIO bus, we just might
have to wait for it.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
4 years agoixp4xx_eth: move platform_data definition
Arnd Bergmann [Sun, 12 Jan 2020 12:04:45 +0000 (13:04 +0100)]
ixp4xx_eth: move platform_data definition

The platform data is needed to compile the driver as standalone,
so move it to a global location along with similar files.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
4 years agoptp: ixp46x: move adjacent to ethernet driver
Arnd Bergmann [Sun, 12 Jan 2020 12:04:44 +0000 (13:04 +0100)]
ptp: ixp46x: move adjacent to ethernet driver

The ixp46x ptp driver has a somewhat unusual setup, where the ptp
driver and the ethernet driver are in different directories but
access the same registers that are defined a platform specific
header file.

Moving everything into drivers/net/ makes it look more like most
other ptp drivers and allows compile-testing this driver on
other targets.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
4 years agowan: ixp4xx_hss: prepare compile testing
Arnd Bergmann [Sun, 12 Jan 2020 12:04:43 +0000 (13:04 +0100)]
wan: ixp4xx_hss: prepare compile testing

The ixp4xx_hss driver needs the platform data definition and the
system clock rate to be compiled. Move both into a new platform_data
header file.

This is a prerequisite for compile testing, but turning on compile
testing requires further patches to isolate the SoC headers.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
4 years agowan: ixp4xx_hss: fix compile-testing on 64-bit
Arnd Bergmann [Sun, 12 Jan 2020 12:04:42 +0000 (13:04 +0100)]
wan: ixp4xx_hss: fix compile-testing on 64-bit

Change the driver to use portable integer types to avoid
warnings during compile testing:

drivers/net/wan/ixp4xx_hss.c:863:21: error: cast to 'u32 *' (aka 'unsigned int *') from smaller integer type 'int' [-Werror,-Wint-to-pointer-cast]
        memcpy_swab32(mem, (u32 *)((int)skb->data & ~3), bytes / 4);
                           ^
drivers/net/wan/ixp4xx_hss.c:979:12: error: incompatible pointer types passing 'u32 *' (aka 'unsigned int *') to parameter of type 'dma_addr_t *' (aka 'unsigned long long *') [-Werror,-Wincompatible-pointer-types]
                                              &port->desc_tab_phys)))
                                              ^~~~~~~~~~~~~~~~~~~~
include/linux/dmapool.h:27:20: note: passing argument to parameter 'handle' here
                     dma_addr_t *handle);
                                 ^

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
4 years agomlx4: Bump up MAX_MSIX from 64 to 128
Jonathan Lemon [Thu, 9 Jan 2020 19:23:17 +0000 (11:23 -0800)]
mlx4: Bump up MAX_MSIX from 64 to 128

On modern hardware with a large number of cpus and using XDP,
the current MSIX limit is insufficient.  Bump the limit in
order to allow more queues.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Reviewed-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
4 years agoMerge branch 'hns3-next'
David S. Miller [Sat, 11 Jan 2020 22:52:56 +0000 (14:52 -0800)]
Merge branch 'hns3-next'

Huazhong Tan says:

====================
net: hns3: add some misc update about reset issue

This series includes some misc update relating to reset issue.
[patch 1/7] & [patch 2/7] splits hclge_reset()/hclgevf_reset()
into two parts: preparing and rebuilding. Since the procedure
of FLR should be separated out from the reset task([patch 3/7 &
patch 3/7]), then the FLR's processing can reuse these codes.

pci_error_handlers.reset_prepare() is void type function, so
[patch 6/7] & [patch 7/7] factor some codes related to PF
function reset to make the preparing done before .reset_prepare()
return.

BTW, [patch 5/7] enlarges the waiting time of reset for matching
the hardware's.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: refactor the notification scheme of PF reset
Huazhong Tan [Sat, 11 Jan 2020 08:33:53 +0000 (16:33 +0800)]
net: hns3: refactor the notification scheme of PF reset

hclge_reset_prepare_down() is only used to inform VF that PF is
going to do function reset, then using hclge_func_reset_sync_vf()
in hclge_reset_prepare_wait() to query whether VF is ready before
asserting PF function reset. To make the code more readable,
this patch uses a new function hclge_function_reset_notify_vf()
to do this job.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: modify hclge_func_reset_sync_vf()'s return type to void
Huazhong Tan [Sat, 11 Jan 2020 08:33:52 +0000 (16:33 +0800)]
net: hns3: modify hclge_func_reset_sync_vf()'s return type to void

When synchronizes with VFs fail before PF function reset,
PF driver should go on its function reset, otherwise it
can not run normally anymore. So, hclge_func_reset_sync_vf()
should not affect the processing of PF reset, this patch
modifies its return type to void.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: enlarge HCLGE_RESET_WAIT_CNT
Huazhong Tan [Sat, 11 Jan 2020 08:33:51 +0000 (16:33 +0800)]
net: hns3: enlarge HCLGE_RESET_WAIT_CNT

When the load of firmware is high, its reset task may takes
more time(which will be as long as 35 seconds). So this
patch modifies HCLGE_RESET_WAIT_CNT to match the firmware's.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: refactor the procedure of VF FLR
Huazhong Tan [Sat, 11 Jan 2020 08:33:50 +0000 (16:33 +0800)]
net: hns3: refactor the procedure of VF FLR

Currently, the actual work of VF FLR is handled in the reset task,
which is asynchronous. So in some case, if the preparing and
rebuilding are not done, then the VF FLR will trigger some problems,
for example, makes hardware go into chaos.

So this patch separates the process of VF FLR from reset task, and
adds a semaphore to serialize this reset and others.

When FLR's preparing fails, if there has other higher level reset
pending or failing times less than the HCLGE_FLR_RETRY_CNT, this
preparing should be retried, otherwise it will get into a wrong state.

BTW, while the hardware reports misc interrupt during pcie_flr(),
the driver can not receive this interrupt anymore, so disable it
when hclgevf_flr_prepare() return, and re-enable it when enter
hclgevf_flr_done().

Avoid declaring internal function hclgevf_enable_vector(), this patch
also moves its definition forward, and removes unused enum
hnae3_flr_state.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: refactor the precedure of PF FLR
Huazhong Tan [Sat, 11 Jan 2020 08:33:49 +0000 (16:33 +0800)]
net: hns3: refactor the precedure of PF FLR

Currently, the actual work of PF FLR is handled in the reset task,
which is asynchronous. So in some case, if the preparing and
rebuilding are not done, then the PF FLR will trigger some problems,
for example, makes hardware go into chaos.

So this patch separates the process of PF FLR from reset task, and
adds a semaphore to serialize this reset and others.

When FLR's preparing fails, if there has other higher level reset
pending or failing times less than the HCLGE_FLR_RETRY_CNT, this
preparing should be retried, otherwise PF and its VF may get into
wrong state.

BTW, while the hardware reports misc interrupt during pcie_flr(),
the driver can not receive this interrupt anymore, so disable it
when hclge_flr_prepare() return, and re-enable it when enter
hclge_flr_done().

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: split hclgevf_reset() into preparing and rebuilding part
Huazhong Tan [Sat, 11 Jan 2020 08:33:48 +0000 (16:33 +0800)]
net: hns3: split hclgevf_reset() into preparing and rebuilding part

hclgevf_reset() is a little bloated, and the process of VF FLR will
be separated from the reset task later. So this patch splits
hclgevf_reset() into hclgevf_reset_prepare() and hclge_reset_rebuild(),
then FLR can also reuse these two functions. Also moves HNAE3_UP_CLIENT
into hclgevf_reset_stack().

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: split hclge_reset() into preparing and rebuilding part
Huazhong Tan [Sat, 11 Jan 2020 08:33:47 +0000 (16:33 +0800)]
net: hns3: split hclge_reset() into preparing and rebuilding part

hclge_reset() is a little bloated, and the process of PF FLR will
be separated from the reset task later. So this patch splits
hclge_reset() into hclge_reset_prepare() and hclge_reset_rebuild(),
then FLR can also reuse these two functions.

BTW, since hclge_clear_reset_cause() and hclge_reset_prepare_up()
will not affect the device, so in hclge_reset_rebuild(), these
functions are called without rtnl_lock.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: remove set but not used variable 'nic_data'
YueHaibing [Fri, 10 Jan 2020 06:09:08 +0000 (06:09 +0000)]
sfc: remove set but not used variable 'nic_data'

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

drivers/net/ethernet/sfc/mcdi_functions.c: In function 'efx_mcdi_ev_init':
drivers/net/ethernet/sfc/mcdi_functions.c:79:28: warning:
 variable 'nic_data' set but not used [-Wunused-but-set-variable]

commit 4438b587fe4b ("sfc: move MCDI event queue management code")
introduces this unused variable.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: remove duplicated include from ef10.c
YueHaibing [Fri, 10 Jan 2020 01:35:17 +0000 (01:35 +0000)]
sfc: remove duplicated include from ef10.c

Remove duplicated include.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agobnxt: Detach page from page pool before sending up the stack
Jonathan Lemon [Thu, 9 Jan 2020 19:35:42 +0000 (11:35 -0800)]
bnxt: Detach page from page pool before sending up the stack

When running in XDP mode, pages come from the page pool, and should
be freed back to the same pool or specifically detached.  Currently,
when the driver re-initializes, the page pool destruction is delayed
forever since it thinks there are oustanding pages.

Fixes: 322b87ca55f2 ("bnxt_en: add page_pool support")
Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Reviewed-by: Andy Gospodarek <gospo@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'devlink-documentation-refactor'
David S. Miller [Sat, 11 Jan 2020 01:07:00 +0000 (17:07 -0800)]
Merge branch 'devlink-documentation-refactor'

Jacob Keller says:

====================
devlink documentation refactor

This series updates the devlink documentation, with a few primary goals

 * move all of the devlink documentation into a dedicated subfolder
 * convert that documentation to the reStructuredText format
 * merge driver-specific documentations into a single file per driver
 * add missing documentation, including per-driver and devlink generally

For each driver, I took the time to review the code and add further
documentation on the various features it currently supports. Additionally, I
added new documentation files for some of the features such as
devlink-dpipe, devlink-resource, and devlink-regions.

Note for the region snapshot triggering, I kept that as a separate patch as
that is based on work that has not yet been merged to net-next, and may
change.

I also improved the existing documentation for devlink-info and
devlink-param by adding a bit more of an introduction when converting it to
the rst format.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: document region snapshot triggering from userspace
Jacob Keller [Thu, 9 Jan 2020 22:46:25 +0000 (14:46 -0800)]
devlink: document region snapshot triggering from userspace

Now that devlink regions can be triggered via
DEVLINK_CMD_REGION_TRIGGER, document this in the devlink-region.rst
file.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: introduce devlink-dpipe.rst documentation file
Jacob Keller [Thu, 9 Jan 2020 22:46:24 +0000 (14:46 -0800)]
devlink: introduce devlink-dpipe.rst documentation file

Primarily based on the DPIPE netdev conference paper, introduce a new
file to document the dpipe interface.

This likely needs further improvement, but is at least a good overall
start.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: add a devlink-resource.rst documentation file
Jacob Keller [Thu, 9 Jan 2020 22:46:23 +0000 (14:46 -0800)]
devlink: add a devlink-resource.rst documentation file

Take the little bit of documentation for resources from various commit
messages and combine it into a new devlink-resource.rst file.

This could probably be expanded on even further by someone with more
knowledge of how the devlink resources work.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: rename and expand devlink-trap-netdevsim.rst
Jacob Keller [Thu, 9 Jan 2020 22:46:22 +0000 (14:46 -0800)]
devlink: rename and expand devlink-trap-netdevsim.rst

Rename the trap-specific netdevimsim.rst file, and expand it to include
documentation of all the devlink features currently implemented by the
netdevsim driver code.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Cc: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: add documentation for ionic device driver
Jacob Keller [Thu, 9 Jan 2020 22:46:21 +0000 (14:46 -0800)]
devlink: add documentation for ionic device driver

The IONIC device driver allocates a devlink and reports versions. Add
documentation for this driver.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Cc: Shannon Nelson <snelson@pensando.io>
Acked-by: Shannon Nelson <snelson@pensandi.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: add a file documenting devlink regions
Jacob Keller [Thu, 9 Jan 2020 22:46:20 +0000 (14:46 -0800)]
devlink: add a file documenting devlink regions

Also document the regions created by the mlx4 driver. This is currently
the only in-tree driver that creates devlink region snapshots.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Cc: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: add a driver-specific file for the qed driver
Jacob Keller [Thu, 9 Jan 2020 22:46:19 +0000 (14:46 -0800)]
devlink: add a driver-specific file for the qed driver

The qed driver recently added devlink support with a single devlink
parameter. Add a driver-specific file to document the devlink features
that the qed driver supports.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Cc: Ariel Elior <aelior@marvell.com>
Cc: GR-everest-linux-l2@marvell.com
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: add parameter documentation for the mlx4 driver
Jacob Keller [Thu, 9 Jan 2020 22:46:18 +0000 (14:46 -0800)]
devlink: add parameter documentation for the mlx4 driver

The mlx5 and mlxsw drivers have driver-specific documentation for the
devlink features they support. No such file was added for mlx4.

Add a file to document the mlx4 devlink support. Initially it contains
only the devlink parameters.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Cc: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: document info versions for each driver
Jacob Keller [Thu, 9 Jan 2020 22:46:17 +0000 (14:46 -0800)]
devlink: document info versions for each driver

Add the set of info versions reported by each device driver, including
a description of what the version represents, and what modes (fixed,
running, stored) it reports.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Cc: Tariq Toukan <tariqt@mellanox.com>
Cc: Saeed Mahameed <saeedm@mellanox.com>
Cc: Leon Romanovsky <leonro@mellanox.com>
Cc: Michael Chan <michael.chan@broadcom.com>
Cc: Jiri Pirko <jiri@mellanox.com>
Cc: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: convert driver-specific files to reStructuredText
Jacob Keller [Thu, 9 Jan 2020 22:46:16 +0000 (14:46 -0800)]
devlink: convert driver-specific files to reStructuredText

Several drivers document what parameters they support in
a devlink-params-*.txt file. This file is supposed to contain both the
list of generic parameters implemented by the driver, as well as a list
of driver-specific parameters and their descriptions.

It would also be good if the driver documentation included other
driver-specific implementations, such as info versions, devlink
regions, and so forth.

Convert all of these documentation files to reStructuredText, and rename
them to just the driver name. Future changes will include other
driver-specific implementations. Each file will contain a table for the
generic parameters implemented, as well as a separate table for the
driver-specific parameters.

Future sections such as for devlink info versions will be added to these
files. This avoids creating additional devlink-<feature>-<driver> files
for each devlink feature, reducing clutter in the documentation folder.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Cc: Tariq Toukan <tariqt@mellanox.com>
Cc: Saeed Mahameed <saeedm@mellanox.com>
Cc: Leon Romanovsky <leonro@mellanox.com>
Cc: Michael Chan <michael.chan@broadcom.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Vivien Didelot <vivien.didelot@gmail.com>
Cc: Jiri Pirko <jiri@mellanox.com>
Cc: Ido Schimmel <idosch@mellanox.com>
Cc: Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: mention reloading in devlink-params.rst
Jacob Keller [Thu, 9 Jan 2020 22:46:15 +0000 (14:46 -0800)]
devlink: mention reloading in devlink-params.rst

Mention that drivers must support devlink-reload in order for driverinit
parameters to function properly

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: add documentation for generic devlink parameters
Jacob Keller [Thu, 9 Jan 2020 22:46:14 +0000 (14:46 -0800)]
devlink: add documentation for generic devlink parameters

A few generic devlink parameters have been added, but never documented.
Fix that now.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: convert devlink-params.txt to reStructuredText
Jacob Keller [Thu, 9 Jan 2020 22:46:13 +0000 (14:46 -0800)]
devlink: convert devlink-params.txt to reStructuredText

Convert the generic parameters descriptions into the reStructuredText
format.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: rename devlink-info-versions.rst and add a header
Jacob Keller [Thu, 9 Jan 2020 22:46:12 +0000 (14:46 -0800)]
devlink: rename devlink-info-versions.rst and add a header

Rename the devlink-info-versions.rst file to a plain devlink-info.rst
file. Add additional paragraphs explaining what devlink-info is for,
and the expectation that drivers use the generic names where plausible.

Note that drivers which use non-standard info version names ought to
document these in a driver-specific info-versions.rst file.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: convert devlink-health.txt to rst format
Jacob Keller [Thu, 9 Jan 2020 22:46:11 +0000 (14:46 -0800)]
devlink: convert devlink-health.txt to rst format

Update the devlink-health documentation to use the newer
ReStructuredText format.

Note that it's unclear what OOB stood for, and it has been left as-is
without a proper first-use expansion of the acronym.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: move devlink documentation to subfolder
Jacob Keller [Thu, 9 Jan 2020 22:46:10 +0000 (14:46 -0800)]
devlink: move devlink documentation to subfolder

Combine the documentation for devlink into a subfolder, and provide an
index.rst file that can be used to generally describe devlink.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: add macro for "fw.psid"
Jacob Keller [Thu, 9 Jan 2020 22:46:09 +0000 (14:46 -0800)]
devlink: add macro for "fw.psid"

The "fw.psid" devlink info version is documented in devlink-info.rst,
and used by one driver. However, there is no associated macro for this
firmware version like there is for others. Add one now.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'r8169-factor-out-chip-specific-PHY-configuration-to-a-separate-source...
David S. Miller [Sat, 11 Jan 2020 00:41:35 +0000 (16:41 -0800)]
Merge branch 'r8169-factor-out-chip-specific-PHY-configuration-to-a-separate-source-file'

Heiner Kallweit says:

====================
r8169: factor out chip-specific PHY configuration to a separate source file

Basically every chip version needs its own PHY configuration.
To improve maintainability of the driver move all these PHY
configurations to a separate source file. To allow this we first have
to change all PHY configurations to use phylib functions wherever
possible.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: factor out PHY configuration to r8169_phy_config.c
Heiner Kallweit [Thu, 9 Jan 2020 19:34:55 +0000 (20:34 +0100)]
r8169: factor out PHY configuration to r8169_phy_config.c

Move chip-specific PHY configurations to separate source file
r8169_phy_config.c. This improves maintainability of the driver.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: add r8169.h
Heiner Kallweit [Thu, 9 Jan 2020 19:34:05 +0000 (20:34 +0100)]
r8169: add r8169.h

In preparation of factoring out PHY configuration to a separate source
file move commonly used definitions to new header file r8169.h.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: rename rtl_apply_firmware
Heiner Kallweit [Thu, 9 Jan 2020 19:33:13 +0000 (20:33 +0100)]
r8169: rename rtl_apply_firmware

Rename rtl_apply_firmware() to r8169_apply_firmware() before exporting
it to avoid namespace clashes with other drivers for Realtek hardware.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: add phydev argument to rtl8168d_apply_firmware_cond
Heiner Kallweit [Thu, 9 Jan 2020 19:32:36 +0000 (20:32 +0100)]
r8169: add phydev argument to rtl8168d_apply_firmware_cond

Pass the phy_device as parameter to rtl8168d_apply_firmware_cond(),
this avoids having to access rtl8169_private internals.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: use phy_read/write instead of rtl_readphy/writephy
Heiner Kallweit [Thu, 9 Jan 2020 19:31:47 +0000 (20:31 +0100)]
r8169: use phy_read/write instead of rtl_readphy/writephy

Replace rtl_writephy and rtl_readphy with the respective phylib
functions.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: replace rtl_w0w1_phy
Heiner Kallweit [Thu, 9 Jan 2020 19:31:10 +0000 (20:31 +0100)]
r8169: replace rtl_w0w1_phy

Replace rtl_w0w1_phy with phylib functions.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: replace rtl_patchphy
Heiner Kallweit [Thu, 9 Jan 2020 19:30:37 +0000 (20:30 +0100)]
r8169: replace rtl_patchphy

Replace rtl_patchphy with phylib functions.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: move disabling MAC EEE for RTL8402/RTL8106e
Heiner Kallweit [Thu, 9 Jan 2020 19:30:00 +0000 (20:30 +0100)]
r8169: move disabling MAC EEE for RTL8402/RTL8106e

Move configuring EEE on MAC side out of the PHY configuration.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: move setting ERI register 0x1d0 for RTL8106
Heiner Kallweit [Thu, 9 Jan 2020 19:29:21 +0000 (20:29 +0100)]
r8169: move setting ERI register 0x1d0 for RTL8106

Writing this ERI register is a MAC setting, so move it to
rtl_hw_start_8106().

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: switch to phylib functions in rtl_writephy_batch
Heiner Kallweit [Thu, 9 Jan 2020 19:28:45 +0000 (20:28 +0100)]
r8169: switch to phylib functions in rtl_writephy_batch

Switch rtl_writephy_batch() to phylib functions, as a result we can
avoid passing a rtl8169_private parameter.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: change argument type of RTL8168g-specific PHY config functions
Heiner Kallweit [Thu, 9 Jan 2020 19:28:08 +0000 (20:28 +0100)]
r8169: change argument type of RTL8168g-specific PHY config functions

These functions use only the phy_device member of rtl8169_private,
so we can pass the phy_device as parameter directly.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: change argument type of EEE PHY functions
Heiner Kallweit [Thu, 9 Jan 2020 19:27:33 +0000 (20:27 +0100)]
r8169: change argument type of EEE PHY functions

These functions use only the phy_device member of rtl8169_private,
so we can pass the phy_device as parameter directly.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: move RTL8169scd Gigabyte PHY quirk
Heiner Kallweit [Thu, 9 Jan 2020 19:26:59 +0000 (20:26 +0100)]
r8169: move RTL8169scd Gigabyte PHY quirk

In preparation of factoring out rtl8169scd_hw_phy_config() move this
quirk to rtl8169_init_phy().

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: remove not needed debug print in rtl8169_init_phy
Heiner Kallweit [Thu, 9 Jan 2020 19:26:19 +0000 (20:26 +0100)]
r8169: remove not needed debug print in rtl8169_init_phy

Remove a useless debug statement. This also allows to remove the
net_device parameter from rtl8169_init_phy().

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: prepare for exporting rtl_hw_phy_config
Heiner Kallweit [Thu, 9 Jan 2020 19:25:31 +0000 (20:25 +0100)]
r8169: prepare for exporting rtl_hw_phy_config

In preperation of factoring out the PHY configuration to a separate
source file this patch:
- avoids accessing rtl8169_private internals by passing the phy_device
  and mac_version as separate parameters
- renames rtl_hw_phy_config to r8169_hw_phy_config to avoid namespace
  clashes with other drivers for Realtek hardware

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'stmmac-Frame-Preemption-fixes'
David S. Miller [Fri, 10 Jan 2020 19:29:44 +0000 (11:29 -0800)]
Merge branch 'stmmac-Frame-Preemption-fixes'

Jose Abreu says:

====================
net: stmmac: Frame Preemption fixes

Two single fixes for the -next tree for recently introduced Frame Preemption
feature.

1) and 2) fixes the disabling of Frame Preemption that was not being correctly
handled because of a missing return.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: stmmac: gmac5+: Fix missing return
Jose Abreu [Fri, 10 Jan 2020 15:13:35 +0000 (16:13 +0100)]
net: stmmac: gmac5+: Fix missing return

If FPE is supposed to be disabled we need to return after disabling it.

Fixes: 7c7282746883 ("net: stmmac: gmac5+: Add support for Frame Preemption")
Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: stmmac: xgmac: Fix missing return
Jose Abreu [Fri, 10 Jan 2020 15:13:34 +0000 (16:13 +0100)]
net: stmmac: xgmac: Fix missing return

If FPE is supposed to be disabled we need to return after disabling it.

Fixes: f0e56c8d8f7d ("net: stmmac: xgmac3+: Add support for Frame Preemption")
Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'sfc-even-more-code-refactoring'
David S. Miller [Fri, 10 Jan 2020 19:24:37 +0000 (11:24 -0800)]
Merge branch 'sfc-even-more-code-refactoring'

Alex Maftei says:

====================
sfc: even more code refactoring

Splitting even more of the driver code into different files, which
will later be used in another driver for a new product.

This is a continuation to my previous patch series, and the one
before it.
There will be a stand-alone patch as well after this - after which
the refactoring will be concluded, for now.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>