aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxiong <xiong@qca.qualcomm.com>2013-01-19 13:15:09 +0800
committerLuis R. Rodriguez <mcgrof@do-not-panic.com>2013-01-24 07:56:06 -0800
commit426fc1195b0a73e9ee94a145b273a6388d62a08d (patch)
tree996902ac8519a48653e57feaea390245709f9d4f
parentd3c925fe8ec202a4ef6b656cb90c3f8d59894727 (diff)
downloadalx-426fc1195b0a73e9ee94a145b273a6388d62a08d.tar.gz
alx: show correct DUPLEX info for ethtool
because FULL_DUPLEX & DUPLEX_FULL are different, 'ethtool ethX' will show wrong duplex info, this patch fix it. the PHY initial advertisement is also changed to reflect real HW capability. Signed-off-by: xiong <xiong@qca.qualcomm.com> Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
-rw-r--r--src/alx_ethtool.c16
-rw-r--r--src/alx_main.c2
2 files changed, 15 insertions, 3 deletions
diff --git a/src/alx_ethtool.c b/src/alx_ethtool.c
index 50cae4a..22e781c 100644
--- a/src/alx_ethtool.c
+++ b/src/alx_ethtool.c
@@ -40,7 +40,8 @@ static int alx_get_settings(struct net_device *netdev,
SUPPORTED_100baseT_Half |
SUPPORTED_100baseT_Full |
SUPPORTED_Autoneg |
- SUPPORTED_TP);
+ SUPPORTED_TP |
+ SUPPORTED_Pause);
if (ALX_CAP(hw, GIGA))
ecmd->supported |= SUPPORTED_1000baseT_Full;
@@ -54,9 +55,20 @@ static int alx_get_settings(struct net_device *netdev,
AUTONEG_ENABLE : AUTONEG_DISABLE;
ecmd->transceiver = XCVR_INTERNAL;
+ if (hw->flowctrl & ALX_FC_ANEG &&
+ hw->adv_cfg & ADVERTISED_Autoneg) {
+ if (hw->flowctrl & ALX_FC_RX) {
+ ecmd->advertising |= ADVERTISED_Pause;
+ if (!(hw->flowctrl & ALX_FC_TX))
+ ecmd->advertising |= ADVERTISED_Asym_Pause;
+ } else if (hw->flowctrl & ALX_FC_TX)
+ ecmd->advertising |= ADVERTISED_Asym_Pause;
+ }
+
if (hw->link_up) {
ethtool_cmd_speed_set(ecmd, hw->link_speed);
- ecmd->duplex = hw->link_duplex;
+ ecmd->duplex = hw->link_duplex == FULL_DUPLEX ?
+ DUPLEX_FULL : DUPLEX_HALF;
} else {
ethtool_cmd_speed_set(ecmd, -1);
ecmd->duplex = -1;
diff --git a/src/alx_main.c b/src/alx_main.c
index a99baff..c3e7e1f 100644
--- a/src/alx_main.c
+++ b/src/alx_main.c
@@ -1101,7 +1101,7 @@ static int __devinit alx_init_sw(struct alx_adapter *adpt)
ADVERTISED_10baseT_Half |
ADVERTISED_10baseT_Full |
ADVERTISED_100baseT_Full |
- ADVERTISED_10baseT_Half |
+ ADVERTISED_100baseT_Half |
ADVERTISED_1000baseT_Full;
hw->flowctrl = ALX_FC_ANEG | ALX_FC_RX | ALX_FC_TX;
hw->wrr_ctrl = ALX_WRR_PRI_RESTRICT_NONE;