1 /* 2 * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 */ 18 19 #ifndef __WAL_NET_H__ 20 #define __WAL_NET_H__ 21 22 /* **************************************************************************** 23 1 其他头文件包含 24 **************************************************************************** */ 25 #include "hmac_ext_if.h" 26 #include "oam_ext_if.h" 27 #include "wal_main.h" 28 29 #ifdef __cplusplus 30 #if __cplusplus 31 extern "C" { 32 #endif 33 #endif 34 35 /* **************************************************************************** 36 2 宏定义 37 **************************************************************************** */ 38 /* * Ask if a driver is ready to send */ 39 #define WAL_SIOCDEVPRIVATE 0x89F0 /* SIOCDEVPRIVATE */ 40 #define WAL_ADDR_MAX 16 41 42 /* **************************************************************************** 43 3 枚举定义 44 **************************************************************************** */ 45 typedef enum { 46 WAL_PHY_MODE_11N = 0, 47 WAL_PHY_MODE_11G = 1, 48 WAL_PHY_MODE_11B = 2, 49 WAL_PHY_MODE_BUTT 50 } wal_phy_mode; 51 52 typedef enum { 53 WAL_ADDR_IDX_STA0 = 0, 54 WAL_ADDR_IDX_AP0 = 1, 55 WAL_ADDR_IDX_STA1 = 2, 56 WAL_ADDR_IDX_STA2 = 3, 57 WAL_ADDR_IDX_BUTT 58 } wal_addr_idx; 59 60 /* **************************************************************************** 61 7 STRUCT定义 62 **************************************************************************** */ 63 typedef struct { 64 hi_u8 ac_addr[WLAN_MAC_ADDR_LEN]; 65 hi_u16 us_status; 66 } wal_dev_addr_stru; 67 68 #if (_PRE_OS_VERSION_LITEOS == _PRE_OS_VERSION) 69 typedef struct { 70 hi_u8 enable; /* 开关标志,配置WPA重关联,驱动延时上报LWIP机制开启 */ 71 hi_u8 reconn; /* WPA自动重连标志 */ 72 hi_u8 resv[2]; /* 2: 四字节对齐用 */ 73 frw_timeout_stru delay_timer; 74 } wal_delay_report_stru; 75 #endif 76 /* **************************************************************************** 77 10 函数声明 78 **************************************************************************** */ 79 #if (_PRE_OS_VERSION_LITEOS == _PRE_OS_VERSION) 80 hi_u32 hwal_skb_struct_free(oal_netbuf_stru *sk_buf); 81 oal_netbuf_stru *hwal_skb_struct_alloc(hi_void); 82 hi_u32 hwal_pbuf_convert_2_skb(const oal_net_device_stru *netdev, oal_lwip_buf *lwip_buf, oal_netbuf_stru *sk_buf); 83 oal_lwip_buf *hwal_skb_convert_2_pbuf(const oal_netbuf_stru *sk_buf); 84 #endif 85 #if (_PRE_OS_VERSION_LITEOS == _PRE_OS_VERSION) 86 hi_u32 wal_netdev_open(oal_net_device_stru *netdev); 87 hi_u32 wal_netdev_stop(oal_net_device_stru *netdev); 88 #else 89 hi_s32 wal_netdev_open(oal_net_device_stru *netdev); 90 hi_s32 wal_netdev_stop(oal_net_device_stru *netdev); 91 #endif 92 #ifdef _PRE_WLAN_FEATURE_MESH_LWIP_RIPPLE 93 hi_s32 hwal_lwip_remove_user(oal_lwip_netif *netif, oal_linklayer_addr *mac_addr); 94 hi_s32 hwal_lwip_set_beacon_priority(oal_lwip_netif *netif, hi_u8 prio); 95 hi_s32 hwal_lwip_set_mnid(oal_lwip_netif *netif, oal_uniqid_t us_mnid); 96 #endif 97 hi_u32 wal_mesh_inform_tx_data_info(frw_event_mem_stru *event_mem); 98 hi_u32 wal_mesh_report_mesh_user_info(frw_event_mem_stru *event_mem); 99 hi_u32 wal_report_sta_assoc_info(frw_event_mem_stru *event_mem); 100 hi_void wal_ip_conver_multi_mac(hi_u8 *puc_group_mac, const hi_u8 *puc_group_ip, hi_u8 ip_len); 101 hi_void wal_init_dev_addr(hi_void); 102 hi_u32 wal_set_dev_addr(const hi_char *pc_addr, hi_u8 mac_len); 103 hi_u32 wal_set_dev_addr_from_efuse(const hi_char *pc_addr, hi_u8 mac_len); 104 hi_u8 wal_dev_is_running(hi_void); 105 hi_u32 wal_get_dev_addr(hi_u8 *pc_addr, hi_u8 addr_len, nl80211_iftype_uint8 type); 106 #ifndef _PRE_HDF_LINUX 107 #if (_PRE_OS_VERSION_LITEOS == _PRE_OS_VERSION) 108 hi_s32 wal_init_drv_wlan_netdev(nl80211_iftype_uint8 type, wal_phy_mode mode, oal_net_device_stru *netdev); 109 #elif (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION) 110 hi_u32 wal_init_drv_wlan_netdev(nl80211_iftype_uint8 type, wal_phy_mode mode, hi_u16 bw); 111 #endif 112 #endif 113 hi_s32 wal_deinit_drv_wlan_netdev(oal_net_device_stru *netdev); 114 hi_void set_past_net_device_by_index(hi_u32 netdev_index, oal_net_device_stru *netdev); 115 oal_net_device_ops_stru *wal_get_net_dev_ops(hi_void); 116 hi_u32 wal_get_efuse_mac_addr(hi_void); 117 hi_void wal_set_delay_report_config(hi_u8 enable, hi_u16 timeout); 118 hi_void wal_set_auto_conn_status(hi_u8 auto_reconn); 119 120 #ifdef __cplusplus 121 #if __cplusplus 122 } 123 #endif 124 #endif 125 126 #endif 127