- if (data & RTL8366RB_PORT_STATUS_LINK_MASK) {
- len = snprintf(smi->buf, sizeof(smi->buf),
- "port:%d link:up speed:%s %s-duplex %s%s%s",
- val->port_vlan,
- rtl8366rb_speed_str(data &
- RTL8366RB_PORT_STATUS_SPEED_MASK),
- (data & RTL8366RB_PORT_STATUS_DUPLEX_MASK) ?
- "full" : "half",
- (data & RTL8366RB_PORT_STATUS_TXPAUSE_MASK) ?
- "tx-pause ": "",
- (data & RTL8366RB_PORT_STATUS_RXPAUSE_MASK) ?
- "rx-pause " : "",
- (data & RTL8366RB_PORT_STATUS_AN_MASK) ?
- "nway ": "");
- } else {
- len = snprintf(smi->buf, sizeof(smi->buf), "port:%d link: down",
- val->port_vlan);
- }
+ link->link = !!(data & RTL8366RB_PORT_STATUS_LINK_MASK);
+ if (!link->link)
+ return 0;
+
+ link->duplex = !!(data & RTL8366RB_PORT_STATUS_DUPLEX_MASK);
+ link->rx_flow = !!(data & RTL8366RB_PORT_STATUS_RXPAUSE_MASK);
+ link->tx_flow = !!(data & RTL8366RB_PORT_STATUS_TXPAUSE_MASK);
+ link->aneg = !!(data & RTL8366RB_PORT_STATUS_AN_MASK);