summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/realtek
AgeCommit message (Collapse)AuthorFilesLines
2022-02-10rtw89: coex: set EN bit to PLT registerPing-Ke Shih1-3/+4
B_AX_PLT_EN is to enable polluted mechanism. If it is enabled and gnt_bt = 1 while wlan TX, B_AX_BT_PLT_PKT_CNT counter will increase, but TX counter to BB will not. Without this bit BTCoex mechanism might have some problems. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220208082751.43553-1-pkshih@realtek.com
2022-02-10rtw89: recover rates of rate adaptive mechanismChien-Hsun Liao1-17/+30
Some APs like CMW270 only support one phyrate and the function rtw89_phy_ra_mask_rssi could disable that rate. To fix such problem, we restore the rate mask if we find that the rate_mask is empty. Also, apply missed legacy rates from sta->supp_rates[]. Signed-off-by: Chien-Hsun Liao <ben.liao@realtek.com> Signed-off-by: Kuan-Chung Chen <damon.chen@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/20220208082427.42433-3-pkshih@realtek.com
2022-02-10rtw88: recover rates of rate adaptive mechanismChien-Hsun Liao1-23/+44
Some APs like CMW270 only support one phyrate and the function rtw_update_rate_mask could disable that rate. To fix such problem, we restore the rate mask if we find that the rate_mask is empty. Signed-off-by: Chien-Hsun Liao <ben.liao@realtek.com> Signed-off-by: Kuan-Chung Chen <damon.chen@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/20220208082427.42433-2-pkshih@realtek.com
2022-02-10rtw89: declare AP mode supportPing-Ke Shih1-1/+2
Things are ready for AP mode, so declare this driver can support it. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220207063900.43643-8-pkshih@realtek.com
2022-02-10rtw89: debug: add stations entry to show ID assignmentPing-Ke Shih1-0/+71
In order to trace the relation of IDs, we add this debugfs entry to make them clear. The output looks like: map: mac_id: 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 addr_cam: 07 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 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 [1] 58:00:e3:bb:9c:4f addr_cam_idx=1 -> bssid_cam_idx=0 sec_cam_bitmap=00 00 00 00 00 00 00 00 STA [2] 94:08:53:8e:ef:75 addr_cam_idx=2 -> bssid_cam_idx=0 sec_cam_bitmap=00 00 00 00 00 00 00 00 Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220207063900.43643-7-pkshih@realtek.com
2022-02-10rtw89: implement ieee80211_ops::start_ap and stop_apPing-Ke Shih1-0/+33
Configure firmware and hardware to run AP mode. The start_ap() setup bssid, mac port, mac_id entry, and does RFK. The stop_ap() reset the state. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220207063900.43643-6-pkshih@realtek.com
2022-02-10rtw89: maintain assoc/disassoc STA states of firmware and hardwarePing-Ke Shih3-3/+33
In AP mode, when a STA associate to us, we need to create an entry in firmware and hardware, and then they can transmit data properly. The entry index called mac_id which is assigned when sta_add, and we ask firmware to create an entry for an associated station. Also, the address CAM should be filled so hardware can know which packet is ours, and lookup the mac_id for further use. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220207063900.43643-5-pkshih@realtek.com
2022-02-10rtw89: only STA mode change vif_type mapping dynamicallyPing-Ke Shih2-2/+5
vif_type mapping indicates hardware operating mode corresponding to vif type. In STA mode, hardware mode should be INFRA or NO_LINK mode dynamically according to association status. Since AP mode don't need to change this by association status intuitively, just do the mapping in STA mode. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220207063900.43643-4-pkshih@realtek.com
2022-02-10rtw89: add addr_cam field to sta to support AP modePing-Ke Shih3-30/+43
In AP mode, each connected station needs an entry of address CAM. The address CAM of vif is still needed to assit in AP itself. For station mode, it still uses vif's address CAM. Add a help macro rtw89_get_addr_cam_of() to get addr_cam from vif or sta for all use cases. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220207063900.43643-3-pkshih@realtek.com
2022-02-10rtw89: extend role_maintain to support AP modePing-Ke Shih3-4/+17
Fill mac_id and self_role depends on the operation mode. In AP mode, echo connected station has an unique mac_id, and each vif also has one mac_id to represent itself. The self_role is assigned to vif if the operation mode is decided, and RTW89_SELF_ROLE_AP_CLIENT is assigned to the connected STA in AP mode, Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220207063900.43643-2-pkshih@realtek.com
2022-02-10rtw88: fix use after free in rtw_hw_scan_update_probe_req()Dan Carpenter1-3/+3
This code needs to use skb_queue_walk_safe() instead of skb_queue_walk() because it frees the list iterator. Fixes: d95984b5580d ("rtw88: fix memory overrun and memory leak during hw_scan") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220203082532.GA25151@kili
2022-02-01rtlwifi: remove redundant initialization of variable ul_encalgoColin Ian King1-1/+1
Variable ul_encalgo is initialized with a value that is never read, it is being re-assigned a new value in every case in the following switch statement. The initialization is redundant and can be removed. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Acked-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220130223714.6999-1-colin.i.king@gmail.com
2022-01-31rtw88: rtw8821c: enable rfe 6 devicesPing-Ke Shih1-0/+1
Ping-Ke Shih answered[1] a question for a user about an rtl8821ce device that reported RFE 6, which the driver did not support. Ping-Ke suggested a possible fix, but the user never reported back. A second user discovered the above thread and tested the proposed fix. Accordingly, I am pushing this change, even though I am not the author. [1] https://lore.kernel.org/linux-wireless/3f5e2f6eac344316b5dd518ebfea2f95@realtek.com/ Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Reported-and-tested-by: masterzorag <masterzorag@gmail.com> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220107024739.20967-1-Larry.Finger@lwfinger.net
2022-01-31rtw88: fix memory overrun and memory leak during hw_scanPo-Hao Huang1-10/+24
Previously we allocated less memory than actual required, overwrite to the buffer causes the mm module to complaint and raise access violation faults. Along with potential memory leaks when returned early. Fix these by passing the correct size and proper deinit flow. Fixes: 10d162b2ed39 ("rtw88: 8822c: add ieee80211_ops::hw_scan") 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/20220121070813.9656-4-pkshih@realtek.com
2022-01-31rtw88: fix idle mode flow for hw scanPo-Hao Huang4-4/+23
Upon hw scan completion, idle mode is not re-entered. This might increase power consumption under no link mode. Fix this by adding the re-enter flow. We need another work for this since enter_ips waits for c2h_work to finish, which might lead to deadlock if caller is in the same work. Fixes: 10d162b2ed39 ("rtw88: 8822c: add ieee80211_ops::hw_scan") 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/20220121070813.9656-3-pkshih@realtek.com
2022-01-31rtw88: check for validity before using a pointerMuhammad Usama Anjum1-0/+8
ieee80211_probereq_get() can return NULL. Pointer skb should be checked for validty before use. If it is not valid, list of skbs needs to be freed. Fixes: 10d162b2ed39 ("rtw88: 8822c: add ieee80211_ops::hw_scan") Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220121070813.9656-2-pkshih@realtek.com
2022-01-28rtw89: use pci_read/write_config instead of dbi read/writeChin-Yen Lee1-75/+53
In the past we use dbi function of wifi mac to read/write pci config space, but the function will be remove in new chip. So use kernel api pci_read/write_config_byte instead. 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/20220121075555.12457-2-pkshih@realtek.com
2022-01-28rtw89: refine DIG feature to support 160M and CCK PDJohnson Lin5-7/+44
DIG, which is short for dynamic initial gain, is used to adjust gain to get good RX performance. CCK PD feature, a mechanism that adjusts 802.11b CCK packet detection(PD) power threshold based on environment noisy level in order to avoid false alarm. Also, refine related variable naming. Signed-off-by: Johnson Lin <johnson.lin@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/20220121075555.12457-1-pkshih@realtek.com
2022-01-28rtw89: fix maybe uninitialized `qempty` variableÍñigo Huguet1-0/+1
Call to dle_dfi_qempty might fail, leaving qempty.qempty untouched, which is latter used to control the for loop. If that happens, it's not initialized anywhere. Initialize it so the loop doesn't iterate unless it's modified by the call to dle_dfi_qempty. Signed-off-by: Íñigo Huguet <ihuguet@redhat.com> Acked-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220113094253.73370-1-ihuguet@redhat.com
2022-01-28rtw89: include subband type in channel paramsZong-Zhe Yang2-15/+20
Make stuffs related to channel be collected in channel_params, and encapsulate the corresponding decision in get_channel_params(). Then, functions that takes channel_params can also notice subband type. 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/20220113011042.6705-2-pkshih@realtek.com
2022-01-28rtw89: handle 6G band if supported by a chipsetZong-Zhe Yang3-57/+179
For next chipset which can support 6G band, we add the handling of ieee80211_supported_band for 6G band in advance. And a bitmap, support_bands, is added to rtw89_chip_info to declare which NL80211_BAND_* are supported. With the chipset's declaration, we register the corresponding instances of ieee80211_supported_band with wiphy. 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/20220113011042.6705-1-pkshih@realtek.com
2022-01-28rtw89: separate {init,deinit}_addr_cam functionsPing-Ke Shih3-14/+26
Each stations connected to AP needs to set an address CAM, so don't combine address and BSSID CAM. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220107034239.22002-13-pkshih@realtek.com
2022-01-28rtw89: set mac_id and port ID to TXWDPing-Ke Shih3-2/+27
One mac_id is corresponding to one connected station, and port ID is a ID of virtual interfaces. With proper mac_id and port ID, firmware and hardware can handle a packet with correct context. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220107034239.22002-12-pkshih@realtek.com
2022-01-28rtw89: send broadcast/multicast packets via HIQ if STAs are in sleep modePing-Ke Shih2-3/+6
If a packet we are going to send is broadcast/multicast and certain STAs are in sleep mode, a flag IEEE80211_TX_CTL_SEND_AFTER_DTIM is added to txinfo. Then, this kind of packets must be sent via HIQ instead of regular AC queues, because they should be sent right after beacon. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220107034239.22002-11-pkshih@realtek.com
2022-01-28rtw89: configure mac port HIQ registersPing-Ke Shih2-2/+46
HIQ is short for high queue that is used to send broadcast/multicast packets right after TBTT in AP mode. Two registers, DTIM and window size, are configured accordingly. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220107034239.22002-10-pkshih@realtek.com
2022-01-28rtw89: rename vif_maintain to role_maintainPing-Ke Shih4-17/+17
The H2C_FUNC_MAC_FWROLE_MAINTAIN also maintains the roles of all connected stations; not just the role of VIF. So, I correct the name, but don't change the logic at all. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220107034239.22002-9-pkshih@realtek.com
2022-01-28rtw89: extend firmware commands on states of sta_assoc and sta_disconnectPing-Ke Shih4-14/+32
The h2c_join firmware command is used to indicate a station is connected, and the assoc_cmac_tbl firmware command is used to set CMAC table corresponding to a mac_id. Both commands must work in both station and AP modes. Use the mac_id of rtw89_sta naturally and intuitively. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220107034239.22002-8-pkshih@realtek.com
2022-01-28rtw89: allocate mac_id for each station in AP modePing-Ke Shih1-0/+5
In station mode, mac_id of station is the same as rtwvif's one. In AP mode, each station uses individual mac_id. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220107034239.22002-7-pkshih@realtek.com
2022-01-28rtw89: implement mac80211_ops::set_tim to indicate STA to receive packetsPing-Ke Shih3-0/+35
Update beacon content if TIM bitmap maintained by mac80211 is changed. Since .set_tim must be atomic but driver uses mutex lock, we add a work. Otherwise, kernel says "sched: RT throttling activated" and lock down. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220107034239.22002-6-pkshih@realtek.com
2022-01-28rtw89: add C2H handle of BCN_CNTPing-Ke Shih2-0/+7
This C2H notify driver the beacon count we send out. We don't handle the content for now, so add a dummy handler to avoid messages, like rtw89_pci 0000:03:00.0: c2h class 0 func 3 not support C2H: 00000000: 01 03 01 3f 0f 00 00 00 80 0a 00 00 00 00 a0 rtw89_pci 0000:03:00.0: c2h class 0 func 3 not support C2H: 00000000: 01 03 01 40 0f 00 00 00 00 03 20 00 00 00 a5 Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220107034239.22002-5-pkshih@realtek.com
2022-01-28rtw89: download beacon content to firmwarePing-Ke Shih3-0/+159
Firmware sends out beacon content generated by mac80211, and then stations can receive beacon and work with this AP properly. Also, we download beacon content again if TIM is changed. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220107034239.22002-4-pkshih@realtek.com
2022-01-28rtw89: use hardware SSN to TX management framePing-Ke Shih3-1/+11
Since firmware transmits beacon by hardware SSN, driver does it with the same setting, then packets in the air have continual sequence number. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220107034239.22002-3-pkshih@realtek.com
2022-01-28rtw89: configure rx_filter according to FIF_PROBE_REQPing-Ke Shih1-1/+10
With this patch, we can receive probe_req and reply probe_resp, and STA can find us. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220107034239.22002-2-pkshih@realtek.com
2022-01-28rtw89: correct use of BA CAMPing-Ke Shih5-8/+107
BA CAM is used to ACK peer's packets, so it must be established when IEEE80211_AMPDU_RX_START, and free it by IEEE80211_AMPDU_RX_STOP. The hardware can support two static BA CAM entries, so I implement a bitmap and a struct to record which entry is used and its corresponding tid. Also, the hardware can learn and create dynamic BA CAM entries automatically if received packets don't match static BA CAM. That means it can still work if we don't use H2C to set static BA CAM. An exception is tid=0 should be always allocated in static BA CAM, so an existing static BA CAM will be replaced if it is full and peer is going to establish a BA with tid=0. The new firmware use new format of this H2C, so I upgrade it as well. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220104012052.6911-1-pkshih@realtek.com
2022-01-28rtw89: encapsulate RX handlers to single functionPing-Ke Shih1-15/+17
We have three points to receive packets to mac80211 with three different kinds of status. Many handlers are common and can be shared, so I move them together, and I don't change the logic at all. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220103013623.17052-3-pkshih@realtek.com
2022-01-28rtw89: Add RX counters of VHT MCS-10/11 to debugfsPing-Ke Shih1-8/+14
8852AE can receive packets with VHT MCS10/11, and we want to know we have received this kind of packets, so show the counter of VHT MCS10/11 in debugfs, like: TP TX: 1 [1] Mbps (lv: 1), RX: 420 [422] Mbps (lv: 4) Beacon: 19 Avg packet length: TX=102, RX=3081 RX count: Legacy: [0, 0, 0, 0] OFDM: [0, 0, 0, 0, 0, 0, 0, 0] HT 0: [0, 0, 0, 0, 0, 0, 0, 0] HT 1: [0, 0, 0, 0, 0, 0, 0, 0] VHT 1SS: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0][0, 0] VHT 2SS: [0, 0, 0, 0, 0, 0, 0, 4, 624, 4818][29913, 556] HE 1SS: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] HE 2ss: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] TX rate [0]: VHT 2SS MCS-9 SGI (hw_rate=0x119) ==> agg_wait=1 (3500) RX rate [0]: VHT 2SS MCS-10 SGI (hw_rate=0x11a) RSSI: -30 dBm (raw=161, prev=165) Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220103013623.17052-2-pkshih@realtek.com
2022-01-28rtw89: remove duplicate definition of hardware port numberPing-Ke Shih4-13/+12
RTW89_MAX_HW_PORT_NUM and RTW89_PORT_NUM refer to the same thing, so remove the one of them. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20211227083134.35248-1-pkshih@realtek.com
2022-01-28rtw89: extract modules by chipsetZong-Zhe Yang13-60/+131
We are planning to support more chipsets, e.g. 8852C. Before that, we consider architecutre to handle multiple kinds of chipsets. Obviosuly, based on original design, rtw89_core module will have large size even if there is only one chipset under running. It is because all chipset related things are put in rtw89_core now. To reduce such overhead, we extract modules of rtw89 and adjust dependencies between modules. The following assumes that 8852AE, 8852AU, and 8852CE are all supported, we describe the difference before and after extraction. [Before extraction] ------------- |------------------------------------ | rtw89_usb | V ------------- --------------------------------------- ------------- | rtw89_core (including 8852A, 8852C) | <--- | rtw89_pci | --------------------------------------- ------------- The data of 8852A and 8852C are built in rtw89_core. And rtw89_pci is the entry of 8852AE and 8852CE. And rtw89_usb is the entry of 8852AU. [After extraction] ------------- ---------------- |----------- | rtw89_usb | <-------- | rtw89_8852au | | ------------- ---------------- V --------------- | -------------- | | <--------------- | rtw89_core | <--- | rtw89_8852a | -------------- | | <--------------- ^ ^ --------------- | | | ------------- ---------------- | | | | <-------- | rtw89_8852ae | | |----------- | rtw89_pci | ---------------- | | | <----------------- | ------------- | | --------------- ---------------- |--------------- | rtw89_8852c | <------ | rtw89_8852ce | --------------- ---------------- The data of 8852A/8852C is extracted to rtw89_8852a/rtw89_8852c. And rtw89_pci/rtw89_usb handles only common flow of pci/usb bus. Finally, 8852AE, 8852AU, and 8852CE have individual entry modules, i.e. rtw89_8852ae, rtw89_8852au, and rtw89_8852ce correspondingly. 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/20211221025828.25092-1-pkshih@realtek.com
2021-12-23Merge tag 'wireless-drivers-next-2021-12-23' of ↵Jakub Kicinski27-121/+1026
git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next Kalle Valo says: ==================== wireless-drivers-next patches for v5.17 Third set of patches for v5.17, and the final one if all goes well. We have Specific Absorption Rate (SAR) support for both mt76 and rtw88. Also iwlwifi should be now W=1 warning free. But otherwise nothing really special this time, business as usual. Major changes: mt76 * Specific Absorption Rate (SAR) support * mt7921: new PCI ids * mt7921: 160 MHz channel support iwlwifi * fix W=1 and sparse warnings * BNJ hardware support * add new killer device ids * support for Time-Aware-SAR (TAS) from the BIOS * Optimized Connectivity Experience (OCE) scan support rtw88 * hardware scan * Specific Absorption Rate (SAR) support ath11k * qca6390/wcn6855: report signal and tx bitrate * qca6390: rfkill support * qca6390/wcn6855: regdb.bin support ath5k * switch to rate table based lookup wilc1000 * spi: reset/enable GPIO support * tag 'wireless-drivers-next-2021-12-23' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next: (148 commits) mt76: mt7921: fix a possible race enabling/disabling runtime-pm wilc1000: Document enable-gpios and reset-gpios properties wilc1000: Add reset/enable GPIO support to SPI driver wilc1000: Convert static "chipid" variable to device-local variable rtw89: 8852a: correct bit definition of dfs_en rtw88: don't consider deep PS mode when transmitting packet ath11k: Fix unexpected return buffer manager error for QCA6390 ath11k: add support of firmware logging for WCN6855 ath11k: Fix napi related hang ath10k: replace strlcpy with strscpy rtw88: support SAR via kernel common API rtw88: 8822c: add ieee80211_ops::hw_scan iwlwifi: mei: wait before mapping the shared area iwlwifi: mei: clear the ownership when the driver goes down iwlwifi: yoyo: fix issue with new DBGI_SRAM region read. iwlwifi: fw: fix some scan kernel-doc iwlwifi: pcie: make sure prph_info is set when treating wakeup IRQ iwlwifi: mvm: remove card state notification code iwlwifi: mvm: drop too short packets silently iwlwifi: mvm: fix AUX ROC removal ... ==================== Link: https://lore.kernel.org/r/20211223141108.78808C36AE9@smtp.kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-12-23codel: remove unnecessary sock.h includeJakub Kicinski2-0/+4
Since sock.h is modified relatively often (60 times in the last 12 months) it seems worthwhile to decrease the incremental build work. CoDel's header includes net/inet_ecn.h which in turn includes net/sock.h. codel.h is itself included by mac80211 which is included by much of the WiFi stack and drivers. Removing the net/inet_ecn.h include from CoDel breaks the dependecy between WiFi and sock.h. Commit d068ca2ae2e6 ("codel: split into multiple files") moved all the code which actually needs ECN helpers out to net/codel_impl.h, the include can be moved there as well. This decreases the incremental build size after touching sock.h from 4999 objects to 4051 objects. Fix unmasked missing includes in WiFi drivers. Acked-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20211221193941.3805147-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-12-22rtw89: 8852a: correct bit definition of dfs_enChung-Hsuan Hung1-1/+1
Since there are other protections in the set channel flow, fortunately old wrong setting won't affect the performance. Signed-off-by: Chung-Hsuan Hung <hsuan8331@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/20211221024800.23814-1-pkshih@realtek.com
2021-12-22rtw88: don't consider deep PS mode when transmitting packetChin-Yen Lee4-2/+11
In original flow, driver needs to ensure chip leave deep ps mode before transmitting any packet, and don't enter deep ps mode beofre PCIE DMA is finished. Now with the support of 8822ce's hardware setting and firmware after v9.9.11, these limits are removed. 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/20211221020230.20764-1-pkshih@realtek.com
2021-12-21rtw88: support SAR via kernel common APIZong-Zhe Yang9-20/+257
Register cfg80211_sar_capa with type NL80211_SAR_TYPE_POWER and four frequency ranges for configurations in unit of 0.25 dBm. And handle callback set_sar_specs. Originally, TX power has three main parameters, i.e. power base, power by rate, and power limit. The formula can be simply considered as TX power = power base + min(power by rate, power limit). With the support of SAR which can be treated as another power limit, there is one more parameter for TX power. And the formula will evolve into TX power = power base + min(power by rate, power limit, power sar). Besides, debugfs tx_pwr_tbl is also refined to show SAR information. The following is an example for the difference. Before supporting SAR, ----------------------------------- ... path rate pwr base (byr lmt ) rem A CCK_1M 66(0x42) 78 -12 ( 12 -12) 0 A CCK_2M 66(0x42) 78 -12 ( 8 -12) 0 ... ----------------------------------- After supporting SAR and making some configurations, ----------------------------------- ... path rate pwr base (byr lmt sar ) rem A CCK_1M 62(0x3e) 78 -16 ( 12 -12 -16) 0 A CCK_2M 62(0x3e) 78 -16 ( 8 -12 -16) 0 ... ----------------------------------- 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/20211220093656.65312-1-pkshih@realtek.com
2021-12-21rtw88: 8822c: add ieee80211_ops::hw_scanPo-Hao Huang9-33/+709
Declare this function allows us to use customized scanning policy. By doing so we can be more time efficient on each scan. In order to make existing coex mechanism work as usual, firmware notifies driver on each channel switch event, then decide antenna ownership based on the current channel/band. Do note that this new mechanism affects throughput more than the sw_scan we used to have, but the overall average throughput is not affected since each scan take less time. Since the firmware size is limited, we only support probe requests with custom IEs length under 128 bytes for now, if any user space tools requires more than that, we'll introduce related changes afterwards. For backward compatibility, we fallback to sw_scan when using older firmware that does not support this feature. 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/20211221085010.39421-1-pkshih@realtek.com
2021-12-21Merge tag 'mac80211-next-for-net-next-2021-12-21' of ↵Jakub Kicinski2-2/+3
git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next Johannes Berg says: ==================== This time we have: * ndo_fill_forward_path support in mac80211, to let drivers use it * association comeback notification for userspace, to be able to react more sensibly to long delays * support for background radar detection hardware in some chipsets * SA Query Procedures offload on the AP side * more logging if we find problems with HT/VHT/HE * various cleanups and minor fixes Conflicts: net/wireless/reg.c: e08ebd6d7b90 ("cfg80211: Acquire wiphy mutex on regulatory work") 701fdfe348f7 ("cfg80211: Enable regulatory enforcement checks for drivers supporting mesh iface") https://lore.kernel.org/r/20211221111950.57ecc6a7@canb.auug.org.au drivers/net/wireless/ath/ath10k/wmi.c: 7f599aeccbd2 ("cfg80211: Use the HE operation IE to determine a 6GHz BSS channel") 3bf2537ec2e3 ("ath10k: drop beacon and probe response which leak from other channel") https://lore.kernel.org/r/20211221115004.1cd6b262@canb.auug.org.au * tag 'mac80211-next-for-net-next-2021-12-21' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next: (32 commits) cfg80211: Enable regulatory enforcement checks for drivers supporting mesh iface rfkill: allow to get the software rfkill state cfg80211: refactor cfg80211_get_ies_channel_number() nl82011: clarify interface combinations wrt. channels nl80211: Add support to offload SA Query procedures for AP SME device nl80211: Add support to set AP settings flags with single attribute mac80211: add more HT/VHT/HE state logging cfg80211: Use the HE operation IE to determine a 6GHz BSS channel cfg80211: rename offchannel_chain structs to background_chain to avoid confusion with ETSI standard mac80211: Notify cfg80211 about association comeback cfg80211: Add support for notifying association comeback mac80211: introduce channel switch disconnect function cfg80211: Fix order of enum nl80211_band_iftype_attr documentation cfg80211: simplify cfg80211_chandef_valid() mac80211: Remove a couple of obsolete TODO mac80211: fix FEC flag in radio tap header mac80211: use coarse boottime for airtime fairness code ieee80211: change HE nominal packet padding value defines cfg80211: use ieee80211_bss_get_elem() instead of _get_ie() mac80211: Use memset_after() to clear tx status ... ==================== Link: https://lore.kernel.org/r/20211221112532.28708-1-johannes@sipsolutions.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-12-20rtlwifi: rtl8192cu: Fix WARNING when calling local_irq_restore() with ↵Larry Finger1-0/+1
interrupts enabled Syzbot reports the following WARNING: [200~raw_local_irq_restore() called with IRQs enabled WARNING: CPU: 1 PID: 1206 at kernel/locking/irqflag-debug.c:10 warn_bogus_irq_restore+0x1d/0x20 kernel/locking/irqflag-debug.c:10 Hardware initialization for the rtl8188cu can run for as long as 350 ms, and the routine may be called with interrupts disabled. To avoid locking the machine for this long, the current routine saves the interrupt flags and enables local interrupts. The problem is that it restores the flags at the end without disabling local interrupts first. This patch fixes commit a53268be0cb9 ("rtlwifi: rtl8192cu: Fix too long disable of IRQs"). Reported-by: syzbot+cce1ee31614c171f5595@syzkaller.appspotmail.com Cc: stable@vger.kernel.org Fixes: a53268be0cb9 ("rtlwifi: rtl8192cu: Fix too long disable of IRQs") Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20211215171105.20623-1-Larry.Finger@lwfinger.net
2021-12-20rtl8xxxu: Improve the A-MPDU retransmission rate with RTS/CTS protectionChris Chiu1-2/+2
The A-MPDU TX retransmission rate is always high (> 20%) even in a very clean environment. However, the vendor driver retransimission rate is < 10% in the same test bed. The difference is the vendor driver starts the A-MPDU TXOP with initial RTS/CTS handshake which is observed in the air capture and the TX descriptor. Since the driver does not know how many frames will be aggregated and the estimated duration, forcing the RTS/CTS protection for A-MPDU helps to lower the retransmission rate from > 20% to ~12% in the same test setup with the vendor driver. Signed-off-by: Chris Chiu <chris.chiu@canonical.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20211215085819.729345-1-chris.chiu@canonical.com
2021-12-20rtw88: 8822c: update rx settings to prevent potential hw deadlockPo-Hao Huang4-4/+4
These settings enables mac to detect and recover when rx fifo circuit deadlock occurs. Previous version missed this, so we fix it. 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/20211217012708.8623-1-pkshih@realtek.com
2021-12-20rtw88: don't check CRC of VHT-SIG-B in 802.11ac signalChin-Yen Lee5-8/+20
Currently all realtek wifi chip is set to check CRC of VHT-SIG-B in 802.11ac signal, but some AP don't calculate the CRC and packets from these AP can't be received and lead to disconnection. We disable the check defaultly to avoid this case. 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/20211217012421.7859-1-pkshih@realtek.com
2021-12-20rtw88: Disable PCIe ASPM while doing NAPI poll on 8821CEKai-Heng Feng2-51/+21
Many Intel based platforms face system random freeze after commit 9e2fd29864c5 ("rtw88: add napi support"). The commit itself shouldn't be the culprit. My guess is that the 8821CE only leaves ASPM L1 for a short period when IRQ is raised. Since IRQ is masked during NAPI polling, the PCIe link stays at L1 and makes RX DMA extremely slow. Eventually the RX ring becomes messed up: [ 1133.194697] rtw_8821ce 0000:02:00.0: pci bus timeout, check dma status Since the 8821CE hardware may fail to leave ASPM L1, manually do it in the driver to resolve the issue. Fixes: 9e2fd29864c5 ("rtw88: add napi support") Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=215131 BugLink: https://bugs.launchpad.net/bugs/1927808 Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com> Acked-by: Jian-Hong Pan <jhp@endlessos.org> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20211215114635.333767-1-kai.heng.feng@canonical.com