netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@linux-foundation.org>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [patch 26/30] netdev: convert ni65 to net_device_ops
Date: Thu, 26 Mar 2009 18:11:40 -0700	[thread overview]
Message-ID: <20090327011256.830948135@linux-foundation.org> (raw)
In-Reply-To: 20090327011114.169107105@linux-foundation.org

[-- Attachment #1: ni65.patch --]
[-- Type: text/plain, Size: 5595 bytes --]

Also, use internal net_device_stats.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/ni65.c	2009-03-26 17:03:44.248604988 -0700
+++ b/drivers/net/ni65.c	2009-03-26 17:16:16.734599577 -0700
@@ -237,7 +237,7 @@ struct priv
 	void *tmdbounce[TMDNUM];
 	int tmdbouncenum;
 	int lock,xmit_queued;
-	struct net_device_stats stats;
+
 	void *self;
 	int cmdr_addr;
 	int cardno;
@@ -257,7 +257,6 @@ static void  ni65_timeout(struct net_dev
 static int  ni65_close(struct net_device *dev);
 static int  ni65_alloc_buffer(struct net_device *dev);
 static void ni65_free_buffer(struct priv *p);
-static struct net_device_stats *ni65_get_stats(struct net_device *);
 static void set_multicast_list(struct net_device *dev);
 
 static int irqtab[] __initdata = { 9,12,15,5 }; /* irq config-translate */
@@ -401,6 +400,17 @@ out:
 	return ERR_PTR(err);
 }
 
+static const struct net_device_ops ni65_netdev_ops = {
+	.ndo_open		= ni65_open,
+	.ndo_stop		= ni65_close,
+	.ndo_start_xmit		= ni65_send_packet,
+	.ndo_tx_timeout		= ni65_timeout,
+	.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,
+};
+
 /*
  * this is the real card probe ..
  */
@@ -549,13 +559,9 @@ static int __init ni65_probe1(struct net
 	}
 
 	dev->base_addr = ioaddr;
-	dev->open		= ni65_open;
-	dev->stop		= ni65_close;
-	dev->hard_start_xmit	= ni65_send_packet;
-	dev->tx_timeout		= ni65_timeout;
+	dev->netdev_ops = &ni65_netdev_ops;
 	dev->watchdog_timeo	= HZ/2;
-	dev->get_stats		= ni65_get_stats;
-	dev->set_multicast_list = set_multicast_list;
+
 	return 0; /* everything is OK */
 }
 
@@ -901,13 +907,13 @@ static irqreturn_t ni65_interrupt(int ir
 			if(debuglevel > 1)
 				printk(KERN_ERR "%s: general error: %04x.\n",dev->name,csr0);
 			if(csr0 & CSR0_BABL)
-				p->stats.tx_errors++;
+				dev->stats.tx_errors++;
 			if(csr0 & CSR0_MISS) {
 				int i;
 				for(i=0;i<RMDNUM;i++)
 					printk("%02x ",p->rmdhead[i].u.s.status);
 				printk("\n");
-				p->stats.rx_errors++;
+				dev->stats.rx_errors++;
 			}
 			if(csr0 & CSR0_MERR) {
 				if(debuglevel > 1)
@@ -997,12 +1003,12 @@ static void ni65_xmit_intr(struct net_de
 #endif
 		 /* checking some errors */
 			if(tmdp->status2 & XMIT_RTRY)
-				p->stats.tx_aborted_errors++;
+				dev->stats.tx_aborted_errors++;
 			if(tmdp->status2 & XMIT_LCAR)
-				p->stats.tx_carrier_errors++;
+				dev->stats.tx_carrier_errors++;
 			if(tmdp->status2 & (XMIT_BUFF | XMIT_UFLO )) {
 		/* this stops the xmitter */
-				p->stats.tx_fifo_errors++;
+				dev->stats.tx_fifo_errors++;
 				if(debuglevel > 0)
 					printk(KERN_ERR "%s: Xmit FIFO/BUFF error\n",dev->name);
 				if(p->features & INIT_RING_BEFORE_START) {
@@ -1016,12 +1022,12 @@ static void ni65_xmit_intr(struct net_de
 			if(debuglevel > 2)
 				printk(KERN_ERR "%s: xmit-error: %04x %02x-%04x\n",dev->name,csr0,(int) tmdstat,(int) tmdp->status2);
 			if(!(csr0 & CSR0_BABL)) /* don't count errors twice */
-				p->stats.tx_errors++;
+				dev->stats.tx_errors++;
 			tmdp->status2 = 0;
 		}
 		else {
-			p->stats.tx_bytes -= (short)(tmdp->blen);
-			p->stats.tx_packets++;
+			dev->stats.tx_bytes -= (short)(tmdp->blen);
+			dev->stats.tx_packets++;
 		}
 
 #ifdef XMT_VIA_SKB
@@ -1057,7 +1063,7 @@ static void ni65_recv_intr(struct net_de
 			if(!(rmdstat & RCV_ERR)) {
 				if(rmdstat & RCV_START)
 				{
-					p->stats.rx_length_errors++;
+					dev->stats.rx_length_errors++;
 					printk(KERN_ERR "%s: recv, packet too long: %d\n",dev->name,rmdp->mlen & 0x0fff);
 				}
 			}
@@ -1066,16 +1072,16 @@ static void ni65_recv_intr(struct net_de
 					printk(KERN_ERR "%s: receive-error: %04x, lance-status: %04x/%04x\n",
 									dev->name,(int) rmdstat,csr0,(int) inw(PORT+L_DATAREG) );
 				if(rmdstat & RCV_FRAM)
-					p->stats.rx_frame_errors++;
+					dev->stats.rx_frame_errors++;
 				if(rmdstat & RCV_OFLO)
-					p->stats.rx_over_errors++;
+					dev->stats.rx_over_errors++;
 				if(rmdstat & RCV_CRC)
-					p->stats.rx_crc_errors++;
+					dev->stats.rx_crc_errors++;
 				if(rmdstat & RCV_BUF_ERR)
-					p->stats.rx_fifo_errors++;
+					dev->stats.rx_fifo_errors++;
 			}
 			if(!(csr0 & CSR0_MISS)) /* don't count errors twice */
-				p->stats.rx_errors++;
+				dev->stats.rx_errors++;
 		}
 		else if( (len = (rmdp->mlen & 0x0fff) - 4) >= 60)
 		{
@@ -1106,20 +1112,20 @@ static void ni65_recv_intr(struct net_de
 				skb_put(skb,len);
 				skb_copy_to_linear_data(skb, (unsigned char *) p->recvbounce[p->rmdnum],len);
 #endif
-				p->stats.rx_packets++;
-				p->stats.rx_bytes += len;
+				dev->stats.rx_packets++;
+				dev->stats.rx_bytes += len;
 				skb->protocol=eth_type_trans(skb,dev);
 				netif_rx(skb);
 			}
 			else
 			{
 				printk(KERN_ERR "%s: can't alloc new sk_buff\n",dev->name);
-				p->stats.rx_dropped++;
+				dev->stats.rx_dropped++;
 			}
 		}
 		else {
 			printk(KERN_INFO "%s: received runt packet\n",dev->name);
-			p->stats.rx_errors++;
+			dev->stats.rx_errors++;
 		}
 		rmdp->blen = -(R_BUF_SIZE-8);
 		rmdp->mlen = 0;
@@ -1213,23 +1219,6 @@ static int ni65_send_packet(struct sk_bu
 	return 0;
 }
 
-static struct net_device_stats *ni65_get_stats(struct net_device *dev)
-{
-
-#if 0
-	int i;
-	struct priv *p = dev->ml_priv;
-	for(i=0;i<RMDNUM;i++)
-	{
-		struct rmd *rmdp = p->rmdhead + ((p->rmdnum + i) & (RMDNUM-1));
-		printk("%02x ",rmdp->u.s.status);
-	}
-	printk("\n");
-#endif
-
-	return &((struct priv *)dev->ml_priv)->stats;
-}
-
 static void set_multicast_list(struct net_device *dev)
 {
 	if(!ni65_lance_reinit(dev))



  parent reply	other threads:[~2009-03-27  1:35 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-27  1:11 [patch 00/30] last of the x86 net_device_ops Stephen Hemminger
2009-03-27  1:11 ` [patch 01/30] 3c503, smc-ultra: netdev_ops bugs Stephen Hemminger
2009-03-27  7:50   ` David Miller
2009-03-27  1:11 ` [patch 02/30] uml: convert network device to internal network device stats Stephen Hemminger
2009-03-27  7:50   ` David Miller
2009-03-27  1:11 ` [patch 03/30] uml: convert network device to netdevice ops Stephen Hemminger
2009-03-27  7:50   ` David Miller
2009-03-27  1:11 ` [patch 04/30] appletalk: convert cops to internal net_device_stats Stephen Hemminger
2009-03-27  7:50   ` David Miller
2009-03-27  1:11 ` [patch 05/30] To: acme@ghostprotocols.net Subjetct: appltetalk: convert cops device to net_device ops Stephen Hemminger
2009-03-27  7:50   ` [patch 05/30] " David Miller
2009-03-27  1:11 ` [patch 06/30] appletalk: convert LTPC to use internal net_device_stats Stephen Hemminger
2009-03-27  7:50   ` David Miller
2009-03-27  1:11 ` [patch 07/30] appletalk: convert LTPC to net_device_ops Stephen Hemminger
2009-03-27  7:50   ` David Miller
2009-03-27  1:11 ` [patch 08/30] IRDA: convert donauboe " Stephen Hemminger
2009-03-27  7:50   ` David Miller
2009-03-27  1:11 ` [patch 09/30] tokenring: convert drivers " Stephen Hemminger
2009-03-27  7:50   ` David Miller
2009-03-27  1:11 ` [patch 10/30] tokenring: convert smctr " Stephen Hemminger
2009-03-27  7:50   ` David Miller
2009-03-27  1:11 ` [patch 11/30] wan: convert sdla driver " Stephen Hemminger
2009-03-27  7:50   ` David Miller
2009-03-27  1:11 ` [patch 12/30] wireless: convert arlan " Stephen Hemminger
2009-03-27  7:51   ` David Miller
2009-03-27  1:11 ` [patch 13/30] wireless: convert wavelan " Stephen Hemminger
     [not found]   ` <20090327011255.886835267-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2009-03-27  7:51     ` David Miller
2009-03-27  1:11 ` [patch 14/30] netdev: seeq8005 convert " Stephen Hemminger
2009-03-27  7:51   ` David Miller
2009-03-27  1:11 ` [patch 15/30] netdev: smc9194 " Stephen Hemminger
2009-03-27  7:51   ` David Miller
2009-03-27  1:11 ` [patch 16/30] netdev: smc-ultra32 " Stephen Hemminger
2009-03-27  7:51   ` David Miller
2009-03-27  1:11 ` [patch 17/30] netdev: smc-ultra fix netpoll Stephen Hemminger
2009-03-27  7:51   ` David Miller
2009-03-27  1:11 ` [patch 18/30] lance: convert to net_device_ops Stephen Hemminger
2009-03-27  7:51   ` David Miller
2009-03-27  1:11 ` [patch 19/30] netdev: ibmlana " Stephen Hemminger
2009-03-27  7:51   ` David Miller
2009-03-27  1:11 ` [patch 20/30] netdev: convert eexpress " Stephen Hemminger
2009-03-27  7:51   ` David Miller
2009-03-27  1:11 ` [patch 21/30] netdev: convert eexpro " Stephen Hemminger
2009-03-27  7:51   ` David Miller
2009-03-27  1:11 ` [patch 22/30] netdev: convert at1700 " Stephen Hemminger
2009-03-27  7:51   ` David Miller
2009-03-27  7:52   ` David Miller
2009-03-27  1:11 ` [patch 23/30] netdev: convert depca " Stephen Hemminger
2009-03-27  7:52   ` David Miller
2009-03-27  1:11 ` [patch 24/30] netdev: convert ewrk3 " Stephen Hemminger
2009-03-27  7:52   ` David Miller
2009-03-27  1:11 ` [patch 25/30] netdev: convert ni52 " Stephen Hemminger
2009-03-27  7:52   ` David Miller
2009-03-27  1:11 ` Stephen Hemminger [this message]
2009-03-27  7:52   ` [patch 26/30] netdev: convert ni65 " David Miller
2009-03-27  1:11 ` [patch 27/30] netdev: convert ac3200 " Stephen Hemminger
2009-03-27  7:52   ` David Miller
2009-03-27  7:52   ` David Miller
2009-03-27  1:11 ` [patch 28/30] netdev: convert lp486e " Stephen Hemminger
2009-03-27  7:52   ` David Miller
2009-03-27  1:11 ` [patch 29/30] netdev: convert cs89x0 " Stephen Hemminger
2009-03-27  7:52   ` David Miller
2009-03-27  1:11 ` [patch 30/30] netdev: convert eth16i " Stephen Hemminger
2009-03-27  7:52   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090327011256.830948135@linux-foundation.org \
    --to=shemminger@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).