diff options
Diffstat (limited to 'drivers/net/pcmcia')
-rw-r--r-- | drivers/net/pcmcia/3c574_cs.c | 23 | ||||
-rw-r--r-- | drivers/net/pcmcia/3c589_cs.c | 25 | ||||
-rw-r--r-- | drivers/net/pcmcia/axnet_cs.c | 70 | ||||
-rw-r--r-- | drivers/net/pcmcia/fmvj18x_cs.c | 59 | ||||
-rw-r--r-- | drivers/net/pcmcia/nmclan_cs.c | 23 | ||||
-rw-r--r-- | drivers/net/pcmcia/pcnet_cs.c | 34 | ||||
-rw-r--r-- | drivers/net/pcmcia/smc91c92_cs.c | 79 | ||||
-rw-r--r-- | drivers/net/pcmcia/xirc2ps_cs.c | 66 |
8 files changed, 185 insertions, 194 deletions
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c index 2404a838b1f..8f3872b8985 100644 --- a/drivers/net/pcmcia/3c574_cs.c +++ b/drivers/net/pcmcia/3c574_cs.c @@ -257,6 +257,18 @@ static void tc574_detach(struct pcmcia_device *p_dev); local data structures for one device. The device is registered with Card Services. */ +static const struct net_device_ops el3_netdev_ops = { + .ndo_open = el3_open, + .ndo_stop = el3_close, + .ndo_start_xmit = el3_start_xmit, + .ndo_tx_timeout = el3_tx_timeout, + .ndo_get_stats = el3_get_stats, + .ndo_do_ioctl = el3_ioctl, + .ndo_set_multicast_list = set_rx_mode, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; static int tc574_probe(struct pcmcia_device *link) { @@ -284,18 +296,9 @@ static int tc574_probe(struct pcmcia_device *link) link->conf.IntType = INT_MEMORY_AND_IO; link->conf.ConfigIndex = 1; - /* The EL3-specific entries in the device structure. */ - dev->hard_start_xmit = &el3_start_xmit; - dev->get_stats = &el3_get_stats; - dev->do_ioctl = &el3_ioctl; + dev->netdev_ops = &el3_netdev_ops; SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); - dev->set_multicast_list = &set_rx_mode; - dev->open = &el3_open; - dev->stop = &el3_close; -#ifdef HAVE_TX_TIMEOUT - dev->tx_timeout = el3_tx_timeout; dev->watchdog_timeo = TX_TIMEOUT; -#endif return tc574_config(link); } /* tc574_attach */ diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index 1e01b8a6dbf..cdf661a6092 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c @@ -169,6 +169,19 @@ static void tc589_detach(struct pcmcia_device *p_dev); ======================================================================*/ +static const struct net_device_ops el3_netdev_ops = { + .ndo_open = el3_open, + .ndo_stop = el3_close, + .ndo_start_xmit = el3_start_xmit, + .ndo_tx_timeout = el3_tx_timeout, + .ndo_set_config = el3_config, + .ndo_get_stats = el3_get_stats, + .ndo_set_multicast_list = set_multicast_list, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; + static int tc589_probe(struct pcmcia_device *link) { struct el3_private *lp; @@ -195,17 +208,9 @@ static int tc589_probe(struct pcmcia_device *link) link->conf.IntType = INT_MEMORY_AND_IO; link->conf.ConfigIndex = 1; - /* The EL3-specific entries in the device structure. */ - dev->hard_start_xmit = &el3_start_xmit; - dev->set_config = &el3_config; - dev->get_stats = &el3_get_stats; - dev->set_multicast_list = &set_multicast_list; - dev->open = &el3_open; - dev->stop = &el3_close; -#ifdef HAVE_TX_TIMEOUT - dev->tx_timeout = el3_tx_timeout; + dev->netdev_ops = &el3_netdev_ops; dev->watchdog_timeo = TX_TIMEOUT; -#endif + SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); return tc589_config(link); diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 0afa7209581..501a8d7ac2b 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c @@ -35,6 +35,7 @@ #include <linux/spinlock.h> #include <linux/ethtool.h> #include <linux/netdevice.h> +#include <linux/etherdevice.h> #include <linux/crc32.h> #include "../8390.h" @@ -91,6 +92,10 @@ static void axnet_release(struct pcmcia_device *link); static int axnet_open(struct net_device *dev); static int axnet_close(struct net_device *dev); static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); +static int axnet_start_xmit(struct sk_buff *skb, struct net_device *dev); +static struct net_device_stats *get_stats(struct net_device *dev); +static void set_multicast_list(struct net_device *dev); +static void axnet_tx_timeout(struct net_device *dev); static const struct ethtool_ops netdev_ethtool_ops; static irqreturn_t ei_irq_wrapper(int irq, void *dev_id); static void ei_watchdog(u_long arg); @@ -108,7 +113,6 @@ static void block_output(struct net_device *dev, int count, static void axnet_detach(struct pcmcia_device *p_dev); -static void axdev_setup(struct net_device *dev); static void AX88190_init(struct net_device *dev, int startp); static int ax_open(struct net_device *dev); static int ax_close(struct net_device *dev); @@ -134,6 +138,19 @@ static inline axnet_dev_t *PRIV(struct net_device *dev) return p; } +static const struct net_device_ops axnet_netdev_ops = { + .ndo_open = axnet_open, + .ndo_stop = axnet_close, + .ndo_do_ioctl = axnet_ioctl, + .ndo_start_xmit = axnet_start_xmit, + .ndo_tx_timeout = axnet_tx_timeout, + .ndo_get_stats = get_stats, + .ndo_set_multicast_list = set_multicast_list, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; + /*====================================================================== axnet_attach() creates an "instance" of the driver, allocating @@ -146,15 +163,17 @@ static int axnet_probe(struct pcmcia_device *link) { axnet_dev_t *info; struct net_device *dev; + struct ei_device *ei_local; DEBUG(0, "axnet_attach()\n"); - dev = alloc_netdev(sizeof(struct ei_device) + sizeof(axnet_dev_t), - "eth%d", axdev_setup); - + dev = alloc_etherdev(sizeof(struct ei_device) + sizeof(axnet_dev_t)); if (!dev) return -ENOMEM; + ei_local = netdev_priv(dev); + spin_lock_init(&ei_local->page_lock); + info = PRIV(dev); info->p_dev = link; link->priv = dev; @@ -163,10 +182,10 @@ static int axnet_probe(struct pcmcia_device *link) link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.IntType = INT_MEMORY_AND_IO; - dev->open = &axnet_open; - dev->stop = &axnet_close; - dev->do_ioctl = &axnet_ioctl; + dev->netdev_ops = &axnet_netdev_ops; + SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); + dev->watchdog_timeo = TX_TIMEOUT; return axnet_config(link); } /* axnet_attach */ @@ -861,7 +880,7 @@ module_exit(exit_axnet_cs); */ -static const char *version_8390 = +static const char version_8390[] = KERN_INFO \ "8390.c:v1.10cvs 9/23/94 Donald Becker (becker@scyld.com)\n"; #include <linux/bitops.h> @@ -905,14 +924,12 @@ int ei_debug = 1; /* Index to functions. */ static void ei_tx_intr(struct net_device *dev); static void ei_tx_err(struct net_device *dev); -static void axnet_tx_timeout(struct net_device *dev); static void ei_receive(struct net_device *dev); static void ei_rx_overrun(struct net_device *dev); /* Routines generic to NS8390-based boards. */ static void NS8390_trigger_send(struct net_device *dev, unsigned int length, int start_page); -static void set_multicast_list(struct net_device *dev); static void do_set_multicast_list(struct net_device *dev); /* @@ -954,15 +971,6 @@ static int ax_open(struct net_device *dev) unsigned long flags; struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev); -#ifdef HAVE_TX_TIMEOUT - /* The card I/O part of the driver (e.g. 3c503) can hook a Tx timeout - wrapper that does e.g. media check & then calls axnet_tx_timeout. */ - if (dev->tx_timeout == NULL) - dev->tx_timeout = axnet_tx_timeout; - if (dev->watchdog_timeo <= 0) - dev->watchdog_timeo = TX_TIMEOUT; -#endif - /* * Grab the page lock so we own the register set, then call * the init function. @@ -1701,30 +1709,6 @@ static void set_multicast_list(struct net_device *dev) spin_unlock_irqrestore(&dev_lock(dev), flags); } -/** - * axdev_setup - init rest of 8390 device struct - * @dev: network device structure to init - * - * Initialize the rest of the 8390 device structure. Do NOT __init - * this, as it is used by 8390 based modular drivers too. - */ - -static void axdev_setup(struct net_device *dev) -{ - struct ei_device *ei_local; - if (ei_debug > 1) - printk(version_8390); - - ei_local = (struct ei_device *)netdev_priv(dev); - spin_lock_init(&ei_local->page_lock); - - dev->hard_start_xmit = &axnet_start_xmit; - dev->get_stats = get_stats; - dev->set_multicast_list = &set_multicast_list; - - ether_setup(dev); -} - /* This page of functions should be 8390 generic */ /* Follow National Semi's recommendations for initializing the "NIC". */ diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index 69dcfbbabe8..81e6660a433 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c @@ -100,7 +100,6 @@ static int fjn_start_xmit(struct sk_buff *skb, struct net_device *dev); static irqreturn_t fjn_interrupt(int irq, void *dev_id); static void fjn_rx(struct net_device *dev); static void fjn_reset(struct net_device *dev); -static struct net_device_stats *fjn_get_stats(struct net_device *dev); static void set_rx_mode(struct net_device *dev); static void fjn_tx_timeout(struct net_device *dev); static const struct ethtool_ops netdev_ethtool_ops; @@ -118,7 +117,6 @@ typedef enum { MBH10302, MBH10304, TDK, CONTEC, LA501, UNGERMANN, typedef struct local_info_t { struct pcmcia_device *p_dev; dev_node_t node; - struct net_device_stats stats; long open_time; uint tx_started:1; uint tx_queue; @@ -229,6 +227,18 @@ typedef struct local_info_t { #define BANK_1U 0x24 /* bank 1 (CONFIG_1) */ #define BANK_2U 0x28 /* bank 2 (CONFIG_1) */ +static const struct net_device_ops fjn_netdev_ops = { + .ndo_open = fjn_open, + .ndo_stop = fjn_close, + .ndo_start_xmit = fjn_start_xmit, + .ndo_tx_timeout = fjn_tx_timeout, + .ndo_set_config = fjn_config, + .ndo_set_multicast_list = set_rx_mode, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; + static int fmvj18x_probe(struct pcmcia_device *link) { local_info_t *lp; @@ -260,17 +270,9 @@ static int fmvj18x_probe(struct pcmcia_device *link) link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.IntType = INT_MEMORY_AND_IO; - /* The FMVJ18x specific entries in the device structure. */ - dev->hard_start_xmit = &fjn_start_xmit; - dev->set_config = &fjn_config; - dev->get_stats = &fjn_get_stats; - dev->set_multicast_list = &set_rx_mode; - dev->open = &fjn_open; - dev->stop = &fjn_close; -#ifdef HAVE_TX_TIMEOUT - dev->tx_timeout = fjn_tx_timeout; + dev->netdev_ops = &fjn_netdev_ops; dev->watchdog_timeo = TX_TIMEOUT; -#endif + SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); return fmvj18x_config(link); @@ -793,7 +795,7 @@ static irqreturn_t fjn_interrupt(int dummy, void *dev_id) fjn_rx(dev); } if (tx_stat & F_TMT_RDY) { - lp->stats.tx_packets += lp->sent ; + dev->stats.tx_packets += lp->sent ; lp->sent = 0 ; if (lp->tx_queue) { outb(DO_TX | lp->tx_queue, ioaddr + TX_START); @@ -840,7 +842,7 @@ static void fjn_tx_timeout(struct net_device *dev) htons(inw(ioaddr + 6)), htons(inw(ioaddr + 8)), htons(inw(ioaddr +10)), htons(inw(ioaddr +12)), htons(inw(ioaddr +14))); - lp->stats.tx_errors++; + dev->stats.tx_errors++; /* ToDo: We should try to restart the adaptor... */ local_irq_disable(); fjn_reset(dev); @@ -880,7 +882,7 @@ static int fjn_start_xmit(struct sk_buff *skb, struct net_device *dev) DEBUG(4, "%s: Transmitting a packet of length %lu.\n", dev->name, (unsigned long)skb->len); - lp->stats.tx_bytes += skb->len; + dev->stats.tx_bytes += skb->len; /* Disable both interrupts. */ outw(0x0000, ioaddr + TX_INTR); @@ -1008,7 +1010,6 @@ static void fjn_reset(struct net_device *dev) static void fjn_rx(struct net_device *dev) { - struct local_info_t *lp = netdev_priv(dev); unsigned int ioaddr = dev->base_addr; int boguscount = 10; /* 5 -> 10: by agy 19940922 */ @@ -1027,11 +1028,11 @@ static void fjn_rx(struct net_device *dev) } #endif if ((status & 0xF0) != 0x20) { /* There was an error. */ - lp->stats.rx_errors++; - if (status & F_LEN_ERR) lp->stats.rx_length_errors++; - if (status & F_ALG_ERR) lp->stats.rx_frame_errors++; - if (status & F_CRC_ERR) lp->stats.rx_crc_errors++; - if (status & F_OVR_FLO) lp->stats.rx_over_errors++; + dev->stats.rx_errors++; + if (status & F_LEN_ERR) dev->stats.rx_length_errors++; + if (status & F_ALG_ERR) dev->stats.rx_frame_errors++; + if (status & F_CRC_ERR) dev->stats.rx_crc_errors++; + if (status & F_OVR_FLO) dev->stats.rx_over_errors++; } else { u_short pkt_len = inw(ioaddr + DATAPORT); /* Malloc up new buffer. */ @@ -1041,7 +1042,7 @@ static void fjn_rx(struct net_device *dev) printk(KERN_NOTICE "%s: The FMV-18x claimed a very " "large packet, size %d.\n", dev->name, pkt_len); outb(F_SKP_PKT, ioaddr + RX_SKIP); - lp->stats.rx_errors++; + dev->stats.rx_errors++; break; } skb = dev_alloc_skb(pkt_len+2); @@ -1049,7 +1050,7 @@ static void fjn_rx(struct net_device *dev) printk(KERN_NOTICE "%s: Memory squeeze, dropping " "packet (len %d).\n", dev->name, pkt_len); outb(F_SKP_PKT, ioaddr + RX_SKIP); - lp->stats.rx_dropped++; + dev->stats.rx_dropped++; break; } @@ -1070,8 +1071,8 @@ static void fjn_rx(struct net_device *dev) #endif netif_rx(skb); - lp->stats.rx_packets++; - lp->stats.rx_bytes += pkt_len; + dev->stats.rx_packets++; + dev->stats.rx_bytes += pkt_len; } if (--boguscount <= 0) break; @@ -1191,14 +1192,6 @@ static int fjn_close(struct net_device *dev) /*====================================================================*/ -static struct net_device_stats *fjn_get_stats(struct net_device *dev) -{ - local_info_t *lp = netdev_priv(dev); - return &lp->stats; -} /* fjn_get_stats */ - -/*====================================================================*/ - /* Set the multicast/promiscuous mode for this adaptor. */ diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index ec7c588c9ae..02ef63ed1f9 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c @@ -436,6 +436,19 @@ static const struct ethtool_ops netdev_ethtool_ops; static void nmclan_detach(struct pcmcia_device *p_dev); +static const struct net_device_ops mace_netdev_ops = { + .ndo_open = mace_open, + .ndo_stop = mace_close, + .ndo_start_xmit = mace_start_xmit, + .ndo_tx_timeout = mace_tx_timeout, + .ndo_set_config = mace_config, + .ndo_get_stats = mace_get_stats, + .ndo_set_multicast_list = set_multicast_list, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; + /* ---------------------------------------------------------------------------- nmclan_attach Creates an "instance" of the driver, allocating local data @@ -474,17 +487,9 @@ static int nmclan_probe(struct pcmcia_device *link) lp->tx_free_frames=AM2150_MAX_TX_FRAMES; - dev->hard_start_xmit = &mace_start_xmit; - dev->set_config = &mace_config; - dev->get_stats = &mace_get_stats; - dev->set_multicast_list = &set_multicast_list; + dev->netdev_ops = &mace_netdev_ops; SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); - dev->open = &mace_open; - dev->stop = &mace_close; -#ifdef HAVE_TX_TIMEOUT - dev->tx_timeout = mace_tx_timeout; dev->watchdog_timeo = TX_TIMEOUT; -#endif return nmclan_config(link); } /* nmclan_attach */ diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index a6999403f37..2fbf9f9ddd3 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c @@ -39,6 +39,7 @@ #include <linux/ethtool.h> #include <linux/netdevice.h> #include <linux/log2.h> +#include <linux/etherdevice.h> #include "../8390.h" #include <pcmcia/cs_types.h> @@ -233,6 +234,23 @@ static inline pcnet_dev_t *PRIV(struct net_device *dev) return (pcnet_dev_t *)(p + sizeof(struct ei_device)); } +static const struct net_device_ops pcnet_netdev_ops = { + .ndo_open = pcnet_open, + .ndo_stop = pcnet_close, + .ndo_set_config = set_config, + .ndo_start_xmit = ei_start_xmit, + .ndo_get_stats = ei_get_stats, + .ndo_do_ioctl = ei_ioctl, + .ndo_set_multicast_list = ei_set_multicast_list, + .ndo_tx_timeout = ei_tx_timeout, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = ei_poll, +#endif +}; + /*====================================================================== pcnet_attach() creates an "instance" of the driver, allocating @@ -260,9 +278,7 @@ static int pcnet_probe(struct pcmcia_device *link) link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.IntType = INT_MEMORY_AND_IO; - dev->open = &pcnet_open; - dev->stop = &pcnet_close; - dev->set_config = &set_config; + dev->netdev_ops = &pcnet_netdev_ops; return pcnet_config(link); } /* pcnet_attach */ @@ -640,18 +656,12 @@ static int pcnet_config(struct pcmcia_device *link) SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); - if (info->flags & (IS_DL10019|IS_DL10022)) { - dev->do_ioctl = &ei_ioctl; + if (info->flags & (IS_DL10019|IS_DL10022)) mii_phy_probe(dev); - } link->dev_node = &info->node; SET_NETDEV_DEV(dev, &handle_to_dev(link)); -#ifdef CONFIG_NET_POLL_CONTROLLER - dev->poll_controller = ei_poll; -#endif - if (register_netdev(dev) != 0) { printk(KERN_NOTICE "pcnet_cs: register_netdev() failed\n"); link->dev_node = NULL; @@ -1183,6 +1193,10 @@ static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) pcnet_dev_t *info = PRIV(dev); u16 *data = (u16 *)&rq->ifr_ifru; unsigned int mii_addr = dev->base_addr + DLINK_GPIO; + + if (!(info->flags & (IS_DL10019|IS_DL10022))) + return -EINVAL; + switch (cmd) { case SIOCGMIIPHY: data[0] = info->phy_id; diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index fccd53ef3c6..774232c13b3 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c @@ -108,7 +108,7 @@ struct smc_private { spinlock_t lock; u_short manfid; u_short cardid; - struct net_device_stats stats; + dev_node_t node; struct sk_buff *saved_skb; int packets_waiting; @@ -289,7 +289,6 @@ static void smc_tx_timeout(struct net_device *dev); static int smc_start_xmit(struct sk_buff *skb, struct net_device *dev); static irqreturn_t smc_interrupt(int irq, void *dev_id); static void smc_rx(struct net_device *dev); -static struct net_device_stats *smc_get_stats(struct net_device *dev); static void set_rx_mode(struct net_device *dev); static int s9k_config(struct net_device *dev, struct ifmap *map); static void smc_set_xcvr(struct net_device *dev, int if_port); @@ -301,6 +300,19 @@ static void mdio_write(struct net_device *dev, int phy_id, int loc, int value); static int smc_link_ok(struct net_device *dev); static const struct ethtool_ops ethtool_ops; +static const struct net_device_ops smc_netdev_ops = { + .ndo_open = smc_open, + .ndo_stop = smc_close, + .ndo_start_xmit = smc_start_xmit, + .ndo_tx_timeout = smc_tx_timeout, + .ndo_set_config = s9k_config, + .ndo_set_multicast_list = set_rx_mode, + .ndo_do_ioctl = &smc_ioctl, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; + /*====================================================================== smc91c92_attach() creates an "instance" of the driver, allocating @@ -336,18 +348,9 @@ static int smc91c92_probe(struct pcmcia_device *link) link->conf.IntType = INT_MEMORY_AND_IO; /* The SMC91c92-specific entries in the device structure. */ - dev->hard_start_xmit = &smc_start_xmit; - dev->get_stats = &smc_get_stats; - dev->set_config = &s9k_config; - dev->set_multicast_list = &set_rx_mode; - dev->open = &smc_open; - dev->stop = &smc_close; - dev->do_ioctl = &smc_ioctl; + dev->netdev_ops = &smc_netdev_ops; SET_ETHTOOL_OPS(dev, ðtool_ops); -#ifdef HAVE_TX_TIMEOUT - dev->tx_timeout = smc_tx_timeout; dev->watchdog_timeo = TX_TIMEOUT; -#endif smc->mii_if.dev = dev; smc->mii_if.mdio_read = mdio_read; @@ -1291,7 +1294,7 @@ static void smc_hardware_send_packet(struct net_device * dev) return; } - smc->stats.tx_bytes += skb->len; + dev->stats.tx_bytes += skb->len; /* The card should use the just-allocated buffer. */ outw(packet_no, ioaddr + PNR_ARR); /* point to the beginning of the packet */ @@ -1340,7 +1343,7 @@ static void smc_tx_timeout(struct net_device *dev) printk(KERN_NOTICE "%s: SMC91c92 transmit timed out, " "Tx_status %2.2x status %4.4x.\n", dev->name, inw(ioaddr)&0xff, inw(ioaddr + 2)); - smc->stats.tx_errors++; + dev->stats.tx_errors++; smc_reset(dev); dev->trans_start = jiffies; smc->saved_skb = NULL; @@ -1362,7 +1365,7 @@ static int smc_start_xmit(struct sk_buff *skb, struct net_device *dev) if (smc->saved_skb) { /* THIS SHOULD NEVER HAPPEN. */ - smc->stats.tx_aborted_errors++; + dev->stats.tx_aborted_errors++; printk(KERN_DEBUG "%s: Internal error -- sent packet while busy.\n", dev->name); return 1; @@ -1375,7 +1378,7 @@ static int smc_start_xmit(struct sk_buff *skb, struct net_device *dev) printk(KERN_ERR "%s: Far too big packet error.\n", dev->name); dev_kfree_skb (skb); smc->saved_skb = NULL; - smc->stats.tx_dropped++; + dev->stats.tx_dropped++; return 0; /* Do not re-queue this packet. */ } /* A packet is now waiting. */ @@ -1433,11 +1436,11 @@ static void smc_tx_err(struct net_device * dev) tx_status = inw(ioaddr + DATA_1); - smc->stats.tx_errors++; - if (tx_status & TS_LOSTCAR) smc->stats.tx_carrier_errors++; - if (tx_status & TS_LATCOL) smc->stats.tx_window_errors++; + dev->stats.tx_errors++; + if (tx_status & TS_LOSTCAR) dev->stats.tx_carrier_errors++; + if (tx_status & TS_LATCOL) dev->stats.tx_window_errors++; if (tx_status & TS_16COL) { - smc->stats.tx_aborted_errors++; + dev->stats.tx_aborted_errors++; smc->tx_err++; } @@ -1474,10 +1477,10 @@ static void smc_eph_irq(struct net_device *dev) /* Could be a counter roll-over warning: update stats. */ card_stats = inw(ioaddr + COUNTER); /* single collisions */ - smc->stats.collisions += card_stats & 0xF; + dev->stats.collisions += card_stats & 0xF; card_stats >>= 4; /* multiple collisions */ - smc->stats.collisions += card_stats & 0xF; + dev->stats.collisions += card_stats & 0xF; #if 0 /* These are for when linux supports these statistics */ card_stats >>= 4; /* deferred */ card_stats >>= 4; /* excess deferred */ @@ -1551,7 +1554,7 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id) if (status & IM_TX_EMPTY_INT) { outw(IM_TX_EMPTY_INT, ioaddr + INTERRUPT); mask &= ~IM_TX_EMPTY_INT; - smc->stats.tx_packets += smc->packets_waiting; + dev->stats.tx_packets += smc->packets_waiting; smc->packets_waiting = 0; } if (status & IM_ALLOC_INT) { @@ -1567,8 +1570,8 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id) netif_wake_queue(dev); } if (status & IM_RX_OVRN_INT) { - smc->stats.rx_errors++; - smc->stats.rx_fifo_errors++; + dev->stats.rx_errors++; + dev->stats.rx_fifo_errors++; if (smc->duplex) smc->rx_ovrn = 1; /* need MC_RESET outside smc_interrupt */ outw(IM_RX_OVRN_INT, ioaddr + INTERRUPT); @@ -1618,7 +1621,6 @@ irq_done: static void smc_rx(struct net_device *dev) { - struct smc_private *smc = netdev_priv(dev); unsigned int ioaddr = dev->base_addr; int rx_status; int packet_length; /* Caution: not frame length, rather words @@ -1649,7 +1651,7 @@ static void smc_rx(struct net_device *dev) if (skb == NULL) { DEBUG(1, "%s: Low memory, packet dropped.\n", dev->name); - smc->stats.rx_dropped++; + dev->stats.rx_dropped++; outw(MC_RELEASE, ioaddr + MMU_CMD); return; } @@ -1662,18 +1664,18 @@ static void smc_rx(struct net_device *dev) netif_rx(skb); dev->last_rx = jiffies; - smc->stats.rx_packets++; - smc->stats.rx_bytes += packet_length; + dev->stats.rx_packets++; + dev->stats.rx_bytes += packet_length; if (rx_status & RS_MULTICAST) - smc->stats.multicast++; + dev->stats.multicast++; } else { /* error ... */ - smc->stats.rx_errors++; + dev->stats.rx_errors++; - if (rx_status & RS_ALGNERR) smc->stats.rx_frame_errors++; + if (rx_status & RS_ALGNERR) dev->stats.rx_frame_errors++; if (rx_status & (RS_TOOSHORT | RS_TOOLONG)) - smc->stats.rx_length_errors++; - if (rx_status & RS_BADCRC) smc->stats.rx_crc_errors++; + dev->stats.rx_length_errors++; + if (rx_status & RS_BADCRC) dev->stats.rx_crc_errors++; } /* Let the MMU free the memory of this packet. */ outw(MC_RELEASE, ioaddr + MMU_CMD); @@ -1681,15 +1683,6 @@ static void smc_rx(struct net_device *dev) return; } -/*====================================================================*/ - -static struct net_device_stats *smc_get_stats(struct net_device *dev) -{ - struct smc_private *smc = netdev_priv(dev); - /* Nothing to update - the 91c92 is a pretty primative chip. */ - return &smc->stats; -} - /*====================================================================== Calculate values for the hardware multicast filter hash table. diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index fef7e1861d6..a3685c0d22f 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c @@ -335,7 +335,7 @@ typedef struct local_info_t { struct net_device *dev; struct pcmcia_device *p_dev; dev_node_t node; - struct net_device_stats stats; + int card_type; int probe_port; int silicon; /* silicon revision. 0=old CE2, 1=Scipper, 4=Mohawk */ @@ -355,7 +355,6 @@ typedef struct local_info_t { static int do_start_xmit(struct sk_buff *skb, struct net_device *dev); static void xirc_tx_timeout(struct net_device *dev); static void xirc2ps_tx_timeout_task(struct work_struct *work); -static struct net_device_stats *do_get_stats(struct net_device *dev); static void set_addresses(struct net_device *dev); static void set_multicast_list(struct net_device *dev); static int set_card_type(struct pcmcia_device *link, const void *s); @@ -546,6 +545,19 @@ mii_wr(unsigned int ioaddr, u_char phyaddr, u_char phyreg, unsigned data, /*============= Main bulk of functions =========================*/ +static const struct net_device_ops netdev_ops = { + .ndo_open = do_open, + .ndo_stop = do_stop, + .ndo_start_xmit = do_start_xmit, + .ndo_tx_timeout = xirc_tx_timeout, + .ndo_set_config = do_config, + .ndo_do_ioctl = do_ioctl, + .ndo_set_multicast_list = set_multicast_list, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; + /**************** * xirc2ps_attach() creates an "instance" of the driver, allocating * local data structures for one device. The device is registered @@ -581,19 +593,10 @@ xirc2ps_probe(struct pcmcia_device *link) link->irq.Instance = dev; /* Fill in card specific entries */ - dev->hard_start_xmit = &do_start_xmit; - dev->set_config = &do_config; - dev->get_stats = &do_get_stats; - dev->do_ioctl = &do_ioctl; - SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); - dev->set_multicast_list = &set_multicast_list; - dev->open = &do_open; - dev->stop = &do_stop; -#ifdef HAVE_TX_TIMEOUT - dev->tx_timeout = xirc_tx_timeout; + dev->netdev_ops = &netdev_ops; + dev->ethtool_ops = &netdev_ethtool_ops; dev->watchdog_timeo = TX_TIMEOUT; INIT_WORK(&local->tx_timeout_task, xirc2ps_tx_timeout_task); -#endif return xirc2ps_config(link); } /* xirc2ps_attach */ @@ -1172,7 +1175,7 @@ xirc2ps_interrupt(int irq, void *dev_id) if (bytes_rcvd > maxrx_bytes && (rsr & PktRxOk)) { /* too many bytes received during this int, drop the rest of the * packets */ - lp->stats.rx_dropped++; + dev->stats.rx_dropped++; DEBUG(2, "%s: RX drop, too much done\n", dev->name); } else if (rsr & PktRxOk) { struct sk_buff *skb; @@ -1186,7 +1189,7 @@ xirc2ps_interrupt(int irq, void *dev_id) if (!skb) { printk(KNOT_XIRC "low memory, packet dropped (size=%u)\n", pktlen); - lp->stats.rx_dropped++; + dev->stats.rx_dropped++; } else { /* okay get the packet */ skb_reserve(skb, 2); if (lp->silicon == 0 ) { /* work around a hardware bug */ @@ -1242,24 +1245,24 @@ xirc2ps_interrupt(int irq, void *dev_id) } skb->protocol = eth_type_trans(skb, dev); netif_rx(skb); - lp->stats.rx_packets++; - lp->stats.rx_bytes += pktlen; + dev->stats.rx_packets++; + dev->stats.rx_bytes += pktlen; if (!(rsr & PhyPkt)) - lp->stats.multicast++; + dev->stats.multicast++; } } else { /* bad packet */ DEBUG(5, "rsr=%#02x\n", rsr); } if (rsr & PktTooLong) { - lp->stats.rx_frame_errors++; + dev->stats.rx_frame_errors++; DEBUG(3, "%s: Packet too long\n", dev->name); } if (rsr & CRCErr) { - lp->stats.rx_crc_errors++; + dev->stats.rx_crc_errors++; DEBUG(3, "%s: CRC error\n", dev->name); } if (rsr & AlignErr) { - lp->stats.rx_fifo_errors++; /* okay ? */ + dev->stats.rx_fifo_errors++; /* okay ? */ DEBUG(3, "%s: Alignment error\n", dev->name); } @@ -1270,7 +1273,7 @@ xirc2ps_interrupt(int irq, void *dev_id) eth_status = GetByte(XIRCREG_ESR); } if (rx_status & 0x10) { /* Receive overrun */ - lp->stats.rx_over_errors++; + dev->stats.rx_over_errors++; PutByte(XIRCREG_CR, ClearRxOvrun); DEBUG(3, "receive overrun cleared\n"); } @@ -1283,11 +1286,11 @@ xirc2ps_interrupt(int irq, void *dev_id) nn = GetByte(XIRCREG0_PTR); lp->last_ptr_value = nn; if (nn < n) /* rollover */ - lp->stats.tx_packets += 256 - n; + dev->stats.tx_packets += 256 - n; else if (n == nn) { /* happens sometimes - don't know why */ DEBUG(0, "PTR not changed?\n"); } else - lp->stats.tx_packets += lp->last_ptr_value - n; + dev->stats.tx_packets += lp->last_ptr_value - n; netif_wake_queue(dev); } if (tx_status & 0x0002) { /* Execessive collissions */ @@ -1295,7 +1298,7 @@ xirc2ps_interrupt(int irq, void *dev_id) PutByte(XIRCREG_CR, RestartTx); /* restart transmitter process */ } if (tx_status & 0x0040) - lp->stats.tx_aborted_errors++; + dev->stats.tx_aborted_errors++; /* recalculate our work chunk so that we limit the duration of this * ISR to about 1/10 of a second. @@ -1353,7 +1356,7 @@ static void xirc_tx_timeout(struct net_device *dev) { local_info_t *lp = netdev_priv(dev); - lp->stats.tx_errors++; + dev->stats.tx_errors++; printk(KERN_NOTICE "%s: transmit timed out\n", dev->name); schedule_work(&lp->tx_timeout_task); } @@ -1409,20 +1412,11 @@ do_start_xmit(struct sk_buff *skb, struct net_device *dev) dev_kfree_skb (skb); dev->trans_start = jiffies; - lp->stats.tx_bytes += pktlen; + dev->stats.tx_bytes += pktlen; netif_start_queue(dev); return 0; } -static struct net_device_stats * -do_get_stats(struct net_device *dev) -{ - local_info_t *lp = netdev_priv(dev); - - /* lp->stats.rx_missed_errors = GetByte(?) */ - return &lp->stats; -} - /**************** * Set all addresses: This first one is the individual address, * the next 9 addresses are taken from the multicast list and |