summaryrefslogtreecommitdiff
path: root/net/sched/sch_tbf.c
diff options
context:
space:
mode:
authorPetr Machata <petrm@nvidia.com>2021-10-19 11:07:04 +0300
committerDavid S. Miller <davem@davemloft.net>2021-10-19 14:24:51 +0300
commit6b3efbfa4e68d84e6efbcd1ff4e98f5ba1da4307 (patch)
tree721b4a5c0bc8240264f5359690b3643b46bbb9da /net/sched/sch_tbf.c
parentaaa5570612b1f1b9e4841ec54163bdeec1f451e7 (diff)
downloadlinux-6b3efbfa4e68d84e6efbcd1ff4e98f5ba1da4307.tar.xz
net: sch_tbf: Add a graft command
As another qdisc is linked to the TBF, the latter should issue an event to give drivers a chance to react to the grafting. In other qdiscs, this event is called GRAFT, so follow suit with TBF as well. Signed-off-by: Petr Machata <petrm@nvidia.com> Signed-off-by: Ido Schimmel <idosch@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_tbf.c')
-rw-r--r--net/sched/sch_tbf.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index 78e79029dc63..72102277449e 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -184,6 +184,20 @@ static int tbf_offload_dump(struct Qdisc *sch)
return qdisc_offload_dump_helper(sch, TC_SETUP_QDISC_TBF, &qopt);
}
+static void tbf_offload_graft(struct Qdisc *sch, struct Qdisc *new,
+ struct Qdisc *old, struct netlink_ext_ack *extack)
+{
+ struct tc_tbf_qopt_offload graft_offload = {
+ .handle = sch->handle,
+ .parent = sch->parent,
+ .child_handle = new->handle,
+ .command = TC_TBF_GRAFT,
+ };
+
+ qdisc_offload_graft_helper(qdisc_dev(sch), sch, new, old,
+ TC_SETUP_QDISC_TBF, &graft_offload, extack);
+}
+
/* GSO packet is too big, segment it so that tbf can transmit
* each segment in time
*/
@@ -547,6 +561,8 @@ static int tbf_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
new = &noop_qdisc;
*old = qdisc_replace(sch, new, &q->qdisc);
+
+ tbf_offload_graft(sch, new, *old, extack);
return 0;
}