* [PATCH -next] net: sched: sch_skbprio: add support for qlen statistics of each priority in sch_skbprio
@ 2022-08-25 10:27 Zhengchao Shao
2022-08-27 2:46 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Zhengchao Shao @ 2022-08-25 10:27 UTC (permalink / raw)
To: netdev, linux-kernel, davem, edumazet, kuba, pabeni, jhs,
xiyou.wangcong, jiri
Cc: weiyongjun1, yuehaibing, shaozhengchao
The skbprio_dump_class_stats() gets the qlen of queues with the cl - 1
priority, but the qlen of each priority is not used in enqueue or dequeue
process.
Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
---
net/sched/sch_skbprio.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/sched/sch_skbprio.c b/net/sched/sch_skbprio.c
index 7a5e4c454715..fe2bb7bf9d2a 100644
--- a/net/sched/sch_skbprio.c
+++ b/net/sched/sch_skbprio.c
@@ -83,6 +83,7 @@ static int skbprio_enqueue(struct sk_buff *skb, struct Qdisc *sch,
__skb_queue_tail(qdisc, skb);
qdisc_qstats_backlog_inc(sch, skb);
q->qstats[prio].backlog += qdisc_pkt_len(skb);
+ q->qstats[prio].qlen++;
/* Check to update highest and lowest priorities. */
if (prio > q->highest_prio)
@@ -106,6 +107,7 @@ static int skbprio_enqueue(struct sk_buff *skb, struct Qdisc *sch,
__skb_queue_tail(qdisc, skb);
qdisc_qstats_backlog_inc(sch, skb);
q->qstats[prio].backlog += qdisc_pkt_len(skb);
+ q->qstats[prio].qlen++;
/* Drop the packet at the tail of the lowest priority qdisc. */
lp_qdisc = &q->qdiscs[lp];
@@ -115,6 +117,7 @@ static int skbprio_enqueue(struct sk_buff *skb, struct Qdisc *sch,
qdisc_drop(to_drop, sch, to_free);
q->qstats[lp].backlog -= qdisc_pkt_len(to_drop);
+ q->qstats[lp].qlen--;
q->qstats[lp].drops++;
q->qstats[lp].overlimits++;
@@ -150,6 +153,7 @@ static struct sk_buff *skbprio_dequeue(struct Qdisc *sch)
qdisc_bstats_update(sch, skb);
q->qstats[q->highest_prio].backlog -= qdisc_pkt_len(skb);
+ q->qstats[q->highest_prio].qlen--;
/* Update highest priority field. */
if (skb_queue_empty(hpq)) {
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH -next] net: sched: sch_skbprio: add support for qlen statistics of each priority in sch_skbprio
2022-08-25 10:27 [PATCH -next] net: sched: sch_skbprio: add support for qlen statistics of each priority in sch_skbprio Zhengchao Shao
@ 2022-08-27 2:46 ` Jakub Kicinski
2022-08-27 4:20 ` shaozhengchao
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2022-08-27 2:46 UTC (permalink / raw)
To: Zhengchao Shao
Cc: netdev, linux-kernel, davem, edumazet, pabeni, jhs,
xiyou.wangcong, jiri, weiyongjun1, yuehaibing
On Thu, 25 Aug 2022 18:27:45 +0800 Zhengchao Shao wrote:
> diff --git a/net/sched/sch_skbprio.c b/net/sched/sch_skbprio.c
> index 7a5e4c454715..fe2bb7bf9d2a 100644
> --- a/net/sched/sch_skbprio.c
> +++ b/net/sched/sch_skbprio.c
> @@ -83,6 +83,7 @@ static int skbprio_enqueue(struct sk_buff *skb, struct Qdisc *sch,
> __skb_queue_tail(qdisc, skb);
The skb queue called "qdisc" here (confusingly) already maintains
a length (also called qlen). Can we just access that variable instead
of maintaining the same value manually?
> qdisc_qstats_backlog_inc(sch, skb);
> q->qstats[prio].backlog += qdisc_pkt_len(skb);
> + q->qstats[prio].qlen++;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] net: sched: sch_skbprio: add support for qlen statistics of each priority in sch_skbprio
2022-08-27 2:46 ` Jakub Kicinski
@ 2022-08-27 4:20 ` shaozhengchao
0 siblings, 0 replies; 3+ messages in thread
From: shaozhengchao @ 2022-08-27 4:20 UTC (permalink / raw)
To: Jakub Kicinski
Cc: netdev, linux-kernel, davem, edumazet, pabeni, jhs,
xiyou.wangcong, jiri, weiyongjun1, yuehaibing
On 2022/8/27 10:46, Jakub Kicinski wrote:
> On Thu, 25 Aug 2022 18:27:45 +0800 Zhengchao Shao wrote:
>> diff --git a/net/sched/sch_skbprio.c b/net/sched/sch_skbprio.c
>> index 7a5e4c454715..fe2bb7bf9d2a 100644
>> --- a/net/sched/sch_skbprio.c
>> +++ b/net/sched/sch_skbprio.c
>> @@ -83,6 +83,7 @@ static int skbprio_enqueue(struct sk_buff *skb, struct Qdisc *sch,
>> __skb_queue_tail(qdisc, skb);
>
> The skb queue called "qdisc" here (confusingly) already maintains
> a length (also called qlen). Can we just access that variable instead
> of maintaining the same value manually?
>
>> qdisc_qstats_backlog_inc(sch, skb);
>> q->qstats[prio].backlog += qdisc_pkt_len(skb);
>> + q->qstats[prio].qlen++;
>
Hi Jakub:
Thank you for your reply. You are right, I have missed something. This
patch seems to be unnecessary.
Zhengchao Shao
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-27 4:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-25 10:27 [PATCH -next] net: sched: sch_skbprio: add support for qlen statistics of each priority in sch_skbprio Zhengchao Shao
2022-08-27 2:46 ` Jakub Kicinski
2022-08-27 4:20 ` shaozhengchao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).