wil6210: add 'freq' and 'link' debugfs entries
authorVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Mon, 16 Jun 2014 16:37:13 +0000 (19:37 +0300)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 19 Jun 2014 19:49:25 +0000 (15:49 -0400)
Expose operational frequency and link info

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/wil6210/cfg80211.c
drivers/net/wireless/ath/wil6210/debugfs.c
drivers/net/wireless/ath/wil6210/wil6210.h

index 850a2f11e0f9be9189f8971a135020d4fb67108b..4ac2c208c9ba3ff109e8c8942b1b9637e9b7cf0d 100644 (file)
@@ -104,8 +104,8 @@ int wil_iftype_nl2wmi(enum nl80211_iftype type)
        return -EOPNOTSUPP;
 }
 
-static int wil_cid_fill_sinfo(struct wil6210_priv *wil, int cid,
-                             struct station_info *sinfo)
+int wil_cid_fill_sinfo(struct wil6210_priv *wil, int cid,
+                      struct station_info *sinfo)
 {
        struct wmi_notify_req_cmd cmd = {
                .cid = cid,
index 89f0d094c5a2c0e8a6fc6eff1b185d5644af86f8..d6acb309dd1637e654c9b89d6a54b3c594f4c071 100644 (file)
@@ -773,6 +773,80 @@ static const struct file_operations fops_temp = {
        .llseek         = seq_lseek,
 };
 
+/*---------freq------------*/
+static int wil_freq_debugfs_show(struct seq_file *s, void *data)
+{
+       struct wil6210_priv *wil = s->private;
+       struct wireless_dev *wdev = wil_to_wdev(wil);
+       u16 freq = wdev->chandef.chan ? wdev->chandef.chan->center_freq : 0;
+
+       seq_printf(s, "Freq = %d\n", freq);
+
+       return 0;
+}
+
+static int wil_freq_seq_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, wil_freq_debugfs_show, inode->i_private);
+}
+
+static const struct file_operations fops_freq = {
+       .open           = wil_freq_seq_open,
+       .release        = single_release,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+};
+
+/*---------link------------*/
+static int wil_link_debugfs_show(struct seq_file *s, void *data)
+{
+       struct wil6210_priv *wil = s->private;
+       struct station_info sinfo;
+       int i, rc;
+
+       for (i = 0; i < ARRAY_SIZE(wil->sta); i++) {
+               struct wil_sta_info *p = &wil->sta[i];
+               char *status = "unknown";
+               switch (p->status) {
+               case wil_sta_unused:
+                       status = "unused   ";
+                       break;
+               case wil_sta_conn_pending:
+                       status = "pending  ";
+                       break;
+               case wil_sta_connected:
+                       status = "connected";
+                       break;
+               }
+               seq_printf(s, "[%d] %pM %s%s\n", i, p->addr, status,
+                          (p->data_port_open ? " data_port_open" : ""));
+
+               if (p->status == wil_sta_connected) {
+                       rc = wil_cid_fill_sinfo(wil, i, &sinfo);
+                       if (rc)
+                               return rc;
+
+                       seq_printf(s, "  Tx_mcs = %d\n", sinfo.txrate.mcs);
+                       seq_printf(s, "  Rx_mcs = %d\n", sinfo.rxrate.mcs);
+                       seq_printf(s, "  SQ     = %d\n", sinfo.signal);
+               }
+       }
+
+       return 0;
+}
+
+static int wil_link_seq_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, wil_link_debugfs_show, inode->i_private);
+}
+
+static const struct file_operations fops_link = {
+       .open           = wil_link_seq_open,
+       .release        = single_release,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+};
+
 /*---------Station matrix------------*/
 static void wil_print_rxtid(struct seq_file *s, struct wil_tid_ampdu_rx *r)
 {
@@ -880,6 +954,8 @@ int wil6210_debugfs_init(struct wil6210_priv *wil)
        debugfs_create_file("tx_mgmt", S_IWUSR, dbg, wil, &fops_txmgmt);
        debugfs_create_file("wmi_send", S_IWUSR, dbg, wil, &fops_wmi);
        debugfs_create_file("temp", S_IRUGO, dbg, wil, &fops_temp);
+       debugfs_create_file("freq", S_IRUGO, dbg, wil, &fops_freq);
+       debugfs_create_file("link", S_IRUGO, dbg, wil, &fops_link);
 
        wil->rgf_blob.data = (void * __force)wil->csr + 0;
        wil->rgf_blob.size = 0xa000;
index 4cbb8cec29c6fe4c1b8a3a69865d9b1a9b7148a4..fd6ff0926f3b7476d0835f4d2bbdf835c4bb7cec 100644 (file)
@@ -512,6 +512,8 @@ int wil_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
 
 int wil6210_debugfs_init(struct wil6210_priv *wil);
 void wil6210_debugfs_remove(struct wil6210_priv *wil);
+int wil_cid_fill_sinfo(struct wil6210_priv *wil, int cid,
+                      struct station_info *sinfo);
 
 struct wireless_dev *wil_cfg80211_init(struct device *dev);
 void wil_wdev_free(struct wil6210_priv *wil);