]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/net/wireless/ath/wil6210/wil6210.h
wil6210: update target reset to support new HW
[mirror_ubuntu-artful-kernel.git] / drivers / net / wireless / ath / wil6210 / wil6210.h
index 1f91eaf95bbebd0dfd70d316943558c5882ed54d..14f861cd295db9df6bf52c118cb082c633c42284 100644 (file)
@@ -74,6 +74,9 @@ struct RGF_ICR {
 } __packed;
 
 /* registers - FW addresses */
+#define RGF_FW_REV_ID                  (0x880a8c) /* chip revision */
+#define RGF_USER_SERIAL_BAUD_RATE      (0x880050)
+#define RGF_LOS_COUNTER_CTL            (0x882dc4)
 #define RGF_USER_USER_SCRATCH_PAD      (0x8802bc)
 #define RGF_USER_USER_ICR              (0x880b4c) /* struct RGF_ICR */
        #define BIT_USER_USER_ICR_SW_INT_2      BIT(18)
@@ -125,6 +128,31 @@ struct RGF_ICR {
 
 /* Hardware definitions end */
 
+/**
+ * mk_cidxtid - construct @cidxtid field
+ * @cid: CID value
+ * @tid: TID value
+ *
+ * @cidxtid field encoded as bits 0..3 - CID; 4..7 - TID
+ */
+static inline u8 mk_cidxtid(u8 cid, u8 tid)
+{
+       return ((tid & 0xf) << 4) | (cid & 0xf);
+}
+
+/**
+ * parse_cidxtid - parse @cidxtid field
+ * @cid: store CID value here
+ * @tid: store TID value here
+ *
+ * @cidxtid field encoded as bits 0..3 - CID; 4..7 - TID
+ */
+static inline void parse_cidxtid(u8 cidxtid, u8 *cid, u8 *tid)
+{
+       *cid = cidxtid & 0xf;
+       *tid = (cidxtid >> 4) & 0xf;
+}
+
 struct wil6210_mbox_ring {
        u32 base;
        u16 entry_size; /* max. size of mbox entry, incl. all headers */
@@ -184,12 +212,19 @@ struct pending_wmi_event {
        } __packed event;
 };
 
+enum { /* for wil_ctx.mapped_as */
+       wil_mapped_as_none = 0,
+       wil_mapped_as_single = 1,
+       wil_mapped_as_page = 2,
+};
+
 /**
  * struct wil_ctx - software context for Vring descriptor
  */
 struct wil_ctx {
        struct sk_buff *skb;
-       u8 mapped_as_page:1;
+       u8 nr_frags;
+       u8 mapped_as;
 };
 
 union vring_desc;
@@ -215,6 +250,46 @@ enum { /* for wil6210_priv.status */
 
 struct pci_dev;
 
+/**
+ * struct tid_ampdu_rx - TID aggregation information (Rx).
+ *
+ * @reorder_buf: buffer to reorder incoming aggregated MPDUs
+ * @reorder_time: jiffies when skb was added
+ * @session_timer: check if peer keeps Tx-ing on the TID (by timeout value)
+ * @reorder_timer: releases expired frames from the reorder buffer.
+ * @last_rx: jiffies of last rx activity
+ * @head_seq_num: head sequence number in reordering buffer.
+ * @stored_mpdu_num: number of MPDUs in reordering buffer
+ * @ssn: Starting Sequence Number expected to be aggregated.
+ * @buf_size: buffer size for incoming A-MPDUs
+ * @timeout: reset timer value (in TUs).
+ * @dialog_token: dialog token for aggregation session
+ * @rcu_head: RCU head used for freeing this struct
+ * @reorder_lock: serializes access to reorder buffer, see below.
+ *
+ * This structure's lifetime is managed by RCU, assignments to
+ * the array holding it must hold the aggregation mutex.
+ *
+ * The @reorder_lock is used to protect the members of this
+ * struct, except for @timeout, @buf_size and @dialog_token,
+ * which are constant across the lifetime of the struct (the
+ * dialog token being used only for debugging).
+ */
+struct wil_tid_ampdu_rx {
+       spinlock_t reorder_lock; /* see above */
+       struct sk_buff **reorder_buf;
+       unsigned long *reorder_time;
+       struct timer_list session_timer;
+       struct timer_list reorder_timer;
+       unsigned long last_rx;
+       u16 head_seq_num;
+       u16 stored_mpdu_num;
+       u16 ssn;
+       u16 buf_size;
+       u16 timeout;
+       u8 dialog_token;
+};
+
 struct wil6210_stats {
        u64 tsf;
        u32 snr;
@@ -226,6 +301,43 @@ struct wil6210_stats {
        u16 peer_tx_sector;
 };
 
+enum wil_sta_status {
+       wil_sta_unused = 0,
+       wil_sta_conn_pending = 1,
+       wil_sta_connected = 2,
+};
+
+#define WIL_STA_TID_NUM (16)
+
+struct wil_net_stats {
+       unsigned long   rx_packets;
+       unsigned long   tx_packets;
+       unsigned long   rx_bytes;
+       unsigned long   tx_bytes;
+       unsigned long   tx_errors;
+       unsigned long   rx_dropped;
+       u16 last_mcs_rx;
+};
+
+/**
+ * struct wil_sta_info - data for peer
+ *
+ * Peer identified by its CID (connection ID)
+ * NIC performs beam forming for each peer;
+ * if no beam forming done, frame exchange is not
+ * possible.
+ */
+struct wil_sta_info {
+       u8 addr[ETH_ALEN];
+       enum wil_sta_status status;
+       struct wil_net_stats stats;
+       bool data_port_open; /* can send any data, not only EAPOL */
+       /* Rx BACK */
+       struct wil_tid_ampdu_rx *tid_rx[WIL_STA_TID_NUM];
+       unsigned long tid_rx_timer_expired[BITS_TO_LONGS(WIL_STA_TID_NUM)];
+       unsigned long tid_rx_stop_requested[BITS_TO_LONGS(WIL_STA_TID_NUM)];
+};
+
 struct wil6210_priv {
        struct pci_dev *pdev;
        int n_msi;
@@ -233,6 +345,7 @@ struct wil6210_priv {
        void __iomem *csr;
        ulong status;
        u32 fw_version;
+       u32 hw_version;
        u8 n_mids; /* number of additional MIDs as reported by FW */
        /* profile */
        u32 monitor_flags;
@@ -267,7 +380,8 @@ struct wil6210_priv {
        /* DMA related */
        struct vring vring_rx;
        struct vring vring_tx[WIL6210_MAX_TX_RINGS];
-       u8 dst_addr[WIL6210_MAX_TX_RINGS][ETH_ALEN];
+       u8 vring2cid_tid[WIL6210_MAX_TX_RINGS][2]; /* [0] - CID, [1] - TID */
+       struct wil_sta_info sta[WIL6210_MAX_CID];
        /* scan */
        struct cfg80211_scan_request *scan_request;
 
@@ -334,6 +448,7 @@ void wil_link_off(struct wil6210_priv *wil);
 int wil_up(struct wil6210_priv *wil);
 int wil_down(struct wil6210_priv *wil);
 void wil_mbox_ring_le2cpus(struct wil6210_mbox_ring *r);
+int wil_find_cid(struct wil6210_priv *wil, const u8 *mac);
 
 void __iomem *wmi_buffer(struct wil6210_priv *wil, __le32 ptr);
 void __iomem *wmi_addr(struct wil6210_priv *wil, u32 ptr);
@@ -357,7 +472,9 @@ int wmi_echo(struct wil6210_priv *wil);
 int wmi_set_ie(struct wil6210_priv *wil, u8 type, u16 ie_len, const void *ie);
 int wmi_rx_chain_add(struct wil6210_priv *wil, struct vring *vring);
 int wmi_p2p_cfg(struct wil6210_priv *wil, int channel);
+int wmi_rxon(struct wil6210_priv *wil, bool on);
 int wmi_get_temperature(struct wil6210_priv *wil, u32 *t_m, u32 *t_r);
+int wmi_disconnect_sta(struct wil6210_priv *wil, const u8 *mac, u16 reason);
 
 int wil6210_init_irq(struct wil6210_priv *wil, int irq);
 void wil6210_fini_irq(struct wil6210_priv *wil, int irq);