diff options
author | David S. Miller <davem@davemloft.net> | 2005-05-19 01:46:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-05-19 01:46:34 -0400 |
commit | fac9b83ea79aa3112ed245d9a4fc2a5c3ec2b7ec (patch) | |
tree | 14749e6e5e0abdfb707b41dad714e36246e6cff8 /drivers/net/tg3.c | |
parent | 05d3794aa8bd3b2c9f7920a05003c331cdeb75c5 (diff) |
[TG3]: Add tagged status support.
When supported, use the TAGGED interrupt processing support
the chip provides. In this mode, instead of a "on/off" binary
semaphore, an incrementing tag scheme is used to ACK interrupts.
All MSI supporting chips support TAGGED mode, so the tg3_msi()
interrupt handler uses it unconditionally. This invariant is
verified when MSI support is tested.
Since we can invoke tg3_poll() multiple times per interrupt under
high packet load, we fetch a new copy of the tag value in the
status block right before we actually do the work.
Also, because the tagged status tells the chip exactly which
work we have processed, we can make two optimizations:
1) tg3_restart_ints() need not check tg3_has_work()
2) the tg3_timer() need not poke the chip 10 times per
second to keep from losing interrupt events
Based upon valuable feedback from Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r-- | drivers/net/tg3.c | 195 |
1 files changed, 140 insertions, 55 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index f79b02e80e75..488b8c65252d 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -420,7 +420,8 @@ static void tg3_enable_ints(struct tg3 *tp) | |||
420 | { | 420 | { |
421 | tw32(TG3PCI_MISC_HOST_CTRL, | 421 | tw32(TG3PCI_MISC_HOST_CTRL, |
422 | (tp->misc_host_ctrl & ~MISC_HOST_CTRL_MASK_PCI_INT)); | 422 | (tp->misc_host_ctrl & ~MISC_HOST_CTRL_MASK_PCI_INT)); |
423 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000000); | 423 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, |
424 | (tp->last_tag << 24)); | ||
424 | tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW); | 425 | tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW); |
425 | 426 | ||
426 | tg3_cond_int(tp); | 427 | tg3_cond_int(tp); |
@@ -455,10 +456,16 @@ static void tg3_restart_ints(struct tg3 *tp) | |||
455 | { | 456 | { |
456 | tw32(TG3PCI_MISC_HOST_CTRL, | 457 | tw32(TG3PCI_MISC_HOST_CTRL, |
457 | (tp->misc_host_ctrl & ~MISC_HOST_CTRL_MASK_PCI_INT)); | 458 | (tp->misc_host_ctrl & ~MISC_HOST_CTRL_MASK_PCI_INT)); |
458 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000000); | 459 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, |
460 | tp->last_tag << 24); | ||
459 | mmiowb(); | 461 | mmiowb(); |
460 | 462 | ||
461 | if (tg3_has_work(tp)) | 463 | /* When doing tagged status, this work check is unnecessary. |
464 | * The last_tag we write above tells the chip which piece of | ||
465 | * work we've completed. | ||
466 | */ | ||
467 | if (!(tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) && | ||
468 | tg3_has_work(tp)) | ||
462 | tw32(HOSTCC_MODE, tp->coalesce_mode | | 469 | tw32(HOSTCC_MODE, tp->coalesce_mode | |
463 | (HOSTCC_MODE_ENABLE | HOSTCC_MODE_NOW)); | 470 | (HOSTCC_MODE_ENABLE | HOSTCC_MODE_NOW)); |
464 | } | 471 | } |
@@ -2862,6 +2869,9 @@ static int tg3_poll(struct net_device *netdev, int *budget) | |||
2862 | 2869 | ||
2863 | spin_lock_irqsave(&tp->lock, flags); | 2870 | spin_lock_irqsave(&tp->lock, flags); |
2864 | 2871 | ||
2872 | if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) | ||
2873 | tp->last_tag = sblk->status_tag; | ||
2874 | |||
2865 | /* handle link change and other phy events */ | 2875 | /* handle link change and other phy events */ |
2866 | if (!(tp->tg3_flags & | 2876 | if (!(tp->tg3_flags & |
2867 | (TG3_FLAG_USE_LINKCHG_REG | | 2877 | (TG3_FLAG_USE_LINKCHG_REG | |
@@ -2928,22 +2938,21 @@ static irqreturn_t tg3_msi(int irq, void *dev_id, struct pt_regs *regs) | |||
2928 | spin_lock_irqsave(&tp->lock, flags); | 2938 | spin_lock_irqsave(&tp->lock, flags); |
2929 | 2939 | ||
2930 | /* | 2940 | /* |
2931 | * writing any value to intr-mbox-0 clears PCI INTA# and | 2941 | * Writing any value to intr-mbox-0 clears PCI INTA# and |
2932 | * chip-internal interrupt pending events. | 2942 | * chip-internal interrupt pending events. |
2933 | * writing non-zero to intr-mbox-0 additional tells the | 2943 | * Writing non-zero to intr-mbox-0 additional tells the |
2934 | * NIC to stop sending us irqs, engaging "in-intr-handler" | 2944 | * NIC to stop sending us irqs, engaging "in-intr-handler" |
2935 | * event coalescing. | 2945 | * event coalescing. |
2936 | */ | 2946 | */ |
2937 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001); | 2947 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001); |
2948 | tp->last_tag = sblk->status_tag; | ||
2938 | sblk->status &= ~SD_STATUS_UPDATED; | 2949 | sblk->status &= ~SD_STATUS_UPDATED; |
2939 | |||
2940 | if (likely(tg3_has_work(tp))) | 2950 | if (likely(tg3_has_work(tp))) |
2941 | netif_rx_schedule(dev); /* schedule NAPI poll */ | 2951 | netif_rx_schedule(dev); /* schedule NAPI poll */ |
2942 | else { | 2952 | else { |
2943 | /* no work, re-enable interrupts | 2953 | /* No work, re-enable interrupts. */ |
2944 | */ | ||
2945 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, | 2954 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, |
2946 | 0x00000000); | 2955 | tp->last_tag << 24); |
2947 | } | 2956 | } |
2948 | 2957 | ||
2949 | spin_unlock_irqrestore(&tp->lock, flags); | 2958 | spin_unlock_irqrestore(&tp->lock, flags); |
@@ -2969,21 +2978,62 @@ static irqreturn_t tg3_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
2969 | if ((sblk->status & SD_STATUS_UPDATED) || | 2978 | if ((sblk->status & SD_STATUS_UPDATED) || |
2970 | !(tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) { | 2979 | !(tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) { |
2971 | /* | 2980 | /* |
2972 | * writing any value to intr-mbox-0 clears PCI INTA# and | 2981 | * Writing any value to intr-mbox-0 clears PCI INTA# and |
2973 | * chip-internal interrupt pending events. | 2982 | * chip-internal interrupt pending events. |
2974 | * writing non-zero to intr-mbox-0 additional tells the | 2983 | * Writing non-zero to intr-mbox-0 additional tells the |
2975 | * NIC to stop sending us irqs, engaging "in-intr-handler" | 2984 | * NIC to stop sending us irqs, engaging "in-intr-handler" |
2976 | * event coalescing. | 2985 | * event coalescing. |
2977 | */ | 2986 | */ |
2978 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, | 2987 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, |
2979 | 0x00000001); | 2988 | 0x00000001); |
2989 | sblk->status &= ~SD_STATUS_UPDATED; | ||
2990 | if (likely(tg3_has_work(tp))) | ||
2991 | netif_rx_schedule(dev); /* schedule NAPI poll */ | ||
2992 | else { | ||
2993 | /* No work, shared interrupt perhaps? re-enable | ||
2994 | * interrupts, and flush that PCI write | ||
2995 | */ | ||
2996 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, | ||
2997 | 0x00000000); | ||
2998 | tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW); | ||
2999 | } | ||
3000 | } else { /* shared interrupt */ | ||
3001 | handled = 0; | ||
3002 | } | ||
3003 | |||
3004 | spin_unlock_irqrestore(&tp->lock, flags); | ||
3005 | |||
3006 | return IRQ_RETVAL(handled); | ||
3007 | } | ||
3008 | |||
3009 | static irqreturn_t tg3_interrupt_tagged(int irq, void *dev_id, struct pt_regs *regs) | ||
3010 | { | ||
3011 | struct net_device *dev = dev_id; | ||
3012 | struct tg3 *tp = netdev_priv(dev); | ||
3013 | struct tg3_hw_status *sblk = tp->hw_status; | ||
3014 | unsigned long flags; | ||
3015 | unsigned int handled = 1; | ||
3016 | |||
3017 | spin_lock_irqsave(&tp->lock, flags); | ||
3018 | |||
3019 | /* In INTx mode, it is possible for the interrupt to arrive at | ||
3020 | * the CPU before the status block posted prior to the interrupt. | ||
3021 | * Reading the PCI State register will confirm whether the | ||
3022 | * interrupt is ours and will flush the status block. | ||
3023 | */ | ||
3024 | if ((sblk->status & SD_STATUS_UPDATED) || | ||
3025 | !(tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) { | ||
2980 | /* | 3026 | /* |
2981 | * Flush PCI write. This also guarantees that our | 3027 | * writing any value to intr-mbox-0 clears PCI INTA# and |
2982 | * status block has been flushed to host memory. | 3028 | * chip-internal interrupt pending events. |
3029 | * writing non-zero to intr-mbox-0 additional tells the | ||
3030 | * NIC to stop sending us irqs, engaging "in-intr-handler" | ||
3031 | * event coalescing. | ||
2983 | */ | 3032 | */ |
2984 | tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW); | 3033 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, |
3034 | 0x00000001); | ||
3035 | tp->last_tag = sblk->status_tag; | ||
2985 | sblk->status &= ~SD_STATUS_UPDATED; | 3036 | sblk->status &= ~SD_STATUS_UPDATED; |
2986 | |||
2987 | if (likely(tg3_has_work(tp))) | 3037 | if (likely(tg3_has_work(tp))) |
2988 | netif_rx_schedule(dev); /* schedule NAPI poll */ | 3038 | netif_rx_schedule(dev); /* schedule NAPI poll */ |
2989 | else { | 3039 | else { |
@@ -2991,7 +3041,7 @@ static irqreturn_t tg3_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
2991 | * interrupts, and flush that PCI write | 3041 | * interrupts, and flush that PCI write |
2992 | */ | 3042 | */ |
2993 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, | 3043 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, |
2994 | 0x00000000); | 3044 | tp->last_tag << 24); |
2995 | tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW); | 3045 | tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW); |
2996 | } | 3046 | } |
2997 | } else { /* shared interrupt */ | 3047 | } else { /* shared interrupt */ |
@@ -5445,7 +5495,8 @@ static int tg3_reset_hw(struct tg3 *tp) | |||
5445 | udelay(100); | 5495 | udelay(100); |
5446 | 5496 | ||
5447 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0); | 5497 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0); |
5448 | tr32(MAILBOX_INTERRUPT_0); | 5498 | tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW); |
5499 | tp->last_tag = 0; | ||
5449 | 5500 | ||
5450 | if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { | 5501 | if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { |
5451 | tw32_f(DMAC_MODE, DMAC_MODE_ENABLE); | 5502 | tw32_f(DMAC_MODE, DMAC_MODE_ENABLE); |
@@ -5723,31 +5774,33 @@ static void tg3_timer(unsigned long __opaque) | |||
5723 | spin_lock_irqsave(&tp->lock, flags); | 5774 | spin_lock_irqsave(&tp->lock, flags); |
5724 | spin_lock(&tp->tx_lock); | 5775 | spin_lock(&tp->tx_lock); |
5725 | 5776 | ||
5726 | /* All of this garbage is because when using non-tagged | 5777 | if (!(tp->tg3_flags & TG3_FLAG_TAGGED_STATUS)) { |
5727 | * IRQ status the mailbox/status_block protocol the chip | 5778 | /* All of this garbage is because when using non-tagged |
5728 | * uses with the cpu is race prone. | 5779 | * IRQ status the mailbox/status_block protocol the chip |
5729 | */ | 5780 | * uses with the cpu is race prone. |
5730 | if (tp->hw_status->status & SD_STATUS_UPDATED) { | 5781 | */ |
5731 | tw32(GRC_LOCAL_CTRL, | 5782 | if (tp->hw_status->status & SD_STATUS_UPDATED) { |
5732 | tp->grc_local_ctrl | GRC_LCLCTRL_SETINT); | 5783 | tw32(GRC_LOCAL_CTRL, |
5733 | } else { | 5784 | tp->grc_local_ctrl | GRC_LCLCTRL_SETINT); |
5734 | tw32(HOSTCC_MODE, tp->coalesce_mode | | 5785 | } else { |
5735 | (HOSTCC_MODE_ENABLE | HOSTCC_MODE_NOW)); | 5786 | tw32(HOSTCC_MODE, tp->coalesce_mode | |
5736 | } | 5787 | (HOSTCC_MODE_ENABLE | HOSTCC_MODE_NOW)); |
5788 | } | ||
5737 | 5789 | ||
5738 | if (!(tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) { | 5790 | if (!(tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) { |
5739 | tp->tg3_flags2 |= TG3_FLG2_RESTART_TIMER; | 5791 | tp->tg3_flags2 |= TG3_FLG2_RESTART_TIMER; |
5740 | spin_unlock(&tp->tx_lock); | 5792 | spin_unlock(&tp->tx_lock); |
5741 | spin_unlock_irqrestore(&tp->lock, flags); | 5793 | spin_unlock_irqrestore(&tp->lock, flags); |
5742 | schedule_work(&tp->reset_task); | 5794 | schedule_work(&tp->reset_task); |
5743 | return; | 5795 | return; |
5796 | } | ||
5744 | } | 5797 | } |
5745 | 5798 | ||
5746 | if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) | ||
5747 | tg3_periodic_fetch_stats(tp); | ||
5748 | |||
5749 | /* This part only runs once per second. */ | 5799 | /* This part only runs once per second. */ |
5750 | if (!--tp->timer_counter) { | 5800 | if (!--tp->timer_counter) { |
5801 | if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) | ||
5802 | tg3_periodic_fetch_stats(tp); | ||
5803 | |||
5751 | if (tp->tg3_flags & TG3_FLAG_USE_LINKCHG_REG) { | 5804 | if (tp->tg3_flags & TG3_FLAG_USE_LINKCHG_REG) { |
5752 | u32 mac_stat; | 5805 | u32 mac_stat; |
5753 | int phy_event; | 5806 | int phy_event; |
@@ -5846,9 +5899,13 @@ static int tg3_test_interrupt(struct tg3 *tp) | |||
5846 | if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) | 5899 | if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) |
5847 | err = request_irq(tp->pdev->irq, tg3_msi, | 5900 | err = request_irq(tp->pdev->irq, tg3_msi, |
5848 | SA_SAMPLE_RANDOM, dev->name, dev); | 5901 | SA_SAMPLE_RANDOM, dev->name, dev); |
5849 | else | 5902 | else { |
5850 | err = request_irq(tp->pdev->irq, tg3_interrupt, | 5903 | irqreturn_t (*fn)(int, void *, struct pt_regs *)=tg3_interrupt; |
5904 | if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) | ||
5905 | fn = tg3_interrupt_tagged; | ||
5906 | err = request_irq(tp->pdev->irq, fn, | ||
5851 | SA_SHIRQ | SA_SAMPLE_RANDOM, dev->name, dev); | 5907 | SA_SHIRQ | SA_SAMPLE_RANDOM, dev->name, dev); |
5908 | } | ||
5852 | 5909 | ||
5853 | if (err) | 5910 | if (err) |
5854 | return err; | 5911 | return err; |
@@ -5900,9 +5957,14 @@ static int tg3_test_msi(struct tg3 *tp) | |||
5900 | 5957 | ||
5901 | tp->tg3_flags2 &= ~TG3_FLG2_USING_MSI; | 5958 | tp->tg3_flags2 &= ~TG3_FLG2_USING_MSI; |
5902 | 5959 | ||
5903 | err = request_irq(tp->pdev->irq, tg3_interrupt, | 5960 | { |
5904 | SA_SHIRQ | SA_SAMPLE_RANDOM, dev->name, dev); | 5961 | irqreturn_t (*fn)(int, void *, struct pt_regs *)=tg3_interrupt; |
5962 | if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) | ||
5963 | fn = tg3_interrupt_tagged; | ||
5905 | 5964 | ||
5965 | err = request_irq(tp->pdev->irq, fn, | ||
5966 | SA_SHIRQ | SA_SAMPLE_RANDOM, dev->name, dev); | ||
5967 | } | ||
5906 | if (err) | 5968 | if (err) |
5907 | return err; | 5969 | return err; |
5908 | 5970 | ||
@@ -5948,7 +6010,13 @@ static int tg3_open(struct net_device *dev) | |||
5948 | if ((tp->tg3_flags2 & TG3_FLG2_5750_PLUS) && | 6010 | if ((tp->tg3_flags2 & TG3_FLG2_5750_PLUS) && |
5949 | (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5750_AX) && | 6011 | (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5750_AX) && |
5950 | (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5750_BX)) { | 6012 | (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5750_BX)) { |
5951 | if (pci_enable_msi(tp->pdev) == 0) { | 6013 | /* All MSI supporting chips should support tagged |
6014 | * status. Assert that this is the case. | ||
6015 | */ | ||
6016 | if (!(tp->tg3_flags & TG3_FLAG_TAGGED_STATUS)) { | ||
6017 | printk(KERN_WARNING PFX "%s: MSI without TAGGED? " | ||
6018 | "Not using MSI.\n", tp->dev->name); | ||
6019 | } else if (pci_enable_msi(tp->pdev) == 0) { | ||
5952 | u32 msi_mode; | 6020 | u32 msi_mode; |
5953 | 6021 | ||
5954 | msi_mode = tr32(MSGINT_MODE); | 6022 | msi_mode = tr32(MSGINT_MODE); |
@@ -5959,9 +6027,14 @@ static int tg3_open(struct net_device *dev) | |||
5959 | if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) | 6027 | if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) |
5960 | err = request_irq(tp->pdev->irq, tg3_msi, | 6028 | err = request_irq(tp->pdev->irq, tg3_msi, |
5961 | SA_SAMPLE_RANDOM, dev->name, dev); | 6029 | SA_SAMPLE_RANDOM, dev->name, dev); |
5962 | else | 6030 | else { |
5963 | err = request_irq(tp->pdev->irq, tg3_interrupt, | 6031 | irqreturn_t (*fn)(int, void *, struct pt_regs *)=tg3_interrupt; |
6032 | if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) | ||
6033 | fn = tg3_interrupt_tagged; | ||
6034 | |||
6035 | err = request_irq(tp->pdev->irq, fn, | ||
5964 | SA_SHIRQ | SA_SAMPLE_RANDOM, dev->name, dev); | 6036 | SA_SHIRQ | SA_SAMPLE_RANDOM, dev->name, dev); |
6037 | } | ||
5965 | 6038 | ||
5966 | if (err) { | 6039 | if (err) { |
5967 | if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) { | 6040 | if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) { |
@@ -5980,9 +6053,16 @@ static int tg3_open(struct net_device *dev) | |||
5980 | tg3_halt(tp, 1); | 6053 | tg3_halt(tp, 1); |
5981 | tg3_free_rings(tp); | 6054 | tg3_free_rings(tp); |
5982 | } else { | 6055 | } else { |
5983 | tp->timer_offset = HZ / 10; | 6056 | if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) |
5984 | tp->timer_counter = tp->timer_multiplier = 10; | 6057 | tp->timer_offset = HZ; |
5985 | tp->asf_counter = tp->asf_multiplier = (10 * 120); | 6058 | else |
6059 | tp->timer_offset = HZ / 10; | ||
6060 | |||
6061 | BUG_ON(tp->timer_offset > HZ); | ||
6062 | tp->timer_counter = tp->timer_multiplier = | ||
6063 | (HZ / tp->timer_offset); | ||
6064 | tp->asf_counter = tp->asf_multiplier = | ||
6065 | ((HZ / tp->timer_offset) * 120); | ||
5986 | 6066 | ||
5987 | init_timer(&tp->timer); | 6067 | init_timer(&tp->timer); |
5988 | tp->timer.expires = jiffies + tp->timer_offset; | 6068 | tp->timer.expires = jiffies + tp->timer_offset; |
@@ -6005,6 +6085,7 @@ static int tg3_open(struct net_device *dev) | |||
6005 | 6085 | ||
6006 | if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) { | 6086 | if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) { |
6007 | err = tg3_test_msi(tp); | 6087 | err = tg3_test_msi(tp); |
6088 | |||
6008 | if (err) { | 6089 | if (err) { |
6009 | spin_lock_irq(&tp->lock); | 6090 | spin_lock_irq(&tp->lock); |
6010 | spin_lock(&tp->tx_lock); | 6091 | spin_lock(&tp->tx_lock); |
@@ -8422,15 +8503,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
8422 | if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) | 8503 | if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) |
8423 | tp->tg3_flags2 |= TG3_FLG2_PHY_BER_BUG; | 8504 | tp->tg3_flags2 |= TG3_FLG2_PHY_BER_BUG; |
8424 | 8505 | ||
8425 | /* Only 5701 and later support tagged irq status mode. | ||
8426 | * Also, 5788 chips cannot use tagged irq status. | ||
8427 | * | ||
8428 | * However, since we are using NAPI avoid tagged irq status | ||
8429 | * because the interrupt condition is more difficult to | ||
8430 | * fully clear in that mode. | ||
8431 | */ | ||
8432 | tp->coalesce_mode = 0; | 8506 | tp->coalesce_mode = 0; |
8433 | |||
8434 | if (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5700_AX && | 8507 | if (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5700_AX && |
8435 | GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5700_BX) | 8508 | GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5700_BX) |
8436 | tp->coalesce_mode |= HOSTCC_MODE_32BYTE; | 8509 | tp->coalesce_mode |= HOSTCC_MODE_32BYTE; |
@@ -8494,6 +8567,18 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
8494 | grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788M)) | 8567 | grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788M)) |
8495 | tp->tg3_flags2 |= TG3_FLG2_IS_5788; | 8568 | tp->tg3_flags2 |= TG3_FLG2_IS_5788; |
8496 | 8569 | ||
8570 | if (!(tp->tg3_flags2 & TG3_FLG2_IS_5788) && | ||
8571 | (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700)) | ||
8572 | tp->tg3_flags |= TG3_FLAG_TAGGED_STATUS; | ||
8573 | if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) { | ||
8574 | tp->coalesce_mode |= (HOSTCC_MODE_CLRTICK_RXBD | | ||
8575 | HOSTCC_MODE_CLRTICK_TXBD); | ||
8576 | |||
8577 | tp->misc_host_ctrl |= MISC_HOST_CTRL_TAGGED_STATUS; | ||
8578 | pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL, | ||
8579 | tp->misc_host_ctrl); | ||
8580 | } | ||
8581 | |||
8497 | /* these are limited to 10/100 only */ | 8582 | /* these are limited to 10/100 only */ |
8498 | if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 && | 8583 | if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 && |
8499 | (grc_misc_cfg == 0x8000 || grc_misc_cfg == 0x4000)) || | 8584 | (grc_misc_cfg == 0x8000 || grc_misc_cfg == 0x4000)) || |