Commit 6b3efbfa authored by Petr Machata's avatar Petr Machata Committed by David S. Miller
Browse files

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: default avatarPetr Machata <petrm@nvidia.com>
Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent aaa55706
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -977,6 +977,7 @@ enum tc_tbf_command {
	TC_TBF_REPLACE,
	TC_TBF_DESTROY,
	TC_TBF_STATS,
	TC_TBF_GRAFT,
};

struct tc_tbf_qopt_offload_replace_params {
@@ -992,6 +993,7 @@ struct tc_tbf_qopt_offload {
	union {
		struct tc_tbf_qopt_offload_replace_params replace_params;
		struct tc_qopt_offload_stats stats;
		u32 child_handle;
	};
};

+16 −0
Original line number Diff line number Diff line
@@ -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;
}