diff options
author | Alex Bounine <alex.bou9@gmail.com> | 2008-02-11 14:36:37 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2008-02-11 14:47:29 -0500 |
commit | 9dde447a09ec8fc0ba8375a16fe6bed2470f0d14 (patch) | |
tree | bc75ced62ba07340d088bf9a2380db99a3122587 /drivers/net/tsi108_eth.c | |
parent | b1aefe58c21de4265223b563ae923b50f4c4be08 (diff) |
Tsi108_eth: Add ethtool support
Add ethtool support to tsi108_eth network driver.
Signed-off-by: Alexandre Bounine <alexandreb@tundra.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/tsi108_eth.c')
-rw-r--r-- | drivers/net/tsi108_eth.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c index bc3848962bb1..6f33f84d37b0 100644 --- a/drivers/net/tsi108_eth.c +++ b/drivers/net/tsi108_eth.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/net.h> | 36 | #include <linux/net.h> |
37 | #include <linux/netdevice.h> | 37 | #include <linux/netdevice.h> |
38 | #include <linux/etherdevice.h> | 38 | #include <linux/etherdevice.h> |
39 | #include <linux/ethtool.h> | ||
39 | #include <linux/skbuff.h> | 40 | #include <linux/skbuff.h> |
40 | #include <linux/slab.h> | 41 | #include <linux/slab.h> |
41 | #include <linux/spinlock.h> | 42 | #include <linux/spinlock.h> |
@@ -1519,12 +1520,46 @@ static void tsi108_init_mac(struct net_device *dev) | |||
1519 | TSI_WRITE(TSI108_EC_INTMASK, ~0); | 1520 | TSI_WRITE(TSI108_EC_INTMASK, ~0); |
1520 | } | 1521 | } |
1521 | 1522 | ||
1523 | static int tsi108_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | ||
1524 | { | ||
1525 | struct tsi108_prv_data *data = netdev_priv(dev); | ||
1526 | unsigned long flags; | ||
1527 | int rc; | ||
1528 | |||
1529 | spin_lock_irqsave(&data->txlock, flags); | ||
1530 | rc = mii_ethtool_gset(&data->mii_if, cmd); | ||
1531 | spin_unlock_irqrestore(&data->txlock, flags); | ||
1532 | |||
1533 | return rc; | ||
1534 | } | ||
1535 | |||
1536 | static int tsi108_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | ||
1537 | { | ||
1538 | struct tsi108_prv_data *data = netdev_priv(dev); | ||
1539 | unsigned long flags; | ||
1540 | int rc; | ||
1541 | |||
1542 | spin_lock_irqsave(&data->txlock, flags); | ||
1543 | rc = mii_ethtool_sset(&data->mii_if, cmd); | ||
1544 | spin_unlock_irqrestore(&data->txlock, flags); | ||
1545 | |||
1546 | return rc; | ||
1547 | } | ||
1548 | |||
1522 | static int tsi108_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | 1549 | static int tsi108_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) |
1523 | { | 1550 | { |
1524 | struct tsi108_prv_data *data = netdev_priv(dev); | 1551 | struct tsi108_prv_data *data = netdev_priv(dev); |
1552 | if (!netif_running(dev)) | ||
1553 | return -EINVAL; | ||
1525 | return generic_mii_ioctl(&data->mii_if, if_mii(rq), cmd, NULL); | 1554 | return generic_mii_ioctl(&data->mii_if, if_mii(rq), cmd, NULL); |
1526 | } | 1555 | } |
1527 | 1556 | ||
1557 | static const struct ethtool_ops tsi108_ethtool_ops = { | ||
1558 | .get_link = ethtool_op_get_link, | ||
1559 | .get_settings = tsi108_get_settings, | ||
1560 | .set_settings = tsi108_set_settings, | ||
1561 | }; | ||
1562 | |||
1528 | static int | 1563 | static int |
1529 | tsi108_init_one(struct platform_device *pdev) | 1564 | tsi108_init_one(struct platform_device *pdev) |
1530 | { | 1565 | { |
@@ -1589,6 +1624,7 @@ tsi108_init_one(struct platform_device *pdev) | |||
1589 | dev->get_stats = tsi108_get_stats; | 1624 | dev->get_stats = tsi108_get_stats; |
1590 | netif_napi_add(dev, &data->napi, tsi108_poll, 64); | 1625 | netif_napi_add(dev, &data->napi, tsi108_poll, 64); |
1591 | dev->do_ioctl = tsi108_do_ioctl; | 1626 | dev->do_ioctl = tsi108_do_ioctl; |
1627 | dev->ethtool_ops = &tsi108_ethtool_ops; | ||
1592 | 1628 | ||
1593 | /* Apparently, the Linux networking code won't use scatter-gather | 1629 | /* Apparently, the Linux networking code won't use scatter-gather |
1594 | * if the hardware doesn't do checksums. However, it's faster | 1630 | * if the hardware doesn't do checksums. However, it's faster |