Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | #ifndef __P2P_H |
| 29 | #define __P2P_H |
| 30 | /**=========================================================================== |
| 31 | |
| 32 | \file wlan_hdd_p2p.h |
| 33 | |
| 34 | \brief Linux HDD P2P include file |
| 35 | |
| 36 | ==========================================================================*/ |
| 37 | #define ACTION_FRAME_TX_TIMEOUT 2000 |
| 38 | #define WAIT_CANCEL_REM_CHAN 1000 |
| 39 | #define WAIT_REM_CHAN_READY 1000 |
| 40 | #define WAIT_CHANGE_CHANNEL_FOR_OFFCHANNEL_TX 3000 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 41 | #define COMPLETE_EVENT_PROPOGATE_TIME 10 |
| 42 | |
| 43 | #ifdef QCA_WIFI_3_0_EMU |
| 44 | #define ACTION_FRAME_DEFAULT_WAIT 500 |
| 45 | #else |
| 46 | #define ACTION_FRAME_DEFAULT_WAIT 200 |
| 47 | #endif |
| 48 | |
| 49 | #define WLAN_HDD_GET_TYPE_FRM_FC(__fc__) (((__fc__) & 0x0F) >> 2) |
| 50 | #define WLAN_HDD_GET_SUBTYPE_FRM_FC(__fc__) (((__fc__) & 0xF0) >> 4) |
| 51 | #define WLAN_HDD_80211_FRM_DA_OFFSET 4 |
| 52 | #define P2P_WILDCARD_SSID_LEN 7 |
| 53 | #define P2P_WILDCARD_SSID "DIRECT-" |
| 54 | |
| 55 | #ifdef QCA_WIFI_3_0_EMU |
| 56 | #define P2P_ROC_DURATION_MULTIPLIER_GO_PRESENT 2 |
| 57 | #define P2P_ROC_DURATION_MULTIPLIER_GO_ABSENT 3 |
| 58 | #else |
| 59 | #define P2P_ROC_DURATION_MULTIPLIER_GO_PRESENT 2 |
| 60 | #define P2P_ROC_DURATION_MULTIPLIER_GO_ABSENT 5 |
| 61 | #endif |
| 62 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 63 | #define HDD_P2P_MAX_ROC_DURATION 1000 |
| 64 | #define MAX_ROC_REQ_QUEUE_ENTRY 10 |
| 65 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 66 | #define P2P_POWER_SAVE_TYPE_OPPORTUNISTIC (1 << 0) |
| 67 | #define P2P_POWER_SAVE_TYPE_PERIODIC_NOA (1 << 1) |
| 68 | #define P2P_POWER_SAVE_TYPE_SINGLE_NOA (1 << 2) |
| 69 | |
| 70 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 71 | typedef enum { P2P_NOT_ACTIVE, |
| 72 | P2P_GO_NEG_PROCESS, |
| 73 | P2P_GO_NEG_COMPLETED, |
| 74 | P2P_CLIENT_CONNECTING_STATE_1, |
| 75 | P2P_GO_COMPLETED_STATE, |
| 76 | P2P_CLIENT_CONNECTED_STATE_1, |
| 77 | P2P_CLIENT_DISCONNECTED_STATE, |
| 78 | P2P_CLIENT_CONNECTING_STATE_2, |
| 79 | P2P_CLIENT_COMPLETED_STATE} tP2PConnectionStatus; |
| 80 | |
| 81 | extern tP2PConnectionStatus global_p2p_connection_status; |
| 82 | #endif |
| 83 | |
| 84 | typedef struct p2p_app_setP2pPs { |
| 85 | uint8_t opp_ps; |
| 86 | uint32_t ctWindow; |
| 87 | uint8_t count; |
| 88 | uint32_t duration; |
| 89 | uint32_t interval; |
| 90 | uint32_t single_noa_duration; |
| 91 | uint8_t psSelection; |
| 92 | } p2p_app_setP2pPs_t; |
| 93 | |
| 94 | int wlan_hdd_cfg80211_remain_on_channel(struct wiphy *wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 95 | struct wireless_dev *wdev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 96 | struct ieee80211_channel *chan, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 97 | unsigned int duration, u64 *cookie); |
| 98 | |
| 99 | int wlan_hdd_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 100 | struct wireless_dev *wdev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 101 | u64 cookie); |
| 102 | |
| 103 | int wlan_hdd_cfg80211_mgmt_tx_cancel_wait(struct wiphy *wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 104 | struct wireless_dev *wdev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 105 | u64 cookie); |
| 106 | |
| 107 | int hdd_set_p2p_ps(struct net_device *dev, void *msgData); |
| 108 | int hdd_set_p2p_opps(struct net_device *dev, uint8_t *command); |
| 109 | int hdd_set_p2p_noa(struct net_device *dev, uint8_t *command); |
| 110 | |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 111 | void __hdd_indicate_mgmt_frame(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 112 | uint32_t nFrameLength, uint8_t *pbFrames, |
| 113 | uint8_t frameType, uint32_t rxChan, int8_t rxRssi); |
| 114 | |
| 115 | void hdd_remain_chan_ready_handler(hdd_adapter_t *pAdapter, |
| 116 | uint32_t scan_id); |
| 117 | void hdd_send_action_cnf(hdd_adapter_t *pAdapter, bool actionSendSuccess); |
| 118 | int wlan_hdd_check_remain_on_channel(hdd_adapter_t *pAdapter); |
| 119 | void wlan_hdd_cancel_existing_remain_on_channel(hdd_adapter_t *pAdapter); |
| 120 | |
| 121 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) |
| 122 | int wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, |
| 123 | struct cfg80211_mgmt_tx_params *params, u64 *cookie); |
Amar Singhal | 01098f7 | 2015-10-08 11:55:32 -0700 | [diff] [blame] | 124 | #else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 125 | int wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, |
| 126 | struct ieee80211_channel *chan, bool offchan, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 127 | unsigned int wait, |
| 128 | const u8 *buf, size_t len, bool no_cck, |
| 129 | bool dont_wait_for_ack, u64 *cookie); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 130 | #endif |
| 131 | |
Ryan Hsu | 07495ea | 2016-01-21 15:25:39 -0800 | [diff] [blame] | 132 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) || defined(WITH_BACKPORTS) |
| 133 | struct wireless_dev *wlan_hdd_add_virtual_intf(struct wiphy *wiphy, |
| 134 | const char *name, |
| 135 | unsigned char name_assign_type, |
| 136 | enum nl80211_iftype type, |
| 137 | u32 *flags, |
| 138 | struct vif_params *params); |
| 139 | #else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 140 | struct wireless_dev *wlan_hdd_add_virtual_intf(struct wiphy *wiphy, |
| 141 | const char *name, |
| 142 | enum nl80211_iftype type, |
| 143 | u32 *flags, |
| 144 | struct vif_params *params); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 145 | |
Ryan Hsu | 07495ea | 2016-01-21 15:25:39 -0800 | [diff] [blame] | 146 | #endif |
| 147 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 148 | int wlan_hdd_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev); |
Amar Singhal | 01098f7 | 2015-10-08 11:55:32 -0700 | [diff] [blame] | 149 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 150 | |
| 151 | void wlan_hdd_cleanup_remain_on_channel_ctx(hdd_adapter_t *pAdapter); |
| 152 | |
| 153 | void wlan_hdd_roc_request_dequeue(struct work_struct *work); |
| 154 | #endif /* __P2P_H */ |