Message ID | 20190107194733.31138-4-toke@toke.dk |
---|---|
State | Changes Requested |
Delegated to: | David Miller |
Headers | show |
Series | sched: Fix qdisc interactions exposed by using sch_cake as a leaf qdisc | expand |
On 01/07/2019 11:47 AM, Toke Høiland-Jørgensen wrote: > From: Toke Høiland-Jørgensen <toke@redhat.com> > > With GSO splitting in sch_cake, we can decrease as well as increase the > qlen. To make it possible to signal this up the qdisc tree, change > qdisc_tree_reduce_backlog() to accept signed integer values as the number > of packets and bytes to reduce the backlog by. Not sure why this patch is needed, given we use u32 integers for q.qlen & qstats.backlog 0xFFFFFFFF for n is really -1 once folded... sch->q.qlen -= n; sch->qstats.backlog -= len;
Eric Dumazet <eric.dumazet@gmail.com> writes: > On 01/07/2019 11:47 AM, Toke Høiland-Jørgensen wrote: >> From: Toke Høiland-Jørgensen <toke@redhat.com> >> >> With GSO splitting in sch_cake, we can decrease as well as increase the >> qlen. To make it possible to signal this up the qdisc tree, change >> qdisc_tree_reduce_backlog() to accept signed integer values as the number >> of packets and bytes to reduce the backlog by. > > > Not sure why this patch is needed, given we use u32 integers > for q.qlen & qstats.backlog > > 0xFFFFFFFF for n is really -1 once folded... > > sch->q.qlen -= n; > sch->qstats.backlog -= len; Sure, it works without the patch, but changing to int properly communicates the intent (that negative values are allowed) rather than rely on overflow behaviour... -Toke
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 9481f2c142e2..7a4957599874 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -580,8 +580,7 @@ struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue, void qdisc_reset(struct Qdisc *qdisc); void qdisc_put(struct Qdisc *qdisc); void qdisc_put_unlocked(struct Qdisc *qdisc); -void qdisc_tree_reduce_backlog(struct Qdisc *qdisc, unsigned int n, - unsigned int len); +void qdisc_tree_reduce_backlog(struct Qdisc *qdisc, int n, int len); #ifdef CONFIG_NET_SCHED int qdisc_offload_dump_helper(struct Qdisc *q, enum tc_setup_type type, void *type_data); diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 7e4d1ccf4c87..03e26e8d0ec9 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c @@ -758,8 +758,7 @@ static u32 qdisc_alloc_handle(struct net_device *dev) return 0; } -void qdisc_tree_reduce_backlog(struct Qdisc *sch, unsigned int n, - unsigned int len) +void qdisc_tree_reduce_backlog(struct Qdisc *sch, int n, int len) { bool qdisc_is_offloaded = sch->flags & TCQ_F_OFFLOADED; const struct Qdisc_class_ops *cops;