0001
0002
0003
0004
0005
0006 #ifndef _LBS_DEFS_H_
0007 #define _LBS_DEFS_H_
0008
0009 #include <linux/spinlock.h>
0010
0011 #ifdef CONFIG_LIBERTAS_DEBUG
0012 #define DEBUG
0013 #define PROC_DEBUG
0014 #endif
0015
0016 #ifndef DRV_NAME
0017 #define DRV_NAME "libertas"
0018 #endif
0019
0020
0021 #define LBS_DEB_ENTER 0x00000001
0022 #define LBS_DEB_LEAVE 0x00000002
0023 #define LBS_DEB_MAIN 0x00000004
0024 #define LBS_DEB_NET 0x00000008
0025 #define LBS_DEB_MESH 0x00000010
0026 #define LBS_DEB_WEXT 0x00000020
0027 #define LBS_DEB_IOCTL 0x00000040
0028 #define LBS_DEB_SCAN 0x00000080
0029 #define LBS_DEB_ASSOC 0x00000100
0030 #define LBS_DEB_JOIN 0x00000200
0031 #define LBS_DEB_11D 0x00000400
0032 #define LBS_DEB_DEBUGFS 0x00000800
0033 #define LBS_DEB_ETHTOOL 0x00001000
0034 #define LBS_DEB_HOST 0x00002000
0035 #define LBS_DEB_CMD 0x00004000
0036 #define LBS_DEB_RX 0x00008000
0037 #define LBS_DEB_TX 0x00010000
0038 #define LBS_DEB_USB 0x00020000
0039 #define LBS_DEB_CS 0x00040000
0040 #define LBS_DEB_FW 0x00080000
0041 #define LBS_DEB_THREAD 0x00100000
0042 #define LBS_DEB_HEX 0x00200000
0043 #define LBS_DEB_SDIO 0x00400000
0044 #define LBS_DEB_SYSFS 0x00800000
0045 #define LBS_DEB_SPI 0x01000000
0046 #define LBS_DEB_CFG80211 0x02000000
0047
0048 extern unsigned int lbs_debug;
0049
0050 #ifdef DEBUG
0051 #define LBS_DEB_LL(grp, grpnam, fmt, args...) \
0052 do { if ((lbs_debug & (grp)) == (grp)) \
0053 printk(KERN_DEBUG DRV_NAME grpnam ": " fmt, ## args); } while (0)
0054 #else
0055 #define LBS_DEB_LL(grp, grpnam, fmt, args...) do {} while (0)
0056 #endif
0057
0058 #define lbs_deb_main(fmt, args...) LBS_DEB_LL(LBS_DEB_MAIN, " main", fmt, ##args)
0059 #define lbs_deb_net(fmt, args...) LBS_DEB_LL(LBS_DEB_NET, " net", fmt, ##args)
0060 #define lbs_deb_mesh(fmt, args...) LBS_DEB_LL(LBS_DEB_MESH, " mesh", fmt, ##args)
0061 #define lbs_deb_wext(fmt, args...) LBS_DEB_LL(LBS_DEB_WEXT, " wext", fmt, ##args)
0062 #define lbs_deb_ioctl(fmt, args...) LBS_DEB_LL(LBS_DEB_IOCTL, " ioctl", fmt, ##args)
0063 #define lbs_deb_scan(fmt, args...) LBS_DEB_LL(LBS_DEB_SCAN, " scan", fmt, ##args)
0064 #define lbs_deb_assoc(fmt, args...) LBS_DEB_LL(LBS_DEB_ASSOC, " assoc", fmt, ##args)
0065 #define lbs_deb_join(fmt, args...) LBS_DEB_LL(LBS_DEB_JOIN, " join", fmt, ##args)
0066 #define lbs_deb_11d(fmt, args...) LBS_DEB_LL(LBS_DEB_11D, " 11d", fmt, ##args)
0067 #define lbs_deb_debugfs(fmt, args...) LBS_DEB_LL(LBS_DEB_DEBUGFS, " debugfs", fmt, ##args)
0068 #define lbs_deb_ethtool(fmt, args...) LBS_DEB_LL(LBS_DEB_ETHTOOL, " ethtool", fmt, ##args)
0069 #define lbs_deb_host(fmt, args...) LBS_DEB_LL(LBS_DEB_HOST, " host", fmt, ##args)
0070 #define lbs_deb_cmd(fmt, args...) LBS_DEB_LL(LBS_DEB_CMD, " cmd", fmt, ##args)
0071 #define lbs_deb_rx(fmt, args...) LBS_DEB_LL(LBS_DEB_RX, " rx", fmt, ##args)
0072 #define lbs_deb_tx(fmt, args...) LBS_DEB_LL(LBS_DEB_TX, " tx", fmt, ##args)
0073 #define lbs_deb_fw(fmt, args...) LBS_DEB_LL(LBS_DEB_FW, " fw", fmt, ##args)
0074 #define lbs_deb_usb(fmt, args...) LBS_DEB_LL(LBS_DEB_USB, " usb", fmt, ##args)
0075 #define lbs_deb_usbd(dev, fmt, args...) LBS_DEB_LL(LBS_DEB_USB, " usbd", "%s:" fmt, dev_name(dev), ##args)
0076 #define lbs_deb_cs(fmt, args...) LBS_DEB_LL(LBS_DEB_CS, " cs", fmt, ##args)
0077 #define lbs_deb_thread(fmt, args...) LBS_DEB_LL(LBS_DEB_THREAD, " thread", fmt, ##args)
0078 #define lbs_deb_sdio(fmt, args...) LBS_DEB_LL(LBS_DEB_SDIO, " sdio", fmt, ##args)
0079 #define lbs_deb_sysfs(fmt, args...) LBS_DEB_LL(LBS_DEB_SYSFS, " sysfs", fmt, ##args)
0080 #define lbs_deb_spi(fmt, args...) LBS_DEB_LL(LBS_DEB_SPI, " spi", fmt, ##args)
0081 #define lbs_deb_cfg80211(fmt, args...) LBS_DEB_LL(LBS_DEB_CFG80211, " cfg80211", fmt, ##args)
0082
0083 #ifdef DEBUG
0084 static inline void lbs_deb_hex(unsigned int grp, const char *prompt,
0085 const u8 *buf, int len)
0086 {
0087 int i = 0;
0088
0089 if (len &&
0090 (lbs_debug & LBS_DEB_HEX) &&
0091 (lbs_debug & grp))
0092 {
0093 for (i = 1; i <= len; i++) {
0094 if ((i & 0xf) == 1) {
0095 if (i != 1)
0096 printk("\n");
0097 printk(DRV_NAME " %s: ", prompt);
0098 }
0099 printk("%02x ", (u8) * buf);
0100 buf++;
0101 }
0102 printk("\n");
0103 }
0104 }
0105 #else
0106 #define lbs_deb_hex(grp,prompt,buf,len) do {} while (0)
0107 #endif
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125 #define MRVDRV_MAX_MULTICAST_LIST_SIZE 32
0126 #define LBS_NUM_CMD_BUFFERS 10
0127 #define LBS_CMD_BUFFER_SIZE (2 * 1024)
0128 #define MRVDRV_MAX_CHANNEL_SIZE 14
0129 #define MRVDRV_ASSOCIATION_TIME_OUT 255
0130 #define MRVDRV_SNAP_HEADER_LEN 8
0131
0132 #define LBS_UPLD_SIZE 2312
0133 #define DEV_NAME_LEN 32
0134
0135
0136 #define EHS_WAKE_ON_BROADCAST_DATA 0x0001
0137 #define EHS_WAKE_ON_UNICAST_DATA 0x0002
0138 #define EHS_WAKE_ON_MAC_EVENT 0x0004
0139 #define EHS_WAKE_ON_MULTICAST_DATA 0x0008
0140 #define EHS_REMOVE_WAKEUP 0xFFFFFFFF
0141
0142 #define WOL_RULE_NET_TYPE_INFRA_OR_IBSS 0x00
0143 #define WOL_RULE_NET_TYPE_MESH 0x10
0144 #define WOL_RULE_ADDR_TYPE_BCAST 0x01
0145 #define WOL_RULE_ADDR_TYPE_MCAST 0x08
0146 #define WOL_RULE_ADDR_TYPE_UCAST 0x02
0147 #define WOL_RULE_OP_AND 0x01
0148 #define WOL_RULE_OP_OR 0x02
0149 #define WOL_RULE_OP_INVALID 0xFF
0150 #define WOL_RESULT_VALID_CMD 0
0151 #define WOL_RESULT_NOSPC_ERR 1
0152 #define WOL_RESULT_EEXIST_ERR 2
0153
0154
0155
0156
0157 #define MRVDRV_MAX_BSS_DESCRIPTS 16
0158 #define MRVDRV_MAX_REGION_CODE 6
0159
0160 #define MRVDRV_DEFAULT_LISTEN_INTERVAL 10
0161
0162 #define MRVDRV_CHANNELS_PER_SCAN 4
0163 #define MRVDRV_MAX_CHANNELS_PER_SCAN 14
0164
0165 #define MRVDRV_MIN_BEACON_INTERVAL 20
0166 #define MRVDRV_MAX_BEACON_INTERVAL 1000
0167 #define MRVDRV_BEACON_INTERVAL 100
0168
0169 #define MARVELL_MESH_IE_LENGTH 9
0170
0171
0172
0173
0174
0175 #define MARVELL_MESH_IE_TYPE 4
0176 #define MARVELL_MESH_IE_SUBTYPE 0
0177 #define MARVELL_MESH_IE_VERSION 0
0178 #define MARVELL_MESH_PROTO_ID_HWMP 0
0179 #define MARVELL_MESH_METRIC_ID 0
0180 #define MARVELL_MESH_CAPABILITY 0
0181
0182
0183 #define MRVDRV_TX_DNLD_RDY 0x0001
0184 #define MRVDRV_RX_UPLD_RDY 0x0002
0185 #define MRVDRV_CMD_DNLD_RDY 0x0004
0186 #define MRVDRV_CMD_UPLD_RDY 0x0008
0187 #define MRVDRV_CARDEVENT 0x0010
0188
0189
0190 #define POW_ADAPT_DEFAULT_P0 13
0191 #define POW_ADAPT_DEFAULT_P1 15
0192 #define POW_ADAPT_DEFAULT_P2 18
0193 #define TPC_DEFAULT_P0 5
0194 #define TPC_DEFAULT_P1 10
0195 #define TPC_DEFAULT_P2 13
0196
0197
0198
0199
0200
0201
0202
0203
0204 #define MRVDRV_TxPD_POWER_MGMT_NULL_PACKET 0x01
0205 #define MRVDRV_TxPD_POWER_MGMT_LAST_PACKET 0x08
0206
0207
0208
0209
0210
0211
0212 #define TxPD_CONTROL_WDS_FRAME (1<<17)
0213 #define TxPD_MESH_FRAME TxPD_CONTROL_WDS_FRAME
0214
0215
0216 #define MESH_IFACE_ID 0x0001
0217
0218 #define MESH_IFACE_BIT_OFFSET 0x000c
0219
0220 #define MESH_CAPINFO_ENABLE_MASK (1<<16)
0221
0222
0223 #define MRVL_FW_V4 (0x04)
0224
0225 #define MRVL_FW_V5 (0x05)
0226
0227 #define MRVL_FW_V10 (0x0a)
0228
0229 #define MRVL_FW_MAJOR_REV(x) ((x)>>24)
0230
0231
0232
0233 #define MRVDRV_RXPD_STATUS_OK 0x0001
0234
0235
0236
0237
0238
0239
0240
0241 #define RxPD_CONTROL_WDS_FRAME (0x40)
0242 #define RxPD_MESH_FRAME RxPD_CONTROL_WDS_FRAME
0243
0244
0245
0246
0247
0248
0249
0250
0251 #define MRVDRV_NF_DEFAULT_SCAN_VALUE (-96)
0252
0253
0254 #define MRVDRV_RTS_MIN_VALUE 0
0255 #define MRVDRV_RTS_MAX_VALUE 2347
0256 #define MRVDRV_FRAG_MIN_VALUE 256
0257 #define MRVDRV_FRAG_MAX_VALUE 2346
0258
0259
0260 #define EXTRA_LEN 36
0261
0262 #define MRVDRV_ETH_TX_PACKET_BUFFER_SIZE \
0263 (ETH_FRAME_LEN + sizeof(struct txpd) + EXTRA_LEN)
0264
0265 #define MRVDRV_ETH_RX_PACKET_BUFFER_SIZE \
0266 (ETH_FRAME_LEN + sizeof(struct rxpd) \
0267 + MRVDRV_SNAP_HEADER_LEN + EXTRA_LEN)
0268
0269 #define CMD_F_HOSTCMD (1 << 0)
0270 #define FW_CAPINFO_WPA (1 << 0)
0271 #define FW_CAPINFO_PS (1 << 1)
0272 #define FW_CAPINFO_FIRMWARE_UPGRADE (1 << 13)
0273 #define FW_CAPINFO_BOOT2_UPGRADE (1<<14)
0274 #define FW_CAPINFO_PERSISTENT_CONFIG (1<<15)
0275
0276 #define KEY_LEN_WPA_AES 16
0277 #define KEY_LEN_WPA_TKIP 32
0278 #define KEY_LEN_WEP_104 13
0279 #define KEY_LEN_WEP_40 5
0280
0281 #define RF_ANTENNA_1 0x1
0282 #define RF_ANTENNA_2 0x2
0283 #define RF_ANTENNA_AUTO 0xFFFF
0284
0285 #define BAND_B (0x01)
0286 #define BAND_G (0x02)
0287 #define ALL_802_11_BANDS (BAND_B | BAND_G)
0288
0289 #define MAX_RATES 14
0290
0291 #define MAX_LEDS 8
0292
0293
0294 extern const char lbs_driver_version[];
0295 extern u16 lbs_region_code_to_index[MRVDRV_MAX_REGION_CODE];
0296
0297
0298
0299
0300 enum SNRNF_TYPE {
0301 TYPE_BEACON = 0,
0302 TYPE_RXPD,
0303 MAX_TYPE_B
0304 };
0305
0306
0307 enum SNRNF_DATA {
0308 TYPE_NOAVG = 0,
0309 TYPE_AVG,
0310 MAX_TYPE_AVG
0311 };
0312
0313
0314 enum LBS_802_11_POWER_MODE {
0315 LBS802_11POWERMODECAM,
0316 LBS802_11POWERMODEMAX_PSP,
0317 LBS802_11POWERMODEFAST_PSP,
0318
0319 LBS802_11POWEMODEMAX
0320 };
0321
0322
0323 enum PS_STATE {
0324 PS_STATE_FULL_POWER,
0325 PS_STATE_AWAKE,
0326 PS_STATE_PRE_SLEEP,
0327 PS_STATE_SLEEP
0328 };
0329
0330
0331 enum DNLD_STATE {
0332 DNLD_RES_RECEIVED,
0333 DNLD_DATA_SENT,
0334 DNLD_CMD_SENT,
0335 DNLD_BOOTCMD_SENT,
0336 };
0337
0338
0339 enum LBS_MEDIA_STATE {
0340 LBS_CONNECTED,
0341 LBS_DISCONNECTED
0342 };
0343
0344
0345 enum LBS_802_11_PRIVACY_FILTER {
0346 LBS802_11PRIVFILTERACCEPTALL,
0347 LBS802_11PRIVFILTER8021XWEP
0348 };
0349
0350
0351 enum mv_ms_type {
0352 MVMS_DAT = 0,
0353 MVMS_CMD = 1,
0354 MVMS_TXDONE = 2,
0355 MVMS_EVENT
0356 };
0357
0358
0359 enum KEY_TYPE_ID {
0360 KEY_TYPE_ID_WEP = 0,
0361 KEY_TYPE_ID_TKIP,
0362 KEY_TYPE_ID_AES
0363 };
0364
0365
0366 enum KEY_INFO_WPA {
0367 KEY_INFO_WPA_MCAST = 0x01,
0368 KEY_INFO_WPA_UNICAST = 0x02,
0369 KEY_INFO_WPA_ENABLED = 0x04
0370 };
0371
0372
0373 #define FWT_DEFAULT_METRIC 0
0374 #define FWT_DEFAULT_DIR 1
0375
0376 #define FWT_DEFAULT_RATE 3
0377 #define FWT_DEFAULT_SSN 0xffffffff
0378 #define FWT_DEFAULT_DSN 0
0379 #define FWT_DEFAULT_HOPCOUNT 0
0380 #define FWT_DEFAULT_TTL 0
0381 #define FWT_DEFAULT_EXPIRATION 0
0382 #define FWT_DEFAULT_SLEEPMODE 0
0383 #define FWT_DEFAULT_SNR 0
0384
0385 #endif