]> git.proxmox.com Git - mirror_ubuntu-kernels.git/log
mirror_ubuntu-kernels.git
4 years agonet: vlan: Avoid using BUG() in vlan_proto_idx()
Florian Fainelli [Fri, 25 Sep 2020 00:27:44 +0000 (17:27 -0700)]
net: vlan: Avoid using BUG() in vlan_proto_idx()

While we should always make sure that we specify a valid VLAN protocol
to vlan_proto_idx(), killing the machine when an invalid value is
specified is too harsh and not helpful for debugging. All callers are
capable of dealing with an error returned by vlan_proto_idx() so check
the index value and propagate it accordingly.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge tag 'wireless-drivers-next-2020-09-25' of git://git.kernel.org/pub/scm/linux...
David S. Miller [Fri, 25 Sep 2020 20:16:29 +0000 (13:16 -0700)]
Merge tag 'wireless-drivers-next-2020-09-25' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next

Kalle Valo says:

====================
wireless-drivers-next patches for v5.10

Second set of patches for v5.10. Biggest change here is wcn3680
support to wcn36xx driver, otherwise smaller features. And naturally
the usual fixes and cleanups.

Major changes:

brcmfmac

* support 4-way handshake offloading for WPA/WPA2-PSK in AP mode

* support SAE authentication offload in AP mode

mt76

* mt7663 runtime power management improvements

* mt7915 A-MSDU offload

wcn36xx

* add support wcn3680 Wi-Fi 5 devices

ath11k

* spectral scan support for ipq6018
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoath11k: fix undefined reference to 'ath11k_debugfs_htt_ext_stats_handler'
Kalle Valo [Fri, 25 Sep 2020 08:57:21 +0000 (11:57 +0300)]
ath11k: fix undefined reference to 'ath11k_debugfs_htt_ext_stats_handler'

kbuild bot reported than link fails when CONFIG_ATH11K_DEBUGFS is disabled:

drivers/net/wireless/ath/ath11k/dp_rx.c:1662: undefined reference to `ath11k_debugfs_htt_ext_stats_handler'

This was because I had missed to move the static inline version of the function
(which are used when CONFIG_ATH11K_DEBUGFS is disabled) to debufs_htt_stats.h.
Also move ath11k_debugfs_htt_stats_req() at the same time. And create a stub
also for ath11k_debugfs_htt_stats_init() for consistency, even if it's not
needed.

Reported-by: kernel test robot <lkp@intel.com>
Fixes: 568f06036ee2 ("ath11k: debugfs: move some function declarations to correct header files")
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1601024241-16594-1-git-send-email-kvalo@codeaurora.org
4 years agoMerge branch 'hns3-next'
David S. Miller [Fri, 25 Sep 2020 03:19:25 +0000 (20:19 -0700)]
Merge branch 'hns3-next'

Huazhong Tan says:

====================
net: hns3: updates for -next

There are some updates for the HNS3 ethernet driver.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: rename macro of pci device id of vf
Guangbin Huang [Fri, 25 Sep 2020 00:26:18 +0000 (08:26 +0800)]
net: hns3: rename macro of pci device id of vf

VF devices do not have speed division, its speed is depended on its PF.
So macro name of PCI device id of VF is incorrent to have 100G info, it
should be renamed by removing 100G info.

Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: add support for 200G device
Guangbin Huang [Fri, 25 Sep 2020 00:26:17 +0000 (08:26 +0800)]
net: hns3: add support for 200G device

The 200G device has a new device id 0xA228, so adds this device id to
pci table, then the driver can probe it.

As speed_ability queried from firmware has only 8 bits and already be
used up, so firmware adds extra speed_ability_ext to indicate more
speed abilities to support 200G and driver needs to parse it.

Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: add debugfs of dumping pf interrupt resources
Yufeng Mo [Fri, 25 Sep 2020 00:26:16 +0000 (08:26 +0800)]
net: hns3: add debugfs of dumping pf interrupt resources

The pf's interrupt resources will be changed with the number of
enabled pf. Dumping this resource information will be helpful
for debugging.

Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: add a hardware error detect type
Yufeng Mo [Fri, 25 Sep 2020 00:26:15 +0000 (08:26 +0800)]
net: hns3: add a hardware error detect type

In hns3_process_hw_error(), the hardware error detection of the
ROCEE AXI RESP error type is added. When this error occurs,
the client needs to be notified of this error and take
corresponding operation.

Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: remove unnecessary variable initialization
Yufeng Mo [Fri, 25 Sep 2020 00:26:14 +0000 (08:26 +0800)]
net: hns3: remove unnecessary variable initialization

If a variable is assigned a value before it is used, it's no
need to assign an initial value to the variable. So remove
these redundant operations.

Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: refactor the function for dumping tc information in debugfs
Yufeng Mo [Fri, 25 Sep 2020 00:26:13 +0000 (08:26 +0800)]
net: hns3: refactor the function for dumping tc information in debugfs

Remove some unnecessary parameters of hclge_title_idx_print(),
and rename this function for readability.

Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: tcp: drop unused function argument from mptcp_incoming_options
Florian Westphal [Thu, 24 Sep 2020 23:23:02 +0000 (01:23 +0200)]
net: tcp: drop unused function argument from mptcp_incoming_options

Since commit cfde141ea3faa30e ("mptcp: move option parsing into
mptcp_incoming_options()"), the 3rd function argument is no longer used.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'mptcp-RM_ADDR-ADD_ADDR-enhancements'
David S. Miller [Fri, 25 Sep 2020 02:58:34 +0000 (19:58 -0700)]
Merge branch 'mptcp-RM_ADDR-ADD_ADDR-enhancements'

Geliang Tang says:

====================
mptcp: RM_ADDR/ADD_ADDR enhancements

This series include two enhancements for the MPTCP path management,
namely RM_ADDR support and ADD_ADDR echo support, as specified by RFC
sections 3.4.1 and 3.4.2.

1 RM_ADDR support include 9 patches (1-3 and 8-13):

Patch 1 is the helper for patch 2, these two patches add the RM_ADDR
outgoing functions, which are derived from ADD_ADDR's corresponding
functions.

Patch 3 adds the RM_ADDR incoming logic, when RM_ADDR suboption is
received, close the subflow matching the rm_id, and update PM counter.

Patch 8 is the main remove routine. When the PM netlink removes an address,
we traverse all the existing msk sockets to find the relevant sockets. Then
trigger the RM_ADDR signal and remove the subflow which using this local
address, this subflow removing functions has been implemented in patch 9.

Finally, patches 10-13 are the self-tests for RM_ADDR.

2 ADD_ADDR echo support include 7 patches (4-7 and 14-16).

Patch 4 adds the ADD_ADDR echo logic, when the ADD_ADDR suboption has been
received, send out the same ADD_ADDR suboption with echo-flag, and no HMAC
included.

Patches 5 and 6 are the self-tests for ADD_ADDR echo. Patch 7 is a little
cleaning up.

Patch 14 and 15 are the helpers for patch 16. These three patches add
the ADD_ADDR retransmition when no ADD_ADDR echo is received.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomptcp: retransmit ADD_ADDR when timeout
Geliang Tang [Thu, 24 Sep 2020 00:30:02 +0000 (08:30 +0800)]
mptcp: retransmit ADD_ADDR when timeout

This patch implemented the retransmition of ADD_ADDR when no ADD_ADDR echo
is received. It added a timer with the announced address. When timeout
occurs, ADD_ADDR will be retransmitted.

Suggested-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomptcp: add sk_stop_timer_sync helper
Geliang Tang [Thu, 24 Sep 2020 00:30:01 +0000 (08:30 +0800)]
mptcp: add sk_stop_timer_sync helper

This patch added a new helper sk_stop_timer_sync, it deactivates a timer
like sk_stop_timer, but waits for the handler to finish.

Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomptcp: add struct mptcp_pm_add_entry
Geliang Tang [Thu, 24 Sep 2020 00:30:00 +0000 (08:30 +0800)]
mptcp: add struct mptcp_pm_add_entry

Add a new struct mptcp_pm_add_entry to describe add_addr's entry.

Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoselftests: mptcp: add remove addr and subflow test cases
Geliang Tang [Thu, 24 Sep 2020 00:29:59 +0000 (08:29 +0800)]
selftests: mptcp: add remove addr and subflow test cases

This patch added the remove addr and subflow test cases and two new
functions.

The first function run_remove_tests calls do_transfer with two new
arguments, rm_nr_ns1 and rm_nr_ns2, for the numbers of addresses should be
removed during the transfer process in namespace 1 and namespace 2.

If both these two arguments are 0, we do the join test cases with
"mptcp_connect -j" command. Otherwise, do the remove test cases with
"mptcp_connect -r" command.

The second function chk_rm_nr checks the RM_ADDR related mibs's counters.

The output of the test cases looks like this:

11 remove single subflow           syn[ ok ] - synack[ ok ] - ack[ ok ]
                                   rm [ ok ] - sf    [ ok ]
12 remove multiple subflows        syn[ ok ] - synack[ ok ] - ack[ ok ]
                                   rm [ ok ] - sf    [ ok ]
13 remove single address           syn[ ok ] - synack[ ok ] - ack[ ok ]
                                   add[ ok ] - echo  [ ok ]
                                   rm [ ok ] - sf    [ ok ]
14 remove subflow and signal       syn[ ok ] - synack[ ok ] - ack[ ok ]
                                   add[ ok ] - echo  [ ok ]
                                   rm [ ok ] - sf    [ ok ]
15 remove subflows and signal      syn[ ok ] - synack[ ok ] - ack[ ok ]
                                   add[ ok ] - echo  [ ok ]
                                   rm [ ok ] - sf    [ ok ]

Suggested-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Suggested-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoselftests: mptcp: add remove cfg in mptcp_connect
Geliang Tang [Thu, 24 Sep 2020 00:29:58 +0000 (08:29 +0800)]
selftests: mptcp: add remove cfg in mptcp_connect

This patch added a new cfg, named cfg_remove in mptcp_connect. This new
cfg_remove is copied from cfg_join. The only difference between them is in
the do_rnd_write function. Here we slow down the transfer process of all
data to let the RM_ADDR suboption can be sent and received completely.
Otherwise the remove address and subflow test cases don't work.

Suggested-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Suggested-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomptcp: add mptcp_destroy_common helper
Geliang Tang [Thu, 24 Sep 2020 00:29:57 +0000 (08:29 +0800)]
mptcp: add mptcp_destroy_common helper

This patch added a new helper named mptcp_destroy_common containing the
shared code between mptcp_destroy() and mptcp_sock_destruct().

Suggested-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomptcp: add RM_ADDR related mibs
Geliang Tang [Thu, 24 Sep 2020 00:29:56 +0000 (08:29 +0800)]
mptcp: add RM_ADDR related mibs

This patch added two new mibs for RM_ADDR, named MPTCP_MIB_RMADDR and
MPTCP_MIB_RMSUBFLOW, when the RM_ADDR suboption is received, increase
the first mib counter, when the local subflow is removed, increase the
second mib counter.

Suggested-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Suggested-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomptcp: implement mptcp_pm_remove_subflow
Geliang Tang [Thu, 24 Sep 2020 00:29:55 +0000 (08:29 +0800)]
mptcp: implement mptcp_pm_remove_subflow

This patch implemented the local subflow removing function,
mptcp_pm_remove_subflow, it simply called mptcp_pm_nl_rm_subflow_received
under the PM spin lock.

We use mptcp_pm_remove_subflow to remove a local subflow, so change it's
argument from remote_id to local_id.

We check subflow->local_id in mptcp_pm_nl_rm_subflow_received to remove
a subflow.

Suggested-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Suggested-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomptcp: remove addr and subflow in PM netlink
Geliang Tang [Thu, 24 Sep 2020 00:29:54 +0000 (08:29 +0800)]
mptcp: remove addr and subflow in PM netlink

This patch implements the remove announced addr and subflow logic in PM
netlink.

When the PM netlink removes an address, we traverse all the existing msk
sockets to find the relevant sockets.

We add a new list named anno_list in mptcp_pm_data, to record all the
announced addrs. In the traversing, we check if it has been recorded.
If it has been, we trigger the RM_ADDR signal.

We also check if this address is in conn_list. If it is, we remove the
subflow which using this local address.

Since we call mptcp_pm_free_anno_list in mptcp_destroy, we need to move
__mptcp_init_sock before the mptcp_is_enabled check in mptcp_init_sock.

Suggested-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Suggested-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomptcp: add accept_subflow re-check
Geliang Tang [Thu, 24 Sep 2020 00:29:53 +0000 (08:29 +0800)]
mptcp: add accept_subflow re-check

The re-check of pm->accept_subflow with pm->lock held was missing, this
patch fixed it.

Suggested-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoselftests: mptcp: add ADD_ADDR mibs check function
Geliang Tang [Thu, 24 Sep 2020 00:29:52 +0000 (08:29 +0800)]
selftests: mptcp: add ADD_ADDR mibs check function

This patch added the ADD_ADDR related mibs counter check function
chk_add_nr(). This function check both ADD_ADDR and ADD_ADDR with
echo flag.

The output looks like this:

 07 unused signal address             syn[ ok ] - synack[ ok ] - ack[ ok ]
                                      add[ ok ] - echo  [ ok ]
 08 signal address                    syn[ ok ] - synack[ ok ] - ack[ ok ]
                                      add[ ok ] - echo  [ ok ]
 09 subflow and signal                syn[ ok ] - synack[ ok ] - ack[ ok ]
                                      add[ ok ] - echo  [ ok ]
 10 multiple subflows and signal      syn[ ok ] - synack[ ok ] - ack[ ok ]
                                      add[ ok ] - echo  [ ok ]
 11 remove subflow and signal         syn[ ok ] - synack[ ok ] - ack[ ok ]
                                      add[ ok ] - echo  [ ok ]

Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomptcp: add ADD_ADDR related mibs
Geliang Tang [Thu, 24 Sep 2020 00:29:51 +0000 (08:29 +0800)]
mptcp: add ADD_ADDR related mibs

This patch added two mibs for ADD_ADDR, MPTCP_MIB_ADDADDR for receiving
of the ADD_ADDR suboption with echo-flag=0, and MPTCP_MIB_ECHOADD for
receiving the ADD_ADDR suboption with echo-flag=1.

Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Co-developed-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomptcp: send out ADD_ADDR with echo flag
Geliang Tang [Thu, 24 Sep 2020 00:29:50 +0000 (08:29 +0800)]
mptcp: send out ADD_ADDR with echo flag

When the ADD_ADDR suboption has been received, we need to send out the same
ADD_ADDR suboption with echo-flag=1, and no HMAC.

Suggested-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomptcp: add the incoming RM_ADDR support
Geliang Tang [Thu, 24 Sep 2020 00:29:49 +0000 (08:29 +0800)]
mptcp: add the incoming RM_ADDR support

This patch added the RM_ADDR option parsing logic:

We parsed the incoming options to find if the rm_addr option is received,
and called mptcp_pm_rm_addr_received to schedule PM work to a new status,
named MPTCP_PM_RM_ADDR_RECEIVED.

PM work got this status, and called mptcp_pm_nl_rm_addr_received to handle
it.

In mptcp_pm_nl_rm_addr_received, we closed the subflow matching the rm_id,
and updated PM counter.

Suggested-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Suggested-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomptcp: add the outgoing RM_ADDR support
Geliang Tang [Thu, 24 Sep 2020 00:29:48 +0000 (08:29 +0800)]
mptcp: add the outgoing RM_ADDR support

This patch added a new signal named rm_addr_signal in PM. On outgoing path,
we called mptcp_pm_should_rm_signal to check if rm_addr_signal has been
set. If it has been, we sent out the RM_ADDR option.

Suggested-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomptcp: rename addr_signal and the related functions
Geliang Tang [Thu, 24 Sep 2020 00:29:47 +0000 (08:29 +0800)]
mptcp: rename addr_signal and the related functions

This patch renamed addr_signal and the related functions with the explicit
word "add".

Suggested-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge tag 'mlx5-updates-2020-09-22' of git://git.kernel.org/pub/scm/linux/kernel...
David S. Miller [Fri, 25 Sep 2020 02:54:40 +0000 (19:54 -0700)]
Merge tag 'mlx5-updates-2020-09-22' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux

Saeed Mahameed says:

====================
mlx5-updates-2020-09-22

This series includes mlx5 updates

1) Add support for Connection Tracking offload in NIC mode.
   Supporting CT offload in NIC mode on Mellanox cards is useful for
   scenarios where the dual port NIC serves as a gateway between 2
   networks and forwards traffic between these networks.

   Since the traffic is not terminated on the host in this case,
   no use of SRIOV VFs and/or switchdev mode is required.

   Today Mellanox NIC cards already support offloading of packet forwarding
   between physical ports without going to the host so combining it with CT
   offloading allows users to create a gateway with forwarding and CT
   (Including NAT) offloading capabilities in non-switchdev mode.

   To support connection tracking in non-Switchdev mode (Single NIC mode),
   we need to make use of the current Connection tracking infrastructure
   implemented on top of E-Switch and the mlx5 generic flow table chains
   APIs, to make it work on non-Eswitch steering domain e.g. NIC RX domain,
   the following was performed:

 1.1) Refactor current flow steering chains infrastructure and
      updates TC nic mode implementation to use flow table chains.
 1.2) Refactor current Connection Tracking (CT) infrastructure to not
      assume E-switch backend, and make the CT layer agnostic to
      underlying steering mode (E-Switch/NIC)
 1.3) Plumbing to support CT offload in NIC mode.

2) Trivial code cleanups.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'dpaa2-mac-add-PCS-support-through-the-Lynx-module'
David S. Miller [Fri, 25 Sep 2020 02:49:36 +0000 (19:49 -0700)]
Merge branch 'dpaa2-mac-add-PCS-support-through-the-Lynx-module'

Ioana Ciornei says:

====================
dpaa2-mac: add PCS support through the Lynx module

This patch set aims to add PCS support in the dpaa2-eth driver by
leveraging the Lynx PCS module.

The first two patches are some missing pieces: the first one adding
support for 10GBASER in Lynx PCS while the second one adds a new
function - of_mdio_find_device - which is helpful in retrieving the PCS
represented as a mdio_device.  The final patch adds the glue logic
between phylink and the Lynx PCS module: it retrieves the PCS
represented as an mdio_device and registers it to Lynx and phylink.
From that point on, any PCS callbacks are treated by Lynx, without
dpaa2-eth interaction.

Changes in v2:
 - move put_device() after destroy - 3/3
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodpaa2-mac: add PCS support through the Lynx module
Ioana Ciornei [Wed, 23 Sep 2020 15:41:23 +0000 (18:41 +0300)]
dpaa2-mac: add PCS support through the Lynx module

Include PCS support in the dpaa2-eth driver by integrating it with the
new Lynx PCS module. There is not much to talk about in terms of changes
needed in the dpaa2-eth driver since the only steps necessary are to
find the MDIO device representing the PCS, register it to the Lynx PCS
module and then let phylink know if its existence also.
After this, the PCS callbacks will be treated directly by Lynx, without
interraction from dpaa2-eth's part.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoof: add of_mdio_find_device() api
Russell King [Wed, 23 Sep 2020 15:41:22 +0000 (18:41 +0300)]
of: add of_mdio_find_device() api

Add a helper function which finds the mdio_device structure given a
device tree node. This is helpful for finding the PCS device based on a
DTS node but managing it as a mdio_device instead of a phy_device.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: pcs-lynx: add support for 10GBASER
Ioana Ciornei [Wed, 23 Sep 2020 15:41:21 +0000 (18:41 +0300)]
net: pcs-lynx: add support for 10GBASER

Add support in the Lynx PCS module for the 10GBASE-R mode which is only
used to get the link state, since it offers a single fixed speed.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: mscc: ocelot: always pass skb clone to ocelot_port_add_txtstamp_skb
Vladimir Oltean [Wed, 23 Sep 2020 11:24:20 +0000 (14:24 +0300)]
net: mscc: ocelot: always pass skb clone to ocelot_port_add_txtstamp_skb

Currently, ocelot switchdev passes the skb directly to the function that
enqueues it to the list of skb's awaiting a TX timestamp. Whereas the
felix DSA driver first clones the skb, then passes the clone to this
queue.

This matters because in the case of felix, the common IRQ handler, which
is ocelot_get_txtstamp(), currently clones the clone, and frees the
original clone. This is useless and can be simplified by using
skb_complete_tx_timestamp() instead of skb_tstamp_tx().

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
Kalle Valo [Thu, 24 Sep 2020 16:49:58 +0000 (19:49 +0300)]
Merge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git

ath.git patches for v5.10. Major changes:

wcn36xx

* add support wcn3680 Wi-Fi 5 devices

ath11k

* spectral scan support for ipq6018

4 years agoMerge tag 'mt76-for-kvalo-2020-09-23' of https://github.com/nbd168/wireless
Kalle Valo [Thu, 24 Sep 2020 16:44:50 +0000 (19:44 +0300)]
Merge tag 'mt76-for-kvalo-2020-09-23' of https://github.com/nbd168/wireless

mt76 patches for 5.10

* mt7663 runtime power management improvements
* performance improvements
* sdio support fixes
* testmode fixes
* mt7622 fixes
* 7915 A-MSDU offload
* cleanups

# gpg: Signature made Thu 24 Sep 2020 07:10:25 PM EEST using DSA key ID 02A76EF5
# gpg: Good signature from "Felix Fietkau <nbd@nbd.name>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 75D1 1A7D 91A7 710F 4900  42EF D77D 141D 02A7 6EF5

4 years agomt76: mt7663s: remove max_tx_fragments limitation
Lorenzo Bianconi [Thu, 17 Sep 2020 17:18:22 +0000 (19:18 +0200)]
mt76: mt7663s: remove max_tx_fragments limitation

Remove A-MSDU max_tx_fragments constraint for sdio since the check is
already performed in mt7663s_tx_run_queue routine

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: Convert to DEFINE_SHOW_ATTRIBUTE
Qinglang Miao [Sat, 19 Sep 2020 02:12:42 +0000 (10:12 +0800)]
mt76: Convert to DEFINE_SHOW_ATTRIBUTE

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: add offchannel condition in switch channel command
Shayne Chen [Tue, 22 Sep 2020 11:36:01 +0000 (19:36 +0800)]
mt76: mt7915: add offchannel condition in switch channel command

Add a missing offchannel condition for channel switch reason, which
bypasses DPD calibration to reduce scanning time.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: convert to use le16_add_cpu()
Liu Shixin [Mon, 14 Sep 2020 04:17:50 +0000 (12:17 +0800)]
mt76: mt7915: convert to use le16_add_cpu()

Convert cpu_to_le16(le16_to_cpu(E1) + E2) to use le16_add_cpu().

Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: Fix unsigned expressions compared with zero
Ye Bin [Mon, 24 Aug 2020 07:28:26 +0000 (15:28 +0800)]
mt76: Fix unsigned expressions compared with zero

Fixes variable types in mt76x02_dfs_create_sequence and
mt76x02_dfs_add_event_to_sequence

Signed-off-by: Ye Bin <yebin10@huawei.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: fix possible memory leak in mt7915_mcu_add_beacon
Lorenzo Bianconi [Mon, 14 Sep 2020 18:29:01 +0000 (20:29 +0200)]
mt76: mt7915: fix possible memory leak in mt7915_mcu_add_beacon

Release mcu message memory in case of failure in mt7915_mcu_add_beacon
routine

Fixes: e57b7901469fc ("mt76: add mac80211 driver for MT7915 PCIe-based chipsets")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt76x0: Move tables used only by init.c to their own header file
Lee Jones [Fri, 21 Aug 2020 07:16:44 +0000 (08:16 +0100)]
mt76: mt76x0: Move tables used only by init.c to their own header file

Taking the same approach as initvals_phy.h.

Fixes the following W=1 kernel build warning(s):

 drivers/net/wireless/mediatek/mt76/mt76x0/initvals.h:218:35: warning: â€˜mt76x0_dcoc_tab’ defined but not used [-Wunused-const-variable=]
 218 | static const struct mt76_reg_pair mt76x0_dcoc_tab[] = {
 | ^~~~~~~~~~~~~~~
 drivers/net/wireless/mediatek/mt76/mt76x0/initvals.h:86:35: warning: â€˜mt76x0_bbp_init_tab’ defined but not used [-Wunused-const-variable=]
 86 | static const struct mt76_reg_pair mt76x0_bbp_init_tab[] = {
 | ^~~~~~~~~~~~~~~~~~~
 drivers/net/wireless/mediatek/mt76/mt76x0/initvals.h:48:35: warning: â€˜mt76x0_mac_reg_table’ defined but not used [-Wunused-const-variable=]
 48 | static const struct mt76_reg_pair mt76x0_mac_reg_table[] = {
 | ^~~~~~~~~~~~~~~~~~~~
 drivers/net/wireless/mediatek/mt76/mt76x0/initvals.h:14:35: warning: â€˜common_mac_reg_table’ defined but not used [-Wunused-const-variable=]
 14 | static const struct mt76_reg_pair common_mac_reg_table[] = {
 | ^~~~~~~~~~~~~~~~~~~~

Cc: Felix Fietkau <nbd@nbd.name>
Cc: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Cc: Ryder Lee <ryder.lee@mediatek.com>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Stanislaw Gruszka <stf_xl@wp.pl>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: linux-mediatek@lists.infradead.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: Use fallthrough pseudo-keyword
Gustavo A. R. Silva [Tue, 1 Sep 2020 17:33:41 +0000 (12:33 -0500)]
mt76: Use fallthrough pseudo-keyword

Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
fall-through markings when it is the case.

[1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: unlock dfs bands
Lorenzo Bianconi [Mon, 24 Aug 2020 10:57:13 +0000 (12:57 +0200)]
mt76: mt7615: unlock dfs bands

Unlock dfs channels for mt7615 devices since the driver supports
radar detection. Dfs pattern detector has been tested successfully by
mt7615 users.
Do not unlock DFS frequencies for mt7663 devices since it has not been
tested yet.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7663: check isr read return value in mt7663s_rx_work
Lorenzo Bianconi [Sat, 5 Sep 2020 09:26:07 +0000 (11:26 +0200)]
mt76: mt7663: check isr read return value in mt7663s_rx_work

In order to avoid using stale isr values, check return value from
sdio_readsb() in mt7663s_rx_work()

Tested-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7663s: introduce sdio tx aggregation
Lorenzo Bianconi [Sat, 5 Sep 2020 09:26:06 +0000 (11:26 +0200)]
mt76: mt7663s: introduce sdio tx aggregation

Introduce sdio tx aggregation to reduce bus transaction ands improve tx
throughput. For the moment the skb are copied in a dedicated buffer
since mmc APIs do not support sg table for zero-copy.
Since skb data are already copied in xmit_buff[], avoid linearization in
ma80211 layer. Relying on tx aggregation, we improve tx tpt of ~65%.

Tested-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7663s: fix possible quota leak in mt7663s_refill_sched_quota
Lorenzo Bianconi [Sat, 5 Sep 2020 09:26:05 +0000 (11:26 +0200)]
mt76: mt7663s: fix possible quota leak in mt7663s_refill_sched_quota

Look just at reported quota since the hw sporadically reports mcu tx
quota without setting WHIER_TX_DONE_INT_EN bit

Tested-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: move pad estimation out of mt76_skb_adjust_pad
Lorenzo Bianconi [Sat, 5 Sep 2020 09:26:04 +0000 (11:26 +0200)]
mt76: move pad estimation out of mt76_skb_adjust_pad

Move frame pad computation out of mt76_skb_adjust_pad routine.
This is a preliminary patch to introduce sdio tx aggregation.

Tested-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7663s: introduce __mt7663s_xmit_queue routine
Lorenzo Bianconi [Sat, 5 Sep 2020 09:26:03 +0000 (11:26 +0200)]
mt76: mt7663s: introduce __mt7663s_xmit_queue routine

This is a preliminary patch to introduce sdio tx aggregation

Tested-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7663s: split mt7663s_tx_update_sched in mt7663s_tx_{pick,update}_quota
Lorenzo Bianconi [Sat, 5 Sep 2020 09:26:02 +0000 (11:26 +0200)]
mt76: mt7663s: split mt7663s_tx_update_sched in mt7663s_tx_{pick,update}_quota

In order to not update the available quota in case of a tx error, split
mt7663s_tx_update_sched in mt7663s_tx_{pick,update}_quota routines

Tested-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7663s: do not use altx for ctl/mgmt traffic
Lorenzo Bianconi [Sat, 5 Sep 2020 09:26:01 +0000 (11:26 +0200)]
mt76: mt7663s: do not use altx for ctl/mgmt traffic

Since the sdio engine does not report quota for altx queue, move
ctl/mgmt traffic to standard data queues

Tested-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7622: fix fw hang on mt7622
Lorenzo Bianconi [Tue, 8 Sep 2020 11:54:03 +0000 (13:54 +0200)]
mt76: mt7622: fix fw hang on mt7622

Set poll timeout to 3s for mt7622 devices in order to avoid fw hangs.
Swap mt7622_trigger_hif_int and doorbell configuration order in
mt7615_mcu_drv_pmctrl routine.
Introduce mt7615_mcu_lp_drv_pmctrl routine to take care of drv_own
configuration for runtime-pm.

Fixes: 08523a2a1db5 ("mt76: mt7615: add mt7615_pm_wake utility routine")
Fixes: 894b7767ec2f ("mt76: mt7615: improve mt7615_driver_own reliability")
Fixes: 757b0e7fd6f4 ("mt76: mt7615: avoid polling in fw_own for mt7663")
Co-developed-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: fix VHT LDPC capability
Ryder Lee [Fri, 4 Sep 2020 21:16:05 +0000 (05:16 +0800)]
mt76: mt7615: fix VHT LDPC capability

The MCU field should contain a boolean 0/1, not the flag itself.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: Remove set but unused variable 'index'
Wang Hai [Mon, 7 Sep 2020 14:10:02 +0000 (22:10 +0800)]
mt76: mt7615: Remove set but unused variable 'index'

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

drivers/net/wireless/mediatek/mt76/mt7615/testmode.c: In function mt7615_tm_set_tx_power
drivers/net/wireless/mediatek/mt76/mt7615/testmode.c:83:7: warning: variable â€˜index’ set but not used [-Wunused-but-set-variable]=

commit 4f0bce1c8888 ("mt76: mt7615: implement testmode support")
involved this unused variable, remove it.

Signed-off-by: Wang Hai <wanghai38@huawei.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: remove retry_q from struct mt76_txq and related code
Felix Fietkau [Wed, 2 Sep 2020 11:39:00 +0000 (13:39 +0200)]
mt76: remove retry_q from struct mt76_txq and related code

Since the switch to using AQL by default, mtxq->retry_q is never filled anymore
Remove it to get rid of a few more unnecessary cycles in the tx path

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: move txwi handling code to dma.c, since it is mmio specific
Felix Fietkau [Tue, 1 Sep 2020 16:48:40 +0000 (18:48 +0200)]
mt76: move txwi handling code to dma.c, since it is mmio specific

This way we can make some functions static

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: fix queue/tid mapping for airtime reporting
Felix Fietkau [Tue, 1 Sep 2020 21:41:30 +0000 (23:41 +0200)]
mt76: mt7915: fix queue/tid mapping for airtime reporting

Unlike 7615, 7915 uses the same AC index for rx and tx, which matches the
LMAC queue mapping

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: simplify mt7915_lmac_mapping
Felix Fietkau [Tue, 1 Sep 2020 19:26:33 +0000 (21:26 +0200)]
mt76: mt7915: simplify mt7915_lmac_mapping

Compared to mac80211 ACs, MT7915 queue numbers are in reverse order
There is no need for the defensive WARN_ON_ONCE, so we can simplify
the function to avoid the array lookup

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: dma: cache dma map address/len in struct mt76_queue_entry
Felix Fietkau [Thu, 27 Aug 2020 05:58:32 +0000 (07:58 +0200)]
mt76: dma: cache dma map address/len in struct mt76_queue_entry

Accessing them from uncached memory can be expensive, so it's cheaper to
cache them

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: fix HE BSS info
Felix Fietkau [Thu, 27 Aug 2020 07:05:46 +0000 (09:05 +0200)]
mt76: mt7915: fix HE BSS info

he_pe_duration and he_rts_thres have the same unit as the fields in the HE
operation IE

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: convert from tx tasklet to tx worker thread
Felix Fietkau [Fri, 24 Jul 2020 14:11:52 +0000 (16:11 +0200)]
mt76: convert from tx tasklet to tx worker thread

This improves performance by allowing the scheduler to move the tx scheduling
work to idle CPUs. Since tx scheduling work is very latency sensitive and
kept short via AQL, sched_set_fifo_low is used to keep worker priority above
normal tasks

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: add utility functions for deferring work to a kernel thread
Felix Fietkau [Fri, 24 Jul 2020 12:43:49 +0000 (14:43 +0200)]
mt76: add utility functions for deferring work to a kernel thread

In order to avoid keeping work like tx scheduling pinned to the CPU it was
scheduled from, it makes sense to switch from tasklets to kernel threads.

Unlike a workqueue, this one only allows one fixed worker function to be
executed by the worker thread. Because of that, there is less locking
and less code for scheduling involved.
This is important because the tx worker is scheduled often in a hot path

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: testmode: add a limit for queued tx_frames packets
Felix Fietkau [Tue, 8 Sep 2020 17:12:22 +0000 (19:12 +0200)]
mt76: testmode: add a limit for queued tx_frames packets

This avoids running out of available tx tokens

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: fix antenna selection for testmode tx_frames
Felix Fietkau [Tue, 25 Aug 2020 09:07:00 +0000 (11:07 +0200)]
mt76: mt7615: fix antenna selection for testmode tx_frames

Do not alter the tx/rx chain settings during channel setup, antennas are
remapped by the testmode specific register writes already

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: fix MT_ANT_SWITCH_CON register definition
Felix Fietkau [Tue, 25 Aug 2020 05:38:00 +0000 (07:38 +0200)]
mt76: mt7615: fix MT_ANT_SWITCH_CON register definition

This is used for testmode tx antenna selection

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: fix unexpected firmware mode
Chih-Min Chen [Fri, 4 Sep 2020 05:51:02 +0000 (13:51 +0800)]
mt76: mt7915: fix unexpected firmware mode

Avoid firmware falling into spectrum mode since that will set
unexpected PSE/PLE thresholds which lead to Tx hang.

This mode should be cleaned before firmware download stage.

Signed-off-by: Chih-Min Chen <chih-min.chen@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt76x02: tune tx ring size
Felix Fietkau [Mon, 24 Aug 2020 07:41:27 +0000 (09:41 +0200)]
mt76: mt76x02: tune tx ring size

Increase data queue size to improve performance.
Reduce PS/mgmt queue size

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7603: tune tx ring size
Felix Fietkau [Mon, 24 Aug 2020 07:37:45 +0000 (09:37 +0200)]
mt76: mt7603: tune tx ring size

Stop relying on global tx ring size, reduce size for PS/mgmt queue

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: remove struct mt76_sw_queue
Felix Fietkau [Sun, 23 Aug 2020 19:43:51 +0000 (21:43 +0200)]
mt76: remove struct mt76_sw_queue

All members except for the struct mt76_queue pointer have been removed

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: rely on AQL for burst size limits on tx queueing
Felix Fietkau [Sun, 23 Aug 2020 19:22:20 +0000 (21:22 +0200)]
mt76: rely on AQL for burst size limits on tx queueing

Now that AQL works well on all mt76 drivers, completely replace the arbitrary
burst sizing and number of bursts logic for tx scheduling.
For the short period of time in which AQL does not work well yet, limit each
stations to 16 in-flight packets that have no estimated tx time.
This should avoid filling the queue if a station connects and queues up a
large number of packets before rate control information is available, especially
with hardware rate control

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: remove swq from struct mt76_sw_queue
Felix Fietkau [Sun, 23 Aug 2020 16:21:18 +0000 (18:21 +0200)]
mt76: remove swq from struct mt76_sw_queue

Since txq selection was moved to mac80211, it is no longer used

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: remove qid argument to drv->tx_complete_skb
Felix Fietkau [Sun, 23 Aug 2020 13:08:02 +0000 (15:08 +0200)]
mt76: remove qid argument to drv->tx_complete_skb

It is not needed

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: unify queue tx cleanup code
Felix Fietkau [Sun, 23 Aug 2020 12:50:13 +0000 (14:50 +0200)]
mt76: unify queue tx cleanup code

Cleanup and preparation for changing tx scheduling behavior

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: sdio: fix use of q->head and q->tail
Felix Fietkau [Sun, 23 Aug 2020 10:43:19 +0000 (12:43 +0200)]
mt76: sdio: fix use of q->head and q->tail

Their use is reversed compared to DMA. The order for DMA makes more sense,
so let's use that

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: usb: fix use of q->head and q->tail
Felix Fietkau [Sun, 23 Aug 2020 10:42:18 +0000 (12:42 +0200)]
mt76: usb: fix use of q->head and q->tail

Their use is reversed compared to DMA. The order for DMA makes more sense,
so let's use that

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7603: check for single-stream EEPROM configuration
Felix Fietkau [Tue, 25 Aug 2020 05:03:37 +0000 (07:03 +0200)]
mt76: mt7603: check for single-stream EEPROM configuration

Some devices using MT7628 or MT7603 have only one antenna chain connected.
Detect these using the EEPROM rx/tx path settings

Reported-by: Qin Wei <me@vonger.cn>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: add memory barrier to DMA queue kick
Felix Fietkau [Tue, 24 Mar 2020 10:57:43 +0000 (11:57 +0100)]
mt76: add memory barrier to DMA queue kick

Ensure that descriptor memory has been fully written before letting the
hardware read it

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: add support for accessing mapped registers via bus ops
Felix Fietkau [Sat, 25 Jul 2020 07:40:43 +0000 (09:40 +0200)]
mt76: mt7915: add support for accessing mapped registers via bus ops

Makes it possible to read/write them via debugfs, similar to mt7615/7603

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: significantly reduce interrupt load
Felix Fietkau [Sat, 22 Aug 2020 15:18:37 +0000 (17:18 +0200)]
mt76: mt7615: significantly reduce interrupt load

On 7615 and newer, DMA completion only triggers unmap, but not free of queued
skbs, since pointers to packets are queued internally.
Because of that, there is no need to process the main data queue immediately
on DMA completion.
To improve performance, mask out the DMA data queue completion interrupt and
process the queue only when we receive a txfree event.
This brings the number of interrupts under load down to a small fraction.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: significantly reduce interrupt load
Felix Fietkau [Sat, 22 Aug 2020 12:41:42 +0000 (14:41 +0200)]
mt76: mt7915: significantly reduce interrupt load

On 7615 and newer, DMA completion only triggers unmap, but not free of queued
skbs, since pointers to packets are queued internally.
Because of that, there is no need to process the main data queue immediately
on DMA completion.
To improve performance, mask out the DMA data queue completion interrupt and
process the queue only when we receive a txfree event.
This brings the number of interrupts under load down to a small fraction.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: schedule tx tasklet in mt7915_mac_tx_free
Felix Fietkau [Tue, 28 Jul 2020 18:07:49 +0000 (20:07 +0200)]
mt76: mt7915: schedule tx tasklet in mt7915_mac_tx_free

The previous scheduling round may have been limited by AQL.
More frames might be available after the tx free run.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: dma: update q->queued immediately on cleanup
Felix Fietkau [Thu, 6 Aug 2020 14:39:33 +0000 (16:39 +0200)]
mt76: dma: update q->queued immediately on cleanup

Tx cleanup and tx enqueuing can run in parallel. In order to avoid queue
starvation issues under load, update q->queued immediately.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: optimize mt7915_mac_sta_poll
Felix Fietkau [Thu, 20 Aug 2020 09:41:16 +0000 (11:41 +0200)]
mt76: mt7915: optimize mt7915_mac_sta_poll

Since DMA completion does not imply tx completion, it makes more sense to
poll for airtime from mt7915_mac_tx_free.
Reduce the runtime of the function by moving all items from dev->sta_poll_list
to a local list once and process any stations that were added afterwards
on the next run

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: fix reading airtime statistics
Felix Fietkau [Tue, 18 Aug 2020 10:44:05 +0000 (12:44 +0200)]
mt76: mt7615: fix reading airtime statistics

- change the WTBL LMAC access function to set the mapping window only once
- use ac * 2 as offset, since each AC has separate words for rx and tx

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7663u: fix dma header initialization
Lorenzo Bianconi [Mon, 24 Aug 2020 18:55:12 +0000 (20:55 +0200)]
mt76: mt7663u: fix dma header initialization

Fix length field corruption in usb dma header introduced adding sdio
support

Fixes: 75b10f0cbd0b ("mt76: mt76u: add mt76_skb_adjust_pad utility routine")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: fix a possible NULL pointer dereference in mt76_testmode_dump
Lorenzo Bianconi [Fri, 21 Aug 2020 10:52:15 +0000 (12:52 +0200)]
mt76: fix a possible NULL pointer dereference in mt76_testmode_dump

Fix a possible NULL pointer dereference in mt76_testmode_dump() since
nla_nest_start returns NULL in case of error

Fixes: f0efa8621550e ("mt76: add API for testmode support")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: fix a possible NULL pointer dereference in mt7615_pm_wake_work
Lorenzo Bianconi [Fri, 21 Aug 2020 10:09:54 +0000 (12:09 +0200)]
mt76: mt7615: fix a possible NULL pointer dereference in mt7615_pm_wake_work

Initialize wcid to global_wcid if msta is NULL in mt7615_pm_wake_work
routine since wcid will be dereferenced running mt76_tx()

Fixes: 2b8cdfb28d340 ("mt76: mt7615: wake device before pushing frames in mt7615_tx")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: fix possible memory leak in mt7615_tm_set_tx_power
Lorenzo Bianconi [Fri, 21 Aug 2020 09:19:51 +0000 (11:19 +0200)]
mt76: mt7615: fix possible memory leak in mt7615_tm_set_tx_power

Fix a memory leak in mt7615_tm_set_tx_power routine if
mt7615_eeprom_get_target_power_index fails.
Moreover do not account req_header twice in mcu skb allocation.

Fixes: 4f0bce1c88882 ("mt76: mt7615: implement testmode support")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7663s: fix unable to handle kernel paging request
Sean Wang [Tue, 18 Aug 2020 04:12:28 +0000 (12:12 +0800)]
mt76: mt7663s: fix unable to handle kernel paging request

Use buffer allocated with kmalloc instead of with stack to fix kernel
crash due to Unable to handle kernel paging request at virtual address
ffffffc0095cbce8.

[  156.977349] Unable to handle kernel paging request at virtual address ffffffc0095cbce8
[  156.985270] Mem abort info:
[  156.988059]   ESR = 0x96000045
[  156.991104]   Exception class = DABT (current EL), IL = 32 bits
[  156.997013]   SET = 0, FnV = 0
[  157.000057]   EA = 0, S1PTW = 0
[  157.003190] Data abort info:
[  157.006061]   ISV = 0, ISS = 0x00000045
[  157.009887]   CM = 0, WnR = 1
[  157.012850] swapper pgtable: 4k pages, 39-bit VAs, pgdp = 0000000042adcba2
[  157.019715] [ffffffc0095cbce8] pgd=0000000000000000, pud=0000000000000000
[  157.026499] Internal error: Oops: 96000045 [#1] PREEMPT SMP
[  157.032065] Modules linked in: mt7663s mt7663_usb_sdio_common mt7615_common

...

[  157.073007] Process CompositorTileW (pid: 1625, stack limit = 0x000000003f2389fc)
[  157.080484] CPU: 0 PID: 1625 Comm: CompositorTileW Not tainted 4.19.137 #36
[  157.092219] pstate: 80000085 (Nzcv daIf -PAN -UAO)
[  157.097012] pc : __memcpy+0xc0/0x180
[  157.100585] lr : swiotlb_tbl_unmap_single+0x84/0x14c
[  157.105540] sp : ffffff8008003cb0
[  157.108845] x29: ffffff8008003cb0 x28: ffffff9c1a211f60
[  157.114149] x27: ffffff9c19ecc018 x26: 0000000000001000
[  157.119452] x25: ffffff9c1a378000 x24: 0000000000000001
[  157.124755] x23: ffffff9c1a378000 x22: 00000000000001ff
[  157.130058] x21: 0000000000000000 x20: 00000000fbefe800
[  157.135360] x19: 0000000000000070 x18: 0000000000000000
[  157.140663] x17: 0000000000000000 x16: 0000000000000000
[  157.145965] x15: 0000000000000000 x14: 0000000000000000
[  157.151267] x13: 0000000000000000 x12: 000000000000000d
[  157.156569] x11: 000000000000000c x10: 0000000a7befe800
[  157.161873] x9 : fffffff680000000 x8 : 0000000000000000
[  157.167175] x7 : 0000000100000003 x6 : ffffffc0095cbce8
[  157.172479] x5 : 0000000000000000 x4 : 0000000000000000
[  157.177781] x3 : 0000000000000002 x2 : fffffffffffffff0
[  157.183085] x1 : ffffffca7befe810 x0 : ffffffc0095cbce8
[  157.188389] Call trace:
[  157.190832]  __memcpy+0xc0/0x180
[  157.194053]  swiotlb_unmap_sg_attrs+0xa8/0xb0
[  157.198406]  __swiotlb_unmap_sg_attrs+0x8c/0xa4
[  157.202931]  msdc_unprepare_data+0x6c/0x84
[  157.207019]  msdc_request_done+0x58/0x98
[  157.210934]  msdc_data_xfer_done+0x1a8/0x1d0
[  157.215195]  msdc_irq+0x12c/0x17c
[  157.218505]  __handle_irq_event_percpu+0xd8/0x298
[  157.223202]  handle_irq_event+0x60/0xdc
[  157.227031]  handle_fasteoi_irq+0xa4/0x1d4
[  157.231120]  __handle_domain_irq+0x84/0xc4
[  157.235210]  gic_handle_irq+0x124/0x1a4
[  157.239038]  el0_irq_naked+0x4c/0x54
[  157.242608] Code: 14000028 f1020042 5400024a a8c12027 (a88120c7)
[  157.248693] ---[ end trace 28b8090135b0a2e1 ]---
[  157.265589] Kernel panic - not syncing: Fatal exception in interrupt
[  157.271944] SMP: stopping secondary CPUs
[  157.275865] Kernel Offset: 0x1c10e00000 from 0xffffff8008000000
[  157.281779] CPU features: 0x0,2188200c
[  157.285519] Memory Limit: none

Fixes: a66cbdd6573d ("mt76: mt7615: introduce mt7663s support")
Co-developed-by: YN Chen <YN.Chen@mediatek.com>
Signed-off-by: YN Chen <YN.Chen@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7663s: fix resume failure
Sean Wang [Thu, 13 Aug 2020 21:49:47 +0000 (05:49 +0800)]
mt76: mt7663s: fix resume failure

MT7663s have to rely on MMC_PM_KEEP_POWER in pm_flags for to avoid SDIO
power is being shut off.

To fix sdio access failure like "mt7663s mmc1:0001:1: sdio write failed:
-22" for the first sdio command to access the bus in the resume handler.

Fixes: a66cbdd6573d ("mt76: mt7615: introduce mt7663s support")
Co-developed-by: YN Chen <YN.Chen@mediatek.com>
Signed-off-by: YN Chen <YN.Chen@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7663s: use NULL instead of 0 in sdio code
Lorenzo Bianconi [Thu, 13 Aug 2020 09:55:52 +0000 (11:55 +0200)]
mt76: mt7663s: use NULL instead of 0 in sdio code

Fix the following sparse warnings in mt7663s driver:

drivers/net/wireless/mediatek/mt76/mt7615/sdio_mcu.c:78:62: warning:
Using plain integer as NULL pointer
drivers/net/wireless/mediatek/mt76/mt7615/sdio_mcu.c:110:62: warning:
Using plain integer as NULL pointer
drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c:229:64: warning:
Using plain integer as NULL pointer
drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c:263:64: warning:
Using plain integer as NULL pointer

Fixes: a66cbdd6573d ("mt76: mt7615: introduce mt7663s support")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: release mutex in mt7615_reset_test_set
Lorenzo Bianconi [Sat, 8 Aug 2020 18:25:41 +0000 (20:25 +0200)]
mt76: mt7615: release mutex in mt7615_reset_test_set

Reduce scope of mutex_acquire/mutex_release in mt7615_reset_test_set
routine in order to fix the following static checker warning:

drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c:179
mt7615_reset_test_set()
warn: inconsistent returns 'dev->mt76.mutex'.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: ea4906c4be49 ("mt76: mt7615: wake device before accessing regmap in debugfs")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: add Tx A-MSDU offloading support
Ryder Lee [Tue, 11 Aug 2020 07:59:57 +0000 (09:59 +0200)]
mt76: mt7915: add Tx A-MSDU offloading support

This disables the software A-MSDU aggregation in mac80211 and enables hardware
offloading

Suggested-by: Yiwei Chung <yiwei.chung@mediatek.com>
Suggested-by: YF Luo <yf.luo@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Co-developed-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: add missing flags in WMM parameter settings
Felix Fietkau [Sat, 8 Aug 2020 19:22:53 +0000 (21:22 +0200)]
mt76: mt7915: add missing flags in WMM parameter settings

Indicate the filled parameter to the firmware

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: simplify aggregation session check
Felix Fietkau [Tue, 28 Jul 2020 21:30:08 +0000 (23:30 +0200)]
mt76: mt7915: simplify aggregation session check

Use the txwi data as primary source information to avoid touching skb data
Use bitfield instead of state variable + spinlock

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: remove mtxq->agg_ssn assignment
Felix Fietkau [Tue, 28 Jul 2020 18:48:42 +0000 (20:48 +0200)]
mt76: mt7615: remove mtxq->agg_ssn assignment

It is not used anywhere for this driver

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: move mt76_check_agg_ssn to driver tx_prepare calls
Felix Fietkau [Tue, 28 Jul 2020 18:41:09 +0000 (20:41 +0200)]
mt76: move mt76_check_agg_ssn to driver tx_prepare calls

mt7615 and newer drivers do not need this, since they use sequence number offload
Moving this code also reduces the number of callsites to make it easier to review

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: enable offloading of sequence number assignment
Felix Fietkau [Mon, 27 Jul 2020 13:33:12 +0000 (15:33 +0200)]
mt76: mt7915: enable offloading of sequence number assignment

Preparation for supporting more offload features

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: increase tx retry count
Felix Fietkau [Sat, 8 Aug 2020 19:36:53 +0000 (21:36 +0200)]
mt76: mt7915: increase tx retry count

Set it to 15 to match reference driver

Signed-off-by: Felix Fietkau <nbd@nbd.name>