aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/files
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2010-07-15 13:05:56 +0000
committerGabor Juhos <juhosg@openwrt.org>2010-07-15 13:05:56 +0000
commit9445ce43a6c77e2c2eaf1b0606132b751a1b0f14 (patch)
treeb1f640f846e3791be19c8729efdf7c07b4d8d2df /target/linux/generic/files
parent9a92e1a32c16d64378a835d48780940091f833c6 (diff)
downloadupstream-9445ce43a6c77e2c2eaf1b0606132b751a1b0f14.tar.gz
upstream-9445ce43a6c77e2c2eaf1b0606132b751a1b0f14.tar.bz2
upstream-9445ce43a6c77e2c2eaf1b0606132b751a1b0f14.zip
generic: rtl8366: add debugfs file to show PVIDs
SVN-Revision: 22206
Diffstat (limited to 'target/linux/generic/files')
-rw-r--r--target/linux/generic/files/drivers/net/phy/rtl8366_smi.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c
index 2b51c58e87..c827cd20ee 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c
@@ -520,6 +520,34 @@ static ssize_t rtl8366_read_debugfs_vlan_mc(struct file *file,
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
}
+static ssize_t rtl8366_read_debugfs_pvid(struct file *file,
+ char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct rtl8366_smi *smi = (struct rtl8366_smi *)file->private_data;
+ char *buf = smi->buf;
+ int len = 0;
+ int i;
+
+ len += snprintf(buf + len, sizeof(smi->buf) - len, "%4s %4s\n",
+ "port", "pvid");
+
+ for (i = 0; i < smi->num_ports; i++) {
+ int pvid;
+ int err;
+
+ err = rtl8366_get_pvid(smi, i, &pvid);
+ if (err)
+ len += snprintf(buf + len, sizeof(smi->buf) - len,
+ "%4d error\n", i);
+ else
+ len += snprintf(buf + len, sizeof(smi->buf) - len,
+ "%4d %4d\n", i, pvid);
+ }
+
+ return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+}
+
static ssize_t rtl8366_read_debugfs_reg(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
@@ -634,6 +662,12 @@ static const struct file_operations fops_rtl8366_vlan_mc = {
.owner = THIS_MODULE
};
+static const struct file_operations fops_rtl8366_pvid = {
+ .read = rtl8366_read_debugfs_pvid,
+ .open = rtl8366_debugfs_open,
+ .owner = THIS_MODULE
+};
+
static const struct file_operations fops_rtl8366_mibs = {
.read = rtl8366_read_debugfs_mibs,
.open = rtl8366_debugfs_open,
@@ -679,6 +713,14 @@ static void rtl8366_debugfs_init(struct rtl8366_smi *smi)
return;
}
+ node = debugfs_create_file("pvid", S_IRUSR, root, smi,
+ &fops_rtl8366_pvid);
+ if (!node) {
+ dev_err(smi->parent, "Creating debugfs file '%s' failed\n",
+ "pvid");
+ return;
+ }
+
node = debugfs_create_file("mibs", S_IRUSR, smi->debugfs_root, smi,
&fops_rtl8366_mibs);
if (!node)