-static int rtl8366rb_reset_chip(struct rtl8366rb *rtl)
+static inline struct rtl8366_smi *sw_to_rtl8366_smi(struct switch_dev *sw)
+{
+ struct rtl8366rb *rtl = sw_to_rtl8366rb(sw);
+ return &rtl->smi;
+}
+
+static int rtl8366rb_reset_chip(struct rtl8366_smi *smi)
/*
* For the 16 entries more work needs to be done. First see if such
* VID is already there and change it
*/
for (i = 0; i < RTL8366_NUM_VLANS; ++i) {
/*
* For the 16 entries more work needs to be done. First see if such
* VID is already there and change it
*/
for (i = 0; i < RTL8366_NUM_VLANS; ++i) {
/* Try to find an existing vid and update port member set */
if (val == vlanmc.vid) {
vlanmc.member |= ((1 << port) | RTL8366_PORT_CPU);
/* Try to find an existing vid and update port member set */
if (val == vlanmc.vid) {
vlanmc.member |= ((1 << port) | RTL8366_PORT_CPU);
size_t count, loff_t *ppos)
{
struct rtl8366rb *rtl = (struct rtl8366rb *)file->private_data;
size_t count, loff_t *ppos)
{
struct rtl8366rb *rtl = (struct rtl8366rb *)file->private_data;
- if (!rtl8366_get_mib_counter(rtl, i, j, &counter))
+ if (!rtl8366_get_mib_counter(smi, i, j, &counter))
size_t count, loff_t *ppos)
{
struct rtl8366rb *rtl = (struct rtl8366rb *)file->private_data;
size_t count, loff_t *ppos)
{
struct rtl8366rb *rtl = (struct rtl8366rb *)file->private_data;
len += snprintf(buf + len, sizeof(rtl->buf) - len,
"\t[%d] \t %d \t %d \t 0x%04x \t 0x%04x \t %d "
len += snprintf(buf + len, sizeof(rtl->buf) - len,
"\t[%d] \t %d \t %d \t 0x%04x \t 0x%04x \t %d "
struct rtl8366_vlan_mc vlanmc;
struct rtl8366_vlan_4k vlan4k;
struct rtl8366rb *rtl = sw_to_rtl8366rb(dev);
struct rtl8366_vlan_mc vlanmc;
struct rtl8366_vlan_4k vlan4k;
struct rtl8366rb *rtl = sw_to_rtl8366rb(dev);
- rtl8366rb_get_vlan_mc(rtl, val->port_vlan, &vlanmc);
- rtl8366rb_get_vlan_4k(rtl, vlanmc.vid, &vlan4k);
+ rtl8366rb_get_vlan_mc(smi, val->port_vlan, &vlanmc);
+ rtl8366rb_get_vlan_4k(smi, vlanmc.vid, &vlan4k);
len += snprintf(buf + len, sizeof(rtl->buf) - len, "VLAN %d: Ports: ",
val->port_vlan);
for (i = 0; i < RTL8366_NUM_PORTS; ++i) {
int index = 0;
len += snprintf(buf + len, sizeof(rtl->buf) - len, "VLAN %d: Ports: ",
val->port_vlan);
for (i = 0; i < RTL8366_NUM_PORTS; ++i) {
int index = 0;
for (i = 0; i < RTL8366S_MIB_COUNT; ++i) {
len += snprintf(buf + len, sizeof(rtl->buf) - len,
"%d:%s\t", i, rtl8366rb_mib_counters[i].name);
for (i = 0; i < RTL8366S_MIB_COUNT; ++i) {
len += snprintf(buf + len, sizeof(rtl->buf) - len,
"%d:%s\t", i, rtl8366rb_mib_counters[i].name);
- if (!rtl8366_get_mib_counter(rtl, i, val->port_vlan, &counter))
+ if (!rtl8366_get_mib_counter(smi, i, val->port_vlan, &counter))
- rtl8366rb_get_vlan_mc(rtl, val->port_vlan, &vlanmc);
- rtl8366rb_get_vlan_4k(rtl, vlanmc.vid, &vlan4k);
+ rtl8366rb_get_vlan_mc(smi, val->port_vlan, &vlanmc);
+ rtl8366rb_get_vlan_4k(smi, vlanmc.vid, &vlan4k);
- rtl8366rb_set_vlan_mc(rtl, val->port_vlan, &vlanmc);
- rtl8366rb_set_vlan_4k(rtl, &vlan4k);
+ rtl8366rb_set_vlan_mc(smi, val->port_vlan, &vlanmc);
+ rtl8366rb_set_vlan_4k(smi, &vlan4k);
- struct rtl8366rb *rtl = sw_to_rtl8366rb(dev);
- return rtl8366rb_get_vlan_port_pvid(rtl, port, val);
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
+ return rtl8366rb_get_vlan_port_pvid(smi, port, val);
- struct rtl8366rb *rtl = sw_to_rtl8366rb(dev);
- return rtl8366rb_set_vlan_port_pvid(rtl, port, val);
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
+ return rtl8366rb_set_vlan_port_pvid(smi, port, val);