Netdev List
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: davem@davemloft.net
Cc: oss-drivers@netronome.com, netdev@vger.kernel.org,
	jiri@resnulli.us, xiyou.wangcong@gmail.com, jhs@mojatatu.com,
	Jakub Kicinski <jakub.kicinski@netronome.com>
Subject: [PATCH net-next 07/13] net: sched: red: offload a graft notification
Date: Mon, 12 Nov 2018 14:58:13 -0800	[thread overview]
Message-ID: <20181112225819.29823-8-jakub.kicinski@netronome.com> (raw)
In-Reply-To: <20181112225819.29823-1-jakub.kicinski@netronome.com>

Drivers offloading Qdiscs should have reasonable certainty
the offloaded behaviour matches the SW path.  This is impossible
if the driver does not know about all Qdiscs or when Qdiscs move
and are reused.  Send a graft notification from RED.  The drivers
are expected to simply stop offloading the Qdisc, if a non-standard
child is ever grafted onto it.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: John Hurley <john.hurley@netronome.com>
---
 include/net/pkt_cls.h |  2 ++
 net/sched/sch_red.c   | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index fa31d034231d..01f2802b7aee 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -834,6 +834,7 @@ enum tc_red_command {
 	TC_RED_DESTROY,
 	TC_RED_STATS,
 	TC_RED_XSTATS,
+	TC_RED_GRAFT,
 };
 
 struct tc_red_qopt_offload_params {
@@ -853,6 +854,7 @@ struct tc_red_qopt_offload {
 		struct tc_red_qopt_offload_params set;
 		struct tc_qopt_offload_stats stats;
 		struct red_stats *xstats;
+		u32 child_handle;
 	};
 };
 
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c
index a1d08bdd9357..4b5ca172ee2d 100644
--- a/net/sched/sch_red.c
+++ b/net/sched/sch_red.c
@@ -367,6 +367,21 @@ static int red_dump_class(struct Qdisc *sch, unsigned long cl,
 	return 0;
 }
 
+static void red_graft_offload(struct Qdisc *sch,
+			      struct Qdisc *new, struct Qdisc *old,
+			      struct netlink_ext_ack *extack)
+{
+	struct tc_red_qopt_offload graft_offload = {
+		.handle		= sch->handle,
+		.parent		= sch->parent,
+		.child_handle	= new->handle,
+		.command	= TC_RED_GRAFT,
+	};
+
+	qdisc_offload_graft_helper(qdisc_dev(sch), sch, new, old,
+				   TC_SETUP_QDISC_RED, &graft_offload, extack);
+}
+
 static int red_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
 		     struct Qdisc **old, struct netlink_ext_ack *extack)
 {
@@ -376,6 +391,8 @@ static int red_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
 		new = &noop_qdisc;
 
 	*old = qdisc_replace(sch, new, &q->qdisc);
+
+	red_graft_offload(sch, new, *old, extack);
 	return 0;
 }
 
-- 
2.17.1

  parent reply	other threads:[~2018-11-13  8:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-12 22:58 [PATCH net-next 00/13] nfp: abm: track all Qdiscs Jakub Kicinski
2018-11-12 22:58 ` [PATCH net-next 01/13] nfp: abm: rename qdiscs -> red_qdiscs Jakub Kicinski
2018-11-12 22:58 ` [PATCH net-next 02/13] nfp: abm: keep track of all RED thresholds Jakub Kicinski
2018-11-12 22:58 ` [PATCH net-next 03/13] nfp: abm: track all offload-enabled qdiscs Jakub Kicinski
2018-11-12 22:58 ` [PATCH net-next 04/13] net: sched: provide notification for graft on root Jakub Kicinski
2018-11-12 22:58 ` [PATCH net-next 05/13] nfp: abm: remember which Qdisc is root Jakub Kicinski
2018-11-12 22:58 ` [PATCH net-next 06/13] nfp: abm: allocate Qdisc child table Jakub Kicinski
2018-11-12 22:58 ` Jakub Kicinski [this message]
2018-11-12 22:58 ` [PATCH net-next 08/13] net: sched: mq: offload a graft notification Jakub Kicinski
2018-11-12 22:58 ` [PATCH net-next 09/13] nfp: abm: build full Qdisc hierarchy based on graft notifications Jakub Kicinski
2018-11-12 22:58 ` [PATCH net-next 10/13] net: sched: red: notify drivers about RED's limit parameter Jakub Kicinski
2018-11-12 22:58 ` [PATCH net-next 11/13] nfp: abm: reset RED's child based on limit Jakub Kicinski
2018-11-12 22:58 ` [PATCH net-next 12/13] nfp: abm: save RED's parameters Jakub Kicinski
2018-11-12 22:58 ` [PATCH net-next 13/13] nfp: abm: restructure Qdisc handling Jakub Kicinski
2018-11-14 16:53 ` [PATCH net-next 00/13] nfp: abm: track all Qdiscs David Miller

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=20181112225819.29823-8-jakub.kicinski@netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=davem@davemloft.net \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@netronome.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox