All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@idosch.org>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, jiri@nvidia.com,
	petrm@nvidia.com, jhs@mojatatu.com, xiyou.wangcong@gmail.com,
	mlxsw@nvidia.com, Ido Schimmel <idosch@nvidia.com>
Subject: [PATCH net-next 1/9] net: sch_tbf: Add a graft command
Date: Tue, 19 Oct 2021 11:07:04 +0300	[thread overview]
Message-ID: <20211019080712.705464-2-idosch@idosch.org> (raw)
In-Reply-To: <20211019080712.705464-1-idosch@idosch.org>

From: Petr Machata <petrm@nvidia.com>

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>
---
 include/net/pkt_cls.h |  2 ++
 net/sched/sch_tbf.c   | 16 ++++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index 4a5833108083..193f88ebf629 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -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;
 	};
 };
 
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;
 }
 
-- 
2.31.1


  reply	other threads:[~2021-10-19  8:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-19  8:07 [PATCH net-next 0/9] mlxsw: Multi-level qdisc offload Ido Schimmel
2021-10-19  8:07 ` Ido Schimmel [this message]
2021-10-19  8:07 ` [PATCH net-next 2/9] mlxsw: spectrum_qdisc: Query tclass / priomap instead of caching it Ido Schimmel
2021-10-19  8:07 ` [PATCH net-next 3/9] mlxsw: spectrum_qdisc: Extract two helpers for handling future FIFOs Ido Schimmel
2021-10-19  8:07 ` [PATCH net-next 4/9] mlxsw: spectrum_qdisc: Destroy children in mlxsw_sp_qdisc_destroy() Ido Schimmel
2021-10-19  8:07 ` [PATCH net-next 5/9] mlxsw: spectrum_qdisc: Unify graft validation Ido Schimmel
2021-10-19  8:07 ` [PATCH net-next 6/9] mlxsw: spectrum_qdisc: Clean stats recursively when priomap changes Ido Schimmel
2021-10-19  8:07 ` [PATCH net-next 7/9] mlxsw: spectrum_qdisc: Validate qdisc topology Ido Schimmel
2021-10-19  8:07 ` [PATCH net-next 8/9] mlxsw: spectrum_qdisc: Make RED, TBF offloads classful Ido Schimmel
2021-10-19  8:07 ` [PATCH net-next 9/9] selftests: mlxsw: Add a test for un/offloadable qdisc trees Ido Schimmel
2021-10-19 11:30 ` [PATCH net-next 0/9] mlxsw: Multi-level qdisc offload patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211019080712.705464-2-idosch@idosch.org \
    --to=idosch@idosch.org \
    --cc=davem@davemloft.net \
    --cc=idosch@nvidia.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=mlxsw@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=petrm@nvidia.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.