Skip to content

Commit c093875

Browse files
author
Herton R. Krzesinski
committed
Merge: net/sched: phase-2 backports for RHEL-9.2
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/1924 Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2162634 Upstream Status: All mainline in net.git. Tested: boot tested only Conflicts: None Signed-off-by: Davide Caratti <dcaratti@redhat.com> Approved-by: Marcelo Ricardo Leitner <mleitner@redhat.com> Approved-by: Xin Long <lxin@redhat.com> Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
2 parents 78220bc + 175f45b commit c093875

File tree

7 files changed

+38
-21
lines changed

7 files changed

+38
-21
lines changed

include/net/sch_generic.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,4 +1298,11 @@ void mq_change_real_num_tx(struct Qdisc *sch, unsigned int new_real_tx);
12981298

12991299
int sch_frag_xmit_hook(struct sk_buff *skb, int (*xmit)(struct sk_buff *skb));
13001300

1301+
/* Make sure qdisc is no longer in SCHED state. */
1302+
static inline void qdisc_synchronize(const struct Qdisc *q)
1303+
{
1304+
while (test_bit(__QDISC_STATE_SCHED, &q->state))
1305+
msleep(1);
1306+
}
1307+
13011308
#endif

net/sched/cls_tcindex.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base,
332332
struct tcindex_filter_result *r, struct nlattr **tb,
333333
struct nlattr *est, u32 flags, struct netlink_ext_ack *extack)
334334
{
335-
struct tcindex_filter_result new_filter_result, *old_r = r;
335+
struct tcindex_filter_result new_filter_result;
336336
struct tcindex_data *cp = NULL, *oldp;
337337
struct tcindex_filter *f = NULL; /* make gcc behave */
338338
struct tcf_result cr = {};
@@ -401,7 +401,7 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base,
401401
err = tcindex_filter_result_init(&new_filter_result, cp, net);
402402
if (err < 0)
403403
goto errout_alloc;
404-
if (old_r)
404+
if (r)
405405
cr = r->res;
406406

407407
err = -EBUSY;
@@ -478,14 +478,6 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base,
478478
tcf_bind_filter(tp, &cr, base);
479479
}
480480

481-
if (old_r && old_r != r) {
482-
err = tcindex_filter_result_init(old_r, cp, net);
483-
if (err < 0) {
484-
kfree(f);
485-
goto errout_alloc;
486-
}
487-
}
488-
489481
oldp = p;
490482
r->res = cr;
491483
tcf_exts_change(&r->exts, &e);

net/sched/sch_api.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,6 +1113,11 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
11131113
return -ENOENT;
11141114
}
11151115

1116+
if (new && new->ops == &noqueue_qdisc_ops) {
1117+
NL_SET_ERR_MSG(extack, "Cannot assign noqueue to a class");
1118+
return -EINVAL;
1119+
}
1120+
11161121
err = cops->graft(parent, cl, new, &old, extack);
11171122
if (err)
11181123
return err;

net/sched/sch_cake.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2224,8 +2224,12 @@ static struct sk_buff *cake_dequeue(struct Qdisc *sch)
22242224

22252225
static void cake_reset(struct Qdisc *sch)
22262226
{
2227+
struct cake_sched_data *q = qdisc_priv(sch);
22272228
u32 c;
22282229

2230+
if (!q->tins)
2231+
return;
2232+
22292233
for (c = 0; c < CAKE_MAX_TINS; c++)
22302234
cake_clear_tin(sch, c);
22312235
}

net/sched/sch_gred.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ static int gred_offload_dump_stats(struct Qdisc *sch)
377377
/* Even if driver returns failure adjust the stats - in case offload
378378
* ended but driver still wants to adjust the values.
379379
*/
380+
sch_tree_lock(sch);
380381
for (i = 0; i < MAX_DPs; i++) {
381382
if (!table->tab[i])
382383
continue;
@@ -393,6 +394,7 @@ static int gred_offload_dump_stats(struct Qdisc *sch)
393394
sch->qstats.overlimits += hw_stats->stats.qstats[i].overlimits;
394395
}
395396
_bstats_update(&sch->bstats, bytes, packets);
397+
sch_tree_unlock(sch);
396398

397399
kfree(hw_stats);
398400
return ret;

net/sched/sch_htb.c

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,22 +1566,25 @@ static int htb_destroy_class_offload(struct Qdisc *sch, struct htb_class *cl,
15661566
struct tc_htb_qopt_offload offload_opt;
15671567
struct netdev_queue *dev_queue;
15681568
struct Qdisc *q = cl->leaf.q;
1569-
struct Qdisc *old = NULL;
1569+
struct Qdisc *old;
15701570
int err;
15711571

15721572
if (cl->level)
15731573
return -EINVAL;
15741574

15751575
WARN_ON(!q);
15761576
dev_queue = htb_offload_get_queue(cl);
1577-
old = htb_graft_helper(dev_queue, NULL);
1578-
if (destroying)
1579-
/* Before HTB is destroyed, the kernel grafts noop_qdisc to
1580-
* all queues.
1577+
/* When destroying, caller qdisc_graft grafts the new qdisc and invokes
1578+
* qdisc_put for the qdisc being destroyed. htb_destroy_class_offload
1579+
* does not need to graft or qdisc_put the qdisc being destroyed.
1580+
*/
1581+
if (!destroying) {
1582+
old = htb_graft_helper(dev_queue, NULL);
1583+
/* Last qdisc grafted should be the same as cl->leaf.q when
1584+
* calling htb_delete.
15811585
*/
1582-
WARN_ON(!(old->flags & TCQ_F_BUILTIN));
1583-
else
15841586
WARN_ON(old != q);
1587+
}
15851588

15861589
if (cl->parent) {
15871590
_bstats_update(&cl->parent->bstats_bias,
@@ -1598,10 +1601,12 @@ static int htb_destroy_class_offload(struct Qdisc *sch, struct htb_class *cl,
15981601
};
15991602
err = htb_offload(qdisc_dev(sch), &offload_opt);
16001603

1601-
if (!err || destroying)
1602-
qdisc_put(old);
1603-
else
1604-
htb_graft_helper(dev_queue, old);
1604+
if (!destroying) {
1605+
if (!err)
1606+
qdisc_put(old);
1607+
else
1608+
htb_graft_helper(dev_queue, old);
1609+
}
16051610

16061611
if (last_child)
16071612
return err;

net/sched/sch_taprio.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,6 +1633,7 @@ static void taprio_reset(struct Qdisc *sch)
16331633
int i;
16341634

16351635
hrtimer_cancel(&q->advance_timer);
1636+
16361637
if (q->qdiscs) {
16371638
for (i = 0; i < dev->num_tx_queues; i++)
16381639
if (q->qdiscs[i])
@@ -1656,6 +1657,7 @@ static void taprio_destroy(struct Qdisc *sch)
16561657
* happens in qdisc_create(), after taprio_init() has been called.
16571658
*/
16581659
hrtimer_cancel(&q->advance_timer);
1660+
qdisc_synchronize(sch);
16591661

16601662
taprio_disable_offload(dev, q, NULL);
16611663

0 commit comments

Comments
 (0)