Lines Matching +full:cam +full:- +full:if
1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2 /* Copyright(c) 2019-2020 Realtek Corporation
5 #include "cam.h"
22 if (!skb) in rtw89_cam_get_sec_key_cmd()
30 key32[i] = FIELD_PREP(GENMASK(7, 0), sec_cam->key[j + 0]) | in rtw89_cam_get_sec_key_cmd()
31 FIELD_PREP(GENMASK(15, 8), sec_cam->key[j + 1]) | in rtw89_cam_get_sec_key_cmd()
32 FIELD_PREP(GENMASK(23, 16), sec_cam->key[j + 2]) | in rtw89_cam_get_sec_key_cmd()
33 FIELD_PREP(GENMASK(31, 24), sec_cam->key[j + 3]); in rtw89_cam_get_sec_key_cmd()
36 cmd = skb->data; in rtw89_cam_get_sec_key_cmd()
37 RTW89_SET_FWCMD_SEC_IDX(cmd, sec_cam->sec_cam_idx + (ext_key ? 1 : 0)); in rtw89_cam_get_sec_key_cmd()
38 RTW89_SET_FWCMD_SEC_OFFSET(cmd, sec_cam->offset); in rtw89_cam_get_sec_key_cmd()
39 RTW89_SET_FWCMD_SEC_LEN(cmd, sec_cam->len); in rtw89_cam_get_sec_key_cmd()
40 RTW89_SET_FWCMD_SEC_TYPE(cmd, sec_cam->type); in rtw89_cam_get_sec_key_cmd()
42 RTW89_SET_FWCMD_SEC_SPP_MODE(cmd, sec_cam->spp_mode); in rtw89_cam_get_sec_key_cmd()
58 if (!skb) { in rtw89_cam_send_sec_key_cmd()
60 return -ENOMEM; in rtw89_cam_send_sec_key_cmd()
70 if (ret) { in rtw89_cam_send_sec_key_cmd()
76 if (!sec_cam->ext_key) in rtw89_cam_send_sec_key_cmd()
80 if (!ext_skb) { in rtw89_cam_send_sec_key_cmd()
82 return -ENOMEM; in rtw89_cam_send_sec_key_cmd()
92 if (ret) { in rtw89_cam_send_sec_key_cmd()
104 const struct rtw89_chip_info *chip = rtwdev->chip; in rtw89_cam_get_avail_sec_cam()
105 struct rtw89_cam_info *cam_info = &rtwdev->cam_info; in rtw89_cam_get_avail_sec_cam()
106 u8 sec_cam_num = chip->scam_num; in rtw89_cam_get_avail_sec_cam()
109 if (!ext_key) { in rtw89_cam_get_avail_sec_cam()
110 idx = find_first_zero_bit(cam_info->sec_cam_map, sec_cam_num); in rtw89_cam_get_avail_sec_cam()
111 if (idx >= sec_cam_num) in rtw89_cam_get_avail_sec_cam()
112 return -EBUSY; in rtw89_cam_get_avail_sec_cam()
114 set_bit(idx, cam_info->sec_cam_map); in rtw89_cam_get_avail_sec_cam()
121 idx = find_next_zero_bit(cam_info->sec_cam_map, sec_cam_num, idx); in rtw89_cam_get_avail_sec_cam()
122 if (idx >= sec_cam_num - 1) in rtw89_cam_get_avail_sec_cam()
123 return -EBUSY; in rtw89_cam_get_avail_sec_cam()
124 /* ext keys need two cam entries for 256-bit key */ in rtw89_cam_get_avail_sec_cam()
125 if (test_bit(idx + 1, cam_info->sec_cam_map)) { in rtw89_cam_get_avail_sec_cam()
130 set_bit(idx, cam_info->sec_cam_map); in rtw89_cam_get_avail_sec_cam()
131 set_bit(idx + 1, cam_info->sec_cam_map); in rtw89_cam_get_avail_sec_cam()
145 * RTW89_ADDR_CAM_SEC_ALL_UNI : 0 - 6 unicast in rtw89_cam_get_addr_cam_key_idx()
146 * RTW89_ADDR_CAM_SEC_NORMAL : 0 - 1 unicast, 2 - 4 group, 5 - 6 BIP in rtw89_cam_get_addr_cam_key_idx()
147 * RTW89_ADDR_CAM_SEC_4GROUP : 0 - 1 unicast, 2 - 5 group, 6 BIP in rtw89_cam_get_addr_cam_key_idx()
149 switch (addr_cam->sec_ent_mode) { in rtw89_cam_get_addr_cam_key_idx()
151 return -EINVAL; in rtw89_cam_get_addr_cam_key_idx()
153 idx = find_first_zero_bit(addr_cam->sec_cam_map, in rtw89_cam_get_addr_cam_key_idx()
155 if (idx >= RTW89_SEC_CAM_IN_ADDR_CAM) in rtw89_cam_get_addr_cam_key_idx()
156 return -EBUSY; in rtw89_cam_get_addr_cam_key_idx()
160 if (sec_cam->type == RTW89_SEC_KEY_TYPE_BIP_CCMP128) { in rtw89_cam_get_addr_cam_key_idx()
161 idx = find_next_zero_bit(addr_cam->sec_cam_map, in rtw89_cam_get_addr_cam_key_idx()
163 if (idx > 6) in rtw89_cam_get_addr_cam_key_idx()
164 return -EBUSY; in rtw89_cam_get_addr_cam_key_idx()
169 if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) { in rtw89_cam_get_addr_cam_key_idx()
170 idx = find_next_zero_bit(addr_cam->sec_cam_map, in rtw89_cam_get_addr_cam_key_idx()
172 if (idx > 1) in rtw89_cam_get_addr_cam_key_idx()
173 return -EBUSY; in rtw89_cam_get_addr_cam_key_idx()
179 idx = find_next_zero_bit(addr_cam->sec_cam_map, in rtw89_cam_get_addr_cam_key_idx()
181 if (idx > 4) in rtw89_cam_get_addr_cam_key_idx()
182 return -EBUSY; in rtw89_cam_get_addr_cam_key_idx()
186 if (sec_cam->type == RTW89_SEC_KEY_TYPE_BIP_CCMP128) { in rtw89_cam_get_addr_cam_key_idx()
187 if (test_bit(6, addr_cam->sec_cam_map)) in rtw89_cam_get_addr_cam_key_idx()
188 return -EINVAL; in rtw89_cam_get_addr_cam_key_idx()
193 if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) { in rtw89_cam_get_addr_cam_key_idx()
194 idx = find_next_zero_bit(addr_cam->sec_cam_map, in rtw89_cam_get_addr_cam_key_idx()
196 if (idx > 1) in rtw89_cam_get_addr_cam_key_idx()
197 return -EBUSY; in rtw89_cam_get_addr_cam_key_idx()
203 idx = find_next_zero_bit(addr_cam->sec_cam_map, in rtw89_cam_get_addr_cam_key_idx()
205 if (idx > 5) in rtw89_cam_get_addr_cam_key_idx()
206 return -EBUSY; in rtw89_cam_get_addr_cam_key_idx()
226 if (!vif) { in rtw89_cam_detach_sec_cam()
227 rtw89_err(rtwdev, "No iface for deleting sec cam\n"); in rtw89_cam_detach_sec_cam()
228 return -EINVAL; in rtw89_cam_detach_sec_cam()
231 rtwvif = (struct rtw89_vif *)vif->drv_priv; in rtw89_cam_detach_sec_cam()
234 for_each_set_bit(i, addr_cam->sec_cam_map, RTW89_SEC_CAM_IN_ADDR_CAM) { in rtw89_cam_detach_sec_cam()
235 if (addr_cam->sec_ent[i] != sec_cam->sec_cam_idx) in rtw89_cam_detach_sec_cam()
238 clear_bit(i, addr_cam->sec_cam_map); in rtw89_cam_detach_sec_cam()
241 if (inform_fw) { in rtw89_cam_detach_sec_cam()
243 if (ret) in rtw89_cam_detach_sec_cam()
245 "failed to update dctl cam del key: %d\n", ret); in rtw89_cam_detach_sec_cam()
247 if (ret) in rtw89_cam_detach_sec_cam()
248 rtw89_err(rtwdev, "failed to update cam del key: %d\n", ret); in rtw89_cam_detach_sec_cam()
266 if (!vif) { in rtw89_cam_attach_sec_cam()
267 rtw89_err(rtwdev, "No iface for adding sec cam\n"); in rtw89_cam_attach_sec_cam()
268 return -EINVAL; in rtw89_cam_attach_sec_cam()
271 rtwvif = (struct rtw89_vif *)vif->drv_priv; in rtw89_cam_attach_sec_cam()
274 if (key->cipher == WLAN_CIPHER_SUITE_WEP40 || in rtw89_cam_attach_sec_cam()
275 key->cipher == WLAN_CIPHER_SUITE_WEP104) in rtw89_cam_attach_sec_cam()
276 addr_cam->sec_ent_mode = RTW89_ADDR_CAM_SEC_ALL_UNI; in rtw89_cam_attach_sec_cam()
279 if (ret) { in rtw89_cam_attach_sec_cam()
280 rtw89_err(rtwdev, "failed to get addr cam key idx %d, %d\n", in rtw89_cam_attach_sec_cam()
281 addr_cam->sec_ent_mode, sec_cam->type); in rtw89_cam_attach_sec_cam()
285 addr_cam->sec_ent_keyid[key_idx] = key->keyidx; in rtw89_cam_attach_sec_cam()
286 addr_cam->sec_ent[key_idx] = sec_cam->sec_cam_idx; in rtw89_cam_attach_sec_cam()
287 set_bit(key_idx, addr_cam->sec_cam_map); in rtw89_cam_attach_sec_cam()
289 if (ret) { in rtw89_cam_attach_sec_cam()
290 rtw89_err(rtwdev, "failed to update dctl cam sec entry: %d\n", in rtw89_cam_attach_sec_cam()
295 if (ret) { in rtw89_cam_attach_sec_cam()
296 rtw89_err(rtwdev, "failed to update addr cam sec entry: %d\n", in rtw89_cam_attach_sec_cam()
298 clear_bit(key_idx, addr_cam->sec_cam_map); in rtw89_cam_attach_sec_cam()
312 struct rtw89_cam_info *cam_info = &rtwdev->cam_info; in rtw89_cam_sec_key_install()
316 /* maximum key length 256-bit */ in rtw89_cam_sec_key_install()
317 if (key->keylen > 32) { in rtw89_cam_sec_key_install()
318 rtw89_err(rtwdev, "invalid sec key length %d\n", key->keylen); in rtw89_cam_sec_key_install()
319 return -EINVAL; in rtw89_cam_sec_key_install()
323 if (ret) { in rtw89_cam_sec_key_install()
324 rtw89_warn(rtwdev, "no available sec cam: %d ext: %d\n", in rtw89_cam_sec_key_install()
330 if (!sec_cam) { in rtw89_cam_sec_key_install()
331 ret = -ENOMEM; in rtw89_cam_sec_key_install()
335 key->hw_key_idx = sec_cam_idx; in rtw89_cam_sec_key_install()
336 cam_info->sec_entries[sec_cam_idx] = sec_cam; in rtw89_cam_sec_key_install()
338 sec_cam->sec_cam_idx = sec_cam_idx; in rtw89_cam_sec_key_install()
339 sec_cam->type = hw_key_type; in rtw89_cam_sec_key_install()
340 sec_cam->len = RTW89_SEC_CAM_LEN; in rtw89_cam_sec_key_install()
341 sec_cam->ext_key = ext_key; in rtw89_cam_sec_key_install()
342 memcpy(sec_cam->key, key->key, key->keylen); in rtw89_cam_sec_key_install()
344 if (ret) { in rtw89_cam_sec_key_install()
349 /* associate with addr cam */ in rtw89_cam_sec_key_install()
351 if (ret) { in rtw89_cam_sec_key_install()
352 rtw89_err(rtwdev, "failed to attach sec cam: %d\n", ret); in rtw89_cam_sec_key_install()
359 cam_info->sec_entries[sec_cam_idx] = NULL; in rtw89_cam_sec_key_install()
361 clear_bit(sec_cam_idx, cam_info->sec_cam_map); in rtw89_cam_sec_key_install()
362 if (ext_key) in rtw89_cam_sec_key_install()
363 clear_bit(sec_cam_idx + 1, cam_info->sec_cam_map); in rtw89_cam_sec_key_install()
373 const struct rtw89_chip_info *chip = rtwdev->chip; in rtw89_cam_sec_key_add()
378 switch (key->cipher) { in rtw89_cam_sec_key_add()
387 if (!chip->hw_mgmt_tx_encrypt) in rtw89_cam_sec_key_add()
388 key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX; in rtw89_cam_sec_key_add()
392 if (!chip->hw_mgmt_tx_encrypt) in rtw89_cam_sec_key_add()
393 key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX; in rtw89_cam_sec_key_add()
398 if (!chip->hw_mgmt_tx_encrypt) in rtw89_cam_sec_key_add()
399 key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX; in rtw89_cam_sec_key_add()
403 if (!chip->hw_mgmt_tx_encrypt) in rtw89_cam_sec_key_add()
404 key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX; in rtw89_cam_sec_key_add()
411 return -EOPNOTSUPP; in rtw89_cam_sec_key_add()
414 if (!chip->hw_sec_hdr) in rtw89_cam_sec_key_add()
415 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; in rtw89_cam_sec_key_add()
419 if (ret) { in rtw89_cam_sec_key_add()
434 struct rtw89_cam_info *cam_info = &rtwdev->cam_info; in rtw89_cam_sec_key_del()
439 sec_cam_idx = key->hw_key_idx; in rtw89_cam_sec_key_del()
440 sec_cam = cam_info->sec_entries[sec_cam_idx]; in rtw89_cam_sec_key_del()
441 if (!sec_cam) in rtw89_cam_sec_key_del()
442 return -EINVAL; in rtw89_cam_sec_key_del()
446 /* clear valid bit in addr cam will disable sec cam, in rtw89_cam_sec_key_del()
449 cam_info->sec_entries[sec_cam_idx] = NULL; in rtw89_cam_sec_key_del()
450 clear_bit(sec_cam_idx, cam_info->sec_cam_map); in rtw89_cam_sec_key_del()
451 if (sec_cam->ext_key) in rtw89_cam_sec_key_del()
452 clear_bit(sec_cam_idx + 1, cam_info->sec_cam_map); in rtw89_cam_sec_key_del()
473 struct rtw89_cam_info *cam_info = &rtwdev->cam_info; in rtw89_cam_deinit_addr_cam()
475 addr_cam->valid = false; in rtw89_cam_deinit_addr_cam()
476 clear_bit(addr_cam->addr_cam_idx, cam_info->addr_cam_map); in rtw89_cam_deinit_addr_cam()
482 struct rtw89_cam_info *cam_info = &rtwdev->cam_info; in rtw89_cam_deinit_bssid_cam()
484 bssid_cam->valid = false; in rtw89_cam_deinit_bssid_cam()
485 clear_bit(bssid_cam->bssid_cam_idx, cam_info->bssid_cam_map); in rtw89_cam_deinit_bssid_cam()
490 struct rtw89_addr_cam_entry *addr_cam = &rtwvif->addr_cam; in rtw89_cam_deinit()
491 struct rtw89_bssid_cam_entry *bssid_cam = &rtwvif->bssid_cam; in rtw89_cam_deinit()
500 ieee80211_iter_keys_rcu(rtwdev->hw, NULL, rtw89_cam_reset_key_iter, rtwdev); in rtw89_cam_reset_keys()
507 const struct rtw89_chip_info *chip = rtwdev->chip; in rtw89_cam_get_avail_addr_cam()
508 struct rtw89_cam_info *cam_info = &rtwdev->cam_info; in rtw89_cam_get_avail_addr_cam()
509 u8 addr_cam_num = chip->acam_num; in rtw89_cam_get_avail_addr_cam()
512 idx = find_first_zero_bit(cam_info->addr_cam_map, addr_cam_num); in rtw89_cam_get_avail_addr_cam()
513 if (idx >= addr_cam_num) in rtw89_cam_get_avail_addr_cam()
514 return -EBUSY; in rtw89_cam_get_avail_addr_cam()
516 set_bit(idx, cam_info->addr_cam_map); in rtw89_cam_get_avail_addr_cam()
524 const struct rtw89_chip_info *chip = rtwdev->chip; in rtw89_get_addr_cam_entry_size()
526 switch (chip->chip_id) { in rtw89_get_addr_cam_entry_size()
545 if (unlikely(addr_cam->valid)) { in rtw89_cam_init_addr_cam()
547 "addr cam is already valid; skip init\n"); in rtw89_cam_init_addr_cam()
552 if (ret) { in rtw89_cam_init_addr_cam()
553 rtw89_err(rtwdev, "failed to get available addr cam\n"); in rtw89_cam_init_addr_cam()
557 addr_cam->addr_cam_idx = addr_cam_idx; in rtw89_cam_init_addr_cam()
558 addr_cam->len = rtw89_get_addr_cam_entry_size(rtwdev); in rtw89_cam_init_addr_cam()
559 addr_cam->offset = 0; in rtw89_cam_init_addr_cam()
560 addr_cam->valid = true; in rtw89_cam_init_addr_cam()
561 addr_cam->addr_mask = 0; in rtw89_cam_init_addr_cam()
562 addr_cam->mask_sel = RTW89_NO_MSK; in rtw89_cam_init_addr_cam()
563 addr_cam->sec_ent_mode = RTW89_ADDR_CAM_SEC_NORMAL; in rtw89_cam_init_addr_cam()
564 bitmap_zero(addr_cam->sec_cam_map, RTW89_SEC_CAM_IN_ADDR_CAM); in rtw89_cam_init_addr_cam()
567 addr_cam->sec_ent_keyid[i] = 0; in rtw89_cam_init_addr_cam()
568 addr_cam->sec_ent[i] = 0; in rtw89_cam_init_addr_cam()
571 /* associate addr cam with bssid cam */ in rtw89_cam_init_addr_cam()
572 addr_cam->bssid_cam_idx = bssid_cam->bssid_cam_idx; in rtw89_cam_init_addr_cam()
580 const struct rtw89_chip_info *chip = rtwdev->chip; in rtw89_cam_get_avail_bssid_cam()
581 struct rtw89_cam_info *cam_info = &rtwdev->cam_info; in rtw89_cam_get_avail_bssid_cam()
582 u8 bssid_cam_num = chip->bcam_num; in rtw89_cam_get_avail_bssid_cam()
585 idx = find_first_zero_bit(cam_info->bssid_cam_map, bssid_cam_num); in rtw89_cam_get_avail_bssid_cam()
586 if (idx >= bssid_cam_num) in rtw89_cam_get_avail_bssid_cam()
587 return -EBUSY; in rtw89_cam_get_avail_bssid_cam()
589 set_bit(idx, cam_info->bssid_cam_map); in rtw89_cam_get_avail_bssid_cam()
603 if (unlikely(bssid_cam->valid)) { in rtw89_cam_init_bssid_cam()
605 "bssid cam is already valid; skip init\n"); in rtw89_cam_init_bssid_cam()
610 if (ret) { in rtw89_cam_init_bssid_cam()
611 rtw89_err(rtwdev, "failed to get available bssid cam\n"); in rtw89_cam_init_bssid_cam()
615 bssid_cam->bssid_cam_idx = bssid_cam_idx; in rtw89_cam_init_bssid_cam()
616 bssid_cam->phy_idx = rtwvif->phy_idx; in rtw89_cam_init_bssid_cam()
617 bssid_cam->len = BSSID_CAM_ENT_SIZE; in rtw89_cam_init_bssid_cam()
618 bssid_cam->offset = 0; in rtw89_cam_init_bssid_cam()
619 bssid_cam->valid = true; in rtw89_cam_init_bssid_cam()
620 ether_addr_copy(bssid_cam->bssid, bssid); in rtw89_cam_init_bssid_cam()
627 struct rtw89_bssid_cam_entry *bssid_cam = &rtwvif->bssid_cam; in rtw89_cam_bssid_changed()
629 ether_addr_copy(bssid_cam->bssid, rtwvif->bssid); in rtw89_cam_bssid_changed()
634 struct rtw89_addr_cam_entry *addr_cam = &rtwvif->addr_cam; in rtw89_cam_init()
635 struct rtw89_bssid_cam_entry *bssid_cam = &rtwvif->bssid_cam; in rtw89_cam_init()
638 ret = rtw89_cam_init_bssid_cam(rtwdev, rtwvif, bssid_cam, rtwvif->bssid); in rtw89_cam_init()
639 if (ret) { in rtw89_cam_init()
640 rtw89_err(rtwdev, "failed to init bssid cam\n"); in rtw89_cam_init()
645 if (ret) { in rtw89_cam_init()
646 rtw89_err(rtwdev, "failed to init addr cam\n"); in rtw89_cam_init()
659 u8 bss_color = vif->bss_conf.he_bss_color.color; in rtw89_cam_fill_bssid_cam_info()
662 if (vif->bss_conf.nontransmitted) in rtw89_cam_fill_bssid_cam_info()
667 FWCMD_SET_ADDR_BSSID_IDX(cmd, bssid_cam->bssid_cam_idx); in rtw89_cam_fill_bssid_cam_info()
668 FWCMD_SET_ADDR_BSSID_OFFSET(cmd, bssid_cam->offset); in rtw89_cam_fill_bssid_cam_info()
669 FWCMD_SET_ADDR_BSSID_LEN(cmd, bssid_cam->len); in rtw89_cam_fill_bssid_cam_info()
670 FWCMD_SET_ADDR_BSSID_VALID(cmd, bssid_cam->valid); in rtw89_cam_fill_bssid_cam_info()
672 FWCMD_SET_ADDR_BSSID_BB_SEL(cmd, bssid_cam->phy_idx); in rtw89_cam_fill_bssid_cam_info()
675 FWCMD_SET_ADDR_BSSID_BSSID0(cmd, bssid_cam->bssid[0]); in rtw89_cam_fill_bssid_cam_info()
676 FWCMD_SET_ADDR_BSSID_BSSID1(cmd, bssid_cam->bssid[1]); in rtw89_cam_fill_bssid_cam_info()
677 FWCMD_SET_ADDR_BSSID_BSSID2(cmd, bssid_cam->bssid[2]); in rtw89_cam_fill_bssid_cam_info()
678 FWCMD_SET_ADDR_BSSID_BSSID3(cmd, bssid_cam->bssid[3]); in rtw89_cam_fill_bssid_cam_info()
679 FWCMD_SET_ADDR_BSSID_BSSID4(cmd, bssid_cam->bssid[4]); in rtw89_cam_fill_bssid_cam_info()
680 FWCMD_SET_ADDR_BSSID_BSSID5(cmd, bssid_cam->bssid[5]); in rtw89_cam_fill_bssid_cam_info()
705 const u8 *sma = scan_mac_addr ? scan_mac_addr : rtwvif->mac_addr; in rtw89_cam_fill_addr_cam_info()
709 u8 *tma = sta ? sta->addr : rtwvif->bssid; in rtw89_cam_fill_addr_cam_info()
711 if (addr_cam->addr_mask != 0) { in rtw89_cam_fill_addr_cam_info()
712 addr_msk_start = __ffs(addr_cam->addr_mask); in rtw89_cam_fill_addr_cam_info()
713 if (addr_cam->mask_sel == RTW89_SMA) in rtw89_cam_fill_addr_cam_info()
715 else if (addr_cam->mask_sel == RTW89_TMA) in rtw89_cam_fill_addr_cam_info()
721 FWCMD_SET_ADDR_IDX(cmd, addr_cam->addr_cam_idx); in rtw89_cam_fill_addr_cam_info()
722 FWCMD_SET_ADDR_OFFSET(cmd, addr_cam->offset); in rtw89_cam_fill_addr_cam_info()
723 FWCMD_SET_ADDR_LEN(cmd, addr_cam->len); in rtw89_cam_fill_addr_cam_info()
725 FWCMD_SET_ADDR_VALID(cmd, addr_cam->valid); in rtw89_cam_fill_addr_cam_info()
726 FWCMD_SET_ADDR_NET_TYPE(cmd, rtwvif->net_type); in rtw89_cam_fill_addr_cam_info()
727 FWCMD_SET_ADDR_BCN_HIT_COND(cmd, rtwvif->bcn_hit_cond); in rtw89_cam_fill_addr_cam_info()
728 FWCMD_SET_ADDR_HIT_RULE(cmd, rtwvif->hit_rule); in rtw89_cam_fill_addr_cam_info()
729 FWCMD_SET_ADDR_BB_SEL(cmd, rtwvif->phy_idx); in rtw89_cam_fill_addr_cam_info()
730 FWCMD_SET_ADDR_ADDR_MASK(cmd, addr_cam->addr_mask); in rtw89_cam_fill_addr_cam_info()
731 FWCMD_SET_ADDR_MASK_SEL(cmd, addr_cam->mask_sel); in rtw89_cam_fill_addr_cam_info()
735 FWCMD_SET_ADDR_BSSID_CAM_IDX(cmd, addr_cam->bssid_cam_idx); in rtw89_cam_fill_addr_cam_info()
751 FWCMD_SET_ADDR_PORT_INT(cmd, rtwvif->port); in rtw89_cam_fill_addr_cam_info()
752 FWCMD_SET_ADDR_TSF_SYNC(cmd, rtwvif->port); in rtw89_cam_fill_addr_cam_info()
753 FWCMD_SET_ADDR_TF_TRS(cmd, rtwvif->trigger); in rtw89_cam_fill_addr_cam_info()
754 FWCMD_SET_ADDR_LSIG_TXOP(cmd, rtwvif->lsig_txop); in rtw89_cam_fill_addr_cam_info()
755 FWCMD_SET_ADDR_TGT_IND(cmd, rtwvif->tgt_ind); in rtw89_cam_fill_addr_cam_info()
756 FWCMD_SET_ADDR_FRM_TGT_IND(cmd, rtwvif->frm_tgt_ind); in rtw89_cam_fill_addr_cam_info()
757 FWCMD_SET_ADDR_MACID(cmd, rtwsta ? rtwsta->mac_id : rtwvif->mac_id); in rtw89_cam_fill_addr_cam_info()
758 if (rtwvif->net_type == RTW89_NET_TYPE_INFRA) in rtw89_cam_fill_addr_cam_info()
759 FWCMD_SET_ADDR_AID12(cmd, vif->cfg.aid & 0xfff); in rtw89_cam_fill_addr_cam_info()
760 else if (rtwvif->net_type == RTW89_NET_TYPE_AP_MODE) in rtw89_cam_fill_addr_cam_info()
761 FWCMD_SET_ADDR_AID12(cmd, sta ? sta->aid & 0xfff : 0); in rtw89_cam_fill_addr_cam_info()
762 FWCMD_SET_ADDR_WOL_PATTERN(cmd, rtwvif->wowlan_pattern); in rtw89_cam_fill_addr_cam_info()
763 FWCMD_SET_ADDR_WOL_UC(cmd, rtwvif->wowlan_uc); in rtw89_cam_fill_addr_cam_info()
764 FWCMD_SET_ADDR_WOL_MAGIC(cmd, rtwvif->wowlan_magic); in rtw89_cam_fill_addr_cam_info()
765 FWCMD_SET_ADDR_WAPI(cmd, addr_cam->wapi); in rtw89_cam_fill_addr_cam_info()
766 FWCMD_SET_ADDR_SEC_ENT_MODE(cmd, addr_cam->sec_ent_mode); in rtw89_cam_fill_addr_cam_info()
767 FWCMD_SET_ADDR_SEC_ENT0_KEYID(cmd, addr_cam->sec_ent_keyid[0]); in rtw89_cam_fill_addr_cam_info()
768 FWCMD_SET_ADDR_SEC_ENT1_KEYID(cmd, addr_cam->sec_ent_keyid[1]); in rtw89_cam_fill_addr_cam_info()
769 FWCMD_SET_ADDR_SEC_ENT2_KEYID(cmd, addr_cam->sec_ent_keyid[2]); in rtw89_cam_fill_addr_cam_info()
770 FWCMD_SET_ADDR_SEC_ENT3_KEYID(cmd, addr_cam->sec_ent_keyid[3]); in rtw89_cam_fill_addr_cam_info()
771 FWCMD_SET_ADDR_SEC_ENT4_KEYID(cmd, addr_cam->sec_ent_keyid[4]); in rtw89_cam_fill_addr_cam_info()
772 FWCMD_SET_ADDR_SEC_ENT5_KEYID(cmd, addr_cam->sec_ent_keyid[5]); in rtw89_cam_fill_addr_cam_info()
773 FWCMD_SET_ADDR_SEC_ENT6_KEYID(cmd, addr_cam->sec_ent_keyid[6]); in rtw89_cam_fill_addr_cam_info()
775 FWCMD_SET_ADDR_SEC_ENT_VALID(cmd, addr_cam->sec_cam_map[0] & 0xff); in rtw89_cam_fill_addr_cam_info()
776 FWCMD_SET_ADDR_SEC_ENT0(cmd, addr_cam->sec_ent[0]); in rtw89_cam_fill_addr_cam_info()
777 FWCMD_SET_ADDR_SEC_ENT1(cmd, addr_cam->sec_ent[1]); in rtw89_cam_fill_addr_cam_info()
778 FWCMD_SET_ADDR_SEC_ENT2(cmd, addr_cam->sec_ent[2]); in rtw89_cam_fill_addr_cam_info()
779 FWCMD_SET_ADDR_SEC_ENT3(cmd, addr_cam->sec_ent[3]); in rtw89_cam_fill_addr_cam_info()
780 FWCMD_SET_ADDR_SEC_ENT4(cmd, addr_cam->sec_ent[4]); in rtw89_cam_fill_addr_cam_info()
781 FWCMD_SET_ADDR_SEC_ENT5(cmd, addr_cam->sec_ent[5]); in rtw89_cam_fill_addr_cam_info()
782 FWCMD_SET_ADDR_SEC_ENT6(cmd, addr_cam->sec_ent[6]); in rtw89_cam_fill_addr_cam_info()
791 struct rtw89_wow_param *rtw_wow = &rtwdev->wow; in rtw89_cam_fill_dctl_sec_cam_info_v1()
792 u8 *ptk_tx_iv = rtw_wow->key_info.ptk_tx_iv; in rtw89_cam_fill_dctl_sec_cam_info_v1()
794 h2c->c0 = le32_encode_bits(rtwsta ? rtwsta->mac_id : rtwvif->mac_id, in rtw89_cam_fill_dctl_sec_cam_info_v1()
798 h2c->w4 = le32_encode_bits(addr_cam->sec_ent_keyid[0], in rtw89_cam_fill_dctl_sec_cam_info_v1()
800 le32_encode_bits(addr_cam->sec_ent_keyid[1], in rtw89_cam_fill_dctl_sec_cam_info_v1()
802 le32_encode_bits(addr_cam->sec_ent_keyid[2], in rtw89_cam_fill_dctl_sec_cam_info_v1()
804 le32_encode_bits(addr_cam->sec_ent_keyid[3], in rtw89_cam_fill_dctl_sec_cam_info_v1()
806 le32_encode_bits(addr_cam->sec_ent_keyid[4], in rtw89_cam_fill_dctl_sec_cam_info_v1()
808 le32_encode_bits(addr_cam->sec_ent_keyid[5], in rtw89_cam_fill_dctl_sec_cam_info_v1()
810 le32_encode_bits(addr_cam->sec_ent_keyid[6], in rtw89_cam_fill_dctl_sec_cam_info_v1()
812 h2c->m4 = cpu_to_le32(DCTLINFO_V1_W4_SEC_ENT0_KEYID | in rtw89_cam_fill_dctl_sec_cam_info_v1()
820 h2c->w5 = le32_encode_bits(addr_cam->sec_cam_map[0] & 0xff, in rtw89_cam_fill_dctl_sec_cam_info_v1()
822 le32_encode_bits(addr_cam->sec_ent[0], in rtw89_cam_fill_dctl_sec_cam_info_v1()
824 le32_encode_bits(addr_cam->sec_ent[1], in rtw89_cam_fill_dctl_sec_cam_info_v1()
826 le32_encode_bits(addr_cam->sec_ent[2], in rtw89_cam_fill_dctl_sec_cam_info_v1()
828 h2c->m5 = cpu_to_le32(DCTLINFO_V1_W5_SEC_ENT_VALID | in rtw89_cam_fill_dctl_sec_cam_info_v1()
833 h2c->w6 = le32_encode_bits(addr_cam->sec_ent[3], in rtw89_cam_fill_dctl_sec_cam_info_v1()
835 le32_encode_bits(addr_cam->sec_ent[4], in rtw89_cam_fill_dctl_sec_cam_info_v1()
837 le32_encode_bits(addr_cam->sec_ent[5], in rtw89_cam_fill_dctl_sec_cam_info_v1()
839 le32_encode_bits(addr_cam->sec_ent[6], in rtw89_cam_fill_dctl_sec_cam_info_v1()
841 h2c->m6 = cpu_to_le32(DCTLINFO_V1_W6_SEC_ENT3 | in rtw89_cam_fill_dctl_sec_cam_info_v1()
846 if (rtw_wow->ptk_alg) { in rtw89_cam_fill_dctl_sec_cam_info_v1()
847 h2c->w0 = le32_encode_bits(ptk_tx_iv[0] | ptk_tx_iv[1] << 8, in rtw89_cam_fill_dctl_sec_cam_info_v1()
849 h2c->m0 = cpu_to_le32(DCTLINFO_V1_W0_AES_IV_L); in rtw89_cam_fill_dctl_sec_cam_info_v1()
851 h2c->w1 = le32_encode_bits(ptk_tx_iv[4] | in rtw89_cam_fill_dctl_sec_cam_info_v1()
856 h2c->m1 = cpu_to_le32(DCTLINFO_V1_W1_AES_IV_H); in rtw89_cam_fill_dctl_sec_cam_info_v1()
858 h2c->w4 |= le32_encode_bits(rtw_wow->ptk_keyidx, in rtw89_cam_fill_dctl_sec_cam_info_v1()
860 h2c->m4 |= cpu_to_le32(DCTLINFO_V1_W4_SEC_KEY_ID); in rtw89_cam_fill_dctl_sec_cam_info_v1()
870 struct rtw89_wow_param *rtw_wow = &rtwdev->wow; in rtw89_cam_fill_dctl_sec_cam_info_v2()
871 u8 *ptk_tx_iv = rtw_wow->key_info.ptk_tx_iv; in rtw89_cam_fill_dctl_sec_cam_info_v2()
873 h2c->c0 = le32_encode_bits(rtwsta ? rtwsta->mac_id : rtwvif->mac_id, in rtw89_cam_fill_dctl_sec_cam_info_v2()
877 h2c->w4 = le32_encode_bits(addr_cam->sec_ent_keyid[0], in rtw89_cam_fill_dctl_sec_cam_info_v2()
879 le32_encode_bits(addr_cam->sec_ent_keyid[1], in rtw89_cam_fill_dctl_sec_cam_info_v2()
881 le32_encode_bits(addr_cam->sec_ent_keyid[2], in rtw89_cam_fill_dctl_sec_cam_info_v2()
883 le32_encode_bits(addr_cam->sec_ent_keyid[3], in rtw89_cam_fill_dctl_sec_cam_info_v2()
885 le32_encode_bits(addr_cam->sec_ent_keyid[4], in rtw89_cam_fill_dctl_sec_cam_info_v2()
887 le32_encode_bits(addr_cam->sec_ent_keyid[5], in rtw89_cam_fill_dctl_sec_cam_info_v2()
889 le32_encode_bits(addr_cam->sec_ent_keyid[6], in rtw89_cam_fill_dctl_sec_cam_info_v2()
891 h2c->m4 = cpu_to_le32(DCTLINFO_V2_W4_SEC_ENT0_KEYID | in rtw89_cam_fill_dctl_sec_cam_info_v2()
899 h2c->w5 = le32_encode_bits(addr_cam->sec_cam_map[0], in rtw89_cam_fill_dctl_sec_cam_info_v2()
901 le32_encode_bits(addr_cam->sec_ent[0], in rtw89_cam_fill_dctl_sec_cam_info_v2()
903 h2c->m5 = cpu_to_le32(DCTLINFO_V2_W5_SEC_ENT_VALID_V1 | in rtw89_cam_fill_dctl_sec_cam_info_v2()
906 h2c->w6 = le32_encode_bits(addr_cam->sec_ent[1], in rtw89_cam_fill_dctl_sec_cam_info_v2()
908 le32_encode_bits(addr_cam->sec_ent[2], in rtw89_cam_fill_dctl_sec_cam_info_v2()
910 le32_encode_bits(addr_cam->sec_ent[3], in rtw89_cam_fill_dctl_sec_cam_info_v2()
912 le32_encode_bits(addr_cam->sec_ent[4], in rtw89_cam_fill_dctl_sec_cam_info_v2()
914 h2c->m6 = cpu_to_le32(DCTLINFO_V2_W6_SEC_ENT1_V1 | in rtw89_cam_fill_dctl_sec_cam_info_v2()
919 h2c->w7 = le32_encode_bits(addr_cam->sec_ent[5], in rtw89_cam_fill_dctl_sec_cam_info_v2()
921 le32_encode_bits(addr_cam->sec_ent[6], in rtw89_cam_fill_dctl_sec_cam_info_v2()
923 h2c->m7 = cpu_to_le32(DCTLINFO_V2_W7_SEC_ENT5_V1 | in rtw89_cam_fill_dctl_sec_cam_info_v2()
926 if (rtw_wow->ptk_alg) { in rtw89_cam_fill_dctl_sec_cam_info_v2()
927 h2c->w0 = le32_encode_bits(ptk_tx_iv[0] | ptk_tx_iv[1] << 8, in rtw89_cam_fill_dctl_sec_cam_info_v2()
929 h2c->m0 = cpu_to_le32(DCTLINFO_V2_W0_AES_IV_L); in rtw89_cam_fill_dctl_sec_cam_info_v2()
931 h2c->w1 = le32_encode_bits(ptk_tx_iv[4] | in rtw89_cam_fill_dctl_sec_cam_info_v2()
936 h2c->m1 = cpu_to_le32(DCTLINFO_V2_W1_AES_IV_H); in rtw89_cam_fill_dctl_sec_cam_info_v2()
938 h2c->w4 |= le32_encode_bits(rtw_wow->ptk_keyidx, in rtw89_cam_fill_dctl_sec_cam_info_v2()
940 h2c->m4 |= cpu_to_le32(DCTLINFO_V2_W4_SEC_KEY_ID); in rtw89_cam_fill_dctl_sec_cam_info_v2()