if_ath_alq.h revision 242781
1/*- 2 * Copyright (c) 2012 Adrian Chadd 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer, 10 * without modification. 11 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 12 * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 13 * redistribution must be conditioned upon including a substantially 14 * similar Disclaimer requirement for further binary redistribution. 15 * 16 * NO WARRANTY 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 20 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 21 * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 22 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 27 * THE POSSIBILITY OF SUCH DAMAGES. 28 * 29 * $FreeBSD: head/sys/dev/ath/if_ath_alq.h 242781 2012-11-08 18:07:29Z adrian $ 30 */ 31#ifndef __IF_ATH_ALQ_H__ 32#define __IF_ATH_ALQ_H__ 33 34#define ATH_ALQ_FILENAME_LEN 128 35#define ATH_ALQ_DEVNAME_LEN 32 36 37struct if_ath_alq { 38 uint32_t sc_alq_debug; /* Debug flags to report */ 39 struct alq * sc_alq_alq; /* alq state */ 40 unsigned int sc_alq_qsize; /* queue size */ 41 unsigned int sc_alq_numlost; /* number of "lost" entries */ 42 int sc_alq_isactive; 43 char sc_alq_devname[ATH_ALQ_DEVNAME_LEN]; 44 char sc_alq_filename[ATH_ALQ_FILENAME_LEN]; 45}; 46 47#define ATH_ALQ_EDMA_TXSTATUS 1 48#define ATH_ALQ_EDMA_RXSTATUS 2 49#define ATH_ALQ_EDMA_TXDESC 3 50 51/* 128 bytes in total */ 52#define ATH_ALQ_PAYLOAD_LEN 112 53 54struct if_ath_alq_hdr { 55 uint64_t threadid; 56 uint32_t tstamp; 57 uint16_t op; 58 uint16_t len; /* Length of (optional) payload */ 59}; 60 61struct if_ath_alq_payload { 62 struct if_ath_alq_hdr hdr; 63 char payload[]; 64}; 65 66#ifdef _KERNEL 67static inline int 68if_ath_alq_checkdebug(struct if_ath_alq *alq, uint16_t op) 69{ 70 71 return (alq->sc_alq_debug & (1 << (op - 1))); 72} 73 74extern void if_ath_alq_init(struct if_ath_alq *alq, const char *devname); 75extern void if_ath_alq_tidyup(struct if_ath_alq *alq); 76extern int if_ath_alq_start(struct if_ath_alq *alq); 77extern int if_ath_alq_stop(struct if_ath_alq *alq); 78extern void if_ath_alq_post(struct if_ath_alq *alq, uint16_t op, 79 uint16_t len, const char *buf); 80#endif /* _KERNEL */ 81 82#endif 83