Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright (c) 2004-2011 Atheros Communications Inc.
0003  * Copyright (c) 2011 Qualcomm Atheros, Inc.
0004  *
0005  * Permission to use, copy, modify, and/or distribute this software for any
0006  * purpose with or without fee is hereby granted, provided that the above
0007  * copyright notice and this permission notice appear in all copies.
0008  *
0009  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
0010  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
0011  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
0012  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
0013  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
0014  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
0015  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
0016  */
0017 
0018 #ifndef HTC_H
0019 #define HTC_H
0020 
0021 #include "common.h"
0022 
0023 /* frame header flags */
0024 
0025 /* send direction */
0026 #define HTC_FLAGS_NEED_CREDIT_UPDATE (1 << 0)
0027 #define HTC_FLAGS_SEND_BUNDLE        (1 << 1)
0028 #define HTC_FLAGS_TX_FIXUP_NETBUF    (1 << 2)
0029 
0030 /* receive direction */
0031 #define HTC_FLG_RX_UNUSED        (1 << 0)
0032 #define HTC_FLG_RX_TRAILER       (1 << 1)
0033 /* Bundle count maske and shift */
0034 #define HTC_FLG_RX_BNDL_CNT  (0xF0)
0035 #define HTC_FLG_RX_BNDL_CNT_S    4
0036 
0037 #define HTC_HDR_LENGTH  (sizeof(struct htc_frame_hdr))
0038 #define HTC_MAX_PAYLOAD_LENGTH   (4096 - sizeof(struct htc_frame_hdr))
0039 
0040 /* HTC control message IDs */
0041 
0042 #define HTC_MSG_READY_ID        1
0043 #define HTC_MSG_CONN_SVC_ID     2
0044 #define HTC_MSG_CONN_SVC_RESP_ID    3
0045 #define HTC_MSG_SETUP_COMPLETE_ID   4
0046 #define HTC_MSG_SETUP_COMPLETE_EX_ID    5
0047 
0048 #define HTC_MAX_CTRL_MSG_LEN  256
0049 
0050 #define HTC_VERSION_2P0  0x00
0051 #define HTC_VERSION_2P1  0x01
0052 
0053 #define HTC_SERVICE_META_DATA_MAX_LENGTH 128
0054 
0055 #define HTC_CONN_FLGS_THRESH_LVL_QUAT       0x0
0056 #define HTC_CONN_FLGS_THRESH_LVL_HALF       0x1
0057 #define HTC_CONN_FLGS_THRESH_LVL_THREE_QUAT 0x2
0058 #define HTC_CONN_FLGS_REDUCE_CRED_DRIB      0x4
0059 #define HTC_CONN_FLGS_THRESH_MASK       0x3
0060 /* disable credit flow control on a specific service */
0061 #define HTC_CONN_FLGS_DISABLE_CRED_FLOW_CTRL          (1 << 3)
0062 #define HTC_CONN_FLGS_SET_RECV_ALLOC_SHIFT    8
0063 #define HTC_CONN_FLGS_SET_RECV_ALLOC_MASK     0xFF00U
0064 
0065 /* connect response status codes */
0066 #define HTC_SERVICE_SUCCESS      0
0067 #define HTC_SERVICE_NOT_FOUND    1
0068 #define HTC_SERVICE_FAILED       2
0069 
0070 /* no resources (i.e. no more endpoints) */
0071 #define HTC_SERVICE_NO_RESOURCES 3
0072 
0073 /* specific service is not allowing any more endpoints */
0074 #define HTC_SERVICE_NO_MORE_EP   4
0075 
0076 /* report record IDs */
0077 #define HTC_RECORD_NULL             0
0078 #define HTC_RECORD_CREDITS          1
0079 #define HTC_RECORD_LOOKAHEAD        2
0080 #define HTC_RECORD_LOOKAHEAD_BUNDLE 3
0081 
0082 #define HTC_SETUP_COMP_FLG_RX_BNDL_EN     (1 << 0)
0083 #define HTC_SETUP_COMP_FLG_DISABLE_TX_CREDIT_FLOW (1 << 1)
0084 
0085 #define MAKE_SERVICE_ID(group, index) \
0086     (int)(((int)group << 8) | (int)(index))
0087 
0088 /* NOTE: service ID of 0x0000 is reserved and should never be used */
0089 #define HTC_CTRL_RSVD_SVC MAKE_SERVICE_ID(RSVD_SERVICE_GROUP, 1)
0090 #define WMI_CONTROL_SVC   MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 0)
0091 #define WMI_DATA_BE_SVC   MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 1)
0092 #define WMI_DATA_BK_SVC   MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 2)
0093 #define WMI_DATA_VI_SVC   MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 3)
0094 #define WMI_DATA_VO_SVC   MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 4)
0095 #define WMI_MAX_SERVICES  5
0096 
0097 #define WMM_NUM_AC  4
0098 
0099 /* reserved and used to flush ALL packets */
0100 #define HTC_TX_PACKET_TAG_ALL          0
0101 #define HTC_SERVICE_TX_PACKET_TAG      1
0102 #define HTC_TX_PACKET_TAG_USER_DEFINED (HTC_SERVICE_TX_PACKET_TAG + 9)
0103 
0104 /* more packets on this endpoint are being fetched */
0105 #define HTC_RX_FLAGS_INDICATE_MORE_PKTS  (1 << 0)
0106 
0107 /* TODO.. for BMI */
0108 #define ENDPOINT1 0
0109 /* TODO -remove me, but we have to fix BMI first */
0110 #define HTC_MAILBOX_NUM_MAX    4
0111 
0112 /* enable send bundle padding for this endpoint */
0113 #define HTC_FLGS_TX_BNDL_PAD_EN  (1 << 0)
0114 #define HTC_EP_ACTIVE                            ((u32) (1u << 31))
0115 
0116 /* HTC operational parameters */
0117 #define HTC_TARGET_RESPONSE_TIMEOUT        2000 /* in ms */
0118 #define HTC_TARGET_RESPONSE_POLL_WAIT      10
0119 #define HTC_TARGET_RESPONSE_POLL_COUNT     200
0120 #define HTC_TARGET_DEBUG_INTR_MASK         0x01
0121 #define HTC_TARGET_CREDIT_INTR_MASK        0xF0
0122 
0123 #define HTC_HOST_MAX_MSG_PER_BUNDLE        8
0124 #define HTC_MIN_HTC_MSGS_TO_BUNDLE         2
0125 
0126 /* packet flags */
0127 
0128 #define HTC_RX_PKT_IGNORE_LOOKAHEAD      (1 << 0)
0129 #define HTC_RX_PKT_REFRESH_HDR           (1 << 1)
0130 #define HTC_RX_PKT_PART_OF_BUNDLE        (1 << 2)
0131 #define HTC_RX_PKT_NO_RECYCLE            (1 << 3)
0132 
0133 #define NUM_CONTROL_BUFFERS     8
0134 #define NUM_CONTROL_TX_BUFFERS  2
0135 #define NUM_CONTROL_RX_BUFFERS  (NUM_CONTROL_BUFFERS - NUM_CONTROL_TX_BUFFERS)
0136 
0137 #define HTC_RECV_WAIT_BUFFERS        (1 << 0)
0138 #define HTC_OP_STATE_STOPPING        (1 << 0)
0139 #define HTC_OP_STATE_SETUP_COMPLETE  (1 << 1)
0140 
0141 /*
0142  * The frame header length and message formats defined herein were selected
0143  * to accommodate optimal alignment for target processing. This reduces
0144  * code size and improves performance. Any changes to the header length may
0145  * alter the alignment and cause exceptions on the target. When adding to
0146  * the messagestructures insure that fields are properly aligned.
0147  */
0148 
0149 /* HTC frame header
0150  *
0151  * NOTE: do not remove or re-arrange the fields, these are minimally
0152  * required to take advantage of 4-byte lookaheads in some hardware
0153  * implementations.
0154  */
0155 struct htc_frame_hdr {
0156     struct_group_tagged(htc_frame_look_ahead, header,
0157         union {
0158             struct {
0159                 u8 eid;
0160                 u8 flags;
0161 
0162                 /* length of data (including trailer) that follows the header */
0163                 __le16 payld_len;
0164 
0165             };
0166             u32 word;
0167         };
0168     );
0169     /* end of 4-byte lookahead */
0170 
0171     u8 ctrl[2];
0172 } __packed;
0173 
0174 /* HTC ready message */
0175 struct htc_ready_msg {
0176     __le16 msg_id;
0177     __le16 cred_cnt;
0178     __le16 cred_sz;
0179     u8 max_ep;
0180     u8 pad;
0181 } __packed;
0182 
0183 /* extended HTC ready message */
0184 struct htc_ready_ext_msg {
0185     struct htc_ready_msg ver2_0_info;
0186     u8 htc_ver;
0187     u8 msg_per_htc_bndl;
0188 } __packed;
0189 
0190 /* connect service */
0191 struct htc_conn_service_msg {
0192     __le16 msg_id;
0193     __le16 svc_id;
0194     __le16 conn_flags;
0195     u8 svc_meta_len;
0196     u8 pad;
0197 } __packed;
0198 
0199 /* connect response */
0200 struct htc_conn_service_resp {
0201     __le16 msg_id;
0202     __le16 svc_id;
0203     u8 status;
0204     u8 eid;
0205     __le16 max_msg_sz;
0206     u8 svc_meta_len;
0207     u8 pad;
0208 } __packed;
0209 
0210 struct htc_setup_comp_msg {
0211     __le16 msg_id;
0212 } __packed;
0213 
0214 /* extended setup completion message */
0215 struct htc_setup_comp_ext_msg {
0216     __le16 msg_id;
0217     __le32 flags;
0218     u8 msg_per_rxbndl;
0219     u8 Rsvd[3];
0220 } __packed;
0221 
0222 struct htc_record_hdr {
0223     u8 rec_id;
0224     u8 len;
0225 } __packed;
0226 
0227 struct htc_credit_report {
0228     u8 eid;
0229     u8 credits;
0230 } __packed;
0231 
0232 /*
0233  * NOTE: The lk_ahd array is guarded by a pre_valid
0234  * and Post Valid guard bytes. The pre_valid bytes must
0235  * equal the inverse of the post_valid byte.
0236  */
0237 struct htc_lookahead_report {
0238     u8 pre_valid;
0239     u8 lk_ahd[4];
0240     u8 post_valid;
0241 } __packed;
0242 
0243 struct htc_bundle_lkahd_rpt {
0244     u8 lk_ahd[4];
0245 } __packed;
0246 
0247 /* Current service IDs */
0248 
0249 enum htc_service_grp_ids {
0250     RSVD_SERVICE_GROUP = 0,
0251     WMI_SERVICE_GROUP = 1,
0252 
0253     HTC_TEST_GROUP = 254,
0254     HTC_SERVICE_GROUP_LAST = 255
0255 };
0256 
0257 /* ------ endpoint IDS ------ */
0258 
0259 enum htc_endpoint_id {
0260     ENDPOINT_UNUSED = -1,
0261     ENDPOINT_0 = 0,
0262     ENDPOINT_1 = 1,
0263     ENDPOINT_2 = 2,
0264     ENDPOINT_3,
0265     ENDPOINT_4,
0266     ENDPOINT_5,
0267     ENDPOINT_6,
0268     ENDPOINT_7,
0269     ENDPOINT_8,
0270     ENDPOINT_MAX,
0271 };
0272 
0273 struct htc_tx_packet_info {
0274     u16 tag;
0275     int cred_used;
0276     u8 flags;
0277     int seqno;
0278 };
0279 
0280 struct htc_rx_packet_info {
0281     u32 exp_hdr;
0282     u32 rx_flags;
0283     u32 indicat_flags;
0284 };
0285 
0286 struct htc_target;
0287 
0288 /* wrapper around endpoint-specific packets */
0289 struct htc_packet {
0290     struct list_head list;
0291 
0292     /* caller's per packet specific context */
0293     void *pkt_cntxt;
0294 
0295     /*
0296      * the true buffer start , the caller can store the real
0297      * buffer start here.  In receive callbacks, the HTC layer
0298      * sets buf to the start of the payload past the header.
0299      * This field allows the caller to reset buf when it recycles
0300      * receive packets back to HTC.
0301      */
0302     u8 *buf_start;
0303 
0304     /*
0305      * Pointer to the start of the buffer. In the transmit
0306      * direction this points to the start of the payload. In the
0307      * receive direction, however, the buffer when queued up
0308      * points to the start of the HTC header but when returned
0309      * to the caller points to the start of the payload
0310      */
0311     u8 *buf;
0312     u32 buf_len;
0313 
0314     /* actual length of payload */
0315     u32 act_len;
0316 
0317     /* endpoint that this packet was sent/recv'd from */
0318     enum htc_endpoint_id endpoint;
0319 
0320     /* completion status */
0321 
0322     int status;
0323     union {
0324         struct htc_tx_packet_info tx;
0325         struct htc_rx_packet_info rx;
0326     } info;
0327 
0328     void (*completion) (struct htc_target *, struct htc_packet *);
0329     struct htc_target *context;
0330 
0331     /*
0332      * optimization for network-oriented data, the HTC packet
0333      * can pass the network buffer corresponding to the HTC packet
0334      * lower layers may optimized the transfer knowing this is
0335      * a network buffer
0336      */
0337     struct sk_buff *skb;
0338 };
0339 
0340 enum htc_send_full_action {
0341     HTC_SEND_FULL_KEEP = 0,
0342     HTC_SEND_FULL_DROP = 1,
0343 };
0344 
0345 struct htc_ep_callbacks {
0346     void (*tx_complete) (struct htc_target *, struct htc_packet *);
0347     void (*rx) (struct htc_target *, struct htc_packet *);
0348     void (*rx_refill) (struct htc_target *, enum htc_endpoint_id endpoint);
0349     enum htc_send_full_action (*tx_full) (struct htc_target *,
0350                           struct htc_packet *);
0351     struct htc_packet *(*rx_allocthresh) (struct htc_target *,
0352                           enum htc_endpoint_id, int);
0353     void (*tx_comp_multi) (struct htc_target *, struct list_head *);
0354     int rx_alloc_thresh;
0355     int rx_refill_thresh;
0356 };
0357 
0358 /* service connection information */
0359 struct htc_service_connect_req {
0360     u16 svc_id;
0361     u16 conn_flags;
0362     struct htc_ep_callbacks ep_cb;
0363     int max_txq_depth;
0364     u32 flags;
0365     unsigned int max_rxmsg_sz;
0366 };
0367 
0368 /* service connection response information */
0369 struct htc_service_connect_resp {
0370     u8 buf_len;
0371     u8 act_len;
0372     enum htc_endpoint_id endpoint;
0373     unsigned int len_max;
0374     u8 resp_code;
0375 };
0376 
0377 /* endpoint distributionstructure */
0378 struct htc_endpoint_credit_dist {
0379     struct list_head list;
0380 
0381     /* Service ID (set by HTC) */
0382     u16 svc_id;
0383 
0384     /* endpoint for this distributionstruct (set by HTC) */
0385     enum htc_endpoint_id endpoint;
0386 
0387     u32 dist_flags;
0388 
0389     /*
0390      * credits for normal operation, anything above this
0391      * indicates the endpoint is over-subscribed.
0392      */
0393     int cred_norm;
0394 
0395     /* floor for credit distribution */
0396     int cred_min;
0397 
0398     int cred_assngd;
0399 
0400     /* current credits available */
0401     int credits;
0402 
0403     /*
0404      * pending credits to distribute on this endpoint, this
0405      * is set by HTC when credit reports arrive.  The credit
0406      * distribution functions sets this to zero when it distributes
0407      * the credits.
0408      */
0409     int cred_to_dist;
0410 
0411     /*
0412      * the number of credits that the current pending TX packet needs
0413      * to transmit. This is set by HTC when endpoint needs credits in
0414      * order to transmit.
0415      */
0416     int seek_cred;
0417 
0418     /* size in bytes of each credit */
0419     int cred_sz;
0420 
0421     /* credits required for a maximum sized messages */
0422     int cred_per_msg;
0423 
0424     /* reserved for HTC use */
0425     struct htc_endpoint *htc_ep;
0426 
0427     /*
0428      * current depth of TX queue , i.e. messages waiting for credits
0429      * This field is valid only when HTC_CREDIT_DIST_ACTIVITY_CHANGE
0430      * or HTC_CREDIT_DIST_SEND_COMPLETE is indicated on an endpoint
0431      * that has non-zero credits to recover.
0432      */
0433     int txq_depth;
0434 };
0435 
0436 /*
0437  * credit distribution code that is passed into the distribution function,
0438  * there are mandatory and optional codes that must be handled
0439  */
0440 enum htc_credit_dist_reason {
0441     HTC_CREDIT_DIST_SEND_COMPLETE = 0,
0442     HTC_CREDIT_DIST_ACTIVITY_CHANGE = 1,
0443     HTC_CREDIT_DIST_SEEK_CREDITS,
0444 };
0445 
0446 struct ath6kl_htc_credit_info {
0447     int total_avail_credits;
0448     int cur_free_credits;
0449 
0450     /* list of lowest priority endpoints */
0451     struct list_head lowestpri_ep_dist;
0452 };
0453 
0454 /* endpoint statistics */
0455 struct htc_endpoint_stats {
0456     /*
0457      * number of times the host set the credit-low flag in a send
0458      * message on this endpoint
0459      */
0460     u32 cred_low_indicate;
0461 
0462     u32 tx_issued;
0463     u32 tx_pkt_bundled;
0464     u32 tx_bundles;
0465     u32 tx_dropped;
0466 
0467     /* running count of total credit reports received for this endpoint */
0468     u32 tx_cred_rpt;
0469 
0470     /* credit reports received from this endpoint's RX packets */
0471     u32 cred_rpt_from_rx;
0472 
0473     /* credit reports received from RX packets of other endpoints */
0474     u32 cred_rpt_from_other;
0475 
0476     /* credit reports received from endpoint 0 RX packets */
0477     u32 cred_rpt_ep0;
0478 
0479     /* count of credits received via Rx packets on this endpoint */
0480     u32 cred_from_rx;
0481 
0482     /* count of credits received via another endpoint */
0483     u32 cred_from_other;
0484 
0485     /* count of credits received via another endpoint */
0486     u32 cred_from_ep0;
0487 
0488     /* count of consummed credits */
0489     u32 cred_cosumd;
0490 
0491     /* count of credits returned */
0492     u32 cred_retnd;
0493 
0494     u32 rx_pkts;
0495 
0496     /* count of lookahead records found in Rx msg */
0497     u32 rx_lkahds;
0498 
0499     /* count of recv packets received in a bundle */
0500     u32 rx_bundl;
0501 
0502     /* count of number of bundled lookaheads */
0503     u32 rx_bundle_lkahd;
0504 
0505     /* count of the number of bundle indications from the HTC header */
0506     u32 rx_bundle_from_hdr;
0507 
0508     /* the number of times the recv allocation threshold was hit */
0509     u32 rx_alloc_thresh_hit;
0510 
0511     /* total number of bytes */
0512     u32 rxalloc_thresh_byte;
0513 };
0514 
0515 struct htc_endpoint {
0516     enum htc_endpoint_id eid;
0517     u16 svc_id;
0518     struct list_head txq;
0519     struct list_head rx_bufq;
0520     struct htc_endpoint_credit_dist cred_dist;
0521     struct htc_ep_callbacks ep_cb;
0522     int max_txq_depth;
0523     int len_max;
0524     int tx_proc_cnt;
0525     int rx_proc_cnt;
0526     struct htc_target *target;
0527     u8 seqno;
0528     u32 conn_flags;
0529     struct htc_endpoint_stats ep_st;
0530     u16 tx_drop_packet_threshold;
0531 
0532     struct {
0533         u8 pipeid_ul;
0534         u8 pipeid_dl;
0535         struct list_head tx_lookup_queue;
0536         bool tx_credit_flow_enabled;
0537     } pipe;
0538 };
0539 
0540 struct htc_control_buffer {
0541     struct htc_packet packet;
0542     u8 *buf;
0543 };
0544 
0545 struct htc_pipe_txcredit_alloc {
0546     u16 service_id;
0547     u8 credit_alloc;
0548 };
0549 
0550 enum htc_send_queue_result {
0551     HTC_SEND_QUEUE_OK = 0,  /* packet was queued */
0552     HTC_SEND_QUEUE_DROP = 1,    /* this packet should be dropped */
0553 };
0554 
0555 struct ath6kl_htc_ops {
0556     void* (*create)(struct ath6kl *ar);
0557     int (*wait_target)(struct htc_target *target);
0558     int (*start)(struct htc_target *target);
0559     int (*conn_service)(struct htc_target *target,
0560                 struct htc_service_connect_req *req,
0561                 struct htc_service_connect_resp *resp);
0562     int  (*tx)(struct htc_target *target, struct htc_packet *packet);
0563     void (*stop)(struct htc_target *target);
0564     void (*cleanup)(struct htc_target *target);
0565     void (*flush_txep)(struct htc_target *target,
0566                enum htc_endpoint_id endpoint, u16 tag);
0567     void (*flush_rx_buf)(struct htc_target *target);
0568     void (*activity_changed)(struct htc_target *target,
0569                  enum htc_endpoint_id endpoint,
0570                  bool active);
0571     int (*get_rxbuf_num)(struct htc_target *target,
0572                  enum htc_endpoint_id endpoint);
0573     int (*add_rxbuf_multiple)(struct htc_target *target,
0574                   struct list_head *pktq);
0575     int (*credit_setup)(struct htc_target *target,
0576                 struct ath6kl_htc_credit_info *cred_info);
0577     int (*tx_complete)(struct ath6kl *ar, struct sk_buff *skb);
0578     int (*rx_complete)(struct ath6kl *ar, struct sk_buff *skb, u8 pipe);
0579 };
0580 
0581 struct ath6kl_device;
0582 
0583 /* our HTC target state */
0584 struct htc_target {
0585     struct htc_endpoint endpoint[ENDPOINT_MAX];
0586 
0587     /* contains struct htc_endpoint_credit_dist */
0588     struct list_head cred_dist_list;
0589 
0590     struct list_head free_ctrl_txbuf;
0591     struct list_head free_ctrl_rxbuf;
0592     struct ath6kl_htc_credit_info *credit_info;
0593     int tgt_creds;
0594     unsigned int tgt_cred_sz;
0595 
0596     /* protects free_ctrl_txbuf and free_ctrl_rxbuf */
0597     spinlock_t htc_lock;
0598 
0599     /* FIXME: does this protext rx_bufq and endpoint structures or what? */
0600     spinlock_t rx_lock;
0601 
0602     /* protects endpoint->txq */
0603     spinlock_t tx_lock;
0604 
0605     struct ath6kl_device *dev;
0606     u32 htc_flags;
0607     u32 rx_st_flags;
0608     enum htc_endpoint_id ep_waiting;
0609     u8 htc_tgt_ver;
0610 
0611     /* max messages per bundle for HTC */
0612     int msg_per_bndl_max;
0613 
0614     u32 tx_bndl_mask;
0615     int rx_bndl_enable;
0616     int max_rx_bndl_sz;
0617     int max_tx_bndl_sz;
0618 
0619     u32 block_sz;
0620     u32 block_mask;
0621 
0622     int max_scat_entries;
0623     int max_xfer_szper_scatreq;
0624 
0625     int chk_irq_status_cnt;
0626 
0627     /* counts the number of Tx without bundling continously per AC */
0628     u32 ac_tx_count[WMM_NUM_AC];
0629 
0630     struct {
0631         struct htc_packet *htc_packet_pool;
0632         u8 ctrl_response_buf[HTC_MAX_CTRL_MSG_LEN];
0633         int ctrl_response_len;
0634         bool ctrl_response_valid;
0635         struct htc_pipe_txcredit_alloc txcredit_alloc[ENDPOINT_MAX];
0636     } pipe;
0637 };
0638 
0639 int ath6kl_htc_rxmsg_pending_handler(struct htc_target *target,
0640                      u32 msg_look_ahead, int *n_pkts);
0641 
0642 static inline void set_htc_pkt_info(struct htc_packet *packet, void *context,
0643                     u8 *buf, unsigned int len,
0644                     enum htc_endpoint_id eid, u16 tag)
0645 {
0646     packet->pkt_cntxt = context;
0647     packet->buf = buf;
0648     packet->act_len = len;
0649     packet->endpoint = eid;
0650     packet->info.tx.tag = tag;
0651 }
0652 
0653 static inline void htc_rxpkt_reset(struct htc_packet *packet)
0654 {
0655     packet->buf = packet->buf_start;
0656     packet->act_len = 0;
0657 }
0658 
0659 static inline void set_htc_rxpkt_info(struct htc_packet *packet, void *context,
0660                       u8 *buf, unsigned long len,
0661                       enum htc_endpoint_id eid)
0662 {
0663     packet->pkt_cntxt = context;
0664     packet->buf = buf;
0665     packet->buf_start = buf;
0666     packet->buf_len = len;
0667     packet->endpoint = eid;
0668 }
0669 
0670 static inline int get_queue_depth(struct list_head *queue)
0671 {
0672     struct list_head *tmp_list;
0673     int depth = 0;
0674 
0675     list_for_each(tmp_list, queue)
0676         depth++;
0677 
0678     return depth;
0679 }
0680 
0681 void ath6kl_htc_pipe_attach(struct ath6kl *ar);
0682 void ath6kl_htc_mbox_attach(struct ath6kl *ar);
0683 
0684 #endif