diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath6kl/htc.h')
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/htc.h | 596 |
1 files changed, 596 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/htc.h b/drivers/net/wireless/ath/ath6kl/htc.h new file mode 100644 index 000000000000..16fa7a84a231 --- /dev/null +++ b/drivers/net/wireless/ath/ath6kl/htc.h | |||
@@ -0,0 +1,596 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2004-2011 Atheros Communications Inc. | ||
3 | * | ||
4 | * Permission to use, copy, modify, and/or distribute this software for any | ||
5 | * purpose with or without fee is hereby granted, provided that the above | ||
6 | * copyright notice and this permission notice appear in all copies. | ||
7 | * | ||
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
15 | */ | ||
16 | |||
17 | #ifndef HTC_H | ||
18 | #define HTC_H | ||
19 | |||
20 | #include "common.h" | ||
21 | |||
22 | /* frame header flags */ | ||
23 | |||
24 | /* send direction */ | ||
25 | #define HTC_FLAGS_NEED_CREDIT_UPDATE (1 << 0) | ||
26 | #define HTC_FLAGS_SEND_BUNDLE (1 << 1) | ||
27 | |||
28 | /* receive direction */ | ||
29 | #define HTC_FLG_RX_UNUSED (1 << 0) | ||
30 | #define HTC_FLG_RX_TRAILER (1 << 1) | ||
31 | /* Bundle count maske and shift */ | ||
32 | #define HTC_FLG_RX_BNDL_CNT (0xF0) | ||
33 | #define HTC_FLG_RX_BNDL_CNT_S 4 | ||
34 | |||
35 | #define HTC_HDR_LENGTH (sizeof(struct htc_frame_hdr)) | ||
36 | #define HTC_MAX_PAYLOAD_LENGTH (4096 - sizeof(struct htc_frame_hdr)) | ||
37 | |||
38 | /* HTC control message IDs */ | ||
39 | |||
40 | #define HTC_MSG_READY_ID 1 | ||
41 | #define HTC_MSG_CONN_SVC_ID 2 | ||
42 | #define HTC_MSG_CONN_SVC_RESP_ID 3 | ||
43 | #define HTC_MSG_SETUP_COMPLETE_ID 4 | ||
44 | #define HTC_MSG_SETUP_COMPLETE_EX_ID 5 | ||
45 | |||
46 | #define HTC_MAX_CTRL_MSG_LEN 256 | ||
47 | |||
48 | #define HTC_VERSION_2P0 0x00 | ||
49 | #define HTC_VERSION_2P1 0x01 | ||
50 | |||
51 | #define HTC_SERVICE_META_DATA_MAX_LENGTH 128 | ||
52 | |||
53 | #define HTC_CONN_FLGS_THRESH_LVL_QUAT 0x0 | ||
54 | #define HTC_CONN_FLGS_THRESH_LVL_HALF 0x1 | ||
55 | #define HTC_CONN_FLGS_THRESH_LVL_THREE_QUAT 0x2 | ||
56 | #define HTC_CONN_FLGS_REDUCE_CRED_DRIB 0x4 | ||
57 | #define HTC_CONN_FLGS_THRESH_MASK 0x3 | ||
58 | |||
59 | /* connect response status codes */ | ||
60 | #define HTC_SERVICE_SUCCESS 0 | ||
61 | #define HTC_SERVICE_NOT_FOUND 1 | ||
62 | #define HTC_SERVICE_FAILED 2 | ||
63 | |||
64 | /* no resources (i.e. no more endpoints) */ | ||
65 | #define HTC_SERVICE_NO_RESOURCES 3 | ||
66 | |||
67 | /* specific service is not allowing any more endpoints */ | ||
68 | #define HTC_SERVICE_NO_MORE_EP 4 | ||
69 | |||
70 | /* report record IDs */ | ||
71 | #define HTC_RECORD_NULL 0 | ||
72 | #define HTC_RECORD_CREDITS 1 | ||
73 | #define HTC_RECORD_LOOKAHEAD 2 | ||
74 | #define HTC_RECORD_LOOKAHEAD_BUNDLE 3 | ||
75 | |||
76 | #define HTC_SETUP_COMP_FLG_RX_BNDL_EN (1 << 0) | ||
77 | |||
78 | #define MAKE_SERVICE_ID(group, index) \ | ||
79 | (int)(((int)group << 8) | (int)(index)) | ||
80 | |||
81 | /* NOTE: service ID of 0x0000 is reserved and should never be used */ | ||
82 | #define HTC_CTRL_RSVD_SVC MAKE_SERVICE_ID(RSVD_SERVICE_GROUP, 1) | ||
83 | #define WMI_CONTROL_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 0) | ||
84 | #define WMI_DATA_BE_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 1) | ||
85 | #define WMI_DATA_BK_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 2) | ||
86 | #define WMI_DATA_VI_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 3) | ||
87 | #define WMI_DATA_VO_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 4) | ||
88 | #define WMI_MAX_SERVICES 5 | ||
89 | |||
90 | /* reserved and used to flush ALL packets */ | ||
91 | #define HTC_TX_PACKET_TAG_ALL 0 | ||
92 | #define HTC_SERVICE_TX_PACKET_TAG 1 | ||
93 | #define HTC_TX_PACKET_TAG_USER_DEFINED (HTC_SERVICE_TX_PACKET_TAG + 9) | ||
94 | |||
95 | /* more packets on this endpoint are being fetched */ | ||
96 | #define HTC_RX_FLAGS_INDICATE_MORE_PKTS (1 << 0) | ||
97 | |||
98 | /* TODO.. for BMI */ | ||
99 | #define ENDPOINT1 0 | ||
100 | /* TODO -remove me, but we have to fix BMI first */ | ||
101 | #define HTC_MAILBOX_NUM_MAX 4 | ||
102 | |||
103 | /* enable send bundle padding for this endpoint */ | ||
104 | #define HTC_FLGS_TX_BNDL_PAD_EN (1 << 0) | ||
105 | #define HTC_EP_ACTIVE ((u32) (1u << 31)) | ||
106 | |||
107 | /* HTC operational parameters */ | ||
108 | #define HTC_TARGET_RESPONSE_TIMEOUT 2000 /* in ms */ | ||
109 | #define HTC_TARGET_DEBUG_INTR_MASK 0x01 | ||
110 | #define HTC_TARGET_CREDIT_INTR_MASK 0xF0 | ||
111 | |||
112 | #define HTC_HOST_MAX_MSG_PER_BUNDLE 8 | ||
113 | #define HTC_MIN_HTC_MSGS_TO_BUNDLE 2 | ||
114 | |||
115 | /* packet flags */ | ||
116 | |||
117 | #define HTC_RX_PKT_IGNORE_LOOKAHEAD (1 << 0) | ||
118 | #define HTC_RX_PKT_REFRESH_HDR (1 << 1) | ||
119 | #define HTC_RX_PKT_PART_OF_BUNDLE (1 << 2) | ||
120 | #define HTC_RX_PKT_NO_RECYCLE (1 << 3) | ||
121 | |||
122 | /* scatter request flags */ | ||
123 | |||
124 | #define HTC_SCAT_REQ_FLG_PART_BNDL (1 << 0) | ||
125 | |||
126 | #define NUM_CONTROL_BUFFERS 8 | ||
127 | #define NUM_CONTROL_TX_BUFFERS 2 | ||
128 | #define NUM_CONTROL_RX_BUFFERS (NUM_CONTROL_BUFFERS - NUM_CONTROL_TX_BUFFERS) | ||
129 | |||
130 | #define HTC_RECV_WAIT_BUFFERS (1 << 0) | ||
131 | #define HTC_OP_STATE_STOPPING (1 << 0) | ||
132 | |||
133 | /* | ||
134 | * The frame header length and message formats defined herein were selected | ||
135 | * to accommodate optimal alignment for target processing. This reduces | ||
136 | * code size and improves performance. Any changes to the header length may | ||
137 | * alter the alignment and cause exceptions on the target. When adding to | ||
138 | * the messagestructures insure that fields are properly aligned. | ||
139 | */ | ||
140 | |||
141 | /* HTC frame header | ||
142 | * | ||
143 | * NOTE: do not remove or re-arrange the fields, these are minimally | ||
144 | * required to take advantage of 4-byte lookaheads in some hardware | ||
145 | * implementations. | ||
146 | */ | ||
147 | struct htc_frame_hdr { | ||
148 | u8 eid; | ||
149 | u8 flags; | ||
150 | |||
151 | /* length of data (including trailer) that follows the header */ | ||
152 | __le16 payld_len; | ||
153 | |||
154 | /* end of 4-byte lookahead */ | ||
155 | |||
156 | u8 ctrl[2]; | ||
157 | } __packed; | ||
158 | |||
159 | /* HTC ready message */ | ||
160 | struct htc_ready_msg { | ||
161 | __le16 msg_id; | ||
162 | __le16 cred_cnt; | ||
163 | __le16 cred_sz; | ||
164 | u8 max_ep; | ||
165 | u8 pad; | ||
166 | } __packed; | ||
167 | |||
168 | /* extended HTC ready message */ | ||
169 | struct htc_ready_ext_msg { | ||
170 | struct htc_ready_msg ver2_0_info; | ||
171 | u8 htc_ver; | ||
172 | u8 msg_per_htc_bndl; | ||
173 | } __packed; | ||
174 | |||
175 | /* connect service */ | ||
176 | struct htc_conn_service_msg { | ||
177 | __le16 msg_id; | ||
178 | __le16 svc_id; | ||
179 | __le16 conn_flags; | ||
180 | u8 svc_meta_len; | ||
181 | u8 pad; | ||
182 | } __packed; | ||
183 | |||
184 | /* connect response */ | ||
185 | struct htc_conn_service_resp { | ||
186 | __le16 msg_id; | ||
187 | __le16 svc_id; | ||
188 | u8 status; | ||
189 | u8 eid; | ||
190 | __le16 max_msg_sz; | ||
191 | u8 svc_meta_len; | ||
192 | u8 pad; | ||
193 | } __packed; | ||
194 | |||
195 | struct htc_setup_comp_msg { | ||
196 | __le16 msg_id; | ||
197 | } __packed; | ||
198 | |||
199 | /* extended setup completion message */ | ||
200 | struct htc_setup_comp_ext_msg { | ||
201 | __le16 msg_id; | ||
202 | __le32 flags; | ||
203 | u8 msg_per_rxbndl; | ||
204 | u8 Rsvd[3]; | ||
205 | } __packed; | ||
206 | |||
207 | struct htc_record_hdr { | ||
208 | u8 rec_id; | ||
209 | u8 len; | ||
210 | } __packed; | ||
211 | |||
212 | struct htc_credit_report { | ||
213 | u8 eid; | ||
214 | u8 credits; | ||
215 | } __packed; | ||
216 | |||
217 | /* | ||
218 | * NOTE: The lk_ahd array is guarded by a pre_valid | ||
219 | * and Post Valid guard bytes. The pre_valid bytes must | ||
220 | * equal the inverse of the post_valid byte. | ||
221 | */ | ||
222 | struct htc_lookahead_report { | ||
223 | u8 pre_valid; | ||
224 | u8 lk_ahd[4]; | ||
225 | u8 post_valid; | ||
226 | } __packed; | ||
227 | |||
228 | struct htc_bundle_lkahd_rpt { | ||
229 | u8 lk_ahd[4]; | ||
230 | } __packed; | ||
231 | |||
232 | /* Current service IDs */ | ||
233 | |||
234 | enum htc_service_grp_ids { | ||
235 | RSVD_SERVICE_GROUP = 0, | ||
236 | WMI_SERVICE_GROUP = 1, | ||
237 | |||
238 | HTC_TEST_GROUP = 254, | ||
239 | HTC_SERVICE_GROUP_LAST = 255 | ||
240 | }; | ||
241 | |||
242 | /* ------ endpoint IDS ------ */ | ||
243 | |||
244 | enum htc_endpoint_id { | ||
245 | ENDPOINT_UNUSED = -1, | ||
246 | ENDPOINT_0 = 0, | ||
247 | ENDPOINT_1 = 1, | ||
248 | ENDPOINT_2 = 2, | ||
249 | ENDPOINT_3, | ||
250 | ENDPOINT_4, | ||
251 | ENDPOINT_5, | ||
252 | ENDPOINT_6, | ||
253 | ENDPOINT_7, | ||
254 | ENDPOINT_8, | ||
255 | ENDPOINT_MAX, | ||
256 | }; | ||
257 | |||
258 | struct htc_tx_packet_info { | ||
259 | u16 tag; | ||
260 | int cred_used; | ||
261 | u8 flags; | ||
262 | int seqno; | ||
263 | }; | ||
264 | |||
265 | struct htc_rx_packet_info { | ||
266 | u32 exp_hdr; | ||
267 | u32 rx_flags; | ||
268 | u32 indicat_flags; | ||
269 | }; | ||
270 | |||
271 | struct htc_target; | ||
272 | |||
273 | /* wrapper around endpoint-specific packets */ | ||
274 | struct htc_packet { | ||
275 | struct list_head list; | ||
276 | |||
277 | /* caller's per packet specific context */ | ||
278 | void *pkt_cntxt; | ||
279 | |||
280 | /* | ||
281 | * the true buffer start , the caller can store the real | ||
282 | * buffer start here. In receive callbacks, the HTC layer | ||
283 | * sets buf to the start of the payload past the header. | ||
284 | * This field allows the caller to reset buf when it recycles | ||
285 | * receive packets back to HTC. | ||
286 | */ | ||
287 | u8 *buf_start; | ||
288 | |||
289 | /* | ||
290 | * Pointer to the start of the buffer. In the transmit | ||
291 | * direction this points to the start of the payload. In the | ||
292 | * receive direction, however, the buffer when queued up | ||
293 | * points to the start of the HTC header but when returned | ||
294 | * to the caller points to the start of the payload | ||
295 | */ | ||
296 | u8 *buf; | ||
297 | u32 buf_len; | ||
298 | |||
299 | /* actual length of payload */ | ||
300 | u32 act_len; | ||
301 | |||
302 | /* endpoint that this packet was sent/recv'd from */ | ||
303 | enum htc_endpoint_id endpoint; | ||
304 | |||
305 | /* completion status */ | ||
306 | |||
307 | int status; | ||
308 | union { | ||
309 | struct htc_tx_packet_info tx; | ||
310 | struct htc_rx_packet_info rx; | ||
311 | } info; | ||
312 | |||
313 | void (*completion) (struct htc_target *, struct htc_packet *); | ||
314 | struct htc_target *context; | ||
315 | }; | ||
316 | |||
317 | enum htc_send_full_action { | ||
318 | HTC_SEND_FULL_KEEP = 0, | ||
319 | HTC_SEND_FULL_DROP = 1, | ||
320 | }; | ||
321 | |||
322 | struct htc_ep_callbacks { | ||
323 | void (*rx) (struct htc_target *, struct htc_packet *); | ||
324 | void (*rx_refill) (struct htc_target *, enum htc_endpoint_id endpoint); | ||
325 | enum htc_send_full_action (*tx_full) (struct htc_target *, | ||
326 | struct htc_packet *); | ||
327 | struct htc_packet *(*rx_allocthresh) (struct htc_target *, | ||
328 | enum htc_endpoint_id, int); | ||
329 | int rx_alloc_thresh; | ||
330 | int rx_refill_thresh; | ||
331 | }; | ||
332 | |||
333 | /* service connection information */ | ||
334 | struct htc_service_connect_req { | ||
335 | u16 svc_id; | ||
336 | u16 conn_flags; | ||
337 | struct htc_ep_callbacks ep_cb; | ||
338 | int max_txq_depth; | ||
339 | u32 flags; | ||
340 | unsigned int max_rxmsg_sz; | ||
341 | }; | ||
342 | |||
343 | /* service connection response information */ | ||
344 | struct htc_service_connect_resp { | ||
345 | u8 buf_len; | ||
346 | u8 act_len; | ||
347 | enum htc_endpoint_id endpoint; | ||
348 | unsigned int len_max; | ||
349 | u8 resp_code; | ||
350 | }; | ||
351 | |||
352 | /* endpoint distributionstructure */ | ||
353 | struct htc_endpoint_credit_dist { | ||
354 | struct list_head list; | ||
355 | |||
356 | /* Service ID (set by HTC) */ | ||
357 | u16 svc_id; | ||
358 | |||
359 | /* endpoint for this distributionstruct (set by HTC) */ | ||
360 | enum htc_endpoint_id endpoint; | ||
361 | |||
362 | u32 dist_flags; | ||
363 | |||
364 | /* | ||
365 | * credits for normal operation, anything above this | ||
366 | * indicates the endpoint is over-subscribed. | ||
367 | */ | ||
368 | int cred_norm; | ||
369 | |||
370 | /* floor for credit distribution */ | ||
371 | int cred_min; | ||
372 | |||
373 | int cred_assngd; | ||
374 | |||
375 | /* current credits available */ | ||
376 | int credits; | ||
377 | |||
378 | /* | ||
379 | * pending credits to distribute on this endpoint, this | ||
380 | * is set by HTC when credit reports arrive. The credit | ||
381 | * distribution functions sets this to zero when it distributes | ||
382 | * the credits. | ||
383 | */ | ||
384 | int cred_to_dist; | ||
385 | |||
386 | /* | ||
387 | * the number of credits that the current pending TX packet needs | ||
388 | * to transmit. This is set by HTC when endpoint needs credits in | ||
389 | * order to transmit. | ||
390 | */ | ||
391 | int seek_cred; | ||
392 | |||
393 | /* size in bytes of each credit */ | ||
394 | int cred_sz; | ||
395 | |||
396 | /* credits required for a maximum sized messages */ | ||
397 | int cred_per_msg; | ||
398 | |||
399 | /* reserved for HTC use */ | ||
400 | void *htc_rsvd; | ||
401 | |||
402 | /* | ||
403 | * current depth of TX queue , i.e. messages waiting for credits | ||
404 | * This field is valid only when HTC_CREDIT_DIST_ACTIVITY_CHANGE | ||
405 | * or HTC_CREDIT_DIST_SEND_COMPLETE is indicated on an endpoint | ||
406 | * that has non-zero credits to recover. | ||
407 | */ | ||
408 | int txq_depth; | ||
409 | }; | ||
410 | |||
411 | /* | ||
412 | * credit distibution code that is passed into the distrbution function, | ||
413 | * there are mandatory and optional codes that must be handled | ||
414 | */ | ||
415 | enum htc_credit_dist_reason { | ||
416 | HTC_CREDIT_DIST_SEND_COMPLETE = 0, | ||
417 | HTC_CREDIT_DIST_ACTIVITY_CHANGE = 1, | ||
418 | HTC_CREDIT_DIST_SEEK_CREDITS, | ||
419 | }; | ||
420 | |||
421 | struct htc_credit_state_info { | ||
422 | int total_avail_credits; | ||
423 | int cur_free_credits; | ||
424 | struct list_head lowestpri_ep_dist; | ||
425 | }; | ||
426 | |||
427 | /* endpoint statistics */ | ||
428 | struct htc_endpoint_stats { | ||
429 | /* | ||
430 | * number of times the host set the credit-low flag in a send | ||
431 | * message on this endpoint | ||
432 | */ | ||
433 | u32 cred_low_indicate; | ||
434 | |||
435 | u32 tx_issued; | ||
436 | u32 tx_pkt_bundled; | ||
437 | u32 tx_bundles; | ||
438 | u32 tx_dropped; | ||
439 | |||
440 | /* running count of total credit reports received for this endpoint */ | ||
441 | u32 tx_cred_rpt; | ||
442 | |||
443 | /* credit reports received from this endpoint's RX packets */ | ||
444 | u32 cred_rpt_from_rx; | ||
445 | |||
446 | /* credit reports received from RX packets of other endpoints */ | ||
447 | u32 cred_rpt_from_other; | ||
448 | |||
449 | /* credit reports received from endpoint 0 RX packets */ | ||
450 | u32 cred_rpt_ep0; | ||
451 | |||
452 | /* count of credits received via Rx packets on this endpoint */ | ||
453 | u32 cred_from_rx; | ||
454 | |||
455 | /* count of credits received via another endpoint */ | ||
456 | u32 cred_from_other; | ||
457 | |||
458 | /* count of credits received via another endpoint */ | ||
459 | u32 cred_from_ep0; | ||
460 | |||
461 | /* count of consummed credits */ | ||
462 | u32 cred_cosumd; | ||
463 | |||
464 | /* count of credits returned */ | ||
465 | u32 cred_retnd; | ||
466 | |||
467 | u32 rx_pkts; | ||
468 | |||
469 | /* count of lookahead records found in Rx msg */ | ||
470 | u32 rx_lkahds; | ||
471 | |||
472 | /* count of recv packets received in a bundle */ | ||
473 | u32 rx_bundl; | ||
474 | |||
475 | /* count of number of bundled lookaheads */ | ||
476 | u32 rx_bundle_lkahd; | ||
477 | |||
478 | /* count of the number of bundle indications from the HTC header */ | ||
479 | u32 rx_bundle_from_hdr; | ||
480 | |||
481 | /* the number of times the recv allocation threshold was hit */ | ||
482 | u32 rx_alloc_thresh_hit; | ||
483 | |||
484 | /* total number of bytes */ | ||
485 | u32 rxalloc_thresh_byte; | ||
486 | }; | ||
487 | |||
488 | struct htc_endpoint { | ||
489 | enum htc_endpoint_id eid; | ||
490 | u16 svc_id; | ||
491 | struct list_head txq; | ||
492 | struct list_head rx_bufq; | ||
493 | struct htc_endpoint_credit_dist cred_dist; | ||
494 | struct htc_ep_callbacks ep_cb; | ||
495 | int max_txq_depth; | ||
496 | int len_max; | ||
497 | int tx_proc_cnt; | ||
498 | int rx_proc_cnt; | ||
499 | struct htc_target *target; | ||
500 | u8 seqno; | ||
501 | u32 conn_flags; | ||
502 | struct htc_endpoint_stats ep_st; | ||
503 | }; | ||
504 | |||
505 | struct htc_control_buffer { | ||
506 | struct htc_packet packet; | ||
507 | u8 *buf; | ||
508 | }; | ||
509 | |||
510 | struct ath6kl_device; | ||
511 | |||
512 | /* our HTC target state */ | ||
513 | struct htc_target { | ||
514 | struct htc_endpoint endpoint[ENDPOINT_MAX]; | ||
515 | struct list_head cred_dist_list; | ||
516 | struct list_head free_ctrl_txbuf; | ||
517 | struct list_head free_ctrl_rxbuf; | ||
518 | struct htc_credit_state_info *cred_dist_cntxt; | ||
519 | int tgt_creds; | ||
520 | unsigned int tgt_cred_sz; | ||
521 | spinlock_t htc_lock; | ||
522 | spinlock_t rx_lock; | ||
523 | spinlock_t tx_lock; | ||
524 | struct ath6kl_device *dev; | ||
525 | u32 htc_flags; | ||
526 | u32 rx_st_flags; | ||
527 | enum htc_endpoint_id ep_waiting; | ||
528 | u8 htc_tgt_ver; | ||
529 | |||
530 | /* max messages per bundle for HTC */ | ||
531 | int msg_per_bndl_max; | ||
532 | |||
533 | bool tx_bndl_enable; | ||
534 | int rx_bndl_enable; | ||
535 | }; | ||
536 | |||
537 | void *htc_create(struct ath6kl *ar); | ||
538 | void htc_set_credit_dist(struct htc_target *target, | ||
539 | struct htc_credit_state_info *cred_info, | ||
540 | u16 svc_pri_order[], int len); | ||
541 | int htc_wait_target(struct htc_target *target); | ||
542 | int htc_start(struct htc_target *target); | ||
543 | int htc_conn_service(struct htc_target *target, | ||
544 | struct htc_service_connect_req *req, | ||
545 | struct htc_service_connect_resp *resp); | ||
546 | int htc_tx(struct htc_target *target, struct htc_packet *packet); | ||
547 | void htc_stop(struct htc_target *target); | ||
548 | void htc_cleanup(struct htc_target *target); | ||
549 | void htc_flush_txep(struct htc_target *target, | ||
550 | enum htc_endpoint_id endpoint, u16 tag); | ||
551 | void htc_flush_rx_buf(struct htc_target *target); | ||
552 | void htc_indicate_activity_change(struct htc_target *target, | ||
553 | enum htc_endpoint_id endpoint, bool active); | ||
554 | int htc_get_rxbuf_num(struct htc_target *target, enum htc_endpoint_id endpoint); | ||
555 | int htc_add_rxbuf_multiple(struct htc_target *target, struct list_head *pktq); | ||
556 | |||
557 | static inline void set_htc_pkt_info(struct htc_packet *packet, void *context, | ||
558 | u8 *buf, unsigned int len, | ||
559 | enum htc_endpoint_id eid, u16 tag) | ||
560 | { | ||
561 | packet->pkt_cntxt = context; | ||
562 | packet->buf = buf; | ||
563 | packet->act_len = len; | ||
564 | packet->endpoint = eid; | ||
565 | packet->info.tx.tag = tag; | ||
566 | } | ||
567 | |||
568 | static inline void htc_rxpkt_reset(struct htc_packet *packet) | ||
569 | { | ||
570 | packet->buf = packet->buf_start; | ||
571 | packet->act_len = 0; | ||
572 | } | ||
573 | |||
574 | static inline void set_htc_rxpkt_info(struct htc_packet *packet, void *context, | ||
575 | u8 *buf, unsigned long len, | ||
576 | enum htc_endpoint_id eid) | ||
577 | { | ||
578 | packet->pkt_cntxt = context; | ||
579 | packet->buf = buf; | ||
580 | packet->buf_start = buf; | ||
581 | packet->buf_len = len; | ||
582 | packet->endpoint = eid; | ||
583 | } | ||
584 | |||
585 | static inline int get_queue_depth(struct list_head *queue) | ||
586 | { | ||
587 | struct list_head *tmp_list; | ||
588 | int depth = 0; | ||
589 | |||
590 | list_for_each(tmp_list, queue) | ||
591 | depth++; | ||
592 | |||
593 | return depth; | ||
594 | } | ||
595 | |||
596 | #endif | ||