aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2010-01-31 12:48:48 +0000
committerGabor Juhos <juhosg@openwrt.org>2010-01-31 12:48:48 +0000
commitb84db9ddc36a29867be0a2a4863f066524d50655 (patch)
tree11e43721145db647ec3122e13f8d3ab6873ee625 /target/linux
parent150f80a0ed48f1cd1252695c904d330a0487343d (diff)
downloadmaster-187ad058-b84db9ddc36a29867be0a2a4863f066524d50655.tar.gz
master-187ad058-b84db9ddc36a29867be0a2a4863f066524d50655.tar.bz2
master-187ad058-b84db9ddc36a29867be0a2a4863f066524d50655.zip
ramips_eth: simplify tx_next computation
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@19444 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/ramips/files/drivers/net/ramips.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/target/linux/ramips/files/drivers/net/ramips.c b/target/linux/ramips/files/drivers/net/ramips.c
index 3061bccc07..ed748de0d3 100644
--- a/target/linux/ramips/files/drivers/net/ramips.c
+++ b/target/linux/ramips/files/drivers/net/ramips.c
@@ -163,10 +163,7 @@ ramips_eth_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
dma_sync_single_for_device(NULL, mapped_addr, skb->len, DMA_TO_DEVICE);
spin_lock_irqsave(&priv->page_lock, flags);
tx = ramips_fe_rr(RAMIPS_TX_CTX_IDX0);
- if (tx == NUM_TX_DESC - 1)
- tx_next = 0;
- else
- tx_next = tx + 1;
+ tx_next = (tx + 1) % NUM_TX_DESC;
if ((priv->tx_skb[tx]) || (priv->tx_skb[tx_next]) ||
!(priv->tx[tx].txd2 & TX_DMA_DONE) ||
@@ -180,7 +177,7 @@ ramips_eth_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
dev->stats.tx_bytes += skb->len;
priv->tx_skb[tx] = skb;
wmb();
- ramips_fe_wr((tx + 1) % NUM_TX_DESC, RAMIPS_TX_CTX_IDX0);
+ ramips_fe_wr(tx_next, RAMIPS_TX_CTX_IDX0);
spin_unlock_irqrestore(&priv->page_lock, flags);
return NETDEV_TX_OK;