summaryrefslogtreecommitdiffstats
path: root/debian/patches-rt/0004-gen_stats-Move-remaining-users-to-gnet_stats_add_que.patch
blob: 421e84227f14963eca6289bc576bdb9fc500a7fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Sat, 16 Oct 2021 10:49:05 +0200
Subject: [PATCH 4/9] gen_stats: Move remaining users to
 gnet_stats_add_queue().
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/5.15/older/patches-5.15.3-rt21.tar.xz

The gnet_stats_queue::qlen member is only used in the SMP-case.

qdisc_qstats_qlen_backlog() needs to add qdisc_qlen() to qstats.qlen to
have the same value as that provided by qdisc_qlen_sum().

gnet_stats_copy_queue() needs to overwritte the resulting qstats.qlen
field whith the caller submitted qlen value. It might be differ from the
submitted value.

Let both functions use gnet_stats_add_queue() and remove unused
__gnet_stats_copy_queue().

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 include/net/gen_stats.h   |    3 ---
 include/net/sch_generic.h |    5 ++---
 net/core/gen_stats.c      |   39 ++-------------------------------------
 3 files changed, 4 insertions(+), 43 deletions(-)

--- a/include/net/gen_stats.h
+++ b/include/net/gen_stats.h
@@ -59,9 +59,6 @@ int gnet_stats_copy_rate_est(struct gnet
 int gnet_stats_copy_queue(struct gnet_dump *d,
 			  struct gnet_stats_queue __percpu *cpu_q,
 			  struct gnet_stats_queue *q, __u32 qlen);
-void __gnet_stats_copy_queue(struct gnet_stats_queue *qstats,
-			     const struct gnet_stats_queue __percpu *cpu_q,
-			     const struct gnet_stats_queue *q, __u32 qlen);
 void gnet_stats_add_queue(struct gnet_stats_queue *qstats,
 			  const struct gnet_stats_queue __percpu *cpu_q,
 			  const struct gnet_stats_queue *q);
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -968,10 +968,9 @@ static inline void qdisc_qstats_qlen_bac
 					     __u32 *backlog)
 {
 	struct gnet_stats_queue qstats = { 0 };
-	__u32 len = qdisc_qlen_sum(sch);
 
-	__gnet_stats_copy_queue(&qstats, sch->cpu_qstats, &sch->qstats, len);
-	*qlen = qstats.qlen;
+	gnet_stats_add_queue(&qstats, sch->cpu_qstats, &sch->qstats);
+	*qlen = qstats.qlen + qdisc_qlen(sch);
 	*backlog = qstats.backlog;
 }
 
--- a/net/core/gen_stats.c
+++ b/net/core/gen_stats.c
@@ -285,42 +285,6 @@ gnet_stats_copy_rate_est(struct gnet_dum
 }
 EXPORT_SYMBOL(gnet_stats_copy_rate_est);
 
-static void
-__gnet_stats_copy_queue_cpu(struct gnet_stats_queue *qstats,
-			    const struct gnet_stats_queue __percpu *q)
-{
-	int i;
-
-	for_each_possible_cpu(i) {
-		const struct gnet_stats_queue *qcpu = per_cpu_ptr(q, i);
-
-		qstats->qlen = 0;
-		qstats->backlog += qcpu->backlog;
-		qstats->drops += qcpu->drops;
-		qstats->requeues += qcpu->requeues;
-		qstats->overlimits += qcpu->overlimits;
-	}
-}
-
-void __gnet_stats_copy_queue(struct gnet_stats_queue *qstats,
-			     const struct gnet_stats_queue __percpu *cpu,
-			     const struct gnet_stats_queue *q,
-			     __u32 qlen)
-{
-	if (cpu) {
-		__gnet_stats_copy_queue_cpu(qstats, cpu);
-	} else {
-		qstats->qlen = q->qlen;
-		qstats->backlog = q->backlog;
-		qstats->drops = q->drops;
-		qstats->requeues = q->requeues;
-		qstats->overlimits = q->overlimits;
-	}
-
-	qstats->qlen = qlen;
-}
-EXPORT_SYMBOL(__gnet_stats_copy_queue);
-
 static void gnet_stats_add_queue_cpu(struct gnet_stats_queue *qstats,
 				     const struct gnet_stats_queue __percpu *q)
 {
@@ -374,7 +338,8 @@ gnet_stats_copy_queue(struct gnet_dump *
 {
 	struct gnet_stats_queue qstats = {0};
 
-	__gnet_stats_copy_queue(&qstats, cpu_q, q, qlen);
+	gnet_stats_add_queue(&qstats, cpu_q, q);
+	qstats.qlen = qlen;
 
 	if (d->compat_tc_stats) {
 		d->tc_stats.drops = qstats.drops;