1 /*
2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 * 文 件 名 : hmac_wds.c
15 * 生成日期 : 2016年12月13日
16 * 功能描述 : hmac_wds.c的头文件
17 */
18
19
20 #ifndef __HMAC_WDS_H__
21 #define __HMAC_WDS_H__
22
23 /*****************************************************************************
24 1 头文件包含
25 *****************************************************************************/
26 #include "oal_types.h"
27 #include "mac_vap_ext.h"
28 #include "hmac_vap.h"
29
30 #ifdef __cplusplus
31 #if __cplusplus
32 extern "C" {
33 #endif
34 #endif
35
36 #undef THIS_FILE_ID
37 #define THIS_FILE_ID OAM_FILE_ID_HMAC_WDS_H
38 #ifdef _PRE_WLAN_FEATURE_VIRTUAL_MULTI_STA
39 /*****************************************************************************/
40 /*****************************************************************************
41 2 宏定义
42 *****************************************************************************/
mac_calculate_hash_value(const osal_u8 * sta_mac_addr)43 static INLINE__ osal_u32 mac_calculate_hash_value(const osal_u8 *sta_mac_addr)
44 {
45 return (sta_mac_addr[0] + sta_mac_addr[1] + sta_mac_addr[2] + sta_mac_addr[3] + sta_mac_addr[4] + sta_mac_addr[5]) &
46 (osal_u32)(MAC_VAP_USER_HASH_MAX_VALUE - 1);
47 }
48
49 #define wds_calc_mac_hash_val(mac_addr) (mac_calculate_hash_value(mac_addr) & (WDS_HASH_NUM - 1))
50 #define WDS_TABLE_ADD_ENTRY 0
51 #define WDS_TABLE_DEL_ENTRY 1
52 #define WDS_MAX_STAS_NUM 256
53 #define WDS_MAX_NODE_NUM 4
54 #define WDS_MAX_NEIGH_NUM 512
55
56 #define WDS_MIN_AGE_NUM 5
57 #define WDS_MAX_AGE_NUM 10000
58
59 #define WDS_TABLE_DEF_TIMER 15000 /* timer interval as 15 secs */
60
61 #ifdef _PRE_WLAN_FEATURE_VIRTUAL_MULTI_STA
62 #define VMSTA_4ADDR_SUPPORT 0
63 #define VMSTA_4ADDR_UNSUPPORT -1
64 #endif
65 /*****************************************************************************
66 3 枚举定义
67 *****************************************************************************/
68
69
70 /*****************************************************************************
71 4 全局变量声明
72 *****************************************************************************/
73
74
75 /*****************************************************************************
76 5 消息头定义
77 *****************************************************************************/
78
79
80 /*****************************************************************************
81 6 消息定义
82 *****************************************************************************/
83
84
85 /*****************************************************************************
86 7 STRUCT定义
87 *****************************************************************************/
88 typedef struct {
89 struct osal_list_head entry;
90 osal_u8 mac[WLAN_MAC_ADDR_LEN];
91 osal_u8 stas_num;
92 osal_u8 auc_resv[1];
93 } hmac_wds_node_stru;
94
95 typedef struct {
96 struct osal_list_head entry;
97 osal_u32 last_pkt_age;
98 hmac_wds_node_stru *related_node;
99 osal_u8 mac[WLAN_MAC_ADDR_LEN];
100 osal_u8 auc_resv[2];
101 } hmac_wds_stas_stru;
102
103 typedef struct {
104 struct osal_list_head entry;
105 osal_u32 last_pkt_age;
106 osal_u8 mac[WLAN_MAC_ADDR_LEN];
107 osal_u8 auc_resv[2];
108 } hmac_wds_neigh_stru;
109
110 typedef struct {
111 osal_u8 sta_mac[WLAN_MAC_ADDR_LEN];
112 osal_u8 node_mac[WLAN_MAC_ADDR_LEN];
113 } mac_cfg_wds_sta_stru;
114
115 /*****************************************************************************
116 8 UNION定义
117 *****************************************************************************/
118
119 /*****************************************************************************
120 9 OTHERS定义
121 *****************************************************************************/
122 typedef osal_u32(*p_hmac_wds_node_func)(hmac_vap_stru *hmac_vap, osal_u8 *addr, osal_void *arg);
123
124 /*****************************************************************************
125 10 函数声明
126 *****************************************************************************/
127 extern osal_u32 hmac_wds_update_table(hmac_vap_stru *hmac_vap, osal_u8 *node_mac, osal_u8 *sta_mac,
128 osal_u8 update_mode);
129 extern osal_u32 hmac_wds_add_node(hmac_vap_stru *hmac_vap, osal_u8 *node_mac);
130 extern osal_u32 hmac_wds_del_node(hmac_vap_stru *hmac_vap, osal_u8 *node_mac);
131 extern osal_u32 hmac_wds_reset_sta_mapping_table(hmac_vap_stru *hmac_vap);
132 extern osal_u32 hmac_wds_add_sta(hmac_vap_stru *hmac_vap, osal_u8 *node_mac, osal_u8 *sta_mac);
133 extern osal_u32 hmac_wds_del_sta(hmac_vap_stru *hmac_vap, osal_u8 *addr);
134 extern osal_u32 hmac_find_valid_user_by_wds_sta(hmac_vap_stru *hmac_vap, osal_u8 *sta_mac_addr,
135 osal_u16 *pus_user_idx);
136 extern osal_u32 hmac_wds_node_ergodic(hmac_vap_stru *hmac_vap, osal_u8 *src_addr,
137 p_hmac_wds_node_func hmac_wds_node, osal_void *arg);
138
139 extern osal_u32 hmac_wds_update_neigh(hmac_vap_stru *hmac_vap, osal_u8 *addr);
140 extern osal_u32 hmac_wds_neigh_not_expired(hmac_vap_stru *hmac_vap, osal_u8 *addr);
141 extern osal_u32 hmac_wds_reset_neigh_table(hmac_vap_stru *hmac_vap);
142 extern osal_u32 hmac_wds_table_create_timer(hmac_vap_stru *hmac_vap);
143 extern oal_bool_enum_uint8 hmac_vmsta_get_user_a4_support(hmac_vap_stru *hmac_vap, osal_u8 *addr);
144 extern oal_bool_enum_uint8 hmac_vmsta_check_vap_a4_support(osal_u8 *ie, osal_u32 ie_len);
145 extern oal_bool_enum_uint8 hmac_vmsta_check_user_a4_support(osal_u8 *frame, osal_u32 frame_len);
146 extern osal_u32 hmac_vmsta_set_vap_a4_enable(hmac_vap_stru *hmac_vap);
147 extern osal_void hmac_wds_init_table(hmac_vap_stru *hmac_vap);
148 extern osal_u32 hmac_wds_find_sta(hmac_vap_stru *hmac_vap, osal_u8 *addr,
149 hmac_wds_stas_stru **ppst_wds_node);
150 extern osal_u32 hmac_wds_tx_broadcast_pkt(hmac_vap_stru *hmac_vap, osal_u8 *addr, osal_void *arg);
151
152 #endif
153
154 #ifdef __cplusplus
155 #if __cplusplus
156 }
157 #endif
158 #endif
159
160 #endif /* end of hmac_wds.h */
161