1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2025-04-21 12:27:27 +03:00

generic: add rtl8366rb switch vlan fid support

Allows to use fids 0 to 7. Default is 0.
Those who will use this don't forget to `set vlan fid` every time
after `set vlan ports` if you want non default behavior.
Minor changes. Version bump.

Signed-off-by: Roman Yeryomin <roman@advem.lv>

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@24125 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
juhosg
2010-11-24 10:01:21 +00:00
parent d59a23df99
commit dbdef16088
3 changed files with 66 additions and 7 deletions

View File

@@ -972,6 +972,52 @@ int rtl8366_sw_set_vlan_ports(struct switch_dev *dev, struct switch_val *val)
}
EXPORT_SYMBOL_GPL(rtl8366_sw_set_vlan_ports);
int rtl8366_sw_get_vlan_fid(struct switch_dev *dev,
const struct switch_attr *attr,
struct switch_val *val)
{
struct rtl8366_vlan_4k vlan4k;
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
int err;
if (!smi->ops->is_vlan_valid(smi, val->port_vlan))
return -EINVAL;
err = smi->ops->get_vlan_4k(smi, val->port_vlan, &vlan4k);
if (err)
return err;
val->value.i = vlan4k.fid;
return 0;
}
EXPORT_SYMBOL_GPL(rtl8366_sw_get_vlan_fid);
int rtl8366_sw_set_vlan_fid(struct switch_dev *dev,
const struct switch_attr *attr,
struct switch_val *val)
{
struct rtl8366_vlan_4k vlan4k;
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
int err;
if (!smi->ops->is_vlan_valid(smi, val->port_vlan))
return -EINVAL;
if (val->value.i < 0 || val->value.i > attr->max)
return -EINVAL;
err = smi->ops->get_vlan_4k(smi, val->port_vlan, &vlan4k);
if (err)
return err;
return rtl8366_set_vlan(smi, val->port_vlan,
vlan4k.member,
vlan4k.untag,
val->value.i);
}
EXPORT_SYMBOL_GPL(rtl8366_sw_set_vlan_fid);
int rtl8366_sw_get_vlan_enable(struct switch_dev *dev,
const struct switch_attr *attr,
struct switch_val *val)