From: Tom Herbert <therbert@google.com>
To: davem@davemloft.net, netdev@vger.kernel.org,
eric.dumazet@gmail.com, fw@strlen.de
Subject: [PATCH net-next 2/6] sched: Eliminate use of flow_keys in sch_choke
Date: Wed, 4 Mar 2015 10:40:00 -0800 [thread overview]
Message-ID: <1425494404-24114-3-git-send-email-therbert@google.com> (raw)
In-Reply-To: <1425494404-24114-1-git-send-email-therbert@google.com>
In choke_match_flow compare skb_get_hash values for the skbuffs
instead of explicitly matching keys after calling flow_dissector.
Signed-off-by: Tom Herbert <therbert@google.com>
---
net/sched/sch_choke.c | 32 ++------------------------------
1 file changed, 2 insertions(+), 30 deletions(-)
diff --git a/net/sched/sch_choke.c b/net/sched/sch_choke.c
index c009eb9..8faa375 100644
--- a/net/sched/sch_choke.c
+++ b/net/sched/sch_choke.c
@@ -18,7 +18,6 @@
#include <net/pkt_sched.h>
#include <net/inet_ecn.h>
#include <net/red.h>
-#include <net/flow_keys.h>
/*
CHOKe stateless AQM for fair bandwidth allocation
@@ -133,16 +132,8 @@ static void choke_drop_by_idx(struct Qdisc *sch, unsigned int idx)
--sch->q.qlen;
}
-/* private part of skb->cb[] that a qdisc is allowed to use
- * is limited to QDISC_CB_PRIV_LEN bytes.
- * As a flow key might be too large, we store a part of it only.
- */
-#define CHOKE_K_LEN min_t(u32, sizeof(struct flow_keys), QDISC_CB_PRIV_LEN - 3)
-
struct choke_skb_cb {
u16 classid;
- u8 keys_valid;
- u8 keys[QDISC_CB_PRIV_LEN - 3];
};
static inline struct choke_skb_cb *choke_skb_cb(const struct sk_buff *skb)
@@ -169,26 +160,8 @@ static u16 choke_get_classid(const struct sk_buff *skb)
static bool choke_match_flow(struct sk_buff *skb1,
struct sk_buff *skb2)
{
- struct flow_keys temp;
-
- if (skb1->protocol != skb2->protocol)
- return false;
-
- if (!choke_skb_cb(skb1)->keys_valid) {
- choke_skb_cb(skb1)->keys_valid = 1;
- skb_flow_dissect(skb1, &temp);
- memcpy(&choke_skb_cb(skb1)->keys, &temp, CHOKE_K_LEN);
- }
-
- if (!choke_skb_cb(skb2)->keys_valid) {
- choke_skb_cb(skb2)->keys_valid = 1;
- skb_flow_dissect(skb2, &temp);
- memcpy(&choke_skb_cb(skb2)->keys, &temp, CHOKE_K_LEN);
- }
-
- return !memcmp(&choke_skb_cb(skb1)->keys,
- &choke_skb_cb(skb2)->keys,
- CHOKE_K_LEN);
+ return (skb1->protocol == skb2->protocol &&
+ skb_get_hash(skb1) == skb_get_hash(skb2));
}
/*
@@ -279,7 +252,6 @@ static int choke_enqueue(struct sk_buff *skb, struct Qdisc *sch)
goto other_drop; /* Packet was eaten by filter */
}
- choke_skb_cb(skb)->keys_valid = 0;
/* Compute average queue usage (see RED) */
q->vars.qavg = red_calc_qavg(p, &q->vars, sch->q.qlen);
if (red_is_idling(&q->vars))
--
2.2.0.rc0.207.ga3a616c
next prev parent reply other threads:[~2015-03-04 18:40 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-04 18:39 [PATCH net-next 0/6] net: Call skb_get_hash in qdiscs Tom Herbert
2015-03-04 18:39 ` [PATCH net-next 1/6] net: Add skb_get_hash_perturb Tom Herbert
2015-03-04 18:40 ` Tom Herbert [this message]
2015-03-04 18:40 ` [PATCH net-next 3/6] sched: Eliminate use of flow_keys in sch_fq_codel Tom Herbert
2015-03-04 18:40 ` [PATCH net-next 4/6] sched: Eliminate use of flow_keys in sch_hhf Tom Herbert
2015-03-04 18:40 ` [PATCH net-next 5/6] sched: Eliminate use of flow_keys in sch_sfb Tom Herbert
2015-03-04 18:40 ` [PATCH net-next 6/6] sched: Eliminate use of flow_keys in sch_sfq Tom Herbert
2015-03-04 20:03 ` [PATCH net-next 0/6] net: Call skb_get_hash in qdiscs Eric Dumazet
2015-03-04 21:49 ` Tom Herbert
2015-03-04 22:31 ` Eric Dumazet
2015-03-05 21:06 ` David Miller
2015-03-05 11:13 ` David Laight
2015-03-05 17:19 ` Tom Herbert
2015-03-05 17:59 ` Eric Dumazet
-- strict thread matches above, loose matches on Subject: below --
2015-03-01 22:09 [PATCH RFC net-next 0/6] net: Call skb_get_hash in net/sched Tom Herbert
2015-03-01 22:09 ` [PATCH net-next 2/6] sched: Eliminate use of flow_keys in sch_choke Tom Herbert
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=1425494404-24114-3-git-send-email-therbert@google.com \
--to=therbert@google.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=fw@strlen.de \
--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;
as well as URLs for NNTP newsgroup(s).