diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2010-06-26 19:16:12 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2010-06-26 19:16:12 +0000 |
commit | d33784922b984fe89b0b47b6c0ed488684d80267 (patch) | |
tree | 391d550b99f073928f6f0e4585525569f6799922 /target/linux/generic-2.6/files/drivers/net/phy/rtl8366s.c | |
parent | da7200fc8db7c4c39418c7dc4982df709cf3064b (diff) | |
download | master-187ad058-d33784922b984fe89b0b47b6c0ed488684d80267.tar.gz master-187ad058-d33784922b984fe89b0b47b6c0ed488684d80267.tar.bz2 master-187ad058-d33784922b984fe89b0b47b6c0ed488684d80267.zip |
generic: rtl8366: rename vlanmc and vlan4k related structures an functions
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21913 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/generic-2.6/files/drivers/net/phy/rtl8366s.c')
-rw-r--r-- | target/linux/generic-2.6/files/drivers/net/phy/rtl8366s.c | 81 |
1 files changed, 40 insertions, 41 deletions
diff --git a/target/linux/generic-2.6/files/drivers/net/phy/rtl8366s.c b/target/linux/generic-2.6/files/drivers/net/phy/rtl8366s.c index 2af32eee4d..bbe06932b7 100644 --- a/target/linux/generic-2.6/files/drivers/net/phy/rtl8366s.c +++ b/target/linux/generic-2.6/files/drivers/net/phy/rtl8366s.c @@ -155,7 +155,7 @@ struct rtl8366s { #endif }; -struct rtl8366s_vlanconfig { +struct rtl8366s_vlan_mc { u16 reserved2:1; u16 priority:3; u16 vid:12; @@ -166,7 +166,7 @@ struct rtl8366s_vlanconfig { u16 member:6; }; -struct rtl8366s_vlan4kentry { +struct rtl8366s_vlan_4k { u16 reserved1:4; u16 vid:12; @@ -372,15 +372,15 @@ static int rtl8366_get_mib_counter(struct rtl8366s *rtl, int counter, return 0; } -static int rtl8366s_get_vlan_4k_entry(struct rtl8366s *rtl, u32 vid, - struct rtl8366s_vlan4kentry *vlan4k) +static int rtl8366s_get_vlan_4k(struct rtl8366s *rtl, u32 vid, + struct rtl8366s_vlan_4k *vlan4k) { struct rtl8366_smi *smi = &rtl->smi; int err; u32 data; u16 *tableaddr; - memset(vlan4k, '\0', sizeof(struct rtl8366s_vlan4kentry)); + memset(vlan4k, '\0', sizeof(struct rtl8366s_vlan_4k)); vlan4k->vid = vid; if (vid >= RTL8366_NUM_VIDS) @@ -418,8 +418,8 @@ static int rtl8366s_get_vlan_4k_entry(struct rtl8366s *rtl, u32 vid, return 0; } -static int rtl8366s_set_vlan_4k_entry(struct rtl8366s *rtl, - const struct rtl8366s_vlan4kentry *vlan4k) +static int rtl8366s_set_vlan_4k(struct rtl8366s *rtl, + const struct rtl8366s_vlan_4k *vlan4k) { struct rtl8366_smi *smi = &rtl->smi; int err; @@ -456,8 +456,8 @@ static int rtl8366s_set_vlan_4k_entry(struct rtl8366s *rtl, return err; } -static int rtl8366s_get_vlan_member_config(struct rtl8366s *rtl, u32 index, - struct rtl8366s_vlanconfig *vlanmc) +static int rtl8366s_get_vlan_mc(struct rtl8366s *rtl, u32 index, + struct rtl8366s_vlan_mc *vlanmc) { struct rtl8366_smi *smi = &rtl->smi; int err; @@ -465,7 +465,7 @@ static int rtl8366s_get_vlan_member_config(struct rtl8366s *rtl, u32 index, u32 data; u16 *tableaddr; - memset(vlanmc, '\0', sizeof(struct rtl8366s_vlanconfig)); + memset(vlanmc, '\0', sizeof(struct rtl8366s_vlan_mc)); if (index >= RTL8366_NUM_VLANS) return -EINVAL; @@ -490,9 +490,8 @@ static int rtl8366s_get_vlan_member_config(struct rtl8366s *rtl, u32 index, return 0; } -static int rtl8366s_set_vlan_member_config(struct rtl8366s *rtl, u32 index, - const struct rtl8366s_vlanconfig - *vlanmc) +static int rtl8366s_set_vlan_mc(struct rtl8366s *rtl, u32 index, + const struct rtl8366s_vlan_mc *vlanmc) { struct rtl8366_smi *smi = &rtl->smi; int err; @@ -554,7 +553,7 @@ static int rtl8366s_get_port_vlan_index(struct rtl8366s *rtl, int port, static int rtl8366s_get_vlan_port_pvid(struct rtl8366s *rtl, int port, int *val) { - struct rtl8366s_vlanconfig vlanmc; + struct rtl8366s_vlan_mc vlanmc; int err; int index; @@ -562,7 +561,7 @@ static int rtl8366s_get_vlan_port_pvid(struct rtl8366s *rtl, int port, if (err) return err; - err = rtl8366s_get_vlan_member_config(rtl, index, &vlanmc); + err = rtl8366s_get_vlan_mc(rtl, index, &vlanmc); if (err) return err; @@ -598,29 +597,29 @@ static int rtl8366s_set_port_vlan_index(struct rtl8366s *rtl, int port, static int rtl8366s_set_vlan_port_pvid(struct rtl8366s *rtl, int port, int val) { int i; - struct rtl8366s_vlanconfig vlanmc; - struct rtl8366s_vlan4kentry vlan4k; + struct rtl8366s_vlan_mc vlanmc; + struct rtl8366s_vlan_4k vlan4k; if (port >= RTL8366_NUM_PORTS || val >= RTL8366_NUM_VIDS) return -EINVAL; /* Updating the 4K entry; lookup it and change the port member set */ - rtl8366s_get_vlan_4k_entry(rtl, val, &vlan4k); + rtl8366s_get_vlan_4k(rtl, val, &vlan4k); vlan4k.member |= ((1 << port) | RTL8366_PORT_CPU); vlan4k.untag = RTL8366_PORT_ALL_BUT_CPU; - rtl8366s_set_vlan_4k_entry(rtl, &vlan4k); + rtl8366s_set_vlan_4k(rtl, &vlan4k); /* * 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) { - rtl8366s_get_vlan_member_config(rtl, i, &vlanmc); + rtl8366s_get_vlan_mc(rtl, i, &vlanmc); /* Try to find an existing vid and update port member set */ if (val == vlanmc.vid) { vlanmc.member |= ((1 << port) | RTL8366_PORT_CPU); - rtl8366s_set_vlan_member_config(rtl, i, &vlanmc); + rtl8366s_set_vlan_mc(rtl, i, &vlanmc); /* Now update PVID register settings */ rtl8366s_set_port_vlan_index(rtl, port, i); @@ -634,7 +633,7 @@ static int rtl8366s_set_vlan_port_pvid(struct rtl8366s *rtl, int port, int val) * has no member ports) with new one */ for (i = 0; i < RTL8366_NUM_VLANS; ++i) { - rtl8366s_get_vlan_member_config(rtl, i, &vlanmc); + rtl8366s_get_vlan_mc(rtl, i, &vlanmc); /* * See if this vlan member configuration is unused. It is @@ -647,7 +646,7 @@ static int rtl8366s_set_vlan_port_pvid(struct rtl8366s *rtl, int port, int val) vlanmc.member = ((1 << port) | RTL8366_PORT_CPU); vlanmc.fid = 0; - rtl8366s_set_vlan_member_config(rtl, i, &vlanmc); + rtl8366s_set_vlan_mc(rtl, i, &vlanmc); /* Now update PVID register settings */ rtl8366s_set_port_vlan_index(rtl, port, i); @@ -695,8 +694,8 @@ static int rtl8366s_vlan_set_4ktable(struct rtl8366s *rtl, int enable) static int rtl8366s_reset_vlan(struct rtl8366s *rtl) { - struct rtl8366s_vlan4kentry vlan4k; - struct rtl8366s_vlanconfig vlanmc; + struct rtl8366s_vlan_4k vlan4k; + struct rtl8366s_vlan_mc vlanmc; int err; int i; @@ -707,7 +706,7 @@ static int rtl8366s_reset_vlan(struct rtl8366s *rtl) vlanmc.untag = 0; vlanmc.fid = 0; for (i = 0; i < RTL8366_NUM_VLANS; i++) { - err = rtl8366s_set_vlan_member_config(rtl, i, &vlanmc); + err = rtl8366s_set_vlan_mc(rtl, i, &vlanmc); if (err) return err; } @@ -717,7 +716,7 @@ static int rtl8366s_reset_vlan(struct rtl8366s *rtl) vlan4k.member = RTL8366_PORT_ALL; vlan4k.untag = RTL8366_PORT_ALL; vlan4k.fid = 0; - err = rtl8366s_set_vlan_4k_entry(rtl, &vlan4k); + err = rtl8366s_set_vlan_4k(rtl, &vlan4k); if (err) return err; @@ -801,9 +800,9 @@ static ssize_t rtl8366s_read_debugfs_vlan(struct file *file, "\tports\n"); for (i = 0; i < RTL8366_NUM_VLANS; ++i) { - struct rtl8366s_vlanconfig vlanmc; + struct rtl8366s_vlan_mc vlanmc; - rtl8366s_get_vlan_member_config(rtl, i, &vlanmc); + rtl8366s_get_vlan_mc(rtl, i, &vlanmc); len += snprintf(buf + len, sizeof(rtl->buf) - len, "\t[%d] \t %d \t %d \t 0x%04x \t 0x%04x \t %d " @@ -1120,8 +1119,8 @@ static int rtl8366s_sw_get_vlan_info(struct switch_dev *dev, { int i; u32 len = 0; - struct rtl8366s_vlanconfig vlanmc; - struct rtl8366s_vlan4kentry vlan4k; + struct rtl8366s_vlan_mc vlanmc; + struct rtl8366s_vlan_4k vlan4k; struct rtl8366s *rtl = sw_to_rtl8366s(dev); char *buf = rtl->buf; @@ -1130,8 +1129,8 @@ static int rtl8366s_sw_get_vlan_info(struct switch_dev *dev, memset(buf, '\0', sizeof(rtl->buf)); - rtl8366s_get_vlan_member_config(rtl, val->port_vlan, &vlanmc); - rtl8366s_get_vlan_4k_entry(rtl, vlanmc.vid, &vlan4k); + rtl8366s_get_vlan_mc(rtl, val->port_vlan, &vlanmc); + rtl8366s_get_vlan_4k(rtl, vlanmc.vid, &vlan4k); len += snprintf(buf + len, sizeof(rtl->buf) - len, "VLAN %d: Ports: ", val->port_vlan); @@ -1259,7 +1258,7 @@ static int rtl8366s_sw_get_port_mib(struct switch_dev *dev, static int rtl8366s_sw_get_vlan_ports(struct switch_dev *dev, struct switch_val *val) { - struct rtl8366s_vlanconfig vlanmc; + struct rtl8366s_vlan_mc vlanmc; struct rtl8366s *rtl = sw_to_rtl8366s(dev); struct switch_port *port; int i; @@ -1267,7 +1266,7 @@ static int rtl8366s_sw_get_vlan_ports(struct switch_dev *dev, if (val->port_vlan == 0 || val->port_vlan >= RTL8366_NUM_VLANS) return -EINVAL; - rtl8366s_get_vlan_member_config(rtl, val->port_vlan, &vlanmc); + rtl8366s_get_vlan_mc(rtl, val->port_vlan, &vlanmc); port = &val->value.ports[0]; val->len = 0; @@ -1287,8 +1286,8 @@ static int rtl8366s_sw_get_vlan_ports(struct switch_dev *dev, static int rtl8366s_sw_set_vlan_ports(struct switch_dev *dev, struct switch_val *val) { - struct rtl8366s_vlanconfig vlanmc; - struct rtl8366s_vlan4kentry vlan4k; + struct rtl8366s_vlan_mc vlanmc; + struct rtl8366s_vlan_4k vlan4k; struct rtl8366s *rtl = sw_to_rtl8366s(dev); struct switch_port *port; int i; @@ -1296,8 +1295,8 @@ static int rtl8366s_sw_set_vlan_ports(struct switch_dev *dev, if (val->port_vlan == 0 || val->port_vlan >= RTL8366_NUM_VLANS) return -EINVAL; - rtl8366s_get_vlan_member_config(rtl, val->port_vlan, &vlanmc); - rtl8366s_get_vlan_4k_entry(rtl, vlanmc.vid, &vlan4k); + rtl8366s_get_vlan_mc(rtl, val->port_vlan, &vlanmc); + rtl8366s_get_vlan_4k(rtl, vlanmc.vid, &vlan4k); vlanmc.untag = 0; vlanmc.member = 0; @@ -1313,8 +1312,8 @@ static int rtl8366s_sw_set_vlan_ports(struct switch_dev *dev, vlan4k.member = vlanmc.member; vlan4k.untag = vlanmc.untag; - rtl8366s_set_vlan_member_config(rtl, val->port_vlan, &vlanmc); - rtl8366s_set_vlan_4k_entry(rtl, &vlan4k); + rtl8366s_set_vlan_mc(rtl, val->port_vlan, &vlanmc); + rtl8366s_set_vlan_4k(rtl, &vlan4k); return 0; } |