aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/appletalk/cops.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-03-27 21:35:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-03-27 21:35:03 -0400
commit5d80f8e5a9dc9c9a94d4aeaa567e219a808b8a4a (patch)
tree357258d77e2153ef7409926773655c5f8775a1f3 /drivers/net/appletalk/cops.c
parent7b616c8a2f5c8507b4aed6907336ec5b85803a39 (diff)
parent0870352bc6e0dee485c86a0c99dd60e7089c8917 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (166 commits) Revert "ax25: zero length frame filtering in AX25" Revert "netrom: zero length frame filtering in NetRom" cfg80211: default CONFIG_WIRELESS_OLD_REGULATORY to n mac80211/iwlwifi: move virtual A-MDPU queue bookkeeping to iwlwifi mac80211: fix aggregation to not require queue stop mac80211: add skb length sanity checking mac80211: unify and fix TX aggregation start mac80211: clean up __ieee80211_tx args mac80211: rework the pending packets code mac80211: fix A-MPDU queue assignment mac80211: rewrite fragmentation iwlwifi: show current driver status in user readable format b43: Add BCM4307 PCI-ID cfg80211: fix locking in nl80211_set_wiphy mac80211: fix RX path ath5k: properly drop packets from ops->tx ar9170: single module build ath9k: fix dma mapping leak of rx buffer upon rmmod rt2x00: New USB ID for rt73usb ath5k: warn and correct rate for unknown hw rate indexes ...
Diffstat (limited to 'drivers/net/appletalk/cops.c')
-rw-r--r--drivers/net/appletalk/cops.c45
1 files changed, 18 insertions, 27 deletions
diff --git a/drivers/net/appletalk/cops.c b/drivers/net/appletalk/cops.c
index 54819a34ba0a..7f8325419803 100644
--- a/drivers/net/appletalk/cops.c
+++ b/drivers/net/appletalk/cops.c
@@ -171,7 +171,6 @@ static unsigned int cops_debug = COPS_DEBUG;
171 171
172struct cops_local 172struct cops_local
173{ 173{
174 struct net_device_stats stats;
175 int board; /* Holds what board type is. */ 174 int board; /* Holds what board type is. */
176 int nodeid; /* Set to 1 once have nodeid. */ 175 int nodeid; /* Set to 1 once have nodeid. */
177 unsigned char node_acquire; /* Node ID when acquired. */ 176 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);
197static void set_multicast_list (struct net_device *dev); 196static void set_multicast_list (struct net_device *dev);
198static int cops_ioctl (struct net_device *dev, struct ifreq *rq, int cmd); 197static int cops_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
199static int cops_close (struct net_device *dev); 198static int cops_close (struct net_device *dev);
200static struct net_device_stats *cops_get_stats (struct net_device *dev);
201 199
202static void cleanup_card(struct net_device *dev) 200static void cleanup_card(struct net_device *dev)
203{ 201{
@@ -260,6 +258,15 @@ out:
260 return ERR_PTR(err); 258 return ERR_PTR(err);
261} 259}
262 260
261static const struct net_device_ops cops_netdev_ops = {
262 .ndo_open = cops_open,
263 .ndo_stop = cops_close,
264 .ndo_start_xmit = cops_send_packet,
265 .ndo_tx_timeout = cops_timeout,
266 .ndo_do_ioctl = cops_ioctl,
267 .ndo_set_multicast_list = set_multicast_list,
268};
269
263/* 270/*
264 * This is the real probe routine. Linux has a history of friendly device 271 * This is the real probe routine. Linux has a history of friendly device
265 * probes on the ISA bus. A good device probes avoids doing writes, and 272 * probes on the ISA bus. A good device probes avoids doing writes, and
@@ -333,16 +340,9 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr)
333 /* Copy local board variable to lp struct. */ 340 /* Copy local board variable to lp struct. */
334 lp->board = board; 341 lp->board = board;
335 342
336 dev->hard_start_xmit = cops_send_packet; 343 dev->netdev_ops = &cops_netdev_ops;
337 dev->tx_timeout = cops_timeout;
338 dev->watchdog_timeo = HZ * 2; 344 dev->watchdog_timeo = HZ * 2;
339 345
340 dev->get_stats = cops_get_stats;
341 dev->open = cops_open;
342 dev->stop = cops_close;
343 dev->do_ioctl = cops_ioctl;
344 dev->set_multicast_list = set_multicast_list;
345 dev->mc_list = NULL;
346 346
347 /* Tell the user where the card is and what mode we're in. */ 347 /* Tell the user where the card is and what mode we're in. */
348 if(board==DAYNA) 348 if(board==DAYNA)
@@ -797,7 +797,7 @@ static void cops_rx(struct net_device *dev)
797 { 797 {
798 printk(KERN_WARNING "%s: Memory squeeze, dropping packet.\n", 798 printk(KERN_WARNING "%s: Memory squeeze, dropping packet.\n",
799 dev->name); 799 dev->name);
800 lp->stats.rx_dropped++; 800 dev->stats.rx_dropped++;
801 while(pkt_len--) /* Discard packet */ 801 while(pkt_len--) /* Discard packet */
802 inb(ioaddr); 802 inb(ioaddr);
803 spin_unlock_irqrestore(&lp->lock, flags); 803 spin_unlock_irqrestore(&lp->lock, flags);
@@ -819,7 +819,7 @@ static void cops_rx(struct net_device *dev)
819 { 819 {
820 printk(KERN_WARNING "%s: Bad packet length of %d bytes.\n", 820 printk(KERN_WARNING "%s: Bad packet length of %d bytes.\n",
821 dev->name, pkt_len); 821 dev->name, pkt_len);
822 lp->stats.tx_errors++; 822 dev->stats.tx_errors++;
823 dev_kfree_skb_any(skb); 823 dev_kfree_skb_any(skb);
824 return; 824 return;
825 } 825 }
@@ -836,7 +836,7 @@ static void cops_rx(struct net_device *dev)
836 if(rsp_type != LAP_RESPONSE) 836 if(rsp_type != LAP_RESPONSE)
837 { 837 {
838 printk(KERN_WARNING "%s: Bad packet type %d.\n", dev->name, rsp_type); 838 printk(KERN_WARNING "%s: Bad packet type %d.\n", dev->name, rsp_type);
839 lp->stats.tx_errors++; 839 dev->stats.tx_errors++;
840 dev_kfree_skb_any(skb); 840 dev_kfree_skb_any(skb);
841 return; 841 return;
842 } 842 }
@@ -846,8 +846,8 @@ static void cops_rx(struct net_device *dev)
846 skb_reset_transport_header(skb); /* Point to data (Skip header). */ 846 skb_reset_transport_header(skb); /* Point to data (Skip header). */
847 847
848 /* Update the counters. */ 848 /* Update the counters. */
849 lp->stats.rx_packets++; 849 dev->stats.rx_packets++;
850 lp->stats.rx_bytes += skb->len; 850 dev->stats.rx_bytes += skb->len;
851 851
852 /* Send packet to a higher place. */ 852 /* Send packet to a higher place. */
853 netif_rx(skb); 853 netif_rx(skb);
@@ -858,7 +858,7 @@ static void cops_timeout(struct net_device *dev)
858 struct cops_local *lp = netdev_priv(dev); 858 struct cops_local *lp = netdev_priv(dev);
859 int ioaddr = dev->base_addr; 859 int ioaddr = dev->base_addr;
860 860
861 lp->stats.tx_errors++; 861 dev->stats.tx_errors++;
862 if(lp->board==TANGENT) 862 if(lp->board==TANGENT)
863 { 863 {
864 if((inb(ioaddr+TANG_CARD_STATUS)&TANG_TX_READY)==0) 864 if((inb(ioaddr+TANG_CARD_STATUS)&TANG_TX_READY)==0)
@@ -916,8 +916,8 @@ static int cops_send_packet(struct sk_buff *skb, struct net_device *dev)
916 spin_unlock_irqrestore(&lp->lock, flags); /* Restore interrupts. */ 916 spin_unlock_irqrestore(&lp->lock, flags); /* Restore interrupts. */
917 917
918 /* Done sending packet, update counters and cleanup. */ 918 /* Done sending packet, update counters and cleanup. */
919 lp->stats.tx_packets++; 919 dev->stats.tx_packets++;
920 lp->stats.tx_bytes += skb->len; 920 dev->stats.tx_bytes += skb->len;
921 dev->trans_start = jiffies; 921 dev->trans_start = jiffies;
922 dev_kfree_skb (skb); 922 dev_kfree_skb (skb);
923 return 0; 923 return 0;
@@ -986,15 +986,6 @@ static int cops_close(struct net_device *dev)
986 return 0; 986 return 0;
987} 987}
988 988
989/*
990 * Get the current statistics.
991 * This may be called with the card open or closed.
992 */
993static struct net_device_stats *cops_get_stats(struct net_device *dev)
994{
995 struct cops_local *lp = netdev_priv(dev);
996 return &lp->stats;
997}
998 989
999#ifdef MODULE 990#ifdef MODULE
1000static struct net_device *cops_dev; 991static struct net_device *cops_dev;