Commit 0a6f299b authored by Ping-Ke Shih's avatar Ping-Ke Shih Committed by Kalle Valo
Browse files

rtw89: configure security CAM for V1 chip



Add to configure security CAM while mac80211 calls set_key and del_key.

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/20220413010804.8941-4-pkshih@realtek.com
parent 04b5983e
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -244,6 +244,12 @@ static int rtw89_cam_attach_sec_cam(struct rtw89_dev *rtwdev,
	addr_cam->sec_ent[key_idx] = sec_cam->sec_cam_idx;
	addr_cam->sec_entries[key_idx] = sec_cam;
	set_bit(key_idx, addr_cam->sec_cam_map);
	ret = rtw89_chip_h2c_dctl_sec_cam(rtwdev, rtwvif, rtwsta);
	if (ret) {
		rtw89_err(rtwdev, "failed to update dctl cam sec entry: %d\n",
			  ret);
		return ret;
	}
	ret = rtw89_fw_h2c_cam(rtwdev, rtwvif, rtwsta, NULL);
	if (ret) {
		rtw89_err(rtwdev, "failed to update addr cam sec entry: %d\n",
@@ -398,6 +404,9 @@ int rtw89_cam_sec_key_del(struct rtw89_dev *rtwdev,
	clear_bit(key_idx, addr_cam->sec_cam_map);
	addr_cam->sec_entries[key_idx] = NULL;
	if (inform_fw) {
		ret = rtw89_chip_h2c_dctl_sec_cam(rtwdev, rtwvif, rtwsta);
		if (ret)
			rtw89_err(rtwdev, "failed to update dctl cam del key: %d\n", ret);
		ret = rtw89_fw_h2c_cam(rtwdev, rtwvif, rtwsta, NULL);
		if (ret)
			rtw89_err(rtwdev, "failed to update cam del key: %d\n", ret);
+15 −0
Original line number Diff line number Diff line
@@ -2106,6 +2106,9 @@ struct rtw89_chip_ops {
	int (*stop_sch_tx)(struct rtw89_dev *rtwdev, u8 mac_idx,
			   u32 *tx_en, enum rtw89_sch_tx_sel sel);
	int (*resume_sch_tx)(struct rtw89_dev *rtwdev, u8 mac_idx, u32 tx_en);
	int (*h2c_dctl_sec_cam)(struct rtw89_dev *rtwdev,
				struct rtw89_vif *rtwvif,
				struct rtw89_sta *rtwsta);

	void (*btc_set_rfe)(struct rtw89_dev *rtwdev);
	void (*btc_init_cfg)(struct rtw89_dev *rtwdev);
@@ -3634,6 +3637,18 @@ int rtw89_chip_resume_sch_tx(struct rtw89_dev *rtwdev, u8 mac_idx, u32 tx_en)
	return chip->ops->resume_sch_tx(rtwdev, mac_idx, tx_en);
}

static inline
int rtw89_chip_h2c_dctl_sec_cam(struct rtw89_dev *rtwdev,
				struct rtw89_vif *rtwvif,
				struct rtw89_sta *rtwsta)
{
	const struct rtw89_chip_info *chip = rtwdev->chip;

	if (!chip->ops->h2c_dctl_sec_cam)
		return 0;
	return chip->ops->h2c_dctl_sec_cam(rtwdev, rtwvif, rtwsta);
}

static inline u8 *get_hdr_bssid(struct ieee80211_hdr *hdr)
{
	__le16 fc = hdr->frame_control;
+1 −0
Original line number Diff line number Diff line
@@ -2075,6 +2075,7 @@ static const struct rtw89_chip_ops rtw8852a_chip_ops = {
	.mac_cfg_gnt		= rtw89_mac_cfg_gnt,
	.stop_sch_tx		= rtw89_mac_stop_sch_tx,
	.resume_sch_tx		= rtw89_mac_resume_sch_tx,
	.h2c_dctl_sec_cam	= NULL,

	.btc_set_rfe		= rtw8852a_btc_set_rfe,
	.btc_init_cfg		= rtw8852a_btc_init_cfg,
+1 −0
Original line number Diff line number Diff line
@@ -645,6 +645,7 @@ static const struct rtw89_chip_ops rtw8852c_chip_ops = {
	.mac_cfg_gnt		= rtw89_mac_cfg_gnt_v1,
	.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,

	.btc_init_cfg		= rtw8852c_btc_init_cfg,
};