ath9k: Use cleaner debug masks
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / ath9k / core.h
index f0c54377dfe6748dde7004f3a1b574bf62aefa70..ae32b2c4ef1623875cd8f06ca12496932662a945 100644 (file)
@@ -84,52 +84,33 @@ struct ath_node;
 
 static const u8 ath_bcast_mac[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
 
-/*************/
-/* Debugging */
-/*************/
-
 enum ATH_DEBUG {
        ATH_DBG_RESET           = 0x00000001,
-       ATH_DBG_PHY_IO          = 0x00000002,
-       ATH_DBG_REG_IO          = 0x00000004,
-       ATH_DBG_QUEUE           = 0x00000008,
-       ATH_DBG_EEPROM          = 0x00000010,
-       ATH_DBG_NF_CAL          = 0x00000020,
-       ATH_DBG_CALIBRATE       = 0x00000040,
-       ATH_DBG_CHANNEL         = 0x00000080,
-       ATH_DBG_INTERRUPT       = 0x00000100,
-       ATH_DBG_REGULATORY      = 0x00000200,
-       ATH_DBG_ANI             = 0x00000400,
-       ATH_DBG_POWER_MGMT      = 0x00000800,
-       ATH_DBG_XMIT            = 0x00001000,
-       ATH_DBG_BEACON          = 0x00002000,
-       ATH_DBG_RATE            = 0x00004000,
-       ATH_DBG_CONFIG          = 0x00008000,
-       ATH_DBG_KEYCACHE        = 0x00010000,
-       ATH_DBG_AGGR            = 0x00020000,
-       ATH_DBG_FATAL           = 0x00040000,
+       ATH_DBG_REG_IO          = 0x00000002,
+       ATH_DBG_QUEUE           = 0x00000004,
+       ATH_DBG_EEPROM          = 0x00000008,
+       ATH_DBG_CALIBRATE       = 0x00000010,
+       ATH_DBG_CHANNEL         = 0x00000020,
+       ATH_DBG_INTERRUPT       = 0x00000040,
+       ATH_DBG_REGULATORY      = 0x00000080,
+       ATH_DBG_ANI             = 0x00000100,
+       ATH_DBG_POWER_MGMT      = 0x00000200,
+       ATH_DBG_XMIT            = 0x00000400,
+       ATH_DBG_BEACON          = 0x00001000,
+       ATH_DBG_CONFIG          = 0x00002000,
+       ATH_DBG_KEYCACHE        = 0x00004000,
+       ATH_DBG_FATAL           = 0x00008000,
        ATH_DBG_ANY             = 0xffffffff
 };
 
 #define DBG_DEFAULT (ATH_DBG_FATAL)
 
-#define        DPRINTF(sc, _m, _fmt, ...) do {                 \
-               if (sc->sc_debug & (_m))                \
-                       printk(_fmt , ##__VA_ARGS__);   \
-       } while (0)
-
-/***************************/
-/* Load-time Configuration */
-/***************************/
-
-/* Per-instance load-time (note: NOT run-time) configurations
- * for Atheros Device */
 struct ath_config {
        u32 ath_aggr_prot;
        u16 txpowlimit;
        u16 txpowlimit_override;
-       u8 cabqReadytime; /* Cabq Readytime % */
-       u8 swBeaconProcess; /* Process received beacons in SW (vs HW) */
+       u8 cabqReadytime;
+       u8 swBeaconProcess;
 };
 
 /*************************/
@@ -160,14 +141,13 @@ enum buffer_type {
 };
 
 struct ath_buf_state {
-       int bfs_nframes;                        /* # frames in aggregate */
-       u16 bfs_al;                             /* length of aggregate */
-       u16 bfs_frmlen;                         /* length of frame */
-       int bfs_seqno;                          /* sequence number */
-       int bfs_tidno;                          /* tid of this frame */
-       int bfs_retries;                        /* current retries */
-       u32 bf_type;                            /* BUF_* (enum buffer_type) */
-       /* key type use to encrypt this frame */
+       int bfs_nframes;                /* # frames in aggregate */
+       u16 bfs_al;                     /* length of aggregate */
+       u16 bfs_frmlen;                 /* length of frame */
+       int bfs_seqno;                  /* sequence number */
+       int bfs_tidno;                  /* tid of this frame */
+       int bfs_retries;                /* current retries */
+       u32 bf_type;                    /* BUF_* (enum buffer_type) */
        u32 bfs_keyix;
        enum ath9k_key_type bfs_keytype;
 };
@@ -213,13 +193,6 @@ struct ath_buf {
        dma_addr_t bf_dmacontext;
 };
 
-/*
- * reset the rx buffer.
- * any new fields added to the athbuf and require
- * reset need to be added to this macro.
- * currently bf_status is the only one requires that
- * requires reset.
- */
 #define ATH_RXBUF_RESET(_bf)    ((_bf)->bf_status = 0)
 
 /* hw processing complete, desc processed by hal */
@@ -263,11 +236,8 @@ void ath_rx_cleanup(struct ath_softc *sc);
 int ath_rx_tasklet(struct ath_softc *sc, int flush);
 
 #define ATH_TXBUF               512
-/* max number of transmit attempts (tries) */
 #define ATH_TXMAXTRY            13
-/* max number of 11n transmit attempts (tries) */
 #define ATH_11N_TXMAXTRY        10
-/* max number of tries for management and control frames */
 #define ATH_MGT_TXMAXTRY        4
 #define WME_BA_BMP_SIZE         64
 #define WME_MAX_BA              WME_BA_BMP_SIZE
@@ -279,22 +249,12 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush);
         WME_AC_VO)
 
 
-/* Wireless Multimedia Extension Defines */
-#define WME_AC_BE               0 /* best effort */
-#define WME_AC_BK               1 /* background */
-#define WME_AC_VI               2 /* video */
-#define WME_AC_VO               3 /* voice */
-#define WME_NUM_AC              4
+#define WME_AC_BE   0
+#define WME_AC_BK   1
+#define WME_AC_VI   2
+#define WME_AC_VO   3
+#define WME_NUM_AC  4
 
-/*
- * Data transmit queue state.  One of these exists for each
- * hardware transmit queue.  Packets sent to us from above
- * are assigned to queues based on their priority.  Not all
- * devices support a complete set of hardware transmit queues.
- * For those devices the array sc_ac2q will map multiple
- * priorities to fewer hardware queues (typically all to one
- * hardware queue).
- */
 struct ath_txq {
        u32 axq_qnum;                   /* hardware q number */
        u32 *axq_link;                  /* link ptr in last TX desc */
@@ -372,14 +332,15 @@ struct ath_xmit_status {
 #define ATH_TX_BAR          0x04
 };
 
+/* All RSSI values are noise floor adjusted */
 struct ath_tx_stat {
-       int rssi;               /* RSSI (noise floor ajusted) */
-       int rssictl[ATH_MAX_ANTENNA];   /* RSSI (noise floor ajusted) */
-       int rssiextn[ATH_MAX_ANTENNA];  /* RSSI (noise floor ajusted) */
-       int rateieee;           /* data rate xmitted (IEEE rate code) */
-       int rateKbps;           /* data rate xmitted (Kbps) */
-       int ratecode;           /* phy rate code */
-       int flags;              /* validity flags */
+       int rssi;
+       int rssictl[ATH_MAX_ANTENNA];
+       int rssiextn[ATH_MAX_ANTENNA];
+       int rateieee;
+       int rateKbps;
+       int ratecode;
+       int flags;
 /* if any of ctl,extn chain rssis are valid */
 #define ATH_TX_CHAIN_RSSI_VALID 0x01
 /* if extn chain rssis are valid */
@@ -415,7 +376,7 @@ void ath_tx_cabq(struct ath_softc *sc, struct sk_buff *skb);
 /**********************/
 
 #define ADDBA_EXCHANGE_ATTEMPTS    10
-#define ATH_AGGR_DELIM_SZ          4   /* delimiter size   */
+#define ATH_AGGR_DELIM_SZ          4
 #define ATH_AGGR_MINPLEN           256 /* in bytes, minimum packet length */
 /* number of delimiters for encryption padding */
 #define ATH_AGGR_ENCRYPTDELIM      10
@@ -466,10 +427,9 @@ struct aggr_rifs_param {
 
 /* Per-node aggregation state */
 struct ath_node_aggr {
-       struct ath_atx tx;      /* node transmit state */
+       struct ath_atx tx;
 };
 
-/* driver-specific node state */
 struct ath_node {
        struct ath_softc *an_sc;
        struct ath_node_aggr an_aggr;
@@ -500,12 +460,11 @@ void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid
 #define ATH_SET_VAP_BSSID_MASK(bssid_mask) \
        ((bssid_mask)[0] &= ~(((ATH_BCBUF-1)<<2)|0x02))
 
-/* driver-specific vap state */
 struct ath_vap {
-       int av_bslot;                   /* beacon slot index */
-       enum ath9k_opmode av_opmode;    /* VAP operational mode */
-       struct ath_buf *av_bcbuf;       /* beacon buffer */
-       struct ath_tx_control av_btxctl;  /* txctl information for beacon */
+       int av_bslot;
+       enum ath9k_opmode av_opmode;
+       struct ath_buf *av_bcbuf;
+       struct ath_tx_control av_btxctl;
 };
 
 /*******************/
@@ -518,12 +477,11 @@ struct ath_vap {
  * number of beacon intervals, the game's up.
  */
 #define BSTUCK_THRESH                  (9 * ATH_BCBUF)
-#define        ATH_BCBUF                       4   /* number of beacon buffers */
-#define ATH_DEFAULT_BINTVAL            100 /* default beacon interval in TU */
+#define        ATH_BCBUF                       4
+#define ATH_DEFAULT_BINTVAL            100 /* TU */
 #define ATH_DEFAULT_BMISS_LIMIT        10
 #define IEEE80211_MS_TO_TU(x)           (((x) * 1000) / 1024)
 
-/* beacon configuration */
 struct ath_beacon_config {
        u16 beacon_interval;
        u16 listen_interval;
@@ -674,18 +632,18 @@ struct ath_softc {
        u8 sc_tx_chainmask;
        u8 sc_rx_chainmask;
        enum ath9k_int sc_imask;
-       enum wireless_mode sc_curmode;  /* current phy mode */
+       enum wireless_mode sc_curmode;
        enum PROT_MODE sc_protmode;
 
-       u8 sc_nbcnvaps;                 /* # of vaps sending beacons */
-       u16 sc_nvaps;                   /* # of active virtual ap's */
+       u8 sc_nbcnvaps;
+       u16 sc_nvaps;
        struct ieee80211_vif *sc_vaps[ATH_BCBUF];
 
        u8 sc_mcastantenna;
-       u8 sc_defant;                   /* current default antenna */
-       u8 sc_rxotherant;               /* rx's on non-default antenna */
+       u8 sc_defant;
+       u8 sc_rxotherant;
 
-       struct ath9k_node_stats sc_halstats; /* station-mode rssi stats */
+       struct ath9k_node_stats sc_halstats;
        enum ath9k_ht_extprotspacing sc_ht_extprotspacing;
        enum ath9k_ht_macmode tx_chan_width;
 
@@ -699,22 +657,22 @@ struct ath_softc {
        } sc_updateslot;        /* slot time update fsm */
 
        /* Crypto */
-       u32 sc_keymax;          /* size of key cache */
-       DECLARE_BITMAP(sc_keymap, ATH_KEYMAX);  /* key use bit map */
+       u32 sc_keymax;
+       DECLARE_BITMAP(sc_keymap, ATH_KEYMAX);
        u8 sc_splitmic;         /* split TKIP MIC keys */
 
        /* RX */
        struct list_head sc_rxbuf;
        struct ath_descdma sc_rxdma;
-       int sc_rxbufsize;       /* rx size based on mtu */
-       u32 *sc_rxlink;         /* link ptr in last RX desc */
+       int sc_rxbufsize;
+       u32 *sc_rxlink;
 
        /* TX */
        struct list_head sc_txbuf;
        struct ath_txq sc_txq[ATH9K_NUM_TX_QUEUES];
        struct ath_descdma sc_txdma;
        u32 sc_txqsetup;
-       int sc_haltype2q[ATH9K_WME_AC_VO+1]; /* HAL WME AC -> h/w qnum */
+       int sc_haltype2q[ATH9K_WME_AC_VO+1];
        u16 seq_no; /* TX sequence number */
 
        /* Beacon */
@@ -724,13 +682,13 @@ struct ath_softc {
        struct list_head sc_bbuf;
        u32 sc_bhalq;
        u32 sc_bmisscount;
-       u32 ast_be_xmit;        /* beacons transmitted */
+       u32 ast_be_xmit;
        u64 bc_tstamp;
 
        /* Rate */
        struct ieee80211_rate rates[IEEE80211_NUM_BANDS][ATH_RATE_MAX];
        struct ath_rate_table *hw_rate_table[ATH9K_MODE_MAX];
-       u8 sc_protrix;          /* protection rate index */
+       u8 sc_protrix;
 
        /* Channel, Band */
        struct ieee80211_channel channels[IEEE80211_NUM_BANDS][ATH_CHAN_MAX];
@@ -755,6 +713,7 @@ struct ath_softc {
        struct ath_ani sc_ani;
 };
 
+void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...);
 int ath_reset(struct ath_softc *sc, bool retry_tx);
 int ath_get_hal_qnum(u16 queue, struct ath_softc *sc);
 int ath_get_mac80211_qnum(u32 queue, struct ath_softc *sc);