Commit c19d893f authored by Zhengchao Shao's avatar Zhengchao Shao Committed by Paolo Abeni

net: sched: delete duplicate cleanup of backlog and qlen

qdisc_reset() is clearing qdisc->q.qlen and qdisc->qstats.backlog
_after_ calling qdisc->ops->reset. There is no need to clear them
again in the specific reset function.
Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
Link: https://lore.kernel.org/r/20220824005231.345727-1-shaozhengchao@huawei.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent ff763011
...@@ -1137,7 +1137,6 @@ static inline void __qdisc_reset_queue(struct qdisc_skb_head *qh) ...@@ -1137,7 +1137,6 @@ static inline void __qdisc_reset_queue(struct qdisc_skb_head *qh)
static inline void qdisc_reset_queue(struct Qdisc *sch) static inline void qdisc_reset_queue(struct Qdisc *sch)
{ {
__qdisc_reset_queue(&sch->q); __qdisc_reset_queue(&sch->q);
sch->qstats.backlog = 0;
} }
static inline struct Qdisc *qdisc_replace(struct Qdisc *sch, struct Qdisc *new, static inline struct Qdisc *qdisc_replace(struct Qdisc *sch, struct Qdisc *new,
......
...@@ -577,7 +577,6 @@ static void atm_tc_reset(struct Qdisc *sch) ...@@ -577,7 +577,6 @@ static void atm_tc_reset(struct Qdisc *sch)
pr_debug("atm_tc_reset(sch %p,[qdisc %p])\n", sch, p); pr_debug("atm_tc_reset(sch %p,[qdisc %p])\n", sch, p);
list_for_each_entry(flow, &p->flows, list) list_for_each_entry(flow, &p->flows, list)
qdisc_reset(flow->q); qdisc_reset(flow->q);
sch->q.qlen = 0;
} }
static void atm_tc_destroy(struct Qdisc *sch) static void atm_tc_destroy(struct Qdisc *sch)
......
...@@ -975,7 +975,6 @@ cbq_reset(struct Qdisc *sch) ...@@ -975,7 +975,6 @@ cbq_reset(struct Qdisc *sch)
cl->cpriority = cl->priority; cl->cpriority = cl->priority;
} }
} }
sch->q.qlen = 0;
} }
......
...@@ -315,8 +315,6 @@ static void choke_reset(struct Qdisc *sch) ...@@ -315,8 +315,6 @@ static void choke_reset(struct Qdisc *sch)
rtnl_qdisc_drop(skb, sch); rtnl_qdisc_drop(skb, sch);
} }
sch->q.qlen = 0;
sch->qstats.backlog = 0;
if (q->tab) if (q->tab)
memset(q->tab, 0, (q->tab_mask + 1) * sizeof(struct sk_buff *)); memset(q->tab, 0, (q->tab_mask + 1) * sizeof(struct sk_buff *));
q->head = q->tail = 0; q->head = q->tail = 0;
......
...@@ -441,8 +441,6 @@ static void drr_reset_qdisc(struct Qdisc *sch) ...@@ -441,8 +441,6 @@ static void drr_reset_qdisc(struct Qdisc *sch)
qdisc_reset(cl->qdisc); qdisc_reset(cl->qdisc);
} }
} }
sch->qstats.backlog = 0;
sch->q.qlen = 0;
} }
static void drr_destroy_qdisc(struct Qdisc *sch) static void drr_destroy_qdisc(struct Qdisc *sch)
......
...@@ -409,8 +409,6 @@ static void dsmark_reset(struct Qdisc *sch) ...@@ -409,8 +409,6 @@ static void dsmark_reset(struct Qdisc *sch)
pr_debug("%s(sch %p,[qdisc %p])\n", __func__, sch, p); pr_debug("%s(sch %p,[qdisc %p])\n", __func__, sch, p);
if (p->q) if (p->q)
qdisc_reset(p->q); qdisc_reset(p->q);
sch->qstats.backlog = 0;
sch->q.qlen = 0;
} }
static void dsmark_destroy(struct Qdisc *sch) static void dsmark_destroy(struct Qdisc *sch)
......
...@@ -445,9 +445,6 @@ static void etf_reset(struct Qdisc *sch) ...@@ -445,9 +445,6 @@ static void etf_reset(struct Qdisc *sch)
timesortedlist_clear(sch); timesortedlist_clear(sch);
__qdisc_reset_queue(&sch->q); __qdisc_reset_queue(&sch->q);
sch->qstats.backlog = 0;
sch->q.qlen = 0;
q->last = 0; q->last = 0;
} }
......
...@@ -727,8 +727,6 @@ static void ets_qdisc_reset(struct Qdisc *sch) ...@@ -727,8 +727,6 @@ static void ets_qdisc_reset(struct Qdisc *sch)
} }
for (band = 0; band < q->nbands; band++) for (band = 0; band < q->nbands; band++)
qdisc_reset(q->classes[band].qdisc); qdisc_reset(q->classes[band].qdisc);
sch->qstats.backlog = 0;
sch->q.qlen = 0;
} }
static void ets_qdisc_destroy(struct Qdisc *sch) static void ets_qdisc_destroy(struct Qdisc *sch)
......
...@@ -347,8 +347,6 @@ static void fq_codel_reset(struct Qdisc *sch) ...@@ -347,8 +347,6 @@ static void fq_codel_reset(struct Qdisc *sch)
codel_vars_init(&flow->cvars); codel_vars_init(&flow->cvars);
} }
memset(q->backlogs, 0, q->flows_cnt * sizeof(u32)); memset(q->backlogs, 0, q->flows_cnt * sizeof(u32));
sch->q.qlen = 0;
sch->qstats.backlog = 0;
q->memory_usage = 0; q->memory_usage = 0;
} }
......
...@@ -521,9 +521,6 @@ static void fq_pie_reset(struct Qdisc *sch) ...@@ -521,9 +521,6 @@ static void fq_pie_reset(struct Qdisc *sch)
INIT_LIST_HEAD(&flow->flowchain); INIT_LIST_HEAD(&flow->flowchain);
pie_vars_init(&flow->vars); pie_vars_init(&flow->vars);
} }
sch->q.qlen = 0;
sch->qstats.backlog = 0;
} }
static void fq_pie_destroy(struct Qdisc *sch) static void fq_pie_destroy(struct Qdisc *sch)
......
...@@ -1484,8 +1484,6 @@ hfsc_reset_qdisc(struct Qdisc *sch) ...@@ -1484,8 +1484,6 @@ hfsc_reset_qdisc(struct Qdisc *sch)
} }
q->eligible = RB_ROOT; q->eligible = RB_ROOT;
qdisc_watchdog_cancel(&q->watchdog); qdisc_watchdog_cancel(&q->watchdog);
sch->qstats.backlog = 0;
sch->q.qlen = 0;
} }
static void static void
......
...@@ -1008,8 +1008,6 @@ static void htb_reset(struct Qdisc *sch) ...@@ -1008,8 +1008,6 @@ static void htb_reset(struct Qdisc *sch)
} }
qdisc_watchdog_cancel(&q->watchdog); qdisc_watchdog_cancel(&q->watchdog);
__qdisc_reset_queue(&q->direct_queue); __qdisc_reset_queue(&q->direct_queue);
sch->q.qlen = 0;
sch->qstats.backlog = 0;
memset(q->hlevel, 0, sizeof(q->hlevel)); memset(q->hlevel, 0, sizeof(q->hlevel));
memset(q->row_mask, 0, sizeof(q->row_mask)); memset(q->row_mask, 0, sizeof(q->row_mask));
} }
......
...@@ -152,7 +152,6 @@ multiq_reset(struct Qdisc *sch) ...@@ -152,7 +152,6 @@ multiq_reset(struct Qdisc *sch)
for (band = 0; band < q->bands; band++) for (band = 0; band < q->bands; band++)
qdisc_reset(q->queues[band]); qdisc_reset(q->queues[band]);
sch->q.qlen = 0;
q->curband = 0; q->curband = 0;
} }
......
...@@ -135,8 +135,6 @@ prio_reset(struct Qdisc *sch) ...@@ -135,8 +135,6 @@ prio_reset(struct Qdisc *sch)
for (prio = 0; prio < q->bands; prio++) for (prio = 0; prio < q->bands; prio++)
qdisc_reset(q->queues[prio]); qdisc_reset(q->queues[prio]);
sch->qstats.backlog = 0;
sch->q.qlen = 0;
} }
static int prio_offload(struct Qdisc *sch, struct tc_prio_qopt *qopt) static int prio_offload(struct Qdisc *sch, struct tc_prio_qopt *qopt)
......
...@@ -1458,8 +1458,6 @@ static void qfq_reset_qdisc(struct Qdisc *sch) ...@@ -1458,8 +1458,6 @@ static void qfq_reset_qdisc(struct Qdisc *sch)
qdisc_reset(cl->qdisc); qdisc_reset(cl->qdisc);
} }
} }
sch->qstats.backlog = 0;
sch->q.qlen = 0;
} }
static void qfq_destroy_qdisc(struct Qdisc *sch) static void qfq_destroy_qdisc(struct Qdisc *sch)
......
...@@ -176,8 +176,6 @@ static void red_reset(struct Qdisc *sch) ...@@ -176,8 +176,6 @@ static void red_reset(struct Qdisc *sch)
struct red_sched_data *q = qdisc_priv(sch); struct red_sched_data *q = qdisc_priv(sch);
qdisc_reset(q->qdisc); qdisc_reset(q->qdisc);
sch->qstats.backlog = 0;
sch->q.qlen = 0;
red_restart(&q->vars); red_restart(&q->vars);
} }
......
...@@ -453,8 +453,6 @@ static void sfb_reset(struct Qdisc *sch) ...@@ -453,8 +453,6 @@ static void sfb_reset(struct Qdisc *sch)
struct sfb_sched_data *q = qdisc_priv(sch); struct sfb_sched_data *q = qdisc_priv(sch);
qdisc_reset(q->qdisc); qdisc_reset(q->qdisc);
sch->qstats.backlog = 0;
sch->q.qlen = 0;
q->slot = 0; q->slot = 0;
q->double_buffering = false; q->double_buffering = false;
sfb_zero_all_buckets(q); sfb_zero_all_buckets(q);
......
...@@ -213,9 +213,6 @@ static void skbprio_reset(struct Qdisc *sch) ...@@ -213,9 +213,6 @@ static void skbprio_reset(struct Qdisc *sch)
struct skbprio_sched_data *q = qdisc_priv(sch); struct skbprio_sched_data *q = qdisc_priv(sch);
int prio; int prio;
sch->qstats.backlog = 0;
sch->q.qlen = 0;
for (prio = 0; prio < SKBPRIO_MAX_PRIORITY; prio++) for (prio = 0; prio < SKBPRIO_MAX_PRIORITY; prio++)
__skb_queue_purge(&q->qdiscs[prio]); __skb_queue_purge(&q->qdiscs[prio]);
......
...@@ -1636,8 +1636,6 @@ static void taprio_reset(struct Qdisc *sch) ...@@ -1636,8 +1636,6 @@ static void taprio_reset(struct Qdisc *sch)
if (q->qdiscs[i]) if (q->qdiscs[i])
qdisc_reset(q->qdiscs[i]); qdisc_reset(q->qdiscs[i]);
} }
sch->qstats.backlog = 0;
sch->q.qlen = 0;
} }
static void taprio_destroy(struct Qdisc *sch) static void taprio_destroy(struct Qdisc *sch)
......
...@@ -330,8 +330,6 @@ static void tbf_reset(struct Qdisc *sch) ...@@ -330,8 +330,6 @@ static void tbf_reset(struct Qdisc *sch)
struct tbf_sched_data *q = qdisc_priv(sch); struct tbf_sched_data *q = qdisc_priv(sch);
qdisc_reset(q->qdisc); qdisc_reset(q->qdisc);
sch->qstats.backlog = 0;
sch->q.qlen = 0;
q->t_c = ktime_get_ns(); q->t_c = ktime_get_ns();
q->tokens = q->buffer; q->tokens = q->buffer;
q->ptokens = q->mtu; q->ptokens = q->mtu;
......
...@@ -124,7 +124,6 @@ teql_reset(struct Qdisc *sch) ...@@ -124,7 +124,6 @@ teql_reset(struct Qdisc *sch)
struct teql_sched_data *dat = qdisc_priv(sch); struct teql_sched_data *dat = qdisc_priv(sch);
skb_queue_purge(&dat->q); skb_queue_purge(&dat->q);
sch->q.qlen = 0;
} }
static void static void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment