RTL8366RB_MIB_CTRL_PORT_RESET(val->port_vlan));
}
-static int rtl8366rb_sw_get_port_mib(struct switch_dev *dev,
- const struct switch_attr *attr,
- struct switch_val *val)
-{
- struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
- int i, len = 0;
- unsigned long long counter = 0;
- char *buf = smi->buf;
-
- if (val->port_vlan >= RTL8366RB_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) {
- 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))
- len += snprintf(buf + len, sizeof(smi->buf) - len,
- "%llu\n", counter);
- else
- len += snprintf(buf + len, sizeof(smi->buf) - len,
- "%s\n", "error");
- }
-
- val->value.s = buf;
- val->len = len;
- return 0;
-}
-
static int rtl8366rb_sw_get_vlan_ports(struct switch_dev *dev,
struct switch_val *val)
{
return rtl8366_set_vlan(smi, val->port_vlan, member, untag, 0);
}
-static int rtl8366rb_sw_get_port_pvid(struct switch_dev *dev, int port, int *val)
-{
- struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
- return rtl8366_get_pvid(smi, port, val);
-}
-
-static int rtl8366rb_sw_set_port_pvid(struct switch_dev *dev, int port, int val)
-{
- struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
- return rtl8366_set_pvid(smi, port, val);
-}
-
static int rtl8366rb_sw_reset_switch(struct switch_dev *dev)
{
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
.description = "Get MIB counters for port",
.max = 33,
.set = NULL,
- .get = rtl8366rb_sw_get_port_mib,
+ .get = rtl8366_sw_get_port_mib,
}, {
.type = SWITCH_TYPE_INT,
.name = "led",
.get_vlan_ports = rtl8366rb_sw_get_vlan_ports,
.set_vlan_ports = rtl8366rb_sw_set_vlan_ports,
- .get_port_pvid = rtl8366rb_sw_get_port_pvid,
- .set_port_pvid = rtl8366rb_sw_set_port_pvid,
+ .get_port_pvid = rtl8366_sw_get_port_pvid,
+ .set_port_pvid = rtl8366_sw_set_port_pvid,
.reset_switch = rtl8366rb_sw_reset_switch,
};