Skip to contentSkip to conversation

macvtap: fix tx_dropped counting error

PATCH Applied Jason Wang 4 participants 4 messages Nov 25, 2013 – Nov 28, 2013

Subsystems (2)
lore
Share & tools
lore

Jason Wang

author
#0 lore raw

PATCH 1/1 macvtap: fix tx_dropped counting error

After commit 8ffab51b3dfc54876f145f15b351c41f3f703195
(macvlan: lockless tx path), tx stat counter were converted to percpu stat structure. So we need use to this also for tx_dropped in macvtap. Otherwise, the management won't notice the dropping packet in macvtap tx path.

Cc Michael S. Tsirkin <[email protected]>
Cc Vlad Yasevich <[email protected]>
Cc Eric Dumazet <[email protected]>
---
 drivers/net/macvtap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/macvtap.c +1 -1
index dc76670..0605da8 100644
@@ -744,7 +744,7 @@ err:
 	rcu_read_lock();
 	vlan = rcu_dereference(q->vlan);
 	if (vlan)
-		vlan->dev->stats.tx_dropped++;
+		this_cpu_inc(vlan->pcpu_stats->tx_dropped);
 	rcu_read_unlock();
 
 	return err;
Signature · 1 line
1.8.3.2
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Jason Wang

After commit 8ffab51b3dfc54876f145f15b351c41f3f703195
(macvlan: lockless tx path), tx stat counter were converted to percpu stat structure. So we need use to this also for tx_dropped in macvtap. Otherwise, the management won't notice the dropping packet in macvtap tx path.

Cc Michael S. Tsirkin <[email protected]>
Cc Vlad Yasevich <[email protected]>
Cc Eric Dumazet <[email protected]>
Quoted 19 lines
---
 drivers/net/macvtap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/macvtap.c +1 -1
index dc76670..0605da8 100644
@@ -744,7 +744,7 @@ err:
 	rcu_read_lock();
 	vlan = rcu_dereference(q->vlan);
 	if (vlan)
-		vlan->dev->stats.tx_dropped++;
+		this_cpu_inc(vlan->pcpu_stats->tx_dropped);
 	rcu_read_unlock();
 
 	return err;
Signature · 1 line
1.8.3.2
Acked-by on v1 1/1
#2 lore raw
In reply to Jason Wang
Quoted 7 lines · Jason Wang

After commit 8ffab51b3dfc54876f145f15b351c41f3f703195
(macvlan: lockless tx path), tx stat counter were converted to percpu stat structure. So we need use to this also for tx_dropped in macvtap. Otherwise, the management won't notice the dropping packet in macvtap tx path.

Cc Michael S. Tsirkin <[email protected]>
Cc Vlad Yasevich <[email protected]>

-vlad

Quoted 20 lines
---
 drivers/net/macvtap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/macvtap.c +1 -1
index dc76670..0605da8 100644
@@ -744,7 +744,7 @@ err:
 	rcu_read_lock();
 	vlan = rcu_dereference(q->vlan);
 	if (vlan)
-		vlan->dev->stats.tx_dropped++;
+		this_cpu_inc(vlan->pcpu_stats->tx_dropped);
 	rcu_read_unlock();
 
 	return err;
maintainer Applied
#3 lore raw
In reply to Jason Wang

From: Jason Wang <[email protected]>
Date: Mon, 25 Nov 2013 17:19:04 +0800

Quoted 9 lines

After commit 8ffab51b3dfc54876f145f15b351c41f3f703195
(macvlan: lockless tx path), tx stat counter were converted to percpu stat structure. So we need use to this also for tx_dropped in macvtap. Otherwise, the management won't notice the dropping packet in macvtap tx path.

Cc Michael S. Tsirkin <[email protected]>
Cc Vlad Yasevich <[email protected]>
Cc Eric Dumazet <[email protected]>

Applied, thanks Jason.