From f2ca8f33b73ad7526d4b9960358c148247d744d7 Mon Sep 17 00:00:00 2001 From: Olof Johansson Date: Wed, 28 Nov 2007 20:56:54 -0600 Subject: [PATCH] --- yaml --- r: 78975 b: refs/heads/master c: 61cec3bddc79373a246e2f8eb13e5acdc106f46a h: refs/heads/master i: 78973: 9e812dbf1c6b39bfe213c2c0f4b28c96d748b73f 78971: 139ba9fc2c0a270c5be8e7dc02411031ef68d7f8 78967: 7cd2df6402dd861ac4f2664561bbfa6019dd6ecf 78959: db51535362f60ffcc7a847c920be6d6898f1add4 78943: d3b0cfa915de0761b276e95578747a1c72dc9f39 78911: d46a6a0b243030973150599658ba45bfba5e6025 78847: 24505d58f037a2884a456b2348d9fad0d38342b3 v: v3 --- [refs] | 2 +- trunk/drivers/net/pasemi_mac.c | 41 +++++++++++++++++++++++++++------- trunk/drivers/net/pasemi_mac.h | 1 + 3 files changed, 35 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index 2c6e6ef2ca34..3a6c896ba10e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5c15332bed4c59fff6423f08ef6bd6894af38a99 +refs/heads/master: 61cec3bddc79373a246e2f8eb13e5acdc106f46a diff --git a/trunk/drivers/net/pasemi_mac.c b/trunk/drivers/net/pasemi_mac.c index c6e24a8dcf72..683e8de0ac89 100644 --- a/trunk/drivers/net/pasemi_mac.c +++ b/trunk/drivers/net/pasemi_mac.c @@ -805,27 +805,43 @@ static irqreturn_t pasemi_mac_rx_intr(int irq, void *data) return IRQ_HANDLED; } +#define TX_CLEAN_INTERVAL HZ + +static void pasemi_mac_tx_timer(unsigned long data) +{ + struct pasemi_mac_txring *txring = (struct pasemi_mac_txring *)data; + struct pasemi_mac *mac = txring->mac; + + pasemi_mac_clean_tx(txring); + + mod_timer(&txring->clean_timer, jiffies + TX_CLEAN_INTERVAL); + + pasemi_mac_restart_tx_intr(mac); +} + static irqreturn_t pasemi_mac_tx_intr(int irq, void *data) { struct pasemi_mac_txring *txring = data; const struct pasemi_dmachan *chan = &txring->chan; - unsigned int reg, pcnt; + struct pasemi_mac *mac = txring->mac; + unsigned int reg; if (!(*chan->status & PAS_STATUS_CAUSE_M)) return IRQ_NONE; - pasemi_mac_clean_tx(txring); - - pcnt = *chan->status & PAS_STATUS_PCNT_M; - - reg = PAS_IOB_DMA_TXCH_RESET_PCNT(pcnt) | PAS_IOB_DMA_TXCH_RESET_PINTC; + reg = 0; if (*chan->status & PAS_STATUS_SOFT) reg |= PAS_IOB_DMA_TXCH_RESET_SINTC; if (*chan->status & PAS_STATUS_ERROR) reg |= PAS_IOB_DMA_TXCH_RESET_DINTC; - write_iob_reg(PAS_IOB_DMA_TXCH_RESET(chan->chno), reg); + mod_timer(&txring->clean_timer, jiffies + (TX_CLEAN_INTERVAL)*2); + + netif_rx_schedule(mac->netdev, &mac->napi); + + if (reg) + write_iob_reg(PAS_IOB_DMA_TXCH_RESET(chan->chno), reg); return IRQ_HANDLED; } @@ -973,7 +989,7 @@ static int pasemi_mac_open(struct net_device *dev) PAS_IOB_DMA_RXCH_CFG_CNTTH(0)); write_iob_reg(PAS_IOB_DMA_TXCH_CFG(mac->tx->chan.chno), - PAS_IOB_DMA_TXCH_CFG_CNTTH(128)); + PAS_IOB_DMA_TXCH_CFG_CNTTH(32)); write_mac_reg(mac, PAS_MAC_IPC_CHNL, PAS_MAC_IPC_CHNL_DCHNO(mac->rx->chan.chno) | @@ -1054,6 +1070,12 @@ static int pasemi_mac_open(struct net_device *dev) if (mac->phydev) phy_start(mac->phydev); + init_timer(&mac->tx->clean_timer); + mac->tx->clean_timer.function = pasemi_mac_tx_timer; + mac->tx->clean_timer.data = (unsigned long)mac->tx; + mac->tx->clean_timer.expires = jiffies+HZ; + add_timer(&mac->tx->clean_timer); + return 0; out_rx_int: @@ -1087,6 +1109,8 @@ static int pasemi_mac_close(struct net_device *dev) phy_disconnect(mac->phydev); } + del_timer_sync(&mac->tx->clean_timer); + netif_stop_queue(dev); napi_disable(&mac->napi); @@ -1304,6 +1328,7 @@ static int pasemi_mac_poll(struct napi_struct *napi, int budget) netif_rx_complete(dev, napi); pasemi_mac_restart_rx_intr(mac); + pasemi_mac_restart_tx_intr(mac); } return pkts; } diff --git a/trunk/drivers/net/pasemi_mac.h b/trunk/drivers/net/pasemi_mac.h index 64b2047d19f0..c6555edba55d 100644 --- a/trunk/drivers/net/pasemi_mac.h +++ b/trunk/drivers/net/pasemi_mac.h @@ -34,6 +34,7 @@ struct pasemi_mac_txring { unsigned int next_to_clean; struct pasemi_mac_buffer *ring_info; struct pasemi_mac *mac; /* Needed in intr handler */ + struct timer_list clean_timer; }; struct pasemi_mac_rxring {