xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/ath/ath6kl/common.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Copyright (c) 2010-2011 Atheros Communications Inc.
3*4882a593Smuzhiyun  * Copyright (c) 2011-2012 Qualcomm Atheros, Inc.
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * Permission to use, copy, modify, and/or distribute this software for any
6*4882a593Smuzhiyun  * purpose with or without fee is hereby granted, provided that the above
7*4882a593Smuzhiyun  * copyright notice and this permission notice appear in all copies.
8*4882a593Smuzhiyun  *
9*4882a593Smuzhiyun  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10*4882a593Smuzhiyun  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11*4882a593Smuzhiyun  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12*4882a593Smuzhiyun  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13*4882a593Smuzhiyun  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14*4882a593Smuzhiyun  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15*4882a593Smuzhiyun  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16*4882a593Smuzhiyun  */
17*4882a593Smuzhiyun 
18*4882a593Smuzhiyun #ifndef COMMON_H
19*4882a593Smuzhiyun #define COMMON_H
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun #include <linux/netdevice.h>
22*4882a593Smuzhiyun 
23*4882a593Smuzhiyun #define ATH6KL_MAX_IE			256
24*4882a593Smuzhiyun 
25*4882a593Smuzhiyun __printf(2, 3) void ath6kl_printk(const char *level, const char *fmt, ...);
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun /*
28*4882a593Smuzhiyun  * Reflects the version of binary interface exposed by ATH6KL target
29*4882a593Smuzhiyun  * firmware. Needs to be incremented by 1 for any change in the firmware
30*4882a593Smuzhiyun  * that requires upgrade of the driver on the host side for the change to
31*4882a593Smuzhiyun  * work correctly
32*4882a593Smuzhiyun  */
33*4882a593Smuzhiyun #define ATH6KL_ABI_VERSION        1
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun #define SIGNAL_QUALITY_METRICS_NUM_MAX    2
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun enum {
38*4882a593Smuzhiyun 	SIGNAL_QUALITY_METRICS_SNR = 0,
39*4882a593Smuzhiyun 	SIGNAL_QUALITY_METRICS_RSSI,
40*4882a593Smuzhiyun 	SIGNAL_QUALITY_METRICS_ALL,
41*4882a593Smuzhiyun };
42*4882a593Smuzhiyun 
43*4882a593Smuzhiyun /*
44*4882a593Smuzhiyun  * Data Path
45*4882a593Smuzhiyun  */
46*4882a593Smuzhiyun 
47*4882a593Smuzhiyun #define WMI_MAX_TX_DATA_FRAME_LENGTH	      \
48*4882a593Smuzhiyun 	(1500 + sizeof(struct wmi_data_hdr) + \
49*4882a593Smuzhiyun 	 sizeof(struct ethhdr) +      \
50*4882a593Smuzhiyun 	 sizeof(struct ath6kl_llc_snap_hdr))
51*4882a593Smuzhiyun 
52*4882a593Smuzhiyun /* An AMSDU frame */ /* The MAX AMSDU length of AR6003 is 3839 */
53*4882a593Smuzhiyun #define WMI_MAX_AMSDU_RX_DATA_FRAME_LENGTH    \
54*4882a593Smuzhiyun 	(3840 + sizeof(struct wmi_data_hdr) + \
55*4882a593Smuzhiyun 	 sizeof(struct ethhdr) +      \
56*4882a593Smuzhiyun 	 sizeof(struct ath6kl_llc_snap_hdr))
57*4882a593Smuzhiyun 
58*4882a593Smuzhiyun #define EPPING_ALIGNMENT_PAD			       \
59*4882a593Smuzhiyun 	(((sizeof(struct htc_frame_hdr) + 3) & (~0x3)) \
60*4882a593Smuzhiyun 	 - sizeof(struct htc_frame_hdr))
61*4882a593Smuzhiyun 
62*4882a593Smuzhiyun struct ath6kl_llc_snap_hdr {
63*4882a593Smuzhiyun 	u8 dsap;
64*4882a593Smuzhiyun 	u8 ssap;
65*4882a593Smuzhiyun 	u8 cntl;
66*4882a593Smuzhiyun 	u8 org_code[3];
67*4882a593Smuzhiyun 	__be16 eth_type;
68*4882a593Smuzhiyun } __packed;
69*4882a593Smuzhiyun 
70*4882a593Smuzhiyun enum ath6kl_crypto_type {
71*4882a593Smuzhiyun 	NONE_CRYPT          = 0x01,
72*4882a593Smuzhiyun 	WEP_CRYPT           = 0x02,
73*4882a593Smuzhiyun 	TKIP_CRYPT          = 0x04,
74*4882a593Smuzhiyun 	AES_CRYPT           = 0x08,
75*4882a593Smuzhiyun 	WAPI_CRYPT          = 0x10,
76*4882a593Smuzhiyun };
77*4882a593Smuzhiyun 
78*4882a593Smuzhiyun struct htc_endpoint_credit_dist;
79*4882a593Smuzhiyun struct ath6kl;
80*4882a593Smuzhiyun struct ath6kl_htcap;
81*4882a593Smuzhiyun enum htc_credit_dist_reason;
82*4882a593Smuzhiyun struct ath6kl_htc_credit_info;
83*4882a593Smuzhiyun 
84*4882a593Smuzhiyun struct sk_buff *ath6kl_buf_alloc(int size);
85*4882a593Smuzhiyun #endif /* COMMON_H */
86