forked from openwrt/openwrt
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mac80211: rtl8xxxu: sync with linux-next 20240229
Backporting upstream patches to improve RTL8188F support. Signed-off-by: Shiji Yang <[email protected]>
- Loading branch information
1 parent
860dd27
commit 97f5422
Showing
33 changed files
with
2,499 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
...c80211/patches/rtl/001-01-v6.9-wifi-rtl8xxxu-remove-assignment-of-priv-vif-in-rtl8x.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
From d55cb6d8a99441aff55cb9ce663a07f7f1667e83 Mon Sep 17 00:00:00 2001 | ||
From: Martin Kaistra <[email protected]> | ||
Date: Fri, 22 Dec 2023 11:14:22 +0100 | ||
Subject: [PATCH 01/21] wifi: rtl8xxxu: remove assignment of priv->vif in | ||
rtl8xxxu_bss_info_changed() | ||
|
||
priv->vif gets already set in rtl8xxxu_add_interface, there is no need | ||
to set it also in rtl8xxxu_bss_info_changed(). | ||
|
||
Signed-off-by: Martin Kaistra <[email protected]> | ||
Reviewed-by: Ping-Ke Shih <[email protected]> | ||
Signed-off-by: Kalle Valo <[email protected]> | ||
Link: https://msgid.link/[email protected] | ||
--- | ||
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 1 - | ||
1 file changed, 1 deletion(-) | ||
|
||
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | ||
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | ||
@@ -5004,7 +5004,6 @@ rtl8xxxu_bss_info_changed(struct ieee802 | ||
|
||
rtl8xxxu_update_ra_report(rarpt, highest_rate, sgi, bw); | ||
|
||
- priv->vif = vif; | ||
priv->rssi_level = RTL8XXXU_RATR_STA_INIT; | ||
|
||
priv->fops->update_rate_mask(priv, ramask, 0, sgi, |
61 changes: 61 additions & 0 deletions
61
...c80211/patches/rtl/001-02-v6.9-wifi-rtl8xxxu-prepare-supporting-two-virtual-interfa.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
From 2bbd7d584046038ce655e476628bb15e1460fac6 Mon Sep 17 00:00:00 2001 | ||
From: Martin Kaistra <[email protected]> | ||
Date: Fri, 22 Dec 2023 11:14:23 +0100 | ||
Subject: [PATCH 02/21] wifi: rtl8xxxu: prepare supporting two virtual | ||
interfaces | ||
|
||
To prepare for concurrent mode, add an array ("vifs") to rtl8xxxu_priv | ||
to keep track of both interfaces. | ||
|
||
Keep the old priv->vif as long there are still users of it and let | ||
priv->vifs[0] point to the same location. | ||
|
||
Signed-off-by: Martin Kaistra <[email protected]> | ||
Reviewed-by: Ping-Ke Shih <[email protected]> | ||
Signed-off-by: Kalle Valo <[email protected]> | ||
Link: https://msgid.link/[email protected] | ||
--- | ||
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 2 ++ | ||
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 10 +++++++--- | ||
2 files changed, 9 insertions(+), 3 deletions(-) | ||
|
||
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | ||
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | ||
@@ -1897,6 +1897,8 @@ struct rtl8xxxu_priv { | ||
* is supported and no iface_combinations are provided. | ||
*/ | ||
struct ieee80211_vif *vif; | ||
+ | ||
+ struct ieee80211_vif *vifs[2]; | ||
struct delayed_work ra_watchdog; | ||
struct work_struct c2hcmd_work; | ||
struct sk_buff_head c2hcmd_queue; | ||
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | ||
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | ||
@@ -6569,10 +6569,12 @@ static int rtl8xxxu_add_interface(struct | ||
int ret; | ||
u8 val8; | ||
|
||
- if (!priv->vif) | ||
+ if (!priv->vif) { | ||
priv->vif = vif; | ||
- else | ||
+ priv->vifs[0] = vif; | ||
+ } else { | ||
return -EOPNOTSUPP; | ||
+ } | ||
|
||
switch (vif->type) { | ||
case NL80211_IFTYPE_STATION: | ||
@@ -6622,8 +6624,10 @@ static void rtl8xxxu_remove_interface(st | ||
|
||
dev_dbg(&priv->udev->dev, "%s\n", __func__); | ||
|
||
- if (priv->vif) | ||
+ if (priv->vif) { | ||
priv->vif = NULL; | ||
+ priv->vifs[0] = NULL; | ||
+ } | ||
} | ||
|
||
static int rtl8xxxu_config(struct ieee80211_hw *hw, u32 changed) |
102 changes: 102 additions & 0 deletions
102
...c80211/patches/rtl/001-03-v6.9-wifi-rtl8xxxu-support-setting-linktype-for-both-inte.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
From 7f444692cde83c1455682c2d0d2c9a666422b867 Mon Sep 17 00:00:00 2001 | ||
From: Martin Kaistra <[email protected]> | ||
Date: Fri, 22 Dec 2023 11:14:24 +0100 | ||
Subject: [PATCH 03/21] wifi: rtl8xxxu: support setting linktype for both | ||
interfaces | ||
|
||
To prepare for concurrent mode, enhance the set_linktype function to be | ||
able to set the linktype in the MSR register for both hardware ports. | ||
|
||
Until the users of set_linktype can handle multiple interfaces, use | ||
port_num = 0. | ||
|
||
Signed-off-by: Martin Kaistra <[email protected]> | ||
Reviewed-by: Ping-Ke Shih <[email protected]> | ||
Signed-off-by: Kalle Valo <[email protected]> | ||
Link: https://msgid.link/[email protected] | ||
--- | ||
.../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 37 +++++++++++-------- | ||
1 file changed, 22 insertions(+), 15 deletions(-) | ||
|
||
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | ||
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | ||
@@ -1633,33 +1633,41 @@ rtl8xxxu_gen1_set_tx_power(struct rtl8xx | ||
} | ||
|
||
static void rtl8xxxu_set_linktype(struct rtl8xxxu_priv *priv, | ||
- enum nl80211_iftype linktype) | ||
+ enum nl80211_iftype linktype, int port_num) | ||
{ | ||
- u8 val8; | ||
- | ||
- val8 = rtl8xxxu_read8(priv, REG_MSR); | ||
- val8 &= ~MSR_LINKTYPE_MASK; | ||
+ u8 val8, type; | ||
|
||
switch (linktype) { | ||
case NL80211_IFTYPE_UNSPECIFIED: | ||
- val8 |= MSR_LINKTYPE_NONE; | ||
+ type = MSR_LINKTYPE_NONE; | ||
break; | ||
case NL80211_IFTYPE_ADHOC: | ||
- val8 |= MSR_LINKTYPE_ADHOC; | ||
+ type = MSR_LINKTYPE_ADHOC; | ||
break; | ||
case NL80211_IFTYPE_STATION: | ||
- val8 |= MSR_LINKTYPE_STATION; | ||
+ type = MSR_LINKTYPE_STATION; | ||
break; | ||
case NL80211_IFTYPE_AP: | ||
- val8 |= MSR_LINKTYPE_AP; | ||
+ type = MSR_LINKTYPE_AP; | ||
break; | ||
default: | ||
- goto out; | ||
+ return; | ||
+ } | ||
+ | ||
+ switch (port_num) { | ||
+ case 0: | ||
+ val8 = rtl8xxxu_read8(priv, REG_MSR) & 0x0c; | ||
+ val8 |= type; | ||
+ break; | ||
+ case 1: | ||
+ val8 = rtl8xxxu_read8(priv, REG_MSR) & 0x03; | ||
+ val8 |= type << 2; | ||
+ break; | ||
+ default: | ||
+ return; | ||
} | ||
|
||
rtl8xxxu_write8(priv, REG_MSR, val8); | ||
-out: | ||
- return; | ||
} | ||
|
||
static void | ||
@@ -4236,7 +4244,6 @@ static int rtl8xxxu_init_device(struct i | ||
} | ||
|
||
rtl8xxxu_set_mac(priv); | ||
- rtl8xxxu_set_linktype(priv, NL80211_IFTYPE_STATION); | ||
|
||
/* | ||
* Configure initial WMAC settings | ||
@@ -4964,7 +4971,7 @@ rtl8xxxu_bss_info_changed(struct ieee802 | ||
if (changed & BSS_CHANGED_ASSOC) { | ||
dev_dbg(dev, "Changed ASSOC: %i!\n", vif->cfg.assoc); | ||
|
||
- rtl8xxxu_set_linktype(priv, vif->type); | ||
+ rtl8xxxu_set_linktype(priv, vif->type, 0); | ||
|
||
if (vif->cfg.assoc) { | ||
u32 ramask; | ||
@@ -6610,7 +6617,7 @@ static int rtl8xxxu_add_interface(struct | ||
ret = -EOPNOTSUPP; | ||
} | ||
|
||
- rtl8xxxu_set_linktype(priv, vif->type); | ||
+ rtl8xxxu_set_linktype(priv, vif->type, 0); | ||
ether_addr_copy(priv->mac_addr, vif->addr); | ||
rtl8xxxu_set_mac(priv); | ||
|
28 changes: 28 additions & 0 deletions
28
...c80211/patches/rtl/001-04-v6.9-wifi-rtl8xxxu-8188e-convert-usage-of-priv-vif-to-pri.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
From a047e46a7b98de384a158b25a05dc09aa7d70c5f Mon Sep 17 00:00:00 2001 | ||
From: Martin Kaistra <[email protected]> | ||
Date: Fri, 22 Dec 2023 11:14:25 +0100 | ||
Subject: [PATCH 04/21] wifi: rtl8xxxu: 8188e: convert usage of priv->vif to | ||
priv->vifs[0] | ||
|
||
The driver currently does not support AP or concurrent mode for 8188e, | ||
so just use priv->vifs[0] instead of priv->vif for now. | ||
|
||
Signed-off-by: Martin Kaistra <[email protected]> | ||
Reviewed-by: Ping-Ke Shih <[email protected]> | ||
Signed-off-by: Kalle Valo <[email protected]> | ||
Link: https://msgid.link/[email protected] | ||
--- | ||
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | ||
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | ||
@@ -1699,7 +1699,7 @@ void rtl8188e_handle_ra_tx_report2(struc | ||
/* We only use macid 0, so only the first item is relevant. | ||
* AP mode will use more of them if it's ever implemented. | ||
*/ | ||
- if (!priv->vif || priv->vif->type == NL80211_IFTYPE_STATION) | ||
+ if (!priv->vifs[0] || priv->vifs[0]->type == NL80211_IFTYPE_STATION) | ||
items = 1; | ||
|
||
for (macid = 0; macid < items; macid++) { |
72 changes: 72 additions & 0 deletions
72
...c80211/patches/rtl/001-05-v6.9-wifi-rtl8xxxu-support-setting-mac-address-register-f.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
From 00add60cad3c9690ac0f9d4f6685f96ccd607670 Mon Sep 17 00:00:00 2001 | ||
From: Martin Kaistra <[email protected]> | ||
Date: Fri, 22 Dec 2023 11:14:26 +0100 | ||
Subject: [PATCH 05/21] wifi: rtl8xxxu: support setting mac address register | ||
for both interfaces | ||
|
||
To prepare for concurrent mode, enhance rtl8xxxu_set_mac() to write the | ||
mac address of the respective interface to REG_MACID or REG_MACID1. | ||
|
||
Remove the call to rtl8xxxu_set_mac() from the init function as we set | ||
it in rtl8xxxu_add_interface() later anyway. | ||
|
||
Until rtl8xxxu_add_interface() can handle both interfaces, call | ||
rtl8xxxu_set_mac() with port_num = 0. | ||
|
||
Signed-off-by: Martin Kaistra <[email protected]> | ||
Reviewed-by: Ping-Ke Shih <[email protected]> | ||
Signed-off-by: Kalle Valo <[email protected]> | ||
Link: https://msgid.link/[email protected] | ||
--- | ||
.../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 20 +++++++++++++------ | ||
1 file changed, 14 insertions(+), 6 deletions(-) | ||
|
||
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | ||
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | ||
@@ -3580,15 +3580,25 @@ void rtl8723a_phy_lc_calibrate(struct rt | ||
rtl8xxxu_write8(priv, REG_TXPAUSE, 0x00); | ||
} | ||
|
||
-static int rtl8xxxu_set_mac(struct rtl8xxxu_priv *priv) | ||
+static int rtl8xxxu_set_mac(struct rtl8xxxu_priv *priv, int port_num) | ||
{ | ||
int i; | ||
u16 reg; | ||
|
||
- reg = REG_MACID; | ||
+ switch (port_num) { | ||
+ case 0: | ||
+ reg = REG_MACID; | ||
+ break; | ||
+ case 1: | ||
+ reg = REG_MACID1; | ||
+ break; | ||
+ default: | ||
+ WARN_ONCE("%s: invalid port_num\n", __func__); | ||
+ return -EINVAL; | ||
+ } | ||
|
||
for (i = 0; i < ETH_ALEN; i++) | ||
- rtl8xxxu_write8(priv, reg + i, priv->mac_addr[i]); | ||
+ rtl8xxxu_write8(priv, reg + i, priv->vifs[port_num]->addr[i]); | ||
|
||
return 0; | ||
} | ||
@@ -4243,8 +4253,6 @@ static int rtl8xxxu_init_device(struct i | ||
rtl8xxxu_write32(priv, REG_HIMR, 0xffffffff); | ||
} | ||
|
||
- rtl8xxxu_set_mac(priv); | ||
- | ||
/* | ||
* Configure initial WMAC settings | ||
*/ | ||
@@ -6619,7 +6627,7 @@ static int rtl8xxxu_add_interface(struct | ||
|
||
rtl8xxxu_set_linktype(priv, vif->type, 0); | ||
ether_addr_copy(priv->mac_addr, vif->addr); | ||
- rtl8xxxu_set_mac(priv); | ||
+ rtl8xxxu_set_mac(priv, 0); | ||
|
||
return ret; | ||
} |
75 changes: 75 additions & 0 deletions
75
...c80211/patches/rtl/001-06-v6.9-wifi-rtl8xxxu-extend-wifi-connected-check-to-both-in.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
From 9aa776209ca31695bead52674ad943848ccc97d5 Mon Sep 17 00:00:00 2001 | ||
From: Martin Kaistra <[email protected]> | ||
Date: Fri, 22 Dec 2023 11:14:27 +0100 | ||
Subject: [PATCH 06/21] wifi: rtl8xxxu: extend wifi connected check to both | ||
interfaces | ||
|
||
There are multiple places in the code where the current connection | ||
status of wifi is checked. The driver will support two interfaces soon | ||
and either one of them (or both) could be connected. | ||
|
||
Convert all uses of (vif && vif->cfg.assoc) to a new helper | ||
function rtl8xxxu_is_assoc() which checks both interfaces. | ||
|
||
Signed-off-by: Martin Kaistra <[email protected]> | ||
Reviewed-by: Ping-Ke Shih <[email protected]> | ||
Signed-off-by: Kalle Valo <[email protected]> | ||
Link: https://msgid.link/[email protected] | ||
--- | ||
.../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 20 +++++++++---------- | ||
1 file changed, 9 insertions(+), 11 deletions(-) | ||
|
||
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | ||
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | ||
@@ -6043,18 +6043,20 @@ void rtl8723bu_update_bt_link_info(struc | ||
btcoex->bt_busy = false; | ||
} | ||
|
||
+static inline bool rtl8xxxu_is_assoc(struct rtl8xxxu_priv *priv) | ||
+{ | ||
+ return (priv->vifs[0] && priv->vifs[0]->cfg.assoc) || | ||
+ (priv->vifs[1] && priv->vifs[1]->cfg.assoc); | ||
+} | ||
+ | ||
static | ||
void rtl8723bu_handle_bt_inquiry(struct rtl8xxxu_priv *priv) | ||
{ | ||
- struct ieee80211_vif *vif; | ||
struct rtl8xxxu_btcoex *btcoex; | ||
- bool wifi_connected; | ||
|
||
- vif = priv->vif; | ||
btcoex = &priv->bt_coex; | ||
- wifi_connected = (vif && vif->cfg.assoc); | ||
|
||
- if (!wifi_connected) { | ||
+ if (!rtl8xxxu_is_assoc(priv)) { | ||
rtl8723bu_set_ps_tdma(priv, 0x8, 0x0, 0x0, 0x0, 0x0); | ||
rtl8723bu_set_coex_with_type(priv, 0); | ||
} else if (btcoex->has_sco || btcoex->has_hid || btcoex->has_a2dp) { | ||
@@ -6072,15 +6074,11 @@ void rtl8723bu_handle_bt_inquiry(struct | ||
static | ||
void rtl8723bu_handle_bt_info(struct rtl8xxxu_priv *priv) | ||
{ | ||
- struct ieee80211_vif *vif; | ||
struct rtl8xxxu_btcoex *btcoex; | ||
- bool wifi_connected; | ||
|
||
- vif = priv->vif; | ||
btcoex = &priv->bt_coex; | ||
- wifi_connected = (vif && vif->cfg.assoc); | ||
|
||
- if (wifi_connected) { | ||
+ if (rtl8xxxu_is_assoc(priv)) { | ||
u32 val32 = 0; | ||
u32 high_prio_tx = 0, high_prio_rx = 0; | ||
|
||
@@ -7103,7 +7101,7 @@ static void rtl8xxxu_track_cfo(struct rt | ||
int cfo_khz_a, cfo_khz_b, cfo_average; | ||
int crystal_cap; | ||
|
||
- if (!priv->vif || !priv->vif->cfg.assoc) { | ||
+ if (!rtl8xxxu_is_assoc(priv)) { | ||
/* Reset */ | ||
cfo->adjust = true; | ||
|
Oops, something went wrong.