[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1429101008-9464-5-git-send-email-dingtianhong@huawei.com>
Date: Wed, 15 Apr 2015 20:30:06 +0800
From: Ding Tianhong <dingtianhong@...wei.com>
To: <arnd@...db.de>, <davem@...emloft.net>, <grant.likely@...aro.org>
CC: <sergei.shtylyov@...entembedded.com>,
<linux-arm-kernel@...ts.infradead.org>, <eric.dumazet@...il.com>,
<zhangfei.gao@...aro.org>, <joe@...ches.com>,
<netdev@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux@....linux.org.uk>
Subject: [PATCH net-next 4/6] net: hip04: Don't free the tx skb when the buffer is not ready for xmit
Eric pointed out the problem that the tx skb might already have be freed
by tx completion before enter the xmit queue, so don't notice the tx completion
until the skb is ready to be freed.
Signed-off-by: Ding Tianhong <dingtianhong@...wei.com>
Cc: "David S. Miller" <davem@...emloft.net>
Cc: Eric Dumazet <eric.dumazet@...il.com>
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Zhangfei Gao <zhangfei.gao@...aro.org>
Cc: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Joe Perches <joe@...ches.com>
---
drivers/net/ethernet/hisilicon/hip04_eth.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c
index 7533858..ff9d19c 100644
--- a/drivers/net/ethernet/hisilicon/hip04_eth.c
+++ b/drivers/net/ethernet/hisilicon/hip04_eth.c
@@ -480,8 +480,6 @@ static int hip04_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
skb_tx_timestamp(skb);
hip04_set_xmit_desc(priv, phys);
- priv->tx_head = TX_NEXT(tx_head);
- count++;
netdev_sent_queue(ndev, skb->len);
stats->tx_bytes += skb->len;
@@ -489,6 +487,8 @@ static int hip04_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
/* Ensure tx_head update visible to tx reclaim */
smp_wmb();
+ count++;
+ priv->tx_head = TX_NEXT(tx_head);
/* queue is getting full, better start cleaning up now */
if (count >= priv->tx_coalesce_frames) {
--
1.8.0
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists