• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef AGNX_STA_H_
2 #define AGNX_STA_H_
3 
4 #define STA_TX_WQ_NUM	8	/* The number of TX workqueue one STA has */
5 
6 struct agnx_hash_cmd {
7 	__be32 cmdhi;
8 #define MACLO		0xFFFF0000
9 #define MACLO_SHIFT	16
10 #define STA_ID		0x0000FFF0
11 #define STA_ID_SHIFT	4
12 #define CMD		0x0000000C
13 #define CMD_SHIFT	2
14 #define STATUS		0x00000002
15 #define STATUS_SHIFT	1
16 #define PASS		0x00000001
17 #define PASS_SHIFT	1
18 	__be32 cmdlo;
19 }__attribute__((__packed__));
20 
21 
22 /*
23  * Station Power Template
24  * FIXME Just for agn100 yet
25  */
26 struct agnx_sta_power {
27 	__le32 reg;
28 #define SIGNAL			0x000000FF /* signal */
29 #define SIGNAL_SHIFT		0
30 #define RATE			0x00000F00
31 #define RATE_SHIFT		8
32 #define TIFS			0x00001000
33 #define TIFS_SHIFT		12
34 #define EDCF			0x00002000
35 #define EDCF_SHIFT		13
36 #define CHANNEL_BOND		0x00004000
37 #define CHANNEL_BOND_SHIFT	14
38 #define PHY_MODE		0x00038000
39 #define PHY_MODE_SHIFT		15
40 #define POWER_LEVEL		0x007C0000
41 #define POWER_LEVEL_SHIFT	18
42 #define NUM_TRANSMITTERS	0x00800000
43 #define NUM_TRANSMITTERS_SHIFT	23
44 } __attribute__((__packed__));
45 
46 /*
47  * TX Workqueue Descriptor
48  */
49 struct agnx_sta_tx_wq {
50 	__le32 reg0;
51 #define HEAD_POINTER_LOW	0xFF000000 /* Head pointer low */
52 #define HEAD_POINTER_LOW_SHIFT	24
53 #define TAIL_POINTER		0x00FFFFFF /* Tail pointer */
54 #define TAIL_POINTER_SHIFT	0
55 
56 	__le32 reg3;
57 #define ACK_POINTER_LOW	        0xFFFF0000	/* ACK pointer low */
58 #define ACK_POINTER_LOW_SHIFT	16
59 #define HEAD_POINTER_HIGH	0x0000FFFF	/* Head pointer high */
60 #define HEAD_POINTER_HIGH_SHIFT	0
61 
62 	__le32 reg1;
63 /* ACK timeout tail packet count */
64 #define ACK_TIMOUT_TAIL_PACK_CNT	0xFFF00000
65 #define ACK_TIMOUT_TAIL_PACK_CNT_SHIFT	20
66 /* Head timeout tail packet count */
67 #define HEAD_TIMOUT_TAIL_PACK_CNT	0x000FFF00
68 #define HEAD_TIMOUT_TAIL_PACK_CNT_SHIFT	8
69 #define ACK_POINTER_HIGH	        0x000000FF /* ACK pointer high */
70 #define ACK_POINTER_HIGH_SHIFT		0
71 
72 	__le32 reg2;
73 #define WORK_QUEUE_VALID		0x80000000 /* valid */
74 #define WORK_QUEUE_VALID_SHIFT		31
75 #define WORK_QUEUE_ACK_TYPE		0x40000000 /* ACK type */
76 #define WORK_QUEUE_ACK_TYPE_SHIFT	30
77 /* Head timeout window limit fragmentation count */
78 #define HEAD_TIMOUT_WIN_LIM_FRAG_CNT	0x3FFF0000
79 #define HEAD_TIMOUT_WIN_LIM_FRAG_CNT_SHIFT	16
80 /* Head timeout window limit byte count */
81 #define HEAD_TIMOUT_WIN_LIM_BYTE_CNT	0x0000FFFF
82 #define HEAD_TIMOUT_WIN_LIM_BYTE_CNT_SHIFT	 0
83 } __attribute__((__packed__));
84 
85 
86 /*
87  * Traffic Class Structure
88  */
89 struct agnx_sta_traffic {
90 	__le32 reg0;
91 #define ACK_TIMOUT_CNT		0xFF800000 /* ACK Timeout Counts */
92 #define ACK_TIMOUT_CNT_SHIFT	23
93 #define TRAFFIC_ACK_TYPE	0x00600000 /* ACK Type */
94 #define TRAFFIC_ACK_TYPE_SHIFT	21
95 #define NEW_PACKET		0x00100000 /* New Packet  */
96 #define NEW_PACKET_SHIFT	20
97 #define TRAFFIC_VALID		0x00080000 /* Valid */
98 #define TRAFFIC_VALID_SHIFT	19
99 #define RX_HDR_DESC_POINTER	0x0007FFFF /* RX Header Descripter pointer */
100 #define RX_HDR_DESC_POINTER_SHIFT	 0
101 
102 	__le32 reg1;
103 #define RX_PACKET_TIMESTAMP	0xFFFF0000 /* RX Packet Timestamp */
104 #define RX_PACKET_TIMESTAMP_SHIFT	16
105 #define TRAFFIC_RESERVED	0x0000E000 /* Reserved */
106 #define TRAFFIC_RESERVED_SHIFT  13
107 #define SV			0x00001000 /* sv */
108 #define SV_SHIFT		12
109 #define RX_SEQUENCE_NUM		0x00000FFF /* RX Sequence Number */
110 #define RX_SEQUENCE_NUM_SHIFT	0
111 
112 	__le32 tx_replay_cnt_low; /* TX Replay Counter Low */
113 
114 	__le16 tx_replay_cnt_high; /* TX Replay Counter High */
115 	__le16 rx_replay_cnt_high; /* RX Replay Counter High */
116 
117 	__be32 rx_replay_cnt_low; /* RX Replay Counter Low */
118 } __attribute__((__packed__));
119 
120 /*
121  * Station Descriptors
122  */
123 struct agnx_sta {
124 	__le32 tx_session_keys[4]; /* Transmit Session Key (0-3) */
125 	__le32 rx_session_keys[4]; /* Receive Session Key (0-3) */
126 
127 	__le32 reg;
128 #define ID_1			0xC0000000 /* id 1 */
129 #define ID_1_SHIFT		30
130 #define ID_0			0x30000000 /* id 0 */
131 #define ID_0_SHIFT		28
132 #define ENABLE_CONCATENATION	0x0FF00000 /* Enable concatenation */
133 #define ENABLE_CONCATENATION_SHIFT	20
134 #define ENABLE_DECOMPRESSION	0x000FF000 /* Enable decompression */
135 #define ENABLE_DECOMPRESSION_SHIFT	12
136 #define STA_RESERVED		0x00000C00 /* Reserved */
137 #define STA_RESERVED_SHIFT	10
138 #define EAP			0x00000200 /* EAP */
139 #define EAP_SHIFT		9
140 #define ED_NULL			0x00000100 /* ED NULL */
141 #define ED_NULL_SHIFT		8
142 #define ENCRYPTION_POLICY	0x000000E0 /* Encryption Policy */
143 #define ENCRYPTION_POLICY_SHIFT 5
144 #define DEFINED_KEY_ID		0x00000018 /* Defined Key ID */
145 #define DEFINED_KEY_ID_SHIFT	3
146 #define FIXED_KEY		0x00000004 /* Fixed Key */
147 #define FIXED_KEY_SHIFT		2
148 #define KEY_VALID		0x00000002 /* Key Valid */
149 #define KEY_VALID_SHIFT		1
150 #define STATION_VALID		0x00000001 /* Station Valid */
151 #define STATION_VALID_SHIFT	0
152 
153 	__le32 tx_aes_blks_unicast; /* TX AES Blks Unicast */
154 	__le32 rx_aes_blks_unicast; /* RX AES Blks Unicast */
155 
156 	__le16 aes_format_err_unicast_cnt; /* AES Format Error Unicast Counts */
157 	__le16 aes_replay_unicast; /* AES Replay Unicast */
158 
159 	__le16 aes_decrypt_err_unicast;	/* AES Decrypt Error Unicast */
160 	__le16 aes_decrypt_err_default;	/* AES Decrypt Error default */
161 
162 	__le16 single_retry_packets; /* Single Retry Packets */
163 	__le16 failed_tx_packets; /* Failed Tx Packets */
164 
165 	__le16 muti_retry_packets; /* Multiple Retry Packets */
166 	__le16 ack_timeouts;	/* ACK Timeouts */
167 
168 	__le16 frag_tx_cnt;	/* Fragment TX Counts */
169 	__le16 rts_brq_sent;	/* RTS Brq Sent */
170 
171 	__le16 tx_packets;	/* TX Packets */
172 	__le16 cts_back_timeout; /* CTS Back Timeout */
173 
174 	__le32 phy_stats_high;	/* PHY Stats High */
175 	__le32 phy_stats_low;	/* PHY Stats Low */
176 
177 	struct agnx_sta_traffic traffic[8];	/* Traffic Class Structure (8) */
178 
179 	__le16 traffic_class0_frag_success; /* Traffic Class 0 Fragment Success */
180 	__le16 traffic_class1_frag_success; /* Traffic Class 1 Fragment Success */
181 	__le16 traffic_class2_frag_success; /* Traffic Class 2 Fragment Success */
182 	__le16 traffic_class3_frag_success; /* Traffic Class 3 Fragment Success */
183 	__le16 traffic_class4_frag_success; /* Traffic Class 4 Fragment Success */
184 	__le16 traffic_class5_frag_success; /* Traffic Class 5 Fragment Success */
185 	__le16 traffic_class6_frag_success; /* Traffic Class 6 Fragment Success */
186 	__le16 traffic_class7_frag_success; /* Traffic Class 7 Fragment Success */
187 
188 	__le16 num_frag_non_prime_rates; /* number of Fragments for non-prime rates */
189 	__le16 ack_timeout_non_prime_rates; /* ACK Timeout for non-prime rates */
190 
191 } __attribute__((__packed__));
192 
193 
194 struct agnx_beacon_hdr {
195 	struct agnx_sta_power power; /* Tx Station Power Template  */
196 	u8 phy_hdr[6];		/* PHY Hdr */
197 	u8 frame_len_lo;	/* Frame Length Lo */
198 	u8 frame_len_hi;	/* Frame Length Hi */
199 	u8 mac_hdr[24];		/* MAC Header */
200 	/* FIXME */
201 	/* 802.11(abg) beacon */
202 } __attribute__((__packed__));
203 
204 void hash_write(struct agnx_priv *priv, u8 *mac_addr, u8 sta_id);
205 void hash_dump(struct agnx_priv *priv, u8 sta_id);
206 void hash_read(struct agnx_priv *priv, u32 reghi, u32 reglo, u8 sta_id);
207 void hash_delete(struct agnx_priv *priv, u32 reghi, u32 reglo, u8 sta_id);
208 
209 void get_sta_power(struct agnx_priv *priv, struct agnx_sta_power *power, unsigned int sta_idx);
210 void set_sta_power(struct agnx_priv *priv, struct agnx_sta_power *power,
211 		   unsigned int sta_idx);
212 void get_sta_tx_wq(struct agnx_priv *priv, struct agnx_sta_tx_wq *tx_wq,
213 		   unsigned int sta_idx, unsigned int wq_idx);
214 void set_sta_tx_wq(struct agnx_priv *priv, struct agnx_sta_tx_wq *tx_wq,
215 		   unsigned int sta_idx, unsigned int wq_idx);
216 void get_sta(struct agnx_priv *priv, struct agnx_sta *sta, unsigned int sta_idx);
217 void set_sta(struct agnx_priv *priv, struct agnx_sta *sta, unsigned int sta_idx);
218 
219 void sta_power_init(struct agnx_priv *priv, unsigned int num);
220 void sta_init(struct agnx_priv *priv, unsigned int num);
221 
222 #endif /* AGNX_STA_H_ */
223