13 #include <linux/pci.h>
20 #ifdef CONFIG_TULIP_NAPI_HW_MITIGATION
24 static unsigned int mit_table[MIT_SIZE+1] =
97 #ifdef CONFIG_TULIP_NAPI
103 napi_schedule(&tp->
napi);
112 #ifdef CONFIG_TULIP_NAPI_HW_MITIGATION
116 #ifdef CONFIG_TULIP_NAPI_HW_MITIGATION
125 netdev_dbg(dev,
" In tulip_rx(), entry %d %08x\n",
126 entry, tp->
rx_ring[entry].status);
130 netdev_dbg(dev,
" In tulip_poll(), hardware disappeared\n");
146 netdev_dbg(dev,
"In tulip_rx(), entry %d %08x\n",
149 if (++work_done >= budget)
157 pkt_len = ((status >> 16) & 0x7ff) - 4;
175 if ((status & 0xffff) != 0x7fff) {
178 "Oversized Ethernet frame spanned multiple buffers, status %08x!\n",
180 dev->
stats.rx_length_errors++;
185 netdev_dbg(dev,
"Receive error, Rx status %08x\n",
187 dev->
stats.rx_errors++;
188 if (pkt_len > 1518 ||
190 dev->
stats.rx_length_errors++;
193 dev->
stats.rx_frame_errors++;
195 dev->
stats.rx_crc_errors++;
197 dev->
stats.rx_fifo_errors++;
205 (skb = netdev_alloc_skb(dev, pkt_len + 2)) !=
NULL) {
207 pci_dma_sync_single_for_cpu(tp->
pdev,
210 #if ! defined(__alpha__)
211 skb_copy_to_linear_data(skb, tp->
rx_buffers[entry].skb->data,
219 pci_dma_sync_single_for_device(tp->
pdev,
226 #ifndef final_version
230 "Internal fault: The skbuff addresses do not match in tulip_rx: %08x vs. %08llx %p / %p\n",
232 (
unsigned long long)tp->
rx_buffers[entry].mapping,
247 dev->
stats.rx_packets++;
250 #ifdef CONFIG_TULIP_NAPI_HW_MITIGATION
272 #ifdef CONFIG_TULIP_NAPI_HW_MITIGATION
367 netdev_dbg(dev,
"In tulip_rx(), entry %d %08x\n",
368 entry, tp->
rx_ring[entry].status);
375 netdev_dbg(dev,
"In tulip_rx(), entry %d %08x\n",
377 if (--rx_work_limit < 0)
385 pkt_len = ((status >> 16) & 0x7ff) - 4;
402 if ((status & 0xffff) != 0x7fff) {
405 "Oversized Ethernet frame spanned multiple buffers, status %08x!\n",
407 dev->
stats.rx_length_errors++;
412 netdev_dbg(dev,
"Receive error, Rx status %08x\n",
414 dev->
stats.rx_errors++;
415 if (pkt_len > 1518 ||
416 (status & RxDescRunt))
417 dev->
stats.rx_length_errors++;
419 dev->
stats.rx_frame_errors++;
421 dev->
stats.rx_crc_errors++;
423 dev->
stats.rx_fifo_errors++;
431 (skb = netdev_alloc_skb(dev, pkt_len + 2)) !=
NULL) {
433 pci_dma_sync_single_for_cpu(tp->
pdev,
436 #if ! defined(__alpha__)
437 skb_copy_to_linear_data(skb, tp->
rx_buffers[entry].skb->data,
445 pci_dma_sync_single_for_device(tp->
pdev,
452 #ifndef final_version
456 "Internal fault: The skbuff addresses do not match in tulip_rx: %08x vs. %Lx %p / %p\n",
473 dev->
stats.rx_packets++;
483 static inline unsigned int phy_interrupt (
struct net_device *dev)
494 spin_lock(&tp->
lock);
496 spin_unlock(&tp->
lock);
522 #ifdef CONFIG_TULIP_NAPI
528 unsigned int handled = 0;
534 handled = phy_interrupt (dev);
543 #ifdef CONFIG_TULIP_NAPI
545 if (!rxd && (csr5 & (RxIntr |
RxNoBuf))) {
549 napi_schedule(&tp->
napi);
565 if (csr5 & (RxIntr |
RxNoBuf)) {
573 netdev_dbg(dev,
"interrupt csr5=%#8.8x new csr5=%#8.8x\n",
580 spin_lock(&tp->
lock);
594 pci_unmap_single(tp->
pdev,
601 if (status & 0x8000) {
603 #ifndef final_version
605 netdev_dbg(dev,
"Transmit error, Tx status %08x\n",
608 dev->
stats.tx_errors++;
610 dev->
stats.tx_aborted_errors++;
612 dev->
stats.tx_carrier_errors++;
614 dev->
stats.tx_window_errors++;
616 dev->
stats.tx_fifo_errors++;
618 dev->
stats.tx_heartbeat_errors++;
620 dev->
stats.tx_bytes +=
622 dev->
stats.collisions += (status >> 3) & 15;
623 dev->
stats.tx_packets++;
637 #ifndef final_version
640 "Out-of-sync dirty pointer, %d vs. %d\n",
647 netif_wake_queue(dev);
653 "The transmitter stopped. CSR5 is %x, CSR6 %x, new CSR6 %x\n",
656 tulip_restart_rxtx(tp);
658 spin_unlock(&tp->
lock);
663 if (csr5 == 0xffffffff)
666 dev->
stats.tx_errors++;
668 if ((tp->
csr6 & 0xC000) != 0xC000)
671 tp->
csr6 |= 0x00200000;
673 tulip_restart_rxtx(tp);
684 dev->
stats.rx_errors++;
685 tulip_start_rxtx(tp);
696 int error = (csr5 >> 23) & 7;
708 "(%lu) System Error occurred (%d)\n",
719 "Re-enabling interrupts, %08x\n",
725 if (tx > maxtx || rx > maxrx || oi > maxoi) {
727 dev_warn(&dev->
dev,
"Too much work during an interrupt, csr5=0x%08x. (%lu) (%d,%d,%d)\n",
728 csr5, tp->
nir, tx, rx, oi);
743 iowrite32(((~csr5) & 0x0001ebef) | AbnormalIntr | TimerInt, ioaddr +
CSR7);
755 #ifdef CONFIG_TULIP_NAPI
778 "in rx suspend mode: (%lu) (tp->cur_rx = %u, ttimer = %d, rx = %d) go/stay in suspend mode\n",
787 "in rx suspend mode: (%lu) set timer\n",
800 dev->
stats.rx_dropped += missed & 0x10000 ? 0x10000 : missed;
804 netdev_dbg(dev,
"exiting interrupt, csr5=%#04x\n",