Skip to content

Commit

Permalink
net/sched: taprio: avoid calling child->ops->dequeue(child) twice
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Vladimir Oltean authored and David S. Miller committed Feb 8, 2023
1 parent 92f9666 commit 4c22942
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions net/sched/sch_taprio.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,12 +528,8 @@ static struct sk_buff *taprio_dequeue_from_txq(struct Qdisc *sch, int txq,
if (unlikely(!child))
return NULL;

if (TXTIME_ASSIST_IS_ENABLED(q->flags)) {
skb = child->ops->dequeue(child);
if (!skb)
return NULL;
goto skb_found;
}
if (TXTIME_ASSIST_IS_ENABLED(q->flags))
goto skip_peek_checks;

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

skip_peek_checks:
skb = child->ops->dequeue(child);
if (unlikely(!skb))
return NULL;

skb_found:
qdisc_bstats_update(sch, skb);
qdisc_qstats_backlog_dec(sch, skb);
sch->q.qlen--;
Expand Down

0 comments on commit 4c22942

Please sign in to comment.