kernel: rtl8306: cosmetic changes for swconfig
Changes to: - show the correct "enable_vlan" value under "Global attributes" - show tagged ports under "Vlan: ports" - use get_port_link method to report link status Signed-off-by: Antonios Vamporakis <ant@area128.com> SVN-Revision: 40303
This commit is contained in:
parent
89ecc2fdad
commit
6a72dc4082
1 changed files with 26 additions and 21 deletions
|
@ -582,6 +582,27 @@ rtl_attr_get_port_int(struct switch_dev *dev, const struct switch_attr *attr, st
|
||||||
return rtl_attr_get_int(dev, attr, val);
|
return rtl_attr_get_int(dev, attr, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
rtl_get_port_link(struct switch_dev *dev, int port, struct switch_port_link *link)
|
||||||
|
{
|
||||||
|
if (port >= RTL8306_NUM_PORTS)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
link->link = rtl_get(dev, RTL_PORT_REG(port, LINK));
|
||||||
|
if (!link->link)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
link->duplex = rtl_get(dev, RTL_PORT_REG(port, DUPLEX));
|
||||||
|
link->aneg = rtl_get(dev, RTL_PORT_REG(port, NWAY));
|
||||||
|
|
||||||
|
if (rtl_get(dev, RTL_PORT_REG(port, SPEED)))
|
||||||
|
link->speed = SWITCH_PORT_SPEED_100;
|
||||||
|
else
|
||||||
|
link->speed = SWITCH_PORT_SPEED_10;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
rtl_attr_set_vlan_int(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val)
|
rtl_attr_set_vlan_int(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val)
|
||||||
{
|
{
|
||||||
|
@ -614,7 +635,8 @@ rtl_get_ports(struct switch_dev *dev, struct switch_val *val)
|
||||||
|
|
||||||
port = &val->value.ports[val->len];
|
port = &val->value.ports[val->len];
|
||||||
port->id = i;
|
port->id = i;
|
||||||
port->flags = 0;
|
if (rtl_get(dev, RTL_PORT_REG(i, TAG_INSERT)) == 2 || i == dev->cpu_port)
|
||||||
|
port->flags = (1 << SWITCH_PORT_FLAG_TAGGED);
|
||||||
val->len++;
|
val->len++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -653,7 +675,8 @@ rtl_set_vlan(struct switch_dev *dev, const struct switch_attr *attr, struct swit
|
||||||
static int
|
static int
|
||||||
rtl_get_vlan(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val)
|
rtl_get_vlan(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val)
|
||||||
{
|
{
|
||||||
return rtl_get(dev, RTL_REG_VLAN_ENABLE);
|
val->value.i = rtl_get(dev, RTL_REG_VLAN_ENABLE);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -776,13 +799,6 @@ static struct switch_attr rtl_port[] = {
|
||||||
.description = "Port VLAN ID",
|
.description = "Port VLAN ID",
|
||||||
.max = RTL8306_NUM_VLANS - 1,
|
.max = RTL8306_NUM_VLANS - 1,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
RTL_PORT_REGATTR(LINK),
|
|
||||||
.name = "link",
|
|
||||||
.description = "get the current link state",
|
|
||||||
.max = 1,
|
|
||||||
.set = NULL,
|
|
||||||
},
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
{
|
{
|
||||||
RTL_PORT_REGATTR(NULL_VID_REPLACE),
|
RTL_PORT_REGATTR(NULL_VID_REPLACE),
|
||||||
|
@ -809,18 +825,6 @@ static struct switch_attr rtl_port[] = {
|
||||||
.max = 3,
|
.max = 3,
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
RTL_PORT_REGATTR(SPEED),
|
|
||||||
.name = "speed",
|
|
||||||
.description = "current link speed",
|
|
||||||
.max = 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
RTL_PORT_REGATTR(NWAY),
|
|
||||||
.name = "nway",
|
|
||||||
.description = "enable autonegotiation",
|
|
||||||
.max = 1,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct switch_attr rtl_vlan[] = {
|
static struct switch_attr rtl_vlan[] = {
|
||||||
|
@ -850,6 +854,7 @@ static const struct switch_dev_ops rtl8306_ops = {
|
||||||
.set_vlan_ports = rtl_set_ports,
|
.set_vlan_ports = rtl_set_ports,
|
||||||
.apply_config = rtl_hw_apply,
|
.apply_config = rtl_hw_apply,
|
||||||
.reset_switch = rtl_reset,
|
.reset_switch = rtl_reset,
|
||||||
|
.get_port_link = rtl_get_port_link,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
Loading…
Reference in a new issue