aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ipg.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index dbd23bb65d1e..50f0c17451b1 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -857,21 +857,14 @@ static void init_tfdlist(struct net_device *dev)
857static void ipg_nic_txfree(struct net_device *dev) 857static void ipg_nic_txfree(struct net_device *dev)
858{ 858{
859 struct ipg_nic_private *sp = netdev_priv(dev); 859 struct ipg_nic_private *sp = netdev_priv(dev);
860 void __iomem *ioaddr = sp->ioaddr; 860 unsigned int released, pending, dirty;
861 unsigned int curr;
862 u64 txd_map;
863 unsigned int released, pending;
864
865 txd_map = (u64)sp->txd_map;
866 curr = ipg_r32(TFD_LIST_PTR_0) -
867 do_div(txd_map, sizeof(struct ipg_tx)) - 1;
868 861
869 IPG_DEBUG_MSG("_nic_txfree\n"); 862 IPG_DEBUG_MSG("_nic_txfree\n");
870 863
871 pending = sp->tx_current - sp->tx_dirty; 864 pending = sp->tx_current - sp->tx_dirty;
865 dirty = sp->tx_dirty % IPG_TFDLIST_LENGTH;
872 866
873 for (released = 0; released < pending; released++) { 867 for (released = 0; released < pending; released++) {
874 unsigned int dirty = sp->tx_dirty % IPG_TFDLIST_LENGTH;
875 struct sk_buff *skb = sp->TxBuff[dirty]; 868 struct sk_buff *skb = sp->TxBuff[dirty];
876 struct ipg_tx *txfd = sp->txd + dirty; 869 struct ipg_tx *txfd = sp->txd + dirty;
877 870
@@ -882,11 +875,8 @@ static void ipg_nic_txfree(struct net_device *dev)
882 * If the TFDDone bit is set, free the associated 875 * If the TFDDone bit is set, free the associated
883 * buffer. 876 * buffer.
884 */ 877 */
885 if (dirty == curr) 878 if (!(txfd->tfc & cpu_to_le64(IPG_TFC_TFDDONE)))
886 break; 879 break;
887
888 /* Setup TFDDONE for compatible issue. */
889 txfd->tfc |= cpu_to_le64(IPG_TFC_TFDDONE);
890 880
891 /* Free the transmit buffer. */ 881 /* Free the transmit buffer. */
892 if (skb) { 882 if (skb) {
@@ -898,6 +888,7 @@ static void ipg_nic_txfree(struct net_device *dev)
898 888
899 sp->TxBuff[dirty] = NULL; 889 sp->TxBuff[dirty] = NULL;
900 } 890 }
891 dirty = (dirty + 1) % IPG_TFDLIST_LENGTH;
901 } 892 }
902 893
903 sp->tx_dirty += released; 894 sp->tx_dirty += released;
@@ -1630,6 +1621,8 @@ static irqreturn_t ipg_interrupt_handler(int irq, void *dev_inst)
1630#ifdef JUMBO_FRAME 1621#ifdef JUMBO_FRAME
1631 ipg_nic_rxrestore(dev); 1622 ipg_nic_rxrestore(dev);
1632#endif 1623#endif
1624 spin_lock(&sp->lock);
1625
1633 /* Get interrupt source information, and acknowledge 1626 /* Get interrupt source information, and acknowledge
1634 * some (i.e. TxDMAComplete, RxDMAComplete, RxEarly, 1627 * some (i.e. TxDMAComplete, RxDMAComplete, RxEarly,
1635 * IntRequested, MacControlFrame, LinkEvent) interrupts 1628 * IntRequested, MacControlFrame, LinkEvent) interrupts
@@ -1647,9 +1640,7 @@ static irqreturn_t ipg_interrupt_handler(int irq, void *dev_inst)
1647 handled = 1; 1640 handled = 1;
1648 1641
1649 if (unlikely(!netif_running(dev))) 1642 if (unlikely(!netif_running(dev)))
1650 goto out; 1643 goto out_unlock;
1651
1652 spin_lock(&sp->lock);
1653 1644
1654 /* If RFDListEnd interrupt, restore all used RFDs. */ 1645 /* If RFDListEnd interrupt, restore all used RFDs. */
1655 if (status & IPG_IS_RFD_LIST_END) { 1646 if (status & IPG_IS_RFD_LIST_END) {
@@ -1733,9 +1724,9 @@ out_enable:
1733 ipg_w16(IPG_IE_TX_DMA_COMPLETE | IPG_IE_RX_DMA_COMPLETE | 1724 ipg_w16(IPG_IE_TX_DMA_COMPLETE | IPG_IE_RX_DMA_COMPLETE |
1734 IPG_IE_HOST_ERROR | IPG_IE_INT_REQUESTED | IPG_IE_TX_COMPLETE | 1725 IPG_IE_HOST_ERROR | IPG_IE_INT_REQUESTED | IPG_IE_TX_COMPLETE |
1735 IPG_IE_LINK_EVENT | IPG_IE_UPDATE_STATS, INT_ENABLE); 1726 IPG_IE_LINK_EVENT | IPG_IE_UPDATE_STATS, INT_ENABLE);
1736 1727out_unlock:
1737 spin_unlock(&sp->lock); 1728 spin_unlock(&sp->lock);
1738out: 1729
1739 return IRQ_RETVAL(handled); 1730 return IRQ_RETVAL(handled);
1740} 1731}
1741 1732
@@ -1943,10 +1934,7 @@ static int ipg_nic_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
1943 */ 1934 */
1944 if (sp->tenmbpsmode) 1935 if (sp->tenmbpsmode)
1945 txfd->tfc |= cpu_to_le64(IPG_TFC_TXINDICATE); 1936 txfd->tfc |= cpu_to_le64(IPG_TFC_TXINDICATE);
1946 else if (!((sp->tx_current - sp->tx_dirty + 1) > 1937 txfd->tfc |= cpu_to_le64(IPG_TFC_TXDMAINDICATE);
1947 IPG_FRAMESBETWEENTXDMACOMPLETES)) {
1948 txfd->tfc |= cpu_to_le64(IPG_TFC_TXDMAINDICATE);
1949 }
1950 /* Based on compilation option, determine if FCS is to be 1938 /* Based on compilation option, determine if FCS is to be
1951 * appended to transmit frame by IPG. 1939 * appended to transmit frame by IPG.
1952 */ 1940 */
@@ -2003,7 +1991,7 @@ static int ipg_nic_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
2003 ipg_w32(IPG_DC_TX_DMA_POLL_NOW, DMA_CTRL); 1991 ipg_w32(IPG_DC_TX_DMA_POLL_NOW, DMA_CTRL);
2004 1992
2005 if (sp->tx_current == (sp->tx_dirty + IPG_TFDLIST_LENGTH)) 1993 if (sp->tx_current == (sp->tx_dirty + IPG_TFDLIST_LENGTH))
2006 netif_wake_queue(dev); 1994 netif_stop_queue(dev);
2007 1995
2008 spin_unlock_irqrestore(&sp->lock, flags); 1996 spin_unlock_irqrestore(&sp->lock, flags);
2009 1997