Commit 45e39485 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jeff Garzik

Add basic ethtool support to axnet_cs, wavelan_cs net drivers

(originally by Arjan, merged and re-merged by hch)
parent baa9f9dc
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/ethtool.h>
#include <asm/uaccess.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
...@@ -817,6 +819,27 @@ static void ei_watchdog(u_long arg) ...@@ -817,6 +819,27 @@ static void ei_watchdog(u_long arg)
add_timer(&info->watchdog); add_timer(&info->watchdog);
} }
static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
{
u32 ethcmd;
if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
return -EFAULT;
switch (ethcmd) {
case ETHTOOL_GDRVINFO: {
struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
strncpy(info.driver, "axnet_cs", sizeof(info.driver)-1);
if (copy_to_user(useraddr, &info, sizeof(info)))
return -EFAULT;
return 0;
}
}
return -EOPNOTSUPP;
}
/*====================================================================*/ /*====================================================================*/
static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
...@@ -825,6 +848,8 @@ static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ...@@ -825,6 +848,8 @@ static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
u16 *data = (u16 *)&rq->ifr_data; u16 *data = (u16 *)&rq->ifr_data;
ioaddr_t mii_addr = dev->base_addr + AXNET_MII_EEP; ioaddr_t mii_addr = dev->base_addr + AXNET_MII_EEP;
switch (cmd) { switch (cmd) {
case SIOCETHTOOL:
return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
case SIOCDEVPRIVATE: case SIOCDEVPRIVATE:
data[0] = info->phy_id; data[0] = info->phy_id;
case SIOCDEVPRIVATE+1: case SIOCDEVPRIVATE+1:
......
...@@ -56,6 +56,8 @@ ...@@ -56,6 +56,8 @@
* *
*/ */
#include <linux/ethtool.h>
#include <asm/uaccess.h>
#include "wavelan_cs.p.h" /* Private header */ #include "wavelan_cs.p.h" /* Private header */
/************************* MISC SUBROUTINES **************************/ /************************* MISC SUBROUTINES **************************/
...@@ -1858,6 +1860,27 @@ wl_his_gather(device * dev, ...@@ -1858,6 +1860,27 @@ wl_his_gather(device * dev,
} }
#endif /* HISTOGRAM */ #endif /* HISTOGRAM */
static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
{
u32 ethcmd;
if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
return -EFAULT;
switch (ethcmd) {
case ETHTOOL_GDRVINFO: {
struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
strncpy(info.driver, "wavelan_cs", sizeof(info.driver)-1);
if (copy_to_user(useraddr, &info, sizeof(info)))
return -EFAULT;
return 0;
}
}
return -EOPNOTSUPP;
}
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
/* /*
* Wireless Handler : get protocol name * Wireless Handler : get protocol name
...@@ -2889,6 +2912,10 @@ wavelan_ioctl(struct net_device * dev, /* Device on wich the ioctl apply */ ...@@ -2889,6 +2912,10 @@ wavelan_ioctl(struct net_device * dev, /* Device on wich the ioctl apply */
/* Look what is the request */ /* Look what is the request */
switch(cmd) switch(cmd)
{ {
case SIOCETHTOOL:
ret = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
break;
/* --------------- WIRELESS EXTENSIONS --------------- */ /* --------------- WIRELESS EXTENSIONS --------------- */
case SIOCGIWNAME: case SIOCGIWNAME:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment