Commit 14f0999d authored by Ping-Ke Shih's avatar Ping-Ke Shih Committed by Kalle Valo

rtw89: separate {init,deinit}_addr_cam functions

Each stations connected to AP needs to set an address CAM, so don't combine
address and BSSID CAM.
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/20220107034239.22002-13-pkshih@realtek.com
parent 9eecaec2
...@@ -427,15 +427,23 @@ static void rtw89_cam_reset_key_iter(struct ieee80211_hw *hw, ...@@ -427,15 +427,23 @@ static void rtw89_cam_reset_key_iter(struct ieee80211_hw *hw,
rtw89_cam_deinit(rtwdev, rtwvif); rtw89_cam_deinit(rtwdev, rtwvif);
} }
void rtw89_cam_deinit_addr_cam(struct rtw89_dev *rtwdev,
struct rtw89_addr_cam_entry *addr_cam)
{
struct rtw89_cam_info *cam_info = &rtwdev->cam_info;
addr_cam->valid = false;
clear_bit(addr_cam->addr_cam_idx, cam_info->addr_cam_map);
}
void rtw89_cam_deinit(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif) void rtw89_cam_deinit(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
{ {
struct rtw89_cam_info *cam_info = &rtwdev->cam_info; struct rtw89_cam_info *cam_info = &rtwdev->cam_info;
struct rtw89_addr_cam_entry *addr_cam = &rtwvif->addr_cam; struct rtw89_addr_cam_entry *addr_cam = &rtwvif->addr_cam;
struct rtw89_bssid_cam_entry *bssid_cam = &rtwvif->bssid_cam; struct rtw89_bssid_cam_entry *bssid_cam = &rtwvif->bssid_cam;
addr_cam->valid = false; rtw89_cam_deinit_addr_cam(rtwdev, addr_cam);
bssid_cam->valid = false; bssid_cam->valid = false;
clear_bit(addr_cam->addr_cam_idx, cam_info->addr_cam_map);
clear_bit(bssid_cam->bssid_cam_idx, cam_info->bssid_cam_map); clear_bit(bssid_cam->bssid_cam_idx, cam_info->bssid_cam_map);
} }
...@@ -464,10 +472,10 @@ static int rtw89_cam_get_avail_addr_cam(struct rtw89_dev *rtwdev, ...@@ -464,10 +472,10 @@ static int rtw89_cam_get_avail_addr_cam(struct rtw89_dev *rtwdev,
return 0; return 0;
} }
static int rtw89_cam_init_addr_cam(struct rtw89_dev *rtwdev, int rtw89_cam_init_addr_cam(struct rtw89_dev *rtwdev,
struct rtw89_vif *rtwvif) struct rtw89_addr_cam_entry *addr_cam,
const struct rtw89_bssid_cam_entry *bssid_cam)
{ {
struct rtw89_addr_cam_entry *addr_cam = &rtwvif->addr_cam;
u8 addr_cam_idx; u8 addr_cam_idx;
int i; int i;
int ret; int ret;
...@@ -484,14 +492,17 @@ static int rtw89_cam_init_addr_cam(struct rtw89_dev *rtwdev, ...@@ -484,14 +492,17 @@ static int rtw89_cam_init_addr_cam(struct rtw89_dev *rtwdev,
addr_cam->valid = true; addr_cam->valid = true;
addr_cam->addr_mask = 0; addr_cam->addr_mask = 0;
addr_cam->mask_sel = RTW89_NO_MSK; addr_cam->mask_sel = RTW89_NO_MSK;
addr_cam->sec_ent_mode = RTW89_ADDR_CAM_SEC_NORMAL;
bitmap_zero(addr_cam->sec_cam_map, RTW89_SEC_CAM_IN_ADDR_CAM); bitmap_zero(addr_cam->sec_cam_map, RTW89_SEC_CAM_IN_ADDR_CAM);
ether_addr_copy(addr_cam->sma, rtwvif->mac_addr);
for (i = 0; i < RTW89_SEC_CAM_IN_ADDR_CAM; i++) { for (i = 0; i < RTW89_SEC_CAM_IN_ADDR_CAM; i++) {
addr_cam->sec_ent_keyid[i] = 0; addr_cam->sec_ent_keyid[i] = 0;
addr_cam->sec_ent[i] = 0; addr_cam->sec_ent[i] = 0;
} }
/* associate addr cam with bssid cam */
addr_cam->bssid_cam_idx = bssid_cam->bssid_cam_idx;
return 0; return 0;
} }
...@@ -549,21 +560,18 @@ int rtw89_cam_init(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif) ...@@ -549,21 +560,18 @@ int rtw89_cam_init(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
struct rtw89_bssid_cam_entry *bssid_cam = &rtwvif->bssid_cam; struct rtw89_bssid_cam_entry *bssid_cam = &rtwvif->bssid_cam;
int ret; int ret;
ret = rtw89_cam_init_addr_cam(rtwdev, rtwvif); ret = rtw89_cam_init_bssid_cam(rtwdev, rtwvif);
if (ret) { if (ret) {
rtw89_err(rtwdev, "failed to init addr cam\n"); rtw89_err(rtwdev, "failed to init bssid cam\n");
return ret; return ret;
} }
ret = rtw89_cam_init_bssid_cam(rtwdev, rtwvif); ret = rtw89_cam_init_addr_cam(rtwdev, addr_cam, bssid_cam);
if (ret) { if (ret) {
rtw89_err(rtwdev, "failed to init bssid cam\n"); rtw89_err(rtwdev, "failed to init addr cam\n");
return ret; return ret;
} }
/* associate addr cam with bssid cam */
addr_cam->bssid_cam_idx = bssid_cam->bssid_cam_idx;
return 0; return 0;
} }
......
...@@ -346,6 +346,11 @@ static inline void FWCMD_SET_ADDR_BSSID_BSSID5(void *cmd, u32 value) ...@@ -346,6 +346,11 @@ static inline void FWCMD_SET_ADDR_BSSID_BSSID5(void *cmd, u32 value)
int rtw89_cam_init(struct rtw89_dev *rtwdev, struct rtw89_vif *vif); int rtw89_cam_init(struct rtw89_dev *rtwdev, struct rtw89_vif *vif);
void rtw89_cam_deinit(struct rtw89_dev *rtwdev, struct rtw89_vif *vif); void rtw89_cam_deinit(struct rtw89_dev *rtwdev, struct rtw89_vif *vif);
int rtw89_cam_init_addr_cam(struct rtw89_dev *rtwdev,
struct rtw89_addr_cam_entry *addr_cam,
const struct rtw89_bssid_cam_entry *bssid_cam);
void rtw89_cam_deinit_addr_cam(struct rtw89_dev *rtwdev,
struct rtw89_addr_cam_entry *addr_cam);
void rtw89_cam_fill_addr_cam_info(struct rtw89_dev *rtwdev, void rtw89_cam_fill_addr_cam_info(struct rtw89_dev *rtwdev,
struct rtw89_vif *vif, struct rtw89_vif *vif,
struct rtw89_sta *rtwsta, struct rtw89_sta *rtwsta,
......
...@@ -1879,7 +1879,6 @@ struct rtw89_addr_cam_entry { ...@@ -1879,7 +1879,6 @@ struct rtw89_addr_cam_entry {
u8 wapi : 1; u8 wapi : 1;
u8 mask_sel : 2; u8 mask_sel : 2;
u8 bssid_cam_idx: 6; u8 bssid_cam_idx: 6;
u8 sma[ETH_ALEN];
u8 sec_ent_mode; u8 sec_ent_mode;
DECLARE_BITMAP(sec_cam_map, RTW89_SEC_CAM_IN_ADDR_CAM); DECLARE_BITMAP(sec_cam_map, RTW89_SEC_CAM_IN_ADDR_CAM);
......
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