|
|
@ -582,6 +582,47 @@ static ssize_t rtl8366_write_debugfs_reg(struct file *file, |
|
|
|
return count; |
|
|
|
return count; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static ssize_t rtl8366_read_debugfs_mibs(struct file *file, |
|
|
|
|
|
|
|
char __user *user_buf, |
|
|
|
|
|
|
|
size_t count, loff_t *ppos) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
struct rtl8366_smi *smi = file->private_data; |
|
|
|
|
|
|
|
int i, j, len = 0; |
|
|
|
|
|
|
|
char *buf = smi->buf; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
len += snprintf(buf + len, sizeof(smi->buf) - len, "%-36s", |
|
|
|
|
|
|
|
"Counter"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < smi->num_ports; i++) { |
|
|
|
|
|
|
|
char port_buf[10]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snprintf(port_buf, sizeof(port_buf), "Port %d", i); |
|
|
|
|
|
|
|
len += snprintf(buf + len, sizeof(smi->buf) - len, " %12s", |
|
|
|
|
|
|
|
port_buf); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
len += snprintf(buf + len, sizeof(smi->buf) - len, "\n"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < smi->num_mib_counters; i++) { |
|
|
|
|
|
|
|
len += snprintf(buf + len, sizeof(smi->buf) - len, "%-36s ", |
|
|
|
|
|
|
|
smi->mib_counters[i].name); |
|
|
|
|
|
|
|
for (j = 0; j < smi->num_ports; j++) { |
|
|
|
|
|
|
|
unsigned long long counter = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!smi->ops->get_mib_counter(smi, i, j, &counter)) |
|
|
|
|
|
|
|
len += snprintf(buf + len, |
|
|
|
|
|
|
|
sizeof(smi->buf) - len, |
|
|
|
|
|
|
|
"%12llu ", counter); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
len += snprintf(buf + len, |
|
|
|
|
|
|
|
sizeof(smi->buf) - len, |
|
|
|
|
|
|
|
"%12s ", "error"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
len += snprintf(buf + len, sizeof(smi->buf) - len, "\n"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static const struct file_operations fops_rtl8366_regs = { |
|
|
|
static const struct file_operations fops_rtl8366_regs = { |
|
|
|
.read = rtl8366_read_debugfs_reg, |
|
|
|
.read = rtl8366_read_debugfs_reg, |
|
|
|
.write = rtl8366_write_debugfs_reg, |
|
|
|
.write = rtl8366_write_debugfs_reg, |
|
|
@ -595,6 +636,12 @@ static const struct file_operations fops_rtl8366_vlan_mc = { |
|
|
|
.owner = THIS_MODULE |
|
|
|
.owner = THIS_MODULE |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const struct file_operations fops_rtl8366_mibs = { |
|
|
|
|
|
|
|
.read = rtl8366_read_debugfs_mibs, |
|
|
|
|
|
|
|
.open = rtl8366_debugfs_open, |
|
|
|
|
|
|
|
.owner = THIS_MODULE |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
static void rtl8366_debugfs_init(struct rtl8366_smi *smi) |
|
|
|
static void rtl8366_debugfs_init(struct rtl8366_smi *smi) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct dentry *node; |
|
|
|
struct dentry *node; |
|
|
@ -628,9 +675,17 @@ static void rtl8366_debugfs_init(struct rtl8366_smi *smi) |
|
|
|
|
|
|
|
|
|
|
|
node = debugfs_create_file("vlan_mc", S_IRUSR, root, smi, |
|
|
|
node = debugfs_create_file("vlan_mc", S_IRUSR, root, smi, |
|
|
|
&fops_rtl8366_vlan_mc); |
|
|
|
&fops_rtl8366_vlan_mc); |
|
|
|
if (!node) |
|
|
|
if (!node) { |
|
|
|
dev_err(smi->parent, "Creating debugfs file '%s' failed\n", |
|
|
|
dev_err(smi->parent, "Creating debugfs file '%s' failed\n", |
|
|
|
"vlan_mc"); |
|
|
|
"vlan_mc"); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
node = debugfs_create_file("mibs", S_IRUSR, smi->debugfs_root, smi, |
|
|
|
|
|
|
|
&fops_rtl8366_mibs); |
|
|
|
|
|
|
|
if (!node) |
|
|
|
|
|
|
|
dev_err(smi->parent, "Creating debugfs file '%s' failed\n", |
|
|
|
|
|
|
|
"mibs"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void rtl8366_debugfs_remove(struct rtl8366_smi *smi) |
|
|
|
static void rtl8366_debugfs_remove(struct rtl8366_smi *smi) |
|
|
|