diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2010-07-15 13:05:32 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2010-07-15 13:05:32 +0000 |
commit | bd79e0b9fc395416471f0298c1bf8ec397294914 (patch) | |
tree | f1dc1312e15dd5ca17f6ae50693fbc2f20b015e0 /target/linux/generic | |
parent | 941938939e8fe03592555b7dea743f573e325584 (diff) | |
download | upstream-bd79e0b9fc395416471f0298c1bf8ec397294914.tar.gz upstream-bd79e0b9fc395416471f0298c1bf8ec397294914.tar.bz2 upstream-bd79e0b9fc395416471f0298c1bf8ec397294914.zip |
generic: rtl8366: generealize rtl8366{s,rb}_sw_get_port_mib functions
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@22199 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/generic')
-rw-r--r-- | target/linux/generic/files/drivers/net/phy/rtl8366rb.c | 9 | ||||
-rw-r--r-- | target/linux/generic/files/drivers/net/phy/rtl8366s.c | 9 |
2 files changed, 10 insertions, 8 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366rb.c b/target/linux/generic/files/drivers/net/phy/rtl8366rb.c index f71f4f2b5b..d4fa74a864 100644 --- a/target/linux/generic/files/drivers/net/phy/rtl8366rb.c +++ b/target/linux/generic/files/drivers/net/phy/rtl8366rb.c @@ -801,17 +801,18 @@ static int rtl8366rb_sw_get_port_mib(struct switch_dev *dev, unsigned long long counter = 0; char *buf = smi->buf; - if (val->port_vlan >= RTL8366RB_NUM_PORTS) + if (val->port_vlan >= smi->num_ports) return -EINVAL; len += snprintf(buf + len, sizeof(smi->buf) - len, "Port %d MIB counters\n", val->port_vlan); - for (i = 0; i < ARRAY_SIZE(rtl8366rb_mib_counters); ++i) { + for (i = 0; i < smi->num_mib_counters; ++i) { len += snprintf(buf + len, sizeof(smi->buf) - len, - "%-36s: ", rtl8366rb_mib_counters[i].name); - if (!rtl8366rb_get_mib_counter(smi, i, val->port_vlan, &counter)) + "%-36s: ", smi->mib_counters[i].name); + if (!smi->ops->get_mib_counter(smi, i, val->port_vlan, + &counter)) len += snprintf(buf + len, sizeof(smi->buf) - len, "%llu\n", counter); else diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366s.c b/target/linux/generic/files/drivers/net/phy/rtl8366s.c index 7ed6c5fc1c..b603c23360 100644 --- a/target/linux/generic/files/drivers/net/phy/rtl8366s.c +++ b/target/linux/generic/files/drivers/net/phy/rtl8366s.c @@ -828,17 +828,18 @@ static int rtl8366s_sw_get_port_mib(struct switch_dev *dev, unsigned long long counter = 0; char *buf = smi->buf; - if (val->port_vlan >= RTL8366S_NUM_PORTS) + if (val->port_vlan >= smi->num_ports) return -EINVAL; len += snprintf(buf + len, sizeof(smi->buf) - len, "Port %d MIB counters\n", val->port_vlan); - for (i = 0; i < ARRAY_SIZE(rtl8366s_mib_counters); ++i) { + for (i = 0; i < smi->num_mib_counters; ++i) { len += snprintf(buf + len, sizeof(smi->buf) - len, - "%-36s: ", rtl8366s_mib_counters[i].name); - if (!rtl8366_get_mib_counter(smi, i, val->port_vlan, &counter)) + "%-36s: ", smi->mib_counters[i].name); + if (!smi->ops->get_mib_counter(smi, i, val->port_vlan, + &counter)) len += snprintf(buf + len, sizeof(smi->buf) - len, "%llu\n", counter); else |