summaryrefslogtreecommitdiff
path: root/uapi
diff options
context:
space:
mode:
authorPrakash Dhavali <pdhavali@codeaurora.org>2015-11-02 17:55:19 -0800
committerPrakash Dhavali <pdhavali@codeaurora.org>2015-11-17 17:52:53 -0800
commit7090c5fd8d2bc46a463549bf26505e67a32d1d0e (patch)
tree776ac2d3640e034d07fa959888a59b2fa6d001e0 /uapi
parent8508e16801dbea385191d858c82356d7894f3f91 (diff)
qcacld-3.0: Initial snapshot of ihelium wlan driver
qcacld-3.0: Initial snapshot of ihelium wlan driver to match code-scanned SU Release 5.0.0.139. This is open-source version of wlan for next Android release. Change-Id: Icf598ca97da74f84bea607e4e902d1889806f507
Diffstat (limited to 'uapi')
-rw-r--r--uapi/linux/a_debug.h202
-rw-r--r--uapi/linux/a_types.h52
-rw-r--r--uapi/linux/athstartpack.h48
-rw-r--r--uapi/linux/dbglog_common.h142
-rw-r--r--uapi/linux/debug_linux.h50
-rw-r--r--uapi/linux/osapi_linux.h293
-rw-r--r--uapi/linux/pktlog_ac_fmt.h267
7 files changed, 1054 insertions, 0 deletions
diff --git a/uapi/linux/a_debug.h b/uapi/linux/a_debug.h
new file mode 100644
index 000000000000..62931060cf08
--- /dev/null
+++ b/uapi/linux/a_debug.h
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * This file was originally distributed by Qualcomm Atheros, Inc.
+ * under proprietary terms before Copyright ownership was assigned
+ * to the Linux Foundation.
+ */
+
+#ifndef _A_DEBUG_H_
+#define _A_DEBUG_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <a_types.h>
+#include "osapi_linux.h"
+
+/* standard debug print masks bits 0..7 */
+#define ATH_DEBUG_ERR (1 << 0) /* errors */
+#define ATH_DEBUG_WARN (1 << 1) /* warnings */
+#define ATH_DEBUG_INFO (1 << 2) /* informational (module startup info) */
+#define ATH_DEBUG_TRC (1 << 3) /* generic function call tracing */
+#define ATH_DEBUG_RSVD1 (1 << 4)
+#define ATH_DEBUG_RSVD2 (1 << 5)
+#define ATH_DEBUG_RSVD3 (1 << 6)
+#define ATH_DEBUG_RSVD4 (1 << 7)
+
+#define ATH_DEBUG_MASK_DEFAULTS (ATH_DEBUG_ERR | ATH_DEBUG_WARN)
+#define ATH_DEBUG_ANY 0xFFFF
+
+/* other aliases used throughout */
+#define ATH_DEBUG_ERROR ATH_DEBUG_ERR
+#define ATH_LOG_ERR ATH_DEBUG_ERR
+#define ATH_LOG_INF ATH_DEBUG_INFO
+#define ATH_LOG_TRC ATH_DEBUG_TRC
+#define ATH_DEBUG_TRACE ATH_DEBUG_TRC
+#define ATH_DEBUG_INIT ATH_DEBUG_INFO
+
+/* bits 8..31 are module-specific masks */
+#define ATH_DEBUG_MODULE_MASK_SHIFT 8
+
+/* macro to make a module-specific masks */
+#define ATH_DEBUG_MAKE_MODULE_MASK(index) (1 << (ATH_DEBUG_MODULE_MASK_SHIFT + (index)))
+
+void debug_dump_bytes(A_UCHAR *buffer, A_UINT16 length,
+ char *pDescription);
+
+/* Debug support on a per-module basis
+ *
+ * Usage:
+ *
+ * Each module can utilize it's own debug mask variable. A set of commonly used
+ * masks are provided (ERRORS, WARNINGS, TRACE etc..). It is up to each module
+ * to define module-specific masks using the macros above.
+ *
+ * Each module defines a single debug mask variable debug_XXX where the "name" of the module is
+ * common to all C-files within that module. This requires every C-file that includes a_debug.h
+ * to define the module name in that file.
+ *
+ * Example:
+ *
+ * #define ATH_MODULE_NAME htc
+ * #include "a_debug.h"
+ *
+ * This will define a debug mask structure called debug_htc and all debug macros will reference this
+ * variable.
+ *
+ * A module can define module-specific bit masks using the ATH_DEBUG_MAKE_MODULE_MASK() macro:
+ *
+ * #define ATH_DEBUG_MY_MASK1 ATH_DEBUG_MAKE_MODULE_MASK(0)
+ * #define ATH_DEBUG_MY_MASK2 ATH_DEBUG_MAKE_MODULE_MASK(1)
+ *
+ * The instantiation of the debug structure should be made by the module. When a module is
+ * instantiated, the module can set a description string, a default mask and an array of description
+ * entries containing information on each module-defined debug mask.
+ * NOTE: The instantiation is statically allocated, only one instance can exist per module.
+ *
+ * Example:
+ *
+ *
+ * #define ATH_DEBUG_BMI ATH_DEBUG_MAKE_MODULE_MASK(0)
+ *
+ * #ifdef DEBUG
+ * static ATH_DEBUG_MASK_DESCRIPTION bmi_debug_desc[] = {
+ * { ATH_DEBUG_BMI , "BMI Tracing"}, <== description of the module specific mask
+ * };
+ *
+ * ATH_DEBUG_INSTANTIATE_MODULE_VAR(bmi,
+ * "bmi" <== module name
+ * "Boot Manager Interface", <== description of module
+ * ATH_DEBUG_MASK_DEFAULTS, <== defaults
+ * ATH_DEBUG_DESCRIPTION_COUNT(bmi_debug_desc),
+ * bmi_debug_desc);
+ *
+ * #endif
+ *
+ * A module can optionally register it's debug module information in order for other tools to change the
+ * bit mask at runtime. A module can call A_REGISTER_MODULE_DEBUG_INFO() in it's module
+ * init code. This macro can be called multiple times without consequence. The debug info maintains
+ * state to indicate whether the information was previously registered.
+ *
+ * */
+
+#define ATH_DEBUG_MAX_MASK_DESC_LENGTH 32
+#define ATH_DEBUG_MAX_MOD_DESC_LENGTH 64
+
+typedef struct {
+ A_UINT32 Mask;
+ A_CHAR Description[ATH_DEBUG_MAX_MASK_DESC_LENGTH];
+} ATH_DEBUG_MASK_DESCRIPTION;
+
+#define ATH_DEBUG_INFO_FLAGS_REGISTERED (1 << 0)
+
+typedef struct _ATH_DEBUG_MODULE_DBG_INFO {
+ struct _ATH_DEBUG_MODULE_DBG_INFO *pNext;
+ A_CHAR ModuleName[16];
+ A_CHAR ModuleDescription[ATH_DEBUG_MAX_MOD_DESC_LENGTH];
+ A_UINT32 Flags;
+ A_UINT32 CurrentMask;
+ int MaxDescriptions;
+ ATH_DEBUG_MASK_DESCRIPTION *pMaskDescriptions; /* pointer to array of descriptions */
+} ATH_DEBUG_MODULE_DBG_INFO;
+
+#define ATH_DEBUG_DESCRIPTION_COUNT(d) (int)((sizeof((d))) / (sizeof(ATH_DEBUG_MASK_DESCRIPTION)))
+
+#define GET_ATH_MODULE_DEBUG_VAR_NAME(s) _XGET_ATH_MODULE_NAME_DEBUG_(s)
+#define GET_ATH_MODULE_DEBUG_VAR_MASK(s) _XGET_ATH_MODULE_NAME_DEBUG_(s).CurrentMask
+#define _XGET_ATH_MODULE_NAME_DEBUG_(s) debug_ ## s
+
+#ifdef DEBUG
+
+/* for source files that will instantiate the debug variables */
+#define ATH_DEBUG_INSTANTIATE_MODULE_VAR(s,name,moddesc,initmask,count,descriptions) \
+ ATH_DEBUG_MODULE_DBG_INFO GET_ATH_MODULE_DEBUG_VAR_NAME(s) = \
+ {NULL,(name),(moddesc),0,(initmask),count,(descriptions)}
+
+#ifdef ATH_MODULE_NAME
+extern ATH_DEBUG_MODULE_DBG_INFO
+GET_ATH_MODULE_DEBUG_VAR_NAME(ATH_MODULE_NAME);
+#define AR_DEBUG_LVL_CHECK(lvl) (GET_ATH_MODULE_DEBUG_VAR_MASK(ATH_MODULE_NAME) & (lvl))
+#endif /* ATH_MODULE_NAME */
+
+#define ATH_DEBUG_SET_DEBUG_MASK(s,lvl) GET_ATH_MODULE_DEBUG_VAR_MASK(s) = (lvl)
+
+#define ATH_DEBUG_DECLARE_EXTERN(s) \
+ extern ATH_DEBUG_MODULE_DBG_INFO GET_ATH_MODULE_DEBUG_VAR_NAME(s)
+
+#define AR_DEBUG_PRINTBUF(buffer, length, desc) debug_dump_bytes(buffer,length,desc)
+
+#define AR_DEBUG_ASSERT A_ASSERT
+
+void a_dump_module_debug_info(ATH_DEBUG_MODULE_DBG_INFO *pInfo);
+void a_register_module_debug_info(ATH_DEBUG_MODULE_DBG_INFO *pInfo);
+#ifdef A_SIMOS_DEVHOST
+#define A_DUMP_MODULE_DEBUG_INFO(s) a_dump_module_debug_info(&(GET_ATH_MODULE_DEBUG_VAR_NAME(s)))
+#define A_REGISTER_MODULE_DEBUG_INFO(s) a_register_module_debug_info(&(GET_ATH_MODULE_DEBUG_VAR_NAME(s)))
+#else
+#define A_DUMP_MODULE_DEBUG_INFO(s)
+#define A_REGISTER_MODULE_DEBUG_INFO(s)
+#endif
+
+#else /* !DEBUG */
+/* NON DEBUG */
+#define ATH_DEBUG_INSTANTIATE_MODULE_VAR(s,name,moddesc,initmask,count,descriptions)
+#define AR_DEBUG_LVL_CHECK(lvl) 0
+#define AR_DEBUG_PRINTBUF(buffer, length, desc)
+#define AR_DEBUG_ASSERT(test)
+#define ATH_DEBUG_DECLARE_EXTERN(s)
+#define ATH_DEBUG_SET_DEBUG_MASK(s,lvl)
+#define A_DUMP_MODULE_DEBUG_INFO(s)
+#define A_REGISTER_MODULE_DEBUG_INFO(s)
+
+#endif
+
+#if defined(__linux__) && !defined(LINUX_EMULATION)
+#include "debug_linux.h"
+#endif
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif
diff --git a/uapi/linux/a_types.h b/uapi/linux/a_types.h
new file mode 100644
index 000000000000..b47f4a83903c
--- /dev/null
+++ b/uapi/linux/a_types.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2013-2014 The Linux Foundation. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * This file was originally distributed by Qualcomm Atheros, Inc.
+ * under proprietary terms before Copyright ownership was assigned
+ * to the Linux Foundation.
+ */
+
+/* depot/sw/qca_main/perf_pwr_offload/drivers/host/include/a_types.h#7 - integrate change 1327637 (ktext) */
+/* ============================================================================== */
+/* This file contains the definitions of the basic atheros data types. */
+/* It is used to map the data types in atheros files to a platform specific */
+/* type. */
+/* */
+/* Author(s): ="Atheros" */
+/* ============================================================================== */
+
+#ifndef _A_TYPES_H_
+#define _A_TYPES_H_
+#include <athdefs.h>
+
+typedef unsigned int A_UINT32;
+typedef unsigned long long A_UINT64;
+typedef unsigned short A_UINT16;
+typedef unsigned char A_UINT8;
+typedef int A_INT32;
+typedef short A_INT16;
+typedef char A_INT8;
+typedef unsigned char A_UCHAR;
+typedef char A_CHAR;
+typedef _Bool A_BOOL;
+
+#endif /* _ATHTYPES_H_ */
diff --git a/uapi/linux/athstartpack.h b/uapi/linux/athstartpack.h
new file mode 100644
index 000000000000..c6c051eb2912
--- /dev/null
+++ b/uapi/linux/athstartpack.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2013-2014 The Linux Foundation. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * This file was originally distributed by Qualcomm Atheros, Inc.
+ * under proprietary terms before Copyright ownership was assigned
+ * to the Linux Foundation.
+ */
+
+#ifndef _ATHSTARTPACK_H
+#define _ATHSTARTPACK_H
+
+#if defined(LINUX) || defined(__linux__)
+#include "osapi_linux.h"
+#endif /* LINUX */
+
+#ifdef QNX
+#endif /* QNX */
+
+#if __LONG_MAX__ == __INT_MAX__
+/* 32-bit compilation */
+#define PREPACK64
+#define POSTPACK64
+#else
+/* 64-bit compilation */
+#define PREPACK64 PREPACK
+#define POSTPACK64 POSTPACK
+#endif
+
+#endif /* _ATHSTARTPACK_H */
diff --git a/uapi/linux/dbglog_common.h b/uapi/linux/dbglog_common.h
new file mode 100644
index 000000000000..152862fa661b
--- /dev/null
+++ b/uapi/linux/dbglog_common.h
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2011, 2014-2015 The Linux Foundation. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * This file was originally distributed by Qualcomm Atheros, Inc.
+ * under proprietary terms before Copyright ownership was assigned
+ * to the Linux Foundation.
+ */
+
+#ifndef _DBGLOG_COMMON_H_
+#define _DBGLOG_COMMON_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "dbglog_id.h"
+#include "dbglog.h"
+
+#define MAX_DBG_MSGS 256
+
+#define ATH6KL_FWLOG_PAYLOAD_SIZE 1500
+
+#define DBGLOG_PRINT_PREFIX "FWLOG: "
+
+/* Handy Macros to read data length and type from FW */
+#define WLAN_DIAG_0_TYPE_S 0
+#define WLAN_DIAG_0_TYPE 0x000000ff
+#define WLAN_DIAG_0_TYPE_GET(x) WMI_F_MS(x, WLAN_DIAG_0_TYPE)
+#define WLAN_DIAG_0_TYPE_SET(x, y) WMI_F_RMW(x, y, WLAN_DIAG_0_TYPE)
+/* bits 8-15 reserved */
+
+/* length includes the size of wlan_diag_data */
+#define WLAN_DIAG_0_LEN_S 16
+#define WLAN_DIAG_0_LEN 0xffff0000
+#define WLAN_DIAG_0_LEN_GET(x) WMI_F_MS(x, WLAN_DIAG_0_LEN)
+#define WLAN_DIAG_0_LEN_SET(x, y) WMI_F_RMW(x, y, WLAN_DIAG_0_LEN)
+
+#define CNSS_DIAG_SLEEP_INTERVAL 5 /* In secs */
+
+#define ATH6KL_FWLOG_MAX_ENTRIES 20
+#define ATH6KL_FWLOG_PAYLOAD_SIZE 1500
+
+#define DIAG_WLAN_DRIVER_UNLOADED 6
+#define DIAG_WLAN_DRIVER_LOADED 7
+#define DIAG_TYPE_LOGS 1
+#define DIAG_TYPE_EVENTS 2
+
+typedef enum {
+ DBGLOG_PROCESS_DEFAULT = 0,
+ DBGLOG_PROCESS_PRINT_RAW, /* print them in debug view */
+ DBGLOG_PROCESS_POOL_RAW, /* user buffer pool to save them */
+ DBGLOG_PROCESS_NET_RAW, /* user buffer pool to save them */
+ DBGLOG_PROCESS_MAX,
+} dbglog_process_t;
+
+enum cnss_diag_type {
+ DIAG_TYPE_FW_EVENT, /* send fw event- to diag */
+ DIAG_TYPE_FW_LOG, /* send log event- to diag */
+ DIAG_TYPE_FW_DEBUG_MSG, /* send dbg message- to diag */
+ DIAG_TYPE_INIT_REQ, /* cnss_diag initialization- from diag */
+ DIAG_TYPE_FW_MSG, /* fw msg command-to diag */
+ DIAG_TYPE_HOST_MSG, /* host command-to diag */
+ DIAG_TYPE_CRASH_INJECT, /*crash inject-from diag */
+ DIAG_TYPE_DBG_LEVEL, /* DBG LEVEL-from diag */
+};
+
+enum wlan_diag_config_type {
+ DIAG_VERSION_INFO,
+};
+
+enum wlan_diag_frame_type {
+ WLAN_DIAG_TYPE_CONFIG,
+ WLAN_DIAG_TYPE_EVENT,
+ WLAN_DIAG_TYPE_LOG,
+ WLAN_DIAG_TYPE_MSG,
+ WLAN_DIAG_TYPE_LEGACY_MSG,
+};
+
+/* log/event are always 32-bit aligned. Padding is inserted after
+ * optional payload to satisify this requirement */
+struct wlan_diag_data {
+ unsigned int word0; /* type, length */
+ unsigned int target_time;
+ unsigned int code; /* Diag log or event Code */
+ uint8_t payload[0];
+};
+
+struct dbglog_slot {
+ unsigned int diag_type;
+ unsigned int timestamp;
+ unsigned int length;
+ unsigned int dropped;
+ /* max ATH6KL_FWLOG_PAYLOAD_SIZE bytes */
+ uint8_t payload[0];
+} __packed;
+
+typedef struct event_report_s {
+ unsigned int diag_type;
+ unsigned short event_id;
+ unsigned short length;
+} event_report_t;
+
+/*
+ * Custom debug_print handlers
+ * Args:
+ * module Id
+ * vap id
+ * debug msg id
+ * Time stamp
+ * no of arguments
+ * pointer to the buffer holding the args
+ */
+typedef A_BOOL (*module_dbg_print)(A_UINT32, A_UINT16, A_UINT32,
+ A_UINT32, A_UINT16, A_UINT32 *);
+
+/** Register module specific dbg print*/
+void dbglog_reg_modprint(A_UINT32 mod_id, module_dbg_print printfn);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _DBGLOG_COMMON_H_ */
diff --git a/uapi/linux/debug_linux.h b/uapi/linux/debug_linux.h
new file mode 100644
index 000000000000..57c3590efba4
--- /dev/null
+++ b/uapi/linux/debug_linux.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * This file was originally distributed by Qualcomm Atheros, Inc.
+ * under proprietary terms before Copyright ownership was assigned
+ * to the Linux Foundation.
+ */
+
+#ifndef _DEBUG_LINUX_H_
+#define _DEBUG_LINUX_H_
+
+/* macro to remove parens */
+#define ATH_PRINTX_ARG(arg ...) arg
+
+#ifdef DEBUG
+/* NOTE: the AR_DEBUG_PRINTF macro is defined here to handle special handling of variable arg macros
+ * which may be compiler dependent. */
+#define AR_DEBUG_PRINTF(mask, args) do { \
+ if (GET_ATH_MODULE_DEBUG_VAR_MASK(ATH_MODULE_NAME) & (mask)) { \
+ A_LOGGER(mask, ATH_MODULE_NAME, ATH_PRINTX_ARG args); \
+ } \
+} while (0)
+#else
+/* on non-debug builds, keep in error and warning messages in the driver, all other
+ * message tracing will get compiled out */
+#define AR_DEBUG_PRINTF(mask, args) \
+ if ((mask) & (ATH_DEBUG_ERR | ATH_DEBUG_WARN)) { A_PRINTF(ATH_PRINTX_ARG args); }
+
+#endif
+
+#endif /* _DEBUG_LINUX_H_ */
diff --git a/uapi/linux/osapi_linux.h b/uapi/linux/osapi_linux.h
new file mode 100644
index 000000000000..e0420bc12e7f
--- /dev/null
+++ b/uapi/linux/osapi_linux.h
@@ -0,0 +1,293 @@
+/*
+ * Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * This file was originally distributed by Qualcomm Atheros, Inc.
+ * under proprietary terms before Copyright ownership was assigned
+ * to the Linux Foundation.
+ */
+
+/* ------------------------------------------------------------------------------ */
+/* This file contains the definitions of the basic atheros data types. */
+/* It is used to map the data types in atheros files to a platform specific */
+/* type. */
+/* ------------------------------------------------------------------------------ */
+
+#ifndef _OSAPI_LINUX_H_
+#define _OSAPI_LINUX_H_
+
+#ifdef __KERNEL__
+
+#include <linux/version.h>
+#include <generated/autoconf.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/skbuff.h>
+#include <linux/netdevice.h>
+#include <linux/jiffies.h>
+#include <linux/timer.h>
+#include <linux/delay.h>
+#include <linux/wait.h>
+#include <linux/semaphore.h>
+
+#include <linux/cache.h>
+/* #include <linux/kthread.h> */
+#include "a_types.h"
+
+#ifdef __GNUC__
+#define __ATTRIB_PACK __attribute__ ((packed))
+#define __ATTRIB_PRINTF __attribute__ ((format (printf, 1, 2)))
+#define __ATTRIB_NORETURN __attribute__ ((noreturn))
+#else /* Not GCC */
+#define __ATTRIB_PACK
+#define __ATTRIB_PRINTF
+#define __ATTRIB_NORETURN
+#endif /* End __GNUC__ */
+
+#define PREPACK
+#define POSTPACK __ATTRIB_PACK
+
+#define A_MEMCPY(dst, src, len) memcpy((A_UINT8 *)(dst), (src), (len))
+#define A_MEMZERO(addr, len) memset(addr, 0, len)
+#define A_MEMSET(addr, value, size) memset((addr), (value), (size))
+#define A_MEMCMP(addr1, addr2, len) memcmp((addr1), (addr2), (len))
+
+#if defined(ANDROID_ENV) && defined(CONFIG_ANDROID_LOGGER)
+extern unsigned int enablelogcat;
+extern int android_logger_lv(void *module, int mask);
+enum logidx { LOG_MAIN_IDX = 0 };
+extern int logger_write(const enum logidx idx,
+ const unsigned char prio,
+ const char __kernel *const tag,
+ const char __kernel *const fmt, ...);
+#define A_ANDROID_PRINTF(mask, module, tags, args ...) do { \
+ if (enablelogcat) \
+ logger_write(LOG_MAIN_IDX, android_logger_lv(module, mask), tags, args); \
+ else \
+ printk(KERN_ALERT args); \
+} while (0)
+#ifdef DEBUG
+#define A_LOGGER_MODULE_NAME(x) # x
+#define A_LOGGER(mask, mod, args ...) \
+ A_ANDROID_PRINTF(mask, &GET_ATH_MODULE_DEBUG_VAR_NAME(mod), "ar6k_" A_LOGGER_MODULE_NAME(mod), args);
+#endif
+#define A_PRINTF(args ...) A_ANDROID_PRINTF(ATH_DEBUG_INFO, NULL, "ar6k_driver", args)
+#else
+#define A_LOGGER(mask, mod, args ...) printk(args)
+#define A_PRINTF(args ...) printk(args)
+#endif /* ANDROID */
+#define A_PRINTF_LOG(args ...) printk(args)
+#define A_SNPRINTF(buf, len, args ...) snprintf (buf, len, args)
+
+/*
+ * Timer Functions
+ */
+#define A_MSLEEP(msecs) \
+ { \
+ set_current_state(TASK_INTERRUPTIBLE); \
+ schedule_timeout((HZ * (msecs)) / 1000); \
+ set_current_state(TASK_RUNNING); \
+ }
+
+typedef struct timer_list A_TIMER;
+
+/*
+ * Wait Queue related functions
+ */
+#ifndef wait_event_interruptible_timeout
+#define __wait_event_interruptible_timeout(wq, condition, ret) \
+ do { \
+ wait_queue_t __wait; \
+ init_waitqueue_entry(&__wait, current); \
+ \
+ add_wait_queue(&wq, &__wait); \
+ for (;; ) { \
+ set_current_state(TASK_INTERRUPTIBLE); \
+ if (condition) \
+ break; \
+ if (!signal_pending(current)) { \
+ ret = schedule_timeout(ret); \
+ if (!ret) \
+ break; \
+ continue; \
+ } \
+ ret = -ERESTARTSYS; \
+ break; \
+ } \
+ current->state = TASK_RUNNING; \
+ remove_wait_queue(&wq, &__wait); \
+ } while (0)
+
+#define wait_event_interruptible_timeout(wq, condition, timeout) \
+ ({ \
+ long __ret = timeout; \
+ if (!(condition)) \
+ __wait_event_interruptible_timeout(wq, condition, __ret); \
+ __ret; \
+ })
+#endif /* wait_event_interruptible_timeout */
+
+#ifdef DEBUG
+#ifdef A_SIMOS_DEVHOST
+extern unsigned int panic_on_assert;
+#define A_ASSERT(expr) \
+ if (!(expr)) { \
+ printk(KERN_ALERT "Debug Assert Caught, File %s, Line: %d, Test:%s \n",__FILE__, __LINE__,# expr); \
+ if (panic_on_assert) panic(# expr); \
+ }
+#else
+#define A_ASSERT(expr) \
+ if (!(expr)) { \
+ printk(KERN_ALERT "Debug Assert Caught, File %s, Line: %d, Test:%s \n",__FILE__, __LINE__,# expr); \
+ }
+#endif
+#else
+#define A_ASSERT(expr)
+#endif /* DEBUG */
+
+#ifdef ANDROID_ENV
+struct firmware;
+int android_request_firmware(const struct firmware **firmware_p,
+ const char *filename, struct device *device);
+void android_release_firmware(const struct firmware *firmware);
+#define A_REQUEST_FIRMWARE(_ppf, _pfile, _dev) android_request_firmware(_ppf, _pfile, _dev)
+#define A_RELEASE_FIRMWARE(_pf) android_release_firmware(_pf)
+#else
+#define A_REQUEST_FIRMWARE(_ppf, _pfile, _dev) request_firmware(_ppf, _pfile, _dev)
+#define A_RELEASE_FIRMWARE(_pf) release_firmware(_pf)
+#endif
+
+/*
+ * Network buffer queue support
+ */
+typedef struct sk_buff_head A_NETBUF_QUEUE_T;
+
+#define A_NETBUF_FREE(bufPtr) \
+ a_netbuf_free(bufPtr)
+#define A_NETBUF_LEN(bufPtr) \
+ a_netbuf_to_len(bufPtr)
+#define A_NETBUF_PUSH(bufPtr, len) \
+ a_netbuf_push(bufPtr, len)
+#define A_NETBUF_PUT(bufPtr, len) \
+ a_netbuf_put(bufPtr, len)
+#define A_NETBUF_TRIM(bufPtr,len) \
+ a_netbuf_trim(bufPtr, len)
+#define A_NETBUF_PULL(bufPtr, len) \
+ a_netbuf_pull(bufPtr, len)
+#define A_NETBUF_HEADROOM(bufPtr) \
+ a_netbuf_headroom(bufPtr)
+#define A_NETBUF_SETLEN(bufPtr,len) \
+ a_netbuf_setlen(bufPtr, len)
+
+/* Add data to end of a buffer */
+#define A_NETBUF_PUT_DATA(bufPtr, srcPtr, len) \
+ a_netbuf_put_data(bufPtr, srcPtr, len)
+
+/* Add data to start of the buffer */
+#define A_NETBUF_PUSH_DATA(bufPtr, srcPtr, len) \
+ a_netbuf_push_data(bufPtr, srcPtr, len)
+
+/* Remove data at start of the buffer */
+#define A_NETBUF_PULL_DATA(bufPtr, dstPtr, len) \
+ a_netbuf_pull_data(bufPtr, dstPtr, len)
+
+/* Remove data from the end of the buffer */
+#define A_NETBUF_TRIM_DATA(bufPtr, dstPtr, len) \
+ a_netbuf_trim_data(bufPtr, dstPtr, len)
+
+/* View data as "size" contiguous bytes of type "t" */
+#define A_NETBUF_VIEW_DATA(bufPtr, t, size) \
+ (t )( ((struct skbuf *)(bufPtr))->data)
+
+/* return the beginning of the headroom for the buffer */
+#define A_NETBUF_HEAD(bufPtr) \
+ ((((struct sk_buff *)(bufPtr))->head))
+
+/*
+ * OS specific network buffer access routines
+ */
+void a_netbuf_free(void *bufPtr);
+void *a_netbuf_to_data(void *bufPtr);
+A_UINT32 a_netbuf_to_len(void *bufPtr);
+A_STATUS a_netbuf_push(void *bufPtr, A_INT32 len);
+A_STATUS a_netbuf_push_data(void *bufPtr, char *srcPtr, A_INT32 len);
+A_STATUS a_netbuf_put(void *bufPtr, A_INT32 len);
+A_STATUS a_netbuf_put_data(void *bufPtr, char *srcPtr, A_INT32 len);
+A_STATUS a_netbuf_pull(void *bufPtr, A_INT32 len);
+A_STATUS a_netbuf_pull_data(void *bufPtr, char *dstPtr, A_INT32 len);
+A_STATUS a_netbuf_trim(void *bufPtr, A_INT32 len);
+A_STATUS a_netbuf_trim_data(void *bufPtr, char *dstPtr, A_INT32 len);
+A_STATUS a_netbuf_setlen(void *bufPtr, A_INT32 len);
+A_INT32 a_netbuf_headroom(void *bufPtr);
+void a_netbuf_enqueue(A_NETBUF_QUEUE_T *q, void *pkt);
+void a_netbuf_prequeue(A_NETBUF_QUEUE_T *q, void *pkt);
+void *a_netbuf_dequeue(A_NETBUF_QUEUE_T *q);
+int a_netbuf_queue_size(A_NETBUF_QUEUE_T *q);
+int a_netbuf_queue_empty(A_NETBUF_QUEUE_T *q);
+int a_netbuf_queue_empty(A_NETBUF_QUEUE_T *q);
+void a_netbuf_queue_init(A_NETBUF_QUEUE_T *q);
+
+#ifdef QCA_PARTNER_PLATFORM
+#include "ath_carr_pltfrm.h"
+#endif /* QCA_PARTNER_PLATFORM */
+
+#else /* __KERNEL__ */
+
+#ifdef __GNUC__
+#define __ATTRIB_PACK __attribute__ ((packed))
+#define __ATTRIB_PRINTF __attribute__ ((format (printf, 1, 2)))
+#define __ATTRIB_NORETURN __attribute__ ((noreturn))
+#ifndef INLINE
+#define INLINE __inline__
+#endif
+#else /* Not GCC */
+#define __ATTRIB_PACK
+#define __ATTRIB_PRINTF
+#define __ATTRIB_NORETURN
+#ifndef INLINE
+#define INLINE __inline
+#endif
+#endif /* End __GNUC__ */
+
+#define PREPACK
+#define POSTPACK __ATTRIB_PACK
+
+#define A_MEMCPY(dst, src, len) memcpy((dst), (src), (len))
+#define A_MEMSET(addr, value, size) memset((addr), (value), (size))
+#define A_MEMZERO(addr, len) memset((addr), 0, (len))
+#define A_MEMCMP(addr1, addr2, len) memcmp((addr1), (addr2), (len))
+
+#ifdef ANDROID
+#ifndef err
+#include <errno.h>
+#define err(_s, args ...) do { \
+ fprintf(stderr, "%s: line %d ", __FILE__, __LINE__); \
+ fprintf(stderr, args); fprintf(stderr, ": %d\n", errno); \
+ exit(_s); } while (0)
+#endif
+#else
+#include <err.h>
+#endif
+
+#endif /* __KERNEL__ */
+
+#endif /* _OSAPI_LINUX_H_ */
diff --git a/uapi/linux/pktlog_ac_fmt.h b/uapi/linux/pktlog_ac_fmt.h
new file mode 100644
index 000000000000..bde0d3e6fea5
--- /dev/null
+++ b/uapi/linux/pktlog_ac_fmt.h
@@ -0,0 +1,267 @@
+/*
+ * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * This file was originally distributed by Qualcomm Atheros, Inc.
+ * under proprietary terms before Copyright ownership was assigned
+ * to the Linux Foundation.
+ */
+
+#ifndef REMOVE_PKT_LOG
+#ifndef _PKTLOG_FMT_H_
+#define _PKTLOG_FMT_H_
+
+#define CUR_PKTLOG_VER 10010 /* Packet log version */
+#define PKTLOG_MAGIC_NUM 7735225
+
+#ifdef __linux__
+#define PKTLOG_PROC_DIR "ath_pktlog"
+#define PKTLOG_PROC_SYSTEM "system"
+#define WLANDEV_BASENAME "cld"
+#endif
+
+#ifdef WIN32
+#pragma pack(push, pktlog_fmt, 1)
+#define __ATTRIB_PACK
+#elif defined(__EFI__)
+#define __ATTRIB_PACK
+#else
+#ifndef __ATTRIB_PACK
+#define __ATTRIB_PACK __attribute__ ((packed))
+#endif
+#endif
+#include <a_types.h>
+/*
+ * Each packet log entry consists of the following fixed length header
+ * followed by variable length log information determined by log_type
+ */
+
+struct ath_pktlog_hdr {
+ uint16_t flags;
+ uint16_t missed_cnt;
+ uint16_t log_type;
+ uint16_t size;
+ uint32_t timestamp;
+#ifdef HELIUMPLUS
+ uint32_t type_specific_data;
+#endif
+} __ATTRIB_PACK;
+
+#define ATH_PKTLOG_HDR_FLAGS_MASK 0xffff
+#define ATH_PKTLOG_HDR_FLAGS_SHIFT 0
+#define ATH_PKTLOG_HDR_FLAGS_OFFSET 0
+#define ATH_PKTLOG_HDR_MISSED_CNT_MASK 0xffff0000
+#define ATH_PKTLOG_HDR_MISSED_CNT_SHIFT 16
+#define ATH_PKTLOG_HDR_MISSED_CNT_OFFSET 0
+#define ATH_PKTLOG_HDR_LOG_TYPE_MASK 0xffff
+#define ATH_PKTLOG_HDR_LOG_TYPE_SHIFT 0
+#define ATH_PKTLOG_HDR_LOG_TYPE_OFFSET 1
+#define ATH_PKTLOG_HDR_SIZE_MASK 0xffff0000
+#define ATH_PKTLOG_HDR_SIZE_SHIFT 16
+#define ATH_PKTLOG_HDR_SIZE_OFFSET 1
+#define ATH_PKTLOG_HDR_TIMESTAMP_OFFSET 2
+#define ATH_PKTLOG_HDR_TYPE_SPECIFIC_DATA_OFFSET 3
+
+/**
+ * enum - Pktlog flag field details
+ * packet origin [1:0]
+ * 00 - Local
+ * 01 - Remote
+ * 10 - Unknown/Not applicable
+ * 11 - Reserved
+ * reserved [15:2]
+ */
+enum {
+ PKTLOG_FLG_FRM_TYPE_LOCAL_S = 0,
+ PKTLOG_FLG_FRM_TYPE_REMOTE_S,
+ PKTLOG_FLG_FRM_TYPE_CLONE_S,
+ PKTLOG_FLG_FRM_TYPE_CBF_S,
+ PKTLOG_FLG_FRM_TYPE_UNKNOWN_S
+};
+
+#define PHFLAGS_INTERRUPT_CONTEXT 0x80000000
+
+/* Masks for setting pktlog events filters */
+#define ATH_PKTLOG_TX 0x000000001
+#define ATH_PKTLOG_RX 0x000000002
+#define ATH_PKTLOG_RCFIND 0x000000004
+#define ATH_PKTLOG_RCUPDATE 0x000000008
+#define ATH_PKTLOG_ANI 0x000000010
+#define ATH_PKTLOG_TEXT 0x000000020
+#define ATH_PKTLOG_PHYERR 0x000000040
+#define ATH_PKTLOG_PROMISC 0x000000080
+
+/* Types of packet log events */
+#define PKTLOG_TYPE_TX_CTRL 1
+#define PKTLOG_TYPE_TX_STAT 2
+#define PKTLOG_TYPE_TX_MSDU_ID 3
+#define PKTLOG_TYPE_TX_FRM_HDR 4
+#define PKTLOG_TYPE_RX_STAT 5
+#define PKTLOG_TYPE_RC_FIND 6
+#define PKTLOG_TYPE_RC_UPDATE 7
+#define PKTLOG_TYPE_TX_VIRT_ADDR 8
+#define PKTLOG_TYPE_MAX 9
+
+#define PKTLOG_MAX_TXCTL_WORDS 57 /* +2 words for bitmap */
+#define PKTLOG_MAX_TXSTATUS_WORDS 32
+#define PKTLOG_MAX_PROTO_WORDS 16
+#define PKTLOG_MAX_RXDESC_WORDS 62
+
+struct txctl_frm_hdr {
+ uint16_t framectrl; /* frame control field from header */
+ uint16_t seqctrl; /* frame control field from header */
+ uint16_t bssid_tail; /* last two octets of bssid */
+ uint16_t sa_tail; /* last two octets of SA */
+ uint16_t da_tail; /* last two octets of DA */
+ uint16_t resvd;
+};
+
+#if defined(HELIUMPLUS)
+/* Peregrine 11ac based */
+#define MAX_PKT_INFO_MSDU_ID 1
+#else
+/* Peregrine 11ac based */
+#define MAX_PKT_INFO_MSDU_ID 192
+#endif /* defined(HELIUMPLUS) */
+
+/*
+ * msdu_id_info_t is defined for reference only
+ */
+struct msdu_id_info {
+ uint32_t num_msdu;
+ uint8_t bound_bmap[(MAX_PKT_INFO_MSDU_ID + 7)>>3];
+ /* TODO:
+ * Convert the id's to uint32_t
+ * Reduces computation in the driver code
+ */
+ uint16_t id[MAX_PKT_INFO_MSDU_ID];
+} __ATTRIB_PACK;
+#define MSDU_ID_INFO_NUM_MSDU_OFFSET 0 /* char offset */
+#define MSDU_ID_INFO_BOUND_BM_OFFSET offsetof(struct msdu_id_info, bound_bmap)
+#define MSDU_ID_INFO_ID_OFFSET offsetof(struct msdu_id_info, id)
+
+
+struct ath_pktlog_txctl {
+ struct ath_pktlog_hdr pl_hdr;
+ /* struct txctl_frm_hdr frm_hdr; */
+ void *txdesc_hdr_ctl; /* frm_hdr + Tx descriptor words */
+ struct {
+ struct txctl_frm_hdr frm_hdr;
+ uint32_t txdesc_ctl[PKTLOG_MAX_TXCTL_WORDS];
+ /* uint32_t *proto_hdr; / * protocol header (variable length!) * / */
+ /* uint32_t *misc; / * Can be used for HT specific or other misc info * / */
+ } priv;
+} __ATTRIB_PACK;
+
+struct ath_pktlog_tx_status {
+ struct ath_pktlog_hdr pl_hdr;
+ void *ds_status;
+ int32_t misc[0]; /* Can be used for HT specific or other misc info */
+} __ATTRIB_PACK;
+
+struct ath_pktlog_msdu_info {
+ struct ath_pktlog_hdr pl_hdr;
+ void *ath_msdu_info;
+ A_UINT32 num_msdu;
+ struct {
+ /*
+ * Provision to add more information fields
+ */
+ struct msdu_info_t {
+ A_UINT32 num_msdu;
+ A_UINT8 bound_bmap[MAX_PKT_INFO_MSDU_ID >> 3];
+ } msdu_id_info;
+ /*
+ * array of num_msdu
+ * Static implementation will consume unwanted memory
+ * Need to split the pktlog_get_buf to get the buffer pointer only
+ */
+ uint16_t msdu_len[MAX_PKT_INFO_MSDU_ID];
+ } priv;
+ size_t priv_size;
+
+} __ATTRIB_PACK;
+
+struct ath_pktlog_rx_info {
+ struct ath_pktlog_hdr pl_hdr;
+ void *rx_desc;
+} __ATTRIB_PACK;
+
+struct ath_pktlog_rc_find {
+ struct ath_pktlog_hdr pl_hdr;
+ void *rcFind;
+} __ATTRIB_PACK;
+
+struct ath_pktlog_rc_update {
+ struct ath_pktlog_hdr pl_hdr;
+ void *txRateCtrl; /* rate control state proper */
+} __ATTRIB_PACK;
+
+#ifdef WIN32
+#pragma pack(pop, pktlog_fmt)
+#endif
+#ifdef __ATTRIB_PACK
+#undef __ATTRIB_PACK
+#endif /* __ATTRIB_PACK */
+
+/*
+ * The following header is included in the beginning of the file,
+ * followed by log entries when the log buffer is read through procfs
+ */
+
+struct ath_pktlog_bufhdr {
+ uint32_t magic_num; /* Used by post processing scripts */
+ uint32_t version; /* Set to CUR_PKTLOG_VER */
+};
+
+struct ath_pktlog_buf {
+ struct ath_pktlog_bufhdr bufhdr;
+ int32_t rd_offset;
+ volatile int32_t wr_offset;
+ /* Whenever this bytes written value croses 4K bytes,
+ * logging will be triggered
+ */
+ int32_t bytes_written;
+ /* Index of the messages sent to userspace */
+ uint32_t msg_index;
+ /* Offset for read */
+ loff_t offset;
+ char log_data[0];
+};
+
+#define PKTLOG_MOV_RD_IDX(_rd_offset, _log_buf, _log_size) \
+ do { \
+ if((_rd_offset + sizeof(struct ath_pktlog_hdr) + \
+ ((struct ath_pktlog_hdr *)((_log_buf)->log_data + \
+ (_rd_offset)))->size) <= _log_size) { \
+ _rd_offset = ((_rd_offset) + sizeof(struct ath_pktlog_hdr) + \
+ ((struct ath_pktlog_hdr *)((_log_buf)->log_data + \
+ (_rd_offset)))->size); \
+ } else { \
+ _rd_offset = ((struct ath_pktlog_hdr *)((_log_buf)->log_data + \
+ (_rd_offset)))->size; \
+ } \
+ (_rd_offset) = (((_log_size) - (_rd_offset)) >= \
+ sizeof(struct ath_pktlog_hdr)) ? _rd_offset : 0; \
+ } while(0)
+
+#endif /* _PKTLOG_FMT_H_ */
+#endif /* REMOVE_PKT_LOG */