aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tc35815.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/tc35815.c')
-rw-r--r--drivers/net/tc35815.c68
1 files changed, 1 insertions, 67 deletions
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index 0d621ca5e27b..803eb64ffcc2 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -22,12 +22,7 @@
22 * All Rights Reserved. 22 * All Rights Reserved.
23 */ 23 */
24 24
25#define TC35815_NAPI 25#define DRV_VERSION "1.39"
26#ifdef TC35815_NAPI
27#define DRV_VERSION "1.38-NAPI"
28#else
29#define DRV_VERSION "1.38"
30#endif
31static const char *version = "tc35815.c:v" DRV_VERSION "\n"; 26static const char *version = "tc35815.c:v" DRV_VERSION "\n";
32#define MODNAME "tc35815" 27#define MODNAME "tc35815"
33 28
@@ -563,12 +558,8 @@ static void free_rxbuf_skb(struct pci_dev *hwdev, struct sk_buff *skb, dma_addr_
563static int tc35815_open(struct net_device *dev); 558static int tc35815_open(struct net_device *dev);
564static int tc35815_send_packet(struct sk_buff *skb, struct net_device *dev); 559static int tc35815_send_packet(struct sk_buff *skb, struct net_device *dev);
565static irqreturn_t tc35815_interrupt(int irq, void *dev_id); 560static irqreturn_t tc35815_interrupt(int irq, void *dev_id);
566#ifdef TC35815_NAPI
567static int tc35815_rx(struct net_device *dev, int limit); 561static int tc35815_rx(struct net_device *dev, int limit);
568static int tc35815_poll(struct napi_struct *napi, int budget); 562static int tc35815_poll(struct napi_struct *napi, int budget);
569#else
570static void tc35815_rx(struct net_device *dev);
571#endif
572static void tc35815_txdone(struct net_device *dev); 563static void tc35815_txdone(struct net_device *dev);
573static int tc35815_close(struct net_device *dev); 564static int tc35815_close(struct net_device *dev);
574static struct net_device_stats *tc35815_get_stats(struct net_device *dev); 565static struct net_device_stats *tc35815_get_stats(struct net_device *dev);
@@ -924,9 +915,7 @@ static int __devinit tc35815_init_one(struct pci_dev *pdev,
924 dev->netdev_ops = &tc35815_netdev_ops; 915 dev->netdev_ops = &tc35815_netdev_ops;
925 dev->ethtool_ops = &tc35815_ethtool_ops; 916 dev->ethtool_ops = &tc35815_ethtool_ops;
926 dev->watchdog_timeo = TC35815_TX_TIMEOUT; 917 dev->watchdog_timeo = TC35815_TX_TIMEOUT;
927#ifdef TC35815_NAPI
928 netif_napi_add(dev, &lp->napi, tc35815_poll, NAPI_WEIGHT); 918 netif_napi_add(dev, &lp->napi, tc35815_poll, NAPI_WEIGHT);
929#endif
930 919
931 dev->irq = pdev->irq; 920 dev->irq = pdev->irq;
932 dev->base_addr = (unsigned long)ioaddr; 921 dev->base_addr = (unsigned long)ioaddr;
@@ -1401,9 +1390,7 @@ tc35815_open(struct net_device *dev)
1401 return -EAGAIN; 1390 return -EAGAIN;
1402 } 1391 }
1403 1392
1404#ifdef TC35815_NAPI
1405 napi_enable(&lp->napi); 1393 napi_enable(&lp->napi);
1406#endif
1407 1394
1408 /* Reset the hardware here. Don't forget to set the station address. */ 1395 /* Reset the hardware here. Don't forget to set the station address. */
1409 spin_lock_irq(&lp->lock); 1396 spin_lock_irq(&lp->lock);
@@ -1537,11 +1524,7 @@ static void tc35815_fatal_error_interrupt(struct net_device *dev, u32 status)
1537 tc35815_schedule_restart(dev); 1524 tc35815_schedule_restart(dev);
1538} 1525}
1539 1526
1540#ifdef TC35815_NAPI
1541static int tc35815_do_interrupt(struct net_device *dev, u32 status, int limit) 1527static int tc35815_do_interrupt(struct net_device *dev, u32 status, int limit)
1542#else
1543static int tc35815_do_interrupt(struct net_device *dev, u32 status)
1544#endif
1545{ 1528{
1546 struct tc35815_local *lp = netdev_priv(dev); 1529 struct tc35815_local *lp = netdev_priv(dev);
1547 int ret = -1; 1530 int ret = -1;
@@ -1580,12 +1563,7 @@ static int tc35815_do_interrupt(struct net_device *dev, u32 status)
1580 /* normal notification */ 1563 /* normal notification */
1581 if (status & Int_IntMacRx) { 1564 if (status & Int_IntMacRx) {
1582 /* Got a packet(s). */ 1565 /* Got a packet(s). */
1583#ifdef TC35815_NAPI
1584 ret = tc35815_rx(dev, limit); 1566 ret = tc35815_rx(dev, limit);
1585#else
1586 tc35815_rx(dev);
1587 ret = 0;
1588#endif
1589 lp->lstats.rx_ints++; 1567 lp->lstats.rx_ints++;
1590 } 1568 }
1591 if (status & Int_IntMacTx) { 1569 if (status & Int_IntMacTx) {
@@ -1593,12 +1571,8 @@ static int tc35815_do_interrupt(struct net_device *dev, u32 status)
1593 lp->lstats.tx_ints++; 1571 lp->lstats.tx_ints++;
1594 tc35815_txdone(dev); 1572 tc35815_txdone(dev);
1595 netif_wake_queue(dev); 1573 netif_wake_queue(dev);
1596#ifdef TC35815_NAPI
1597 if (ret < 0) 1574 if (ret < 0)
1598 ret = 0; 1575 ret = 0;
1599#else
1600 ret = 0;
1601#endif
1602 } 1576 }
1603 return ret; 1577 return ret;
1604} 1578}
@@ -1613,7 +1587,6 @@ static irqreturn_t tc35815_interrupt(int irq, void *dev_id)
1613 struct tc35815_local *lp = netdev_priv(dev); 1587 struct tc35815_local *lp = netdev_priv(dev);
1614 struct tc35815_regs __iomem *tr = 1588 struct tc35815_regs __iomem *tr =
1615 (struct tc35815_regs __iomem *)dev->base_addr; 1589 (struct tc35815_regs __iomem *)dev->base_addr;
1616#ifdef TC35815_NAPI
1617 u32 dmactl = tc_readl(&tr->DMA_Ctl); 1590 u32 dmactl = tc_readl(&tr->DMA_Ctl);
1618 1591
1619 if (!(dmactl & DMA_IntMask)) { 1592 if (!(dmactl & DMA_IntMask)) {
@@ -1630,22 +1603,6 @@ static irqreturn_t tc35815_interrupt(int irq, void *dev_id)
1630 return IRQ_HANDLED; 1603 return IRQ_HANDLED;
1631 } 1604 }
1632 return IRQ_NONE; 1605 return IRQ_NONE;
1633#else
1634 int handled;
1635 u32 status;
1636
1637 spin_lock(&lp->lock);
1638 status = tc_readl(&tr->Int_Src);
1639 /* BLEx, FDAEx will be cleared later */
1640 tc_writel(status & ~(Int_BLEx | Int_FDAEx),
1641 &tr->Int_Src); /* write to clear */
1642 handled = tc35815_do_interrupt(dev, status);
1643 if (status & (Int_BLEx | Int_FDAEx))
1644 tc_writel(status & (Int_BLEx | Int_FDAEx), &tr->Int_Src);
1645 (void)tc_readl(&tr->Int_Src); /* flush */
1646 spin_unlock(&lp->lock);
1647 return IRQ_RETVAL(handled >= 0);
1648#endif /* TC35815_NAPI */
1649} 1606}
1650 1607
1651#ifdef CONFIG_NET_POLL_CONTROLLER 1608#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -1658,20 +1615,13 @@ static void tc35815_poll_controller(struct net_device *dev)
1658#endif 1615#endif
1659 1616
1660/* We have a good packet(s), get it/them out of the buffers. */ 1617/* We have a good packet(s), get it/them out of the buffers. */
1661#ifdef TC35815_NAPI
1662static int 1618static int
1663tc35815_rx(struct net_device *dev, int limit) 1619tc35815_rx(struct net_device *dev, int limit)
1664#else
1665static void
1666tc35815_rx(struct net_device *dev)
1667#endif
1668{ 1620{
1669 struct tc35815_local *lp = netdev_priv(dev); 1621 struct tc35815_local *lp = netdev_priv(dev);
1670 unsigned int fdctl; 1622 unsigned int fdctl;
1671 int i; 1623 int i;
1672#ifdef TC35815_NAPI
1673 int received = 0; 1624 int received = 0;
1674#endif
1675 1625
1676 while (!((fdctl = le32_to_cpu(lp->rfd_cur->fd.FDCtl)) & FD_CownsFD)) { 1626 while (!((fdctl = le32_to_cpu(lp->rfd_cur->fd.FDCtl)) & FD_CownsFD)) {
1677 int status = le32_to_cpu(lp->rfd_cur->fd.FDStat); 1627 int status = le32_to_cpu(lp->rfd_cur->fd.FDStat);
@@ -1694,10 +1644,8 @@ tc35815_rx(struct net_device *dev)
1694 int offset; 1644 int offset;
1695#endif 1645#endif
1696 1646
1697#ifdef TC35815_NAPI
1698 if (--limit < 0) 1647 if (--limit < 0)
1699 break; 1648 break;
1700#endif
1701#ifdef TC35815_USE_PACKEDBUFFER 1649#ifdef TC35815_USE_PACKEDBUFFER
1702 BUG_ON(bd_count > 2); 1650 BUG_ON(bd_count > 2);
1703 skb = dev_alloc_skb(pkt_len + NET_IP_ALIGN); 1651 skb = dev_alloc_skb(pkt_len + NET_IP_ALIGN);
@@ -1767,12 +1715,8 @@ tc35815_rx(struct net_device *dev)
1767 if (netif_msg_pktdata(lp)) 1715 if (netif_msg_pktdata(lp))
1768 print_eth(data); 1716 print_eth(data);
1769 skb->protocol = eth_type_trans(skb, dev); 1717 skb->protocol = eth_type_trans(skb, dev);
1770#ifdef TC35815_NAPI
1771 netif_receive_skb(skb); 1718 netif_receive_skb(skb);
1772 received++; 1719 received++;
1773#else
1774 netif_rx(skb);
1775#endif
1776 dev->stats.rx_packets++; 1720 dev->stats.rx_packets++;
1777 dev->stats.rx_bytes += pkt_len; 1721 dev->stats.rx_bytes += pkt_len;
1778 } else { 1722 } else {
@@ -1888,12 +1832,9 @@ tc35815_rx(struct net_device *dev)
1888#endif 1832#endif
1889 } 1833 }
1890 1834
1891#ifdef TC35815_NAPI
1892 return received; 1835 return received;
1893#endif
1894} 1836}
1895 1837
1896#ifdef TC35815_NAPI
1897static int tc35815_poll(struct napi_struct *napi, int budget) 1838static int tc35815_poll(struct napi_struct *napi, int budget)
1898{ 1839{
1899 struct tc35815_local *lp = container_of(napi, struct tc35815_local, napi); 1840 struct tc35815_local *lp = container_of(napi, struct tc35815_local, napi);
@@ -1930,7 +1871,6 @@ static int tc35815_poll(struct napi_struct *napi, int budget)
1930 } 1871 }
1931 return received; 1872 return received;
1932} 1873}
1933#endif
1934 1874
1935#ifdef NO_CHECK_CARRIER 1875#ifdef NO_CHECK_CARRIER
1936#define TX_STA_ERR (Tx_ExColl|Tx_Under|Tx_Defer|Tx_LateColl|Tx_TxPar|Tx_SQErr) 1876#define TX_STA_ERR (Tx_ExColl|Tx_Under|Tx_Defer|Tx_LateColl|Tx_TxPar|Tx_SQErr)
@@ -2050,11 +1990,7 @@ tc35815_txdone(struct net_device *dev)
2050 pci_unmap_single(lp->pci_dev, lp->tx_skbs[lp->tfd_end].skb_dma, skb->len, PCI_DMA_TODEVICE); 1990 pci_unmap_single(lp->pci_dev, lp->tx_skbs[lp->tfd_end].skb_dma, skb->len, PCI_DMA_TODEVICE);
2051 lp->tx_skbs[lp->tfd_end].skb = NULL; 1991 lp->tx_skbs[lp->tfd_end].skb = NULL;
2052 lp->tx_skbs[lp->tfd_end].skb_dma = 0; 1992 lp->tx_skbs[lp->tfd_end].skb_dma = 0;
2053#ifdef TC35815_NAPI
2054 dev_kfree_skb_any(skb); 1993 dev_kfree_skb_any(skb);
2055#else
2056 dev_kfree_skb_irq(skb);
2057#endif
2058 } 1994 }
2059 txfd->fd.FDSystem = cpu_to_le32(0xffffffff); 1995 txfd->fd.FDSystem = cpu_to_le32(0xffffffff);
2060 1996
@@ -2118,9 +2054,7 @@ tc35815_close(struct net_device *dev)
2118 struct tc35815_local *lp = netdev_priv(dev); 2054 struct tc35815_local *lp = netdev_priv(dev);
2119 2055
2120 netif_stop_queue(dev); 2056 netif_stop_queue(dev);
2121#ifdef TC35815_NAPI
2122 napi_disable(&lp->napi); 2057 napi_disable(&lp->napi);
2123#endif
2124 if (lp->phy_dev) 2058 if (lp->phy_dev)
2125 phy_stop(lp->phy_dev); 2059 phy_stop(lp->phy_dev);
2126 cancel_work_sync(&lp->restart_work); 2060 cancel_work_sync(&lp->restart_work);