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