]> www.infradead.org Git - linux.git/commitdiff
wifi: rtw89: introduce chip support link number and driver MLO capability
authorZong-Zhe Yang <kevin_yang@realtek.com>
Mon, 19 Aug 2024 09:17:24 +0000 (17:17 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Tue, 27 Aug 2024 02:58:01 +0000 (10:58 +0800)
Configure supported link number by chip. And, introduce driver capability
flag for MLO. Driver should depend on runtime FW features and chip info to
determine whether to set the MLO capability flag or not. Once the MLO flag
is set, driver will consider/register/initialize things for MLO usages.

However, we just add the driver MLO capability flag ahead and don't really
set it. Then, we can start to tweak driver architecture for MLO. Some code
should depend on this flag. And after tweaking driver architecture is done,
we will set it based on runtime conditions as mentioned above.

Besides, MLD number supported by HW should be
chip supported mac_id number / chip supported link number
Without driver MLO capability flag, we allocate stations based on supported
mac_id number. With driver MLO capability flag, we allocate stations based
on supported MLD number.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20240819091724.33730-9-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/core.c
drivers/net/wireless/realtek/rtw89/core.h
drivers/net/wireless/realtek/rtw89/rtw8851b.c
drivers/net/wireless/realtek/rtw89/rtw8852a.c
drivers/net/wireless/realtek/rtw89/rtw8852b.c
drivers/net/wireless/realtek/rtw89/rtw8852bt.c
drivers/net/wireless/realtek/rtw89/rtw8852c.c
drivers/net/wireless/realtek/rtw89/rtw8922a.c

index c3680353bcf191618305abd3a5b2992a317bc08c..dc642697d74a5979f93115890feb34f56ab0571d 100644 (file)
@@ -4263,9 +4263,14 @@ void rtw89_core_stop(struct rtw89_dev *rtwdev)
 u8 rtw89_acquire_mac_id(struct rtw89_dev *rtwdev)
 {
        const struct rtw89_chip_info *chip = rtwdev->chip;
-       u8 mac_id_num = chip->support_macid_num;
+       u8 mac_id_num;
        u8 mac_id;
 
+       if (rtwdev->support_mlo)
+               mac_id_num = chip->support_macid_num / chip->support_link_num;
+       else
+               mac_id_num = chip->support_macid_num;
+
        mac_id = find_first_zero_bit(rtwdev->mac_id_map, mac_id_num);
        if (mac_id == mac_id_num)
                return RTW89_MAX_MAC_ID_NUM;
@@ -4681,6 +4686,9 @@ static int rtw89_core_register_hw(struct rtw89_dev *rtwdev)
        if (chip->chip_gen == RTW89_CHIP_BE)
                hw->wiphy->flags |= WIPHY_FLAG_DISABLE_WEXT;
 
+       if (rtwdev->support_mlo)
+               hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO;
+
        hw->wiphy->features |= NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR;
 
        hw->wiphy->max_scan_ssids = RTW89_SCANOFLD_MAX_SSID;
@@ -4783,6 +4791,7 @@ struct rtw89_dev *rtw89_alloc_ieee80211_hw(struct device *device,
        struct ieee80211_ops *ops;
        u32 driver_data_size;
        int fw_format = -1;
+       bool support_mlo;
        bool no_chanctx;
 
        firmware = rtw89_early_fw_feature_recognize(device, chip, &early_fw, &fw_format);
@@ -4811,6 +4820,14 @@ struct rtw89_dev *rtw89_alloc_ieee80211_hw(struct device *device,
        if (!hw)
                goto err;
 
+       /* TODO: When driver MLO arch. is done, determine whether to support MLO
+        * according to the following conditions.
+        * 1. run with chanctx_ops
+        * 2. chip->support_link_num != 0
+        * 3. FW feature supports AP_LINK_PS
+        */
+       support_mlo = false;
+
        hw->wiphy->iface_combinations = rtw89_iface_combs;
 
        if (no_chanctx || chip->support_chanctx_num == 1)
@@ -4825,9 +4842,12 @@ struct rtw89_dev *rtw89_alloc_ieee80211_hw(struct device *device,
        rtwdev->chip = chip;
        rtwdev->fw.req.firmware = firmware;
        rtwdev->fw.fw_format = fw_format;
+       rtwdev->support_mlo = support_mlo;
 
-       rtw89_debug(rtwdev, RTW89_DBG_FW, "probe driver %s chanctx\n",
+       rtw89_debug(rtwdev, RTW89_DBG_CHAN, "probe driver %s chanctx\n",
                    no_chanctx ? "without" : "with");
+       rtw89_debug(rtwdev, RTW89_DBG_CHAN, "probe driver %s MLO cap\n",
+                   support_mlo ? "with" : "without");
 
        return rtwdev;
 
index b24c2e5ecc64e05e7ca15331e8e6a6cf012877e2..34dbe7f132f8407888239caeb63273121dbe65d5 100644 (file)
@@ -4232,6 +4232,7 @@ struct rtw89_chip_info {
        u8 wde_qempty_mgq_grpsel;
        u32 rf_base_addr[2];
        u8 support_macid_num;
+       u8 support_link_num;
        u8 support_chanctx_num;
        u8 support_bands;
        u16 support_bandwidths;
@@ -5475,6 +5476,7 @@ struct rtw89_dev {
        const struct ieee80211_ops *ops;
 
        bool dbcc_en;
+       bool support_mlo;
        enum rtw89_mlo_dbcc_mode mlo_dbcc_mode;
        struct rtw89_hw_scan_info scan_info;
        const struct rtw89_chip_info *chip;
index c2fa8e270a4bba028dfeedf78b69a16ed3063de8..6dc07edd18a2e67c385f4b5f27e453437ee7cbee 100644 (file)
@@ -2465,6 +2465,7 @@ const struct rtw89_chip_info rtw8851b_chip_info = {
        .dig_regs               = &rtw8851b_dig_regs,
        .tssi_dbw_table         = NULL,
        .support_macid_num      = RTW89_MAX_MAC_ID_NUM,
+       .support_link_num       = 0,
        .support_chanctx_num    = 0,
        .support_rnr            = false,
        .support_bands          = BIT(NL80211_BAND_2GHZ) |
index 1034d8b29f5d66d58d758df819bb35188e7b30a5..5eadb0cba29c96bb0d1a44df321371ad37aa75a0 100644 (file)
@@ -2183,6 +2183,7 @@ const struct rtw89_chip_info rtw8852a_chip_info = {
        .dig_regs               = &rtw8852a_dig_regs,
        .tssi_dbw_table         = NULL,
        .support_macid_num      = RTW89_MAX_MAC_ID_NUM,
+       .support_link_num       = 0,
        .support_chanctx_num    = 1,
        .support_rnr            = false,
        .support_bands          = BIT(NL80211_BAND_2GHZ) |
index 4a4e825302ea3864627e588d038a9a45348d05c2..b7e92ce9256b251ff442e5cffb51e4f4d56c853b 100644 (file)
@@ -820,6 +820,7 @@ const struct rtw89_chip_info rtw8852b_chip_info = {
        .dig_regs               = &rtw8852b_dig_regs,
        .tssi_dbw_table         = NULL,
        .support_macid_num      = RTW89_MAX_MAC_ID_NUM,
+       .support_link_num       = 0,
        .support_chanctx_num    = 0,
        .support_rnr            = false,
        .support_bands          = BIT(NL80211_BAND_2GHZ) |
index f7d133ac34ded1d23d53aa8c1dc4293ac30586df..52a76d2646e9a2a431033ed29767f3bf96cc1253 100644 (file)
@@ -753,6 +753,7 @@ const struct rtw89_chip_info rtw8852bt_chip_info = {
        .dig_regs               = &rtw8852bt_dig_regs,
        .tssi_dbw_table         = NULL,
        .support_macid_num      = RTW89_MAX_MAC_ID_NUM,
+       .support_link_num       = 0,
        .support_chanctx_num    = 1,
        .support_rnr            = false,
        .support_bands          = BIT(NL80211_BAND_2GHZ) |
index d4adab43f4f2ff6c37ec160ba0dc253aa7046bcb..4a7eaebcdddcf688b0b27d9370dd08dc5f40953d 100644 (file)
@@ -2961,6 +2961,7 @@ const struct rtw89_chip_info rtw8852c_chip_info = {
        .dig_regs               = &rtw8852c_dig_regs,
        .tssi_dbw_table         = &rtw89_8852c_tssi_dbw_table,
        .support_macid_num      = RTW89_MAX_MAC_ID_NUM,
+       .support_link_num       = 0,
        .support_chanctx_num    = 2,
        .support_rnr            = false,
        .support_bands          = BIT(NL80211_BAND_2GHZ) |
index 85bdeeda95de449e2480099d2887365e1676d6e7..3387989299c9ad57987fc281400850db13a6e392 100644 (file)
@@ -2621,6 +2621,7 @@ const struct rtw89_chip_info rtw8922a_chip_info = {
        .dig_regs               = &rtw8922a_dig_regs,
        .tssi_dbw_table         = NULL,
        .support_macid_num      = 32,
+       .support_link_num       = 2,
        .support_chanctx_num    = 2,
        .support_rnr            = true,
        .support_bands          = BIT(NL80211_BAND_2GHZ) |