patch-2.4.18 linux/drivers/net/pcmcia/aironet4500_cs.c
Next file: linux/drivers/net/pcmcia/fmvj18x_cs.c
Previous file: linux/drivers/net/pcmcia/3c589_cs.c
Back to the patch index
Back to the overall index
- Lines: 100
- Date:
Fri Dec 21 18:50:47 2001
- Orig file:
linux.orig/drivers/net/pcmcia/aironet4500_cs.c
- Orig date:
Mon Feb 18 20:18:39 2002
diff -Naur -X /home/marcelo/lib/dontdiff linux.orig/drivers/net/pcmcia/aironet4500_cs.c linux/drivers/net/pcmcia/aironet4500_cs.c
@@ -10,8 +10,11 @@
*
*/
+#define DRV_NAME "aironet4500_cs"
+#define DRV_VERSION "0.1"
+
static const char *awc_version =
-"aironet4500_cs.c v0.1 1/1/99 Elmer Joandi, elmer@ylenurme.ee.\n";
+DRV_NAME ".c v" DRV_VERSION " 1/1/99 Elmer Joandi, elmer@ylenurme.ee.\n";
#include <linux/module.h>
@@ -24,6 +27,9 @@
#include <linux/timer.h>
#include <linux/interrupt.h>
#include <linux/in.h>
+#include <linux/ethtool.h>
+
+#include <asm/uaccess.h>
#include <asm/io.h>
#include <asm/system.h>
#include <asm/bitops.h>
@@ -159,6 +165,66 @@
return ret;
}
+static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
+{
+ u32 ethcmd;
+
+ /* dev_ioctl() in ../../net/core/dev.c has already checked
+ capable(CAP_NET_ADMIN), so don't bother with that here. */
+
+ if (get_user(ethcmd, (u32 *)useraddr))
+ return -EFAULT;
+
+ switch (ethcmd) {
+
+ case ETHTOOL_GDRVINFO: {
+ struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
+ strcpy (info.driver, DRV_NAME);
+ strcpy (info.version, DRV_VERSION);
+ sprintf(info.bus_info, "PCMCIA 0x%lx", dev->base_addr);
+ if (copy_to_user (useraddr, &info, sizeof (info)))
+ return -EFAULT;
+ return 0;
+ }
+
+#ifdef PCMCIA_DEBUG
+ /* get message-level */
+ case ETHTOOL_GMSGLVL: {
+ struct ethtool_value edata = {ETHTOOL_GMSGLVL};
+ edata.data = pc_debug;
+ if (copy_to_user(useraddr, &edata, sizeof(edata)))
+ return -EFAULT;
+ return 0;
+ }
+ /* set message-level */
+ case ETHTOOL_SMSGLVL: {
+ struct ethtool_value edata;
+ if (copy_from_user(&edata, useraddr, sizeof(edata)))
+ return -EFAULT;
+ pc_debug = edata.data;
+ return 0;
+ }
+#endif
+
+ default:
+ break;
+ }
+
+ return -EOPNOTSUPP;
+}
+
+static int awc_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
+{
+ switch (cmd) {
+ case SIOCETHTOOL:
+ return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
+
+ default:
+ return -EOPNOTSUPP;
+ }
+ return 0;
+}
+
/*
awc_attach() creates an "instance" of the driver, allocating
local data structures for one device. The device is registered
@@ -230,7 +296,8 @@
// dev->set_config = &awc_config_misiganes,aga mitte awc_config;
dev->get_stats = &awc_get_stats;
// dev->set_multicast_list = &awc_set_multicast_list;
-
+ dev->do_ioctl = &awc_ioctl;
+
strcpy(dev->name, ((struct awc_private *)dev->priv)->node.dev_name);
ether_setup(dev);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)