- speed = (data & RTL8366S_PORT_STATUS_SPEED_MASK);
- duplex = (data & RTL8366S_PORT_STATUS_DUPLEX_MASK) >> 2;
- link = (data & RTL8366S_PORT_STATUS_LINK_MASK) >> 4;
- txpause = (data & RTL8366S_PORT_STATUS_TXPAUSE_MASK) >> 5;
- rxpause = (data & RTL8366S_PORT_STATUS_RXPAUSE_MASK) >> 6;
- nway = (data & RTL8366S_PORT_STATUS_AN_MASK) >> 7;
-
- len += snprintf(buf + len, sizeof(smi->buf) - len, "Port %d: ",
- val->port_vlan);
-
- if (link)
- len += snprintf(buf + len, sizeof(smi->buf) - len,
- "Link UP, Speed: ");
- else
- len += snprintf(buf + len, sizeof(smi->buf) - len,
- "Link DOWN, Speed: ");
-
- if (speed == 0)
- len += snprintf(buf + len, sizeof(smi->buf) - len,
- "10Base-TX ");
- else if (speed == 1)
- len += snprintf(buf + len, sizeof(smi->buf) - len,
- "100Base-TX ");
- else if (speed == 2)
- len += snprintf(buf + len, sizeof(smi->buf) - len,
- "1000Base-TX ");
-
- if (duplex)
- len += snprintf(buf + len, sizeof(smi->buf) - len,
- "Full-Duplex, ");
- else
- len += snprintf(buf + len, sizeof(smi->buf) - len,
- "Half-Duplex, ");
-
- if (txpause)
- len += snprintf(buf + len, sizeof(smi->buf) - len,
- "TX-Pause ");
- if (rxpause)
- len += snprintf(buf + len, sizeof(smi->buf) - len,
- "RX-Pause ");
- if (nway)
- len += snprintf(buf + len, sizeof(smi->buf) - len,
- "nway ");
-
- val->value.s = buf;
+ len = snprintf(smi->buf, sizeof(smi->buf),
+ "port:%d link:%s speed:%s %s-duplex %s%s%s",
+ val->port_vlan,
+ (data & RTL8366S_PORT_STATUS_LINK_MASK) ? "up" : "down",
+ rtl8366_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 ": "");
+
+ val->value.s = smi->buf;