@@ -145,6 +145,7 @@ __gnet_stats_copy_basic(const seqcount_t *running,
unsigned int seq;
if (cpu) {
+ memset(bstats, 0, sizeof(*bstats));
__gnet_stats_copy_basic_cpu(bstats, cpu);
return;
}
@@ -305,6 +306,7 @@ void __gnet_stats_copy_queue(struct gnet_stats_queue *qstats,
__u32 qlen)
{
if (cpu) {
+ memset(qstats, 0, sizeof(*qstats));
__gnet_stats_copy_queue_cpu(qstats, cpu);
} else {
qstats->qlen = q->qlen;
@@ -131,6 +131,8 @@ static int mq_dump(struct Qdisc *sch, struct sk_buff *skb)
struct Qdisc *qdisc;
unsigned int ntx;
__u32 qlen = 0;
+ struct gnet_stats_queue qstats = {0};
+ struct gnet_stats_basic_packed bstats = {0};
sch->q.qlen = 0;
memset(&sch->bstats, 0, sizeof(sch->bstats));
@@ -145,25 +147,20 @@ static int mq_dump(struct Qdisc *sch, struct sk_buff *skb)
qdisc = netdev_get_tx_queue(dev, ntx)->qdisc_sleeping;
spin_lock_bh(qdisc_lock(qdisc));
- if (qdisc_is_percpu_stats(qdisc)) {
- qlen = qdisc_qlen_sum(qdisc);
- __gnet_stats_copy_basic(NULL, &sch->bstats,
- qdisc->cpu_bstats,
- &qdisc->bstats);
- __gnet_stats_copy_queue(&sch->qstats,
- qdisc->cpu_qstats,
- &qdisc->qstats, qlen);
- sch->q.qlen += qlen;
- } else {
- sch->q.qlen += qdisc->q.qlen;
- sch->bstats.bytes += qdisc->bstats.bytes;
- sch->bstats.packets += qdisc->bstats.packets;
- sch->qstats.qlen += qdisc->qstats.qlen;
- sch->qstats.backlog += qdisc->qstats.backlog;
- sch->qstats.drops += qdisc->qstats.drops;
- sch->qstats.requeues += qdisc->qstats.requeues;
- sch->qstats.overlimits += qdisc->qstats.overlimits;
- }
+ qlen = qdisc_qlen_sum(qdisc);
+ __gnet_stats_copy_basic(NULL, &bstats, qdisc->cpu_bstats,
+ &qdisc->bstats);
+ __gnet_stats_copy_queue(&qstats, qdisc->cpu_qstats,
+ &qdisc->qstats, qlen);
+
+ sch->q.qlen += qdisc->q.qlen;
+ sch->bstats.bytes += bstats.bytes;
+ sch->bstats.packets += bstats.packets;
+ sch->qstats.qlen += qstats.qlen;
+ sch->qstats.backlog += qstats.backlog;
+ sch->qstats.drops += qstats.drops;
+ sch->qstats.requeues += qstats.requeues;
+ sch->qstats.overlimits += qstats.overlimits;
spin_unlock_bh(qdisc_lock(qdisc));
}
@@ -388,6 +388,9 @@ static int mqprio_dump(struct Qdisc *sch, struct sk_buff *skb)
struct tc_mqprio_qopt opt = { 0 };
struct Qdisc *qdisc;
unsigned int ntx, tc;
+ __u32 qlen = 0;
+ struct gnet_stats_queue qstats = {0};
+ struct gnet_stats_basic_packed bstats = {0};
sch->q.qlen = 0;
memset(&sch->bstats, 0, sizeof(sch->bstats));
@@ -402,25 +405,20 @@ static int mqprio_dump(struct Qdisc *sch, struct sk_buff *skb)
qdisc = netdev_get_tx_queue(dev, ntx)->qdisc_sleeping;
spin_lock_bh(qdisc_lock(qdisc));
- if (qdisc_is_percpu_stats(qdisc)) {
- __u32 qlen = qdisc_qlen_sum(qdisc);
-
- __gnet_stats_copy_basic(NULL, &sch->bstats,
- qdisc->cpu_bstats,
- &qdisc->bstats);
- __gnet_stats_copy_queue(&sch->qstats,
- qdisc->cpu_qstats,
- &qdisc->qstats, qlen);
- sch->q.qlen += qlen;
- } else {
- sch->q.qlen += qdisc->q.qlen;
- sch->bstats.bytes += qdisc->bstats.bytes;
- sch->bstats.packets += qdisc->bstats.packets;
- sch->qstats.backlog += qdisc->qstats.backlog;
- sch->qstats.drops += qdisc->qstats.drops;
- sch->qstats.requeues += qdisc->qstats.requeues;
- sch->qstats.overlimits += qdisc->qstats.overlimits;
- }
+ qlen = qdisc_qlen_sum(qdisc);
+ __gnet_stats_copy_basic(NULL, &bstats, qdisc->cpu_bstats,
+ &qdisc->bstats);
+ __gnet_stats_copy_queue(&qstats, qdisc->cpu_qstats,
+ &qdisc->qstats, qlen);
+
+ sch->q.qlen += qdisc->q.qlen;
+ sch->bstats.bytes += bstats.bytes;
+ sch->bstats.packets += bstats.packets;
+ sch->qstats.qlen += qstats.qlen;
+ sch->qstats.backlog += qstats.backlog;
+ sch->qstats.drops += qstats.drops;
+ sch->qstats.requeues += qstats.requeues;
+ sch->qstats.overlimits += qstats.overlimits;
spin_unlock_bh(qdisc_lock(qdisc));
}