Merge branch 'ipg-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/romieu/netdev-2.6 into upstream-fixes

This commit is contained in:
Jeff Garzik 2008-01-18 14:39:26 -05:00
Родитель 5655662dab 47cccd7d7c
Коммит 220df5c3de
1 изменённых файлов: 12 добавлений и 24 удалений

Просмотреть файл

@ -857,21 +857,14 @@ static void init_tfdlist(struct net_device *dev)
static void ipg_nic_txfree(struct net_device *dev) static void ipg_nic_txfree(struct net_device *dev)
{ {
struct ipg_nic_private *sp = netdev_priv(dev); struct ipg_nic_private *sp = netdev_priv(dev);
void __iomem *ioaddr = sp->ioaddr; unsigned int released, pending, dirty;
unsigned int curr;
u64 txd_map;
unsigned int released, pending;
txd_map = (u64)sp->txd_map;
curr = ipg_r32(TFD_LIST_PTR_0) -
do_div(txd_map, sizeof(struct ipg_tx)) - 1;
IPG_DEBUG_MSG("_nic_txfree\n"); IPG_DEBUG_MSG("_nic_txfree\n");
pending = sp->tx_current - sp->tx_dirty; pending = sp->tx_current - sp->tx_dirty;
dirty = sp->tx_dirty % IPG_TFDLIST_LENGTH;
for (released = 0; released < pending; released++) { for (released = 0; released < pending; released++) {
unsigned int dirty = sp->tx_dirty % IPG_TFDLIST_LENGTH;
struct sk_buff *skb = sp->TxBuff[dirty]; struct sk_buff *skb = sp->TxBuff[dirty];
struct ipg_tx *txfd = sp->txd + dirty; struct ipg_tx *txfd = sp->txd + dirty;
@ -882,11 +875,8 @@ static void ipg_nic_txfree(struct net_device *dev)
* If the TFDDone bit is set, free the associated * If the TFDDone bit is set, free the associated
* buffer. * buffer.
*/ */
if (dirty == curr) if (!(txfd->tfc & cpu_to_le64(IPG_TFC_TFDDONE)))
break; break;
/* Setup TFDDONE for compatible issue. */
txfd->tfc |= cpu_to_le64(IPG_TFC_TFDDONE);
/* Free the transmit buffer. */ /* Free the transmit buffer. */
if (skb) { if (skb) {
@ -898,6 +888,7 @@ static void ipg_nic_txfree(struct net_device *dev)
sp->TxBuff[dirty] = NULL; sp->TxBuff[dirty] = NULL;
} }
dirty = (dirty + 1) % IPG_TFDLIST_LENGTH;
} }
sp->tx_dirty += released; sp->tx_dirty += released;
@ -1630,6 +1621,8 @@ static irqreturn_t ipg_interrupt_handler(int irq, void *dev_inst)
#ifdef JUMBO_FRAME #ifdef JUMBO_FRAME
ipg_nic_rxrestore(dev); ipg_nic_rxrestore(dev);
#endif #endif
spin_lock(&sp->lock);
/* Get interrupt source information, and acknowledge /* Get interrupt source information, and acknowledge
* some (i.e. TxDMAComplete, RxDMAComplete, RxEarly, * some (i.e. TxDMAComplete, RxDMAComplete, RxEarly,
* IntRequested, MacControlFrame, LinkEvent) interrupts * IntRequested, MacControlFrame, LinkEvent) interrupts
@ -1647,9 +1640,7 @@ static irqreturn_t ipg_interrupt_handler(int irq, void *dev_inst)
handled = 1; handled = 1;
if (unlikely(!netif_running(dev))) if (unlikely(!netif_running(dev)))
goto out; goto out_unlock;
spin_lock(&sp->lock);
/* If RFDListEnd interrupt, restore all used RFDs. */ /* If RFDListEnd interrupt, restore all used RFDs. */
if (status & IPG_IS_RFD_LIST_END) { if (status & IPG_IS_RFD_LIST_END) {
@ -1733,9 +1724,9 @@ out_enable:
ipg_w16(IPG_IE_TX_DMA_COMPLETE | IPG_IE_RX_DMA_COMPLETE | ipg_w16(IPG_IE_TX_DMA_COMPLETE | IPG_IE_RX_DMA_COMPLETE |
IPG_IE_HOST_ERROR | IPG_IE_INT_REQUESTED | IPG_IE_TX_COMPLETE | IPG_IE_HOST_ERROR | IPG_IE_INT_REQUESTED | IPG_IE_TX_COMPLETE |
IPG_IE_LINK_EVENT | IPG_IE_UPDATE_STATS, INT_ENABLE); IPG_IE_LINK_EVENT | IPG_IE_UPDATE_STATS, INT_ENABLE);
out_unlock:
spin_unlock(&sp->lock); spin_unlock(&sp->lock);
out:
return IRQ_RETVAL(handled); return IRQ_RETVAL(handled);
} }
@ -1943,10 +1934,7 @@ static int ipg_nic_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
*/ */
if (sp->tenmbpsmode) if (sp->tenmbpsmode)
txfd->tfc |= cpu_to_le64(IPG_TFC_TXINDICATE); txfd->tfc |= cpu_to_le64(IPG_TFC_TXINDICATE);
else if (!((sp->tx_current - sp->tx_dirty + 1) > txfd->tfc |= cpu_to_le64(IPG_TFC_TXDMAINDICATE);
IPG_FRAMESBETWEENTXDMACOMPLETES)) {
txfd->tfc |= cpu_to_le64(IPG_TFC_TXDMAINDICATE);
}
/* Based on compilation option, determine if FCS is to be /* Based on compilation option, determine if FCS is to be
* appended to transmit frame by IPG. * appended to transmit frame by IPG.
*/ */
@ -2003,7 +1991,7 @@ static int ipg_nic_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
ipg_w32(IPG_DC_TX_DMA_POLL_NOW, DMA_CTRL); ipg_w32(IPG_DC_TX_DMA_POLL_NOW, DMA_CTRL);
if (sp->tx_current == (sp->tx_dirty + IPG_TFDLIST_LENGTH)) if (sp->tx_current == (sp->tx_dirty + IPG_TFDLIST_LENGTH))
netif_wake_queue(dev); netif_stop_queue(dev);
spin_unlock_irqrestore(&sp->lock, flags); spin_unlock_irqrestore(&sp->lock, flags);