forked from zeplios/atheros-patches
-
Notifications
You must be signed in to change notification settings - Fork 0
/
594-rssi-read-at-debug.patch
81 lines (75 loc) · 2.55 KB
/
594-rssi-read-at-debug.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
--- a/drivers/net/wireless/ath/ath9k/debug.c 2012-11-22 20:08:21.000000000 +0800
+++ b/drivers/net/wireless/ath/ath9k/debug.c 2012-11-22 20:05:56.000000000 +0800
@@ -1967,6 +1967,29 @@
.llseek = default_llseek,
};
+/**
+ * @author zs, read rssi by second
+ */
+static ssize_t read_file_realtime_info(struct file *file, char __user *user_buf, size_t count, loff_t *ppos)
+{
+ struct ath_softc *sc = file->private_data;
+ char buf[64];
+ unsigned int len = 0;
+
+ len = snprintf(buf, sizeof(buf), "%d\t%d\t%d\t%d\n", sc->debug.rtv.seqno,
+ sc->debug.rtv.rssi, sc->debug.rtv.noise, sc->debug.rtv.rate_idx);
+ if(len > sizeof(buf))
+ len = sizeof(buf);
+ return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+}
+
+static const struct file_operations fops_realtime_info = {
+ .read = read_file_realtime_info,
+ .open = ath9k_debugfs_open,
+ .owner = THIS_MODULE,
+ .llseek = default_llseek,
+};
+
int ath9k_init_debug(struct ath_hw *ah)
{
struct ath_common *common = ath9k_hw_common(ah);
@@ -2044,6 +2067,8 @@
&fops_inject_settings);
debugfs_create_file("pkt_record", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc,
&fops_pkt_record);
+ debugfs_create_file("realtime_var", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc,
+ &fops_realtime_info);
INIT_LIST_HEAD(&sc->debug.recv_tp_list);
sc->debug.setting = kmalloc(sizeof(struct inject_settings), GFP_KERNEL);
--- a/drivers/net/wireless/ath/ath9k/debug.h 2012-11-22 20:08:21.000000000 +0800
+++ b/drivers/net/wireless/ath/ath9k/debug.h 2012-11-22 20:04:57.000000000 +0800
@@ -248,6 +248,13 @@
u32 pkt_counter;
};
+struct realtime_var{
+ u16 seqno;
+ int8_t rssi;
+ s8 noise;
+ int rate_idx;
+};
+
struct ath9k_debug {
struct dentry *debugfs_phy;
u32 regidx;
@@ -260,6 +267,7 @@
struct inject_settings *setting;
struct list_head recv_tp_list;
+ struct realtime_var rtv;
};
int ath9k_init_debug(struct ath_hw *ah);
--- a/drivers/net/wireless/ath/ath9k/recv.c 2012-11-22 20:08:21.000000000 +0800
+++ b/drivers/net/wireless/ath/ath9k/recv.c 2012-11-22 20:08:17.000000000 +0800
@@ -1877,6 +1877,13 @@
if (retval)
goto requeue_drop_frag;
+ if(!rs.rs_moreaggr && rs.rs_rssi != ATH9K_RSSI_BAD && ieee80211_is_data(hdr->frame_control)){
+ sc->debug.rtv.rssi = rs.rs_rssi;
+ sc->debug.rtv.seqno = (le16_to_cpu(hdr->seq_ctrl) >> 4);
+ sc->debug.rtv.noise = ah->noise;
+ sc->debug.rtv.rate_idx = rxs->rate_idx;
+ }
+
/* Ensure we always have an skb to requeue once we are done
* processing the current buffer's skb */
requeue_skb = ath_rxbuf_alloc(common, common->rx_bufsize, GFP_ATOMIC);