wifi: rtw89: add chip_ops::h2c_ba_cam() to configure BA CAM
authorPing-Ke Shih <pkshih@realtek.com>
Mon, 8 Jan 2024 09:11:27 +0000 (17:11 +0800)
committerKalle Valo <kvalo@kernel.org>
Fri, 12 Jan 2024 17:10:52 +0000 (19:10 +0200)
Since chips could use different version of BA CAM H2C command, add a
chip_ops to abstract the operation.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240108091134.67007-4-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/core.h
drivers/net/wireless/realtek/rtw89/fw.c
drivers/net/wireless/realtek/rtw89/fw.h
drivers/net/wireless/realtek/rtw89/mac80211.c
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/rtw8852c.c
drivers/net/wireless/realtek/rtw89/rtw8922a.c

index 662425b..151b000 100644 (file)
@@ -3197,6 +3197,8 @@ struct rtw89_chip_ops {
        int (*h2c_dctl_sec_cam)(struct rtw89_dev *rtwdev,
                                struct rtw89_vif *rtwvif,
                                struct rtw89_sta *rtwsta);
+       int (*h2c_ba_cam)(struct rtw89_dev *rtwdev, struct rtw89_sta *rtwsta,
+                         bool valid, struct ieee80211_ampdu_params *params);
 
        void (*btc_set_rfe)(struct rtw89_dev *rtwdev);
        void (*btc_init_cfg)(struct rtw89_dev *rtwdev);
index 28bf810..b121520 100644 (file)
@@ -1556,6 +1556,7 @@ fail:
 
        return ret;
 }
+EXPORT_SYMBOL(rtw89_fw_h2c_ba_cam);
 
 static int rtw89_fw_h2c_init_ba_cam_v0_ext(struct rtw89_dev *rtwdev,
                                           u8 entry_idx, u8 uid)
@@ -1682,6 +1683,7 @@ fail:
 
        return ret;
 }
+EXPORT_SYMBOL(rtw89_fw_h2c_ba_cam_v1);
 
 int rtw89_fw_h2c_init_ba_cam_users(struct rtw89_dev *rtwdev, u8 users,
                                   u8 offset, u8 mac_idx)
index 687623f..6c51ee9 100644 (file)
@@ -3996,6 +3996,15 @@ static inline void rtw89_fw_h2c_init_ba_cam(struct rtw89_dev *rtwdev)
                rtw89_fw_h2c_init_dynamic_ba_cam_v0_ext(rtwdev);
 }
 
+static inline
+int rtw89_chip_h2c_ba_cam(struct rtw89_dev *rtwdev, struct rtw89_sta *rtwsta,
+                         bool valid, struct ieee80211_ampdu_params *params)
+{
+       const struct rtw89_chip_info *chip = rtwdev->chip;
+
+       return chip->ops->h2c_ba_cam(rtwdev, rtwsta, valid, params);
+}
+
 /* must consider compatibility; don't insert new in the mid */
 struct rtw89_fw_txpwr_byrate_entry {
        u8 band;
index 93889d2..915bd82 100644 (file)
@@ -673,12 +673,12 @@ static int rtw89_ops_ampdu_action(struct ieee80211_hw *hw,
                break;
        case IEEE80211_AMPDU_RX_START:
                mutex_lock(&rtwdev->mutex);
-               rtw89_fw_h2c_ba_cam(rtwdev, rtwsta, true, params);
+               rtw89_chip_h2c_ba_cam(rtwdev, rtwsta, true, params);
                mutex_unlock(&rtwdev->mutex);
                break;
        case IEEE80211_AMPDU_RX_STOP:
                mutex_lock(&rtwdev->mutex);
-               rtw89_fw_h2c_ba_cam(rtwdev, rtwsta, false, params);
+               rtw89_chip_h2c_ba_cam(rtwdev, rtwsta, false, params);
                mutex_unlock(&rtwdev->mutex);
                break;
        default:
index b5cf093..73700c4 100644 (file)
@@ -2334,6 +2334,7 @@ static const struct rtw89_chip_ops rtw8851b_chip_ops = {
        .stop_sch_tx            = rtw89_mac_stop_sch_tx,
        .resume_sch_tx          = rtw89_mac_resume_sch_tx,
        .h2c_dctl_sec_cam       = NULL,
+       .h2c_ba_cam             = rtw89_fw_h2c_ba_cam,
 
        .btc_set_rfe            = rtw8851b_btc_set_rfe,
        .btc_init_cfg           = rtw8851b_btc_init_cfg,
index 0c76c52..481c1f5 100644 (file)
@@ -2078,6 +2078,7 @@ static const struct rtw89_chip_ops rtw8852a_chip_ops = {
        .stop_sch_tx            = rtw89_mac_stop_sch_tx,
        .resume_sch_tx          = rtw89_mac_resume_sch_tx,
        .h2c_dctl_sec_cam       = NULL,
+       .h2c_ba_cam             = rtw89_fw_h2c_ba_cam,
 
        .btc_set_rfe            = rtw8852a_btc_set_rfe,
        .btc_init_cfg           = rtw8852a_btc_init_cfg,
index ab60cc1..8666365 100644 (file)
@@ -2503,6 +2503,7 @@ static const struct rtw89_chip_ops rtw8852b_chip_ops = {
        .stop_sch_tx            = rtw89_mac_stop_sch_tx,
        .resume_sch_tx          = rtw89_mac_resume_sch_tx,
        .h2c_dctl_sec_cam       = NULL,
+       .h2c_ba_cam             = rtw89_fw_h2c_ba_cam,
 
        .btc_set_rfe            = rtw8852b_btc_set_rfe,
        .btc_init_cfg           = rtw8852b_btc_init_cfg,
index 9a9b710..6727c9f 100644 (file)
@@ -2848,6 +2848,7 @@ static const struct rtw89_chip_ops rtw8852c_chip_ops = {
        .stop_sch_tx            = rtw89_mac_stop_sch_tx_v1,
        .resume_sch_tx          = rtw89_mac_resume_sch_tx_v1,
        .h2c_dctl_sec_cam       = rtw89_fw_h2c_dctl_sec_cam_v1,
+       .h2c_ba_cam             = rtw89_fw_h2c_ba_cam,
 
        .btc_set_rfe            = rtw8852c_btc_set_rfe,
        .btc_init_cfg           = rtw8852c_btc_init_cfg,
index 070d0c7..2c8cefb 100644 (file)
@@ -822,6 +822,7 @@ static const struct rtw89_chip_ops rtw8922a_chip_ops = {
        .read_phycap            = rtw8922a_read_phycap,
        .pwr_on_func            = rtw8922a_pwr_on_func,
        .pwr_off_func           = rtw8922a_pwr_off_func,
+       .h2c_ba_cam             = rtw89_fw_h2c_ba_cam_v1,
 };
 
 const struct rtw89_chip_info rtw8922a_chip_info = {