blob: 82e3ff8855ed406521813b96b9522a05bef149bf [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
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/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
42#ifndef _WLAN_HDD_WOWL_H
43#define _WLAN_HDD_WOWL_H
44
45/*============================================================================
46 @file wlan_hdd_wowl.h
47
48 This module houses all the logic for WOWL in HDD.
49
50 It provides the following APIs
51
52 - Ability to enable/disable following WoWL modes
53 1) Magic packet (MP) mode
54 2) Pattern Byte Matching (PBM) mode
55 - Ability to add/remove patterns for PBM
56
57 A Magic Packet is a packet that contains 6 0xFFs followed by 16 contiguous
58 copies of the receiving NIC's Ethernet address. There is no API to configure
59 Magic Packet Pattern.
60
61 Wakeup pattern (used for PBM) is defined as following:
62 typedef struct
63 {
64 U8 PatternSize; // Non-Zero pattern size
65 U8 PatternMaskSize; // Non-zero pattern mask size
66 U8 PatternMask[PatternMaskSize]; // Pattern mask
67 U8 Pattern[PatternSize]; // Pattern
68 } hdd_wowl_ptrn_t;
69
70 PatternSize and PatternMaskSize indicate size of the variable length Pattern
71 and PatternMask. PatternMask indicates which bytes of an incoming packet
72 should be compared with corresponding bytes in the pattern.
73
74 Maximum allowed pattern size is 128 bytes. Maximum allowed PatternMaskSize
75 is 16 bytes.
76
77 Maximum number of patterns that can be configured is 8
78
79 HDD will add following 2 commonly used patterns for PBM by default:
80 1) ARP Broadcast Pattern
81 2) Unicast Pattern
82
83 However note that WoWL will not be enabled by default by HDD. WoWL needs to
84 enabled explcitly by exercising the iwpriv command.
85
86 HDD will expose an API that accepts patterns as Hex string in the following
87 format: "PatternSize:PatternMaskSize:PatternMask:Pattern". Mutliple patterns
88 can be specified by deleimiting each pattern with the ';' token.
89 "PatternSize1:PatternMaskSize1:PatternMask1:Pattern1;PatternSize2:...."
90
91 Patterns can be configured dynamically via iwpriv cmd or statically via
92 qcom_cfg.ini file
93
94 PBM (when enabled) can perform filtering on unicast data or broadcast data or
95 both. These configurations are part of factory defaults (cfg.dat) and
96 the deafult behavior is to perform filtering on both unicast and data frames.
97
98 MP filtering (when enabled) is performed ALWAYS on both unicast and broadcast
99 data frames.
100
101 Mangement frames are not subjected to WoWL filtering and are discarded when
102 WoWL is enabled.
103
104 Whenever a patern match succeeds, RX path is restored and packets (both
105 management and data) will be pushed to the host from that point onwards.
106 Therefore, exit from WoWL is implicit and happens automatically when the
107 first packet match succeeds.
108
109 WoWL works on top of BMPS. So when WoWL is requested, SME will attempt to put
110 the device in BMPS mode (if not already in BMPS). If attempt to BMPS fails,
111 request for WoWL will be rejected.
112
113 Copyright (c) 2009 QUALCOMM Incorporated.
114 All Rights Reserved.
115 Qualcomm Confidential and Proprietary
116
117============================================================================*/
118/* $Header$ */
119
120/*----------------------------------------------------------------------------
121 * Include Files
122 * -------------------------------------------------------------------------*/
123#include <vos_types.h>
124
125/*----------------------------------------------------------------------------
126 * Preprocessor Definitions and Constants
127 * -------------------------------------------------------------------------*/
128
129/*----------------------------------------------------------------------------
130 * Type Declarations
131 * -------------------------------------------------------------------------*/
132
133/**============================================================================
134 @brief hdd_add_wowl_ptrn() - Function which will add the WoWL pattern to be
135 used when PBM filtering is enabled
136
137 @param ptrn : [in] pointer to the pattern string to be added
138
139 @return : FALSE if any errors encountered
140 : TRUE otherwise
141 ===========================================================================*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700142v_BOOL_t hdd_add_wowl_ptrn (hdd_adapter_t *pAdapter, const char * ptrn);
Jeff Johnson295189b2012-06-20 16:38:30 -0700143
144/**============================================================================
145 @brief hdd_del_wowl_ptrn() - Function which will remove a WoWL pattern
146
147 @param ptrn : [in] pointer to the pattern string to be removed
148
149 @return : FALSE if any errors encountered
150 : TRUE otherwise
151 ===========================================================================*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700152v_BOOL_t hdd_del_wowl_ptrn (hdd_adapter_t *pAdapter, const char * ptrn);
Jeff Johnson295189b2012-06-20 16:38:30 -0700153
154/**============================================================================
Yue Ma0d4891e2013-08-06 17:01:45 -0700155 @brief hdd_add_wowl_ptrn_debugfs() - Function which will add a WoW pattern
156 to be used when PBM filtering is enabled and MP filtering is disabled
157
158 @param pAdapter : [in] pointer to the adapter
159 pattern_idx : [in] index of the pattern to be added
160 pattern_offset : [in] offset of the pattern in the frame payload
161 pattern_buf : [in] pointer to the pattern hex string to be added
162
163 @return : FALSE if any errors encountered
164 : TRUE otherwise
165 ===========================================================================*/
166v_BOOL_t hdd_add_wowl_ptrn_debugfs(hdd_adapter_t *pAdapter, v_U8_t pattern_idx,
167 v_U8_t pattern_offset, char *pattern_buf);
168
169/**============================================================================
170 @brief hdd_del_wowl_ptrn_debugfs() - Function which will remove a WoW pattern
171
172 @param pAdapter : [in] pointer to the adapter
173 pattern_idx : [in] index of the pattern to be removed
174
175 @return : FALSE if any errors encountered
176 : TRUE otherwise
177 ===========================================================================*/
178v_BOOL_t hdd_del_wowl_ptrn_debugfs(hdd_adapter_t *pAdapter, v_U8_t pattern_idx);
179
180/**============================================================================
Jeff Johnson295189b2012-06-20 16:38:30 -0700181 @brief hdd_enter_wowl() - Function which will enable WoWL. Atleast one
182 of MP and PBM must be enabled
183
184 @param enable_mp : [in] Whether to enable magic packet WoWL mode
185 @param enable_pbm : [in] Whether to enable pattern byte matching WoWL mode
186
187 @return : FALSE if any errors encountered
188 : TRUE otherwise
189 ===========================================================================*/
190v_BOOL_t hdd_enter_wowl (hdd_adapter_t *pAdapter, v_BOOL_t enable_mp, v_BOOL_t enable_pbm);
191
192/**============================================================================
193 @brief hdd_exit_wowl() - Function which will disable WoWL
194
195 @return : FALSE if any errors encountered
196 : TRUE otherwise
197 ===========================================================================*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700198v_BOOL_t hdd_exit_wowl (hdd_adapter_t*pAdapter);
Jeff Johnson295189b2012-06-20 16:38:30 -0700199
200/**============================================================================
201 @brief hdd_init_wowl() - Init function which will initialize the WoWL module
202 and perform any required intial configuration
203
204 @return : FALSE if any errors encountered
205 : TRUE otherwise
206 ===========================================================================*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700207v_BOOL_t hdd_init_wowl (hdd_adapter_t* pAdapter);
Jeff Johnson295189b2012-06-20 16:38:30 -0700208
Srinivas Girigowda100eb322013-03-15 16:48:20 -0700209/**============================================================================
210 @brief hdd_parse_hex() - function returns integer equivalent of hexa decimal
211
212 @return : integer equivalent of hexa decimal
213 ===========================================================================*/
214int hdd_parse_hex(unsigned char c);
215
Jeff Johnson295189b2012-06-20 16:38:30 -0700216#endif /* #ifndef _WLAN_HDD_WOWL_H */