1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-12-18 16:49:23 +02:00

generic: rtl8366: don't show link parameters if the link is down

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21908 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
juhosg 2010-06-26 19:15:48 +00:00
parent d9272169b8
commit 062819b9cb
2 changed files with 34 additions and 24 deletions

View File

@ -1119,10 +1119,10 @@ 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;
if (data & RTL8366S_PORT_STATUS_LINK_MASK) {
len = snprintf(rtl->buf, sizeof(rtl->buf), len = snprintf(rtl->buf, sizeof(rtl->buf),
"port:%d link:%s speed:%s %s-duplex %s%s%s", "port:%d link:up speed:%s %s-duplex %s%s%s",
val->port_vlan, val->port_vlan,
(data & RTL8366S_PORT_STATUS_LINK_MASK) ? "up" : "down",
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) ?
@ -1131,7 +1131,12 @@ static int rtl8366rb_sw_get_port_link(struct switch_dev *dev,
"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;

View File

@ -1087,10 +1087,10 @@ 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;
if (data & RTL8366S_PORT_STATUS_LINK_MASK) {
len = snprintf(rtl->buf, sizeof(rtl->buf), len = snprintf(rtl->buf, sizeof(rtl->buf),
"port:%d link:%s speed:%s %s-duplex %s%s%s", "port:%d link:up speed:%s %s-duplex %s%s%s",
val->port_vlan, val->port_vlan,
(data & RTL8366S_PORT_STATUS_LINK_MASK) ? "up" : "down",
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) ?
@ -1099,7 +1099,12 @@ static int rtl8366s_sw_get_port_link(struct switch_dev *dev,
"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;