Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Petr Machata and committed by
David S. Miller
6b3efbfa aaa55706

+18
+2
include/net/pkt_cls.h
··· 977 977 TC_TBF_REPLACE, 978 978 TC_TBF_DESTROY, 979 979 TC_TBF_STATS, 980 + TC_TBF_GRAFT, 980 981 }; 981 982 982 983 struct tc_tbf_qopt_offload_replace_params { ··· 993 992 union { 994 993 struct tc_tbf_qopt_offload_replace_params replace_params; 995 994 struct tc_qopt_offload_stats stats; 995 + u32 child_handle; 996 996 }; 997 997 }; 998 998
+16
net/sched/sch_tbf.c
··· 184 184 return qdisc_offload_dump_helper(sch, TC_SETUP_QDISC_TBF, &qopt); 185 185 } 186 186 187 + static void tbf_offload_graft(struct Qdisc *sch, struct Qdisc *new, 188 + struct Qdisc *old, struct netlink_ext_ack *extack) 189 + { 190 + struct tc_tbf_qopt_offload graft_offload = { 191 + .handle = sch->handle, 192 + .parent = sch->parent, 193 + .child_handle = new->handle, 194 + .command = TC_TBF_GRAFT, 195 + }; 196 + 197 + qdisc_offload_graft_helper(qdisc_dev(sch), sch, new, old, 198 + TC_SETUP_QDISC_TBF, &graft_offload, extack); 199 + } 200 + 187 201 /* GSO packet is too big, segment it so that tbf can transmit 188 202 * each segment in time 189 203 */ ··· 561 547 new = &noop_qdisc; 562 548 563 549 *old = qdisc_replace(sch, new, &q->qdisc); 550 + 551 + tbf_offload_graft(sch, new, *old, extack); 564 552 return 0; 565 553 } 566 554