ath6kl: Add tx_complete() to struct htc_ep_callbacks
[cascardo/linux.git] / drivers / net / wireless / ath / ath6kl / core.h
index 7f1869d..f1ce003 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2010-2011 Atheros Communications Inc.
+ * Copyright (c) 2011-2012 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
@@ -59,8 +60,9 @@
 #define MAX_DEFAULT_SEND_QUEUE_DEPTH      (MAX_DEF_COOKIE_NUM / WMM_NUM_AC)
 
 #define DISCON_TIMER_INTVAL               10000  /* in msec */
-#define A_DEFAULT_LISTEN_INTERVAL         1      /* beacon intervals */
-#define A_MAX_WOW_LISTEN_INTERVAL         1000
+
+/* Channel dwell time in fg scan */
+#define ATH6KL_FG_SCAN_INTERVAL                50 /* in ms */
 
 /* includes also the null byte */
 #define ATH6KL_FIRMWARE_MAGIC               "QCA-ATH6KL"
@@ -89,6 +91,12 @@ enum ath6kl_fw_capability {
         */
        ATH6KL_FW_CAPABILITY_STA_P2PDEV_DUPLEX,
 
+       /*
+        * Firmware has support to cleanup inactive stations
+        * in AP mode.
+        */
+       ATH6KL_FW_CAPABILITY_INACTIVITY_TIMEOUT,
+
        /* this needs to be last */
        ATH6KL_FW_CAPABILITY_MAX,
 };
@@ -183,6 +191,11 @@ struct ath6kl_fw_ie {
 
 #define MBOX_YIELD_LIMIT 99
 
+#define ATH6KL_DEFAULT_LISTEN_INTVAL   100 /* in TUs */
+#define ATH6KL_DEFAULT_BMISS_TIME      1500
+#define ATH6KL_MAX_WOW_LISTEN_INTL     300 /* in TUs */
+#define ATH6KL_MAX_BMISS_TIME          5000
+
 /* configuration lags */
 /*
  * ATH6KL_CONF_IGNORE_ERP_BARKER: Ignore the barker premable in
@@ -196,8 +209,9 @@ struct ath6kl_fw_ie {
 #define ATH6KL_CONF_IGNORE_PS_FAIL_EVT_IN_SCAN  BIT(1)
 #define ATH6KL_CONF_ENABLE_11N                 BIT(2)
 #define ATH6KL_CONF_ENABLE_TX_BURST            BIT(3)
-#define ATH6KL_CONF_SUSPEND_CUTPOWER           BIT(4)
-#define ATH6KL_CONF_UART_DEBUG                 BIT(5)
+#define ATH6KL_CONF_UART_DEBUG                 BIT(4)
+
+#define P2P_WILDCARD_SSID_LEN                  7 /* DIRECT- */
 
 enum wlan_low_pwr_state {
        WLAN_POWER_STATE_ON,
@@ -227,6 +241,12 @@ struct rxtid {
        u32 hold_q_sz;
        struct skb_hold_q *hold_q;
        struct sk_buff_head q;
+
+       /*
+        * FIXME: No clue what this should protect. Apparently it should
+        * protect some of the fields above but they are also accessed
+        * without taking the lock.
+        */
        spinlock_t lock;
 };
 
@@ -286,6 +306,16 @@ struct ath6kl_cookie {
        struct ath6kl_cookie *arc_list_next;
 };
 
+struct ath6kl_mgmt_buff {
+       struct list_head list;
+       u32 freq;
+       u32 wait;
+       u32 id;
+       bool no_cck;
+       size_t len;
+       u8 buf[0];
+};
+
 struct ath6kl_sta {
        u16 sta_flags;
        u8 mac[ETH_ALEN];
@@ -295,7 +325,12 @@ struct ath6kl_sta {
        u8 auth;
        u8 wpa_ie[ATH6KL_MAX_IE];
        struct sk_buff_head psq;
+
+       /* protects psq, mgmt_psq, apsdq, and mgmt_psq_len fields */
        spinlock_t psq_lock;
+
+       struct list_head mgmt_psq;
+       size_t mgmt_psq_len;
        u8 apsd_info;
        struct sk_buff_head apsdq;
        struct aggr_info_conn *aggr_conn;
@@ -452,6 +487,7 @@ enum ath6kl_vif_state {
        DTIM_PERIOD_AVAIL,
        WLAN_ENABLED,
        STATS_UPDATE_PEND,
+       HOST_SLEEP_MODE_CMD_PROCESSED,
 };
 
 struct ath6kl_vif {
@@ -494,6 +530,8 @@ struct ath6kl_vif {
        bool probe_req_report;
        u16 next_chan;
        u16 assoc_bss_beacon_int;
+       u16 listen_intvl_t;
+       u16 bmiss_time_t;
        u8 assoc_bss_dtim_period;
        struct net_device_stats net_stats;
        struct target_stats target_stats;
@@ -521,6 +559,8 @@ enum ath6kl_dev_state {
 enum ath6kl_state {
        ATH6KL_STATE_OFF,
        ATH6KL_STATE_ON,
+       ATH6KL_STATE_SUSPENDING,
+       ATH6KL_STATE_RESUMING,
        ATH6KL_STATE_DEEPSLEEP,
        ATH6KL_STATE_CUTPOWER,
        ATH6KL_STATE_WOW,
@@ -549,9 +589,14 @@ struct ath6kl {
        unsigned int vif_max;
        u8 max_norm_iface;
        u8 avail_idx_map;
+
+       /*
+        * Protects at least amsdu_rx_buffer_queue, ath6kl_alloc_cookie()
+        * calls, tx_pending and total_tx_data_pend.
+        */
        spinlock_t lock;
+
        struct semaphore sem;
-       u16 listen_intvl_b;
        u8 lrssi_roam_threshold;
        struct ath6kl_version version;
        u32 target_type;
@@ -577,7 +622,13 @@ struct ath6kl {
        u8 sta_list_index;
        struct ath6kl_req_key ap_mode_bkey;
        struct sk_buff_head mcastpsq;
+
+       /*
+        * FIXME: protects access to mcastpsq but is actually useless as
+        * all skbe_queue_*() functions provide serialisation themselves
+        */
        spinlock_t mcastpsq_lock;
+
        u8 intra_bss;
        struct wmi_ap_mode_stat ap_stats;
        u8 ap_country_code[3];
@@ -619,6 +670,8 @@ struct ath6kl {
        } hw;
 
        u16 conf_flags;
+       u16 suspend_mode;
+       u16 wow_suspend_mode;
        wait_queue_head_t event_wq;
        struct ath6kl_mbox_info mbox_info;
 
@@ -649,12 +702,16 @@ struct ath6kl {
 
        bool p2p;
 
+       bool wiphy_registered;
+
 #ifdef CONFIG_ATH6KL_DEBUG
        struct {
-               struct circ_buf fwlog_buf;
-               spinlock_t fwlog_lock;
-               void *fwlog_tmp;
+               struct sk_buff_head fwlog_queue;
+               struct completion fwlog_completion;
+               bool fwlog_open;
+
                u32 fwlog_mask;
+
                unsigned int dbgfs_diag_reg;
                u32 diag_reg_addr_wr;
                u32 diag_reg_val_wr;
@@ -697,7 +754,8 @@ void init_netdev(struct net_device *dev);
 void ath6kl_cookie_init(struct ath6kl *ar);
 void ath6kl_cookie_cleanup(struct ath6kl *ar);
 void ath6kl_rx(struct htc_target *target, struct htc_packet *packet);
-void ath6kl_tx_complete(void *context, struct list_head *packet_queue);
+void ath6kl_tx_complete(struct htc_target *context,
+                       struct list_head *packet_queue);
 enum htc_send_full_action ath6kl_tx_queue_full(struct htc_target *target,
                                               struct htc_packet *packet);
 void ath6kl_stop_txrx(struct ath6kl *ar);
@@ -715,7 +773,8 @@ void ath6kl_free_cookie(struct ath6kl *ar, struct ath6kl_cookie *cookie);
 int ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev);
 
 struct aggr_info *aggr_init(struct ath6kl_vif *vif);
-void aggr_conn_init(struct ath6kl_vif *vif, struct aggr_info_conn *aggr_conn);
+void aggr_conn_init(struct ath6kl_vif *vif, struct aggr_info *aggr_info,
+                   struct aggr_info_conn *aggr_conn);
 void ath6kl_rx_refill(struct htc_target *target,
                      enum htc_endpoint_id endpoint);
 void ath6kl_refill_amsdu_rxbufs(struct ath6kl *ar, int count);
@@ -725,10 +784,10 @@ struct htc_packet *ath6kl_alloc_amsdu_rxbuf(struct htc_target *target,
 void aggr_module_destroy(struct aggr_info *aggr_info);
 void aggr_reset_state(struct aggr_info_conn *aggr_conn);
 
-struct ath6kl_sta *ath6kl_find_sta(struct ath6kl_vif *vif, u8 * node_addr);
+struct ath6kl_sta *ath6kl_find_sta(struct ath6kl_vif *vif, u8 *node_addr);
 struct ath6kl_sta *ath6kl_find_sta_by_aid(struct ath6kl *ar, u8 aid);
 
-void ath6kl_ready_event(void *devt, u8 * datap, u32 sw_ver, u32 abi_ver);
+void ath6kl_ready_event(void *devt, u8 *datap, u32 sw_ver, u32 abi_ver);
 int ath6kl_control_tx(void *devt, struct sk_buff *skb,
                      enum htc_endpoint_id eid);
 void ath6kl_connect_event(struct ath6kl_vif *vif, u16 channel,