mac80211: rtl8xxxu: sync with linux-next 20240229
[openwrt/staging/981213.git] / package / kernel / mac80211 / patches / rtl / 001-02-v6.9-wifi-rtl8xxxu-prepare-supporting-two-virtual-interfa.patch
1 From 2bbd7d584046038ce655e476628bb15e1460fac6 Mon Sep 17 00:00:00 2001
2 From: Martin Kaistra <martin.kaistra@linutronix.de>
3 Date: Fri, 22 Dec 2023 11:14:23 +0100
4 Subject: [PATCH 02/21] wifi: rtl8xxxu: prepare supporting two virtual
5 interfaces
6
7 To prepare for concurrent mode, add an array ("vifs") to rtl8xxxu_priv
8 to keep track of both interfaces.
9
10 Keep the old priv->vif as long there are still users of it and let
11 priv->vifs[0] point to the same location.
12
13 Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
14 Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
15 Signed-off-by: Kalle Valo <kvalo@kernel.org>
16 Link: https://msgid.link/20231222101442.626837-3-martin.kaistra@linutronix.de
17 ---
18 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 2 ++
19 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 10 +++++++---
20 2 files changed, 9 insertions(+), 3 deletions(-)
21
22 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
23 +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
24 @@ -1897,6 +1897,8 @@ struct rtl8xxxu_priv {
25 * is supported and no iface_combinations are provided.
26 */
27 struct ieee80211_vif *vif;
28 +
29 + struct ieee80211_vif *vifs[2];
30 struct delayed_work ra_watchdog;
31 struct work_struct c2hcmd_work;
32 struct sk_buff_head c2hcmd_queue;
33 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
34 +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
35 @@ -6569,10 +6569,12 @@ static int rtl8xxxu_add_interface(struct
36 int ret;
37 u8 val8;
38
39 - if (!priv->vif)
40 + if (!priv->vif) {
41 priv->vif = vif;
42 - else
43 + priv->vifs[0] = vif;
44 + } else {
45 return -EOPNOTSUPP;
46 + }
47
48 switch (vif->type) {
49 case NL80211_IFTYPE_STATION:
50 @@ -6622,8 +6624,10 @@ static void rtl8xxxu_remove_interface(st
51
52 dev_dbg(&priv->udev->dev, "%s\n", __func__);
53
54 - if (priv->vif)
55 + if (priv->vif) {
56 priv->vif = NULL;
57 + priv->vifs[0] = NULL;
58 + }
59 }
60
61 static int rtl8xxxu_config(struct ieee80211_hw *hw, u32 changed)