From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, cake@lists.bufferbloat.net
Subject: [Cake] [PATCH net-next 3/5] sch_cake: don't call diffserv parsing code when it is not needed
Date: Thu, 25 Jun 2020 13:55:06 +0200 [thread overview]
Message-ID: <159308610609.190211.12172433725292686379.stgit@toke.dk> (raw)
In-Reply-To: <159308610282.190211.9431406149182757758.stgit@toke.dk>
From: Toke Høiland-Jørgensen <toke@redhat.com>
As a further optimisation of the diffserv parsing codepath, we can skip it
entirely if CAKE is neither configured to use diffserv-based
classification, nor to zero out the diffserv bits.
Fixes: c87b4ecdbe8d ("sch_cake: Make sure we can write the IP header before changing DSCP bits")
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
---
net/sched/sch_cake.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c
index cebcc36755ac..958523c777be 100644
--- a/net/sched/sch_cake.c
+++ b/net/sched/sch_cake.c
@@ -1597,7 +1597,7 @@ static unsigned int cake_drop(struct Qdisc *sch, struct sk_buff **to_free)
return idx + (tin << 16);
}
-static u8 cake_handle_diffserv(struct sk_buff *skb, u16 wash)
+static u8 cake_handle_diffserv(struct sk_buff *skb, bool wash)
{
const int offset = skb_network_offset(skb);
u16 *buf, buf_;
@@ -1658,14 +1658,17 @@ static struct cake_tin_data *cake_select_tin(struct Qdisc *sch,
{
struct cake_sched_data *q = qdisc_priv(sch);
u32 tin, mark;
+ bool wash;
u8 dscp;
/* Tin selection: Default to diffserv-based selection, allow overriding
- * using firewall marks or skb->priority.
+ * using firewall marks or skb->priority. Call DSCP parsing early if
+ * wash is enabled, otherwise defer to below to skip unneeded parsing.
*/
- dscp = cake_handle_diffserv(skb,
- q->rate_flags & CAKE_FLAG_WASH);
mark = (skb->mark & q->fwmark_mask) >> q->fwmark_shft;
+ wash = !!(q->rate_flags & CAKE_FLAG_WASH);
+ if (wash)
+ dscp = cake_handle_diffserv(skb, wash);
if (q->tin_mode == CAKE_DIFFSERV_BESTEFFORT)
tin = 0;
@@ -1679,6 +1682,8 @@ static struct cake_tin_data *cake_select_tin(struct Qdisc *sch,
tin = q->tin_order[TC_H_MIN(skb->priority) - 1];
else {
+ if (!wash)
+ dscp = cake_handle_diffserv(skb, wash);
tin = q->tin_index[dscp];
if (unlikely(tin >= q->tin_cnt))
next prev parent reply other threads:[~2020-06-25 11:55 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-25 11:55 [Cake] [PATCH net-next 0/5] sched: A series of fixes and optimisations for sch_cake Toke Høiland-Jørgensen
2020-06-25 11:55 ` [Cake] [PATCH net-next 1/5] sch_cake: fix IP protocol handling in the presence of VLAN tags Toke Høiland-Jørgensen
2020-06-25 19:29 ` David Miller
2020-06-25 19:53 ` Toke Høiland-Jørgensen
2020-06-25 20:00 ` David Miller
2020-06-26 8:27 ` Davide Caratti
2020-06-26 12:52 ` Toke Høiland-Jørgensen
2020-06-26 14:01 ` Jamal Hadi Salim
2020-06-26 18:52 ` Davide Caratti
2020-06-29 10:27 ` Toke Høiland-Jørgensen
2020-06-26 13:11 ` Jonathan Morton
2020-06-26 14:59 ` Sebastian Moeller
2020-06-26 16:36 ` Jonathan Morton
2020-06-26 22:00 ` Stephen Hemminger
2020-06-25 11:55 ` [Cake] [PATCH net-next 2/5] sch_cake: don't try to reallocate or unshare skb unconditionally Toke Høiland-Jørgensen
2020-06-25 11:55 ` Toke Høiland-Jørgensen [this message]
2020-06-25 11:55 ` [Cake] [PATCH net-next 4/5] sch_cake: add RFC 8622 LE PHB support to CAKE diffserv handling Toke Høiland-Jørgensen
2020-06-25 11:55 ` [Cake] [PATCH net-next 5/5] sch_cake: fix a few style nits Toke Høiland-Jørgensen
2020-06-25 19:31 ` [Cake] [PATCH net-next 0/5] sched: A series of fixes and optimisations for sch_cake David Miller
2020-06-25 19:49 ` Toke Høiland-Jørgensen
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
List information: https://lists.bufferbloat.net/postorius/lists/cake.lists.bufferbloat.net/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=159308610609.190211.12172433725292686379.stgit@toke.dk \
--to=toke@redhat.com \
--cc=cake@lists.bufferbloat.net \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/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