Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1 | /* src/prism2/driver/prism2mib.c |
| 2 | * |
| 3 | * Management request for mibset/mibget |
| 4 | * |
| 5 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. |
| 6 | * -------------------------------------------------------------------- |
| 7 | * |
| 8 | * linux-wlan |
| 9 | * |
| 10 | * The contents of this file are subject to the Mozilla Public |
| 11 | * License Version 1.1 (the "License"); you may not use this file |
| 12 | * except in compliance with the License. You may obtain a copy of |
| 13 | * the License at http://www.mozilla.org/MPL/ |
| 14 | * |
| 15 | * Software distributed under the License is distributed on an "AS |
| 16 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or |
| 17 | * implied. See the License for the specific language governing |
| 18 | * rights and limitations under the License. |
| 19 | * |
| 20 | * Alternatively, the contents of this file may be used under the |
| 21 | * terms of the GNU Public License version 2 (the "GPL"), in which |
| 22 | * case the provisions of the GPL are applicable instead of the |
| 23 | * above. If you wish to allow the use of your version of this file |
| 24 | * only under the terms of the GPL and not to allow others to use |
| 25 | * your version of this file under the MPL, indicate your decision |
| 26 | * by deleting the provisions above and replace them with the notice |
| 27 | * and other provisions required by the GPL. If you do not delete |
| 28 | * the provisions above, a recipient may use your version of this |
| 29 | * file under either the MPL or the GPL. |
| 30 | * |
| 31 | * -------------------------------------------------------------------- |
| 32 | * |
| 33 | * Inquiries regarding the linux-wlan Open Source project can be |
| 34 | * made directly to: |
| 35 | * |
| 36 | * AbsoluteValue Systems Inc. |
| 37 | * info@linux-wlan.com |
| 38 | * http://www.linux-wlan.com |
| 39 | * |
| 40 | * -------------------------------------------------------------------- |
| 41 | * |
| 42 | * Portions of the development of this software were funded by |
| 43 | * Intersil Corporation as part of PRISM(R) chipset product development. |
| 44 | * |
| 45 | * -------------------------------------------------------------------- |
| 46 | * |
| 47 | * The functions in this file handle the mibset/mibget management |
| 48 | * functions. |
| 49 | * |
| 50 | * -------------------------------------------------------------------- |
| 51 | */ |
| 52 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 53 | #include <linux/module.h> |
| 54 | #include <linux/kernel.h> |
| 55 | #include <linux/sched.h> |
| 56 | #include <linux/types.h> |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 57 | #include <linux/wireless.h> |
| 58 | #include <linux/netdevice.h> |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 59 | #include <linux/io.h> |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 60 | #include <linux/delay.h> |
| 61 | #include <asm/byteorder.h> |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 62 | #include <linux/usb.h> |
Moritz Muehlenhoff | 7f6e0e4 | 2009-01-25 21:54:55 +0100 | [diff] [blame] | 63 | #include <linux/bitops.h> |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 64 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 65 | #include "p80211types.h" |
| 66 | #include "p80211hdr.h" |
| 67 | #include "p80211mgmt.h" |
| 68 | #include "p80211conv.h" |
| 69 | #include "p80211msg.h" |
| 70 | #include "p80211netdev.h" |
| 71 | #include "p80211metadef.h" |
| 72 | #include "p80211metastruct.h" |
| 73 | #include "hfa384x.h" |
| 74 | #include "prism2mgmt.h" |
| 75 | |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 76 | #define MIB_TMP_MAXLEN 200 /* Max length of RID record (in bytes). */ |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 77 | |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 78 | #define F_STA 0x1 /* MIB is supported on stations. */ |
| 79 | #define F_READ 0x2 /* MIB may be read. */ |
| 80 | #define F_WRITE 0x4 /* MIB may be written. */ |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 81 | |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 82 | struct mibrec { |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 83 | u32 did; |
| 84 | u16 flag; |
| 85 | u16 parm1; |
| 86 | u16 parm2; |
| 87 | u16 parm3; |
Modestas Stankus | 6f8eee6 | 2014-07-31 22:04:32 +0300 | [diff] [blame] | 88 | int (*func)(struct mibrec *mib, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 89 | int isget, |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 90 | wlandevice_t *wlandev, |
| 91 | hfa384x_t *hw, |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 92 | struct p80211msg_dot11req_mibset *msg, void *data); |
| 93 | }; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 94 | |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 95 | static int prism2mib_bytearea2pstr(struct mibrec *mib, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 96 | int isget, |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 97 | wlandevice_t *wlandev, |
| 98 | hfa384x_t *hw, |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 99 | struct p80211msg_dot11req_mibset *msg, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 100 | void *data); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 101 | |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 102 | static int prism2mib_uint32(struct mibrec *mib, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 103 | int isget, |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 104 | wlandevice_t *wlandev, |
| 105 | hfa384x_t *hw, |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 106 | struct p80211msg_dot11req_mibset *msg, void *data); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 107 | |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 108 | static int prism2mib_flag(struct mibrec *mib, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 109 | int isget, |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 110 | wlandevice_t *wlandev, |
| 111 | hfa384x_t *hw, |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 112 | struct p80211msg_dot11req_mibset *msg, void *data); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 113 | |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 114 | static int prism2mib_wepdefaultkey(struct mibrec *mib, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 115 | int isget, |
Svenne Krap | 5dd8acc | 2010-02-14 18:59:00 +0100 | [diff] [blame] | 116 | wlandevice_t *wlandev, |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 117 | hfa384x_t *hw, |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 118 | struct p80211msg_dot11req_mibset *msg, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 119 | void *data); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 120 | |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 121 | static int prism2mib_privacyinvoked(struct mibrec *mib, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 122 | int isget, |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 123 | wlandevice_t *wlandev, |
| 124 | hfa384x_t *hw, |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 125 | struct p80211msg_dot11req_mibset *msg, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 126 | void *data); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 127 | |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 128 | static int prism2mib_excludeunencrypted(struct mibrec *mib, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 129 | int isget, |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 130 | wlandevice_t *wlandev, |
| 131 | hfa384x_t *hw, |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 132 | struct p80211msg_dot11req_mibset *msg, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 133 | void *data); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 134 | |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 135 | static int prism2mib_fragmentationthreshold(struct mibrec *mib, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 136 | int isget, |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 137 | wlandevice_t *wlandev, |
| 138 | hfa384x_t *hw, |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 139 | struct p80211msg_dot11req_mibset *msg, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 140 | void *data); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 141 | |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 142 | static int prism2mib_priv(struct mibrec *mib, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 143 | int isget, |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 144 | wlandevice_t *wlandev, |
| 145 | hfa384x_t *hw, |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 146 | struct p80211msg_dot11req_mibset *msg, void *data); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 147 | |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 148 | static struct mibrec mibtab[] = { |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 149 | |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 150 | /* dot11smt MIB's */ |
| 151 | {DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey0, |
| 152 | F_STA | F_WRITE, |
| 153 | HFA384x_RID_CNFWEPDEFAULTKEY0, 0, 0, |
| 154 | prism2mib_wepdefaultkey}, |
| 155 | {DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey1, |
| 156 | F_STA | F_WRITE, |
| 157 | HFA384x_RID_CNFWEPDEFAULTKEY1, 0, 0, |
| 158 | prism2mib_wepdefaultkey}, |
| 159 | {DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey2, |
| 160 | F_STA | F_WRITE, |
| 161 | HFA384x_RID_CNFWEPDEFAULTKEY2, 0, 0, |
| 162 | prism2mib_wepdefaultkey}, |
| 163 | {DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey3, |
| 164 | F_STA | F_WRITE, |
| 165 | HFA384x_RID_CNFWEPDEFAULTKEY3, 0, 0, |
| 166 | prism2mib_wepdefaultkey}, |
| 167 | {DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked, |
| 168 | F_STA | F_READ | F_WRITE, |
| 169 | HFA384x_RID_CNFWEPFLAGS, HFA384x_WEPFLAGS_PRIVINVOKED, 0, |
| 170 | prism2mib_privacyinvoked}, |
| 171 | {DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID, |
| 172 | F_STA | F_READ | F_WRITE, |
| 173 | HFA384x_RID_CNFWEPDEFAULTKEYID, 0, 0, |
| 174 | prism2mib_uint32}, |
| 175 | {DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted, |
| 176 | F_STA | F_READ | F_WRITE, |
| 177 | HFA384x_RID_CNFWEPFLAGS, HFA384x_WEPFLAGS_EXCLUDE, 0, |
| 178 | prism2mib_excludeunencrypted}, |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 179 | |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 180 | /* dot11mac MIB's */ |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 181 | |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 182 | {DIDmib_dot11mac_dot11OperationTable_dot11MACAddress, |
| 183 | F_STA | F_READ | F_WRITE, |
| 184 | HFA384x_RID_CNFOWNMACADDR, HFA384x_RID_CNFOWNMACADDR_LEN, 0, |
| 185 | prism2mib_bytearea2pstr}, |
| 186 | {DIDmib_dot11mac_dot11OperationTable_dot11RTSThreshold, |
| 187 | F_STA | F_READ | F_WRITE, |
| 188 | HFA384x_RID_RTSTHRESH, 0, 0, |
| 189 | prism2mib_uint32}, |
| 190 | {DIDmib_dot11mac_dot11OperationTable_dot11ShortRetryLimit, |
| 191 | F_STA | F_READ, |
| 192 | HFA384x_RID_SHORTRETRYLIMIT, 0, 0, |
| 193 | prism2mib_uint32}, |
| 194 | {DIDmib_dot11mac_dot11OperationTable_dot11LongRetryLimit, |
| 195 | F_STA | F_READ, |
| 196 | HFA384x_RID_LONGRETRYLIMIT, 0, 0, |
| 197 | prism2mib_uint32}, |
| 198 | {DIDmib_dot11mac_dot11OperationTable_dot11FragmentationThreshold, |
| 199 | F_STA | F_READ | F_WRITE, |
| 200 | HFA384x_RID_FRAGTHRESH, 0, 0, |
| 201 | prism2mib_fragmentationthreshold}, |
| 202 | {DIDmib_dot11mac_dot11OperationTable_dot11MaxTransmitMSDULifetime, |
| 203 | F_STA | F_READ, |
| 204 | HFA384x_RID_MAXTXLIFETIME, 0, 0, |
| 205 | prism2mib_uint32}, |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 206 | |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 207 | /* dot11phy MIB's */ |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 208 | |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 209 | {DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel, |
| 210 | F_STA | F_READ, |
| 211 | HFA384x_RID_CURRENTCHANNEL, 0, 0, |
| 212 | prism2mib_uint32}, |
| 213 | {DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel, |
| 214 | F_STA | F_READ | F_WRITE, |
| 215 | HFA384x_RID_TXPOWERMAX, 0, 0, |
| 216 | prism2mib_uint32}, |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 217 | |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 218 | /* p2Static MIB's */ |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 219 | |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 220 | {DIDmib_p2_p2Static_p2CnfPortType, |
| 221 | F_STA | F_READ | F_WRITE, |
| 222 | HFA384x_RID_CNFPORTTYPE, 0, 0, |
| 223 | prism2mib_uint32}, |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 224 | |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 225 | /* p2MAC MIB's */ |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 226 | |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 227 | {DIDmib_p2_p2MAC_p2CurrentTxRate, |
| 228 | F_STA | F_READ, |
| 229 | HFA384x_RID_CURRENTTXRATE, 0, 0, |
| 230 | prism2mib_uint32}, |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 231 | |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 232 | /* And finally, lnx mibs */ |
| 233 | {DIDmib_lnx_lnxConfigTable_lnxRSNAIE, |
| 234 | F_STA | F_READ | F_WRITE, |
| 235 | HFA384x_RID_CNFWPADATA, 0, 0, |
| 236 | prism2mib_priv}, |
| 237 | {0, 0, 0, 0, 0, NULL} |
| 238 | }; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 239 | |
| 240 | /*---------------------------------------------------------------- |
| 241 | * prism2mgmt_mibset_mibget |
| 242 | * |
| 243 | * Set the value of a mib item. |
| 244 | * |
| 245 | * Arguments: |
| 246 | * wlandev wlan device structure |
| 247 | * msgp ptr to msg buffer |
| 248 | * |
| 249 | * Returns: |
| 250 | * 0 success and done |
| 251 | * <0 success, but we're waiting for something to finish. |
| 252 | * >0 an error occurred while handling the message. |
| 253 | * Side effects: |
| 254 | * |
| 255 | * Call context: |
| 256 | * process thread (usually) |
| 257 | * interrupt |
| 258 | ----------------------------------------------------------------*/ |
| 259 | |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 260 | int prism2mgmt_mibset_mibget(wlandevice_t *wlandev, void *msgp) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 261 | { |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 262 | hfa384x_t *hw = wlandev->priv; |
| 263 | int result, isget; |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 264 | struct mibrec *mib; |
Solomon Peachy | f980c17 | 2008-10-27 11:14:01 -0400 | [diff] [blame] | 265 | |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 266 | u16 which; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 267 | |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 268 | struct p80211msg_dot11req_mibset *msg = msgp; |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 269 | p80211itemd_t *mibitem; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 270 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 271 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; |
| 272 | msg->resultcode.data = P80211ENUM_resultcode_success; |
| 273 | |
| 274 | /* |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 275 | ** Determine if this is an Access Point or a station. |
| 276 | */ |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 277 | |
Solomon Peachy | f980c17 | 2008-10-27 11:14:01 -0400 | [diff] [blame] | 278 | which = F_STA; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 279 | |
| 280 | /* |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 281 | ** Find the MIB in the MIB table. Note that a MIB may be in the |
| 282 | ** table twice...once for an AP and once for a station. Make sure |
| 283 | ** to get the correct one. Note that DID=0 marks the end of the |
| 284 | ** MIB table. |
| 285 | */ |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 286 | |
| 287 | mibitem = (p80211itemd_t *) msg->mibattribute.data; |
| 288 | |
| 289 | for (mib = mibtab; mib->did != 0; mib++) |
| 290 | if (mib->did == mibitem->did && (mib->flag & which)) |
| 291 | break; |
| 292 | |
| 293 | if (mib->did == 0) { |
| 294 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; |
| 295 | goto done; |
| 296 | } |
| 297 | |
| 298 | /* |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 299 | ** Determine if this is a "mibget" or a "mibset". If this is a |
| 300 | ** "mibget", then make sure that the MIB may be read. Otherwise, |
| 301 | ** this is a "mibset" so make make sure that the MIB may be written. |
| 302 | */ |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 303 | |
| 304 | isget = (msg->msgcode == DIDmsg_dot11req_mibget); |
| 305 | |
| 306 | if (isget) { |
| 307 | if (!(mib->flag & F_READ)) { |
| 308 | msg->resultcode.data = |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 309 | P80211ENUM_resultcode_cant_get_writeonly_mib; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 310 | goto done; |
| 311 | } |
| 312 | } else { |
| 313 | if (!(mib->flag & F_WRITE)) { |
| 314 | msg->resultcode.data = |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 315 | P80211ENUM_resultcode_cant_set_readonly_mib; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 316 | goto done; |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | /* |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 321 | ** Execute the MIB function. If things worked okay, then make |
| 322 | ** sure that the MIB function also worked okay. If so, and this |
| 323 | ** is a "mibget", then the status value must be set for both the |
| 324 | ** "mibattribute" parameter and the mib item within the data |
| 325 | ** portion of the "mibattribute". |
| 326 | */ |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 327 | |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 328 | result = mib->func(mib, isget, wlandev, hw, msg, (void *)mibitem->data); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 329 | |
| 330 | if (msg->resultcode.data == P80211ENUM_resultcode_success) { |
| 331 | if (result != 0) { |
Mithlesh Thukral | 75f49e0 | 2009-05-25 19:06:16 +0530 | [diff] [blame] | 332 | pr_debug("get/set failure, result=%d\n", result); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 333 | msg->resultcode.data = |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 334 | P80211ENUM_resultcode_implementation_failure; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 335 | } else { |
| 336 | if (isget) { |
| 337 | msg->mibattribute.status = |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 338 | P80211ENUM_msgitem_status_data_ok; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 339 | mibitem->status = |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 340 | P80211ENUM_msgitem_status_data_ok; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 341 | } |
| 342 | } |
| 343 | } |
| 344 | |
| 345 | done: |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 346 | return 0; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 347 | } |
| 348 | |
| 349 | /*---------------------------------------------------------------- |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 350 | * prism2mib_bytearea2pstr |
| 351 | * |
| 352 | * Get/set pstr data to/from a byte area. |
| 353 | * |
| 354 | * MIB record parameters: |
| 355 | * parm1 Prism2 RID value. |
| 356 | * parm2 Number of bytes of RID data. |
| 357 | * parm3 Not used. |
| 358 | * |
| 359 | * Arguments: |
| 360 | * mib MIB record. |
| 361 | * isget MIBGET/MIBSET flag. |
| 362 | * wlandev wlan device structure. |
| 363 | * priv "priv" structure. |
| 364 | * hw "hw" structure. |
| 365 | * msg Message structure. |
| 366 | * data Data buffer. |
| 367 | * |
| 368 | * Returns: |
| 369 | * 0 - Success. |
| 370 | * ~0 - Error. |
| 371 | * |
| 372 | ----------------------------------------------------------------*/ |
| 373 | |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 374 | static int prism2mib_bytearea2pstr(struct mibrec *mib, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 375 | int isget, |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 376 | wlandevice_t *wlandev, |
| 377 | hfa384x_t *hw, |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 378 | struct p80211msg_dot11req_mibset *msg, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 379 | void *data) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 380 | { |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 381 | int result; |
Janani Ravichandran | 0440107 | 2016-02-25 14:13:24 -0500 | [diff] [blame] | 382 | p80211pstrd_t *pstr = data; |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 383 | u8 bytebuf[MIB_TMP_MAXLEN]; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 384 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 385 | if (isget) { |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 386 | result = |
| 387 | hfa384x_drvr_getconfig(hw, mib->parm1, bytebuf, mib->parm2); |
Solomon Peachy | 56afef56 | 2008-10-29 10:43:00 -0400 | [diff] [blame] | 388 | prism2mgmt_bytearea2pstr(bytebuf, pstr, mib->parm2); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 389 | } else { |
| 390 | memset(bytebuf, 0, mib->parm2); |
Bhumika Goyal | 2cfc7ba | 2016-02-13 18:49:34 +0530 | [diff] [blame] | 391 | memcpy(bytebuf, pstr->data, pstr->len); |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 392 | result = |
| 393 | hfa384x_drvr_setconfig(hw, mib->parm1, bytebuf, mib->parm2); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 394 | } |
| 395 | |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 396 | return result; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 397 | } |
| 398 | |
| 399 | /*---------------------------------------------------------------- |
| 400 | * prism2mib_uint32 |
| 401 | * |
| 402 | * Get/set uint32 data. |
| 403 | * |
| 404 | * MIB record parameters: |
| 405 | * parm1 Prism2 RID value. |
| 406 | * parm2 Not used. |
| 407 | * parm3 Not used. |
| 408 | * |
| 409 | * Arguments: |
| 410 | * mib MIB record. |
| 411 | * isget MIBGET/MIBSET flag. |
| 412 | * wlandev wlan device structure. |
| 413 | * priv "priv" structure. |
| 414 | * hw "hw" structure. |
| 415 | * msg Message structure. |
| 416 | * data Data buffer. |
| 417 | * |
| 418 | * Returns: |
| 419 | * 0 - Success. |
| 420 | * ~0 - Error. |
| 421 | * |
| 422 | ----------------------------------------------------------------*/ |
| 423 | |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 424 | static int prism2mib_uint32(struct mibrec *mib, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 425 | int isget, |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 426 | wlandevice_t *wlandev, |
| 427 | hfa384x_t *hw, |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 428 | struct p80211msg_dot11req_mibset *msg, void *data) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 429 | { |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 430 | int result; |
Janani Ravichandran | 3e83b0a | 2016-02-25 14:17:50 -0500 | [diff] [blame] | 431 | u32 *uint32 = data; |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 432 | u8 bytebuf[MIB_TMP_MAXLEN]; |
| 433 | u16 *wordbuf = (u16 *) bytebuf; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 434 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 435 | if (isget) { |
| 436 | result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf); |
| 437 | *uint32 = *wordbuf; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 438 | } else { |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 439 | *wordbuf = *uint32; |
| 440 | result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf); |
| 441 | } |
| 442 | |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 443 | return result; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 444 | } |
| 445 | |
| 446 | /*---------------------------------------------------------------- |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 447 | * prism2mib_flag |
| 448 | * |
| 449 | * Get/set a flag. |
| 450 | * |
| 451 | * MIB record parameters: |
| 452 | * parm1 Prism2 RID value. |
| 453 | * parm2 Bit to get/set. |
| 454 | * parm3 Not used. |
| 455 | * |
| 456 | * Arguments: |
| 457 | * mib MIB record. |
| 458 | * isget MIBGET/MIBSET flag. |
| 459 | * wlandev wlan device structure. |
| 460 | * priv "priv" structure. |
| 461 | * hw "hw" structure. |
| 462 | * msg Message structure. |
| 463 | * data Data buffer. |
| 464 | * |
| 465 | * Returns: |
| 466 | * 0 - Success. |
| 467 | * ~0 - Error. |
| 468 | * |
| 469 | ----------------------------------------------------------------*/ |
| 470 | |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 471 | static int prism2mib_flag(struct mibrec *mib, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 472 | int isget, |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 473 | wlandevice_t *wlandev, |
| 474 | hfa384x_t *hw, |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 475 | struct p80211msg_dot11req_mibset *msg, void *data) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 476 | { |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 477 | int result; |
Janani Ravichandran | 3e83b0a | 2016-02-25 14:17:50 -0500 | [diff] [blame] | 478 | u32 *uint32 = data; |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 479 | u8 bytebuf[MIB_TMP_MAXLEN]; |
| 480 | u16 *wordbuf = (u16 *) bytebuf; |
| 481 | u32 flags; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 482 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 483 | result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf); |
| 484 | if (result == 0) { |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 485 | flags = *wordbuf; |
| 486 | if (isget) { |
| 487 | *uint32 = (flags & mib->parm2) ? |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 488 | P80211ENUM_truth_true : P80211ENUM_truth_false; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 489 | } else { |
| 490 | if ((*uint32) == P80211ENUM_truth_true) |
| 491 | flags |= mib->parm2; |
| 492 | else |
| 493 | flags &= ~mib->parm2; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 494 | *wordbuf = flags; |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 495 | result = |
| 496 | hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 497 | } |
| 498 | } |
| 499 | |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 500 | return result; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 501 | } |
| 502 | |
| 503 | /*---------------------------------------------------------------- |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 504 | * prism2mib_wepdefaultkey |
| 505 | * |
| 506 | * Get/set WEP default keys. |
| 507 | * |
| 508 | * MIB record parameters: |
| 509 | * parm1 Prism2 RID value. |
| 510 | * parm2 Number of bytes of RID data. |
| 511 | * parm3 Not used. |
| 512 | * |
| 513 | * Arguments: |
| 514 | * mib MIB record. |
| 515 | * isget MIBGET/MIBSET flag. |
| 516 | * wlandev wlan device structure. |
| 517 | * priv "priv" structure. |
| 518 | * hw "hw" structure. |
| 519 | * msg Message structure. |
| 520 | * data Data buffer. |
| 521 | * |
| 522 | * Returns: |
| 523 | * 0 - Success. |
| 524 | * ~0 - Error. |
| 525 | * |
| 526 | ----------------------------------------------------------------*/ |
| 527 | |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 528 | static int prism2mib_wepdefaultkey(struct mibrec *mib, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 529 | int isget, |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 530 | wlandevice_t *wlandev, |
| 531 | hfa384x_t *hw, |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 532 | struct p80211msg_dot11req_mibset *msg, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 533 | void *data) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 534 | { |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 535 | int result; |
Janani Ravichandran | 3e83b0a | 2016-02-25 14:17:50 -0500 | [diff] [blame] | 536 | p80211pstrd_t *pstr = data; |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 537 | u8 bytebuf[MIB_TMP_MAXLEN]; |
| 538 | u16 len; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 539 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 540 | if (isget) { |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 541 | result = 0; /* Should never happen. */ |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 542 | } else { |
| 543 | len = (pstr->len > 5) ? HFA384x_RID_CNFWEP128DEFAULTKEY_LEN : |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 544 | HFA384x_RID_CNFWEPDEFAULTKEY_LEN; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 545 | memset(bytebuf, 0, len); |
Bhumika Goyal | 2cfc7ba | 2016-02-13 18:49:34 +0530 | [diff] [blame] | 546 | memcpy(bytebuf, pstr->data, pstr->len); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 547 | result = hfa384x_drvr_setconfig(hw, mib->parm1, bytebuf, len); |
| 548 | } |
| 549 | |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 550 | return result; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 551 | } |
| 552 | |
| 553 | /*---------------------------------------------------------------- |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 554 | * prism2mib_privacyinvoked |
| 555 | * |
| 556 | * Get/set the dot11PrivacyInvoked value. |
| 557 | * |
| 558 | * MIB record parameters: |
| 559 | * parm1 Prism2 RID value. |
| 560 | * parm2 Bit value for PrivacyInvoked flag. |
| 561 | * parm3 Not used. |
| 562 | * |
| 563 | * Arguments: |
| 564 | * mib MIB record. |
| 565 | * isget MIBGET/MIBSET flag. |
| 566 | * wlandev wlan device structure. |
| 567 | * priv "priv" structure. |
| 568 | * hw "hw" structure. |
| 569 | * msg Message structure. |
| 570 | * data Data buffer. |
| 571 | * |
| 572 | * Returns: |
| 573 | * 0 - Success. |
| 574 | * ~0 - Error. |
| 575 | * |
| 576 | ----------------------------------------------------------------*/ |
| 577 | |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 578 | static int prism2mib_privacyinvoked(struct mibrec *mib, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 579 | int isget, |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 580 | wlandevice_t *wlandev, |
| 581 | hfa384x_t *hw, |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 582 | struct p80211msg_dot11req_mibset *msg, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 583 | void *data) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 584 | { |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 585 | if (wlandev->hostwep & HOSTWEP_DECRYPT) { |
| 586 | if (wlandev->hostwep & HOSTWEP_DECRYPT) |
| 587 | mib->parm2 |= HFA384x_WEPFLAGS_DISABLE_RXCRYPT; |
| 588 | if (wlandev->hostwep & HOSTWEP_ENCRYPT) |
| 589 | mib->parm2 |= HFA384x_WEPFLAGS_DISABLE_TXCRYPT; |
| 590 | } |
| 591 | |
Aya Mahfouz | c732041 | 2015-02-27 14:50:34 +0200 | [diff] [blame] | 592 | return prism2mib_flag(mib, isget, wlandev, hw, msg, data); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 593 | } |
| 594 | |
| 595 | /*---------------------------------------------------------------- |
| 596 | * prism2mib_excludeunencrypted |
| 597 | * |
| 598 | * Get/set the dot11ExcludeUnencrypted value. |
| 599 | * |
| 600 | * MIB record parameters: |
| 601 | * parm1 Prism2 RID value. |
| 602 | * parm2 Bit value for ExcludeUnencrypted flag. |
| 603 | * parm3 Not used. |
| 604 | * |
| 605 | * Arguments: |
| 606 | * mib MIB record. |
| 607 | * isget MIBGET/MIBSET flag. |
| 608 | * wlandev wlan device structure. |
| 609 | * priv "priv" structure. |
| 610 | * hw "hw" structure. |
| 611 | * msg Message structure. |
| 612 | * data Data buffer. |
| 613 | * |
| 614 | * Returns: |
| 615 | * 0 - Success. |
| 616 | * ~0 - Error. |
| 617 | * |
| 618 | ----------------------------------------------------------------*/ |
| 619 | |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 620 | static int prism2mib_excludeunencrypted(struct mibrec *mib, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 621 | int isget, |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 622 | wlandevice_t *wlandev, |
| 623 | hfa384x_t *hw, |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 624 | struct p80211msg_dot11req_mibset *msg, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 625 | void *data) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 626 | { |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 627 | |
Aya Mahfouz | c732041 | 2015-02-27 14:50:34 +0200 | [diff] [blame] | 628 | return prism2mib_flag(mib, isget, wlandev, hw, msg, data); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 629 | } |
| 630 | |
| 631 | /*---------------------------------------------------------------- |
| 632 | * prism2mib_fragmentationthreshold |
| 633 | * |
| 634 | * Get/set the fragmentation threshold. |
| 635 | * |
| 636 | * MIB record parameters: |
| 637 | * parm1 Prism2 RID value. |
| 638 | * parm2 Not used. |
| 639 | * parm3 Not used. |
| 640 | * |
| 641 | * Arguments: |
| 642 | * mib MIB record. |
| 643 | * isget MIBGET/MIBSET flag. |
| 644 | * wlandev wlan device structure. |
| 645 | * priv "priv" structure. |
| 646 | * hw "hw" structure. |
| 647 | * msg Message structure. |
| 648 | * data Data buffer. |
| 649 | * |
| 650 | * Returns: |
| 651 | * 0 - Success. |
| 652 | * ~0 - Error. |
| 653 | * |
| 654 | ----------------------------------------------------------------*/ |
| 655 | |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 656 | static int prism2mib_fragmentationthreshold(struct mibrec *mib, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 657 | int isget, |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 658 | wlandevice_t *wlandev, |
| 659 | hfa384x_t *hw, |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 660 | struct p80211msg_dot11req_mibset *msg, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 661 | void *data) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 662 | { |
Janani Ravichandran | 3e83b0a | 2016-02-25 14:17:50 -0500 | [diff] [blame] | 663 | u32 *uint32 = data; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 664 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 665 | if (!isget) |
| 666 | if ((*uint32) % 2) { |
Johannes Stadlinger | 5a69d92 | 2014-06-19 21:20:16 +0200 | [diff] [blame] | 667 | netdev_warn(wlandev->netdev, |
| 668 | "Attempt to set odd number FragmentationThreshold\n"); |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 669 | msg->resultcode.data = |
| 670 | P80211ENUM_resultcode_not_supported; |
| 671 | return 0; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 672 | } |
| 673 | |
Amitoj Kaur Chawla | d4f8455 | 2015-10-31 15:49:29 +0530 | [diff] [blame] | 674 | return prism2mib_uint32(mib, isget, wlandev, hw, msg, data); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 675 | } |
| 676 | |
| 677 | /*---------------------------------------------------------------- |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 678 | * prism2mib_priv |
| 679 | * |
| 680 | * Get/set values in the "priv" data structure. |
| 681 | * |
| 682 | * MIB record parameters: |
| 683 | * parm1 Not used. |
| 684 | * parm2 Not used. |
| 685 | * parm3 Not used. |
| 686 | * |
| 687 | * Arguments: |
| 688 | * mib MIB record. |
| 689 | * isget MIBGET/MIBSET flag. |
| 690 | * wlandev wlan device structure. |
| 691 | * priv "priv" structure. |
| 692 | * hw "hw" structure. |
| 693 | * msg Message structure. |
| 694 | * data Data buffer. |
| 695 | * |
| 696 | * Returns: |
| 697 | * 0 - Success. |
| 698 | * ~0 - Error. |
| 699 | * |
| 700 | ----------------------------------------------------------------*/ |
| 701 | |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 702 | static int prism2mib_priv(struct mibrec *mib, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 703 | int isget, |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 704 | wlandevice_t *wlandev, |
| 705 | hfa384x_t *hw, |
Edgardo Hames | b6bb56e | 2010-08-02 16:20:39 -0300 | [diff] [blame] | 706 | struct p80211msg_dot11req_mibset *msg, void *data) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 707 | { |
Janani Ravichandran | 3e83b0a | 2016-02-25 14:17:50 -0500 | [diff] [blame] | 708 | p80211pstrd_t *pstr = data; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 709 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 710 | switch (mib->did) { |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 711 | case DIDmib_lnx_lnxConfigTable_lnxRSNAIE:{ |
| 712 | hfa384x_WPAData_t wpa; |
Modestas Stankus | 6f8eee6 | 2014-07-31 22:04:32 +0300 | [diff] [blame] | 713 | |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 714 | if (isget) { |
| 715 | hfa384x_drvr_getconfig(hw, |
| 716 | HFA384x_RID_CNFWPADATA, |
Svenne Krap | 5dd8acc | 2010-02-14 18:59:00 +0100 | [diff] [blame] | 717 | (u8 *) &wpa, |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 718 | sizeof(wpa)); |
Moritz Muehlenhoff | 18c7f79 | 2009-02-18 19:50:07 +0100 | [diff] [blame] | 719 | pstr->len = le16_to_cpu(wpa.datalen); |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 720 | memcpy(pstr->data, wpa.data, pstr->len); |
| 721 | } else { |
Moritz Muehlenhoff | 18c7f79 | 2009-02-18 19:50:07 +0100 | [diff] [blame] | 722 | wpa.datalen = cpu_to_le16(pstr->len); |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 723 | memcpy(wpa.data, pstr->data, pstr->len); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 724 | |
Grzegorz Swirski | 9b4c8cf | 2014-09-20 12:09:11 +0100 | [diff] [blame] | 725 | hfa384x_drvr_setconfig(hw, |
| 726 | HFA384x_RID_CNFWPADATA, |
| 727 | (u8 *) &wpa, |
| 728 | sizeof(wpa)); |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 729 | } |
| 730 | break; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 731 | } |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 732 | default: |
Vitaly Osipov | 02d9b1e | 2014-05-18 16:59:36 +1000 | [diff] [blame] | 733 | netdev_err(wlandev->netdev, "Unhandled DID 0x%08x\n", mib->did); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 734 | } |
| 735 | |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 736 | return 0; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 737 | } |
| 738 | |
| 739 | /*---------------------------------------------------------------- |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 740 | * prism2mgmt_pstr2bytestr |
| 741 | * |
| 742 | * Convert the pstr data in the WLAN message structure into an hfa384x |
| 743 | * byte string format. |
| 744 | * |
| 745 | * Arguments: |
| 746 | * bytestr hfa384x byte string data type |
| 747 | * pstr wlan message data |
| 748 | * |
| 749 | * Returns: |
| 750 | * Nothing |
| 751 | * |
| 752 | ----------------------------------------------------------------*/ |
| 753 | |
Himangi Saraogi | b211991 | 2013-11-02 18:11:44 +0530 | [diff] [blame] | 754 | void prism2mgmt_pstr2bytestr(struct hfa384x_bytestr *bytestr, |
| 755 | p80211pstrd_t *pstr) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 756 | { |
Moritz Muehlenhoff | 18c7f79 | 2009-02-18 19:50:07 +0100 | [diff] [blame] | 757 | bytestr->len = cpu_to_le16((u16) (pstr->len)); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 758 | memcpy(bytestr->data, pstr->data, pstr->len); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 759 | } |
| 760 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 761 | /*---------------------------------------------------------------- |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 762 | * prism2mgmt_bytestr2pstr |
| 763 | * |
| 764 | * Convert the data in an hfa384x byte string format into a |
| 765 | * pstr in the WLAN message. |
| 766 | * |
| 767 | * Arguments: |
| 768 | * bytestr hfa384x byte string data type |
| 769 | * msg wlan message |
| 770 | * |
| 771 | * Returns: |
| 772 | * Nothing |
| 773 | * |
| 774 | ----------------------------------------------------------------*/ |
| 775 | |
Himangi Saraogi | b211991 | 2013-11-02 18:11:44 +0530 | [diff] [blame] | 776 | void prism2mgmt_bytestr2pstr(struct hfa384x_bytestr *bytestr, |
| 777 | p80211pstrd_t *pstr) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 778 | { |
Moritz Muehlenhoff | 18c7f79 | 2009-02-18 19:50:07 +0100 | [diff] [blame] | 779 | pstr->len = (u8) (le16_to_cpu((u16) (bytestr->len))); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 780 | memcpy(pstr->data, bytestr->data, pstr->len); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 781 | } |
| 782 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 783 | /*---------------------------------------------------------------- |
| 784 | * prism2mgmt_bytearea2pstr |
| 785 | * |
| 786 | * Convert the data in an hfa384x byte area format into a pstr |
| 787 | * in the WLAN message. |
| 788 | * |
| 789 | * Arguments: |
| 790 | * bytearea hfa384x byte area data type |
| 791 | * msg wlan message |
| 792 | * |
| 793 | * Returns: |
| 794 | * Nothing |
| 795 | * |
| 796 | ----------------------------------------------------------------*/ |
| 797 | |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 798 | void prism2mgmt_bytearea2pstr(u8 *bytearea, p80211pstrd_t *pstr, int len) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 799 | { |
Moritz Muehlenhoff | ec7466f | 2009-02-08 02:21:03 +0100 | [diff] [blame] | 800 | pstr->len = (u8) len; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 801 | memcpy(pstr->data, bytearea, len); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 802 | } |