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

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

irda: convert to internal stats



Convert IRDA drivers to use already existing net_device_stats structure
in network device. This is a pre-cursor to conversion to net_device
ops. Compile tested only.

Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 46377bb3
Loading
Loading
Loading
Loading
+16 −29
Original line number Original line Diff line number Diff line
@@ -109,7 +109,6 @@ static int ali_ircc_net_open(struct net_device *dev);
static int  ali_ircc_net_close(struct net_device *dev);
static int  ali_ircc_net_close(struct net_device *dev);
static int  ali_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static int  ali_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static void ali_ircc_change_speed(struct ali_ircc_cb *self, __u32 baud);
static void ali_ircc_change_speed(struct ali_ircc_cb *self, __u32 baud);
static struct net_device_stats *ali_ircc_net_get_stats(struct net_device *dev);


/* SIR function */
/* SIR function */
static int  ali_ircc_sir_hard_xmit(struct sk_buff *skb, struct net_device *dev);
static int  ali_ircc_sir_hard_xmit(struct sk_buff *skb, struct net_device *dev);
@@ -366,7 +365,6 @@ static int ali_ircc_open(int i, chipio_t *info)
	dev->open            = ali_ircc_net_open;
	dev->open            = ali_ircc_net_open;
	dev->stop            = ali_ircc_net_close;
	dev->stop            = ali_ircc_net_close;
	dev->do_ioctl        = ali_ircc_net_ioctl;
	dev->do_ioctl        = ali_ircc_net_ioctl;
	dev->get_stats	     = ali_ircc_net_get_stats;


	err = register_netdev(dev);
	err = register_netdev(dev);
	if (err) {
	if (err) {
@@ -876,7 +874,7 @@ static void ali_ircc_sir_receive(struct ali_ircc_cb *self)
         * async_unwrap_char will deliver all found frames  
         * async_unwrap_char will deliver all found frames  
	 */
	 */
	do {
	do {
		async_unwrap_char(self->netdev, &self->stats, &self->rx_buff, 
		async_unwrap_char(self->netdev, &self->netdev->stats, &self->rx_buff,
				  inb(iobase+UART_RX));
				  inb(iobase+UART_RX));


		/* Make sure we don't stay here too long */
		/* Make sure we don't stay here too long */
@@ -943,7 +941,7 @@ static void ali_ircc_sir_write_wakeup(struct ali_ircc_cb *self)
			netif_wake_queue(self->netdev);	
			netif_wake_queue(self->netdev);	
		}
		}
			
			
		self->stats.tx_packets++;
		self->netdev->stats.tx_packets++;
		
		
		/* Turn on receive interrupts */
		/* Turn on receive interrupts */
		outb(UART_IER_RDI, iobase+UART_IER);
		outb(UART_IER_RDI, iobase+UART_IER);
@@ -1467,7 +1465,7 @@ static int ali_ircc_fir_hard_xmit(struct sk_buff *skb, struct net_device *dev)
	self->tx_fifo.queue[self->tx_fifo.free].len = skb->len;
	self->tx_fifo.queue[self->tx_fifo.free].len = skb->len;
	self->tx_fifo.tail += skb->len;
	self->tx_fifo.tail += skb->len;


	self->stats.tx_bytes += skb->len;
	dev->stats.tx_bytes += skb->len;


	skb_copy_from_linear_data(skb, self->tx_fifo.queue[self->tx_fifo.free].start,
	skb_copy_from_linear_data(skb, self->tx_fifo.queue[self->tx_fifo.free].start,
		      skb->len);
		      skb->len);
@@ -1661,12 +1659,12 @@ static int ali_ircc_dma_xmit_complete(struct ali_ircc_cb *self)
	
	
	{
	{
		IRDA_ERROR("%s(), ********* LSR_FRAME_ABORT *********\n", __func__);
		IRDA_ERROR("%s(), ********* LSR_FRAME_ABORT *********\n", __func__);
		self->stats.tx_errors++;
		self->netdev->stats.tx_errors++;
		self->stats.tx_fifo_errors++;		
		self->netdev->stats.tx_fifo_errors++;
	}
	}
	else 
	else 
	{
	{
		self->stats.tx_packets++;
		self->netdev->stats.tx_packets++;
	}
	}


	/* Check if we need to change the speed */
	/* Check if we need to change the speed */
@@ -1831,35 +1829,35 @@ static int ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
			IRDA_DEBUG(0,"%s(), ************* RX Errors ************ \n", __func__ );
			IRDA_DEBUG(0,"%s(), ************* RX Errors ************ \n", __func__ );
			
			
			/* Skip frame */
			/* Skip frame */
			self->stats.rx_errors++;
			self->netdev->stats.rx_errors++;
			
			
			self->rx_buff.data += len;
			self->rx_buff.data += len;
			
			
			if (status & LSR_FIFO_UR) 
			if (status & LSR_FIFO_UR) 
			{
			{
				self->stats.rx_frame_errors++;
				self->netdev->stats.rx_frame_errors++;
				IRDA_DEBUG(0,"%s(), ************* FIFO Errors ************ \n", __func__ );
				IRDA_DEBUG(0,"%s(), ************* FIFO Errors ************ \n", __func__ );
			}	
			}	
			if (status & LSR_FRAME_ERROR)
			if (status & LSR_FRAME_ERROR)
			{
			{
				self->stats.rx_frame_errors++;
				self->netdev->stats.rx_frame_errors++;
				IRDA_DEBUG(0,"%s(), ************* FRAME Errors ************ \n", __func__ );
				IRDA_DEBUG(0,"%s(), ************* FRAME Errors ************ \n", __func__ );
			}
			}
							
							
			if (status & LSR_CRC_ERROR) 
			if (status & LSR_CRC_ERROR) 
			{
			{
				self->stats.rx_crc_errors++;
				self->netdev->stats.rx_crc_errors++;
				IRDA_DEBUG(0,"%s(), ************* CRC Errors ************ \n", __func__ );
				IRDA_DEBUG(0,"%s(), ************* CRC Errors ************ \n", __func__ );
			}
			}
			
			
			if(self->rcvFramesOverflow)
			if(self->rcvFramesOverflow)
			{
			{
				self->stats.rx_frame_errors++;
				self->netdev->stats.rx_frame_errors++;
				IRDA_DEBUG(0,"%s(), ************* Overran DMA buffer ************ \n", __func__ );
				IRDA_DEBUG(0,"%s(), ************* Overran DMA buffer ************ \n", __func__ );
			}
			}
			if(len == 0)
			if(len == 0)
			{
			{
				self->stats.rx_frame_errors++;
				self->netdev->stats.rx_frame_errors++;
				IRDA_DEBUG(0,"%s(), ********** Receive Frame Size = 0 ********* \n", __func__ );
				IRDA_DEBUG(0,"%s(), ********** Receive Frame Size = 0 ********* \n", __func__ );
			}
			}
		}	 
		}	 
@@ -1910,7 +1908,7 @@ static int ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
				IRDA_WARNING("%s(), memory squeeze, "
				IRDA_WARNING("%s(), memory squeeze, "
					     "dropping frame.\n",
					     "dropping frame.\n",
					     __func__);
					     __func__);
				self->stats.rx_dropped++;
				self->netdev->stats.rx_dropped++;


				return FALSE;
				return FALSE;
			}
			}
@@ -1924,8 +1922,8 @@ static int ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)


			/* Move to next frame */
			/* Move to next frame */
			self->rx_buff.data += len;
			self->rx_buff.data += len;
			self->stats.rx_bytes += len;
			self->netdev->stats.rx_bytes += len;
			self->stats.rx_packets++;
			self->netdev->stats.rx_packets++;


			skb->dev = self->netdev;
			skb->dev = self->netdev;
			skb_reset_mac_header(skb);
			skb_reset_mac_header(skb);
@@ -1994,7 +1992,7 @@ static int ali_ircc_sir_hard_xmit(struct sk_buff *skb, struct net_device *dev)
	self->tx_buff.len = async_wrap_skb(skb, self->tx_buff.data, 
	self->tx_buff.len = async_wrap_skb(skb, self->tx_buff.data, 
					   self->tx_buff.truesize);
					   self->tx_buff.truesize);
	
	
	self->stats.tx_bytes += self->tx_buff.len;
	self->netdev->stats.tx_bytes += self->tx_buff.len;


	/* Turn on transmit finished interrupt. Will fire immediately!  */
	/* Turn on transmit finished interrupt. Will fire immediately!  */
	outb(UART_IER_THRI, iobase+UART_IER); 
	outb(UART_IER_THRI, iobase+UART_IER); 
@@ -2111,17 +2109,6 @@ static int ali_ircc_is_receiving(struct ali_ircc_cb *self)
	return status;
	return status;
}
}


static struct net_device_stats *ali_ircc_net_get_stats(struct net_device *dev)
{
	struct ali_ircc_cb *self = netdev_priv(dev);
	
	IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__ );
		
	IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__ );
	
	return &self->stats;
}

static int ali_ircc_suspend(struct platform_device *dev, pm_message_t state)
static int ali_ircc_suspend(struct platform_device *dev, pm_message_t state)
{
{
	struct ali_ircc_cb *self = platform_get_drvdata(dev);
	struct ali_ircc_cb *self = platform_get_drvdata(dev);
+0 −1
Original line number Original line Diff line number Diff line
@@ -191,7 +191,6 @@ struct ali_ircc_cb {
	struct tx_fifo tx_fifo;    /* Info about frames to be transmitted */
	struct tx_fifo tx_fifo;    /* Info about frames to be transmitted */


	struct net_device *netdev;     /* Yes! we are some kind of netdevice */
	struct net_device *netdev;     /* Yes! we are some kind of netdevice */
	struct net_device_stats stats;
	
	
	struct irlap_cb *irlap;    /* The link layer we are binded to */
	struct irlap_cb *irlap;    /* The link layer we are binded to */
	struct qos_info qos;       /* QoS capabilities for this device */
	struct qos_info qos;       /* QoS capabilities for this device */
+0 −1
Original line number Original line Diff line number Diff line
@@ -107,7 +107,6 @@ struct au1k_private {
	iobuff_t rx_buff;
	iobuff_t rx_buff;


	struct net_device *netdev;
	struct net_device *netdev;
	struct net_device_stats stats;
	
	
	struct timeval stamp;
	struct timeval stamp;
	struct timeval now;
	struct timeval now;
+0 −9
Original line number Original line Diff line number Diff line
@@ -53,7 +53,6 @@ static int au1k_irda_hard_xmit(struct sk_buff *, struct net_device *);
static int au1k_irda_rx(struct net_device *);
static int au1k_irda_rx(struct net_device *);
static void au1k_irda_interrupt(int, void *);
static void au1k_irda_interrupt(int, void *);
static void au1k_tx_timeout(struct net_device *);
static void au1k_tx_timeout(struct net_device *);
static struct net_device_stats *au1k_irda_stats(struct net_device *);
static int au1k_irda_ioctl(struct net_device *, struct ifreq *, int);
static int au1k_irda_ioctl(struct net_device *, struct ifreq *, int);
static int au1k_irda_set_speed(struct net_device *dev, int speed);
static int au1k_irda_set_speed(struct net_device *dev, int speed);


@@ -213,7 +212,6 @@ static int au1k_irda_net_init(struct net_device *dev)
	dev->open = au1k_irda_start;
	dev->open = au1k_irda_start;
	dev->hard_start_xmit = au1k_irda_hard_xmit;
	dev->hard_start_xmit = au1k_irda_hard_xmit;
	dev->stop = au1k_irda_stop;
	dev->stop = au1k_irda_stop;
	dev->get_stats = au1k_irda_stats;
	dev->do_ioctl = au1k_irda_ioctl;
	dev->do_ioctl = au1k_irda_ioctl;
	dev->tx_timeout = au1k_tx_timeout;
	dev->tx_timeout = au1k_tx_timeout;


@@ -832,13 +830,6 @@ au1k_irda_ioctl(struct net_device *dev, struct ifreq *ifreq, int cmd)
	return ret;
	return ret;
}
}



static struct net_device_stats *au1k_irda_stats(struct net_device *dev)
{
	struct au1k_private *aup = netdev_priv(dev);
	return &aup->stats;
}

MODULE_AUTHOR("Pete Popov <ppopov@mvista.com>");
MODULE_AUTHOR("Pete Popov <ppopov@mvista.com>");
MODULE_DESCRIPTION("Au1000 IrDA Device Driver");
MODULE_DESCRIPTION("Au1000 IrDA Device Driver");


+0 −1
Original line number Original line Diff line number Diff line
@@ -308,7 +308,6 @@ struct OboeRing
struct toshoboe_cb
struct toshoboe_cb
{
{
  struct net_device *netdev;    /* Yes! we are some kind of netdevice */
  struct net_device *netdev;    /* Yes! we are some kind of netdevice */
  struct net_device_stats stats;
  struct tty_driver ttydev;
  struct tty_driver ttydev;


  struct irlap_cb *irlap;       /* The link layer we are binded to */
  struct irlap_cb *irlap;       /* The link layer we are binded to */
Loading