Ravi Joshi | a063dd9 | 2016-05-25 16:43:13 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016 The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * Permission to use, copy, modify, and/or distribute this software for |
| 7 | * any purpose with or without fee is hereby granted, provided that the |
| 8 | * above copyright notice and this permission notice appear in all |
| 9 | * copies. |
| 10 | * |
| 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 12 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 13 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 14 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 15 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 16 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 17 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 18 | * PERFORMANCE OF THIS SOFTWARE. |
| 19 | */ |
| 20 | |
| 21 | /** |
| 22 | * DOC: wlan_hdd_nan_datapath.h |
| 23 | * |
| 24 | * WLAN Host Device Driver nan datapath API specification |
| 25 | */ |
Ravi Joshi | a063dd9 | 2016-05-25 16:43:13 -0700 | [diff] [blame] | 26 | #ifndef __WLAN_HDD_NAN_DATAPATH_H |
| 27 | #define __WLAN_HDD_NAN_DATAPATH_H |
| 28 | |
Deepak Dhamdhere | 3385d75 | 2016-05-25 20:36:47 -0700 | [diff] [blame] | 29 | struct hdd_context_s; |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 30 | struct hdd_tgt_cfg; |
Deepak Dhamdhere | 13230d3 | 2016-05-26 00:46:53 -0700 | [diff] [blame] | 31 | struct hdd_config; |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 32 | struct hdd_adapter_s; |
| 33 | struct wireless_dev; |
| 34 | |
| 35 | /* NAN Social channels */ |
| 36 | #define NAN_SOCIAL_CHANNEL_2_4GHZ 6 |
| 37 | #define NAN_SOCIAL_CHANNEL_5GHZ_LOWER_BAND 44 |
| 38 | #define NAN_SOCIAL_CHANNEL_5GHZ_UPPER_BAND 149 |
| 39 | |
| 40 | #define NDP_APP_INFO_LEN 255 |
| 41 | #define NDP_QOS_INFO_LEN 255 |
Naveen Rawat | f28315c | 2016-06-29 18:06:02 -0700 | [diff] [blame] | 42 | #define NDP_NUM_INSTANCE_ID 255 |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 43 | |
Deepak Dhamdhere | 5872c8c | 2016-06-02 15:51:47 -0700 | [diff] [blame] | 44 | #define NDP_BROADCAST_STAID (0) |
| 45 | |
Deepak Dhamdhere | f16015f | 2016-06-01 14:28:09 -0700 | [diff] [blame] | 46 | #ifdef WLAN_FEATURE_NAN_DATAPATH |
| 47 | #define WLAN_HDD_IS_NDI(adapter) ((adapter)->device_mode == QDF_NDI_MODE) |
| 48 | |
| 49 | #define WLAN_HDD_IS_NDI_CONNECTED(adapter) ( \ |
| 50 | eConnectionState_NdiConnected ==\ |
| 51 | (adapter)->sessionCtx.station.conn_info.connState) |
| 52 | #else |
| 53 | #define WLAN_HDD_IS_NDI(adapter) (false) |
| 54 | #define WLAN_HDD_IS_NDI_CONNECTED(adapter) (false) |
| 55 | #endif /* WLAN_FEATURE_NAN_DATAPATH */ |
| 56 | |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 57 | /** |
| 58 | * enum qca_wlan_vendor_attr_ndp_params - vendor attribute parameters |
| 59 | * @QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD: NDP Sub command |
| 60 | * @QCA_WLAN_VENDOR_ATTR_NDP_TRANSACTION_ID: Transaction id reference |
| 61 | * @QCA_WLAN_VENDOR_ATTR_NDP_STATUS_ID: NDP status id |
| 62 | * @QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_INSTANCE_ID: Service instance id |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 63 | * @QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL: Requested channel |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 64 | * @QCA_WLAN_VENDOR_ATTR_NDP_PEER_DISCOVERY_MAC_ADDR: Peer discovery mac addr |
| 65 | * @QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR: Iface name |
| 66 | * @QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_SECURITY: Security configuration |
| 67 | * @QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS: Qos configuration |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 68 | * @QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO: Application info |
| 69 | * @QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID: NDP instance id |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 70 | * @QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID_ARRAY: NDP instance id array |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 71 | * @QCA_WLAN_VENDOR_ATTR_NDP_RESPONSE_CODE: Schedule response |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 72 | * @QCA_WLAN_VENDOR_ATTR_NDP_NDI_MAC_ADDR: NDI mac address |
| 73 | * @QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_TYPE: Driver return status |
| 74 | * @QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE: Driver return value |
| 75 | */ |
| 76 | enum qca_wlan_vendor_attr_ndp_params { |
| 77 | QCA_WLAN_VENDOR_ATTR_NDP_PARAM_INVALID = 0, |
| 78 | QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD, |
| 79 | QCA_WLAN_VENDOR_ATTR_NDP_TRANSACTION_ID, |
| 80 | QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_INSTANCE_ID, |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 81 | QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL, |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 82 | QCA_WLAN_VENDOR_ATTR_NDP_PEER_DISCOVERY_MAC_ADDR, |
| 83 | QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR, |
| 84 | QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_SECURITY, |
| 85 | QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS, |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 86 | QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO, |
| 87 | QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID, |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 88 | QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID_ARRAY, |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 89 | QCA_WLAN_VENDOR_ATTR_NDP_RESPONSE_CODE, |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 90 | QCA_WLAN_VENDOR_ATTR_NDP_NDI_MAC_ADDR, |
| 91 | QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_TYPE, |
| 92 | QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE, |
| 93 | |
| 94 | QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_AFTER_LAST, |
| 95 | QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX = |
| 96 | QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_AFTER_LAST - 1, |
| 97 | }; |
| 98 | |
| 99 | /** |
| 100 | * enum qca_wlan_vendor_attr_ndp_cfg_security - vendor security attribute |
| 101 | * @QCA_WLAN_VENDOR_ATTR_NDP_SECURITY_ENABLE: Security enabled |
| 102 | */ |
| 103 | enum qca_wlan_vendor_attr_ndp_cfg_security { |
| 104 | QCA_WLAN_VENDOR_ATTR_NDP_SECURITY_ENABLE = 1, |
| 105 | }; |
| 106 | |
| 107 | /** |
| 108 | * enum qca_wlan_vendor_attr_ndp_qos - vendor qos attribute |
| 109 | * @QCA_WLAN_VENDOR_ATTR_NDP_QOS_CONFIG: NDP QoS configuration |
| 110 | */ |
| 111 | enum qca_wlan_vendor_attr_ndp_qos { |
| 112 | QCA_WLAN_VENDOR_ATTR_NDP_QOS_CONFIG = 1, |
| 113 | }; |
| 114 | |
| 115 | /** |
| 116 | * enum qca_wlan_vendor_attr_ndp_sub_cmd_value - NDP subcmd value |
| 117 | * @QCA_WLAN_VENDOR_ATTR_NDP_INVALID: Unused subcmd value |
| 118 | * @QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_CREATE: iface create |
| 119 | * @QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_DELETE: iface delete |
| 120 | * @QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_REQUEST: NDP initiator request |
| 121 | * @QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_RESPONSE: NDP initiator response |
| 122 | * @QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_REQUEST: NDP responder request |
| 123 | * @QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_RESPONSE: NDP responder response |
| 124 | * @QCA_WLAN_VENDOR_ATTR_NDP_END_REQUEST: NDP end request |
| 125 | * @QCA_WLAN_VENDOR_ATTR_NDP_END_RESPONSE: NDP end response |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 126 | * @QCA_WLAN_VENDOR_ATTR_NDP_REQUEST_IND: NDP request indication |
| 127 | * @QCA_WLAN_VENDOR_ATTR_NDP_CONFIRM_IND: NDP confirm indication |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 128 | * @QCA_WLAN_VENDOR_ATTR_NDP_END_IND: NDP End indication |
| 129 | */ |
| 130 | enum qca_wlan_vendor_attr_ndp_sub_cmd_value { |
| 131 | QCA_WLAN_VENDOR_ATTR_NDP_INVALID = 0, |
| 132 | QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_CREATE = 1, |
| 133 | QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_DELETE = 2, |
| 134 | QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_REQUEST = 3, |
| 135 | QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_RESPONSE = 4, |
| 136 | QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_REQUEST = 5, |
| 137 | QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_RESPONSE = 6, |
| 138 | QCA_WLAN_VENDOR_ATTR_NDP_END_REQUEST = 7, |
| 139 | QCA_WLAN_VENDOR_ATTR_NDP_END_RESPONSE = 8, |
Naveen Rawat | d915350 | 2016-06-06 15:30:29 -0700 | [diff] [blame] | 140 | QCA_WLAN_VENDOR_ATTR_NDP_REQUEST_IND = 9, |
| 141 | QCA_WLAN_VENDOR_ATTR_NDP_CONFIRM_IND = 10, |
| 142 | QCA_WLAN_VENDOR_ATTR_NDP_END_IND = 11 |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 143 | }; |
| 144 | |
| 145 | /** enum nan_datapath_state - NAN datapath states |
| 146 | * @NAN_DATA_NDI_CREATING_STATE: NDI create is in progress |
| 147 | * @NAN_DATA_NDI_CREATED_STATE: NDI successfully crated |
| 148 | * @NAN_DATA_NDI_DELETING_STATE: NDI delete is in progress |
| 149 | * @NAN_DATA_NDI_DELETED_STATE: NDI delete is in progress |
| 150 | * @NAN_DATA_PEER_CREATE_STATE: Peer create is in progress |
| 151 | * @NAN_DATA_PEER_DELETE_STATE: Peer delete is in progrss |
| 152 | * @NAN_DATA_CONNECTING_STATE: Data connection in progress |
| 153 | * @NAN_DATA_CONNECTED_STATE: Data connection successful |
| 154 | * @NAN_DATA_END_STATE: NDP end is in progress |
| 155 | * @NAN_DATA_DISCONNECTED_STATE: NDP is in disconnected state |
| 156 | */ |
| 157 | enum nan_datapath_state { |
| 158 | NAN_DATA_NDI_CREATING_STATE = 0, |
| 159 | NAN_DATA_NDI_CREATED_STATE = 1, |
| 160 | NAN_DATA_NDI_DELETING_STATE = 2, |
| 161 | NAN_DATA_NDI_DELETED_STATE = 3, |
| 162 | NAN_DATA_PEER_CREATE_STATE = 4, |
| 163 | NAN_DATA_PEER_DELETE_STATE = 5, |
| 164 | NAN_DATA_CONNECTING_STATE = 6, |
| 165 | NAN_DATA_CONNECTED_STATE = 7, |
| 166 | NAN_DATA_END_STATE = 8, |
| 167 | NAN_DATA_DISCONNECTED_STATE = 9, |
| 168 | }; |
| 169 | |
| 170 | /** |
| 171 | * struct nan_datapath_ctx - context for nan data path |
| 172 | * @state: Current state of NDP |
| 173 | * @active_ndp_sessions: active ndp sessions per adapter |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 174 | * @active_ndp_peers: number of active ndp peers |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 175 | * @ndp_create_transaction_id: transaction id for create req |
| 176 | * @ndp_delete_transaction_id: transaction id for delete req |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 177 | * @ndp_key_installed: NDP security key installed |
| 178 | * @ndp_enc_key: NDP encryption key info |
| 179 | * @ndp_debug_state: debug state info |
Naveen Rawat | 8d63a59 | 2016-06-29 18:30:59 -0700 | [diff] [blame] | 180 | * @ndi_delete_rsp_reason: reason code for ndi_delete rsp |
| 181 | * @ndi_delete_rsp_status: status for ndi_delete rsp |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 182 | */ |
| 183 | struct nan_datapath_ctx { |
| 184 | enum nan_datapath_state state; |
Naveen Rawat | f28315c | 2016-06-29 18:06:02 -0700 | [diff] [blame] | 185 | /* idx in following array should follow conn_info.peerMacAddress */ |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 186 | uint32_t active_ndp_sessions[MAX_PEERS]; |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 187 | uint32_t active_ndp_peers; |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 188 | uint16_t ndp_create_transaction_id; |
| 189 | uint16_t ndp_delete_transaction_id; |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 190 | bool ndp_key_installed; |
| 191 | tCsrRoamSetKey ndp_enc_key; |
| 192 | uint32_t ndp_debug_state; |
Naveen Rawat | 8d63a59 | 2016-06-29 18:30:59 -0700 | [diff] [blame] | 193 | uint32_t ndi_delete_rsp_reason; |
| 194 | uint32_t ndi_delete_rsp_status; |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 195 | }; |
Deepak Dhamdhere | 3385d75 | 2016-05-25 20:36:47 -0700 | [diff] [blame] | 196 | |
| 197 | #ifdef WLAN_FEATURE_NAN_DATAPATH |
| 198 | void hdd_ndp_print_ini_config(struct hdd_context_s *hdd_ctx); |
Deepak Dhamdhere | 13230d3 | 2016-05-26 00:46:53 -0700 | [diff] [blame] | 199 | void hdd_nan_datapath_target_config(struct hdd_context_s *hdd_ctx, |
| 200 | struct wma_tgt_cfg *cfg); |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 201 | void hdd_ndp_event_handler(struct hdd_adapter_s *adapter, |
| 202 | tCsrRoamInfo *roam_info, uint32_t roam_id, eRoamCmdStatus roam_status, |
| 203 | eCsrRoamResult roam_result); |
| 204 | int wlan_hdd_cfg80211_process_ndp_cmd(struct wiphy *wiphy, |
| 205 | struct wireless_dev *wdev, const void *data, int data_len); |
| 206 | int hdd_init_nan_data_mode(struct hdd_adapter_s *adapter); |
Deepak Dhamdhere | 13983f2 | 2016-05-31 19:06:09 -0700 | [diff] [blame] | 207 | void hdd_ndp_session_end_handler(hdd_adapter_t *adapter); |
Deepak Dhamdhere | 3385d75 | 2016-05-25 20:36:47 -0700 | [diff] [blame] | 208 | #else |
| 209 | static inline void hdd_ndp_print_ini_config(struct hdd_context_s *hdd_ctx) |
| 210 | { |
| 211 | } |
Deepak Dhamdhere | 13230d3 | 2016-05-26 00:46:53 -0700 | [diff] [blame] | 212 | static inline void hdd_nan_datapath_target_config(struct hdd_context_s *hdd_ctx, |
| 213 | struct wma_tgt_cfg *cfg) |
| 214 | { |
| 215 | } |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 216 | static inline void hdd_ndp_event_handler(struct hdd_adapter_s *adapter, |
| 217 | tCsrRoamInfo *roam_info, uint32_t roam_id, eRoamCmdStatus roam_status, |
| 218 | eCsrRoamResult roam_result) |
| 219 | { |
| 220 | } |
| 221 | static inline int wlan_hdd_cfg80211_process_ndp_cmd(struct wiphy *wiphy, |
| 222 | struct wireless_dev *wdev, const void *data, int data_len) |
| 223 | { |
| 224 | return 0; |
| 225 | } |
| 226 | static inline int hdd_init_nan_data_mode(struct hdd_adapter_s *adapter) |
| 227 | { |
| 228 | return 0; |
| 229 | } |
Deepak Dhamdhere | 13983f2 | 2016-05-31 19:06:09 -0700 | [diff] [blame] | 230 | static inline void hdd_ndp_session_end_handler(hdd_adapter_t *adapter) |
| 231 | { |
| 232 | } |
Deepak Dhamdhere | 3385d75 | 2016-05-25 20:36:47 -0700 | [diff] [blame] | 233 | #endif /* WLAN_FEATURE_NAN_DATAPATH */ |
| 234 | |
Ravi Joshi | a063dd9 | 2016-05-25 16:43:13 -0700 | [diff] [blame] | 235 | #endif /* __WLAN_HDD_NAN_DATAPATH_H */ |