diff options
author | David S. Miller <davem@davemloft.net> | 2008-08-07 05:10:27 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-07 05:10:27 -0400 |
commit | 32bb93b02da8c75031e601ff1f9a25f99febbe5f (patch) | |
tree | 429d2b978f517d366de572fa5058d513ed7b51a6 /drivers/net/wan/lmc/lmc_main.c | |
parent | 6edafaaf6f5e70ef1e620ff01bd6bacebe1e0718 (diff) | |
parent | 3859069bc3358772b08bd91efe9edec39a746ea8 (diff) |
Merge branch 'upstream-davem' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
Diffstat (limited to 'drivers/net/wan/lmc/lmc_main.c')
-rw-r--r-- | drivers/net/wan/lmc/lmc_main.c | 672 |
1 files changed, 294 insertions, 378 deletions
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c index 62133cee446a..f80640f5a744 100644 --- a/drivers/net/wan/lmc/lmc_main.c +++ b/drivers/net/wan/lmc/lmc_main.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 1997-2000 LAN Media Corporation (LMC) | 2 | * Copyright (c) 1997-2000 LAN Media Corporation (LMC) |
3 | * All rights reserved. www.lanmedia.com | 3 | * All rights reserved. www.lanmedia.com |
4 | * Generic HDLC port Copyright (C) 2008 Krzysztof Halasa <khc@pm.waw.pl> | ||
4 | * | 5 | * |
5 | * This code is written by: | 6 | * This code is written by: |
6 | * Andrew Stanley-Jones (asj@cban.com) | 7 | * Andrew Stanley-Jones (asj@cban.com) |
@@ -36,8 +37,6 @@ | |||
36 | * | 37 | * |
37 | */ | 38 | */ |
38 | 39 | ||
39 | /* $Id: lmc_main.c,v 1.36 2000/04/11 05:25:25 asj Exp $ */ | ||
40 | |||
41 | #include <linux/kernel.h> | 40 | #include <linux/kernel.h> |
42 | #include <linux/module.h> | 41 | #include <linux/module.h> |
43 | #include <linux/string.h> | 42 | #include <linux/string.h> |
@@ -49,6 +48,7 @@ | |||
49 | #include <linux/interrupt.h> | 48 | #include <linux/interrupt.h> |
50 | #include <linux/pci.h> | 49 | #include <linux/pci.h> |
51 | #include <linux/delay.h> | 50 | #include <linux/delay.h> |
51 | #include <linux/hdlc.h> | ||
52 | #include <linux/init.h> | 52 | #include <linux/init.h> |
53 | #include <linux/in.h> | 53 | #include <linux/in.h> |
54 | #include <linux/if_arp.h> | 54 | #include <linux/if_arp.h> |
@@ -57,9 +57,6 @@ | |||
57 | #include <linux/skbuff.h> | 57 | #include <linux/skbuff.h> |
58 | #include <linux/inet.h> | 58 | #include <linux/inet.h> |
59 | #include <linux/bitops.h> | 59 | #include <linux/bitops.h> |
60 | |||
61 | #include <net/syncppp.h> | ||
62 | |||
63 | #include <asm/processor.h> /* Processor type for cache alignment. */ | 60 | #include <asm/processor.h> /* Processor type for cache alignment. */ |
64 | #include <asm/io.h> | 61 | #include <asm/io.h> |
65 | #include <asm/dma.h> | 62 | #include <asm/dma.h> |
@@ -78,8 +75,6 @@ | |||
78 | #include "lmc_debug.h" | 75 | #include "lmc_debug.h" |
79 | #include "lmc_proto.h" | 76 | #include "lmc_proto.h" |
80 | 77 | ||
81 | static int lmc_first_load = 0; | ||
82 | |||
83 | static int LMC_PKT_BUF_SZ = 1542; | 78 | static int LMC_PKT_BUF_SZ = 1542; |
84 | 79 | ||
85 | static struct pci_device_id lmc_pci_tbl[] = { | 80 | static struct pci_device_id lmc_pci_tbl[] = { |
@@ -91,11 +86,10 @@ static struct pci_device_id lmc_pci_tbl[] = { | |||
91 | }; | 86 | }; |
92 | 87 | ||
93 | MODULE_DEVICE_TABLE(pci, lmc_pci_tbl); | 88 | MODULE_DEVICE_TABLE(pci, lmc_pci_tbl); |
94 | MODULE_LICENSE("GPL"); | 89 | MODULE_LICENSE("GPL v2"); |
95 | 90 | ||
96 | 91 | ||
97 | static int lmc_start_xmit(struct sk_buff *skb, struct net_device *dev); | 92 | static int lmc_start_xmit(struct sk_buff *skb, struct net_device *dev); |
98 | static int lmc_start_xmit(struct sk_buff *skb, struct net_device *dev); | ||
99 | static int lmc_rx (struct net_device *dev); | 93 | static int lmc_rx (struct net_device *dev); |
100 | static int lmc_open(struct net_device *dev); | 94 | static int lmc_open(struct net_device *dev); |
101 | static int lmc_close(struct net_device *dev); | 95 | static int lmc_close(struct net_device *dev); |
@@ -114,20 +108,14 @@ static void lmc_driver_timeout(struct net_device *dev); | |||
114 | * linux reserves 16 device specific IOCTLs. We call them | 108 | * linux reserves 16 device specific IOCTLs. We call them |
115 | * LMCIOC* to control various bits of our world. | 109 | * LMCIOC* to control various bits of our world. |
116 | */ | 110 | */ |
117 | int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | 111 | int lmc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ |
118 | { | 112 | { |
119 | lmc_softc_t *sc; | 113 | lmc_softc_t *sc = dev_to_sc(dev); |
120 | lmc_ctl_t ctl; | 114 | lmc_ctl_t ctl; |
121 | int ret; | 115 | int ret = -EOPNOTSUPP; |
122 | u_int16_t regVal; | 116 | u16 regVal; |
123 | unsigned long flags; | 117 | unsigned long flags; |
124 | 118 | ||
125 | struct sppp *sp; | ||
126 | |||
127 | ret = -EOPNOTSUPP; | ||
128 | |||
129 | sc = dev->priv; | ||
130 | |||
131 | lmc_trace(dev, "lmc_ioctl in"); | 119 | lmc_trace(dev, "lmc_ioctl in"); |
132 | 120 | ||
133 | /* | 121 | /* |
@@ -149,7 +137,6 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
149 | break; | 137 | break; |
150 | 138 | ||
151 | case LMCIOCSINFO: /*fold01*/ | 139 | case LMCIOCSINFO: /*fold01*/ |
152 | sp = &((struct ppp_device *) dev)->sppp; | ||
153 | if (!capable(CAP_NET_ADMIN)) { | 140 | if (!capable(CAP_NET_ADMIN)) { |
154 | ret = -EPERM; | 141 | ret = -EPERM; |
155 | break; | 142 | break; |
@@ -175,25 +162,20 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
175 | sc->TxDescriptControlInit &= ~LMC_TDES_ADD_CRC_DISABLE; | 162 | sc->TxDescriptControlInit &= ~LMC_TDES_ADD_CRC_DISABLE; |
176 | } | 163 | } |
177 | 164 | ||
178 | if (ctl.keepalive_onoff == LMC_CTL_OFF) | ||
179 | sp->pp_flags &= ~PP_KEEPALIVE; /* Turn off */ | ||
180 | else | ||
181 | sp->pp_flags |= PP_KEEPALIVE; /* Turn on */ | ||
182 | |||
183 | ret = 0; | 165 | ret = 0; |
184 | break; | 166 | break; |
185 | 167 | ||
186 | case LMCIOCIFTYPE: /*fold01*/ | 168 | case LMCIOCIFTYPE: /*fold01*/ |
187 | { | 169 | { |
188 | u_int16_t old_type = sc->if_type; | 170 | u16 old_type = sc->if_type; |
189 | u_int16_t new_type; | 171 | u16 new_type; |
190 | 172 | ||
191 | if (!capable(CAP_NET_ADMIN)) { | 173 | if (!capable(CAP_NET_ADMIN)) { |
192 | ret = -EPERM; | 174 | ret = -EPERM; |
193 | break; | 175 | break; |
194 | } | 176 | } |
195 | 177 | ||
196 | if (copy_from_user(&new_type, ifr->ifr_data, sizeof(u_int16_t))) { | 178 | if (copy_from_user(&new_type, ifr->ifr_data, sizeof(u16))) { |
197 | ret = -EFAULT; | 179 | ret = -EFAULT; |
198 | break; | 180 | break; |
199 | } | 181 | } |
@@ -206,15 +188,11 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
206 | } | 188 | } |
207 | 189 | ||
208 | lmc_proto_close(sc); | 190 | lmc_proto_close(sc); |
209 | lmc_proto_detach(sc); | ||
210 | 191 | ||
211 | sc->if_type = new_type; | 192 | sc->if_type = new_type; |
212 | // lmc_proto_init(sc); | ||
213 | lmc_proto_attach(sc); | 193 | lmc_proto_attach(sc); |
214 | lmc_proto_open(sc); | 194 | ret = lmc_proto_open(sc); |
215 | 195 | break; | |
216 | ret = 0 ; | ||
217 | break ; | ||
218 | } | 196 | } |
219 | 197 | ||
220 | case LMCIOCGETXINFO: /*fold01*/ | 198 | case LMCIOCGETXINFO: /*fold01*/ |
@@ -241,51 +219,53 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
241 | 219 | ||
242 | break; | 220 | break; |
243 | 221 | ||
244 | case LMCIOCGETLMCSTATS: /*fold01*/ | 222 | case LMCIOCGETLMCSTATS: |
245 | if (sc->lmc_cardtype == LMC_CARDTYPE_T1){ | 223 | if (sc->lmc_cardtype == LMC_CARDTYPE_T1) { |
246 | lmc_mii_writereg (sc, 0, 17, T1FRAMER_FERR_LSB); | 224 | lmc_mii_writereg(sc, 0, 17, T1FRAMER_FERR_LSB); |
247 | sc->stats.framingBitErrorCount += | 225 | sc->extra_stats.framingBitErrorCount += |
248 | lmc_mii_readreg (sc, 0, 18) & 0xff; | 226 | lmc_mii_readreg(sc, 0, 18) & 0xff; |
249 | lmc_mii_writereg (sc, 0, 17, T1FRAMER_FERR_MSB); | 227 | lmc_mii_writereg(sc, 0, 17, T1FRAMER_FERR_MSB); |
250 | sc->stats.framingBitErrorCount += | 228 | sc->extra_stats.framingBitErrorCount += |
251 | (lmc_mii_readreg (sc, 0, 18) & 0xff) << 8; | 229 | (lmc_mii_readreg(sc, 0, 18) & 0xff) << 8; |
252 | lmc_mii_writereg (sc, 0, 17, T1FRAMER_LCV_LSB); | 230 | lmc_mii_writereg(sc, 0, 17, T1FRAMER_LCV_LSB); |
253 | sc->stats.lineCodeViolationCount += | 231 | sc->extra_stats.lineCodeViolationCount += |
254 | lmc_mii_readreg (sc, 0, 18) & 0xff; | 232 | lmc_mii_readreg(sc, 0, 18) & 0xff; |
255 | lmc_mii_writereg (sc, 0, 17, T1FRAMER_LCV_MSB); | 233 | lmc_mii_writereg(sc, 0, 17, T1FRAMER_LCV_MSB); |
256 | sc->stats.lineCodeViolationCount += | 234 | sc->extra_stats.lineCodeViolationCount += |
257 | (lmc_mii_readreg (sc, 0, 18) & 0xff) << 8; | 235 | (lmc_mii_readreg(sc, 0, 18) & 0xff) << 8; |
258 | lmc_mii_writereg (sc, 0, 17, T1FRAMER_AERR); | 236 | lmc_mii_writereg(sc, 0, 17, T1FRAMER_AERR); |
259 | regVal = lmc_mii_readreg (sc, 0, 18) & 0xff; | 237 | regVal = lmc_mii_readreg(sc, 0, 18) & 0xff; |
260 | 238 | ||
261 | sc->stats.lossOfFrameCount += | 239 | sc->extra_stats.lossOfFrameCount += |
262 | (regVal & T1FRAMER_LOF_MASK) >> 4; | 240 | (regVal & T1FRAMER_LOF_MASK) >> 4; |
263 | sc->stats.changeOfFrameAlignmentCount += | 241 | sc->extra_stats.changeOfFrameAlignmentCount += |
264 | (regVal & T1FRAMER_COFA_MASK) >> 2; | 242 | (regVal & T1FRAMER_COFA_MASK) >> 2; |
265 | sc->stats.severelyErroredFrameCount += | 243 | sc->extra_stats.severelyErroredFrameCount += |
266 | regVal & T1FRAMER_SEF_MASK; | 244 | regVal & T1FRAMER_SEF_MASK; |
267 | } | 245 | } |
268 | 246 | if (copy_to_user(ifr->ifr_data, &sc->lmc_device->stats, | |
269 | if (copy_to_user(ifr->ifr_data, &sc->stats, | 247 | sizeof(sc->lmc_device->stats)) || |
270 | sizeof (struct lmc_statistics))) | 248 | copy_to_user(ifr->ifr_data + sizeof(sc->lmc_device->stats), |
271 | ret = -EFAULT; | 249 | &sc->extra_stats, sizeof(sc->extra_stats))) |
272 | else | 250 | ret = -EFAULT; |
273 | ret = 0; | 251 | else |
274 | break; | 252 | ret = 0; |
253 | break; | ||
275 | 254 | ||
276 | case LMCIOCCLEARLMCSTATS: /*fold01*/ | 255 | case LMCIOCCLEARLMCSTATS: |
277 | if (!capable(CAP_NET_ADMIN)){ | 256 | if (!capable(CAP_NET_ADMIN)) { |
278 | ret = -EPERM; | 257 | ret = -EPERM; |
279 | break; | 258 | break; |
280 | } | 259 | } |
281 | 260 | ||
282 | memset (&sc->stats, 0, sizeof (struct lmc_statistics)); | 261 | memset(&sc->lmc_device->stats, 0, sizeof(sc->lmc_device->stats)); |
283 | sc->stats.check = STATCHECK; | 262 | memset(&sc->extra_stats, 0, sizeof(sc->extra_stats)); |
284 | sc->stats.version_size = (DRIVER_VERSION << 16) + | 263 | sc->extra_stats.check = STATCHECK; |
285 | sizeof (struct lmc_statistics); | 264 | sc->extra_stats.version_size = (DRIVER_VERSION << 16) + |
286 | sc->stats.lmc_cardtype = sc->lmc_cardtype; | 265 | sizeof(sc->lmc_device->stats) + sizeof(sc->extra_stats); |
287 | ret = 0; | 266 | sc->extra_stats.lmc_cardtype = sc->lmc_cardtype; |
288 | break; | 267 | ret = 0; |
268 | break; | ||
289 | 269 | ||
290 | case LMCIOCSETCIRCUIT: /*fold01*/ | 270 | case LMCIOCSETCIRCUIT: /*fold01*/ |
291 | if (!capable(CAP_NET_ADMIN)){ | 271 | if (!capable(CAP_NET_ADMIN)){ |
@@ -330,7 +310,8 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
330 | ret = -EFAULT; | 310 | ret = -EFAULT; |
331 | break; | 311 | break; |
332 | } | 312 | } |
333 | if (copy_to_user(ifr->ifr_data + sizeof (u32), lmcEventLogBuf, sizeof (lmcEventLogBuf))) | 313 | if (copy_to_user(ifr->ifr_data + sizeof(u32), lmcEventLogBuf, |
314 | sizeof(lmcEventLogBuf))) | ||
334 | ret = -EFAULT; | 315 | ret = -EFAULT; |
335 | else | 316 | else |
336 | ret = 0; | 317 | ret = 0; |
@@ -641,14 +622,12 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
641 | /* the watchdog process that cruises around */ | 622 | /* the watchdog process that cruises around */ |
642 | static void lmc_watchdog (unsigned long data) /*fold00*/ | 623 | static void lmc_watchdog (unsigned long data) /*fold00*/ |
643 | { | 624 | { |
644 | struct net_device *dev = (struct net_device *) data; | 625 | struct net_device *dev = (struct net_device *)data; |
645 | lmc_softc_t *sc; | 626 | lmc_softc_t *sc = dev_to_sc(dev); |
646 | int link_status; | 627 | int link_status; |
647 | u_int32_t ticks; | 628 | u32 ticks; |
648 | unsigned long flags; | 629 | unsigned long flags; |
649 | 630 | ||
650 | sc = dev->priv; | ||
651 | |||
652 | lmc_trace(dev, "lmc_watchdog in"); | 631 | lmc_trace(dev, "lmc_watchdog in"); |
653 | 632 | ||
654 | spin_lock_irqsave(&sc->lmc_lock, flags); | 633 | spin_lock_irqsave(&sc->lmc_lock, flags); |
@@ -677,22 +656,22 @@ static void lmc_watchdog (unsigned long data) /*fold00*/ | |||
677 | * check for a transmit interrupt timeout | 656 | * check for a transmit interrupt timeout |
678 | * Has the packet xmt vs xmt serviced threshold been exceeded */ | 657 | * Has the packet xmt vs xmt serviced threshold been exceeded */ |
679 | if (sc->lmc_taint_tx == sc->lastlmc_taint_tx && | 658 | if (sc->lmc_taint_tx == sc->lastlmc_taint_tx && |
680 | sc->stats.tx_packets > sc->lasttx_packets && | 659 | sc->lmc_device->stats.tx_packets > sc->lasttx_packets && |
681 | sc->tx_TimeoutInd == 0) | 660 | sc->tx_TimeoutInd == 0) |
682 | { | 661 | { |
683 | 662 | ||
684 | /* wait for the watchdog to come around again */ | 663 | /* wait for the watchdog to come around again */ |
685 | sc->tx_TimeoutInd = 1; | 664 | sc->tx_TimeoutInd = 1; |
686 | } | 665 | } |
687 | else if (sc->lmc_taint_tx == sc->lastlmc_taint_tx && | 666 | else if (sc->lmc_taint_tx == sc->lastlmc_taint_tx && |
688 | sc->stats.tx_packets > sc->lasttx_packets && | 667 | sc->lmc_device->stats.tx_packets > sc->lasttx_packets && |
689 | sc->tx_TimeoutInd) | 668 | sc->tx_TimeoutInd) |
690 | { | 669 | { |
691 | 670 | ||
692 | LMC_EVENT_LOG(LMC_EVENT_XMTINTTMO, LMC_CSR_READ (sc, csr_status), 0); | 671 | LMC_EVENT_LOG(LMC_EVENT_XMTINTTMO, LMC_CSR_READ (sc, csr_status), 0); |
693 | 672 | ||
694 | sc->tx_TimeoutDisplay = 1; | 673 | sc->tx_TimeoutDisplay = 1; |
695 | sc->stats.tx_TimeoutCnt++; | 674 | sc->extra_stats.tx_TimeoutCnt++; |
696 | 675 | ||
697 | /* DEC chip is stuck, hit it with a RESET!!!! */ | 676 | /* DEC chip is stuck, hit it with a RESET!!!! */ |
698 | lmc_running_reset (dev); | 677 | lmc_running_reset (dev); |
@@ -712,13 +691,11 @@ static void lmc_watchdog (unsigned long data) /*fold00*/ | |||
712 | /* reset the transmit timeout detection flag */ | 691 | /* reset the transmit timeout detection flag */ |
713 | sc->tx_TimeoutInd = 0; | 692 | sc->tx_TimeoutInd = 0; |
714 | sc->lastlmc_taint_tx = sc->lmc_taint_tx; | 693 | sc->lastlmc_taint_tx = sc->lmc_taint_tx; |
715 | sc->lasttx_packets = sc->stats.tx_packets; | 694 | sc->lasttx_packets = sc->lmc_device->stats.tx_packets; |
716 | } | 695 | } else { |
717 | else | ||
718 | { | ||
719 | sc->tx_TimeoutInd = 0; | 696 | sc->tx_TimeoutInd = 0; |
720 | sc->lastlmc_taint_tx = sc->lmc_taint_tx; | 697 | sc->lastlmc_taint_tx = sc->lmc_taint_tx; |
721 | sc->lasttx_packets = sc->stats.tx_packets; | 698 | sc->lasttx_packets = sc->lmc_device->stats.tx_packets; |
722 | } | 699 | } |
723 | 700 | ||
724 | /* --- end time out check ----------------------------------- */ | 701 | /* --- end time out check ----------------------------------- */ |
@@ -748,19 +725,7 @@ static void lmc_watchdog (unsigned long data) /*fold00*/ | |||
748 | sc->last_link_status = 1; | 725 | sc->last_link_status = 1; |
749 | /* lmc_reset (sc); Again why reset??? */ | 726 | /* lmc_reset (sc); Again why reset??? */ |
750 | 727 | ||
751 | /* Inform the world that link protocol is back up. */ | ||
752 | netif_carrier_on(dev); | 728 | netif_carrier_on(dev); |
753 | |||
754 | /* Now we have to tell the syncppp that we had an outage | ||
755 | * and that it should deal. Calling sppp_reopen here | ||
756 | * should do the trick, but we may have to call sppp_close | ||
757 | * when the link goes down, and call sppp_open here. | ||
758 | * Subject to more testing. | ||
759 | * --bbraun | ||
760 | */ | ||
761 | |||
762 | lmc_proto_reopen(sc); | ||
763 | |||
764 | } | 729 | } |
765 | 730 | ||
766 | /* Call media specific watchdog functions */ | 731 | /* Call media specific watchdog functions */ |
@@ -816,114 +781,93 @@ kick_timer: | |||
816 | 781 | ||
817 | } | 782 | } |
818 | 783 | ||
819 | static void lmc_setup(struct net_device * const dev) /*fold00*/ | 784 | static int lmc_attach(struct net_device *dev, unsigned short encoding, |
785 | unsigned short parity) | ||
820 | { | 786 | { |
821 | lmc_trace(dev, "lmc_setup in"); | 787 | if (encoding == ENCODING_NRZ && parity == PARITY_CRC16_PR1_CCITT) |
822 | 788 | return 0; | |
823 | dev->type = ARPHRD_HDLC; | 789 | return -EINVAL; |
824 | dev->hard_start_xmit = lmc_start_xmit; | ||
825 | dev->open = lmc_open; | ||
826 | dev->stop = lmc_close; | ||
827 | dev->get_stats = lmc_get_stats; | ||
828 | dev->do_ioctl = lmc_ioctl; | ||
829 | dev->tx_timeout = lmc_driver_timeout; | ||
830 | dev->watchdog_timeo = (HZ); /* 1 second */ | ||
831 | |||
832 | lmc_trace(dev, "lmc_setup out"); | ||
833 | } | 790 | } |
834 | 791 | ||
835 | |||
836 | static int __devinit lmc_init_one(struct pci_dev *pdev, | 792 | static int __devinit lmc_init_one(struct pci_dev *pdev, |
837 | const struct pci_device_id *ent) | 793 | const struct pci_device_id *ent) |
838 | { | 794 | { |
839 | struct net_device *dev; | 795 | lmc_softc_t *sc; |
840 | lmc_softc_t *sc; | 796 | struct net_device *dev; |
841 | u16 subdevice; | 797 | u16 subdevice; |
842 | u_int16_t AdapModelNum; | 798 | u16 AdapModelNum; |
843 | int err = -ENOMEM; | 799 | int err; |
844 | static int cards_found; | 800 | static int cards_found; |
845 | #ifndef GCOM | 801 | |
846 | /* We name by type not by vendor */ | 802 | /* lmc_trace(dev, "lmc_init_one in"); */ |
847 | static const char lmcname[] = "hdlc%d"; | 803 | |
848 | #else | 804 | err = pci_enable_device(pdev); |
849 | /* | 805 | if (err) { |
850 | * GCOM uses LMC vendor name so that clients can know which card | 806 | printk(KERN_ERR "lmc: pci enable failed: %d\n", err); |
851 | * to attach to. | 807 | return err; |
852 | */ | 808 | } |
853 | static const char lmcname[] = "lmc%d"; | ||
854 | #endif | ||
855 | |||
856 | |||
857 | /* | ||
858 | * Allocate our own device structure | ||
859 | */ | ||
860 | dev = alloc_netdev(sizeof(lmc_softc_t), lmcname, lmc_setup); | ||
861 | if (!dev) { | ||
862 | printk (KERN_ERR "lmc:alloc_netdev for device failed\n"); | ||
863 | goto out1; | ||
864 | } | ||
865 | |||
866 | lmc_trace(dev, "lmc_init_one in"); | ||
867 | |||
868 | err = pci_enable_device(pdev); | ||
869 | if (err) { | ||
870 | printk(KERN_ERR "lmc: pci enable failed:%d\n", err); | ||
871 | goto out2; | ||
872 | } | ||
873 | |||
874 | if (pci_request_regions(pdev, "lmc")) { | ||
875 | printk(KERN_ERR "lmc: pci_request_region failed\n"); | ||
876 | err = -EIO; | ||
877 | goto out3; | ||
878 | } | ||
879 | |||
880 | pci_set_drvdata(pdev, dev); | ||
881 | |||
882 | if(lmc_first_load == 0){ | ||
883 | printk(KERN_INFO "Lan Media Corporation WAN Driver Version %d.%d.%d\n", | ||
884 | DRIVER_MAJOR_VERSION, DRIVER_MINOR_VERSION,DRIVER_SUB_VERSION); | ||
885 | lmc_first_load = 1; | ||
886 | } | ||
887 | |||
888 | sc = dev->priv; | ||
889 | sc->lmc_device = dev; | ||
890 | sc->name = dev->name; | ||
891 | |||
892 | /* Initialize the sppp layer */ | ||
893 | /* An ioctl can cause a subsequent detach for raw frame interface */ | ||
894 | dev->ml_priv = sc; | ||
895 | sc->if_type = LMC_PPP; | ||
896 | sc->check = 0xBEAFCAFE; | ||
897 | dev->base_addr = pci_resource_start(pdev, 0); | ||
898 | dev->irq = pdev->irq; | ||
899 | |||
900 | SET_NETDEV_DEV(dev, &pdev->dev); | ||
901 | |||
902 | /* | ||
903 | * This will get the protocol layer ready and do any 1 time init's | ||
904 | * Must have a valid sc and dev structure | ||
905 | */ | ||
906 | lmc_proto_init(sc); | ||
907 | |||
908 | lmc_proto_attach(sc); | ||
909 | 809 | ||
910 | /* | 810 | err = pci_request_regions(pdev, "lmc"); |
911 | * Why were we changing this??? | 811 | if (err) { |
912 | dev->tx_queue_len = 100; | 812 | printk(KERN_ERR "lmc: pci_request_region failed\n"); |
913 | */ | 813 | goto err_req_io; |
814 | } | ||
914 | 815 | ||
915 | /* Init the spin lock so can call it latter */ | 816 | /* |
817 | * Allocate our own device structure | ||
818 | */ | ||
819 | sc = kzalloc(sizeof(lmc_softc_t), GFP_KERNEL); | ||
820 | if (!sc) { | ||
821 | err = -ENOMEM; | ||
822 | goto err_kzalloc; | ||
823 | } | ||
916 | 824 | ||
917 | spin_lock_init(&sc->lmc_lock); | 825 | dev = alloc_hdlcdev(sc); |
918 | pci_set_master(pdev); | 826 | if (!dev) { |
827 | printk(KERN_ERR "lmc:alloc_netdev for device failed\n"); | ||
828 | goto err_hdlcdev; | ||
829 | } | ||
919 | 830 | ||
920 | printk ("%s: detected at %lx, irq %d\n", dev->name, | ||
921 | dev->base_addr, dev->irq); | ||
922 | 831 | ||
923 | if (register_netdev (dev) != 0) { | 832 | dev->type = ARPHRD_HDLC; |
924 | printk (KERN_ERR "%s: register_netdev failed.\n", dev->name); | 833 | dev_to_hdlc(dev)->xmit = lmc_start_xmit; |
925 | goto out4; | 834 | dev_to_hdlc(dev)->attach = lmc_attach; |
926 | } | 835 | dev->open = lmc_open; |
836 | dev->stop = lmc_close; | ||
837 | dev->get_stats = lmc_get_stats; | ||
838 | dev->do_ioctl = lmc_ioctl; | ||
839 | dev->tx_timeout = lmc_driver_timeout; | ||
840 | dev->watchdog_timeo = HZ; /* 1 second */ | ||
841 | dev->tx_queue_len = 100; | ||
842 | sc->lmc_device = dev; | ||
843 | sc->name = dev->name; | ||
844 | sc->if_type = LMC_PPP; | ||
845 | sc->check = 0xBEAFCAFE; | ||
846 | dev->base_addr = pci_resource_start(pdev, 0); | ||
847 | dev->irq = pdev->irq; | ||
848 | pci_set_drvdata(pdev, dev); | ||
849 | SET_NETDEV_DEV(dev, &pdev->dev); | ||
850 | |||
851 | /* | ||
852 | * This will get the protocol layer ready and do any 1 time init's | ||
853 | * Must have a valid sc and dev structure | ||
854 | */ | ||
855 | lmc_proto_attach(sc); | ||
856 | |||
857 | /* Init the spin lock so can call it latter */ | ||
858 | |||
859 | spin_lock_init(&sc->lmc_lock); | ||
860 | pci_set_master(pdev); | ||
861 | |||
862 | printk(KERN_INFO "%s: detected at %lx, irq %d\n", dev->name, | ||
863 | dev->base_addr, dev->irq); | ||
864 | |||
865 | err = register_hdlc_device(dev); | ||
866 | if (err) { | ||
867 | printk(KERN_ERR "%s: register_netdev failed.\n", dev->name); | ||
868 | free_netdev(dev); | ||
869 | goto err_hdlcdev; | ||
870 | } | ||
927 | 871 | ||
928 | sc->lmc_cardtype = LMC_CARDTYPE_UNKNOWN; | 872 | sc->lmc_cardtype = LMC_CARDTYPE_UNKNOWN; |
929 | sc->lmc_timing = LMC_CTL_CLOCK_SOURCE_EXT; | 873 | sc->lmc_timing = LMC_CTL_CLOCK_SOURCE_EXT; |
@@ -939,27 +883,27 @@ static int __devinit lmc_init_one(struct pci_dev *pdev, | |||
939 | 883 | ||
940 | switch (subdevice) { | 884 | switch (subdevice) { |
941 | case PCI_DEVICE_ID_LMC_HSSI: | 885 | case PCI_DEVICE_ID_LMC_HSSI: |
942 | printk ("%s: LMC HSSI\n", dev->name); | 886 | printk(KERN_INFO "%s: LMC HSSI\n", dev->name); |
943 | sc->lmc_cardtype = LMC_CARDTYPE_HSSI; | 887 | sc->lmc_cardtype = LMC_CARDTYPE_HSSI; |
944 | sc->lmc_media = &lmc_hssi_media; | 888 | sc->lmc_media = &lmc_hssi_media; |
945 | break; | 889 | break; |
946 | case PCI_DEVICE_ID_LMC_DS3: | 890 | case PCI_DEVICE_ID_LMC_DS3: |
947 | printk ("%s: LMC DS3\n", dev->name); | 891 | printk(KERN_INFO "%s: LMC DS3\n", dev->name); |
948 | sc->lmc_cardtype = LMC_CARDTYPE_DS3; | 892 | sc->lmc_cardtype = LMC_CARDTYPE_DS3; |
949 | sc->lmc_media = &lmc_ds3_media; | 893 | sc->lmc_media = &lmc_ds3_media; |
950 | break; | 894 | break; |
951 | case PCI_DEVICE_ID_LMC_SSI: | 895 | case PCI_DEVICE_ID_LMC_SSI: |
952 | printk ("%s: LMC SSI\n", dev->name); | 896 | printk(KERN_INFO "%s: LMC SSI\n", dev->name); |
953 | sc->lmc_cardtype = LMC_CARDTYPE_SSI; | 897 | sc->lmc_cardtype = LMC_CARDTYPE_SSI; |
954 | sc->lmc_media = &lmc_ssi_media; | 898 | sc->lmc_media = &lmc_ssi_media; |
955 | break; | 899 | break; |
956 | case PCI_DEVICE_ID_LMC_T1: | 900 | case PCI_DEVICE_ID_LMC_T1: |
957 | printk ("%s: LMC T1\n", dev->name); | 901 | printk(KERN_INFO "%s: LMC T1\n", dev->name); |
958 | sc->lmc_cardtype = LMC_CARDTYPE_T1; | 902 | sc->lmc_cardtype = LMC_CARDTYPE_T1; |
959 | sc->lmc_media = &lmc_t1_media; | 903 | sc->lmc_media = &lmc_t1_media; |
960 | break; | 904 | break; |
961 | default: | 905 | default: |
962 | printk (KERN_WARNING "%s: LMC UNKOWN CARD!\n", dev->name); | 906 | printk(KERN_WARNING "%s: LMC UNKOWN CARD!\n", dev->name); |
963 | break; | 907 | break; |
964 | } | 908 | } |
965 | 909 | ||
@@ -977,32 +921,28 @@ static int __devinit lmc_init_one(struct pci_dev *pdev, | |||
977 | */ | 921 | */ |
978 | AdapModelNum = (lmc_mii_readreg (sc, 0, 3) & 0x3f0) >> 4; | 922 | AdapModelNum = (lmc_mii_readreg (sc, 0, 3) & 0x3f0) >> 4; |
979 | 923 | ||
980 | if ((AdapModelNum == LMC_ADAP_T1 | 924 | if ((AdapModelNum != LMC_ADAP_T1 || /* detect LMC1200 */ |
981 | && subdevice == PCI_DEVICE_ID_LMC_T1) || /* detect LMC1200 */ | 925 | subdevice != PCI_DEVICE_ID_LMC_T1) && |
982 | (AdapModelNum == LMC_ADAP_SSI | 926 | (AdapModelNum != LMC_ADAP_SSI || /* detect LMC1000 */ |
983 | && subdevice == PCI_DEVICE_ID_LMC_SSI) || /* detect LMC1000 */ | 927 | subdevice != PCI_DEVICE_ID_LMC_SSI) && |
984 | (AdapModelNum == LMC_ADAP_DS3 | 928 | (AdapModelNum != LMC_ADAP_DS3 || /* detect LMC5245 */ |
985 | && subdevice == PCI_DEVICE_ID_LMC_DS3) || /* detect LMC5245 */ | 929 | subdevice != PCI_DEVICE_ID_LMC_DS3) && |
986 | (AdapModelNum == LMC_ADAP_HSSI | 930 | (AdapModelNum != LMC_ADAP_HSSI || /* detect LMC5200 */ |
987 | && subdevice == PCI_DEVICE_ID_LMC_HSSI)) | 931 | subdevice != PCI_DEVICE_ID_LMC_HSSI)) |
988 | { /* detect LMC5200 */ | 932 | printk(KERN_WARNING "%s: Model number (%d) miscompare for PCI" |
933 | " Subsystem ID = 0x%04x\n", | ||
934 | dev->name, AdapModelNum, subdevice); | ||
989 | 935 | ||
990 | } | ||
991 | else { | ||
992 | printk ("%s: Model number (%d) miscompare for PCI Subsystem ID = 0x%04x\n", | ||
993 | dev->name, AdapModelNum, subdevice); | ||
994 | // return (NULL); | ||
995 | } | ||
996 | /* | 936 | /* |
997 | * reset clock | 937 | * reset clock |
998 | */ | 938 | */ |
999 | LMC_CSR_WRITE (sc, csr_gp_timer, 0xFFFFFFFFUL); | 939 | LMC_CSR_WRITE (sc, csr_gp_timer, 0xFFFFFFFFUL); |
1000 | 940 | ||
1001 | sc->board_idx = cards_found++; | 941 | sc->board_idx = cards_found++; |
1002 | sc->stats.check = STATCHECK; | 942 | sc->extra_stats.check = STATCHECK; |
1003 | sc->stats.version_size = (DRIVER_VERSION << 16) + | 943 | sc->extra_stats.version_size = (DRIVER_VERSION << 16) + |
1004 | sizeof (struct lmc_statistics); | 944 | sizeof(sc->lmc_device->stats) + sizeof(sc->extra_stats); |
1005 | sc->stats.lmc_cardtype = sc->lmc_cardtype; | 945 | sc->extra_stats.lmc_cardtype = sc->lmc_cardtype; |
1006 | 946 | ||
1007 | sc->lmc_ok = 0; | 947 | sc->lmc_ok = 0; |
1008 | sc->last_link_status = 0; | 948 | sc->last_link_status = 0; |
@@ -1010,58 +950,51 @@ static int __devinit lmc_init_one(struct pci_dev *pdev, | |||
1010 | lmc_trace(dev, "lmc_init_one out"); | 950 | lmc_trace(dev, "lmc_init_one out"); |
1011 | return 0; | 951 | return 0; |
1012 | 952 | ||
1013 | out4: | 953 | err_hdlcdev: |
1014 | lmc_proto_detach(sc); | 954 | pci_set_drvdata(pdev, NULL); |
1015 | out3: | 955 | kfree(sc); |
1016 | if (pdev) { | 956 | err_kzalloc: |
1017 | pci_release_regions(pdev); | 957 | pci_release_regions(pdev); |
1018 | pci_set_drvdata(pdev, NULL); | 958 | err_req_io: |
1019 | } | 959 | pci_disable_device(pdev); |
1020 | out2: | 960 | return err; |
1021 | free_netdev(dev); | ||
1022 | out1: | ||
1023 | return err; | ||
1024 | } | 961 | } |
1025 | 962 | ||
1026 | /* | 963 | /* |
1027 | * Called from pci when removing module. | 964 | * Called from pci when removing module. |
1028 | */ | 965 | */ |
1029 | static void __devexit lmc_remove_one (struct pci_dev *pdev) | 966 | static void __devexit lmc_remove_one(struct pci_dev *pdev) |
1030 | { | 967 | { |
1031 | struct net_device *dev = pci_get_drvdata(pdev); | 968 | struct net_device *dev = pci_get_drvdata(pdev); |
1032 | 969 | ||
1033 | if (dev) { | 970 | if (dev) { |
1034 | lmc_softc_t *sc = dev->priv; | 971 | printk(KERN_DEBUG "%s: removing...\n", dev->name); |
1035 | 972 | unregister_hdlc_device(dev); | |
1036 | printk("%s: removing...\n", dev->name); | 973 | free_netdev(dev); |
1037 | lmc_proto_detach(sc); | 974 | pci_release_regions(pdev); |
1038 | unregister_netdev(dev); | 975 | pci_disable_device(pdev); |
1039 | free_netdev(dev); | 976 | pci_set_drvdata(pdev, NULL); |
1040 | pci_release_regions(pdev); | 977 | } |
1041 | pci_disable_device(pdev); | ||
1042 | pci_set_drvdata(pdev, NULL); | ||
1043 | } | ||
1044 | } | 978 | } |
1045 | 979 | ||
1046 | /* After this is called, packets can be sent. | 980 | /* After this is called, packets can be sent. |
1047 | * Does not initialize the addresses | 981 | * Does not initialize the addresses |
1048 | */ | 982 | */ |
1049 | static int lmc_open (struct net_device *dev) /*fold00*/ | 983 | static int lmc_open(struct net_device *dev) |
1050 | { | 984 | { |
1051 | lmc_softc_t *sc = dev->priv; | 985 | lmc_softc_t *sc = dev_to_sc(dev); |
986 | int err; | ||
1052 | 987 | ||
1053 | lmc_trace(dev, "lmc_open in"); | 988 | lmc_trace(dev, "lmc_open in"); |
1054 | 989 | ||
1055 | lmc_led_on(sc, LMC_DS3_LED0); | 990 | lmc_led_on(sc, LMC_DS3_LED0); |
1056 | 991 | ||
1057 | lmc_dec_reset (sc); | 992 | lmc_dec_reset(sc); |
1058 | lmc_reset (sc); | 993 | lmc_reset(sc); |
1059 | |||
1060 | LMC_EVENT_LOG(LMC_EVENT_RESET1, LMC_CSR_READ (sc, csr_status), 0); | ||
1061 | LMC_EVENT_LOG(LMC_EVENT_RESET2, | ||
1062 | lmc_mii_readreg (sc, 0, 16), | ||
1063 | lmc_mii_readreg (sc, 0, 17)); | ||
1064 | 994 | ||
995 | LMC_EVENT_LOG(LMC_EVENT_RESET1, LMC_CSR_READ(sc, csr_status), 0); | ||
996 | LMC_EVENT_LOG(LMC_EVENT_RESET2, lmc_mii_readreg(sc, 0, 16), | ||
997 | lmc_mii_readreg(sc, 0, 17)); | ||
1065 | 998 | ||
1066 | if (sc->lmc_ok){ | 999 | if (sc->lmc_ok){ |
1067 | lmc_trace(dev, "lmc_open lmc_ok out"); | 1000 | lmc_trace(dev, "lmc_open lmc_ok out"); |
@@ -1106,14 +1039,14 @@ static int lmc_open (struct net_device *dev) /*fold00*/ | |||
1106 | 1039 | ||
1107 | /* dev->flags |= IFF_UP; */ | 1040 | /* dev->flags |= IFF_UP; */ |
1108 | 1041 | ||
1109 | lmc_proto_open(sc); | 1042 | if ((err = lmc_proto_open(sc)) != 0) |
1043 | return err; | ||
1110 | 1044 | ||
1111 | dev->do_ioctl = lmc_ioctl; | 1045 | dev->do_ioctl = lmc_ioctl; |
1112 | 1046 | ||
1113 | 1047 | ||
1114 | netif_start_queue(dev); | 1048 | netif_start_queue(dev); |
1115 | 1049 | sc->extra_stats.tx_tbusy0++; | |
1116 | sc->stats.tx_tbusy0++ ; | ||
1117 | 1050 | ||
1118 | /* | 1051 | /* |
1119 | * select what interrupts we want to get | 1052 | * select what interrupts we want to get |
@@ -1165,8 +1098,7 @@ static int lmc_open (struct net_device *dev) /*fold00*/ | |||
1165 | 1098 | ||
1166 | static void lmc_running_reset (struct net_device *dev) /*fold00*/ | 1099 | static void lmc_running_reset (struct net_device *dev) /*fold00*/ |
1167 | { | 1100 | { |
1168 | 1101 | lmc_softc_t *sc = dev_to_sc(dev); | |
1169 | lmc_softc_t *sc = (lmc_softc_t *) dev->priv; | ||
1170 | 1102 | ||
1171 | lmc_trace(dev, "lmc_runnig_reset in"); | 1103 | lmc_trace(dev, "lmc_runnig_reset in"); |
1172 | 1104 | ||
@@ -1184,7 +1116,7 @@ static void lmc_running_reset (struct net_device *dev) /*fold00*/ | |||
1184 | netif_wake_queue(dev); | 1116 | netif_wake_queue(dev); |
1185 | 1117 | ||
1186 | sc->lmc_txfull = 0; | 1118 | sc->lmc_txfull = 0; |
1187 | sc->stats.tx_tbusy0++ ; | 1119 | sc->extra_stats.tx_tbusy0++; |
1188 | 1120 | ||
1189 | sc->lmc_intrmask = TULIP_DEFAULT_INTR_MASK; | 1121 | sc->lmc_intrmask = TULIP_DEFAULT_INTR_MASK; |
1190 | LMC_CSR_WRITE (sc, csr_intr, sc->lmc_intrmask); | 1122 | LMC_CSR_WRITE (sc, csr_intr, sc->lmc_intrmask); |
@@ -1200,14 +1132,13 @@ static void lmc_running_reset (struct net_device *dev) /*fold00*/ | |||
1200 | * This disables the timer for the watchdog and keepalives, | 1132 | * This disables the timer for the watchdog and keepalives, |
1201 | * and disables the irq for dev. | 1133 | * and disables the irq for dev. |
1202 | */ | 1134 | */ |
1203 | static int lmc_close (struct net_device *dev) /*fold00*/ | 1135 | static int lmc_close(struct net_device *dev) |
1204 | { | 1136 | { |
1205 | /* not calling release_region() as we should */ | 1137 | /* not calling release_region() as we should */ |
1206 | lmc_softc_t *sc; | 1138 | lmc_softc_t *sc = dev_to_sc(dev); |
1207 | 1139 | ||
1208 | lmc_trace(dev, "lmc_close in"); | 1140 | lmc_trace(dev, "lmc_close in"); |
1209 | 1141 | ||
1210 | sc = dev->priv; | ||
1211 | sc->lmc_ok = 0; | 1142 | sc->lmc_ok = 0; |
1212 | sc->lmc_media->set_link_status (sc, 0); | 1143 | sc->lmc_media->set_link_status (sc, 0); |
1213 | del_timer (&sc->timer); | 1144 | del_timer (&sc->timer); |
@@ -1215,7 +1146,7 @@ static int lmc_close (struct net_device *dev) /*fold00*/ | |||
1215 | lmc_ifdown (dev); | 1146 | lmc_ifdown (dev); |
1216 | 1147 | ||
1217 | lmc_trace(dev, "lmc_close out"); | 1148 | lmc_trace(dev, "lmc_close out"); |
1218 | 1149 | ||
1219 | return 0; | 1150 | return 0; |
1220 | } | 1151 | } |
1221 | 1152 | ||
@@ -1223,16 +1154,16 @@ static int lmc_close (struct net_device *dev) /*fold00*/ | |||
1223 | /* When the interface goes down, this is called */ | 1154 | /* When the interface goes down, this is called */ |
1224 | static int lmc_ifdown (struct net_device *dev) /*fold00*/ | 1155 | static int lmc_ifdown (struct net_device *dev) /*fold00*/ |
1225 | { | 1156 | { |
1226 | lmc_softc_t *sc = dev->priv; | 1157 | lmc_softc_t *sc = dev_to_sc(dev); |
1227 | u32 csr6; | 1158 | u32 csr6; |
1228 | int i; | 1159 | int i; |
1229 | 1160 | ||
1230 | lmc_trace(dev, "lmc_ifdown in"); | 1161 | lmc_trace(dev, "lmc_ifdown in"); |
1231 | 1162 | ||
1232 | /* Don't let anything else go on right now */ | 1163 | /* Don't let anything else go on right now */ |
1233 | // dev->start = 0; | 1164 | // dev->start = 0; |
1234 | netif_stop_queue(dev); | 1165 | netif_stop_queue(dev); |
1235 | sc->stats.tx_tbusy1++ ; | 1166 | sc->extra_stats.tx_tbusy1++; |
1236 | 1167 | ||
1237 | /* stop interrupts */ | 1168 | /* stop interrupts */ |
1238 | /* Clear the interrupt mask */ | 1169 | /* Clear the interrupt mask */ |
@@ -1244,8 +1175,8 @@ static int lmc_ifdown (struct net_device *dev) /*fold00*/ | |||
1244 | csr6 &= ~LMC_DEC_SR; /* Turn off the Receive bit */ | 1175 | csr6 &= ~LMC_DEC_SR; /* Turn off the Receive bit */ |
1245 | LMC_CSR_WRITE (sc, csr_command, csr6); | 1176 | LMC_CSR_WRITE (sc, csr_command, csr6); |
1246 | 1177 | ||
1247 | sc->stats.rx_missed_errors += | 1178 | sc->lmc_device->stats.rx_missed_errors += |
1248 | LMC_CSR_READ (sc, csr_missed_frames) & 0xffff; | 1179 | LMC_CSR_READ(sc, csr_missed_frames) & 0xffff; |
1249 | 1180 | ||
1250 | /* release the interrupt */ | 1181 | /* release the interrupt */ |
1251 | if(sc->got_irq == 1){ | 1182 | if(sc->got_irq == 1){ |
@@ -1276,7 +1207,7 @@ static int lmc_ifdown (struct net_device *dev) /*fold00*/ | |||
1276 | lmc_led_off (sc, LMC_MII16_LED_ALL); | 1207 | lmc_led_off (sc, LMC_MII16_LED_ALL); |
1277 | 1208 | ||
1278 | netif_wake_queue(dev); | 1209 | netif_wake_queue(dev); |
1279 | sc->stats.tx_tbusy0++ ; | 1210 | sc->extra_stats.tx_tbusy0++; |
1280 | 1211 | ||
1281 | lmc_trace(dev, "lmc_ifdown out"); | 1212 | lmc_trace(dev, "lmc_ifdown out"); |
1282 | 1213 | ||
@@ -1289,7 +1220,7 @@ static int lmc_ifdown (struct net_device *dev) /*fold00*/ | |||
1289 | static irqreturn_t lmc_interrupt (int irq, void *dev_instance) /*fold00*/ | 1220 | static irqreturn_t lmc_interrupt (int irq, void *dev_instance) /*fold00*/ |
1290 | { | 1221 | { |
1291 | struct net_device *dev = (struct net_device *) dev_instance; | 1222 | struct net_device *dev = (struct net_device *) dev_instance; |
1292 | lmc_softc_t *sc; | 1223 | lmc_softc_t *sc = dev_to_sc(dev); |
1293 | u32 csr; | 1224 | u32 csr; |
1294 | int i; | 1225 | int i; |
1295 | s32 stat; | 1226 | s32 stat; |
@@ -1300,8 +1231,6 @@ static irqreturn_t lmc_interrupt (int irq, void *dev_instance) /*fold00*/ | |||
1300 | 1231 | ||
1301 | lmc_trace(dev, "lmc_interrupt in"); | 1232 | lmc_trace(dev, "lmc_interrupt in"); |
1302 | 1233 | ||
1303 | sc = dev->priv; | ||
1304 | |||
1305 | spin_lock(&sc->lmc_lock); | 1234 | spin_lock(&sc->lmc_lock); |
1306 | 1235 | ||
1307 | /* | 1236 | /* |
@@ -1354,7 +1283,7 @@ static irqreturn_t lmc_interrupt (int irq, void *dev_instance) /*fold00*/ | |||
1354 | 1283 | ||
1355 | int n_compl = 0 ; | 1284 | int n_compl = 0 ; |
1356 | /* reset the transmit timeout detection flag -baz */ | 1285 | /* reset the transmit timeout detection flag -baz */ |
1357 | sc->stats.tx_NoCompleteCnt = 0; | 1286 | sc->extra_stats.tx_NoCompleteCnt = 0; |
1358 | 1287 | ||
1359 | badtx = sc->lmc_taint_tx; | 1288 | badtx = sc->lmc_taint_tx; |
1360 | i = badtx % LMC_TXDESCS; | 1289 | i = badtx % LMC_TXDESCS; |
@@ -1378,27 +1307,25 @@ static irqreturn_t lmc_interrupt (int irq, void *dev_instance) /*fold00*/ | |||
1378 | if (sc->lmc_txq[i] == NULL) | 1307 | if (sc->lmc_txq[i] == NULL) |
1379 | continue; | 1308 | continue; |
1380 | 1309 | ||
1381 | /* | 1310 | /* |
1382 | * Check the total error summary to look for any errors | 1311 | * Check the total error summary to look for any errors |
1383 | */ | 1312 | */ |
1384 | if (stat & 0x8000) { | 1313 | if (stat & 0x8000) { |
1385 | sc->stats.tx_errors++; | 1314 | sc->lmc_device->stats.tx_errors++; |
1386 | if (stat & 0x4104) | 1315 | if (stat & 0x4104) |
1387 | sc->stats.tx_aborted_errors++; | 1316 | sc->lmc_device->stats.tx_aborted_errors++; |
1388 | if (stat & 0x0C00) | 1317 | if (stat & 0x0C00) |
1389 | sc->stats.tx_carrier_errors++; | 1318 | sc->lmc_device->stats.tx_carrier_errors++; |
1390 | if (stat & 0x0200) | 1319 | if (stat & 0x0200) |
1391 | sc->stats.tx_window_errors++; | 1320 | sc->lmc_device->stats.tx_window_errors++; |
1392 | if (stat & 0x0002) | 1321 | if (stat & 0x0002) |
1393 | sc->stats.tx_fifo_errors++; | 1322 | sc->lmc_device->stats.tx_fifo_errors++; |
1394 | } | 1323 | } else { |
1395 | else { | 1324 | sc->lmc_device->stats.tx_bytes += sc->lmc_txring[i].length & 0x7ff; |
1396 | 1325 | ||
1397 | sc->stats.tx_bytes += sc->lmc_txring[i].length & 0x7ff; | 1326 | sc->lmc_device->stats.tx_packets++; |
1398 | |||
1399 | sc->stats.tx_packets++; | ||
1400 | } | 1327 | } |
1401 | 1328 | ||
1402 | // dev_kfree_skb(sc->lmc_txq[i]); | 1329 | // dev_kfree_skb(sc->lmc_txq[i]); |
1403 | dev_kfree_skb_irq(sc->lmc_txq[i]); | 1330 | dev_kfree_skb_irq(sc->lmc_txq[i]); |
1404 | sc->lmc_txq[i] = NULL; | 1331 | sc->lmc_txq[i] = NULL; |
@@ -1415,13 +1342,13 @@ static irqreturn_t lmc_interrupt (int irq, void *dev_instance) /*fold00*/ | |||
1415 | LMC_EVENT_LOG(LMC_EVENT_TBUSY0, n_compl, 0); | 1342 | LMC_EVENT_LOG(LMC_EVENT_TBUSY0, n_compl, 0); |
1416 | sc->lmc_txfull = 0; | 1343 | sc->lmc_txfull = 0; |
1417 | netif_wake_queue(dev); | 1344 | netif_wake_queue(dev); |
1418 | sc->stats.tx_tbusy0++ ; | 1345 | sc->extra_stats.tx_tbusy0++; |
1419 | 1346 | ||
1420 | 1347 | ||
1421 | #ifdef DEBUG | 1348 | #ifdef DEBUG |
1422 | sc->stats.dirtyTx = badtx; | 1349 | sc->extra_stats.dirtyTx = badtx; |
1423 | sc->stats.lmc_next_tx = sc->lmc_next_tx; | 1350 | sc->extra_stats.lmc_next_tx = sc->lmc_next_tx; |
1424 | sc->stats.lmc_txfull = sc->lmc_txfull; | 1351 | sc->extra_stats.lmc_txfull = sc->lmc_txfull; |
1425 | #endif | 1352 | #endif |
1426 | sc->lmc_taint_tx = badtx; | 1353 | sc->lmc_taint_tx = badtx; |
1427 | 1354 | ||
@@ -1476,9 +1403,9 @@ lmc_int_fail_out: | |||
1476 | return IRQ_RETVAL(handled); | 1403 | return IRQ_RETVAL(handled); |
1477 | } | 1404 | } |
1478 | 1405 | ||
1479 | static int lmc_start_xmit (struct sk_buff *skb, struct net_device *dev) /*fold00*/ | 1406 | static int lmc_start_xmit(struct sk_buff *skb, struct net_device *dev) |
1480 | { | 1407 | { |
1481 | lmc_softc_t *sc; | 1408 | lmc_softc_t *sc = dev_to_sc(dev); |
1482 | u32 flag; | 1409 | u32 flag; |
1483 | int entry; | 1410 | int entry; |
1484 | int ret = 0; | 1411 | int ret = 0; |
@@ -1486,8 +1413,6 @@ static int lmc_start_xmit (struct sk_buff *skb, struct net_device *dev) /*fold00 | |||
1486 | 1413 | ||
1487 | lmc_trace(dev, "lmc_start_xmit in"); | 1414 | lmc_trace(dev, "lmc_start_xmit in"); |
1488 | 1415 | ||
1489 | sc = dev->priv; | ||
1490 | |||
1491 | spin_lock_irqsave(&sc->lmc_lock, flags); | 1416 | spin_lock_irqsave(&sc->lmc_lock, flags); |
1492 | 1417 | ||
1493 | /* normal path, tbusy known to be zero */ | 1418 | /* normal path, tbusy known to be zero */ |
@@ -1532,8 +1457,8 @@ static int lmc_start_xmit (struct sk_buff *skb, struct net_device *dev) /*fold00 | |||
1532 | if (sc->lmc_next_tx - sc->lmc_taint_tx >= LMC_TXDESCS - 1) | 1457 | if (sc->lmc_next_tx - sc->lmc_taint_tx >= LMC_TXDESCS - 1) |
1533 | { /* ring full, go busy */ | 1458 | { /* ring full, go busy */ |
1534 | sc->lmc_txfull = 1; | 1459 | sc->lmc_txfull = 1; |
1535 | netif_stop_queue(dev); | 1460 | netif_stop_queue(dev); |
1536 | sc->stats.tx_tbusy1++ ; | 1461 | sc->extra_stats.tx_tbusy1++; |
1537 | LMC_EVENT_LOG(LMC_EVENT_TBUSY1, entry, 0); | 1462 | LMC_EVENT_LOG(LMC_EVENT_TBUSY1, entry, 0); |
1538 | } | 1463 | } |
1539 | #endif | 1464 | #endif |
@@ -1550,7 +1475,7 @@ static int lmc_start_xmit (struct sk_buff *skb, struct net_device *dev) /*fold00 | |||
1550 | * the watchdog timer handler. -baz | 1475 | * the watchdog timer handler. -baz |
1551 | */ | 1476 | */ |
1552 | 1477 | ||
1553 | sc->stats.tx_NoCompleteCnt++; | 1478 | sc->extra_stats.tx_NoCompleteCnt++; |
1554 | sc->lmc_next_tx++; | 1479 | sc->lmc_next_tx++; |
1555 | 1480 | ||
1556 | /* give ownership to the chip */ | 1481 | /* give ownership to the chip */ |
@@ -1569,9 +1494,9 @@ static int lmc_start_xmit (struct sk_buff *skb, struct net_device *dev) /*fold00 | |||
1569 | } | 1494 | } |
1570 | 1495 | ||
1571 | 1496 | ||
1572 | static int lmc_rx (struct net_device *dev) /*fold00*/ | 1497 | static int lmc_rx(struct net_device *dev) |
1573 | { | 1498 | { |
1574 | lmc_softc_t *sc; | 1499 | lmc_softc_t *sc = dev_to_sc(dev); |
1575 | int i; | 1500 | int i; |
1576 | int rx_work_limit = LMC_RXDESCS; | 1501 | int rx_work_limit = LMC_RXDESCS; |
1577 | unsigned int next_rx; | 1502 | unsigned int next_rx; |
@@ -1583,8 +1508,6 @@ static int lmc_rx (struct net_device *dev) /*fold00*/ | |||
1583 | 1508 | ||
1584 | lmc_trace(dev, "lmc_rx in"); | 1509 | lmc_trace(dev, "lmc_rx in"); |
1585 | 1510 | ||
1586 | sc = dev->priv; | ||
1587 | |||
1588 | lmc_led_on(sc, LMC_DS3_LED3); | 1511 | lmc_led_on(sc, LMC_DS3_LED3); |
1589 | 1512 | ||
1590 | rxIntLoopCnt = 0; /* debug -baz */ | 1513 | rxIntLoopCnt = 0; /* debug -baz */ |
@@ -1597,39 +1520,38 @@ static int lmc_rx (struct net_device *dev) /*fold00*/ | |||
1597 | rxIntLoopCnt++; /* debug -baz */ | 1520 | rxIntLoopCnt++; /* debug -baz */ |
1598 | len = ((stat & LMC_RDES_FRAME_LENGTH) >> RDES_FRAME_LENGTH_BIT_NUMBER); | 1521 | len = ((stat & LMC_RDES_FRAME_LENGTH) >> RDES_FRAME_LENGTH_BIT_NUMBER); |
1599 | if ((stat & 0x0300) != 0x0300) { /* Check first segment and last segment */ | 1522 | if ((stat & 0x0300) != 0x0300) { /* Check first segment and last segment */ |
1600 | if ((stat & 0x0000ffff) != 0x7fff) { | 1523 | if ((stat & 0x0000ffff) != 0x7fff) { |
1601 | /* Oversized frame */ | 1524 | /* Oversized frame */ |
1602 | sc->stats.rx_length_errors++; | 1525 | sc->lmc_device->stats.rx_length_errors++; |
1603 | goto skip_packet; | 1526 | goto skip_packet; |
1604 | } | 1527 | } |
1605 | } | 1528 | } |
1606 | |||
1607 | if(stat & 0x00000008){ /* Catch a dribbling bit error */ | ||
1608 | sc->stats.rx_errors++; | ||
1609 | sc->stats.rx_frame_errors++; | ||
1610 | goto skip_packet; | ||
1611 | } | ||
1612 | 1529 | ||
1530 | if (stat & 0x00000008) { /* Catch a dribbling bit error */ | ||
1531 | sc->lmc_device->stats.rx_errors++; | ||
1532 | sc->lmc_device->stats.rx_frame_errors++; | ||
1533 | goto skip_packet; | ||
1534 | } | ||
1613 | 1535 | ||
1614 | if(stat & 0x00000004){ /* Catch a CRC error by the Xilinx */ | ||
1615 | sc->stats.rx_errors++; | ||
1616 | sc->stats.rx_crc_errors++; | ||
1617 | goto skip_packet; | ||
1618 | } | ||
1619 | 1536 | ||
1537 | if (stat & 0x00000004) { /* Catch a CRC error by the Xilinx */ | ||
1538 | sc->lmc_device->stats.rx_errors++; | ||
1539 | sc->lmc_device->stats.rx_crc_errors++; | ||
1540 | goto skip_packet; | ||
1541 | } | ||
1620 | 1542 | ||
1621 | if (len > LMC_PKT_BUF_SZ){ | 1543 | if (len > LMC_PKT_BUF_SZ) { |
1622 | sc->stats.rx_length_errors++; | 1544 | sc->lmc_device->stats.rx_length_errors++; |
1623 | localLengthErrCnt++; | 1545 | localLengthErrCnt++; |
1624 | goto skip_packet; | 1546 | goto skip_packet; |
1625 | } | 1547 | } |
1626 | 1548 | ||
1627 | if (len < sc->lmc_crcSize + 2) { | 1549 | if (len < sc->lmc_crcSize + 2) { |
1628 | sc->stats.rx_length_errors++; | 1550 | sc->lmc_device->stats.rx_length_errors++; |
1629 | sc->stats.rx_SmallPktCnt++; | 1551 | sc->extra_stats.rx_SmallPktCnt++; |
1630 | localLengthErrCnt++; | 1552 | localLengthErrCnt++; |
1631 | goto skip_packet; | 1553 | goto skip_packet; |
1632 | } | 1554 | } |
1633 | 1555 | ||
1634 | if(stat & 0x00004000){ | 1556 | if(stat & 0x00004000){ |
1635 | printk(KERN_WARNING "%s: Receiver descriptor error, receiver out of sync?\n", dev->name); | 1557 | printk(KERN_WARNING "%s: Receiver descriptor error, receiver out of sync?\n", dev->name); |
@@ -1656,8 +1578,8 @@ static int lmc_rx (struct net_device *dev) /*fold00*/ | |||
1656 | } | 1578 | } |
1657 | 1579 | ||
1658 | dev->last_rx = jiffies; | 1580 | dev->last_rx = jiffies; |
1659 | sc->stats.rx_packets++; | 1581 | sc->lmc_device->stats.rx_packets++; |
1660 | sc->stats.rx_bytes += len; | 1582 | sc->lmc_device->stats.rx_bytes += len; |
1661 | 1583 | ||
1662 | LMC_CONSOLE_LOG("recv", skb->data, len); | 1584 | LMC_CONSOLE_LOG("recv", skb->data, len); |
1663 | 1585 | ||
@@ -1679,7 +1601,6 @@ static int lmc_rx (struct net_device *dev) /*fold00*/ | |||
1679 | 1601 | ||
1680 | skb_put (skb, len); | 1602 | skb_put (skb, len); |
1681 | skb->protocol = lmc_proto_type(sc, skb); | 1603 | skb->protocol = lmc_proto_type(sc, skb); |
1682 | skb->protocol = htons(ETH_P_WAN_PPP); | ||
1683 | skb_reset_mac_header(skb); | 1604 | skb_reset_mac_header(skb); |
1684 | /* skb_reset_network_header(skb); */ | 1605 | /* skb_reset_network_header(skb); */ |
1685 | skb->dev = dev; | 1606 | skb->dev = dev; |
@@ -1704,7 +1625,7 @@ static int lmc_rx (struct net_device *dev) /*fold00*/ | |||
1704 | * in which care we'll try to allocate the buffer | 1625 | * in which care we'll try to allocate the buffer |
1705 | * again. (once a second) | 1626 | * again. (once a second) |
1706 | */ | 1627 | */ |
1707 | sc->stats.rx_BuffAllocErr++; | 1628 | sc->extra_stats.rx_BuffAllocErr++; |
1708 | LMC_EVENT_LOG(LMC_EVENT_RCVINT, stat, len); | 1629 | LMC_EVENT_LOG(LMC_EVENT_RCVINT, stat, len); |
1709 | sc->failed_recv_alloc = 1; | 1630 | sc->failed_recv_alloc = 1; |
1710 | goto skip_out_of_mem; | 1631 | goto skip_out_of_mem; |
@@ -1739,16 +1660,14 @@ static int lmc_rx (struct net_device *dev) /*fold00*/ | |||
1739 | * descriptors with bogus packets | 1660 | * descriptors with bogus packets |
1740 | * | 1661 | * |
1741 | if (localLengthErrCnt > LMC_RXDESCS - 3) { | 1662 | if (localLengthErrCnt > LMC_RXDESCS - 3) { |
1742 | sc->stats.rx_BadPktSurgeCnt++; | 1663 | sc->extra_stats.rx_BadPktSurgeCnt++; |
1743 | LMC_EVENT_LOG(LMC_EVENT_BADPKTSURGE, | 1664 | LMC_EVENT_LOG(LMC_EVENT_BADPKTSURGE, localLengthErrCnt, |
1744 | localLengthErrCnt, | 1665 | sc->extra_stats.rx_BadPktSurgeCnt); |
1745 | sc->stats.rx_BadPktSurgeCnt); | ||
1746 | } */ | 1666 | } */ |
1747 | 1667 | ||
1748 | /* save max count of receive descriptors serviced */ | 1668 | /* save max count of receive descriptors serviced */ |
1749 | if (rxIntLoopCnt > sc->stats.rxIntLoopCnt) { | 1669 | if (rxIntLoopCnt > sc->extra_stats.rxIntLoopCnt) |
1750 | sc->stats.rxIntLoopCnt = rxIntLoopCnt; /* debug -baz */ | 1670 | sc->extra_stats.rxIntLoopCnt = rxIntLoopCnt; /* debug -baz */ |
1751 | } | ||
1752 | 1671 | ||
1753 | #ifdef DEBUG | 1672 | #ifdef DEBUG |
1754 | if (rxIntLoopCnt == 0) | 1673 | if (rxIntLoopCnt == 0) |
@@ -1775,23 +1694,22 @@ skip_out_of_mem: | |||
1775 | return 0; | 1694 | return 0; |
1776 | } | 1695 | } |
1777 | 1696 | ||
1778 | static struct net_device_stats *lmc_get_stats (struct net_device *dev) /*fold00*/ | 1697 | static struct net_device_stats *lmc_get_stats(struct net_device *dev) |
1779 | { | 1698 | { |
1780 | lmc_softc_t *sc = dev->priv; | 1699 | lmc_softc_t *sc = dev_to_sc(dev); |
1781 | unsigned long flags; | 1700 | unsigned long flags; |
1782 | 1701 | ||
1783 | lmc_trace(dev, "lmc_get_stats in"); | 1702 | lmc_trace(dev, "lmc_get_stats in"); |
1784 | 1703 | ||
1785 | |||
1786 | spin_lock_irqsave(&sc->lmc_lock, flags); | 1704 | spin_lock_irqsave(&sc->lmc_lock, flags); |
1787 | 1705 | ||
1788 | sc->stats.rx_missed_errors += LMC_CSR_READ (sc, csr_missed_frames) & 0xffff; | 1706 | sc->lmc_device->stats.rx_missed_errors += LMC_CSR_READ(sc, csr_missed_frames) & 0xffff; |
1789 | 1707 | ||
1790 | spin_unlock_irqrestore(&sc->lmc_lock, flags); | 1708 | spin_unlock_irqrestore(&sc->lmc_lock, flags); |
1791 | 1709 | ||
1792 | lmc_trace(dev, "lmc_get_stats out"); | 1710 | lmc_trace(dev, "lmc_get_stats out"); |
1793 | 1711 | ||
1794 | return (struct net_device_stats *) &sc->stats; | 1712 | return &sc->lmc_device->stats; |
1795 | } | 1713 | } |
1796 | 1714 | ||
1797 | static struct pci_driver lmc_driver = { | 1715 | static struct pci_driver lmc_driver = { |
@@ -1970,7 +1888,7 @@ static void lmc_softreset (lmc_softc_t * const sc) /*fold00*/ | |||
1970 | { | 1888 | { |
1971 | if (sc->lmc_txq[i] != NULL){ /* have buffer */ | 1889 | if (sc->lmc_txq[i] != NULL){ /* have buffer */ |
1972 | dev_kfree_skb(sc->lmc_txq[i]); /* free it */ | 1890 | dev_kfree_skb(sc->lmc_txq[i]); /* free it */ |
1973 | sc->stats.tx_dropped++; /* We just dropped a packet */ | 1891 | sc->lmc_device->stats.tx_dropped++; /* We just dropped a packet */ |
1974 | } | 1892 | } |
1975 | sc->lmc_txq[i] = NULL; | 1893 | sc->lmc_txq[i] = NULL; |
1976 | sc->lmc_txring[i].status = 0x00000000; | 1894 | sc->lmc_txring[i].status = 0x00000000; |
@@ -1982,7 +1900,7 @@ static void lmc_softreset (lmc_softc_t * const sc) /*fold00*/ | |||
1982 | lmc_trace(sc->lmc_device, "lmc_softreset out"); | 1900 | lmc_trace(sc->lmc_device, "lmc_softreset out"); |
1983 | } | 1901 | } |
1984 | 1902 | ||
1985 | void lmc_gpio_mkinput(lmc_softc_t * const sc, u_int32_t bits) /*fold00*/ | 1903 | void lmc_gpio_mkinput(lmc_softc_t * const sc, u32 bits) /*fold00*/ |
1986 | { | 1904 | { |
1987 | lmc_trace(sc->lmc_device, "lmc_gpio_mkinput in"); | 1905 | lmc_trace(sc->lmc_device, "lmc_gpio_mkinput in"); |
1988 | sc->lmc_gpio_io &= ~bits; | 1906 | sc->lmc_gpio_io &= ~bits; |
@@ -1990,7 +1908,7 @@ void lmc_gpio_mkinput(lmc_softc_t * const sc, u_int32_t bits) /*fold00*/ | |||
1990 | lmc_trace(sc->lmc_device, "lmc_gpio_mkinput out"); | 1908 | lmc_trace(sc->lmc_device, "lmc_gpio_mkinput out"); |
1991 | } | 1909 | } |
1992 | 1910 | ||
1993 | void lmc_gpio_mkoutput(lmc_softc_t * const sc, u_int32_t bits) /*fold00*/ | 1911 | void lmc_gpio_mkoutput(lmc_softc_t * const sc, u32 bits) /*fold00*/ |
1994 | { | 1912 | { |
1995 | lmc_trace(sc->lmc_device, "lmc_gpio_mkoutput in"); | 1913 | lmc_trace(sc->lmc_device, "lmc_gpio_mkoutput in"); |
1996 | sc->lmc_gpio_io |= bits; | 1914 | sc->lmc_gpio_io |= bits; |
@@ -1998,7 +1916,7 @@ void lmc_gpio_mkoutput(lmc_softc_t * const sc, u_int32_t bits) /*fold00*/ | |||
1998 | lmc_trace(sc->lmc_device, "lmc_gpio_mkoutput out"); | 1916 | lmc_trace(sc->lmc_device, "lmc_gpio_mkoutput out"); |
1999 | } | 1917 | } |
2000 | 1918 | ||
2001 | void lmc_led_on(lmc_softc_t * const sc, u_int32_t led) /*fold00*/ | 1919 | void lmc_led_on(lmc_softc_t * const sc, u32 led) /*fold00*/ |
2002 | { | 1920 | { |
2003 | lmc_trace(sc->lmc_device, "lmc_led_on in"); | 1921 | lmc_trace(sc->lmc_device, "lmc_led_on in"); |
2004 | if((~sc->lmc_miireg16) & led){ /* Already on! */ | 1922 | if((~sc->lmc_miireg16) & led){ /* Already on! */ |
@@ -2011,7 +1929,7 @@ void lmc_led_on(lmc_softc_t * const sc, u_int32_t led) /*fold00*/ | |||
2011 | lmc_trace(sc->lmc_device, "lmc_led_on out"); | 1929 | lmc_trace(sc->lmc_device, "lmc_led_on out"); |
2012 | } | 1930 | } |
2013 | 1931 | ||
2014 | void lmc_led_off(lmc_softc_t * const sc, u_int32_t led) /*fold00*/ | 1932 | void lmc_led_off(lmc_softc_t * const sc, u32 led) /*fold00*/ |
2015 | { | 1933 | { |
2016 | lmc_trace(sc->lmc_device, "lmc_led_off in"); | 1934 | lmc_trace(sc->lmc_device, "lmc_led_off in"); |
2017 | if(sc->lmc_miireg16 & led){ /* Already set don't do anything */ | 1935 | if(sc->lmc_miireg16 & led){ /* Already set don't do anything */ |
@@ -2061,13 +1979,13 @@ static void lmc_reset(lmc_softc_t * const sc) /*fold00*/ | |||
2061 | */ | 1979 | */ |
2062 | sc->lmc_media->init(sc); | 1980 | sc->lmc_media->init(sc); |
2063 | 1981 | ||
2064 | sc->stats.resetCount++; | 1982 | sc->extra_stats.resetCount++; |
2065 | lmc_trace(sc->lmc_device, "lmc_reset out"); | 1983 | lmc_trace(sc->lmc_device, "lmc_reset out"); |
2066 | } | 1984 | } |
2067 | 1985 | ||
2068 | static void lmc_dec_reset(lmc_softc_t * const sc) /*fold00*/ | 1986 | static void lmc_dec_reset(lmc_softc_t * const sc) /*fold00*/ |
2069 | { | 1987 | { |
2070 | u_int32_t val; | 1988 | u32 val; |
2071 | lmc_trace(sc->lmc_device, "lmc_dec_reset in"); | 1989 | lmc_trace(sc->lmc_device, "lmc_dec_reset in"); |
2072 | 1990 | ||
2073 | /* | 1991 | /* |
@@ -2151,23 +2069,21 @@ static void lmc_initcsrs(lmc_softc_t * const sc, lmc_csrptr_t csr_base, /*fold00 | |||
2151 | lmc_trace(sc->lmc_device, "lmc_initcsrs out"); | 2069 | lmc_trace(sc->lmc_device, "lmc_initcsrs out"); |
2152 | } | 2070 | } |
2153 | 2071 | ||
2154 | static void lmc_driver_timeout(struct net_device *dev) { /*fold00*/ | 2072 | static void lmc_driver_timeout(struct net_device *dev) |
2155 | lmc_softc_t *sc; | 2073 | { |
2074 | lmc_softc_t *sc = dev_to_sc(dev); | ||
2156 | u32 csr6; | 2075 | u32 csr6; |
2157 | unsigned long flags; | 2076 | unsigned long flags; |
2158 | 2077 | ||
2159 | lmc_trace(dev, "lmc_driver_timeout in"); | 2078 | lmc_trace(dev, "lmc_driver_timeout in"); |
2160 | 2079 | ||
2161 | sc = dev->priv; | ||
2162 | |||
2163 | spin_lock_irqsave(&sc->lmc_lock, flags); | 2080 | spin_lock_irqsave(&sc->lmc_lock, flags); |
2164 | 2081 | ||
2165 | printk("%s: Xmitter busy|\n", dev->name); | 2082 | printk("%s: Xmitter busy|\n", dev->name); |
2166 | 2083 | ||
2167 | sc->stats.tx_tbusy_calls++ ; | 2084 | sc->extra_stats.tx_tbusy_calls++; |
2168 | if (jiffies - dev->trans_start < TX_TIMEOUT) { | 2085 | if (jiffies - dev->trans_start < TX_TIMEOUT) |
2169 | goto bug_out; | 2086 | goto bug_out; |
2170 | } | ||
2171 | 2087 | ||
2172 | /* | 2088 | /* |
2173 | * Chip seems to have locked up | 2089 | * Chip seems to have locked up |
@@ -2178,7 +2094,7 @@ static void lmc_driver_timeout(struct net_device *dev) { /*fold00*/ | |||
2178 | 2094 | ||
2179 | LMC_EVENT_LOG(LMC_EVENT_XMTPRCTMO, | 2095 | LMC_EVENT_LOG(LMC_EVENT_XMTPRCTMO, |
2180 | LMC_CSR_READ (sc, csr_status), | 2096 | LMC_CSR_READ (sc, csr_status), |
2181 | sc->stats.tx_ProcTimeout); | 2097 | sc->extra_stats.tx_ProcTimeout); |
2182 | 2098 | ||
2183 | lmc_running_reset (dev); | 2099 | lmc_running_reset (dev); |
2184 | 2100 | ||
@@ -2195,8 +2111,8 @@ static void lmc_driver_timeout(struct net_device *dev) { /*fold00*/ | |||
2195 | /* immediate transmit */ | 2111 | /* immediate transmit */ |
2196 | LMC_CSR_WRITE (sc, csr_txpoll, 0); | 2112 | LMC_CSR_WRITE (sc, csr_txpoll, 0); |
2197 | 2113 | ||
2198 | sc->stats.tx_errors++; | 2114 | sc->lmc_device->stats.tx_errors++; |
2199 | sc->stats.tx_ProcTimeout++; /* -baz */ | 2115 | sc->extra_stats.tx_ProcTimeout++; /* -baz */ |
2200 | 2116 | ||
2201 | dev->trans_start = jiffies; | 2117 | dev->trans_start = jiffies; |
2202 | 2118 | ||