mirror of https://github.com/hak5/openwrt-owl.git
generic: rtl8366: don't show link parameters if the link is down
SVN-Revision: 21908owl
parent
0aa0d49169
commit
e627f76251
|
@ -1119,19 +1119,24 @@ static int rtl8366rb_sw_get_port_link(struct switch_dev *dev,
|
||||||
if (val->port_vlan % 2)
|
if (val->port_vlan % 2)
|
||||||
data = data >> 8;
|
data = data >> 8;
|
||||||
|
|
||||||
len = snprintf(rtl->buf, sizeof(rtl->buf),
|
if (data & RTL8366S_PORT_STATUS_LINK_MASK) {
|
||||||
"port:%d link:%s speed:%s %s-duplex %s%s%s",
|
len = snprintf(rtl->buf, sizeof(rtl->buf),
|
||||||
val->port_vlan,
|
"port:%d link:up speed:%s %s-duplex %s%s%s",
|
||||||
(data & RTL8366S_PORT_STATUS_LINK_MASK) ? "up" : "down",
|
val->port_vlan,
|
||||||
rtl8366rb_speed_str(data &
|
rtl8366rb_speed_str(data &
|
||||||
RTL8366S_PORT_STATUS_SPEED_MASK),
|
RTL8366S_PORT_STATUS_SPEED_MASK),
|
||||||
(data & RTL8366S_PORT_STATUS_DUPLEX_MASK) ?
|
(data & RTL8366S_PORT_STATUS_DUPLEX_MASK) ?
|
||||||
"full" : "half",
|
"full" : "half",
|
||||||
(data & RTL8366S_PORT_STATUS_TXPAUSE_MASK) ?
|
(data & RTL8366S_PORT_STATUS_TXPAUSE_MASK) ?
|
||||||
"tx-pause ": "",
|
"tx-pause ": "",
|
||||||
(data & RTL8366S_PORT_STATUS_RXPAUSE_MASK) ?
|
(data & RTL8366S_PORT_STATUS_RXPAUSE_MASK) ?
|
||||||
"rx-pause " : "",
|
"rx-pause " : "",
|
||||||
(data & RTL8366S_PORT_STATUS_AN_MASK) ? "nway ": "");
|
(data & RTL8366S_PORT_STATUS_AN_MASK) ?
|
||||||
|
"nway ": "");
|
||||||
|
} else {
|
||||||
|
len = snprintf(rtl->buf, sizeof(rtl->buf), "port:%d link: down",
|
||||||
|
val->port_vlan);
|
||||||
|
}
|
||||||
|
|
||||||
val->value.s = rtl->buf;
|
val->value.s = rtl->buf;
|
||||||
val->len = len;
|
val->len = len;
|
||||||
|
|
|
@ -1087,19 +1087,24 @@ static int rtl8366s_sw_get_port_link(struct switch_dev *dev,
|
||||||
if (val->port_vlan % 2)
|
if (val->port_vlan % 2)
|
||||||
data = data >> 8;
|
data = data >> 8;
|
||||||
|
|
||||||
len = snprintf(rtl->buf, sizeof(rtl->buf),
|
if (data & RTL8366S_PORT_STATUS_LINK_MASK) {
|
||||||
"port:%d link:%s speed:%s %s-duplex %s%s%s",
|
len = snprintf(rtl->buf, sizeof(rtl->buf),
|
||||||
val->port_vlan,
|
"port:%d link:up speed:%s %s-duplex %s%s%s",
|
||||||
(data & RTL8366S_PORT_STATUS_LINK_MASK) ? "up" : "down",
|
val->port_vlan,
|
||||||
rtl8366s_speed_str(data &
|
rtl8366s_speed_str(data &
|
||||||
RTL8366S_PORT_STATUS_SPEED_MASK),
|
RTL8366S_PORT_STATUS_SPEED_MASK),
|
||||||
(data & RTL8366S_PORT_STATUS_DUPLEX_MASK) ?
|
(data & RTL8366S_PORT_STATUS_DUPLEX_MASK) ?
|
||||||
"full" : "half",
|
"full" : "half",
|
||||||
(data & RTL8366S_PORT_STATUS_TXPAUSE_MASK) ?
|
(data & RTL8366S_PORT_STATUS_TXPAUSE_MASK) ?
|
||||||
"tx-pause ": "",
|
"tx-pause ": "",
|
||||||
(data & RTL8366S_PORT_STATUS_RXPAUSE_MASK) ?
|
(data & RTL8366S_PORT_STATUS_RXPAUSE_MASK) ?
|
||||||
"rx-pause " : "",
|
"rx-pause " : "",
|
||||||
(data & RTL8366S_PORT_STATUS_AN_MASK) ? "nway ": "");
|
(data & RTL8366S_PORT_STATUS_AN_MASK) ?
|
||||||
|
"nway ": "");
|
||||||
|
} else {
|
||||||
|
len = snprintf(rtl->buf, sizeof(rtl->buf), "port:%d link: down",
|
||||||
|
val->port_vlan);
|
||||||
|
}
|
||||||
|
|
||||||
val->value.s = rtl->buf;
|
val->value.s = rtl->buf;
|
||||||
val->len = len;
|
val->len = len;
|
||||||
|
|
Loading…
Reference in New Issue