Maxime Chevallier [Fri, 2 Sep 2022 08:32:01 +0000 (10:32 +0200)]
dt-bindings: net: Convert Altera TSE bindings to yaml
Convert the bindings for the Altera Triple-Speed Ethernet to yaml.
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
David S. Miller [Sun, 4 Sep 2022 10:24:34 +0000 (11:24 +0100)]
Merge tag 'wireless-next-2022-09-03' of git://git./linux/kernel/git/wireless/wireless-next
Johannes Berg says:
====================
drivers
- rtw89: large update across the map, e.g. coex, pci(e), etc.
- ath9k: uninit memory read fix
- ath10k: small peer map fix and a WCN3990 device fix
- wfx: underflow
stack
- the "change MAC address while IFF_UP" change from James
we discussed
- more MLO work, including a set of fixes for the previous
code, now that we have more code we can exercise it more
- prevent some features with MLO that aren't ready yet
(AP_VLAN and 4-address connections)
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Johannes Berg [Fri, 2 Sep 2022 14:12:49 +0000 (16:12 +0200)]
wifi: mac80211_hwsim: fix multi-channel handling in netlink RX
In netlink RX, now that we can actually have multiple
channel contexts for MLO, things don't work well as we
only keep a single pointer, and then on link switching
we might NULL it, and hit the return if the channel is
NULL.
However, we already use mac80211_hwsim_tx_iter() which
deals with all this, so remove the test and adjust the
remaining code a bit.
This then means we no longer use the chanctx pointer,
so remove it as well.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Johannes Berg [Fri, 2 Sep 2022 14:12:51 +0000 (16:12 +0200)]
wifi: mac80211: call drv_sta_state() under sdata_lock() in reconfig
Currently, other paths calling drv_sta_state() hold the mutex
and therefore drivers can assume that, and look at links with
that protection. Fix that for the reconfig path as well; to
do it more easily use ieee80211_reconfig_stations() for the
AP/AP_VLAN station reconfig as well.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Johannes Berg [Fri, 2 Sep 2022 14:12:50 +0000 (16:12 +0200)]
wifi: nl80211: add MLD address to assoc BSS entries
Add an MLD address attribute to BSS entries that the interface
is currently associated with to help userspace figure out what's
going on.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Johannes Berg [Fri, 2 Sep 2022 14:12:46 +0000 (16:12 +0200)]
wifi: mac80211: mlme: refactor QoS settings code
Refactor the code to apply QoS settings to the driver so
we can call it on link switch.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Johannes Berg [Fri, 2 Sep 2022 14:12:39 +0000 (16:12 +0200)]
wifi: mac80211_hwsim: warn on invalid link address
Catch the bugs fixed in mac80211 by the previous commits
and warn if an invalid address is added (or removed).
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Johannes Berg [Fri, 2 Sep 2022 14:12:55 +0000 (16:12 +0200)]
wifi: mac80211: fix double SW scan stop
When we stop a not-yet-started scan, we erroneously call
into the driver, causing a sequence of sw_scan_start()
followed by sw_scan_complete() twice. This will cause a
warning in hwsim with next in line commit that validates
the address passed to wmediumd/virtio. Fix this by doing
the calls only if we were actually scanning.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Johannes Berg [Fri, 2 Sep 2022 14:12:38 +0000 (16:12 +0200)]
wifi: mac80211: mlme: assign link address correctly
Right now, we assign the link address only after we add
the link to the driver, which is quite obviously wrong.
It happens to work in many cases because it gets updated
immediately, and then link_conf updates may update it,
but it's clearly not really right.
Set the link address during ieee80211_mgd_setup_link()
so it's set before telling the driver about the link.
Fixes:
81151ce462e5 ("wifi: mac80211: support MLO authentication/association with one link")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Johannes Berg [Fri, 2 Sep 2022 14:12:37 +0000 (16:12 +0200)]
wifi: mac80211: move link code to a new file
We probably should've done that originally, we already have
about 300 lines of code there, and will add more. Move all
the link code we wrote to a new file.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Johannes Berg [Fri, 2 Sep 2022 14:12:36 +0000 (16:12 +0200)]
wifi: mac80211_hwsim: refactor RX a bit
Refactor some common RX functionality between the netlink
and non-netlink paths, adding the special hwsim TLV (if
compiled) also in the netlink path.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Johannes Berg [Fri, 2 Sep 2022 14:12:35 +0000 (16:12 +0200)]
wifi: mac80211_hwsim: check STA magic in change_sta_links
Just as an additional check that mac80211 isn't doing
anything strange, add a check of the STA magic (which
gets assigned when the station is added, and cleared
when the station is removed).
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Johannes Berg [Fri, 2 Sep 2022 14:12:34 +0000 (16:12 +0200)]
wifi: mac80211: remove unused arg to ieee80211_chandef_eht_oper
We don't need the sdata argument, and it doesn't make any
sense for a direct conversion from one value to another,
so just remove the argument
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Johannes Berg [Fri, 2 Sep 2022 14:12:33 +0000 (16:12 +0200)]
wifi: mac80211_hwsim: remove multicast workaround
Now that we have proper multicast TX in mac80211, there's
no longer a need to fake something here.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Jinpeng Cui [Mon, 29 Aug 2022 11:29:53 +0000 (11:29 +0000)]
wifi: nl80211: remove redundant err variable
Return value from rdev_set_mcast_rate() directly instead of
taking this in another redundant variable.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Jinpeng Cui <cui.jinpeng2@zte.com.cn>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
James Prestwood [Fri, 26 Aug 2022 17:00:32 +0000 (10:00 -0700)]
wifi: mac80211: Support POWERED_ADDR_CHANGE feature
Adds support in mac80211 for NL80211_EXT_FEATURE_POWERED_ADDR_CHANGE.
The motivation behind this functionality is to fix limitations of
address randomization on frequencies which are disallowed in world
roaming.
The way things work now, if a client wants to randomize their address
per-connection it must power down the device, change the MAC, and
power back up. Here lies a problem since powering down the device
may result in frequencies being disabled (until the regdom is set).
If the desired BSS is on one such frequency the client is unable to
connect once the phy is powered again.
For mac80211 based devices changing the MAC while powered is possible
but currently disallowed (-EBUSY). This patch adds some logic to
allow a MAC change while powered by removing the interface, changing
the MAC, and adding it again. mac80211 will advertise support for
this feature so userspace can determine the best course of action e.g.
disallow address randomization on certain frequencies if not
supported.
There are certain limitations put on this which simplify the logic:
- No active connection
- No offchannel work, including scanning.
Signed-off-by: James Prestwood <prestwoj@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
James Prestwood [Fri, 26 Aug 2022 17:00:31 +0000 (10:00 -0700)]
wifi: nl80211: Add POWERED_ADDR_CHANGE feature
Add a new extended feature bit signifying that the wireless hardware
supports changing the MAC address while the underlying net_device is
powered. Note that this has a different meaning from
IFF_LIVE_ADDR_CHANGE as additional restrictions might be imposed by
the hardware, such as:
- No connection is active on this interface, carrier is off
- No scan is in progress
- No offchannel operations are in progress
Signed-off-by: James Prestwood <prestwoj@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Johannes Berg [Fri, 2 Sep 2022 14:12:58 +0000 (16:12 +0200)]
wifi: mac80211: prevent 4-addr use on MLDs
We haven't tried this yet, and it's not very likely to
work well right now, so for now disable 4-addr use on
interfaces that are MLDs.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://lore.kernel.org/r/20220902161143.f2e4cc2efaa1.I5924e8fb44a2d098b676f5711b36bbc1b1bd68e2@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Johannes Berg [Fri, 2 Sep 2022 14:12:59 +0000 (16:12 +0200)]
wifi: mac80211: prevent VLANs on MLDs
Do not allow VLANs to be added to AP interfaces that are
MLDs, this isn't going to work because the link structs
aren't propagated to the VLAN interfaces yet.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://lore.kernel.org/r/20220902161144.8c88531146e9.If2ef9a3b138d4f16ed2fda91c852da156bdf5e4d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
David S. Miller [Sat, 3 Sep 2022 09:40:40 +0000 (10:40 +0100)]
Merge branch 'net_sched-redundant-resource-cleanups'
Zhengchao Shao says:
====================
net: sched: remove redundant resource cleanup when init() fails
qdisc_create() calls .init() to initialize qdisc. If the initialization
fails, qdisc_create() will call .destroy() to release resources.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Zhengchao Shao [Fri, 2 Sep 2022 08:34:30 +0000 (16:34 +0800)]
net: sched: htb: remove redundant resource cleanup in htb_init()
If htb_init() fails, qdisc_create() invokes htb_destroy() to clear
resources. Therefore, remove redundant resource cleanup in htb_init().
Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Zhengchao Shao [Fri, 2 Sep 2022 08:34:29 +0000 (16:34 +0800)]
net: sched: fq_codel: remove redundant resource cleanup in fq_codel_init()
If fq_codel_init() fails, qdisc_create() invokes fq_codel_destroy() to
clear resources. Therefore, remove redundant resource cleanup in
fq_codel_init().
Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Wei Fang [Fri, 2 Sep 2022 02:30:01 +0000 (10:30 +0800)]
net: fec: add stop mode support for imx8 platform
The current driver support stop mode by calling machine api.
The patch add dts support to set GPR register for stop request.
imx8mq enter stop/exit stop mode by setting GPR bit, which can
be accessed by A core.
imx8qm enter stop/exit stop mode by calling IMX_SC ipc APIs that
communicate with M core ipc service, and the M core set the related
GPR bit at last.
Signed-off-by: Wei Fang <wei.fang@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
André Apitzsch [Thu, 1 Sep 2022 17:00:13 +0000 (19:00 +0200)]
r8152: Add MAC passthrough support for Lenovo Travel Hub
The Lenovo USB-C Travel Hub supports MAC passthrough.
Signed-off-by: André Apitzsch <git@apitzsch.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Gustavo A. R. Silva [Wed, 31 Aug 2022 19:12:42 +0000 (14:12 -0500)]
net/ipv4: Use __DECLARE_FLEX_ARRAY() helper
We now have a cleaner way to keep compatibility with user-space
(a.k.a. not breaking it) when we need to keep in place a one-element
array (for its use in user-space) together with a flexible-array
member (for its use in kernel-space) without making it hard to read
at the source level. This is through the use of the new
__DECLARE_FLEX_ARRAY() helper macro.
The size and memory layout of the structure is preserved after the
changes. See below.
Before changes:
$ pahole -C ip_msfilter net/ipv4/igmp.o
struct ip_msfilter {
union {
struct {
__be32 imsf_multiaddr_aux; /* 0 4 */
__be32 imsf_interface_aux; /* 4 4 */
__u32 imsf_fmode_aux; /* 8 4 */
__u32 imsf_numsrc_aux; /* 12 4 */
__be32 imsf_slist[1]; /* 16 4 */
}; /* 0 20 */
struct {
__be32 imsf_multiaddr; /* 0 4 */
__be32 imsf_interface; /* 4 4 */
__u32 imsf_fmode; /* 8 4 */
__u32 imsf_numsrc; /* 12 4 */
__be32 imsf_slist_flex[0]; /* 16 0 */
}; /* 0 16 */
}; /* 0 20 */
/* size: 20, cachelines: 1, members: 1 */
/* last cacheline: 20 bytes */
};
After changes:
$ pahole -C ip_msfilter net/ipv4/igmp.o
struct ip_msfilter {
__be32 imsf_multiaddr; /* 0 4 */
__be32 imsf_interface; /* 4 4 */
__u32 imsf_fmode; /* 8 4 */
__u32 imsf_numsrc; /* 12 4 */
union {
__be32 imsf_slist[1]; /* 16 4 */
struct {
struct {
} __empty_imsf_slist_flex; /* 16 0 */
__be32 imsf_slist_flex[0]; /* 16 0 */
}; /* 16 0 */
}; /* 16 4 */
/* size: 20, cachelines: 1, members: 5 */
/* last cacheline: 20 bytes */
};
In the past, we had to duplicate the whole original structure within
a union, and update the names of all the members. Now, we just need to
declare the flexible-array member to be used in kernel-space through
the __DECLARE_FLEX_ARRAY() helper together with the one-element array,
within a union. This makes the source code more clean and easier to read.
Link: https://github.com/KSPP/linux/issues/193
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Zhengchao Shao [Thu, 1 Sep 2022 01:16:17 +0000 (09:16 +0800)]
net/sched: cls_api: remove redundant 0 check in tcf_qevent_init()
tcf_qevent_parse_block_index() never returns a zero block_index.
Therefore, it is unnecessary to check the value of block_index in
tcf_qevent_init().
Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Link: https://lore.kernel.org/r/20220901011617.14105-1-shaozhengchao@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
GUO Zihua [Fri, 2 Sep 2022 08:15:21 +0000 (16:15 +0800)]
net: lantiq_etop: Fix return type for implementation of ndo_start_xmit
Since Linux now supports CFI, it will be a good idea to fix mismatched
return type for implementation of hooks. Otherwise this might get
cought out by CFI and cause a panic.
ltq_etop_tx() would return either NETDEV_TX_BUSY or NETDEV_TX_OK, so
change the return type to netdev_tx_t directly.
Signed-off-by: GUO Zihua <guozihua@huawei.com>
Link: https://lore.kernel.org/r/20220902081521.59867-1-guozihua@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
GUO Zihua [Fri, 2 Sep 2022 08:15:50 +0000 (16:15 +0800)]
net: sunplus: Fix return type for implementation of ndo_start_xmit
Since Linux now supports CFI, it will be a good idea to fix mismatched
return type for implementation of hooks. Otherwise this might get
cought out by CFI and cause a panic.
spl2sw_ethernet_start_xmit() would return either NETDEV_TX_BUSY or
NETDEV_TX_OK, so change the return type to netdev_tx_t directly.
Signed-off-by: GUO Zihua <guozihua@huawei.com>
Link: https://lore.kernel.org/r/20220902081550.60095-1-guozihua@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
GUO Zihua [Fri, 2 Sep 2022 08:16:12 +0000 (16:16 +0800)]
net: xscale: Fix return type for implementation of ndo_start_xmit
Since Linux now supports CFI, it will be a good idea to fix mismatched
return type for implementation of hooks. Otherwise this might get
cought out by CFI and cause a panic.
eth_xmit() would return either NETDEV_TX_BUSY or NETDEV_TX_OK, so
change the return type to netdev_tx_t directly.
Signed-off-by: GUO Zihua <guozihua@huawei.com>
Link: https://lore.kernel.org/r/20220902081612.60405-1-guozihua@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
GUO Zihua [Fri, 2 Sep 2022 07:54:07 +0000 (15:54 +0800)]
net: broadcom: Fix return type for implementation of
Since Linux now supports CFI, it will be a good idea to fix mismatched
return type for implementation of hooks. Otherwise this might get
cought out by CFI and cause a panic.
bcm4908_enet_start_xmit() would return either NETDEV_TX_BUSY or
NETDEV_TX_OK, so change the return type to netdev_tx_t directly.
Signed-off-by: GUO Zihua <guozihua@huawei.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20220902075407.52358-1-guozihua@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Gal Pressman [Fri, 2 Sep 2022 03:06:20 +0000 (20:06 -0700)]
net: ieee802154: Fix compilation error when CONFIG_IEEE802154_NL802154_EXPERIMENTAL is disabled
When CONFIG_IEEE802154_NL802154_EXPERIMENTAL is disabled,
NL802154_CMD_DEL_SEC_LEVEL is undefined and results in a compilation
error:
net/ieee802154/nl802154.c:2503:19: error: 'NL802154_CMD_DEL_SEC_LEVEL' undeclared here (not in a function); did you mean 'NL802154_CMD_SET_CCA_ED_LEVEL'?
2503 | .resv_start_op = NL802154_CMD_DEL_SEC_LEVEL + 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
| NL802154_CMD_SET_CCA_ED_LEVEL
Unhide the experimental commands, having them defined in an enum
makes no difference.
Fixes:
9c5d03d36251 ("genetlink: start to validate reserved header bytes")
Signed-off-by: Gal Pressman <gal@nvidia.com>
Acked-by: Stefan Schmidt <stefan@datenfreihafen.org>
Tested-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Link: https://lore.kernel.org/r/20220902030620.2737091-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Jakub Kicinski [Thu, 1 Sep 2022 00:00:58 +0000 (17:00 -0700)]
net: remove netif_tx_napi_add()
All callers are now gone.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Eric Dumazet [Wed, 31 Aug 2022 18:44:27 +0000 (18:44 +0000)]
net: bql: add more documentation
Add some documentation for netdev_tx_sent_queue() and
netdev_tx_completed_queue()
Stating that netdev_tx_completed_queue() must be called once
per TX completion round is apparently not obvious for everybody.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
David S. Miller [Fri, 2 Sep 2022 11:08:44 +0000 (12:08 +0100)]
Merge branch 'net-ipa-transaction-state-IDs'
Alex Elder says:
====================
net: ipa: use IDs to track transaction state
This series is the first of three groups of changes that simplify
the way the IPA driver tracks the state of its transactions.
Each GSI channel has a fixed number of transactions allocated at
initialization time. The number allocated matches the number of
TREs in the transfer ring associated with the channel. This is
because the transfer ring limits the number of transfers that can
ever be underway, and in the worst case, each transaction represents
a single TRE.
Transactions go through various states during their lifetime.
Currently a set of lists keeps track of which transactions are in
each state. Initially, all transactions are free. An allocated
transaction is placed on the allocated list. Once an allocated
transaction is committed, it is moved from the allocated to the
committed list. When a committed transaction is sent to hardware
(via a doorbell) it is moved to the pending list. When hardware
signals that some work has completed, transactions are moved to the
completed list. Finally, when a completed transaction is polled
it's moved to the polled list before being removed when it becomes
free.
Changing a transaction's state thus normally involves manipulating
two lists, and to prevent corruption a spinlock is held while the
lists are updated.
Transactions move through their states in a well-defined sequence
though, and they do so strictly in order. So transaction 0 is
always allocated before transaction 1; transaction 0 is always
committed before transaction 1; and so on, through completion,
polling, and becoming free. Because of this, it's sufficient to
just keep track of which transaction is the first in each state.
The rest of the transactions in a given state can be derived from
the first transaction in an "adjacent" state. As a result, we can
track the state of all transactions with a set of indexes, and can
update these without the need for a spinlock.
This first group of patches just defines the set of indexes that
will be used for this new way of tracking transaction state. Two
more groups of patches will follow. I've broken the 17 patches into
these three groups to facilitate review.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Alex Elder [Wed, 31 Aug 2022 22:40:17 +0000 (17:40 -0500)]
net: ipa: track polled transactions with an ID
Add a transaction ID to track the first element in the transaction
array that has been polled. Advance the ID when we are releasing a
transaction.
Temporarily add warnings that verify that the first polled
transaction tracked by the ID matches the first element on the
polled list, both when polling and freeing.
Remove the temporary warnings added by the previous commit.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Alex Elder [Wed, 31 Aug 2022 22:40:16 +0000 (17:40 -0500)]
net: ipa: track completed transactions with an ID
Add a transaction ID field to track the first element in the
transaction array that has completed but has not yet been polled.
Advance the ID when we are processing a transaction in the NAPI
polling loop (where completed transactions become polled).
Temporarily add warnings that verify that the first completed
transaction tracked by the ID matches the first element on the
completed list, both when pending and completing.
Remove the temporary warnings added by the previous commit.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Alex Elder [Wed, 31 Aug 2022 22:40:15 +0000 (17:40 -0500)]
net: ipa: track pending transactions with an ID
Add a transaction ID field to track the first element in the
transaction array that is pending (sent to hardware) but not yet
complete. Advance the ID when a completion event for a channel
indicates that transactions have completed.
Temporarily add warnings that verify that the first pending
transaction tracked by the ID matches the first element on the
pending list, both when pending and completing, as well as when
resetting the channel.
Remove the temporary warnings added by the previous commit.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Alex Elder [Wed, 31 Aug 2022 22:40:14 +0000 (17:40 -0500)]
net: ipa: track committed transactions with an ID
Add a transaction ID field to track the first element in a channel's
transaction array that has been committed, but not yet passed to the
hardware. Advance the ID when the hardware is notified via doorbell
that TREs from a transaction are ready for consumption.
Temporarily add warnings that verify that the first committed
transaction tracked by the ID matches the first element on the
committed list, both when committing and pending (at doorbell).
Remove the temporary warnings added by the previous commit.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Alex Elder [Wed, 31 Aug 2022 22:40:13 +0000 (17:40 -0500)]
net: ipa: track allocated transactions with an ID
Transactions for a channel are now managed in an array, with a free
transaction ID indicating which is the next one free.
Add another transaction ID field to track the first element in the
array that has been allocated. Advance it when a transaction is
committed (because that is when that transaction leaves allocated
state).
Temporarily add warnings that verify that the first allocated
transaction tracked by the ID matches the first element on the
allocated list, both when allocating and committing a transaction.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Alex Elder [Wed, 31 Aug 2022 22:40:12 +0000 (17:40 -0500)]
net: ipa: use an array for transactions
Transactions are always allocated one at a time. The maximum number
of them we could ever need occurs if each TRE is assigned to a
transaction. So a channel requires no more transactions than the
number of TREs in its transfer ring. That number is known to be a
power-of-2 less than 65536.
The transaction pool abstraction is used for other things, but for
transactions we can use a simple array of transaction structures,
and use a free index to indicate which entry in the array is the
next one free for allocation.
By having the number of elements in the array be a power-of-2, we
can use an ever-incrementing 16-bit free index, and use it modulo
the array size. Distinguish a "trans_id" (whose value can exceed
the number of entries in the transaction array) from a "trans_index"
(which is less than the number of entries).
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
David S. Miller [Fri, 2 Sep 2022 10:37:27 +0000 (11:37 +0100)]
Merge branch 'lan966x-make-reset-optional'
Michael Walle says:
====================
net: lan966x: make reset optional
This is the remaining part of the reset rework on the LAN966x targetting
the netdev tree.
The former series can be found at:
https://lore.kernel.org/lkml/
20220826115607.1148489-1-michael@walle.cc/
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Michael Walle [Wed, 31 Aug 2022 11:18:55 +0000 (13:18 +0200)]
net: lan966x: make reset optional
There is no dedicated reset for just the switch core. The reset which
is used up until now, is more of a global reset, resetting almost the
whole SoC and cause spurious errors by doing so. Make it possible to
handle the reset elsewhere and make the reset optional.
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: David S. Miller <davem@davemloft.net>
Michael Walle [Wed, 31 Aug 2022 11:18:54 +0000 (13:18 +0200)]
dt-bindings: net: sparx5: don't require a reset line
Make the reset line optional. It turns out, there is no dedicated reset
for the switch. Instead, the reset which was used up until now, was kind
of a global reset. This is now handled elsewhere, thus don't require a
reset.
Signed-off-by: Michael Walle <michael@walle.cc>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Wolfram Sang [Tue, 30 Aug 2022 20:14:53 +0000 (22:14 +0200)]
wifi: move from strlcpy with unused retval to strscpy
Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.
Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220830201457.7984-2-wsa+renesas@sang-engineering.com
Jinpeng Cui [Tue, 30 Aug 2022 10:55:05 +0000 (10:55 +0000)]
wifi: wilc1000: remove redundant ret variable
Return value from cfg80211_rx_mgmt() directly instead of
taking this in another redundant variable.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Jinpeng Cui <cui.jinpeng2@zte.com.cn>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220830105505.287564-1-cui.jinpeng2@zte.com.cn
Yang Yingliang [Fri, 26 Aug 2022 02:38:17 +0000 (10:38 +0800)]
wifi: rtw88: add missing destroy_workqueue() on error path in rtw_core_init()
Add the missing destroy_workqueue() before return from rtw_core_init()
in error path.
Fixes:
fe101716c7c9 ("rtw88: replace tx tasklet with work queue")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220826023817.3908255-1-yangyingliang@huawei.com
Dan Carpenter [Fri, 19 Aug 2022 05:23:43 +0000 (08:23 +0300)]
wifi: wfx: prevent underflow in wfx_send_pds()
This does a "chunk_len - 4" subtraction later when it calls:
ret = wfx_hif_configuration(wdev, buf + 4, chunk_len - 4);
so check for "chunk_len" is less than 4.
Fixes:
dcbecb497908 ("staging: wfx: allow new PDS format")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/Yv8eX7Xv2ubUOvW7@kili
Dan Carpenter [Fri, 19 Aug 2022 05:22:32 +0000 (08:22 +0300)]
wifi: rtl8xxxu: tighten bounds checking in rtl8xxxu_read_efuse()
There some bounds checking to ensure that "map_addr" is not out of
bounds before the start of the loop. But the checking needs to be
done as we iterate through the loop because "map_addr" gets larger as
we iterate.
Fixes:
26f1fad29ad9 ("New driver: rtl8xxxu (mac80211)")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Jes Sorensen <Jes.Sorensen@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/Yv8eGLdBslLAk3Ct@kili
Ping-Ke Shih [Fri, 26 Aug 2022 06:10:11 +0000 (14:10 +0800)]
wifi: rtw89: declare to support beamformee above bandwidth 80MHz
Declare this to tell AP we can support beamformee over bandwidth 160M,
and then yield better performance in field.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220826061011.9037-3-pkshih@realtek.com
Ping-Ke Shih [Fri, 26 Aug 2022 06:10:10 +0000 (14:10 +0800)]
wifi: rtw89: correct polling address of address CAM
Writing address to kick hardware to initialize address CAM, and then poll
ready bit to determine completed. Old wrong code poll wrong register
address, so it can lead error and fail to bring up interface.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220826061011.9037-2-pkshih@realtek.com
Ping-Ke Shih [Fri, 26 Aug 2022 06:10:09 +0000 (14:10 +0800)]
wifi: rtw89: no HTC field if TX rate might fallback to legacy
Packets containing HTC field with legacy rate could be dropped by AP. If
TX rate of report is lower than MCS2, hardware might fall back rate to
legacy. Therefore, add a checking rule to avoid HTC field in this
situation.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220826061011.9037-1-pkshih@realtek.com
Ping-Ke Shih [Wed, 24 Aug 2022 06:33:12 +0000 (14:33 +0800)]
wifi: rtw89: pci: correct TX resource checking in low power mode
Number of TX resource must be minimum of TX_BD and TX_WD. Only considering
TX_BD could drop TX packets pulled from mac80211 if TX_WD is unavailable.
Fixes:
52edbb9fb78a ("rtw89: ps: access TX/RX rings via another registers in low power mode")
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220824063312.15784-2-pkshih@realtek.com
Ping-Ke Shih [Wed, 24 Aug 2022 06:33:11 +0000 (14:33 +0800)]
wifi: rtw89: pci: fix interrupt stuck after leaving low power mode
We turn off interrupt in ISR, and re-enable interrupt in threadfn or
napi_poll according to the mode it stays. If we are turning off interrupt,
rtwpci->running flag is unset and interrupt handler stop processing even
if it was called, so disallow to re-enable interrupt in this situation.
Or, wifi chip doesn't trigger interrupt events anymore because interrupt
status (ISR) isn't clear by interrupt handler anymore.
Fixes:
c83dcd0508e2 ("rtw89: pci: add a separate interrupt handler for low power mode")
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220824063312.15784-1-pkshih@realtek.com
Cheng-Chieh Hsieh [Wed, 24 Aug 2022 06:14:25 +0000 (14:14 +0800)]
wifi: rtw89: enlarge the CFO tracking boundary
The calibration value of XTAL offset may be too large in some wifi
modules, that the CFO tracking mechanism under the existing tracking
boundary can not adjust the CFO to the tolerable range. So we enlarge it.
Signed-off-by: Cheng-Chieh Hsieh <cj.hsieh@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220824061425.13764-1-pkshih@realtek.com
Chin-Yen Lee [Fri, 19 Aug 2022 06:48:11 +0000 (14:48 +0800)]
wifi: rtw89: pci: correct suspend/resume setting for variant chips
We find that suspend/resume tests cause 8852CE lost, because some pci
registers are changed for 8852CE. So, correct them accordingly.
Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220819064811.37700-6-pkshih@realtek.com
Chin-Yen Lee [Fri, 19 Aug 2022 06:48:10 +0000 (14:48 +0800)]
wifi: rtw89: pci: enable CLK_REQ, ASPM, L1 and L1ss for 8852c
8852CE controls CLKREQ, ASPM L1, L1ss via wifi registers
instead, so change them accordingly.
Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220819064811.37700-5-pkshih@realtek.com
Chia-Yuan Li [Fri, 19 Aug 2022 06:48:09 +0000 (14:48 +0800)]
wifi: rtw89: pci: fix PCI PHY auto adaption by using software restore
There is chance that PCI PHY auto adaption fail. When first time boot up,
software restore the right adaption value and close PHY auto adaption
mechanism.
Signed-off-by: Chia-Yuan Li <leo.li@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220819064811.37700-4-pkshih@realtek.com
Chia-Yuan Li [Fri, 19 Aug 2022 06:48:08 +0000 (14:48 +0800)]
wifi: rtw89: 8852c: set TBTT shift configuration
It is found that 8852ce loses some beacon after
enabling deep ps mode. We set TBTT shift to wake up
firmware early to open RF/BB for receiving beacon in time.
Signed-off-by: Chia-Yuan Li <leo.li@realtek.com>
Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220819064811.37700-3-pkshih@realtek.com
Chin-Yen Lee [Fri, 19 Aug 2022 06:48:07 +0000 (14:48 +0800)]
wifi: rtw89: add retry to change power_mode state
When starting to send heavy traffic in low power mode,
driver will call multiple tx wake notify to wake firmware
within a short time. In this situation, firmware may miss
power mode change request from driver and leads to status
error. So we change driver to call power_mode_change at most
three times to make sure firmware could get the request.
Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220819064811.37700-2-pkshih@realtek.com
Ping-Ke Shih [Tue, 16 Aug 2022 01:32:47 +0000 (09:32 +0800)]
wifi: rtw89: correct BA CAM allocation
BA CAM entries are global resource of hardware, so move the bitmap and
instances to rtw89_cam_info, and then use link list from rtw89_sta to
these instances.
To check the allocation, add ba_cam to debugfs:
map:
mac_id: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
addr_cam: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
bssid_cam: 01 00 00 00 00 00 00 00
sec_cam: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ba_cam: 03 00 00 00 00 00 00 00
VIF [0] 94:08:53:8e:ef:21
bssid_cam_idx=0
addr_cam_idx=0
-> bssid_cam_idx=0
sec_cam_bitmap=00 00 00 00 00 00 00 00
STA [0] 38:78:62:8b:cb:c6
addr_cam_idx=0
-> bssid_cam_idx=0
sec_cam_bitmap=00 00 00 00 00 00 00 00
ba_cam tid[6]=0, tid[1]=1
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220816013247.6243-4-pkshih@realtek.com
Ping-Ke Shih [Tue, 16 Aug 2022 01:32:46 +0000 (09:32 +0800)]
wifi: rtw89: 8852c: initialize and correct BA CAM content
The bacam_v1 must do additional initialization, and H2C content of BA CAM
is also different. So, correct them accordingly.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220816013247.6243-3-pkshih@realtek.com
Ping-Ke Shih [Tue, 16 Aug 2022 01:32:45 +0000 (09:32 +0800)]
wifi: rtw89: 8852c: declare correct BA CAM number
8852A has 2 BA CAM entries, but 8852C has 8 entries. Add a field to
discriminate their differences.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220816013247.6243-2-pkshih@realtek.com
Zong-Zhe Yang [Fri, 12 Aug 2022 09:31:16 +0000 (17:31 +0800)]
wifi: rtw89: 8852c: update TX power tables to R49
TX power byrate:
doesn't change
TX power limit:
configure values for KCC and UK
refine a bit configuration vales
TX power limit_ru:
configure values for KCC and UK
refine a bit configuration values
change 6GHz to follow indoor setting
configure 6GHz values for ETSI
TX power shape:
change with TX power limit/limit_ru
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220812093116.56791-4-pkshih@realtek.com
Ping-Ke Shih [Fri, 12 Aug 2022 09:31:15 +0000 (17:31 +0800)]
wifi: rtw89: 8852c: update RF radio A/B parameters to R49
Update 8852c radio A/B parameters from internal HALRF_027_00_071 R49.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220812093116.56791-3-pkshih@realtek.com
Zong-Zhe Yang [Fri, 12 Aug 2022 09:31:14 +0000 (17:31 +0800)]
wifi: rtw89: TX power limit/limit_ru consider negative
Some chips' RF TX power limit/limit_ru tables start to configure some
negative values. Fix the setting logic to prevent negative values from
polluting fields of others.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220812093116.56791-2-pkshih@realtek.com
Ching-Te Ku [Mon, 25 Jul 2022 02:35:09 +0000 (10:35 +0800)]
rtw89: coex: Update Wi-Fi driver/firmware TDMA cycle report for RTL8852c
Because RTL8852c firmware handshake use different structure definition
with RTL8852a, so it's necessary to update a version for RTL8852c.
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220725023509.43114-10-pkshih@realtek.com
Ching-Te Ku [Mon, 25 Jul 2022 02:35:08 +0000 (10:35 +0800)]
rtw89: coex: Add v1 Wi-Fi SCC coexistence policy
Because the later firmware had patched some new feature, it can control
the Wi-Fi/BT slots more efficiently. This patch enhance it for better
Wi-Fi SCC mode performance.
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220725023509.43114-9-pkshih@realtek.com
Ching-Te Ku [Mon, 25 Jul 2022 02:35:07 +0000 (10:35 +0800)]
rtw89: coex: Move _set_policy to chip_ops
Due to the difference of Wi-Fi firmware supported feature, RTL8852C
need to defined more policy to enable the features.
(Ex: DBCC, Wi-Fi multi-role, TDMA instant and so on)
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220725023509.43114-8-pkshih@realtek.com
Ching-Te Ku [Mon, 25 Jul 2022 02:35:06 +0000 (10:35 +0800)]
rtw89: coex: update WL role info v1 for RTL8852C branch using
The H2C format and support feature are different. The newer Wi-Fi firmware
and driver branch need to handshake more information like DBCC or P2P
connection info.
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220725023509.43114-7-pkshih@realtek.com
Ching-Te Ku [Mon, 25 Jul 2022 02:35:05 +0000 (10:35 +0800)]
rtw89: coex: Add v1 version TDMA format and parameters
RTL8852C use a later version Wi-Fi firmware, there are some parameters
need to be defined. These new parameter can avoid some unexpected
TDMA mode while Wi-Fi enter/leave lps.
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220725023509.43114-6-pkshih@realtek.com
Ching-Te Ku [Mon, 25 Jul 2022 02:35:04 +0000 (10:35 +0800)]
rtw89: coex: Define BT B1 slot length
It is for setting up BT slot max length at BT auto slot mechanism.
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220725023509.43114-5-pkshih@realtek.com
Ching-Te Ku [Mon, 25 Jul 2022 02:35:03 +0000 (10:35 +0800)]
rtw89: coex: Add logic to parsing rtl8852c firmware type ctrl report
Add a part of logic to parse type of ctrl report from firmware, and
remove Bluetooth packet counter count from driver, the feature was
moved to firmware at rtl8852c.
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220725023509.43114-4-pkshih@realtek.com
Ching-Te Ku [Mon, 25 Jul 2022 02:35:02 +0000 (10:35 +0800)]
rtw89: coex: Move Wi-Fi firmware coexistence matching version to chip
To configure the different chips with different coexistence version,
separated the firmware feature version matching number is necessary.
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220725023509.43114-3-pkshih@realtek.com
Ching-Te Ku [Mon, 25 Jul 2022 02:35:01 +0000 (10:35 +0800)]
rtw89: coex: update radio state for RTL8852A/RTL8852C
Update scoreboard setting to let Bluetooth know Wi-Fi power save state.
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220725023509.43114-2-pkshih@realtek.com
Chia-Yuan Li [Mon, 4 Jul 2022 02:34:53 +0000 (10:34 +0800)]
rtw89: 8852c: adjust mactxen delay of mac/phy interface
mac_txen time is to inform TMAC tx after rx air end.
Modify 8852c value to meet TB SIFS time.
Signed-off-by: Chia-Yuan Li <leo.li@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220704023453.19935-7-pkshih@realtek.com
Chia-Yuan Li [Mon, 4 Jul 2022 02:34:52 +0000 (10:34 +0800)]
rtw89: 8852c: modify PCIE prebkf time
Prebkf time is to inform generating tx command if remaining backoff
time less than this setting value.
It might cause SER if generating tx command early in security mode.
Signed-off-by: Chia-Yuan Li <leo.li@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220704023453.19935-6-pkshih@realtek.com
Zong-Zhe Yang [Mon, 4 Jul 2022 02:34:51 +0000 (10:34 +0800)]
rtw89: ser: leave lps with mutex
Calling rtw89_leave_lps() should hold rtwdev::mutex.
So, fix it.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220704023453.19935-5-pkshih@realtek.com
Ping-Ke Shih [Mon, 4 Jul 2022 02:34:50 +0000 (10:34 +0800)]
rtw89: declare support HE HTC always
Correct ability of HE HTC that both STA and AP mode can support.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220704023453.19935-4-pkshih@realtek.com
Zong-Zhe Yang [Mon, 4 Jul 2022 02:34:49 +0000 (10:34 +0800)]
rtw89: 8852a: update HW setting on BB
Sometimes, BB might encounter RX problem on OFDM 6M. It's not quite
easy to happen, but if it happens, we will keep getting stuck on RX.
And, since we cannot properly receive layer 2 ACK, it also casues TX
problem, e.g. constantly retrying TX. Eventually, after some time, we
would get disconnected due to abnormal behavior.
Update break setting and phy status parsing time to make BB get out
of stuck state faster.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220704023453.19935-3-pkshih@realtek.com
Po-Hao Huang [Mon, 4 Jul 2022 02:34:48 +0000 (10:34 +0800)]
rtw89: 8852c: disable dma during mac init
Without this patch, our hardware attempts to perform dma while device
cpu restarts, and leads to iommu page faults caused by invalid requests.
Some platforms show warning messages as below:
rtw89_8852ce 0000:01:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT
domain=0x000a address=0x10000000004 flags=0x0030]
Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220704023453.19935-2-pkshih@realtek.com
Zong-Zhe Yang [Tue, 9 Aug 2022 10:49:52 +0000 (18:49 +0800)]
wifi: rtw89: early recognize FW feature to decide if chanctx
In current flow, FW is asynchronously loaded after alloc_hw(). It defers
the decision on FW feature map. It makes things difficult for us to decide
whether to hook chanctx ops, which should be decided while alloc_hw() is
calling. Still, asynchronous gets its advantages. So, we want to resolve
this without dropping them.
Based on multi-FW flag, RTW89_MFW_SIG, we can determine runtime FW is
multi-FW (MFW) or single FW (SFW). Both of them have a quite small chunk
for header at the head. The difference is that MFW doesn't describe version
code in its header while SFW does. So, we plan to extend MFW header for
version code. After that, in both cases, we can determine FW feature map by
just FW header. And, according to the map, we can decide chanctx.
So, we call request_partial_firmware_into_buf() to request a quite small
chunk before alloc_hw() to get a early FW feature map without affecting
things much and only use early map to decide whether to hook chanctx ops.
It means that if non-extended MFW is used at runtime, driver just acts
without chanctx as before. If extended MFW or SFW, which supports required
FW features, is used at runtime, driver can hook chanctx ops to mac80211 if
chip has configured support_chanctx_num > 0.
Besides, key point for now to support single one chanctx is whether HW scan
is supported at runtime. So, we configure all chip's support_chanctx_num to
1, and check if HW scan is supported at runtime via early FW feature map.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220809104952.61355-14-pkshih@realtek.com
Zong-Zhe Yang [Tue, 9 Aug 2022 10:49:51 +0000 (18:49 +0800)]
wifi: rtw89: declare support for mac80211 chanctx ops by chip
Some HW features are required if we hook chanctx ops to mac80211. With it,
mac80211 would expect the HW-supported variant ops exists on some behavior,
e.g. HW scan. But, HW features may depend on chip's FW or its development.
Besides, how many chanctx can be supported also depends on chip design.
We can neither decide whether to generally support chanctx ops nor how many
chanctx can be supported.
So, support_chanctx_num is added under chip info to deal with this by chip.
For now, all chip configure support_chanctx_num as 0. We haven't really
hook chanctx ops yet. So, chip can run without mac80211 chanctx as before.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220809104952.61355-13-pkshih@realtek.com
Zong-Zhe Yang [Tue, 9 Aug 2022 10:49:50 +0000 (18:49 +0800)]
wifi: rtw89: add skeleton of mac80211 chanctx ops support
Support mac80211 chanctx series ops. Still, currently support
single channel. Based on this premise, things should be similar
to before. So, we haven't dealt with relationship between vif
and chanctx in depth. Instead, we leave both ::assign_vif()
and ::unassign_vif() as noops for now.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220809104952.61355-12-pkshih@realtek.com
Zong-Zhe Yang [Tue, 9 Aug 2022 10:49:49 +0000 (18:49 +0800)]
wifi: rtw89: introduce entity mode and its recalculated prototype
After supporting more than one channel, we need entity mode to decide
how to set current channel(s) on the sub-entities. This decision may
happen on set_channel() and rtw89_core_set_chip_txpwr().
For now, we support single one channel and use only first HW entry,
i.e. RTW89_SUB_ENTITY_0, RTW89_MAC_0, RTW89_PHY_0. Without something
unexpected, the entity mode should always be RTW89_ENT_MODE_SCC after
recalcated, where SCC means single channel concurrency. So, an assert
is added in set_channel() and rtw89_core_set_chip_txpwr().
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220809104952.61355-11-pkshih@realtek.com
Zong-Zhe Yang [Tue, 9 Aug 2022 10:49:48 +0000 (18:49 +0800)]
wifi: rtw89: initialize entity and configure default chandef
While idle, we need a default chandef to set channel for things,
such as scan. Before support of mac80211 chanctx, mac80211 would
configure a default one on ieee80211_hw::conf::chandef. And we
just queried it whenever we did set channel. However, after support
of mac80211 chanctx, the flow won't work like before.
Besides, we don't now query chandef from ieee80211_hw::conf::chandef
either. So, similar to mac80211 without using chanctx, we configure
the default chandef with ieee80211_channel of index 0 in 2GHz.
Although we have not added the support of mac80211 chanctx here,
this configuration should be compatible before that. So, we commit
this ahead.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220809104952.61355-10-pkshih@realtek.com
Zong-Zhe Yang [Tue, 9 Aug 2022 10:49:47 +0000 (18:49 +0800)]
wifi: rtw89: concentrate chandef setting to stack callback
Originally, we didn't support mac80211 chanctx, so it's expected that
ieee80211_hw::conf::chandef would be filled by mac80211. And then, we
could just query it whenever we need the current chandef.
However, we are planing to support mac80211 chanctx. After that, the
above assumption would be broken. So, we adjust a bit ahead to reduce
future works about mac80211 chanctx.
After this, we don't query ieee80211_hw::conf::chandef directly, and
we add a map, entity_map, to HAL to indicate which chandef came from
stack. And it will later be used to recalcate entity mode.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220809104952.61355-9-pkshih@realtek.com
Zong-Zhe Yang [Tue, 9 Aug 2022 10:49:46 +0000 (18:49 +0800)]
wifi: rtw89: concentrate parameter control for setting channel callback
For future support on multiple channels by multiple sub-entities,
we need to manage parameters of each channel instance like rtw89_chan,
rtw89_mac_idx, rtw89_phy_idx. So, we adjust related channel callback
functions and centrally conrtol these parameters in set_channel().
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220809104952.61355-8-pkshih@realtek.com
Zong-Zhe Yang [Tue, 9 Aug 2022 10:49:45 +0000 (18:49 +0800)]
wifi: rtw89: rfk: concentrate parameter control while set_channel()
For future support on multiple channels, there will be settings of
multiple sub-entities that we need to control. We don't want such
settings to be scattered all over the place. So, we centrally manage
controls of rtw89_phy_idx for RFK in set_channel().
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220809104952.61355-7-pkshih@realtek.com
Zong-Zhe Yang [Tue, 9 Aug 2022 10:49:44 +0000 (18:49 +0800)]
wifi: rtw89: txpwr: concentrate channel related control to top
For future support on multiple channels, it would be disturbing if we
still allow scattered leaf functions of TX power to query and manage
channel related control by themselves.
So, query rtw89_chan only on top functions. Then, pass it via functions
to make sure that the values coming from the same struct rtw89_chan.
Besides, fix rtw8852a_set_txpwr_offset() from rtw8852a_set_txpwr_ctrl()
to rtw8852a_set_txpwr(). TX power offset should consider current band,
so move it to chip_ops::set_txpwr() which will be called every time that
channel is set.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220809104952.61355-6-pkshih@realtek.com
Zong-Zhe Yang [Tue, 9 Aug 2022 10:49:43 +0000 (18:49 +0800)]
wifi: rtw89: create rtw89_chan centrally to avoid breakage
Sometimes we need to write current rtw89_chan outside set_channel(),
e.g. during HW scan, we adjust it to align FW process through C2H.
However, we don't have full parameters to fill entire rtw89_chan.
And it will breakage if we update only part of current rtw89_chan.
That is what we don't want to see because most flows throughout
driver treat rtw89_chan as a whole.
So, we divide struct rtw89_chan to basic part and derived part. The
basic part contains the parameters which we are always able to know.
And the derived part will be calculated by the basic part. Then, a
central function, rtw89_chan_create(), is added to deal with this.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220809104952.61355-5-pkshih@realtek.com
Zong-Zhe Yang [Tue, 9 Aug 2022 10:49:42 +0000 (18:49 +0800)]
wifi: rtw89: re-arrange channel related stuffs under HAL
We are planning to support mac80211 chanctx. To reduce future works,
the driver architecture is adjusted first to isolate related things.
According to chip, our HW may have multiple sub-entities to support
multiple mac80211 chanctx. Struct rtw89_chan has been introduced for
things about channel/band/subband/... Now introduce struct rtw89_chan_rcd
to record difference after assigning new one of struct rtw89_chan.
We will implement and support chanctx with single channel first, i.e.
only use entry in RTW89_SUB_ENTITY_0, before handling dual channels.
Our hierarchy in planning will become as the following.
DEV
-> HAL
---> entity (manage status across sub-entities)
-----> sub-entity[*] (support mac80211 chanctx)
where each sub-entity contains one struct rtw89_chan.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220809104952.61355-4-pkshih@realtek.com
Zong-Zhe Yang [Tue, 9 Aug 2022 10:49:41 +0000 (18:49 +0800)]
wifi: rtw89: introduce rtw89_chan for channel stuffs
Introduce struct rtw89_chan ahead to encapsulate stuffs from struct
rtw89_channel_params. These stuffs have a clone in HAL and are used
throughout driver. After multiple channels support, it's expected that
each channel instance has a configuration of them. So, we refine them
with struct rtw89_chan by precise type first, and will re-arrange HAL
by struct rtw89_chan in the following as well.
(No logic has changed.)
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220809104952.61355-3-pkshih@realtek.com
Zong-Zhe Yang [Tue, 9 Aug 2022 10:49:40 +0000 (18:49 +0800)]
wifi: rtw89: rewrite decision on channel by entity state
We need to invoke the callback of the changed band at the first
set_channel() after every power-off. Originally, we forced the
channel to be 0 when doing power-off, and then determined things
by comparing channel with 0.
However, deciding on such things by channel might be confusing.
It's also confusing to use this kind of decision when we consider
multiple channels in the follow-up patches. So, another flag,
entity_active, is added ahead to HAL to deal with this.
Besides, we also need to check if entity is active when we set
TX power.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220809104952.61355-2-pkshih@realtek.com
Eric Dumazet [Wed, 31 Aug 2022 20:37:29 +0000 (13:37 -0700)]
ipv6: tcp: send consistent autoflowlabel in SYN_RECV state
This is a followup of commit
c67b85558ff2 ("ipv6: tcp: send consistent
autoflowlabel in TIME_WAIT state"), but for SYN_RECV state.
In some cases, TCP sends a challenge ACK on behalf of a SYN_RECV request.
WHen this happens, we want to use the flow label that was used when
the prior SYNACK packet was sent, instead of another one.
After his patch, following packetdrill passes:
0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+0 bind(3, ..., ...) = 0
+0 listen(3, 1) = 0
+.2 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
+0 > (flowlabel 0x11) S. 0:0(0) ack 1 <...>
// Test if a challenge ack is properly sent (same flowlabel than prior SYNACK)
+.01 < .
4000000000:
4000000000(0) ack 1 win 320
+0 > (flowlabel 0x11) . 1:1(0) ack 1
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20220831203729.458000-1-eric.dumazet@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Vladimir Oltean [Wed, 31 Aug 2022 17:08:39 +0000 (20:08 +0300)]
selftests: net: dsa: symlink the tc_actions.sh test
This has been validated on the Ocelot/Felix switch family (NXP LS1028A)
and should be relevant to any switch driver that offloads the tc-flower
and/or tc-matchall actions trap, drop, accept, mirred, for which DSA has
operations.
TEST: gact drop and ok (skip_hw) [ OK ]
TEST: mirred egress flower redirect (skip_hw) [ OK ]
TEST: mirred egress flower mirror (skip_hw) [ OK ]
TEST: mirred egress matchall mirror (skip_hw) [ OK ]
TEST: mirred_egress_to_ingress (skip_hw) [ OK ]
TEST: gact drop and ok (skip_sw) [ OK ]
TEST: mirred egress flower redirect (skip_sw) [ OK ]
TEST: mirred egress flower mirror (skip_sw) [ OK ]
TEST: mirred egress matchall mirror (skip_sw) [ OK ]
TEST: trap (skip_sw) [ OK ]
TEST: mirred_egress_to_ingress (skip_sw) [ OK ]
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20220831170839.931184-1-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Jinpeng Cui [Wed, 31 Aug 2022 15:43:29 +0000 (15:43 +0000)]
netdevsim: remove redundant variable ret
Return value directly from nsim_dev_reload_create()
instead of getting value from redundant variable ret.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Jinpeng Cui <cui.jinpeng2@zte.com.cn>
Link: https://lore.kernel.org/r/20220831154329.305372-1-cui.jinpeng2@zte.com.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Juhee Kang [Wed, 31 Aug 2022 12:58:45 +0000 (21:58 +0900)]
net: rtnetlink: use netif_oper_up instead of open code
The open code is defined as a new helper function(netif_oper_up) on netdev.h,
the code is dev->operstate == IF_OPER_UP || dev->operstate == IF_OPER_UNKNOWN.
Thus, replace the open code to netif_oper_up. This patch doesn't change logic.
Signed-off-by: Juhee Kang <claudiajkang@gmail.com>
Link: https://lore.kernel.org/r/20220831125845.1333-1-claudiajkang@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Zhengchao Shao [Wed, 31 Aug 2022 09:29:19 +0000 (17:29 +0800)]
net: sched: etf: remove true check in etf_enable_offload()
etf_enable_offload() is only called when q->offload is false in
etf_init(). So remove true check in etf_enable_offload().
Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Link: https://lore.kernel.org/r/20220831092919.146149-1-shaozhengchao@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Jakub Kicinski [Thu, 1 Sep 2022 19:58:02 +0000 (12:58 -0700)]
Merge git://git./linux/kernel/git/netdev/net
tools/testing/selftests/net/.gitignore
sort the net-next version and use it
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Linus Torvalds [Thu, 1 Sep 2022 16:20:42 +0000 (09:20 -0700)]
Merge tag 'net-6.0-rc4' of git://git./linux/kernel/git/netdev/net
Pull networking fixes from Paolo Abeni:
"Including fixes from bluetooth, bpf and wireless.
Current release - regressions:
- bpf:
- fix wrong last sg check in sk_msg_recvmsg()
- fix kernel BUG in purge_effective_progs()
- mac80211:
- fix possible leak in ieee80211_tx_control_port()
- potential NULL dereference in ieee80211_tx_control_port()
Current release - new code bugs:
- nfp: fix the access to management firmware hanging
Previous releases - regressions:
- ip: fix triggering of 'icmp redirect'
- sched: tbf: don't call qdisc_put() while holding tree lock
- bpf: fix corrupted packets for XDP_SHARED_UMEM
- bluetooth: hci_sync: fix suspend performance regression
- micrel: fix probe failure
Previous releases - always broken:
- tcp: make global challenge ack rate limitation per net-ns and
default disabled
- tg3: fix potential hang-up on system reboot
- mac802154: fix reception for no-daddr packets
Misc:
- r8152: add PID for the lenovo onelink+ dock"
* tag 'net-6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (56 commits)
net/smc: Remove redundant refcount increase
Revert "sch_cake: Return __NET_XMIT_STOLEN when consuming enqueued skb"
tcp: make global challenge ack rate limitation per net-ns and default disabled
tcp: annotate data-race around challenge_timestamp
net: dsa: hellcreek: Print warning only once
ip: fix triggering of 'icmp redirect'
sch_cake: Return __NET_XMIT_STOLEN when consuming enqueued skb
selftests: net: sort .gitignore file
Documentation: networking: correct possessive "its"
kcm: fix strp_init() order and cleanup
mlxbf_gige: compute MDIO period based on i1clk
ethernet: rocker: fix sleep in atomic context bug in neigh_timer_handler
net: lan966x: improve error handle in lan966x_fdma_rx_get_frame()
nfp: fix the access to management firmware hanging
net: phy: micrel: Make the GPIO to be non-exclusive
net: virtio_net: fix notification coalescing comments
net/sched: fix netdevice reference leaks in attach_default_qdiscs()
net: sched: tbf: don't call qdisc_put() while holding tree lock
net: Use u64_stats_fetch_begin_irq() for stats fetch.
net: dsa: xrs700x: Use irqsave variant for u64 stats update
...