summaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2010-06-26 19:15:48 +0000
committerjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2010-06-26 19:15:48 +0000
commit062819b9cb1abcc20133a87434c1b07a3a82ef94 (patch)
tree89976ac88808e11152dcd3f3f89af71f87850482 /target
parentd9272169b84d59efaac856c5595b4f656937d5f0 (diff)
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
Diffstat (limited to 'target')
-rw-r--r--target/linux/generic-2.6/files/drivers/net/phy/rtl8366rb.c29
-rw-r--r--target/linux/generic-2.6/files/drivers/net/phy/rtl8366s.c29
2 files changed, 34 insertions, 24 deletions
diff --git a/target/linux/generic-2.6/files/drivers/net/phy/rtl8366rb.c b/target/linux/generic-2.6/files/drivers/net/phy/rtl8366rb.c
index 98c5a0ba85..1069225d20 100644
--- a/target/linux/generic-2.6/files/drivers/net/phy/rtl8366rb.c
+++ b/target/linux/generic-2.6/files/drivers/net/phy/rtl8366rb.c
@@ -1119,19 +1119,24 @@ static int rtl8366rb_sw_get_port_link(struct switch_dev *dev,
if (val->port_vlan % 2)
data = data >> 8;
- len = snprintf(rtl->buf, sizeof(rtl->buf),
- "port:%d link:%s speed:%s %s-duplex %s%s%s",
- val->port_vlan,
- (data & RTL8366S_PORT_STATUS_LINK_MASK) ? "up" : "down",
- rtl8366rb_speed_str(data &
+ if (data & RTL8366S_PORT_STATUS_LINK_MASK) {
+ len = snprintf(rtl->buf, sizeof(rtl->buf),
+ "port:%d link:up speed:%s %s-duplex %s%s%s",
+ val->port_vlan,
+ rtl8366rb_speed_str(data &
RTL8366S_PORT_STATUS_SPEED_MASK),
- (data & RTL8366S_PORT_STATUS_DUPLEX_MASK) ?
- "full" : "half",
- (data & RTL8366S_PORT_STATUS_TXPAUSE_MASK) ?
- "tx-pause ": "",
- (data & RTL8366S_PORT_STATUS_RXPAUSE_MASK) ?
- "rx-pause " : "",
- (data & RTL8366S_PORT_STATUS_AN_MASK) ? "nway ": "");
+ (data & RTL8366S_PORT_STATUS_DUPLEX_MASK) ?
+ "full" : "half",
+ (data & RTL8366S_PORT_STATUS_TXPAUSE_MASK) ?
+ "tx-pause ": "",
+ (data & RTL8366S_PORT_STATUS_RXPAUSE_MASK) ?
+ "rx-pause " : "",
+ (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->len = len;
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 26d5c7880b..f30a5a3c6d 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
@@ -1087,19 +1087,24 @@ static int rtl8366s_sw_get_port_link(struct switch_dev *dev,
if (val->port_vlan % 2)
data = data >> 8;
- len = snprintf(rtl->buf, sizeof(rtl->buf),
- "port:%d link:%s speed:%s %s-duplex %s%s%s",
- val->port_vlan,
- (data & RTL8366S_PORT_STATUS_LINK_MASK) ? "up" : "down",
- rtl8366s_speed_str(data &
+ if (data & RTL8366S_PORT_STATUS_LINK_MASK) {
+ len = snprintf(rtl->buf, sizeof(rtl->buf),
+ "port:%d link:up speed:%s %s-duplex %s%s%s",
+ val->port_vlan,
+ rtl8366s_speed_str(data &
RTL8366S_PORT_STATUS_SPEED_MASK),
- (data & RTL8366S_PORT_STATUS_DUPLEX_MASK) ?
- "full" : "half",
- (data & RTL8366S_PORT_STATUS_TXPAUSE_MASK) ?
- "tx-pause ": "",
- (data & RTL8366S_PORT_STATUS_RXPAUSE_MASK) ?
- "rx-pause " : "",
- (data & RTL8366S_PORT_STATUS_AN_MASK) ? "nway ": "");
+ (data & RTL8366S_PORT_STATUS_DUPLEX_MASK) ?
+ "full" : "half",
+ (data & RTL8366S_PORT_STATUS_TXPAUSE_MASK) ?
+ "tx-pause ": "",
+ (data & RTL8366S_PORT_STATUS_RXPAUSE_MASK) ?
+ "rx-pause " : "",
+ (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->len = len;