Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame^] | 2 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [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 | #ifndef _WLAN_HDD_WOWL_H |
| 23 | #define _WLAN_HDD_WOWL_H |
| 24 | |
| 25 | /*============================================================================ |
| 26 | @file wlan_hdd_wowl.h |
| 27 | |
| 28 | This module houses all the logic for WOWL in HDD. |
| 29 | |
| 30 | It provides the following APIs |
| 31 | |
| 32 | - Ability to enable/disable following WoWL modes |
| 33 | 1) Magic packet (MP) mode |
| 34 | 2) Pattern Byte Matching (PBM) mode |
| 35 | - Ability to add/remove patterns for PBM |
| 36 | |
| 37 | A Magic Packet is a packet that contains 6 0xFFs followed by 16 contiguous |
| 38 | copies of the receiving NIC's Ethernet address. There is no API to configure |
| 39 | Magic Packet Pattern. |
| 40 | |
| 41 | Wakeup pattern (used for PBM) is defined as following: |
| 42 | typedef struct |
| 43 | { |
| 44 | U8 PatternSize; // Non-Zero pattern size |
| 45 | U8 PatternMaskSize; // Non-zero pattern mask size |
| 46 | U8 PatternMask[PatternMaskSize]; // Pattern mask |
| 47 | U8 Pattern[PatternSize]; // Pattern |
| 48 | } hdd_wowl_ptrn_t; |
| 49 | |
| 50 | PatternSize and PatternMaskSize indicate size of the variable length Pattern |
| 51 | and PatternMask. PatternMask indicates which bytes of an incoming packet |
| 52 | should be compared with corresponding bytes in the pattern. |
| 53 | |
| 54 | Maximum allowed pattern size is 128 bytes. Maximum allowed PatternMaskSize |
| 55 | is 16 bytes. |
| 56 | |
| 57 | Maximum number of patterns that can be configured is 8 |
| 58 | |
| 59 | HDD will add following 2 commonly used patterns for PBM by default: |
| 60 | 1) ARP Broadcast Pattern |
| 61 | 2) Unicast Pattern |
| 62 | |
| 63 | However note that WoWL will not be enabled by default by HDD. WoWL needs to |
| 64 | enabled explcitly by exercising the iwpriv command. |
| 65 | |
| 66 | HDD will expose an API that accepts patterns as Hex string in the following |
| 67 | format: "PatternSize:PatternMaskSize:PatternMask:Pattern". Mutliple patterns |
| 68 | can be specified by deleimiting each pattern with the ';' token. |
| 69 | "PatternSize1:PatternMaskSize1:PatternMask1:Pattern1;PatternSize2:...." |
| 70 | |
| 71 | Patterns can be configured dynamically via iwpriv cmd or statically via |
| 72 | qcom_cfg.ini file |
| 73 | |
| 74 | PBM (when enabled) can perform filtering on unicast data or broadcast data or |
| 75 | both. These configurations are part of factory defaults (cfg.dat) and |
| 76 | the deafult behavior is to perform filtering on both unicast and data frames. |
| 77 | |
| 78 | MP filtering (when enabled) is performed ALWAYS on both unicast and broadcast |
| 79 | data frames. |
| 80 | |
| 81 | Mangement frames are not subjected to WoWL filtering and are discarded when |
| 82 | WoWL is enabled. |
| 83 | |
| 84 | Whenever a patern match succeeds, RX path is restored and packets (both |
| 85 | management and data) will be pushed to the host from that point onwards. |
| 86 | Therefore, exit from WoWL is implicit and happens automatically when the |
| 87 | first packet match succeeds. |
| 88 | |
| 89 | WoWL works on top of BMPS. So when WoWL is requested, SME will attempt to put |
| 90 | the device in BMPS mode (if not already in BMPS). If attempt to BMPS fails, |
| 91 | request for WoWL will be rejected. |
| 92 | |
| 93 | Copyright (c) 2009 QUALCOMM Incorporated. |
| 94 | All Rights Reserved. |
| 95 | Qualcomm Confidential and Proprietary |
| 96 | |
| 97 | ============================================================================*/ |
| 98 | /* $Header$ */ |
| 99 | |
| 100 | /*---------------------------------------------------------------------------- |
| 101 | * Include Files |
| 102 | * -------------------------------------------------------------------------*/ |
| 103 | #include <vos_types.h> |
| 104 | |
| 105 | /*---------------------------------------------------------------------------- |
| 106 | * Preprocessor Definitions and Constants |
| 107 | * -------------------------------------------------------------------------*/ |
| 108 | |
| 109 | /*---------------------------------------------------------------------------- |
| 110 | * Type Declarations |
| 111 | * -------------------------------------------------------------------------*/ |
| 112 | |
| 113 | /**============================================================================ |
| 114 | @brief hdd_add_wowl_ptrn() - Function which will add the WoWL pattern to be |
| 115 | used when PBM filtering is enabled |
| 116 | |
| 117 | @param ptrn : [in] pointer to the pattern string to be added |
| 118 | |
| 119 | @return : FALSE if any errors encountered |
| 120 | : TRUE otherwise |
| 121 | ===========================================================================*/ |
| 122 | v_BOOL_t hdd_add_wowl_ptrn (const char * ptrn); |
| 123 | |
| 124 | /**============================================================================ |
| 125 | @brief hdd_del_wowl_ptrn() - Function which will remove a WoWL pattern |
| 126 | |
| 127 | @param ptrn : [in] pointer to the pattern string to be removed |
| 128 | |
| 129 | @return : FALSE if any errors encountered |
| 130 | : TRUE otherwise |
| 131 | ===========================================================================*/ |
| 132 | v_BOOL_t hdd_del_wowl_ptrn (const char * ptrn); |
| 133 | |
| 134 | /**============================================================================ |
| 135 | @brief hdd_enter_wowl() - Function which will enable WoWL. Atleast one |
| 136 | of MP and PBM must be enabled |
| 137 | |
| 138 | @param enable_mp : [in] Whether to enable magic packet WoWL mode |
| 139 | @param enable_pbm : [in] Whether to enable pattern byte matching WoWL mode |
| 140 | |
| 141 | @return : FALSE if any errors encountered |
| 142 | : TRUE otherwise |
| 143 | ===========================================================================*/ |
| 144 | v_BOOL_t hdd_enter_wowl (hdd_adapter_t *pAdapter, v_BOOL_t enable_mp, v_BOOL_t enable_pbm); |
| 145 | |
| 146 | /**============================================================================ |
| 147 | @brief hdd_exit_wowl() - Function which will disable WoWL |
| 148 | |
| 149 | @return : FALSE if any errors encountered |
| 150 | : TRUE otherwise |
| 151 | ===========================================================================*/ |
| 152 | v_BOOL_t hdd_exit_wowl (void); |
| 153 | |
| 154 | /**============================================================================ |
| 155 | @brief hdd_init_wowl() - Init function which will initialize the WoWL module |
| 156 | and perform any required intial configuration |
| 157 | |
| 158 | @return : FALSE if any errors encountered |
| 159 | : TRUE otherwise |
| 160 | ===========================================================================*/ |
| 161 | v_BOOL_t hdd_init_wowl (void* pAdapter); |
| 162 | |
| 163 | #endif /* #ifndef _WLAN_HDD_WOWL_H */ |