Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8bbce3f6 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller
Browse files

appletalk: convert cops to internal net_device_stats

parent 8bb95b39
Loading
Loading
Loading
Loading
+8 −20
Original line number Original line Diff line number Diff line
@@ -171,7 +171,6 @@ static unsigned int cops_debug = COPS_DEBUG;


struct cops_local
struct cops_local
{
{
        struct net_device_stats stats;
        int board;			/* Holds what board type is. */
        int board;			/* Holds what board type is. */
	int nodeid;			/* Set to 1 once have nodeid. */
	int nodeid;			/* Set to 1 once have nodeid. */
        unsigned char node_acquire;	/* Node ID when acquired. */
        unsigned char node_acquire;	/* Node ID when acquired. */
@@ -197,7 +196,6 @@ static int cops_send_packet (struct sk_buff *skb, struct net_device *dev);
static void set_multicast_list (struct net_device *dev);
static void set_multicast_list (struct net_device *dev);
static int  cops_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
static int  cops_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
static int  cops_close (struct net_device *dev);
static int  cops_close (struct net_device *dev);
static struct net_device_stats *cops_get_stats (struct net_device *dev);


static void cleanup_card(struct net_device *dev)
static void cleanup_card(struct net_device *dev)
{
{
@@ -337,7 +335,6 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr)
	dev->tx_timeout		= cops_timeout;
	dev->tx_timeout		= cops_timeout;
	dev->watchdog_timeo	= HZ * 2;
	dev->watchdog_timeo	= HZ * 2;


        dev->get_stats          = cops_get_stats;
	dev->open               = cops_open;
	dev->open               = cops_open;
        dev->stop               = cops_close;
        dev->stop               = cops_close;
        dev->do_ioctl           = cops_ioctl;
        dev->do_ioctl           = cops_ioctl;
@@ -797,7 +794,7 @@ static void cops_rx(struct net_device *dev)
        {
        {
                printk(KERN_WARNING "%s: Memory squeeze, dropping packet.\n",
                printk(KERN_WARNING "%s: Memory squeeze, dropping packet.\n",
			dev->name);
			dev->name);
                lp->stats.rx_dropped++;
                dev->stats.rx_dropped++;
                while(pkt_len--)        /* Discard packet */
                while(pkt_len--)        /* Discard packet */
                        inb(ioaddr);
                        inb(ioaddr);
                spin_unlock_irqrestore(&lp->lock, flags);
                spin_unlock_irqrestore(&lp->lock, flags);
@@ -819,7 +816,7 @@ static void cops_rx(struct net_device *dev)
        {
        {
		printk(KERN_WARNING "%s: Bad packet length of %d bytes.\n", 
		printk(KERN_WARNING "%s: Bad packet length of %d bytes.\n", 
			dev->name, pkt_len);
			dev->name, pkt_len);
                lp->stats.tx_errors++;
                dev->stats.tx_errors++;
                dev_kfree_skb_any(skb);
                dev_kfree_skb_any(skb);
                return;
                return;
        }
        }
@@ -836,7 +833,7 @@ static void cops_rx(struct net_device *dev)
        if(rsp_type != LAP_RESPONSE)
        if(rsp_type != LAP_RESPONSE)
        {
        {
                printk(KERN_WARNING "%s: Bad packet type %d.\n", dev->name, rsp_type);
                printk(KERN_WARNING "%s: Bad packet type %d.\n", dev->name, rsp_type);
                lp->stats.tx_errors++;
                dev->stats.tx_errors++;
                dev_kfree_skb_any(skb);
                dev_kfree_skb_any(skb);
                return;
                return;
        }
        }
@@ -846,8 +843,8 @@ static void cops_rx(struct net_device *dev)
        skb_reset_transport_header(skb);    /* Point to data (Skip header). */
        skb_reset_transport_header(skb);    /* Point to data (Skip header). */


        /* Update the counters. */
        /* Update the counters. */
        lp->stats.rx_packets++;
        dev->stats.rx_packets++;
        lp->stats.rx_bytes += skb->len;
        dev->stats.rx_bytes += skb->len;


        /* Send packet to a higher place. */
        /* Send packet to a higher place. */
        netif_rx(skb);
        netif_rx(skb);
@@ -858,7 +855,7 @@ static void cops_timeout(struct net_device *dev)
        struct cops_local *lp = netdev_priv(dev);
        struct cops_local *lp = netdev_priv(dev);
        int ioaddr = dev->base_addr;
        int ioaddr = dev->base_addr;


	lp->stats.tx_errors++;
	dev->stats.tx_errors++;
        if(lp->board==TANGENT)
        if(lp->board==TANGENT)
        {
        {
		if((inb(ioaddr+TANG_CARD_STATUS)&TANG_TX_READY)==0)
		if((inb(ioaddr+TANG_CARD_STATUS)&TANG_TX_READY)==0)
@@ -916,8 +913,8 @@ static int cops_send_packet(struct sk_buff *skb, struct net_device *dev)
	spin_unlock_irqrestore(&lp->lock, flags);	/* Restore interrupts. */
	spin_unlock_irqrestore(&lp->lock, flags);	/* Restore interrupts. */


	/* Done sending packet, update counters and cleanup. */
	/* Done sending packet, update counters and cleanup. */
	lp->stats.tx_packets++;
	dev->stats.tx_packets++;
	lp->stats.tx_bytes += skb->len;
	dev->stats.tx_bytes += skb->len;
	dev->trans_start = jiffies;
	dev->trans_start = jiffies;
	dev_kfree_skb (skb);
	dev_kfree_skb (skb);
        return 0;
        return 0;
@@ -986,15 +983,6 @@ static int cops_close(struct net_device *dev)
        return 0;
        return 0;
}
}


/*
 *      Get the current statistics.
 *      This may be called with the card open or closed.
 */
static struct net_device_stats *cops_get_stats(struct net_device *dev)
{
        struct cops_local *lp = netdev_priv(dev);
        return &lp->stats;
}


#ifdef MODULE
#ifdef MODULE
static struct net_device *cops_dev;
static struct net_device *cops_dev;