|
@@ -366,6 +366,103 @@ free_and_exit:
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
+/* Sysfs histogram file read handler.
|
|
|
+ *
|
|
|
+ * This function is called when the 'histogram' file is opened for reading
|
|
|
+ * It prints the following histogram information -
|
|
|
+ * - Number of histogram samples
|
|
|
+ * - Receive packet number of each rx_rate
|
|
|
+ * - Receive packet number of each snr
|
|
|
+ * - Receive packet number of each nosie_flr
|
|
|
+ * - Receive packet number of each signal streath
|
|
|
+ */
|
|
|
+static ssize_t
|
|
|
+mwifiex_histogram_read(struct file *file, char __user *ubuf,
|
|
|
+ size_t count, loff_t *ppos)
|
|
|
+{
|
|
|
+ struct mwifiex_private *priv =
|
|
|
+ (struct mwifiex_private *)file->private_data;
|
|
|
+ ssize_t ret;
|
|
|
+ struct mwifiex_histogram_data *phist_data;
|
|
|
+ int i, value;
|
|
|
+ unsigned long page = get_zeroed_page(GFP_KERNEL);
|
|
|
+ char *p = (char *)page;
|
|
|
+
|
|
|
+ if (!p)
|
|
|
+ return -ENOMEM;
|
|
|
+
|
|
|
+ if (!priv || !priv->hist_data)
|
|
|
+ return -EFAULT;
|
|
|
+ phist_data = priv->hist_data;
|
|
|
+
|
|
|
+ p += sprintf(p, "\n"
|
|
|
+ "total samples = %d\n",
|
|
|
+ atomic_read(&phist_data->num_samples));
|
|
|
+
|
|
|
+ p += sprintf(p, "rx rates (in Mbps): 0=1M 1=2M");
|
|
|
+ p += sprintf(p, "2=5.5M 3=11M 4=6M 5=9M 6=12M\n");
|
|
|
+ p += sprintf(p, "7=18M 8=24M 9=36M 10=48M 11=54M");
|
|
|
+ p += sprintf(p, "12-27=MCS0-15(BW20) 28-43=MCS0-15(BW40)\n");
|
|
|
+
|
|
|
+ if (ISSUPP_11ACENABLED(priv->adapter->fw_cap_info)) {
|
|
|
+ p += sprintf(p, "44-53=MCS0-9(VHT:BW20)");
|
|
|
+ p += sprintf(p, "54-63=MCS0-9(VHT:BW40)");
|
|
|
+ p += sprintf(p, "64-73=MCS0-9(VHT:BW80)\n\n");
|
|
|
+ } else {
|
|
|
+ p += sprintf(p, "\n");
|
|
|
+ }
|
|
|
+
|
|
|
+ for (i = 0; i < MWIFIEX_MAX_RX_RATES; i++) {
|
|
|
+ value = atomic_read(&phist_data->rx_rate[i]);
|
|
|
+ if (value)
|
|
|
+ p += sprintf(p, "rx_rate[%02d] = %d\n", i, value);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ISSUPP_11ACENABLED(priv->adapter->fw_cap_info)) {
|
|
|
+ for (i = MWIFIEX_MAX_RX_RATES; i < MWIFIEX_MAX_AC_RX_RATES;
|
|
|
+ i++) {
|
|
|
+ value = atomic_read(&phist_data->rx_rate[i]);
|
|
|
+ if (value)
|
|
|
+ p += sprintf(p, "rx_rate[%02d] = %d\n",
|
|
|
+ i, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (i = 0; i < MWIFIEX_MAX_SNR; i++) {
|
|
|
+ value = atomic_read(&phist_data->snr[i]);
|
|
|
+ if (value)
|
|
|
+ p += sprintf(p, "snr[%02ddB] = %d\n", i, value);
|
|
|
+ }
|
|
|
+ for (i = 0; i < MWIFIEX_MAX_NOISE_FLR; i++) {
|
|
|
+ value = atomic_read(&phist_data->noise_flr[i]);
|
|
|
+ if (value)
|
|
|
+ p += sprintf(p, "noise_flr[-%02ddBm] = %d\n",
|
|
|
+ (int)(i-128), value);
|
|
|
+ }
|
|
|
+ for (i = 0; i < MWIFIEX_MAX_SIG_STRENGTH; i++) {
|
|
|
+ value = atomic_read(&phist_data->sig_str[i]);
|
|
|
+ if (value)
|
|
|
+ p += sprintf(p, "sig_strength[-%02ddBm] = %d\n",
|
|
|
+ i, value);
|
|
|
+ }
|
|
|
+
|
|
|
+ ret = simple_read_from_buffer(ubuf, count, ppos, (char *)page,
|
|
|
+ (unsigned long)p - page);
|
|
|
+
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
+static ssize_t
|
|
|
+mwifiex_histogram_write(struct file *file, const char __user *ubuf,
|
|
|
+ size_t count, loff_t *ppos)
|
|
|
+{
|
|
|
+ struct mwifiex_private *priv = (void *)file->private_data;
|
|
|
+
|
|
|
+ if (priv && priv->hist_data)
|
|
|
+ mwifiex_hist_data_reset(priv);
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
static struct mwifiex_debug_info info;
|
|
|
|
|
|
/*
|
|
@@ -832,6 +929,7 @@ MWIFIEX_DFS_FILE_READ_OPS(fw_dump);
|
|
|
MWIFIEX_DFS_FILE_OPS(regrdwr);
|
|
|
MWIFIEX_DFS_FILE_OPS(rdeeprom);
|
|
|
MWIFIEX_DFS_FILE_OPS(hscfg);
|
|
|
+MWIFIEX_DFS_FILE_OPS(histogram);
|
|
|
|
|
|
/*
|
|
|
* This function creates the debug FS directory structure and the files.
|
|
@@ -855,6 +953,7 @@ mwifiex_dev_debugfs_init(struct mwifiex_private *priv)
|
|
|
MWIFIEX_DFS_ADD_FILE(rdeeprom);
|
|
|
MWIFIEX_DFS_ADD_FILE(fw_dump);
|
|
|
MWIFIEX_DFS_ADD_FILE(hscfg);
|
|
|
+ MWIFIEX_DFS_ADD_FILE(histogram);
|
|
|
}
|
|
|
|
|
|
/*
|