|
@@ -36,6 +36,7 @@
|
|
|
#include <linux/net.h>
|
|
|
#include <linux/netdevice.h>
|
|
|
#include <linux/etherdevice.h>
|
|
|
+#include <linux/ethtool.h>
|
|
|
#include <linux/skbuff.h>
|
|
|
#include <linux/slab.h>
|
|
|
#include <linux/spinlock.h>
|
|
@@ -1519,12 +1520,46 @@ static void tsi108_init_mac(struct net_device *dev)
|
|
|
TSI_WRITE(TSI108_EC_INTMASK, ~0);
|
|
|
}
|
|
|
|
|
|
+static int tsi108_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
|
|
+{
|
|
|
+ struct tsi108_prv_data *data = netdev_priv(dev);
|
|
|
+ unsigned long flags;
|
|
|
+ int rc;
|
|
|
+
|
|
|
+ spin_lock_irqsave(&data->txlock, flags);
|
|
|
+ rc = mii_ethtool_gset(&data->mii_if, cmd);
|
|
|
+ spin_unlock_irqrestore(&data->txlock, flags);
|
|
|
+
|
|
|
+ return rc;
|
|
|
+}
|
|
|
+
|
|
|
+static int tsi108_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
|
|
+{
|
|
|
+ struct tsi108_prv_data *data = netdev_priv(dev);
|
|
|
+ unsigned long flags;
|
|
|
+ int rc;
|
|
|
+
|
|
|
+ spin_lock_irqsave(&data->txlock, flags);
|
|
|
+ rc = mii_ethtool_sset(&data->mii_if, cmd);
|
|
|
+ spin_unlock_irqrestore(&data->txlock, flags);
|
|
|
+
|
|
|
+ return rc;
|
|
|
+}
|
|
|
+
|
|
|
static int tsi108_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
|
|
{
|
|
|
struct tsi108_prv_data *data = netdev_priv(dev);
|
|
|
+ if (!netif_running(dev))
|
|
|
+ return -EINVAL;
|
|
|
return generic_mii_ioctl(&data->mii_if, if_mii(rq), cmd, NULL);
|
|
|
}
|
|
|
|
|
|
+static const struct ethtool_ops tsi108_ethtool_ops = {
|
|
|
+ .get_link = ethtool_op_get_link,
|
|
|
+ .get_settings = tsi108_get_settings,
|
|
|
+ .set_settings = tsi108_set_settings,
|
|
|
+};
|
|
|
+
|
|
|
static int
|
|
|
tsi108_init_one(struct platform_device *pdev)
|
|
|
{
|
|
@@ -1589,6 +1624,7 @@ tsi108_init_one(struct platform_device *pdev)
|
|
|
dev->get_stats = tsi108_get_stats;
|
|
|
netif_napi_add(dev, &data->napi, tsi108_poll, 64);
|
|
|
dev->do_ioctl = tsi108_do_ioctl;
|
|
|
+ dev->ethtool_ops = &tsi108_ethtool_ops;
|
|
|
|
|
|
/* Apparently, the Linux networking code won't use scatter-gather
|
|
|
* if the hardware doesn't do checksums. However, it's faster
|