aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2015-01-17 13:13:55 +0000
committerFelix Fietkau <nbd@openwrt.org>2015-01-17 13:13:55 +0000
commit8ce6953097a06de29ea8e51060a94510e69a0d27 (patch)
treebd5fa058384cbda4faa2cecd3756ac7079ad0ef5
parent99251118843a55f925ba6f8a44d25efe85537d72 (diff)
downloadmaster-187ad058-8ce6953097a06de29ea8e51060a94510e69a0d27.tar.gz
master-187ad058-8ce6953097a06de29ea8e51060a94510e69a0d27.tar.bz2
master-187ad058-8ce6953097a06de29ea8e51060a94510e69a0d27.zip
ramips: fix tx bql related race condition in the ethernet driver
Signed-off-by: Felix Fietkau <nbd@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@43995 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c
index 67934c61a0..925cc4cc6b 100644
--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c
@@ -568,6 +568,9 @@ static int fe_tx_map_dma(struct sk_buff *skb, struct net_device *dev,
/* store skb to cleanup */
priv->tx_skb[j] = skb;
+ netdev_sent_queue(dev, skb->len);
+ skb_tx_timestamp(skb);
+
wmb();
j = NEXT_TX_DESP_IDX(j);
fe_reg_w32(j, FE_REG_TX_CTX_IDX0);
@@ -646,6 +649,7 @@ static int fe_start_xmit(struct sk_buff *skb, struct net_device *dev)
struct net_device_stats *stats = &dev->stats;
u32 tx;
int tx_num;
+ int len = skb->len;
if (fe_skb_padto(skb, priv)) {
netif_warn(priv, tx_err, dev, "tx padding failed!\n");
@@ -669,11 +673,8 @@ static int fe_start_xmit(struct sk_buff *skb, struct net_device *dev)
stats->tx_dropped++;
} else {
- netdev_sent_queue(dev, skb->len);
- skb_tx_timestamp(skb);
-
stats->tx_packets++;
- stats->tx_bytes += skb->len;
+ stats->tx_bytes += len;
}
spin_unlock(&priv->page_lock);