aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/mace.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-11 22:40:14 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-11 22:40:14 -0400
commit038a5008b2f395c85e6e71d6ddf3c684e7c405b0 (patch)
tree4735eab577e97e5a22c3141e3f60071c8065585e /drivers/net/mace.c
parentdd6d1844af33acb4edd0a40b1770d091a22c94be (diff)
parent266918303226cceac7eca38ced30f15f277bd89c (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (867 commits) [SKY2]: status polling loop (post merge) [NET]: Fix NAPI completion handling in some drivers. [TCP]: Limit processing lost_retrans loop to work-to-do cases [TCP]: Fix lost_retrans loop vs fastpath problems [TCP]: No need to re-count fackets_out/sacked_out at RTO [TCP]: Extract tcp_match_queue_to_sack from sacktag code [TCP]: Kill almost unused variable pcount from sacktag [TCP]: Fix mark_head_lost to ignore R-bit when trying to mark L [TCP]: Add bytes_acked (ABC) clearing to FRTO too [IPv6]: Update setsockopt(IPV6_MULTICAST_IF) to support RFC 3493, try2 [NETFILTER]: x_tables: add missing ip6t_modulename aliases [NETFILTER]: nf_conntrack_tcp: fix connection reopening [QETH]: fix qeth_main.c [NETLINK]: fib_frontend build fixes [IPv6]: Export userland ND options through netlink (RDNSS support) [9P]: build fix with !CONFIG_SYSCTL [NET]: Fix dev_put() and dev_hold() comments [NET]: make netlink user -> kernel interface synchronious [NET]: unify netlink kernel socket recognition [NET]: cleanup 3rd argument in netlink_sendskb ... Fix up conflicts manually in Documentation/feature-removal-schedule.txt and my new least favourite crap, the "mod_devicetable" support in the files include/linux/mod_devicetable.h and scripts/mod/file2alias.c. (The latter files seem to be explicitly _designed_ to get conflicts when different subsystems work with them - that have an absolutely horrid lack of subsystem separation!) Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/net/mace.c')
-rw-r--r--drivers/net/mace.c69
1 files changed, 28 insertions, 41 deletions
diff --git a/drivers/net/mace.c b/drivers/net/mace.c
index 52b9332810c5..95ebe72f320f 100644
--- a/drivers/net/mace.c
+++ b/drivers/net/mace.c
@@ -57,7 +57,6 @@ struct mace_data {
57 unsigned char tx_fullup; 57 unsigned char tx_fullup;
58 unsigned char tx_active; 58 unsigned char tx_active;
59 unsigned char tx_bad_runt; 59 unsigned char tx_bad_runt;
60 struct net_device_stats stats;
61 struct timer_list tx_timeout; 60 struct timer_list tx_timeout;
62 int timeout_active; 61 int timeout_active;
63 int port_aaui; 62 int port_aaui;
@@ -78,7 +77,6 @@ struct mace_data {
78static int mace_open(struct net_device *dev); 77static int mace_open(struct net_device *dev);
79static int mace_close(struct net_device *dev); 78static int mace_close(struct net_device *dev);
80static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev); 79static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev);
81static struct net_device_stats *mace_stats(struct net_device *dev);
82static void mace_set_multicast(struct net_device *dev); 80static void mace_set_multicast(struct net_device *dev);
83static void mace_reset(struct net_device *dev); 81static void mace_reset(struct net_device *dev);
84static int mace_set_address(struct net_device *dev, void *addr); 82static int mace_set_address(struct net_device *dev, void *addr);
@@ -103,6 +101,7 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_device_i
103 struct mace_data *mp; 101 struct mace_data *mp;
104 const unsigned char *addr; 102 const unsigned char *addr;
105 int j, rev, rc = -EBUSY; 103 int j, rev, rc = -EBUSY;
104 DECLARE_MAC_BUF(mac);
106 105
107 if (macio_resource_count(mdev) != 3 || macio_irq_count(mdev) != 3) { 106 if (macio_resource_count(mdev) != 3 || macio_irq_count(mdev) != 3) {
108 printk(KERN_ERR "can't use MACE %s: need 3 addrs and 3 irqs\n", 107 printk(KERN_ERR "can't use MACE %s: need 3 addrs and 3 irqs\n",
@@ -143,7 +142,6 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_device_i
143 rc = -ENOMEM; 142 rc = -ENOMEM;
144 goto err_release; 143 goto err_release;
145 } 144 }
146 SET_MODULE_OWNER(dev);
147 SET_NETDEV_DEV(dev, &mdev->ofdev.dev); 145 SET_NETDEV_DEV(dev, &mdev->ofdev.dev);
148 146
149 mp = dev->priv; 147 mp = dev->priv;
@@ -189,7 +187,6 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_device_i
189 mp->tx_cmds = (volatile struct dbdma_cmd *) DBDMA_ALIGN(mp + 1); 187 mp->tx_cmds = (volatile struct dbdma_cmd *) DBDMA_ALIGN(mp + 1);
190 mp->rx_cmds = mp->tx_cmds + NCMDS_TX * N_TX_RING + 1; 188 mp->rx_cmds = mp->tx_cmds + NCMDS_TX * N_TX_RING + 1;
191 189
192 memset(&mp->stats, 0, sizeof(mp->stats));
193 memset((char *) mp->tx_cmds, 0, 190 memset((char *) mp->tx_cmds, 0,
194 (NCMDS_TX*N_TX_RING + N_RX_RING + 2) * sizeof(struct dbdma_cmd)); 191 (NCMDS_TX*N_TX_RING + N_RX_RING + 2) * sizeof(struct dbdma_cmd));
195 init_timer(&mp->tx_timeout); 192 init_timer(&mp->tx_timeout);
@@ -214,7 +211,6 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_device_i
214 dev->open = mace_open; 211 dev->open = mace_open;
215 dev->stop = mace_close; 212 dev->stop = mace_close;
216 dev->hard_start_xmit = mace_xmit_start; 213 dev->hard_start_xmit = mace_xmit_start;
217 dev->get_stats = mace_stats;
218 dev->set_multicast_list = mace_set_multicast; 214 dev->set_multicast_list = mace_set_multicast;
219 dev->set_mac_address = mace_set_address; 215 dev->set_mac_address = mace_set_address;
220 216
@@ -245,11 +241,9 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_device_i
245 goto err_free_rx_irq; 241 goto err_free_rx_irq;
246 } 242 }
247 243
248 printk(KERN_INFO "%s: MACE at", dev->name); 244 printk(KERN_INFO "%s: MACE at %s, chip revision %d.%d\n",
249 for (j = 0; j < 6; ++j) { 245 dev->name, print_mac(mac, dev->dev_addr),
250 printk("%c%.2x", (j? ':': ' '), dev->dev_addr[j]); 246 mp->chipid >> 8, mp->chipid & 0xff);
251 }
252 printk(", chip revision %d.%d\n", mp->chipid >> 8, mp->chipid & 0xff);
253 247
254 return 0; 248 return 0;
255 249
@@ -585,13 +579,6 @@ static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev)
585 return 0; 579 return 0;
586} 580}
587 581
588static struct net_device_stats *mace_stats(struct net_device *dev)
589{
590 struct mace_data *p = (struct mace_data *) dev->priv;
591
592 return &p->stats;
593}
594
595static void mace_set_multicast(struct net_device *dev) 582static void mace_set_multicast(struct net_device *dev)
596{ 583{
597 struct mace_data *mp = (struct mace_data *) dev->priv; 584 struct mace_data *mp = (struct mace_data *) dev->priv;
@@ -645,19 +632,19 @@ static void mace_set_multicast(struct net_device *dev)
645 spin_unlock_irqrestore(&mp->lock, flags); 632 spin_unlock_irqrestore(&mp->lock, flags);
646} 633}
647 634
648static void mace_handle_misc_intrs(struct mace_data *mp, int intr) 635static void mace_handle_misc_intrs(struct mace_data *mp, int intr, struct net_device *dev)
649{ 636{
650 volatile struct mace __iomem *mb = mp->mace; 637 volatile struct mace __iomem *mb = mp->mace;
651 static int mace_babbles, mace_jabbers; 638 static int mace_babbles, mace_jabbers;
652 639
653 if (intr & MPCO) 640 if (intr & MPCO)
654 mp->stats.rx_missed_errors += 256; 641 dev->stats.rx_missed_errors += 256;
655 mp->stats.rx_missed_errors += in_8(&mb->mpc); /* reading clears it */ 642 dev->stats.rx_missed_errors += in_8(&mb->mpc); /* reading clears it */
656 if (intr & RNTPCO) 643 if (intr & RNTPCO)
657 mp->stats.rx_length_errors += 256; 644 dev->stats.rx_length_errors += 256;
658 mp->stats.rx_length_errors += in_8(&mb->rntpc); /* reading clears it */ 645 dev->stats.rx_length_errors += in_8(&mb->rntpc); /* reading clears it */
659 if (intr & CERR) 646 if (intr & CERR)
660 ++mp->stats.tx_heartbeat_errors; 647 ++dev->stats.tx_heartbeat_errors;
661 if (intr & BABBLE) 648 if (intr & BABBLE)
662 if (mace_babbles++ < 4) 649 if (mace_babbles++ < 4)
663 printk(KERN_DEBUG "mace: babbling transmitter\n"); 650 printk(KERN_DEBUG "mace: babbling transmitter\n");
@@ -681,7 +668,7 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id)
681 spin_lock_irqsave(&mp->lock, flags); 668 spin_lock_irqsave(&mp->lock, flags);
682 intr = in_8(&mb->ir); /* read interrupt register */ 669 intr = in_8(&mb->ir); /* read interrupt register */
683 in_8(&mb->xmtrc); /* get retries */ 670 in_8(&mb->xmtrc); /* get retries */
684 mace_handle_misc_intrs(mp, intr); 671 mace_handle_misc_intrs(mp, intr, dev);
685 672
686 i = mp->tx_empty; 673 i = mp->tx_empty;
687 while (in_8(&mb->pr) & XMTSV) { 674 while (in_8(&mb->pr) & XMTSV) {
@@ -694,7 +681,7 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id)
694 */ 681 */
695 intr = in_8(&mb->ir); 682 intr = in_8(&mb->ir);
696 if (intr != 0) 683 if (intr != 0)
697 mace_handle_misc_intrs(mp, intr); 684 mace_handle_misc_intrs(mp, intr, dev);
698 if (mp->tx_bad_runt) { 685 if (mp->tx_bad_runt) {
699 fs = in_8(&mb->xmtfs); 686 fs = in_8(&mb->xmtfs);
700 mp->tx_bad_runt = 0; 687 mp->tx_bad_runt = 0;
@@ -768,14 +755,14 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id)
768 } 755 }
769 /* Update stats */ 756 /* Update stats */
770 if (fs & (UFLO|LCOL|LCAR|RTRY)) { 757 if (fs & (UFLO|LCOL|LCAR|RTRY)) {
771 ++mp->stats.tx_errors; 758 ++dev->stats.tx_errors;
772 if (fs & LCAR) 759 if (fs & LCAR)
773 ++mp->stats.tx_carrier_errors; 760 ++dev->stats.tx_carrier_errors;
774 if (fs & (UFLO|LCOL|RTRY)) 761 if (fs & (UFLO|LCOL|RTRY))
775 ++mp->stats.tx_aborted_errors; 762 ++dev->stats.tx_aborted_errors;
776 } else { 763 } else {
777 mp->stats.tx_bytes += mp->tx_bufs[i]->len; 764 dev->stats.tx_bytes += mp->tx_bufs[i]->len;
778 ++mp->stats.tx_packets; 765 ++dev->stats.tx_packets;
779 } 766 }
780 dev_kfree_skb_irq(mp->tx_bufs[i]); 767 dev_kfree_skb_irq(mp->tx_bufs[i]);
781 --mp->tx_active; 768 --mp->tx_active;
@@ -829,7 +816,7 @@ static void mace_tx_timeout(unsigned long data)
829 goto out; 816 goto out;
830 817
831 /* update various counters */ 818 /* update various counters */
832 mace_handle_misc_intrs(mp, in_8(&mb->ir)); 819 mace_handle_misc_intrs(mp, in_8(&mb->ir), dev);
833 820
834 cp = mp->tx_cmds + NCMDS_TX * mp->tx_empty; 821 cp = mp->tx_cmds + NCMDS_TX * mp->tx_empty;
835 822
@@ -849,7 +836,7 @@ static void mace_tx_timeout(unsigned long data)
849 /* fix up the transmit side */ 836 /* fix up the transmit side */
850 i = mp->tx_empty; 837 i = mp->tx_empty;
851 mp->tx_active = 0; 838 mp->tx_active = 0;
852 ++mp->stats.tx_errors; 839 ++dev->stats.tx_errors;
853 if (mp->tx_bad_runt) { 840 if (mp->tx_bad_runt) {
854 mp->tx_bad_runt = 0; 841 mp->tx_bad_runt = 0;
855 } else if (i != mp->tx_fill) { 842 } else if (i != mp->tx_fill) {
@@ -917,18 +904,18 @@ static irqreturn_t mace_rxdma_intr(int irq, void *dev_id)
917 /* got a packet, have a look at it */ 904 /* got a packet, have a look at it */
918 skb = mp->rx_bufs[i]; 905 skb = mp->rx_bufs[i];
919 if (skb == 0) { 906 if (skb == 0) {
920 ++mp->stats.rx_dropped; 907 ++dev->stats.rx_dropped;
921 } else if (nb > 8) { 908 } else if (nb > 8) {
922 data = skb->data; 909 data = skb->data;
923 frame_status = (data[nb-3] << 8) + data[nb-4]; 910 frame_status = (data[nb-3] << 8) + data[nb-4];
924 if (frame_status & (RS_OFLO|RS_CLSN|RS_FRAMERR|RS_FCSERR)) { 911 if (frame_status & (RS_OFLO|RS_CLSN|RS_FRAMERR|RS_FCSERR)) {
925 ++mp->stats.rx_errors; 912 ++dev->stats.rx_errors;
926 if (frame_status & RS_OFLO) 913 if (frame_status & RS_OFLO)
927 ++mp->stats.rx_over_errors; 914 ++dev->stats.rx_over_errors;
928 if (frame_status & RS_FRAMERR) 915 if (frame_status & RS_FRAMERR)
929 ++mp->stats.rx_frame_errors; 916 ++dev->stats.rx_frame_errors;
930 if (frame_status & RS_FCSERR) 917 if (frame_status & RS_FCSERR)
931 ++mp->stats.rx_crc_errors; 918 ++dev->stats.rx_crc_errors;
932 } else { 919 } else {
933 /* Mace feature AUTO_STRIP_RCV is on by default, dropping the 920 /* Mace feature AUTO_STRIP_RCV is on by default, dropping the
934 * FCS on frames with 802.3 headers. This means that Ethernet 921 * FCS on frames with 802.3 headers. This means that Ethernet
@@ -940,15 +927,15 @@ static irqreturn_t mace_rxdma_intr(int irq, void *dev_id)
940 nb -= 8; 927 nb -= 8;
941 skb_put(skb, nb); 928 skb_put(skb, nb);
942 skb->protocol = eth_type_trans(skb, dev); 929 skb->protocol = eth_type_trans(skb, dev);
943 mp->stats.rx_bytes += skb->len; 930 dev->stats.rx_bytes += skb->len;
944 netif_rx(skb); 931 netif_rx(skb);
945 dev->last_rx = jiffies; 932 dev->last_rx = jiffies;
946 mp->rx_bufs[i] = NULL; 933 mp->rx_bufs[i] = NULL;
947 ++mp->stats.rx_packets; 934 ++dev->stats.rx_packets;
948 } 935 }
949 } else { 936 } else {
950 ++mp->stats.rx_errors; 937 ++dev->stats.rx_errors;
951 ++mp->stats.rx_length_errors; 938 ++dev->stats.rx_length_errors;
952 } 939 }
953 940
954 /* advance to next */ 941 /* advance to next */