summaryrefslogtreecommitdiff
path: root/drivers/net/pcmcia/xirc2ps_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/pcmcia/xirc2ps_cs.c')
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c66
1 files changed, 30 insertions, 36 deletions
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index fef7e18..a3685c0 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