diff mbox series

[-next] net: sched: sch_skbprio: add support for qlen statistics of each priority in sch_skbprio

Message ID 20220825102745.70728-1-shaozhengchao@huawei.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [-next] net: sched: sch_skbprio: add support for qlen statistics of each priority in sch_skbprio | expand

Checks

Context Check Description
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 85 this patch: 85
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 85 this patch: 85
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 28 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

shaozhengchao Aug. 25, 2022, 10:27 a.m. UTC
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(+)

Comments

Jakub Kicinski Aug. 27, 2022, 2:46 a.m. UTC | #1
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++;
shaozhengchao Aug. 27, 2022, 4:20 a.m. UTC | #2
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
diff mbox series

Patch

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)) {