patch-2.4.27 linux-2.4.27/drivers/net/via-rhine.c
Next file: linux-2.4.27/drivers/net/wan/farsync.c
Previous file: linux-2.4.27/drivers/net/tun.c
Back to the patch index
Back to the overall index
- Lines: 224
- Date:
2004-08-07 16:26:05.160367569 -0700
- Orig file:
linux-2.4.26/drivers/net/via-rhine.c
- Orig date:
2003-11-28 10:26:20.000000000 -0800
diff -urN linux-2.4.26/drivers/net/via-rhine.c linux-2.4.27/drivers/net/via-rhine.c
@@ -28,10 +28,10 @@
Linux kernel version history:
-
+
LK1.1.0:
- Jeff Garzik: softnet 'n stuff
-
+
LK1.1.1:
- Justin Guyett: softnet and locking fixes
- Jeff Garzik: use PCI interface
@@ -58,7 +58,7 @@
LK1.1.6:
- Urban Widmark: merges from Beckers 1.08b version (VT6102 + mdio)
set netif_running_on/off on startup, del_timer_sync
-
+
LK1.1.7:
- Manfred Spraul: added reset into tx_timeout
@@ -83,7 +83,7 @@
LK1.1.13 (jgarzik):
- Add ethtool support
- Replace some MII-related magic numbers with constants
-
+
LK1.1.14 (Ivan G.):
- fixes comments for Rhine-III
- removes W_MAX_TIMEOUT (unused)
@@ -92,7 +92,7 @@
- sends chip_id as a parameter to wait_for_reset since np is not
initialized on first call
- changes mmio "else if (chip_id==VT6102)" to "else" so it will work
- for Rhine-III's (documentation says same bit is correct)
+ for Rhine-III's (documentation says same bit is correct)
- transmit frame queue message is off by one - fixed
- adds IntrNormalSummary to "Something Wicked" exclusion list
so normal interrupts will not trigger the message (src: Donald Becker)
@@ -316,10 +316,10 @@
The driver runs as two independent, single-threaded flows of control. One
is the send-packet routine, which enforces single-threaded use by the
-dev->priv->lock spinlock. The other thread is the interrupt handler, which
+dev->priv->lock spinlock. The other thread is the interrupt handler, which
is single threaded by the hardware and interrupt handling software.
-The send packet thread has partial control over the Tx ring. It locks the
+The send packet thread has partial control over the Tx ring. It locks the
dev->priv->lock whenever it's queuing a Tx packet. If the next slot in the ring
is not available it stops the transmit queue by calling netif_stop_queue.
@@ -615,6 +615,15 @@
break;
}
+#ifdef CONFIG_NET_POLL_CONTROLLER
+static void via_rhine_poll(struct net_device *dev)
+{
+ disable_irq(dev->irq);
+ via_rhine_interrupt(dev->irq, (void *)dev, NULL);
+ enable_irq(dev->irq);
+}
+#endif
+
static int __devinit via_rhine_init_one (struct pci_dev *pdev,
const struct pci_device_id *ent)
{
@@ -630,7 +639,7 @@
#ifdef USE_MEM
long ioaddr0;
#endif
-
+
/* when built into the kernel, we only print version if device is found */
#ifndef MODULE
static int printed_version;
@@ -651,7 +660,7 @@
printk(KERN_ERR "32-bit PCI DMA addresses not supported by the card!?\n");
goto err_out;
}
-
+
/* sanity check */
if ((pci_resource_len (pdev, 0) < io_size) ||
(pci_resource_len (pdev, 1) < io_size)) {
@@ -671,7 +680,8 @@
goto err_out;
}
SET_MODULE_OWNER(dev);
-
+ SET_NETDEV_DEV(dev, &pdev->dev);
+
if (pci_request_regions(pdev, shortname))
goto err_out_free_netdev;
@@ -783,6 +793,9 @@
dev->ethtool_ops = &netdev_ethtool_ops;
dev->tx_timeout = via_rhine_tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT;
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ dev->poll_controller = via_rhine_poll;
+#endif
if (np->drv_flags & ReqTxAlign)
dev->features |= NETIF_F_SG|NETIF_F_HW_CSUM;
@@ -834,6 +847,8 @@
netif_carrier_on(dev);
else
netif_carrier_off(dev);
+
+ break;
}
}
np->mii_cnt = phy_idx;
@@ -867,7 +882,7 @@
#endif
pci_release_regions(pdev);
err_out_free_netdev:
- kfree (dev);
+ free_netdev (dev);
err_out:
return -ENODEV;
}
@@ -878,7 +893,7 @@
void *ring;
dma_addr_t ring_dma;
- ring = pci_alloc_consistent(np->pdev,
+ ring = pci_alloc_consistent(np->pdev,
RX_RING_SIZE * sizeof(struct rx_desc) +
TX_RING_SIZE * sizeof(struct tx_desc),
&ring_dma);
@@ -890,7 +905,7 @@
np->tx_bufs = pci_alloc_consistent(np->pdev, PKT_BUF_SZ * TX_RING_SIZE,
&np->tx_bufs_dma);
if (np->tx_bufs == NULL) {
- pci_free_consistent(np->pdev,
+ pci_free_consistent(np->pdev,
RX_RING_SIZE * sizeof(struct rx_desc) +
TX_RING_SIZE * sizeof(struct tx_desc),
ring, ring_dma);
@@ -910,7 +925,7 @@
{
struct netdev_private *np = dev->priv;
- pci_free_consistent(np->pdev,
+ pci_free_consistent(np->pdev,
RX_RING_SIZE * sizeof(struct rx_desc) +
TX_RING_SIZE * sizeof(struct tx_desc),
np->rx_ring, np->rx_ring_dma);
@@ -935,7 +950,7 @@
np->rx_buf_sz = (dev->mtu <= 1500 ? PKT_BUF_SZ : dev->mtu + 32);
np->rx_head_desc = &np->rx_ring[0];
next = np->rx_ring_dma;
-
+
/* Init the ring entries */
for (i = 0; i < RX_RING_SIZE; i++) {
np->rx_ring[i].rx_status = 0;
@@ -1138,7 +1153,7 @@
if (debug > 1)
printk(KERN_DEBUG "%s: via_rhine_open() irq %d.\n",
dev->name, np->pdev->irq);
-
+
i = alloc_ring(dev);
if (i)
return i;
@@ -1253,7 +1268,7 @@
/* Reinitialize the hardware. */
wait_for_reset(dev, np->chip_id, dev->name);
init_registers(dev);
-
+
spin_unlock(&np->lock);
enable_irq(np->pdev->irq);
@@ -1303,7 +1318,7 @@
np->tx_ring[entry].addr = cpu_to_le32(np->tx_skbuff_dma[entry]);
}
- np->tx_ring[entry].desc_length =
+ np->tx_ring[entry].desc_length =
cpu_to_le32(TXDESC | (skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN));
/* lock eth irq */
@@ -1351,7 +1366,7 @@
int handled = 0;
ioaddr = dev->base_addr;
-
+
while ((intr_status = get_intr_status(dev))) {
handled = 1;
@@ -1569,7 +1584,7 @@
break; /* Better luck next round. */
skb->dev = dev; /* Mark as being used by this device. */
np->rx_skbuff_dma[entry] =
- pci_map_single(np->pdev, skb->tail, np->rx_buf_sz,
+ pci_map_single(np->pdev, skb->tail, np->rx_buf_sz,
PCI_DMA_FROMDEVICE);
np->rx_ring[entry].addr = cpu_to_le32(np->rx_skbuff_dma[entry]);
}
@@ -1877,7 +1892,7 @@
static void __devexit via_rhine_remove_one (struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata(pdev);
-
+
unregister_netdev(dev);
pci_release_regions(pdev);
@@ -1886,7 +1901,7 @@
iounmap((char *)(dev->base_addr));
#endif
- kfree(dev);
+ free_netdev(dev);
pci_disable_device(pdev);
pci_set_drvdata(pdev, NULL);
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)