aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/files/drivers/net/phy/rtl8366s.c
diff options
context:
space:
mode:
authorThibaut VARENE <hacks@slashdirt.org>2017-08-04 12:29:52 +0200
committerJohn Crispin <john@phrozen.org>2017-09-01 09:30:35 +0200
commit0369e358916ef092a1644334f5dd1412051b68a4 (patch)
tree3778611278cb84aeaf772f7072ccf9e0ca1d6d98 /target/linux/generic/files/drivers/net/phy/rtl8366s.c
parent3056d09b4046e0eb0f6de0f3f5432cd9fa86fc51 (diff)
downloadupstream-0369e358916ef092a1644334f5dd1412051b68a4.tar.gz
upstream-0369e358916ef092a1644334f5dd1412051b68a4.tar.bz2
upstream-0369e358916ef092a1644334f5dd1412051b68a4.zip
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/rtl8366s.c')
-rw-r--r--target/linux/generic/files/drivers/net/phy/rtl8366s.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366s.c b/target/linux/generic/files/drivers/net/phy/rtl8366s.c
index 1c8a106b10..3f458f9dec 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8366s.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8366s.c
@@ -181,6 +181,9 @@
#define RTL8366S_VLAN_FID_SHIFT 12
#define RTL8366S_VLAN_FID_MASK 0x7
+#define RTL8366S_MIB_RXB_ID 0 /* IfInOctets */
+#define RTL8366S_MIB_TXB_ID 20 /* IfOutOctets */
+
static struct rtl8366_mib_counter rtl8366s_mib_counters[] = {
{ 0, 0, 4, "IfInOctets" },
{ 0, 4, 4, "EtherStatsOctets" },
@@ -982,6 +985,13 @@ static int rtl8366s_sw_reset_port_mibs(struct switch_dev *dev,
0, (1 << (val->port_vlan + 3)));
}
+static int rtl8366s_sw_get_port_stats(struct switch_dev *dev, int port,
+ struct switch_port_stats *stats)
+{
+ return (rtl8366_sw_get_port_stats(dev, port, stats,
+ RTL8366S_MIB_TXB_ID, RTL8366S_MIB_RXB_ID));
+}
+
static struct switch_attr rtl8366s_globals[] = {
{
.type = SWITCH_TYPE_INT,
@@ -1105,6 +1115,7 @@ static const struct switch_dev_ops rtl8366_ops = {
.set_port_pvid = rtl8366_sw_set_port_pvid,
.reset_switch = rtl8366_sw_reset_switch,
.get_port_link = rtl8366s_sw_get_port_link,
+ .get_port_stats = rtl8366s_sw_get_port_stats,
};
static int rtl8366s_switch_init(struct rtl8366_smi *smi)