1 /******************************************************************************
2  * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
3  *
4  * Based on the r8180 driver, which is:
5  * Copyright 2004-2005 Andrea Merello <andrea.merello@gmail.com>, et al.
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of version 2 of the GNU General Public License as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  *
15  * The full GNU General Public License is included in this distribution in the
16  * file called LICENSE.
17  *
18  * Contact Information:
19  * wlanfae <wlanfae@realtek.com>
20  *****************************************************************************
21  */
22 #include <linux/netdevice.h>
23 #include <linux/ethtool.h>
24 #include <linux/delay.h>
25 
26 #include "rtl_core.h"
27 
_rtl92e_ethtool_get_drvinfo(struct net_device * dev,struct ethtool_drvinfo * info)28 static void _rtl92e_ethtool_get_drvinfo(struct net_device *dev,
29 					struct ethtool_drvinfo *info)
30 {
31 	struct r8192_priv *priv = rtllib_priv(dev);
32 
33 	strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
34 	strlcpy(info->version, DRV_VERSION, sizeof(info->version));
35 	strlcpy(info->bus_info, pci_name(priv->pdev), sizeof(info->bus_info));
36 }
37 
_rtl92e_ethtool_get_link(struct net_device * dev)38 static u32 _rtl92e_ethtool_get_link(struct net_device *dev)
39 {
40 	struct r8192_priv *priv = rtllib_priv(dev);
41 
42 	return ((priv->rtllib->state == RTLLIB_LINKED) ||
43 		(priv->rtllib->state == RTLLIB_LINKED_SCANNING));
44 }
45 
46 const struct ethtool_ops rtl819x_ethtool_ops = {
47 	.get_drvinfo = _rtl92e_ethtool_get_drvinfo,
48 	.get_link = _rtl92e_ethtool_get_link,
49 };
50