Commit 2def7356 authored by Ping-Ke Shih's avatar Ping-Ke Shih Committed by Kalle Valo

wifi: rtw89: 8852c: declare correct BA CAM number

8852A has 2 BA CAM entries, but 8852C has 8 entries. Add a field to
discriminate their differences.
Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220816013247.6243-2-pkshih@realtek.com
parent 07732caa
...@@ -2238,13 +2238,15 @@ void rtw89_core_release_all_bits_map(unsigned long *addr, unsigned int nbits) ...@@ -2238,13 +2238,15 @@ void rtw89_core_release_all_bits_map(unsigned long *addr, unsigned int nbits)
bitmap_zero(addr, nbits); bitmap_zero(addr, nbits);
} }
int rtw89_core_acquire_sta_ba_entry(struct rtw89_sta *rtwsta, u8 tid, u8 *cam_idx) int rtw89_core_acquire_sta_ba_entry(struct rtw89_dev *rtwdev,
struct rtw89_sta *rtwsta, u8 tid, u8 *cam_idx)
{ {
const struct rtw89_chip_info *chip = rtwdev->chip;
struct rtw89_ba_cam_entry *entry; struct rtw89_ba_cam_entry *entry;
u8 idx; u8 idx;
idx = rtw89_core_acquire_bit_map(rtwsta->ba_cam_map, RTW89_BA_CAM_NUM); idx = rtw89_core_acquire_bit_map(rtwsta->ba_cam_map, chip->bacam_num);
if (idx == RTW89_BA_CAM_NUM) { if (idx == chip->bacam_num) {
/* allocate a static BA CAM to tid=0, so replace the existing /* allocate a static BA CAM to tid=0, so replace the existing
* one if BA CAM is full. Hardware will process the original tid * one if BA CAM is full. Hardware will process the original tid
* automatically. * automatically.
...@@ -2262,12 +2264,14 @@ int rtw89_core_acquire_sta_ba_entry(struct rtw89_sta *rtwsta, u8 tid, u8 *cam_id ...@@ -2262,12 +2264,14 @@ int rtw89_core_acquire_sta_ba_entry(struct rtw89_sta *rtwsta, u8 tid, u8 *cam_id
return 0; return 0;
} }
int rtw89_core_release_sta_ba_entry(struct rtw89_sta *rtwsta, u8 tid, u8 *cam_idx) int rtw89_core_release_sta_ba_entry(struct rtw89_dev *rtwdev,
struct rtw89_sta *rtwsta, u8 tid, u8 *cam_idx)
{ {
const struct rtw89_chip_info *chip = rtwdev->chip;
struct rtw89_ba_cam_entry *entry; struct rtw89_ba_cam_entry *entry;
int i; int i;
for (i = 0; i < RTW89_BA_CAM_NUM; i++) { for (i = 0; i < chip->bacam_num; i++) {
if (!test_bit(i, rtwsta->ba_cam_map)) if (!test_bit(i, rtwsta->ba_cam_map))
continue; continue;
......
...@@ -2083,8 +2083,6 @@ struct rtw89_ra_report { ...@@ -2083,8 +2083,6 @@ struct rtw89_ra_report {
DECLARE_EWMA(rssi, 10, 16); DECLARE_EWMA(rssi, 10, 16);
#define RTW89_BA_CAM_NUM 2
struct rtw89_ba_cam_entry { struct rtw89_ba_cam_entry {
u8 tid; u8 tid;
}; };
...@@ -2092,6 +2090,7 @@ struct rtw89_ba_cam_entry { ...@@ -2092,6 +2090,7 @@ struct rtw89_ba_cam_entry {
#define RTW89_MAX_ADDR_CAM_NUM 128 #define RTW89_MAX_ADDR_CAM_NUM 128
#define RTW89_MAX_BSSID_CAM_NUM 20 #define RTW89_MAX_BSSID_CAM_NUM 20
#define RTW89_MAX_SEC_CAM_NUM 128 #define RTW89_MAX_SEC_CAM_NUM 128
#define RTW89_MAX_BA_CAM_NUM 8
#define RTW89_SEC_CAM_IN_ADDR_CAM 7 #define RTW89_SEC_CAM_IN_ADDR_CAM 7
struct rtw89_addr_cam_entry { struct rtw89_addr_cam_entry {
...@@ -2156,8 +2155,8 @@ struct rtw89_sta { ...@@ -2156,8 +2155,8 @@ struct rtw89_sta {
bool cctl_tx_retry_limit; bool cctl_tx_retry_limit;
u32 data_tx_cnt_lmt:6; u32 data_tx_cnt_lmt:6;
DECLARE_BITMAP(ba_cam_map, RTW89_BA_CAM_NUM); DECLARE_BITMAP(ba_cam_map, RTW89_MAX_BA_CAM_NUM);
struct rtw89_ba_cam_entry ba_cam_entry[RTW89_BA_CAM_NUM]; struct rtw89_ba_cam_entry ba_cam_entry[RTW89_MAX_BA_CAM_NUM];
}; };
struct rtw89_efuse { struct rtw89_efuse {
...@@ -2572,6 +2571,7 @@ struct rtw89_chip_info { ...@@ -2572,6 +2571,7 @@ struct rtw89_chip_info {
u8 acam_num; u8 acam_num;
u8 bcam_num; u8 bcam_num;
u8 scam_num; u8 scam_num;
u8 bacam_num;
u8 sec_ctrl_efuse_size; u8 sec_ctrl_efuse_size;
u32 physical_efuse_size; u32 physical_efuse_size;
...@@ -4154,8 +4154,10 @@ void rtw89_set_channel(struct rtw89_dev *rtwdev); ...@@ -4154,8 +4154,10 @@ void rtw89_set_channel(struct rtw89_dev *rtwdev);
u8 rtw89_core_acquire_bit_map(unsigned long *addr, unsigned long size); u8 rtw89_core_acquire_bit_map(unsigned long *addr, unsigned long size);
void rtw89_core_release_bit_map(unsigned long *addr, u8 bit); void rtw89_core_release_bit_map(unsigned long *addr, u8 bit);
void rtw89_core_release_all_bits_map(unsigned long *addr, unsigned int nbits); void rtw89_core_release_all_bits_map(unsigned long *addr, unsigned int nbits);
int rtw89_core_acquire_sta_ba_entry(struct rtw89_sta *rtwsta, u8 tid, u8 *cam_idx); int rtw89_core_acquire_sta_ba_entry(struct rtw89_dev *rtwdev,
int rtw89_core_release_sta_ba_entry(struct rtw89_sta *rtwsta, u8 tid, u8 *cam_idx); struct rtw89_sta *rtwsta, u8 tid, u8 *cam_idx);
int rtw89_core_release_sta_ba_entry(struct rtw89_dev *rtwdev,
struct rtw89_sta *rtwsta, u8 tid, u8 *cam_idx);
void rtw89_vif_type_mapping(struct ieee80211_vif *vif, bool assoc); void rtw89_vif_type_mapping(struct ieee80211_vif *vif, bool assoc);
int rtw89_chip_info_setup(struct rtw89_dev *rtwdev); int rtw89_chip_info_setup(struct rtw89_dev *rtwdev);
bool rtw89_ra_report_to_bitrate(struct rtw89_dev *rtwdev, u8 rpt_rate, u16 *bitrate); bool rtw89_ra_report_to_bitrate(struct rtw89_dev *rtwdev, u8 rpt_rate, u16 *bitrate);
......
...@@ -685,8 +685,8 @@ int rtw89_fw_h2c_ba_cam(struct rtw89_dev *rtwdev, struct rtw89_sta *rtwsta, ...@@ -685,8 +685,8 @@ int rtw89_fw_h2c_ba_cam(struct rtw89_dev *rtwdev, struct rtw89_sta *rtwsta,
int ret; int ret;
ret = valid ? ret = valid ?
rtw89_core_acquire_sta_ba_entry(rtwsta, params->tid, &entry_idx) : rtw89_core_acquire_sta_ba_entry(rtwdev, rtwsta, params->tid, &entry_idx) :
rtw89_core_release_sta_ba_entry(rtwsta, params->tid, &entry_idx); rtw89_core_release_sta_ba_entry(rtwdev, rtwsta, params->tid, &entry_idx);
if (ret) { if (ret) {
/* it still works even if we don't have static BA CAM, because /* it still works even if we don't have static BA CAM, because
* hardware can create dynamic BA CAM automatically. * hardware can create dynamic BA CAM automatically.
......
...@@ -2148,6 +2148,7 @@ const struct rtw89_chip_info rtw8852a_chip_info = { ...@@ -2148,6 +2148,7 @@ const struct rtw89_chip_info rtw8852a_chip_info = {
.acam_num = 128, .acam_num = 128,
.bcam_num = 10, .bcam_num = 10,
.scam_num = 128, .scam_num = 128,
.bacam_num = 2,
.sec_ctrl_efuse_size = 4, .sec_ctrl_efuse_size = 4,
.physical_efuse_size = 1216, .physical_efuse_size = 1216,
.logical_efuse_size = 1536, .logical_efuse_size = 1536,
......
...@@ -2980,6 +2980,7 @@ const struct rtw89_chip_info rtw8852c_chip_info = { ...@@ -2980,6 +2980,7 @@ const struct rtw89_chip_info rtw8852c_chip_info = {
.acam_num = 128, .acam_num = 128,
.bcam_num = 20, .bcam_num = 20,
.scam_num = 128, .scam_num = 128,
.bacam_num = 8,
.sec_ctrl_efuse_size = 4, .sec_ctrl_efuse_size = 4,
.physical_efuse_size = 1216, .physical_efuse_size = 1216,
.logical_efuse_size = 2048, .logical_efuse_size = 2048,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment