Commit 84261169 authored by Jeff Garzik's avatar Jeff Garzik

[netdrvr tg3] bump version, tidy comments

No code changes in this patch, just cleanup and version bump.
parent 440d4044
/* $Id: tg3.c,v 1.43.2.80 2002/03/14 00:10:04 davem Exp $ /*
* tg3.c: Broadcom Tigon3 ethernet driver. * tg3.c: Broadcom Tigon3 ethernet driver.
* *
* Copyright (C) 2001, 2002 David S. Miller (davem@redhat.com) * Copyright (C) 2001, 2002 David S. Miller (davem@redhat.com)
...@@ -54,8 +54,8 @@ ...@@ -54,8 +54,8 @@
#define DRV_MODULE_NAME "tg3" #define DRV_MODULE_NAME "tg3"
#define PFX DRV_MODULE_NAME ": " #define PFX DRV_MODULE_NAME ": "
#define DRV_MODULE_VERSION "1.2a" #define DRV_MODULE_VERSION "1.4"
#define DRV_MODULE_RELDATE "Dec 9, 2002" #define DRV_MODULE_RELDATE "Feb 1, 2003"
#define TG3_DEF_MAC_MODE 0 #define TG3_DEF_MAC_MODE 0
#define TG3_DEF_RX_MODE 0 #define TG3_DEF_RX_MODE 0
...@@ -2026,6 +2026,7 @@ static int tg3_poll(struct net_device *netdev, int *budget) ...@@ -2026,6 +2026,7 @@ static int tg3_poll(struct net_device *netdev, int *budget)
spin_lock_irqsave(&tp->lock, flags); spin_lock_irqsave(&tp->lock, flags);
/* handle link change and other phy events */
if (!(tp->tg3_flags & if (!(tp->tg3_flags &
(TG3_FLAG_USE_LINKCHG_REG | (TG3_FLAG_USE_LINKCHG_REG |
TG3_FLAG_POLL_SERDES))) { TG3_FLAG_POLL_SERDES))) {
...@@ -2036,12 +2037,14 @@ static int tg3_poll(struct net_device *netdev, int *budget) ...@@ -2036,12 +2037,14 @@ static int tg3_poll(struct net_device *netdev, int *budget)
} }
} }
/* run TX completion thread */
if (sblk->idx[0].tx_consumer != tp->tx_cons) { if (sblk->idx[0].tx_consumer != tp->tx_cons) {
spin_lock(&tp->tx_lock); spin_lock(&tp->tx_lock);
tg3_tx(tp); tg3_tx(tp);
spin_unlock(&tp->tx_lock); spin_unlock(&tp->tx_lock);
} }
/* run RX thread, within the bounds set by NAPI */
done = 1; done = 1;
if (sblk->idx[0].rx_producer != tp->rx_rcb_ptr) { if (sblk->idx[0].rx_producer != tp->rx_rcb_ptr) {
int orig_budget = *budget; int orig_budget = *budget;
...@@ -2059,6 +2062,7 @@ static int tg3_poll(struct net_device *netdev, int *budget) ...@@ -2059,6 +2062,7 @@ static int tg3_poll(struct net_device *netdev, int *budget)
done = 0; done = 0;
} }
/* if no more work, tell net stack and NIC we're done */
if (done) { if (done) {
netif_rx_complete(netdev); netif_rx_complete(netdev);
tg3_enable_ints(tp); tg3_enable_ints(tp);
...@@ -2074,12 +2078,14 @@ static inline unsigned int tg3_has_work(struct net_device *dev, struct tg3 *tp) ...@@ -2074,12 +2078,14 @@ static inline unsigned int tg3_has_work(struct net_device *dev, struct tg3 *tp)
struct tg3_hw_status *sblk = tp->hw_status; struct tg3_hw_status *sblk = tp->hw_status;
unsigned int work_exists = 0; unsigned int work_exists = 0;
/* check for phy events */
if (!(tp->tg3_flags & if (!(tp->tg3_flags &
(TG3_FLAG_USE_LINKCHG_REG | (TG3_FLAG_USE_LINKCHG_REG |
TG3_FLAG_POLL_SERDES))) { TG3_FLAG_POLL_SERDES))) {
if (sblk->status & SD_STATUS_LINK_CHG) if (sblk->status & SD_STATUS_LINK_CHG)
work_exists = 1; work_exists = 1;
} }
/* check for RX/TX work to do */
if (sblk->idx[0].tx_consumer != tp->tx_cons || if (sblk->idx[0].tx_consumer != tp->tx_cons ||
sblk->idx[0].rx_producer != tp->rx_rcb_ptr) sblk->idx[0].rx_producer != tp->rx_rcb_ptr)
work_exists = 1; work_exists = 1;
...@@ -2097,14 +2103,28 @@ static void tg3_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -2097,14 +2103,28 @@ static void tg3_interrupt(int irq, void *dev_id, struct pt_regs *regs)
spin_lock_irqsave(&tp->lock, flags); spin_lock_irqsave(&tp->lock, flags);
if (sblk->status & SD_STATUS_UPDATED) { if (sblk->status & SD_STATUS_UPDATED) {
/*
* writing any value to intr-mbox-0 clears PCI INTA# and
* chip-internal interrupt pending events.
* writing non-zero to intr-mbox-0 additional tells the
* NIC to stop sending us irqs, engaging "in-intr-handler"
* event coalescing.
*/
tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW,
0x00000001); 0x00000001);
/*
* Flush PCI write. This also guarantees that our
* status block has been flushed to host memory.
*/
tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW); tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW);
sblk->status &= ~SD_STATUS_UPDATED; sblk->status &= ~SD_STATUS_UPDATED;
if (likely(tg3_has_work(dev, tp))) if (likely(tg3_has_work(dev, tp)))
netif_rx_schedule(dev); netif_rx_schedule(dev); /* schedule NAPI poll */
else { else {
/* no work, shared interrupt perhaps? re-enable
* interrupts, and flush that PCI write
*/
tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW,
0x00000000); 0x00000000);
tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW); tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW);
...@@ -2209,11 +2229,6 @@ static int tigon3_4gb_hwbug_workaround(struct tg3 *tp, struct sk_buff *skb, ...@@ -2209,11 +2229,6 @@ static int tigon3_4gb_hwbug_workaround(struct tg3 *tp, struct sk_buff *skb,
return -1; return -1;
} }
/* NOTE: Broadcom's driver botches this case up really bad.
* This is especially true if any of the frag pages
* are in highmem. It will instantly oops in that case.
*/
/* New SKB is guarenteed to be linear. */ /* New SKB is guarenteed to be linear. */
entry = *start; entry = *start;
new_addr = pci_map_single(tp->pdev, new_skb->data, new_skb->len, new_addr = pci_map_single(tp->pdev, new_skb->data, new_skb->len,
...@@ -6137,10 +6152,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) ...@@ -6137,10 +6152,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
tp->split_mode_max_reqs = SPLIT_MODE_5704_MAX_REQ; tp->split_mode_max_reqs = SPLIT_MODE_5704_MAX_REQ;
} }
/* ROFL, you should see Broadcom's driver code implementing /* this one is limited to 10/100 only */
* this, stuff like "if (a || b)" where a and b are always
* mutually exclusive. DaveM finds like 6 bugs today, hello!
*/
if (grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5702FE) if (grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5702FE)
tp->tg3_flags |= TG3_FLAG_10_100_ONLY; tp->tg3_flags |= TG3_FLAG_10_100_ONLY;
...@@ -6203,17 +6215,10 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) ...@@ -6203,17 +6215,10 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
/* 5700 chips can get confused if TX buffers straddle the /* 5700 chips can get confused if TX buffers straddle the
* 4GB address boundary in some cases. * 4GB address boundary in some cases.
*/ */
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700) { if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700)
/* ROFL! Latest Broadcom driver disables NETIF_F_HIGHDMA
* in this case instead of fixing their workaround code.
*
* Like, hey, there is this skb_copy() thing guys,
* use it. Oh I can't stop laughing...
*/
tp->dev->hard_start_xmit = tg3_start_xmit_4gbug; tp->dev->hard_start_xmit = tg3_start_xmit_4gbug;
} else { else
tp->dev->hard_start_xmit = tg3_start_xmit; tp->dev->hard_start_xmit = tg3_start_xmit;
}
tp->rx_offset = 2; tp->rx_offset = 2;
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701 && if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701 &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment