30 #include <linux/export.h>
38 rtlpriv->
sec.use_defaultkey =
false;
43 rtlpriv->
sec.pairwise_key =
NULL;
52 u32 target_content = 0;
56 "key_cont_128:\n %x:%x:%x:%x:%x:%x\n",
57 key_cont_128[0], key_cont_128[1],
58 key_cont_128[2], key_cont_128[3],
59 key_cont_128[4], key_cont_128[5]);
62 target_command = entry_i + CAM_CONTENT_COUNT * entry_no;
63 target_command = target_command |
BIT(31) |
BIT(16);
66 target_content = (
u32) (*(mac_addr + 0)) << 16 |
67 (
u32) (*(mac_addr + 1)) << 24 | (
u32) us_config;
69 rtl_write_dword(rtlpriv, rtlpriv->
cfg->maps[
WCAMI],
71 rtl_write_dword(rtlpriv, rtlpriv->
cfg->maps[
RWCAM],
75 rtlpriv->
cfg->maps[
WCAMI], target_content);
77 "The Key ID is %d\n", entry_no);
79 rtlpriv->
cfg->maps[
RWCAM], target_command);
81 }
else if (entry_i == 1) {
83 target_content = (
u32) (*(mac_addr + 5)) << 24 |
84 (
u32) (*(mac_addr + 4)) << 16 |
85 (
u32) (*(mac_addr + 3)) << 8 |
86 (
u32) (*(mac_addr + 2));
88 rtl_write_dword(rtlpriv, rtlpriv->
cfg->maps[
WCAMI],
90 rtl_write_dword(rtlpriv, rtlpriv->
cfg->maps[
RWCAM],
101 (
u32) (*(key_cont_128 + (entry_i * 4 - 8) + 3)) <<
102 24 | (
u32) (*(key_cont_128 + (entry_i * 4 - 8) + 2))
104 (
u32) (*(key_cont_128 + (entry_i * 4 - 8) + 1)) << 8
105 | (
u32) (*(key_cont_128 + (entry_i * 4 - 8) + 0));
107 rtl_write_dword(rtlpriv, rtlpriv->
cfg->maps[
WCAMI],
109 rtl_write_dword(rtlpriv, rtlpriv->
cfg->maps[
RWCAM],
125 u32 ul_key_id,
u32 ul_entry_idx,
u32 ul_enc_alg,
126 u32 ul_default_key,
u8 *key_content)
132 "EntryNo:%x, ulKeyId=%x, ulEncAlg=%x, ulUseDK=%x MacAddr %pM\n",
133 ul_entry_idx, ul_key_id, ul_enc_alg,
134 ul_default_key, mac_addr);
138 "<=== ulKeyId exceed!\n");
142 if (ul_default_key == 1) {
145 us_config =
CFG_VALID | ((ul_enc_alg) << 2) | ul_key_id;
148 rtl_cam_program_entry(hw, ul_entry_idx, mac_addr,
149 key_content, us_config);
159 u8 *mac_addr,
u32 ul_key_id)
167 ul_command = ul_command |
BIT(31) |
BIT(16);
169 rtl_write_dword(rtlpriv, rtlpriv->
cfg->maps[
WCAMI], 0);
170 rtl_write_dword(rtlpriv, rtlpriv->
cfg->maps[
RWCAM], ul_command);
173 "rtl_cam_delete_one_entry(): WRITE A4: %x\n", 0);
175 "rtl_cam_delete_one_entry(): WRITE A0: %x\n", ul_command);
187 ul_command =
BIT(31) |
BIT(30);
188 rtl_write_dword(rtlpriv, rtlpriv->
cfg->maps[
RWCAM], ul_command);
200 switch (rtlpriv->
sec.pairwise_enc_algorithm) {
217 ul_content = (uc_index & 3) | ((
u16) (ul_enc_algo) << 2);
219 ul_content |=
BIT(15);
220 ul_command = CAM_CONTENT_COUNT * uc_index;
221 ul_command = ul_command |
BIT(31) |
BIT(16);
223 rtl_write_dword(rtlpriv, rtlpriv->
cfg->maps[
WCAMI], ul_content);
224 rtl_write_dword(rtlpriv, rtlpriv->
cfg->maps[
RWCAM], ul_command);
227 "rtl_cam_mark_invalid(): WRITE A4: %x\n", ul_content);
229 "rtl_cam_mark_invalid(): WRITE A0: %x\n", ul_command);
242 switch (rtlpriv->
sec.pairwise_enc_algorithm) {
263 (uc_index & 0x03) | ((
u16) (ul_encalgo) << 2);
264 ul_content |=
BIT(15);
270 ul_command = CAM_CONTENT_COUNT * uc_index + entry_i;
271 ul_command = ul_command |
BIT(31) |
BIT(16);
273 rtl_write_dword(rtlpriv, rtlpriv->
cfg->maps[
WCAMI], ul_content);
274 rtl_write_dword(rtlpriv, rtlpriv->
cfg->maps[
RWCAM], ul_command);
277 "rtl_cam_empty_entry(): WRITE A4: %x\n",
280 "rtl_cam_empty_entry(): WRITE A0: %x\n",
294 if (
NULL == sta_addr) {
300 addr = rtlpriv->
sec.hwsec_cam_sta_addr[
i];
306 if ((bitmap &
BIT(0)) == 0) {
308 "-----hwsec_cam_bitmap: 0x%x entry_idx=%d\n",
309 rtlpriv->
sec.hwsec_cam_bitmap, entry_idx);
310 rtlpriv->
sec.hwsec_cam_bitmap |=
BIT(0) << entry_idx;
311 memcpy(rtlpriv->
sec.hwsec_cam_sta_addr[entry_idx],
315 bitmap = bitmap >> 1;
327 if (
NULL == sta_addr) {
331 if (is_zero_ether_addr(sta_addr)) {
333 "sta_addr is %pM\n", sta_addr);
338 addr = rtlpriv->
sec.hwsec_cam_sta_addr[
i];
339 bitmap = (rtlpriv->
sec.hwsec_cam_bitmap) >> i;
340 if (((bitmap &
BIT(0)) ==
BIT(0)) &&
344 rtlpriv->
sec.hwsec_cam_bitmap &= ~(
BIT(0) <<
i);
346 "del CAM entry %d\n", i);