diff options
author | Thibaut VARENE <hacks@slashdirt.org> | 2017-08-04 12:29:52 +0200 |
---|---|---|
committer | John Crispin <john@phrozen.org> | 2017-09-01 09:30:35 +0200 |
commit | 0369e358916ef092a1644334f5dd1412051b68a4 (patch) | |
tree | 3778611278cb84aeaf772f7072ccf9e0ca1d6d98 /target/linux/generic/files/drivers/net/phy/rtl8367b.c | |
parent | 3056d09b4046e0eb0f6de0f3f5432cd9fa86fc51 (diff) | |
download | mtk-20170518-0369e358916ef092a1644334f5dd1412051b68a4.zip mtk-20170518-0369e358916ef092a1644334f5dd1412051b68a4.tar.gz mtk-20170518-0369e358916ef092a1644334f5dd1412051b68a4.tar.bz2 |
generic: provide get_port_stats() on rtl836x switches
This patch provides a generic switch_dev_ops 'get_port_stats()' callback by
taping into the relevant port MIB counters.
This callback is used by swconfig_leds led trigger to blink LEDs with port
network traffic.
Signed-off-by: Thibaut VARENE <hacks@slashdirt.org>
Diffstat (limited to 'target/linux/generic/files/drivers/net/phy/rtl8367b.c')
-rw-r--r-- | target/linux/generic/files/drivers/net/phy/rtl8367b.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8367b.c b/target/linux/generic/files/drivers/net/phy/rtl8367b.c index a73e35e..dbf440a 100644 --- a/target/linux/generic/files/drivers/net/phy/rtl8367b.c +++ b/target/linux/generic/files/drivers/net/phy/rtl8367b.c @@ -235,6 +235,9 @@ struct rtl8367b_initval { u16 val; }; +#define RTL8367B_MIB_RXB_ID 0 /* IfInOctets */ +#define RTL8367B_MIB_TXB_ID 28 /* IfOutOctets */ + static struct rtl8366_mib_counter rtl8367b_mib_counters[RTL8367B_NUM_MIB_COUNTERS] = { {0, 0, 4, "ifInOctets" }, @@ -1302,6 +1305,13 @@ static int rtl8367b_sw_reset_port_mibs(struct switch_dev *dev, RTL8367B_MIB_CTRL0_PORT_RESET_MASK(port % 8)); } +static int rtl8367b_sw_get_port_stats(struct switch_dev *dev, int port, + struct switch_port_stats *stats) +{ + return (rtl8366_sw_get_port_stats(dev, port, stats, + RTL8367B_MIB_TXB_ID, RTL8367B_MIB_RXB_ID)); +} + static struct switch_attr rtl8367b_globals[] = { { .type = SWITCH_TYPE_INT, @@ -1382,6 +1392,7 @@ static const struct switch_dev_ops rtl8367b_sw_ops = { .set_port_pvid = rtl8366_sw_set_port_pvid, .reset_switch = rtl8366_sw_reset_switch, .get_port_link = rtl8367b_sw_get_port_link, + .get_port_stats = rtl8367b_sw_get_port_stats, }; static int rtl8367b_switch_init(struct rtl8366_smi *smi) |