aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/via
diff options
context:
space:
mode:
authorFrancois Romieu <romieu@fr.zoreil.com>2011-12-30 08:43:54 -0500
committerFrancois Romieu <romieu@fr.zoreil.com>2012-01-07 17:02:37 -0500
commit269f3114b53a3ce93eb5977852ac2624a380f600 (patch)
tree69edc14121322f20696ccf2d0463dbea1cd664e6 /drivers/net/ethernet/via
parent356b95424cfb456e14a59eaa579422ce014c424b (diff)
via-rhine: factor out tx_thresh handling
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Diffstat (limited to 'drivers/net/ethernet/via')
-rw-r--r--drivers/net/ethernet/via/via-rhine.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c
index 5c4983b2870a..93987e84be18 100644
--- a/drivers/net/ethernet/via/via-rhine.c
+++ b/drivers/net/ethernet/via/via-rhine.c
@@ -657,6 +657,16 @@ static void rhine_poll(struct net_device *dev)
657} 657}
658#endif 658#endif
659 659
660static void rhine_kick_tx_threshold(struct rhine_private *rp)
661{
662 if (rp->tx_thresh < 0xe0) {
663 void __iomem *ioaddr = rp->base;
664
665 rp->tx_thresh += 0x20;
666 BYTE_REG_BITS_SET(rp->tx_thresh, 0x80, ioaddr + TxConfig);
667 }
668}
669
660static int rhine_napipoll(struct napi_struct *napi, int budget) 670static int rhine_napipoll(struct napi_struct *napi, int budget)
661{ 671{
662 struct rhine_private *rp = container_of(napi, struct rhine_private, napi); 672 struct rhine_private *rp = container_of(napi, struct rhine_private, napi);
@@ -1910,8 +1920,7 @@ static void rhine_error(struct net_device *dev, int intr_status)
1910 intr_status); 1920 intr_status);
1911 } 1921 }
1912 if (intr_status & IntrTxUnderrun) { 1922 if (intr_status & IntrTxUnderrun) {
1913 if (rp->tx_thresh < 0xE0) 1923 rhine_kick_tx_threshold(rp);
1914 BYTE_REG_BITS_SET((rp->tx_thresh += 0x20), 0x80, ioaddr + TxConfig);
1915 if (debug > 1) 1924 if (debug > 1)
1916 netdev_info(dev, "Transmitter underrun, Tx threshold now %02x\n", 1925 netdev_info(dev, "Transmitter underrun, Tx threshold now %02x\n",
1917 rp->tx_thresh); 1926 rp->tx_thresh);
@@ -1923,9 +1932,7 @@ static void rhine_error(struct net_device *dev, int intr_status)
1923 if ((intr_status & IntrTxError) && 1932 if ((intr_status & IntrTxError) &&
1924 (intr_status & (IntrTxAborted | 1933 (intr_status & (IntrTxAborted |
1925 IntrTxUnderrun | IntrTxDescRace)) == 0) { 1934 IntrTxUnderrun | IntrTxDescRace)) == 0) {
1926 if (rp->tx_thresh < 0xE0) { 1935 rhine_kick_tx_threshold(rp);
1927 BYTE_REG_BITS_SET((rp->tx_thresh += 0x20), 0x80, ioaddr + TxConfig);
1928 }
1929 if (debug > 1) 1936 if (debug > 1)
1930 netdev_info(dev, "Unspecified error. Tx threshold now %02x\n", 1937 netdev_info(dev, "Unspecified error. Tx threshold now %02x\n",
1931 rp->tx_thresh); 1938 rp->tx_thresh);