summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorZeng Zhaoming <b32542@freescale.com>2011-05-11 08:39:56 +0800
committerZeng Zhaoming <b32542@freescale.com>2011-05-13 05:08:24 +0800
commite01979d176b077956311116c1b43e5146c67ebd7 (patch)
treed1609d9765c9a19d9689354c70e123c85412828e /drivers/net
parentf5726c46a2bdd7c009d335e64f301aec08ec382c (diff)
ENGR00143384 Fec: fix get wrong carrier status when ethx down
using ioctl() to get interface carrier status, when ethx down, will get wrong status, accroding to linux net subsystem, this case should return EINVAL since phy not start and no carrier status can get. Signed-off-by: Zeng Zhaoming <b32542@freescale.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/fec.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index b85f1963d5a7..49a98903a671 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -914,11 +914,19 @@ static void fec_enet_get_drvinfo(struct net_device *dev,
strcpy(info->bus_info, dev_name(&dev->dev));
}
+static int fec_enet_get_link(struct net_device *dev)
+{
+ if (netif_running(dev))
+ return netif_carrier_ok(dev) ? 1 : 0;
+ else
+ return -EINVAL;
+}
+
static struct ethtool_ops fec_enet_ethtool_ops = {
.get_settings = fec_enet_get_settings,
.set_settings = fec_enet_set_settings,
.get_drvinfo = fec_enet_get_drvinfo,
- .get_link = ethtool_op_get_link,
+ .get_link = fec_enet_get_link,
};
static int fec_enet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)