From af42c0fffba6d24969bffc0ef7724a4a2842c249 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Mon, 1 Sep 2003 05:03:08 -0400 Subject: [PATCH] [netdrvr ne2k-pci] ethtool_ops support --- drivers/net/ne2k-pci.c | 42 ++++++++++++------------------------------ 1 file changed, 12 insertions(+), 30 deletions(-) diff --git a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c index 180fd9ecea3a0..c0def3a23135d 100644 --- a/drivers/net/ne2k-pci.c +++ b/drivers/net/ne2k-pci.c @@ -174,7 +174,7 @@ static void ne2k_pci_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset); static void ne2k_pci_block_output(struct net_device *dev, const int count, const unsigned char *buf, const int start_page); -static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); +static struct ethtool_ops ne2k_pci_ethtool_ops; @@ -355,7 +355,7 @@ static int __devinit ne2k_pci_init_one (struct pci_dev *pdev, ei_status.priv = (unsigned long) pdev; dev->open = &ne2k_pci_open; dev->stop = &ne2k_pci_close; - dev->do_ioctl = &netdev_ioctl; + dev->ethtool_ops = &ne2k_pci_ethtool_ops; NS8390_init(dev, 0); i = register_netdev(dev); @@ -583,40 +583,22 @@ static void ne2k_pci_block_output(struct net_device *dev, int count, return; } -static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) +static void ne2k_pci_get_drvinfo(struct net_device *dev, + struct ethtool_drvinfo *info) { struct ei_device *ei = dev->priv; struct pci_dev *pci_dev = (struct pci_dev *) ei->priv; - u32 ethcmd; - - if (copy_from_user(ðcmd, useraddr, sizeof(ethcmd))) - return -EFAULT; - - switch (ethcmd) { - case ETHTOOL_GDRVINFO: { - struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO}; - strcpy(info.driver, DRV_NAME); - strcpy(info.version, DRV_VERSION); - strcpy(info.bus_info, pci_name(pci_dev)); - if (copy_to_user(useraddr, &info, sizeof(info))) - return -EFAULT; - return 0; - } - } - - return -EOPNOTSUPP; + strcpy(info->driver, DRV_NAME); + strcpy(info->version, DRV_VERSION); + strcpy(info->bus_info, pci_name(pci_dev)); } -static int netdev_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; - } -} +static struct ethtool_ops ne2k_pci_ethtool_ops = { + .get_drvinfo = ne2k_pci_get_drvinfo, + .get_tx_csum = ethtool_op_get_tx_csum, + .get_sg = ethtool_op_get_sg, +}; static void __devexit ne2k_pci_remove_one (struct pci_dev *pdev) { -- 2.53.0