Skip to content

Commit 4c22942

Browse files
vladimirolteandavem330
authored andcommitted
net/sched: taprio: avoid calling child->ops->dequeue(child) twice
Simplify taprio_dequeue_from_txq() by noticing that we can goto one call earlier than the previous skb_found label. This is possible because we've unified the treatment of the child->ops->dequeue(child) return call, we always try other TXQs now, instead of abandoning the root dequeue completely if we failed in the peek() case. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Kurt Kanzenbach <kurt@linutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 92f9666 commit 4c22942

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

net/sched/sch_taprio.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -528,12 +528,8 @@ static struct sk_buff *taprio_dequeue_from_txq(struct Qdisc *sch, int txq,
528528
if (unlikely(!child))
529529
return NULL;
530530

531-
if (TXTIME_ASSIST_IS_ENABLED(q->flags)) {
532-
skb = child->ops->dequeue(child);
533-
if (!skb)
534-
return NULL;
535-
goto skb_found;
536-
}
531+
if (TXTIME_ASSIST_IS_ENABLED(q->flags))
532+
goto skip_peek_checks;
537533

538534
skb = child->ops->peek(child);
539535
if (!skb)
@@ -560,11 +556,11 @@ static struct sk_buff *taprio_dequeue_from_txq(struct Qdisc *sch, int txq,
560556
atomic_sub_return(len, &entry->budget) < 0)
561557
return NULL;
562558

559+
skip_peek_checks:
563560
skb = child->ops->dequeue(child);
564561
if (unlikely(!skb))
565562
return NULL;
566563

567-
skb_found:
568564
qdisc_bstats_update(sch, skb);
569565
qdisc_qstats_backlog_dec(sch, skb);
570566
sch->q.qlen--;

0 commit comments

Comments
 (0)