Commit 7f301cff authored by Michael Zhivich's avatar Michael Zhivich Committed by David S. Miller

ethtool: thunder_bgx: use ethtool.h constants for speed and duplex

Use constants provided by ethtool.h for speed and duplex values
instead of raw integer constants to increase code readability.

thunder_bgx already uses SPEED_UNKNOWN and DUPLEX_UNKNOWN constants,
also provided by ethtool.h.
Signed-off-by: default avatarMichael Zhivich <mzhivich@akamai.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b7f29f8c
...@@ -962,13 +962,13 @@ static void bgx_poll_for_sgmii_link(struct lmac *lmac) ...@@ -962,13 +962,13 @@ static void bgx_poll_for_sgmii_link(struct lmac *lmac)
lmac->last_duplex = (an_result >> 1) & 0x1; lmac->last_duplex = (an_result >> 1) & 0x1;
switch (speed) { switch (speed) {
case 0: case 0:
lmac->last_speed = 10; lmac->last_speed = SPEED_10;
break; break;
case 1: case 1:
lmac->last_speed = 100; lmac->last_speed = SPEED_100;
break; break;
case 2: case 2:
lmac->last_speed = 1000; lmac->last_speed = SPEED_1000;
break; break;
default: default:
lmac->link_up = false; lmac->link_up = false;
...@@ -1012,10 +1012,10 @@ static void bgx_poll_for_link(struct work_struct *work) ...@@ -1012,10 +1012,10 @@ static void bgx_poll_for_link(struct work_struct *work)
!(smu_link & SMU_RX_CTL_STATUS)) { !(smu_link & SMU_RX_CTL_STATUS)) {
lmac->link_up = 1; lmac->link_up = 1;
if (lmac->lmac_type == BGX_MODE_XLAUI) if (lmac->lmac_type == BGX_MODE_XLAUI)
lmac->last_speed = 40000; lmac->last_speed = SPEED_40000;
else else
lmac->last_speed = 10000; lmac->last_speed = SPEED_10000;
lmac->last_duplex = 1; lmac->last_duplex = DUPLEX_FULL;
} else { } else {
lmac->link_up = 0; lmac->link_up = 0;
lmac->last_speed = SPEED_UNKNOWN; lmac->last_speed = SPEED_UNKNOWN;
...@@ -1105,8 +1105,8 @@ static int bgx_lmac_enable(struct bgx *bgx, u8 lmacid) ...@@ -1105,8 +1105,8 @@ static int bgx_lmac_enable(struct bgx *bgx, u8 lmacid)
} else { } else {
/* Default to below link speed and duplex */ /* Default to below link speed and duplex */
lmac->link_up = true; lmac->link_up = true;
lmac->last_speed = 1000; lmac->last_speed = SPEED_1000;
lmac->last_duplex = 1; lmac->last_duplex = DUPLEX_FULL;
bgx_sgmii_change_link_state(lmac); bgx_sgmii_change_link_state(lmac);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment