1 /* 2 * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com> 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17 #ifndef _SMD_H_ 18 #define _SMD_H_ 19 20 #include "wcn36xx.h" 21 22 /* Max shared size is 4k but we take less.*/ 23 #define WCN36XX_NV_FRAGMENT_SIZE 3072 24 25 #define WCN36XX_HAL_BUF_SIZE 4096 26 27 #define HAL_MSG_TIMEOUT 10000 28 #define WCN36XX_SMSM_WLAN_TX_ENABLE 0x00000400 29 #define WCN36XX_SMSM_WLAN_TX_RINGS_EMPTY 0x00000200 30 /* The PNO version info be contained in the rsp msg */ 31 #define WCN36XX_FW_MSG_PNO_VERSION_MASK 0x8000 32 33 enum wcn36xx_fw_msg_result { 34 WCN36XX_FW_MSG_RESULT_SUCCESS = 0, 35 WCN36XX_FW_MSG_RESULT_SUCCESS_SYNC = 1, 36 37 WCN36XX_FW_MSG_RESULT_MEM_FAIL = 5, 38 }; 39 40 /******************************/ 41 /* SMD requests and responses */ 42 /******************************/ 43 struct wcn36xx_fw_msg_status_rsp { 44 u32 status; 45 } __packed; 46 47 struct wcn36xx_hal_ind_msg { 48 struct list_head list; 49 size_t msg_len; 50 u8 msg[]; 51 }; 52 53 struct wcn36xx; 54 struct rpmsg_device; 55 56 int wcn36xx_smd_open(struct wcn36xx *wcn); 57 void wcn36xx_smd_close(struct wcn36xx *wcn); 58 59 int wcn36xx_smd_load_nv(struct wcn36xx *wcn); 60 int wcn36xx_smd_start(struct wcn36xx *wcn); 61 int wcn36xx_smd_stop(struct wcn36xx *wcn); 62 int wcn36xx_smd_start_scan(struct wcn36xx *wcn, u8 scan_channel); 63 int wcn36xx_smd_end_scan(struct wcn36xx *wcn, u8 scan_channel); 64 int wcn36xx_smd_finish_scan(struct wcn36xx *wcn, enum wcn36xx_hal_sys_mode mode, 65 struct ieee80211_vif *vif); 66 int wcn36xx_smd_init_scan(struct wcn36xx *wcn, enum wcn36xx_hal_sys_mode mode, 67 struct ieee80211_vif *vif); 68 69 int wcn36xx_smd_update_scan_params(struct wcn36xx *wcn, u8 *channels, size_t channel_count); 70 int wcn36xx_smd_start_hw_scan(struct wcn36xx *wcn, struct ieee80211_vif *vif, 71 struct cfg80211_scan_request *req); 72 int wcn36xx_smd_stop_hw_scan(struct wcn36xx *wcn); 73 int wcn36xx_smd_update_channel_list(struct wcn36xx *wcn, struct cfg80211_scan_request *req); 74 int wcn36xx_smd_add_sta_self(struct wcn36xx *wcn, struct ieee80211_vif *vif); 75 int wcn36xx_smd_delete_sta_self(struct wcn36xx *wcn, u8 *addr); 76 int wcn36xx_smd_delete_sta(struct wcn36xx *wcn, u8 sta_index); 77 int wcn36xx_smd_join(struct wcn36xx *wcn, const u8 *bssid, u8 *vif, u8 ch); 78 int wcn36xx_smd_set_link_st(struct wcn36xx *wcn, const u8 *bssid, 79 const u8 *sta_mac, 80 enum wcn36xx_hal_link_state state); 81 int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif, 82 struct ieee80211_sta *sta, const u8 *bssid, 83 bool update); 84 int wcn36xx_smd_delete_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif); 85 int wcn36xx_smd_config_sta(struct wcn36xx *wcn, struct ieee80211_vif *vif, 86 struct ieee80211_sta *sta); 87 int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct ieee80211_vif *vif, 88 struct sk_buff *skb_beacon, u16 tim_off, 89 u16 p2p_off); 90 int wcn36xx_smd_switch_channel(struct wcn36xx *wcn, 91 struct ieee80211_vif *vif, int ch); 92 int wcn36xx_smd_process_ptt_msg(struct wcn36xx *wcn, 93 struct ieee80211_vif *vif, 94 void *ptt_msg, size_t len, 95 void **ptt_rsp_msg); 96 int wcn36xx_smd_update_proberesp_tmpl(struct wcn36xx *wcn, 97 struct ieee80211_vif *vif, 98 struct sk_buff *skb); 99 int wcn36xx_smd_set_stakey(struct wcn36xx *wcn, 100 enum ani_ed_type enc_type, 101 u8 keyidx, 102 u8 keylen, 103 u8 *key, 104 u8 sta_index); 105 int wcn36xx_smd_set_bsskey(struct wcn36xx *wcn, 106 enum ani_ed_type enc_type, 107 u8 bssidx, 108 u8 keyidx, 109 u8 keylen, 110 u8 *key); 111 int wcn36xx_smd_remove_stakey(struct wcn36xx *wcn, 112 enum ani_ed_type enc_type, 113 u8 keyidx, 114 u8 sta_index); 115 int wcn36xx_smd_remove_bsskey(struct wcn36xx *wcn, 116 enum ani_ed_type enc_type, 117 u8 bssidx, 118 u8 keyidx); 119 int wcn36xx_smd_enter_bmps(struct wcn36xx *wcn, struct ieee80211_vif *vif); 120 int wcn36xx_smd_exit_bmps(struct wcn36xx *wcn, struct ieee80211_vif *vif); 121 int wcn36xx_smd_set_power_params(struct wcn36xx *wcn, bool ignore_dtim); 122 int wcn36xx_smd_keep_alive_req(struct wcn36xx *wcn, 123 struct ieee80211_vif *vif, 124 int packet_type); 125 int wcn36xx_smd_dump_cmd_req(struct wcn36xx *wcn, u32 arg1, u32 arg2, 126 u32 arg3, u32 arg4, u32 arg5); 127 int wcn36xx_smd_feature_caps_exchange(struct wcn36xx *wcn); 128 void set_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap); 129 int get_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap); 130 void clear_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap); 131 132 int wcn36xx_smd_add_ba_session(struct wcn36xx *wcn, 133 struct ieee80211_sta *sta, 134 u16 tid, 135 u16 *ssn, 136 u8 direction, 137 u8 sta_index); 138 int wcn36xx_smd_add_ba(struct wcn36xx *wcn, u8 session_id); 139 int wcn36xx_smd_del_ba(struct wcn36xx *wcn, u16 tid, u8 direction, u8 sta_index); 140 int wcn36xx_smd_trigger_ba(struct wcn36xx *wcn, u8 sta_index, u16 tid, u16 *ssn); 141 int wcn36xx_smd_get_stats(struct wcn36xx *wcn, u8 sta_index, u32 stats_mask, 142 struct station_info *sinfo); 143 144 int wcn36xx_smd_update_cfg(struct wcn36xx *wcn, u32 cfg_id, u32 value); 145 146 int wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev, 147 void *buf, int len, void *priv, u32 addr); 148 149 int wcn36xx_smd_set_mc_list(struct wcn36xx *wcn, 150 struct ieee80211_vif *vif, 151 struct wcn36xx_hal_rcv_flt_mc_addr_list_type *fp); 152 153 int wcn36xx_smd_arp_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, 154 bool enable); 155 156 int wcn36xx_smd_ipv6_ns_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, 157 bool enable); 158 159 int wcn36xx_smd_gtk_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, 160 bool enable); 161 162 int wcn36xx_smd_gtk_offload_get_info(struct wcn36xx *wcn, 163 struct ieee80211_vif *vif); 164 165 int wcn36xx_smd_wlan_host_suspend_ind(struct wcn36xx *wcn); 166 167 int wcn36xx_smd_host_resume(struct wcn36xx *wcn); 168 169 int wcn36xx_smd_enter_imps(struct wcn36xx *wcn); 170 int wcn36xx_smd_exit_imps(struct wcn36xx *wcn); 171 172 int wcn36xx_smd_add_beacon_filter(struct wcn36xx *wcn, 173 struct ieee80211_vif *vif); 174 175 #endif /* _SMD_H_ */ 176